1
0
forked from sent/waves
waves/public/assets/g/badicecream3/js/BadIceCream.js
2025-04-09 17:11:14 -05:00

1 line
2.5 MiB

!function(){"use strict";var extendStatics=function(t,e){return(extendStatics=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(t,e)},CompressionMethod,m;function __extends(t,e){function i(){this.constructor=t}extendStatics(t,e),t.prototype=null===e?Object.create(e):(i.prototype=e.prototype,new i)}m=CompressionMethod=CompressionMethod||{},m[m.None=0]="None",m[m.Deflate=1]="Deflate",m[m.LZMA=2]="LZMA";var SWFFile=(n.prototype.mapSWFVersionToFPVersion=function(){var t={6:"FP6",7:"FP7",8:"FP8",9:"FP9",10:"FP10",11:"FP10_2",12:"FP10_3",13:"FP11_0",14:"FP11_1",15:"FP11_2",16:"FP11_3",17:"FP11_4",18:"FP11_5",19:"FP11_6",20:"FP11_7",21:"FP11_8",22:"FP11_9",23:"FP12",24:"FP13",25:"FP14",26:"FP15",27:"FP16",28:"FP17",29:"FP18",30:"FP19",31:"FP20",32:"FP21",33:"FP22",34:"FP23",35:"FP24",36:"FP25",37:"FP26",38:"FP27",39:"FP28",40:"FP29",41:"FP30",42:"FP31"};this.fpVersion=t[this.swfVersion]?t[this.swfVersion]:"unmappedSWFVersion:"+this.swfVersion},n),ErrorBase=(Object.defineProperty(p.prototype,"message",{get:function(){return this._messsage},set:function(t){this._messsage=t},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"errorID",{get:function(){return this._errorID},enumerable:!0,configurable:!0}),p),AbstractMethodError=(v=ErrorBase,__extends(w,v),w),EventBase=(z.prototype.clone=function(){return new z(this.type)},z),AssetEvent=(B=EventBase,__extends(C,B),Object.defineProperty(C.prototype,"asset",{get:function(){return this._asset},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"prevName",{get:function(){return this._prevName},enumerable:!0,configurable:!0}),C.prototype.clone=function(){return new C(this.type,this._asset,this._prevName)},C.INVALIDATE="invalidate",C.CLEAR="clear",C.RENAME="rename",C.ENTER_FRAME="enterFrame",C.EXIT_FRAME="exitFrame",C.ASSET_CONFLICT_RESOLVED="assetConflictResolved",C.ASSET_COMPLETE="assetComplete",C.TEXTURE_SIZE_ERROR="textureSizeError",C),EventDispatcher=(I.prototype.addEventListener=function(t,e){var i=this._listenerObjects[t];void 0===i&&(i=this._listenerObjects[t]=new ListenerObject),i.addEventListener(e)},I.prototype.removeEventListener=function(t,e){var i=this._listenerObjects[t];i&&(i.removeEventListener(e),0==i.numListeners&&delete this._listenerObjects[t])},I.prototype.dispatchEvent=function(t){var e=this._listenerObjects[t.type];e&&(t.target=this._t,e.dispatchEvent(t))},I.prototype.hasEventListener=function(t,e){return void 0!==this._listenerObjects[t]&&(null!=e?-1!==this._listenerObjects[t].getEventListenerIndex(e):0<this._listenerObjects[t].numListeners)},I),ListenerObject=(V.prototype.addEventListener=function(t){-1===this._listeners.indexOf(t)&&(this._listeners.push(t),this.numListeners++)},V.prototype.removeEventListener=function(t){var e=this._listeners.indexOf(t);-1!==e&&(this._listeners.splice(e,1),e<=this._index&&this._index--,this.numListeners--)},V.prototype.dispatchEvent=function(t){var e=this.numListeners;for(this._index=0;this._index<e&&this._index<this.numListeners&&(this._listeners[this._index](t),t._iAllowedToImmediatlyPropagate);this._index++);},V.prototype.getEventListenerIndex=function(t){return this._listeners.indexOf(t)},V),AssetBase=(aa=EventDispatcher,__extends(ba,aa),Object.defineProperty(ba.prototype,"adaptee",{get:function(){return this},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"adapter",{get:function(){return this._adapter||this},set:function(t){this._adapter=t},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"assetType",{get:function(){throw new AbstractMethodError},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"originalName",{get:function(){return this._originalName},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"name",{get:function(){return this._name},set:function(t){var e=this._name;this._name=t,null==this._name&&(this._name="null"),this.updateFullPath(),this.dispatchEvent(new AssetEvent(AssetEvent.RENAME,this,e))},enumerable:!0,configurable:!0}),ba.prototype.invalidate=function(){this.dispatchEvent(new AssetEvent(AssetEvent.INVALIDATE,this))},ba.prototype.dispose=function(){throw new AbstractMethodError},ba.prototype.clone=function(){throw new AbstractMethodError},ba.prototype.clear=function(){this.dispatchEvent(new AssetEvent(AssetEvent.CLEAR,this))},Object.defineProperty(ba.prototype,"assetNamespace",{get:function(){return this._namespace},set:function(t){this._namespace=t||ba.DEFAULT_NAMESPACE,this.updateFullPath()},enumerable:!0,configurable:!0}),Object.defineProperty(ba.prototype,"assetFullPath",{get:function(){return this._full_path},enumerable:!0,configurable:!0}),ba.prototype.assetPathEquals=function(t,e){return this._name==t&&(!e||this._namespace==e)},ba.prototype.isAsset=function(t){return this.assetType==t.assetType},ba.prototype.resetAssetPath=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=!0),this._name=t||"null",this._namespace=e||ba.DEFAULT_NAMESPACE,i&&(this._originalName=this._name),this.updateFullPath()},ba.prototype.updateFullPath=function(){this._full_path=[this._namespace,this._name]},ba.ID_COUNT=0,ba.DEFAULT_NAMESPACE="default",ba),StreamingAudioChannel=(oa.stopAllSounds=function(t){void 0===t&&(t=-1);var e=oa._channels.length;if(t<0){for(var i=0;i<e;i++)oa._channels[i].stop();oa._channels.length=0}else{for(var n=[],i=0;i<e;i++)oa._channels[i].groupID==t?oa._channels[i].stop():n[n.length]=oa._channels[i];oa._channels=n}},oa.setChannelGroupVolume=function(t,e){void 0===e&&(e=-1);var i=oa._channels.length;if(e<0)for(var n=0;n<i;n++)oa._channels[n].groupVolume=t;else for(n=0;n<i;n++)oa._channels[n].groupID==e&&(oa._channels[n].groupVolume=t)},Object.defineProperty(oa.prototype,"duration",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(oa.prototype,"currentTime",{get:function(){return this._audio.currentTime-this._startTime},enumerable:!0,configurable:!0}),Object.defineProperty(oa.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!0,configurable:!0}),Object.defineProperty(oa.prototype,"groupVolume",{get:function(){return this._groupVolume},set:function(t){this._groupVolume!=t&&(this._groupVolume=t,this._audio.volume=this._groupVolume*this._volume)},enumerable:!0,configurable:!0}),Object.defineProperty(oa.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(oa.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume!=t&&(this._volume=t,this._audio.volume=this._volume)},enumerable:!0,configurable:!0}),oa.prototype.isPlaying=function(){return this._isPlaying},oa.prototype.isLooping=function(){return this._isLooping},oa.prototype.isDecoding=function(){return!1},Object.defineProperty(oa.prototype,"pan",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),oa.prototype.play=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1),this._isPlaying=!0,!this._isLooping&&this._isLooping==i||(this._isLooping=i,this._sourceDirty=!0),this._sourceDirty&&this._updateSource(),this._buffer=t,this._offset=e,this._audio.volume=this._groupVolume*this._volume,this._isQueuing||this._isOpening||this._queueBuffer()},oa.prototype.stop=function(){this._audio.pause(),this._isPlaying=!1,this._isLooping=!1},oa.prototype._sourceOpen=function(t){this._isOpening=!1,this._mediaSource.activeSourceBuffers.length?console.log("ERR: double sourceopen event called"):(this._sourceBuffer=this._mediaSource.addSourceBuffer("audio/mpeg"),this._sourceBuffer.addEventListener("updateend",this._updateEndDelegate),this._isPlaying&&this._queueBuffer())},oa.prototype._queueBuffer=function(){this._isQueuing=!0,this._startTime=this._sourceBuffer.timestampOffset,this._sourceBuffer.appendBuffer(this._buffer)},oa.prototype._updateEnd=function(t){this._isQueuing=!1,this._isLooping&&this._mediaSource.endOfStream(),this._duration=this._sourceBuffer.timestampOffset-this._startTime,this._audio.currentTime=this._startTime+this._offset,this._audio.play()},oa.prototype._onTimeUpdate=function(t){!this._isLooping&&this._duration<this._audio.currentTime-this._startTime+.1&&this.stop()},oa.prototype._updateSource=function(){this._mediaSource&&this._disposeSource(),this._isQueuing=!1,this._isOpening=!0,this._mediaSource=new MediaSource,this._mediaSource.addEventListener("sourceopen",this._sourceOpenDelegate),this._urlString=URL.createObjectURL(this._mediaSource),this._audio.src=this._urlString,this._audio.loop=this._isLooping,this._sourceDirty=!1},oa.prototype._disposeSource=function(){this._isOpening||(this._sourceBuffer.timestampOffset&&this._sourceBuffer.remove(0,this._sourceBuffer.timestampOffset),this._sourceBuffer.removeEventListener("updateend",this._updateEndDelegate),this._mediaSource.removeSourceBuffer(this._sourceBuffer),delete this._sourceBuffer,this._sourceBuffer=null),this._mediaSource.removeEventListener("sourceopen",this._sourceOpenDelegate),URL.revokeObjectURL(this._urlString),delete this._mediaSource,this._mediaSource=null},oa.maxChannels=4,oa._channels=new Array,oa),WebAudioChannel=(Pa.getAudioContext=function(){return Pa._audioCtx||!window.AudioContext&&!window.webkitAudioContext||(Pa._audioCtx=new(window.AudioContext||window.webkitAudioContext)),Pa._audioCtx&&"suspended"==Pa._audioCtx.state&&Pa._audioCtx.resume(),Pa._audioCtx},Pa.stopAllSounds=function(t){void 0===t&&(t=-1);var e=Pa._channels.length;if(t<0){for(var i=0;i<e;i++)Pa._channels[i].stop();Pa._channels.length=0}else{for(var n=[],i=0;i<e;i++)Pa._channels[i].groupID==t?Pa._channels[i].stop():n[n.length]=Pa._channels[i];Pa._channels=n}},Pa.setChannelGroupVolume=function(t,e){void 0===e&&(e=-1);var i=Pa._channels.length;if(e<0)for(var n=0;n<i;n++)Pa._channels[n].groupVolume=t;else for(n=0;n<i;n++)Pa._channels[n].groupID==e&&(Pa._channels[n].groupVolume=t)},Object.defineProperty(Pa.prototype,"duration",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"currentTime",{get:function(){return this._isDecoding?this._currentTime:this._audioCtx.currentTime-this._startTime},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"groupVolume",{get:function(){return this._groupVolume},set:function(t){this._groupVolume!=t&&(this._groupVolume=t,this._gainNode.gain.value=this._groupVolume*this._volume)},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume!=t&&(this._volume=t,this._gainNode.gain.value=this._groupVolume*this._volume)},enumerable:!0,configurable:!0}),Object.defineProperty(Pa.prototype,"pan",{get:function(){return this._pan},set:function(t){this._pan!=t&&(this._pan=t,this._usingNativePanner?this._pannerNode.pan.value=this._pan:this._pannerNode.setPosition(Math.sin(this._pan*(Math.PI/2)),0,Math.cos(this._pan*(Math.PI/2))))},enumerable:!0,configurable:!0}),Pa.prototype.isPlaying=function(){return this._isPlaying},Pa.prototype.isLooping=function(){return this._isLooping},Pa.prototype.isDecoding=function(){return this._isDecoding},Pa.prototype.play=function(t,e,i,n){var r=this;void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=0),this._isPlaying=!0,this._isLooping=i,this._currentTime=e,this._id=n,this._isDecoding=!0,t=t.slice(0),Pa._decodeCache[n]?this._onDecodeComplete(Pa._decodeCache[n]):Pa._errorCache[n]?this.stop():this._audioCtx.decodeAudioData(t,function(t){return r._onDecodeComplete(t)},function(t){return r._onError(t)})},Pa.prototype.stop=function(){this._isPlaying&&(this._isPlaying=!1,this._isLooping=!1,this._isDecoding=!1,this._source&&this._disposeSource())},Pa.prototype._onDecodeComplete=function(t){if(this._isPlaying){this._isDecoding=!1,Pa._decodeCache[this._id]=t,this._source&&this._disposeSource(),this._source=this._audioCtx.createBufferSource(),this._source.loop=this._isLooping,this._source.connect(this._gainNode),this._source.buffer=t,this._duration=t.duration,this._pan=0,this._startTime=this._audioCtx.currentTime-this._currentTime,this._source.onended=this._onEndedDelegate;try{this._gainNode.gain.value=this._groupVolume*this._volume,this._usingNativePanner?this._pannerNode.pan.value=this._pan:this._pannerNode.setPosition(Math.sin(this._pan*(Math.PI/2)),0,Math.cos(this._pan*(Math.PI/2))),this._source.start(this._audioCtx.currentTime,this._currentTime)}catch(t){console.log("Error starting audio: "+t),this._disposeSource()}}},Pa.prototype._onError=function(t){console.log("Error with decoding audio data"),Pa._errorCache[this._id]=!0,this.stop()},Pa.prototype._onEnded=function(t){this.onSoundComplete&&this.onSoundComplete(),this.stop()},Pa.prototype._disposeSource=function(){this._source.onended=null,this._source.stop(this._audioCtx.currentTime),this._source.disconnect(),this._source=null},Pa.maxChannels=64,Pa._channels=new Array,Pa._decodeCache=new Object,Pa._errorCache=new Object,Pa),audioCtx=WebAudioChannel.getAudioContext(),aa,B,v,resume;function Pa(t,e,i){var n=this;void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=1),this._isPlaying=!1,this._isLooping=!1,this._isDecoding=!1,this._volume=1,this._pan=0,this._groupID=0,this._groupVolume=1,this._groupPan=0,this._startTime=0,this._groupID=t,this._groupVolume=e,this._groupPan=i,this._audioCtx=Pa.getAudioContext(),this._usingNativePanner="function"==typeof this._audioCtx.createStereoPanner,this._gainNode=this._audioCtx.createGain(),this._gainNode.gain.value=this._groupVolume*this._volume,this._pannerNode=this._usingNativePanner?this._audioCtx.createStereoPanner():this._audioCtx.createPanner(),this._usingNativePanner?this._pannerNode.pan.value=this._pan:this._pannerNode.setPosition(Math.sin(this._pan*(Math.PI/2)),0,Math.cos(this._pan*(Math.PI/2))),this._gainNode.connect(this._pannerNode),this._pannerNode.connect(this._audioCtx.destination),this._onEndedDelegate=function(t){return n._onEnded(t)}}function oa(t,e,i){var n=this;void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=1),this._isPlaying=!1,this._isLooping=!1,this._groupID=0,this._groupVolume=1,this._groupPan=0,this._startTime=0,this._groupID=t,this._groupVolume=e,this._groupPan=i,this._sourceOpenDelegate=function(t){return n._sourceOpen(t)},this._updateEndDelegate=function(t){return n._updateEnd(t)},this._audio=new Audio,this._audio.ontimeupdate=function(t){return n._onTimeUpdate(t)},this._updateSource()}function ba(t){void 0===t&&(t=null);var e=aa.call(this)||this;return e._id=ba.ID_COUNT++,null==t&&(t="null"),e._name=t,e._originalName=t,e.updateFullPath(),e}function V(){this._index=0,this._listeners=new Array,this.numListeners=0}function I(t){void 0===t&&(t=null),this._listenerObjects=new Array,this._t=t||this}function C(t,e,i){void 0===i&&(i=null);var n=B.call(this,t)||this;return n._asset=e,n._prevName=i||n._asset.name,n}function z(t){this.type=void 0,this.target=void 0,this._iAllowedToPropagate=!0,this._iAllowedToImmediatlyPropagate=!0,this.type=t}function w(t,e){return void 0===t&&(t=null),void 0===e&&(e=0),v.call(this,t||"An abstract method was called! Either an instance of an abstract export class was created, or an abstract method was not overridden by the subclass.",e)||this}function p(t,e,i){void 0===t&&(t=""),void 0===e&&(e=0),void 0===i&&(i=""),this._errorID=0,this._messsage="",this._name="",this._messsage=t,this._name=i,this._errorID=e}function n(){this.compression=CompressionMethod.None,this.swfVersion=0,this.useAVM1=!0,this.backgroundColor=4294967295,this.bounds=null,this.frameRate=0,this.frameCount=0,this.attributes=null,this.sceneAndFrameLabelData=null,this.bytesLoaded=0,this.bytesTotal=length,this.pendingUpdateDelays=0,this.framesLoaded=0}audioCtx&&"suspended"===audioCtx.state&&(resume=function(){audioCtx.resume();var t=audioCtx.createBuffer(1,1,22050),e=audioCtx.createBufferSource();e.buffer=t,e.connect(audioCtx.destination),e.start(),setTimeout(function(){"running"===audioCtx.state&&document.removeEventListener("mousedown",resume,!1)},0)},document.addEventListener("mousedown",resume,!1));var ByteArrayBase=(ub.prototype.writeByte=function(t){throw"Virtual method"},ub.prototype.readByte=function(){throw"Virtual method"},ub.prototype.writeUnsignedByte=function(t){throw"Virtual method"},ub.prototype.readUnsignedByte=function(){throw"Virtual method"},ub.prototype.writeUnsignedShort=function(t){throw"Virtual method"},ub.prototype.readUnsignedShort=function(){throw"Virtual method"},ub.prototype.writeUnsignedInt=function(t){throw"Virtual method"},ub.prototype.readUnsignedInt=function(){throw"Virtual method"},ub.prototype.writeFloat=function(t){throw"Virtual method"},ub.prototype.toFloatBits=function(t){throw"Virtual method"},ub.prototype.readFloat=function(t){throw"Virtual method"},ub.prototype.fromFloatBits=function(t){throw"Virtual method"},ub.prototype.getBytesAvailable=function(){throw new AbstractMethodError("ByteArrayBase, getBytesAvailable() not implemented ")},ub.prototype.toString=function(){return"[ByteArray] ( "+this._mode+" ) position="+this.position+" length="+this.length},ub.prototype.compareEqual=function(t,e){(null==e||e>this.length-this.position)&&(e=this.length-this.position),e>t.length-t.position&&(e=t.length-t.position);for(var i=e,n=!0;n&&4<=e;)e-=4,this.readUnsignedInt()!=t.readUnsignedInt()&&(n=!1);for(;n&&1<=e;)e--,this.readUnsignedByte()!=t.readUnsignedByte()&&(n=!1);return this.position-=i-e,t.position-=i-e,n},ub.prototype.writeBase64String=function(t){},ub.prototype.dumpToConsole=function(){var t=this.position;function e(t,e){for(var i=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],n="",r=0;r<e;r++)n=i[t>>(r<<2)&15]+n;return n}for(var i=this.position=0;i<this.length;i+=8){for(var n=e(i,4)+":",r=0;r<8&&i+r<this.length;r++)n+=" "+e(this.readUnsignedByte(),2);console.log(n)}this.position=t},ub.prototype.readBase64String=function(t){return(null==t||t>this.length-this.position)&&(t=this.length-this.position),0<t?ub.internalGetBase64String(t,this.readUnsignedByte,this):""},ub.internalGetBase64String=function(t,e,i){for(var n,r,o,s,a,l,c,h="",u=ub.Base64Key;3<=t;)s=(n=e.apply(i))>>2,a=(3&n)<<4|(r=e.apply(i))>>4,l=(15&r)<<2|(o=e.apply(i))>>6,c=63&o,h+=u.charAt(s)+u.charAt(a)+u.charAt(l)+u.charAt(c),t-=3;return 2==t?(s=(n=e.apply(i))>>2,a=(3&n)<<4|(r=e.apply(i))>>4,l=(15&r)<<2,h+=u.charAt(s)+u.charAt(a)+u.charAt(l)+"="):1==t&&(s=(n=e.apply(i))>>2,a=(3&n)<<4,h+=u.charAt(s)+u.charAt(a)+"=="),h},ub.Base64Key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ub),ByteArray=(ec=ByteArrayBase,__extends(fc,ec),fc.prototype.ensureWriteableSpace=function(t){this.ensureSpace(t+this.position)},fc.prototype.setArrayBuffer=function(t){this.ensureSpace(t.byteLength),this.length=t.byteLength;var e=new Int8Array(t);new Int8Array(this.arraybytes,0,this.length).set(e),this.position=0},fc.prototype.writeArrayBuffer=function(t){this.ensureWriteableSpace(t.byteLength);var e=new Int8Array(t);new Int8Array(this.arraybytes,this.length,t.byteLength).set(e),this.length+=t.byteLength,this.position=this.length},fc.prototype.writeByteArray=function(t){this.ensureWriteableSpace(t.length);var e=new Int8Array(t.arraybytes,0,t.length);new Int8Array(this.arraybytes,this.length,t.length).set(e),this.length+=t.length,this.position=this.length},fc.prototype.getBytesAvailable=function(){return this.length-this.position},fc.prototype.ensureSpace=function(t){var e,i,n;t>this.maxlength&&(e=t+255&-256,i=new ArrayBuffer(e),n=new Uint8Array(this.arraybytes,0,this.length),new Uint8Array(i,0,this.length).set(n),this.arraybytes=i,this.maxlength=e)},fc.prototype.writeObject=function(t){console.log("writeObject not implemented yet in core/ByteArray")},fc.prototype.readObject=function(){return console.log("readObject not implemented yet in core/ByteArray"),{}},fc.prototype.writeByte=function(t){this.ensureWriteableSpace(1),new Int8Array(this.arraybytes)[this.position++]=~~t,this.position>this.length&&(this.length=this.position)},fc.prototype.readByte=function(){if(this.position>=this.length)throw"ByteArray out of bounds read. Positon="+this.position+", Length="+this.length;return new Int8Array(this.arraybytes)[this.position++]},fc.prototype.readBytes=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),null==i&&(i=t.length),t.ensureWriteableSpace(e+i);var n=new Int8Array(t.arraybytes),r=new Int8Array(this.arraybytes);n.set(r.subarray(this.position,this.position+i),e),this.position+=i,i+e>t.length&&(t.length+=i+e-t.length)},fc.prototype.writeUnsignedByte=function(t){this.ensureWriteableSpace(1),new Uint8Array(this.arraybytes)[this.position++]=255&~~t,this.position>this.length&&(this.length=this.position)},fc.prototype.readUnsignedByte=function(){if(this.position>=this.length)throw"ByteArray out of bounds read. Positon="+this.position+", Length="+this.length;return new Uint8Array(this.arraybytes)[this.position++]},fc.prototype.writeUnsignedShort=function(t){var e,i;this.ensureWriteableSpace(2),0==(1&this.position)?new Uint16Array(this.arraybytes)[this.position>>1]=65535&~~t:(new Uint16Array(this.unalignedarraybytestemp,0,1)[0]=65535&~~t,e=new Uint8Array(this.arraybytes,this.position,2),i=new Uint8Array(this.unalignedarraybytestemp,0,2),e.set(i)),this.position+=2,this.position>this.length&&(this.length=this.position)},fc.prototype.readUTFBytes=function(t){for(var e="",i=this.position+t,n=new DataView(this.arraybytes);this.position<i;){var r,o,s=n.getUint8(this.position++);if(s<128){if(0==s)break;e+=String.fromCharCode(s)}else s<224?e+=String.fromCharCode((63&s)<<6|127&n.getUint8(this.position++)):s<240?(r=n.getUint8(this.position++),e+=String.fromCharCode((31&s)<<12|(127&r)<<6|127&n.getUint8(this.position++))):(r=n.getUint8(this.position++),o=n.getUint8(this.position++),e+=String.fromCharCode((15&s)<<18|(127&r)<<12|o<<6&127|127&n.getUint8(this.position++)))}return e},fc.prototype.writeUTFBytes=function(t){var e=encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode(parseInt("0x"+e))});this.ensureWriteableSpace(4+e.length),this.writeInt(e.length);for(var i=0;i<e.length;i++)this.writeUnsignedByte(e.charCodeAt(i));if(e.length%4)for(var n=e.length%4,i=0;i<n;i++)this.writeUnsignedByte(0);return e.length},fc.prototype.readInt=function(){var t=new DataView(this.arraybytes).getInt32(this.position,!0);return this.position+=4,t},fc.prototype.readShort=function(){var t=new DataView(this.arraybytes).getInt16(this.position,!0);return this.position+=2,t},fc.prototype.readDouble=function(){var t=new DataView(this.arraybytes).getFloat64(this.position,!0);return this.position+=8,t},fc.prototype.readUnsignedShort=function(){if(this.position>this.length+2)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;if(0==(1&this.position)){var t=new Uint16Array(this.arraybytes),e=this.position>>1;return this.position+=2,t[e]}t=new Uint16Array(this.unalignedarraybytestemp,0,1);var i=new Uint8Array(this.arraybytes,this.position,2);return new Uint8Array(this.unalignedarraybytestemp,0,2).set(i),this.position+=2,t[0]},fc.prototype.writeUnsignedInt=function(t){var e,i;this.ensureWriteableSpace(4),0==(3&this.position)?new Uint32Array(this.arraybytes)[this.position>>2]=4294967295&~~t:(new Uint32Array(this.unalignedarraybytestemp,0,1)[0]=4294967295&~~t,e=new Uint8Array(this.arraybytes,this.position,4),i=new Uint8Array(this.unalignedarraybytestemp,0,4),e.set(i)),this.position+=4,this.position>this.length&&(this.length=this.position)},fc.prototype.writeInt=function(t){var e,i;this.ensureWriteableSpace(4),0==(3&this.position)?new Int32Array(this.arraybytes)[this.position>>2]=~~t:(new Int32Array(this.unalignedarraybytestemp,0,1)[0]=~~t,e=new Uint8Array(this.arraybytes,this.position,4),i=new Uint8Array(this.unalignedarraybytestemp,0,4),e.set(i)),this.position+=4,this.position>this.length&&(this.length=this.position)},fc.prototype.readUnsignedInt=function(){if(this.position>this.length+4)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;if(0==(3&this.position)){var t=new Uint32Array(this.arraybytes),e=this.position>>2;return this.position+=4,t[e]}t=new Uint32Array(this.unalignedarraybytestemp,0,1);var i=new Uint8Array(this.arraybytes,this.position,4);return new Uint8Array(this.unalignedarraybytestemp,0,4).set(i),this.position+=4,t[0]},fc.prototype.writeFloat=function(t){var e,i;this.ensureWriteableSpace(4),0==(3&this.position)?new Float32Array(this.arraybytes)[this.position>>2]=t:(new Float32Array(this.unalignedarraybytestemp,0,1)[0]=t,e=new Uint8Array(this.arraybytes,this.position,4),i=new Uint8Array(this.unalignedarraybytestemp,0,4),e.set(i)),this.position+=4,this.position>this.length&&(this.length=this.position)},fc.prototype.readFloat=function(){if(this.position>this.length+4)throw"ByteArray out of bounds read. Positon="+this.position+", Length="+this.length;if(0==(3&this.position)){var t=new Float32Array(this.arraybytes),e=this.position>>2;return this.position+=4,t[e]}t=new Float32Array(this.unalignedarraybytestemp,0,1);var i=new Uint8Array(this.arraybytes,this.position,4);return new Uint8Array(this.unalignedarraybytestemp,0,4).set(i),this.position+=4,t[0]},fc),ParserUtils=(md.arrayBufferToBase64=function(t,e){for(var i="",n=new Uint8Array(t),r=n.byteLength,o=0;o<r;o++)i+=String.fromCharCode(n[o]);return"data:"+e+";base64,"+window.btoa(i)},md.arrayBufferToAudio=function(t,e){var i=md.arrayBufferToBase64(t,"audio/"+e),n=new Audio;return n.src=i,n},md.arrayBufferToImage=function(t){var e=md.arrayBufferToBase64(t,"image/png"),i=new Image;return i.src=e,i},md.byteArrayToImage=function(t){var e=md.arrayBufferToBase64(t.arraybytes,"image/png"),i=new Image;return i.src=e,i},md.byteArrayToAudio=function(t,e){var i=md.arrayBufferToBase64(t.arraybytes,"audio/"+e),n=new Audio;return n.src=i,n},md.blobToImage=function(t){var e=(window.URL||window.webkitURL).createObjectURL(t),i=new Image;return i.src=e,i},md.blobToAudio=function(t){var e=(window.URL||window.webkitURL).createObjectURL(t),i=new Audio;return i.src=e,i},md.toByteArray=function(t){var e=new ByteArray;return e.setArrayBuffer(t),e},md.toString=function(t,e){if(void 0===e&&(e=0),"string"==typeof t&&null!=t.substr)return t.substr(0,t.length);if(t instanceof ByteArray){var i=t;return i.position=0,i.readUTFBytes(Math.min(i.getBytesAvailable(),e))}return null},md),EventAudioChannel=(Td.stopAllSounds=function(t){void 0===t&&(t=-1);var e=Td._channels.length;if(t<0){for(var i=0;i<e;i++)Td._channels[i].stop();Td._channels.length=0}else{for(var n=[],i=0;i<e;i++)Td._channels[i].groupID==t?Td._channels[i].stop():n[n.length]=Td._channels[i];Td._channels=n}},Td.setChannelGroupVolume=function(t,e){void 0===e&&(e=-1);var i=Td._channels.length;if(e<0)for(var n=0;n<i;n++)Td._channels[n].groupVolume=t;else for(n=0;n<i;n++)Td._channels[n].groupID==e&&(Td._channels[n].groupVolume=t)},Object.defineProperty(Td.prototype,"duration",{get:function(){return this._duration},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"currentTime",{get:function(){return this._audio.currentTime-this._startTime},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"pan",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"groupVolume",{get:function(){return this._groupVolume},set:function(t){this._groupVolume!=t&&(this._groupVolume=t,this._audio.volume=this._groupVolume*this._volume)},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(Td.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume!=t&&(this._volume=t,this._audio.volume=this._volume)},enumerable:!0,configurable:!0}),Td.prototype.isPlaying=function(){return this._isPlaying},Td.prototype.isLooping=function(){return this._isLooping},Td.prototype.isDecoding=function(){return!1},Td.prototype.play=function(t,e,i,n){void 0===e&&(e=0),void 0===i&&(i=!1),void 0===n&&(n=0),this._isPlaying=!0,this._isLooping=i,this._audio.src=Td._base64Cache[n]||(Td._base64Cache[n]=ParserUtils.arrayBufferToBase64(t,"audio/mp3")),this._audio.loop=this._isLooping;var r=this._audio;this._audio.addEventListener("loadedmetadata",function(){r.currentTime=e,r.play()},!1),this._audio.addEventListener("error",function(t){console.log("error in audio",t)},!1),this._audio.addEventListener("error",function(t){console.log("error in audio",t)},!1),this._audio.addEventListener("canplay",function(t){console.log("canplay in audio",t)},!1),this._audio.addEventListener("canplaythrough",function(t){console.log("canplaythrough in audio",t)},!1),this._audio.addEventListener("abort",function(t){console.log("abort in audio",t)},!1),this._audio.addEventListener("loadstart",function(t){console.log("loadstart in audio",t)},!1),this._audio.addEventListener("suspend",function(t){console.log("suspend in audio",t)},!1)},Td.prototype.stop=function(){this._audio.pause(),this._isPlaying=!1,this._isLooping=!1},Td.prototype._onTimeUpdate=function(t){!this._isLooping&&this._audio.duration<this._audio.currentTime-this._startTime+.1&&(this.onSoundComplete&&this.onSoundComplete(),this.stop())},Td.maxChannels=4,Td._channels=new Array,Td._base64Cache=new Object,Td),AudioManager=(xe.setVolume=function(t,e){if(void 0===e&&(e=-1),e<0)for(var i=xe._channelGroupVolumes.length,n=0;n<i;n++)xe._channelGroupVolumes[n]=t;else xe._channelGroupVolumes[e]=t;WebAudioChannel.setChannelGroupVolume(t,e),StreamingAudioChannel.setChannelGroupVolume(t,e),EventAudioChannel.setChannelGroupVolume(t,e)},xe.getVolume=function(t){return void 0===t&&(t=0),xe._channelGroupVolumes[t]},xe.setExternalSoundInterface=function(t){null!=t.startSound?null!=t.stopSound?xe._externalSoundInterface=t:console.log("Could not set the externalSoundInterface, because it does not provide a 'stopSound' function"):console.log("Could not set the externalSoundInterface, because it does not provide a 'startSound' function")},xe.getExternalSoundInterface=function(){return xe._externalSoundInterface},xe.stopAllSounds=function(){WebAudioChannel.stopAllSounds(),StreamingAudioChannel.stopAllSounds(),EventAudioChannel.stopAllSounds()},xe.getChannel=function(t,e){void 0===e&&(e=0);var i=5e7<t?StreamingAudioChannel:WebAudioChannel;xe.isIE&&(i=EventAudioChannel);for(var n=0;i._channels[n]&&i._channels[n].isPlaying();)n++;if(n!=i.maxChannels)return i._channels[n]=new i(e,xe._channelGroupVolumes[e],xe._channelGroupPanning[e]);for(var r,o=i._channels.length,s=0;s<o;s++)if(!(r=i._channels[s]).isLooping()&&!r.isDecoding())return r.groupID=e,r.groupVolume=xe._channelGroupVolumes[e],r.groupPan=xe._channelGroupPanning[e],i._channels.push(i._channels.splice(s,1)[0]),r.stop(),r;return null},xe.isIE=!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g),xe._externalSoundInterface=null,xe._channelGroupVolumes=[1],xe._channelGroupPanning=[.5],xe),WaveAudio=(Le=AssetBase,__extends(Me,Le),Object.defineProperty(Me.prototype,"isPlaying",{get:function(){return!!this._audioChannel&&this._audioChannel.isPlaying()},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"assetType",{get:function(){return Me.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"loopsToPlay",{get:function(){return this._loopsToPlay},set:function(t){var e=this;this._loopsToPlay!=t&&(this._loopsToPlay=t,this._audioChannel&&(this._audioChannel.onSoundComplete=function(){return e._soundCompleteInternal()}))},enumerable:!0,configurable:!0}),Me.prototype._soundCompleteInternal=function(){this._loopsToPlay--,0<this._loopsToPlay?(this.stop(),this.play(0,!1)):(0<this._channelsPlaying&&this._channelsPlaying--,0==this._channelsPlaying&&(this._isPlaying=!1),this._onSoundComplete&&this._onSoundComplete())},Object.defineProperty(Me.prototype,"pan",{get:function(){return this._pan},set:function(t){this._pan!=t&&(this._pan=t,this._audioChannel&&(this._audioChannel.pan=this._pan))},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"channelGroup",{get:function(){return this._channelGroup},set:function(t){if(this._channelGroup!=t){this._channelGroup=t;for(var e=AudioManager.getVolume(t),i=0;i<this._audioChannels.length;i++)this._audioChannels[i].groupVolume=e}},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"volume",{get:function(){return this._volume},set:function(t){if(this._volume!=t){this._volume=t,this._audioChannel&&(this._audioChannel.volume=this._volume);for(var e=0;e<this._audioChannels.length;e++)this._audioChannels[e].volume=this._volume}},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"currentTime",{get:function(){return this._audioChannel?this._audioChannel.currentTime:0},enumerable:!0,configurable:!0}),Object.defineProperty(Me.prototype,"duration",{get:function(){return this._audioChannel?this._audioChannel.duration:0},enumerable:!0,configurable:!0}),Me.prototype.dispose=function(){this._isPlaying=!1,this.stop()},Me.prototype.play=function(t,e){var i=this;void 0===e&&(e=!1),this._isPlaying=!0,this._audioChannel=AudioManager.getChannel(this._data.size,this.channelGroup),this._audioChannel&&(this._channelsPlaying++,this._audioChannels.push(this._audioChannel),this._audioChannel.volume=this._volume,this._audioChannel.onSoundComplete=function(){return i._soundCompleteInternal()},this._data.play(this._audioChannel,t,e,this.id))},Object.defineProperty(Me.prototype,"onSoundComplete",{set:function(t){var e=this;this._onSoundComplete=t,this._audioChannel&&(this._audioChannel.onSoundComplete=function(){return e._soundCompleteInternal()})},enumerable:!0,configurable:!0}),Me.prototype.stop=function(){this._isPlaying=!1;for(var t=0;t<this._audioChannels.length;t++)this._audioChannels[t].stop(),delete this._audioChannels[t];this._channelsPlaying=0,this._audioChannels.length=0,this._audioChannel=null},Me.prototype.clone=function(){var t=new Me(this._data);return t.name=this.name,t},Me.assetType="[asset WaveAudio]",Me),WaveAudioData=(Object.defineProperty(df.prototype,"size",{get:function(){return this._buffer?this._buffer.byteLength:this._blob.size},enumerable:!0,configurable:!0}),df.prototype.play=function(e,i,n,r){var t,o=this;this._buffer?e.play(this._buffer,i,n,r):this._loading||(this._loading=!0,(t=new FileReader).onload=function(t){return o._blobConverted(t,e,i,n,r)},t.readAsArrayBuffer(this._blob))},df.prototype._blobConverted=function(t,e,i,n,r){this._buffer=t.target.result,e.play(this._buffer,i,n,r)},df),ColorUtils=(sf.float32ColorToARGB=function(t){return[(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},sf.f32_RGBA_To_f32_ARGB=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},sf.f32_RGB_To_f32_ARGB=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},sf.prototype.getAlphaFromF32RGBA=function(t){return 255&t},sf.ARGBtoFloat32=function(t,e,i,n){return t<<24|e<<16|i<<8|n},sf.componentToHex=function(t){var e=t.toString(16);return 1==e.length?"0"+e:e},sf.RGBToHexString=function(t){return"#"+sf.componentToHex(t[1])+sf.componentToHex(t[2])+sf.componentToHex(t[3])},sf.ARGBToHexString=function(t){return"#"+sf.componentToHex(t[0])+sf.componentToHex(t[1])+sf.componentToHex(t[2])+sf.componentToHex(t[3])},sf.interpolateFloat32Color=function(t,e,i){var n=1-i;return((4278190080&t)>>>24)*n+((4278190080&e)>>>24)*i<<24|((16711680&t)>>>16)*n+((16711680&e)>>>16)*i<<16|((65280&t)>>>8)*n+((65280&e)>>>8)*i<<8|(255&t)*n+(255&e)*i},sf),ColorTransform=(Jf.prototype.concat=function(t){this._rawData[0]*=t._rawData[0],this._rawData[1]*=t._rawData[1],this._rawData[2]*=t._rawData[2],this._rawData[3]*=t._rawData[3],this._rawData[4]+=t._rawData[4],this._rawData[5]+=t._rawData[5],this._rawData[6]+=t._rawData[6],this._rawData[7]+=t._rawData[7]},Object.defineProperty(Jf.prototype,"alphaMultiplier",{get:function(){return this._rawData[3]},set:function(t){this._rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"alphaOffset",{get:function(){return this._rawData[7]},set:function(t){this._rawData[7]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"blueMultiplier",{get:function(){return this._rawData[2]},set:function(t){this._rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"blueOffset",{get:function(){return this._rawData[6]},set:function(t){this._rawData[6]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"greenMultiplier",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"greenOffset",{get:function(){return this._rawData[5]},set:function(t){this._rawData[5]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"redMultiplier",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"redOffset",{get:function(){return this._rawData[4]},set:function(t){this._rawData[4]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Jf.prototype,"color",{get:function(){return this._rawData[4]<<16|this._rawData[5]<<8|this._rawData[6]},set:function(t){var e=ColorUtils.float32ColorToARGB(t);this._rawData[4]=e[1],this._rawData[5]=e[2],this._rawData[6]=e[3],this._rawData[0]=1,this._rawData[1]=1,this._rawData[2]=1},enumerable:!0,configurable:!0}),Jf.prototype.copyRawDataFrom=function(t){var e=this._rawData;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5],e[6]=t[6],e[7]=t[7]},Jf.prototype.clear=function(){this._rawData[0]=1,this._rawData[1]=1,this._rawData[2]=1,this._rawData[3]=1,this._rawData[4]=0,this._rawData[5]=0,this._rawData[6]=0,this._rawData[7]=0},Jf.prototype.clone=function(){var t=new Jf;return t.copyFrom(this),t},Jf.prototype.copyFrom=function(t){var e=t._rawData,i=this._rawData;i[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7]},Jf.prototype.copyTo=function(t){t.copyFrom(this)},Jf.prototype.prepend=function(t){this._rawData[4]+=t._rawData[4]*this._rawData[0],this._rawData[5]+=t._rawData[5]*this._rawData[1],this._rawData[6]+=t._rawData[6]*this._rawData[2],this._rawData[7]+=t._rawData[7]*this._rawData[3],this.redMultiplier*=t.redMultiplier,this.greenMultiplier*=t.greenMultiplier,this.blueMultiplier*=t.blueMultiplier,this.alphaMultiplier*=t.alphaMultiplier},Jf.prototype._isRenderable=function(){return 0!=this._rawData[3]||0<this._rawData[7]},Jf),TransformEvent=(jg=EventBase,__extends(kg,jg),Object.defineProperty(kg.prototype,"transform",{get:function(){return this._transform},enumerable:!0,configurable:!0}),kg.prototype.clone=function(){return new kg(this.type,this._transform)},kg.INVALIDATE_MATRIX3D="invalidateMatrix3D",kg.INVALIDATE_CONCATENATED_MATRIX3D="invalidateConcatenatedMatrix3D",kg.UPDATE_CONCATENATED_MATRIX3D="updateConcatenatedMatrix3D",kg.INVALIDATE_COLOR_TRANSFORM="invalidateColorTransform",kg),ArgumentError=(og=ErrorBase,__extends(pg,og),pg),Point=(Object.defineProperty(sg.prototype,"x",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(sg.prototype,"y",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(sg.prototype,"length",{get:function(){return Math.sqrt(this._rawData[0]*this._rawData[0]+this._rawData[1]*this._rawData[1])},enumerable:!0,configurable:!0}),sg.prototype.add=function(t){return new sg(this._rawData[0]+t._rawData[0],this._rawData[1]+t._rawData[1])},sg.prototype.clone=function(){return new sg(this.x,this.y)},sg.prototype.copyFrom=function(t){this._rawData[0]=t._rawData[0],this._rawData[1]=t._rawData[1]},sg.prototype.equals=function(t){return this._rawData[0]===t._rawData[0]&&this._rawData[1]==t._rawData[1]},sg.prototype.normalize=function(t){void 0===t&&(t=1);var e,i=this.length;0===this.x&&0===this.y||!i||(e=t/i,this._rawData[0]*=e,this._rawData[1]*=e)},sg.prototype.offset=function(t,e){this._rawData[0]+=t,this._rawData[1]+=e},sg.prototype.setTo=function(t,e){this._rawData[0]=t,this._rawData[1]=e},sg.prototype.subtract=function(t){return new sg(this.x-t.x,this.y-t.y)},sg.prototype.toString=function(){return"[Point] (x="+this.x+", y="+this.y+")"},sg.distance=function(t,e){var i=e.x-t.x,n=e.y-t.y;return 0==i?Math.abs(n):0==n?Math.abs(i):Math.sqrt(i*i+n*n)},sg.interpolate=function(t,e,i){var n=1-i,r=t._rawData,o=e._rawData;return new sg(r[0]*i+o[0]*n,r[1]*i+o[1]*n)},sg.polar=function(t,e){return new sg(t*Math.cos(e),t*Math.sin(e))},sg),Matrix=(Object.defineProperty(Ug.prototype,"a",{get:function(){return this.rawData[0]},set:function(t){this.rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"b",{get:function(){return this.rawData[1]},set:function(t){this.rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"c",{get:function(){return this.rawData[2]},set:function(t){this.rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"d",{get:function(){return this.rawData[3]},set:function(t){this.rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"tx",{get:function(){return this.rawData[4]},set:function(t){this.rawData[4]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ug.prototype,"ty",{get:function(){return this.rawData[5]},set:function(t){this.rawData[5]=t},enumerable:!0,configurable:!0}),Ug.prototype.copyRawDataFrom=function(t,e){void 0===e&&(e=0);var i=this.rawData;i[0]=t[e+0],i[1]=t[e+1],i[2]=t[e+2],i[3]=t[e+3],i[4]=t[e+4],i[5]=t[e+5]},Ug.prototype.clone=function(){var t=this.rawData;return new Ug(t[0],t[1],t[2],t[3],t[4],t[5])},Ug.prototype.concat=function(t){var e=this.rawData,i=t.rawData,n=e[0]*i[0],r=0,o=0,s=e[3]*i[3],a=e[4]*i[0]+i[4],l=e[5]*i[3]+i[5];0===e[1]&&0===e[2]&&0===i[1]&&0===i[2]||(n+=e[1]*i[2],s+=e[2]*i[1],r+=e[0]*i[1]+e[1]*i[3],o+=e[2]*i[0]+e[3]*i[2],a+=e[5]*i[2],l+=e[4]*i[1]),e[0]=n,e[1]=r,e[2]=o,e[3]=s,e[4]=a,e[5]=l},Ug.prototype.copyColumnFrom=function(t,e){var i=this.rawData,n=e._rawData;if(2<t)throw"Column "+t+" out of bounds (2)";0==t?(i[0]=n[0],i[1]=n[1]):1==t?(i[2]=n[0],i[3]=n[1]):(i[4]=n[0],i[5]=n[1])},Ug.prototype.copyColumnTo=function(t,e){var i=this.rawData,n=e._rawData;if(2<t)throw new ArgumentError("ArgumentError, Column "+t+" out of bounds [0, ..., 2]");0==t?(n[0]=i[0],n[1]=i[1],n[2]=0):1==t?(n[0]=i[2],n[1]=i[3],n[2]=0):(n[0]=i[4],n[1]=i[5],n[2]=1)},Ug.prototype.copyFrom=function(t){var e=this.rawData,i=t.rawData;e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5]},Ug.prototype.copyRowFrom=function(t,e){var i=this.rawData,n=e._rawData;if(2<t)throw new ArgumentError("ArgumentError, Row "+t+" out of bounds [0, ..., 2]");0==t?(i[0]=n[0],i[2]=n[1],i[4]=n[2]):(i[1]=n[0],i[3]=n[1],i[5]=n[2])},Ug.prototype.copyRowTo=function(t,e){var i=this.rawData,n=e._rawData;if(2<t)throw new ArgumentError("ArgumentError, Row "+t+" out of bounds [0, ..., 2]");0==t?(n[0]=i[0],n[1]=i[2],n[2]=i[4]):1==t?(n[0]=i[1],n[1]=i[3],n[2]=i[5]):(n[0]=0,n[1]=0,n[2]=1)},Ug.prototype.createBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0);var o,s,a=this.rawData;0!==i?(o=Math.cos(i),s=Math.sin(i),a[0]=o*t,a[1]=s*e,a[2]=-s*t,a[3]=o*e):(a[0]=t,a[1]=0,a[2]=0,a[3]=e),a[4]=n,a[5]=r},Ug.prototype.createGradientBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this.createBox(t/1638.4,e/1638.4,i,n+t/2,r+e/2)},Ug.prototype.deltaTransformPoint=function(t){var e=this.rawData;return new Point(t.x*e[0]+t.y*e[2],t.x*e[1]+t.y*e[3])},Ug.prototype.identity=function(){var t=this.rawData;t[0]=1,t[1]=0,t[2]=0,t[3]=1,t[4]=0,t[5]=0},Ug.prototype.invert=function(){var t=this.rawData,e=t[1],i=t[2],n=t[4],r=t[5];if(0===e&&0===i){var o=t[0]=1/t[0],s=t[3]=1/t[3];return t[1]=t[2]=0,t[4]=-o*n,void(t[5]=-s*r)}var a,l=(o=t[0])*(s=t[3])-e*i;0!==l?(l=1/l,a=t[0]=s*l,e=t[1]=-e*l,i=t[2]=-i*l,s=t[3]=o*l,t[4]=-(a*n+i*r),t[5]=-(e*n+s*r)):this.identity()},Ug.prototype.multiply=function(t){var e=new Ug;return e.a=this.a*t.a+this.b*t.c,e.b=this.a*t.b+this.b*t.d,e.c=this.c*t.a+this.d*t.c,e.d=this.c*t.b+this.d*t.d,e.tx=this.tx*t.a+this.ty*t.c+t.tx,e.ty=this.tx*t.b+this.ty*t.d+t.ty,e},Ug.prototype.rotate=function(t){var e,i,n,r,o,s,a,l,c;0!==t&&(e=this.rawData,i=Math.cos(t),n=Math.sin(t),r=e[0],o=e[1],s=e[2],a=e[3],l=e[4],c=e[5],e[0]=r*i-o*n,e[1]=r*n+o*i,e[2]=s*i-a*n,e[3]=s*n+a*i,e[4]=l*i-c*n,e[5]=l*n+c*i)},Ug.prototype.scale=function(t,e){var i=this.rawData;1!==t&&(i[0]*=t,i[1]*=t,i[4]*=t),1!==e&&(i[2]*=e,i[3]*=e,i[5]*=e)},Ug.prototype.setTo=function(t,e,i,n,r,o){var s=this.rawData;s[0]=t,s[2]=e,s[1]=i,s[3]=n,s[4]=r,s[5]=o},Ug.prototype.toString=function(){return"[Matrix] (a="+this.a+", b="+this.b+", c="+this.c+", d="+this.d+", tx="+this.tx+", ty="+this.ty+")"},Ug.prototype.transformPoint=function(t){var e=this.rawData;return new Point(t.x*e[0]+t.y*e[2]+e[4],t.x*e[1]+t.y*e[3]+e[5])},Ug.prototype.translate=function(t,e){this.rawData[4]+=t,this.rawData[5]+=e},Ug),Vector3D=(Object.defineProperty(Ji.prototype,"x",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ji.prototype,"y",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ji.prototype,"z",{get:function(){return this._rawData[2]},set:function(t){this._rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ji.prototype,"w",{get:function(){return this._rawData[3]},set:function(t){this._rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ji.prototype,"length",{get:function(){return Math.sqrt(this.lengthSquared)},enumerable:!0,configurable:!0}),Object.defineProperty(Ji.prototype,"lengthSquared",{get:function(){var t=this._rawData;return t[0]*t[0]+t[1]*t[1]+t[2]*t[2]},enumerable:!0,configurable:!0}),Ji.prototype.add=function(t){var e=this._rawData,i=t._rawData;return new Ji(e[0]+i[0],e[1]+i[1],e[2]+i[2])},Ji.angleBetween=function(t,e){return Math.acos(t.dotProduct(e)/(t.length*e.length))},Ji.prototype.clone=function(){var t=this._rawData;return new Ji(t[0],t[1],t[2],t[3])},Ji.combine=function(t,e,i,n){var r=t._rawData,o=e._rawData;return new Ji(r[0]*i+o[0]*n,r[1]*i+o[1]*n,r[2]*i+o[2]*n)},Ji.prototype.copyFrom=function(t){var e=this._rawData,i=t._rawData;e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3]},Ji.prototype.crossProduct=function(t,e){void 0===e&&(e=null),null==e&&(e=new Ji);var i=this._rawData,n=t._rawData,r=e._rawData;return r[0]=i[1]*n[2]-i[2]*n[1],r[1]=i[2]*n[0]-i[0]*n[2],r[2]=i[0]*n[1]-i[1]*n[0],e},Ji.prototype.decrementBy=function(t){var e=this._rawData,i=t._rawData;e[0]-=i[0],e[1]-=i[1],e[2]-=i[2]},Ji.distance=function(t,e){var i=t._rawData,n=e._rawData,r=i[0]-n[0],o=i[1]-n[1],s=i[2]-n[2];return Math.sqrt(r*r+o*o+s*s)},Ji.prototype.dotProduct=function(t){var e=this._rawData,i=t._rawData;return e[0]*i[0]+e[1]*i[1]+e[2]*i[2]},Ji.prototype.equals=function(t,e){void 0===e&&(e=!1);var i=this._rawData,n=t._rawData;return i[0]==n[0]&&i[1]==n[1]&&i[2]==n[2]&&(!e||i[3]==n[3])},Ji.prototype.identity=function(){var t=this._rawData;t[0]=0,t[1]=0,t[2]=0,t[3]=1},Ji.prototype.incrementBy=function(t){var e=this._rawData,i=t._rawData;e[0]+=i[0],e[1]+=i[1],e[2]+=i[2]},Ji.prototype.nearEquals=function(t,e,i){void 0===i&&(i=!0);var n=this._rawData,r=t._rawData;return Math.abs(n[0]-r[0])<e&&Math.abs(n[1]-r[1])<e&&Math.abs(n[2]-r[2])<e&&(!i||Math.abs(n[3]-r[3])<e)},Ji.prototype.negate=function(){var t=this._rawData;t[0]=-t[0],t[1]=-t[1],t[2]=-t[2]},Ji.prototype.normalize=function(t){void 0===t&&(t=1);var e,i,n=this.length;return n&&(i=t/n,(e=this._rawData)[0]*=i,e[1]*=i,e[2]*=i),n},Ji.prototype.project=function(){var t=this._rawData;t[0]/=t[3],t[1]/=t[3],t[2]/=t[3]},Ji.prototype.scaleBy=function(t){var e=this._rawData;e[0]*=t,e[1]*=t,e[2]*=t},Ji.prototype.setTo=function(t,e,i,n){void 0===n&&(n=1);var r=this._rawData;r[0]=t,r[1]=e,r[2]=i,r[3]=n},Ji.prototype.subtract=function(t){var e=this._rawData,i=t._rawData;return new Ji(e[0]-i[0],e[1]-i[1],e[2]-i[2])},Ji.prototype.toString=function(){var t=this._rawData;return"[Vector3D] (x:"+t[0]+" ,y:"+t[1]+", z"+t[2]+", w:"+t[3]+")"},Ji.X_AXIS=new Ji(1,0,0),Ji.Y_AXIS=new Ji(0,1,0),Ji.Z_AXIS=new Ji(0,0,1),Ji),Box=(Object.defineProperty(bk.prototype,"back",{get:function(){return this.z+this.depth},set:function(t){this.depth=t-this.z},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"bottom",{get:function(){return this.y+this.height},set:function(t){this.height=t-this.y},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"bottomRightBack",{get:function(){return null==this._bottomRightBack&&(this._bottomRightBack=new Vector3D),this._bottomRightBack.x=this.x+this.width,this._bottomRightBack.y=this.y+this.height,this._bottomRightBack.z=this.z+this.depth,this._bottomRightBack},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"front",{get:function(){return this.z},set:function(t){this.depth+=this.z-t,this.z=t},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"left",{get:function(){return this.x},set:function(t){this.width+=this.x-t,this.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"right",{get:function(){return this.x+this.width},set:function(t){this.width=t-this.x},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"size",{get:function(){return null==this._size&&(this._size=new Vector3D),this._size.x=this.width,this._size.y=this.height,this._size.z=this.depth,this._size},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"top",{get:function(){return this.y},set:function(t){this.height+=this.y-t,this.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(bk.prototype,"topLeftFront",{get:function(){return null==this._topLeftFront&&(this._topLeftFront=new Vector3D),this._topLeftFront.x=this.x,this._topLeftFront.y=this.y,this._topLeftFront.z=this.z,this._topLeftFront},enumerable:!0,configurable:!0}),bk.prototype.clone=function(){return new bk(this.x,this.y,this.z,this.width,this.height,this.depth)},bk.prototype.contains=function(t,e,i){return this.x<=t&&this.x+this.width>=t&&this.y<=e&&this.y+this.height>=e&&this.z<=i&&this.z+this.depth>=i},bk.prototype.containsPoint=function(t){return this.x<=t.x&&this.x+this.width>=t.x&&this.y<=t.y&&this.y+this.height>=t.y&&this.z<=t.z&&this.z+this.depth>=t.z},bk.prototype.containsBox=function(t){return this.x<=t.x&&this.x+this.width>=t.x+t.width&&this.y<=t.y&&this.y+this.height>=t.y+t.height&&this.z<=t.z&&this.z+this.depth>=t.z+t.depth},bk.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.z=t.z,this.width=t.width,this.height=t.height,this.depth=t.depth},bk.prototype.equals=function(t){return this.x==t.x&&this.y==t.y&&this.z==t.z&&this.width==t.width&&this.height==t.height&&this.depth==t.depth},bk.prototype.inflate=function(t,e,i){this.x-=t/2,this.y-=e/2,this.z-=i/2,this.width+=t/2,this.height+=e/2,this.depth+=i/2},bk.prototype.inflatePoint=function(t){this.x-=t.x/2,this.y-=t.y/2,this.z-=t.z/2,this.width+=t.x/2,this.height+=t.y/2,this.depth+=t.z/2},bk.prototype.intersection=function(t){if(this.intersects(t)){var e=new bk;return this.x>t.x?(e.x=this.x,e.width=t.x-this.x+t.width,e.width>this.width&&(e.width=this.width)):(e.x=t.x,e.width=this.x-t.x+this.width,e.width>t.width&&(e.width=t.width)),this.y>t.y?(e.y=this.y,e.height=t.y-this.y+t.height,e.height>this.height&&(e.height=this.height)):(e.y=t.y,e.height=this.y-t.y+this.height,e.height>t.height&&(e.height=t.height)),this.z>t.z?(e.z=this.z,e.depth=t.z-this.z+t.depth,e.depth>this.depth&&(e.depth=this.depth)):(e.z=t.z,e.depth=this.z-t.z+this.depth,e.depth>t.depth&&(e.depth=t.depth)),e}return new bk},bk.prototype.intersects=function(t){return this.x+this.width>=t.x&&this.x<=t.x+t.width&&this.y+this.height>=t.y&&this.y<=t.y+t.height&&this.z+this.depth>=t.z&&this.z<=t.z+t.depth},bk.prototype.rayIntersection=function(t,e,i){if(void 0===i&&(i=null),this.containsPoint(t))return 0;var n,r,o,s,a,l=this.width/2,c=this.height/2,h=this.depth/2,u=this.x+l,p=this.y+c,d=this.z+h,_=t.x-u,f=t.y-p,m=t.z-d,g=e.x,y=e.y,b=e.z;return g<0&&0<(s=(l-_)/g)&&(o=m+s*b,(r=f+s*y)>-c&&r<c&&-h<o&&o<h&&(i&&(i.x=1,i.y=0,i.z=0),a=!0)),!a&&0<g&&0<(s=(-l-_)/g)&&(o=m+s*b,(r=f+s*y)>-c&&r<c&&-h<o&&o<h&&(i&&(i.x=-1,i.y=0,i.z=0),a=!0)),!a&&y<0&&0<(s=(c-f)/y)&&(o=m+s*b,(n=_+s*g)>-l&&n<l&&-h<o&&o<h&&(i&&(i.x=0,i.y=1,i.z=0),a=!0)),!a&&0<y&&0<(s=(-c-f)/y)&&(o=m+s*b,(n=_+s*g)>-l&&n<l&&-h<o&&o<h&&(i&&(i.x=0,i.y=-1,i.z=0),a=!0)),!a&&b<0&&0<(s=(h-m)/b)&&(n=_+s*g,(r=f+s*y)>-c&&r<c&&-l<n&&n<l&&(i&&(i.x=0,i.y=0,i.z=1),a=!0)),!a&&0<b&&0<(s=(-h-m)/b)&&(n=_+s*g,(r=f+s*y)>-c&&r<c&&-l<n&&n<l&&(i&&(i.x=0,i.y=0,i.z=-1),a=!0)),a?s:-1},bk.prototype.closestPointToPoint=function(t,e){var i;return void 0===e&&(e=null),null==e&&(e=new Vector3D),(i=t.x)<this.x&&(i=this.x),i>this.x+this.width&&(i=this.x+this.width),e.x=i,(i=t.y)<this.y+this.height&&(i=this.y+this.height),i>this.y&&(i=this.y),e.y=i,(i=t.z)<this.z&&(i=this.z),i>this.z+this.depth&&(i=this.z+this.depth),e.z=i,e},bk.prototype.offset=function(t,e,i){this.x+=t,this.y+=e,this.z+=i},bk.prototype.offsetPosition=function(t){this.x+=t.x,this.y+=t.y,this.z+=t.z},bk.prototype.identity=function(){this.x=0,this.y=0,this.z=0,this.width=0,this.height=0,this.depth=0},bk.prototype.setTo=function(t,e,i,n,r,o){this.x=t,this.y=e,this.z=i,this.width=n,this.height=r,this.depth=o},bk.prototype.toString=function(){return"[Box] (x="+this.x+", y="+this.y+", z="+this.z+", width="+this.width+", height="+this.height+", depth="+this.depth+")"},bk.prototype.union=function(t,e){var i,n,r;return void 0===e&&(e=null),null==e&&(e=new bk),null==t?e.copyFrom(this):(this.x<t.x?(i=t.x-this.x+t.width,e.x=this.x,e.width=i<this.width?this.width:i):(i=this.x-t.x+this.width,e.x=t.x,e.width=i<t.width?t.width:i),this.y<t.y?(n=t.y-this.y+t.height,e.y=this.y,e.height=n<this.height?this.height:n):(n=this.y-t.y+this.height,e.y=t.y,e.height=n<t.height?t.height:n),this.z<t.z?(r=t.z-this.z+t.depth,e.z=this.z,e.depth=r<this.depth?this.depth:r):(r=this.z-t.z+this.depth,e.z=t.z,e.depth=r<t.depth?t.depth:r)),e},bk),MathConsts=(ml.RADIANS_TO_DEGREES=180/Math.PI,ml.DEGREES_TO_RADIANS=Math.PI/180,ml),Orientation3D=(nl.AXIS_ANGLE="axisAngle",nl.EULER_ANGLES="eulerAngles",nl.QUATERNION="quaternion",nl),Sphere=(ol.prototype.rayIntersection=function(t,e,i){if(this.containsPoint(t))return 0;var n,r=t.x-this.x,o=t.y-this.y,s=t.z-this.z,a=e.x,l=e.y,c=e.z,h=a*a+l*l+c*c,u=2*(r*a+o*l+s*c),p=u*u-4*h*(r*r+o*o+s*s-this.radius*this.radius);return 0<=p&&0<=(n=(-u-Math.sqrt(p))/(2*h))?(i.x=r+n*a,i.y=o+n*l,i.z=s+n*c,i.normalize(),n):-1},ol.prototype.containsPoint=function(t){var e=t.x-this.x,i=t.y-this.y,n=t.z-this.z;return Math.sqrt(e*e+i*i+n*n)<=this.radius},ol.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.z=t.z,this.radius=t.radius},ol.prototype.union=function(t,e){if(void 0===e&&(e=null),null==e&&(e=new ol),null==t)return e.copyFrom(this),e;var i=t.x-this.x,n=t.y-this.y,r=t.z-this.z;return e.radius=(Math.sqrt(i*i+n*n+r*r)+t.radius+this.radius)/2,e.x=this.x+i/2,e.y=this.y+n/2,e.z=this.z+r/2,e},ol.prototype.toString=function(){return"Sphere [x:"+this.x+", y:"+this.y+", z:"+this.z+", radius:"+this.radius+"]"},ol),Matrix3D=(Ql.getAxisRotationMatrix=function(t,e,i,n,r){void 0===r&&(r=null),null==r&&(r=new Ql);var o,s,a=r._rawData,l=n*MathConsts.DEGREES_TO_RADIANS,c=Math.cos(l),h=Math.sin(l),u=1-c;return a[0]=c+t*t*u,a[5]=c+e*e*u,a[10]=c+i*i*u,o=t*e*u,s=i*h,a[1]=o+s,a[4]=o-s,o=t*i*u,s=e*h,a[8]=o+s,a[2]=o-s,o=e*i*u,s=t*h,a[9]=o-s,a[6]=o+s,a[3]=0,a[7]=0,a[11]=0,a[12]=0,a[13]=0,a[14]=0,a[15]=1,r.invalidatePosition(),r},Ql.getPointAtMatrix=function(t,e,i,n){var r,o,s;void 0===n&&(n=null),null==n&&(n=new Ql);var a=n._rawData;return(r=e.clone()).normalize(),(o=i.clone()).normalize(),(s=o.crossProduct(r)).normalize(),s.length<.05&&(s.x=o.y,s.y=o.x,s.z=0,s.normalize()),o=r.crossProduct(s),a[0]=s.x,a[1]=s.y,a[2]=s.z,a[3]=0,a[4]=o.x,a[5]=o.y,a[6]=o.z,a[7]=0,a[8]=r.x,a[9]=r.y,a[10]=r.z,a[11]=0,a[12]=s.dotProduct(t),a[13]=o.dotProduct(t),a[14]=r.dotProduct(t),a[15]=1,n.invalidatePosition(),n},Ql.getQuaternionMatrix=function(t,e){void 0===e&&(e=null),null==e&&(e=new Ql);var i=e._rawData,n=t.x,r=t.y,o=t.z,s=t.w,a=n*n,l=n*r,c=n*o,h=n*s,u=r*r,p=r*o,d=r*s,_=o*o,f=o*s;return i[0]=1-2*(u+_),i[1]=2*(l+f),i[2]=2*(c-d),i[4]=2*(l-f),i[5]=1-2*(a+_),i[6]=2*(p+h),i[8]=2*(c+d),i[9]=2*(p-h),i[10]=1-2*(a+u),i[3]=0,i[7]=0,i[11]=0,i[12]=0,i[13]=0,i[14]=0,i[15]=1,e.invalidatePosition(),e},Ql.compare=function(t,e){for(var i=t._rawData,n=e._rawData,r=0;r<16;++r)if(i[r]!=n[r])return!1;return!0},Object.defineProperty(Ql.prototype,"determinant",{get:function(){var t=this._rawData;return(t[0]*t[5]-t[4]*t[1])*(t[10]*t[15]-t[14]*t[11])-(t[0]*t[9]-t[8]*t[1])*(t[6]*t[15]-t[14]*t[7])+(t[0]*t[13]-t[12]*t[1])*(t[6]*t[11]-t[10]*t[7])+(t[4]*t[9]-t[8]*t[5])*(t[2]*t[15]-t[14]*t[3])-(t[4]*t[13]-t[12]*t[5])*(t[2]*t[11]-t[10]*t[3])+(t[8]*t[13]-t[12]*t[9])*(t[2]*t[7]-t[6]*t[3])},enumerable:!0,configurable:!0}),Object.defineProperty(Ql.prototype,"position",{get:function(){return this._positionDirty&&(this._positionDirty=!1,this._position.x=this._rawData[12],this._position.y=this._rawData[13],this._position.z=this._rawData[14]),this._position},enumerable:!0,configurable:!0}),Ql.prototype.append=function(t){var e=this._rawData,i=t._rawData,n=e[0],r=e[1],o=e[2],s=e[3],a=e[4],l=e[5],c=e[6],h=e[7],u=e[8],p=e[9],d=e[10],_=e[11],f=e[12],m=e[13],g=e[14],y=e[15],b=i[0],v=i[1],x=i[2],A=i[3],S=i[4],w=i[5],C=i[6],P=i[7],E=i[8],T=i[9],M=i[10],D=i[11],I=i[12],O=i[13],L=i[14],F=i[15];e[0]=n*b+r*S+o*E+s*I,e[1]=n*v+r*w+o*T+s*O,e[2]=n*x+r*C+o*M+s*L,e[3]=n*A+r*P+o*D+s*F,e[4]=a*b+l*S+c*E+h*I,e[5]=a*v+l*w+c*T+h*O,e[6]=a*x+l*C+c*M+h*L,e[7]=a*A+l*P+c*D+h*F,e[8]=u*b+p*S+d*E+_*I,e[9]=u*v+p*w+d*T+_*O,e[10]=u*x+p*C+d*M+_*L,e[11]=u*A+p*P+d*D+_*F,e[12]=f*b+m*S+g*E+y*I,e[13]=f*v+m*w+g*T+y*O,e[14]=f*x+m*C+g*M+y*L,e[15]=f*A+m*P+g*D+y*F,this._positionDirty=!0},Ql.prototype.appendRotation=function(t,e){this.append(Ql.getAxisRotationMatrix(e.x,e.y,e.z,t,Ql._tempMatrix))},Ql.prototype.appendSkew=function(t,e,i){var n;0==t&&0==e&&0==i||((n=Ql._tempMatrix._rawData)[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=t,n[5]=1,n[6]=0,n[7]=0,n[8]=e,n[9]=i,n[10]=1,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this.append(Ql._tempMatrix))},Ql.prototype.appendScale=function(t,e,i){var n;1==t&&1==e&&1==i||((n=Ql._tempMatrix._rawData)[0]=t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this.append(Ql._tempMatrix))},Ql.prototype.appendTranslation=function(t,e,i){var n=this._rawData,r=n[3],o=n[7],s=n[11],a=n[15];n[0]+=t*r,n[1]+=e*r,n[2]+=i*r,n[4]+=t*o,n[5]+=e*o,n[6]+=i*o,n[8]+=t*s,n[9]+=e*s,n[10]+=i*s,n[12]+=t*a,n[13]+=e*a,n[14]+=i*a,this._positionDirty=!0},Ql.prototype.clone=function(){var t=new Ql;return t.copyFrom(this),t},Ql.prototype.copyColumnFrom=function(t,e){if(t<0||3<t)throw new ArgumentError("ArgumentError, Column "+t+" out of bounds [0, ..., 3]");var i=this._rawData,n=e._rawData;i[t*=4]=n[0],i[t+1]=n[1],i[t+2]=n[2],i[t+3]=n[3],this._positionDirty=!0},Ql.prototype.copyColumnTo=function(t,e,i){if(void 0===i&&(i=!1),t<0||3<t)throw new ArgumentError("ArgumentError, Column "+t+" out of bounds [0, ..., 3]");t*=4;var n=this._rawData,r=e._rawData;i?(r[0]=-n[t],r[1]=-n[t+1],r[2]=-n[t+2],r[3]=-n[t+3]):(r[0]=n[t],r[1]=n[t+1],r[2]=n[t+2],r[3]=n[t+3])},Ql.prototype.copyFrom=function(t,e){void 0===e&&(e=!1);var i=t._rawData,n=this._rawData;n[0]=i[0],n[5]=i[5],n[10]=i[10],n[15]=i[15],e?(n[1]=i[4],n[2]=i[8],n[3]=i[12],n[4]=i[1],n[6]=i[9],n[7]=i[13],n[8]=i[2],n[9]=i[6],n[11]=i[14],n[12]=i[3],n[13]=i[7],n[14]=i[11]):(n[1]=i[1],n[2]=i[2],n[3]=i[3],n[4]=i[4],n[6]=i[6],n[7]=i[7],n[8]=i[8],n[9]=i[9],n[11]=i[11],n[12]=i[12],n[13]=i[13],n[14]=i[14]),this._positionDirty=!0},Ql.prototype.copyTo=function(t,e){void 0===e&&(e=!1),t.copyFrom(this,e)},Ql.prototype.copyRawDataFrom=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1);var n=this._rawData;n[0]=t[e+0],n[5]=t[e+5],n[10]=t[e+10],n[15]=t[e+15],i?(n[e+1]=t[4],n[e+2]=t[8],n[e+3]=t[12],n[e+4]=t[1],n[e+6]=t[9],n[e+7]=t[13],n[e+8]=t[2],n[e+9]=t[6],n[e+11]=t[14],n[e+12]=t[3],n[e+13]=t[7],n[e+14]=t[11]):(n[1]=t[e+1],n[2]=t[e+2],n[3]=t[e+3],n[4]=t[e+4],n[6]=t[e+6],n[7]=t[e+7],n[8]=t[e+8],n[9]=t[e+9],n[11]=t[e+11],n[12]=t[e+12],n[13]=t[e+13],n[14]=t[e+14]),this._positionDirty=!0},Ql.prototype.copyRawDataTo=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1);var n=this._rawData;t[e]=n[0],t[e+5]=n[5],t[e+10]=n[10],t[e+15]=n[15],i?(t[e+1]=n[4],t[e+2]=n[8],t[e+3]=n[12],t[e+4]=n[1],t[e+6]=n[9],t[e+7]=n[13],t[e+8]=n[2],t[e+9]=n[6],t[e+11]=n[14],t[e+12]=n[3],t[e+13]=n[7],t[e+14]=n[11]):(t[e+1]=n[1],t[e+2]=n[2],t[e+3]=n[3],t[e+4]=n[4],t[e+6]=n[6],t[e+7]=n[7],t[e+8]=n[8],t[e+9]=n[9],t[e+11]=n[11],t[e+12]=n[12],t[e+13]=n[13],t[e+14]=n[14])},Ql.prototype.copyRowFrom=function(t,e){if(t<0||3<t)throw new ArgumentError("ArgumentError, Row "+t+" out of bounds [0, ..., 3]");var i=this._rawData,n=e._rawData;i[t]=n[0],i[t+4]=n[1],i[t+8]=n[2],i[t+12]=n[3],this._positionDirty=!0},Ql.prototype.copyRowTo=function(t,e,i){if(void 0===i&&(i=!1),t<0||3<t)throw new ArgumentError("ArgumentError, Row "+t+" out of bounds [0, ..., 3]");var n=this._rawData,r=e._rawData;i?(r[0]=-n[t],r[1]=-n[t+4],r[2]=-n[t+8],r[3]=-n[t+12]):(r[0]=n[t],r[1]=n[t+4],r[2]=n[t+8],r[3]=n[t+12])},Ql.prototype.decompose=function(t){void 0===t&&(t="eulerAngles"),null==this._components&&(this._components=[new Vector3D,new Vector3D,new Vector3D,new Vector3D]);var e=new Vector3D(this._rawData[0],this._rawData[1],this._rawData[2]),i=new Vector3D(this._rawData[4],this._rawData[5],this._rawData[6]),n=new Vector3D(this._rawData[8],this._rawData[9],this._rawData[10]),r=this._components[3],o=this._components[2];r.x=e.length,e.scaleBy(1/r.x),o.x=e.dotProduct(i),i=Vector3D.combine(i,e,1,-o.x),r.y=i.length,i.scaleBy(1/r.y),o.x/=r.y,o.y=e.dotProduct(n),n=Vector3D.combine(n,e,1,-o.y),o.z=i.dotProduct(n),n=Vector3D.combine(n,i,1,-o.z),r.z=n.length,n.scaleBy(1/r.z),o.y/=r.z,o.z/=r.z,e.dotProduct(i.crossProduct(n))<0&&(r.z=-r.z,n.x=-n.x,n.y=-n.y,n.z=-n.z);var s=this._components[1];switch(t){case Orientation3D.AXIS_ANGLE:s.w=Math.acos((e.x+i.y+n.z-1)/2);var a=Math.sqrt((i.z-n.y)*(i.z-n.y)+(n.x-e.z)*(n.x-e.z)+(e.y-i.x)*(e.y-i.x));s.x=(i.z-n.y)/a,s.y=(n.x-e.z)/a,s.z=(e.y-i.x)/a;break;case Orientation3D.QUATERNION:var l=e.x+i.y+n.z;0<l?(s.w=Math.sqrt(1+l)/2,s.x=(i.z-n.y)/(4*s.w),s.y=(n.x-e.z)/(4*s.w),s.z=(e.y-i.x)/(4*s.w)):e.x>i.y&&e.x>n.z?(s.x=Math.sqrt(1+e.x-i.y-n.z)/2,s.w=(i.z-n.y)/(4*s.x),s.y=(e.y+i.x)/(4*s.x),s.z=(n.x+e.z)/(4*s.x)):i.y>n.z?(s.y=Math.sqrt(1+i.y-e.x-n.z)/2,s.x=(e.y+i.x)/(4*s.y),s.w=(n.x-e.z)/(4*s.y),s.z=(i.z+n.y)/(4*s.y)):(s.z=Math.sqrt(1+n.z-e.x-i.y)/2,s.x=(n.x+e.z)/(4*s.z),s.y=(i.z+n.y)/(4*s.z),s.w=(e.y-i.x)/(4*s.z));break;case Orientation3D.EULER_ANGLES:s.y=Math.asin(-e.z),1!=e.z&&-1!=e.z?(s.x=Math.atan2(i.z,n.z),s.z=Math.atan2(e.y,e.x)):(s.z=0,s.x=Math.atan2(i.x,i.y))}return this._components[0].copyFrom(this.position),this._components},Ql.prototype.deltaTransformVector=function(t,e){void 0===e&&(e=null);var i=t.x,n=t.y,r=t.z;e=e||new Vector3D;var o=this._rawData,s=e._rawData;return s[0]=i*o[0]+n*o[4]+r*o[8],s[1]=i*o[1]+n*o[5]+r*o[9],s[2]=i*o[2]+n*o[6]+r*o[10],s[3]=i*o[3]+n*o[7]+r*o[11],e},Ql.prototype.deltaTransformVectors=function(t,e){for(var i=this._rawData,n=i[0],r=i[1],o=i[2],s=i[4],a=i[5],l=i[6],c=i[8],h=i[9],u=i[10],p=0,d=t.length,_=0;_<d;_+=3){var f=t[_],m=t[_+1],g=t[_+2];e[p++]=n*f+s*m+c*g,e[p++]=r*f+a*m+h*g,e[p++]=o*f+l*m+u*g}},Ql.prototype.identity=function(){var t=this._rawData;t[0]=1,t[1]=0,t[2]=0,t[3]=0,t[4]=0,t[5]=1,t[6]=0,t[7]=0,t[8]=0,t[9]=0,t[10]=1,t[11]=0,t[12]=0,t[13]=0,t[14]=0,t[15]=1,this._positionDirty=!0},Ql.prototype.invert=function(){var t,e,i,n,r,o,s,a,l,c,h,u,p,d,_,f,m=this.determinant,g=1e-11<Math.abs(m),y=this._rawData;return g&&(m=1/m,t=y[0],e=y[1],i=y[2],n=y[3],r=y[4],o=y[5],s=y[6],a=y[7],l=y[8],c=y[9],h=y[10],u=y[11],p=y[12],d=y[13],_=y[14],f=y[15],y[0]=m*(o*(h*f-_*u)-c*(s*f-_*a)+d*(s*u-h*a)),y[1]=-m*(e*(h*f-_*u)-c*(i*f-_*n)+d*(i*u-h*n)),y[2]=m*(e*(s*f-_*a)-o*(i*f-_*n)+d*(i*a-s*n)),y[3]=-m*(e*(s*u-h*a)-o*(i*u-h*n)+c*(i*a-s*n)),y[4]=-m*(r*(h*f-_*u)-l*(s*f-_*a)+p*(s*u-h*a)),y[5]=m*(t*(h*f-_*u)-l*(i*f-_*n)+p*(i*u-h*n)),y[6]=-m*(t*(s*f-_*a)-r*(i*f-_*n)+p*(i*a-s*n)),y[7]=m*(t*(s*u-h*a)-r*(i*u-h*n)+l*(i*a-s*n)),y[8]=m*(r*(c*f-d*u)-l*(o*f-d*a)+p*(o*u-c*a)),y[9]=-m*(t*(c*f-d*u)-l*(e*f-d*n)+p*(e*u-c*n)),y[10]=m*(t*(o*f-d*a)-r*(e*f-d*n)+p*(e*a-o*n)),y[11]=-m*(t*(o*u-c*a)-r*(e*u-c*n)+l*(e*a-o*n)),y[12]=-m*(r*(c*_-d*h)-l*(o*_-d*s)+p*(o*h-c*s)),y[13]=m*(t*(c*_-d*h)-l*(e*_-d*i)+p*(e*h-c*i)),y[14]=-m*(t*(o*_-d*s)-r*(e*_-d*i)+p*(e*s-o*i)),y[15]=m*(t*(o*h-c*s)-r*(e*h-c*i)+l*(e*s-o*i))),this._positionDirty=!0,g},Ql.prototype.isIdentity=function(){var t=this._rawData;return 1==t[0]&&0==t[1]&&0==t[2]&&0==t[3]&&0==t[4]&&1==t[5]&&0==t[6]&&0==t[7]&&0==t[8]&&0==t[9]&&1==t[10]&&0==t[11]&&0==t[12]&&0==t[13]&&0==t[14]&&1==t[15]},Ql.prototype.prepend=function(t){var e=this._rawData,i=t._rawData,n=i[0],r=i[1],o=i[2],s=i[3],a=i[4],l=i[5],c=i[6],h=i[7],u=i[8],p=i[9],d=i[10],_=i[11],f=i[12],m=i[13],g=i[14],y=i[15],b=e[0],v=e[1],x=e[2],A=e[3],S=e[4],w=e[5],C=e[6],P=e[7],E=e[8],T=e[9],M=e[10],D=e[11],I=e[12],O=e[13],L=e[14],F=e[15];e[0]=n*b+r*S+o*E+s*I,e[1]=n*v+r*w+o*T+s*O,e[2]=n*x+r*C+o*M+s*L,e[3]=n*A+r*P+o*D+s*F,e[4]=a*b+l*S+c*E+h*I,e[5]=a*v+l*w+c*T+h*O,e[6]=a*x+l*C+c*M+h*L,e[7]=a*A+l*P+c*D+h*F,e[8]=u*b+p*S+d*E+_*I,e[9]=u*v+p*w+d*T+_*O,e[10]=u*x+p*C+d*M+_*L,e[11]=u*A+p*P+d*D+_*F,e[12]=f*b+m*S+g*E+y*I,e[13]=f*v+m*w+g*T+y*O,e[14]=f*x+m*C+g*M+y*L,e[15]=f*A+m*P+g*D+y*F,this._positionDirty=!0},Ql.prototype.prependRotation=function(t,e){this.prepend(Ql.getAxisRotationMatrix(e.x,e.y,e.z,t,Ql._tempMatrix))},Ql.prototype.prependScale=function(t,e,i){var n;1==t&&1==e&&1==i||((n=Ql._tempMatrix._rawData)[0]=t,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=e,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=i,n[11]=0,n[12]=0,n[13]=0,n[14]=0,n[15]=1,this.prepend(Ql._tempMatrix))},Ql.prototype.prependTranslation=function(t,e,i){var n=Ql._tempMatrix._rawData;n[0]=1,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=1,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t,n[13]=e,n[14]=i,n[15]=1,this.prepend(Ql._tempMatrix)},Ql.prototype.recompose=function(t){var e=t[0]||this.position;this.identity();var i=t[3];!i||1==i.x&&1==i.y&&1==i.z||this.appendScale(i.x,i.y,i.z);var n,r,o=t[2];!o||0==o.x&&0==o.y&&0==o.z||this.appendSkew(o.x,o.y,o.z);var s=Ql._tempMatrix._rawData;s[12]=0,s[13]=0,s[14]=0,s[15]=0;var a,l=t[1];return l&&(0!=(a=-l.x)&&(n=Math.sin(a),r=Math.cos(a),s[0]=1,s[1]=0,s[2]=0,s[3]=0,s[4]=0,s[5]=r,s[6]=-n,s[7]=0,s[8]=0,s[9]=n,s[10]=r,s[11]=0,this.append(Ql._tempMatrix)),0!=(a=-l.y)&&(n=Math.sin(a),r=Math.cos(a),s[0]=r,s[1]=0,s[2]=n,s[3]=0,s[4]=0,s[5]=1,s[6]=0,s[7]=0,s[8]=-n,s[9]=0,s[10]=r,s[11]=0,this.append(Ql._tempMatrix)),0!=(a=-l.z)&&(n=Math.sin(a),r=Math.cos(a),s[0]=r,s[1]=-n,s[2]=0,s[3]=0,s[4]=n,s[5]=r,s[6]=0,s[7]=0,s[8]=0,s[9]=0,s[10]=1,s[11]=0,this.append(Ql._tempMatrix))),this._rawData[12]=e.x,this._rawData[13]=e.y,this._rawData[14]=e.z,t[0]&&(this._positionDirty=!0),this._rawData[15]=1,!0},Ql.prototype.reflect=function(t){var e=t.a,i=t.b,n=t.c,r=t.d,o=-2*e*i,s=-2*e*n,a=-2*i*n,l=this._rawData;l[0]=1-2*e*e,l[4]=o,l[8]=s,l[12]=-2*e*r,l[1]=o,l[5]=1-2*i*i,l[9]=a,l[13]=-2*i*r,l[2]=s,l[6]=a,l[10]=1-2*n*n,l[14]=-2*n*r,l[3]=0,l[7]=0,l[11]=0,l[15]=1,this._positionDirty=!0},Ql.prototype.transformBox=function(t,e){if(void 0===e&&(e=null),null==t)throw new ArgumentError("ArgumentError, box cannot be null");e=e||new Box;var i=t.width/2,n=t.height/2,r=t.depth/2,o=t.x+i,s=t.y+n,a=t.z+r,l=this._rawData[0],c=this._rawData[4],h=this._rawData[8],u=this._rawData[12],p=this._rawData[1],d=this._rawData[5],_=this._rawData[9],f=this._rawData[13],m=this._rawData[2],g=this._rawData[6],y=this._rawData[10],b=o*l+s*c+a*h+u,v=o*p+s*d+a*_+f,x=o*m+s*g+a*y+this._rawData[14],A=Math.max(Math.abs(i*l+n*c+r*h),Math.abs(-i*l+n*c+r*h),Math.abs(i*l-n*c+r*h),Math.abs(i*l+n*c-r*h)),S=Math.max(Math.abs(i*p+n*d+r*_),Math.abs(-i*p+n*d+r*_),Math.abs(i*p-n*d+r*_),Math.abs(i*p+n*d-r*_)),w=Math.max(Math.abs(i*m+n*g+r*y),Math.abs(-i*m+n*g+r*y),Math.abs(i*m-n*g+r*y),Math.abs(i*m+n*g-r*y));return e.width=2*A,e.height=2*S,e.depth=2*w,e.x=b-A,e.y=v-S,e.z=x-w,e},Ql.prototype.transformSphere=function(t,e){if(void 0===e&&(e=null),null==t)throw new ArgumentError("ArgumentError, sphere cannot be null");var i=new Box(t.x-t.radius,t.y-t.radius,t.z-t.radius,2*t.radius,2*t.radius,2*t.radius);return this.transformBox(i,i),(e=e||new Sphere).x=i.x+i.width/2,e.y=i.y+i.height/2,e.z=i.z+i.depth/2,e.radius=Math.max(i.width,i.height,i.depth),e},Ql.prototype.transformVector=function(t,e){if(void 0===e&&(e=null),null==t)throw new ArgumentError("ArgumentError, vector cannot be null");var i=t.x,n=t.y,r=t.z,o=t.w;e=e||new Vector3D;var s=this._rawData,a=e._rawData;return a[0]=i*s[0]+n*s[4]+r*s[8]+o*s[12],a[1]=i*s[1]+n*s[5]+r*s[9]+o*s[13],a[2]=i*s[2]+n*s[6]+r*s[10]+o*s[14],a[3]=i*s[3]+n*s[7]+r*s[11]+o*s[15],e},Ql.prototype.transformVectors=function(t,e){for(var i=0,n=0,r=0,o=0,s=this._rawData;i+3<=t.length;)n=t[i],r=t[i+1],o=t[i+2],e[i]=n*s[0]+r*s[4]+o*s[8]+s[12],e[i+1]=n*s[1]+r*s[5]+o*s[9]+s[13],e[i+2]=n*s[2]+r*s[6]+o*s[10]+s[14],i+=3},Ql.prototype.transpose=function(){var t=this._rawData,e=Ql._tempMatrix._rawData;this.copyRawDataTo(e,0,!0),t[1]=e[1],t[2]=e[2],t[3]=e[3],t[4]=e[4],t[6]=e[6],t[7]=e[7],t[8]=e[8],t[9]=e[9],t[11]=e[11],t[12]=e[12],t[13]=e[13],t[14]=e[14],this._positionDirty=!0},Ql.prototype.invalidatePosition=function(){this._positionDirty=!0},Ql.prototype.toFixed=function(t){var e=Math.pow(10,t);return"matrix3d("+Math.round(this._rawData[0]*e)/e+","+Math.round(this._rawData[1]*e)/e+","+Math.round(this._rawData[2]*e)/e+","+Math.round(this._rawData[3]*e)/e+","+Math.round(this._rawData[4]*e)/e+","+Math.round(this._rawData[5]*e)/e+","+Math.round(this._rawData[6]*e)/e+","+Math.round(this._rawData[7]*e)/e+","+Math.round(this._rawData[8]*e)/e+","+Math.round(this._rawData[9]*e)/e+","+Math.round(this._rawData[10]*e)/e+","+Math.round(this._rawData[11]*e)/e+","+Math.round(this._rawData[12]*e)/e+","+Math.round(this._rawData[13]*e)/e+","+Math.round(this._rawData[14]*e)/e+","+Math.round(this._rawData[15]*e)/e+")"},Ql.prototype.toString=function(){return"matrix3d("+Math.round(1e3*this._rawData[0])/1e3+","+Math.round(1e3*this._rawData[1])/1e3+","+Math.round(1e3*this._rawData[2])/1e3+","+Math.round(1e3*this._rawData[3])/1e3+","+Math.round(1e3*this._rawData[4])/1e3+","+Math.round(1e3*this._rawData[5])/1e3+","+Math.round(1e3*this._rawData[6])/1e3+","+Math.round(1e3*this._rawData[7])/1e3+","+Math.round(1e3*this._rawData[8])/1e3+","+Math.round(1e3*this._rawData[9])/1e3+","+Math.round(1e3*this._rawData[10])/1e3+","+Math.round(1e3*this._rawData[11])/1e3+","+Math.round(1e3*this._rawData[12])/1e3+","+Math.round(1e3*this._rawData[13])/1e3+","+Math.round(1e3*this._rawData[14])/1e3+","+Math.round(1e3*this._rawData[15])/1e3+")"},Ql.CALCULATION_MATRIX=new Ql,Ql._tempMatrix=new Ql,Ql),Transform=(qr=EventDispatcher,__extends(rr,qr),Object.defineProperty(rr.prototype,"backVector",{get:function(){return this._backVector||(this._backVector=new Vector3D),this._matrix3D.copyColumnTo(2,this._backVector,!0),this._backVector},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"colorTransform",{get:function(){return this._colorTransform},set:function(t){var e,i;t?(e=t._rawData,(i=this._colorTransform._rawData)[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7]):this._colorTransform.clear(),this.invalidateColorTransform()},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"concatenatedMatrix",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"concatenatedMatrix3D",{get:function(){return this._concatenatedMatrix3DDirty&&(this._concatenatedMatrix3DDirty=!1,this._concatenatedMatrix3D==this._matrix3D&&this._matrix3DDirty&&this.updateMatrix3D(),this.dispatchEvent(this._updateConcatenatedMatrix3D||(this._updateConcatenatedMatrix3D=new TransformEvent(TransformEvent.UPDATE_CONCATENATED_MATRIX3D,this)))),this._concatenatedMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"inverseConcatenatedMatrix3D",{get:function(){return this._inverseConcatenatedMatrix3DDirty&&(this._inverseConcatenatedMatrix3DDirty=!1,this._inverseConcatenatedMatrix3D.copyFrom(this.concatenatedMatrix3D),this._inverseConcatenatedMatrix3D.invert()),this._inverseConcatenatedMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"downVector",{get:function(){return this._downVector||(this._downVector=new Vector3D),this._matrix3D.copyColumnTo(1,this._downVector,!0),this._downVector},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"forwardVector",{get:function(){return this._forwardVector||(this._forwardVector=new Vector3D),this._matrix3D.copyColumnTo(2,this._forwardVector),this._forwardVector},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"leftVector",{get:function(){return this._leftVector||(this._leftVector=new Vector3D),this._matrix3D.copyColumnTo(0,this._backVector,!0),this._leftVector},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"matrix",{get:function(){return this._matrix||(this._matrix=new Matrix),this._matrix3DDirty&&this.updateMatrix3D(),this._matrix.a=this._matrix3D._rawData[0],this._matrix.b=this._matrix3D._rawData[1],this._matrix.c=this._matrix3D._rawData[4],this._matrix.d=this._matrix3D._rawData[5],this._matrix.tx=this._matrix3D._rawData[12],this._matrix.ty=this._matrix3D._rawData[13],this._matrix},set:function(t){t&&(this._matrix3D.identity(),this._matrix3D._rawData[0]=t.a,this._matrix3D._rawData[1]=t.b,this._matrix3D._rawData[4]=t.c,this._matrix3D._rawData[5]=t.d,this._matrix3D._rawData[12]=t.tx,this._matrix3D._rawData[13]=t.ty,this.invalidateComponents(),this.invalidateConcatenatedMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"matrix3D",{get:function(){return this._matrix3DDirty&&this.updateMatrix3D(),this._matrix3D},set:function(t){var e,i;t?(e=t._rawData,(i=this._matrix3D._rawData)[0]=e[0],i[1]=e[1],i[2]=e[2],i[3]=e[3],i[4]=e[4],i[5]=e[5],i[6]=e[6],i[7]=e[7],i[8]=e[8],i[9]=e[9],i[10]=e[10],i[11]=e[11],i[12]=e[12],i[13]=e[13],i[14]=e[14],i[15]=e[15]):this._matrix3D.identity(),this.invalidateComponents(),this.invalidateConcatenatedMatrix3D()},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"pixelBounds",{get:function(){return this._pixelBounds},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"position",{get:function(){return this._matrix3D.position},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"rightVector",{get:function(){return this._rightVector||(this._rightVector=new Vector3D),this._matrix3D.copyColumnTo(0,this._rightVector),this._rightVector},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"rotation",{get:function(){return this._componentsDirty&&this._updateComponents(),this._rotation},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"scale",{get:function(){return this._componentsDirty&&this._updateComponents(),this._scale},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"skew",{get:function(){return this._componentsDirty&&this._updateComponents(),this._skew},enumerable:!0,configurable:!0}),Object.defineProperty(rr.prototype,"upVector",{get:function(){return this._upVector||(this._upVector=new Vector3D),this._matrix3D.copyColumnTo(1,this._upVector),this._upVector},enumerable:!0,configurable:!0}),rr.prototype.append=function(t){console.log("append("+t+") is not implemented yet in core/Transform")},rr.prototype.clearColorTransform=function(){this._colorTransform&&(this._colorTransform.clear(),this.invalidateColorTransform())},rr.prototype.clearMatrix3D=function(){this._matrix3D.identity(),this.invalidateComponents()},rr.prototype.clone=function(){var t=new rr;return this.copyRawDataTo(t),t},rr.prototype.copyRawDataTo=function(t){this._matrix3DDirty&&this.updateMatrix3D();var e=t._rawData,i=this._rawData;e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],e[16]=i[16],e[17]=i[17],e[18]=i[18],e[19]=i[19],e[20]=i[20],e[21]=i[21],e[22]=i[22],e[23]=i[23],this.invalidateComponents(),this.invalidateColorTransform()},rr.prototype.dispose=function(){},rr.prototype.globalToLocal=function(t,e){void 0===e&&(e=null),this._tempVector3D.setTo(t.x,t.y,0);var i=this.inverseConcatenatedMatrix3D.transformVector(this._tempVector3D,this._tempVector3D);return(e=e||new Point).x=i.x,e.y=i.y,e},rr.prototype.globalToLocal3D=function(t){return this.inverseConcatenatedMatrix3D.transformVector(t)},rr.prototype.invalidateColorTransform=function(){this.dispatchEvent(this._invalidateColorTransform||(this._invalidateColorTransform=new TransformEvent(TransformEvent.INVALIDATE_COLOR_TRANSFORM,this)))},rr.prototype.invalidateComponents=function(){this.invalidatePosition(),this._componentsDirty=!0},rr.prototype.invalidateConcatenatedMatrix3D=function(){this._concatenatedMatrix3DDirty||(this._concatenatedMatrix3DDirty=!0,this._inverseConcatenatedMatrix3DDirty=!0,this.dispatchEvent(this._invalidateConcatenatedMatrix3D||(this._invalidateConcatenatedMatrix3D=new TransformEvent(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this))))},rr.prototype.invalidateMatrix3D=function(){this._concatenatedMatrix3D==this._matrix3D&&this.invalidateConcatenatedMatrix3D(),this._matrix3DDirty||(this._matrix3DDirty=!0,this.dispatchEvent(this._invalidateMatrix3D||(this._invalidateMatrix3D=new TransformEvent(TransformEvent.INVALIDATE_MATRIX3D,this))))},rr.prototype.invalidatePosition=function(){this._concatenatedMatrix3D==this._matrix3D&&this.invalidateConcatenatedMatrix3D(),this._matrix3D.invalidatePosition(),this.dispatchEvent(this._invalidateMatrix3D||(this._invalidateMatrix3D=new TransformEvent(TransformEvent.INVALIDATE_MATRIX3D,this)))},rr.prototype.localToGlobal=function(t,e){void 0===e&&(e=null),this._tempVector3D.setTo(t.x,t.y,0);var i=this.concatenatedMatrix3D.transformVector(this._tempVector3D,this._tempVector3D);return(e=e||new Point).x=i.x,e.y=i.y,e},rr.prototype.lookAt=function(t,e){void 0===e&&(e=null),null==e&&(e=Vector3D.Y_AXIS);var i=Matrix3D.getPointAtMatrix(new Vector3D,t.subtract(this._matrix3D.position),e,Matrix3D.CALCULATION_MATRIX).decompose()[1];this.rotateTo(i.x,i.y,i.z)},rr.prototype.moveBackward=function(t){this.translateLocal(Vector3D.Z_AXIS,-t)},rr.prototype.moveDown=function(t){this.translateLocal(Vector3D.Y_AXIS,-t)},rr.prototype.moveForward=function(t){this.translateLocal(Vector3D.Z_AXIS,t)},rr.prototype.moveLeft=function(t){this.translateLocal(Vector3D.X_AXIS,-t)},rr.prototype.moveRight=function(t){this.translateLocal(Vector3D.X_AXIS,t)},rr.prototype.moveTo=function(t,e,i){this._matrix3D._rawData[12]=t,this._matrix3D._rawData[13]=e,this._matrix3D._rawData[14]=i,this.invalidatePosition()},rr.prototype.moveUp=function(t){this.translateLocal(Vector3D.Y_AXIS,t)},rr.prototype.pitch=function(t){this.rotate(Vector3D.X_AXIS,t)},rr.prototype.roll=function(t){this.rotate(Vector3D.Z_AXIS,t)},rr.prototype.rotate=function(t,e){this.matrix3D.prependRotation(e,t),this.invalidateComponents()},rr.prototype.rotateTo=function(t,e,i){this._componentsDirty&&this._updateComponents(),this._rotation.x=t,this._rotation.y=e,this._rotation.z=i,this.invalidateMatrix3D()},rr.prototype.scaleTo=function(t,e,i){this._componentsDirty&&this._updateComponents(),this._scale.x=t,this._scale.y=e,this._scale.z=i,this.invalidateMatrix3D()},rr.prototype.skewTo=function(t,e,i){this._componentsDirty&&this._updateComponents(),this._skew.x=t,this._skew.y=e,this._skew.z=i,this.invalidateMatrix3D()},rr.prototype.translate=function(t,e){var i=t.x,n=t.y,r=t.z,o=e/Math.sqrt(i*i+n*n+r*r);this.matrix3D.appendTranslation(i*o,n*o,r*o),this.invalidatePosition()},rr.prototype.translateLocal=function(t,e){var i=t.x,n=t.y,r=t.z,o=e/Math.sqrt(i*i+n*n+r*r);this.matrix3D.prependTranslation(i*o,n*o,r*o),this.invalidatePosition()},rr.prototype.updateMatrix3D=function(){this._matrix3D.recompose(this._components),this._matrix3DDirty=!1},rr.prototype.yaw=function(t){this.rotate(Vector3D.Y_AXIS,t)},rr.prototype._updateComponents=function(){var t=this._matrix3D.decompose(),e=t[1];this._rotation.x=e.x,this._rotation.y=e.y,this._rotation.z=e.z,e=t[2],this._skew.x=e.x,this._skew.y=e.y,this._skew.z=e.z,e=t[3],this._scale.x=e.x,this._scale.y=e.y,this._scale.z=e.z,this._componentsDirty=!1},rr),DocumentError=(As=ErrorBase,__extends(Bs,As),Bs.DOCUMENT_DOES_NOT_EXIST="documentDoesNotExist",Bs),PartialImplementationError=(Es=ErrorBase,__extends(Fs,Es),Fs),RangeError$1=(Is=ErrorBase,__extends(Js,Is),Js),LoaderEvent=(Ms=EventBase,__extends(Ns,Ms),Object.defineProperty(Ns.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0}),Object.defineProperty(Ns.prototype,"url",{get:function(){return this._url},enumerable:!0,configurable:!0}),Object.defineProperty(Ns.prototype,"assets",{get:function(){return this._assets},enumerable:!0,configurable:!0}),Ns.prototype.clone=function(){return new Ns(this.type,this._url,this._content,this._assets)},Ns.LOADER_START="loaderStart",Ns.LOADER_COMPLETE="loaderComplete",Ns),ParserEvent=(Ts=EventBase,__extends(Us,Ts),Object.defineProperty(Us.prototype,"message",{get:function(){return this._message},enumerable:!0,configurable:!0}),Us.prototype.clone=function(){return new Us(this.type,this._message)},Us.PARSE_COMPLETE="parseComplete",Us.PARSE_ERROR="parseError",Us.READY_FOR_DEPENDENCIES="readyForDependencies",Us),ProjectionEvent=(Ys=EventBase,__extends(Zs,Ys),Object.defineProperty(Zs.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Zs.INVALIDATE_FRUSTUM_MATRIX3D="invalidateFrustumMatrix3D",Zs.INVALIDATE_VIEW_MATRIX3D="invalidateViewMatrix3D",Zs),TimerEvent=(bt=EventBase,__extends(ct,bt),ct.TIMER="timer",ct.TIMER_COMPLETE="timerComplete",ct),URLLoaderEvent=(et=EventBase,__extends(ft,et),Object.defineProperty(ft.prototype,"urlLoader",{get:function(){return this._urlLoader},enumerable:!0,configurable:!0}),ft.prototype.clone=function(){return new ft(this.type,this._urlLoader)},ft.HTTP_STATUS="httpStatus",ft.LOAD_ERROR="loadError",ft.LOAD_PROGRESS="loadProgress",ft.LOAD_START="loadStart",ft.LOAD_COMPLETE="loadComplete",ft),PlaneClassification=(jt.BACK=0,jt.FRONT=1,jt.IN=0,jt.OUT=1,jt.INTERSECT=2,jt),Plane3D=(kt.prototype.fromPoints=function(t,e,i){var n=e.x-t.x,r=e.y-t.y,o=e.z-t.z,s=i.x-t.x,a=i.y-t.y,l=i.z-t.z;this.a=r*l-o*a,this.b=o*s-n*l,this.c=n*a-r*s,this.d=this.a*t.x+this.b*t.y+this.c*t.z,0==this.a&&0==this.b?this._iAlignment=kt.ALIGN_XY_AXIS:0==this.b&&0==this.c?this._iAlignment=kt.ALIGN_YZ_AXIS:0==this.a&&0==this.c?this._iAlignment=kt.ALIGN_XZ_AXIS:this._iAlignment=kt.ALIGN_ANY},kt.prototype.fromNormalAndPoint=function(t,e){this.a=t.x,this.b=t.y,this.c=t.z,this.d=this.a*e.x+this.b*e.y+this.c*e.z,0==this.a&&0==this.b?this._iAlignment=kt.ALIGN_XY_AXIS:0==this.b&&0==this.c?this._iAlignment=kt.ALIGN_YZ_AXIS:0==this.a&&0==this.c?this._iAlignment=kt.ALIGN_XZ_AXIS:this._iAlignment=kt.ALIGN_ANY},kt.prototype.normalize=function(){var t=1/Math.sqrt(this.a*this.a+this.b*this.b+this.c*this.c);return this.a*=t,this.b*=t,this.c*=t,this.d*=t,this},kt.prototype.distance=function(t){return this._iAlignment==kt.ALIGN_YZ_AXIS?this.a*t.x-this.d:this._iAlignment==kt.ALIGN_XZ_AXIS?this.b*t.y-this.d:this._iAlignment==kt.ALIGN_XY_AXIS?this.c*t.z-this.d:this.a*t.x+this.b*t.y+this.c*t.z-this.d},kt.prototype.classifyPoint=function(t,e){return void 0===e&&(e=.01),this.d!=this.d?PlaneClassification.FRONT:(i=this._iAlignment==kt.ALIGN_YZ_AXIS?this.a*t.x-this.d:this._iAlignment==kt.ALIGN_XZ_AXIS?this.b*t.y-this.d:this._iAlignment==kt.ALIGN_XY_AXIS?this.c*t.z-this.d:this.a*t.x+this.b*t.y+this.c*t.z-this.d)<-e?PlaneClassification.BACK:e<i?PlaneClassification.FRONT:PlaneClassification.INTERSECT;var i},kt.prototype.toString=function(){return"Plane3D [a:"+this.a+", b:"+this.b+", c:"+this.c+", d:"+this.d+"]"},kt.ALIGN_ANY=0,kt.ALIGN_XY_AXIS=1,kt.ALIGN_YZ_AXIS=2,kt.ALIGN_XZ_AXIS=3,kt),PoissonLookup=(Ft.initDistributions=function(){this._distributions=new Array,this._distributions[0]=new Array(.3082841,.4320919),this._distributions[1]=new Array(.3082841,.4320919,-.2274942,-.6640266),this._distributions[2]=new Array(.8742689,.0009265686,-.6864116,-.5536607,-.2325206,.7678371),this._distributions[3]=new Array(.3913446,-.7084417,-.7511101,-.5935929,-.2323436,.5320091,.8435315,.5035911),this._distributions[4]=new Array(.2122471,-.5771395,-.8543506,-.1763534,.5189021,.8323698,-.3616908,.5865368,.9523004,-.04948437),this._distributions[5]=new Array(.5791035,.3496495,.2959551,-.6006749,-.2419119,-.06879545,-.7403072,.6110353,-.04555973,.8059174,-.5275017,-.737129),this._distributions[6]=new Array(.06941478,.8519508,-.7441907,.2426432,.6439992,-.2405252,-.1007523,-.2327587,-.6427067,-.7248485,.8050759,.5492936,.3573822,-.8824506),this._distributions[7]=new Array(.8509863,.4452587,-.09507271,.2073005,.1706571,-.6434793,.8029777,-.2718274,-.4401725,.8196304,.2715359,.8598521,-.8121575,-.006447683,-.6486837,-.7237598),this._distributions[8]=new Array(.6951686,-.2680728,-.04933243,.3710589,.6592212,.3661054,-.01579228,-.6909603,-.3275101,-.1756866,.3811549,.9218544,-.216032,.9755028,-.7065172,.3355389,-.6579109,-.6798355),this._distributions[9]=new Array(.6181276,-.09790418,-.2537868,-.5570995,-.1964931,.3459414,.3474613,-.8885581,.5135743,.5753114,-.9549091,.1480672,-.8711916,-.4293123,-.6928071,.6190156,-.13369,.8892705,.0548224,-.1246777),this._distributions[10]=new Array(.4853027,-.5080479,-.1331675,-.506597,.139575,.01316885,.803486,-.07568797,.5240274,.4883182,-.4334005,.1207938,-.7794577,-.3985141,.1576432,-.9861221,-.3712867,.6959021,.1517378,.9847429,-.9762396,.1661073),this._distributions[11]=new Array(-.2790166,-.01252619,.3389016,.3921154,.2408341,-.313211,-.8151779,-.3898362,-.6347761,.3486495,.09471484,-.7722448,-.1385674,.6364574,.2456331,.9295807,-.3864306,-.8247881,.6111673,-.7164014,.8287669,.05466961,.837706,.5415626),this._distributions[12]=new Array(.056417,.3185693,-.8245888,.1882799,.8575996,.1136829,.1070375,.875332,.4076743,-.06000621,-.4311306,.7239349,.2677574,-.538472,-.08486642,-.2083647,-.888989,-.3906443,-.4768958,-.6664082,.09334993,-.9861541,.808736,-.455949,.5889823,.7660807),this._distributions[13]=new Array(-.2681346,-.3955857,-.1315102,-.8852947,-.5143692,.09551838,.4344836,-.546945,-.8620899,-.3813288,.1650431,.02034803,-.1543657,.3842218,-.828457,.5376903,-.6145,-.7818927,-.2639062,.8784655,.1912684,.9720125,.3135219,.5224229,.7850655,.4592297,.7465045,-.1368916),this._distributions[14]=new Array(.4241029,.695281,.150511,-.02304107,-.2482675,.9120338,.8057325,.2622084,-.2445909,.2765962,.8588713,-.1772072,.3117845,-.4385471,-.3923851,-.3298936,-.1751254,-.7405846,.6926506,-.684163,-.9304563,-.3254691,-.8533293,.1523024,.2510415,-.917345,-.6239773,-.7105472,-.6104624,.6041355),this._distributions[15]=new Array(.5844554,.06651045,.1343258,.6756578,.3799674,-.6301104,.5590436,.7940555,.09574714,.02262517,.8697868,.393301,.003945862,-.421735,.9043913,-.2432393,-.4844007,.7190998,-.3201078,.2972371,-.3852352,-.6341155,-.5413069,-.09223081,-.8468984,-.5126905,.004156174,-.8633173,-.9681889,-.03305046,-.846509,.4414353),this._distributions[16]=new Array(.4506488,.657668,.4621297,.07441051,-.2782125,.6201044,.9750003,.09110117,.1019436,.2986514,.03457398,.9631706,.542098,-.5505635,.8675668,.4938077,-.5414361,.2655292,-.7941836,.6003053,-.09847672,-.1001604,-.9316511,-.08572888,.07286467,-.611899,-.5232627,-.4082253,-.5481608,-.827938,-.1551939,-.9621193,.9220031,-.3315949),this._distributions[17]=new Array(.197908,-.4697656,-.4474689,-.3428435,.8529873,-.2228634,.6022478,-.5469642,.2545276,-.931133,-.1507547,-.7855865,-.07606658,.1011628,.3046715,.2785755,.4698432,-.1064076,.6831254,.4152522,.1374381,.8363233,-.2166121,.6682042,.5511393,.7996449,-.4278994,.28836,-.8875198,.2181732,-.8772842,-.2818254,-.7000262,.5762185,-.6062385,-.7439126),this._distributions[18]=new Array(.6645703,-.05678739,.5720971,.4533803,-.07660709,.08802763,.5163431,-.4426552,.1163455,-.3404382,-.4004807,-.5046007,.2932099,-.8201418,-.5322125,.03834766,-.1490209,-.8817304,-.8000439,-.3509448,.5260983,.8421043,.1197811,.6963812,.9498612,.3122156,-.9285746,.02120355,-.6670724,.7217396,.9155889,-.3510147,-.271941,.4727852,.318879,.1634057,-.2686755,.9253026),this._distributions[19]=new Array(.5064292,.422527,.8935515,-.06610427,.1199719,.175568,.403388,-.2003276,.1657927,.8154403,.9301245,.2929218,-.1644068,.6201534,.7113559,-.6589743,-.3364046,-.1799502,.02109996,-.392765,-.382213,.3219992,-.9201946,.1207967,-.726185,.4291916,-.7443482,-.2480059,-.5147594,.7418784,.1935272,-.7406143,-.3643523,-.5559214,-.7147766,-.6326278,-.2524151,-.9096627,.5161405,.7908453),this._distributions[20]=new Array(.7921003,-.3032096,.5992879,-.009052323,.2538549,-.1872749,.7053444,.3677175,.5417761,-.8170255,.9749611,.1210478,.1969143,-.6117041,-.1824499,-.4634196,-.1181338,-.8668742,-.3050112,-.1352596,-.4409327,-.7082354,-.03225285,.1171548,.3113096,.3250439,-.8166144,-.463995,-.01014475,.4715334,-.6868284,.05091889,-.4011163,.2717285,-.06756835,.8307694,-.7938535,.4352129,-.4663842,.7165329,.559729,.8093995),this._distributions[21]=new Array(.07832243,.426151,-.3856795,.5799953,.01970797,.06706189,.4822682,.3014512,-.1532982,.87485,-.4959527,.07888043,.260601,-.2304784,.4996209,.7167382,.585986,-.04265174,-.7679967,.5509416,-.9041753,.1802134,-.8407655,-.4442826,-.2058258,-.2636995,-.4984115,-.5928579,.2926032,-.7886473,-.06933882,-.621177,.578115,-.4813387,.8981777,-.3291056,.1942733,.9255584,.8084362,.5066984,.9920095,.03103104,-.2403206,-.9389018),this._distributions[22]=new Array(-.5691095,.1014316,-.7788262,.384012,-.8253665,-.1645582,-.1830993,.002997211,-.2555013,-.4177977,-.6640869,-.4794711,-.2351242,.5850121,.02436554,.2825883,.006061143,-.8200245,.1618791,-.3063331,-.3765897,-.7249815,.6092919,-.6769328,-.5956934,.6957655,.5383642,.4522677,-.1489165,.9125596,.4167473,.1335986,.1898309,.5874342,.2288171,.9624356,.7540846,-.07672304,.8986252,.2788797,.3555991,-.9262139,.8454325,-.4027667,.4945236,-.2935512),this._distributions[23]=new Array(-.4481403,-.3758374,-.8877251,.08739938,.05015831,-.1339983,-.4070427,-.8534173,.1019274,-.5503222,-.445998,.1997541,-.8686263,-.2788867,-.7695944,-.6033704,-.05515742,-.885711,-.7714347,.5790485,.3466263,-.8799297,.4487582,-.5321087,-.2461368,.6053771,-.05568117,.2457351,-.4668669,.8523816,.8103387,-.4255538,.4054182,-.175663,-.2802011,-.08920153,.2665959,.382935,.555679,.1621837,.105246,.8420411,.6921161,.6902903,.880946,.2483067,.9699264,-.1021767),this._distributions[24]=new Array(-.1703323,-.3119385,.2916039,-.2988263,-.008472982,-.9277695,-.7730271,-.3277904,.3440474,-.6815342,-.2910278,.03461745,-.6764899,-.657078,-.3505501,-.7311988,-.03478927,.3258755,-.6048835,.159423,.2035525,.02212214,.5116573,.2226856,.6664805,-.2500189,.7147882,-.6609634,.03030632,-.5763278,-.2516585,.6116219,-.9434413,-.0116792,.9061816,.2491155,.182867,.6076167,.286593,.9485695,-.5992439,.6970096,-.2082874,.9416641,.9880044,-.1541709,-.9122881,.331555,.7324886,.6725098),this._distributions[25]=new Array(.3869598,-.04974834,.7168844,-.0693711,-.07166742,.1725325,.4599592,.3232779,.5872094,-.4198674,.2442266,-.625667,.1254557,.4500048,-.2290154,-.1803567,.890583,.3373493,.1256081,.7853789,-.2676466,.5305805,-.7063224,.252168,-.3989835,.1189921,.09617215,-.2451447,.6302541,.6085876,.9380925,-.3234899,.5086241,-.8573482,.03576187,-.9876697,-.0876712,-.6365195,-.5276513,.823456,-.6935764,-.2240411,-.5212318,-.5383121,-.2116208,.9639363,-.9840096,.02743555,-.3991577,-.8994547,-.7830126,.614068),this._distributions[26]=new Array(-.8366601,.4464895,-.5917366,-.02073906,-.9845258,.1635625,-.3097973,.4379579,-.5478154,.7173221,-.1685888,.9261969,.01503595,.6046097,.4452421,.5449086,.0315687,.1944619,.3753404,.8688548,.4143643,.1396648,.8711032,.4304703,.7328773,.1461501,.6374492,-.3521495,.145613,-.1341466,.9040975,-.135123,-.7839059,-.5450199,-.516019,-.3320859,-.206158,-.4431106,-.9703014,-.2368356,-.2473119,-.0864351,.2130725,-.4604077,-.003726701,-.7122303,-.4072131,-.6833169,.1632999,-.9776646,.4686888,-.680495,-.2293511,-.9509777),this._distributions[27]=new Array(.107311,-.1311369,-.4194764,-.3148777,.6171439,-.2745973,.2796618,.1937153,-.09106886,.4180236,.6044006,.05577846,.02927299,-.6738263,-.2580845,.1179939,-.09023564,-.3830024,.3570953,-.5000587,.81591,-.5518309,.9300217,-.1257987,.4904627,-.8381903,-.3163182,-.8632009,.1137595,-.9875998,.8390043,.3538185,.2149114,.4993694,.5191584,.3833552,.5002763,.7061465,-.2567276,.9068756,-.5197366,.3467845,.03668867,.9734009,-.5347553,.66747,-.9028882,.1023768,-.8967977,.412834,-.5821944,.0426479,-.8032165,-.2397038,-.5597343,-.6358021),this._distributions[28]=new Array(-.6562496,-.1781036,-.9301494,.1185208,-.3861143,-.4153562,-.1560799,-.1099607,-.5587025,.395218,-.5322112,-.699701,-.5008639,.08726846,-.970524,-.1963461,-.813577,-.5185111,-.1644458,.298,-.3216791,.639982,.3315373,.3339162,.2383235,-.00105722,.1137828,.5450742,-.01899921,.8798413,.2849685,.8255596,.6974412,.2123175,.7588523,.5470437,.5102502,-.1687844,.5853448,.8033476,.2590716,-.5262504,.5607718,-.6342825,.8666443,-.1491841,.8341052,-.4935003,-.1568441,-.6634066,.2512113,-.8769391,-.2559827,-.9572457,-.01928852,-.3966542,-.750667,.6409678),this._distributions[29]=new Array(.3454786,-.04837726,.2649553,.2406852,.5599093,-.3839145,-.1111814,-.05502108,.7586042,-.05818377,.2519488,-.4665135,-.1264972,.2602723,-.08766216,-.3671907,.6428129,.3999204,-.6105871,-.1246869,-.4589451,-.7646643,-.03021116,-.7899352,-.6036922,-.4293956,-.2481938,.6534185,.102798,.6784465,-.6392644,.4821358,-.6789002,.1779133,-.9140783,-.1989647,-.9262617,.3381507,.4794891,-.8093274,.3959447,.668478,.9602883,.2272305,-.123672,.9210883,.2375148,.9523395,-.52898,.7973378,-.382433,.1228794,.695015,.6948439,.7530277,-.6458191,.8777987,-.3272956,.2318525,-.962768),this._distributions[30]=new Array(.4518921,-.1146195,.4720805,-.4238748,.3655423,.1806341,.1589939,-.23568,.7673324,-.5149941,.01163658,.09045836,.7010971,.1245747,.7518286,-.1855433,.4960719,.4601022,.2566979,-.6308268,-.0654714,-.5126389,-.1823319,-.1343282,-.1464312,.4883236,-.3858738,.203523,.1484799,.4432284,-.477109,-.116241,.2719092,.7208626,.9104174,.3578536,-.5956199,.7662588,-.6996251,.3678654,-.2514512,.9251933,.1275825,-.9478135,-.204608,-.8611552,.4264838,-.877443,.9854161,.05521112,.5912951,.7997434,.1140349,.982093,-.9324368,-.2094094,-.42436,-.6441524,-.6722705,-.3554261,-.7844236,.08587621),this._distributions[31]=new Array(-.4206714,-.5613642,-.8733016,-.3373051,-.1046226,-.2902999,-.1318562,-.8434365,.1145093,-.5962623,-.4965627,-.1873259,-.5011808,-.8546229,-.7165636,-.5743566,.1090901,.2017643,.3404809,-.220455,-.1989015,.2372122,-.4538706,.0979171,.4514146,-.572846,.2314168,-.8514503,-.4247236,.5650803,-.943347,.04514639,-.1309718,.5221877,-.7004157,.4561877,.6306441,.04448673,.4301621,.5766876,.1078042,.7245752,.3875354,.2794483,.702876,-.2924213,.7360667,-.6210318,.7486517,.6531103,.4898235,.8591025,.6549174,.3854057,-.2596106,.7916998,.9251194,-.05296265,-.5620695,.820877,-.01228026,.9937211,.9612103,.2628758)},Ft.getDistribution=function(t){return this._distributions||this.initDistributions(),t<1||32<t?null:this._distributions[t-1]},Ft),Quaternion=(Object.defineProperty(Ht.prototype,"magnitude",{get:function(){return Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z)},enumerable:!0,configurable:!0}),Ht.prototype.multiply=function(t,e){var i=t.w,n=t.x,r=t.y,o=t.z,s=e.w,a=e.x,l=e.y,c=e.z;this.w=i*s-n*a-r*l-o*c,this.x=i*a+n*s+r*c-o*l,this.y=i*l-n*c+r*s+o*a,this.z=i*c+n*l-r*a+o*s},Ht.prototype.multiplyVector=function(t,e){void 0===e&&(e=null),null===e&&(e=new Ht);var i=t.x,n=t.y,r=t.z;return e.w=-this.x*i-this.y*n-this.z*r,e.x=this.w*i+this.y*r-this.z*n,e.y=this.w*n-this.x*r+this.z*i,e.z=this.w*r+this.x*n-this.y*i,e},Ht.prototype.fromAxisAngle=function(t,e){var i=Math.sin(e/2),n=Math.cos(e/2);this.x=t.x*i,this.y=t.y*i,this.z=t.z*i,this.w=n,this.normalize()},Ht.prototype.slerp=function(t,e,i){var n,r,o,s,a,l=t.w,c=t.x,h=t.y,u=t.z,p=e.w,d=e.x,_=e.y,f=e.z,m=l*p+c*d+h*_+u*f;m<0&&(m=-m,p=-p,d=-d,_=-_,f=-f),m<.95?(n=Math.acos(m),r=1/Math.sin(n),o=Math.sin(n*(1-i))*r,s=Math.sin(n*i)*r,this.w=l*o+p*s,this.x=c*o+d*s,this.y=h*o+_*s,this.z=u*o+f*s):(this.w=l+i*(p-l),this.x=c+i*(d-c),this.y=h+i*(_-h),this.z=u+i*(f-u),a=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=a,this.x*=a,this.y*=a,this.z*=a)},Ht.prototype.lerp=function(t,e,i){var n,r=t.w,o=t.x,s=t.y,a=t.z,l=e.w,c=e.x,h=e.y,u=e.z;r*l+o*c+s*h+a*u<0&&(l=-l,c=-c,h=-h,u=-u),this.w=r+i*(l-r),this.x=o+i*(c-o),this.y=s+i*(h-s),this.z=a+i*(u-a),n=1/Math.sqrt(this.w*this.w+this.x*this.x+this.y*this.y+this.z*this.z),this.w*=n,this.x*=n,this.y*=n,this.z*=n},Ht.prototype.fromEulerAngles=function(t,e,i){var n=.5*t,r=.5*e,o=.5*i,s=Math.cos(n),a=Math.sin(n),l=Math.cos(r),c=Math.sin(r),h=Math.cos(o),u=Math.sin(o);this.w=s*l*h+a*c*u,this.x=a*l*h-s*c*u,this.y=s*c*h+a*l*u,this.z=s*l*u-a*c*h},Ht.prototype.toEulerAngles=function(t){return void 0===t&&(t=null),null===t&&(t=new Vector3D),t.x=Math.atan2(2*(this.w*this.x+this.y*this.z),1-2*(this.x*this.x+this.y*this.y)),t.y=Math.asin(2*(this.w*this.y-this.z*this.x)),t.z=Math.atan2(2*(this.w*this.z+this.x*this.y),1-2*(this.y*this.y+this.z*this.z)),t},Ht.prototype.normalize=function(t){void 0===t&&(t=1);var e=t/Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w);this.x*=e,this.y*=e,this.z*=e,this.w*=e},Ht.prototype.toString=function(){return"{x:"+this.x+" y:"+this.y+" z:"+this.z+" w:"+this.w+"}"},Ht.prototype.toMatrix3D=function(t){void 0===t&&(t=null);var e=2*this.x*this.y,i=2*this.x*this.z,n=2*this.x*this.w,r=2*this.y*this.z,o=2*this.y*this.w,s=2*this.z*this.w,a=this.x*this.x,l=this.y*this.y,c=this.z*this.z,h=this.w*this.w,u=(t=t||new Matrix3D)._rawData;return u[0]=a-l-c+h,u[4]=e-s,u[8]=i+o,u[12]=0,u[1]=e+s,u[5]=l-a-c+h,u[9]=r-n,u[13]=0,u[2]=i-o,u[6]=r+n,u[10]=-a-l+c+h,u[14]=0,u[3]=0,u[7]=0,u[11]=0,u[15]=1,t},Ht.prototype.fromMatrix=function(t){var e=t.decompose(Orientation3D.QUATERNION)[1];this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w},Ht.prototype.toRawData=function(t,e){void 0===e&&(e=!1);var i=2*this.x*this.y,n=2*this.x*this.z,r=2*this.x*this.w,o=2*this.y*this.z,s=2*this.y*this.w,a=2*this.z*this.w,l=this.x*this.x,c=this.y*this.y,h=this.z*this.z,u=this.w*this.w;t[0]=l-c-h+u,t[1]=i-a,t[2]=n+s,t[4]=i+a,t[5]=c-l-h+u,t[6]=o-r,t[8]=n-s,t[9]=o+r,t[10]=-l-c+h+u,t[3]=t[7]=t[11]=0,e||(t[12]=t[13]=t[14]=0,t[15]=1)},Ht.prototype.clone=function(){return new Ht(this.x,this.y,this.z,this.w)},Ht.prototype.rotatePoint=function(t,e){var i,n,r,o;void 0===e&&(e=null);var s=t.x,a=t.y,l=t.z;return null===e&&(e=new Vector3D),o=-this.x*s-this.y*a-this.z*l,i=this.w*s+this.y*l-this.z*a,n=this.w*a-this.x*l+this.z*s,r=this.w*l+this.x*a-this.y*s,e.x=-o*this.x+i*this.w-n*this.z+r*this.y,e.y=-o*this.y+i*this.z+n*this.w-r*this.x,e.z=-o*this.z-i*this.y+n*this.x+r*this.w,e},Ht.prototype.copyFrom=function(t){this.x=t.x,this.y=t.y,this.z=t.z,this.w=t.w},Ht),Rectangle=(Dv.prototype.axCallPublicProperty=function(t,e){return null},Dv.prototype.axGetPublicProperty=function(t){return null},Dv.prototype.axSetPublicProperty=function(t){return null},Object.defineProperty(Dv.prototype,"height",{get:function(){return this._rawData[3]},set:function(t){this._rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"width",{get:function(){return this._rawData[2]},set:function(t){this._rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"x",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"y",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"bottom",{get:function(){return this._rawData[1]+this._rawData[3]},set:function(t){this._rawData[3]=t-this._rawData[1]},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"bottomRight",{get:function(){return null==this._bottomRight&&(this._bottomRight=new Point),this._bottomRight._rawData[0]=this._rawData[0]+this._rawData[2],this._bottomRight._rawData[1]=this._rawData[1]+this._rawData[3],this._bottomRight},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"left",{get:function(){return this._rawData[0]},set:function(t){this._rawData[2]+=this._rawData[0]-t,this._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"right",{get:function(){return this._rawData[0]+this._rawData[2]},set:function(t){this._rawData[2]=t-this._rawData[0]},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"size",{get:function(){return null==this._size&&(this._size=new Point),this._size._rawData[0]=this._rawData[2],this._size._rawData[1]=this._rawData[3],this._size},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"top",{get:function(){return this._rawData[1]},set:function(t){this._rawData[3]+=this._rawData[1]-t,this._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(Dv.prototype,"topLeft",{get:function(){return null==this._topLeft&&(this._topLeft=new Point),this._topLeft._rawData[0]=this._rawData[0],this._topLeft._rawData[1]=this._rawData[1],this._topLeft},enumerable:!0,configurable:!0}),Dv.prototype.clone=function(){var t=this._rawData;return new Dv(t[0],t[1],t[2],t[3])},Dv.prototype.contains=function(t,e){var i=this._rawData;return i[0]<=t&&i[0]+i[2]>=t&&i[1]<=e&&i[1]+i[3]>=e},Dv.prototype.containsPoint=function(t){var e=this._rawData,i=t._rawData;return e[0]<=i[0]&&e[0]+e[2]>=i[0]&&e[1]<=i[1]&&e[1]+e[3]>=i[1]},Dv.prototype.containsRect=function(t){var e=this._rawData,i=t._rawData;return e[0]<=i[0]&&e[0]+e[2]>=i[0]+i[2]&&e[1]<=i[1]&&e[1]+e[3]>=i[1]+i[3]},Dv.prototype.copyFrom=function(t){var e=this._rawData,i=t._rawData;e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3]},Dv.prototype.equals=function(t){var e=this._rawData,i=t._rawData;return e[0]==i[0]&&e[1]==i[1]&&e[2]==i[2]&&e[3]==i[3]},Dv.prototype.inflate=function(t,e){var i=this._rawData;i[0]-=t/2,i[1]-=e/2,i[2]+=t/2,i[3]+=e/2},Dv.prototype.inflatePoint=function(t){var e=this._rawData;e[0]-=t.x/2,e[1]-=t.y/2,e[2]+=t.x/2,e[3]+=t.y/2},Dv.prototype.intersection=function(t){var e=this._rawData,i=t._rawData;if(this.intersects(t)){var n=new Dv,r=n._rawData;return e[0]>i[0]?(r[0]=e[0],r[2]=i[0]-e[0]+i[2],r[2]>e[2]&&(r[2]=e[2])):(r[0]=i[0],r[2]=e[0]-i[0]+e[2],r[2]>i[2]&&(r[2]=i[2])),e[1]>i[1]?(r[1]=e[1],r[3]=i[1]-e[1]+i[3],r[3]>e[3]&&(r[3]=e[3])):(r[1]=i[1],r[3]=e[1]-i[1]+e[3],r[3]>i[3]&&(r[3]=i[3])),n}return new Dv},Dv.prototype.intersects=function(t){var e=this._rawData,i=t._rawData;return e[0]+e[2]>i[0]&&e[0]<i[0]+i[2]&&e[1]+e[3]>i[1]&&e[1]<i[1]+i[3]},Dv.prototype.isEmpty=function(){var t=this._rawData;return 0==t[0]&&0==t[1]&&0==t[2]&&0==t[3]},Dv.prototype.offset=function(t,e){this._rawData[0]+=t,this._rawData[1]+=e},Dv.prototype.offsetPoint=function(t){this._rawData[0]+=t.x,this._rawData[1]+=t.y},Dv.prototype.setEmpty=function(){var t=this._rawData;t[0]=0,t[1]=0,t[2]=0,t[3]=0},Dv.prototype.setTo=function(t,e,i,n){var r=this._rawData;r[0]=t,r[1]=e,r[2]=i,r[3]=n},Dv.prototype.toString=function(){return"[Rectangle] (x="+this.x+", y="+this.y+", width="+this.width+", height="+this.height+")"},Dv.prototype.union=function(t){var e=this._rawData,i=t._rawData,n=new Dv,r=n._rawData;return e[0]<i[0]?(r[0]=e[0],r[2]=i[0]-e[0]+i[2],r[2]<e[2]&&(r[2]=e[2])):(r[0]=i[0],r[2]=e[0]-i[0]+e[2],r[2]<i[2]&&(r[2]=i[2])),e[1]<i[1]?(r[1]=e[1],r[3]=i[1]-e[1]+i[3],r[3]<e[3]&&(r[3]=e[3])):(r[1]=i[1],r[3]=e[1]-i[1]+e[3],r[3]<i[3]&&(r[3]=i[3])),n},Dv),AbstractionBase=(Lw=EventDispatcher,__extends(Mw,Lw),Mw.prototype.onClear=function(t){this._asset&&(this._asset.removeEventListener(AssetEvent.CLEAR,this._onClearDelegate),this._asset.removeEventListener(AssetEvent.INVALIDATE,this._onInvalidateDelegate)),this._pool.clearAbstraction(this._asset),this._pool=null,this._asset=null},Mw.prototype.onInvalidate=function(t){this._invalid=!0},Mw),AssetLibraryIterator=(Object.defineProperty(Uw.prototype,"currentAsset",{get:function(){return this._idx<this._filtered.length?this._filtered[this._idx]:null},enumerable:!0,configurable:!0}),Object.defineProperty(Uw.prototype,"numAssets",{get:function(){return this._filtered.length},enumerable:!0,configurable:!0}),Uw.prototype.next=function(){var t=null;return this._idx<this._filtered.length&&(t=this._filtered[this._idx]),this._idx++,t},Uw.prototype.reset=function(){this._idx=0},Uw.prototype.setIndex=function(t){this._idx=t},Uw.prototype.filter=function(t,e,i){if(t||e){var n,r=0;this._filtered=new Array;for(var o=this._assets.length,s=0;s<o;s++)n=this._assets[s],t&&n.adaptee.assetType!=t||e&&n.adaptee.assetNamespace!=e||null!=i&&!i(n)||(this._filtered[r++]=n)}else this._filtered=this._assets},Uw),ConflictPrecedence=(gx.FAVOR_OLD="favorOld",gx.FAVOR_NEW="favorNew",gx),ConflictStrategyBase=(hx.prototype.resolveConflict=function(t,e,i,n){throw new AbstractMethodError},hx.prototype.create=function(){throw new AbstractMethodError},hx.prototype._pUpdateNames=function(t,e,i,n,r,o){var s,a=o===ConflictPrecedence.FAVOR_NEW?n:i,l=(s=o===ConflictPrecedence.FAVOR_NEW?i:n).adaptee.name;r[a.adaptee.name]=a,(r[e]=s).adaptee.resetAssetPath(e,t,!1),s.adaptee.dispatchEvent(new AssetEvent(AssetEvent.ASSET_CONFLICT_RESOLVED,s.adaptee,l))},hx),ErrorConflictStrategy=(vx=ConflictStrategyBase,__extends(wx,vx),wx.prototype.resolveConflict=function(t,e,i,n){throw new ErrorBase("Asset name collision while AssetLibrary.namingStrategy set to AssetLibrary.THROW_ERROR. Asset path: "+t.adaptee.assetFullPath)},wx.prototype.create=function(){return new wx},wx),IgnoreConflictStrategy=(Bx=ConflictStrategyBase,__extends(Cx,Bx),Cx.prototype.resolveConflict=function(t,e,i,n){},Cx.prototype.create=function(){return new Cx},Cx),NumSuffixConflictStrategy=(Hx=ConflictStrategyBase,__extends(Ix,Hx),Ix.prototype.resolveConflict=function(t,e,i,n){var r,o,s,a;for(0<=(r=t.adaptee.name).indexOf(this._separator)?(s=r.substring(0,r.lastIndexOf(this._separator)),a=parseInt(r.substring(s.length-1)),isNaN(a)&&(s=r,a=0)):(s=r,a=0),0==a&&this._next_suffix.hasOwnProperty(s)&&(a=this._next_suffix[s]);a++,o=s.concat(this._separator,a.toString()),i.hasOwnProperty(o););this._next_suffix[s]=a,this._pUpdateNames(e.adaptee.assetNamespace,o,e,t,i,n)},Ix.prototype.create=function(){return new Ix(this._separator)},Ix),ConflictStrategy=(Tx.APPEND_NUM_SUFFIX=new NumSuffixConflictStrategy,Tx.IGNORE=new IgnoreConflictStrategy,Tx.THROW_ERROR=new ErrorConflictStrategy,Tx),URLLoaderDataFormat=(Vx.TEXT="text",Vx.VARIABLES="variables",Vx.BLOB="blob",Vx.ARRAY_BUFFER="arraybuffer",Vx.BINARY="binary",Vx),URLRequestMethod=(Wx.POST="POST",Wx.GET="GET",Wx),URLVariables=(Xx.prototype.decode=function(t){t=t.split("+").join(" ");for(var e,i=/[?&]?([^=]+)=([^&]*)/g;e=i.exec(t);)this._variables[decodeURIComponent(e[1])]=decodeURIComponent(e[2])},Xx.prototype.toString=function(){return""},Object.defineProperty(Xx.prototype,"variables",{get:function(){return this._variables},set:function(t){this._variables=t},enumerable:!0,configurable:!0}),Object.defineProperty(Xx.prototype,"formData",{get:function(){var t=new FormData;for(var e in this._variables)t.append(e,this._variables[e]);return t},enumerable:!0,configurable:!0}),Xx),URLLoader=(dy=EventDispatcher,__extends(ey,dy),Object.defineProperty(ey.prototype,"url",{get:function(){return this._request?this._request.url:""},enumerable:!0,configurable:!0}),Object.defineProperty(ey.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(ey.prototype,"dataFormat",{get:function(){return this._dataFormat},set:function(t){this._dataFormat=t},enumerable:!0,configurable:!0}),Object.defineProperty(ey.prototype,"bytesLoaded",{get:function(){return this._bytesLoaded},enumerable:!0,configurable:!0}),Object.defineProperty(ey.prototype,"bytesTotal",{get:function(){return this._bytesTotal},enumerable:!0,configurable:!0}),ey.prototype.load=function(t){this._request=t,this.initXHR(),t.method===URLRequestMethod.POST?this.postRequest(t):this.getRequest(t)},ey.prototype.isSupported=function(){return null!=window},ey.prototype.close=function(){this._XHR.abort(),this.disposeXHR()},ey.prototype.dispose=function(){this._XHR&&this._XHR.abort(),this.disposeXHR()},ey.prototype.setResponseType=function(t,e){switch(e){case URLLoaderDataFormat.ARRAY_BUFFER:case URLLoaderDataFormat.BLOB:case URLLoaderDataFormat.TEXT:t.responseType=e;break;case URLLoaderDataFormat.VARIABLES:t.responseType=URLLoaderDataFormat.TEXT;break;case URLLoaderDataFormat.BINARY:t.responseType=""}},ey.prototype.getRequest=function(t){try{this._XHR.open(t.method,t.url,t.async),this.setResponseType(this._XHR,this._dataFormat),this._XHR.send()}catch(t){this.handleXmlHttpRequestException(t)}},ey.prototype.postRequest=function(t){if(this._loadError=!1,this._XHR.open(t.method,t.url,t.async),null!=t.data)if(t.data instanceof URLVariables){var e=t.data;try{this._XHR.responseType="text",this._XHR.send(e.formData)}catch(t){this.handleXmlHttpRequestException(t)}}else this.setResponseType(this._XHR,this._dataFormat),t.data?this._XHR.send(t.data):this._XHR.send();else this._XHR.send()},ey.prototype.handleXmlHttpRequestException=function(t){t.code},ey.prototype.initXHR=function(){var e=this;this._XHR||(this._XHR=new XMLHttpRequest,this._XHR.onloadstart=function(t){return e.onLoadStart(t)},this._XHR.onprogress=function(t){return e.onProgress(t)},this._XHR.onabort=function(t){return e.onAbort(t)},this._XHR.onerror=function(t){return e.onLoadError(t)},this._XHR.onload=function(t){return e.onLoadComplete(t)},this._XHR.ontimeout=function(t){return e.onTimeOut(t)},this._XHR.onloadend=function(t){return e.onLoadEnd(t)},this._XHR.onreadystatechange=function(t){return e.onReadyStateChange(t)})},ey.prototype.disposeXHR=function(){null!==this._XHR&&(this._XHR.onloadstart=null,this._XHR.onprogress=null,this._XHR.onabort=null,this._XHR.onerror=null,this._XHR.onload=null,this._XHR.ontimeout=null,this._XHR.onloadend=null,this._XHR=null)},ey.prototype.decodeURLVariables=function(t){var e=new Object;t=t.split("+").join(" ");for(var i,n=/[?&]?([^=]+)=([^&]*)/g;i=n.exec(t);)e[decodeURIComponent(i[1])]=decodeURIComponent(i[2]);return e},ey.prototype.onReadyStateChange=function(t){4==this._XHR.readyState&&(this._status=this._XHR.status,404==this._status&&(this._loadError=!0,this.dispatchEvent(this._loadErrorEvent||(this._loadErrorEvent=new URLLoaderEvent(URLLoaderEvent.LOAD_ERROR,this)))),this.dispatchEvent(this._statusEvent||(this._statusEvent=new URLLoaderEvent(URLLoaderEvent.HTTP_STATUS,this))))},ey.prototype.onLoadEnd=function(t){this._loadError},ey.prototype.onTimeOut=function(t){},ey.prototype.onAbort=function(t){},ey.prototype.onProgress=function(t){this._bytesTotal=t.total,this._bytesLoaded=t.loaded,this.dispatchEvent(this._progressEvent||(this._progressEvent=new URLLoaderEvent(URLLoaderEvent.LOAD_PROGRESS,this)))},ey.prototype.onLoadStart=function(t){this.dispatchEvent(this._loadStartEvent||(this._loadStartEvent=new URLLoaderEvent(URLLoaderEvent.LOAD_START,this)))},ey.prototype.onLoadComplete=function(t){if(!0!==this._loadError){switch(this._dataFormat){case URLLoaderDataFormat.TEXT:this._data=this._XHR.responseText;break;case URLLoaderDataFormat.VARIABLES:this._data=this.decodeURLVariables(this._XHR.responseText);break;case URLLoaderDataFormat.BLOB:case URLLoaderDataFormat.ARRAY_BUFFER:case URLLoaderDataFormat.BINARY:this._data=this._XHR.response;break;default:this._data=this._XHR.responseText}this.dispatchEvent(this._loadCompleteEvent||(this._loadCompleteEvent=new URLLoaderEvent(URLLoaderEvent.LOAD_COMPLETE,this)))}},ey.prototype.onLoadError=function(t){this._loadError=!0,this.dispatchEvent(this._loadErrorEvent||(this._loadErrorEvent=new URLLoaderEvent(URLLoaderEvent.LOAD_ERROR,this)))},ey),ResourceDependency=(Object.defineProperty(Jy.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"sub_id",{get:function(){return this._sub_id},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"request",{get:function(){return this._request},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"parser",{get:function(){return this._parser},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"parentParser",{get:function(){return this._parentParser},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"retrieveAsRawData",{get:function(){return this._retrieveAsRawData},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"suppresAssetEvents",{get:function(){return this._suppressAssetEvents},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"assets",{get:function(){return this._assets},enumerable:!0,configurable:!0}),Object.defineProperty(Jy.prototype,"dependencies",{get:function(){return this._dependencies},enumerable:!0,configurable:!0}),Jy.prototype.setData=function(t){this._data=t},Jy.prototype.setParser=function(t){this._parser=t},Jy.prototype.resolve=function(){this._parentParser&&this._parentParser._iResolveDependency(this)},Jy.prototype.resolveFailure=function(){this._parentParser&&this._parentParser._iResolveDependencyFailure(this)},Jy.prototype.resolveName=function(t){return this._parentParser?this._parentParser._iResolveDependencyName(this,t):t.name},Jy),LoaderContext=(Object.defineProperty(Vy.prototype,"includeDependencies",{get:function(){return this._includeDependencies},set:function(t){this._includeDependencies=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vy.prototype,"materialMode",{get:function(){return this._materialMode},set:function(t){this._materialMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vy.prototype,"externalAssetMode",{get:function(){return this._externalAssetMode},set:function(t){this._externalAssetMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vy.prototype,"dependencyBaseUrl",{get:function(){return this._dependencyBaseUrl},set:function(t){this._dependencyBaseUrl=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vy.prototype,"overrideAbsolutePaths",{get:function(){return this._overrideAbsPath},set:function(t){this._overrideAbsPath=t},enumerable:!0,configurable:!0}),Object.defineProperty(Vy.prototype,"overrideFullURLs",{get:function(){return this._overrideFullUrls},set:function(t){this._overrideFullUrls=t},enumerable:!0,configurable:!0}),Vy.prototype.mapUrl=function(t,e){this._remappedUrls[t]=e},Vy.prototype.mapUrlToData=function(t,e){this._embeddedDataByUrl[t]=e},Vy.prototype._iHasDataForUrl=function(t){return this._embeddedDataByUrl.hasOwnProperty(t)},Vy.prototype._iGetDataForUrl=function(t){return this._embeddedDataByUrl[t]},Vy.prototype._iHasMappingForUrl=function(t){return this._remappedUrls.hasOwnProperty(t)},Vy.prototype._iGetRemappedUrl=function(t){return this._remappedUrls[t]},Vy.UNDEFINED=0,Vy.SINGLEPASS_MATERIALS=1,Vy.MULTIPASS_MATERIALS=2,Vy.ON_DEMAND="onDemand",Vy.PRELOADED="preloaded",Vy),Loader=(kz=EventDispatcher,__extends(lz,kz),lz.enableParser=function(t){lz._parsers.indexOf(t)<0&&lz._parsers.push(t)},lz.enableParsers=function(t){for(var e=0;e<t.length;e++)lz.enableParser(t[e])},Object.defineProperty(lz.prototype,"baseDependency",{get:function(){return this._baseDependency},enumerable:!0,configurable:!0}),lz.prototype.load=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this._uri=t.url=t.url.replace(/\\/g,"/"),this._context=e,this._namespace=i,this.dispatchEvent(new LoaderEvent(LoaderEvent.LOADER_START,this._uri,null,null)),this._baseDependency=new ResourceDependency("",t,null,n,null),this._retrieveDependency(this._baseDependency)},lz.prototype.loadData=function(t,e,i,n,r){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),this._uri=n,this._context=i,this._namespace=n,this.dispatchEvent(new LoaderEvent(LoaderEvent.LOADER_START,this._uri,null,null)),this._baseDependency=new ResourceDependency(e,null,t,r,null),this._retrieveDependency(this._baseDependency)},lz.prototype._retrieveNext=function(t){var e,i;void 0===t&&(t=null),this._currentDependency.dependencies.length?(e=this._currentDependency.dependencies.pop(),this._stack.push(this._currentDependency),this._retrieveDependency(e)):this._currentDependency.parser&&this._currentDependency.parser.parsingPaused?this._currentDependency.parser._iResumeParsing():this._stack&&this._stack.length?(i=this._currentDependency,this._currentDependency=this._stack.pop(),i.success&&i.resolve(),this._retrieveNext(t)):this.dispatchEvent(new LoaderEvent(LoaderEvent.LOADER_COMPLETE,this._uri,this._baseDependency.parser.content,this._baseDependency.assets))},lz.prototype._retrieveDependency=function(t){var e;this._context&&0!=this._context.materialMode&&(this._materialMode=this._context.materialMode),e=(this._currentDependency=t).data,this._context&&t.request&&(this._context._iHasDataForUrl(t.request.url)?e=this._context._iGetDataForUrl(t.request.url):this._context.externalAssetMode!=LoaderContext.ON_DEMAND||"jpg"!=this.getSuffix(t.request.url)&&"png"!=this.getSuffix(t.request.url)||(e=t.request,t.parser||t.setParser(this.getParserFromSuffix(t.request.url)))),e?(e.constructor===Function&&(e=new e),t.setData(e),t.retrieveAsRawData?(t.resolve(),this._retrieveNext()):this._parseDependency(t)):(t.loader=new URLLoader,this._addEventListeners(t.loader),t.request.url=this._resolveDependencyUrl(t),t.retrieveAsRawData?t.loader.dataFormat=URLLoaderDataFormat.BINARY:(t.parser||t.setParser(this.getParserFromSuffix(t.request.url)),t.parser?t.loader.dataFormat=t.parser.dataFormat:t.loader.dataFormat=URLLoaderDataFormat.BINARY),t.loader.load(t.request))},lz.prototype._joinUrl=function(t,e){return"/"!=e.charAt(0)&&"\\"!=e.charAt(0)||(e=e.substr(1)),"."==e.charAt(0)&&(e=e.substr(2)),0==t.length?e:("/"!=t.charAt(t.length-1)&&"\\"!=t.charAt(t.length-1)||(t=t.substr(0,t.length-1)),t.concat("/",e))},lz.prototype._resolveDependencyUrl=function(t){var e,i,n=t.request.url;if(this._context&&this._context._iHasMappingForUrl(n))return this._context._iGetRemappedUrl(n);if(n==this._uri)return n;if(e=new RegExp("/^[a-zA-Z]{3,4}:///"),"/"==n.charAt(0))return this._context&&this._context.overrideAbsolutePaths?this._joinUrl(this._context.dependencyBaseUrl,n):n;if(e.test(n)&&this._context&&this._context.overrideFullURLs){var r=n.replace(e,"");return this._joinUrl(this._context.dependencyBaseUrl,r)}return i=this._context&&this._context.dependencyBaseUrl?this._context.dependencyBaseUrl:this._uri.substring(0,this._uri.lastIndexOf("/")+1),this._joinUrl(i,n)},lz.prototype._retrieveParserDependencies=function(){if(this._currentDependency){for(var t=this._currentDependency.parser.dependencies,e=t.length,i=0;i<e;i++)this._currentDependency.dependencies[i]=t[i];t.length=0,this._stack.push(this._currentDependency),this._retrieveNext()}},lz.prototype._resolveParserDependencies=function(){this._currentDependency.success=!0,this._currentDependency.parser&&this._currentDependency.parser.dependencies.length&&(!this._context||this._context.includeDependencies)?this._retrieveParserDependencies():this._retrieveNext()},lz.prototype._onLoadError=function(t){if(!this.hasEventListener(URLLoaderEvent.LOAD_ERROR))throw new Error;this.dispatchEvent(t),this._currentDependency!=this._baseDependency?(this._currentDependency.resolveFailure(),this._retrieveNext()):this.dispose()},lz.prototype._onParseError=function(t){if(!this.hasEventListener(ParserEvent.PARSE_ERROR))throw new Error(t.message);this.dispatchEvent(t),this._retrieveNext()},lz.prototype._onAssetComplete=function(t){this._currentDependency&&this._currentDependency.assets.push(t.asset),t.asset.resetAssetPath(t.asset.name,this._namespace),this._currentDependency.suppresAssetEvents||this.dispatchEvent(t)},lz.prototype._onReadyForDependencies=function(t){this._context&&!this._context.includeDependencies?t.target._iResumeParsing():this._retrieveParserDependencies()},lz.prototype._onLoadProgress=function(t){this.dispatchEvent(t)},lz.prototype._onLoadComplete=function(t){var e=t.urlLoader;this.dispatchEvent(t),this._removeEventListeners(e),this._currentDependency.setData(e.data),this._currentDependency.retrieveAsRawData?this._resolveParserDependencies():this._parseDependency(this._currentDependency)},lz.prototype._onParseComplete=function(t){var e=t.target;e.removeEventListener(ParserEvent.READY_FOR_DEPENDENCIES,this._onReadyForDependenciesDelegate),e.removeEventListener(ParserEvent.PARSE_COMPLETE,this._onParseCompleteDelegate),e.removeEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),e.removeEventListener(AssetEvent.TEXTURE_SIZE_ERROR,this._onTextureSizeErrorDelegate),e.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),this._resolveParserDependencies()},lz.prototype._onTextureSizeError=function(t){t.asset.name=this._currentDependency.resolveName(t.asset),this.dispatchEvent(t)},lz.prototype._addEventListeners=function(t){t.addEventListener(URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate),t.addEventListener(URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate),t.addEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate)},lz.prototype._removeEventListeners=function(t){t.removeEventListener(URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate),t.removeEventListener(URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate),t.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate)},lz.prototype.stop=function(){this.dispose()},lz.prototype.dispose=function(){this._context=null,this._stack=null,this._currentDependency&&this._currentDependency.loader&&this._removeEventListeners(this._currentDependency.loader),this._currentDependency=null},lz.prototype._getParserFromData=function(t){for(var e=lz._parsers.length-1;0<=e;e--)if(lz._parsers[e].supportsData(t))return new lz._parsers[e];return null},lz.prototype._parseDependency=function(t){var e=t.parser;if(e||t.setParser(e=this._getParserFromData(t.data)),e)e.addEventListener(ParserEvent.READY_FOR_DEPENDENCIES,this._onReadyForDependenciesDelegate),e.addEventListener(ParserEvent.PARSE_COMPLETE,this._onParseCompleteDelegate),e.addEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),e.addEventListener(AssetEvent.TEXTURE_SIZE_ERROR,this._onTextureSizeErrorDelegate),e.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),t.request&&t.request.url&&(e._iFileName=t.request.url),e.materialMode=this._materialMode,e.parseAsync(t.data);else{var i="No parser defined. To enable all parsers for auto-detection, use Parsers.enableAllBundled()";if(!this.hasEventListener(ParserEvent.PARSE_ERROR))throw new Error(i);this.dispatchEvent(new ParserEvent(ParserEvent.PARSE_ERROR,i)),this._retrieveNext()}},lz.prototype.getParserFromSuffix=function(t){for(var e=this.getSuffix(t),i=lz._parsers.length-1;0<=i;i--){var n=lz._parsers[i];if(n.supportsType(e))return new n}return null},lz.prototype.getSuffix=function(t){var e=0<t.indexOf("?")?t.split("?")[0]:t;return e.substr(e.lastIndexOf(".")+1).toLowerCase()},lz._parsers=new Array,lz),AssetLibraryBundle=(sA=EventDispatcher,__extends(tA,sA),tA.prototype.addEventListener=function(t,e){if(t==URLLoaderEvent.LOAD_ERROR||t==ParserEvent.PARSE_ERROR)for(var i;i<this._loaderSessions.length;i++)this._loaderSessions[i].addEventListener(t,this._errorDelegateSelector[t]);sA.prototype.addEventListener.call(this,t,e)},tA.prototype.removeEventListener=function(t,e){if(t==URLLoaderEvent.LOAD_ERROR||t==ParserEvent.PARSE_ERROR)for(var i;i<this._loaderSessions.length;i++)this._loaderSessions[i].removeEventListener(t,this._errorDelegateSelector[t]);sA.prototype.removeEventListener.call(this,t,e)},tA.getInstance=function(t){return void 0===t&&(t="default"),t=t||"default",tA._iInstances.hasOwnProperty(t)||(tA._iInstances[t]=new tA),tA._iInstances[t]},tA.prototype.enableParser=function(t){Loader.enableParser(t)},tA.prototype.enableParsers=function(t){Loader.enableParsers(t)},Object.defineProperty(tA.prototype,"conflictStrategy",{get:function(){return this._strategy},set:function(t){if(!t)throw new ErrorBase("namingStrategy must not be null. To ignore naming, use AssetLibrary.IGNORE");this._strategy=t.create()},enumerable:!0,configurable:!0}),Object.defineProperty(tA.prototype,"conflictPrecedence",{get:function(){return this._strategyPreference},set:function(t){this._strategyPreference=t},enumerable:!0,configurable:!0}),tA.prototype.createIterator=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),new AssetLibraryIterator(this._assets,t,e,i)},tA.prototype.load=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this.getLoader().load(t,e,i,n)},tA.prototype.loadData=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this.getLoader().loadData(t,"",e,i,n)},tA.prototype.getLoader=function(){var t=new Loader;return this._loaderSessions.push(t),t.addEventListener(LoaderEvent.LOADER_START,this._onLoaderStartDelegate),t.addEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),t.addEventListener(AssetEvent.TEXTURE_SIZE_ERROR,this._onTextureSizeErrorDelegate),t.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),this.hasEventListener(URLLoaderEvent.LOAD_ERROR)&&t.addEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this.hasEventListener(ParserEvent.PARSE_ERROR)&&t.addEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),t},tA.prototype.stopLoader=function(t){var e=this._loaderSessions.indexOf(t);if(-1==e)throw new Error("loader is not an active session");this._loaderSessions.splice(e,1),this._killLoaderSession(t)},tA.prototype.getAsset=function(t,e){return void 0===e&&(e=null),this._assetDictDirty&&this.rehashAssetDict(),null==e&&(e=AssetBase.DEFAULT_NAMESPACE),this._assetDictionary.hasOwnProperty(e)?this._assetDictionary[e][t.toString().toLowerCase()]:null},tA.prototype.getAllAssets=function(){return this._assets},tA.prototype.addAsset=function(t){var e,i;0<=this._assets.indexOf(t)||(i=this.getAsset(t.adaptee.name,t.adaptee.assetNamespace),e=t.adaptee.assetNamespace||AssetBase.DEFAULT_NAMESPACE,null!=i&&this._strategy.resolveConflict(t,i,this._assetDictionary[e],this._strategyPreference),this._assets.push(t),this._assetDictionary.hasOwnProperty(e)||(this._assetDictionary[e]=new Object),(this._assetDictionary[e][t.adaptee.name.toString().toLowerCase()]=t).adaptee.addEventListener(AssetEvent.RENAME,this._onAssetRenameDelegate),t.adaptee.addEventListener(AssetEvent.ASSET_CONFLICT_RESOLVED,this._onAssetConflictResolvedDelegate))},tA.prototype.removeAsset=function(t,e){var i;void 0===e&&(e=!0),this.removeAssetFromDict(t),t.adaptee.removeEventListener(AssetEvent.RENAME,this._onAssetRenameDelegate),t.adaptee.removeEventListener(AssetEvent.ASSET_CONFLICT_RESOLVED,this._onAssetConflictResolvedDelegate),0<=(i=this._assets.indexOf(t))&&this._assets.splice(i,1),e&&t.dispose()},tA.prototype.removeAssetByName=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=!0);var n=this.getAsset(t,e);return n&&this.removeAsset(n,i),n},tA.prototype.removeAllAssets=function(t){if(void 0===t&&(t=!0),t)for(var e=this._assets.length,i=0;i<e;i++)this._assets[i].dispose();this._assets.length=0,this.rehashAssetDict()},tA.prototype.removeNamespaceAssets=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0);var i,n=0,r=this._assets.concat();this._assets.length=0,null==t&&(t=AssetBase.DEFAULT_NAMESPACE);for(var o=r.length,s=0;s<o;s++)(i=r[s]).adaptee.assetNamespace==t?(e&&i.dispose(),this.removeAssetFromDict(i,!1)):this._assets[n++]=i;this._assetDictionary.hasOwnProperty(t)&&delete this._assetDictionary[t]},tA.prototype.removeAssetFromDict=function(t,e){void 0===e&&(e=!0),this._assetDictDirty&&this.rehashAssetDict(),this._assetDictionary.hasOwnProperty(t.adaptee.assetNamespace)&&(this._assetDictionary[t.adaptee.assetNamespace].hasOwnProperty(t.adaptee.name.toString().toLowerCase())&&delete this._assetDictionary[t.adaptee.assetNamespace][t.adaptee.name.toString().toLowerCase()],e&&!Object.keys(this._assetDictionary[t.adaptee.assetNamespace]).length&&delete this._assetDictionary[t.adaptee.assetNamespace])},tA.prototype.stop=function(){for(var t=this._loaderSessions.length,e=0;e<t;e++)this._killLoaderSession(this._loaderSessions[e]);this._loaderSessions=new Array},tA.prototype.rehashAssetDict=function(){var t;this._assetDictionary={};for(var e=this._assets.length,i=0;i<e;i++)t=this._assets[i],this._assetDictionary.hasOwnProperty(t.adaptee.assetNamespace)||(this._assetDictionary[t.adaptee.assetNamespace]={}),this._assetDictionary[t.adaptee.assetNamespace][t.adaptee.name.toString().toLowerCase()]=t;this._assetDictDirty=!1},tA.prototype._onLoadError=function(t){this.dispatchEvent(t)},tA.prototype._onParseError=function(t){this.dispatchEvent(t)},tA.prototype._onAssetComplete=function(t){this.addAsset(t.asset.adapter),this.dispatchEvent(t)},tA.prototype._onTextureSizeError=function(t){this.dispatchEvent(t)},tA.prototype._onLoaderStart=function(t){this.dispatchEvent(t)},tA.prototype._onLoaderComplete=function(t){this.stopLoader(t.target),this.dispatchEvent(t)},tA.prototype._killLoaderSession=function(t){t.removeEventListener(LoaderEvent.LOADER_START,this._onLoaderStartDelegate),t.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),t.removeEventListener(AssetEvent.TEXTURE_SIZE_ERROR,this._onTextureSizeErrorDelegate),t.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),this.hasEventListener(URLLoaderEvent.LOAD_ERROR)&&t.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this.hasEventListener(ParserEvent.PARSE_ERROR)&&t.removeEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),t.stop()},tA.prototype._onAssetRename=function(t){var e=t.target.adapter,i=this.getAsset(e.adaptee.assetNamespace,e.adaptee.name);if(null!=i)this._strategy.resolveConflict(e,i,this._assetDictionary[e.adaptee.assetNamespace],this._strategyPreference);else{var n=this._assetDictionary[t.asset.assetNamespace];if(null==n)return;n[t.prevName]=null,n[t.asset.name.toString().toLowerCase()]=t.asset}},tA.prototype._onAssetConflictResolved=function(t){this.dispatchEvent(t.clone())},tA._iInstances=new Object,tA),AssetLibrary=(QB.getBundle=function(t){return void 0===t&&(t="default"),AssetLibraryBundle.getInstance(t)},QB.enableParser=function(t){Loader.enableParser(t)},QB.enableParsers=function(t){Loader.enableParsers(t)},Object.defineProperty(QB,"conflictStrategy",{get:function(){return QB.getBundle().conflictStrategy},set:function(t){QB.getBundle().conflictStrategy=t},enumerable:!0,configurable:!0}),Object.defineProperty(QB,"conflictPrecedence",{get:function(){return QB.getBundle().conflictPrecedence},set:function(t){QB.getBundle().conflictPrecedence=t},enumerable:!0,configurable:!0}),QB.createIterator=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),QB.getBundle().createIterator(t,e,i)},QB.load=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),QB.getBundle().load(t,e,i,n)},QB.loadData=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),QB.getBundle().loadData(t,e,i,n)},QB.stop=function(){QB.getBundle().stop()},QB.getLoader=function(){return QB.getBundle().getLoader()},QB.getAsset=function(t,e){return void 0===e&&(e=null),QB.getBundle().getAsset(t,e)},QB.getAllAssets=function(){return QB.getBundle().getAllAssets()},QB.addEventListener=function(t,e){QB.getBundle().addEventListener(t,e)},QB.removeEventListener=function(t,e){QB.getBundle().removeEventListener(t,e)},QB.addAsset=function(t){QB.getBundle().addAsset(t)},QB.removeAsset=function(t,e){void 0===e&&(e=!0),QB.getBundle().removeAsset(t,e)},QB.removeAssetByName=function(t,e,i){return void 0===e&&(e=null),void 0===i&&(i=!0),QB.getBundle().removeAssetByName(t,e,i)},QB.removeAllAssets=function(t){void 0===t&&(t=!0),QB.getBundle().removeAllAssets(t)},QB.removeNamespaceAssets=function(t,e){void 0===t&&(t=null),void 0===e&&(e=!0),QB.getBundle().removeNamespaceAssets(t,e)},QB),URLRequest=(Object.defineProperty(uC.prototype,"url",{get:function(){return this._url},set:function(t){this._url=t},enumerable:!0,configurable:!0}),uC.prototype.dispose=function(){this.data=null,this._url=null},uC),Timer=(xC=EventDispatcher,__extends(yC,xC),Object.defineProperty(yC.prototype,"currentCount",{get:function(){return this._currentCount},enumerable:!0,configurable:!0}),Object.defineProperty(yC.prototype,"delay",{get:function(){return this._delay},set:function(t){this._delay=t,this._running&&(this.stop(),this.start())},enumerable:!0,configurable:!0}),Object.defineProperty(yC.prototype,"repeatCount",{get:function(){return this._repeatCount},set:function(t){this._repeatCount=t},enumerable:!0,configurable:!0}),yC.prototype.reset=function(){this._running&&this.stop(),this._currentCount=0},Object.defineProperty(yC.prototype,"running",{get:function(){return this._running},enumerable:!0,configurable:!0}),yC.prototype.start=function(){var t=this;this._running=!0,clearInterval(this._iid),this._iid=setInterval(function(){return t.tick()},this._delay)},yC.prototype.stop=function(){this._running=!1,clearInterval(this._iid)},yC.prototype.tick=function(){this._currentCount++,0<this._repeatCount&&this._currentCount>=this._repeatCount?(this.stop(),this.dispatchEvent(new TimerEvent(TimerEvent.TIMER)),this.dispatchEvent(new TimerEvent(TimerEvent.TIMER_COMPLETE))):this.dispatchEvent(new TimerEvent(TimerEvent.TIMER))},yC),xC,sA,kz,dy,Hx,Bx,vx,Lw,et,bt,Ys,Ts,Ms,Is,Es,As,qr,og,jg,Le,ec;function yC(t,e){void 0===e&&(e=0);var i=xC.call(this)||this;if(i._repeatCount=0,i._currentCount=0,i._running=!1,i._delay=t,i._repeatCount=e,isNaN(t)||t<0)throw new ErrorBase("Delay is negative or not a number");return i}function uC(t){void 0===t&&(t=null),this.method=URLRequestMethod.GET,this.async=!0,this._url=t}function QB(){}function tA(){var t,e=sA.call(this)||this;return e._loaderSessionsGarbage=new Array,e._assets=new Array,e._assetDictionary=new Object,e._loaderSessions=new Array,e.conflictStrategy=ConflictStrategy.IGNORE.create(),e.conflictPrecedence=ConflictPrecedence.FAVOR_NEW,e._onAssetRenameDelegate=function(t){return e._onAssetRename(t)},e._onAssetConflictResolvedDelegate=function(t){return e._onAssetConflictResolved(t)},e._onLoaderStartDelegate=function(t){return e._onLoaderStart(t)},e._onLoaderCompleteDelegate=function(t){return e._onLoaderComplete(t)},e._onTextureSizeErrorDelegate=function(t){return e._onTextureSizeError(t)},e._onAssetCompleteDelegate=function(t){return e._onAssetComplete(t)},e._onLoadErrorDelegate=function(t){return e._onLoadError(t)},e._onParseErrorDelegate=function(t){return e._onParseError(t)},e._errorDelegateSelector=((t={})[URLLoaderEvent.LOAD_ERROR]=e._onLoadErrorDelegate,t[ParserEvent.PARSE_ERROR]=e._onParseErrorDelegate,t),e}function lz(t){void 0===t&&(t=0);var e=kz.call(this)||this;return e._materialMode=t,e._stack=new Array,e._onReadyForDependenciesDelegate=function(t){return e._onReadyForDependencies(t)},e._onParseCompleteDelegate=function(t){return e._onParseComplete(t)},e._onParseErrorDelegate=function(t){return e._onParseError(t)},e._onLoadProgressDelegate=function(t){return e._onLoadProgress(t)},e._onLoadCompleteDelegate=function(t){return e._onLoadComplete(t)},e._onLoadErrorDelegate=function(t){return e._onLoadError(t)},e._onTextureSizeErrorDelegate=function(t){return e._onTextureSizeError(t)},e._onAssetCompleteDelegate=function(t){return e._onAssetComplete(t)},e}function Vy(t,e){void 0===t&&(t=!0),void 0===e&&(e=null),this._includeDependencies=t,this._dependencyBaseUrl=e||"",this._embeddedDataByUrl={},this._remappedUrls={},this._materialMode=Vy.UNDEFINED,this._externalAssetMode=Vy.PRELOADED}function Jy(t,e,i,n,r,o,s,a){void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=0),this._assets=[],this._dependencies=[],this._id=t,this._sub_id=a,this._request=e,this._data=i,this._parser=n,this._parentParser=r,this._retrieveAsRawData=o,this._suppressAssetEvents=s}function ey(){var t=dy.call(this)||this;return t._bytesLoaded=0,t._bytesTotal=0,t._dataFormat=URLLoaderDataFormat.TEXT,t._loadError=!1,t}function Xx(t){void 0===t&&(t=null),this._variables=new Object,null!==t&&this.decode(t)}function Wx(){}function Vx(){}function Tx(t){}function Ix(t){void 0===t&&(t=".");var e=Hx.call(this)||this;return e._separator=t,e._next_suffix={},e}function Cx(){return Bx.call(this)||this}function wx(){return vx.call(this)||this}function hx(){}function gx(){}function Uw(t,e,i,n){this._assets=t,this.filter(e,i,n)}function Mw(t,e){var i=Lw.call(this)||this;return i._invalid=!0,i._asset=t,i._pool=e,i._onClearDelegate=function(t){return i.onClear(t)},i._onInvalidateDelegate=function(t){return i.onInvalidate(t)},i._asset&&(i._asset.addEventListener(AssetEvent.CLEAR,i._onClearDelegate),i._asset.addEventListener(AssetEvent.INVALIDATE,i._onInvalidateDelegate)),i}function Dv(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this._rawData=new Float32Array(4);var r=this._rawData;r[0]=t,r[1]=e,r[2]=i,r[3]=n}function Ht(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this.x=0,this.y=0,this.z=0,this.w=1,this.x=t,this.y=e,this.z=i,this.w=n}function Ft(){}function kt(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.a=t,this.b=e,this.c=i,this.d=n,this._iAlignment=0==t&&0==e?kt.ALIGN_XY_AXIS:0==e&&0==i?kt.ALIGN_YZ_AXIS:0==t&&0==i?kt.ALIGN_XZ_AXIS:kt.ALIGN_ANY}function jt(){}function ft(t,e){var i=et.call(this,t)||this;return i._urlLoader=e,i}function ct(t){return bt.call(this,t)||this}function Zs(t,e){var i=Ys.call(this,t)||this;return i._projection=e,i}function Us(t,e){void 0===e&&(e="");var i=Ts.call(this,t)||this;return i._message=e,i}function Ns(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null);var r=Ms.call(this,t)||this;return r._url=e,r._content=i,r._assets=n,r}function Js(t,e){return void 0===t&&(t=null),void 0===e&&(e=0),Is.call(this,t||"RangeError",e)||this}function Fs(t,e){return void 0===t&&(t=""),void 0===e&&(e=0),Es.call(this,"PartialImplementationError - this function is in development. Required Dependency: "+t,e)||this}function Bs(t,e){return void 0===t&&(t="DocumentError"),void 0===e&&(e=0),As.call(this,t,e)||this}function rr(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=qr.call(this)||this;return i._inverseConcatenatedMatrix3D=new Matrix3D,i._matrix=null,i._rotation=new Vector3D,i._scale=new Vector3D(1,1,1),i._skew=new Vector3D,i._tempVector3D=new Vector3D,i._rawData=t||new Float32Array(24),i._matrix3D=new Matrix3D(new Float32Array(i._rawData.buffer,0,16)),i._colorTransform=new ColorTransform(new Float32Array(i._rawData.buffer,64,8)),i._concatenatedMatrix3D=e||i._matrix3D,null==t&&(i._matrix3D.identity(),i._colorTransform.clear()),i._components=new Array(4),i._components[1]=i._rotation,i._components[2]=i._skew,i._components[3]=i._scale,i.invalidateComponents(),i}function Ql(t){void 0===t&&(t=null),this._position=new Vector3D,this._positionDirty=!0,null!=t?this._rawData=t:(this._rawData=new Float32Array(16),this.identity())}function ol(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=t,this.y=e,this.z=i,this.radius=n}function nl(){}function ml(){}function bk(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),this.x=t,this.y=e,this.z=i,this.width=n,this.height=r,this.depth=o}function Ji(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),this._rawData=new Float32Array(4);var r=this._rawData;r[0]=t,r[1]=e,r[2]=i,r[3]=n}function Ug(t,e,i,n,r,o){var s;void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=0),this.rawData=new Float32Array(6),t instanceof Float32Array?this.copyRawDataFrom(t):((s=this.rawData)[0]=Number(t),s[1]=e,s[2]=i,s[3]=n,s[4]=r,s[5]=o)}function sg(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this._rawData=new Float32Array(2),this._rawData[0]=t,this._rawData[1]=e}function pg(t,e){return void 0===t&&(t=null),void 0===e&&(e=0),og.call(this,t||"ArgumentError",e)||this}function kg(t,e){var i=jg.call(this,t)||this;return i._transform=e,i}function Jf(t,e,i,n,r,o,s,a){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),t instanceof Float32Array?this._rawData=t:(this._rawData=new Float32Array(8),this.redMultiplier=Number(t),this.greenMultiplier=e,this.blueMultiplier=i,this.alphaMultiplier=n,this.redOffset=r,this.greenOffset=o,this.blueOffset=s,this.alphaOffset=a)}function sf(){}function df(t){t instanceof Blob?this._blob=t:this._buffer=t instanceof ByteArray?t.arraybytes:t}function Me(t,e){void 0===e&&(e=0);var i=Le.call(this)||this;return i._volume=1,i._pan=0,i._audioChannels=[],i._loopsToPlay=0,i._isPlaying=!1,i._channelsPlaying=0,i._data=t,i._channelGroup=e,i}function xe(){}function Td(t,e,i){var n=this;void 0===t&&(t=0),void 0===e&&(e=1),void 0===i&&(i=1),this._isPlaying=!1,this._isLooping=!1,this._groupID=0,this._groupVolume=1,this._groupPan=0,this._startTime=0,this._groupID=t,this._groupVolume=e,this._groupPan=i,this._audio=new Audio,this._audio.ontimeupdate=function(t){return n._onTimeUpdate(t)}}function md(){}function fc(t){void 0===t&&(t=4);var e=ec.call(this)||this;return e._mode="Typed array",e.maxlength=Math.max(t+255&-256,4),e.arraybytes=new ArrayBuffer(e.maxlength),e.unalignedarraybytestemp=new ArrayBuffer(16),e}function ub(){this.position=0,this.length=0,this._mode=""}function getTimer(){return Date.now()}var ParserBase=(FC=EventDispatcher,__extends(GC,FC),GC.supportsType=function(t){throw new AbstractMethodError},Object.defineProperty(GC.prototype,"content",{get:function(){return this._pContent},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"parsingFailure",{get:function(){return this._parsingFailure},set:function(t){this._parsingFailure=t},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"parsingPaused",{get:function(){return this._parsingPaused},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"parsingComplete",{get:function(){return this._parsingComplete},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"materialMode",{get:function(){return this._materialMode},set:function(t){this._materialMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(GC.prototype,"dataFormat",{get:function(){return this._dataFormat},enumerable:!0,configurable:!0}),GC.prototype.parseAsync=function(t,e){void 0===e&&(e=30),this._data=t,this._pStartParsing(e)},GC.prototype.parseSync=function(t){this._data=t;for(var e=GC.MORE_TO_PARSE;e==GC.MORE_TO_PARSE;)e=this._pProceedParsing();return this._pContent},Object.defineProperty(GC.prototype,"dependencies",{get:function(){return this._dependencies},enumerable:!0,configurable:!0}),GC.prototype._iResolveDependency=function(t){throw new AbstractMethodError},GC.prototype._iResolveDependencyFailure=function(t){throw new AbstractMethodError},GC.prototype._iResolveDependencyName=function(t,e){return e.name},GC.prototype._iResumeParsing=function(){this._parsingPaused=!1,this._timer&&this._timer.start(),this._isParsing||this._pOnInterval()},GC.prototype._pFinalizeAsset=function(t,e){void 0===e&&(e=null),t.name=e||t.name||t.assetType,this.dispatchEvent(new AssetEvent(AssetEvent.ASSET_COMPLETE,t))},GC.prototype._pProceedParsing=function(){throw new AbstractMethodError},GC.prototype._pDieWithError=function(t){void 0===t&&(t="Unknown parsing error"),this._timer&&(this._timer.removeEventListener(TimerEvent.TIMER,this._pOnIntervalDelegate),this._timer.stop(),this._timer=null),this.dispatchEvent(new ParserEvent(ParserEvent.PARSE_ERROR,t))},GC.prototype._pAddDependency=function(t,e,i,n,r,o,s){void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=!1),void 0===s&&(s=0);var a=new ResourceDependency(t,e,n,i,this,r,o,s);return this._dependencies.push(a),a},GC.prototype._pPauseAndRetrieveDependencies=function(){this._pPauseParsing(),this.dispatchEvent(new ParserEvent(ParserEvent.READY_FOR_DEPENDENCIES))},GC.prototype._pPauseParsing=function(){this._timer&&this._timer.stop(),this._parsingPaused=!0},GC.prototype._pHasTime=function(){return getTimer()-this._lastFrameTime<this._frameLimit},GC.prototype._pOnInterval=function(t){this._lastFrameTime=getTimer(),this._isParsing=!0,this._pProceedParsing()&&!this._parsingFailure&&this._pFinishParsing(),this._isParsing=!1},GC.prototype._pStartParsing=function(t){this._frameLimit=t,this._timer=new Timer(this._frameLimit,0),this._timer.addEventListener(TimerEvent.TIMER,this._pOnIntervalDelegate),this._timer.start(),this._pOnInterval()},GC.prototype._pFinishParsing=function(){this._timer&&(this._timer.removeEventListener(TimerEvent.TIMER,this._pOnIntervalDelegate),this._timer.stop()),this._timer=null,this._parsingComplete=!0,this._isParsing=!1,this.dispatchEvent(new ParserEvent(ParserEvent.PARSE_COMPLETE))},GC.prototype._pGetTextData=function(){return ParserUtils.toString(this._data)},GC.prototype._pGetByteData=function(){return ParserUtils.toByteArray(this._data)},GC.prototype._pGetData=function(){return this._data},GC.PARSING_DONE=!0,GC.MORE_TO_PARSE=!1,GC),WaveAudioParser=(gD=ParserBase,__extends(hD,gD),hD.supportsType=function(t){return"wav"==(t=t.toLowerCase())||"mp3"==t||"ogg"==t},hD.supportsData=function(t){return t instanceof ByteArray&&!!hD.parseFileType(t)},hD.prototype._pStartParsing=function(t){delete this._pContent,this._pContent=null,gD.prototype._pStartParsing.call(this,t)},hD.prototype._pProceedParsing=function(){return this._pContent=new WaveAudio(new WaveAudioData(this.data)),this._pFinalizeAsset(this._pContent,this._iFileName),ParserBase.PARSING_DONE},hD.parseFileType=function(t){if(t.position=0,65504==(65504&t.readUnsignedShort()))return"mp3";t.position=0;var e=t.readUnsignedByte(),i=t.readUnsignedByte(),n=t.readUnsignedByte();return 73===e&&68===i&&51===n||255===e&&251===i||255===e&&243===i&&130===n?"mp3":(t.position=0,"RIFF"==t.readUTFBytes(4)?"wav":(t.position=0,"OggS"==t.readUTFBytes(4)?"ogg":(t.position=0,null)))},hD.processFilename=function(t){return t},hD),CoordinateSystem,gD,FC,rD;function hD(){return gD.call(this,URLLoaderDataFormat.BLOB)||this}function GC(t){var e=FC.call(this)||this;return e._materialMode=0,e._dataFormat=t,e._dependencies=new Array,e._pOnIntervalDelegate=function(t){return e._pOnInterval(t)},e}rD=CoordinateSystem=CoordinateSystem||{},rD[rD.LEFT_HANDED=0]="LEFT_HANDED",rD[rD.RIGHT_HANDED=1]="RIGHT_HANDED";var ProjectionBase=(sD=EventDispatcher,__extends(tD,sD),Object.defineProperty(tD.prototype,"transform",{get:function(){return this._transform},set:function(t){this._transform!=t&&(this._transform&&this._transform.removeEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateConcatenatedMatrix3DDelegate),this._transform=t,this._transform&&this._transform.addEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateConcatenatedMatrix3DDelegate),this._invalidateViewMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"coordinateSystem",{get:function(){return this._coordinateSystem},set:function(t){this._coordinateSystem!=t&&(this._coordinateSystem=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"scale",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._scale},set:function(t){this._scale!=t&&(this._scale=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"ratio",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._ratio},set:function(t){this._ratio!=t&&(this._ratio=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"frustumMatrix3D",{get:function(){return this._frustumMatrix3DDirty&&this._updateFrustumMatrix3D(),this._frustumMatrix3D},set:function(t){this._frustumMatrix3D=t,this._invalidateViewMatrix3D(),this._invalidateProperties()},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"viewFrustumCorners",{get:function(){var t,e,i,n,r,o;return this._viewFrustumCornersDirty&&(this._viewFrustumCornersDirty=!1,this._frustumMatrix3DDirty&&this._updateFrustumMatrix3D(),t=this._frustumRect.left,e=this._frustumRect.right,i=this._frustumRect.top,n=this._frustumRect.bottom,this._propertiesDirty&&this._updateProperties(),r=this._near,o=this._far,this._viewFrustumCorners[0]=this._viewFrustumCorners[9]=r*t,this._viewFrustumCorners[3]=this._viewFrustumCorners[6]=r*e,this._viewFrustumCorners[1]=this._viewFrustumCorners[4]=r*i,this._viewFrustumCorners[7]=this._viewFrustumCorners[10]=r*n,this._viewFrustumCorners[12]=this._viewFrustumCorners[21]=o*t,this._viewFrustumCorners[15]=this._viewFrustumCorners[18]=o*e,this._viewFrustumCorners[13]=this._viewFrustumCorners[16]=o*i,this._viewFrustumCorners[19]=this._viewFrustumCorners[22]=o*n,this._viewFrustumCorners[2]=this._viewFrustumCorners[5]=this._viewFrustumCorners[8]=this._viewFrustumCorners[11]=r,this._viewFrustumCorners[14]=this._viewFrustumCorners[17]=this._viewFrustumCorners[20]=this._viewFrustumCorners[23]=o,this._transform.concatenatedMatrix3D.transformVectors(this._viewFrustumCorners,this._viewFrustumCorners)),this._viewFrustumCorners},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"viewFrustumPlanes",{get:function(){if(this._viewFrustumPlanesDirty){if(this._viewFrustumPlanesDirty=!1,!this._viewFrustumPlanes){this._viewFrustumPlanes=[];for(var t=0;t<6;++t)this._viewFrustumPlanes[t]=new Plane3D}var e=this.viewMatrix3D._rawData,i=e[0],n=e[4],r=e[8],o=e[12],s=e[1],a=e[5],l=e[9],c=e[13],h=e[2],u=e[6],p=e[10],d=e[14],_=e[3],f=e[7],m=e[11],g=e[15],y=this._viewFrustumPlanes[0],b=_+i,v=f+n,x=m+r,A=1/Math.sqrt(b*b+v*v+x*x);y.a=b*A,y.b=v*A,y.c=x*A,y.d=-(g+o)*A,y=this._viewFrustumPlanes[1],b=_-i,v=f-n,x=m-r,A=1/Math.sqrt(b*b+v*v+x*x),y.a=b*A,y.b=v*A,y.c=x*A,y.d=(o-g)*A,y=this._viewFrustumPlanes[2],b=_+s,v=f+a,x=m+l,A=1/Math.sqrt(b*b+v*v+x*x),y.a=b*A,y.b=v*A,y.c=x*A,y.d=-(g+c)*A,y=this._viewFrustumPlanes[3],b=_-s,v=f-a,x=m-l,A=1/Math.sqrt(b*b+v*v+x*x),y.a=b*A,y.b=v*A,y.c=x*A,y.d=(c-g)*A,y=this._viewFrustumPlanes[4],b=h,v=u,x=p,A=1/Math.sqrt(b*b+v*v+x*x),y.a=b*A,y.b=v*A,y.c=x*A,y.d=-d*A,y=this._viewFrustumPlanes[5],b=_-h,v=f-u,x=m-p,A=1/Math.sqrt(b*b+v*v+x*x),y.a=b*A,y.b=v*A,y.c=x*A,y.d=(d-g)*A}return this._viewFrustumPlanes},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"near",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._near},set:function(t){t!=this._near&&(this._near=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"originX",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._originX},set:function(t){this._originX!=t&&(this._originX=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"originY",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._originY},set:function(t){this._originY!=t&&(this._originY=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"far",{get:function(){return this._propertiesDirty&&this._updateProperties(),this._far},set:function(t){t!=this._far&&(this._far=t,this._invalidateFrustumMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"frustumRect",{get:function(){return this._frustumMatrix3DDirty&&this._updateFrustumMatrix3D(),this._frustumRect},enumerable:!0,configurable:!0}),tD.prototype.project=function(t,e){throw new AbstractMethodError},tD.prototype.unproject=function(t,e,i,n){throw new AbstractMethodError},Object.defineProperty(tD.prototype,"viewMatrix3D",{get:function(){return this._viewMatrix3DDirty&&(this._viewMatrix3DDirty=!1,this._transform?(this._viewMatrix3D.copyFrom(this._transform.inverseConcatenatedMatrix3D),this._viewMatrix3D.append(this.frustumMatrix3D)):this._viewMatrix3D.copyFrom(this.frustumMatrix3D)),this._viewMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(tD.prototype,"inverseViewMatrix3D",{get:function(){return this._inverseViewMatrix3DDirty&&(this._inverseViewMatrix3DDirty=!1,this._inverseViewMatrix3D.copyFrom(this.viewMatrix3D),this._inverseViewMatrix3D.invert()),this._inverseViewMatrix3D},enumerable:!0,configurable:!0}),tD.prototype.clone=function(){throw new AbstractMethodError},tD.prototype._invalidateProperties=function(){this._propertiesDirty=!0},tD.prototype._invalidateViewMatrix3D=function(){this._viewMatrix3DDirty=!0,this._inverseViewMatrix3DDirty=!0,this._viewFrustumCornersDirty=!0,this._viewFrustumPlanesDirty=!0,this.dispatchEvent(new ProjectionEvent(ProjectionEvent.INVALIDATE_VIEW_MATRIX3D,this))},tD.prototype._invalidateFrustumMatrix3D=function(){this._propertiesDirty&&this._updateProperties(),this._frustumMatrix3DDirty=!0,this.dispatchEvent(new ProjectionEvent(ProjectionEvent.INVALIDATE_FRUSTUM_MATRIX3D,this)),this._invalidateViewMatrix3D()},tD.prototype._updateFrustumMatrix3D=function(){this._frustumMatrix3DDirty=!1},tD.prototype._updateProperties=function(){this._propertiesDirty=!1},tD.prototype._onInvalidateConcatenatedMatrix3D=function(t){this._invalidateViewMatrix3D()},tD),ObliqueNearPlaneProjection=(oE=ProjectionBase,__extends(pE,oE),Object.defineProperty(pE.prototype,"near",{get:function(){return this._baseProjection.near},set:function(t){this._baseProjection.near=t},enumerable:!0,configurable:!0}),Object.defineProperty(pE.prototype,"far",{get:function(){return this._baseProjection.far},set:function(t){this._baseProjection.far=t},enumerable:!0,configurable:!0}),Object.defineProperty(pE.prototype,"plane",{get:function(){return this._plane},set:function(t){this._plane=t,this._invalidateFrustumMatrix3D()},enumerable:!0,configurable:!0}),Object.defineProperty(pE.prototype,"baseProjection",{set:function(t){this._baseProjection&&this._baseProjection.removeEventListener(ProjectionEvent.INVALIDATE_FRUSTUM_MATRIX3D,this._onProjectionMatrixChangedDelegate),this._baseProjection=t,this._baseProjection&&this._baseProjection.addEventListener(ProjectionEvent.INVALIDATE_FRUSTUM_MATRIX3D,this._onProjectionMatrixChangedDelegate),this._invalidateFrustumMatrix3D()},enumerable:!0,configurable:!0}),pE.prototype.onProjectionMatrixChanged=function(t){this._invalidateFrustumMatrix3D()},pE.prototype._updateFrustumMatrix3D=function(){oE.prototype._updateFrustumMatrix3D.call(this),this._frustumMatrix3D.copyFrom(this._baseProjection.frustumMatrix3D);var t=this._plane.a,e=this._plane.b,i=this._plane.c,n=.05-this._plane.d,r=new Vector3D(0<=t?1:-1,0<=e?1:-1,1,1),o=this._frustumMatrix3D.clone();o.invert();var s=o.transformVector(r);this._frustumMatrix3D.copyRowTo(3,r);var a=(s.x*r.x+s.y*r.y+s.z*r.z+s.w*r.w)/(t*s.x+e*s.y+i*s.z+n*s.w);this._frustumMatrix3D.copyRowFrom(2,new Vector3D(t*a,e*a,i*a,n*a))},pE),OrthographicProjection=(HE=ProjectionBase,__extends(IE,HE),IE.prototype.project=function(t,e){void 0===e&&(e=null);var i=this.viewMatrix3D.transformVector(t,e);return i.y=-i.y,i.z=(i.z*(this._far-this._near)+this._far+this._near)/2,i.w=1,i},IE.prototype.unproject=function(t,e,i,n){return void 0===n&&(n=null),null==n&&(n=new Vector3D),n.x=t*i,n.y=-e*i,n.z=(2*i-this._far-this._near)/(this._far-this._near),n.w=1,this.inverseViewMatrix3D.transformVector(n,n),n.w=1,n},IE.prototype.clone=function(){var t=new IE(this.scale,this._coordinateSystem);return t._near=this._near,t._far=this._far,t._coordinateSystem=this._coordinateSystem,t},IE.prototype._updateFrustumMatrix3D=function(){HE.prototype._updateFrustumMatrix3D.call(this);var t=this._frustumMatrix3D._rawData,e=this._scale,i=this._scale/this._ratio;this._frustumRect.left=.5*(this._originX-1)/i,this._frustumRect.top=.5*(this._originY-1)/e,this._frustumRect.right=this._frustumRect.left+1/i,this._frustumRect.bottom=this._frustumRect.top+1/e,t[0]=2*i,t[5]=2*e,t[12]=this._originX,t[13]=this._originY,t[10]=2/(this._far-this._near),t[14]=-(this._far+this._near)/(this._far-this._near),t[1]=t[2]=t[3]=t[4]=t[6]=t[7]=t[8]=t[9]=t[11]=0,t[15]=1,this._frustumMatrix3D.invalidatePosition()},IE.prototype._updateProperties=function(){HE.prototype._updateProperties.call(this);var t=this._frustumMatrix3D._rawData;this._near=-(t[14]+1)/t[10],this._far=-(t[14]-1)/t[10],this._originX=t[8],this._originY=t[9],this._scale=t[5]/2,this._ratio=.5*this._scale/t[0]},IE),PerspectiveProjection=(YE=ProjectionBase,__extends(ZE,YE),Object.defineProperty(ZE.prototype,"fieldOfView",{get:function(){return 360*Math.atan(.5/this.scale)/Math.PI},set:function(t){this.scale=.5/Math.tan(t*Math.PI/360)},enumerable:!0,configurable:!0}),ZE.prototype.project=function(t,e){void 0===e&&(e=null);var i=this.viewMatrix3D.transformVector(t,e);return i.x=i.x/i.w,i.y=-i.y/i.w,i.z=i.w,i.w=1,i},ZE.prototype.unproject=function(t,e,i,n){return void 0===n&&(n=null),null==n&&(n=new Vector3D),n.x=t*i,n.y=-e*i,n.z=(this._far+this._near)/(this._far-this._near)*i-2*this._far*this._near/(this._far-this._near),n.w=i,this.inverseViewMatrix3D.transformVector(n,n),n.w=1,n},ZE.prototype.clone=function(){var t=new ZE(this.fieldOfView,this._coordinateSystem);return t._near=this._near,t._far=this._far,t._coordinateSystem=this._coordinateSystem,t},ZE.prototype._updateFrustumMatrix3D=function(){YE.prototype._updateFrustumMatrix3D.call(this);var t=this._frustumMatrix3D._rawData,e=this._scale,i=this._scale/this._ratio;this._frustumRect.left=.5*(this._originX-1)/i,this._frustumRect.top=.5*(this._originY-1)/e,this._frustumRect.right=this._frustumRect.left+1/i,this._frustumRect.bottom=this._frustumRect.top+1/e,t[0]=2*i,t[5]=2*e,t[8]=this._originX,t[9]=this._originY,t[10]=(this._far+this._near)/(this._far-this._near),t[11]=1,t[1]=t[2]=t[3]=t[4]=t[6]=t[7]=t[12]=t[13]=t[15]=0,t[14]=-2*this._far*this._near/(this._far-this._near),this._coordinateSystem==CoordinateSystem.RIGHT_HANDED&&(t[5]=-t[5]),this._frustumMatrix3D.invalidatePosition()},ZE.prototype._updateProperties=function(){YE.prototype._updateProperties.call(this);var t=this._frustumMatrix3D._rawData;this._near=t[14]/(-1-t[10]),this._far=t[14]/(1-t[10]),this._scale=t[5]/2,this._ratio=.5*this._scale/t[0],this._originX=t[8],this._originY=t[9]},ZE),Byte32Array=(Object.defineProperty(oF.prototype,"arrayBuffer",{get:function(){return this._arrayBuffer},set:function(t){this.bytePosition=0,this.byteLength=-1,this._maxLength=-1,this._ensureSpace(t.byteLength),this._int32Array.set(new Int32Array(t))},enumerable:!0,configurable:!0}),oF.prototype.readByte32Array=function(t,e){void 0===e&&(e=-1),-1==e&&(e=t.byteLength-t.bytePosition),t.writeInt32Array(this._int32Array.subarray(this.bytePosition/4,(this.bytePosition+e)/4)),this.bytePosition+=e},oF.prototype.writeByte32Array=function(t){t.bytePosition=0,t.readByte32Array(this,t.byteLength)},oF.prototype.writeFloat32Array=function(t){this._ensureSpace(this.bytePosition+4*t.length),this._float32Array.set(t,this.bytePosition/4),this.bytePosition+=4*t.length},oF.prototype.writeInt32Array=function(t){this._ensureSpace(this.bytePosition+4*t.length),this._uint32Array.set(t,this.bytePosition/4),this.bytePosition+=4*t.length},oF.prototype.writeUint32Array=function(t){this._ensureSpace(this.bytePosition+4*t.length),this._uint32Array.set(t,this.bytePosition/4),this.bytePosition+=4*t.length},oF.prototype.readFloat32Array=function(t){t.set(this._float32Array.subarray(this.bytePosition/4,this.bytePosition/4+t.length))},oF.prototype.readInt32Array=function(t){t.set(this._int32Array.subarray(this.bytePosition/4,this.bytePosition/4+t.length))},oF.prototype.readUint32Array=function(t){t.set(this._uint32Array.subarray(this.bytePosition/4,this.bytePosition/4+t.length))},oF.prototype.getBytesAvailable=function(){return this.byteLength-this.bytePosition},oF.prototype.readUTFBytes=function(t){for(var e="",i=this.bytePosition+t,n=new DataView(this._arrayBuffer);this.bytePosition<i;){var r,o,s=n.getUint8(this.bytePosition++);if(s<128){if(0==s)break;e+=String.fromCharCode(s)}else s<224?e+=String.fromCharCode((63&s)<<6|127&n.getUint8(this.bytePosition++)):s<240?(r=n.getUint8(this.bytePosition++),e+=String.fromCharCode((31&s)<<12|(127&r)<<6|127&n.getUint8(this.bytePosition++))):(r=n.getUint8(this.bytePosition++),o=n.getUint8(this.bytePosition++),e+=String.fromCharCode((15&s)<<18|(127&r)<<12|o<<6&127|127&n.getUint8(this.bytePosition++)))}return e},oF.prototype.writeUTFBytes=function(t){var e=encodeURIComponent(t).replace(/%([0-9A-F]{2})/g,function(t,e){return String.fromCharCode(parseInt("0x"+e))});if(e.length%4)for(var i=4-e.length%4,n=0;n<i;n++)e+=" ";for(this._ensureSpace(this.bytePosition+4+e.length),this.writeInt(e.length),n=0;n<e.length;n+=4)this.writeUnsignedInt(e.charCodeAt(n+3)<<24|e.charCodeAt(n+2)<<16|e.charCodeAt(n+1)<<8|e.charCodeAt(n));return e.length},oF.prototype.readInt=function(){if(this.bytePosition>this.byteLength+4)throw"ByteArray out of bounds read. Position="+this.bytePosition+", Length="+this.byteLength;var t=this.bytePosition>>2;return this.bytePosition+=4,this._int32Array[t]},oF.prototype.writeUnsignedInt=function(t){this._ensureSpace(this.bytePosition+4),this._uint32Array[this.bytePosition>>2]=4294967295&~~t,this.bytePosition+=4},oF.prototype.writeInt=function(t){this._ensureSpace(this.bytePosition+4),this._int32Array[this.bytePosition>>2]=~~t,this.bytePosition+=4},oF.prototype.readUnsignedInt=function(){if(this.bytePosition>this.byteLength+4)throw"ByteArray out of bounds read. Position="+this.bytePosition+", Length="+this.byteLength;var t=this.bytePosition>>2;return this.bytePosition+=4,this._uint32Array[t]},oF.prototype.writeFloat=function(t){this._ensureSpace(this.bytePosition+4),this._float32Array[this.bytePosition>>2]=t,this.bytePosition+=4},oF.prototype.readFloat=function(){if(this.bytePosition>this.byteLength+4)throw"ByteArray out of bounds read. Positon="+this.bytePosition+", Length="+this.byteLength;var t=this.bytePosition>>2;return this.bytePosition+=4,this._float32Array[t]},oF.prototype._ensureSpace=function(t){var e,i;this.byteLength<t&&(this.byteLength=t,this._maxLength<t)&&(this._maxLength=Math.max(t+255&-256,4),e=new ArrayBuffer(this._maxLength),i=new Int32Array(e),this._int32Array&&i.set(this._int32Array),this._uint32Array=new Uint32Array(e),this._float32Array=new Float32Array(e),this._int32Array=i,this._arrayBuffer=e)},oF),ByteArrayBuffer=(WF=ByteArrayBase,__extends(XF,WF),XF.prototype.writeByte=function(t){var e=~~t;this._bytes[this.position++]=e,this.position>this.length&&(this.length=this.position)},XF.prototype.readByte=function(){if(this.position>=this.length)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;return this._bytes[this.position++]},XF.prototype.writeUnsignedByte=function(t){var e=~~t;this._bytes[this.position++]=255&e,this.position>this.length&&(this.length=this.position)},XF.prototype.readUnsignedByte=function(){if(this.position>=this.length)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;return this._bytes[this.position++]},XF.prototype.writeUnsignedShort=function(t){var e=~~t;this._bytes[this.position++]=255&e,this._bytes[this.position++]=e>>8&255,this.position>this.length&&(this.length=this.position)},XF.prototype.readUnsignedShort=function(){if(this.position+2>this.length)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;var t=this._bytes[this.position]|this._bytes[this.position+1]<<8;return this.position+=2,t},XF.prototype.writeUnsignedInt=function(t){var e=~~t;this._bytes[this.position++]=255&e,this._bytes[this.position++]=e>>>8&255,this._bytes[this.position++]=e>>>16&255,this._bytes[this.position++]=e>>>24&255,this.position>this.length&&(this.length=this.position)},XF.prototype.readUnsignedInt=function(){if(this.position+4>this.length)throw"ByteArray out of bounds read. Position="+this.position+", Length="+this.length;var t=this._bytes[this.position]|this._bytes[this.position+1]<<8|this._bytes[this.position+2]<<16|this._bytes[this.position+3]<<24;return this.position+=4,t>>>0},XF.prototype.writeFloat=function(t){this.writeUnsignedInt(this.toFloatBits(Number(t)))},XF.prototype.toFloatBits=function(t){if(0==t)return 0;var e=0,e=t<0?(t=-t,1):0,i=Math.log(t)/Math.log(2),i=Math.floor(i);return t*=Math.pow(2,23-i),e<<31>>>0|(i+=127)<<23|Math.floor(t)-8388608},XF.prototype.readFloat=function(t){return this.fromFloatBits(this.readUnsignedInt())},XF.prototype.fromFloatBits=function(t){if(0==t)return 0;var e=t>>>23&255,i=8388607&t|8388608,n=Math.pow(2,e-127-23)*i;return t>>>31!=0&&(n=-n),n},XF),CSS=(qG.setElementSize=function(t,e,i){t&&(t.style.width=e+"px",t.style.height=i+"px",t.width=e,t.height=i)},qG.setElementWidth=function(t,e){t&&(t.style.width=e+"px",t.width=e)},qG.setElementHeight=function(t,e){t&&(t.style.height=e+"px",t.height=e)},qG.setElementX=function(t,e){t&&(t.style.position="absolute",t.style.left=e+"px")},qG.setElementY=function(t,e){t&&(t.style.position="absolute",t.style.top=e+"px")},qG.getElementVisibility=function(t){return!!t&&"visible"==t.style.visibility},qG.setElementVisibility=function(t,e){t&&(t.style.visibility=e?"visible":"hidden")},qG.setElementAlpha=function(t,e){t instanceof HTMLCanvasElement&&(t.getContext("2d").globalAlpha=e)},qG.setElementPosition=function(t,e,i,n){void 0===n&&(n=!1),t&&(t.style.position=n?"absolute":"relative",t.style.left=e+"px",t.style.top=i+"px")},qG),RequestAnimationFrame=(LG.prototype.setCallback=function(t,e){this._callback=t,this._callbackContext=e},LG.prototype.start=function(){this._prevTime=this._getTimer(),this._active=!0,window&&(window.requestAnimationFrame?window.requestAnimationFrame(this._rafUpdateFunction):window.mozRequestAnimationFrame?window.requestAnimationFrame=window.mozRequestAnimationFrame:window.webkitRequestAnimationFrame?window.requestAnimationFrame=window.webkitRequestAnimationFrame:window.oRequestAnimationFrame&&(window.requestAnimationFrame=window.oRequestAnimationFrame))},LG.prototype.stop=function(){this._active=!1},Object.defineProperty(LG.prototype,"active",{get:function(){return this._active},enumerable:!0,configurable:!0}),LG.prototype._tick=function(){this._currentTime=this._getTimer(),this._dt=this._currentTime-this._prevTime,this._argsArray[0]=this._dt,this._callback.apply(this._callbackContext,this._argsArray),window.requestAnimationFrame(this._rafUpdateFunction),this._prevTime=this._currentTime},LG),XmlUtils=(RG.getChildrenWithTag=function(t,e){var i=document.createDocumentFragment();if(t)for(var n=t.childNodes.length,r=0;r<n;r++){var o=t.childNodes[r];null!=o&&o.nodeName==e&&i.appendChild(o)}return i.childNodes},RG.filterListByParam=function(t,e,i){var n=document.createDocumentFragment();if(t)for(var r=t.length,o=0;o<r;o++){var s=t[o];null!=s&&s.attributes.getNamedItem(e).value==i&&n.appendChild(s)}return n.childNodes},RG.strToXml=function(t){return(new DOMParser).parseFromString(t,"text/xml")},RG.nodeToString=function(t){return t?(new XMLSerializer).serializeToString(t):""},RG.readAttributeValue=function(t,e){var i=t.attributes;if(null==i)return"";var n=i.getNamedItem(e);return n?n.value:""},RG.writeAttributeValue=function(t,e,i){var n=document.createAttribute(e);n.value=i,n=t.attributes.setNamedItem(n),console.log("XmlUltils - writeAttributeValue() - name: "+n.name+", value: "+n.value)},RG.hasAttribute=function(t,e){var i=t.attributes;return null!=i&&null!=i.getNamedItem(e)},RG),WF,YE,HE,oE,sD;function RG(){}function LG(t,e){var i=this;this._active=!1,this._argsArray=new Array,this._getTimer=getTimer,this.setCallback(t,e),this._rafUpdateFunction=function(){i._active&&i._tick()},this._argsArray.push(this._dt)}function qG(){}function XF(){var t=WF.call(this)||this;return t._bytes=[],t._mode="Array",t}function oF(t){void 0===t&&(t=0),this._maxLength=-1,this.bytePosition=0,this.byteLength=-1,this._ensureSpace(t)}function ZE(t,e){void 0===t&&(t=60),void 0===e&&(e=CoordinateSystem.LEFT_HANDED);var i=YE.call(this,e)||this;return i.fieldOfView=t,i}function IE(t,e){void 0===t&&(t=1),void 0===e&&(e=CoordinateSystem.LEFT_HANDED);var i=HE.call(this,e)||this;return i.scale=t,i}function pE(t,e){var i=oE.call(this)||this;return i.baseProjection=t,i.plane=e,i._onProjectionMatrixChangedDelegate=function(t){return i.onProjectionMatrixChanged(t)},i}function tD(t){void 0===t&&(t=CoordinateSystem.LEFT_HANDED);var e=sD.call(this)||this;return e._viewMatrix3D=new Matrix3D,e._inverseViewMatrix3D=new Matrix3D,e._frustumMatrix3D=new Matrix3D,e._near=20,e._far=3e3,e._scale=1,e._ratio=1,e._originX=0,e._originY=0,e._frustumRect=new Rectangle,e._viewFrustumCorners=[],e._viewMatrix3DDirty=!0,e._inverseViewMatrix3DDirty=!0,e._frustumMatrix3DDirty=!0,e._viewFrustumCornersDirty=!0,e._viewFrustumPlanesDirty=!0,e._coordinateSystem=t,e._onInvalidateConcatenatedMatrix3DDelegate=function(t){return e._onInvalidateConcatenatedMatrix3D(t)},e}console.debug("AwayJS - Core - 0.9.11"),Loader.enableParser(WaveAudioParser);var AVMEvent=(qH=EventBase,__extends(rH,qH),Object.defineProperty(rH.prototype,"avmVersion",{get:function(){return this._avmVersion},enumerable:!0,configurable:!0}),rH.prototype.clone=function(){return new rH(this.type,this._avmVersion)},rH.AVM_COMPLETE="avmComplete",rH),Flags=function(){},FS=function(){},Opcode=function(t,e,i,n,r,o,s,a,l,c){this.a=new FS,this.b=new FS,this.flags=new Flags,this.dest=t,this.a.format=e,this.a.size=i,this.b.format=n,this.b.size=r,this.opcode=o,this.flags.simple=s,this.flags.horizontal=a,this.flags.fragonly=l,this.flags.matrix=c},OpcodeMap=(Object.defineProperty(FH,"map",{get:function(){return FH._map||((FH._map=new Array).mov=new Opcode("vector","vector",4,"none",0,0,!0,null,null,null),FH._map.add=new Opcode("vector","vector",4,"vector",4,1,!0,null,null,null),FH._map.sub=new Opcode("vector","vector",4,"vector",4,2,!0,null,null,null),FH._map.mul=new Opcode("vector","vector",4,"vector",4,3,!0,null,null,null),FH._map.div=new Opcode("vector","vector",4,"vector",4,4,!0,null,null,null),FH._map.rcp=new Opcode("vector","vector",4,"none",0,5,!0,null,null,null),FH._map.min=new Opcode("vector","vector",4,"vector",4,6,!0,null,null,null),FH._map.max=new Opcode("vector","vector",4,"vector",4,7,!0,null,null,null),FH._map.frc=new Opcode("vector","vector",4,"none",0,8,!0,null,null,null),FH._map.sqt=new Opcode("vector","vector",4,"none",0,9,!0,null,null,null),FH._map.rsq=new Opcode("vector","vector",4,"none",0,10,!0,null,null,null),FH._map.pow=new Opcode("vector","vector",4,"vector",4,11,!0,null,null,null),FH._map.log=new Opcode("vector","vector",4,"none",0,12,!0,null,null,null),FH._map.exp=new Opcode("vector","vector",4,"none",0,13,!0,null,null,null),FH._map.nrm=new Opcode("vector","vector",4,"none",0,14,!0,null,null,null),FH._map.sin=new Opcode("vector","vector",4,"none",0,15,!0,null,null,null),FH._map.cos=new Opcode("vector","vector",4,"none",0,16,!0,null,null,null),FH._map.crs=new Opcode("vector","vector",4,"vector",4,17,!0,!0,null,null),FH._map.dp3=new Opcode("vector","vector",4,"vector",4,18,!0,!0,null,null),FH._map.dp4=new Opcode("vector","vector",4,"vector",4,19,!0,!0,null,null),FH._map.abs=new Opcode("vector","vector",4,"none",0,20,!0,null,null,null),FH._map.neg=new Opcode("vector","vector",4,"none",0,21,!0,null,null,null),FH._map.sat=new Opcode("vector","vector",4,"none",0,22,!0,null,null,null),FH._map.ted=new Opcode("vector","vector",4,"sampler",1,38,!0,null,!0,null),FH._map.kil=new Opcode("none","scalar",1,"none",0,39,!0,null,!0,null),FH._map.tex=new Opcode("vector","vector",4,"sampler",1,40,!0,null,!0,null),FH._map.m33=new Opcode("vector","matrix",3,"vector",3,23,!0,null,null,!0),FH._map.m44=new Opcode("vector","matrix",4,"vector",4,24,!0,null,null,!0),FH._map.m43=new Opcode("vector","matrix",3,"vector",4,25,!0,null,null,!0),FH._map.ddx=new Opcode("vector","vector",4,"none",0,26,!0,null,!0,null),FH._map.ddy=new Opcode("vector","vector",4,"none",0,27,!0,null,!0,null),FH._map.sge=new Opcode("vector","vector",4,"vector",4,41,!0,null,null,null),FH._map.slt=new Opcode("vector","vector",4,"vector",4,42,!0,null,null,null),FH._map.sgn=new Opcode("vector","vector",4,"vector",4,43,!0,null,null,null),FH._map.seq=new Opcode("vector","vector",4,"vector",4,44,!0,null,null,null),FH._map.sne=new Opcode("vector","vector",4,"vector",4,45,!0,null,null,null)),FH._map},enumerable:!0,configurable:!0}),FH),Part=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.name="",this.version=0,this.name=t,this.version=e,this.data=new ByteArray},Reg=function(t,e){this.code=t,this.desc=e},RegMap=(Object.defineProperty(KH,"map",{get:function(){return KH._map||((KH._map=new Array).va=new Reg(0,"vertex attribute"),KH._map.fc=new Reg(1,"fragment constant"),KH._map.vc=new Reg(1,"vertex constant"),KH._map.ft=new Reg(2,"fragment temporary"),KH._map.vt=new Reg(2,"vertex temporary"),KH._map.vo=new Reg(3,"vertex output"),KH._map.op=new Reg(3,"vertex output"),KH._map.fd=new Reg(3,"fragment depth output"),KH._map.fo=new Reg(3,"fragment output"),KH._map.oc=new Reg(3,"fragment output"),KH._map.v=new Reg(4,"varying"),KH._map.vi=new Reg(4,"varying output"),KH._map.fi=new Reg(4,"varying input"),KH._map.fs=new Reg(5,"sampler")),KH._map},enumerable:!0,configurable:!0}),KH),Sampler=function(t,e,i){this.shift=t,this.mask=e,this.value=i},SamplerMap=(Object.defineProperty(OH,"map",{get:function(){return OH._map||((OH._map=new Array).rgba=new Sampler(8,15,0),OH._map.rg=new Sampler(8,15,5),OH._map.r=new Sampler(8,15,4),OH._map.compressed=new Sampler(8,15,1),OH._map.compressed_alpha=new Sampler(8,15,2),OH._map.dxt1=new Sampler(8,15,1),OH._map.dxt5=new Sampler(8,15,2),OH._map["2d"]=new Sampler(12,15,0),OH._map.cube=new Sampler(12,15,1),OH._map["3d"]=new Sampler(12,15,2),OH._map.centroid=new Sampler(16,1,1),OH._map.ignoresampler=new Sampler(16,4,4),OH._map.clamp=new Sampler(20,15,0),OH._map.repeat=new Sampler(20,15,1),OH._map.wrap=new Sampler(20,15,1),OH._map.nomip=new Sampler(24,15,0),OH._map.mipnone=new Sampler(24,15,0),OH._map.mipnearest=new Sampler(24,15,1),OH._map.miplinear=new Sampler(24,15,2),OH._map.nearest=new Sampler(28,15,0),OH._map.linear=new Sampler(28,15,1)),OH._map},enumerable:!0,configurable:!0}),OH),AGALMiniAssembler=(PH.prototype.assemble=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null),i=i||1,e&&this.addHeader(e,i);var n=t.replace(/[\f\n\r\v]+/g,"\n").split("\n");for(var r in n)this.processLine(n[r],r);return this.r},PH.prototype.processLine=function(t,e){var i=t.search("//");if(-1!=i&&(t=t.slice(0,i)),0<(t=t.replace(/^\s+|\s+$/g,"")).length){var n=t.search(/<.*>/g),r=null;-1!=n&&(r=t.slice(n).match(/([\w\.\-\+]+)/gi),t=t.slice(0,n));var o=t.match(/([\w\.\+\[\]]+)/gi);if(!o||o.length<1)3<=t.length&&console.log("Warning: bad line "+e+": "+t);else switch(o[0]){case"part":this.addHeader(o[1],Number(o[2]));break;case"endpart":if(!this.cur)throw"Unexpected endpart";return this.cur.data.position=0,void(this.cur=null);default:if(!this.cur)return void console.log("Warning: bad line "+e+": "+t+" (Outside of any part definition)");if("comment"==this.cur.name)return;var s=OpcodeMap.map[o[0]];if(!s)throw"Bad opcode "+o[0]+" "+e+": "+t;this.emitOpcode(this.cur,s.opcode);var a=1;if(s.dest&&"none"!=s.dest){if(!this.emitDest(this.cur,o[a++],s.dest))throw"Bad destination register "+o[a-1]+" "+e+": "+t}else this.emitZeroDword(this.cur);if(s.a&&"none"!=s.a.format){if(!this.emitSource(this.cur,o[a++],s.a))throw"Bad source register "+o[a-1]+" "+e+": "+t}else this.emitZeroQword(this.cur);if(s.b&&"none"!=s.b.format){if("sampler"==s.b.format){if(!this.emitSampler(this.cur,o[a++],s.b,r))throw"Bad sampler register "+o[a-1]+" "+e+": "+t}else if(!this.emitSource(this.cur,o[a++],s.b))throw"Bad source register "+o[a-1]+" "+e+": "+t}else this.emitZeroQword(this.cur)}}},PH.prototype.emitHeader=function(t){switch(t.data.writeUnsignedByte(160),t.data.writeUnsignedInt(t.version),16<=t.version&&t.data.writeUnsignedByte(0),t.data.writeUnsignedByte(161),t.name){case"fragment":t.data.writeUnsignedByte(1);break;case"vertex":t.data.writeUnsignedByte(0);break;case"cpu":t.data.writeUnsignedByte(2);break;default:t.data.writeUnsignedByte(255)}},PH.prototype.emitOpcode=function(t,e){t.data.writeUnsignedInt(e)},PH.prototype.emitZeroDword=function(t){t.data.writeUnsignedInt(0)},PH.prototype.emitZeroQword=function(t){t.data.writeUnsignedInt(0),t.data.writeUnsignedInt(0)},PH.prototype.emitDest=function(t,e,i){var n=e.match(/([fov]?[tpocidavs])(\d*)(\.[xyzw]{1,4})?/i);if(!RegMap.map[n[1]])return!1;var r={num:n[2]?n[2]:0,code:RegMap.map[n[1]].code,mask:this.stringToMask(n[3])};return t.data.writeUnsignedShort(r.num),t.data.writeUnsignedByte(r.mask),t.data.writeUnsignedByte(r.code),!0},PH.prototype.stringToMask=function(t){if(!t)return 15;var e=0;return-1!=t.indexOf("x")&&(e|=1),-1!=t.indexOf("y")&&(e|=2),-1!=t.indexOf("z")&&(e|=4),-1!=t.indexOf("w")&&(e|=8),e},PH.prototype.stringToSwizzle=function(t){if(!t)return 228;var e={x:0,y:1,z:2,w:3},i=0;if("."!=t.charAt(0))throw"Missing . for swizzle";return 1<t.length&&(i|=e[t.charAt(1)]),2<t.length?i|=e[t.charAt(2)]<<2:i|=(3&i)<<2,3<t.length?i|=e[t.charAt(3)]<<4:i|=(12&i)<<2,4<t.length?i|=e[t.charAt(4)]<<6:i|=(48&i)<<2,i},PH.prototype.emitSampler=function(t,e,i,n){var r=e.match(/fs(\d*)/i);if(!r||!r[1])return!1;t.data.writeUnsignedShort(parseInt(r[1])),t.data.writeUnsignedByte(0),t.data.writeUnsignedByte(0);for(var o=5,s=0,a=0;a<n.length;a++){var l=SamplerMap.map[n[a].toLowerCase()];l?(0!=(s>>l.shift&l.mask)&&console.log("Warning, duplicate sampler option"),s|=l.mask<<l.shift,o&=~(l.mask<<l.shift),o|=l.value<<l.shift):console.log("Warning, unknown sampler option: ",n[a])}return t.data.writeUnsignedInt(o),!0},PH.prototype.emitSource=function(t,e,i){var n,r=e.match(/vc\[(v[tcai])(\d+)\.([xyzw])([\+\-]\d+)?\](\.[xyzw]{1,4})?/i);if(r){if(!RegMap.map[r[1]])return!1;var o={num:0|r[2],code:RegMap.map[r[1]].code,swizzle:this.stringToSwizzle(r[5]),select:{x:0,y:1,z:2,w:3}[r[3]],offset:0|r[4]};t.data.writeUnsignedShort(o.num),t.data.writeByte(o.offset),t.data.writeUnsignedByte(o.swizzle),t.data.writeUnsignedByte(1),t.data.writeUnsignedByte(o.code),t.data.writeUnsignedByte(o.select),t.data.writeUnsignedByte(128)}else{if(n=e.match(/([fov]?[tpocidavs])(\d*)(\.[xyzw]{1,4})?/i),!RegMap.map[n[1]])return!1;o={num:0|n[2],code:RegMap.map[n[1]].code,swizzle:this.stringToSwizzle(n[3])},t.data.writeUnsignedShort(o.num),t.data.writeUnsignedByte(0),t.data.writeUnsignedByte(o.swizzle),t.data.writeUnsignedByte(o.code),t.data.writeUnsignedByte(0),t.data.writeUnsignedByte(0),t.data.writeUnsignedByte(0)}return!0},PH.prototype.addHeader=function(t,e){if(e=e||1,null==this.r[t])this.r[t]=new Part(t,e),this.emitHeader(this.r[t]);else if(this.r[t].version!=e)throw"Multiple versions for part "+t;this.cur=this.r[t]},PH),Header=function(){this.progid=0,this.version=0,this.type=""},Description=function(){this.regread=[[],[],[],[],[],[],[]],this.regwrite=[[],[],[],[],[],[],[]],this.hasindirect=!1,this.writedepth=!1,this.hasmatrix=!1,this.samplers=[],this.tokens=[],this.header=new Header},OpLUT=function(t,e,i,n,r,o,s,a,l,c,h){this.s=t,this.flags=e,this.dest=i,this.a=n,this.b=r,this.matrixwidth=o,this.matrixheight=s,this.ndwm=a,this.scalar=l,this.dm=c,this.lod=h},Mapping=(SI.agal2glsllut=[new OpLUT("%dest = %cast(%a);\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(%a + %b);\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(%a - %b);\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(%a * %b);\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(%a / %b);\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(1.0) / %a;\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(min(%a,%b));\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(max(%a,%b));\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(fract(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(sqrt(abs(%a)));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(inversesqrt(abs(%a)));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(pow(abs(%a),%b));\n",0,!0,!0,!0,null,null,null,null,null,null),new OpLUT("%dest = %cast(log2(abs(%a)));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(exp2(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(normalize(vec3( %a ) ));\n",0,!0,!0,!1,null,null,!0,null,null,null),new OpLUT("%dest = %cast(sin(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(cos(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(cross(vec3(%a),vec3(%b)));\n",0,!0,!0,!0,null,null,!0,null,null,null),new OpLUT("%dest = %cast(dot(vec3(%a),vec3(%b)));\n",0,!0,!0,!0,null,null,!0,null,null,null),new OpLUT("%dest = %cast(dot(vec4(%a),vec4(%b)));\n",0,!0,!0,!0,null,null,!0,null,null,null),new OpLUT("%dest = %cast(abs(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(%a * -1.0);\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(clamp(%a,0.0,1.0));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(dot(vec3(%a),vec3(%b)));\n",null,!0,!0,!0,3,3,!0,null,null,null),new OpLUT("%dest = %cast(dot(vec4(%a),vec4(%b)));\n",null,!0,!0,!0,4,4,!0,null,null,null),new OpLUT("%dest = %cast(dot(vec4(%a),vec4(%b)));\n",null,!0,!0,!0,4,3,!0,null,null,null),new OpLUT("%dest = %cast(dFdx(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(dFdy(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("if (float(%a)==float(%b)) {;\n",0,!1,!0,!0,null,null,null,!0,null,null),new OpLUT("if (float(%a)!=float(%b)) {;\n",0,!1,!0,!0,null,null,null,!0,null,null),new OpLUT("if (float(%a)>=float(%b)) {;\n",0,!1,!0,!0,null,null,null,!0,null,null),new OpLUT("if (float(%a)<float(%b)) {;\n",0,!1,!0,!0,null,null,null,!0,null,null),new OpLUT("} else {;\n",0,!1,!1,!1,null,null,null,null,null,null),new OpLUT("};\n",0,!1,!1,!1,null,null,null,null,null,null),new OpLUT(null,null,null,null,!1,null,null,null,null,null,null),new OpLUT(null,null,null,null,!1,null,null,null,null,null,null),new OpLUT(null,null,null,null,!1,null,null,null,null,null,null),new OpLUT(null,null,null,null,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(texture%texdimLod(%b,%texsize(%a)).%dm);\n",null,!0,!0,!0,null,null,null,null,!0,null),new OpLUT("if ( float(%a)<0.0 ) discard;\n",null,!1,!0,!1,null,null,null,!0,null,null),new OpLUT("%dest = %cast(texture%texdim(%b,%texsize(%a)%lod).%dm);\n",null,!0,!0,!0,null,null,!0,null,!0,!0),new OpLUT("%dest = %cast(greaterThanEqual(%a,%b).%dm);\n",0,!0,!0,!0,null,null,!0,null,!0,null),new OpLUT("%dest = %cast(lessThan(%a,%b).%dm);\n",0,!0,!0,!0,null,null,!0,null,!0,null),new OpLUT("%dest = %cast(sign(%a));\n",0,!0,!0,!1,null,null,null,null,null,null),new OpLUT("%dest = %cast(equal(%a,%b).%dm);\n",0,!0,!0,!0,null,null,!0,null,!0,null),new OpLUT("%dest = %cast(notEqual(%a,%b).%dm);\n",0,!0,!0,!0,null,null,!0,null,!0,null)],SI),Destination=function(){this.mask=0,this.regnum=0,this.regtype=0,this.dim=0,this.indexoffset=0,this.swizzle=0,this.lodbiad=0,this.readmode=0,this.special=0,this.wrap=0,this.filter=0,this.indexregtype=0,this.indexselect=0,this.indirectflag=0},Token=function(){this.dest=new Destination,this.opcode=0,this.a=new Destination,this.b=new Destination},AGALTokenizer=(UI.prototype.decribeAGALByteArray=function(t){var e=new Header;if(160!=t.readUnsignedByte())throw"Bad AGAL: Missing 0xa0 magic byte.";if(e.version=t.readUnsignedInt(),16<=e.version&&(t.readUnsignedByte(),e.version>>=1),161!=t.readUnsignedByte())throw"Bad AGAL: Missing 0xa1 magic byte.";switch(e.progid=t.readUnsignedByte(),e.progid){case 1:e.type="fragment";break;case 0:e.type="vertex";break;case 2:e.type="cpu";break;default:e.type=""}for(var i=new Description,n=[];t.position<t.length;){var r=new Token;r.opcode=t.readUnsignedInt();var o=Mapping.agal2glsllut[r.opcode];if(!o)throw"Opcode not valid or not implemented yet: "+r.opcode;o.matrixheight&&(i.hasmatrix=!0),o.dest?(r.dest.regnum=t.readUnsignedShort(),r.dest.mask=t.readUnsignedByte(),r.dest.regtype=t.readUnsignedByte(),i.regwrite[r.dest.regtype][r.dest.regnum]|=r.dest.mask):(r.dest=null,t.readUnsignedInt()),o.a?this.readReg(r.a,1,i,t):(r.a=null,t.readUnsignedInt(),t.readUnsignedInt()),o.b?this.readReg(r.b,0|o.matrixheight,i,t):(r.b=null,t.readUnsignedInt(),t.readUnsignedInt()),n.push(r)}return i.header=e,i.tokens=n,i},UI.prototype.readReg=function(t,e,i,n){if(t.regnum=n.readUnsignedShort(),t.indexoffset=n.readByte(),t.swizzle=n.readUnsignedByte(),t.regtype=n.readUnsignedByte(),i.regread[t.regtype][t.regnum]=15,5==t.regtype?(t.lodbiad=t.indexoffset,t.indexoffset=void 0,t.swizzle=void 0,t.readmode=n.readUnsignedByte(),t.dim=t.readmode>>4,t.readmode&=15,t.special=n.readUnsignedByte(),t.wrap=t.special>>4,t.special&=15,t.mipmap=n.readUnsignedByte(),t.filter=t.mipmap>>4,t.mipmap&=15,i.samplers[t.regnum]=t):(t.indexregtype=n.readUnsignedByte(),t.indexselect=n.readUnsignedByte(),t.indirectflag=n.readUnsignedByte()),t.indirectflag&&(i.hasindirect=!0),!t.indirectflag&&e)for(var r=0;r<e;r++)i.regread[t.regtype][t.regnum+r]=i.regread[t.regtype][t.regnum]},UI),AGLSLParser=(eJ.prototype.parse=function(t,e){var i="",n="";i+="precision "+e+" float;\n";var r=t.header.type[0];"vertex"==t.header.type&&(i+="uniform float yflip;\n");var o=t.regread[1].length;0<o&&(i+="uniform vec4 "+r+"c["+o+"];\n");for(var s=0;s<t.regread[2].length||s<t.regwrite[2].length;s++)(t.regread[2][s]||t.regwrite[2][s])&&(i+="vec4 "+r+"t"+s+";\n");for(s=0;s<t.regread[0].length;s++)t.regread[0][s]&&(i+="attribute vec4 va"+s+";\n");for(s=0;s<t.regread[4].length||s<t.regwrite[4].length;s++)(t.regread[4][s]||t.regwrite[4][s])&&(i+="varying vec4 vi"+s+";\n");for(var a=["2D","Cube","3D",""],s=0;s<t.samplers.length;s++)t.samplers[s]&&(i+="uniform sampler"+a[3&t.samplers[s].dim]+" fs"+s+";\n");"vertex"==t.header.type&&(i+="vec4 outpos;\n"),t.writedepth&&(i+="vec4 tmp_FragDepth;\n");var l=!1;for(n+="void main() {\n",s=0;s<t.tokens.length;s++){var c=Mapping.agal2glsllut[t.tokens[s].opcode];if(-1==c.s.indexOf("dFdx")&&-1==c.s.indexOf("dFdy")||(l=!0),!c)throw"Opcode not valid or not implemented yet: ";for(var h=c.matrixheight||1,u=0;u<h;u++){var p=" "+c.s;if(t.tokens[s].dest){if(c.matrixheight){if(1!=(t.tokens[s].dest.mask>>u&1))continue;var d=this.regtostring(t.tokens[s].dest.regtype,t.tokens[s].dest.regnum,t,r),_="float";d+="."+(m=["x","y","z","w"][u])}else if(d=this.regtostring(t.tokens[s].dest.regtype,t.tokens[s].dest.regnum,t,r),15!=t.tokens[s].dest.mask){var f=0,m="";switch(1&t.tokens[s].dest.mask&&(f++,m+="x"),2&t.tokens[s].dest.mask&&(f++,m+="y"),4&t.tokens[s].dest.mask&&(f++,m+="z"),8&t.tokens[s].dest.mask&&(f++,m+="w"),d+="."+m,f){case 1:_="float";break;case 2:_="vec2";break;case 3:_="vec3";break;default:throw"Unexpected destination mask"}}else _="vec4",m="xyzw";p=(p=(p=p.replace("%dest",d)).replace("%cast",_)).replace("%dm",m)}var g,y,b=15;!c.ndwm&&c.dest&&t.tokens[s].dest&&(b=t.tokens[s].dest.mask),t.tokens[s].a&&(p=p.replace("%a",this.sourcetostring(t.tokens[s].a,0,b,c.scalar,t,r))),t.tokens[s].b&&(p=p.replace("%b",this.sourcetostring(t.tokens[s].b,u,b,c.scalar,t,r)),5==t.tokens[s].b.regtype)&&(g=["2D","Cube","3D"][t.tokens[s].b.dim],y=["vec2","vec3","vec3"][t.tokens[s].b.dim],p=(p=(p=p.replace("%texdim",g)).replace("%texsize",y)).replace("%lod","")),n+=p}}return"vertex"==t.header.type&&(n+=" gl_Position = vec4(outpos.x, outpos.y, outpos.z*2.0 - outpos.w, outpos.w);\n"),l&&"fragment"==t.header.type&&(i="#extension GL_OES_standard_derivatives : enable\n"+i),t.writedepth&&(n+=" gl_FragDepth = clamp(tmp_FragDepth,0.0,1.0);\n"),i+(n+"}\n")},eJ.prototype.regtostring=function(t,e,i,n){switch(t){case 0:return"va"+e;case 1:return i.header.type[0]+"c["+e+"]";case 2:return n+"t"+e;case 3:return"vertex"==i.header.type?"outpos":"gl_FragColor";case 4:return"vi"+e;case 5:return"fs"+e;case 6:return"tmp_FragDepth";default:throw"Unknown register type"}},eJ.prototype.sourcetostring=function(t,e,i,n,r,o){var s,a,l=["x","y","z","w"];return t.indirectflag?(s="vcarrr[int("+this.regtostring(t.indexregtype,t.regnum,r,o)+"."+l[t.indexselect]+")",(a=e+t.indexoffset)<0&&(s+=a.toString()),0<a&&(s+="+"+a.toString()),s+="]"):s=this.regtostring(t.regtype,t.regnum+e,r,o),5==t.regtype?s:n?s+"."+l[t.swizzle>>0&3]:(228==t.swizzle&&15==i||(s+=".",1&i&&(s+=l[t.swizzle>>0&3]),2&i&&(s+=l[t.swizzle>>2&3]),4&i&&(s+=l[t.swizzle>>4&3]),8&i&&(s+=l[t.swizzle>>6&3])),s)},eJ.maxvertexconstants=128,eJ.maxfragconstants=28,eJ.maxtemp=8,eJ.maxstreams=8,eJ.maxtextures=8,eJ),ContextGLBlendFactor,ContextGLClearMask,ContextGLCompareMode,ContextGLDrawMode,ContextGLMipFilter,ContextGLProfile,ContextGLProgramType,ContextGLStencilAction,ContextGLTextureFilter,ContextGLTextureFormat,ContextGLTriangleFace,ContextGLVertexBufferFormat,ContextGLWrapMode,ContextMode,qH,ZJ,YJ,XJ,WJ,VJ,UJ,TJ,SJ,RJ,QJ,PJ,OJ,NJ,MJ;function eJ(){}function UI(){}function SI(t){}function PH(){this.r={},this.cur=new Part}function OH(){}function KH(){}function FH(){}function rH(t,e){var i=qH.call(this,t)||this;return i._avmVersion=e,i}MJ=ContextGLBlendFactor=ContextGLBlendFactor||{},MJ[MJ.DESTINATION_ALPHA=0]="DESTINATION_ALPHA",MJ[MJ.DESTINATION_COLOR=1]="DESTINATION_COLOR",MJ[MJ.ONE=2]="ONE",MJ[MJ.ONE_MINUS_DESTINATION_ALPHA=3]="ONE_MINUS_DESTINATION_ALPHA",MJ[MJ.ONE_MINUS_DESTINATION_COLOR=4]="ONE_MINUS_DESTINATION_COLOR",MJ[MJ.ONE_MINUS_SOURCE_ALPHA=5]="ONE_MINUS_SOURCE_ALPHA",MJ[MJ.ONE_MINUS_SOURCE_COLOR=6]="ONE_MINUS_SOURCE_COLOR",MJ[MJ.SOURCE_ALPHA=7]="SOURCE_ALPHA",MJ[MJ.SOURCE_COLOR=8]="SOURCE_COLOR",MJ[MJ.ZERO=9]="ZERO",NJ=ContextGLClearMask=ContextGLClearMask||{},NJ[NJ.COLOR=1]="COLOR",NJ[NJ.DEPTH=2]="DEPTH",NJ[NJ.STENCIL=4]="STENCIL",NJ[NJ.ALL=7]="ALL",OJ=ContextGLCompareMode=ContextGLCompareMode||{},OJ[OJ.ALWAYS=0]="ALWAYS",OJ[OJ.EQUAL=1]="EQUAL",OJ[OJ.GREATER=2]="GREATER",OJ[OJ.GREATER_EQUAL=3]="GREATER_EQUAL",OJ[OJ.LESS=4]="LESS",OJ[OJ.LESS_EQUAL=5]="LESS_EQUAL",OJ[OJ.NEVER=6]="NEVER",OJ[OJ.NOT_EQUAL=7]="NOT_EQUAL",PJ=ContextGLDrawMode=ContextGLDrawMode||{},PJ[PJ.TRIANGLES=0]="TRIANGLES",PJ[PJ.LINES=1]="LINES",QJ=ContextGLMipFilter=ContextGLMipFilter||{},QJ[QJ.MIPLINEAR=0]="MIPLINEAR",QJ[QJ.MIPNEAREST=1]="MIPNEAREST",QJ[QJ.MIPNONE=2]="MIPNONE",RJ=ContextGLProfile=ContextGLProfile||{},RJ[RJ.BASELINE=0]="BASELINE",RJ[RJ.BASELINE_CONSTRAINED=1]="BASELINE_CONSTRAINED",RJ[RJ.BASELINE_EXTENDED=2]="BASELINE_EXTENDED",SJ=ContextGLProgramType=ContextGLProgramType||{},SJ[SJ.FRAGMENT=0]="FRAGMENT",SJ[SJ.SAMPLER=1]="SAMPLER",SJ[SJ.VERTEX=2]="VERTEX",TJ=ContextGLStencilAction=ContextGLStencilAction||{},TJ[TJ.DECREMENT_SATURATE=0]="DECREMENT_SATURATE",TJ[TJ.DECREMENT_WRAP=1]="DECREMENT_WRAP",TJ[TJ.INCREMENT_SATURATE=2]="INCREMENT_SATURATE",TJ[TJ.INCREMENT_WRAP=3]="INCREMENT_WRAP",TJ[TJ.INVERT=4]="INVERT",TJ[TJ.KEEP=5]="KEEP",TJ[TJ.SET=6]="SET",TJ[TJ.ZERO=7]="ZERO",UJ=ContextGLTextureFilter=ContextGLTextureFilter||{},UJ[UJ.LINEAR=0]="LINEAR",UJ[UJ.NEAREST=1]="NEAREST",VJ=ContextGLTextureFormat=ContextGLTextureFormat||{},VJ[VJ.BGRA=0]="BGRA",VJ[VJ.BGRA_PACKED=1]="BGRA_PACKED",VJ[VJ.BGR_PACKED=2]="BGR_PACKED",VJ[VJ.COMPRESSED=3]="COMPRESSED",VJ[VJ.COMPRESSED_ALPHA=4]="COMPRESSED_ALPHA",WJ=ContextGLTriangleFace=ContextGLTriangleFace||{},WJ[WJ.BACK=0]="BACK",WJ[WJ.FRONT=1]="FRONT",WJ[WJ.FRONT_AND_BACK=2]="FRONT_AND_BACK",WJ[WJ.NONE=3]="NONE",XJ=ContextGLVertexBufferFormat=ContextGLVertexBufferFormat||{},XJ[XJ.FLOAT_1=0]="FLOAT_1",XJ[XJ.FLOAT_2=1]="FLOAT_2",XJ[XJ.FLOAT_3=2]="FLOAT_3",XJ[XJ.FLOAT_4=3]="FLOAT_4",XJ[XJ.BYTE_1=4]="BYTE_1",XJ[XJ.BYTE_2=5]="BYTE_2",XJ[XJ.BYTE_3=6]="BYTE_3",XJ[XJ.BYTE_4=7]="BYTE_4",XJ[XJ.UNSIGNED_BYTE_1=8]="UNSIGNED_BYTE_1",XJ[XJ.UNSIGNED_BYTE_2=9]="UNSIGNED_BYTE_2",XJ[XJ.UNSIGNED_BYTE_3=10]="UNSIGNED_BYTE_3",XJ[XJ.UNSIGNED_BYTE_4=11]="UNSIGNED_BYTE_4",XJ[XJ.SHORT_1=12]="SHORT_1",XJ[XJ.SHORT_2=13]="SHORT_2",XJ[XJ.SHORT_3=14]="SHORT_3",XJ[XJ.SHORT_4=15]="SHORT_4",XJ[XJ.UNSIGNED_SHORT_1=16]="UNSIGNED_SHORT_1",XJ[XJ.UNSIGNED_SHORT_2=17]="UNSIGNED_SHORT_2",XJ[XJ.UNSIGNED_SHORT_3=18]="UNSIGNED_SHORT_3",XJ[XJ.UNSIGNED_SHORT_4=19]="UNSIGNED_SHORT_4",YJ=ContextGLWrapMode=ContextGLWrapMode||{},YJ[YJ.CLAMP=0]="CLAMP",YJ[YJ.REPEAT=1]="REPEAT",ZJ=ContextMode=ContextMode||{},ZJ[ZJ.AUTO=0]="AUTO",ZJ[ZJ.WEBGL=1]="WEBGL",ZJ[ZJ.FLASH=2]="FLASH",ZJ[ZJ.GLES=3]="GLES",ZJ[ZJ.NATIVE=4]="NATIVE",ZJ[ZJ.SOFTWARE=5]="SOFTWARE";var SamplerState=function(){},ImageEvent=($J=EventBase,__extends(_J,$J),Object.defineProperty(_J.prototype,"image",{get:function(){return this._image},enumerable:!0,configurable:!0}),_J.INVALIDATE_MIPMAPS="invalidateMipmaps",_J),StageEvent=(dK=EventBase,__extends(eK,dK),Object.defineProperty(eK.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),eK.prototype.clone=function(){return new eK(this.type,this._stage)},eK.STAGE_ERROR="stageError",eK.CONTEXT_CREATED="contextCreated",eK.CONTEXT_DISPOSED="contextDisposed",eK.CONTEXT_RECREATED="contextRecreated",eK.INVALIDATE_SIZE="invalidateSize",eK),RTTEvent=(iK=EventBase,__extends(jK,iK),Object.defineProperty(jK.prototype,"rttManager",{get:function(){return this._rttManager},enumerable:!0,configurable:!0}),jK.prototype.clone=function(){return new jK(this.type,this._rttManager)},jK.RESIZE="rttManagerResize",jK),ImageBase=(nK=AssetBase,__extends(oK,nK),Object.defineProperty(oK.prototype,"format",{get:function(){return this._pFormat},enumerable:!0,configurable:!0}),oK.prototype.invalidateMipmaps=function(){this.dispatchEvent(new ImageEvent(ImageEvent.INVALIDATE_MIPMAPS,this))},oK),_Stage_ImageBase=(qK=AbstractionBase,__extends(rK,qK),rK.prototype.getTexture=function(){return this._texture||(this._createTexture(),this._invalid=!0),this._texture},rK.prototype.getType=function(){throw new AbstractMethodError},rK.prototype.onClear=function(t){qK.prototype.onClear.call(this,t),this._texture&&(this._texture.dispose(),this._texture=null)},rK.prototype.activate=function(t,e){void 0===e&&(e=null);var i=!(!(e=e||ImageUtils.getDefaultSampler()).mipmap||this._stage.globalDisableMipmap)&&e.mipmap;this._stage.setSamplerAt(t,e),this._stage.context.setTextureAt(t,this.getTexture()),!this._mipmap&&i&&(this._mipmap=!0,this._invalidMipmaps=!0),this._invalidMipmaps&&(this._invalidMipmaps=!1,i&&this._texture.generateMipmaps())},rK.prototype._createTexture=function(){throw new AbstractMethodError},rK.prototype._onInvalidateMipmaps=function(t){this._invalidMipmaps=!0},rK),OpCodes=(BK.trueValue=32,BK.falseValue=33,BK.intMask=63,BK.drawTriangles=41,BK.setProgramConstant=42,BK.setProgram=43,BK.present=44,BK.clear=45,BK.initProgram=46,BK.initVertexBuffer=47,BK.initIndexBuffer=48,BK.configureBackBuffer=49,BK.uploadArrayIndexBuffer=50,BK.uploadArrayVertexBuffer=51,BK.uploadAGALBytesProgram=52,BK.setVertexBufferAt=53,BK.uploadBytesIndexBuffer=54,BK.uploadBytesVertexBuffer=55,BK.setColorMask=56,BK.setDepthTest=57,BK.disposeProgram=58,BK.disposeContext=59,BK.disposeVertexBuffer=61,BK.disposeIndexBuffer=63,BK.initTexture=64,BK.setTextureAt=65,BK.uploadBytesTexture=66,BK.disposeTexture=67,BK.setCulling=68,BK.setScissorRect=69,BK.clearScissorRect=70,BK.setBlendFactors=71,BK.setRenderToTexture=72,BK.clearTextureAt=73,BK.clearVertexBufferAt=74,BK.setStencilActions=75,BK.setStencilReferenceValue=76,BK.initCubeTexture=77,BK.disposeCubeTexture=78,BK.uploadBytesCubeTexture=79,BK.clearRenderToTexture=80,BK.enableErrorChecking=81,BK.drawVertices=82,BK.getFrameBufferForTexture=83,BK.uploadProgram=84,BK.disableCulling=85,BK.disableBlending=86,BK.setSamplerStateAt=87,BK.enableStencil=88,BK.disableStencil=89,BK.setStencilActionsMasks=90,BK.uploadTextureFromURL=92,BK.startSound=101,BK.stopSound=102,BK.updateSound=103,BK),GLESAssetBase=(Object.defineProperty(CK.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),CK),TextureBaseGLES=(FK=GLESAssetBase,__extends(GK,FK),GK.prototype.dispose=function(){this._context._createBytes.writeInt(OpCodes.disposeTexture),this._context._createBytes.writeInt(this.id)},Object.defineProperty(GK.prototype,"glTexture",{get:function(){return this._glTexture},enumerable:!0,configurable:!0}),GK.prototype.generateMipmaps=function(){},GK),CubeTextureGLES=(LK=TextureBaseGLES,__extends(MK,LK),MK.prototype.uploadFromArray=function(t,e,i,n){if(t.length!=this._size*this._size*4)throw new Error("Array is not the correct length for texture dimensions");t instanceof Array&&(t=new Uint8Array(t))},MK.prototype.uploadCompressedTextureFromArray=function(t,e,i){},Object.defineProperty(MK.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),MK),IndexBufferGLES=(ZK=GLESAssetBase,__extends($K,ZK),$K.prototype.uploadFromArray=function(t,e,i){},$K.prototype.uploadFromByteArray=function(t,e,i){},$K.prototype.dispose=function(){},Object.defineProperty($K.prototype,"numIndices",{get:function(){return this._numIndices},enumerable:!0,configurable:!0}),Object.defineProperty($K.prototype,"glBuffer",{get:function(){return this._buffer},enumerable:!0,configurable:!0}),$K),GLESConnector=(Object.defineProperty(kL,"gles",{get:function(){if(!kL._gles)throw"Error: Set GlesConnector.gles before calling methods on ContextGLES!";return kL._gles},set:function(t){kL._gles=t},enumerable:!0,configurable:!0}),kL._gles=null,kL),ProgramGLES=(mL=GLESAssetBase,__extends(nL,mL),nL.prototype.upload=function(t,e){var i=0!=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT).precision?"highp":"mediump",n=0!=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT).precision?"highp":"mediump",r=nL._aglslParser.parse(nL._tokenizer.decribeAGALByteArray(t),i),o=nL._aglslParser.parse(nL._tokenizer.decribeAGALByteArray(e),n),s=new Byte32Array;s.writeInt(1),s.writeInt(OpCodes.uploadProgram),s.writeInt(this.id),s.writeUTFBytes(r),s.writeUTFBytes(o),s.bytePosition=0;var a=new Int32Array(s.byteLength/4);s.readInt32Array(a),GLESConnector.gles.sendGLESCommands(a.buffer)},nL.prototype.getUniformLocation=function(t,e){return null},nL.prototype.getAttribLocation=function(t){return 0},nL.prototype.dispose=function(){this._context._createBytes.writeInt(OpCodes.disposeProgram),this._context._createBytes.writeInt(this.id)},nL.prototype.focusProgram=function(){},Object.defineProperty(nL.prototype,"glProgram",{get:function(){return this._program},enumerable:!0,configurable:!0}),nL._tokenizer=new AGALTokenizer,nL._aglslParser=new AGLSLParser,nL._uniformLocationNameDictionary=["fc","fs","vc"],nL),TextureGLES=(DL=TextureBaseGLES,__extends(EL,DL),Object.defineProperty(EL.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(EL.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(EL.prototype,"frameBuffer",{get:function(){return this._frameBuffer},enumerable:!0,configurable:!0}),EL.prototype.uploadFromArray=function(t,e,i){if(void 0===e&&(e=0),t.length!=this._width*this._height*4)throw new Error("Array is not the correct length for texture dimensions");t instanceof Array&&(t=new Uint8Array(t));var n=new Byte32Array;n.writeInt(1),n.writeInt(OpCodes.uploadBytesTexture|e<<8),n.writeInt(this.id),n.writeFloat(this._width),n.writeFloat(this._height),n.writeInt(t.buffer.byteLength),n.writeInt32Array(new Int32Array(t.buffer)),n.bytePosition=0;var r=new Int32Array(n.byteLength/4);n.readInt32Array(r),GLESConnector.gles.sendGLESCommands(r.buffer)},EL.prototype.uploadFromURL=function(t,e,i){void 0===e&&(e=0);var n=new Byte32Array;n.writeInt(1),n.writeInt(OpCodes.uploadTextureFromURL|e<<8),n.writeInt(this.id);var r=t.url.replace(/[^a-zA-Z0-9]/g,"");console.log("urlRequest.url "+r),n.writeUTFBytes(r),n.bytePosition=0;var o=new Int32Array(n.byteLength/4);n.readInt32Array(o),GLESConnector.gles.sendGLESCommands(o.buffer)},EL.prototype.uploadCompressedTextureFromArray=function(t,e,i){},EL),VertexBufferGLES=(ZL=GLESAssetBase,__extends($L,ZL),$L.prototype.uploadFromArray=function(t,e,i){},$L.prototype.uploadFromByteArray=function(t,e,i){var n=new Byte32Array;n.writeInt(1),n.writeInt(OpCodes.uploadArrayVertexBuffer),n.writeInt(this.id),n.writeInt(e),n.writeInt(t.byteLength),n.writeInt32Array(new Int32Array(t)),n.bytePosition=0;var r=new Int32Array(n.byteLength/4);n.readInt32Array(r),GLESConnector.gles.sendGLESCommands(r.buffer)},Object.defineProperty($L.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),Object.defineProperty($L.prototype,"dataPerVertex",{get:function(){return this._dataPerVertex},enumerable:!0,configurable:!0}),Object.defineProperty($L.prototype,"glBuffer",{get:function(){return this._buffer},enumerable:!0,configurable:!0}),$L.prototype.dispose=function(){this._context._createBytes.writeInt(OpCodes.disposeVertexBuffer),this._context._createBytes.writeInt(this.id)},$L),ContextGLES=(nM.startSound=function(t,e,i,n){nM._soundBytes.writeInt(OpCodes.startSound|(n?1:0)<<8),nM._soundBytes.writeFloat(i),nM._soundBytes.writeInt(e),nM._soundBytes.writeUTFBytes(t)},nM.stopSound=function(t){nM._soundBytes.writeInt(OpCodes.stopSound),nM._soundBytes.writeInt(t)},nM.updateSound=function(t,e,i){nM._soundBytes.writeInt(OpCodes.updateSound|(i?1:0)<<8),nM._soundBytes.writeFloat(e),nM._soundBytes.writeInt(t)},Object.defineProperty(nM.prototype,"container",{get:function(){return this._container},enumerable:!0,configurable:!0}),Object.defineProperty(nM.prototype,"standardDerivatives",{get:function(){return this._standardDerivatives},enumerable:!0,configurable:!0}),Object.defineProperty(nM.prototype,"glVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(nM.prototype,"pixelRatio",{get:function(){return 1},enumerable:!0,configurable:!0}),nM.prototype.enableStencil=function(){this._cmdBytes.writeInt(OpCodes.enableStencil)},nM.prototype.disableStencil=function(){this._cmdBytes.writeInt(OpCodes.disableStencil)},nM.prototype.gl=function(){return this._gl},nM.prototype.clear=function(t,e,i,n,r,o,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=0),void 0===s&&(s=ContextGLClearMask.ALL),this._cmdBytes.writeInt(OpCodes.clear),this._cmdBytes.writeFloat(t),this._cmdBytes.writeFloat(e),this._cmdBytes.writeFloat(i),this._cmdBytes.writeFloat(n),this._cmdBytes.writeInt(r),this._cmdBytes.writeInt(o),this._cmdBytes.writeInt(s)},nM.prototype.configureBackBuffer=function(t,e,i,n){void 0===n&&(n=!0),this._width=t,this._height=e,this._cmdBytes.writeInt(OpCodes.configureBackBuffer|(n?1:0)<<8),this._cmdBytes.writeFloat(t),this._cmdBytes.writeFloat(e)},nM.prototype.createCubeTexture=function(t,e,i,n){return new CubeTextureGLES(this,this._gl,t,this._cubeTextureCnt++)},nM.prototype.createIndexBuffer=function(t){return new IndexBufferGLES(this,this._gl,t,this._indexBufferCnt++)},nM.prototype.createProgram=function(){return new ProgramGLES(this,this._gl,this._programCnt++)},nM.prototype.createTexture=function(t,e,i,n,r){return new TextureGLES(this,this._gl,t,e,this._textureCnt++)},nM.prototype.createVertexBuffer=function(t,e){return new VertexBufferGLES(this,this._gl,t,e,this._vertexBufferCnt++)},nM.prototype.dispose=function(){this._cmdBytes.writeInt(OpCodes.disposeContext),this.execute()},nM.prototype.drawToBitmapImage2D=function(t){},nM.prototype.drawIndices=function(t,e,i,n){},nM.prototype.drawVertices=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=-1),this._cmdBytes.writeInt(OpCodes.drawVertices|this._drawModeDictionary[t]<<8),this._cmdBytes.writeInt(e),this._cmdBytes.writeInt(i)},nM.prototype.present=function(){this.execute()},nM.prototype.setBlendFactors=function(t,e){this._blendEnabled=!0,this._blendSourceFactor=this._blendFactorDictionary[t],this._blendDestinationFactor=this._blendFactorDictionary[e],this.updateBlendStatus()},nM.prototype.setColorMask=function(t,e,i,n){this._cmdBytes.writeInt(OpCodes.setColorMask),this._cmdBytes.writeInt((t?1:0)|(e?1:0)<<8|(i?1:0)<<16|(n?1:0)<<24)},nM.prototype.setCulling=function(t,e){var i;void 0===e&&(e=CoordinateSystem.LEFT_HANDED),t!=ContextGLTriangleFace.NONE?(i=this.translateTriangleFace(t,e),this._cmdBytes.writeInt(OpCodes.setCulling|i<<8)):this._cmdBytes.writeInt(OpCodes.disableCulling)},nM.prototype.setDepthTest=function(t,e){this._cmdBytes.writeInt(OpCodes.setDepthTest|(t?1:0)<<8|this._compareModeDictionary[e]<<16)},nM.prototype.setStencilActionsMasks=function(t,e,i,n,r,o,s){void 0===n&&(n="keep"),void 0===r&&(r="keep"),void 0===o&&(o="keep");var a=this._compareModeDictionary[t],l=this._stencilActionDictionary[o],c=this._stencilActionDictionary[r],h=this._stencilActionDictionary[n];this._cmdBytes.writeInt(OpCodes.setStencilActionsMasks|a<<8),this._cmdBytes.writeInt(e),this._cmdBytes.writeInt(i|l<<8|c<<16|h<<24)},nM.prototype.setStencilActions=function(t,e,i,n,r,o){void 0===t&&(t=ContextGLTriangleFace.FRONT_AND_BACK),void 0===e&&(e=ContextGLCompareMode.ALWAYS),void 0===i&&(i=ContextGLStencilAction.KEEP),void 0===n&&(n=ContextGLStencilAction.KEEP),void 0===r&&(r=ContextGLStencilAction.KEEP),void 0===o&&(o=CoordinateSystem.LEFT_HANDED);var s=this._compareModeDictionary[e],a=this.stencilTriangleFace[t],l=this._stencilActionDictionary[r],c=this._stencilActionDictionary[n],h=this._stencilActionDictionary[i];this._cmdBytes.writeInt(OpCodes.setStencilActions|a<<8),this._cmdBytes.writeInt(s|l<<8|c<<16|h<<24)},nM.prototype.setStencilReferenceValue=function(t,e,i){void 0===e&&(e=255),void 0===i&&(i=255),this._cmdBytes.writeInt(OpCodes.setStencilReferenceValue),this._cmdBytes.writeInt(t),this._cmdBytes.writeInt(e),this._cmdBytes.writeInt(i)},nM.prototype.setProgram=function(t){this._cmdBytes.writeInt(OpCodes.setProgram),this._cmdBytes.writeInt(t.id)},nM.prototype.setProgramConstantsFromArray=function(t,e){this._cmdBytes.writeInt(OpCodes.setProgramConstant|t<<8),this._cmdBytes.writeInt(e.length),this._cmdBytes.writeFloat32Array(e)},nM.prototype.setScissorRectangle=function(t){t?(this._cmdBytes.writeInt(OpCodes.setScissorRect),this._cmdBytes.writeFloat(t.x),this._cmdBytes.writeFloat(t.y),this._cmdBytes.writeFloat(t.width),this._cmdBytes.writeFloat(t.height)):this._cmdBytes.writeInt(OpCodes.clearScissorRect)},nM.prototype.setTextureAt=function(t,e){e?(this._cmdBytes.writeInt(OpCodes.setTextureAt|t<<8),this._cmdBytes.writeInt(e.id)):this._cmdBytes.writeInt(OpCodes.clearTextureAt|t<<8)},nM.prototype.setSamplerStateAt=function(t,e,i,n){this._cmdBytes.writeInt(OpCodes.setSamplerStateAt|t<<8),this._cmdBytes.writeInt(this._wrapDictionary[e]|this._filterDictionary[i]<<8|this._mipmapFilterDictionary[i][n]<<16)},nM.prototype.setVertexBufferAt=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=4),e?(this._cmdBytes.writeInt(OpCodes.setVertexBufferAt|t<<8|n<<16|e.dataPerVertex<<24),this._cmdBytes.writeInt(e.id),this._cmdBytes.writeInt(i)):this._cmdBytes.writeInt(OpCodes.clearVertexBufferAt|t<<8)},nM.prototype.setRenderToTexture=function(t,e,i,n,r){void 0===e&&(e=!1),null==t?this._cmdBytes.writeInt(OpCodes.clearRenderToTexture):(this._cmdBytes.writeInt(OpCodes.setRenderToTexture|(e?1:0)<<8),this._cmdBytes.writeInt(t.id))},nM.prototype.setRenderToBackBuffer=function(){this._cmdBytes.writeInt(OpCodes.clearRenderToTexture)},nM.prototype.copyToTexture=function(t,e,i){},nM.prototype.updateBlendStatus=function(){this._blendEnabled?this._cmdBytes.writeInt(OpCodes.setBlendFactors|this._blendSourceFactor<<8|this._blendDestinationFactor<<16):this._cmdBytes.writeUnsignedInt(OpCodes.disableBlending)},nM.prototype.translateTriangleFace=function(t,e){switch(t){case ContextGLTriangleFace.BACK:return e==CoordinateSystem.LEFT_HANDED?2:1;case ContextGLTriangleFace.FRONT:return e==CoordinateSystem.LEFT_HANDED?1:2;case ContextGLTriangleFace.FRONT_AND_BACK:return 0;default:throw"Unknown ContextGLTriangleFace type."}},nM.prototype.execute=function(){var t,e,i;4<this._createBytes.bytePosition&&(this._createBytes.bytePosition=0,t=new Int32Array(this._createBytes.byteLength/4),this._createBytes.readInt32Array(t),GLESConnector.gles.sendGLESCommands(t.buffer),this._createBytes.byteLength=0,this._createBytes.bytePosition=0,this._createBytes.writeUnsignedInt(1)),4<this._cmdBytes.bytePosition&&(this._cmdBytes.bytePosition=0,e=new Int32Array(this._cmdBytes.byteLength/4),this._cmdBytes.readInt32Array(e),GLESConnector.gles.sendGLESCommands(e.buffer),this._cmdBytes.byteLength=0,this._cmdBytes.bytePosition=0,this._cmdBytes.writeUnsignedInt(0)),4<nM._soundBytes.bytePosition&&(nM._soundBytes.bytePosition=0,i=new Int32Array(nM._soundBytes.byteLength/4),nM._soundBytes.readInt32Array(i),GLESConnector.gles.sendGLESCommands(i.buffer),nM._soundBytes.byteLength=0,nM._soundBytes.bytePosition=0,nM._soundBytes.writeUnsignedInt(100))},nM._uniformLocationNameDictionary=["fc","fs","vc"],nM.MAX_SAMPLERS=8,nM.modulo=0,nM),ImageSampler=(jO=AssetBase,__extends(kO,jO),Object.defineProperty(kO.prototype,"assetType",{get:function(){return kO.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(kO.prototype,"repeat",{get:function(){return this._repeat},set:function(t){this._repeat!=t&&(this._repeat=t)},enumerable:!0,configurable:!0}),Object.defineProperty(kO.prototype,"smooth",{get:function(){return this._smooth},set:function(t){this._smooth!=t&&(this._smooth=t)},enumerable:!0,configurable:!0}),Object.defineProperty(kO.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!=t&&(this._mipmap=t)},enumerable:!0,configurable:!0}),Object.defineProperty(kO.prototype,"imageRect",{get:function(){return this._imageRect},set:function(t){this._imageRect!=t&&(this._imageRect=t,this._updateRect())},enumerable:!0,configurable:!0}),Object.defineProperty(kO.prototype,"frameRect",{get:function(){return this._frameRect},set:function(t){this._frameRect!=t&&(this._frameRect=t,this._updateRect())},enumerable:!0,configurable:!0}),kO.prototype._updateRect=function(){},kO.assetType="[asset Sampler]",kO),ProgramData=(uO.prototype.dispose=function(){this.usages--,this.usages||this._pool.disposeItem(this.vertexString+this.fragmentString)},uO.prototype.disposeFinaly=function(){this.stage&&this.stage.unRegisterProgram(this),this.program&&this.program.dispose(),this.program=null,this.usages=0,this.vertexString=void 0,this.fragmentString=void 0,this.disposedAt=-1,this.stage=void 0,this.disposed=!0},uO.PROGRAMDATA_ID_COUNT=0,uO),ProgramDataPool=(zO.prototype.collect=function(){var t=Date.now();for(var e in this._disposedPool){var i=this._disposedPool[e];(!i.usages&&i.disposedAt+this.keepAlive<t||i.disposed)&&(delete this._pool[e],delete this._disposedPool[e],i.disposeFinaly())}},zO.prototype.getItem=function(t,e){var i=t+e,n=this._pool[i]||(this._pool[i]=new ProgramData(this,this._stage,t,e));return n.disposedAt=-1,delete this._disposedPool[i],this.collect(),n},zO.prototype.disposeItem=function(t){var e=this._pool[t];e&&(e.disposedAt=Date.now(),this._disposedPool[t]=e)},zO),IndexBufferSoftware=(KO.prototype.uploadFromArray=function(t,e,i){this._startOffset=2*e,this._data=t},KO.prototype.uploadFromByteArray=function(t,e,i){this._startOffset=2*e,this._data=new Uint16Array(t)},KO.prototype.dispose=function(){this._data=null},Object.defineProperty(KO.prototype,"numIndices",{get:function(){return this._numIndices},enumerable:!0,configurable:!0}),Object.defineProperty(KO.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Object.defineProperty(KO.prototype,"startOffset",{get:function(){return this._startOffset},enumerable:!0,configurable:!0}),KO),VertexBufferSoftware=(SO.prototype.uploadFromArray=function(t,e,i){this._floatData=t},SO.prototype.uploadFromByteArray=function(t,e,i){this._floatData=new Float32Array(t,e*this._dataPerVertex,i*this._dataPerVertex/4),this._uintData=new Uint8Array(t)},Object.defineProperty(SO.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),Object.defineProperty(SO.prototype,"dataPerVertex",{get:function(){return this._dataPerVertex},enumerable:!0,configurable:!0}),Object.defineProperty(SO.prototype,"attributesPerVertex",{get:function(){return this._dataPerVertex/4},enumerable:!0,configurable:!0}),SO.prototype.dispose=function(){this._floatData=null},Object.defineProperty(SO.prototype,"data",{get:function(){return this._floatData},enumerable:!0,configurable:!0}),Object.defineProperty(SO.prototype,"uintData",{get:function(){return this._uintData},enumerable:!0,configurable:!0}),SO),TextureSoftware=(Object.defineProperty(_O.prototype,"textureType",{get:function(){return _O.textureType},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(_O.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),_O.prototype.dispose=function(){this._mipLevels=null},_O.prototype.isTexture=function(t){return this.textureType==t.textureType},_O.prototype.uploadFromArray=function(t,e,i){void 0===e&&(e=0),this._mipLevels[e]=t instanceof Array?new Uint8ClampedArray(t):new Uint8ClampedArray(t.buffer)},_O.prototype.uploadFromURL=function(t,e,i){},_O.prototype.getData=function(t){return this._mipLevels[t]},_O.prototype.getMipLevelsCount=function(){return this._mipLevels.length},_O.prototype.generateMipmaps=function(){},_O.textureType="texture2d",_O),CubeTextureSoftware=(Object.defineProperty(kP.prototype,"textureType",{get:function(){return kP.textureType},enumerable:!0,configurable:!0}),Object.defineProperty(kP.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),kP.prototype.dispose=function(){this._textureSelectorDictionary=null},kP.prototype.isTexture=function(t){return this.textureType==t.textureType},kP.prototype.uploadFromArray=function(t,e,i,n){void 0===i&&(i=0),this._textureSelectorDictionary[e][i]=t instanceof Array?new Uint8ClampedArray(t):new Uint8ClampedArray(t.buffer)},kP.prototype.getData=function(t,e){return void 0===e&&(e=0),this._textureSelectorDictionary[t][e]},kP.prototype.getMipLevelsCount=function(){return 1},kP.prototype.generateMipmaps=function(){},kP.prototype.uploadCompressedTextureFromArray=function(t,e,i){},kP.textureType="textureCube",kP),ProgramVOSoftware=function(){this.outputColor=new Float32Array([0,0,0,1]),this.discard=!1},SoftwareSamplerState=function(){this.wrap=ContextGLWrapMode.REPEAT,this.filter=ContextGLTextureFilter.LINEAR,this.mipfilter=ContextGLMipFilter.MIPLINEAR},ProgramSoftware=(Object.defineProperty(wP.prototype,"numVarying",{get:function(){return this._numVarying},enumerable:!0,configurable:!0}),wP.prototype.upload=function(t,e){this._vertexDescr=wP._tokenizer.decribeAGALByteArray(t),this._vertexVO=new ProgramVOSoftware,this._vertexVO.temp=new Float32Array(4*this._vertexDescr.regwrite[2].length),this._vertexVO.attributes=new Float32Array(4*this._vertexDescr.regread[0].length),this._numVarying=this._vertexDescr.regwrite[4].length,this._fragmentDescr=wP._tokenizer.decribeAGALByteArray(e),this._fragmentVO=new ProgramVOSoftware,this._fragmentVO.temp=new Float32Array(4*this._fragmentDescr.regwrite[2].length),this._fragmentVO.varying=new Float32Array(4*this._fragmentDescr.regread[4].length),this._fragmentVO.derivativeX=new Float32Array(this._fragmentVO.varying.length),this._fragmentVO.derivativeY=new Float32Array(this._fragmentVO.varying.length)},wP.prototype.dispose=function(){this._vertexDescr=null,this._fragmentDescr=null},wP.prototype.vertex=function(t,e,i,n){for(var r=0,o=this._vertexDescr.regread[0].length,s=this._vertexVO.attributes,a=0;a<o;a++){var l,c=t._vertexBuffers[a];c&&(l=t._vertexBufferOffsets[a]/4+e*c.attributesPerVertex,t._vertexBufferFormats[a]==ContextGLVertexBufferFormat.UNSIGNED_BYTE_4?(s[r++]=c.uintData[4*l],s[r++]=c.uintData[4*l+1],s[r++]=c.uintData[4*l+2],s[r++]=c.uintData[4*l+3]):t._vertexBufferFormats[a]==ContextGLVertexBufferFormat.FLOAT_4?(s[r++]=c.data[l],s[r++]=c.data[1+l],s[r++]=c.data[2+l],s[r++]=c.data[3+l]):t._vertexBufferFormats[a]==ContextGLVertexBufferFormat.FLOAT_3?(s[r++]=c.data[l],s[r++]=c.data[1+l],s[r++]=c.data[2+l],s[r++]=1):t._vertexBufferFormats[a]==ContextGLVertexBufferFormat.FLOAT_2?(s[r++]=c.data[l],s[r++]=c.data[1+l],s[r++]=0,s[r++]=1):t._vertexBufferFormats[a]==ContextGLVertexBufferFormat.FLOAT_1&&(s[r++]=c.data[l],s[r++]=0,s[r++]=0,s[r++]=1))}for(var h=this._vertexVO.temp,u=h.length,a=0;a<u;a+=4)h[a]=0,h[a+1]=0,h[a+2]=0,h[a+3]=1;this._vertexVO.outputPosition=i,this._vertexVO.varying=n;var p=this._vertexDescr.tokens.length;for(a=0;a<p;a++){var d=this._vertexDescr.tokens[a];wP._opCodeFunc[d.opcode](this._vertexVO,this._vertexDescr,d.dest,d.a,d.b,t)}},wP.prototype.fragment=function(t,e,i,n,r,o,s,a){this._fragmentVO.outputDepth=a,this._fragmentVO.discard=!1;for(var l=this._fragmentVO.temp,c=l.length,h=0;h<c;h+=4)l[h]=0,l[h+1]=0,l[h+2]=0,l[h+3]=1;for(var u=[],p=this._fragmentDescr.tokens.length,h=0;h<p;h++)40==(g=this._fragmentDescr.tokens[h]).opcode&&t._samplerStates[g.b.regnum]&&t._samplerStates[g.b.regnum].mipfilter==ContextGLMipFilter.MIPLINEAR&&1<t._textures[g.b.regnum].getMipLevelsCount()&&u.push(g.a.regnum);var d=this._fragmentVO.derivativeX,_=this._fragmentVO.derivativeY,f=this._fragmentVO.varying,m=f.length;for(h=0;h<m;h+=4)f[h]=e.x*r[h]+e.y*o[h]+e.z*s[h],f[h+1]=e.x*r[h+1]+e.y*o[h+1]+e.z*s[h+1],f[h+2]=e.x*r[h+2]+e.y*o[h+2]+e.z*s[h+2],f[h+3]=e.x*r[h+3]+e.y*o[h+3]+e.z*s[h+3],-1!=u.indexOf(h)&&(d[h]=i.x*r[h]+i.y*o[h]+i.z*s[h],d[h+1]=i.x*r[h+1]+i.y*o[h+1]+i.z*s[h+1],d[h+2]=i.x*r[h+2]+i.y*o[h+2]+i.z*s[h+2],d[h+3]=i.x*r[h+3]+i.y*o[h+3]+i.z*s[h+3],d[h]-=f[h],d[h+1]-=f[h+1],d[h+2]-=f[h+2],d[h+3]-=f[h+3],_[h]=n.x*r[h]+n.y*o[h]+n.z*s[h],_[h+1]=n.x*r[h+1]+n.y*o[h+1]+n.z*s[h+1],_[h+2]=n.x*r[h+2]+n.y*o[h+2]+n.z*s[h+2],_[h+3]=n.x*r[h+3]+n.y*o[h+3]+n.z*s[h+3],_[h]-=f[h],_[h+1]-=f[h+1],_[h+2]-=f[h+2],_[h+3]-=f[h+3]);for(h=0;h<p;h++){var g=this._fragmentDescr.tokens[h];wP._opCodeFunc[g.opcode](this._fragmentVO,this._fragmentDescr,g.dest,g.a,g.b,t)}return this._fragmentVO},wP.getDestTarget=function(t,e,i){var n;return 2==i.regtype?n=t.temp:3==i.regtype?n="vertex"==e.header.type?t.outputPosition:t.outputColor:4==i.regtype&&(n=t.varying),n},wP.getSourceTarget=function(t,e,i,n){var r;return 0==i.regtype?r=t.attributes:1==i.regtype?r="vertex"==e.header.type?n._vertexConstants:n._fragmentConstants:2==i.regtype?r=t.temp:4==i.regtype&&(r=t.varying),r},wP.mov=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask;1&h&&(l[s]=c[a+(n.swizzle>>0&3)]),2&h&&(l[1+s]=c[a+(n.swizzle>>2&3)]),4&h&&(l[2+s]=c[a+(n.swizzle>>4&3)]),8&h&&(l[3+s]=c[a+(n.swizzle>>6&3)])},wP.m44=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask;1&p&&(c[s]=h[a]*u[l]+h[1+a]*u[1+l]+h[2+a]*u[2+l]+u[3+l]),2&p&&(c[1+s]=h[a]*u[4+l]+h[1+a]*u[5+l]+h[2+a]*u[6+l]+u[7+l]),4&p&&(c[2+s]=h[a]*u[8+l]+h[1+a]*u[9+l]+h[2+a]*u[10+l]+u[11+l]),8&p&&(c[3+s]=h[a]*u[12+l]+h[1+a]*u[13+l]+h[2+a]*u[14+l]+u[15+l])},wP.sample=function(t,e,i,n,r){var o=i._textures[r];if(o.isTexture(TextureSoftware))return wP.sampleSimpleTexture(t,e,i,n,r);if(o.isTexture(CubeTextureSoftware))return wP.sampleCubeTexture(t,e,i,n,r);throw new ArgumentError("Cannot sample provided texture type")},wP.sampleCubeTexture=function(t,e,i,n,r){var o=4*n.regnum,s=wP.getSourceTarget(t,e,n,i),a=s[o+(n.swizzle>>0&3)],l=s[o+(n.swizzle>>2&3)],c=s[o+(n.swizzle>>4&3)],h=0,u=0,p=0,d=Math.abs(a),_=Math.abs(l),f=Math.abs(c),m=Math.max(d,_,f);m==d?p=0<=a?(h=0,u=.5-c/a*.5,.5-l/a*.5):(h=1,u=.5-c/a*.5,.5+l/a*.5):m==_?(u=0<=l?(h=2,.5+a/l*.5):(h=3,.5-a/l*.5),p=.5+c/l*.5):m==f&&(p=0<=c?(h=4,u=.5+a/c*.5,.5-l/c*.5):(h=5,u=.5+a/c*.5,.5+l/c*.5));var g=i._textures[r],y=i._samplerStates[r]||this._defaultSamplerState,b=y.wrap==ContextGLWrapMode.REPEAT;return y.mipfilter,ContextGLMipFilter.MIPLINEAR,y.filter==ContextGLTextureFilter.LINEAR?wP.sampleBilinear(u,p,g.getData(h),g.size,g.size,b,wP._colorValue0):wP.sampleNearest(u,p,g.getData(h),g.size,g.size,b,wP._colorValue0)},wP.sampleSimpleTexture=function(t,e,i,n,r){var o=4*n.regnum,s=wP.getSourceTarget(t,e,n,i),a=s[o+(n.swizzle>>0&3)],l=s[o+(n.swizzle>>2&3)];if(r>=i._textures.length||null==i._textures[r])throw new ArgumentError("textureIndex contains no texture");var c=i._textures[r],h=i._samplerStates[r]||this._defaultSamplerState,u=h.wrap==ContextGLWrapMode.REPEAT;if(h.mipfilter==ContextGLMipFilter.MIPLINEAR&&1<c.getMipLevelsCount()){var p=Math.abs(t.derivativeX[o+(n.swizzle>>0&3)]),d=Math.abs(t.derivativeX[o+(n.swizzle>>2&3)]),_=Math.abs(t.derivativeY[o+(n.swizzle>>0&3)]),f=Math.abs(t.derivativeY[o+(n.swizzle>>2&3)]),m=Math.log(Math.max(c.width*Math.sqrt(p*p+d*d),c.height*Math.sqrt(_*_+f*f)))/Math.LN2;if(0<m){var g=Math.floor(m),y=Math.ceil(m),b=Math.log(Math.min(c.width,c.height))/Math.LN2;b<y&&(y=b),b<g&&(g=b);var v=m-Math.floor(m),x=c.getData(g),A=c.width/Math.pow(2,g),S=c.height/Math.pow(2,g),w=c.getData(y),C=c.width/Math.pow(2,y),P=c.height/Math.pow(2,y);return h.filter==ContextGLTextureFilter.LINEAR?(wP.sampleBilinear(a,l,x,A,S,u,wP._colorValue0),wP.sampleBilinear(a,l,w,C,P,u,wP._colorValue1)):(wP.sampleNearest(a,l,x,A,S,u,wP._colorValue0),wP.sampleNearest(a,l,w,C,P,u,wP._colorValue1)),wP.interpolateColor(wP._colorValue0,wP._colorValue1,v,wP._colorValue0)}}return h.filter==ContextGLTextureFilter.LINEAR?wP.sampleBilinear(a,l,c.getData(0),c.width,c.height,u,wP._colorValue0):wP.sampleNearest(a,l,c.getData(0),c.width,c.height,u,wP._colorValue0)},wP.sampleNearest=function(t,e,i,n,r,o,s){t*=n,e*=r,o?(t=Math.abs(t%n),e=Math.abs(e%r)):(t<0?t=0:n-1<t&&(t=n-1),e<0?e=0:r-1<e&&(e=r-1));var a=4*((t=Math.floor(t))+(e=Math.floor(e))*n);return s[0]=i[a]/255,s[1]=i[1+a]/255,s[2]=i[2+a]/255,s[3]=i[3+a]/255,s},wP.sampleBilinear=function(t,e,i,n,r,o,s){var a=1/n,l=1/r;e-=l/2;var c=(t-=a/2)*n;c-=Math.floor(c);var h=e*r;return h-=Math.floor(h),wP.interpolateColor(wP.interpolateColor(wP.sampleNearest(t,e,i,n,r,o,wP._colorInterpolated0),wP.sampleNearest(t+a,e,i,n,r,o,wP._colorValue0),c,wP._colorInterpolated0),wP.interpolateColor(wP.sampleNearest(t,e+l,i,n,r,o,wP._colorInterpolated1),wP.sampleNearest(t+a,e+l,i,n,r,o,wP._colorValue0),c,wP._colorInterpolated1),h,s)},wP.interpolateColor=function(t,e,i,n){return n[0]=t[0]+(e[0]-t[0])*i,n[1]=t[1]+(e[1]-t[1])*i,n[2]=t[2]+(e[2]-t[2])*i,n[3]=t[3]+(e[3]-t[3])*i,n},wP.tex=function(t,e,i,n,r,o){var s=4*i.regnum,a=wP.getDestTarget(t,e,i),l=wP.sample(t,e,o,n,r.regnum),c=i.mask;1&c&&(a[s]=l[0]),2&c&&(a[1+s]=l[1]),4&c&&(a[2+s]=l[2]),8&c&&(a[3+s]=l[3])},wP.add=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=h[a+(d>>0&3)]+u[l+(_>>0&3)]),2&p&&(c[1+s]=h[a+(d>>2&3)]+u[l+(_>>2&3)]),4&p&&(c[2+s]=h[a+(d>>4&3)]+u[l+(_>>4&3)]),8&p&&(c[3+s]=h[a+(d>>6&3)]+u[l+(_>>6&3)])},wP.sub=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=h[a+(d>>0&3)]-u[l+(_>>0&3)]),2&p&&(c[1+s]=h[a+(d>>2&3)]-u[l+(_>>2&3)]),4&p&&(c[2+s]=h[a+(d>>4&3)]-u[l+(_>>4&3)]),8&p&&(c[3+s]=h[a+(d>>6&3)]-u[l+(_>>6&3)])},wP.mul=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=h[a+(d>>0&3)]*u[l+(_>>0&3)]),2&p&&(c[1+s]=h[a+(d>>2&3)]*u[l+(_>>2&3)]),4&p&&(c[2+s]=h[a+(d>>4&3)]*u[l+(_>>4&3)]),8&p&&(c[3+s]=h[a+(d>>6&3)]*u[l+(_>>6&3)])},wP.div=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=h[a+(d>>0&3)]/u[l+(_>>0&3)]),2&p&&(c[1+s]=h[a+(d>>2&3)]/u[l+(_>>2&3)]),4&p&&(c[2+s]=h[a+(d>>4&3)]/u[l+(_>>4&3)]),8&p&&(c[3+s]=h[a+(d>>6&3)]/u[l+(_>>6&3)])},wP.rcp=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=1/c[a+(u>>0&3)]),2&h&&(l[1+s]=1/c[a+(u>>2&3)]),4&h&&(l[2+s]=1/c[a+(u>>4&3)]),8&h&&(l[3+s]=1/c[a+(u>>6&3)])},wP.min=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=Math.min(h[a+(d>>0&3)],u[l+(_>>0&3)])),2&p&&(c[1+s]=Math.min(h[a+(d>>2&3)],u[l+(_>>2&3)])),4&p&&(c[2+s]=Math.min(h[a+(d>>4&3)],u[l+(_>>4&3)])),8&p&&(c[3+s]=Math.min(h[a+(d>>6&3)],u[l+(_>>6&3)]))},wP.max=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=Math.max(h[a+(d>>0&3)],u[l+(_>>0&3)])),2&p&&(c[1+s]=Math.max(h[a+(d>>2&3)],u[l+(_>>2&3)])),4&p&&(c[2+s]=Math.max(h[a+(d>>4&3)],u[l+(_>>4&3)])),8&p&&(c[3+s]=Math.max(h[a+(d>>6&3)],u[l+(_>>6&3)]))},wP.frc=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=c[a+(u>>0&3)]-Math.floor(c[a+(u>>0&3)])),2&h&&(l[1+s]=c[a+(u>>2&3)]-Math.floor(c[a+(u>>2&3)])),4&h&&(l[2+s]=c[a+(u>>4&3)]-Math.floor(c[a+(u>>4&3)])),8&h&&(l[3+s]=c[a+(u>>6&3)]-Math.floor(c[a+(u>>6&3)]))},wP.sqt=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.sqrt(c[a+(u>>0&3)])),2&h&&(l[1+s]=Math.sqrt(c[a+(u>>2&3)])),4&h&&(l[2+s]=Math.sqrt(c[a+(u>>4&3)])),8&h&&(l[3+s]=Math.sqrt(c[a+(u>>6&3)]))},wP.rsq=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=1/Math.sqrt(c[a+(u>>0&3)])),2&h&&(l[1+s]=1/Math.sqrt(c[a+(u>>2&3)])),4&h&&(l[2+s]=1/Math.sqrt(c[a+(u>>4&3)])),8&h&&(l[3+s]=1/Math.sqrt(c[a+(u>>6&3)]))},wP.pow=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask,d=n.swizzle,_=r.swizzle;1&p&&(c[s]=Math.pow(h[a+(d>>0&3)],u[l+(_>>0&3)])),2&p&&(c[1+s]=Math.pow(h[a+(d>>2&3)],u[l+(_>>2&3)])),4&p&&(c[2+s]=Math.pow(h[a+(d>>4&3)],u[l+(_>>4&3)])),8&p&&(c[3+s]=Math.pow(h[a+(d>>6&3)],u[l+(_>>6&3)]))},wP.log=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.log(c[a+(u>>0&3)])/Math.LN2),2&h&&(l[1+s]=Math.log(c[a+(u>>2&3)])/Math.LN2),4&h&&(l[2+s]=Math.log(c[a+(u>>4&3)])/Math.LN2),8&h&&(l[3+s]=Math.log(c[a+(u>>6&3)])/Math.LN2)},wP.exp=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.exp(c[a+(u>>0&3)])),2&h&&(l[1+s]=Math.exp(c[a+(u>>2&3)])),4&h&&(l[2+s]=Math.exp(c[a+(u>>4&3)])),8&h&&(l[3+s]=Math.exp(c[a+(u>>6&3)]))},wP.nrm=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle,p=c[a+(u>>0&3)],d=c[a+(u>>2&3)],_=c[a+(u>>4&3)],f=Math.sqrt(p*p+d*d+_*_);p/=f,d/=f,_/=f,1&h&&(l[s]=p),2&h&&(l[1+s]=d),4&h&&(l[2+s]=_)},wP.sin=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.sin(c[a+(u>>0&3)])),2&h&&(l[1+s]=Math.sin(c[a+(u>>2&3)])),4&h&&(l[2+s]=Math.sin(c[a+(u>>4&3)])),8&h&&(l[3+s]=Math.sin(c[a+(u>>6&3)]))},wP.cos=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.cos(c[a+(u>>0&3)])),2&h&&(l[1+s]=Math.cos(c[a+(u>>2&3)])),4&h&&(l[2+s]=Math.cos(c[a+(u>>4&3)])),8&h&&(l[3+s]=Math.cos(c[a+(u>>6&3)]))},wP.crs=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=wP.getSourceTarget(t,e,r,o),y=g[l+(p>>0&3)],b=g[l+(p>>2&3)],v=g[l+(p>>4&3)];1&h&&(c[s]=f*v-m*b),2&h&&(c[1+s]=m*y-_*v),4&h&&(c[2+s]=_*b-f*y)},wP.dp3=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=wP.getSourceTarget(t,e,r,o),y=g[l+(p>>0&3)],b=g[l+(p>>2&3)],v=g[l+(p>>4&3)];1&h&&(c[s]=_*y+f*b+m*v),2&h&&(c[1+s]=_*y+f*b+m*v),4&h&&(c[2+s]=_*y+f*b+m*v),8&h&&(c[3+s]=_*y+f*b+m*v)},wP.dp4=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=d[a+(u>>6&3)],y=wP.getSourceTarget(t,e,r,o),b=y[l+(p>>0&3)],v=y[l+(p>>2&3)],x=y[l+(p>>4&3)],A=y[l+(p>>6&3)];1&h&&(c[s]=_*b+f*v+m*x+g*A),2&h&&(c[1+s]=_*b+f*v+m*x+g*A),4&h&&(c[2+s]=_*b+f*v+m*x+g*A),8&h&&(c[3+s]=_*b+f*v+m*x+g*A)},wP.abs=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.abs(c[a+(u>>0&3)])),2&h&&(l[1+s]=Math.abs(c[a+(u>>2&3)])),4&h&&(l[2+s]=Math.abs(c[a+(u>>4&3)])),8&h&&(l[3+s]=Math.abs(c[a+(u>>6&3)]))},wP.neg=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=-c[a+(u>>0&3)]),2&h&&(l[1+s]=-c[a+(u>>2&3)]),4&h&&(l[2+s]=-c[a+(u>>4&3)]),8&h&&(l[3+s]=-c[a+(u>>6&3)])},wP.sat=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=wP.getSourceTarget(t,e,n,o),h=i.mask,u=n.swizzle;1&h&&(l[s]=Math.max(0,Math.min(1,c[a+(u>>0&3)]))),2&h&&(l[1+s]=Math.max(0,Math.min(1,c[a+(u>>2&3)]))),4&h&&(l[2+s]=Math.max(0,Math.min(1,c[a+(u>>4&3)]))),8&h&&(l[3+s]=Math.max(0,Math.min(1,c[a+(u>>6&3)])))},wP.m33=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask;1&p&&(c[s]=h[a]*u[l]+h[1+a]*u[1+l]+h[2+a]*u[2+l]),2&p&&(c[1+s]=h[a]*u[4+l]+h[1+a]*u[5+l]+h[2+a]*u[6+l]),4&p&&(c[2+s]=h[a]*u[8+l]+h[1+a]*u[9+l]+h[2+a]*u[10+l])},wP.m34=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=wP.getSourceTarget(t,e,n,o),u=wP.getSourceTarget(t,e,r,o),p=i.mask;1&p&&(c[s]=h[a]*u[l]+h[1+a]*u[1+l]+h[2+a]*u[2+l]+u[3+l]),2&p&&(c[1+s]=h[a]*u[4+l]+h[1+a]*u[5+l]+h[2+a]*u[6+l]+u[7+l]),4&p&&(c[2+s]=h[a]*u[8+l]+h[1+a]*u[9+l]+h[2+a]*u[10+l]+u[11+l])},wP.ddx=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=t.derivativeX,h=i.mask,u=n.swizzle;1&h&&(l[s]=c[a+(u>>0&3)]),2&h&&(l[1+s]=c[a+(u>>2&3)]),4&h&&(l[2+s]=c[a+(u>>4&3)]),8&h&&(l[3+s]=c[a+(u>>6&3)])},wP.ddy=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=t.derivativeY,h=i.mask,u=n.swizzle;1&h&&(l[s]=c[a+(u>>0&3)]),2&h&&(l[1+s]=c[a+(u>>2&3)]),4&h&&(l[2+s]=c[a+(u>>4&3)]),8&h&&(l[3+s]=c[a+(u>>6&3)])},wP.sge=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=d[a+(u>>6&3)],y=wP.getSourceTarget(t,e,r,o),b=y[l+(p>>0&3)],v=y[l+(p>>2&3)],x=y[l+(p>>4&3)],A=y[l+(p>>6&3)];1&h&&(c[s]=b<=_?1:0),2&h&&(c[1+s]=v<=f?1:0),4&h&&(c[2+s]=x<=m?1:0),8&h&&(c[3+s]=A<=g?1:0)},wP.slt=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*r.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=d[a+(u>>6&3)],y=wP.getSourceTarget(t,e,r,o),b=y[l+(p>>0&3)],v=y[l+(p>>2&3)],x=y[l+(p>>4&3)],A=y[l+(p>>6&3)];1&h&&(c[s]=_<b?1:0),2&h&&(c[1+s]=f<v?1:0),4&h&&(c[2+s]=m<x?1:0),8&h&&(c[3+s]=g<A?1:0)},wP.seq=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*n.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=d[a+(u>>6&3)],y=wP.getSourceTarget(t,e,r,o),b=y[l+(p>>0&3)],v=y[l+(p>>2&3)],x=y[l+(p>>4&3)],A=y[l+(p>>6&3)];1&h&&(c[s]=_==b?1:0),2&h&&(c[1+s]=f==v?1:0),4&h&&(c[2+s]=m==x?1:0),8&h&&(c[3+s]=g==A?1:0)},wP.sne=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=4*n.regnum,c=wP.getDestTarget(t,e,i),h=i.mask,u=n.swizzle,p=r.swizzle,d=wP.getSourceTarget(t,e,n,o),_=d[a+(u>>0&3)],f=d[a+(u>>2&3)],m=d[a+(u>>4&3)],g=d[a+(u>>6&3)],y=wP.getSourceTarget(t,e,r,o),b=y[l+(p>>0&3)],v=y[l+(p>>2&3)],x=y[l+(p>>4&3)],A=y[l+(p>>6&3)];1&h&&(c[s]=_!=b?1:0),2&h&&(c[1+s]=f!=v?1:0),4&h&&(c[2+s]=m!=x?1:0),8&h&&(c[3+s]=g!=A?1:0)},wP.sgn=function(t,e,i,n,r,o){var s=4*i.regnum,a=4*n.regnum,l=wP.getDestTarget(t,e,i),c=i.mask,h=n.swizzle,u=wP.getSourceTarget(t,e,n,o),p=u[a+(h>>0&3)],d=u[a+(h>>2&3)],_=u[a+(h>>4&3)],f=u[a+(h>>6&3)];1&c&&(l[s]=p<0?-1:0<p?1:0),2&c&&(l[1+s]=d<0?-1:0<d?1:0),4&c&&(l[2+s]=_<0?-1:0<_?1:0),8&c&&(l[3+s]=f<0?-1:0<f?1:0)},wP.kil=function(t,e,i,n,r,o){var s=4*n.regnum,a=n.swizzle;wP.getSourceTarget(t,e,n,o)[s+(a>>0&3)]<0&&(t.discard=!0)},wP._defaultSamplerState=new SoftwareSamplerState,wP._tokenizer=new AGALTokenizer,wP._opCodeFunc=[wP.mov,wP.add,wP.sub,wP.mul,wP.div,wP.rcp,wP.min,wP.max,wP.frc,wP.sqt,wP.rsq,wP.pow,wP.log,wP.exp,wP.nrm,wP.sin,wP.cos,wP.crs,wP.dp3,wP.dp4,wP.abs,wP.neg,wP.sat,wP.m33,wP.m44,wP.m34,null,null,null,null,null,null,null,null,null,null,null,null,null,wP.kil,wP.tex,wP.sge,wP.slt,wP.sgn,wP.seq,wP.sne],wP._colorValue0=new Float32Array(4),wP._colorValue1=new Float32Array(4),wP._colorInterpolated0=new Float32Array(4),wP._colorInterpolated1=new Float32Array(4),wP),BlendModeSoftware=(n_.destinationAlpha=function(t,e,i,n){t[0]=e[0]*i[3]/255,t[1]=e[1]*i[3]/255,t[2]=e[2]*i[3]/255,t[3]=e[3]*i[3]/255},n_.destinationColor=function(t,e,i,n){t[0]=e[0]*i[0]/255,t[1]=e[1]*i[1]/255,t[2]=e[2]*i[2]/255,t[3]=e[3]*i[3]/255},n_.one=function(t,e,i,n){t[0]=e[0],t[1]=e[1],t[2]=e[2],t[3]=e[3]},n_.oneMinusDestinationAlpha=function(t,e,i,n){t[0]=e[0]*(1-i[3]/255),t[1]=e[1]*(1-i[3]/255),t[2]=e[2]*(1-i[3]/255),t[3]=e[3]*(1-i[3]/255)},n_.oneMinusDestinationColor=function(t,e,i,n){t[0]=e[0]*(1-i[0]/255),t[1]=e[1]*(1-i[1]/255),t[2]=e[2]*(1-i[2]/255),t[3]=e[3]*(1-i[3]/255)},n_.oneMinusSourceAlpha=function(t,e,i,n){t[0]=e[0]*(1-n[3]/255),t[1]=e[1]*(1-n[3]/255),t[2]=e[2]*(1-n[3]/255),t[3]=e[3]*(1-n[3]/255)},n_.oneMinusSourceColor=function(t,e,i,n){t[0]=e[0]*(1-n[0]/255),t[1]=e[1]*(1-n[1]/255),t[2]=e[2]*(1-n[2]/255),t[3]=e[3]*(1-n[3]/255)},n_.sourceAlpha=function(t,e,i,n){t[0]=e[0]*n[3]/255,t[1]=e[1]*n[3]/255,t[2]=e[2]*n[3]/255,t[3]=e[3]*n[3]/255},n_.sourceColor=function(t,e,i,n){t[0]=e[0]*n[0]/255,t[1]=e[1]*n[1]/255,t[2]=e[2]*n[2]/255,t[3]=e[3]*n[3]/255},n_.zero=function(t,e,i,n){},n_),DepthCompareModeSoftware=(a0.always=function(t,e){return!0},a0.equal=function(t,e){return t==e},a0.greater=function(t,e){return e<t},a0.greaterEqual=function(t,e){return e<=t},a0.less=function(t,e){return t<e},a0.lessEqual=function(t,e){return t<=e},a0.never=function(t,e){return!1},a0.notEqual=function(t,e){return t!=e},a0),ContextSoftware=(Object.defineProperty(r0.prototype,"glVersion",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(r0.prototype,"pixelRatio",{get:function(){return 1},enumerable:!0,configurable:!0}),r0.prototype.configureBackBuffer=function(t,e,i,n){this._antialias=i,this._antialias%2!=0&&(this._antialias=Math.floor(this._antialias-.5)),0==this._antialias&&(this._antialias=1),this._frontBuffer._setSize(t,e),this._frontCanvas.width=t,this._frontCanvas.height=e,this._frontBufferImageData=this._frontBufferContext.getImageData(0,0,t,e);var r=t*this._antialias,o=e*this._antialias,s=r*o,a=new ArrayBuffer(8*s);this._backBufferZ=new Float32Array(a,0,s),this._backBufferZClear=new Float32Array(a,4*s,s);for(var l=0;l<s;l++)this._backBufferZClear[l]=1e7;this._activeBufferColor==this._backBufferColor&&(this._activeBufferZ=this._backBufferZ),this._backBufferRect.width=r,this._backBufferRect.height=o,this._backBufferColor._setSize(r,o),this.activateScreenMatrix(this._backBufferRect.width,this._backBufferRect.height,!0),this._frontBufferMatrix=new Matrix,this._frontBufferMatrix.scale(1/this._antialias,1/this._antialias)},r0.prototype.activateScreenMatrix=function(t,e,i){var n=this._screenMatrix._rawData;n[0]=t/2,n[1]=0,n[2]=0,n[3]=0,n[4]=0,n[5]=i?-e/2:e/2,n[6]=0,n[7]=0,n[8]=0,n[9]=0,n[10]=1,n[11]=0,n[12]=t/2,n[13]=e/2,n[14]=0,n[15]=0,this._yflip=i},r0.prototype.setRenderToTexture=function(t,e,i,n,r){var o=this.textureBuffersColor[n];null==o?(o=this.textureBuffersColor[n]=new BitmapImage2D(t.width,t.height,!1,16777215,!0),t.uploadFromArray(new Uint8Array(o.data.buffer))):o.fillRect(o.rect,16777215),this._activeBufferColor=o,this._activeBufferColor.lock();var s=this.textureBuffersZ[n],a=this.textureBuffersZClear[n];if(null==s)for(var l=t.width*t.height,c=new ArrayBuffer(8*l),s=this.textureBuffersZ[n]=new Float32Array(c,0,l),a=this.textureBuffersZClear[n]=new Float32Array(c,4*l,l),h=0;h<l;h++)a[h]=1e7;s.set(a),this._activeBufferZ=s,this.activateScreenMatrix(t.width,t.height,!1),this._activeTexture=t},r0.prototype.setRenderToBackBuffer=function(){this._activeBufferColor=this._backBufferColor,this._activeBufferZ=this._backBufferZ,this.activateScreenMatrix(this._backBufferColor.width,this._backBufferColor.height,!0)},r0.prototype.copyToTexture=function(t,e,i){},r0.prototype.drawIndices=function(t,e,i,n){if(this._program){var r=new Float32Array(4),o=new Float32Array(4),s=new Float32Array(4),a=new Float32Array(4),l=new Float32Array(4),c=new Float32Array(4*this._program.numVarying),h=new Float32Array(4*this._program.numVarying),u=new Float32Array(4*this._program.numVarying),p=new Float32Array(4*this._program.numVarying),d=new Float32Array(4*this._program.numVarying),_=new Array(5),f=new Array(4);_[0]=o,_[1]=s,_[2]=r,_[3]=a,_[4]=l;var m=new Array(5),g=new Array(4);if(m[0]=h,m[1]=u,m[2]=c,m[3]=p,m[4]=d,this._yflip&&this._cullingMode==ContextGLTriangleFace.BACK||!this._yflip&&this._cullingMode==ContextGLTriangleFace.FRONT)for(var y=i;y<n;y+=3)this._program.vertex(this,e.data[e.startOffset+y],r,c),this._program.vertex(this,e.data[e.startOffset+y+1],o,h),this._program.vertex(this,e.data[e.startOffset+y+2],s,u),this._triangle(_,f,m,g);else if(this._yflip&&this._cullingMode==ContextGLTriangleFace.FRONT||!this._yflip&&this._cullingMode==ContextGLTriangleFace.BACK)for(y=i;y<n;y+=3)this._program.vertex(this,e.data[e.startOffset+y+2],r,c),this._program.vertex(this,e.data[e.startOffset+y+1],o,h),this._program.vertex(this,e.data[e.startOffset+y],s,u),this._triangle(_,f,m,g);else if(this._cullingMode==ContextGLTriangleFace.FRONT_AND_BACK||this._cullingMode==ContextGLTriangleFace.NONE)for(y=i;y<n;y+=3)this._program.vertex(this,e.data[e.startOffset+y+2],r,c),this._program.vertex(this,e.data[e.startOffset+y+1],o,h),this._program.vertex(this,e.data[e.startOffset+y],s,u),this._triangle(_,f,m,g),this._program.vertex(this,e.data[e.startOffset+y],r,c),this._program.vertex(this,e.data[e.startOffset+y+1],o,h),this._program.vertex(this,e.data[e.startOffset+y+2],s,u),this._triangle(_,f,m,g);this._activeBufferColor!=this._backBufferColor&&(this._activeBufferColor.unlock(),this._activeTexture.uploadFromArray(new Uint8Array(this._activeBufferColor.data.buffer)))}},r0.prototype._triangle=function(t,e,i,n){var r=0,o=0,s=0,a=t[2],l=i[2],c=0<a[2];c&&(e[0]=a,n[0]=l,s++,r++);for(var h=0;h<3;h++){var u,p,d,_=t[h],f=i[h],m=0<_[2];m!=c&&(u=Math.abs(_[2]),d=(p=Math.abs(a[2]))/(p+u),this._interpolateVertexPair(d,_,a,t[3+o]),e[s]=t[3+o],this._interpolateVertexPair(d,f,l,i[3+o]),n[s]=i[3+o],s++,o++),m&&2!=h&&(e[s]=_,n[s]=f,s++,r++),a=_,l=f,c=m}3==r?this._projectTriangle(t[0],t[1],t[2],i[0],i[1],i[2]):2==r?(this._projectTriangle(e[0],e[1],e[2],n[0],n[1],n[2]),this._projectTriangle(e[0],e[2],e[3],n[0],n[2],n[3])):1==r&&this._projectTriangle(e[0],e[1],e[2],n[0],n[1],n[2])},r0.prototype._projectTriangle=function(t,e,i,n,r,o){if(this._p0.x=t[0],this._p0.y=t[1],this._p0.z=t[2],this._p0.w=t[3],this._p1.x=e[0],this._p1.y=e[1],this._p1.z=e[2],this._p1.w=e[3],this._p2.x=i[0],this._p2.y=i[1],this._p2.z=i[2],this._p2.w=i[3],0!=this._p0.w&&0!=this._p1.w&&0!=this._p2.w&&!(isNaN(this._p0.x)||isNaN(this._p0.y)||isNaN(this._p0.z)||isNaN(this._p0.w)||isNaN(this._p1.x)||isNaN(this._p1.y)||isNaN(this._p1.z)||isNaN(this._p1.w)||isNaN(this._p2.x)||isNaN(this._p2.y)||isNaN(this._p2.z)||isNaN(this._p2.w))){this._p0.z=2*this._p0.z-this._p0.w,this._p1.z=2*this._p1.z-this._p1.w,this._p2.z=2*this._p2.z-this._p2.w,this._p0.project(),this._p1.project(),this._p2.project(),this._project.x=this._p0.w,this._project.y=this._p1.w,this._project.z=this._p2.w,this._p0.w=1,this._p1.w=1,this._p2.w=1,this._p0=this._screenMatrix.transformVector(this._p0,this._p0),this._p1=this._screenMatrix.transformVector(this._p1,this._p1),this._p2=this._screenMatrix.transformVector(this._p2,this._p2),this._bboxMin.x=1e6,this._bboxMin.y=1e6,this._bboxMax.x=-1e6,this._bboxMax.y=-1e6,this._clamp.x=this._activeBufferColor.width-1,this._clamp.y=this._activeBufferColor.height-1,this._bboxMin.x=Math.max(0,Math.min(this._bboxMin.x,this._p0.x)),this._bboxMin.y=Math.max(0,Math.min(this._bboxMin.y,this._p0.y)),this._bboxMin.x=Math.max(0,Math.min(this._bboxMin.x,this._p1.x)),this._bboxMin.y=Math.max(0,Math.min(this._bboxMin.y,this._p1.y)),this._bboxMin.x=Math.max(0,Math.min(this._bboxMin.x,this._p2.x)),this._bboxMin.y=Math.max(0,Math.min(this._bboxMin.y,this._p2.y)),this._bboxMax.x=Math.min(this._clamp.x,Math.max(this._bboxMax.x,this._p0.x)),this._bboxMax.y=Math.min(this._clamp.y,Math.max(this._bboxMax.y,this._p0.y)),this._bboxMax.x=Math.min(this._clamp.x,Math.max(this._bboxMax.x,this._p1.x)),this._bboxMax.y=Math.min(this._clamp.y,Math.max(this._bboxMax.y,this._p1.y)),this._bboxMax.x=Math.min(this._clamp.x,Math.max(this._bboxMax.x,this._p2.x)),this._bboxMax.y=Math.min(this._clamp.y,Math.max(this._bboxMax.y,this._p2.y)),this._bboxMin.x=Math.floor(this._bboxMin.x),this._bboxMin.y=Math.floor(this._bboxMin.y),this._bboxMax.x=Math.floor(this._bboxMax.x),this._bboxMax.y=Math.floor(this._bboxMax.y);var s=this._bboxMax.x-this._bboxMin.x,a=this._bboxMax.y-this._bboxMin.y;if(!(s<=0||a<=0)){var l=(this._p1.x-this._p0.x)*(this._p2.y-this._p0.y)-(this._p1.y-this._p0.y)*(this._p2.x-this._p0.x);if(!(l<0))for(var c=-(this._p2.y-this._p1.y)/l,h=-(this._p0.y-this._p2.y)/l,u=-(this._p1.y-this._p0.y)/l,p=(this._p2.x-this._p1.x)/l,d=(this._p0.x-this._p2.x)/l,_=(this._p1.x-this._p0.x)/l,f=((this._p2.x-this._p1.x)*(this._bboxMin.y-this._p1.y)-(this._p2.y-this._p1.y)*(this._bboxMin.x-this._p1.x))/l,m=((this._p0.x-this._p2.x)*(this._bboxMin.y-this._p2.y)-(this._p0.y-this._p2.y)*(this._bboxMin.x-this._p2.x))/l,g=((this._p1.x-this._p0.x)*(this._bboxMin.y-this._p0.y)-(this._p1.y-this._p0.y)*(this._bboxMin.x-this._p0.x))/l,y=0,b=0,v=this._bboxMin.x;v<=this._bboxMax.x;v++){for(var x,A,S,w=this._bboxMin.y;w<=this._bboxMax.y;w++)this._barycentric.x=f+c*y+p*b,this._barycentric.y=m+h*y+d*b,this._barycentric.z=g+u*y+_*b,b+=1,this._barycentric.x<0||this._barycentric.y<0||this._barycentric.z<0||(v!=this._bboxMax.x&&(this._barycentricRight.x=this._barycentric.x+c,this._barycentricRight.y=this._barycentric.y+h,this._barycentricRight.z=this._barycentric.z+u,this._barycentricRight.x/=this._project.x,this._barycentricRight.y/=this._project.y,this._barycentricRight.z/=this._project.z,this._barycentricRight.scaleBy(1/(this._barycentricRight.x+this._barycentricRight.y+this._barycentricRight.z))),w!=this._bboxMax.y&&(this._barycentricBottom.x=this._barycentric.x+p,this._barycentricBottom.y=this._barycentric.y+d,this._barycentricBottom.z=this._barycentric.z+_,this._barycentricBottom.x/=this._project.x,this._barycentricBottom.y/=this._project.y,this._barycentricBottom.z/=this._project.z,this._barycentricBottom.scaleBy(1/(this._barycentricBottom.x+this._barycentricBottom.y+this._barycentricBottom.z))),x=v%this._activeBufferColor.width+w*this._activeBufferColor.width,A=(this._barycentric.x*this._p0.z+this._barycentric.y*this._p1.z+this._barycentric.z*this._p2.z)/(this._barycentric.x+this._barycentric.y+this._barycentric.z),this._barycentric.x/=this._project.x,this._barycentric.y/=this._project.y,this._barycentric.z/=this._project.z,this._barycentric.scaleBy(1/(this._barycentric.x+this._barycentric.y+this._barycentric.z)),this._depthCompareModeSoftware[this._depthCompareMode](A,this._activeBufferZ[x])&&((S=this._program.fragment(this,this._barycentric,this._barycentricRight,this._barycentricBottom,n,r,o,A)).discard||(this._writeDepth&&(this._activeBufferZ[x]=A),this._source[0]=255*S.outputColor[0],this._source[1]=255*S.outputColor[1],this._source[2]=255*S.outputColor[2],this._source[3]=255*S.outputColor[3],this._activeBufferColor.getPixelData(v,w,this._dest),this._putPixel(v,w))));b=0,y+=1}}}},r0.prototype._putPixel=function(t,e){this._blendModeSoftware[this._blendDestination](this._destComp,this._dest,this._dest,this._source),this._blendModeSoftware[this._blendSource](this._sourceComp,this._source,this._dest,this._source),this._rgba[0]=this._sourceComp[0]+this._destComp[0],this._rgba[1]=this._sourceComp[1]+this._destComp[1],this._rgba[2]=this._sourceComp[2]+this._destComp[2],this._rgba[3]=this._sourceComp[3]+this._destComp[3],this._activeBufferColor.setPixelData(t,e,this._rgba)},r0.prototype.createCubeTexture=function(t,e,i,n){return new CubeTextureSoftware(t)},r0.prototype.createIndexBuffer=function(t){return new IndexBufferSoftware(t)},r0.prototype.createProgram=function(){return new ProgramSoftware},r0.prototype.createTexture=function(t,e,i,n,r){return new TextureSoftware(t,e)},r0.prototype.createVertexBuffer=function(t,e){return new VertexBufferSoftware(t,e)},r0.prototype.dispose=function(){},r0.prototype.setBlendFactors=function(t,e){this._blendSource=t,this._blendDestination=e},r0.prototype.setColorMask=function(t,e,i,n){this._colorMaskR=t,this._colorMaskG=e,this._colorMaskB=i,this._colorMaskA=n},r0.prototype.setStencilActions=function(t,e,i,n,r,o){void 0===t&&(t=ContextGLTriangleFace.FRONT_AND_BACK),void 0===e&&(e=ContextGLCompareMode.ALWAYS),void 0===i&&(i=ContextGLStencilAction.KEEP),void 0===n&&(n=ContextGLStencilAction.KEEP),void 0===r&&(r=ContextGLStencilAction.KEEP),void 0===o&&(o=CoordinateSystem.LEFT_HANDED)},r0.prototype.setStencilReferenceValue=function(t,e,i){},r0.prototype.setCulling=function(t,e){this._cullingMode=t},r0.prototype.setDepthTest=function(t,e){this._writeDepth=t,this._depthCompareMode=e},r0.prototype.setProgram=function(t){this._program=t},r0.prototype.setProgramConstantsFromArray=function(t,e){var i;t==ContextGLProgramType.VERTEX?i=this._vertexConstants=new Float32Array(e.length):t==ContextGLProgramType.FRAGMENT&&(i=this._fragmentConstants=new Float32Array(e.length)),i.set(e)},r0.prototype.setTextureAt=function(t,e){this._textures[t]=e},r0.prototype.setVertexBufferAt=function(t,e,i,n){this._vertexBuffers[t]=e,this._vertexBufferOffsets[t]=i,this._vertexBufferFormats[t]=n},r0.prototype.present=function(){this._backBufferColor.unlock(),this._frontBuffer.fillRect(this._frontBuffer.rect,0),this._frontBuffer.drawBitmap(this._backBufferColor.data,0,0,this._backBufferColor.width,this._backBufferColor.height,this._frontBufferMatrix),document&&document.body&&(this._frontBufferImageData.data.set(this._frontBuffer.data),this._frontBufferContext.putImageData(this._frontBufferImageData,0,0))},r0.prototype.drawToBitmapImage2D=function(t){t.setPixels(this._activeBufferColor.rect,this._activeBufferColor.data)},r0.prototype._interpolateVertexPair=function(t,e,i,n){for(var r=0;r<e.length;r++){var o=e[r]-i[r];n[r]=i[r]+o*t}},r0.prototype.clamp=function(t,e,i){return void 0===e&&(e=0),void 0===i&&(i=1),Math.max(e,Math.min(t,i))},r0.prototype.interpolate=function(t,e,i){return t+(e-t)*this.clamp(i)},r0.prototype.drawVertices=function(t,e,i){},r0.prototype.setScissorRectangle=function(t){},r0.prototype.setSamplerStateAt=function(t,e,i,n){var r=this._samplerStates[t];(r=r||(this._samplerStates[t]=new SoftwareSamplerState)).wrap=e,r.filter=i,r.mipfilter=n},r0.prototype.enableStencil=function(){},r0.prototype.disableStencil=function(){},Object.defineProperty(r0.prototype,"frontBuffer",{get:function(){return this._frontBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(r0.prototype,"container",{get:function(){return this._canvas},enumerable:!0,configurable:!0}),r0.prototype.clear=function(t,e,i,n,r,o,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===s&&(s=ContextGLClearMask.ALL),this._backBufferColor.lock(),s&ContextGLClearMask.COLOR&&this._backBufferColor.fillRect(this._backBufferRect,ColorUtils.ARGBtoFloat32(255*n,255*t,255*e,255*i)),s&ContextGLClearMask.DEPTH&&this._backBufferZ.set(this._backBufferZClear)},r0.MAX_SAMPLERS=8,r0),ContextWebGLFlags={PREF_VERSION:2,PREF_MULTISAMPLE:!0,PREF_MIPMAP:1,PREF_REPEAT_WRAP:1},TextureBaseWebGL=(Object.defineProperty(y3.prototype,"id",{get:function(){return this._id},enumerable:!0,configurable:!0}),y3.prototype.dispose=function(){this._gl.deleteTexture(this._glTexture)},Object.defineProperty(y3.prototype,"glTexture",{get:function(){return this._glTexture},enumerable:!0,configurable:!0}),y3.prototype.generateMipmaps=function(){throw new AbstractMethodError},y3.TEXTURE_ID=0,y3),CubeTextureWebGL=(A3=TextureBaseWebGL,__extends(B3,A3),B3.prototype.uploadFromArray=function(t,e,i,n){if(void 0===i&&(i=0),void 0===n&&(n=!1),t.length!=this._size*this._size*4)throw new Error("Array is not the correct length for texture dimensions");t instanceof Array&&(t=new Uint8Array(t)),this._gl.bindTexture(this._gl.TEXTURE_CUBE_MAP,this._glTexture),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,n),this._gl.texImage2D(this._textureSelectorDictionary[e],i,this._gl.RGBA,this._size,this._size,0,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t),this._gl.bindTexture(this._gl.TEXTURE_CUBE_MAP,null)},B3.prototype.uploadCompressedTextureFromArray=function(t,e,i){},Object.defineProperty(B3.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),B3.prototype.generateMipmaps=function(){this._gl.bindTexture(this._gl.TEXTURE_CUBE_MAP,this._glTexture),this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP)},B3),IndexBufferWebGL=(N3.prototype.uploadFromArray=function(t,e,i){this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,this._buffer),e?this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER,2*e,t):this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,t,this._gl.STATIC_DRAW)},N3.prototype.uploadFromByteArray=function(t,e,i){this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,this._buffer),e?this._gl.bufferSubData(this._gl.ELEMENT_ARRAY_BUFFER,2*e,t):this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,t,this._gl.STATIC_DRAW)},N3.prototype.dispose=function(){this._gl.deleteBuffer(this._buffer)},Object.defineProperty(N3.prototype,"numIndices",{get:function(){return this._numIndices},enumerable:!0,configurable:!0}),Object.defineProperty(N3.prototype,"glBuffer",{get:function(){return this._buffer},enumerable:!0,configurable:!0}),N3),TEST_PLACE=/(#define|#version|precision).*\n/gi,ProgramWebGL=(W3.prototype.upload=function(t,e){var i=0!=this._gl.getShaderPrecisionFormat(this._gl.VERTEX_SHADER,this._gl.HIGH_FLOAT).precision?"highp":"mediump",n=0!=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT).precision?"highp":"mediump",r=W3._aglslParser.parse(W3._tokenizer.decribeAGALByteArray(t),i),o=W3._aglslParser.parse(W3._tokenizer.decribeAGALByteArray(e),n);this.name||(this.name="PROG_AGAL_"+this._id),this.uploadRaw(r,o)},W3.prototype.uploadRaw=function(t,e){if(this.name||(this.name="PROG_GLSL_"+this._id),t=this.insertName(t),e=this.insertName(e),this._vertexShader=this._gl.createShader(this._gl.VERTEX_SHADER),this._fragmentShader=this._gl.createShader(this._gl.FRAGMENT_SHADER),this._gl.shaderSource(this._vertexShader,t),this._gl.compileShader(this._vertexShader),!this._gl.getShaderParameter(this._vertexShader,this._gl.COMPILE_STATUS))throw new Error(this._gl.getShaderInfoLog(this._vertexShader));if(this._gl.shaderSource(this._fragmentShader,e),this._gl.compileShader(this._fragmentShader),!this._gl.getShaderParameter(this._fragmentShader,this._gl.COMPILE_STATUS))throw new Error(this._gl.getShaderInfoLog(this._fragmentShader));if(this._gl.attachShader(this._program,this._vertexShader),this._gl.attachShader(this._program,this._fragmentShader),this._gl.linkProgram(this._program),!this._gl.getProgramParameter(this._program,this._gl.LINK_STATUS))throw new Error(this._gl.getProgramInfoLog(this._program));this.reset()},W3.prototype.insertName=function(t){var e=t.match(TEST_PLACE)||[],i=e[e.length-1],n=i?t.lastIndexOf(i)+i.length:0;return t.substr(0,n)+"\n#define SHADER_NAME "+this.name+"\n\n"+t.substr(n)},W3.prototype.reset=function(){this._uniforms[0]={},this._uniforms[1]={},this._uniforms[2]={},this._attribs.length=0},W3.prototype.getUniformLocation=function(t,e){void 0===e&&(e=-1);var i="number"==typeof e,n=i?e:this._nameToIndex[e];if(void 0!==n&&null!=this._uniforms[t][n+1])return this._uniforms[t][n+1];var r=e;return i&&(r=-1===e?W3._uniformLocationNameDictionary[t]:W3._uniformLocationNameDictionary[t]+e),this._nameToIndex[r]=n+1,this._uniforms[t][n+1]=this._gl.getUniformLocation(this._program,r)},W3.prototype.getAttribLocation=function(t){if(null!=this._attribs[t])return this._attribs[t];var e=this._gl.getActiveAttrib(this._program,t);return this._attribs[t]=e?this._gl.getAttribLocation(this._program,e.name):-1},W3.prototype.dispose=function(){this._gl.deleteProgram(this._program)},W3.prototype.focusProgram=function(){this._gl.useProgram(this._program)},Object.defineProperty(W3.prototype,"glProgram",{get:function(){return this._program},enumerable:!0,configurable:!0}),W3.ProgramID=0,W3._tokenizer=new AGALTokenizer,W3._aglslParser=new AGLSLParser,W3._uniformLocationNameDictionary=["fc","fs","vc"],W3),TextureWebGL=(p4=TextureBaseWebGL,__extends(q4,p4),Object.defineProperty(q4.prototype,"width",{get:function(){return this._width},enumerable:!0,configurable:!0}),Object.defineProperty(q4.prototype,"height",{get:function(){return this._height},enumerable:!0,configurable:!0}),Object.defineProperty(q4.prototype,"multisampled",{get:function(){return this._multisampled},enumerable:!0,configurable:!0}),Object.defineProperty(q4.prototype,"framebuffer",{get:function(){return this._frameBuffer[this._mipmapSelector]},enumerable:!0,configurable:!0}),Object.defineProperty(q4.prototype,"textureFramebuffer",{get:function(){return this.multisampled?this._frameBufferDraw[this._mipmapSelector]:this._frameBuffer[this._mipmapSelector]},enumerable:!0,configurable:!0}),q4.prototype.setFrameBuffer=function(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this._context.setFrameBuffer(this,t,e,i,n)},q4.prototype.presentFrameBuffer=function(){console.warn("[Texture] Framebuffer present internal method of ContextWebGL")},q4.prototype.dispose=function(){this._context.disposeTexture(this),this._glTexture=null,this._renderBuffer=null,this._renderBufferDepth=null,this._frameBuffer=null,this._frameBufferDraw=null,this._mipmapSelector=0,this._width=this._height=0,this._multisampled=!1},q4.prototype.uploadFromArray=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1);for(var n=this._width,r=this._height,o=0;o<e;o++)n*=.5,r*=.5;if(t.length!=Math.floor(n)*Math.floor(r)*4)throw new Error("Array is not the correct length for texture dimensions");t instanceof Array&&(t=new Uint8Array(t)),this._gl.bindTexture(this._gl.TEXTURE_2D,this._glTexture),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this._gl.texImage2D(this._gl.TEXTURE_2D,e,this._gl.RGBA,n,r,0,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t),this._gl.bindTexture(this._gl.TEXTURE_2D,null)},q4.prototype.uploadFromURL=function(t,e,i){void 0===i&&(i=!1),this._gl.bindTexture(this._gl.TEXTURE_2D,this._glTexture),this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._width,this._height,0,this._gl.RGBA,this._gl.UNSIGNED_BYTE,null),this._gl.bindTexture(this._gl.TEXTURE_2D,null)},q4.prototype.uploadCompressedTextureFromArray=function(t,e,i){this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc")},q4.prototype.generateMipmaps=function(){this._gl.bindTexture(this._gl.TEXTURE_2D,this._glTexture),this._gl.generateMipmap(this._gl.TEXTURE_2D)},q4),VertexBufferWebGL=(L4.prototype.uploadFromArray=function(t,e,i){this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._buffer),e?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,e*this._dataPerVertex,t):this._gl.bufferData(this._gl.ARRAY_BUFFER,t,this._gl.STATIC_DRAW)},L4.prototype.uploadFromByteArray=function(t,e,i){this._gl.bindBuffer(this._gl.ARRAY_BUFFER,this._buffer),e?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,e*this._dataPerVertex,t):this._gl.bufferData(this._gl.ARRAY_BUFFER,t,this._gl.STATIC_DRAW)},Object.defineProperty(L4.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),Object.defineProperty(L4.prototype,"dataPerVertex",{get:function(){return this._dataPerVertex},enumerable:!0,configurable:!0}),Object.defineProperty(L4.prototype,"glBuffer",{get:function(){return this._buffer},enumerable:!0,configurable:!0}),L4.prototype.dispose=function(){this._gl.deleteBuffer(this._buffer)},L4),nPOTAlerts={},ContextWebGL=(Object.defineProperty(V4.prototype,"glVersion",{get:function(){return this._glVersion},enumerable:!0,configurable:!0}),Object.defineProperty(V4.prototype,"pixelRatio",{get:function(){return this._pixelRatio},enumerable:!0,configurable:!0}),Object.defineProperty(V4.prototype,"container",{get:function(){return this._container},set:function(t){this._container=t,this.initWebGL()},enumerable:!0,configurable:!0}),Object.defineProperty(V4.prototype,"standardDerivatives",{get:function(){return this._standardDerivatives},enumerable:!0,configurable:!0}),V4.prototype.initWebGL=function(t){void 0===t&&(t=!1);var e,i,n={alpha:t,stencil:!0};try{2===ContextWebGLFlags.PREF_VERSION&&(this._gl=this._container.getContext("webgl2",n)),this._gl?this._glVersion=2:(this._gl=this._container.getContext("webgl",n)||this._container.getContext("experimental-webgl",n),this._glVersion=1,2===ContextWebGLFlags.PREF_VERSION&&console.warn("[CONTEXT] Preferred WebGL2 not supported on you device. WebGL1 will used!"))}catch(t){}this._gl?(this._gl.getExtension("OES_standard_derivatives")?this._standardDerivatives=!0:this._standardDerivatives=!1,this._blendFactorDictionary[ContextGLBlendFactor.ONE]=this._gl.ONE,this._blendFactorDictionary[ContextGLBlendFactor.DESTINATION_ALPHA]=this._gl.DST_ALPHA,this._blendFactorDictionary[ContextGLBlendFactor.DESTINATION_COLOR]=this._gl.DST_COLOR,this._blendFactorDictionary[ContextGLBlendFactor.ONE]=this._gl.ONE,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_DESTINATION_ALPHA]=this._gl.ONE_MINUS_DST_ALPHA,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_DESTINATION_COLOR]=this._gl.ONE_MINUS_DST_COLOR,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_SOURCE_ALPHA]=this._gl.ONE_MINUS_SRC_ALPHA,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_SOURCE_COLOR]=this._gl.ONE_MINUS_SRC_COLOR,this._blendFactorDictionary[ContextGLBlendFactor.SOURCE_ALPHA]=this._gl.SRC_ALPHA,this._blendFactorDictionary[ContextGLBlendFactor.SOURCE_COLOR]=this._gl.SRC_COLOR,this._blendFactorDictionary[ContextGLBlendFactor.ZERO]=this._gl.ZERO,this._drawModeDictionary[ContextGLDrawMode.LINES]=this._gl.LINES,this._drawModeDictionary[ContextGLDrawMode.TRIANGLES]=this._gl.TRIANGLES,this._compareModeDictionary[ContextGLCompareMode.ALWAYS]=this._gl.ALWAYS,this._compareModeDictionary[ContextGLCompareMode.EQUAL]=this._gl.EQUAL,this._compareModeDictionary[ContextGLCompareMode.GREATER]=this._gl.GREATER,this._compareModeDictionary[ContextGLCompareMode.GREATER_EQUAL]=this._gl.GEQUAL,this._compareModeDictionary[ContextGLCompareMode.LESS]=this._gl.LESS,this._compareModeDictionary[ContextGLCompareMode.LESS_EQUAL]=this._gl.LEQUAL,this._compareModeDictionary[ContextGLCompareMode.NEVER]=this._gl.NEVER,this._compareModeDictionary[ContextGLCompareMode.NOT_EQUAL]=this._gl.NOTEQUAL,this._stencilActionDictionary[ContextGLStencilAction.DECREMENT_SATURATE]=this._gl.DECR,this._stencilActionDictionary[ContextGLStencilAction.DECREMENT_WRAP]=this._gl.DECR_WRAP,this._stencilActionDictionary[ContextGLStencilAction.INCREMENT_SATURATE]=this._gl.INCR,this._stencilActionDictionary[ContextGLStencilAction.INCREMENT_WRAP]=this._gl.INCR_WRAP,this._stencilActionDictionary[ContextGLStencilAction.INVERT]=this._gl.INVERT,this._stencilActionDictionary[ContextGLStencilAction.KEEP]=this._gl.KEEP,this._stencilActionDictionary[ContextGLStencilAction.SET]=this._gl.REPLACE,this._stencilActionDictionary[ContextGLStencilAction.ZERO]=this._gl.ZERO,this._textureIndexDictionary[0]=this._gl.TEXTURE0,this._textureIndexDictionary[1]=this._gl.TEXTURE1,this._textureIndexDictionary[2]=this._gl.TEXTURE2,this._textureIndexDictionary[3]=this._gl.TEXTURE3,this._textureIndexDictionary[4]=this._gl.TEXTURE4,this._textureIndexDictionary[5]=this._gl.TEXTURE5,this._textureIndexDictionary[6]=this._gl.TEXTURE6,this._textureIndexDictionary[7]=this._gl.TEXTURE7,this._textureTypeDictionary.texture2d=this._gl.TEXTURE_2D,this._textureTypeDictionary.textureCube=this._gl.TEXTURE_CUBE_MAP,this._wrapDictionary[ContextGLWrapMode.REPEAT]=this._gl.REPEAT,this._wrapDictionary[ContextGLWrapMode.CLAMP]=this._gl.CLAMP_TO_EDGE,this._filterDictionary[ContextGLTextureFilter.LINEAR]=this._gl.LINEAR,this._filterDictionary[ContextGLTextureFilter.NEAREST]=this._gl.NEAREST,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR]=new Object,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPNEAREST]=this._gl.LINEAR_MIPMAP_NEAREST,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPLINEAR]=this._gl.LINEAR_MIPMAP_LINEAR,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPNONE]=this._gl.LINEAR,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST]=new Object,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPNEAREST]=this._gl.NEAREST_MIPMAP_NEAREST,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPLINEAR]=this._gl.NEAREST_MIPMAP_LINEAR,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPNONE]=this._gl.NEAREST,this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.FLOAT_1]=new VertexBufferProperties(1,this._gl.FLOAT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.FLOAT_2]=new VertexBufferProperties(2,this._gl.FLOAT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.FLOAT_3]=new VertexBufferProperties(3,this._gl.FLOAT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.FLOAT_4]=new VertexBufferProperties(4,this._gl.FLOAT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.BYTE_1]=new VertexBufferProperties(1,this._gl.BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.BYTE_2]=new VertexBufferProperties(2,this._gl.BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.BYTE_3]=new VertexBufferProperties(3,this._gl.BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.BYTE_4]=new VertexBufferProperties(4,this._gl.BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_BYTE_1]=new VertexBufferProperties(1,this._gl.UNSIGNED_BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_BYTE_2]=new VertexBufferProperties(2,this._gl.UNSIGNED_BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_BYTE_3]=new VertexBufferProperties(3,this._gl.UNSIGNED_BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_BYTE_4]=new VertexBufferProperties(4,this._gl.UNSIGNED_BYTE,!0),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.SHORT_1]=new VertexBufferProperties(1,this._gl.SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.SHORT_2]=new VertexBufferProperties(2,this._gl.SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.SHORT_3]=new VertexBufferProperties(3,this._gl.SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.SHORT_4]=new VertexBufferProperties(4,this._gl.SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_SHORT_1]=new VertexBufferProperties(1,this._gl.UNSIGNED_SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_SHORT_2]=new VertexBufferProperties(2,this._gl.UNSIGNED_SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_SHORT_3]=new VertexBufferProperties(3,this._gl.UNSIGNED_SHORT,!1),this._vertexBufferPropertiesDictionary[ContextGLVertexBufferFormat.UNSIGNED_SHORT_4]=new VertexBufferProperties(4,this._gl.UNSIGNED_SHORT,!1),this._stencilCompareMode=this._gl.ALWAYS,this._stencilCompareModeBack=this._gl.ALWAYS,this._stencilCompareModeFront=this._gl.ALWAYS,e=window.devicePixelRatio||1,i=this._gl.webkitBackingStorePixelRatio||this._gl.mozBackingStorePixelRatio||this._gl.msBackingStorePixelRatio||this._gl.oBackingStorePixelRatio||this._gl.backingStorePixelRatio||1,this._pixelRatio=e/i):alert("WebGL is not available.");for(var r=0;r<V4.MAX_SAMPLERS;++r)this._samplerStates[r]=new SamplerState,this._samplerStates[r].wrap=2===this.glVersion?this._gl.REPEAT:this._gl.CLAMP_TO_EDGE,this._samplerStates[r].filter=this._gl.LINEAR,this._samplerStates[r].mipfilter=this._gl.LINEAR},V4.prototype.gl=function(){return this._gl},V4.prototype.clear=function(t,e,i,n,r,o,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=0),void 0===s&&(s=ContextGLClearMask.ALL),this._drawing||(this.updateBlendStatus(),this._drawing=!0);var a=0;s&ContextGLClearMask.COLOR&&(a|=this._gl.COLOR_BUFFER_BIT),s&ContextGLClearMask.STENCIL&&(a|=this._gl.STENCIL_BUFFER_BIT),s&ContextGLClearMask.DEPTH&&(a|=this._gl.DEPTH_BUFFER_BIT),this._gl.clearColor(t,e,i,n),this._gl.clearDepth(r),this._gl.clearStencil(o),this._gl.clear(a)},V4.prototype.configureBackBuffer=function(t,e,i,n){void 0===n&&(n=!0),this._width=t*this._pixelRatio,this._height=e*this._pixelRatio,n?(this._gl.enable(this._gl.STENCIL_TEST),this._gl.enable(this._gl.DEPTH_TEST)):(this._gl.disable(this._gl.STENCIL_TEST),this._gl.disable(this._gl.DEPTH_TEST)),this._gl.viewport(0,0,this._width,this._height)},V4.prototype.createCubeTexture=function(t,e,i,n){return new CubeTextureWebGL(this,t)},V4.prototype.createIndexBuffer=function(t){return new IndexBufferWebGL(this._gl,t)},V4.prototype.createProgram=function(){return new ProgramWebGL(this._gl)},V4.prototype.createTexture=function(t,e,i,n,r){return new TextureWebGL(this,t,e)},V4.prototype.createVertexBuffer=function(t,e){return new VertexBufferWebGL(this._gl,t,e)},V4.prototype.dispose=function(){for(var t=0;t<this._samplerStates.length;++t)this._samplerStates[t]=null},V4.prototype.drawToBitmapImage2D=function(t){var e=new Uint8Array(t.width*t.height*4);this._gl.readPixels(0,0,t.width,t.height,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e),t.setPixels(new Rectangle(0,0,t.width,t.height),new Uint8ClampedArray(e.buffer))},V4.prototype.drawIndices=function(t,e,i,n){if(void 0===i&&(i=0),void 0===n&&(n=-1),!this._drawing)throw"Need to clear before drawing if the buffer has not been cleared since the last present() call.";this._gl.bindBuffer(this._gl.ELEMENT_ARRAY_BUFFER,e.glBuffer),this._gl.drawElements(this._drawModeDictionary[t],-1==n?e.numIndices:n,this._gl.UNSIGNED_SHORT,2*i)},V4.prototype.drawVertices=function(t,e,i){if(void 0===e&&(e=0),void 0===i&&(i=-1),!this._drawing)throw"Need to clear before drawing if the buffer has not been cleared since the last present() call.";0!=i&&this._gl.drawArrays(this._drawModeDictionary[t],e,i)},V4.prototype.present=function(){},V4.prototype.setBlendFactors=function(t,e){var i=this._blendFactorDictionary[t],n=this._blendFactorDictionary[e];this._blendSourceFactor===i&&this._blendDestinationFactor===n&&this._blendEnabled||(this._blendEnabled=!0,this._blendSourceFactor=i,this._blendDestinationFactor=n,this.updateBlendStatus())},V4.prototype.setColorMask=function(t,e,i,n){this._gl.colorMask(t,e,i,n)},V4.prototype.setCulling=function(t,e){void 0===e&&(e=CoordinateSystem.LEFT_HANDED),t==ContextGLTriangleFace.NONE?this._gl.disable(this._gl.CULL_FACE):(this._gl.enable(this._gl.CULL_FACE),this._gl.cullFace(this.translateTriangleFace(t,e)))},V4.prototype.setDepthTest=function(t,e){this._gl.depthFunc(this._compareModeDictionary[e]),this._gl.depthMask(t)},V4.prototype.setViewport=function(t,e,i,n){this._gl.viewport(t,e,i,n)},V4.prototype.enableDepth=function(){this._gl.enable(this._gl.DEPTH_TEST)},V4.prototype.disableDepth=function(){this._gl.disable(this._gl.DEPTH_TEST)},V4.prototype.enableStencil=function(){this._gl.enable(this._gl.STENCIL_TEST)},V4.prototype.disableStencil=function(){this._gl.disable(this._gl.STENCIL_TEST)},V4.prototype.setStencilActions=function(t,e,i,n,r,o){void 0===t&&(t=ContextGLTriangleFace.FRONT_AND_BACK),void 0===e&&(e=ContextGLCompareMode.ALWAYS),void 0===i&&(i=ContextGLStencilAction.KEEP),void 0===n&&(n=ContextGLStencilAction.KEEP),void 0===r&&(r=ContextGLStencilAction.KEEP),void 0===o&&(o=CoordinateSystem.LEFT_HANDED),this._separateStencil=t!=ContextGLTriangleFace.FRONT_AND_BACK;var s=this._compareModeDictionary[e],a=this._stencilActionDictionary[r],l=this._stencilActionDictionary[n],c=this._stencilActionDictionary[i];this._separateStencil?t==ContextGLTriangleFace.BACK?(this._stencilCompareModeBack=s,this._gl.stencilFuncSeparate(this._gl.BACK,s,this._stencilReferenceValue,this._stencilReadMask),this._gl.stencilOpSeparate(this._gl.BACK,a,l,c)):t==ContextGLTriangleFace.FRONT&&(this._stencilCompareModeFront=s,this._gl.stencilFuncSeparate(this._gl.FRONT,s,this._stencilReferenceValue,this._stencilReadMask),this._gl.stencilOpSeparate(this._gl.FRONT,a,l,c)):(this._stencilCompareMode=s,this._gl.stencilFunc(s,this._stencilReferenceValue,this._stencilReadMask),this._gl.stencilOp(a,l,c))},V4.prototype.setStencilReferenceValue=function(t,e,i){void 0===e&&(e=255),void 0===i&&(i=255),this._stencilReferenceValue=t,this._stencilReadMask=e,this._separateStencil?(this._gl.stencilFuncSeparate(this._gl.FRONT,this._stencilCompareModeFront,t,e),this._gl.stencilFuncSeparate(this._gl.BACK,this._stencilCompareModeBack,t,e)):this._gl.stencilFunc(this._stencilCompareMode,t,e),this._gl.stencilMask(i)},V4.prototype.setProgram=function(t){this._currentProgram!==t&&(this._currentProgram=t).focusProgram()},V4.prototype.setProgramConstantsFromArray=function(t,e){e.length&&this._gl.uniform4fv(this._currentProgram.getUniformLocation(t),e)},V4.prototype.setScissorRectangle=function(t){t?(this._gl.enable(this._gl.SCISSOR_TEST),this._gl.scissor(t.x*this._pixelRatio,this._height-(t.y+t.height)*this._pixelRatio,t.width*this._pixelRatio,t.height*this._pixelRatio)):this._gl.disable(this._gl.SCISSOR_TEST)},V4.prototype.setTextureAt=function(t,e){var i,n,r,o,s=this._samplerStates[t];this._activeTexture!=t&&(e||s.type)&&(this._activeTexture=t,this._gl.activeTexture(this._textureIndexDictionary[t])),e?(n=!((i=e).width&i.width-1||i.height&i.height-1),r=(2===this.glVersion||n)&&0!==ContextWebGLFlags.PREF_REPEAT_WRAP,o=this._textureTypeDictionary[e.textureType],s.type=o,this._gl.bindTexture(o,e.glTexture),this._gl.uniform1i(this._currentProgram.getUniformLocation(ContextGLProgramType.SAMPLER,t),t),s.wrap!==this._gl.REPEAT||r?(this._gl.texParameteri(o,this._gl.TEXTURE_WRAP_S,s.wrap),this._gl.texParameteri(o,this._gl.TEXTURE_WRAP_T,s.wrap)):(nPOTAlerts[i.id]||1!==ContextWebGLFlags.PREF_REPEAT_WRAP||(nPOTAlerts[i.id]=!0,console.warn("[Texture] REPEAT wrap not allowed for nPOT textures in WebGL1,set ContextWebGLFlags.PREF_REPEAT_WRAP = (ContextWebGLPreference.POT_TEXTURES || ContextWebGLPreference.NONE)to supress warnings!",i)),this._gl.texParameteri(o,this._gl.TEXTURE_WRAP_S,this._gl.CLAMP_TO_EDGE),this._gl.texParameteri(o,this._gl.TEXTURE_WRAP_T,this._gl.CLAMP_TO_EDGE)),this._gl.texParameteri(o,this._gl.TEXTURE_MAG_FILTER,s.filter),this._gl.texParameteri(o,this._gl.TEXTURE_MIN_FILTER,s.mipfilter)):s.type&&(this._gl.bindTexture(s.type,null),s.type=null)},V4.prototype.setSamplerStateAt=function(t,e,i,n){if(!(0<=t&&t<V4.MAX_SAMPLERS))throw"Sampler is out of bounds.";this._samplerStates[t].wrap=this._wrapDictionary[e],this._samplerStates[t].filter=this._filterDictionary[i],this._samplerStates[t].mipfilter=this._mipmapFilterDictionary[i][n]},V4.prototype.setVertexBufferAt=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=4);var r,o=this._currentProgram?this._currentProgram.getAttribLocation(t):-1;e?(this._currentArrayBuffer!=e&&(this._currentArrayBuffer=e,this._gl.bindBuffer(this._gl.ARRAY_BUFFER,e?e.glBuffer:null)),r=this._vertexBufferPropertiesDictionary[n],this._gl.enableVertexAttribArray(o),this._gl.vertexAttribPointer(o,r.size,r.type,r.normalized,e.dataPerVertex,i)):-1<o&&this._gl.disableVertexAttribArray(t)},V4.prototype.setRenderToTexture=function(t,e,i,n,r){void 0===e&&(e=!1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this._renderTarget&&this.presentFrameBuffer(this._renderTarget),this._renderTarget=t,this._renderTargetConfig={texture:this._renderTarget,enableDepthAndStencil:e,antiAlias:i,surfaceSelector:n,mipmapSelector:r},this.setFrameBuffer(this._renderTarget,e,i,n,r)},V4.prototype.setRenderToBackBuffer=function(){this._renderTarget&&(this.presentFrameBuffer(this._renderTarget),this._renderTarget=null),this._renderTargetConfig=null,this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null)},V4.prototype.restoreRenderTarget=function(){var t,e,i,n,r;this._renderTargetConfig?((t=this._renderTargetConfig).texture,e=t.enableDepthAndStencil,i=t.antiAlias,n=t.surfaceSelector,r=t.mipmapSelector,this.setFrameBuffer(this._renderTarget,e,i,n,r)):this.setRenderToBackBuffer()},V4.prototype.copyToTexture=function(t,e,i){this.presentFrameBufferTo(this._renderTarget,t,e,i)},V4.prototype.unsafeCopyToTexture=function(t,e,i){this._gl.bindTexture(this._gl.TEXTURE_2D,t.glTexture),this._gl.copyTexSubImage2D(this._gl.TEXTURE_2D,0,i.x,i.y,e.x,e.y,e.width,e.height),this._gl.bindTexture(this._gl.TEXTURE_2D,null)},V4.prototype.setFrameBuffer=function(t,e,i,n,r){this._gl instanceof WebGLRenderingContext&&(r=0);var o=t.width>>>r,s=t.height>>>r;t._mipmapSelector=r,t._frameBuffer[r]?this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,t._frameBuffer[r]):this.initFrameBuffer(t,i,r),e?(this._gl.enable(this._gl.STENCIL_TEST),this._gl.enable(this._gl.DEPTH_TEST)):(this._gl.disable(this._gl.STENCIL_TEST),this._gl.disable(this._gl.DEPTH_TEST)),this._gl.viewport(0,0,o,s)},V4.prototype.initFrameBuffer=function(t,e,i){var n,r,o,s=t._width>>>i,a=t._height>>>i,l=t._frameBuffer[i]=this._gl.createFramebuffer(),c=t._renderBufferDepth[i]=this._gl.createRenderbuffer();t._mipmapSelector=i,this._gl.bindTexture(this._gl.TEXTURE_2D,t._glTexture),this._gl instanceof WebGLRenderingContext||!ContextWebGLFlags.PREF_MULTISAMPLE||e<1?(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,l),this._gl.bindRenderbuffer(this._gl.RENDERBUFFER,c),this._gl.renderbufferStorage(this._gl.RENDERBUFFER,this._gl.DEPTH_STENCIL,t._width,t._height),this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER,this._gl.COLOR_ATTACHMENT0,this._gl.TEXTURE_2D,t._glTexture,0),this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER,this._gl.DEPTH_STENCIL_ATTACHMENT,this._gl.RENDERBUFFER,c),t._multisampled=!1):(n=t._frameBufferDraw[i]=this._gl.createFramebuffer(),r=Math.log(Math.min(t._width,t._height))/Math.LN2|1,this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,n),t._texStorageFlag||(this._gl.texStorage2D(this._gl.TEXTURE_2D,r,this._gl.RGBA8,s,a),t._texStorageFlag=!0),this._gl.framebufferTexture2D(this._gl.FRAMEBUFFER,this._gl.COLOR_ATTACHMENT0,this._gl.TEXTURE_2D,t._glTexture,t._mipmapSelector),this._gl.bindTexture(this._gl.TEXTURE_2D,null),this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,l),this._gl.bindRenderbuffer(this._gl.RENDERBUFFER,c),this._gl.renderbufferStorageMultisample(this._gl.RENDERBUFFER,e,this._gl.DEPTH24_STENCIL8,s,a),this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER,this._gl.DEPTH_STENCIL_ATTACHMENT,this._gl.RENDERBUFFER,c),o=t._renderBuffer[i]=this._gl.createRenderbuffer(),this._gl.bindRenderbuffer(this._gl.RENDERBUFFER,o),this._gl.renderbufferStorageMultisample(this._gl.RENDERBUFFER,e,this._gl.RGBA8,s,a),this._gl.framebufferRenderbuffer(this._gl.FRAMEBUFFER,this._gl.COLOR_ATTACHMENT0,this._gl.RENDERBUFFER,o),t._multisampled=!0),this._gl.bindRenderbuffer(this._gl.RENDERBUFFER,null)},V4.prototype.presentFrameBuffer=function(t){var e,i;this._gl instanceof WebGLRenderingContext||!t._multisampled||(e=t._width>>>t._mipmapSelector,i=t._height>>>t._mipmapSelector,t._frameBuffer[t._mipmapSelector]!==t._frameBufferDraw[t._mipmapSelector]?(this._gl.bindFramebuffer(this._gl.READ_FRAMEBUFFER,t._frameBuffer[t._mipmapSelector]),this._gl.bindFramebuffer(this._gl.DRAW_FRAMEBUFFER,t._frameBufferDraw[t._mipmapSelector]),this._gl.clearBufferfv(this._gl.COLOR,0,[0,0,0,0]),this._gl.blitFramebuffer(0,0,e,i,0,0,e,i,this._gl.COLOR_BUFFER_BIT,this._gl.NEAREST)):console.error("Framebuffer loop `presentFrameBuffer`"))},V4.prototype.presentFrameBufferTo=function(t,e,i,n){var r=e.textureFramebuffer;r||(this.initFrameBuffer(e,0,0),this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,null),r=e.textureFramebuffer),t._frameBuffer[0]!==r?(!t||!t._multisampled||this._gl instanceof WebGLRenderingContext?(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,t._frameBuffer[0]),this.unsafeCopyToTexture(e,i,n)):r&&(this._gl.bindFramebuffer(this._gl.READ_FRAMEBUFFER,t._frameBuffer[0]),this._gl.bindFramebuffer(this._gl.DRAW_FRAMEBUFFER,r),this._gl.blitFramebuffer(0|i.x,0|i.y,i.width+i.x|0,i.height+i.y|0,0|n.x,0|n.y,n.x+i.width|0,n.y+i.height|0,this._gl.COLOR_BUFFER_BIT,this._gl.NEAREST)),this.blitTextureToRenderbuffer(e),this.restoreRenderTarget()):console.error("Framebuffer loop `presentFrameBufferTo`")},V4.prototype.blitTextureToRenderbuffer=function(t){var e,i;t._multisampled&&this._gl instanceof WebGL2RenderingContext&&(t._frameBuffer[t._mipmapSelector]!==t._frameBufferDraw[t._mipmapSelector]?(e=t._width>>>t._mipmapSelector,i=t._height>>>t._mipmapSelector,this._gl.bindFramebuffer(this._gl.DRAW_FRAMEBUFFER,t._frameBuffer[t._mipmapSelector]),this._gl.bindFramebuffer(this._gl.READ_FRAMEBUFFER,t._frameBufferDraw[t._mipmapSelector]),this._gl.clearBufferfv(this._gl.COLOR,0,[0,0,0,0]),this._gl.blitFramebuffer(0,0,e,i,0,0,e,i,this._gl.COLOR_BUFFER_BIT,this._gl.NEAREST)):console.error("Framebuffer loop `blitTextureToRenderbuffer`"))},V4.prototype.disposeTexture=function(e){var i=this;this._renderTarget!==e?(this._gl.deleteTexture(e._glTexture),Object.keys(e._frameBuffer).forEach(function(t){return i._gl.deleteFramebuffer(e._frameBuffer[t])}),Object.keys(e._frameBufferDraw).forEach(function(t){return i._gl.deleteFramebuffer(e._frameBufferDraw[t])}),Object.keys(e._renderBuffer).forEach(function(t){return i._gl.deleteRenderbuffer(e._renderBuffer[t])}),Object.keys(e._renderBufferDepth).forEach(function(t){return i._gl.deleteRenderbuffer(e._renderBufferDepth[t])})):console.error("[Context] Trying to dispose a active tendertarget!")},V4.prototype.updateBlendStatus=function(){this._blendEnabled?(this._gl.enable(this._gl.BLEND),this._gl.blendEquation(this._gl.FUNC_ADD),this._gl.blendFunc(this._blendSourceFactor,this._blendDestinationFactor)):this._gl.disable(this._gl.BLEND)},V4.prototype.translateTriangleFace=function(t,e){switch(t){case ContextGLTriangleFace.BACK:return e==CoordinateSystem.LEFT_HANDED?this._gl.FRONT:this._gl.BACK;case ContextGLTriangleFace.FRONT:return e==CoordinateSystem.LEFT_HANDED?this._gl.BACK:this._gl.FRONT;case ContextGLTriangleFace.FRONT_AND_BACK:return this._gl.FRONT_AND_BACK;default:throw"Unknown ContextGLTriangleFace type."}},V4.MAX_SAMPLERS=8,V4.modulo=0,V4),VertexBufferProperties=function(t,e,i){this.size=t,this.type=e,this.normalized=i},ShaderRegisterElement=(I7.prototype.toString=function(){return this._toStr},Object.defineProperty(I7.prototype,"regName",{get:function(){return this._regName},enumerable:!0,configurable:!0}),Object.defineProperty(I7.prototype,"index",{get:function(){return this._index},enumerable:!0,configurable:!0}),I7.COMPONENTS=["x","y","z","w"],I7),RegisterPool=(M7.prototype.requestFreeVectorReg=function(){for(var t=0;t<this._regCount;++t)if(!this.isRegisterUsed(t))return this._persistent&&this._usedVectorCount[t]++,this._vectorRegisters[t];throw new Error("Register overflow!")},M7.prototype.requestFreeRegComponent=function(){for(var t=0;t<this._regCount;++t)if(!(0<this._usedVectorCount[t]))for(var e=0;e<4;++e)if(0==this._usedSingleCount[e][t])return this._persistent&&this._usedSingleCount[e][t]++,this._registerComponents[e][t];throw new Error("Register overflow!")},M7.prototype.addUsage=function(t,e){-1<t._component?this._usedSingleCount[t._component][t.index]+=e:this._usedVectorCount[t.index]+=e},M7.prototype.removeUsage=function(t){if(-1<t._component){if(--this._usedSingleCount[t._component][t.index]<0)throw new Error("More usages removed than exist!")}else if(--this._usedVectorCount[t.index]<0)throw new Error("More usages removed than exist!")},M7.prototype.dispose=function(){this._vectorRegisters=null,this._registerComponents=null,this._usedSingleCount=null,this._usedVectorCount=null},M7.prototype.hasRegisteredRegs=function(){for(var t=0;t<this._regCount;++t)if(this.isRegisterUsed(t))return!0;return!1},M7.prototype.initRegisters=function(t,e){var i=M7._initPool(t,e);this._vectorRegisters=M7._regPool[i],this._registerComponents=M7._regCompsPool[i],this._usedVectorCount=this._initArray(Array(e),0),this._usedSingleCount=new Array(4),this._usedSingleCount[0]=this._initArray(new Array(e),0),this._usedSingleCount[1]=this._initArray(new Array(e),0),this._usedSingleCount[2]=this._initArray(new Array(e),0),this._usedSingleCount[3]=this._initArray(new Array(e),0)},M7._initPool=function(t,e){var i=t+e;if(null!=M7._regPool[i])return i;var n=new Array(e);M7._regPool[i]=n;var r=[[],[],[],[]];M7._regCompsPool[i]=r;for(var o=0;o<e;++o){n[o]=new ShaderRegisterElement(t,o);for(var s=0;s<4;++s)r[s][o]=new ShaderRegisterElement(t,o,s)}return i},M7.prototype.isRegisterUsed=function(t){if(0<this._usedVectorCount[t])return!0;for(var e=0;e<4;++e)if(0<this._usedSingleCount[e][t])return!0;return!1},M7.prototype._initArray=function(t,e){for(var i=t.length,n=0;n<i;n++)t[n]=e;return t},M7._regPool=new Object,M7._regCompsPool=new Object,M7),ShaderRegisterCache=(l8.prototype.reset=function(){this._fragmentTempCache=new RegisterPool("ft",8,!1),this._vertexTempCache=new RegisterPool("vt",8,!1),this._varyingCache=new RegisterPool("v",8),this._textureCache=new RegisterPool("fs",8),this._vertexAttributesCache=new RegisterPool("va",8),this._fragmentConstantsCache=new RegisterPool("fc",28),this._vertexConstantsCache=new RegisterPool("vc",128),this._fragmentOutputRegister=new ShaderRegisterElement("oc",-1),this._vertexOutputRegister=new ShaderRegisterElement("op",-1),this._numUsedVertexConstants=0,this._numUsedStreams=0,this._numUsedTextures=0,this._numUsedVaryings=0,this._numUsedFragmentConstants=0},l8.prototype.dispose=function(){this._fragmentTempCache.dispose(),this._vertexTempCache.dispose(),this._varyingCache.dispose(),this._fragmentConstantsCache.dispose(),this._vertexAttributesCache.dispose(),this._fragmentTempCache=null,this._vertexTempCache=null,this._varyingCache=null,this._fragmentConstantsCache=null,this._vertexAttributesCache=null,this._fragmentOutputRegister=null,this._vertexOutputRegister=null},l8.prototype.addFragmentTempUsages=function(t,e){this._fragmentTempCache.addUsage(t,e)},l8.prototype.removeFragmentTempUsage=function(t){this._fragmentTempCache.removeUsage(t)},l8.prototype.addVertexTempUsages=function(t,e){this._vertexTempCache.addUsage(t,e)},l8.prototype.removeVertexTempUsage=function(t){this._vertexTempCache.removeUsage(t)},l8.prototype.getFreeFragmentVectorTemp=function(){return this._fragmentTempCache.requestFreeVectorReg()},l8.prototype.getFreeFragmentSingleTemp=function(){return this._fragmentTempCache.requestFreeRegComponent()},l8.prototype.getFreeVarying=function(){return++this._numUsedVaryings,this._varyingCache.requestFreeVectorReg()},l8.prototype.getFreeFragmentConstant=function(){return++this._numUsedFragmentConstants,this._fragmentConstantsCache.requestFreeVectorReg()},l8.prototype.getFreeVertexConstant=function(){return++this._numUsedVertexConstants,this._vertexConstantsCache.requestFreeVectorReg()},l8.prototype.getFreeVertexVectorTemp=function(){return this._vertexTempCache.requestFreeVectorReg()},l8.prototype.getFreeVertexSingleTemp=function(){return this._vertexTempCache.requestFreeRegComponent()},l8.prototype.getFreeVertexAttribute=function(){return++this._numUsedStreams,this._vertexAttributesCache.requestFreeVectorReg()},l8.prototype.getFreeTextureReg=function(){return++this._numUsedTextures,this._textureCache.requestFreeVectorReg()},Object.defineProperty(l8.prototype,"fragmentOutputRegister",{get:function(){return this._fragmentOutputRegister},enumerable:!0,configurable:!0}),Object.defineProperty(l8.prototype,"numUsedVertexConstants",{get:function(){return this._numUsedVertexConstants},enumerable:!0,configurable:!0}),Object.defineProperty(l8.prototype,"numUsedFragmentConstants",{get:function(){return this._numUsedFragmentConstants},enumerable:!0,configurable:!0}),Object.defineProperty(l8.prototype,"numUsedStreams",{get:function(){return this._numUsedStreams},enumerable:!0,configurable:!0}),Object.defineProperty(l8.prototype,"numUsedTextures",{get:function(){return this._numUsedTextures},enumerable:!0,configurable:!0}),Object.defineProperty(l8.prototype,"numUsedVaryings",{get:function(){return this._numUsedVaryings},enumerable:!0,configurable:!0}),l8),Filter3DTaskBase=(Object.defineProperty(t8.prototype,"textureScale",{get:function(){return this._textureScale},set:function(t){this._textureScale!=t&&(this._textureScale=t,this._scaledTextureWidth=this._textureWidth/this._textureScale,this._scaledTextureHeight=this._textureHeight/this._textureScale,this._textureDimensionsInvalid=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t8.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!0,configurable:!0}),Object.defineProperty(t8.prototype,"rttManager",{get:function(){return this._rttManager},set:function(t){this._rttManager!=t&&(this._rttManager=t,this._textureDimensionsInvalid=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t8.prototype,"textureWidth",{get:function(){return this._textureWidth},set:function(t){this._textureWidth!=t&&(this._textureWidth=t,this._scaledTextureWidth=this._textureWidth/this._textureScale,this._textureDimensionsInvalid=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(t8.prototype,"textureHeight",{get:function(){return this._textureHeight},set:function(t){this._textureHeight!=t&&(this._textureHeight=t,this._scaledTextureHeight=this._textureHeight/this._textureScale,this._textureDimensionsInvalid=!0)},enumerable:!0,configurable:!0}),t8.prototype.getMainInputTexture=function(t){return this._textureDimensionsInvalid&&this.updateTextures(t),this._mainInputTexture},t8.prototype.dispose=function(){this._mainInputTexture&&this._mainInputTexture.dispose(),this._program3D&&this._program3D.dispose()},t8.prototype.invalidateProgram=function(){this._program3DInvalid=!0},t8.prototype.updateProgram=function(t){this._program3D&&this._program3D.dispose(),this._program3D=t.context.createProgram(),this._registerCache.reset();var e=(new AGALMiniAssembler).assemble("part vertex 1\n"+this.getVertexCode()+"endpart").vertex.data,i=(new AGALMiniAssembler).assemble("part fragment 1\n"+this.getFragmentCode()+"endpart").fragment.data;this._program3D.name=this.constructor.name,this._program3D.upload(e,i),this._program3DInvalid=!1},t8.prototype.getVertexCode=function(){var t=this._registerCache.getFreeVertexAttribute();this._positionIndex=t.index;var e=this._registerCache.getFreeVertexAttribute();return this._uvIndex=e.index,this._uvVarying=this._registerCache.getFreeVarying(),"mov op, "+t+"\nmov "+this._uvVarying+", "+e+"\n"},t8.prototype.getFragmentCode=function(){throw new AbstractMethodError},t8.prototype.updateTextures=function(t){this._mainInputTexture&&this._mainInputTexture.dispose(),this._mainInputTexture=new Image2D(this._scaledTextureWidth,this._scaledTextureHeight),this._textureDimensionsInvalid=!1},t8.prototype.getProgram=function(t){return this._program3DInvalid&&this.updateProgram(t),this._program3D},t8.prototype.activate=function(t,e,i){},t8.prototype.deactivate=function(t){},Object.defineProperty(t8.prototype,"requireDepthRender",{get:function(){return this._requireDepthRender},enumerable:!0,configurable:!0}),t8),EMPTY_TRANSFORM=new Float32Array([1,1,1,1,0,0,0,0]),Filter3DCopyPixelTask=(M8=Filter3DTaskBase,__extends(N8,M8),Object.defineProperty(N8.prototype,"sourceTexture",{get:function(){return this._mainInputTexture},set:function(t){this._mainInputTexture=t},enumerable:!0,configurable:!0}),N8.prototype.getVertexCode=function(){var t=this._registerCache.getFreeVertexVectorTemp(),e=this._registerCache.getFreeVertexConstant(),i=this._registerCache.getFreeVertexAttribute();this._positionIndex=i.index;var n=this._registerCache.getFreeVertexConstant(),r=this._registerCache.getFreeVertexAttribute();return this._uvIndex=r.index,this._uvVarying=this._registerCache.getFreeVarying(),"mul "+t+".xy, "+i+", "+e+".zw\nadd "+t+".xy, "+t+", "+e+".xy\nmov "+t+".w, "+i+".w\nmov op, "+t+"\nadd "+this._uvVarying+", "+r+", "+n+".xy\nmul "+this._uvVarying+", "+this._uvVarying+", "+n+".zw\n"},N8.prototype.getFragmentCode=function(){var t=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(t,1);var e=this._registerCache.getFreeFragmentConstant(),i=this._registerCache.getFreeFragmentConstant(),n=this._registerCache.getFreeTextureReg();return this._inputTextureIndex=n.index,"tex "+t+", "+this._uvVarying+", "+n+" <2d,linear,clamp>\nmul "+t+", "+t+", "+e+".xyzw\nadd "+t+", "+t+", "+i+".xyzw\nmov oc, "+t+"\n"},N8.prototype.getMainInputTexture=function(t){return this._mainInputTexture},N8.prototype.activate=function(t,e,i){var n=this._positionIndex,r=this._vertexConstantData,o=this.destPoint,s=this.rect,a=this._target,l=this._mainInputTexture;r[n+0]=(2*o.x+s.width)/a.width-1,r[n+1]=(2*o.y+s.height)/a.height-1,r[n+2]=s.width/a.width,r[n+3]=s.height/a.height,r[n+4]=2*s.x/l.width,r[n+5]=2*s.y/l.height,r[n+6]=s.width/l.width,r[n+7]=s.height/l.height;var c=EMPTY_TRANSFORM;if(this.transform){(c=this._fragConstantData).set(this.transform._rawData);for(var h=0;h<4;h++)c[h+4]/=255}var u=t.context;u.setProgramConstantsFromArray(ContextGLProgramType.VERTEX,r),u.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,c)},N8.prototype.deactivate=function(t){},N8),Filter3DBase=(Object.defineProperty(l9.prototype,"requireDepthRender",{get:function(){return this._requireDepthRender},enumerable:!0,configurable:!0}),l9.prototype.addTask=function(t){this._tasks.push(t),null==this._requireDepthRender&&(this._requireDepthRender=t.requireDepthRender)},Object.defineProperty(l9.prototype,"tasks",{get:function(){return this._tasks},enumerable:!0,configurable:!0}),l9.prototype.getMainInputTexture=function(t){return this._tasks[0].getMainInputTexture(t)},Object.defineProperty(l9.prototype,"textureWidth",{get:function(){return this._textureWidth},set:function(t){this._textureWidth=t;for(var e=0;e<this._tasks.length;++e)this._tasks[e].textureWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(l9.prototype,"rttManager",{get:function(){return this._rttManager},set:function(t){this._rttManager=t;for(var e=0;e<this._tasks.length;++e)this._tasks[e].rttManager=t},enumerable:!0,configurable:!0}),Object.defineProperty(l9.prototype,"textureHeight",{get:function(){return this._textureHeight},set:function(t){this._textureHeight=t;for(var e=0;e<this._tasks.length;++e)this._tasks[e].textureHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(l9.prototype,"textureScale",{get:function(){return this._textureScale},set:function(t){this._textureScale=t;for(var e=0;e<this._tasks.length;++e)this._tasks[e].textureScale=t},enumerable:!0,configurable:!0}),l9.prototype.setRenderTargets=function(t,e){this._tasks[this._tasks.length-1].target=t},l9.prototype.dispose=function(){for(var t=0;t<this._tasks.length;++t)this._tasks[t].dispose()},l9.prototype.update=function(t,e){},l9),CopyPixelFilter3D=(B9=Filter3DBase,__extends(C9,B9),Object.defineProperty(C9.prototype,"colorTransform",{get:function(){return this._copyPixelTask.transform},set:function(t){this._copyPixelTask.transform=t},enumerable:!0,configurable:!0}),Object.defineProperty(C9.prototype,"rect",{get:function(){return this._copyPixelTask.rect},set:function(t){this._copyPixelTask.rect=t},enumerable:!0,configurable:!0}),Object.defineProperty(C9.prototype,"destPoint",{get:function(){return this._copyPixelTask.destPoint},set:function(t){this._copyPixelTask.destPoint=t},enumerable:!0,configurable:!0}),Object.defineProperty(C9.prototype,"sourceTexture",{get:function(){return this._copyPixelTask.sourceTexture},set:function(t){this._copyPixelTask.sourceTexture=t},enumerable:!0,configurable:!0}),C9),Filter3DThresholdTask=(I9=Filter3DTaskBase,__extends(J9,I9),Object.defineProperty(J9.prototype,"operation",{get:function(){return this._operation},set:function(t){this._operation!=t&&(this._operation=t,this._op=this._opDecode[t],this._th=this._thDecode[t],this.invalidateProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(J9.prototype,"threshold",{get:function(){return this._threshold},set:function(t){this._threshold!=t&&(this._threshold=t,this._thresholdRGBA.x=(t>>16&255)/255,this._thresholdRGBA.y=(t>>8&255)/255,this._thresholdRGBA.z=(255&t)/255,this._thresholdRGBA.w=(t>>24&255)/255)},enumerable:!0,configurable:!0}),Object.defineProperty(J9.prototype,"color",{get:function(){return this._color},set:function(t){var e;this._color!=t&&(e=((this._color=t)>>24&255)/255,this._colorRGBA.x=e*(t>>16&255)/255,this._colorRGBA.y=e*(t>>8&255)/255,this._colorRGBA.z=e*(255&t)/255,this._colorRGBA.w=e)},enumerable:!0,configurable:!0}),Object.defineProperty(J9.prototype,"mask",{get:function(){return this._mask},set:function(t){this._mask!=t&&(this._mask=t,this._maskRGBA.x=(t>>16&255)/255,this._maskRGBA.y=(t>>8&255)/255,this._maskRGBA.z=(255&t)/255,this._maskRGBA.w=(t>>24&255)/255)},enumerable:!0,configurable:!0}),Object.defineProperty(J9.prototype,"copySource",{get:function(){return this._copySource},set:function(t){this._copySource!=t&&(this._copySource=t,this.invalidateProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(J9.prototype,"sourceTexture",{get:function(){return this._mainInputTexture},set:function(t){this._mainInputTexture=t},enumerable:!0,configurable:!0}),J9.prototype.getVertexCode=function(){var t=this._registerCache.getFreeVertexVectorTemp(),e=this._registerCache.getFreeVertexConstant(),i=this._registerCache.getFreeVertexAttribute();this._positionIndex=i.index;var n=this._registerCache.getFreeVertexConstant(),r=this._registerCache.getFreeVertexAttribute();return this._uvIndex=r.index,this._uvVarying=this._registerCache.getFreeVarying(),"mul "+t+".xy, "+i+", "+e+".zw\nadd "+t+".xy, "+t+", "+e+".xy\nmov "+t+".w, "+i+".w\nmov op, "+t+"\nadd "+this._uvVarying+", "+r+", "+n+".xy\n"},J9.prototype.getFragmentCode=function(){var t=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(t,1);var e=this._registerCache.getFreeTextureReg();this._inputTextureIndex=e.index;var i=this._registerCache.getFreeFragmentConstant();this._fragmentConstantsIndex=i.index;var n,r,o,s=this._registerCache.getFreeFragmentConstant(),a=this._registerCache.getFreeFragmentConstant(),l=this._registerCache.getFreeFragmentConstant();return this._copySource?(r=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(r,1),o=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(o,1),n="tex "+t+", "+this._uvVarying+", "+e+" <2d,linear,clamp>\nmul "+r+", "+t+", "+a+"\ndp4 "+r+", "+r+", "+l+"\n"+this._op+r+", "+(this._th?i:r)+", "+(this._th?r:i)+"\nsub "+o+", "+l+".zzzz, "+r+"\nmul "+r+", "+r+", "+s+"\nmul "+o+", "+o+", "+t+"\nadd "+t+", "+r+", "+o+"\nmov oc, "+t+"\n",this._registerCache.removeFragmentTempUsage(o),this._registerCache.removeFragmentTempUsage(r)):n="tex "+t+", "+this._uvVarying+", "+e+" <2d,linear,clamp>\nmul "+t+", "+t+", "+a+"\ndp4 "+t+", "+t+", "+l+"\n"+this._op+t+", "+(this._th?i:t)+", "+(this._th?t:i)+"\nmul "+t+", "+t+", "+s+"\nmov oc, "+t+"\n",this._registerCache.removeFragmentTempUsage(t),n},J9.prototype.getMainInputTexture=function(t){return this._mainInputTexture},J9.prototype.activate=function(t,e,i){var n=this._positionIndex,r=this._vertexConstantData;r[n]=(2*this.destPoint.x+this.rect.width)/this._target.width-1,r[n+1]=(2*this.destPoint.y+this.rect.height)/this._target.height-1,r[n+2]=this.rect.width/this._target.width,r[n+3]=this.rect.height/this._target.height,r[n+4]=this.rect.x/this._mainInputTexture.width,r[n+5]=this.rect.y/this._mainInputTexture.height;var o=new Vector3D(this._thresholdRGBA.x*this._maskRGBA.x,this._thresholdRGBA.y*this._maskRGBA.y,this._thresholdRGBA.z*this._maskRGBA.z,this._thresholdRGBA.w*this._maskRGBA.w).dotProduct(this._decodeVector),n=this._fragmentConstantsIndex;(r=this._fragmentConstantData)[n]=o,r[n+1]=o,r[n+2]=o,r[n+3]=o,r[n+4]=this._colorRGBA.x,r[n+5]=this._colorRGBA.y,r[n+6]=this._colorRGBA.z,r[n+7]=this._colorRGBA.w,r[n+8]=this._maskRGBA.x,r[n+9]=this._maskRGBA.y,r[n+10]=this._maskRGBA.z,r[n+11]=this._maskRGBA.w;var s=t.context;s.setProgramConstantsFromArray(ContextGLProgramType.VERTEX,this._vertexConstantData),s.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,this._fragmentConstantData)},J9.prototype.deactivate=function(t){},J9),ThresholdFilter3D=(naa=Filter3DBase,__extends(oaa,naa),Object.defineProperty(oaa.prototype,"rect",{get:function(){return this._thresholdTask.rect},set:function(t){this._thresholdTask.rect=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"destPoint",{get:function(){return this._thresholdTask.destPoint},set:function(t){this._thresholdTask.destPoint=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"operation",{get:function(){return this._thresholdTask.operation},set:function(t){this._thresholdTask.operation=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"threshold",{get:function(){return this._thresholdTask.threshold},set:function(t){this._thresholdTask.threshold=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"color",{get:function(){return this._thresholdTask.color},set:function(t){this._thresholdTask.color=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"mask",{get:function(){return this._thresholdTask.mask},set:function(t){this._thresholdTask.mask=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"copySource",{get:function(){return this._thresholdTask.copySource},set:function(t){this._thresholdTask.copySource=t},enumerable:!0,configurable:!0}),Object.defineProperty(oaa.prototype,"sourceTexture",{get:function(){return this._thresholdTask.sourceTexture},set:function(t){this._thresholdTask.sourceTexture=t},enumerable:!0,configurable:!0}),oaa),Stage=(yaa=EventDispatcher,__extends(zaa,yaa),Object.defineProperty(zaa.prototype,"glVersion",{get:function(){return this._context.glVersion},enumerable:!0,configurable:!0}),zaa.prototype.getProgramData=function(t,e){return this._programDataPool.getItem(t,e)},zaa.prototype.setRenderTarget=function(t,e,i,n){var r;void 0===e&&(e=!1),void 0===i&&(i=0),void 0===n&&(n=0),this._renderTarget===t&&i==this._renderSurfaceSelector&&n==this._renderMipmapSelector&&this._enableDepthAndStencil==e||(this._renderTarget=t,this._renderSurfaceSelector=i,this._renderMipmapSelector=n,this._enableDepthAndStencil=e,t?(r=this.getAbstraction(t),this._context.setRenderToTexture(r.getTexture(),e,this._antiAlias,i,n),0!=n&&1!=this._context.glVersion&&(r._invalidMipmaps=!1,r._mipmap=!0)):(this._context.setRenderToBackBuffer(),this.configureBackBuffer(this._width,this._height,this._antiAlias,this._enableDepthAndStencil)))},zaa.prototype.renderFilter=function(t,e){this._filterVertexBuffer||(this._filterVertexBuffer=this._context.createVertexBuffer(4,20)).uploadFromArray(new Float32Array([-1,-1,0,0,0,1,-1,1,0,1,1,1,1,1,2,-1,1,0,1,3]),0,4),this._filterIndexBuffer||(this._filterIndexBuffer=this._context.createIndexBuffer(6)).uploadFromArray(new Uint16Array([2,1,0,3,2,0]),0,6),this._filterSampler||(this._filterSampler=new ImageSampler(!1,!1,!1)),e.setRenderTargets(t,this);var i=this._filterIndexBuffer,n=this._filterVertexBuffer,r=e.tasks,o=r.length;(1<o||r[0].target)&&(this._context.setProgram(r[0].getProgram(this)),this._context.setVertexBufferAt(r[0]._positionIndex,n,0,ContextGLVertexBufferFormat.FLOAT_2),this._context.setVertexBufferAt(r[0]._uvIndex,n,8,ContextGLVertexBufferFormat.FLOAT_2));for(var s=0;s<o;++s){var a=r[s];this.setRenderTarget(a.target,!1),this.setScissor(null),this._context.setProgram(a.getProgram(this)),this._context.setDepthTest(!1,ContextGLCompareMode.LESS_EQUAL),this.getAbstraction(a.getMainInputTexture(this)).activate(a._inputTextureIndex,this._filterSampler),a.target||(n=this._filterVertexBuffer,this._context.setVertexBufferAt(a._positionIndex,n,0,ContextGLVertexBufferFormat.FLOAT_2),this._context.setVertexBufferAt(a._uvIndex,n,8,ContextGLVertexBufferFormat.FLOAT_2)),a.activate(this,null,null),this._context.drawIndices(ContextGLDrawMode.TRIANGLES,i,0,6),a.deactivate(this)}this._context.setDepthTest(!0,ContextGLCompareMode.LESS_EQUAL),this._context.setTextureAt(0,null),this._context.setVertexBufferAt(0,null),this._context.setVertexBufferAt(1,null)},zaa.prototype.copyPixels=function(t,e,i,n,r,o,s){var a;void 0===s&&(s=!1),n.x<-i.width||n.x>e.width||n.y<-i.height||n.y>e.height||(s?(this._copyPixelFilter||(this._copyPixelFilter=new CopyPixelFilter3D),this._copyPixelFilter.sourceTexture=t,this._copyPixelFilter.rect=i,this._copyPixelFilter.destPoint=n,this.renderFilter(e,this._copyPixelFilter)):(i=i.clone(),(n=n.clone()).x<0&&(i.x-=n.x,i.width+=n.x,n.x=0),n.y<0&&(i.y-=n.y,i.height+=n.y,n.y=0),i.width>e.width-n.x&&(i.width=e.width-n.x),i.height>e.height-n.y&&(i.height=e.height-n.y),this.setRenderTarget(t,!1),this.setScissor(null),a=this.getAbstraction(e),this._context.copyToTexture(a.getTexture(),i,n)))},zaa.prototype.threshold=function(t,e,i,n,r,o,s,a,l){n.x<-i.width||n.x>e.width||n.y<-i.height||n.y>e.height||(this._thresholdFilter||(this._thresholdFilter=new ThresholdFilter3D),this._thresholdFilter.sourceTexture=t,this._thresholdFilter.rect=i,this._thresholdFilter.destPoint=n,this._thresholdFilter.operation=r,this._thresholdFilter.threshold=o,this._thresholdFilter.color=s,this._thresholdFilter.mask=a,this._thresholdFilter.copySource=l,this.renderFilter(e,this._thresholdFilter))},zaa.prototype.colorTransform=function(t,e,i,n){this._copyPixelFilter||(this._copyPixelFilter=new CopyPixelFilter3D),this._copyPixelFilter.sourceTexture=t,this._copyPixelFilter.rect=i,this._copyPixelFilter.destPoint=new Point(0,0),this._copyPixelFilter.colorTransform=n,this.renderFilter(e,this._copyPixelFilter),this._copyPixelFilter.colorTransform=null},zaa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new zaa._abstractionClassPool[t.assetType](t,this))},zaa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},zaa.registerAbstraction=function(t,e){zaa._abstractionClassPool[e.assetType]=t},zaa.prototype.requestContext=function(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=ContextGLProfile.BASELINE),void 0===i&&(i=ContextMode.AUTO),void 0===n&&(n=!1),null!=this._usesSoftwareRendering&&(this._usesSoftwareRendering=t),this._profile=e;try{i==ContextMode.SOFTWARE?this._context=new ContextSoftware(this._container):i==ContextMode.GLES?this._context=new ContextGLES(this._container):this._context=new ContextWebGL(this._container,n)}catch(t){this.dispatchEvent(new StageEvent(StageEvent.STAGE_ERROR,this))}this._context&&this._callback(this._context)},Object.defineProperty(zaa.prototype,"width",{get:function(){return this._sizeDirty=!1,this._width},set:function(t){this._width!=t&&(this._container.style.width=t+"px",this._container.width=t*this._context.pixelRatio,this._width=t,this._backBufferDirty=!0,this._invalidateSize())},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"height",{get:function(){return this._sizeDirty=!1,this._height},set:function(t){this._height!=t&&(this._container.style.height=t+"px",this._container.height=t*this._context.pixelRatio,this._height=t,this._backBufferDirty=!0,this._invalidateSize())},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"x",{get:function(){return this._x},set:function(t){this._x!=t&&(CSS.setElementX(this._container,t),this._x=t)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"y",{get:function(){return this._y},set:function(t){this._y!=t&&(CSS.setElementY(this._container,t),this._y=t)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"visible",{get:function(){return CSS.getElementVisibility(this._container)},set:function(t){CSS.setElementVisibility(this._container,t)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"container",{get:function(){return this._container},set:function(t){this._container=t,this._context&&(this._context.container=this._container)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),zaa.prototype._invalidateSize=function(){this._sizeDirty||(this._sizeDirty=!0,this.dispatchEvent(new StageEvent(StageEvent.INVALIDATE_SIZE,this)))},Object.defineProperty(zaa.prototype,"profile",{get:function(){return this._profile},enumerable:!0,configurable:!0}),zaa.prototype.dispose=function(){for(var t in this._abstractionPool)this._abstractionPool[t].clear&&this._abstractionPool[t].clear();this._abstractionPool={},this._stageManager.iRemoveStage(this),this.freeContext(),this._stageManager=null,this._stageIndex=-1},zaa.prototype.configureBackBuffer=function(t,e,i,n){this.width=t,this.height=e,this._antiAlias=i,this._enableDepthAndStencil=n,this._context&&this._context.configureBackBuffer(t,e,i,n)},Object.defineProperty(zaa.prototype,"enableDepthAndStencil",{get:function(){return this._enableDepthAndStencil},set:function(t){this._enableDepthAndStencil!=t&&(this._enableDepthAndStencil=t,this._backBufferDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"renderSurfaceSelector",{get:function(){return this._renderSurfaceSelector},enumerable:!0,configurable:!0}),zaa.prototype.clear=function(t,e,i,n,r,o,s){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=0),void 0===s&&(s=ContextGLClearMask.ALL),this._context&&(this._backBufferDirty&&null==this._renderTarget&&(this._backBufferDirty=!1,this.configureBackBuffer(this._width,this._height,this._antiAlias,this._enableDepthAndStencil)),this._context.clear(t,e,i,n,r,o,s),this._bufferClear=!0)},Object.defineProperty(zaa.prototype,"stageIndex",{get:function(){return this._stageIndex},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"usesSoftwareRendering",{get:function(){return this._usesSoftwareRendering},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"antiAlias",{get:function(){return this._antiAlias},set:function(t){this._antiAlias!=t&&(this._antiAlias=t,this._backBufferDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(zaa.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t},enumerable:!0,configurable:!0}),zaa.prototype.registerProgram=function(t){for(var e=0;null!=this._programData[e];)e++;(this._programData[e]=t).id=e},zaa.prototype.unRegisterProgram=function(t){this._programData[t.id]=null,t.id=-1},zaa.prototype.freeContext=function(){this._context&&(this._context.dispose(),this.dispatchEvent(new StageEvent(StageEvent.CONTEXT_DISPOSED,this))),this._context=null,this._initialised=!1},zaa.prototype.onContextLost=function(t){},zaa.prototype.onContextRestored=function(t){},zaa.prototype.recoverFromDisposal=function(){return!!this._context},zaa.prototype._callback=function(t){this._context=t,this._container=this._context.container,this._width&&this._height&&this._context.configureBackBuffer(this._width,this._height,this._antiAlias,this._enableDepthAndStencil),this.dispatchEvent(new StageEvent(this._initialised?StageEvent.CONTEXT_RECREATED:StageEvent.CONTEXT_CREATED,this)),this._initialised=!0},zaa.prototype.setVertexBuffer=function(t,e,i,n,r,o){void 0===o&&(o=!1),this._context.setVertexBufferAt(t,e,r,this._bufferFormatDictionary[o?i+4:i][n])},zaa.prototype.setScissor=function(t){this._backBufferDirty&&null==this._renderTarget&&(this._backBufferDirty=!1,this.configureBackBuffer(this._width,this._height,this._antiAlias,this._enableDepthAndStencil)),this._context.setScissorRectangle(t)},zaa.prototype.setSamplerAt=function(t,e){var i=e.repeat?ContextGLWrapMode.REPEAT:ContextGLWrapMode.CLAMP,n=e.smooth&&!this.globalDisableSmooth?ContextGLTextureFilter.LINEAR:ContextGLTextureFilter.NEAREST,r=e.mipmap&&!this.globalDisableMipmap?ContextGLMipFilter.MIPLINEAR:ContextGLMipFilter.MIPNONE;this._context.setSamplerStateAt(t,i,n,r)},zaa._abstractionClassPool=new Object,zaa),ImageCube=(jca=ImageBase,__extends(kca,jca),Object.defineProperty(kca.prototype,"assetType",{get:function(){return kca.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(kca.prototype,"size",{get:function(){return this._size},set:function(t){this._size!=t&&this._setSize(this._size)},enumerable:!0,configurable:!0}),kca.prototype._setSize=function(t){this._size!=t&&this.clear(),this._size=t,this._testDimensions()},kca.prototype._testDimensions=function(){if(!ImageUtils.isDimensionValid(this._size))throw new Error("Invalid dimension: Width and height must be power of 2 and cannot exceed 2048")},kca.assetType="[image ImageCube]",kca),_Stage_ImageCube=(pca=_Stage_ImageBase,__extends(qca,pca),qca.prototype.getType=function(){return"cube"},qca.prototype._createTexture=function(){this._texture=this._stage.context.createCubeTexture(this._asset.size,ContextGLTextureFormat.BGRA,!1)},qca),pca,jca,yaa,naa,I9,B9,M8,p4,A3,jO,ZL,DL,mL,ZK,LK,FK,qK,nK,iK,dK,$J;function qca(){return null!==pca&&pca.apply(this,arguments)||this}function kca(t){var e=jca.call(this)||this;return e._size=t,e._testDimensions(),e}function zaa(t,e,i,n,r){void 0===r&&(r=ContextGLProfile.BASELINE);var o=yaa.call(this)||this;return o._abstractionPool=new Object,o._programData=new Array,o._x=0,o._y=0,o._stageIndex=-1,o._antiAlias=4,o._renderTarget=null,o._renderSurfaceSelector=0,o._renderMipmapSelector=0,o._initialised=!1,o._bufferFormatDictionary=new Array(5),o.globalDisableMipmap=!1,o.globalDisableSmooth=!1,o.numUsedStreams=0,o.numUsedTextures=0,o._programDataPool=new ProgramDataPool(o),o._container=t,o._container&&(o._container.addEventListener("webglcontextlost",function(t){return o.onContextLost(t)}),o._container.addEventListener("webglcontextrestored",function(t){return o.onContextRestored(t)})),o._stageIndex=e,o._stageManager=i,o._enableDepthAndStencil=!0,CSS.setElementX(o._container,0),CSS.setElementY(o._container,0),o._bufferFormatDictionary[1]=new Array(5),o._bufferFormatDictionary[1][1]=ContextGLVertexBufferFormat.BYTE_1,o._bufferFormatDictionary[1][2]=ContextGLVertexBufferFormat.BYTE_2,o._bufferFormatDictionary[1][3]=ContextGLVertexBufferFormat.BYTE_3,o._bufferFormatDictionary[1][4]=ContextGLVertexBufferFormat.BYTE_4,o._bufferFormatDictionary[2]=new Array(5),o._bufferFormatDictionary[2][1]=ContextGLVertexBufferFormat.SHORT_1,o._bufferFormatDictionary[2][2]=ContextGLVertexBufferFormat.SHORT_2,o._bufferFormatDictionary[2][3]=ContextGLVertexBufferFormat.SHORT_3,o._bufferFormatDictionary[2][4]=ContextGLVertexBufferFormat.SHORT_4,o._bufferFormatDictionary[4]=new Array(5),o._bufferFormatDictionary[4][1]=ContextGLVertexBufferFormat.FLOAT_1,o._bufferFormatDictionary[4][2]=ContextGLVertexBufferFormat.FLOAT_2,o._bufferFormatDictionary[4][3]=ContextGLVertexBufferFormat.FLOAT_3,o._bufferFormatDictionary[4][4]=ContextGLVertexBufferFormat.FLOAT_4,o._bufferFormatDictionary[5]=new Array(5),o._bufferFormatDictionary[5][1]=ContextGLVertexBufferFormat.UNSIGNED_BYTE_1,o._bufferFormatDictionary[5][2]=ContextGLVertexBufferFormat.UNSIGNED_BYTE_2,o._bufferFormatDictionary[5][3]=ContextGLVertexBufferFormat.UNSIGNED_BYTE_3,o._bufferFormatDictionary[5][4]=ContextGLVertexBufferFormat.UNSIGNED_BYTE_4,o._bufferFormatDictionary[6]=new Array(5),o._bufferFormatDictionary[6][1]=ContextGLVertexBufferFormat.UNSIGNED_SHORT_1,o._bufferFormatDictionary[6][2]=ContextGLVertexBufferFormat.UNSIGNED_SHORT_2,o._bufferFormatDictionary[6][3]=ContextGLVertexBufferFormat.UNSIGNED_SHORT_3,o._bufferFormatDictionary[6][4]=ContextGLVertexBufferFormat.UNSIGNED_SHORT_4,o.visible=!0,o}function oaa(){var t=naa.call(this)||this;return t._thresholdTask=new Filter3DThresholdTask,t.addTask(t._thresholdTask),t}function J9(){var t=I9.call(this)||this;return t._opDecode={"<":"slt ","<=":"sge ",">":"slt ",">=":"sge ","==":"seq ","!=":"sne "},t._thDecode={"<":!1,"<=":!0,">":!0,">=":!1,"==":!1,"!=":!1},t._operation="<",t._threshold=0,t._thresholdRGBA=new Vector3D,t._color=0,t._colorRGBA=new Vector3D,t._mask=0,t._maskRGBA=new Vector3D,t._copySource=!1,t._decodeVector=new Vector3D(65025,255,1,16581375),t.rect=new Rectangle,t.destPoint=new Point,t._vertexConstantData=new Float32Array([0,0,0,0,0,0,0,0]),t._fragmentConstantData=new Float32Array([0,0,0,0,0,0,0,0,0,0,0,0,65025,255,1,16581375]),t}function C9(){var t=B9.call(this)||this;return t._copyPixelTask=new Filter3DCopyPixelTask,t.addTask(t._copyPixelTask),t}function l9(){this._textureScale=1,this._tasks=new Array}function N8(){var t=M8.call(this)||this;return t.rect=new Rectangle,t.destPoint=new Point,t._vertexConstantData=new Float32Array([0,0,0,0,0,0,0,0]),t._fragConstantData=EMPTY_TRANSFORM.slice(),t}function t8(t){void 0===t&&(t=!1),this._scaledTextureWidth=-1,this._scaledTextureHeight=-1,this._textureWidth=-1,this._textureHeight=-1,this._textureDimensionsInvalid=!0,this._program3DInvalid=!0,this._textureScale=1,this._requireDepthRender=t,this._registerCache=new ShaderRegisterCache(ContextGLProfile.BASELINE)}function l8(t){this._numUsedVertexConstants=0,this._numUsedFragmentConstants=0,this._numUsedStreams=0,this._numUsedTextures=0,this._numUsedVaryings=0,this._profile=t,this.reset()}function M7(t,e,i){void 0===i&&(i=!0),this._regName=t,this._regCount=e,this._persistent=i,this.initRegisters(t,e)}function I7(t,e,i){void 0===i&&(i=-1),this._component=i,this._regName=t,this._index=e,this._toStr=this._regName,0<=this._index&&(this._toStr+=this._index),-1<i&&(this._toStr+="."+I7.COMPONENTS[i])}function V4(t,e){void 0===e&&(e=!1),this._blendFactorDictionary=new Object,this._drawModeDictionary=new Object,this._compareModeDictionary=new Object,this._stencilActionDictionary=new Object,this._textureIndexDictionary=new Array(8),this._textureTypeDictionary=new Object,this._wrapDictionary=new Object,this._filterDictionary=new Object,this._mipmapFilterDictionary=new Object,this._vertexBufferPropertiesDictionary=[],this._drawing=!0,this._samplerStates=new Array(8),this._stencilReferenceValue=0,this._stencilReadMask=255,this._separateStencil=!1,this._renderTargetConfig=void 0,this._container=t,this.initWebGL(e)}function L4(t,e,i){this._gl=t,this._buffer=this._gl.createBuffer(),this._numVertices=e,this._dataPerVertex=i}function q4(t,e,i){var n=p4.call(this,t)||this;return n.textureType="texture2d",n._frameBuffer=[],n._frameBufferDraw=[],n._renderBuffer=[],n._renderBufferDepth=[],n._mipmapSelector=0,n._multisampled=!1,n._width=e,n._height=i,n._glTexture=n._gl.createTexture(),n}function W3(t){this._id=W3.ProgramID++,this._uniforms=[{},{},{}],this._nameToIndex={},this._attribs=[],this._gl=t,this._program=this._gl.createProgram()}function N3(t,e){this._gl=t,this._buffer=this._gl.createBuffer(),this._numIndices=e}function B3(t,e){var i=A3.call(this,t)||this;i._textureSelectorDictionary=new Array(6),i.textureType="textureCube";var n=i._gl;return i._size=e,i._glTexture=i._gl.createTexture(),i._textureSelectorDictionary[0]=n.TEXTURE_CUBE_MAP_POSITIVE_X,i._textureSelectorDictionary[1]=n.TEXTURE_CUBE_MAP_NEGATIVE_X,i._textureSelectorDictionary[2]=n.TEXTURE_CUBE_MAP_POSITIVE_Y,i._textureSelectorDictionary[3]=n.TEXTURE_CUBE_MAP_NEGATIVE_Y,i._textureSelectorDictionary[4]=n.TEXTURE_CUBE_MAP_POSITIVE_Z,i._textureSelectorDictionary[5]=n.TEXTURE_CUBE_MAP_NEGATIVE_Z,i}function y3(t){this.textureType="",this._context=t,this._gl=t._gl,this._id=y3.TEXTURE_ID++}function r0(t){this._backBufferRect=new Rectangle,this._cullingMode=ContextGLTriangleFace.BACK,this._blendSource=ContextGLBlendFactor.ONE,this._blendDestination=ContextGLBlendFactor.ZERO,this._colorMaskR=!0,this._colorMaskG=!0,this._colorMaskB=!0,this._colorMaskA=!0,this._writeDepth=!0,this._depthCompareMode=ContextGLCompareMode.LESS,this._depthCompareModeSoftware=function(t,e){},this._blendModeSoftware=function(t,e,i){},this._screenMatrix=new Matrix3D,this._frontBufferMatrix=new Matrix,this._bboxMin=new Point,this._bboxMax=new Point,this._clamp=new Point,this._samplerStates=[],this._textures=[],this.textureBuffersColor=[],this.textureBuffersZ=[],this.textureBuffersZClear=[],this._vertexBuffers=[],this._vertexBufferOffsets=[],this._vertexBufferFormats=[],this._rgba=new Uint8ClampedArray(4),this._source=new Uint8ClampedArray(4),this._dest=new Uint8ClampedArray(4),this._destComp=new Uint8ClampedArray(4),this._sourceComp=new Uint8ClampedArray(4),this._antialias=0,this._p0=new Vector3D,this._p1=new Vector3D,this._p2=new Vector3D,this._project=new Vector3D,this._barycentric=new Vector3D,this._barycentricRight=new Vector3D,this._barycentricBottom=new Vector3D,this._canvas=t,this._backBufferColor=new BitmapImage2D(100,100,!1,0,!1),this._frontBuffer=new BitmapImage2D(100,100,!1,0,!1),this._activeBufferColor=this._backBufferColor;var e=new ArrayBuffer(8e4);this._backBufferZ=new Float32Array(e,0,1e4),this._backBufferZClear=new Float32Array(e,4e4,1e4);for(var i=0;i<1e4;i++)this._backBufferZClear[i]=1e7;this._activeBufferZ=this._backBufferZ,document&&document.body&&(this._frontCanvas=document.createElement("canvas"),this._frontBufferContext=this._frontCanvas.getContext("2d"),this._frontBufferImageData=this._frontBufferContext.getImageData(0,0,100,100),this._frontCanvas.style.position="absolute",document.body.appendChild(this._frontCanvas)),this._depthCompareModeSoftware[ContextGLCompareMode.ALWAYS]=DepthCompareModeSoftware.always,this._depthCompareModeSoftware[ContextGLCompareMode.EQUAL]=DepthCompareModeSoftware.equal,this._depthCompareModeSoftware[ContextGLCompareMode.GREATER]=DepthCompareModeSoftware.greaterEqual,this._depthCompareModeSoftware[ContextGLCompareMode.GREATER_EQUAL]=DepthCompareModeSoftware.greater,this._depthCompareModeSoftware[ContextGLCompareMode.LESS]=DepthCompareModeSoftware.less,this._depthCompareModeSoftware[ContextGLCompareMode.LESS_EQUAL]=DepthCompareModeSoftware.lessEqual,this._depthCompareModeSoftware[ContextGLCompareMode.NEVER]=DepthCompareModeSoftware.never,this._depthCompareModeSoftware[ContextGLCompareMode.NOT_EQUAL]=DepthCompareModeSoftware.notEqual,this._blendModeSoftware[ContextGLBlendFactor.DESTINATION_ALPHA]=BlendModeSoftware.destinationAlpha,this._blendModeSoftware[ContextGLBlendFactor.DESTINATION_COLOR]=BlendModeSoftware.destinationColor,this._blendModeSoftware[ContextGLBlendFactor.ONE]=BlendModeSoftware.one,this._blendModeSoftware[ContextGLBlendFactor.ONE_MINUS_DESTINATION_ALPHA]=BlendModeSoftware.oneMinusDestinationAlpha,this._blendModeSoftware[ContextGLBlendFactor.ONE_MINUS_DESTINATION_COLOR]=BlendModeSoftware.oneMinusDestinationColor,this._blendModeSoftware[ContextGLBlendFactor.ONE_MINUS_SOURCE_ALPHA]=BlendModeSoftware.oneMinusSourceAlpha,this._blendModeSoftware[ContextGLBlendFactor.ONE_MINUS_SOURCE_COLOR]=BlendModeSoftware.oneMinusSourceColor,this._blendModeSoftware[ContextGLBlendFactor.SOURCE_ALPHA]=BlendModeSoftware.sourceAlpha,this._blendModeSoftware[ContextGLBlendFactor.SOURCE_COLOR]=BlendModeSoftware.sourceColor,this._blendModeSoftware[ContextGLBlendFactor.ZERO]=BlendModeSoftware.zero}function a0(){}function n_(){}function wP(){this._numVarying=0}function kP(t){this._textureSelectorDictionary=[[],[],[],[],[],[]],this._size=t}function _O(t,e){this._mipLevels=[],this._width=t,this._height=e}function SO(t,e){this._numVertices=t,this._dataPerVertex=e}function KO(t){this._numIndices=t}function zO(t){this._pool={},this._disposedPool={},this.keepAlive=1e3,this._stage=t}function uO(t,e,i,n){this.usages=0,this.disposedAt=-1,this.disposed=!1,this._pool=t,this.stage=e,this.vertexString=i,this.fragmentString=n,this.stage.registerProgram(this)}function kO(t,e,i){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1);var n=jO.call(this)||this;return n._repeat=t,n._smooth=e,n._mipmap=i,n}function nM(t){this._blendFactorDictionary=new Object,this._drawModeDictionary=new Object,this._compareModeDictionary=new Object,this.stencilTriangleFace=new Object,this._stencilActionDictionary=new Object,this._textureIndexDictionary=new Array(8),this._textureTypeDictionary=new Object,this._wrapDictionary=new Object,this._filterDictionary=new Object,this._mipmapFilterDictionary=new Object,this._vertexBufferPropertiesDictionary=[],this._samplerStates=new Array(8),this._stencilReferenceValue=0,this._stencilReadMask=255,this._separateStencil=!1,this._textureCnt=0,this._programCnt=0,this._cubeTextureCnt=0,this._indexBufferCnt=0,this._vertexBufferCnt=0,this._container=t,this._cmdBytes=new Byte32Array,this._createBytes=new Byte32Array,nM._soundBytes=new Byte32Array,nM._soundBytes.writeUnsignedInt(100),this._cmdBytes.writeUnsignedInt(0),this._createBytes.writeUnsignedInt(1),this._blendFactorDictionary[ContextGLBlendFactor.ONE]=0,this._blendFactorDictionary[ContextGLBlendFactor.DESTINATION_ALPHA]=1,this._blendFactorDictionary[ContextGLBlendFactor.DESTINATION_COLOR]=2,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_DESTINATION_ALPHA]=3,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_DESTINATION_COLOR]=4,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_SOURCE_ALPHA]=5,this._blendFactorDictionary[ContextGLBlendFactor.ONE_MINUS_SOURCE_COLOR]=6,this._blendFactorDictionary[ContextGLBlendFactor.SOURCE_ALPHA]=7,this._blendFactorDictionary[ContextGLBlendFactor.SOURCE_COLOR]=8,this._blendFactorDictionary[ContextGLBlendFactor.ZERO]=9,this._drawModeDictionary[ContextGLDrawMode.LINES]=0,this._drawModeDictionary[ContextGLDrawMode.TRIANGLES]=1,this._compareModeDictionary[ContextGLCompareMode.ALWAYS]=0,this._compareModeDictionary[ContextGLCompareMode.EQUAL]=1,this._compareModeDictionary[ContextGLCompareMode.GREATER]=2,this._compareModeDictionary[ContextGLCompareMode.GREATER_EQUAL]=3,this._compareModeDictionary[ContextGLCompareMode.LESS]=4,this._compareModeDictionary[ContextGLCompareMode.LESS_EQUAL]=5,this._compareModeDictionary[ContextGLCompareMode.NEVER]=6,this._compareModeDictionary[ContextGLCompareMode.NOT_EQUAL]=7,this.stencilTriangleFace[ContextGLTriangleFace.BACK]=2,this.stencilTriangleFace[ContextGLTriangleFace.FRONT]=1,this.stencilTriangleFace[ContextGLTriangleFace.FRONT_AND_BACK]=0,this._stencilActionDictionary[ContextGLStencilAction.DECREMENT_SATURATE]=0,this._stencilActionDictionary[ContextGLStencilAction.DECREMENT_WRAP]=1,this._stencilActionDictionary[ContextGLStencilAction.INCREMENT_SATURATE]=2,this._stencilActionDictionary[ContextGLStencilAction.INCREMENT_WRAP]=3,this._stencilActionDictionary[ContextGLStencilAction.INVERT]=4,this._stencilActionDictionary[ContextGLStencilAction.KEEP]=5,this._stencilActionDictionary[ContextGLStencilAction.SET]=6,this._stencilActionDictionary[ContextGLStencilAction.ZERO]=7,this._textureTypeDictionary.texture2d=0,this._textureTypeDictionary.textureCube=1,this._wrapDictionary[ContextGLWrapMode.REPEAT]=0,this._wrapDictionary[ContextGLWrapMode.CLAMP]=1,this._filterDictionary[ContextGLTextureFilter.LINEAR]=0,this._filterDictionary[ContextGLTextureFilter.NEAREST]=1,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR]=new Object,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPNEAREST]=2,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPLINEAR]=3,this._mipmapFilterDictionary[ContextGLTextureFilter.LINEAR][ContextGLMipFilter.MIPNONE]=0,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST]=new Object,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPNEAREST]=4,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPLINEAR]=5,this._mipmapFilterDictionary[ContextGLTextureFilter.NEAREST][ContextGLMipFilter.MIPNONE]=1}function $L(t,e,i,n,r){var o=ZL.call(this,t,r)||this;return o._numVertices=i,o._dataPerVertex=n,o}function EL(t,e,i,n,r){var o=DL.call(this,t,e,r)||this;return o.textureType="texture2d",o._width=i,o._height=n,o}function nL(t,e,i){var n=mL.call(this,t,i)||this;return n._uniforms=[[],[],[]],n._attribs=[],n}function kL(){}function $K(t,e,i,n){var r=ZK.call(this,t,n)||this;return r._gl=e,r._numIndices=i,r}function MK(t,e,i,n){var r=LK.call(this,t,e,n)||this;return r._textureSelectorDictionary=new Array(6),r.textureType="textureCube",r._size=i,r}function GK(t,e,i){var n=FK.call(this,t,i)||this;return n.textureType="",n}function CK(t,e){this._context=t,this._id=e}function BK(){}function rK(t,e){var i=qK.call(this,t,e)||this;return i.usages=0,i._invalidMipmaps=!0,i._invalidMapper=!0,i._stage=e,i._onInvalidateMipmapsDelegate=function(t){return i._onInvalidateMipmaps(t)},i._asset.addEventListener(ImageEvent.INVALIDATE_MIPMAPS,i._onInvalidateMipmapsDelegate),i}function oK(){var t=nK.call(this)||this;return t._pFormat="bgra",t}function jK(t,e){var i=iK.call(this,t)||this;return i._rttManager=e,i}function eK(t,e){var i=dK.call(this,t)||this;return i._stage=e,i}function _J(t,e){var i=$J.call(this,t)||this;return i._image=e,i}Stage.registerAbstraction(_Stage_ImageCube,ImageCube);var BitmapImageUtils=(rca.drawBitmap=function(t,e,i,n,r,o,s,a,l,c,h){if(void 0===h&&(h=null),h||l!=n||c!=r){h||(h=new Matrix).scale(l/n,c/r);var u=Math.sqrt(h.a*h.a+h.b*h.b),p=Math.sqrt(h.c*h.c+h.d*h.d),d=n*u,_=r*p;if(h.tx+=s,h.ty+=a,s=Math.floor(h.tx),a=Math.floor(h.ty),h.invert(),1<=u||1<=p)for(var f=new Point,m=s;m<s+d;m++)for(var g=a;g<a+_;g++){f.x=m,f.y=g,f=h.transformPoint(f);var y=rca.sampleBilinear(f.x,f.y,t,n,r);rca.applyPixel32(o,l,c,m,g,y)}else for(var b=new Point,v=new Point,m=s;m<s+d;m++)for(g=a;g<a+_;g++)b.x=m,b.y=g,b=h.transformPoint(b),v.x=m+1,v.y=g+1,v=h.transformPoint(v),y=rca.sampleBox(b.x+e,b.y+i,v.x+e,v.y+i,t,n,r),rca.applyPixel32(o,l,c,m,g,y);h.invert()}else for(m=s;m<s+d;m++)for(g=a;g<a+_;g++)y=rca.sample(m-s+e,g-a+i,t,n,r),rca.applyPixel32(o,l,c,m,g,y)},rca.applyPixel32=function(t,e,i,n,r,o){var s;n=Math.floor(n),r=Math.floor(r),n<0||e<=n||i<=r||r<0||(t[s=4*(n+r*e)]=o[0],t[1+s]=o[1],t[2+s]=o[2],t[3+s]=o[3],t[s]=255&t[s],t[1+s]=255&t[1+s],t[2+s]=255&t[2+s],t[3+s]=255&t[3+s])},rca.sampleBilinear=function(t,e,i,n,r,o,s){void 0===o&&(o=1),void 0===s&&(s=1);var a=rca.sample(t,e,i,n,r),l=rca.sample(t+o,e,i,n,r),c=rca.sample(t,e+s,i,n,r),h=rca.sample(t+o,e+s,i,n,r),u=t;u-=Math.floor(u);var p=rca.interpolateColor(a,l,u),d=rca.interpolateColor(c,h,u),_=e;return _-=Math.floor(_),rca.interpolateColor(p,d,_)},rca.sample=function(t,e,i,n,r){t=Math.floor(t),e=Math.floor(e);var o=[0,0,0,0];if(t<0||n<=t||e<0||r<=e)return o;var s=4*(t+e*n);return o[0]=i[s],o[1]=i[1+s],o[2]=i[2+s],o[3]=i[3+s],o},rca.sampleBox=function(t,e,i,n,r,o,s){for(var a,l,c=0,h=[0,0,0,0],u=Math.floor(e),p=Math.ceil(n),u=Math.max(Math.min(u,s-1),0),p=Math.max(Math.min(p,s-1),0),d=u;d<p;d++){l=1,d<e&&(l*=1-(e-d)),n<d&&(l*=1-(d-n));for(var _=Math.floor(t),f=Math.ceil(i),_=Math.max(Math.min(_,o-1),0),f=Math.max(Math.min(f,o-1),0),m=_;m<f;m++){a=l;var g=rca.sample(m,d,r,o,s);m<t&&(a*=1-(t-m)),i<m&&(a*=1-(m-i)),h[0]+=g[0]*a,h[1]+=g[1]*a,h[2]+=g[2]*a,h[3]+=g[3]*a,c+=a}}return h[0]/=c,h[1]/=c,h[2]/=c,h[3]/=c,h[0]=255&h[0],h[1]=255&h[1],h[2]=255&h[2],h[3]=255&h[3],h},rca.interpolateColor=function(t,e,i){var n=[];return n[0]=t[0]+(e[0]-t[0])*i,n[1]=t[1]+(e[1]-t[1])*i,n[2]=t[2]+(e[2]-t[2])*i,n[3]=t[3]+(e[3]-t[3])*i,n},rca),BitmapImageCube=(Kda=ImageCube,__extends(Lda,Kda),Object.defineProperty(Lda.prototype,"assetType",{get:function(){return Lda.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Lda.prototype,"transparent",{get:function(){return this._transparent},set:function(t){this._transparent=t},enumerable:!0,configurable:!0}),Lda.prototype.clone=function(){for(var t=new Lda(this._size,this.transparent),e=0;e<6;e++)t.setPixels(e,new Rectangle(0,0,this._size,this._size),this.data[e]);return t},Lda.prototype.colorTransform=function(t,e,i){for(var n,r,o=this.data[t],s=0;s<e.width;++s)for(n=0;n<e.height;++n)o[r=4*(s+e.x+(n+e.y)*this._size)]=o[r]*i.redMultiplier+i.redOffset,o[1+r]=o[1+r]*i.greenMultiplier+i.greenOffset,o[2+r]=o[2+r]*i.blueMultiplier+i.blueOffset,o[3+r]=o[3+r]*i.alphaMultiplier+i.alphaOffset;this._locked||this.invalidate()},Lda.prototype.copyChannel=function(t,e,i,n,r,o){for(var s,a,l=e.data,c=this._data[t],h=Math.round(Math.log(r)/Math.log(2)),u=Math.round(Math.log(o)/Math.log(2)),p=Math.round(i.x),d=Math.round(i.y),_=Math.round(n.x),f=Math.round(n.y),m=0;m<i.width;++m)for(s=0;s<i.height;++s)a=4*(m+p+(s+d)*e.width),c[4*(m+_+(s+f)*this._size)+u]=l[a+h];this._locked||this.invalidate()},Lda.prototype.dispose=function(){Kda.prototype.dispose.call(this);for(var t=0;t<6;t++)this._data[t]=null;this._transparent=null,this._locked=null},Lda.prototype.drawBitmap=function(t,e,i,n,r,o,s){void 0===s&&(s=null),BitmapImageUtils.drawBitmap(e,i,n,r,o,this.data[t],0,0,this._size,this._size,s),this._locked||this.invalidate()},Lda.prototype.fillRect=function(t,e,i){var n,r,o=new Uint32Array(this._data[t].buffer),s=~~e.x,a=~~e.y,l=~~e.width,c=~~e.height,h=this._transparent?4294967295&i:4278190080+(16777215&i);if(0==s&&0==a&&l==this._size&&c==this._size)o.fill(h);else for(n=0;n<c;++n)r=s+(n+a)*this._size,o.fill(h,r,r+l);this._locked||this.invalidate()},Lda.prototype.getPixel=function(t,e,i){var n,r=4*(~~e+~~i*this._size),o=this.data[t],s=o[0+r],a=o[1+r],l=o[2+r];return(n=o[3+r])?255*s/n<<16|255*a/n<<8|255*l/n:0},Lda.prototype.getPixel32=function(t,e,i){var n,r=4*(~~e+~~i*this._size),o=this.data[t],s=o[r++],a=o[r++],l=o[r++];return(n=o[r])?n<<24|255*s/n<<16|255*a/n<<8|255*l/n:0},Lda.prototype.lock=function(){this._locked||(this._locked=!0)},Lda.prototype.setArray=function(t,e,i){for(var n,r,o,s=this.data[t],a=0;a<e.width;++a)for(n=0;n<e.height;++n)o=ColorUtils.float32ColorToARGB(i[a+n*e.width]),s[0+(r=4*(a+e.x+(n+e.y)*this._size))]=o[1],s[1+r]=o[2],s[2+r]=o[3],s[3+r]=this._transparent?o[0]:255;this._locked||this.invalidate()},Lda.prototype.setPixel=function(t,e,i,n){var r=4*(~~e+~~i*this._size),o=ColorUtils.float32ColorToARGB(n),s=this.data[t];s[0+r]=o[1],s[1+r]=o[2],s[2+r]=o[3],s[3+r]=255,this._locked||this.invalidate()},Lda.prototype.setPixel32=function(t,e,i,n){var r=4*(~~e+~~i*this._size),o=ColorUtils.float32ColorToARGB(n),s=this.data[t];s[0+r]=o[1],s[1+r]=o[2],s[2+r]=o[3],s[3+r]=this._transparent?o[0]:255,this._locked||this.invalidate()},Lda.prototype.setPixels=function(t,e,i){if(0==e.x&&0==e.y&&e.width==this._size&&e.height==this._size)this._data[t].set(i);else for(var n=this._size,r=e.width,o=this._data[t],s=0;s<e.height;++s)o.set(i.subarray(s*r*4,(s+1)*r*4),4*(e.x+(s+e.y)*n));this._locked||this.invalidate()},Lda.prototype.unlock=function(){this._locked&&(this._locked=!1,this.invalidate())},Object.defineProperty(Lda.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),Lda.prototype._setSize=function(t){for(var e=0;e<6;e++){var i=this.data[e];this._data[e]=new Uint8ClampedArray(4*t*t);for(var n=this._size<t?this._size:t;0<n;++e)this._data[e].set(i.subarray(0*n*4,4*n),0*t*4)}Kda.prototype._setSize.call(this,t)},Lda.assetType="[image BitmapImageCube]",Lda.posX=0,Lda.negX=1,Lda.posY=2,Lda.negY=3,Lda.posZ=4,Lda.negZ=5,Lda),_Stage_BitmapImageCube=(Gfa=_Stage_ImageCube,__extends(Hfa,Gfa),Hfa.prototype.getTexture=function(){if(Gfa.prototype.getTexture.call(this),this._invalid){this._invalid=!1;for(var t=0;t<6;++t)this._texture.uploadFromArray(new Uint8Array(this._asset.data[t].buffer),t,0,this._asset.transparent);this._invalidMipmaps=!0}return this._texture},Hfa),Gfa,Kda;function Hfa(){return null!==Gfa&&Gfa.apply(this,arguments)||this}function Lda(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=null);var n=Kda.call(this,t)||this;n._data=new Array(6),n._locked=!1,n._transparent=e;for(var r=0;r<6;r++)n._data[r]=new Uint8ClampedArray(4*n._size*n._size),null!=i&&n.fillRect(r,new Rectangle(0,0,t,t),i);return n}function rca(){}Stage.registerAbstraction(_Stage_BitmapImageCube,BitmapImageCube);var DefaultGraphicsFactory=(Jfa.prototype.createImage2D=function(t,e,i,n,r){return void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=!0),new BitmapImage2D(t,e,i,n,r)},Jfa),ImageUtils=(Pfa.imageToBitmapImage2D=function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=null);var n=(i=i||new DefaultGraphicsFactory).createImage2D(t.naturalWidth,t.naturalHeight,!0,null,e),r=document.createElement("canvas");r.width=t.naturalWidth,r.height=t.naturalHeight;var o=r.getContext("2d");return o.drawImage(t,0,0),n.setPixels(n.rect,o.getImageData(0,0,t.naturalWidth,t.naturalHeight).data),n},Pfa.isImage2DValid=function(t){return null==t||this.isDimensionValid(t.width,t.powerOfTwo)&&this.isDimensionValid(t.height,t.powerOfTwo)},Pfa.isHTMLImageElementValid=function(t){return null==t||this.isDimensionValid(t.width)&&this.isDimensionValid(t.height)},Pfa.isDimensionValid=function(t,e){return void 0===e&&(e=!0),1<=t&&t<=this.MAX_SIZE&&(!e||this.isPowerOfTwo(t))},Pfa.isPowerOfTwo=function(t){return!!t&&(t&-t)==t},Pfa.getBestPowerOf2=function(t){for(var e=1;e<t;)e<<=1;return e>this.MAX_SIZE&&(e=this.MAX_SIZE),e},Pfa.getDefaultImage2D=function(){return this._defaultBitmapImage2D||this.createDefaultImage2D(),this._defaultBitmapImage2D},Pfa.getDefaultImageCube=function(){return this._defaultBitmapImageCube||this.createDefaultImageCube(),this._defaultBitmapImageCube},Pfa.getDefaultSampler=function(){return this._defaultSampler||this.createDefaultSampler(),this._defaultSampler},Pfa.createDefaultImageCube=function(){this._defaultBitmapImage2D||this.createDefaultImage2D();for(var t=new BitmapImageCube(this._defaultBitmapImage2D.width),e=0;e<6;e++)t.drawBitmap(e,this._defaultBitmapImage2D.data,0,0,this._defaultBitmapImage2D.width,this._defaultBitmapImage2D.height);this._defaultBitmapImageCube=t},Pfa.createDefaultImage2D=function(){for(var t,e=new BitmapImage2D(8,8,!1,0),i=0;i<8;i++)for(t=0;t<8;t++)1&t^1&i&&e.setPixel(i,t,16777215);this._defaultBitmapImage2D=e},Pfa.createDefaultSampler=function(){this._defaultSampler=new ImageSampler},Pfa.MAX_SIZE=8192,Pfa),Image2D=(gga=ImageBase,__extends(hga,gga),Object.defineProperty(hga.prototype,"assetType",{get:function(){return hga.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(hga.prototype,"height",{get:function(){return this._rect.height},set:function(t){this._setSize(this._rect.width,t)},enumerable:!0,configurable:!0}),Object.defineProperty(hga.prototype,"alphaChannel",{get:function(){return this._alphaChannel},set:function(t){this._alphaChannel=t},enumerable:!0,configurable:!0}),Object.defineProperty(hga.prototype,"rect",{get:function(){return this._rect},enumerable:!0,configurable:!0}),Object.defineProperty(hga.prototype,"width",{get:function(){return this._rect.width},set:function(t){this._setSize(t,this._rect.height)},enumerable:!0,configurable:!0}),hga.prototype._setSize=function(t,e){t=Math.round(t),e=Math.round(e),this._rect.width==t&&this._rect.height==e||(this.clear(),this._rect.width=t,this._rect.height=e,this._testDimensions())},hga.prototype._testDimensions=function(){if(this._powerOfTwo&&(!ImageUtils.isDimensionValid(this._rect.width)||!ImageUtils.isDimensionValid(this._rect.height)))throw new Error("Invalid dimension: Width and height must be power of 2 and cannot exceed 2048")},Object.defineProperty(hga.prototype,"powerOfTwo",{get:function(){return this._powerOfTwo},set:function(t){this._powerOfTwo!=t&&(this._powerOfTwo=t,this._testDimensions())},enumerable:!0,configurable:!0}),hga.assetType="[image Image2D]",hga),_Stage_Image2D=(sga=_Stage_ImageBase,__extends(tga,sga),tga.prototype.getType=function(){return"2d"},tga.prototype._createTexture=function(){this._texture=this._stage.context.createTexture(this._asset.width,this._asset.height,ContextGLTextureFormat.BGRA,!0)},tga),sga,gga;function tga(){return null!==sga&&sga.apply(this,arguments)||this}function hga(t,e,i){void 0===i&&(i=!0);var n=gga.call(this)||this;return n._powerOfTwo=!0,n._rect=new Rectangle(0,0,Math.round(t),Math.round(e)),n._powerOfTwo=i,n._testDimensions(),n}function Pfa(){}function Jfa(){}function fastARGB_to_ABGR(t,e){return void 0===e&&(e=!0),((e?4278190080&t:4278190080)|(255&t)<<16|65280&t|(16711680&t)>>16&255)>>>0}Stage.registerAbstraction(_Stage_Image2D,Image2D);var BitmapImage2D=(wga=Image2D,__extends(xga,wga),xga.prototype.addMipLevel=function(t){this._customMipLevels||(this._customMipLevels=[]),this._customMipLevels.push(t)},Object.defineProperty(xga.prototype,"mipLevels",{get:function(){return this._customMipLevels},enumerable:!0,configurable:!0}),Object.defineProperty(xga.prototype,"assetType",{get:function(){return xga.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(xga.prototype,"transparent",{get:function(){return this._transparent},set:function(t){this._transparent=t},enumerable:!0,configurable:!0}),xga.prototype.clone=function(){var t=new xga(this._rect.width,this._rect.height,this._transparent,null,this._powerOfTwo);return t.setPixels(this._rect,this.data),t},xga.prototype.colorTransform=function(t,e){for(var i,n,r=this.data,o=0;o<t.width;++o)for(i=0;i<t.height;++i)r[n=4*(o+t.x+(i+t.y)*this._rect.width)]=r[n]*e.redMultiplier+e.redOffset,r[1+n]=r[1+n]*e.greenMultiplier+e.greenOffset,r[2+n]=r[2+n]*e.blueMultiplier+e.blueOffset,r[3+n]=r[3+n]*e.alphaMultiplier+e.alphaOffset;this._locked||this.invalidate()},xga.prototype.copyChannel=function(t,e,i,n,r){for(var o,s,a=t.data,l=this.data,c=Math.round(Math.log(n)/Math.log(2)),h=Math.round(Math.log(r)/Math.log(2)),u=Math.round(e.x),p=Math.round(e.y),d=Math.round(i.x),_=Math.round(i.y),f=0;f<e.width;++f)for(o=0;o<e.height;++o)s=4*(f+u+(o+p)*t.width),l[4*(f+d+(o+_)*this._rect.width)+h]=a[s+c];this._locked||this.invalidate()},xga.prototype.merge=function(t,e,i,n,r,o,s){var a,l,c,h=this.data,u=t.data;for(n=~~n,r=~~r,o=~~o,s=~~s,a=0;a<e.width;++a)for(l=0;l<e.height;++l)h[c=4*(a+e.x+(l+e.y)*this.width)]=~~((u[c]*n+h[c]*(256-n))/256),h[1+c]=~~((u[1+c]*r+h[1+c]*(256-r))/256),h[2+c]=~~((u[2+c]*o+h[2+c]*(256-o))/256),h[3+c]=~~((u[3+c]*s+h[3+c]*(256-s))/256);this._locked||this.invalidate()},xga.prototype.dispose=function(){this.clear(),this._data=null,this._rect=null,this._transparent=null,this._locked=null},xga.prototype.getColorBoundsRect=function(t,e,i){void 0===i&&(i=!0);var n=new Uint32Array(this.data.buffer),r=this.rect;e=fastARGB_to_ABGR(e,this._transparent),t=fastARGB_to_ABGR(t,this._transparent);for(var o=r.width,s=r.height,a=0,l=0,c=!1,h=performance.now(),u=0;u<r.height;u++)for(var p=0;p<r.width;p++){var d=n[u*r.width+p];((d=(d&t)>>>0)===e&&i||d!==e&&!i)&&(c=!0,o=p<o?p:o,a=a<p?p:a,s=u<s?u:s,l=l<u?u:l)}var _=c?new Rectangle(o,s,a-o+1,l-s+1):new Rectangle(0,0,0,0),f=performance.now()-h;return console.debug("ColoreRect (mask, color, rect, time):",t.toString(16),e.toString(16),_._rawData,f),_},xga.prototype.floodFill=function(t,e,i){t|=0,e|=0;var n=new Uint32Array(this.data.buffer),r=this._rect.width,o=this._rect.height,s=this._floodStack;s.length=r*o*2;var a,l,c=n[t+e*r],h=ColorUtils.float32ColorToARGB(i),u=h[0],p=h[1],d=h[2],_=h[3],f=((u=this._transparent?u:255)<<24|(_=_*u/255|0)<<16|(d=d*u/255|0)<<8|(p=p*u/255|0))>>>0,m=0,g=0;for(s[g++]=t,s[g++]=e;0<g;){for(e=s[--g],m=t=s[--g];0<=m&&n[e*r+m]===c;)m--;for(m++,a=l=!1;m<r&&n[e*r+m]===c;)n[e*r+m]=f,!a&&0<e&&n[(e-1)*r+m]===c?(s[g++]=m,s[g++]=e-1,a=!0):a&&0<e&&n[(e-1)*r+m]!==c&&(a=!1),!l&&e<o-1&&n[(e+1)*r+m]===c?(s[g++]=m,s[g++]=e+1,l=!0):l&&e<o-1&&n[(e+1)*r+m]!==c&&(l=!1),m++}this._locked||this.invalidate()},xga.prototype.drawBitmap=function(t,e,i,n,r,o){void 0===o&&(o=null),BitmapImageUtils.drawBitmap(t,e,i,n,r,this.data,0,0,this._rect.width,this._rect.height,o),this._locked||this.invalidate()},xga.prototype.fillRect=function(t,e){var i,n,r=new Uint32Array(this._data.buffer),o=~~t.x,s=~~t.y,a=~~t.width,l=~~t.height,c=this._transparent?4294967295&e:4278190080+(16777215&e);if(0==o&&0==s&&a==this._rect.width&&l==this._rect.height)r.fill(c);else for(i=0;i<l;++i)n=o+(i+s)*this._rect.width,r.fill(c,n,n+a);this._locked||this.invalidate()},xga.prototype.getPixel=function(t,e){var i,n=4*(~~t+~~e*this._rect.width),r=this._data,o=r[0+n],s=r[1+n],a=r[2+n];return(i=r[3+n])?255*o/i<<16|255*s/i<<8|255*a/i:0},xga.prototype.getPixel32=function(t,e){var i,n=4*(~~t+~~e*this._rect.width),r=this._data,o=r[n++],s=r[n++],a=r[n++];return(i=r[n])?(i<<24|255*o/i<<16|255*s/i<<8|255*a/i)>>>0:0},xga.prototype.getPixelData=function(t,e,i){var n=4*(t+e*this._rect.width),r=this._data;i[0]=r[n++],i[1]=r[n++],i[2]=r[n++],i[3]=r[n]},xga.prototype.setPixelData=function(t,e,i){var n=4*(t+e*this._rect.width),r=this.data;r[0+n]=i[0],r[1+n]=i[1],r[2+n]=i[2],r[3+n]=this._transparent?i[3]:255,this._locked||this.invalidate()},xga.prototype.lock=function(){this._locked||(this._locked=!0)},xga.prototype.setArray=function(t,e){for(var i,n,r,o=this.data,s=0;s<t.width;++s)for(i=0;i<t.height;++i)r=ColorUtils.float32ColorToARGB(e[s+i*t.width]),o[0+(n=4*(s+t.x+(i+t.y)*this._rect.width))]=r[1],o[1+n]=r[2],o[2+n]=r[3],o[3+n]=this._transparent?r[0]:255;this._locked||this.invalidate()},xga.prototype.setPixel=function(t,e,i){var n=4*(~~t+~~e*this._rect.width),r=ColorUtils.float32ColorToARGB(i),o=this.data;o[0+n]=r[1],o[1+n]=r[2],o[2+n]=r[3],o[3+n]=255,this._locked||this.invalidate()},xga.prototype.setPixelFromArray=function(t,e,i){var n=4*(t+e*this._rect.width),r=this.data;r[0+n]=i[1],r[1+n]=i[2],r[2+n]=i[3],r[3+n]=255*i[0],this._locked||this.invalidate()},xga.prototype.setPixel32=function(t,e,i){var n=4*(~~t+~~e*this._rect.width),r=ColorUtils.float32ColorToARGB(i),o=this.data;o[0+n]=r[1],o[1+n]=r[2],o[2+n]=r[3],o[3+n]=this._transparent?r[0]:255,this._locked||this.invalidate()},xga.prototype.setPixels=function(t,e){if(t.equals(this._rect))this._data.set(e);else for(var i=this._rect.width,n=t.width,r=this._data,o=0;o<t.height;++o)r.set(e.subarray(o*n*4,(o+1)*n*4),4*(t.x+(o+t.y)*i));this._locked||this.invalidate()},xga.prototype.unlock=function(){this._locked&&(this._locked=!1,this.invalidate())},Object.defineProperty(xga.prototype,"alphaChannel",{set:function(t){if(t){if(this._data.length!=4*t.length)throw"error when trying to merge the alpha channel into the image. the length of the alpha channel should be 1/4 of the length of the imageData";for(var e=0;e<t.length;e++)this._data[4*e+3]=t[e];this._alphaChannel=null}},enumerable:!0,configurable:!0}),Object.defineProperty(xga.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),xga.prototype._setSize=function(t,e){var i=this.data;this._data=new Uint8ClampedArray(4*t*e);for(var n=this._rect.width<t?this._rect.width:t,r=this._rect.height<e?this._rect.height:e,o=0;o<r;++o)this._data.set(i.subarray(o*n*4,(o+1)*n*4),o*t*4);wga.prototype._setSize.call(this,t,e)},xga.assetType="[image BitmapImage2D]",xga),_Stage_BitmapImage2D=(uja=_Stage_Image2D,__extends(vja,uja),vja.prototype.getTexture=function(){if(uja.prototype.getTexture.call(this),this._invalid){this._invalid=!1;var t=this._asset._data.buffer;this._texture.uploadFromArray(new Uint8Array(t),0,this._asset.transparent);var e=this._asset.mipLevels;if(e&&0<e.length){for(var i=0;i<e.length;i++)this._texture.uploadFromArray(new Uint8Array(e[i].data.buffer),i+1,this._asset.transparent);this._mipmap=!0,this._invalidMipmaps=!1}else this._invalidMipmaps=!0}return this._texture},vja),uja,wga;function vja(){return null!==uja&&uja.apply(this,arguments)||this}function xga(t,e,i,n,r,o){void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=!0),void 0===o&&(o=null);var s=wga.call(this,t,e,r)||this;return s._locked=!1,s._floodStack=[],s._data=new Uint8ClampedArray(4*s._rect.width*s._rect.height),s._transparent=i,s._stage=o,null!=n&&0!=n&&s.fillRect(s._rect,n),s}Stage.registerAbstraction(_Stage_BitmapImage2D,BitmapImage2D);var BitmapImageChannel=(zja.ALPHA=8,zja.BLUE=4,zja.GREEN=2,zja.RED=1,zja),BlendMode=(Aja.ADD="add",Aja.ALPHA="alpha",Aja.DARKEN="darken",Aja.DIFFERENCE="difference",Aja.ERASE="erase",Aja.HARDLIGHT="hardlight",Aja.INVERT="invert",Aja.LAYER="layer",Aja.LIGHTEN="lighten",Aja.MULTIPLY="multiply",Aja.NORMAL="normal",Aja.OVERLAY="overlay",Aja.SCREEN="screen",Aja.SHADER="shader",Aja.SUBTRACT="subtract",Aja),ExternalImage2D=(Bja=Image2D,__extends(Cja,Bja),Object.defineProperty(Cja.prototype,"assetType",{get:function(){return Cja.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Cja.prototype,"urlRequest",{get:function(){return this._urlRequest},set:function(t){this._urlRequest=t},enumerable:!0,configurable:!0}),Cja.prototype.clone=function(){return new Cja(this._urlRequest)},Cja.assetType="[image ExternalImage2D]",Cja),_Stage_ExternalImage2D=(Gja=_Stage_Image2D,__extends(Hja,Gja),Hja.prototype.getTexture=function(){return Gja.prototype.getTexture.call(this),this._invalid&&(this._invalid=!1,this._texture.uploadFromURL(this._asset.urlRequest,0),this._invalidMipmaps=!0),this._texture},Hja),Gja,Bja;function Hja(){return null!==Gja&&Gja.apply(this,arguments)||this}function Cja(t){var e=Bja.call(this,8,8,!0)||this;return e._urlRequest=t,e}function Aja(){}function zja(){}Stage.registerAbstraction(_Stage_ExternalImage2D,ExternalImage2D);var SpecularImage2D=(Ija=Image2D,__extends(Jja,Ija),Object.defineProperty(Jja.prototype,"assetType",{get:function(){return Jja.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Jja.prototype,"specularSource",{get:function(){return this._specularSource},set:function(t){this._specularSource!=t&&(this._specularSource=t,this.invalidate(),this._testSize())},enumerable:!0,configurable:!0}),Object.defineProperty(Jja.prototype,"glossSource",{get:function(){return this._glossSource},set:function(t){this._glossSource!=t&&(this._glossSource=t,this.invalidate(),this._testSize())},enumerable:!0,configurable:!0}),Jja.prototype.clone=function(){return new Jja(this._specularSource,this._glossSource)},Jja.prototype.dispose=function(){Ija.prototype.dispose.call(this),this._rect=null,this._output.dispose()},Object.defineProperty(Jja.prototype,"data",{get:function(){var t=new Point;return this._output.fillRect(this._rect,16777215),this._glossSource&&this._output.copyChannel(this._glossSource,this._rect,t,BitmapImageChannel.GREEN,BitmapImageChannel.GREEN),this._specularSource&&this._output.copyChannel(this._specularSource,this._rect,t,BitmapImageChannel.RED,BitmapImageChannel.RED),this._output.data},enumerable:!0,configurable:!0}),Jja.prototype._setSize=function(t,e){Ija.prototype._setSize.call(this,t,e),this._output._setSize(t,e)},Jja.prototype._testSize=function(){var t,e=this._specularSource?(t=this._specularSource.width,this._specularSource.height):this._glossSource?(t=this._glossSource.width,this._glossSource.height):t=1;t!=this._output.width&&e!=this._output.height&&(this._output.dispose(),this._output=new BitmapImage2D(t,e,!1,16777215)),this._setSize(t,e)},Jja.assetType="[asset SpecularImage2D]",Jja),Ija;function Jja(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=Ija.call(this,1,1)||this;return i._specularSource=t,i._glossSource=e,i._output=new BitmapImage2D(1,1,!1,16777215),i._testSize(),i}Stage.registerAbstraction(_Stage_BitmapImage2D,SpecularImage2D);var Filter3DCompositeTask=(Uja=Filter3DTaskBase,__extends(Vja,Uja),Object.defineProperty(Vja.prototype,"overlayTexture",{get:function(){return this._overlayTexture},set:function(t){this._overlayTexture=t,this._overlayWidth=this._overlayTexture.width,this._overlayHeight=this._overlayTexture.height},enumerable:!0,configurable:!0}),Object.defineProperty(Vja.prototype,"exposure",{get:function(){return this._data[0]},set:function(t){this._data[0]=t},enumerable:!0,configurable:!0}),Vja.prototype.getFragmentCode=function(){var t=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(t,1);var e=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(e,1);var i=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(i,1);var n=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(n,1);var r=this._registerCache.getFreeTextureReg();this._inputTextureIndex=r.index;var o=this._registerCache.getFreeTextureReg();this._overlayTextureIndex=o.index;var s=this._registerCache.getFreeFragmentConstant();this._exposureIndex=4*s.index;var a,l=this._registerCache.getFreeFragmentConstant();switch(this._scalingIndex=4*l.index,a="tex "+t+", "+this._uvVarying+", "+r+" <2d,linear,clamp>\nmul "+e+", "+this._uvVarying+", "+l+".zw\nadd "+e+", "+e+", "+l+".xy\ntex "+e+", "+e+", "+o+" <2d,linear,clamp>\nmul "+e+", "+e+", "+s+".xxx\nadd "+e+", "+e+", "+s+".xxx\n",this._blendMode){case"multiply":a+="mul oc, "+t+", "+e+"\n";break;case"add":a+="add oc, "+t+", "+e+"\n";break;case"subtract":a+="sub oc, "+t+", "+e+"\n";break;case"overlay":a+="sge "+i+", "+t+", "+s+".yyy\n",a+="sub "+t+", "+i+", "+t+"\n",a+="sub "+e+", "+e+", "+i+"\n",a+="mul "+e+", "+e+", "+t+"\n",a+="sub "+n+", "+i+", "+s+".yyy\n",a+="div "+e+", "+e+", "+n+"\n",a+="add oc, "+e+", "+i+"\n";break;case"normal":a+="mov oc, "+t+"\n";break;default:throw new Error("Unknown blend mode")}return a},Vja.prototype.activate=function(t,e,i){this._data[4]=-.5*(this._textureWidth-this._overlayWidth)/this._overlayWidth,this._data[5]=-.5*(this._textureHeight-this._overlayHeight)/this._overlayHeight,this._data[6]=this._textureWidth/this._overlayWidth,this._data[7]=this._textureHeight/this._overlayHeight,t.context.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,this._data),t.getAbstraction(this._overlayTexture).activate(this._overlayTextureIndex)},Vja.prototype.deactivate=function(t){t.context.setTextureAt(1,null)},Vja),Filter3DFXAATask=(mka=Filter3DTaskBase,__extends(nka,mka),Object.defineProperty(nka.prototype,"amount",{get:function(){return this._amount},set:function(t){this._amount!=t&&(this._amount=t,this.invalidateProgram(),this.updateBlurData())},enumerable:!0,configurable:!0}),Object.defineProperty(nka.prototype,"stepSize",{get:function(){return this._stepSize},set:function(t){this._stepSize!=t&&(this._stepSize=t,this.calculateStepSize(),this.invalidateProgram(),this.updateBlurData())},enumerable:!0,configurable:!0}),nka.prototype.getFragmentCode=function(){var t="fc0",e="ft0.xy",i="ft0.x",n="ft0.y",r="ft2.x",o="ft2.y",s="ft2.z",a="ft2.w",l="ft3.y",c="ft3.z",h="ft1",u="ft4.x",p=new Array;return p.push("tex",h,"v0","fs0","<2d wrap linear>","\n"),p.push("dp3","ft3.x",h,t,"\n"),p.push("mov",e,"v0","\n"),p.push("sub",e,e,"fc2.xy","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("dp3",r,h,t,"\n"),p.push("mov",e,"v0","\n"),p.push("add",e,e,"fc2.xy","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("dp3",a,h,t,"\n"),p.push("mov",e,"v0","\n"),p.push("sub",n,n,"fc2.y","\n"),p.push("add",i,i,"fc2.x","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("dp3",o,h,t,"\n"),p.push("mov",e,"v0","\n"),p.push("add",n,n,"fc2.y","\n"),p.push("sub",i,i,"fc2.x","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("dp3",s,h,t,"\n"),p.push("add",l,r,o,"\n"),p.push("add",c,s,a,"\n"),p.push("sub",u,l,c,"\n"),p.push("neg",u,u,"\n"),p.push("add",l,r,s,"\n"),p.push("add",c,o,a,"\n"),p.push("sub","ft4.y",l,c,"\n"),p.push("add",l,l,c,"\n"),p.push("mul",l,l,"fc3.y","\n"),p.push("mul",l,l,"fc1.x","\n"),p.push("max","ft5.x",l,"fc3.x","\n"),p.push("abs",l,u,"\n"),p.push("abs",c,"ft4.y","\n"),p.push("min",l,l,c,"\n"),p.push("add",l,l,"ft5.x","\n"),p.push("rcp","ft5.y",l,"\n"),p.push("mul",l,u,"ft5.y","\n"),p.push("mov",c,"fc3.z","\n"),p.push("neg",c,c,"\n"),p.push("max",l,l,c,"\n"),p.push("min",l,"fc3.z",l,"\n"),p.push("mul",u,l,"fc2.x","\n"),p.push("mul",l,"ft4.y","ft5.y","\n"),p.push("mov",c,"fc3.z","\n"),p.push("neg",c,c,"\n"),p.push("max",l,l,c,"\n"),p.push("min",l,"fc3.z",l,"\n"),p.push("mul","ft4.y",l,"fc2.y","\n"),p.push("mul","ft1.xy","ft4.xy","fc4.x","\n"),p.push("add",e,"v0","ft1.xy","\n"),p.push("tex","ft6",e,"fs0","<2d wrap linear>","\n"),p.push("mul","ft1.xy","ft4.xy","fc4.y","\n"),p.push("add",e,"v0","ft1.xy","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("add","ft6","ft6",h,"\n"),p.push("mul","ft6","ft6","fc1.y","\n"),p.push("mul","ft1.xy","ft4.xy","fc4.z","\n"),p.push("add",e,"v0","ft1.xy","\n"),p.push("tex","ft7",e,"fs0","<2d wrap linear>","\n"),p.push("mul","ft1.xy","ft4.xy","fc4.w","\n"),p.push("add",e,"v0","ft1.xy","\n"),p.push("tex",h,e,"fs0","<2d wrap linear>","\n"),p.push("add","ft7","ft7",h,"\n"),p.push("mul","ft7","ft7","fc1.x","\n"),p.push("mul",h,"ft6","fc1.y","\n"),p.push("add","ft7","ft7",h,"\n"),p.push("min",l,s,a,"\n"),p.push("min",c,r,o,"\n"),p.push("min",l,l,c,"\n"),p.push("min","ft5.x",l,"ft3.x","\n"),p.push("max",l,s,a,"\n"),p.push("max",c,r,o,"\n"),p.push("max",l,l,c,"\n"),p.push("max","ft5.y",l,"ft3.x","\n"),p.push("dp3",l,t,"ft7","\n"),p.push("slt",c,l,"ft5.x","\n"),p.push("sge","ft3.w",l,"ft5.y","\n"),p.push("mul",c,c,"ft3.w","\n"),p.push("mul","ft6","ft6",c,"\n"),p.push("sub",c,"fc1.w",c,"\n"),p.push("mul","ft7","ft7",c,"\n"),p.push("add","oc","ft6","ft7","\n"),p.join(" ")},nka.prototype.activate=function(t,e,i){t.context.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,this._data)},nka.prototype.updateTextures=function(t){mka.prototype.updateTextures.call(this,t),this.updateBlurData()},nka.prototype.updateBlurData=function(){this._rttManager&&(this._data[8]=1/this._textureWidth,this._data[9]=1/this._textureHeight)},nka.prototype.calculateStepSize=function(){this._realStepSize=1},nka.MAX_AUTO_SAMPLES=15,nka),Filter3DHBlurTask=(Nka=Filter3DTaskBase,__extends(Oka,Nka),Object.defineProperty(Oka.prototype,"amount",{get:function(){return this._amount},set:function(t){this._amount!=t&&(this._amount=t,this.invalidateProgram(),this.updateBlurData(),this.calculateStepSize())},enumerable:!0,configurable:!0}),Object.defineProperty(Oka.prototype,"stepSize",{get:function(){return this._stepSize},set:function(t){this._stepSize!=t&&(this._stepSize=t,this.calculateStepSize(),this.invalidateProgram(),this.updateBlurData())},enumerable:!0,configurable:!0}),Oka.prototype.getFragmentCode=function(){var t=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(t,1);var e=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(e,1);var i=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(i,1);var n=this._registerCache.getFreeTextureReg();this._inputTextureIndex=n.index;var r=this._registerCache.getFreeFragmentConstant();this._blurIndex=4*r.index;var o=1,s="mov "+t+", "+this._uvVarying+"\nsub "+t+".x, "+this._uvVarying+".x, "+r+".x\n";s+="tex "+e+", "+t+", "+n+" <2d,linear,clamp>\n";for(var a=this._realStepSize;a<=this._amount;a+=this._realStepSize)s+="add "+t+".x, "+t+".x, "+r+".y\ntex "+i+", "+t+", "+n+" <2d,linear,clamp>\nadd "+e+", "+e+", "+i+"\n",++o;return s+="mul oc, "+e+", "+r+".z\n",this._data[2]=1/o,s},Oka.prototype.activate=function(t,e,i){t.context.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,this._data)},Oka.prototype.updateTextures=function(t){Nka.prototype.updateTextures.call(this,t),this.updateBlurData()},Oka.prototype.updateBlurData=function(){var t=1/this._textureWidth;this._data[0]=.5*this._amount*t,this._data[1]=this._realStepSize*t},Oka.prototype.calculateStepSize=function(){this._realStepSize=0<this._stepSize?this._stepSize:this._amount>Oka.MAX_AUTO_SAMPLES?this._amount/Oka.MAX_AUTO_SAMPLES:1},Oka.MAX_AUTO_SAMPLES=15,Oka),Filter3DVBlurTask=(fla=Filter3DTaskBase,__extends(gla,fla),Object.defineProperty(gla.prototype,"amount",{get:function(){return this._amount},set:function(t){this._amount!=t&&(this._amount=t,this.invalidateProgram(),this.updateBlurData())},enumerable:!0,configurable:!0}),Object.defineProperty(gla.prototype,"stepSize",{get:function(){return this._stepSize},set:function(t){this._stepSize!=t&&(this._stepSize=t,this.calculateStepSize(),this.invalidateProgram(),this.updateBlurData())},enumerable:!0,configurable:!0}),gla.prototype.getFragmentCode=function(){var t=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(t,1);var e=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(e,1);var i=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(i,1);var n=this._registerCache.getFreeTextureReg();this._inputTextureIndex=n.index;var r=this._registerCache.getFreeFragmentConstant();this._blurIndex=4*r.index;var o=1,s="mov "+t+", "+this._uvVarying+"\nsub "+t+".y, "+this._uvVarying+".y, "+r+".x\n";s+="tex "+e+", "+t+", "+n+" <2d,linear,clamp>\n";for(var a=this._realStepSize;a<=this._amount;a+=this._realStepSize)s+="add "+t+".y, "+t+".y, "+r+".y\n",s+="tex "+i+", "+t+", "+n+" <2d,linear,clamp>\nadd "+e+", "+e+", "+i+"\n",++o;return s+="mul oc, "+e+", "+r+".z\n",this._data[2]=1/o,s},gla.prototype.activate=function(t,e,i){t.context.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,this._data)},gla.prototype.updateTextures=function(t){fla.prototype.updateTextures.call(this,t),this.updateBlurData()},gla.prototype.updateBlurData=function(){var t=1/this._textureHeight;this._data[0]=.5*this._amount*t,this._data[1]=this._realStepSize*t},gla.prototype.calculateStepSize=function(){this._realStepSize=0<this._stepSize?this._stepSize:this._amount>gla.MAX_AUTO_SAMPLES?this._amount/gla.MAX_AUTO_SAMPLES:1},gla.MAX_AUTO_SAMPLES=15,gla),BlurFilter3D=(zla=Filter3DBase,__extends(Ala,zla),Object.defineProperty(Ala.prototype,"blurX",{get:function(){return this._hBlurTask.amount},set:function(t){this._hBlurTask.amount=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ala.prototype,"blurY",{get:function(){return this._vBlurTask.amount},set:function(t){this._vBlurTask.amount=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ala.prototype,"stepSize",{get:function(){return this._hBlurTask.stepSize},set:function(t){this._hBlurTask.stepSize=t,this._vBlurTask.stepSize=t},enumerable:!0,configurable:!0}),Ala.prototype.setRenderTargets=function(t,e){this._hBlurTask.target=this._vBlurTask.getMainInputTexture(e),zla.prototype.setRenderTargets.call(this,t,e)},Ala),CompositeFilter3D=(Kla=Filter3DBase,__extends(Lla,Kla),Object.defineProperty(Lla.prototype,"exposure",{get:function(){return this._compositeTask.exposure},set:function(t){this._compositeTask.exposure=t},enumerable:!0,configurable:!0}),Object.defineProperty(Lla.prototype,"overlayTexture",{get:function(){return this._compositeTask.overlayTexture},set:function(t){this._compositeTask.overlayTexture=t},enumerable:!0,configurable:!0}),Lla),FXAAFilter3D=(Rla=Filter3DBase,__extends(Sla,Rla),Object.defineProperty(Sla.prototype,"amount",{get:function(){return this._fxaaTask.amount},set:function(t){this._fxaaTask.amount=t},enumerable:!0,configurable:!0}),Object.defineProperty(Sla.prototype,"stepSize",{get:function(){return this._fxaaTask.stepSize},set:function(t){this._fxaaTask.stepSize=t},enumerable:!0,configurable:!0}),Sla),StageManager=(Yla=EventDispatcher,__extends(Zla,Yla),Zla.getInstance=function(){return null==this._instance&&(this._instance=new Zla),this._instance},Zla.prototype.getStageAt=function(t,e,i,n,r){if(void 0===e&&(e=!1),void 0===i&&(i=ContextGLProfile.BASELINE),void 0===n&&(n=ContextMode.AUTO),void 0===r&&(r=!1),t<0||Zla.STAGE_MAX_QUANTITY<=t)throw new ArgumentError("Index is out of bounds [0.."+Zla.STAGE_MAX_QUANTITY+"]");var o,s;return this._stages[t]||(Zla._numStages++,document&&null==Zla.htmlCanvas?((o=document.createElement("canvas")).id="stage"+t,document.body.appendChild(o)):Zla.htmlCanvas&&(o=Zla.htmlCanvas),(s=this._stages[t]=new Stage(o,t,this,e,i)).addEventListener(StageEvent.CONTEXT_CREATED,this._onContextCreatedDelegate),s.requestContext(e,i,n,r)),this._stages[t]},Zla.prototype.iRemoveStage=function(t){Zla._numStages--,t.removeEventListener(StageEvent.CONTEXT_CREATED,this._onContextCreatedDelegate),this._stages[t.stageIndex]=null},Zla.prototype.getFreeStage=function(t,e,i,n){void 0===t&&(t=!1),void 0===e&&(e=ContextGLProfile.BASELINE),void 0===i&&(i=ContextMode.AUTO),void 0===n&&(n=!1);for(var r=0,o=this._stages.length;r<o;){if(!this._stages[r])return this.getStageAt(r,t,e,i,n);++r}return null},Object.defineProperty(Zla.prototype,"hasFreeStage",{get:function(){return Zla._numStages<Zla.STAGE_MAX_QUANTITY},enumerable:!0,configurable:!0}),Object.defineProperty(Zla.prototype,"numSlotsFree",{get:function(){return Zla.STAGE_MAX_QUANTITY-Zla._numStages},enumerable:!0,configurable:!0}),Object.defineProperty(Zla.prototype,"numSlotsUsed",{get:function(){return Zla._numStages},enumerable:!0,configurable:!0}),Object.defineProperty(Zla.prototype,"numSlotsTotal",{get:function(){return this._stages.length},enumerable:!0,configurable:!0}),Zla.prototype.onContextCreated=function(t){},Zla.STAGE_MAX_QUANTITY=8,Zla.htmlCanvas=null,Zla._numStages=0,Zla),RTTBufferManager=(pma=EventDispatcher,__extends(qma,pma),qma.getInstance=function(t){if(!t)throw new Error("stage key cannot be null!");null==qma._instances&&(qma._instances=new Array);var e,i=qma.getRTTBufferManagerFromStage(t);return null==i&&(i=new qma(t),(e=new RTTBufferManagerVO).stage3d=t,e.rttbfm=i,qma._instances.push(e)),i},qma.getRTTBufferManagerFromStage=function(t){for(var e,i=qma._instances.length,n=0;n<i;n++)if((e=qma._instances[n]).stage3d===t)return e.rttbfm;return null},qma.deleteRTTBufferManager=function(t){for(var e=qma._instances.length,i=0;i<e;i++)if(qma._instances[i].stage3d===t)return void qma._instances.splice(i,1)},Object.defineProperty(qma.prototype,"textureRatioX",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._textureRatioX},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"textureRatioY",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._textureRatioY},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"viewOffsetX",{get:function(){return this._viewOffsetX},set:function(t){this._viewOffsetX=t,this._buffersInvalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"viewOffsetY",{get:function(){return this._viewOffsetY},set:function(t){this._viewOffsetY=t,this._buffersInvalid=!0},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"viewWidth",{get:function(){return this._viewWidth},set:function(t){t!=this._viewWidth&&(this._viewWidth=t,this._buffersInvalid=!0,this._textureWidth=this._powerOfTwo?ImageUtils.getBestPowerOf2(this._viewWidth):this._viewWidth,this._textureWidth>this._viewWidth?(this._renderToTextureRect.x=Math.floor(.5*(this._textureWidth-this._viewWidth)),this._renderToTextureRect.width=this._viewWidth):(this._renderToTextureRect.x=0,this._renderToTextureRect.width=this._textureWidth),this.dispatchEvent(new RTTEvent(RTTEvent.RESIZE,this)))},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"viewHeight",{get:function(){return this._viewHeight},set:function(t){t!=this._viewHeight&&(this._viewHeight=t,this._buffersInvalid=!0,this._textureHeight=this._powerOfTwo?ImageUtils.getBestPowerOf2(this._viewHeight):this._viewHeight,this._textureHeight>this._viewHeight?(this._renderToTextureRect.y=Math.floor(.5*(this._textureHeight-this._viewHeight)),this._renderToTextureRect.height=this._viewHeight):(this._renderToTextureRect.y=0,this._renderToTextureRect.height=this._textureHeight),this.dispatchEvent(new RTTEvent(RTTEvent.RESIZE,this)))},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"renderToTextureVertexBuffer",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._renderToTextureVertexBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"renderToScreenVertexBuffer",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._renderToScreenVertexBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"indexBuffer",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._indexBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"renderToTextureRect",{get:function(){return this._buffersInvalid&&this.updateRTTBuffers(),this._renderToTextureRect},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"textureWidth",{get:function(){return this._textureWidth},enumerable:!0,configurable:!0}),Object.defineProperty(qma.prototype,"textureHeight",{get:function(){return this._textureHeight},enumerable:!0,configurable:!0}),qma.prototype.dispose=function(){qma.deleteRTTBufferManager(this._stage),this._indexBuffer&&(this._indexBuffer.dispose(),this._renderToScreenVertexBuffer.dispose(),this._renderToTextureVertexBuffer.dispose(),this._renderToScreenVertexBuffer=null,this._renderToTextureVertexBuffer=null,this._indexBuffer=null)},qma.prototype.updateRTTBuffers=function(){var t,e,i=this._stage.context;null==this._renderToTextureVertexBuffer&&(this._renderToTextureVertexBuffer=i.createVertexBuffer(4,20)),null==this._renderToScreenVertexBuffer&&(this._renderToScreenVertexBuffer=i.createVertexBuffer(4,20)),this._indexBuffer||(this._indexBuffer=i.createIndexBuffer(6),this._indexBuffer.uploadFromArray(new Uint16Array([2,1,0,3,2,0]),0,6)),this._textureRatioX=t=Math.min(this._viewWidth/this._textureWidth,1),this._textureRatioY=e=Math.min(this._viewHeight/this._textureHeight,1);var n=.5*(1-t),r=.5*(t+1),o=.5*(1-e),s=.5*(e+1),a=new Float32Array([-t,-e,n,o,0,t,-e,r,o,1,t,e,r,s,2,-t,e,n,s,3]),l=new Float32Array([-1,-1,n,o,0,1,-1,r,o,1,1,1,r,s,2,-1,1,n,s,3]);this._renderToTextureVertexBuffer.uploadFromArray(a,0,4),this._renderToScreenVertexBuffer.uploadFromArray(l,0,4),this._buffersInvalid=!1},qma),RTTBufferManagerVO=function(){},Image2DParser=(Rma=ParserBase,__extends(Sma,Rma),Sma.supportsType=function(t){return"jpg"==(t=t.toLowerCase())||"jpeg"==t||"png"==t||"gif"==t},Sma.supportsData=function(t){if(t instanceof HTMLImageElement)return!0;if(!(t instanceof ByteArray))return!1;var e=t;return e.position=0,55551==e.readUnsignedShort()||(e.position=0,16973==e.readShort()||(e.position=1,"PNG"==e.readUTFBytes(3)||(e.position=0,"GIF"==e.readUTFBytes(3)&&14393==e.readShort()&&97==e.readByte()||(e.position=0,"ATF"==e.readUTFBytes(3)))))},Sma.prototype._pFinalizeAsset=function(t,e){this._alphaChannel&&(t.alphaChannel=this._alphaChannel),Rma.prototype._pFinalizeAsset.call(this,t,e)},Sma.prototype._pProceedParsing=function(){var e=this;if(this._loadingImage)return ParserBase.MORE_TO_PARSE;if(this._htmlImageElement)i=ImageUtils.imageToBitmapImage2D(this._htmlImageElement,!1,this._factory),this._pFinalizeAsset(i,this._iFileName);else if(this.data instanceof HTMLImageElement){var t=this.data,i=ImageUtils.imageToBitmapImage2D(t,!1,this._factory);this._pFinalizeAsset(i,this._iFileName)}else if(this.data instanceof ByteArray){if(this.data.position=0,this._htmlImageElement=ParserUtils.byteArrayToImage(this.data),!this._htmlImageElement.naturalWidth)return this._htmlImageElement.onload=function(t){return e.onLoadComplete(t)},this._loadingImage=!0,ParserBase.MORE_TO_PARSE;i=ImageUtils.imageToBitmapImage2D(this._htmlImageElement,!1,this._factory),this._pFinalizeAsset(i,this._iFileName)}else if(this.data instanceof ArrayBuffer)this._htmlImageElement=ParserUtils.arrayBufferToImage(this.data),i=ImageUtils.imageToBitmapImage2D(this._htmlImageElement,!1,this._factory),this._pFinalizeAsset(i,this._iFileName);else{if(this.data instanceof Blob)return this._htmlImageElement=ParserUtils.blobToImage(this.data),this._htmlImageElement.onload=function(t){return e.onLoadComplete(t)},this._loadingImage=!0,ParserBase.MORE_TO_PARSE;this.data instanceof URLRequest&&(i=new ExternalImage2D(this.data),this._pFinalizeAsset(i,this._iFileName))}return this._pContent=i,ParserBase.PARSING_DONE},Sma.prototype.onLoadComplete=function(t){this._loadingImage=!1},Sma),ImageCubeParser=(fna=ParserBase,__extends(gna,fna),gna.supportsType=function(t){return"cube"==t.toLowerCase()},gna.supportsData=function(t){try{return!!JSON.parse(t)}catch(t){return!1}},gna.prototype._iResolveDependency=function(t){},gna.prototype._iResolveDependencyFailure=function(t){},gna.prototype._pProceedParsing=function(){if(null!=this._imgDependencyDictionary){var t=new BitmapImageCube(this._getBitmapImage2D(gna.posX).width),e=new Rectangle(0,0,t.size,t.size);return t.setPixels(BitmapImageCube.posX,e,this._getBitmapImage2D(gna.posX).data),t.setPixels(BitmapImageCube.negX,e,this._getBitmapImage2D(gna.negX).data),t.setPixels(BitmapImageCube.posY,e,this._getBitmapImage2D(gna.posY).data),t.setPixels(BitmapImageCube.negY,e,this._getBitmapImage2D(gna.negY).data),t.setPixels(BitmapImageCube.posZ,e,this._getBitmapImage2D(gna.posZ).data),t.setPixels(BitmapImageCube.negZ,e,this._getBitmapImage2D(gna.negZ).data),this._imgDependencyDictionary=null,t.name=this._iFileName,this._pFinalizeAsset(t,this._iFileName),ParserBase.PARSING_DONE}try{var i,n=JSON.parse(this.data),r=n.data;if(6!=r.length&&this._pDieWithError("ImageCubeParser: Error - cube texture should have exactly 6 images"),n){this._imgDependencyDictionary=new Object;for(var o=0;o<r.length;o++)i=r[o],this._imgDependencyDictionary[i.id]=this._pAddDependency(i.id,new URLRequest(i.image.toString()));return this._validateCubeData()?(this._pPauseAndRetrieveDependencies(),ParserBase.MORE_TO_PARSE):(this._pDieWithError("ImageCubeParser: JSON data error - cubes require id of: \n"+gna.posX+", "+gna.negX+", \n"+gna.posY+", "+gna.negY+", \n"+gna.posZ+", "+gna.negZ),ParserBase.PARSING_DONE)}}catch(t){this._pDieWithError("CubeTexturePaser Error parsing JSON")}return ParserBase.PARSING_DONE},gna.prototype._validateCubeData=function(){return null!=this._imgDependencyDictionary[gna.posX]&&null!=this._imgDependencyDictionary[gna.negX]&&null!=this._imgDependencyDictionary[gna.posY]&&null!=this._imgDependencyDictionary[gna.negY]&&null!=this._imgDependencyDictionary[gna.posZ]&&null!=this._imgDependencyDictionary[gna.negZ]},gna.prototype._getBitmapImage2D=function(t){var e=this._imgDependencyDictionary[t];return e?e.assets[0]:null},gna.posX="posX",gna.negX="negX",gna.posY="posY",gna.negY="negY",gna.posZ="posZ",gna.negZ="negZ",gna),TextureAtlasParser=(tna=ParserBase,__extends(una,tna),una.supportsType=function(t){return"xml"==t.toLowerCase()},una.supportsData=function(t){try{var e=ParserUtils.toString(t);return-1!=e.indexOf("TextureAtlas")||-1!=e.indexOf("textureatlas")}catch(t){return!1}},una.prototype._iResolveDependency=function(t){t.assets.length?(this._imageData=t.assets[0],this._pFinalizeAsset(this._imageData),this._parseState=TextureAtlasParserState.PARSE_SUBTEXTURES):this._parseState=TextureAtlasParserState.PARSE_COMPLETE},una.prototype._iResolveDependencyFailure=function(t){this._parseState=TextureAtlasParserState.PARSE_COMPLETE},una.prototype._pProceedParsing=function(){switch(this._parseState){case TextureAtlasParserState.PARSE_XML:try{this._doc=XmlUtils.getChildrenWithTag(XmlUtils.strToXml(this._pGetTextData()),"TextureAtlas")[0],this._imagePath=XmlUtils.readAttributeValue(this._doc,"imagePath"),this._subTextureNodes=XmlUtils.getChildrenWithTag(this._doc,"SubTexture"),this._parseState=TextureAtlasParserState.PARSE_IMAGE}catch(t){return ParserBase.PARSING_DONE}break;case TextureAtlasParserState.PARSE_IMAGE:if(!this._imagePath)return ParserBase.PARSING_DONE;this._pAddDependency(this._imagePath,new URLRequest(this._imagePath)),this._pPauseAndRetrieveDependencies();break;case TextureAtlasParserState.PARSE_SUBTEXTURES:for(var t,e,i,n,r,o,s=this._subTextureNodes.length,a=0;a<s;a++)e=this._subTextureNodes[a],t=new ImageSampler,i=XmlUtils.readAttributeValue(e,"x"),n=XmlUtils.readAttributeValue(e,"y"),r=XmlUtils.readAttributeValue(e,"width"),o=XmlUtils.readAttributeValue(e,"height"),(i||n||r||o)&&(t.imageRect=new Rectangle(parseInt(i)/this._imageData.width,parseInt(n)/this._imageData.height,parseInt(r)/this._imageData.width,parseInt(o)/this._imageData.height)),i=XmlUtils.readAttributeValue(e,"frameX"),n=XmlUtils.readAttributeValue(e,"frameY"),r=XmlUtils.readAttributeValue(e,"frameWidth"),o=XmlUtils.readAttributeValue(e,"frameHeight"),(i||n||r||o)&&(t.frameRect=new Rectangle(parseInt(i),parseInt(n),parseInt(r),parseInt(o))),this._pFinalizeAsset(t,XmlUtils.readAttributeValue(e,"name"));this._parseState=TextureAtlasParserState.PARSE_COMPLETE;break;case TextureAtlasParserState.PARSE_COMPLETE:return ParserBase.PARSING_DONE}return ParserBase.MORE_TO_PARSE},una),TextureAtlasParserState=(Jna.PARSE_XML=0,Jna.PARSE_IMAGE=1,Jna.PARSE_SUBTEXTURES=2,Jna.PARSE_COMPLETE=3,Jna),ShaderRegisterData=function(){this.textures=new Array,this.animatableAttributes=new Array,this.animationTargetRegisters=new Array},AttributesBuffer=(Kna=AssetBase,__extends(Lna,Kna),Object.defineProperty(Lna.prototype,"assetType",{get:function(){return Lna.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Lna.prototype,"stride",{get:function(){return this._lengthDirty&&this._updateLength(),this._stride},set:function(t){this._newStride!=t&&(this._newStride=t,this.resize())},enumerable:!0,configurable:!0}),Object.defineProperty(Lna.prototype,"count",{get:function(){return this._newCount},set:function(t){this._newCount!=t&&(this._newCount=t,this.resize())},enumerable:!0,configurable:!0}),Object.defineProperty(Lna.prototype,"buffer",{get:function(){return this._lengthDirty&&this._updateLength(),this._contentDirty=!1,this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(Lna.prototype,"bufferView",{get:function(){return this._lengthDirty&&this._updateLength(),this._contentDirty=!1,this._bufferView},set:function(t){this._bufferView=t,this._buffer=this._bufferView.buffer},enumerable:!0,configurable:!0}),Object.defineProperty(Lna.prototype,"length",{get:function(){return this._count*this.stride},enumerable:!0,configurable:!0}),Lna.prototype.invalidate=function(){this._contentDirty||(Kna.prototype.invalidate.call(this),this._contentDirty=!0)},Lna.prototype.resize=function(){this._lengthDirty||(this.clear(),this._lengthDirty=!0,this._newStride||(this._buffer=null,this._bufferView=null))},Lna.prototype.cloneBufferView=function(){var t=new Lna(this._stride,this._count);return t.bufferView.set(this.bufferView),t},Lna.prototype.clone=function(){var t=new Lna(this._stride,this._count);t.bufferView.set(this.bufferView);for(var e=this._viewVOs.length,i=0;i<e;i++)this._viewVOs[i].view._internalClone(t);return t},Lna.prototype.getView=function(t){return t<this._viewVOs.length?this._viewVOs[t].view:null},Lna.prototype._setAttributes=function(t,e,i){void 0===i&&(i=0);var n=e instanceof Uint8Array?e:new Uint8Array(e.buffer),r=this._viewVOs[t],o=r.length,s=r.offset,a=n.length/o;if(this.count<a+i&&(this.count=a+i),this._lengthDirty&&this._updateLength(),1==this._viewVOs.length)this._bufferView.set(n);else for(var l=0;l<a;l++)this._bufferView.set(n.subarray(l*o,(l+1)*o),(l+i)*this._stride+s);this.invalidate()},Lna.prototype._addView=function(t){var e=new ViewVO(t),i=this._viewVOs.length;e.offset=i?this._viewVOs[i-1].offset+this._viewVOs[i-1].length:0,this._viewVOs.push(e),this._newStride<e.offset+e.length&&(this._newStride=e.offset+e.length,this.resize()),t._index=i},Lna.prototype._removeView=function(t){var e=t._index,i=this._viewVOs.splice(e,1)[0],n=this._viewVOs.length;i.dispose();for(var r=e;r<n;r++)(i=this._viewVOs[r]).offset=r?this._viewVOs[r-1].offset+this._viewVOs[r-1].length:0,i.view._index=r;this._newStride=n?this._viewVOs[n-1].offset+this._viewVOs[n-1].length:0,this.resize()},Lna.prototype._getOffset=function(t){return this._viewVOs[t].offset},Lna.prototype._updateLength=function(){var t,e;this._lengthDirty=!1;var i=this._viewVOs.length,n=this._newStride*this._newCount;if(!this._buffer||this._buffer.byteLength!=n){var r,o,s,a,l=new ArrayBuffer(n),c=new Uint8Array(l,0,l.byteLength);if(this._buffer)if(this._stride!=this._newStride){for(t=0;t<i;t++){for(o=(r=this._viewVOs[t]).length,s=r.offset,a=r.oldOffset,e=0;e<this._count;e++)null!=a&&c.set(new Uint8Array(this._buffer,e*this._stride+a,o),e*this._newStride+s);r.oldOffset=r.offset}this._stride=this._newStride}else c.set(new Uint8Array(this._buffer,0,Math.min(n,this._buffer.byteLength)));this._buffer=l,this._bufferView=c}this._count=this._newCount},Lna.assetType="[assets AttributesBuffer]",Lna),ViewVO=(xoa.prototype.dispose=function(){this.view=null},xoa.prototype.clone=function(){return new xoa(this.view)},xoa),_Stage_AttributesBuffer=(zoa=AbstractionBase,__extends(Aoa,zoa),Aoa.prototype.onClear=function(t){zoa.prototype.onClear.call(this,t),this._attributesBuffer=null,this._indexBuffer&&(this._indexBuffer.dispose(),this._indexBuffer=null),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null)},Aoa.prototype.activate=function(t,e,i,n,r){void 0===r&&(r=!1),this._stage.setVertexBuffer(t,this._getVertexBuffer(),e,i,n,r)},Aoa.prototype.draw=function(t,e,i){this._stage.context.drawIndices(t,this._getIndexBuffer(),e,i)},Aoa.prototype._getIndexBuffer=function(){return this._indexBuffer||(this._invalid=!0,this._indexBuffer=this._stage.context.createIndexBuffer(this._attributesBuffer.count*this._attributesBuffer.stride/2)),this._invalid&&(this._invalid=!1,this._indexBuffer.uploadFromByteArray(this._attributesBuffer.buffer,0,this._attributesBuffer.length)),this._indexBuffer},Aoa.prototype._getVertexBuffer=function(){return this._vertexBuffer||(this._invalid=!0,this._vertexBuffer=this._stage.context.createVertexBuffer(this._attributesBuffer.count,this._attributesBuffer.stride)),this._invalid&&(this._invalid=!1,this._vertexBuffer.uploadFromByteArray(this._attributesBuffer.buffer,0,this._attributesBuffer.count)),this._vertexBuffer},Aoa),zoa,Kna,tna,fna,Rma,pma,Yla,Rla,Kla,zla,fla,Nka,mka,Uja;function Aoa(t,e){var i=zoa.call(this,t,e)||this;return i._stage=e,i._attributesBuffer=t,i}function xoa(t){this.view=t,this.length=t.size*t.dimensions}function Lna(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=Kna.call(this)||this;return i._count=0,i._newCount=0,i._stride=0,i._newStride=0,i._viewVOs=new Array,i._stride=i._newStride=t,i._count=i._newCount=e,i._buffer=new ArrayBuffer(i._stride*i._count),i._bufferView=new Uint8Array(i._buffer,0,i._buffer.byteLength),i}function Jna(){}function una(){var t=tna.call(this,URLLoaderDataFormat.TEXT)||this;return t._parseState=0,t}function gna(){return fna.call(this,URLLoaderDataFormat.TEXT)||this}function Sma(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=Rma.call(this,URLLoaderDataFormat.BLOB)||this;return i._factory=t||new DefaultGraphicsFactory,i._alphaChannel=e,i}function qma(t,e){void 0===e&&(e=!0);var i=pma.call(this)||this;return i._viewOffsetX=0,i._viewOffsetY=0,i._viewWidth=-1,i._viewHeight=-1,i._textureWidth=-1,i._textureHeight=-1,i._buffersInvalid=!0,i._renderToTextureRect=new Rectangle,i._stage=t,i._powerOfTwo=e,i}function Zla(){var e=Yla.call(this)||this;return e._stages=new Array(Zla.STAGE_MAX_QUANTITY),e._onContextCreatedDelegate=function(t){return e.onContextCreated(t)},e}function Sla(t,e){void 0===e&&(e=-1);var i=Rla.call(this)||this;return i._fxaaTask=new Filter3DFXAATask(t,e),i.addTask(i._fxaaTask),i}function Lla(t,e){void 0===e&&(e=1);var i=Kla.call(this)||this;return i._compositeTask=new Filter3DCompositeTask(t,e),i.addTask(i._compositeTask),i}function Ala(t,e,i){void 0===t&&(t=3),void 0===e&&(e=3),void 0===i&&(i=-1);var n=zla.call(this)||this;return n._hBlurTask=new Filter3DHBlurTask(t,i),n._vBlurTask=new Filter3DVBlurTask(e,i),n.addTask(n._hBlurTask),n.addTask(n._vBlurTask),n}function gla(t,e){void 0===e&&(e=-1);var i=fla.call(this)||this;return i._stepSize=1,i._amount=t,i._data=new Float32Array([0,0,0,1]),i.stepSize=e,i}function Oka(t,e){void 0===e&&(e=-1);var i=Nka.call(this)||this;return i._stepSize=1,i._amount=t,i._data=new Float32Array([0,0,0,1]),i.stepSize=e,i}function nka(t,e){void 0===t&&(t=1),void 0===e&&(e=-1);var i=mka.call(this)||this;return i._stepSize=1,i._data=new Float32Array(20),i._data.set([.299,.587,.114,0],0),i._data.set([.25,.5,.75,1],4),i._data.set([1/1024,1/1024,-1,1],8),i._data.set([1/128,1/8,8,0],12),i._data.set([1/3-.5,2/3-.5,-.5,.5],16),i.amount=t,i.stepSize=e,i}function Vja(t,e){void 0===e&&(e=1);var i=Uja.call(this)||this;return i._data=new Float32Array([e,.5,2,-1,0,0,0,0]),i._blendMode=t,i}Stage.registerAbstraction(_Stage_AttributesBuffer,AttributesBuffer);var AttributesView=(Noa=AssetBase,__extends(Ooa,Noa),Object.defineProperty(Ooa.prototype,"assetType",{get:function(){return Ooa.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"attributesBuffer",{get:function(){return this._attributesBuffer},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"size",{get:function(){return this._size},set:function(t){this._size!=t&&(this._size=t,this._attributesBuffer._removeView(this),this._attributesBuffer._addView(this))},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"dimensions",{get:function(){return this._dimensions},set:function(t){this._dimensions!=t&&(this._dimensions=t,this._attributesBuffer._removeView(this),this._attributesBuffer._addView(this))},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"unsigned",{get:function(){return this._unsigned},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"count",{get:function(){return this._attributesBuffer.count},set:function(t){this._attributesBuffer.count=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"offset",{get:function(){return this._attributesBuffer._getOffset(this._index)},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"length",{get:function(){return this._attributesBuffer.count*this._dimensions},enumerable:!0,configurable:!0}),Object.defineProperty(Ooa.prototype,"stride",{get:function(){return this._attributesBuffer.stride/this._size},enumerable:!0,configurable:!0}),Ooa.prototype.set=function(t,e){void 0===e&&(e=0),this._attributesBuffer._setAttributes(this._index,t instanceof Array?new this._arrayClass(t):t,e)},Ooa.prototype.get=function(t,e){return void 0===e&&(e=0),new this._arrayClass(this._attributesBuffer.buffer,e*this._attributesBuffer.stride+this.offset,t*this.stride-this.offset/this.size)},Ooa.prototype._internalClone=function(t){return this._cloneCache=new Ooa(this._arrayClass,this._dimensions,t,this._unsigned)},Ooa.prototype.clone=function(t){void 0===t&&(t=null),t&&this._internalClone(t),this._cloneCache||this._attributesBuffer.clone();var e=this._cloneCache;return this._cloneCache=null,e},Ooa.prototype.invalidate=function(){Noa.prototype.invalidate.call(this),this._attributesBuffer.invalidate()},Ooa.prototype.dispose=function(){this._attributesBuffer&&(this._attributesBuffer._removeView(this),this._attributesBuffer=null)},Ooa.assetType="[attributes AttributesView]",Ooa),Byte4Attributes=(cpa=AttributesView,__extends(dpa,cpa),Object.defineProperty(dpa.prototype,"assetType",{get:function(){return dpa.assetType},enumerable:!0,configurable:!0}),dpa.prototype.set=function(t,e){void 0===e&&(e=0),cpa.prototype.set.call(this,t,e)},dpa.prototype.get=function(t,e){return void 0===e&&(e=0),cpa.prototype.get.call(this,t,e)},dpa.prototype._internalClone=function(t){return this._cloneCache=new dpa(t,this._arrayClass==Uint8Array)},dpa.prototype.clone=function(t){return void 0===t&&(t=null),cpa.prototype.clone.call(this,t)},dpa.assetType="[attributes Byte4Attributes]",dpa),Float1Attributes=(mpa=AttributesView,__extends(npa,mpa),Object.defineProperty(npa.prototype,"assetType",{get:function(){return npa.assetType},enumerable:!0,configurable:!0}),npa.prototype.set=function(t,e){void 0===e&&(e=0),mpa.prototype.set.call(this,t,e)},npa.prototype.get=function(t,e){return void 0===e&&(e=0),mpa.prototype.get.call(this,t,e)},npa.prototype._internalClone=function(t){return this._cloneCache=new npa(t)},npa.prototype.clone=function(t){return void 0===t&&(t=null),mpa.prototype.clone.call(this,t)},npa.assetType="[attributes Float1Attributes]",npa),Float2Attributes=(vpa=AttributesView,__extends(wpa,vpa),Object.defineProperty(wpa.prototype,"assetType",{get:function(){return wpa.assetType},enumerable:!0,configurable:!0}),wpa.prototype.set=function(t,e){void 0===e&&(e=0),vpa.prototype.set.call(this,t,e)},wpa.prototype.get=function(t,e){return void 0===e&&(e=0),vpa.prototype.get.call(this,t,e)},wpa.prototype._internalClone=function(t){return this._cloneCache=new wpa(t)},wpa.prototype.clone=function(t){return void 0===t&&(t=null),vpa.prototype.clone.call(this,t)},wpa.assetType="[attributes Float2Attributes]",wpa),Float3Attributes=(Epa=AttributesView,__extends(Fpa,Epa),Object.defineProperty(Fpa.prototype,"assetType",{get:function(){return Fpa.assetType},enumerable:!0,configurable:!0}),Fpa.prototype.set=function(t,e){void 0===e&&(e=0),Epa.prototype.set.call(this,t,e)},Fpa.prototype.get=function(t,e){return void 0===e&&(e=0),Epa.prototype.get.call(this,t,e)},Fpa.prototype._internalClone=function(t){return this._cloneCache=new Fpa(t)},Fpa.prototype.clone=function(t){return void 0===t&&(t=null),Epa.prototype.clone.call(this,t)},Fpa.assetType="[attributes Float3Attributes]",Fpa),Float4Attributes=(Npa=AttributesView,__extends(Opa,Npa),Object.defineProperty(Opa.prototype,"assetType",{get:function(){return Opa.assetType},enumerable:!0,configurable:!0}),Opa.prototype.set=function(t,e){void 0===e&&(e=0),Npa.prototype.set.call(this,t,e)},Opa.prototype.get=function(t,e){return void 0===e&&(e=0),Npa.prototype.get.call(this,t,e)},Opa.prototype._internalClone=function(t){return this._cloneCache=new Opa(t)},Opa.prototype.clone=function(t){return void 0===t&&(t=null),Npa.prototype.clone.call(this,t)},Opa.assetType="[attributes Float4Attributes]",Opa),Short2Attributes=(Wpa=AttributesView,__extends(Xpa,Wpa),Object.defineProperty(Xpa.prototype,"assetType",{get:function(){return Xpa.assetType},enumerable:!0,configurable:!0}),Xpa.prototype.set=function(t,e){void 0===e&&(e=0),Wpa.prototype.set.call(this,t,e)},Xpa.prototype.get=function(t,e){return void 0===e&&(e=0),Wpa.prototype.get.call(this,t,e)},Xpa.prototype._internalClone=function(t){return this._cloneCache=new Xpa(t,this._arrayClass==Uint16Array)},Xpa.prototype.clone=function(t){return void 0===t&&(t=null),Wpa.prototype.clone.call(this,t)},Xpa.assetType="[attributes Short2Attributes]",Xpa),Short3Attributes=(eqa=AttributesView,__extends(fqa,eqa),Object.defineProperty(fqa.prototype,"assetType",{get:function(){return fqa.assetType},enumerable:!0,configurable:!0}),fqa.prototype.set=function(t,e){void 0===e&&(e=0),eqa.prototype.set.call(this,t,e)},fqa.prototype.get=function(t,e){return void 0===e&&(e=0),eqa.prototype.get.call(this,t,e)},fqa.prototype._internalClone=function(t){return this._cloneCache=new fqa(t,this._arrayClass==Uint16Array)},fqa.prototype.clone=function(t){return void 0===t&&(t=null),eqa.prototype.clone.call(this,t)},fqa.assetType="[attributes Short3Attributes]",fqa),eqa,Wpa,Npa,Epa,vpa,mpa,cpa,Noa;function fqa(t,e){return void 0===e&&(e=!0),eqa.call(this,e?Uint16Array:Int16Array,3,t,e)||this}function Xpa(t,e){return void 0===e&&(e=!0),Wpa.call(this,e?Uint16Array:Int16Array,2,t,e)||this}function Opa(t){return Npa.call(this,Float32Array,4,t)||this}function Fpa(t){return Epa.call(this,Float32Array,3,t)||this}function wpa(t){return vpa.call(this,Float32Array,2,t)||this}function npa(t){return mpa.call(this,Float32Array,1,t)||this}function dpa(t,e){return void 0===e&&(e=!0),cpa.call(this,e?Uint8Array:Int8Array,4,t,e)||this}function Ooa(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=!1);var r=Noa.call(this)||this;return r._arrayClass=t,r._size=t.BYTES_PER_ELEMENT,r._dimensions=e,r._attributesBuffer=i instanceof AttributesBuffer?i:new AttributesBuffer(r._dimensions*r._size,i),r._attributesBuffer._addView(r),r._unsigned=n,r}console.debug("AwayJS - Stage - 0.11.18"),Loader.enableParser(Image2DParser),Loader.enableParser(ImageCubeParser),Loader.enableParser(TextureAtlasParser);var AlignmentMode=(oqa.REGISTRATION_POINT="registrationPoint",oqa.TRANSFORM_POINT="transformPoint",oqa),HierarchicalProperties=(pqa.MOUSE_ENABLED=1,pqa.VISIBLE=2,pqa.MASK_ID=4,pqa.MASKS=8,pqa.COLOR_TRANSFORM=16,pqa.SCENE_TRANSFORM=32,pqa.ALL=63,pqa),OrientationMode=(qqa.DEFAULT="default",qqa.CAMERA_PLANE="cameraPlane",qqa.CAMERA_POSITION="cameraPosition",qqa),PickingCollision=function(t){this.normal=new Vector3D,this.rayPosition=new Vector3D,this.rayDirection=new Vector3D,this.entity=t},BoundingVolumeType,sqa;function qqa(){}function pqa(){}function oqa(){}sqa=BoundingVolumeType=BoundingVolumeType||{},sqa[sqa.SPHERE=0]="SPHERE",sqa[sqa.SPHERE_FAST=1]="SPHERE_FAST",sqa[sqa.SPHERE_BOUNDS=2]="SPHERE_BOUNDS",sqa[sqa.SPHERE_BOUNDS_FAST=3]="SPHERE_BOUNDS_FAST",sqa[sqa.BOX=4]="BOX",sqa[sqa.BOX_FAST=5]="BOX_FAST",sqa[sqa.BOX_BOUNDS=6]="BOX_BOUNDS",sqa[sqa.BOX_BOUNDS_FAST=7]="BOX_BOUNDS_FAST",sqa[sqa.NULL=8]="NULL";var BoundsPickerEvent=(tqa=EventBase,__extends(uqa,tqa),Object.defineProperty(uqa.prototype,"boundsPicker",{get:function(){return this._boundsPicker},enumerable:!0,configurable:!0}),uqa.prototype.clone=function(){return new uqa(this.type,this._boundsPicker)},uqa.INVALIDATE_BOUNDS="invalidateBounds",uqa),BoundingVolumeBase=(yqa=AbstractionBase,__extends(zqa,yqa),zqa.prototype._onInvalidateBounds=function(t){this._invalid=!0},zqa.prototype._onInvalidateMatrix3D=function(t){this._invalid=!0},zqa.prototype.onClear=function(t){if(yqa.prototype.onClear.call(this,t),this._picker.addEventListener(BoundsPickerEvent.INVALIDATE_BOUNDS,this._onInvalidateBoundsDelegate),this._targetCoordinateSpace){var e=this._picker.entity;if(this._targetCoordinateSpace.parent){for(;e&&e!=this._targetCoordinateSpace.parent;)e.transform.removeEventListener(TransformEvent.INVALIDATE_MATRIX3D,this._onInvalidateMatrix3DDelegate),e=e.parent;e||this._targetCoordinateSpace.transform.removeEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateMatrix3DDelegate)}else e.transform.removeEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateMatrix3DDelegate)}this._targetCoordinateSpace=null,this._picker=null},zqa.prototype.nullify=function(){throw new AbstractMethodError},zqa.prototype.isInFrustum=function(t,e){throw new AbstractMethodError},zqa.prototype.clone=function(){throw new AbstractMethodError},zqa.prototype.rayIntersection=function(t,e,i){return-1},zqa.prototype.classifyToPlane=function(t){throw new AbstractMethodError},zqa.prototype._update=function(){this._invalid=!1},zqa),BoundingBox=(Qqa=BoundingVolumeBase,__extends(Rqa,Qqa),Rqa.prototype.nullify=function(){this._x=this._y=this._z=0,this._width=this._height=this._depth=0,this._centerX=this._centerY=this._centerZ=0,this._halfExtentsX=this._halfExtentsY=this._halfExtentsZ=0},Rqa.prototype.isInFrustum=function(t,e){if(this._invalid&&this._update(),null!=this._box){for(var i=0;i<e;++i){var n=t[i],r=n.a,o=n.b,s=n.c,a=r<0?-this._halfExtentsX:this._halfExtentsX,l=o<0?-this._halfExtentsY:this._halfExtentsY,c=s<0?-this._halfExtentsZ:this._halfExtentsZ;if(r*(this._centerX+a)+o*(this._centerY+l)+s*(this._centerZ+c)-n.d<0)return!1}return!0}},Rqa.prototype.rayIntersection=function(t,e,i){return this._invalid&&this._update(),null==this._box?-1:this._box.rayIntersection(t,e,i)},Rqa.prototype.getBox=function(){return this._invalid&&this._update(),this._box},Rqa.prototype.classifyToPlane=function(t){var e=t.a,i=t.b,n=t.c,r=e*this._centerX+i*this._centerY+n*this._centerZ-t.d;e<0&&(e=-e),i<0&&(i=-i),n<0&&(n=-n);var o=e*this._halfExtentsX+i*this._halfExtentsY+n*this._halfExtentsZ;return o<r?PlaneClassification.FRONT:r<-o?PlaneClassification.BACK:PlaneClassification.INTERSECT},Rqa.prototype._update=function(){var t;Qqa.prototype._update.call(this),this._targetCoordinateSpace&&(this._targetCoordinateSpace==this._picker.entity?t=this._picker.entity.transform.matrix3D:(t=this._picker.entity.transform.concatenatedMatrix3D.clone(),this._targetCoordinateSpace.parent&&t.append(this._targetCoordinateSpace.parent.transform.inverseConcatenatedMatrix3D))),this._box=this._picker._getBoxBoundsInternal(t,this._strokeFlag,this._fastFlag,this._box),null!=this._box&&(this._halfExtentsX=this._box.width/2,this._halfExtentsY=this._box.height/2,this._halfExtentsZ=this._box.depth/2,this._centerX=this._box.x+this._halfExtentsX,this._centerY=this._box.y+this._halfExtentsY,this._centerZ=this._box.z+this._halfExtentsZ)},Rqa),BoundingSphere=(lra=BoundingVolumeBase,__extends(mra,lra),mra.prototype.nullify=function(){this._centerX=this._centerY=this._centerZ=0,this._radius=0},mra.prototype.isInFrustum=function(t,e){this._invalid&&this._update();for(var i=0;i<e;++i){var n=t[i],r=n.a<0?-this._radius:this._radius,o=n.b<0?-this._radius:this._radius,s=n.c<0?-this._radius:this._radius;if(n.a*(this._centerX+r)+n.b*(this._centerY+o)+n.c*(this._centerZ+s)-n.d<0)return!1}return!0},mra.prototype.rayIntersection=function(t,e,i){return this._invalid&&this._update(),this._sphere.rayIntersection(t,e,i)},mra.prototype.getSphere=function(){return this._invalid&&this._update(),this._sphere},mra.prototype.classifyToPlane=function(t){var e=t.a,i=t.b,n=t.c,r=e*this._centerX+i*this._centerY+n*this._centerZ-t.d;e<0&&(e=-e),i<0&&(i=-i),n<0&&(n=-n);var o=(e+i+n)*this._radius;return o<r?PlaneClassification.FRONT:r<-o?PlaneClassification.BACK:PlaneClassification.INTERSECT},mra.prototype._update=function(){var t;lra.prototype._update.call(this),this._targetCoordinateSpace&&(this._targetCoordinateSpace==this._picker.entity?t=this._picker.entity.transform.matrix3D:(t=this._picker.entity.transform.concatenatedMatrix3D.clone(),this._targetCoordinateSpace.parent&&t.append(this._targetCoordinateSpace.parent.transform.inverseConcatenatedMatrix3D))),this._sphere=this._picker._getSphereBoundsInternal(null,t,this._strokeFlag,this._fastFlag,this._sphere);var e=this._picker.entity.transform.concatenatedMatrix3D,i=this._sphere.x,n=this._sphere.y,r=this._sphere.z,o=this._sphere.radius,s=e._rawData,a=s[0],l=s[4],c=s[8],h=s[12],u=s[1],p=s[5],d=s[9],_=s[13],f=s[2],m=s[6],g=s[10],y=s[14];this._centerX=i*a+n*l+r*c+h,this._centerY=i*u+n*p+r*d+_,this._centerZ=i*f+n*m+r*g+y;var b=a+l+c,v=u+p+d,x=f+m+g;this._radius=o*Math.sqrt((b*b+v*v+x*x)/3)},mra),NullBounds=($ra=BoundingVolumeBase,__extends(_ra,$ra),_ra.prototype.isInFrustum=function(t,e){return!0},_ra.prototype.classifyToPlane=function(t){return PlaneClassification.INTERSECT},_ra),_a,_b,_c,BoundingVolumePool=(Object.defineProperty(dsa.prototype,"picker",{get:function(){return this._picker},enumerable:!0,configurable:!0}),Object.defineProperty(dsa.prototype,"strokeFlag",{get:function(){return this._strokeFlag},enumerable:!0,configurable:!0}),Object.defineProperty(dsa.prototype,"fastFlag",{get:function(){return this._fastFlag},enumerable:!0,configurable:!0}),dsa.prototype.getAbstraction=function(t){var e=t?t.id:-1;return this._boundingVolumePool[e]||(this._boundingVolumePool[e]=new this._boundingVolumeClass(t,this))},dsa.prototype.clearAbstraction=function(t){delete this._boundingVolumePool[t?t.id:-1]},dsa.prototype.dispose=function(){for(var t in this._boundingVolumePool)this._boundingVolumePool[t].onClear(null)},dsa._strokeDict=((_a={})[BoundingVolumeType.BOX]=!1,_a[BoundingVolumeType.BOX_FAST]=!1,_a[BoundingVolumeType.BOX_BOUNDS]=!0,_a[BoundingVolumeType.BOX_BOUNDS_FAST]=!0,_a[BoundingVolumeType.SPHERE]=!1,_a[BoundingVolumeType.SPHERE_FAST]=!1,_a[BoundingVolumeType.SPHERE_BOUNDS]=!0,_a[BoundingVolumeType.SPHERE_FAST]=!0,_a[BoundingVolumeType.NULL]=!1,_a),dsa._fastDict=((_b={})[BoundingVolumeType.BOX]=!1,_b[BoundingVolumeType.BOX_FAST]=!0,_b[BoundingVolumeType.BOX_BOUNDS]=!1,_b[BoundingVolumeType.BOX_BOUNDS_FAST]=!0,_b[BoundingVolumeType.SPHERE]=!1,_b[BoundingVolumeType.SPHERE_FAST]=!0,_b[BoundingVolumeType.SPHERE_BOUNDS]=!1,_b[BoundingVolumeType.SPHERE_FAST]=!0,_b[BoundingVolumeType.NULL]=!1,_b),dsa._boundsDict=((_c={})[BoundingVolumeType.BOX]=BoundingBox,_c[BoundingVolumeType.BOX_FAST]=BoundingBox,_c[BoundingVolumeType.BOX_BOUNDS]=BoundingBox,_c[BoundingVolumeType.BOX_BOUNDS_FAST]=BoundingBox,_c[BoundingVolumeType.SPHERE]=BoundingSphere,_c[BoundingVolumeType.SPHERE_FAST]=BoundingSphere,_c[BoundingVolumeType.SPHERE_BOUNDS]=BoundingSphere,_c[BoundingVolumeType.SPHERE_FAST]=BoundingSphere,_c[BoundingVolumeType.NULL]=NullBounds,_c),dsa),PickEntity=(ksa=AbstractionBase,__extends(lsa,ksa),Object.defineProperty(lsa.prototype,"pickingCollision",{get:function(){return this._pickingCollision},enumerable:!0,configurable:!0}),Object.defineProperty(lsa.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(lsa.prototype,"entity",{get:function(){return this._entity},enumerable:!0,configurable:!0}),Object.defineProperty(lsa.prototype,"pickGroup",{get:function(){return this._pickGroup},enumerable:!0,configurable:!0}),lsa.prototype.getBoundingVolume=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),null==e&&(e=this._entity.defaultBoundingVolume),(this._boundingVolumePools[e]||(this._boundingVolumePools[e]=new BoundingVolumePool(this,e))).getAbstraction(t)},lsa.prototype.hitTestPoint=function(t,e,i){return void 0===i&&(i=!1),this._hitTestPointInternal(this._entity,t,e,i,!1)},lsa.prototype._hitTestPointInternal=function(t,e,i,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),!(-1==this._entity.maskId||r&&n))return!1;this._invalid&&this._update();var o=new Point(e,i);this._entity.transform.globalToLocal(o,o);var s=this._getBoxBoundsInternal(null,!1,!0);if(null==s||!s.contains(o.x,o.y,0))return!1;if(!n||"[asset TextField]"==this._entity.assetType||"[asset Billboard]"==this._entity.assetType)return!0;for(var a=this._pickables.length,l=!1,c=0;c<a;c++)if(this._pickables[c].hitTestPoint(o.x,o.y,0)){l=!0;break}if(!l)return!1;var h=this._entity.maskOwners;if(h)for(var u,p,d,_,f=h.length,c=0;c<f;c++)if((u=h[c]).isDescendant(t)){d=(p=u.masks).length,_=!1;for(var m=0;m<d;m++)if((u=p[m]).isDescendant(t)&&u&&this._pickGroup.getBoundsPicker(u.partition)._hitTestPointInternal(t,e,i,n,!0)){_=!0;break}if(!_)return!1}return!0},lsa.prototype.isInFrustum=function(t,e){return this._isInFrustumInternal(this._entity,t,e)},lsa.prototype._isInFrustumInternal=function(t,e,i){return this.getBoundingVolume(t).isInFrustum(e,i)},lsa.prototype.isIntersectingRay=function(t,e){return this._isIntersectingRayInternal(this._entity,t,e)},lsa.prototype._isIntersectingRayInternal=function(t,e,i){var n=this._entity.transform.inverseConcatenatedMatrix3D;n.transformVector(e,this._pickingCollision.rayPosition),n.deltaTransformVector(i,this._pickingCollision.rayDirection);var r=this.getBoundingVolume().rayIntersection(this._pickingCollision.rayPosition,this._pickingCollision.rayDirection,this._pickingCollision.normal);return!(r<0||!this._isIntersectingMasks(t,e,i)||(this._pickingCollision.rayEntryDistance=r,this._pickingCollision.globalRayPosition=e,this._pickingCollision.globalRayDirection=i,this._pickingCollision.rayOriginIsInsideBounds=0==r,0))},lsa.prototype.isIntersectingShape=function(t){for(var e=!1,i=0;i<this._pickables.length;i++)if(this._pickables[i].testCollision(this._pickingCollision,t)){if(!t)return!0;e=!0}return e},lsa.prototype.getBoxBounds=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=!1),void 0===i&&(i=!1),this._getBoxBoundsInternal(t?t.transform.matrix3D:null,e,i)},lsa.prototype._getBoxBoundsInternal=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=null),this._invalid&&this._update();var o=this._pickables.length;if(o)if(i){var s,a=e?1:0;if(this._orientedBoxBoundsDirty[a]){this._orientedBoxBoundsDirty[a]=!1;for(var l=0;l<o;l++)s=this._pickables[l].getBoxBounds(null,e,this._orientedBoxBounds[a],s);this._orientedBoxBounds[a]=s}else s=this._orientedBoxBounds[a];null!=s&&(r=t?t.transformBox(s).union(r,r||n):s.union(r,r||n))}else for(l=0;l<o;l++)r=this._pickables[l].getBoxBounds(t,e,n,r);return r},lsa.prototype.getSphereBounds=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=!1),void 0===i&&(i=!1),this._getSphereBoundsInternal(null,t?t.transform.matrix3D:null,e,i)},lsa.prototype._getSphereBoundsInternal=function(t,e,i,n,r,o){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===r&&(r=null),void 0===o&&(o=null),this._invalid&&this._update();var s=this._getBoxBoundsInternal(e,i);if(null!=s){t||((t=new Vector3D).x=s.x+s.width/2,t.y=s.y+s.height/2,t.z=s.z+s.depth/2);var a=this._pickables.length;if(a)if(n){var l,c=i?1:0;if(this._orientedSphereBoundsDirty[c]){this._orientedSphereBoundsDirty[c]=!1;for(var h=0;h<a;h++)l=this._pickables[h].getSphereBounds(t,null,i,this._orientedSphereBounds[c],l);this._orientedSphereBounds[c]=l}else l=this._orientedSphereBounds[c];null!=l&&(o=e?e.transformSphere(l).union(o,o||r):l.union(o,o||r))}else for(h=0;h<a;h++)o=this._pickables[h].getSphereBounds(t,e,i,r,o);return o}},lsa.prototype.applyTraversable=function(t){this._pickables.push(this.getAbstraction(t))},lsa.prototype.onInvalidate=function(t){ksa.prototype.onInvalidate.call(this,t),this._pickables=[],this._orientedBoxBoundsDirty[0]=!0,this._orientedBoxBoundsDirty[1]=!0,this._orientedSphereBoundsDirty[0]=!0,this._orientedSphereBoundsDirty[1]=!0,this.dispatchEvent(new BoundsPickerEvent(BoundsPickerEvent.INVALIDATE_BOUNDS,this))},lsa.prototype.onClear=function(t){for(var e in ksa.prototype.onClear.call(this,t),this._boundingVolumePools)this._boundingVolumePools[e].dispose(),delete this._boundingVolumePools[e];for(var e in this._pickablePool)this._pickablePool[e].onClear(null)},lsa.prototype.getAbstraction=function(t){return this._pickablePool[t.id]||(this._pickablePool[t.id]=new lsa._pickPickableClassPool[t.assetType](t,this))},lsa.prototype.clearAbstraction=function(t){delete this._pickablePool[t.id],this.onInvalidate(null)},lsa.registerPickable=function(t,e){lsa._pickPickableClassPool[e.assetType]=t},lsa.prototype._update=function(){this._invalid=!1,this._entity._acceptTraverser(this)},lsa.prototype._isIntersectingMasks=function(t,e,i){var n=this._entity.maskOwners;if(n)for(var r,o,s,a,l=n.length,c=0;c<l;c++)if((r=n[c]).isDescendant(t)){s=(o=r.masks).length,a=!1;for(var h=0;h<s;h++)if((r=o[h]).isDescendant(t)&&r&&this._pickGroup.getRaycastPicker(r.partition)._getCollisionInternal(e,i,!0,!0)){a=!0;break}if(!a)return!1}return!0},lsa._pickPickableClassPool=new Object,lsa),_Pick_PickableBase=(Sta=AbstractionBase,__extends(Tta,Sta),Tta.prototype.onClear=function(t){Sta.prototype.onClear.call(this,t),this._view=null},Tta.prototype.hitTestPoint=function(t,e,i){throw new AbstractMethodError},Tta.prototype.getBoxBounds=function(t,e,i,n){return void 0===n&&(n=null),n},Tta.prototype.getSphereBounds=function(t,e,i,n,r){return void 0===r&&(r=null),r},Tta.prototype.testCollision=function(t,e){throw new AbstractMethodError},Tta),ViewEvent=(kua=EventBase,__extends(lua,kua),Object.defineProperty(lua.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),lua.INVALIDATE_VIEW_MATRIX3D="invalidateViewMatrix3D",lua.INVALIDATE_SIZE="invalidateSize",lua),NodeBase=(Object.defineProperty(pua.prototype,"entity",{get:function(){return this._entity},enumerable:!0,configurable:!0}),Object.defineProperty(pua.prototype,"pickObject",{get:function(){return this._entity.pickObject},enumerable:!0,configurable:!0}),Object.defineProperty(pua.prototype,"boundsVisible",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(pua.prototype,"maskId",{get:function(){return this._entity.maskId},enumerable:!0,configurable:!0}),pua.prototype.getBoundsPrimitive=function(t){throw new AbstractMethodError},pua.prototype.isInFrustum=function(t,e,i,n){return!!this._entity._iIsVisible()},pua.prototype.isVisible=function(){return this._entity._iIsVisible()},pua.prototype.isIntersectingRay=function(t,e,i,n){return!0},pua.prototype.isRenderable=function(){return!0},pua.prototype.isCastingShadow=function(){return!0},pua.prototype.dispose=function(){this.parent=null,this._childNodes=null},pua.prototype.acceptTraverser=function(t){if(this._partition.root==this._entity&&this._partition.updateEntities(),(t.partition==this._partition||t==t.getTraverser(this._partition))&&t.enterNode(this))for(var e=0;e<this._numChildNodes;e++)this._childNodes[e].acceptTraverser(t)},pua.prototype.iAddNode=function(t){(t.parent=this)._childNodes[this._numChildNodes++]=t},pua.prototype.iRemoveNode=function(t){var e=this._childNodes.indexOf(t);this._childNodes[e]=this._childNodes[--this._numChildNodes],this._childNodes.pop()},pua),PartitionBase=(Gua=AssetBase,__extends(Hua,Gua),Object.defineProperty(Hua.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(Hua.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(Hua.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Hua.prototype.addChild=function(t){return t&&t.parent&&t.parent.removeChildInternal(t),this._children.push(t),t._setParent(this),t},Hua.prototype.removeChild=function(t){return this.removeChildInternal(t),t._setParent(null),t},Hua.prototype.removeChildInternal=function(t){return this._children.splice(this._children.indexOf(t),1)[0]},Hua.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new Hua._abstractionClassPool[t.assetType](t,this))},Hua.prototype.getPartition=function(t){return null},Hua.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},Hua.prototype.traverse=function(t){this.isUpdated=this._invalid,this._invalid=!1,this._rootNode.acceptTraverser(t)},Hua.prototype.invalidateEntity=function(t){this._invalid||this.invalidate(),this._updateQueue[t.id]=t},Hua.prototype.updateEntity=function(t){t._iInternalUpdate(),this.updateNode(this.getAbstraction(t))},Hua.prototype.updateNode=function(t){var e=this.findParentForNode(t);e&&t.parent!=e&&(t.parent&&t.parent.iRemoveNode(t),e.iAddNode(t))},Hua.prototype.clearEntity=function(t){this._invalid||this.invalidate(),delete this._updateQueue[t.id],this.clearNode(this.getAbstraction(t))},Hua.prototype.clearNode=function(t){t.parent&&(t.parent.iRemoveNode(t),t.parent=null)},Hua.prototype.findParentForNode=function(t){return this._rootNode},Hua.prototype.updateEntities=function(){for(var t in this._updateQueue)this.updateEntity(this._updateQueue[t]);this._updateQueue={}},Hua.prototype.invalidate=function(){this._invalid=!0,Gua.prototype.invalidate.call(this),this._parent&&this._parent.invalidate()},Hua.prototype.dispose=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},Hua.prototype._setParent=function(t){this._parent&&(this._parent.clearNode(this._rootNode),this._parent.invalidate()),(this._parent=t)&&(t.updateNode(this._rootNode),t.invalidate()),this._setScene(t?t.scene:null)},Hua.prototype._setScene=function(t){if(this._scene!=t){this._scene=t;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._setScene(t)}},Hua.prototype._onRootClear=function(t){this.clear(),this._abstractionPool},Hua.registerAbstraction=function(t,e){Hua._abstractionClassPool[e.assetType]=t},Hua._abstractionClassPool=new Object,Hua),BasicPartition=(hva=PartitionBase,__extends(iva,hva),iva),EntityNode=(lva=AbstractionBase,__extends(mva,lva),Object.defineProperty(mva.prototype,"entity",{get:function(){return this._asset},enumerable:!0,configurable:!0}),Object.defineProperty(mva.prototype,"pickObject",{get:function(){return this._asset.pickObject},enumerable:!0,configurable:!0}),Object.defineProperty(mva.prototype,"boundsVisible",{get:function(){return this._asset.boundsVisible},enumerable:!0,configurable:!0}),Object.defineProperty(mva.prototype,"maskId",{get:function(){return this._asset.maskId},enumerable:!0,configurable:!0}),mva.prototype.getBoundsPrimitive=function(t){return this._asset.getBoundsPrimitive(t)},mva.prototype.isCastingShadow=function(){return this._asset.castsShadows},mva.prototype.onClear=function(t){this._pool.clearEntity(this._asset),lva.prototype.onClear.call(this,t)},mva.prototype.isInFrustum=function(t,e,i,n){return!!this._asset._iIsVisible()},mva.prototype.isVisible=function(){return this._asset._iIsVisible()},mva.prototype.isIntersectingRay=function(t,e,i,n){return n.getAbstraction(this._asset)._isIntersectingRayInternal(t,e,i)},mva.prototype.isRenderable=function(){return this._asset._iAssignedColorTransform()._isRenderable()},mva.prototype.acceptTraverser=function(t){t.enterNode(this)&&t.applyEntity(this._asset)},mva),RaycastPicker=(Ava=AbstractionBase,__extends(Bva,Ava),Object.defineProperty(Bva.prototype,"partition",{get:function(){return this._partition},enumerable:!0,configurable:!0}),Object.defineProperty(Bva.prototype,"entity",{get:function(){return this._entity},enumerable:!0,configurable:!0}),Bva.prototype.traverse=function(){this._entities.length=0,this._pickers.length=0,this._partition.traverse(this)},Bva.prototype.getTraverser=function(t){if(t.root._iIsMouseEnabled()||t.root.isDragEntity()){var e=this._pickGroup.getRaycastPicker(t);return e._isIntersectingRayInternal(this._rootEntity,this._globalRayPosition,this._globalRayDirection,this._shapeFlag)&&this._pickers.push(e),e}return this},Object.defineProperty(Bva.prototype,"dragEntity",{get:function(){return this._dragEntity},set:function(t){this._dragEntity!=t&&(this._dragEntity&&this._dragEntity._stopDrag(),this._dragEntity=t,this._dragEntity&&this._dragEntity._startDrag())},enumerable:!0,configurable:!0}),Bva.prototype.enterNode=function(t){return!(!t.isVisible()||t.maskId!=this._rootEntity.maskId)&&(t.pickObject?(t.pickObject.partition.traverse(this),!1):t.isIntersectingRay(this._rootEntity,this._globalRayPosition,this._globalRayDirection,this._pickGroup))},Bva.prototype.isIntersectingRay=function(t,e,i){return void 0===i&&(i=!1),this._isIntersectingRayInternal(this._entity,t,e,i)},Bva.prototype._isIntersectingRayInternal=function(t,e,i,n){return this._rootEntity=t,this._globalRayPosition=e,this._globalRayDirection=i,this._shapeFlag=this.shapeFlag||n,this.traverse(),!(!this._entities.length&&!this._pickers.length)},Bva.prototype.getCollision=function(t,e,i){return void 0===i&&(i=!1),this._getCollisionInternal(t,e,i,!1)},Bva.prototype._getCollisionInternal=function(t,e,i,n){if(!this._isIntersectingRayInternal(this._entity,t,e,i))return null;this._collectEntities(this._collectedEntities,this._dragEntity);var r=this._getPickingCollision();return this._collectedEntities.length=0,r},Bva.prototype._collectEntities=function(t,e){for(var i,n,r=this._pickers.length,o=0;o<r;o++)(i=this._pickers[o]).entity!=e&&i._collectEntities(t,e);for(o=0;o<this._entities.length;++o)(n=this._entities[o]).pickingCollision.pickerEntity=this._entity,t.push(n)},Bva.prototype.setIgnoreList=function(t){this._ignoredEntities=t},Bva.prototype.isIgnored=function(t){if(this._ignoredEntities)for(var e=this._ignoredEntities.length,i=0;i<e;i++)if(this._ignoredEntities[i]==t)return!0;return!1},Bva.prototype.sortOnNearT=function(t,e){return t.pickingCollision.rayEntryDistance>e.pickingCollision.rayEntryDistance?1:t.pickingCollision.rayEntryDistance<e.pickingCollision.rayEntryDistance?-1:0},Bva.prototype._getPickingCollision=function(){var t,e,i;this._collectedEntities=this._collectedEntities.sort(this.sortOnNearT);for(var n=this._collectedEntities.length,r=0;r<n&&(e=(t=this._collectedEntities[r]).pickingCollision,null==i||e.rayEntryDistance<i.rayEntryDistance);r++)if(this._shapeFlag||t.shapeFlag)e.rayEntryDistance=Number.MAX_VALUE,t.isIntersectingShape(this.findClosestCollision)&&(i=e);else if(!e.rayOriginIsInsideBounds){i=e;break}return i&&this.updatePosition(i),this._dragEntity&&"[asset MovieClip]"==this._dragEntity.assetType&&this._dragEntity.adapter&&this._dragEntity.adapter.setDropTarget(i?i.entity:null),i},Bva.prototype.updatePosition=function(t){var e=t.position||(t.position=new Vector3D),i=t.rayDirection,n=t.rayPosition,r=t.rayEntryDistance;e.x=n.x+r*i.x,e.y=n.y+r*i.y,e.z=n.z+r*i.z},Bva.prototype.dispose=function(){},Bva.prototype.applyEntity=function(t){var e;this.isIgnored(t)||(e=this._pickGroup.getAbstraction(t),this._entities.push(e))},Bva),BoundsPicker=(vwa=AbstractionBase,__extends(wwa,vwa),Object.defineProperty(wwa.prototype,"partition",{get:function(){return this._partition},enumerable:!0,configurable:!0}),Object.defineProperty(wwa.prototype,"entity",{get:function(){return this._entity},enumerable:!0,configurable:!0}),Object.defineProperty(wwa.prototype,"width",{get:function(){var t=this.getBoxBounds();return null==t?0:t.width*this._entity.transform.scale.x},set:function(t){var e=this.getBoxBounds();null!=e&&0!=e.width&&this._entity.transform.scaleTo(t/e.width,this._entity.transform.scale.y,this._entity.transform.scale.z)},enumerable:!0,configurable:!0}),Object.defineProperty(wwa.prototype,"height",{get:function(){var t=this.getBoxBounds();return null==t?0:t.height*this._entity.transform.scale.y},set:function(t){var e=this.getBoxBounds();null!=e&&0!=e.height&&this._entity.transform.scaleTo(this._entity.transform.scale.x,t/e.height,this._entity.transform.scale.z)},enumerable:!0,configurable:!0}),Object.defineProperty(wwa.prototype,"depth",{get:function(){var t=this.getBoxBounds();return null==t?0:t.depth*this._entity.transform.scale.z},set:function(t){var e=this.getBoxBounds();null!=e&&0!=e.depth&&this._entity.transform.scaleTo(this._entity.transform.scale.x,this._entity.transform.scale.y,t/e.depth)},enumerable:!0,configurable:!0}),wwa.prototype.onInvalidate=function(t){vwa.prototype.onInvalidate.call(this,t),this.dispatchEvent(new BoundsPickerEvent(BoundsPickerEvent.INVALIDATE_BOUNDS,this))},wwa.prototype.traverse=function(){this._boundsPickers.length=0,this._partition.traverse(this),this._invalid=!1},wwa.prototype.getTraverser=function(t){var e=this._pickGroup.getBoundsPicker(t);return this._invalid&&this._boundsPickers.push(e),e},wwa.prototype.enterNode=function(t){return!0},wwa.prototype.getBoundingVolume=function(t,e){return void 0===t&&(t=null),void 0===e&&(e=null),null==e&&(e=this._entity.defaultBoundingVolume),(this._boundingVolumePools[e]||(this._boundingVolumePools[e]=new BoundingVolumePool(this,e))).getAbstraction(t)},wwa.prototype.getBoxBounds=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=!1),void 0===i&&(i=!1),this.getBoundingVolume(t,e?i?BoundingVolumeType.BOX_BOUNDS_FAST:BoundingVolumeType.BOX_BOUNDS:i?BoundingVolumeType.BOX_FAST:BoundingVolumeType.BOX).getBox()},wwa.prototype.getSphereBounds=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=!1),void 0===i&&(i=!1),this.getBoundingVolume(t,e?i?BoundingVolumeType.SPHERE_BOUNDS_FAST:BoundingVolumeType.SPHERE_BOUNDS:i?BoundingVolumeType.SPHERE_FAST:BoundingVolumeType.SPHERE).getSphere()},wwa.prototype.hitTestPoint=function(t,e,i){return void 0===i&&(i=!1),this._hitTestPointInternal(this._entity,t,e,i,!1)},wwa.prototype._hitTestPointInternal=function(t,e,i,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=!1),!(-1==this._entity.maskId||r&&n))return!1;this._invalid&&this.traverse();var o=new Point(e,i);this._entity.transform.globalToLocal(o,o);var s=this.getBoxBounds(null,!1,!0);if(null==s||!s.contains(o.x,o.y,0))return!1;if(!n||"[asset TextField]"==this._entity.assetType||"[asset Billboard]"==this._entity.assetType)return!0;var a=this._boundsPickers.length;if(a)for(var l=0;l<a;++l)if(this._boundsPickers[l]._hitTestPointInternal(t,e,i,n,r))return!0},wwa.prototype.hitTestObject=function(t){var e=t.getBoxBounds(this._entity,!0,!0);if(null==e)return!1;var i=this.getBoxBounds(this._entity,!0,!0);return null!=i&&!!e.intersects(i)&&!!t.getBoxBounds(this._entity,!0).intersects(this.getBoxBounds(this._entity,!0))},wwa.prototype._getBoxBoundsInternal=function(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=null),this._invalid&&this.traverse();var o=this._boundsPickers.length;if(0<o)for(var s=new Matrix3D,a=0;a<o;++a)r=this._boundsPickers[a].entity!=this._entity?(t?s.copyFrom(t):s.identity(),s.prepend(this._boundsPickers[a].entity.transform.matrix3D),this._boundsPickers[a].entity._registrationMatrix3D&&s.prepend(this._boundsPickers[a].entity._registrationMatrix3D),this._boundsPickers[a]._getBoxBoundsInternal(s,e,i,n,r)):this._boundsPickers[a]._getBoxBoundsInternal(t,e,i,n,r);return r},wwa.prototype._getSphereBoundsInternal=function(t,e,i,n,r,o){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=!0),void 0===r&&(r=null),void 0===o&&(o=null),this._invalid&&this.traverse();var s=this._getBoxBoundsInternal(e,i,n);if(null!=s){t||((t=new Vector3D).x=s.x+s.width/2,t.y=s.y+s.height/2,t.z=s.z+s.depth/2);var a=this._boundsPickers.length;if(0<a)for(var l=new Matrix3D,c=0;c<a;++c)o=this._boundsPickers[c].entity!=this._entity?(e?l.copyFrom(e):l.identity(),l.prepend(this._boundsPickers[c].entity.transform.matrix3D),this._boundsPickers[c].entity._registrationMatrix3D&&l.prepend(this._boundsPickers[c].entity._registrationMatrix3D),this._boundsPickers[c]._getSphereBoundsInternal(t,l,i,n,r,o)):this._boundsPickers[c]._getSphereBoundsInternal(t,e,i,n,r,o);return o}},wwa.prototype.isInFrustum=function(t,e){return this._isInFrustumInternal(this._entity,t,e)},wwa.prototype._isInFrustumInternal=function(t,e,i){return this.getBoundingVolume(t).isInFrustum(e,i)},wwa.prototype.onClear=function(t){for(var e in vwa.prototype.onClear.call(this,t),this._boundingVolumePools)this._boundingVolumePools[e].dispose(),delete this._boundingVolumePools[e]},wwa.prototype.dispose=function(){},wwa.prototype.applyEntity=function(t){this._boundsPickers.push(this._pickGroup.getAbstraction(t))},wwa),TabPicker=(Jxa=AbstractionBase,__extends(Kxa,Jxa),Object.defineProperty(Kxa.prototype,"partition",{get:function(){return this._partition},enumerable:!0,configurable:!0}),Object.defineProperty(Kxa.prototype,"entity",{get:function(){return this._entity},enumerable:!0,configurable:!0}),Kxa.prototype.sortTabEnabledEntities=function(){if(!(this._customTabEntities.length<=0&&this._tabEntities.length<=0)){var t,e=[],i=0,n=0;if(0<this._customTabEntities.length)for(;i<this._customTabEntities.length;)this._customTabEntities[i]&&(this._customTabEntities[i]=this._customTabEntities[i].reverse()),i++;else{for(t=this._tabEntities.length,i=0;i<t;i++){var r=this._tabEntities[i],o=r.transform.concatenatedMatrix3D.position,s=Math.floor(o.y/10);e.length<=s&&(e.length=s+1),e[s]||(e[s]=[]),e[s].push(r)}for(i=this._tabEntities.length=0;i<e.length;i++){var a=e[i];if(a)for(a=a.sort(function(t,e){return t.transform.concatenatedMatrix3D.position.x>e.transform.concatenatedMatrix3D.position.x?1:-1}),n=0;n<a.length;n++)this._tabEntities[this._tabEntities.length]=a[n]}}}},Kxa.prototype.traverse=function(){this._tabEntities.length=0,this._customTabEntities.length=0,this._customTabEntitiesSorted.length=0,this._partition.traverse(this),this.sortTabEnabledEntities(),this._invalid=!1},Kxa.prototype.getTraverser=function(t){return this},Kxa.prototype.getNextTabEntity=function(t){if(this._invalid&&this.traverse(),this._customTabEntities.length<=0&&this._tabEntities.length<=0)return t;if(0<this._customTabEntities.length){var e=0,i=0,n=0,r=0;if(t)for(;e<this._customTabEntities.length;){if(this._customTabEntities[e])for(n=0;n<this._customTabEntities[e].length;n++)if(this._customTabEntities[e][n]==t){for(r=n+1;r<this._customTabEntities[e].length;){if(this._customTabEntities[e][r])return this._customTabEntities[e][r];r++}for(i=e+1;i<this._customTabEntities.length;){if(this._customTabEntities[i])for(r=0;r<this._customTabEntities[i].length;r++)if(this._customTabEntities[i][r])return this._customTabEntities[i][r];i++}for(i=0;i<this._customTabEntities.length;){if(this._customTabEntities[i])for(r=0;r<this._customTabEntities[i].length;r++)if(this._customTabEntities[i][r])return this._customTabEntities[i][r];i++}}e++}for(i=0;i<this._customTabEntities.length;){if(this._customTabEntities[i])for(r=0;r<this._customTabEntities[i].length;r++)if(this._customTabEntities[i][r])return this._customTabEntities[i][r];i++}return t}for(var o=this._tabEntities.length,e=0;e<o;e++)if(this._tabEntities[e]==t)return e==o-1?this._tabEntities[0]:this._tabEntities[e+1];return this._tabEntities[0]},Kxa.prototype.getPrevTabEntity=function(t){if(this._invalid&&this.traverse(),this._customTabEntities.length<=0&&this._tabEntities.length<=0)return t;if(0<this._customTabEntities.length){var e=this._customTabEntities.length,i=0,n=0,r=0;if(t)for(;0<e;)if(e--,this._customTabEntities[e])for(n=this._customTabEntities[e].length-1;0<=n;n--)if(this._customTabEntities[e][n]==t){for(r=n-1;0<r;)if(r--,this._customTabEntities[e][r])return this._customTabEntities[e][r];for(i=e-1;0<i;)if(i--,this._customTabEntities[i])for(r=this._customTabEntities[i].length-1;0<=r;r--)if(this._customTabEntities[i][r])return this._customTabEntities[i][r];for(i=this._customTabEntities.length;0<i;)if(i--,this._customTabEntities[i])for(r=this._customTabEntities[i].length-1;0<=r;r--)if(this._customTabEntities[i][r])return this._customTabEntities[i][r]}for(i=this._customTabEntities.length-1;0<i;)if(i--,this._customTabEntities[i])for(r=this._customTabEntities[i].length-1;0<=r;r--)if(this._customTabEntities[i][r])return this._customTabEntities[i][r];return t}if(t)for(e=this._tabEntities.length-1;0<=e;e--)if(this._tabEntities[e]==t)return 0==e?this._tabEntities[this._tabEntities.length-1]:this._tabEntities[e-1];return this._tabEntities[0]},Kxa.prototype.enterNode=function(t){return!!t.isVisible()},Kxa.prototype.dispose=function(){},Kxa.prototype.applyEntity=function(t){t.tabEnabled&&("[asset TextField]"==t.assetType&&"input"!=t.type||(0<=t.tabIndex?(this._customTabEntities.length<t.tabIndex&&(this._customTabEntities.length=t.tabIndex),this._customTabEntities[t.tabIndex]||(this._customTabEntities[t.tabIndex]=[]),this._customTabEntities[t.tabIndex].push(t)):this._tabEntities[this._tabEntities.length]=t))},Kxa),PickGroup=(Object.defineProperty(kya,"instancePool",{get:function(){return kya._instancePool},enumerable:!0,configurable:!0}),kya.clearAllInstances=function(){for(var t in this._instancePool)this._instancePool[t].clearAll(),delete this._instancePool[t]},kya.getInstance=function(t){return this._instancePool[t.id]||(this._instancePool[t.id]=new kya(t))},kya.clearInstance=function(t){var e=this._instancePool[t.id];e&&(e.clearAll(),delete this._instancePool[t.id])},kya.prototype.getAbstraction=function(t){return this._entityPool[t.id]||(this._entityPool[t.id]=new PickEntity(this._view,t,this))},kya.prototype.clearAbstraction=function(t){delete this._entityPool[t.id]},kya.prototype.clearAll=function(){for(var t in this._entityPool)this._entityPool[t].onClear(null);this._raycastPickerPool.clearAll(),this._boundsPickerPool.clearAll(),this._tabPickerPool.clearAll()},kya.prototype.getRaycastPicker=function(t){return this._raycastPickerPool.getAbstraction(t)},kya.prototype.getBoundsPicker=function(t){return this._boundsPickerPool.getAbstraction(t)},kya.prototype.getTabPicker=function(t){return this._tabPickerPool.getAbstraction(t)},kya._instancePool=new Object,kya),RaycastPickerPool=(wya.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new RaycastPicker(this._pickGroup,t,this))},wya.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},wya.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},wya),BoundsPickerPool=(Bya.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new BoundsPicker(this._pickGroup,t,this))},Bya.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},Bya.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},Bya),TabPickerPool=(Gya.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new TabPicker(t,this))},Gya.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},Gya.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},Gya),View=(Kya=AssetBase,__extends(Lya,Kya),Object.defineProperty(Lya.prototype,"shareContext",{get:function(){return this._shareContext},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"x",{get:function(){return this._shareContext||this._target?this._rect.x:this._stage.x},set:function(t){if(this._shareContext||this._target){if(this._rect.x==t)return;this._offset.x=(this._rect.x=t)/this._targetWidth,this._invalidateViewMatrix3D()}else this._stage.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"y",{get:function(){return this._shareContext||this._target?this._rect.y:this._stage.y},set:function(t){if(this._shareContext||this._target){if(this._rect.y==t)return;this._offset.y=(this._rect.y=t)/this._targetHeight,this._invalidateViewMatrix3D()}else this._stage.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"width",{get:function(){return this._rect.width},set:function(t){this._rect.width!=t&&(this._rect.width=t,this._shareContext||this._target?(this._scale.x=t/this._targetWidth,this._updatePixelRatio(),this._invalidateViewMatrix3D()):this._stage.width=t,this._invalidateSize())},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"height",{get:function(){return this._scale.y*this._targetHeight},set:function(t){this._rect.height!=t&&(this._rect.height=t,this._shareContext||this._target?(this._scale.y=t/this._targetHeight,this._updateFocalLength(),this._updatePixelRatio(),this._invalidateViewMatrix3D()):this._stage.height=t,this._invalidateSize())},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor!=t&&(this._backgroundColor=t,this._backgroundRed=(t>>16&255)/255,this._backgroundGreen=(t>>8&255)/255,this._backgroundBlue=(255&t)/255)},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"focalLength",{get:function(){return this._focalLength},set:function(t){this._focalLength!=t&&(this._focalLength=t,this._updateFocalLength())},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"pixelRatio",{get:function(){return this._pixelRatio},set:function(t){this._pixelRatio!=t&&(this._pixelRatio=t,this._updatePixelRatio())},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"projection",{get:function(){return this._projection},set:function(t){if(null==t)throw new ErrorBase("projection cannot be null");this._projection!=t&&(this._projection.removeEventListener(ProjectionEvent.INVALIDATE_VIEW_MATRIX3D,this._onInvalidateViewMatrix3DDelegate),this._projection=t,this._projection.addEventListener(ProjectionEvent.INVALIDATE_VIEW_MATRIX3D,this._onInvalidateViewMatrix3DDelegate),this._invalidateViewMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"target",{get:function(){return this._target},set:function(t){this._target!=t&&this._updateTarget(t)},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"frustumMatrix3D",{get:function(){return this._frustumMatrix3DDirty&&(this._frustumMatrix3DDirty=!1,this._frustumMatrix3D.recompose(this._components),this._frustumMatrix3D.prepend(this._projection.frustumMatrix3D)),this._frustumMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"viewMatrix3D",{get:function(){return this._viewMatrix3DDirty&&(this._viewMatrix3DDirty=!1,this._viewMatrix3D.recompose(this._components),this._viewMatrix3D.prepend(this._projection.viewMatrix3D)),this._viewMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(Lya.prototype,"inverseViewMatrix3D",{get:function(){return this._inverseViewMatrix3DDirty&&(this._inverseViewMatrix3DDirty=!1,this._inverseViewMatrix3D.copyFrom(this.viewMatrix3D),this._inverseViewMatrix3D.invert()),this._inverseViewMatrix3D},enumerable:!0,configurable:!0}),Lya.prototype.clear=function(t,e,i,n,r){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=ContextGLClearMask.ALL),this._stage.setRenderTarget(this._target,e,i,n),this._stage.setScissor(null==this._target?this._rect:null),t&&this._stage.clear(this._backgroundRed,this._backgroundGreen,this._backgroundBlue,this.backgroundAlpha,this.backgroundDepth,this.backgroundStencil,r)},Lya.prototype.present=function(){this._shareContext||null!=this._target||this._stage.context.present()},Lya.prototype.project=function(t,e){return void 0===e&&(e=null),(e=this._projection.project(t,e)).x=(e.x+1)*this.width/2,e.y=(e.y+1)*this.height/2,e},Lya.prototype.unproject=function(t,e,i,n){return void 0===n&&(n=null),this._projection.unproject(2*t/this.width-1,2*e/this.height-1,i,n)},Lya.prototype.dispose=function(){this._target?(this._target.removeEventListener(AssetEvent.INVALIDATE,this._onInvalidateSizeDelegate),this._target=null):(this._stage.removeEventListener(StageEvent.INVALIDATE_SIZE,this._onInvalidateSizeDelegate),this._shareContext||null!=this._target||this._stage.dispose(),this._stage=null),this._projection&&(this._projection.removeEventListener(ProjectionEvent.INVALIDATE_VIEW_MATRIX3D,this._onInvalidateViewMatrix3DDelegate),this._projection=null)},Lya.prototype._onInvalidateSize=function(t){this._updateDimensions(),this._updateFocalLength(),this._updatePixelRatio()},Lya.prototype._onInvalidateViewMatrix3D=function(t){this._invalidateViewMatrix3D()},Lya.prototype._updateTarget=function(t){this._target?this._target.removeEventListener(AssetEvent.INVALIDATE,this._onInvalidateSizeDelegate):this._stage.removeEventListener(StageEvent.INVALIDATE_SIZE,this._onInvalidateSizeDelegate),this._target=t,this._target?this._target.addEventListener(AssetEvent.INVALIDATE,this._onInvalidateSizeDelegate):this._stage.addEventListener(StageEvent.INVALIDATE_SIZE,this._onInvalidateSizeDelegate),this._updateDimensions(),this._updateFocalLength(),this._updatePixelRatio()},Lya.prototype._updateDimensions=function(){this._target?this._target instanceof Image2D?(this._targetWidth=this._target.width,this._targetHeight=this._target.height):this._target instanceof ImageCube&&(this._targetWidth=this._target.size,this._targetHeight=this._target.size):(this._targetWidth=this._stage.width,this._targetHeight=this._stage.height),this.preserveDimensions&&(this._shareContext||this._target)?(this._offset.x=this._rect.x/this._targetWidth,this._offset.y=this._rect.y/this._targetHeight,this._scale.x=this._rect.width/this._targetWidth,this._scale.y=this._rect.height/this._targetHeight):(this._rect.x=this._offset.x*this._targetWidth,this._rect.y=this._offset.y*this._targetHeight,this._rect.width=this._scale.x*this._targetWidth,this._rect.height=this._scale.y*this._targetHeight,this._invalidateSize())},Lya.prototype._updateFocalLength=function(){this.preserveFocalLength?this.projection.scale=this._focalLength/this._rect.height:this._focalLength=this._projection.scale*this._rect.height},Lya.prototype._updatePixelRatio=function(){this.preservePixelRatio?this._projection.ratio=this._pixelRatio*this._rect.width/this._rect.height:this._pixelRatio=this._projection.ratio*this._rect.height/this._rect.width},Lya.prototype._invalidateViewMatrix3D=function(){this._frustumMatrix3DDirty=!0,this._viewMatrix3DDirty=!0,this._inverseViewMatrix3DDirty=!0,this.dispatchEvent(new ViewEvent(ViewEvent.INVALIDATE_VIEW_MATRIX3D,this))},Lya.prototype._invalidateSize=function(){this.dispatchEvent(new ViewEvent(ViewEvent.INVALIDATE_SIZE,this))},Lya),Kya,Jxa,vwa,Ava,lva,hva,Gua,kua,Sta,ksa,$ra,lra,Qqa,yqa,tqa;function Lya(t,e,i,n,r,o){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=!1),void 0===n&&(n=ContextGLProfile.BASELINE),void 0===r&&(r=ContextMode.AUTO),void 0===o&&(o=!1);var s=Kya.call(this)||this;return s._rect=new Rectangle,s._backgroundRed=0,s._backgroundGreen=0,s._backgroundBlue=0,s._focalLength=1e3,s._pixelRatio=1,s._frustumMatrix3D=new Matrix3D,s._viewMatrix3D=new Matrix3D,s._inverseViewMatrix3D=new Matrix3D,s._components=new Array(4),s._offset=new Vector3D,s._scale=new Vector3D(1,1,1),s._frustumMatrix3DDirty=!0,s._viewMatrix3DDirty=!0,s._inverseViewMatrix3DDirty=!0,s.backgroundAlpha=1,s.backgroundDepth=1,s.backgroundStencil=0,s.preservePixelRatio=!0,s.preserveFocalLength=!1,s.preserveDimensions=!1,s._components[0]=s._offset,s._components[3]=s._scale,s._onInvalidateSizeDelegate=function(t){return s._onInvalidateSize(t)},s._onInvalidateViewMatrix3DDelegate=function(t){return s._onInvalidateViewMatrix3D(t)},s._projection=t||new PerspectiveProjection,s._projection.addEventListener(ProjectionEvent.INVALIDATE_VIEW_MATRIX3D,s._onInvalidateViewMatrix3DDelegate),e&&(s._shareContext=!0),s._stage=e||StageManager.getInstance().getFreeStage(i,n,r,o),s._stage.addEventListener(StageEvent.INVALIDATE_SIZE,s._onInvalidateSizeDelegate),s._targetWidth=s._stage.width,s._targetHeight=s._stage.height,s._updateFocalLength(),s._updatePixelRatio(),s}function Gya(){this._abstractionPool=new Object}function Bya(t){this._abstractionPool=new Object,this._pickGroup=t}function wya(t){this._abstractionPool=new Object,this._pickGroup=t}function kya(t){this._entityPool=new Object,this._view=t,this._raycastPickerPool=new RaycastPickerPool(this),this._boundsPickerPool=new BoundsPickerPool(this),this._tabPickerPool=kya._tabPickerPool||(kya._tabPickerPool=new TabPickerPool)}function Kxa(t,e){var i=Jxa.call(this,t,e)||this;return i._tabEntities=[],i._customTabEntities=[],i._customTabEntitiesSorted=[],i._partition=t,i._entity=t.root,i}function wwa(t,e,i){var n=vwa.call(this,e,i)||this;return n._boundingVolumePools=new Object,n._boundsPickers=[],n._pickGroup=t,n._partition=e,n._entity=e.root,n}function Bva(t,e,i){var n=Ava.call(this,e,i)||this;return n.shapeFlag=!1,n.findClosestCollision=!1,n._entities=[],n._pickers=[],n._collectedEntities=[],n._pickGroup=t,n._partition=e,n._entity=e.root,n}function mva(t,e){return lva.call(this,t,e)||this}function iva(t){var e=hva.call(this,t)||this;return e._rootNode=new NodeBase(t,e),e}function Hua(t,e){void 0===e&&(e=!1);var i=Gua.call(this)||this;return i._children=new Array,i._abstractionPool=new Object,i._updateQueue={},i.isUpdated=!1,i._root=t,i._root.addEventListener(AssetEvent.CLEAR,function(t){return i._onRootClear(t)}),e&&(i._scene=t),i}function pua(t,e){this._childNodes=new Array,this._numChildNodes=0,this._entity=t,this._partition=e}function lua(t,e){var i=kua.call(this,t)||this;return i._view=e,i}function Tta(t,e){var i=Sta.call(this,t,e)||this;return i.sourceEntity=e.entity,i._view=e.view,i._pickGroup=e.pickGroup,i}function lsa(t,e,i){var n=ksa.call(this,e,i)||this;return n._boundingVolumePools=new Object,n._orientedBoxBounds=[],n._orientedBoxBoundsDirty=[!0,!0],n._orientedSphereBounds=[],n._orientedSphereBoundsDirty=[!0,!0],n._pickablePool=new Object,n._pickables=[],n.shapeFlag=!1,n._view=t,n._entity=e,n._pickGroup=i,n._pickingCollision=new PickingCollision(n._entity),n}function dsa(t,e){this._boundingVolumePool=new Object,this._picker=t,this._strokeFlag=dsa._strokeDict[e],this._fastFlag=dsa._fastDict[e],this._boundingVolumeClass=dsa._boundsDict[e]}function _ra(){return null!==$ra&&$ra.apply(this,arguments)||this}function mra(){var t=null!==lra&&lra.apply(this,arguments)||this;return t._radius=0,t._centerX=0,t._centerY=0,t._centerZ=0,t}function Rqa(){var t=null!==Qqa&&Qqa.apply(this,arguments)||this;return t._x=0,t._y=0,t._z=0,t._width=0,t._height=0,t._depth=0,t._centerX=0,t._centerY=0,t._centerZ=0,t._halfExtentsX=0,t._halfExtentsY=0,t._halfExtentsZ=0,t}function zqa(t,e){var i=yqa.call(this,t,e)||this;if(i._targetCoordinateSpace=t,i._picker=e.picker,i._strokeFlag=e.strokeFlag,i._fastFlag=e.fastFlag,i._onInvalidateBoundsDelegate=function(t){return i._onInvalidateBounds(t)},i._onInvalidateMatrix3DDelegate=function(t){return i._onInvalidateMatrix3D(t)},i._picker.addEventListener(BoundsPickerEvent.INVALIDATE_BOUNDS,i._onInvalidateBoundsDelegate),i._targetCoordinateSpace){var n=i._picker.entity;if(i._targetCoordinateSpace.parent){for(;n&&n!=i._targetCoordinateSpace.parent;)n.transform.addEventListener(TransformEvent.INVALIDATE_MATRIX3D,i._onInvalidateMatrix3DDelegate),n=n.parent;n||i._targetCoordinateSpace.transform.addEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,i._onInvalidateMatrix3DDelegate)}else n.transform.addEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,i._onInvalidateMatrix3DDelegate)}return i}function uqa(t,e){var i=tqa.call(this,t)||this;return i._boundsPicker=e,i}console.debug("AwayJS - View - 0.6.1");var AnimationElements=(qza.prototype.createVertexData=function(t,e){this._numVertices=t,this._totalLenOfOneVertex=e,this._pVertexData=new Float32Array(t*e)},qza.prototype.activateVertexBuffer=function(t,e,i,n){var r=i.stageIndex,o=i.context,s=this._pVertexBuffer[r];s&&this._pBufferContext[r]==o||(s=this._pVertexBuffer[r]=o.createVertexBuffer(this._numVertices,4*this._totalLenOfOneVertex),this._pBufferContext[r]=o,this._pBufferDirty[r]=!0),this._pBufferDirty[r]&&(s.uploadFromArray(this._pVertexData,0,this._numVertices),this._pBufferDirty[r]=!1),o.setVertexBufferAt(t,s,4*e,n)},qza.prototype.dispose=function(){for(;this._pVertexBuffer.length;){var t=this._pVertexBuffer.pop();t&&t.dispose()}},qza.prototype.invalidateBuffer=function(){for(var t=0;t<8;t++)this._pBufferDirty[t]=!0},Object.defineProperty(qza.prototype,"vertexData",{get:function(){return this._pVertexData},enumerable:!0,configurable:!0}),Object.defineProperty(qza.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),Object.defineProperty(qza.prototype,"totalLenOfOneVertex",{get:function(){return this._totalLenOfOneVertex},enumerable:!0,configurable:!0}),qza.SUBGEOM_ID_COUNT=0,qza),ColorSegmentPoint=(Object.defineProperty(Dza.prototype,"color",{get:function(){return this._color},enumerable:!0,configurable:!0}),Object.defineProperty(Dza.prototype,"life",{get:function(){return this._life},enumerable:!0,configurable:!0}),Dza),JointPose=(Gza.prototype.toMatrix3D=function(t){return void 0===t&&(t=null),null==t&&(t=new Matrix3D),this.orientation.toMatrix3D(t),t.appendTranslation(this.translation.x,this.translation.y,this.translation.z),t},Gza.prototype.copyFrom=function(t){var e=t.orientation,i=t.translation;this.orientation.x=e.x,this.orientation.y=e.y,this.orientation.z=e.z,this.orientation.w=e.w,this.translation.x=i.x,this.translation.y=i.y,this.translation.z=i.z},Gza),ParticleAnimationData=function(t,e,i,n,r){this.index=t,this.startTime=e,this.totalTime=i+n,this.duration=i,this.delay=n,this.startVertexIndex=r.startVertexIndex,this.numVertices=r.numVertices},ParticleProperties=function(){},ParticlePropertiesMode=(Qza.GLOBAL=0,Qza.LOCAL_STATIC=1,Qza.LOCAL_DYNAMIC=2,Qza),Skeleton=(Rza=AssetBase,__extends(Sza,Rza),Object.defineProperty(Sza.prototype,"numJoints",{get:function(){return this.joints.length},enumerable:!0,configurable:!0}),Sza.prototype.jointFromName=function(t){var e=this.jointIndexFromName(t);return-1!=e?this.joints[e]:null},Sza.prototype.jointIndexFromName=function(t){for(var e,i;i<this.joints.length;i++){if(this.joints[i].name==t)return e;e++}return-1},Sza.prototype.dispose=function(){this.joints.length=0},Object.defineProperty(Sza.prototype,"assetType",{get:function(){return Sza.assetType},enumerable:!0,configurable:!0}),Sza.assetType="[asset Skeleton]",Sza),SkeletonPose=(Zza=AssetBase,__extends($za,Zza),Object.defineProperty($za.prototype,"numJointPoses",{get:function(){return this.jointPoses.length},enumerable:!0,configurable:!0}),Object.defineProperty($za.prototype,"assetType",{get:function(){return $za.assetType},enumerable:!0,configurable:!0}),$za.prototype.jointPoseFromName=function(t){var e=this.jointPoseIndexFromName(t);return-1!=e?this.jointPoses[e]:null},$za.prototype.jointPoseIndexFromName=function(t){for(var e,i;i<this.jointPoses.length;i++){if(this.jointPoses[i].name==t)return e;e++}return-1},$za.prototype.clone=function(){for(var t=new $za,e=this.jointPoses.length,i=0;i<e;i++){var n=new JointPose,r=this.jointPoses[i];n.name=r.name,n.copyFrom(r),t.jointPoses[i]=n}return t},$za.prototype.dispose=function(){this.jointPoses.length=0},$za.assetType="[asset SkeletonPose]",$za),VertexAnimationMode=(kAa.ADDITIVE="additive",kAa.ABSOLUTE="absolute",kAa),ShaderBase=(Object.defineProperty(lAa.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"pass",{get:function(){return this._pass},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"renderMaterial",{get:function(){return this._renderMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"programData",{get:function(){return this._invalidProgram&&this._updateProgram(),this._programData},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"usesAnimation",{get:function(){return this._usesAnimation},set:function(t){this._usesAnimation!=t&&(this._usesAnimation=t,this.invalidateProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"numUsedVertexConstants",{get:function(){return this._invalidProgram&&this._updateProgram(),this._numUsedVertexConstants},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"numUsedFragmentConstants",{get:function(){return this._invalidProgram&&this._updateProgram(),this._numUsedFragmentConstants},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"numUsedStreams",{get:function(){return this._invalidProgram&&this._updateProgram(),this._numUsedStreams},enumerable:!0,configurable:!0}),Object.defineProperty(lAa.prototype,"numUsedTextures",{get:function(){return this._invalidProgram&&this._updateProgram(),this._numUsedTextures},enumerable:!0,configurable:!0}),lAa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new lAa._abstractionClassPool[t.assetType](t,this))},lAa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},lAa.registerAbstraction=function(t,e){lAa._abstractionClassPool[e.assetType]=t},lAa.prototype._includeDependencies=function(){this._renderMaterial.renderElements._includeDependencies(this),this._pass._includeDependencies(this)},lAa.prototype.reset=function(){this.projectionDependencies=0,this.normalDependencies=0,this.colorDependencies=0,this.viewDirDependencies=0,this.uvDependencies=0,this.secondaryUVDependencies=0,this.globalPosDependencies=0,this.tangentDependencies=0,this.usesCommonData=!1,this.usesGlobalPosFragment=!1,this.usesPositionFragment=!1,this.usesFragmentAnimation=!1,this.usesTangentSpace=!1,this.outputsNormals=!1,this.outputsTangentNormals=!1},lAa.prototype.setBlendMode=function(t){switch(t){case BlendMode.NORMAL:this._blendFactorSource=ContextGLBlendFactor.ONE,this._blendFactorDest=ContextGLBlendFactor.ZERO,this.usesBlending=!1,this.usesPremultipliedAlpha=!1;break;case BlendMode.LAYER:this._blendFactorSource=ContextGLBlendFactor.ONE,this._blendFactorDest=ContextGLBlendFactor.ONE_MINUS_SOURCE_ALPHA,this.usesBlending=!0,this.usesPremultipliedAlpha=!0;break;case BlendMode.MULTIPLY:this._blendFactorSource=ContextGLBlendFactor.ZERO,this._blendFactorDest=ContextGLBlendFactor.SOURCE_COLOR,this.usesBlending=!0,this.usesPremultipliedAlpha=!0;break;case BlendMode.ADD:this._blendFactorSource=ContextGLBlendFactor.ONE,this._blendFactorDest=ContextGLBlendFactor.ONE,this.usesBlending=!0,this.usesPremultipliedAlpha=!0;break;case BlendMode.ALPHA:this._blendFactorSource=ContextGLBlendFactor.ZERO,this._blendFactorDest=ContextGLBlendFactor.SOURCE_ALPHA,this.usesBlending=!0,this.usesPremultipliedAlpha=!1;break;default:throw new ArgumentError("Unsupported blend mode!")}},lAa.prototype._activate=function(){var t,e,i;this.programData.program||(this.programData.program=this._stage.context.createProgram(),t=(new AGALMiniAssembler).assemble("part vertex 1\n"+this.programData.vertexString+"endpart").vertex.data,e=(new AGALMiniAssembler).assemble("part fragment 1\n"+this.programData.fragmentString+"endpart").fragment.data,this.programData.program.upload(t,e)),this._stage.context.setProgram(this.programData.program),this._stage.context.setCulling(this.useBothSides?ContextGLTriangleFace.NONE:this._defaultCulling,this._view.projection.coordinateSystem),!this.usesTangentSpace&&0<=this.cameraPositionIndex&&(i=this._view.projection.transform.concatenatedMatrix3D.position,this.vertexConstantData[this.cameraPositionIndex]=i.x,this.vertexConstantData[this.cameraPositionIndex+1]=i.y,this.vertexConstantData[this.cameraPositionIndex+2]=i.z),this._stage.context.setDepthTest(this.writeDepth&&!this.usesBlending,this.depthCompareMode),this._stage.context.setBlendFactors(this._blendFactorSource,this._blendFactorDest),this.activeElements=null},lAa.prototype._deactivate=function(){this._stage.context.setDepthTest(!0,ContextGLCompareMode.LESS_EQUAL),this.activeElements=null},lAa.prototype._setRenderState=function(t){var e,i,n,r,o,s,a;t.sourceEntity.animator&&t.sourceEntity.animator.setRenderState(this,t),this.usesUVTransform&&((i=t.uvMatrix)?(e=i.rawData,this.vertexConstantData[this.uvMatrixIndex]=e[0],this.vertexConstantData[this.uvMatrixIndex+1]=e[2],this.vertexConstantData[this.uvMatrixIndex+3]=e[4],this.vertexConstantData[this.uvMatrixIndex+4]=e[1],this.vertexConstantData[this.uvMatrixIndex+5]=e[3],this.vertexConstantData[this.uvMatrixIndex+7]=e[5]):(this.vertexConstantData[this.uvMatrixIndex]=1,this.vertexConstantData[this.uvMatrixIndex+1]=0,this.vertexConstantData[this.uvMatrixIndex+3]=0,this.vertexConstantData[this.uvMatrixIndex+4]=0,this.vertexConstantData[this.uvMatrixIndex+5]=1,this.vertexConstantData[this.uvMatrixIndex+7]=0)),this.usesColorTransform&&((n=t.sourceEntity._iAssignedColorTransform())?(e=n._rawData,this.fragmentConstantData[this.colorTransformIndex]=e[0],this.fragmentConstantData[this.colorTransformIndex+1]=e[1],this.fragmentConstantData[this.colorTransformIndex+2]=e[2],this.fragmentConstantData[this.colorTransformIndex+3]=e[3],this.fragmentConstantData[this.colorTransformIndex+4]=e[4]/255,this.fragmentConstantData[this.colorTransformIndex+5]=e[5]/255,this.fragmentConstantData[this.colorTransformIndex+6]=e[6]/255,this.fragmentConstantData[this.colorTransformIndex+7]=e[7]/255):(this.fragmentConstantData[this.colorTransformIndex]=1,this.fragmentConstantData[this.colorTransformIndex+1]=1,this.fragmentConstantData[this.colorTransformIndex+2]=1,this.fragmentConstantData[this.colorTransformIndex+3]=1,this.fragmentConstantData[this.colorTransformIndex+4]=0,this.fragmentConstantData[this.colorTransformIndex+5]=0,this.fragmentConstantData[this.colorTransformIndex+6]=0,this.fragmentConstantData[this.colorTransformIndex+7]=0)),0<=this.sceneNormalMatrixIndex&&this.sceneNormalMatrix.copyFrom(t.sourceEntity.transform.inverseConcatenatedMatrix3D),this.usesTangentSpace&&0<=this.cameraPositionIndex&&(t.sourceEntity.transform.inverseConcatenatedMatrix3D.copyRawDataTo(this._pInverseSceneMatrix),o=(r=this._view.projection.transform.concatenatedMatrix3D.position).x,s=r.y,a=r.z,this.vertexConstantData[this.cameraPositionIndex]=this._pInverseSceneMatrix[0]*o+this._pInverseSceneMatrix[4]*s+this._pInverseSceneMatrix[8]*a+this._pInverseSceneMatrix[12],this.vertexConstantData[this.cameraPositionIndex+1]=this._pInverseSceneMatrix[1]*o+this._pInverseSceneMatrix[5]*s+this._pInverseSceneMatrix[9]*a+this._pInverseSceneMatrix[13],this.vertexConstantData[this.cameraPositionIndex+2]=this._pInverseSceneMatrix[2]*o+this._pInverseSceneMatrix[6]*s+this._pInverseSceneMatrix[10]*a+this._pInverseSceneMatrix[14])},lAa.prototype.invalidateProgram=function(){this._invalidProgram=!0},lAa.prototype.dispose=function(){this._programData.dispose(),this._programData=null,this._registerCache.dispose(),this._registerCache=null,this._sharedRegisters=null},lAa.prototype._updateProgram=function(){this._invalidProgram=!1,this._sharedRegisters=new ShaderRegisterData,this._registerCache=new ShaderRegisterCache(this.profile),this.reset(),this._includeDependencies(),this._initRegisterIndices(),this._compileDependencies(),this._vertexCode+=this._pass._getVertexCode(this._registerCache,this._sharedRegisters),this._fragmentCode+=this._pass._getFragmentCode(this._registerCache,this._sharedRegisters),this._postAnimationFragmentCode+=this._pass._getPostAnimationFragmentCode(this._registerCache,this._sharedRegisters),this.usesPremultipliedAlpha&&(this._postAnimationFragmentCode+="mul "+this._sharedRegisters.shadedTarget+".xyz, "+this._sharedRegisters.shadedTarget+", "+this._sharedRegisters.shadedTarget+".w\n"),this._postAnimationFragmentCode+="mov "+this._registerCache.fragmentOutputRegister+", "+this._sharedRegisters.shadedTarget+"\n",this._registerCache.removeFragmentTempUsage(this._sharedRegisters.shadedTarget),this._compileAnimationCode(),this._initConstantData();var t=this._stage.getProgramData(this._animationVertexCode+this._vertexCode,this._fragmentCode+this._animationFragmentCode+this._postAnimationFragmentCode);this._programData!=t&&(this._programData&&this._programData.dispose(),(this._programData=t).usages++)},lAa.prototype._initRegisterIndices=function(){this.commonsDataIndex=-1,this.cameraPositionIndex=-1,this.curvesIndex=-1,this.uvIndex=-1,this.uvMatrixIndex=-1,this.colorTransformIndex=-1,this.secondaryUVIndex=-1,this.normalIndex=-1,this.colorBufferIndex=-1,this.tangentIndex=-1,this.sceneMatrixIndex=-1,this.sceneNormalMatrixIndex=-1,this.jointIndexIndex=-1,this.jointWeightIndex=-1,this.imageIndices.length=0,this._sharedRegisters.animatedPosition=this._registerCache.getFreeVertexVectorTemp(),this._registerCache.addVertexTempUsages(this._sharedRegisters.animatedPosition,1),this._sharedRegisters.animatableAttributes.push(this._registerCache.getFreeVertexAttribute()),this._sharedRegisters.animationTargetRegisters.push(this._sharedRegisters.animatedPosition),this._vertexCode="",this._fragmentCode="",this._postAnimationFragmentCode="",(this.usesCommonData||0<this.normalDependencies)&&(this._sharedRegisters.commons=this._registerCache.getFreeFragmentConstant(),this.commonsDataIndex=4*this._sharedRegisters.commons.index),(0<this.tangentDependencies||this.outputsNormals)&&(this._sharedRegisters.tangentInput=this._registerCache.getFreeVertexAttribute(),this.tangentIndex=this._sharedRegisters.tangentInput.index,this._sharedRegisters.animatedTangent=this._registerCache.getFreeVertexVectorTemp(),this._registerCache.addVertexTempUsages(this._sharedRegisters.animatedTangent,1),this.usesTangentSpace&&(this._sharedRegisters.bitangent=this._registerCache.getFreeVertexVectorTemp(),this._registerCache.addVertexTempUsages(this._sharedRegisters.bitangent,1)),this._sharedRegisters.animatableAttributes.push(this._sharedRegisters.tangentInput),this._sharedRegisters.animationTargetRegisters.push(this._sharedRegisters.animatedTangent)),0<this.normalDependencies&&(this._sharedRegisters.normalInput=this._registerCache.getFreeVertexAttribute(),this.normalIndex=this._sharedRegisters.normalInput.index,this._sharedRegisters.animatedNormal=this._registerCache.getFreeVertexVectorTemp(),this._registerCache.addVertexTempUsages(this._sharedRegisters.animatedNormal,1),this._sharedRegisters.animatableAttributes.push(this._sharedRegisters.normalInput),this._sharedRegisters.animationTargetRegisters.push(this._sharedRegisters.animatedNormal)),0<this.uvDependencies&&(this._sharedRegisters.uvInput=this._registerCache.getFreeVertexAttribute(),this.uvIndex=this._sharedRegisters.uvInput.index,this.usesUVTransform||(this._sharedRegisters.animatedUV=this._registerCache.getFreeVertexVectorTemp(),this._registerCache.addVertexTempUsages(this._sharedRegisters.animatedUV,1))),this._sharedRegisters.shadedTarget=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(this._sharedRegisters.shadedTarget,1)},lAa.prototype._compileDependencies=function(){0<this.colorDependencies&&this._compileColorCode(),0<this.globalPosDependencies&&this._compileGlobalPositionCode(),this.usesPositionFragment&&this._compilePositionCode(),this.usesCurves&&this._compileCurvesCode(),this.usesColorTransform&&this._compileColorTransformCode(),0<this.uvDependencies&&this._compileUVCode(),0<this.secondaryUVDependencies&&this._compileSecondaryUVCode(),0<this.normalDependencies&&this._compileNormalCode(),0<this.viewDirDependencies&&this._compileViewDirCode(),this._vertexCode+=this._renderElements._getVertexCode(this,this._registerCache,this._sharedRegisters),this._fragmentCode+=this._renderElements._getFragmentCode(this,this._registerCache,this._sharedRegisters)},lAa.prototype._initConstantData=function(){this._numUsedVertexConstants=this._registerCache.numUsedVertexConstants,this._numUsedFragmentConstants=this._registerCache.numUsedFragmentConstants,this._numUsedStreams=this._registerCache.numUsedStreams,this._numUsedTextures=this._registerCache.numUsedTextures,this.vertexConstantData=new Float32Array(4*this._registerCache.numUsedVertexConstants),this.fragmentConstantData=new Float32Array(4*this._registerCache.numUsedFragmentConstants),0<=this.viewMatrixIndex?this.viewMatrix=new Matrix3D(new Float32Array(this.vertexConstantData.buffer,4*this.viewMatrixIndex,16)):this.viewMatrix&&(this.viewMatrix=null),0<=this.sceneMatrixIndex?this.sceneMatrix=new Matrix3D(new Float32Array(this.vertexConstantData.buffer,4*this.sceneMatrixIndex,16)):this.sceneMatrix&&(this.sceneMatrix=null),0<=this.commonsDataIndex&&(this.fragmentConstantData[this.commonsDataIndex]=.5,this.fragmentConstantData[this.commonsDataIndex+1]=0,this.fragmentConstantData[this.commonsDataIndex+2]=1/255,this.fragmentConstantData[this.commonsDataIndex+3]=1),0<=this.uvMatrixIndex&&(this.vertexConstantData[this.uvMatrixIndex]=1,this.vertexConstantData[this.uvMatrixIndex+1]=0,this.vertexConstantData[this.uvMatrixIndex+2]=0,this.vertexConstantData[this.uvMatrixIndex+3]=0,this.vertexConstantData[this.uvMatrixIndex+4]=0,this.vertexConstantData[this.uvMatrixIndex+5]=1,this.vertexConstantData[this.uvMatrixIndex+6]=0,this.vertexConstantData[this.uvMatrixIndex+7]=0),0<=this.colorTransformIndex&&(this.fragmentConstantData[this.colorTransformIndex]=1,this.fragmentConstantData[this.colorTransformIndex+1]=1,this.fragmentConstantData[this.colorTransformIndex+2]=1,this.fragmentConstantData[this.colorTransformIndex+3]=1,this.fragmentConstantData[this.colorTransformIndex+4]=0,this.fragmentConstantData[this.colorTransformIndex+5]=0,this.fragmentConstantData[this.colorTransformIndex+6]=0,this.fragmentConstantData[this.colorTransformIndex+7]=0),0<=this.sceneNormalMatrixIndex?this.sceneNormalMatrix=new Matrix3D(new Float32Array(this.vertexConstantData.buffer,4*this.sceneNormalMatrixIndex,16)):this.sceneNormalMatrix&&(this.sceneNormalMatrix=null),0<=this.cameraPositionIndex&&(this.vertexConstantData[this.cameraPositionIndex+3]=1),this._pass._initConstantData(),this._usesAnimation&&this._renderMaterial.animationSet.doneAGALCode(this)},lAa.prototype._compileColorCode=function(){this._sharedRegisters.colorInput=this._registerCache.getFreeVertexAttribute(),this.colorBufferIndex=this._sharedRegisters.colorInput.index,this._sharedRegisters.colorVarying=this._registerCache.getFreeVarying(),this._vertexCode+="mov "+this._sharedRegisters.colorVarying+", "+this._sharedRegisters.colorInput+"\n"},lAa.prototype._compileGlobalPositionCode=function(){this._registerCache.addVertexTempUsages(this._sharedRegisters.globalPositionVertex=this._registerCache.getFreeVertexVectorTemp(),this.globalPosDependencies);var t=this._registerCache.getFreeVertexConstant();this._registerCache.getFreeVertexConstant(),this._registerCache.getFreeVertexConstant(),this._registerCache.getFreeVertexConstant(),this.sceneMatrixIndex=4*t.index,this._vertexCode+="m44 "+this._sharedRegisters.globalPositionVertex+", "+this._sharedRegisters.animatedPosition+", "+t+"\n",this.usesGlobalPosFragment&&(this._sharedRegisters.globalPositionVarying=this._registerCache.getFreeVarying(),this._vertexCode+="mov "+this._sharedRegisters.globalPositionVarying+", "+this._sharedRegisters.globalPositionVertex+"\n")},lAa.prototype._compilePositionCode=function(){this._sharedRegisters.positionVarying=this._registerCache.getFreeVarying(),this._vertexCode+="mov "+this._sharedRegisters.positionVarying+", "+this._sharedRegisters.animatedPosition+"\n"},lAa.prototype._compileCurvesCode=function(){this._sharedRegisters.curvesInput=this._registerCache.getFreeVertexAttribute(),this.curvesIndex=this._sharedRegisters.curvesInput.index,this._sharedRegisters.curvesVarying=this._registerCache.getFreeVarying(),this._vertexCode+="mov "+this._sharedRegisters.curvesVarying+", "+this._sharedRegisters.curvesInput+"\n";var t=this._registerCache.getFreeFragmentSingleTemp();this._fragmentCode+="mul "+t+", "+this._sharedRegisters.curvesVarying+".y, "+this._sharedRegisters.curvesVarying+".y\nsub "+t+", "+t+", "+this._sharedRegisters.curvesVarying+".z\nmul "+t+", "+t+", "+this._sharedRegisters.curvesVarying+".x\nkil "+t+"\n"},lAa.prototype._compileColorTransformCode=function(){var t=this._registerCache.getFreeFragmentConstant(),e=this._registerCache.getFreeFragmentConstant();this.colorTransformIndex=4*t.index,this._postAnimationFragmentCode+="mul "+this._sharedRegisters.shadedTarget+", "+this._sharedRegisters.shadedTarget+", "+t+"\n",this._postAnimationFragmentCode+="add "+this._sharedRegisters.shadedTarget+", "+this._sharedRegisters.shadedTarget+", "+e+"\n"},lAa.prototype._compileUVCode=function(){var t,e;this._sharedRegisters.uvVarying=this._registerCache.getFreeVarying(),this.usesUVTransform?(t=this._registerCache.getFreeVertexConstant(),e=this._registerCache.getFreeVertexConstant(),this.uvMatrixIndex=4*t.index,this._vertexCode+="dp4 "+this._sharedRegisters.uvVarying+".x, "+this._sharedRegisters.uvInput+", "+t+"\ndp4 "+this._sharedRegisters.uvVarying+".y, "+this._sharedRegisters.uvInput+", "+e+"\nmov "+this._sharedRegisters.uvVarying+".zw, "+this._sharedRegisters.uvInput+".zw \n"):this._vertexCode+="mov "+this._sharedRegisters.uvVarying+", "+this._sharedRegisters.animatedUV+"\n"},lAa.prototype._compileSecondaryUVCode=function(){var t=this._registerCache.getFreeVertexAttribute();this.secondaryUVIndex=t.index,this._sharedRegisters.secondaryUVVarying=this._registerCache.getFreeVarying(),this._vertexCode+="mov "+this._sharedRegisters.secondaryUVVarying+", "+t+"\n"},lAa.prototype._compileViewDirCode=function(){var t,e=this._registerCache.getFreeVertexConstant();this._sharedRegisters.viewDirVarying=this._registerCache.getFreeVarying(),this._sharedRegisters.viewDirFragment=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(this._sharedRegisters.viewDirFragment,this.viewDirDependencies),this.cameraPositionIndex=4*e.index,this.usesTangentSpace?(t=this._registerCache.getFreeVertexVectorTemp(),this._vertexCode+="sub "+t+", "+e+", "+this._sharedRegisters.animatedPosition+"\nm33 "+this._sharedRegisters.viewDirVarying+".xyz, "+t+", "+this._sharedRegisters.animatedTangent+"\nmov "+this._sharedRegisters.viewDirVarying+".w, "+this._sharedRegisters.animatedPosition+".w\n"):(this._vertexCode+="sub "+this._sharedRegisters.viewDirVarying+", "+e+", "+this._sharedRegisters.globalPositionVertex+"\n",this._registerCache.removeVertexTempUsage(this._sharedRegisters.globalPositionVertex)),this._fragmentCode+="nrm "+this._sharedRegisters.viewDirFragment+".xyz, "+this._sharedRegisters.viewDirVarying+"\nmov "+this._sharedRegisters.viewDirFragment+".w, "+this._sharedRegisters.viewDirVarying+".w\n"},lAa.prototype._compileNormalCode=function(){if(this._sharedRegisters.normalFragment=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(this._sharedRegisters.normalFragment,this.normalDependencies),this.outputsNormals&&!this.outputsTangentNormals)return this._vertexCode+=this._pass._getNormalVertexCode(this._registerCache,this._sharedRegisters),void(this._fragmentCode+=this._pass._getNormalFragmentCode(this._registerCache,this._sharedRegisters));var t,e,i,n,r;this.outputsNormals&&this.usesTangentSpace||((t=new Array(3))[0]=this._registerCache.getFreeVertexConstant(),t[1]=this._registerCache.getFreeVertexConstant(),t[2]=this._registerCache.getFreeVertexConstant(),this._registerCache.getFreeVertexConstant(),this.sceneNormalMatrixIndex=4*t[0].index,this._sharedRegisters.normalVarying=this._registerCache.getFreeVarying()),this.outputsNormals?this.usesTangentSpace?(this._vertexCode+="nrm "+this._sharedRegisters.animatedNormal+".xyz, "+this._sharedRegisters.animatedNormal+"\nnrm "+this._sharedRegisters.animatedTangent+".xyz, "+this._sharedRegisters.animatedTangent+"\ncrs "+this._sharedRegisters.bitangent+".xyz, "+this._sharedRegisters.animatedNormal+", "+this._sharedRegisters.animatedTangent+"\n",this._fragmentCode+=this._pass._getNormalFragmentCode(this._registerCache,this._sharedRegisters)):(this._sharedRegisters.tangentVarying=this._registerCache.getFreeVarying(),this._sharedRegisters.bitangentVarying=this._registerCache.getFreeVarying(),r=this._registerCache.getFreeVertexVectorTemp(),this._vertexCode+="m33 "+r+".xyz, "+this._sharedRegisters.animatedNormal+", "+t[0]+"\nnrm "+this._sharedRegisters.animatedNormal+".xyz, "+r+"\nm33 "+r+".xyz, "+this._sharedRegisters.animatedTangent+", "+t[0]+"\nnrm "+this._sharedRegisters.animatedTangent+".xyz, "+r+"\nmov "+this._sharedRegisters.tangentVarying+".x, "+this._sharedRegisters.animatedTangent+".x \nmov "+this._sharedRegisters.tangentVarying+".z, "+this._sharedRegisters.animatedNormal+".x \nmov "+this._sharedRegisters.tangentVarying+".w, "+this._sharedRegisters.normalInput+".w \nmov "+this._sharedRegisters.bitangentVarying+".x, "+this._sharedRegisters.animatedTangent+".y \nmov "+this._sharedRegisters.bitangentVarying+".z, "+this._sharedRegisters.animatedNormal+".y \nmov "+this._sharedRegisters.bitangentVarying+".w, "+this._sharedRegisters.normalInput+".w \nmov "+this._sharedRegisters.normalVarying+".x, "+this._sharedRegisters.animatedTangent+".z \nmov "+this._sharedRegisters.normalVarying+".z, "+this._sharedRegisters.animatedNormal+".z \nmov "+this._sharedRegisters.normalVarying+".w, "+this._sharedRegisters.normalInput+".w \ncrs "+r+".xyz, "+this._sharedRegisters.animatedNormal+", "+this._sharedRegisters.animatedTangent+"\nmov "+this._sharedRegisters.tangentVarying+".y, "+r+".x \nmov "+this._sharedRegisters.bitangentVarying+".y, "+r+".y \nmov "+this._sharedRegisters.normalVarying+".y, "+r+".z \n",this._registerCache.removeVertexTempUsage(this._sharedRegisters.animatedTangent),e=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(e,1),i=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(i,1),n=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(n,1),this._fragmentCode+="nrm "+e+".xyz, "+this._sharedRegisters.tangentVarying+"\nmov "+e+".w, "+this._sharedRegisters.tangentVarying+".w\t\nnrm "+i+".xyz, "+this._sharedRegisters.bitangentVarying+"\nnrm "+n+".xyz, "+this._sharedRegisters.normalVarying+"\n",this._fragmentCode+=this._pass._getNormalFragmentCode(this._registerCache,this._sharedRegisters)+"m33 "+this._sharedRegisters.normalFragment+".xyz, "+this._sharedRegisters.normalFragment+", "+e+"\nmov "+this._sharedRegisters.normalFragment+".w, "+this._sharedRegisters.normalVarying+".w\n",this._registerCache.removeFragmentTempUsage(i),this._registerCache.removeFragmentTempUsage(e),this._registerCache.removeFragmentTempUsage(n)):(this._vertexCode+="m33 "+this._sharedRegisters.normalVarying+".xyz, "+this._sharedRegisters.animatedNormal+", "+t[0]+"\nmov "+this._sharedRegisters.normalVarying+".w, "+this._sharedRegisters.animatedNormal+".w\n",this._fragmentCode+="nrm "+this._sharedRegisters.normalFragment+".xyz, "+this._sharedRegisters.normalVarying+"\nmov "+this._sharedRegisters.normalFragment+".w, "+this._sharedRegisters.normalVarying+".w\n",0<this.tangentDependencies&&(this._sharedRegisters.tangentVarying=this._registerCache.getFreeVarying(),this._vertexCode+="m33 "+this._sharedRegisters.tangentVarying+".xyz, "+this._sharedRegisters.animatedTangent+", "+t[0]+"\nmov "+this._sharedRegisters.tangentVarying+".w, "+this._sharedRegisters.animatedTangent+".w\n")),this.usesTangentSpace||this._registerCache.removeVertexTempUsage(this._sharedRegisters.animatedNormal)},lAa.prototype._compileAnimationCode=function(){if(this._animationVertexCode="",this._animationFragmentCode="",this._usesAnimation){var t=this._renderMaterial.animationSet;this._animationVertexCode+=t.getAGALVertexCode(this,this._registerCache,this._sharedRegisters),0<this.uvDependencies&&!this.usesUVTransform&&(this._animationVertexCode+=t.getAGALUVCode(this,this._registerCache,this._sharedRegisters)),this.usesFragmentAnimation&&(this._animationFragmentCode+=t.getAGALFragmentCode(this,this._registerCache,this._sharedRegisters.shadedTarget))}else{for(var e=this._sharedRegisters.animatableAttributes.length,i=0;i<e;++i)this._animationVertexCode+="mov "+this._sharedRegisters.animationTargetRegisters[i]+", "+this._sharedRegisters.animatableAttributes[i]+"\n";0<this.uvDependencies&&!this.usesUVTransform&&(this._animationVertexCode+="mov "+this._sharedRegisters.animatedUV+","+this._sharedRegisters.uvInput+"\n")}},lAa.prototype.setVertexConst=function(t,e,i,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),t*=4,this.vertexConstantData[t++]=e,this.vertexConstantData[t++]=i,this.vertexConstantData[t++]=n,this.vertexConstantData[t]=r},lAa.prototype.setVertexConstFromArray=function(t,e){t*=4;for(var i=0;i<e.length;i++)this.vertexConstantData[t++]=e[i]},lAa.prototype.setVertexConstFromMatrix=function(t,e){t*=4;var i=e._rawData;this.vertexConstantData[t++]=i[0],this.vertexConstantData[t++]=i[4],this.vertexConstantData[t++]=i[8],this.vertexConstantData[t++]=i[12],this.vertexConstantData[t++]=i[1],this.vertexConstantData[t++]=i[5],this.vertexConstantData[t++]=i[9],this.vertexConstantData[t++]=i[13],this.vertexConstantData[t++]=i[2],this.vertexConstantData[t++]=i[6],this.vertexConstantData[t++]=i[10],this.vertexConstantData[t++]=i[14],this.vertexConstantData[t++]=i[3],this.vertexConstantData[t++]=i[7],this.vertexConstantData[t++]=i[11],this.vertexConstantData[t]=i[15]},lAa.prototype.setFragmentConst=function(t,e,i,n,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),t*=4,this.fragmentConstantData[t++]=e,this.fragmentConstantData[t++]=i,this.fragmentConstantData[t++]=n,this.fragmentConstantData[t]=r},lAa._abstractionClassPool=new Object,lAa),PassEvent=(nBa=EventBase,__extends(oBa,nBa),Object.defineProperty(oBa.prototype,"pass",{get:function(){return this._pass},enumerable:!0,configurable:!0}),oBa.prototype.clone=function(){return new oBa(this.type,this._pass)},oBa.INVALIDATE="invalidatePass",oBa),MaterialEvent=(sBa=EventBase,__extends(tBa,sBa),Object.defineProperty(tBa.prototype,"material",{get:function(){return this._material},enumerable:!0,configurable:!0}),tBa.prototype.clone=function(){return new tBa(this.type,this._material)},tBa.INVALIDATE_TEXTURES="invalidateTextures",tBa.INVALIDATE_PASSES="invalidatePasses",tBa),_Render_MaterialBase=(xBa=AbstractionBase,__extends(yBa,xBa),Object.defineProperty(yBa.prototype,"animationSet",{get:function(){return this._animationSet},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"material",{get:function(){return this._material},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"numImages",{get:function(){return this._invalidImages&&this._updateImages(),this._numImages},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"renderOrderId",{get:function(){return this._invalidAnimation&&this._updateAnimation(),this._renderOrderId},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"numPasses",{get:function(){return this._invalidAnimation&&this._updateAnimation(),this._passes.length},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"style",{get:function(){return this._material.style},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"renderGroup",{get:function(){return this._renderGroup},enumerable:!0,configurable:!0}),Object.defineProperty(yBa.prototype,"renderElements",{get:function(){return this._renderElements},enumerable:!0,configurable:!0}),yBa.prototype.activatePass=function(t){var e;for(this._activePass=this._passes[t],e=this._activePass.shader.numUsedStreams;e<this._stage.numUsedStreams;e++)this._stage.context.setVertexBufferAt(e,null);for(e=this._activePass.shader.numUsedTextures;e<this._stage.numUsedTextures;e++)this._stage.context.setTextureAt(e,null);this._activePass._activate(this._renderGroup.view)},yBa.prototype.deactivatePass=function(){this._activePass._deactivate(),this._stage.numUsedStreams=this._activePass.shader.numUsedStreams,this._stage.numUsedTextures=this._activePass.shader.numUsedTextures},yBa.prototype.addOwner=function(t){var e;this._owners.push(t);var i=t.sourceEntity.animator;if(i&&(e=i.animationSet),t.sourceEntity.animator){if(this._animationSet&&e!=this._animationSet)throw new Error("A Material instance cannot be shared across material owners with different animation sets");this._animationSet!=e&&(this._animationSet=e,this._invalidAnimation=!0)}},yBa.prototype.removeOwner=function(t){this._owners.splice(this._owners.indexOf(t),1),this._owners.length||this.onClear(null)},yBa.prototype.getImageIndex=function(t,e){return void 0===e&&(e=0),this._invalidImages&&this._updateImages(),this._imageIndices[t.id][e]},yBa.prototype.onClear=function(t){xBa.prototype.onClear.call(this,t);for(var e=this._passes.length,i=0;i<e;i++)this._passes[i].removeEventListener(PassEvent.INVALIDATE,this._onPassInvalidateDelegate),this._passes[i].dispose();this._passes=null,this._material.removeEventListener(MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTexturesDelegate),this._material.removeEventListener(MaterialEvent.INVALIDATE_PASSES,this._onInvalidatePassesDelegate),this._animationSet=null,this._material=null,this._renderElements=null,this._stage=null,this._owners=null},yBa.prototype.onInvalidatePasses=function(t){for(var e=this._passes.length,i=0;i<e;i++)this._passes[i].invalidate();this._invalidAnimation=!0,this._invalidImages=!0},yBa.prototype.onPassInvalidate=function(t){this._invalidAnimation=!0},yBa.prototype.onInvalidateTextures=function(t){for(var e=this._owners,i=e.length,n=0;n<i;n++)e[n]._onInvalidateStyle()},yBa.prototype.onInvalidate=function(t){xBa.prototype.onInvalidate.call(this,t),this._invalidRender=!0,this._invalidAnimation=!0},yBa.prototype._pClearPasses=function(){for(var t=this._passes.length,e=0;e<t;++e)this._passes[e].removeEventListener(PassEvent.INVALIDATE,this._onPassInvalidateDelegate);this._passes.length=0},yBa.prototype._pAddPass=function(t){this._passes.push(t),t.addEventListener(PassEvent.INVALIDATE,this._onPassInvalidateDelegate)},yBa.prototype._pRemovePass=function(t){t.removeEventListener(PassEvent.INVALIDATE,this._onPassInvalidateDelegate),this._passes.splice(this._passes.indexOf(t),1)},yBa.prototype._pUpdateRender=function(){this._invalidRender=!1},yBa.prototype._updateAnimation=function(){this._invalidRender&&this._pUpdateRender(),this._invalidAnimation=!1;for(var t,e=this._getEnabledGPUAnimation(),i=0,n=1,r=this._passes.length,o=0;o<r;o++)(t=this._passes[o].shader).usesAnimation=e,i+=t.programData.id*n,n*=1e3;if(this._usesAnimation!=e){this._usesAnimation=e;for(var s=this._owners,a=s.length,l=0;l<a;l++)s[l]._onInvalidateElements()}this._renderOrderId=i},yBa.prototype._updateImages=function(){this._invalidImages=!1;for(var t,e,i,n=this._material.style,r=this._material.getNumTextures(),o=0,s=0;s<r;s++){e=(t=this._material.getTextureAt(s)).getNumImages(),i=this._imageIndices[t.id]=new Array;for(var a=0;a<e;a++)this.images[o]=this._stage.getAbstraction(t.getImageAt(a)||(n?n.getImageAt(t,a):null)||ImageUtils.getDefaultImage2D()),this.samplers[o]=t.getSamplerAt(a)||(n?n.getSamplerAt(t,a):null)||ImageUtils.getDefaultSampler(),i[a]=o++}this._numImages=o},yBa.prototype._getEnabledGPUAnimation=function(){if(this._animationSet){this._animationSet.resetGPUCompatibility();for(var t,e=this._owners,i=e.length,n=this._passes.length,r=0;r<n;r++){(t=this._passes[r].shader).usesAnimation=!1;for(var o=0;o<i;o++)e[o].sourceEntity.animator&&e[o].sourceEntity.animator.testGPUCompatibility(t)}return!this._animationSet.usesCPU}return!1},yBa),_Render_ElementsBase=(Object.defineProperty(yCa.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(yCa.prototype,"renderGroup",{get:function(){return this._renderGroup},enumerable:!0,configurable:!0}),yCa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new this._renderMaterialClassPool[t.assetType](t,this))},yCa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},yCa.prototype._includeDependencies=function(t){},yCa.prototype._getVertexCode=function(t,e,i){return""},yCa.prototype._getFragmentCode=function(t,e,i){return""},yCa),RenderableEvent=(LCa=EventBase,__extends(MCa,LCa),Object.defineProperty(MCa.prototype,"renderable",{get:function(){return this._renderable},enumerable:!0,configurable:!0}),MCa.prototype.clone=function(){return new MCa(this.type,this._renderable)},MCa.INVALIDATE_MATERIAL="invalidateMaterial",MCa.INVALIDATE_ELEMENTS="invalidateElements",MCa.INVALIDATE_STYLE="invalidateStyle",MCa),MaterialUtils=(QCa.getDefaultTextureMaterial=function(){return this._defaultTextureMaterial||this.createDefaultTextureMaterial(),this._defaultTextureMaterial},QCa.getDefaultCubeTextureMaterial=function(){return this._defaultCubeTextureMaterial||this.createDefaultCubeTextureMaterial(),this._defaultCubeTextureMaterial},QCa.getDefaultColorMaterial=function(){return QCa._defaultColorMaterial||QCa.createDefaultColorMaterial(),QCa._defaultColorMaterial},QCa.createDefaultTextureMaterial=function(){this._defaultTextureMaterial=new this._defaultMaterialClass(ImageUtils.getDefaultImage2D()),this._defaultTextureMaterial.name="defaultTextureMaterial"},QCa.createDefaultCubeTextureMaterial=function(){this._defaultCubeTextureMaterial=new this._defaultMaterialClass(ImageUtils.getDefaultImageCube()),this._defaultCubeTextureMaterial.name="defaultCubeTextureMaterial"},QCa.createDefaultColorMaterial=function(){this._defaultColorMaterial=new this._defaultMaterialClass(16777215),this._defaultColorMaterial.name="defaultColorMaterial"},QCa.setDefaultMaterialClass=function(t){this._defaultMaterialClass=t},QCa),_Render_RenderableBase=(SCa=AbstractionBase,__extends(TCa,SCa),Object.defineProperty(TCa.prototype,"images",{get:function(){return this._styleDirty&&this._updateStyle(),this._images},enumerable:!0,configurable:!0}),Object.defineProperty(TCa.prototype,"samplers",{get:function(){return this._styleDirty&&this._updateStyle(),this._samplers},enumerable:!0,configurable:!0}),Object.defineProperty(TCa.prototype,"uvMatrix",{get:function(){return this._styleDirty&&this._updateStyle(),this._uvMatrix},enumerable:!0,configurable:!0}),Object.defineProperty(TCa.prototype,"stageElements",{get:function(){return this._elementsDirty&&this._updateElements(),this._stageElements},enumerable:!0,configurable:!0}),Object.defineProperty(TCa.prototype,"renderMaterial",{get:function(){return this._materialDirty&&this._updateMaterial(),this._renderMaterial},enumerable:!0,configurable:!0}),TCa.prototype.executeRender=function(t,e,i,n){var r=this._renderMaterial._activePass;r._setRenderState(this);var o=r.shader,s=this.stageElements;o.activeElements!=s&&(o.activeElements=s)._setRenderState(this,o),this._stageElements.draw(this,o,this._count,this._offset)},TCa.prototype.onClear=function(t){this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate),this._asset.removeEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateMaterialDelegate),this._asset.removeEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateStyleDelegate),SCa.prototype.onClear.call(this,t),this.renderSceneTransform=null,this._stage=null,this.next=null,this.maskOwners=null,this._renderMaterial.removeOwner(this),this._renderMaterial=null,this._stageElements=null},TCa.prototype._onInvalidateElements=function(t){this._elementsDirty=!0},TCa.prototype._onInvalidateMaterial=function(t){this._materialDirty=!0,this._styleDirty=!0},TCa.prototype._onInvalidateStyle=function(t){this._styleDirty=!0},TCa.prototype._getStageElements=function(){throw new AbstractMethodError},TCa.prototype._getRenderMaterial=function(){throw new AbstractMethodError},TCa.prototype._getStyle=function(){throw new AbstractMethodError},TCa.prototype._updateElements=function(){this._stageElements=this._getStageElements(),this._elementsDirty=!1},TCa.prototype._updateMaterial=function(){var t=this._getRenderMaterial();this._renderMaterial!=t&&(this._renderMaterial&&this._renderMaterial.removeOwner(this),this._renderMaterial=t,this._renderMaterial.addOwner(this)),this._materialDirty=!1},TCa.prototype._updateStyle=function(){var t=this._getStyle();this._materialDirty&&this._updateMaterial();var e=this._renderMaterial.numImages,i=this._renderMaterial.material;this._images.length=e,this._samplers.length=e,this._uvMatrix=t?t.uvMatrix:i.style?i.style.uvMatrix:null;for(var n,r,o,s=this._renderMaterial.material.getNumTextures(),a=0;a<s;a++){e=(n=i.getTextureAt(a)).getNumImages();for(var l=0;l<e;l++)o=this._renderMaterial.getImageIndex(n,l),r=t?t.getImageAt(n,l):null,this._images[o]=r?this._stage.getAbstraction(r):null,this._samplers[o]=t?t.getSamplerAt(n,l):null}this._styleDirty=!1},TCa.prototype.getDefaultMaterial=function(){return MaterialUtils.getDefaultTextureMaterial()},TCa),RenderEntity=(tDa=AbstractionBase,__extends(uDa,tDa),Object.defineProperty(uDa.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(uDa.prototype,"entity",{get:function(){return this._asset},enumerable:!0,configurable:!0}),Object.defineProperty(uDa.prototype,"renderGroup",{get:function(){return this._renderGroup},enumerable:!0,configurable:!0}),uDa.prototype.onClear=function(t){for(var e in this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate),this._asset.removeEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateMaterialDelegate),this._asset.removeEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateStyleDelegate),this._abstractionPool)this._abstractionPool[e].onClear(null);tDa.prototype.onClear.call(this,t)},uDa.prototype._onInvalidateElements=function(t){for(var e in this._abstractionPool)this._abstractionPool[e]._onInvalidateElements()},uDa.prototype._onInvalidateMaterial=function(t){for(var e in this._abstractionPool)this._abstractionPool[e]._onInvalidateMaterial()},uDa.prototype._onInvalidateStyle=function(t){for(var e in this._abstractionPool)this._abstractionPool[e]._onInvalidateStyle()},uDa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new uDa._renderRenderableClassPool[t.assetType](t,this))},uDa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},uDa.registerRenderable=function(t,e){uDa._renderRenderableClassPool[e.assetType]=t},uDa._renderRenderableClassPool=new Object,uDa),StyleEvent=(ODa=EventBase,__extends(PDa,ODa),Object.defineProperty(PDa.prototype,"style",{get:function(){return this._style},enumerable:!0,configurable:!0}),PDa.prototype.clone=function(){return new PDa(this.type,this._style)},PDa.INVALIDATE_PROPERTIES="invalidateProperties",PDa),Style=(TDa=EventDispatcher,__extends(UDa,TDa),Object.defineProperty(UDa.prototype,"sampler",{get:function(){return this._sampler},set:function(t){this._sampler!=t&&(this._sampler=t,this._invalidateProperties())},enumerable:!0,configurable:!0}),Object.defineProperty(UDa.prototype,"image",{get:function(){return this._image},set:function(t){this._image!=t&&(this._image=t,this._invalidateProperties())},enumerable:!0,configurable:!0}),Object.defineProperty(UDa.prototype,"uvMatrix",{get:function(){return this._uvMatrix},set:function(t){this._uvMatrix!=t&&(this._uvMatrix=t,this._invalidateProperties())},enumerable:!0,configurable:!0}),Object.defineProperty(UDa.prototype,"color",{get:function(){return this._color},set:function(t){this._color!=t&&(this._color=t,this._invalidateProperties())},enumerable:!0,configurable:!0}),UDa.prototype.getImageAt=function(t,e){return void 0===e&&(e=0),(this._images[t.id]?this._images[t.id][e]:null)||this._image},UDa.prototype.getSamplerAt=function(t,e){return void 0===e&&(e=0),(this._samplers[t.id]?this._samplers[t.id][e]:null)||this._sampler},UDa.prototype.addImageAt=function(t,e,i){void 0===i&&(i=0),this._images[e.id]||(this._images[e.id]=new Array),this._images[e.id][i]=t},UDa.prototype.addSamplerAt=function(t,e,i){void 0===i&&(i=0),this._samplers[e.id]||(this._samplers[e.id]=new Array),this._samplers[e.id][i]=t,this._invalidateProperties()},UDa.prototype.removeImageAt=function(t,e){void 0===e&&(e=0),this._images[t.id]&&(this._images[t.id][e]=null,this._invalidateProperties())},UDa.prototype.removeSamplerAt=function(t,e){void 0===e&&(e=0),this._samplers[t.id]&&(this._samplers[t.id][e]=null,this._invalidateProperties())},UDa.prototype._invalidateProperties=function(){this.dispatchEvent(new StyleEvent(StyleEvent.INVALIDATE_PROPERTIES,this))},UDa),_Shader_TextureBase=(mEa=AbstractionBase,__extends(nEa,mEa),nEa.prototype.onClear=function(t){mEa.prototype.onClear.call(this,t),this._texture=null,this._shader=null,this._stage=null},nEa.prototype._initVO=function(t){},nEa.prototype._initConstants=function(){},nEa.prototype._getFragmentCode=function(t,e,i,n){throw new AbstractMethodError},nEa.prototype._setRenderState=function(t){},nEa.prototype.activate=function(){},nEa.prototype.getTextureReg=function(t,e,i){var n=this._shader.imageIndices.indexOf(t);if(-1!=n)return i.textures[n];var r=e.getFreeTextureReg();return i.textures.push(r),this._shader.imageIndices.push(t),r},nEa),AnimationRegisterData=(DEa.prototype.reset=function(t,e,i){this.rotationRegisters=new Array,this.positionAttribute=e.animatableAttributes[0],this.scaleAndRotateTarget=e.animationTargetRegisters[0];for(var n,r=1;r<e.animationTargetRegisters.length;r++)this.rotationRegisters.push(e.animationTargetRegisters[r]);this.vertexZeroConst=t.getFreeVertexConstant(),this.vertexZeroConst=new ShaderRegisterElement(this.vertexZeroConst.regName,this.vertexZeroConst.index,0),this.vertexOneConst=new ShaderRegisterElement(this.vertexZeroConst.regName,this.vertexZeroConst.index,1),this.vertexTwoConst=new ShaderRegisterElement(this.vertexZeroConst.regName,this.vertexZeroConst.index,2),this.positionTarget=t.getFreeVertexVectorTemp(),t.addVertexTempUsages(this.positionTarget,1),this.positionTarget=new ShaderRegisterElement(this.positionTarget.regName,this.positionTarget.index),i?(this.velocityTarget=t.getFreeVertexVectorTemp(),t.addVertexTempUsages(this.velocityTarget,1),this.velocityTarget=new ShaderRegisterElement(this.velocityTarget.regName,this.velocityTarget.index),this.vertexTime=new ShaderRegisterElement(this.velocityTarget.regName,this.velocityTarget.index,3),this.vertexLife=new ShaderRegisterElement(this.positionTarget.regName,this.positionTarget.index,3)):(n=t.getFreeVertexVectorTemp(),t.addVertexTempUsages(n,1),this.vertexTime=new ShaderRegisterElement(n.regName,n.index,0),this.vertexLife=new ShaderRegisterElement(n.regName,n.index,1))},DEa.prototype.setUVSourceAndTarget=function(t){this.uvVar=t.animatedUV,this.uvAttribute=t.uvInput,this.uvTarget=new ShaderRegisterElement(this.positionTarget.regName,this.positionTarget.index)},DEa.prototype.setRegisterIndex=function(t,e,i){var n=this.indexDictionary[t.id];null==n&&(n=this.indexDictionary[t.id]=new Array(8)),n[e]=i},DEa.prototype.getRegisterIndex=function(t,e){return this.indexDictionary[t.id][e]},DEa),AnimationNodeBase=(QEa=AssetBase,__extends(REa,QEa),Object.defineProperty(REa.prototype,"stateClass",{get:function(){return this._pStateClass},enumerable:!0,configurable:!0}),REa.prototype.dispose=function(){},Object.defineProperty(REa.prototype,"assetType",{get:function(){return REa.assetType},enumerable:!0,configurable:!0}),REa.assetType="[asset AnimationNodeBase]",REa),ElementsEvent=(SEa=EventBase,__extends(TEa,SEa),Object.defineProperty(TEa.prototype,"attributesView",{get:function(){return this._attributesView},enumerable:!0,configurable:!0}),TEa.prototype.clone=function(){return new TEa(this.type,this._attributesView)},TEa.INVALIDATE_INDICES="invalidateIndices",TEa.CLEAR_INDICES="clearIndices",TEa.INVALIDATE_VERTICES="invalidateVertices",TEa.CLEAR_VERTICES="clearVertices",TEa),ElementsUtils=(XEa.generateFaceNormals=function(t,e,i,n,r){void 0===r&&(r=0);var o=t.get(n,r),s=e.get(e.count);null==i?i=new Float4Attributes(n+r):i.count<n+r&&(i.count=n+r);var a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A,S,w,C,P=t.stride,E=e.dimensions,T=e.stride,M=i.get(n,r),D=n*P,I=0,O=0;if(3==E)for(I=0;I<D;I+=P)l=s[a=o[I]*T],u=s[a+1],_=s[a+2],c=s[a=o[I+1]*T],p=s[a+1],f=s[a+2],h=s[a=o[I+2]*T],d=s[a+1],A=(y=s[a+2]-_)*(v=p-u)-(g=d-u)*(x=f-_),S=(m=h-l)*x-y*(b=c-l),w=g*b-m*v,C=Math.sqrt(A*A+S*S+w*w),M[O++]=A,M[O++]=S,M[O++]=w,M[O++]=C;else if(2==E)for(I=0;I<D;I+=P)M[O++]=0,M[O++]=0,M[O++]=1,M[O++]=1;return i},XEa.generateNormals=function(t,e,i,n){var r=t.get(t.count),o=e.get(e.count);null==i&&(i=new Float3Attributes(n));for(var s,a=t.dimensions,l=i.stride,c=i.get(i.count),h=i.count*l,u=0;u<h;u+=l)c[u]=0,c[u+1]=0,c[u+2]=0;h=t.count*a;var p,d,_,f,m=0,g=1,y=2;for(u=0;u<h;u+=a)c[s=r[u]*l]+=o[m],c[s+1]+=o[g],c[s+2]+=o[y],c[s=r[u+1]*l]+=o[m],c[s+1]+=o[g],c[s+2]+=o[y],c[s=r[u+2]*l]+=o[m],c[s+1]+=o[g],c[s+2]+=o[y],m+=4,g+=4,y+=4;for(h=i.count*l,u=0;u<h;u+=l)p=c[u],d=c[u+1],_=c[u+2],f=1/Math.sqrt(p*p+d*d+_*_),c[u]=p*f,c[u+1]=d*f,c[u+2]=_*f;return i},XEa.generateFaceTangents=function(t,e,i,n,r,o,s){void 0===o&&(o=0);var a=t.get(r,o),l=e.get(e.count),c=i.get(i.count);null==n?n=new Float4Attributes(r+o):n.count<r+o&&(n.count=r+o);for(var h,u,p,d,_,f,m,g,y,b,v,x,A,S,w,C=t.dimensions,P=e.dimensions,E=e.stride,T=i.stride,M=n.get(r,o),D=0,I=r*C,D=0;D<I;D+=C)h=a[D],u=a[D+1],p=a[D+2],d=c[h*T+1],m=c[u*T+1]-d,g=c[p*T+1]-d,_=u*E,f=p*E,b=l[d=h*E],A=g*(l[_]-b)-m*(l[f]-b),v=l[d+1],S=g*(l[1+_]-v)-m*(l[1+f]-v),w=3==P?(x=l[d+2],g*(l[2+_]-x)-m*(l[2+f]-x)):0,y=1/Math.sqrt(A*A+S*S+w*w),M[D]=y*A,M[D+1]=y*S,M[D+2]=y*w;return n},XEa.generateTangents=function(t,e,i,n,r){var o=t.get(t.count),s=e.get(e.count),a=i.get(i.count);null==n&&(n=new Float3Attributes(r));for(var l,c,h=t.dimensions,u=n.stride,p=n.get(n.count),d=n.count*u,_=0;_<d;_+=u)p[_]=0,p[_+1]=0,p[_+2]=0;var f,m,g,y,b=0,v=1,x=2,A=3,d=t.count*h;for(_=0;_<d;_+=h)l=a[A],c=o[_]*u,p[c++]+=s[b]*l,p[c++]+=s[v]*l,p[c]+=s[x]*l,c=o[_+1]*u,p[c++]+=s[b]*l,p[c++]+=s[v]*l,p[c]+=s[x]*l,c=o[_+2]*u,p[c++]+=s[b]*l,p[c++]+=s[v]*l,p[c]+=s[x]*l,b+=3,v+=3,x+=3,A+=4;for(_=0;_<d;_+=u)f=p[_],m=p[_+1],g=p[_+2],y=1/Math.sqrt(f*f+m*m+g*g),p[_]=f*y,p[_+1]=m*y,p[_+2]=g*y;return n},XEa.generateColors=function(t,e,i,n,r){void 0===r&&(r=0),null==e&&(e=new Byte4Attributes(i)),e.count<n+r&&(e.count=n+r);for(var o=e.get(n,r),s=e.stride,a=e.count*s,l=0;l<a;l+=s)o[l]=255,o[l+1]=255,o[l+2]=255,o[l+3]=255;return e},XEa.scale=function(t,e,i,n,r,o){void 0===o&&(o=0),n.count<r+o&&(n.count=r+o);for(var s,a=new Float32Array([t,e,i]),l=n.get(r,o),c=n.stride,h=n.dimensions,u=r*c,p=0;p<u;p+=c)for(s=0;s<h;s++)l[p+s]*=a[s];n.invalidate()},XEa.applyTransformation=function(t,e,i,n,r,o){void 0===o&&(o=0);var s,a,l,c,h,u,p=e.get(r,o),d=e.stride;i&&(s=i.get(r,o),a=i.stride),n&&(l=n.get(r,o),c=n.stride);var _,f=new Vector3D;(i||n)&&((_=t.clone()).invert(),_.transpose());for(var m=0,g=0,y=0,b=0;b<r;++b)h=m+1,u=m+2,f.x=p[m],f.y=p[h],f.z=p[u],f=t.transformVector(f),p[m]=f.x,p[h]=f.y,p[u]=f.z,m+=d,s&&(h=g+1,u=g+2,f.x=s[g],f.y=s[h],f.z=s[u],(f=_.deltaTransformVector(f)).normalize(),s[g]=f.x,s[h]=f.y,s[u]=f.z,g+=a),l&&(h=y+1,u=y+2,f.x=l[y],f.y=l[h],f.z=l[u],(f=_.deltaTransformVector(f)).normalize(),l[y]=f.x,l[h]=f.y,l[u]=f.z,y+=c);e.invalidate(),i&&i.invalidate(),n&&n.invalidate()},XEa.getSubIndices=function(t,e,i,n){void 0===n&&(n=0);var r=t.attributesBuffer,o=t.length;if(i.length=0,o<XEa.LIMIT_INDICES&&e<XEa.LIMIT_VERTS)return r;var s,a,l=t.get(t.count,n),c=new Array,h=XEa._indexSwap;for(h.length=o,d=0;d<o;d++)h[d]=-1;for(var u=0,p=n*t.dimensions,d=0;d<o+p&&d+1<XEa.LIMIT_INDICES&&u+1<XEa.LIMIT_VERTS;)0<=h[s=l[d]]?a=h[s]:(a=u++,i[h[s]=a]=s),c[d++]=a;return r=new AttributesBuffer(t.size*t.dimensions,c.length/t.dimensions),(t=t.clone(r)).set(c),r},XEa.getSubVertices=function(t,e){if(!e.length)return t;for(var i,n,r=t.stride,o=t.bufferView,s=new Uint8Array(e.length*r),a=0,l=0,c=e.length,a=0;a<c;a++)for(i=a*r,n=e[a]*r,l=0;l<r;l++)s[i+l]=o[n+l];return(t=new AttributesBuffer(r,c)).bufferView=s,t},XEa.tempFloat32x4=new Float32Array(4),XEa.LIMIT_VERTS=65535,XEa.LIMIT_INDICES=16777215,XEa._indexSwap=new Array,XEa),_Stage_ElementsBase=(hIa=AbstractionBase,__extends(iIa,hIa),Object.defineProperty(iIa.prototype,"elements",{get:function(){return this._elements},enumerable:!0,configurable:!0}),Object.defineProperty(iIa.prototype,"numIndices",{get:function(){return this._numIndices},enumerable:!0,configurable:!0}),Object.defineProperty(iIa.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),iIa.prototype.getIndexMappings=function(){return this._indicesUpdated||this._updateIndices(),this._indexMappings},iIa.prototype.getIndexBufferGL=function(){return this._indicesUpdated||this._updateIndices(),this._indices},iIa.prototype.getVertexBufferGL=function(t){this._indicesUpdated||this._updateIndices();var e=t.attributesBuffer.id;return this._verticesUpdated[e]||this._updateVertices(t),this._vertices[e]},iIa.prototype.activateVertexBufferVO=function(t,e,i,n){void 0===i&&(i=0),void 0===n&&(n=0),this.getVertexBufferGL(e).activate(t,e.size,i||e.dimensions,e.offset+n,e.unsigned)},iIa.prototype.onClear=function(t){hIa.prototype.onClear.call(this,t),this._elements.removeEventListener(ElementsEvent.CLEAR_INDICES,this._onClearIndicesDelegate),this._elements.removeEventListener(ElementsEvent.INVALIDATE_INDICES,this._onInvalidateIndicesDelegate),this._elements.removeEventListener(ElementsEvent.CLEAR_VERTICES,this._onClearVerticesDelegate),this._elements.removeEventListener(ElementsEvent.INVALIDATE_VERTICES,this._onInvalidateVerticesDelegate),this._elements=null,this._overflow&&(this._overflow.onClear(t),this._overflow=null)},iIa.prototype._setRenderState=function(t,e){this._verticesUpdated||this._updateIndices()},iIa.prototype.draw=function(t,e,i,n){throw new AbstractMethodError},iIa.prototype._updateIndices=function(t){void 0===t&&(t=0);var e=this._elements.indices;if(e?(this._indices=this._stage.getAbstraction(ElementsUtils.getSubIndices(e,this._elements.numVertices,this._indexMappings,t)),this._numIndices=this._indices._attributesBuffer.count*e.dimensions):(this._indices=null,this._numIndices=0,this._indexMappings=Array()),t+=this._numIndices,e&&t<e.count*this._elements.indices.dimensions?(this._overflow||(this._overflow=this._pGetOverflowElements()),this._overflow._updateIndices(t)):this._overflow&&(this._overflow.onClear(new AssetEvent(AssetEvent.CLEAR,this._elements)),this._overflow=null),this._indicesUpdated=!0,this._indexMappings.length)for(var i in this._verticesUpdated)this._verticesUpdated[i]=!1},iIa.prototype._updateVertices=function(t){this._numVertices=this._elements.numVertices;var e=t.attributesBuffer.id;this._vertices[e]=this._stage.getAbstraction(ElementsUtils.getSubVertices(t.attributesBuffer,this._indexMappings)),this._verticesUpdated[e]=!0},iIa.prototype._onInvalidateIndices=function(t){t.attributesView&&(this._indicesUpdated=!1)},iIa.prototype._onClearIndices=function(t){t.attributesView&&(this._indices.onClear(new AssetEvent(AssetEvent.CLEAR,t.attributesView)),this._indices=null)},iIa.prototype._onInvalidateVertices=function(t){var e;t.attributesView&&(e=t.attributesView.attributesBuffer.id,this._verticesUpdated[e]=!1)},iIa.prototype._onClearVertices=function(t){var e;t.attributesView&&(e=t.attributesView.attributesBuffer.id,this._vertices[e]&&(this._vertices[e].onClear(new AssetEvent(AssetEvent.CLEAR,t.attributesView)),delete this._vertices[e],delete this._verticesUpdated[e]))},iIa.prototype._pGetOverflowElements=function(){throw new AbstractMethodError},iIa),ChunkVO=function(){},MappingMode,hIa,SEa,QEa,mEa,TDa,ODa,tDa,SCa,LCa,xBa,sBa,nBa,Zza,Rza,OIa;function iIa(t,e){var i=hIa.call(this,t,e)||this;return i.usages=0,i._vertices=new Object,i._verticesUpdated=new Object,i._indexMappings=Array(),i._numIndices=0,i._elements=t,i._stage=e,i._onInvalidateIndicesDelegate=function(t){return i._onInvalidateIndices(t)},i._onClearIndicesDelegate=function(t){return i._onClearIndices(t)},i._onInvalidateVerticesDelegate=function(t){return i._onInvalidateVertices(t)},i._onClearVerticesDelegate=function(t){return i._onClearVertices(t)},i._elements.addEventListener(ElementsEvent.CLEAR_INDICES,i._onClearIndicesDelegate),i._elements.addEventListener(ElementsEvent.INVALIDATE_INDICES,i._onInvalidateIndicesDelegate),i._elements.addEventListener(ElementsEvent.CLEAR_VERTICES,i._onClearVerticesDelegate),i._elements.addEventListener(ElementsEvent.INVALIDATE_VERTICES,i._onInvalidateVerticesDelegate),i}function XEa(){}function TEa(t,e){var i=SEa.call(this,t)||this;return i._attributesView=e,i}function REa(){return QEa.call(this)||this}function DEa(){this.indexDictionary=new Object}function nEa(t,e){var i=mEa.call(this,t,e)||this;return i._texture=t,i._shader=e,i._stage=e._stage,i}function UDa(){var t=TDa.call(this)||this;return t._samplers=new Object,t._images=new Object,t._color=16777215,t}function PDa(t,e){var i=ODa.call(this,t)||this;return i._style=e,i}function uDa(t,e,i){var n=tDa.call(this,e,i)||this;return n._abstractionPool=new Object,n._stage=t,n._renderGroup=i,n._onInvalidateElementsDelegate=function(t){return n._onInvalidateElements(t)},n._onInvalidateMaterialDelegate=function(t){return n._onInvalidateMaterial(t)},n._onInvalidateStyleDelegate=function(t){return n._onInvalidateStyle(t)},n._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,n._onInvalidateElementsDelegate),n._asset.addEventListener(RenderableEvent.INVALIDATE_MATERIAL,n._onInvalidateMaterialDelegate),n._asset.addEventListener(RenderableEvent.INVALIDATE_STYLE,n._onInvalidateStyleDelegate),n}function TCa(t,e){var i=SCa.call(this,t,e)||this;return i._materialDirty=!0,i._elementsDirty=!0,i._styleDirty=!0,i._images=new Array,i._samplers=new Array,i._count=0,i._offset=0,i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)},i._onInvalidateMaterialDelegate=function(t){return i._onInvalidateMaterial(t)},i._onInvalidateStyleDelegate=function(t){return i._onInvalidateStyle(t)},i.sourceEntity=e.entity,i._stage=e.stage,i.renderGroup=e.renderGroup,i._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate),i._asset.addEventListener(RenderableEvent.INVALIDATE_MATERIAL,i._onInvalidateMaterialDelegate),i._asset.addEventListener(RenderableEvent.INVALIDATE_STYLE,i._onInvalidateStyleDelegate),i}function QCa(){}function MCa(t,e){var i=LCa.call(this,t)||this;return i._renderable=e,i}function yCa(t,e,i){this._abstractionPool=new Object,this._stage=t,this._renderMaterialClassPool=e,this._renderGroup=i}function yBa(t,e){var i=xBa.call(this,t,e)||this;return i._owners=new Array,i._passes=new Array,i._invalidAnimation=!0,i._invalidRender=!0,i._invalidImages=!0,i._imageIndices=new Object,i._usesAnimation=!1,i.images=new Array,i.samplers=new Array,i.requiresBlending=!1,i.materialID=t.id,i._material=t,i._renderElements=e,i._stage=e.stage,i._renderGroup=e.renderGroup,i._onInvalidateTexturesDelegate=function(t){return i.onInvalidateTextures(t)},i._onInvalidatePassesDelegate=function(t){return i.onInvalidatePasses(t)},i._material.addEventListener(MaterialEvent.INVALIDATE_TEXTURES,i._onInvalidateTexturesDelegate),i._material.addEventListener(MaterialEvent.INVALIDATE_PASSES,i._onInvalidatePassesDelegate),i._onPassInvalidateDelegate=function(t){return i.onPassInvalidate(t)},i}function tBa(t,e){var i=sBa.call(this,t)||this;return i._material=e,i}function oBa(t,e){var i=nBa.call(this,t)||this;return i._pass=e,i}function lAa(t,e,i,n){this._abstractionPool=new Object,this._blendFactorSource=ContextGLBlendFactor.ONE,this._blendFactorDest=ContextGLBlendFactor.ZERO,this._invalidProgram=!0,this._animationVertexCode="",this._animationFragmentCode="",this._vertexCode="",this._fragmentCode="",this._postAnimationFragmentCode="",this.usesBlending=!1,this.useImageRect=!1,this.usesCurves=!1,this.depthCompareMode=ContextGLCompareMode.LESS_EQUAL,this.writeDepth=!0,this._defaultCulling=ContextGLTriangleFace.BACK,this._pInverseSceneMatrix=new Float32Array(16),this.ambientR=255,this.ambientG=255,this.ambientB=255,this.usesGlobalPosFragment=!1,this.usesPositionFragment=!1,this.imageIndices=new Array,this._renderElements=t,this._renderMaterial=e,this._pass=i,this._stage=n,this._view=t.renderGroup.view,this.profile=this._stage.profile}function kAa(){}function $za(){var t=Zza.call(this)||this;return t.jointPoses=new Array,t}function Sza(){var t=Rza.call(this)||this;return t.joints=new Array,t}function Qza(){}function Gza(){this.orientation=new Quaternion,this.translation=new Vector3D}function Dza(t,e){if(t<=0||1<=t)throw new Error("life exceeds range (0,1)");this._life=t,this._color=e}function qza(){this._pVertexBuffer=new Array(8),this._pBufferContext=new Array(8),this._pBufferDirty=new Array(8),this.numProcessedVertices=0,this.previousTime=Number.NEGATIVE_INFINITY,this.animationParticles=new Array;for(var t=0;t<8;t++)this._pBufferDirty[t]=!0;this._iUniqueId=qza.SUBGEOM_ID_COUNT++}OIa=MappingMode=MappingMode||{},OIa[OIa.LINEAR=0]="LINEAR",OIa[OIa.RADIAL=1]="RADIAL";var Filter3DRenderer=(PIa.prototype.onRTTResize=function(t){this._filterSizesInvalid=!0},Object.defineProperty(PIa.prototype,"requireDepthRender",{get:function(){return this._requireDepthRender},enumerable:!0,configurable:!0}),PIa.prototype.getMainInputTexture=function(t){return this._filterTasksInvalid&&this.updateFilterTasks(t),this._mainInputTexture},Object.defineProperty(PIa.prototype,"filters",{get:function(){return this._filters},set:function(t){if(this._filters=t,this._filterTasksInvalid=!0,this._requireDepthRender=!1,this._filters){for(var e=0;e<this._filters.length;++e)this._filters[e].requireDepthRender&&(this._requireDepthRender=!0);this._filterSizesInvalid=!0}},enumerable:!0,configurable:!0}),Object.defineProperty(PIa.prototype,"sampler",{get:function(){return this._sampler},enumerable:!0,configurable:!0}),Object.defineProperty(PIa.prototype,"renderToTextureRect",{get:function(){return this._filterSizesInvalid&&this.updateFilterSizes(),this._renderToTextureRect},enumerable:!0,configurable:!0}),PIa.prototype.updateFilterTasks=function(t){var e,i;if(this._filterSizesInvalid&&this.updateFilterSizes(),this._filters){this._tasks=new Array,e=this._filters.length-1;for(var n=0;n<=e;++n)(i=this._filters[n]).setRenderTargets(n==e?null:this._filters[n+1].getMainInputTexture(t),t),this._tasks=this._tasks.concat(i.tasks);this._mainInputTexture=this._filters[0].getMainInputTexture(t)}else this._tasks=null},PIa.prototype.render=function(t,e,i){var n,r,o,s=t.context,a=this._rttManager.indexBuffer,l=this._rttManager.renderToTextureVertexBuffer;if(this._filters){for(this._filterSizesInvalid&&this.updateFilterSizes(),this._filterTasksInvalid&&this.updateFilterTasks(t),n=this._filters.length,r=0;r<n;++r)this._filters[r].update(t,e);for(1<(n=this._tasks.length)&&(s.setProgram(this._tasks[0].getProgram(t)),s.setVertexBufferAt(this._tasks[0]._positionIndex,l,0,ContextGLVertexBufferFormat.FLOAT_2),s.setVertexBufferAt(this._tasks[0]._uvIndex,l,8,ContextGLVertexBufferFormat.FLOAT_2)),r=0;r<n;++r)o=this._tasks[r],t.setRenderTarget(o.target),s.setProgram(o.getProgram(t)),t.getAbstraction(o.getMainInputTexture(t)).activate(o._inputTextureIndex,this._sampler),o.target||(l=this._rttManager.renderToScreenVertexBuffer,s.setVertexBufferAt(o._positionIndex,l,0,ContextGLVertexBufferFormat.FLOAT_2),s.setVertexBufferAt(o._uvIndex,l,8,ContextGLVertexBufferFormat.FLOAT_2)),s.clear(0,0,0,0),o.activate(t,e,i),s.setBlendFactors(ContextGLBlendFactor.ONE,ContextGLBlendFactor.ZERO),s.drawIndices(ContextGLDrawMode.TRIANGLES,a,0,6),o.deactivate(t);s.setTextureAt(0,null),s.setVertexBufferAt(0,null),s.setVertexBufferAt(1,null)}},PIa.prototype.updateFilterSizes=function(){for(var t=0;t<this._filters.length;++t)this._filters[t].textureWidth=this._rttManager.textureWidth,this._filters[t].textureHeight=this._rttManager.textureHeight,this._filters[t].rttManager=this._rttManager;var e=this._filters[0].textureScale;this._renderToTextureRect.x=this._rttManager.renderToTextureRect.x/e,this._renderToTextureRect.y=this._rttManager.renderToTextureRect.y/e,this._renderToTextureRect.width=this._rttManager.renderToTextureRect.width/e,this._renderToTextureRect.height=this._rttManager.renderToTextureRect.height/e,this._filterSizesInvalid=!1},PIa.prototype.dispose=function(){this._rttManager.removeEventListener(RTTEvent.RESIZE,this._onRTTResizeDelegate),this._rttManager=null,this._stage=null},PIa),RenderableMergeSort=(kJa.prototype.sortBlendedRenderables=function(t){var e,i,n,r,o,s;if(!t||!t.next)return t;for(i=(n=t).next;i;)(i=i.next)&&(n=n.next,i=i.next);if(e=n.next,n.next=null,t=this.sortBlendedRenderables(t),e=this.sortBlendedRenderables(e),!t)return e;if(!e)return t;for(;t&&e;)t.zIndex<e.zIndex?t=(s=t).next:e=(s=e).next,r?o.next=s:r=s,o=s;return t?o.next=t:e&&(o.next=e),r},kJa.prototype.sortOpaqueRenderables=function(t){var e,i,n,r,o,s;if(!t||!t.next)return t;for(i=(n=t).next;i;)(i=i.next)&&(n=n.next,i=i.next);if(e=n.next,n.next=null,t=this.sortOpaqueRenderables(t),e=this.sortOpaqueRenderables(e),!t)return e;if(!e)return t;for(;t&&e&&null!=t&&null!=e;){var a,l,c=t.renderOrderId,h=e.renderOrderId;(c==h?(a=t.materialID)==(l=e.materialID)?t.zIndex<e.zIndex?1:-1:l<a?1:-1:h<c?1:-1)<0?t=(s=t).next:e=(s=e).next,r?o.next=s:r=s,o=s}return t?o.next=t:e&&(o.next=e),r},kJa),RendererBase=(EJa=AbstractionBase,__extends(FJa,EJa),Object.defineProperty(FJa.prototype,"maskOwners",{get:function(){return this.sourceEntity.maskOwners},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"partition",{get:function(){return this._partition},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"renderGroup",{get:function(){return this._renderGroup},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"cullPlanes",{get:function(){return this._customCullPlanes},set:function(t){this._customCullPlanes=t},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"renderBlended",{get:function(){return this._renderBlended},set:function(t){this._renderBlended=t},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"disableColor",{get:function(){return this._disableColor},set:function(t){this._disableColor!=t&&(this._disableColor=t,this._invalid=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"disableClear",{get:function(){return this._disableClear},set:function(t){this._disableClear!=t&&(this._disableClear=t,this._invalid=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"numElements",{get:function(){return this._pNumElements},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"context",{get:function(){return this._context},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(FJa.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),FJa.prototype.onClear=function(t){EJa.prototype.onClear.call(this,t),this._renderGroup.removeEventListener(StageEvent.CONTEXT_CREATED,this._onContextUpdateDelegate),this._renderGroup.removeEventListener(StageEvent.CONTEXT_RECREATED,this._onContextUpdateDelegate),this._renderGroup.removeEventListener(ViewEvent.INVALIDATE_SIZE,this._onSizeInvalidateDelegate),this._onContextUpdateDelegate=null,this._onSizeInvalidateDelegate=null,this._view=null,this._stage=null,this._context=null,this.next=null},FJa.prototype.render=function(t,e,i,n){void 0===t&&(t=!0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this._enableDepthAndStencil=t,this._surfaceSelector=e,this._mipmapSelector=i,this._maskConfig=n,this._maskConfig&&(this._disableClear=!0,this._disableColor=!0),this._renderGroup.update(this._partition),this._view.target&&this._view.target.invalidateMipmaps(),this._view.clear(!this._depthPrepass&&!this._disableClear,t,e,i,!this._view.shareContext||this._view.target?ContextGLClearMask.ALL:ContextGLClearMask.DEPTH),this._context.setBlendFactors(ContextGLBlendFactor.ONE,ContextGLBlendFactor.ZERO),this._context.setDepthTest(!0,ContextGLCompareMode.LESS_EQUAL),this.executeRender(t,e,i),this._view.shareContext&&!this._view.target||this._snapshotRequired&&this._snapshotBitmapImage2D&&(this._context.drawToBitmapImage2D(this._snapshotBitmapImage2D),this._snapshotRequired=!1)},FJa.prototype.traverse=function(){this._pBlendedRenderableHead=null,this._pOpaqueRenderableHead=null,this._pNumElements=0,this._activeMaskOwners=null,this._cameraTransform=this._view.projection.transform.concatenatedMatrix3D,this._cameraForward=this._view.projection.transform.forwardVector,this._cullPlanes=this._customCullPlanes?this._customCullPlanes:this._view.projection.viewFrustumPlanes,this._numCullPlanes=this._cullPlanes?this._cullPlanes.length:0,FJa._collectionMark++,this._partition.traverse(this),this.renderableSorter&&(this._pOpaqueRenderableHead=this.renderableSorter.sortOpaqueRenderables(this._pOpaqueRenderableHead),this._pBlendedRenderableHead=this.renderableSorter.sortBlendedRenderables(this._pBlendedRenderableHead)),this._invalid=!1},FJa.prototype._iRenderCascades=function(t,e,i,n){},FJa.prototype.executeRender=function(t,e,i){this.traverse(),this._disableColor?this._context.setColorMask(!1,!1,!1,!1):this._context.setColorMask(!0,!0,!0,!0),this._maskConfig?this._context.enableStencil():this._context.disableStencil(),this.drawRenderables(this._pOpaqueRenderableHead),this._renderBlended&&this.drawRenderables(this._pBlendedRenderableHead)},FJa.prototype.onInvalidate=function(t){EJa.prototype.onInvalidate.call(this,t),this._renderGroup.invalidate()},FJa.prototype.queueSnapshot=function(t){this._snapshotRequired=!0,this._snapshotBitmapImage2D=t},FJa.prototype.drawRenderables=function(t){for(var e,i,n,r;t;){for(r=(n=t.renderMaterial)?n.numPasses:1,(this._activeMasksDirty||this._checkMaskOwners(t.maskOwners))&&((this._activeMaskOwners=t.maskOwners)?this._renderMasks(this._activeMaskOwners):this._maskConfig||this._context.disableStencil(),this._activeMasksDirty=!1),e=0;e<r;e++){for(n&&n.activatePass(e),i=t;i.executeRender(this._enableDepthAndStencil,this._surfaceSelector,this._mipmapSelector,this._maskConfig),(i=i.next)&&i.renderMaterial==n&&!(this._activeMasksDirty=this._checkMaskOwners(i.maskOwners)););n&&n.deactivatePass()}t=i}},FJa.prototype.onContextUpdate=function(t){this._context=this._stage.context},FJa.prototype.onSizeInvalidate=function(t){this._pRttBufferManager&&(this._pRttBufferManager.viewWidth=this._view.width,this._pRttBufferManager.viewHeight=this._view.height),this._depthTextureDirty=!0},FJa.prototype.enterNode=function(t){var e=t._collectionMark!=FJa._collectionMark&&t.isRenderable()&&(this._maskConfig||t.isInFrustum(this._partition.root,this._cullPlanes,this._numCullPlanes,this._renderGroup.pickGroup))&&t.maskId==this._maskId;return t._collectionMark=FJa._collectionMark,e},FJa.prototype.getTraverser=function(t){return this},FJa.prototype.applyEntity=function(t){this._sourceEntity=t,this._renderEntity=this._renderGroup.getAbstraction(t),this._zIndex=t.zOffset+this._cameraTransform.position.subtract(t.scenePosition).dotProduct(this._cameraForward),this._renderSceneTransform=t.getRenderSceneTransform(this._cameraTransform),t._acceptTraverser(this)},FJa.prototype.applyTraversable=function(t){var e=this._renderEntity.getAbstraction(t);e.cascaded=!1,e.zIndex=this._zIndex,e.maskId=this._sourceEntity.maskId,e.maskOwners=this._sourceEntity.maskOwners;var i=e.renderMaterial;e.materialID=i.materialID,e.renderOrderId=i.renderOrderId,e.renderSceneTransform=this._renderSceneTransform,i.requiresBlending?(e.next=this._pBlendedRenderableHead,this._pBlendedRenderableHead=e):(e.next=this._pOpaqueRenderableHead,this._pOpaqueRenderableHead=e),this._pNumElements+=e.stageElements.elements.numElements},FJa.prototype._renderMasks=function(t){var e=Math.log2(this._maskConfig)>>1,i=this._maskConfig?Math.pow(2,1+e<<1):1,n=i;this._context.enableStencil(),this._context.setStencilActions(ContextGLTriangleFace.FRONT_AND_BACK,ContextGLCompareMode.ALWAYS,ContextGLStencilAction.SET,ContextGLStencilAction.SET,ContextGLStencilAction.SET);for(var r,o,s,a=t.length,l=0;l<a;++l){0!=l&&this._context.setStencilActions(ContextGLTriangleFace.FRONT_AND_BACK,ContextGLCompareMode.EQUAL,ContextGLStencilAction.SET,ContextGLStencilAction.SET,ContextGLStencilAction.KEEP),this._context.setStencilReferenceValue(255,n,n=(n&i)+i),this._context.clear(0,0,0,0,0,0,ContextGLClearMask.STENCIL),o=(r=t[l].masks).length;for(var c=0;c<o;++c)(s=r[c])&&this._renderGroup.getRenderer(s.partition).render(!0,0,0,n)}this._context.setStencilActions(ContextGLTriangleFace.FRONT_AND_BACK,ContextGLCompareMode.EQUAL,ContextGLStencilAction.SET,ContextGLStencilAction.SET,ContextGLStencilAction.KEEP),this._context.setStencilReferenceValue(255,n,this._maskConfig),this._disableColor||this._context.setColorMask(!0,!0,!0,!0)},FJa.prototype._checkMaskOwners=function(t){if(null==this._activeMaskOwners||null==t)return Boolean(this._activeMaskOwners!=t);if(this._activeMaskOwners.length!=t.length)return!0;for(var e,i,n,r=t.length,o=0;o<r;o++){if(e=(i=t[o].masks).length,(n=this._activeMaskOwners[o].masks).length!=e)return!0;for(var s=0;s<e;s++)if(n[s]!=i[s])return!0}return!1},FJa._collectionMark=0,FJa),DefaultRenderer=(HKa=RendererBase,__extends(IKa,HKa),Object.defineProperty(IKa.prototype,"antiAlias",{get:function(){return this._stage.antiAlias},set:function(t){this._stage.antiAlias=t},enumerable:!0,configurable:!0}),Object.defineProperty(IKa.prototype,"depthPrepass",{get:function(){return this._depthPrepass},set:function(t){this._depthPrepass=t},enumerable:!0,configurable:!0}),Object.defineProperty(IKa.prototype,"filters3d",{get:function(){return this._filter3DRenderer?this._filter3DRenderer.filters:null},set:function(t){t&&0==t.length&&(t=null),this._filter3DRenderer&&!t?(this._filter3DRenderer.dispose(),this._filter3DRenderer=null):!this._filter3DRenderer&&t&&(this._filter3DRenderer=new Filter3DRenderer(this._stage),this._filter3DRenderer.filters=t),this._filter3DRenderer?(this._filter3DRenderer.filters=t,this._requireDepthRender=this._filter3DRenderer.requireDepthRender):(this._requireDepthRender=!1,this._depthRender&&(this._depthRender.dispose(),this._depthRender=null))},enumerable:!0,configurable:!0}),IKa.prototype.enterNode=function(t){var e=HKa.prototype.enterNode.call(this,t);return e&&t.boundsVisible&&this.applyEntity(t.getBoundsPrimitive(this._renderGroup.pickGroup)),e},IKa.prototype.render=function(t,e,i,n){void 0===t&&(t=!0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),this._stage.recoverFromDisposal()&&(this._requireDepthRender&&this._renderSceneDepthToTexture(),this._depthPrepass&&this._renderDepthPrepass(),this._filter3DRenderer?(this._view.target=this._filter3DRenderer.getMainInputTexture(this._stage),HKa.prototype.render.call(this,t,e,i),this._filter3DRenderer.render(this._stage,this._view.projection,this._depthRender)):HKa.prototype.render.call(this,t,e,i,n),n||this._view.present())},IKa.prototype.onClear=function(t){HKa.prototype.onClear.call(this,t),this._pRttBufferManager.dispose(),this._pRttBufferManager=null,this._depthRenderer.onClear(t),this._distanceRenderer.onClear(t),this._depthRenderer=null,this._distanceRenderer=null,this._depthRender=null},IKa.prototype._renderDepthPrepass=function(){this._depthRenderer.disableColor=!0,this._depthRenderer.view.projection=this._view.projection,this._filter3DRenderer?this._depthRenderer.view.target=this._filter3DRenderer.getMainInputTexture(this._stage):this._depthRenderer.view.target=null,this._depthRenderer.render(),this._depthRenderer.disableColor=!1},IKa.prototype._renderSceneDepthToTexture=function(){!this._depthTextureDirty&&this._depthRender||this.initDepthTexture(this._stage.context),this._depthRenderer.render()},IKa.prototype.initDepthTexture=function(t){this._depthTextureDirty=!1,this._depthRender&&this._depthRender.dispose(),this._depthRender=new BitmapImage2D(this._pRttBufferManager.textureWidth,this._pRttBufferManager.textureHeight),this._depthRenderer.view.target=this._depthRender,this._depthRenderer.view.projection=this._view.projection},IKa),DepthRenderer=(YKa=RendererBase,__extends(ZKa,YKa),ZKa.prototype.enterNode=function(t){return t._collectionMark!=RendererBase._collectionMark&&t.isCastingShadow()?YKa.prototype.enterNode.call(this,t):(t._collectionMark=RendererBase._collectionMark,!1)},ZKa),DistanceRenderer=(cLa=RendererBase,__extends(dLa,cLa),dLa.prototype.enterNode=function(t){return t._collectionMark!=RendererBase._collectionMark&&t.isCastingShadow()?cLa.prototype.enterNode.call(this,t):(t._collectionMark=RendererBase._collectionMark,!1)},dLa),_a$1,_b$1,DefaultRendererPool=(Object.defineProperty(iLa.prototype,"materialClassPool",{get:function(){return iLa._materialClassPool},enumerable:!0,configurable:!0}),iLa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new DefaultRenderer(this._renderGroup,t,this))},iLa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},iLa.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},iLa.registerMaterial=function(t,e){iLa._materialClassPool[e.assetType]=t},iLa._materialClassPool=new Object,iLa),DepthRendererPool=(Object.defineProperty(pLa.prototype,"materialClassPool",{get:function(){return pLa._materialClassPool},enumerable:!0,configurable:!0}),pLa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new DepthRenderer(this._renderGroup,t,this))},pLa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},pLa.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},pLa.registerMaterial=function(t,e){pLa._materialClassPool[e.assetType]=t},pLa._materialClassPool=new Object,pLa),DistanceRendererPool=(Object.defineProperty(wLa.prototype,"materialClassPool",{get:function(){return wLa._materialClassPool},enumerable:!0,configurable:!0}),wLa.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=new DistanceRenderer(this._renderGroup,t,this))},wLa.prototype.clearAbstraction=function(t){delete this._abstractionPool[t.id]},wLa.prototype.clearAll=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},wLa.registerMaterial=function(t,e){wLa._materialClassPool[e.assetType]=t},wLa._materialClassPool=new Object,wLa),RendererType,cLa,YKa,HKa,EJa,DLa;function wLa(t){this._abstractionPool=new Object,this._renderGroup=t}function pLa(t){this._abstractionPool=new Object,this._renderGroup=t}function iLa(t){this._abstractionPool=new Object,this._renderGroup=t}function dLa(t,e,i){return cLa.call(this,t,e,i)||this}function ZKa(t,e,i){return YKa.call(this,t,e,i)||this}function IKa(t,e,i){var n=HKa.call(this,t,e,i)||this;return n._pRttBufferManager=RTTBufferManager.getInstance(n._stage),n._depthRenderer=t.depthRenderGroup.getRenderer(e),n._distanceRenderer=t.distanceRenderGroup.getRenderer(e),n}function FJa(t,e,i){var n=EJa.call(this,e,i)||this;return n._cameraForward=new Vector3D,n._depthTextureDirty=!0,n._depthPrepass=!1,n._pNumElements=0,n._disableColor=!1,n._disableClear=!1,n._renderBlended=!0,n._numCullPlanes=0,n._partition=e,n.sourceEntity=e.root,n._maskId=e.root.maskId,n._onSizeInvalidateDelegate=function(t){return n.onSizeInvalidate(t)},n._onContextUpdateDelegate=function(t){return n.onContextUpdate(t)},n.renderableSorter=new RenderableMergeSort,n._renderGroup=t,n._renderGroup.addEventListener(StageEvent.CONTEXT_CREATED,n._onContextUpdateDelegate),n._renderGroup.addEventListener(StageEvent.CONTEXT_RECREATED,n._onContextUpdateDelegate),n._renderGroup.addEventListener(ViewEvent.INVALIDATE_SIZE,n._onSizeInvalidateDelegate),n._view=n._renderGroup.view,n._stage=n._renderGroup.stage,n._stage.context&&(n._context=n._stage.context),n}function kJa(){}function PIa(t){var e=this;this._filterSizesInvalid=!0,this._onRTTResizeDelegate=function(t){return e.onRTTResize(t)},this._stage=t,this._rttManager=RTTBufferManager.getInstance(t),this._rttManager.addEventListener(RTTEvent.RESIZE,this._onRTTResizeDelegate),this._sampler=new ImageSampler(!1,!1,!1),this._renderToTextureRect=new Rectangle}DLa=RendererType=RendererType||{},DLa[DLa.DEFAULT=0]="DEFAULT",DLa[DLa.DEPTH=1]="DEPTH",DLa[DLa.DISTANCE=2]="DISTANCE";var RenderGroup=(ELa=EventDispatcher,__extends(FLa,ELa),FLa.clearAllInstances=function(){for(var t in this._instancePool)this._instancePool[t].clearAll(),delete this._instancePool[t]},FLa.getInstance=function(t,e){return this._instancePool[e][t.id]||(this._instancePool[e][t.id]=new FLa(t,e))},FLa.clearInstance=function(t,e){var i=this._instancePool[e][t.id];i&&(i.clearAll(),delete this._instancePool[e][t.id])},Object.defineProperty(FLa.prototype,"view",{get:function(){return this._view},enumerable:!0,configurable:!0}),Object.defineProperty(FLa.prototype,"depthRenderGroup",{get:function(){return null==this._depthRenderGroup&&(this._depthRenderGroup=FLa.getInstance(new View(null,this._stage),RendererType.DEPTH)),this._depthRenderGroup},enumerable:!0,configurable:!0}),Object.defineProperty(FLa.prototype,"distanceRenderGroup",{get:function(){return null==this._distanceRenderGroup&&(this._distanceRenderGroup=FLa.getInstance(new View(null,this._stage),RendererType.DISTANCE)),this._distanceRenderGroup},enumerable:!0,configurable:!0}),Object.defineProperty(FLa.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(FLa.prototype,"pickGroup",{get:function(){return this._pickGroup},enumerable:!0,configurable:!0}),FLa.prototype.clearAll=function(){for(var t in this._stage.removeEventListener(StageEvent.CONTEXT_CREATED,this._onContextUpdateDelegate),this._stage.removeEventListener(StageEvent.CONTEXT_RECREATED,this._onContextUpdateDelegate),this._view.removeEventListener(ViewEvent.INVALIDATE_SIZE,this._onSizeInvalidateDelegate),this._entityPool)this._entityPool[t].onClear(null);this._rendererPool.clearAll()},FLa.prototype.update=function(t){for(var e=this._mappers.length,i=0;i<e;i++)this._mappers[i].update(t,this)},FLa.prototype.invalidate=function(){this._invalid=!0},FLa.prototype._addMapper=function(t){-1==this._mappers.indexOf(t)&&this._mappers.push(t)},FLa.prototype._removeMapper=function(t){var e=this._mappers.indexOf(t);-1!=e&&this._mappers.splice(e,1)},FLa.prototype.onSizeInvalidate=function(t){this.dispatchEvent(t)},FLa.prototype.onContextUpdate=function(t){this.dispatchEvent(t)},FLa.prototype.getRenderElements=function(t){return this._materialPools[t.assetType]||(this._materialPools[t.assetType]=new FLa._renderElementsClassPool[t.assetType](this._stage,this._materialClassPool,this))},FLa.prototype.getAbstraction=function(t){return this._entityPool[t.id]||(this._entityPool[t.id]=new RenderEntity(this._stage,t,this))},FLa.prototype.getRenderer=function(t){return this._rendererPool.getAbstraction(t)},FLa.prototype.clearAbstraction=function(t){delete this._entityPool[t.id]},FLa.registerElements=function(t,e){FLa._renderElementsClassPool[e.assetType]=t},FLa.registerDefaultMaterial=function(t,e){DefaultRendererPool.registerMaterial(t,e)},FLa.registerDepthMaterial=function(t,e){DepthRendererPool.registerMaterial(t,e)},FLa.registerDistanceMaterial=function(t,e){DistanceRendererPool.registerMaterial(t,e)},FLa._rendererClass=((_a$1={})[RendererType.DEFAULT]=DefaultRendererPool,_a$1[RendererType.DEPTH]=DepthRendererPool,_a$1[RendererType.DISTANCE]=DistanceRendererPool,_a$1),FLa._defaultInstancePool=new Object,FLa._depthInstancePool=new Object,FLa._distanceInstancePool=new Object,FLa._instancePool=((_b$1={})[RendererType.DEFAULT]=FLa._defaultInstancePool,_b$1[RendererType.DEPTH]=FLa._depthInstancePool,_b$1[RendererType.DISTANCE]=FLa._distanceInstancePool,_b$1),FLa._renderElementsClassPool=new Object,FLa),ELa;function FLa(t,e){var i=ELa.call(this)||this;return i._mappers=new Array,i._materialPools=new Object,i._entityPool=new Object,i._view=t,i._stage=t.stage,i._pickGroup=PickGroup.getInstance(t),i._rendererPool=new FLa._rendererClass[e](i),i._materialClassPool=i._rendererPool.materialClassPool,e!=RendererType.DEFAULT&&(i._view.backgroundColor=16777215),i._onSizeInvalidateDelegate=function(t){return i.onSizeInvalidate(t)},i._onContextUpdateDelegate=function(t){return i.onContextUpdate(t)},i._stage.addEventListener(StageEvent.CONTEXT_CREATED,i._onContextUpdateDelegate),i._stage.addEventListener(StageEvent.CONTEXT_RECREATED,i._onContextUpdateDelegate),i._view.addEventListener(ViewEvent.INVALIDATE_SIZE,i._onSizeInvalidateDelegate),i}console.debug("AwayJS - Renderer - 0.11.2");var AnimationClipNodeBase=(kMa=AnimationNodeBase,__extends(lMa,kMa),Object.defineProperty(lMa.prototype,"looping",{get:function(){return this._pLooping},set:function(t){this._pLooping!=t&&(this._pLooping=t,this._pStitchDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(lMa.prototype,"stitchFinalFrame",{get:function(){return this._pStitchFinalFrame},set:function(t){this._pStitchFinalFrame!=t&&(this._pStitchFinalFrame=t,this._pStitchDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(lMa.prototype,"totalDuration",{get:function(){return this._pStitchDirty&&this._pUpdateStitch(),this._pTotalDuration},enumerable:!0,configurable:!0}),Object.defineProperty(lMa.prototype,"totalDelta",{get:function(){return this._pStitchDirty&&this._pUpdateStitch(),this._pTotalDelta},enumerable:!0,configurable:!0}),Object.defineProperty(lMa.prototype,"lastFrame",{get:function(){return this._pStitchDirty&&this._pUpdateStitch(),this._pLastFrame},enumerable:!0,configurable:!0}),Object.defineProperty(lMa.prototype,"durations",{get:function(){return this._pDurations},enumerable:!0,configurable:!0}),lMa.prototype._pUpdateStitch=function(){this._pStitchDirty=!1,this._pLastFrame=this._pStitchFinalFrame?this._pNumFrames:this._pNumFrames-1,this._pTotalDuration=0,this._pTotalDelta.x=0,this._pTotalDelta.y=0,this._pTotalDelta.z=0},lMa),AnimationStateBase=(Object.defineProperty(pMa.prototype,"positionDelta",{get:function(){return this._pPositionDeltaDirty&&this._pUpdatePositionDelta(),this._pRootDelta},enumerable:!0,configurable:!0}),pMa.prototype.offset=function(t){this._pStartTime=t,this._pPositionDeltaDirty=!0},pMa.prototype.update=function(t){this._pTime!=t-this._pStartTime&&this._pUpdateTime(t)},pMa.prototype.phase=function(t){},pMa.prototype._pUpdateTime=function(t){this._pTime=t-this._pStartTime,this._pPositionDeltaDirty=!0},pMa.prototype._pUpdatePositionDelta=function(){},pMa),ParticleStateBase=(wMa=AnimationStateBase,__extends(xMa,wMa),Object.defineProperty(xMa.prototype,"needUpdateTime",{get:function(){return this._pNeedUpdateTime},enumerable:!0,configurable:!0}),xMa.prototype.setRenderState=function(t,e,i,n){},xMa.prototype._pUpdateDynamicProperties=function(t){this._pDynamicPropertiesDirty[t._iUniqueId]=!0;for(var e,i,n,r,o,s=t.animationParticles,a=t.vertexData,l=t.totalLenOfOneVertex,c=this._particleNode.dataLength,h=this._particleNode._iDataOffset,u=this._pDynamicProperties.length,p=0,d=0,_=0;p<u;){for(;d<u&&(o=s[d]).index==p;){for(r=this._pDynamicProperties[p],e=o.numVertices*l,i=o.startVertexIndex*l+h,_=0;_<e;_+=l)for(n=i+_,_=0;_<e;_+=l)n=i+_,a[n++]=r.x,a[n++]=r.y,a[n++]=r.z,4==c&&(a[n++]=r.w);d++}p++}t.invalidateBuffer()},xMa),ParticleAccelerationState=(VMa=ParticleStateBase,__extends(WMa,VMa),Object.defineProperty(WMa.prototype,"acceleration",{get:function(){return this._acceleration},set:function(t){this._acceleration.x=t.x,this._acceleration.y=t.y,this._acceleration.z=t.z,this.updateAccelerationData()},enumerable:!0,configurable:!0}),WMa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,WMa.ACCELERATION_INDEX);this._particleAccelerationNode.mode==ParticlePropertiesMode.LOCAL_STATIC?i.activateVertexBuffer(r,this._particleAccelerationNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3):t.setVertexConst(r,this._halfAcceleration.x,this._halfAcceleration.y,this._halfAcceleration.z)},WMa.prototype.updateAccelerationData=function(){this._particleAccelerationNode.mode==ParticlePropertiesMode.GLOBAL&&(this._halfAcceleration=new Vector3D(this._acceleration.x/2,this._acceleration.y/2,this._acceleration.z/2))},WMa.ACCELERATION_INDEX=0,WMa),ParticleNodeBase=(eNa=AnimationNodeBase,__extends(fNa,eNa),Object.defineProperty(fNa.prototype,"mode",{get:function(){return this._pMode},enumerable:!0,configurable:!0}),Object.defineProperty(fNa.prototype,"priority",{get:function(){return this._priority},enumerable:!0,configurable:!0}),Object.defineProperty(fNa.prototype,"dataLength",{get:function(){return this._pDataLength},enumerable:!0,configurable:!0}),Object.defineProperty(fNa.prototype,"oneData",{get:function(){return this._pOneData},enumerable:!0,configurable:!0}),fNa.prototype.getAGALVertexCode=function(t,e,i,n){return""},fNa.prototype.getAGALFragmentCode=function(t,e,i,n){return""},fNa.prototype.getAGALUVCode=function(t,e,i,n){return""},fNa.prototype._iGeneratePropertyOfOneParticle=function(t){},fNa.prototype._iProcessAnimationSetting=function(t){},fNa.MODES={0:fNa.GLOBAL="Global",1:fNa.LOCAL_STATIC="LocalStatic",2:fNa.LOCAL_DYNAMIC="LocalDynamic"},fNa),ParticleAccelerationNode=(zNa=ParticleNodeBase,__extends(ANa,zNa),ANa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleAccelerationState.ACCELERATION_INDEX,r.index);var o=i.getFreeVertexVectorTemp();i.addVertexTempUsages(o,1);var s,a="mul "+o+","+n.vertexTime+","+r+"\n";return e.needVelocity&&(a+="mul "+(s=i.getFreeVertexVectorTemp())+","+o+","+n.vertexTwoConst+"\n",a+="add "+n.velocityTarget+".xyz,"+s+".xyz,"+n.velocityTarget+".xyz\n"),i.removeVertexTempUsage(o),(a+="mul "+o+","+o+","+n.vertexTime+"\n")+"add "+n.positionTarget+".xyz,"+o+","+n.positionTarget+".xyz\n"},ANa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},ANa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[ANa.ACCELERATION_VECTOR3D];if(!e)throw new Error("there is no "+ANa.ACCELERATION_VECTOR3D+" in param!");this._pOneData[0]=e.x/2,this._pOneData[1]=e.y/2,this._pOneData[2]=e.z/2},ANa.ACCELERATION_VECTOR3D="AccelerationVector3D",ANa),ParticleBezierCurveState=(PNa=ParticleStateBase,__extends(QNa,PNa),Object.defineProperty(QNa.prototype,"controlPoint",{get:function(){return this._controlPoint},set:function(t){this._controlPoint=t},enumerable:!0,configurable:!0}),Object.defineProperty(QNa.prototype,"endPoint",{get:function(){return this._endPoint},set:function(t){this._endPoint=t},enumerable:!0,configurable:!0}),QNa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,QNa.BEZIER_CONTROL_INDEX),o=n.getRegisterIndex(this._pAnimationNode,QNa.BEZIER_END_INDEX);this._particleBezierCurveNode.mode==ParticlePropertiesMode.LOCAL_STATIC?(i.activateVertexBuffer(r,this._particleBezierCurveNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3),i.activateVertexBuffer(o,this._particleBezierCurveNode._iDataOffset+3,t.stage,ContextGLVertexBufferFormat.FLOAT_3)):(t.setVertexConst(r,this._controlPoint.x,this._controlPoint.y,this._controlPoint.z),t.setVertexConst(o,this._endPoint.x,this._endPoint.y,this._endPoint.z))},QNa.BEZIER_CONTROL_INDEX=0,QNa.BEZIER_END_INDEX=1,QNa),ParticleBezierCurveNode=(aOa=ParticleNodeBase,__extends(bOa,aOa),bOa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleBezierCurveState.BEZIER_CONTROL_INDEX,r.index);var o=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleBezierCurveState.BEZIER_END_INDEX,o.index);var s=i.getFreeVertexVectorTemp(),a=new ShaderRegisterElement(s.regName,s.index,0),l=new ShaderRegisterElement(s.regName,s.index,1),c=new ShaderRegisterElement(s.regName,s.index,2);i.addVertexTempUsages(s,1);var h=i.getFreeVertexVectorTemp(),u=new ShaderRegisterElement(h.regName,h.index);i.removeVertexTempUsage(s);var p="";return p+="sub "+a+","+n.vertexOneConst+","+n.vertexLife+"\n",p+="mul "+l+","+n.vertexLife+","+n.vertexLife+"\n",p+="mul "+c+","+n.vertexLife+","+a+"\n",p+="mul "+c+","+c+","+n.vertexTwoConst+"\n",p+="mul "+u+".xyz,"+c+","+r+"\n",p+="add "+n.positionTarget+".xyz,"+u+".xyz,"+n.positionTarget+".xyz\n",p+="mul "+u+".xyz,"+l+","+o+"\n",p+="add "+n.positionTarget+".xyz,"+u+".xyz,"+n.positionTarget+".xyz\n",e.needVelocity&&(p+="mul "+l+","+n.vertexLife+","+n.vertexTwoConst+"\n",p+="sub "+c+","+n.vertexOneConst+","+l+"\n",p+="mul "+c+","+n.vertexTwoConst+","+c+"\n",p+="mul "+u+".xyz,"+r+","+c+"\n",p+="add "+n.velocityTarget+".xyz,"+u+".xyz,"+n.velocityTarget+".xyz\n",p+="mul "+u+".xyz,"+o+","+l+"\n",p+="add "+n.velocityTarget+".xyz,"+u+".xyz,"+n.velocityTarget+".xyz\n"),p},bOa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},bOa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[bOa.BEZIER_CONTROL_VECTOR3D];if(!e)throw new Error("there is no "+bOa.BEZIER_CONTROL_VECTOR3D+" in param!");var i=t[bOa.BEZIER_END_VECTOR3D];if(!i)throw new Error("there is no "+bOa.BEZIER_END_VECTOR3D+" in param!");this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z,this._pOneData[3]=i.x,this._pOneData[4]=i.y,this._pOneData[5]=i.z},bOa.BEZIER_CONTROL_VECTOR3D="BezierControlVector3D",bOa.BEZIER_END_VECTOR3D="BezierEndVector3D",bOa),ParticleBillboardState=(xOa=ParticleStateBase,__extends(yOa,xOa),yOa.prototype.setRenderState=function(t,e,i,n){var r,o,s,a;this._billboardAxis?(o=e.sourceEntity.transform.concatenatedMatrix3D.position,(a=(s=t.view.projection.transform.concatenatedMatrix3D.position.subtract(o)).crossProduct(this._billboardAxis)).normalize(),(s=this.billboardAxis.crossProduct(a)).normalize(),this._matrix.copyFrom(e.sourceEntity.transform.concatenatedMatrix3D),r=this._matrix.decompose(Orientation3D.AXIS_ANGLE),this._matrix.copyColumnFrom(0,a),this._matrix.copyColumnFrom(1,this.billboardAxis),this._matrix.copyColumnFrom(2,s),this._matrix.copyColumnFrom(3,o)):(this._matrix.copyFrom(e.sourceEntity.transform.concatenatedMatrix3D),this._matrix.append(t.view.projection.transform.inverseConcatenatedMatrix3D),r=this._matrix.decompose(Orientation3D.AXIS_ANGLE),this._matrix.identity()),this._matrix.appendRotation(-r[1].w*MathConsts.RADIANS_TO_DEGREES,r[1]),t.setVertexConstFromMatrix(n.getRegisterIndex(this._pAnimationNode,yOa.MATRIX_INDEX),this._matrix)},Object.defineProperty(yOa.prototype,"billboardAxis",{get:function(){return this.billboardAxis},set:function(t){this.billboardAxis=t?t.clone():null,this.billboardAxis&&this.billboardAxis.normalize()},enumerable:!0,configurable:!0}),yOa.MATRIX_INDEX=0,yOa),ParticleBillboardNode=(LOa=ParticleNodeBase,__extends(MOa,LOa),MOa.prototype.getAGALVertexCode=function(t,e,i,n){var r=i.getFreeVertexConstant();n.setRegisterIndex(this,ParticleBillboardState.MATRIX_INDEX,r.index),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.getFreeVertexConstant();for(var o,s=i.getFreeVertexVectorTemp(),a="m33 "+s+".xyz,"+n.scaleAndRotateTarget+","+r+"\nmov "+n.scaleAndRotateTarget+".xyz,"+s+"\n",l=0;l<n.rotationRegisters.length;l++)a+="m33 "+s+".xyz,"+(o=n.rotationRegisters[l])+","+r+"\nmov "+o+".xyz,"+o+"\n";return a},MOa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},MOa.prototype._iProcessAnimationSetting=function(t){t.hasBillboard=!0},MOa),ParticleColorState=($Oa=ParticleStateBase,__extends(_Oa,$Oa),Object.defineProperty(_Oa.prototype,"startColor",{get:function(){return this._startColor},set:function(t){this._startColor=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(_Oa.prototype,"endColor",{get:function(){return this._endColor},set:function(t){this._endColor=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(_Oa.prototype,"cycleDuration",{get:function(){return this._cycleDuration},set:function(t){this._cycleDuration=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(_Oa.prototype,"cyclePhase",{get:function(){return this._cyclePhase},set:function(t){this._cyclePhase=t,this.updateColorData()},enumerable:!0,configurable:!0}),_Oa.prototype.setRenderState=function(t,e,i,n){var r;t.usesFragmentAnimation&&(r=this._particleColorNode._iDataOffset,this._usesCycle&&t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,_Oa.CYCLE_INDEX),this._cycleData.x,this._cycleData.y,this._cycleData.z,this._cycleData.w),this._usesMultiplier&&(this._particleColorNode.mode==ParticlePropertiesMode.LOCAL_STATIC?(i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,_Oa.START_MULTIPLIER_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4),r+=4,i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,_Oa.DELTA_MULTIPLIER_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4),r+=4):(t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,_Oa.START_MULTIPLIER_INDEX),this._startMultiplierData.x,this._startMultiplierData.y,this._startMultiplierData.z,this._startMultiplierData.w),t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,_Oa.DELTA_MULTIPLIER_INDEX),this._deltaMultiplierData.x,this._deltaMultiplierData.y,this._deltaMultiplierData.z,this._deltaMultiplierData.w))),this._usesOffset&&(this._particleColorNode.mode==ParticlePropertiesMode.LOCAL_STATIC?(i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,_Oa.START_OFFSET_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4),r+=4,i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,_Oa.DELTA_OFFSET_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4)):(t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,_Oa.START_OFFSET_INDEX),this._startOffsetData.x,this._startOffsetData.y,this._startOffsetData.z,this._startOffsetData.w),t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,_Oa.DELTA_OFFSET_INDEX),this._deltaOffsetData.x,this._deltaOffsetData.y,this._deltaOffsetData.z,this._deltaOffsetData.w))))},_Oa.prototype.updateColorData=function(){if(this._usesCycle){if(this._cycleDuration<=0)throw new Error("the cycle duration must be greater than zero");this._cycleData=new Vector3D(2*Math.PI/this._cycleDuration,this._cyclePhase*Math.PI/180,0,0)}this._particleColorNode.mode==ParticlePropertiesMode.GLOBAL&&(this._usesCycle?(this._usesMultiplier&&(this._startMultiplierData=new Vector3D((this._startColor.redMultiplier+this._endColor.redMultiplier)/2,(this._startColor.greenMultiplier+this._endColor.greenMultiplier)/2,(this._startColor.blueMultiplier+this._endColor.blueMultiplier)/2,(this._startColor.alphaMultiplier+this._endColor.alphaMultiplier)/2),this._deltaMultiplierData=new Vector3D((this._endColor.redMultiplier-this._startColor.redMultiplier)/2,(this._endColor.greenMultiplier-this._startColor.greenMultiplier)/2,(this._endColor.blueMultiplier-this._startColor.blueMultiplier)/2,(this._endColor.alphaMultiplier-this._startColor.alphaMultiplier)/2)),this._usesOffset&&(this._startOffsetData=new Vector3D((this._startColor.redOffset+this._endColor.redOffset)/510,(this._startColor.greenOffset+this._endColor.greenOffset)/510,(this._startColor.blueOffset+this._endColor.blueOffset)/510,(this._startColor.alphaOffset+this._endColor.alphaOffset)/510),this._deltaOffsetData=new Vector3D((this._endColor.redOffset-this._startColor.redOffset)/510,(this._endColor.greenOffset-this._startColor.greenOffset)/510,(this._endColor.blueOffset-this._startColor.blueOffset)/510,(this._endColor.alphaOffset-this._startColor.alphaOffset)/510))):(this._usesMultiplier&&(this._startMultiplierData=new Vector3D(this._startColor.redMultiplier,this._startColor.greenMultiplier,this._startColor.blueMultiplier,this._startColor.alphaMultiplier),this._deltaMultiplierData=new Vector3D(this._endColor.redMultiplier-this._startColor.redMultiplier,this._endColor.greenMultiplier-this._startColor.greenMultiplier,this._endColor.blueMultiplier-this._startColor.blueMultiplier,this._endColor.alphaMultiplier-this._startColor.alphaMultiplier)),this._usesOffset&&(this._startOffsetData=new Vector3D(this._startColor.redOffset/255,this._startColor.greenOffset/255,this._startColor.blueOffset/255,this._startColor.alphaOffset/255),this._deltaOffsetData=new Vector3D((this._endColor.redOffset-this._startColor.redOffset)/255,(this._endColor.greenOffset-this._startColor.greenOffset)/255,(this._endColor.blueOffset-this._startColor.blueOffset)/255,(this._endColor.alphaOffset-this._startColor.alphaOffset)/255))))},_Oa.START_MULTIPLIER_INDEX=0,_Oa.DELTA_MULTIPLIER_INDEX=1,_Oa.START_OFFSET_INDEX=2,_Oa.DELTA_OFFSET_INDEX=3,_Oa.CYCLE_INDEX=4,_Oa),ParticleTimeState=(mPa=ParticleStateBase,__extends(nPa,mPa),nPa.prototype.setRenderState=function(t,e,i,n){i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,nPa.TIME_STREAM_INDEX),this._particleTimeNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_4);var r=this._pTime/1e3;t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,nPa.TIME_CONSTANT_INDEX),r,r,r,r)},nPa.TIME_STREAM_INDEX=0,nPa.TIME_CONSTANT_INDEX=1,nPa),ParticleTimeNode=(wPa=ParticleNodeBase,__extends(xPa,wPa),xPa.prototype.getAGALVertexCode=function(t,e,i,n){var r=i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleTimeState.TIME_STREAM_INDEX,r.index);var o=i.getFreeVertexConstant();n.setRegisterIndex(this,ParticleTimeState.TIME_CONSTANT_INDEX,o.index);var s="";s+="sub "+n.vertexTime+","+o+","+r+".x\n";var a,l,c=i.getFreeVertexSingleTemp();return s+="sge "+c+","+n.vertexTime+","+n.vertexZeroConst+"\n",s+="mul "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+c+"\n",this._iUsesDuration&&(this._iUsesLooping?(a=i.getFreeVertexSingleTemp(),this._iUsesDelay?(s+="div "+a+","+n.vertexTime+","+r+".z\n",s+="frc "+a+","+a+"\n",s+="mul "+n.vertexTime+","+a+","+r+".z\n",s+="slt "+a+","+n.vertexTime+","+r+".y\n",s+="mul "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+a+"\n"):(s+="mul "+a+","+n.vertexTime+","+r+".w\n",s+="frc "+a+","+a+"\n",s+="mul "+n.vertexTime+","+a+","+r+".y\n")):(s+="sge "+(l=i.getFreeVertexSingleTemp())+","+r+".y,"+n.vertexTime+"\n",s+="mul "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+l+"\n")),s+("mul "+n.vertexLife+","+n.vertexTime)+","+r+".w\n"},xPa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},xPa.prototype._iGeneratePropertyOfOneParticle=function(t){this._pOneData[0]=t.startTime,this._pOneData[1]=t.duration,this._pOneData[2]=t.delay+t.duration,this._pOneData[3]=1/t.duration},xPa),AnimationSetError=(OPa=ErrorBase,__extends(PPa,OPa),PPa),AnimationSetBase=(RPa=AssetBase,__extends(SPa,RPa),SPa.prototype._pFindTempReg=function(t,e){void 0===e&&(e=null);for(var i,n=0;;){if(i="vt"+n,-1==t.indexOf(i)&&e!=i)return i;++n}},Object.defineProperty(SPa.prototype,"usesCPU",{get:function(){return this._usesCPU},enumerable:!0,configurable:!0}),SPa.prototype.resetGPUCompatibility=function(){this._usesCPU=!1},SPa.prototype.cancelGPUCompatibility=function(){this._usesCPU=!0},SPa.prototype.getAGALVertexCode=function(t,e,i){throw new AbstractMethodError},SPa.prototype.getAGALFragmentCode=function(t,e,i){throw new AbstractMethodError},SPa.prototype.getAGALUVCode=function(t,e,i){throw new AbstractMethodError},SPa.prototype.doneAGALCode=function(t){throw new AbstractMethodError},Object.defineProperty(SPa.prototype,"assetType",{get:function(){return SPa.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(SPa.prototype,"animations",{get:function(){return this._animations},enumerable:!0,configurable:!0}),Object.defineProperty(SPa.prototype,"animationNames",{get:function(){return this._animationNames},enumerable:!0,configurable:!0}),SPa.prototype.hasAnimation=function(t){return null!=this._animationDictionary[t]},SPa.prototype.getAnimation=function(t){return this._animationDictionary[t]},SPa.prototype.addAnimation=function(t){if(this._animationDictionary[t.name])throw new AnimationSetError("root node name '"+t.name+"' already exists in the set");this._animationDictionary[t.name]=t,this._animations.push(t),this._animationNames.push(t.name)},SPa.prototype.dispose=function(){},SPa.assetType="[asset AnimationSet]",SPa),ParticleAnimationSet=(jQa=AnimationSetBase,__extends(kQa,jQa),Object.defineProperty(kQa.prototype,"particleNodes",{get:function(){return this._particleNodes},enumerable:!0,configurable:!0}),kQa.prototype.addAnimation=function(t){var e,i=t;for(i._iProcessAnimationSetting(this),i.mode==ParticlePropertiesMode.LOCAL_STATIC?(i._iDataOffset=this._totalLenOfOneVertex,this._totalLenOfOneVertex+=i.dataLength,this._localStaticNodes.push(i)):i.mode==ParticlePropertiesMode.LOCAL_DYNAMIC&&this._localDynamicNodes.push(i),e=this._particleNodes.length-1;0<=e&&!(this._particleNodes[e].priority<=i.priority);e--);this._particleNodes.splice(e+1,0,i),jQa.prototype.addAnimation.call(this,t)},kQa.prototype.getAGALVertexCode=function(t,e,i){this._iAnimationRegisterData=t.animationRegisterData,null==this._iAnimationRegisterData&&(this._iAnimationRegisterData=t.animationRegisterData=new AnimationRegisterData),this._iAnimationRegisterData.reset(e,i,this.needVelocity);for(var n,r="",o=i.animatableAttributes.length,s=0;s<o;s++)r+="mov "+i.animationTargetRegisters[s]+","+i.animatableAttributes[s]+"\n";for(r+="mov "+this._iAnimationRegisterData.positionTarget+".xyz,"+this._iAnimationRegisterData.vertexZeroConst+"\n",this.needVelocity&&(r+="mov "+this._iAnimationRegisterData.velocityTarget+".xyz,"+this._iAnimationRegisterData.vertexZeroConst+"\n"),s=0;s<this._particleNodes.length;s++)(n=this._particleNodes[s]).priority<kQa.POST_PRIORITY&&(r+=n.getAGALVertexCode(t,this,e,this._iAnimationRegisterData));for(r+="add "+this._iAnimationRegisterData.scaleAndRotateTarget+".xyz,"+this._iAnimationRegisterData.scaleAndRotateTarget+".xyz,"+this._iAnimationRegisterData.positionTarget+".xyz\n",s=0;s<this._particleNodes.length;s++)(n=this._particleNodes[s]).priority>=kQa.POST_PRIORITY&&n.priority<kQa.COLOR_PRIORITY&&(r+=n.getAGALVertexCode(t,this,e,this._iAnimationRegisterData));for(this.hasColorMulNode&&(this._iAnimationRegisterData.colorMulTarget=e.getFreeVertexVectorTemp(),e.addVertexTempUsages(this._iAnimationRegisterData.colorMulTarget,1),this._iAnimationRegisterData.colorMulVary=e.getFreeVarying(),r+="mov "+this._iAnimationRegisterData.colorMulTarget+","+this._iAnimationRegisterData.vertexOneConst+"\n"),this.hasColorAddNode&&(this._iAnimationRegisterData.colorAddTarget=e.getFreeVertexVectorTemp(),e.addVertexTempUsages(this._iAnimationRegisterData.colorAddTarget,1),this._iAnimationRegisterData.colorAddVary=e.getFreeVarying(),r+="mov "+this._iAnimationRegisterData.colorAddTarget+","+this._iAnimationRegisterData.vertexZeroConst+"\n"),s=0;s<this._particleNodes.length;s++)(n=this._particleNodes[s]).priority>=kQa.COLOR_PRIORITY&&(r+=n.getAGALVertexCode(t,this,e,this._iAnimationRegisterData));return t.usesFragmentAnimation&&(this.hasColorAddNode||this.hasColorMulNode)&&(this.hasColorMulNode&&(r+="mov "+this._iAnimationRegisterData.colorMulVary+","+this._iAnimationRegisterData.colorMulTarget+"\n"),this.hasColorAddNode&&(r+="mov "+this._iAnimationRegisterData.colorAddVary+","+this._iAnimationRegisterData.colorAddTarget+"\n")),r},kQa.prototype.getAGALUVCode=function(t,e,i){var n,r="";if(this.hasUVNode){this._iAnimationRegisterData.setUVSourceAndTarget(i),r+="mov "+this._iAnimationRegisterData.uvTarget+".xy,"+this._iAnimationRegisterData.uvAttribute.toString()+"\n";for(var o=0;o<this._particleNodes.length;o++)n=this._particleNodes[o];r+=n.getAGALUVCode(t,this,e,this._iAnimationRegisterData),r+="mov "+this._iAnimationRegisterData.uvVar+","+this._iAnimationRegisterData.uvTarget+".xy\n"}else r+="mov "+i.animatedUV+","+i.uvInput+"\n";return r},kQa.prototype.getAGALFragmentCode=function(t,e,i){var n="";return t.usesFragmentAnimation&&(this.hasColorAddNode||this.hasColorMulNode)&&(this.hasColorMulNode&&(n+="mul "+i+","+i+","+this._iAnimationRegisterData.colorMulVary+"\n"),this.hasColorAddNode&&(n+="add "+i+","+i+","+this._iAnimationRegisterData.colorAddVary+"\n")),n},kQa.prototype.doneAGALCode=function(t){t.setVertexConst(this._iAnimationRegisterData.vertexZeroConst.index,0,1,2,0)},Object.defineProperty(kQa.prototype,"usesCPU",{get:function(){return!1},enumerable:!0,configurable:!0}),kQa.prototype.cancelGPUCompatibility=function(){},kQa.prototype.dispose=function(){for(var t in this._animationElements)this._animationElements[t].dispose();jQa.prototype.dispose.call(this)},kQa.prototype.getAnimationElements=function(t,e){return this._animationElements[e.id]||(this._iGenerateAnimationElements(t),this._animationElements[e.id])},kQa.prototype._iGenerateAnimationElements=function(t){if(null==this.initParticleFunc)throw new Error("no initParticleFunc set");for(var e,i,n,r,o,s=!1,a=0;a<t.numElements;a++)r=t.elements[a],this._animationElements[r.id]||((n=this._animationElements[r.id]=new AnimationElements).createVertexData(r.numVertices,this._totalLenOfOneVertex),s=!0);if(s){var l,c,h,u,p,d,_,f,m,g,y,b=t.particles,v=b.length,x=t.numParticles,A=new ParticleProperties;for(A.total=x,A.startTime=0,A.duration=1e3,A.delay=.1,e=a=0;a<x;){for(A.index=a,this.initParticleFunc.call(this.initParticleScope,A),i=0;i<this._localStaticNodes.length;i++)this._localStaticNodes[i]._iGeneratePropertyOfOneParticle(A);for(;e<v&&(l=b[e]).particleIndex==a;){for(i=0;i<t.numElements;i++)if((r=t.elements[i])==l.elements){n=this._animationElements[r.id];break}for(_=l.numVertices,f=n.vertexData,m=_*this._totalLenOfOneVertex,g=n.numProcessedVertices*this._totalLenOfOneVertex,i=0;i<this._localStaticNodes.length;i++)for(d=(o=this._localStaticNodes[i]).oneData,c=o.dataLength,h=g+o._iDataOffset,u=0;u<m;u+=this._totalLenOfOneVertex)for(y=h+u,p=0;p<c;p++)f[y+p]=d[p];this._localDynamicNodes.length&&n.animationParticles.push(new ParticleAnimationData(a,A.startTime,A.duration,A.delay,l)),n.numProcessedVertices+=_,e++}a++}}},kQa.POST_PRIORITY=9,kQa.COLOR_PRIORITY=18,kQa),ParticleColorNode=(jRa=ParticleNodeBase,__extends(kRa,jRa),kRa.prototype.getAGALVertexCode=function(t,e,i,n){var r,o,s,a,l,c,h,u="";return t.usesFragmentAnimation&&(r=i.getFreeVertexVectorTemp(),this._iUsesCycle&&(o=i.getFreeVertexConstant(),n.setRegisterIndex(this,ParticleColorState.CYCLE_INDEX,o.index),i.addVertexTempUsages(r,1),s=i.getFreeVertexSingleTemp(),i.removeVertexTempUsage(r),u+="mul "+s+","+n.vertexTime+","+o+".x\n",this._iUsesPhase&&(u+="add "+s+","+s+","+o+".y\n"),u+="sin "+s+","+s+"\n"),this._iUsesMultiplier&&(a=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute(),l=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute(),n.setRegisterIndex(this,ParticleColorState.START_MULTIPLIER_INDEX,a.index),n.setRegisterIndex(this,ParticleColorState.DELTA_MULTIPLIER_INDEX,l.index),u+="mul "+r+","+l+","+(this._iUsesCycle?s:n.vertexLife)+"\n",u+="add "+r+","+r+","+a+"\n",u+="mul "+n.colorMulTarget+","+r+","+n.colorMulTarget+"\n"),this._iUsesOffset&&(c=this._pMode==ParticlePropertiesMode.LOCAL_STATIC?i.getFreeVertexAttribute():i.getFreeVertexConstant(),h=this._pMode==ParticlePropertiesMode.LOCAL_STATIC?i.getFreeVertexAttribute():i.getFreeVertexConstant(),n.setRegisterIndex(this,ParticleColorState.START_OFFSET_INDEX,c.index),n.setRegisterIndex(this,ParticleColorState.DELTA_OFFSET_INDEX,h.index),u+="mul "+r+","+h+","+(this._iUsesCycle?s:n.vertexLife)+"\n",u+="add "+r+","+r+","+c+"\n",u+="add "+n.colorAddTarget+","+r+","+n.colorAddTarget+"\n")),u},kRa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},kRa.prototype._iProcessAnimationSetting=function(t){this._iUsesMultiplier&&(t.hasColorMulNode=!0),this._iUsesOffset&&(t.hasColorAddNode=!0)},kRa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[kRa.COLOR_START_COLORTRANSFORM];if(!e)throw new Error("there is no "+kRa.COLOR_START_COLORTRANSFORM+" in param!");var i=t[kRa.COLOR_END_COLORTRANSFORM];if(!i)throw new Error("there is no "+kRa.COLOR_END_COLORTRANSFORM+" in param!");var n=0;this._iUsesCycle?(this._iUsesMultiplier&&(this._pOneData[n++]=(e.redMultiplier+i.redMultiplier)/2,this._pOneData[n++]=(e.greenMultiplier+i.greenMultiplier)/2,this._pOneData[n++]=(e.blueMultiplier+i.blueMultiplier)/2,this._pOneData[n++]=(e.alphaMultiplier+i.alphaMultiplier)/2,this._pOneData[n++]=(e.redMultiplier-i.redMultiplier)/2,this._pOneData[n++]=(e.greenMultiplier-i.greenMultiplier)/2,this._pOneData[n++]=(e.blueMultiplier-i.blueMultiplier)/2,this._pOneData[n++]=(e.alphaMultiplier-i.alphaMultiplier)/2),this._iUsesOffset&&(this._pOneData[n++]=(e.redOffset+i.redOffset)/510,this._pOneData[n++]=(e.greenOffset+i.greenOffset)/510,this._pOneData[n++]=(e.blueOffset+i.blueOffset)/510,this._pOneData[n++]=(e.alphaOffset+i.alphaOffset)/510,this._pOneData[n++]=(e.redOffset-i.redOffset)/510,this._pOneData[n++]=(e.greenOffset-i.greenOffset)/510,this._pOneData[n++]=(e.blueOffset-i.blueOffset)/510,this._pOneData[n++]=(e.alphaOffset-i.alphaOffset)/510)):(this._iUsesMultiplier&&(this._pOneData[n++]=e.redMultiplier,this._pOneData[n++]=e.greenMultiplier,this._pOneData[n++]=e.blueMultiplier,this._pOneData[n++]=e.alphaMultiplier,this._pOneData[n++]=i.redMultiplier-e.redMultiplier,this._pOneData[n++]=i.greenMultiplier-e.greenMultiplier,this._pOneData[n++]=i.blueMultiplier-e.blueMultiplier,this._pOneData[n++]=i.alphaMultiplier-e.alphaMultiplier),this._iUsesOffset&&(this._pOneData[n++]=e.redOffset/255,this._pOneData[n++]=e.greenOffset/255,this._pOneData[n++]=e.blueOffset/255,this._pOneData[n++]=e.alphaOffset/255,this._pOneData[n++]=(i.redOffset-e.redOffset)/255,this._pOneData[n++]=(i.greenOffset-e.greenOffset)/255,this._pOneData[n++]=(i.blueOffset-e.blueOffset)/255,this._pOneData[n++]=(i.alphaOffset-e.alphaOffset)/255))},kRa.COLOR_START_COLORTRANSFORM="ColorStartColorTransform",kRa.COLOR_END_COLORTRANSFORM="ColorEndColorTransform",kRa),ParticleFollowState=(NRa=ParticleStateBase,__extends(ORa,NRa),Object.defineProperty(ORa.prototype,"followTarget",{get:function(){return this._followTarget},set:function(t){this._followTarget=t},enumerable:!0,configurable:!0}),Object.defineProperty(ORa.prototype,"smooth",{get:function(){return this._smooth},set:function(t){this._smooth=t},enumerable:!0,configurable:!0}),ORa.prototype.setRenderState=function(t,e,i,n){this._followTarget&&(this._particleFollowNode._iUsesPosition&&(this._targetPos.x=this._followTarget.transform.position.x/e.sourceEntity.transform.scale.x,this._targetPos.y=this._followTarget.transform.position.y/e.sourceEntity.transform.scale.y,this._targetPos.z=this._followTarget.transform.position.z/e.sourceEntity.transform.scale.z),this._particleFollowNode._iUsesRotation&&(this._targetEuler.x=this._followTarget.transform.rotation.x,this._targetEuler.y=this._followTarget.transform.rotation.y,this._targetEuler.z=this._followTarget.transform.rotation.z)),this._prePos||(this._prePos=this._targetPos.clone()),this._preEuler||(this._preEuler=this._targetEuler.clone());var r=this._pTime/1e3,o=i.previousTime,s=r-o,a=o!=r;this._particleFollowNode._iUsesPosition&&this._particleFollowNode._iUsesRotation?(a&&this.processPositionAndRotation(r,s,i),i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,ORa.FOLLOW_POSITION_INDEX),this._particleFollowNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3),i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,ORa.FOLLOW_ROTATION_INDEX),this._particleFollowNode._iDataOffset+3,t.stage,ContextGLVertexBufferFormat.FLOAT_3)):this._particleFollowNode._iUsesPosition?(a&&this.processPosition(r,s,i),i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,ORa.FOLLOW_POSITION_INDEX),this._particleFollowNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3)):this._particleFollowNode._iUsesRotation&&(a&&this.precessRotation(r,s,i),i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,ORa.FOLLOW_ROTATION_INDEX),this._particleFollowNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3)),this._prePos.copyFrom(this._targetPos),this._targetEuler.copyFrom(this._targetEuler),i.previousTime=r},ORa.prototype.processPosition=function(t,e,i){var n,r,o=i.animationParticles,s=i.vertexData,a=!1,l=o.length;this._smooth?(r=this._prePos.subtract(this._targetPos)).scaleBy(1/e):n=this._targetPos;for(var c=0;c<l;c++){var h=(t-o[c].startTime)/o[c].totalTime,u=(h-Math.floor(h))*o[c].totalTime;if(u-e<=0){var p=o[c].startVertexIndex*i.totalLenOfOneVertex+this._particleFollowNode._iDataOffset;if(this._smooth&&(this._temp.copyFrom(r),this._temp.scaleBy(u),n=this._targetPos.add(this._temp)),s[p]!=n.x||s[p+1]!=n.y||s[p+2]!=n.z){a=!0;for(var d=0;d<o[c].numVertices;d++)s[p++]=n.x,s[p++]=n.y,s[p++]=n.z}}}a&&i.invalidateBuffer()},ORa.prototype.precessRotation=function(t,e,i){var n,r,o=i.animationParticles,s=i.vertexData,a=!1,l=o.length;this._smooth?(r=this._preEuler.subtract(this._targetEuler)).scaleBy(1/e):n=this._targetEuler;for(var c=0;c<l;c++){var h=(t-o[c].startTime)/o[c].totalTime,u=(h-Math.floor(h))*o[c].totalTime;if(u-e<=0){var p=o[c].startVertexIndex*i.totalLenOfOneVertex+this._particleFollowNode._iDataOffset;if(this._smooth&&(this._temp.copyFrom(r),this._temp.scaleBy(u),n=this._targetEuler.add(this._temp)),s[p]!=n.x||s[p+1]!=n.y||s[p+2]!=n.z){a=!0;for(var d=0;d<o[c].numVertices;d++)s[p++]=n.x,s[p++]=n.y,s[p++]=n.z}}}a&&i.invalidateBuffer()},ORa.prototype.processPositionAndRotation=function(t,e,i){var n,r,o,s,a=i.animationParticles,l=i.vertexData,c=!1,h=a.length;this._smooth?((o=this._prePos.subtract(this._targetPos)).scaleBy(1/e),(s=this._preEuler.subtract(this._targetEuler)).scaleBy(1/e)):(n=this._targetPos,r=this._targetEuler);for(var u=0;u<h;u++){var p=(t-a[u].startTime)/a[u].totalTime,d=(p-Math.floor(p))*a[u].totalTime;if(d-e<=0){var _=a[u].startVertexIndex*i.totalLenOfOneVertex+this._particleFollowNode._iDataOffset;if(this._smooth&&(this._temp.copyFrom(o),this._temp.scaleBy(d),n=this._targetPos.add(this._temp),this._temp.copyFrom(s),this._temp.scaleBy(d),r=this._targetEuler.add(this._temp)),l[_]!=n.x||l[_+1]!=n.y||l[_+2]!=n.z||l[_+3]!=r.x||l[_+4]!=r.y||l[_+5]!=r.z){c=!0;for(var f=0;f<a[u].numVertices;f++)l[_++]=n.x,l[_++]=n.y,l[_++]=n.z,l[_++]=r.x,l[_++]=r.y,l[_++]=r.z}}}c&&i.invalidateBuffer()},ORa.FOLLOW_POSITION_INDEX=0,ORa.FOLLOW_ROTATION_INDEX=1,ORa),ParticleFollowNode=(SSa=ParticleNodeBase,__extends(TSa,SSa),TSa.prototype.getAGALVertexCode=function(t,e,i,n){var r,o="";if(this._iUsesRotation){var s=i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleFollowState.FOLLOW_ROTATION_INDEX,s.index);var a=i.getFreeVertexVectorTemp();i.addVertexTempUsages(a,1);var l=i.getFreeVertexVectorTemp();i.addVertexTempUsages(l,1);var c,h=i.getFreeVertexVectorTemp();e.hasBillboard&&(i.addVertexTempUsages(h,1),c=i.getFreeVertexVectorTemp()),i.removeVertexTempUsage(a),i.removeVertexTempUsage(l),e.hasBillboard&&i.removeVertexTempUsage(h);var u,p=n.rotationRegisters.length;if(o+="mov "+a+","+n.vertexZeroConst+"\n",o+="mov "+a+".x,"+n.vertexOneConst+"\n",o+="mov "+h+","+n.vertexZeroConst+"\n",o+="sin "+h+".y,"+s+".x\n",o+="cos "+h+".z,"+s+".x\n",o+="mov "+l+".x,"+n.vertexZeroConst+"\n",o+="mov "+l+".y,"+h+".z\n",o+="neg "+l+".z,"+h+".y\n",e.hasBillboard)o+="m33 "+c+".xyz,"+n.positionTarget+".xyz,"+a+"\n";else for(o+="m33 "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+a+"\n",u=0;u<p;u++)o+="m33 "+n.rotationRegisters[u]+".xyz,"+n.rotationRegisters[u]+","+a+"\n";if(o+="mov "+a+","+n.vertexZeroConst+"\n",o+="cos "+a+".x,"+s+".y\n",o+="sin "+a+".z,"+s+".y\n",o+="mov "+l+","+n.vertexZeroConst+"\n",o+="mov "+l+".y,"+n.vertexOneConst+"\n",o+="mov "+h+","+n.vertexZeroConst+"\n",o+="neg "+h+".x,"+a+".z\n",o+="mov "+h+".z,"+a+".x\n",e.hasBillboard)o+="m33 "+c+".xyz,"+c+".xyz,"+a+"\n";else for(o+="m33 "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+a+"\n",u=0;u<p;u++)o+="m33 "+n.rotationRegisters[u]+".xyz,"+n.rotationRegisters[u]+","+a+"\n";if(o+="mov "+l+","+n.vertexZeroConst+"\n",o+="sin "+l+".x,"+s+".z\n",o+="cos "+l+".y,"+s+".z\n",o+="mov "+a+","+n.vertexZeroConst+"\n",o+="mov "+a+".x,"+l+".y\n",o+="neg "+a+".y,"+l+".x\n",o+="mov "+h+","+n.vertexZeroConst+"\n",o+="mov "+h+".z,"+n.vertexOneConst+"\n",e.hasBillboard)o+="m33 "+c+".xyz,"+c+".xyz,"+a+"\n",o+="sub "+c+".xyz,"+c+".xyz,"+n.positionTarget+".xyz\n",o+="add "+n.scaleAndRotateTarget+".xyz,"+c+".xyz,"+n.scaleAndRotateTarget+".xyz\n";else for(o+="m33 "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+a+"\n",u=0;u<p;u++)o+="m33 "+n.rotationRegisters[u]+".xyz,"+n.rotationRegisters[u]+","+a+"\n"}return this._iUsesPosition&&(r=i.getFreeVertexAttribute(),n.setRegisterIndex(this,ParticleFollowState.FOLLOW_POSITION_INDEX,r.index),o+="add "+n.scaleAndRotateTarget+".xyz,"+r+","+n.scaleAndRotateTarget+".xyz\n"),o},TSa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},TSa),ParticleInitialColorState=(kTa=ParticleStateBase,__extends(lTa,kTa),Object.defineProperty(lTa.prototype,"initialColor",{get:function(){return this._initialColor},set:function(t){this._initialColor=t},enumerable:!0,configurable:!0}),lTa.prototype.setRenderState=function(t,e,i,n){var r;t.usesFragmentAnimation&&(this._particleInitialColorNode.mode==ParticlePropertiesMode.LOCAL_STATIC?(r=this._particleInitialColorNode._iDataOffset,this._usesMultiplier&&(i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,lTa.MULTIPLIER_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4),r+=4),this._usesOffset&&i.activateVertexBuffer(n.getRegisterIndex(this._pAnimationNode,lTa.OFFSET_INDEX),r,t.stage,ContextGLVertexBufferFormat.FLOAT_4)):(this._usesMultiplier&&t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,lTa.MULTIPLIER_INDEX),this._multiplierData.x,this._multiplierData.y,this._multiplierData.z,this._multiplierData.w),this._usesOffset&&t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,lTa.OFFSET_INDEX),this._offsetData.x,this._offsetData.y,this._offsetData.z,this._offsetData.w)))},lTa.prototype.updateColorData=function(){this._particleInitialColorNode.mode==ParticlePropertiesMode.GLOBAL&&(this._usesMultiplier&&(this._multiplierData=new Vector3D(this._initialColor.redMultiplier,this._initialColor.greenMultiplier,this._initialColor.blueMultiplier,this._initialColor.alphaMultiplier)),this._usesOffset&&(this._offsetData=new Vector3D(this._initialColor.redOffset/255,this._initialColor.greenOffset/255,this._initialColor.blueOffset/255,this._initialColor.alphaOffset/255)))},lTa.MULTIPLIER_INDEX=0,lTa.OFFSET_INDEX=1,lTa),ParticleInitialColorNode=(vTa=ParticleNodeBase,__extends(wTa,vTa),wTa.prototype.getAGALVertexCode=function(t,e,i,n){var r,o,s="";return t.usesFragmentAnimation&&(this._iUsesMultiplier&&(r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute(),n.setRegisterIndex(this,ParticleInitialColorState.MULTIPLIER_INDEX,r.index),s+="mul "+n.colorMulTarget+","+r+","+n.colorMulTarget+"\n"),this._iUsesOffset&&(o=this._pMode==ParticlePropertiesMode.LOCAL_STATIC?i.getFreeVertexAttribute():i.getFreeVertexConstant(),n.setRegisterIndex(this,ParticleInitialColorState.OFFSET_INDEX,o.index),s+="add "+n.colorAddTarget+","+o+","+n.colorAddTarget+"\n")),s},wTa.prototype._iProcessAnimationSetting=function(t){this._iUsesMultiplier&&(t.hasColorMulNode=!0),this._iUsesOffset&&(t.hasColorAddNode=!0)},wTa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[wTa.COLOR_INITIAL_COLORTRANSFORM];if(!e)throw new Error("there is no "+wTa.COLOR_INITIAL_COLORTRANSFORM+" in param!");var i=0;this._iUsesMultiplier&&(this._pOneData[i++]=e.redMultiplier,this._pOneData[i++]=e.greenMultiplier,this._pOneData[i++]=e.blueMultiplier,this._pOneData[i++]=e.alphaMultiplier),this._iUsesOffset&&(this._pOneData[i++]=e.redOffset/255,this._pOneData[i++]=e.greenOffset/255,this._pOneData[i++]=e.blueOffset/255,this._pOneData[i++]=e.alphaOffset/255)},wTa.COLOR_INITIAL_COLORTRANSFORM="ColorInitialColorTransform",wTa),ParticleOrbitState=(NTa=ParticleStateBase,__extends(OTa,NTa),Object.defineProperty(OTa.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this.updateOrbitData()},enumerable:!0,configurable:!0}),Object.defineProperty(OTa.prototype,"cycleDuration",{get:function(){return this._cycleDuration},set:function(t){this._cycleDuration=t,this.updateOrbitData()},enumerable:!0,configurable:!0}),Object.defineProperty(OTa.prototype,"cyclePhase",{get:function(){return this._cyclePhase},set:function(t){this._cyclePhase=t,this.updateOrbitData()},enumerable:!0,configurable:!0}),Object.defineProperty(OTa.prototype,"eulers",{get:function(){return this._eulers},set:function(t){this._eulers=t,this.updateOrbitData()},enumerable:!0,configurable:!0}),OTa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,OTa.ORBIT_INDEX);this._particleOrbitNode.mode==ParticlePropertiesMode.LOCAL_STATIC?this._usesPhase?i.activateVertexBuffer(r,this._particleOrbitNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_4):i.activateVertexBuffer(r,this._particleOrbitNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3):t.setVertexConst(r,this._orbitData.x,this._orbitData.y,this._orbitData.z,this._orbitData.w),this._usesEulers&&t.setVertexConstFromMatrix(n.getRegisterIndex(this._pAnimationNode,OTa.EULERS_INDEX),this._eulersMatrix)},OTa.prototype.updateOrbitData=function(){if(this._usesEulers&&(this._eulersMatrix=new Matrix3D,this._eulersMatrix.appendRotation(this._eulers.x,Vector3D.X_AXIS),this._eulersMatrix.appendRotation(this._eulers.y,Vector3D.Y_AXIS),this._eulersMatrix.appendRotation(this._eulers.z,Vector3D.Z_AXIS)),this._particleOrbitNode.mode==ParticlePropertiesMode.GLOBAL)if(this._orbitData=new Vector3D(this._radius,0,this._radius*Math.PI*2,this._cyclePhase*Math.PI/180),this._usesCycle){if(this._cycleDuration<=0)throw new Error("the cycle duration must be greater than zero");this._orbitData.y=2*Math.PI/this._cycleDuration}else this._orbitData.y=2*Math.PI},OTa.ORBIT_INDEX=0,OTa.EULERS_INDEX=1,OTa),ParticleOrbitNode=(_Ta=ParticleNodeBase,__extends(aUa,_Ta),aUa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleOrbitState.ORBIT_INDEX,r.index);var o=i.getFreeVertexConstant();n.setRegisterIndex(this,ParticleOrbitState.EULERS_INDEX,o.index),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.getFreeVertexConstant();var s=i.getFreeVertexVectorTemp();i.addVertexTempUsages(s,1);var a=new ShaderRegisterElement(s.regName,s.index),l=i.getFreeVertexVectorTemp(),c=new ShaderRegisterElement(l.regName,l.index,0),h=new ShaderRegisterElement(l.regName,l.index,1),u=new ShaderRegisterElement(l.regName,l.index,2);i.removeVertexTempUsage(s);var p="";return this._iUsesCycle?(p+="mul "+u+","+n.vertexTime+","+r+".y\n",this._iUsesPhase&&(p+="add "+u+","+u+","+r+".w\n")):p+="mul "+u+","+n.vertexLife+","+r+".y\n",p+="cos "+c+","+u+"\n",p+="sin "+h+","+u+"\n",p+="mul "+a+".x,"+c+","+r+".x\n",p+="mul "+a+".y,"+h+","+r+".x\n",p+="mov "+a+".wz"+n.vertexZeroConst+"\n",this._iUsesEulers&&(p+="m44 "+a+","+a+","+o+"\n"),p+="add "+n.positionTarget+".xyz,"+a+".xyz,"+n.positionTarget+".xyz\n",e.needVelocity&&(p+="neg "+a+".x,"+h+"\n",p+="mov "+a+".y,"+c+"\n",p+="mov "+a+".zw,"+n.vertexZeroConst+"\n",this._iUsesEulers&&(p+="m44 "+a+","+a+","+o+"\n"),p+="mul "+a+","+a+","+r+".z\n",p+="div "+a+","+a+","+r+".y\n",this._iUsesCycle||(p+="div "+a+","+a+","+n.vertexLife+"\n"),p+="add "+n.velocityTarget+".xyz,"+n.velocityTarget+".xyz,"+a+".xyz\n"),p},aUa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},aUa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[aUa.ORBIT_VECTOR3D];if(!e)throw new Error("there is no "+aUa.ORBIT_VECTOR3D+" in param!");if(this._pOneData[0]=e.x,this._iUsesCycle&&e.y<=0)throw new Error("the cycle duration must be greater than zero");this._pOneData[1]=2*Math.PI/(this._iUsesCycle?e.y:1),this._pOneData[2]=e.x*Math.PI*2,this._iUsesPhase&&(this._pOneData[3]=e.z*Math.PI/180)},aUa.ORBIT_VECTOR3D="OrbitVector3D",aUa),ParticleOscillatorState=(BUa=ParticleStateBase,__extends(CUa,BUa),Object.defineProperty(CUa.prototype,"oscillator",{get:function(){return this._oscillator},set:function(t){this._oscillator=t,this.updateOscillatorData()},enumerable:!0,configurable:!0}),CUa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,CUa.OSCILLATOR_INDEX);this._particleOscillatorNode.mode==ParticlePropertiesMode.LOCAL_STATIC?i.activateVertexBuffer(r,this._particleOscillatorNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_4):t.setVertexConst(r,this._oscillatorData.x,this._oscillatorData.y,this._oscillatorData.z,this._oscillatorData.w)},CUa.prototype.updateOscillatorData=function(){if(this._particleOscillatorNode.mode==ParticlePropertiesMode.GLOBAL){if(this._oscillator.w<=0)throw new Error("the cycle duration must greater than zero");null==this._oscillatorData&&(this._oscillatorData=new Vector3D),this._oscillatorData.x=this._oscillator.x,this._oscillatorData.y=this._oscillator.y,this._oscillatorData.z=this._oscillator.z,this._oscillatorData.w=2*Math.PI/this._oscillator.w}},CUa.OSCILLATOR_INDEX=0,CUa),ParticleOscillatorNode=(MUa=ParticleNodeBase,__extends(NUa,MUa),NUa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleOscillatorState.OSCILLATOR_INDEX,r.index);var o=i.getFreeVertexVectorTemp(),s=new ShaderRegisterElement(o.regName,o.index,0),a=new ShaderRegisterElement(o.regName,o.index,1),l=new ShaderRegisterElement(o.regName,o.index,2);i.addVertexTempUsages(o,1);var c=i.getFreeVertexVectorTemp(),h=new ShaderRegisterElement(c.regName,c.index);i.removeVertexTempUsage(o);var u="";return u+="mul "+s+","+n.vertexTime+","+r+".w\n",u+="sin "+a+","+s+"\n",u+="mul "+h+".xyz,"+a+","+r+".xyz\n",u+="add "+n.positionTarget+".xyz,"+h+".xyz,"+n.positionTarget+".xyz\n",e.needVelocity&&(u+="cos "+l+","+s+"\n",u+="mul "+h+".xyz,"+l+","+r+".xyz\n",u+="add "+n.velocityTarget+".xyz,"+h+".xyz,"+n.velocityTarget+".xyz\n"),u},NUa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},NUa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[NUa.OSCILLATOR_VECTOR3D];if(!e)throw new Error("there is no "+NUa.OSCILLATOR_VECTOR3D+" in param!");if(this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z,e.w<=0)throw new Error("the cycle duration must greater than zero");this._pOneData[3]=2*Math.PI/e.w},NUa.OSCILLATOR_VECTOR3D="OscillatorVector3D",NUa),ParticlePositionState=(eVa=ParticleStateBase,__extends(fVa,eVa),Object.defineProperty(fVa.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t},enumerable:!0,configurable:!0}),fVa.prototype.getPositions=function(){return this._pDynamicProperties},fVa.prototype.setPositions=function(t){this._pDynamicProperties=t,this._pDynamicPropertiesDirty=new Object},fVa.prototype.setRenderState=function(t,e,i,n){this._particlePositionNode.mode!=ParticlePropertiesMode.LOCAL_DYNAMIC||this._pDynamicPropertiesDirty[i._iUniqueId]||this._pUpdateDynamicProperties(i);var r=n.getRegisterIndex(this._pAnimationNode,fVa.POSITION_INDEX);this._particlePositionNode.mode==ParticlePropertiesMode.GLOBAL?t.setVertexConst(r,this._position.x,this._position.y,this._position.z):i.activateVertexBuffer(r,this._particlePositionNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3)},fVa.POSITION_INDEX=0,fVa),ParticlePositionNode=(qVa=ParticleNodeBase,__extends(rVa,qVa),rVa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();return n.setRegisterIndex(this,ParticlePositionState.POSITION_INDEX,r.index),"add "+n.positionTarget+".xyz,"+r+".xyz,"+n.positionTarget+".xyz\n"},rVa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},rVa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[rVa.POSITION_VECTOR3D];if(!e)throw new Error("there is no "+rVa.POSITION_VECTOR3D+" in param!");this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z},rVa.POSITION_VECTOR3D="PositionVector3D",rVa),ParticleRotateToHeadingState=(DVa=ParticleStateBase,__extends(EVa,DVa),EVa.prototype.setRenderState=function(t,e,i,n){this._pParticleAnimator.animationSet.hasBillboard&&(this._matrix.copyFrom(e.sourceEntity.transform.concatenatedMatrix3D),this._matrix.append(t.view.projection.transform.inverseConcatenatedMatrix3D),t.setVertexConstFromMatrix(n.getRegisterIndex(this._pAnimationNode,EVa.MATRIX_INDEX),this._matrix))},EVa.MATRIX_INDEX=0,EVa),ParticleRotateToHeadingNode=(MVa=ParticleNodeBase,__extends(NVa,MVa),NVa.prototype.getAGALVertexCode=function(t,e,i,n){var r,o="",s=n.rotationRegisters.length;if(e.hasBillboard){var a=i.getFreeVertexVectorTemp();i.addVertexTempUsages(a,1);var l=i.getFreeVertexVectorTemp();i.addVertexTempUsages(l,1);var c=i.getFreeVertexVectorTemp(),h=i.getFreeVertexConstant();for(n.setRegisterIndex(this,ParticleRotateToHeadingState.MATRIX_INDEX,h.index),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.removeVertexTempUsage(a),i.removeVertexTempUsage(l),o+="m33 "+a+".xyz,"+n.velocityTarget+".xyz,"+h+"\n",o+="mov "+c+","+n.vertexZeroConst+"\n",o+="mov "+c+".xy,"+a+".xy\n",o+="nrm "+c+".xyz,"+c+".xyz\n",o+="mov "+l+","+n.vertexZeroConst+"\n",o+="mov "+l+".x,"+c+".y\n",o+="mov "+l+".y,"+c+".x\n",o+="mov "+a+","+n.vertexZeroConst+"\n",o+="mov "+a+".x,"+c+".x\n",o+="neg "+a+".y,"+c+".y\n",o+="mov "+c+","+n.vertexZeroConst+"\n",o+="mov "+c+".z,"+n.vertexOneConst+"\n",o+="m33 "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+a+"\n",r=0;r<s;r++)o+="m33 "+n.rotationRegisters[r]+".xyz,"+n.rotationRegisters[r]+","+a+"\n"}else{var u=i.getFreeVertexVectorTemp();i.addVertexTempUsages(u,1);var p=i.getFreeVertexVectorTemp();i.addVertexTempUsages(p,1);var d=i.getFreeVertexVectorTemp();i.addVertexTempUsages(d,1);var _=i.getFreeVertexVectorTemp(),f=new ShaderRegisterElement(d.regName,d.index,3),m=new ShaderRegisterElement(_.regName,_.index,3),g=new ShaderRegisterElement(u.regName,u.index,3),y=m;for(i.removeVertexTempUsage(u),i.removeVertexTempUsage(p),i.removeVertexTempUsage(d),o+="mov "+p+".x,"+n.vertexOneConst+"\n",o+="mov "+p+".yz,"+n.vertexZeroConst+"\n",o+="nrm "+u+".xyz,"+n.velocityTarget+".xyz\n",o+="dp3 "+g+","+u+".xyz,"+p+".xyz\n",o+="crs "+u+".xyz,"+p+".xyz,"+u+".xyz\n",o+="nrm "+u+".xyz,"+u+".xyz\n",o+="dp3 "+d+".x,"+u+".xyz,"+u+".xyz\n",o+="sge "+d+".x,"+n.vertexZeroConst+","+d+".x\n",o+="add "+u+".z,"+d+".x,"+u+".z\n",o+="add "+y+","+g+","+n.vertexOneConst+"\n",o+="div "+y+","+y+","+n.vertexTwoConst+"\n",o+="sqt "+f+","+y+"\n",o+="sub "+y+","+n.vertexOneConst+","+g+"\n",o+="div "+y+","+y+","+n.vertexTwoConst+"\n",o+="sqt "+m+","+y+"\n",o+="mul "+d+".xyz,"+m+","+u+".xyz\n",o+="mul "+_+".xyz,"+m+","+u+".xyz\n",o+="neg "+_+".xyz,"+_+".xyz\n",o+="crs "+u+".xyz,"+d+".xyz,"+n.scaleAndRotateTarget+".xyz\n",o+="mul "+p+".xyz,"+f+","+n.scaleAndRotateTarget+".xyz\n",o+="add "+u+".xyz,"+u+".xyz,"+p+".xyz\n",o+="dp3 "+p+".w,"+d+".xyz,"+n.scaleAndRotateTarget+".xyz\n",o+="neg "+u+".w,"+p+".w\n",o+="crs "+d+".xyz,"+u+".xyz,"+_+".xyz\n",o+="mul "+p+".xyzw,"+u+".xyzw,"+f+"\n",o+="add "+d+".xyz,"+d+".xyz,"+p+".xyz\n",o+="mul "+p+".xyz,"+u+".w,"+_+".xyz\n",o+="add "+n.scaleAndRotateTarget+".xyz,"+d+".xyz,"+p+".xyz\n",r=0;r<s;r++)o+="mov "+p+".x,"+n.vertexOneConst+"\n",o+="mov "+p+".yz,"+n.vertexZeroConst+"\n",o+="nrm "+u+".xyz,"+n.velocityTarget+".xyz\n",o+="dp3 "+g+","+u+".xyz,"+p+".xyz\n",o+="crs "+u+".xyz,"+p+".xyz,"+u+".xyz\n",o+="nrm "+u+".xyz,"+u+".xyz\n",o+="dp3 "+d+".x,"+u+".xyz,"+u+".xyz\n",o+="sge "+d+".x,"+n.vertexZeroConst+","+d+".x\n",o+="add "+u+".z,"+d+".x,"+u+".z\n",o+="add "+y+","+g+","+n.vertexOneConst+"\n",o+="div "+y+","+y+","+n.vertexTwoConst+"\n",o+="sqt "+f+","+y+"\n",o+="sub "+y+","+n.vertexOneConst+","+g+"\n",o+="div "+y+","+y+","+n.vertexTwoConst+"\n",o+="sqt "+m+","+y+"\n",o+="mul "+d+".xyz,"+m+","+u+".xyz\n",o+="mul "+_+".xyz,"+m+","+u+".xyz\n",o+="neg "+_+".xyz,"+_+".xyz\n",o+="crs "+u+".xyz,"+d+".xyz,"+n.rotationRegisters[r]+".xyz\n",o+="mul "+p+".xyz,"+f+","+n.rotationRegisters[r]+".xyz\n",o+="add "+u+".xyz,"+u+".xyz,"+p+".xyz\n",o+="dp3 "+p+".w,"+d+".xyz,"+n.rotationRegisters[r]+".xyz\n",o+="neg "+u+".w,"+p+".w\n",o+="crs "+d+".xyz,"+u+".xyz,"+_+".xyz\n",o+="mul "+p+".xyzw,"+u+".xyzw,"+f+"\n",o+="add "+d+".xyz,"+d+".xyz,"+p+".xyz\n",o+="mul "+p+".xyz,"+u+".w,"+_+".xyz\n",o+="add "+n.rotationRegisters[r]+".xyz,"+d+".xyz,"+p+".xyz\n"}return o},NVa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},NVa.prototype._iProcessAnimationSetting=function(t){t.needVelocity=!0},NVa),ParticleRotateToPositionState=(iWa=ParticleStateBase,__extends(jWa,iWa),Object.defineProperty(jWa.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t},enumerable:!0,configurable:!0}),jWa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,jWa.POSITION_INDEX);this._pParticleAnimator.animationSet.hasBillboard&&(this._matrix.copyFrom(e.sourceEntity.transform.concatenatedMatrix3D),this._matrix.append(t.view.projection.transform.inverseConcatenatedMatrix3D),t.setVertexConstFromMatrix(n.getRegisterIndex(this._pAnimationNode,jWa.MATRIX_INDEX),this._matrix)),this._particleRotateToPositionNode.mode==ParticlePropertiesMode.GLOBAL?(this._offset=e.sourceEntity.transform.inverseConcatenatedMatrix3D.transformVector(this._position),t.setVertexConst(r,this._offset.x,this._offset.y,this._offset.z)):i.activateVertexBuffer(r,this._particleRotateToPositionNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3)},jWa.MATRIX_INDEX=0,jWa.POSITION_INDEX=1,jWa),ParticleRotateToPositionNode=(tWa=ParticleNodeBase,__extends(uWa,tWa),uWa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleRotateToPositionState.POSITION_INDEX,r.index);var o,s="",a=n.rotationRegisters.length;if(e.hasBillboard){var l=i.getFreeVertexVectorTemp();i.addVertexTempUsages(l,1);var c=i.getFreeVertexVectorTemp();i.addVertexTempUsages(c,1);var h=i.getFreeVertexVectorTemp(),u=i.getFreeVertexConstant();for(n.setRegisterIndex(this,ParticleRotateToPositionState.MATRIX_INDEX,u.index),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.getFreeVertexConstant(),i.removeVertexTempUsage(l),i.removeVertexTempUsage(c),s+="sub "+l+".xyz,"+r+".xyz,"+n.positionTarget+".xyz\n",s+="m33 "+l+".xyz,"+l+".xyz,"+u+"\n",s+="mov "+h+","+n.vertexZeroConst+"\n",s+="mov "+h+".xy,"+l+".xy\n",s+="nrm "+h+".xyz,"+h+".xyz\n",s+="mov "+c+","+n.vertexZeroConst+"\n",s+="mov "+c+".x,"+h+".y\n",s+="mov "+c+".y,"+h+".x\n",s+="mov "+l+","+n.vertexZeroConst+"\n",s+="mov "+l+".x,"+h+".x\n",s+="neg "+l+".y,"+h+".y\n",s+="mov "+h+","+n.vertexZeroConst+"\n",s+="mov "+h+".z,"+n.vertexOneConst+"\n",s+="m33 "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+l+"\n",o=0;o<a;o++)s+="m33 "+n.rotationRegisters[o]+".xyz,"+n.rotationRegisters[o]+","+l+"\n"}else{var p=i.getFreeVertexVectorTemp();i.addVertexTempUsages(p,1);var d=i.getFreeVertexVectorTemp();i.addVertexTempUsages(d,1);var _=new ShaderRegisterElement(d.regName,d.index,0),f=new ShaderRegisterElement(d.regName,d.index,1),m=new ShaderRegisterElement(d.regName,d.index,2),g=new ShaderRegisterElement(d.regName,d.index,3),y=i.getFreeVertexVectorTemp();for(i.addVertexTempUsages(y,1),i.removeVertexTempUsage(p),i.removeVertexTempUsage(d),i.removeVertexTempUsage(y),s+="sub "+p+".xyz,"+r+".xyz,"+n.positionTarget+".xyz\n",s+="nrm "+p+".xyz,"+p+".xyz\n",s+="mov "+f+","+p+".y\n",s+="mul "+_+","+f+","+f+"\n",s+="sub "+_+","+n.vertexOneConst+","+_+"\n",s+="sqt "+_+","+_+"\n",s+="mul "+y+".x,"+_+","+n.scaleAndRotateTarget+".y\n",s+="mul "+y+".y,"+f+","+n.scaleAndRotateTarget+".z\n",s+="mul "+y+".z,"+f+","+n.scaleAndRotateTarget+".y\n",s+="mul "+y+".w,"+_+","+n.scaleAndRotateTarget+".z\n",s+="sub "+n.scaleAndRotateTarget+".y,"+y+".x,"+y+".y\n",s+="add "+n.scaleAndRotateTarget+".z,"+y+".z,"+y+".w\n",s+="abs "+y+".y,"+p+".y\n",s+="sge "+y+".z,"+y+".y,"+n.vertexOneConst+"\n",s+="mul "+y+".x,"+y+".y,"+p+".y\n",s+="mov "+p+".y,"+n.vertexZeroConst+"\n",s+="dp3 "+f+","+p+".xyz,"+p+".xyz\n",s+="sge "+g+","+n.vertexZeroConst+","+f+"\n",s+="mov "+p+".y,"+n.vertexZeroConst+"\n",s+="nrm "+p+".xyz,"+p+".xyz\n",s+="sub "+f+","+n.vertexOneConst+","+g+"\n",s+="mul "+f+","+f+","+p+".x\n",s+="mov "+_+","+p+".z\n",s+="neg "+_+","+_+"\n",s+="sub "+m+","+n.vertexOneConst+","+_+"\n",s+="mul "+m+","+y+".x,"+g+"\n",s+="add "+_+","+_+","+m+"\n",s+="mul "+y+".x,"+_+","+n.scaleAndRotateTarget+".x\n",s+="mul "+y+".y,"+f+","+n.scaleAndRotateTarget+".z\n",s+="mul "+y+".z,"+f+","+n.scaleAndRotateTarget+".x\n",s+="mul "+y+".w,"+_+","+n.scaleAndRotateTarget+".z\n",s+="sub "+n.scaleAndRotateTarget+".x,"+y+".x,"+y+".y\n",s+="add "+n.scaleAndRotateTarget+".z,"+y+".z,"+y+".w\n",o=0;o<a;o++)s+="sub "+p+".xyz,"+r+".xyz,"+n.positionTarget+".xyz\n",s+="nrm "+p+".xyz,"+p+".xyz\n",s+="mov "+f+","+p+".y\n",s+="mul "+_+","+f+","+f+"\n",s+="sub "+_+","+n.vertexOneConst+","+_+"\n",s+="sqt "+_+","+_+"\n",s+="mul "+y+".x,"+_+","+n.rotationRegisters[o]+".y\n",s+="mul "+y+".y,"+f+","+n.rotationRegisters[o]+".z\n",s+="mul "+y+".z,"+f+","+n.rotationRegisters[o]+".y\n",s+="mul "+y+".w,"+_+","+n.rotationRegisters[o]+".z\n",s+="sub "+n.rotationRegisters[o]+".y,"+y+".x,"+y+".y\n",s+="add "+n.rotationRegisters[o]+".z,"+y+".z,"+y+".w\n",s+="abs "+y+".y,"+p+".y\n",s+="sge "+y+".z,"+y+".y,"+n.vertexOneConst+"\n",s+="mul "+y+".x,"+y+".y,"+p+".y\n",s+="mov "+p+".y,"+n.vertexZeroConst+"\n",s+="dp3 "+f+","+p+".xyz,"+p+".xyz\n",s+="sge "+g+","+n.vertexZeroConst+","+f+"\n",s+="mov "+p+".y,"+n.vertexZeroConst+"\n",s+="nrm "+p+".xyz,"+p+".xyz\n",s+="sub "+f+","+n.vertexOneConst+","+g+"\n",s+="mul "+f+","+f+","+p+".x\n",s+="mov "+_+","+p+".z\n",s+="neg "+_+","+_+"\n",s+="sub "+m+","+n.vertexOneConst+","+_+"\n",s+="mul "+m+","+y+".x,"+g+"\n",s+="add "+_+","+_+","+m+"\n",s+="mul "+y+".x,"+_+","+n.rotationRegisters[o]+".x\n",s+="mul "+y+".y,"+f+","+n.rotationRegisters[o]+".z\n",s+="mul "+y+".z,"+f+","+n.rotationRegisters[o]+".x\n",s+="mul "+y+".w,"+_+","+n.rotationRegisters[o]+".z\n",s+="sub "+n.rotationRegisters[o]+".x,"+y+".x,"+y+".y\n",s+="add "+n.rotationRegisters[o]+".z,"+y+".z,"+y+".w\n"}return s},uWa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},uWa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[uWa.POSITION_VECTOR3D];if(!e)throw new Error("there is no "+uWa.POSITION_VECTOR3D+" in param!");this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z},uWa.POSITION_VECTOR3D="RotateToPositionVector3D",uWa),ParticleRotationalVelocityState=(UWa=ParticleStateBase,__extends(VWa,UWa),Object.defineProperty(VWa.prototype,"rotationalVelocity",{get:function(){return this._rotationalVelocity},set:function(t){this._rotationalVelocity=t,this.updateRotationalVelocityData()},enumerable:!0,configurable:!0}),VWa.prototype.getRotationalVelocities=function(){return this._pDynamicProperties},VWa.prototype.setRotationalVelocities=function(t){this._pDynamicProperties=t,this._pDynamicPropertiesDirty=new Object},VWa.prototype.setRenderState=function(t,e,i,n){this._particleRotationalVelocityNode.mode!=ParticlePropertiesMode.LOCAL_DYNAMIC||this._pDynamicPropertiesDirty[i._iUniqueId]||this._pUpdateDynamicProperties(i);var r=n.getRegisterIndex(this._pAnimationNode,VWa.ROTATIONALVELOCITY_INDEX);this._particleRotationalVelocityNode.mode==ParticlePropertiesMode.GLOBAL?t.setVertexConst(r,this._rotationalVelocityData.x,this._rotationalVelocityData.y,this._rotationalVelocityData.z,this._rotationalVelocityData.w):i.activateVertexBuffer(r,this._particleRotationalVelocityNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_4)},VWa.prototype.updateRotationalVelocityData=function(){if(this._particleRotationalVelocityNode.mode==ParticlePropertiesMode.GLOBAL){if(this._rotationalVelocity.w<=0)throw new Error("the cycle duration must greater than zero");var t=this._rotationalVelocity.clone();t.length<=0?t.z=1:t.normalize(),this._rotationalVelocityData=new Vector3D(t.x,t.y,t.z,Math.PI/t.w)}},VWa.ROTATIONALVELOCITY_INDEX=0,VWa),ParticleRotationalVelocityNode=(fXa=ParticleNodeBase,__extends(gXa,fXa),gXa.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleRotationalVelocityState.ROTATIONALVELOCITY_INDEX,r.index);var o=i.getFreeVertexVectorTemp();i.addVertexTempUsages(o,1);var s=i.getFreeVertexVectorTemp();i.addVertexTempUsages(s,1);var a=i.getFreeVertexVectorTemp();i.addVertexTempUsages(a,1);var l=new ShaderRegisterElement(a.regName,a.index),c=i.getFreeVertexVectorTemp(),c=new ShaderRegisterElement(c.regName,c.index),h=new ShaderRegisterElement(l.regName,l.index,3),u=new ShaderRegisterElement(c.regName,c.index,3);i.removeVertexTempUsage(o),i.removeVertexTempUsage(s),i.removeVertexTempUsage(a);var p="";p+="mov "+o+".xyz,"+r+".xyz\n",p+="mov "+o+".w,"+n.vertexZeroConst+"\n",p+="mul "+h+","+n.vertexTime+","+r+".w\n",p+="sin "+u+","+h+"\n",p+="cos "+h+","+h+"\n",p+="mul "+l+".xyz,"+u+","+o+".xyz\n",p+="mul "+c+".xyz,"+u+","+o+".xyz\n",p+="neg "+c+".xyz,"+c+".xyz\n",p+="crs "+o+".xyz,"+l+".xyz,"+n.scaleAndRotateTarget+".xyz\n",p+="mul "+s+".xyz,"+h+","+n.scaleAndRotateTarget+".xyz\n",p+="add "+o+".xyz,"+o+".xyz,"+s+".xyz\n",p+="dp3 "+s+".w,"+l+".xyz,"+n.scaleAndRotateTarget+".xyz\n",p+="neg "+o+".w,"+s+".w\n",p+="crs "+l+".xyz,"+o+".xyz,"+c+".xyz\n",p+="mul "+s+".xyzw,"+o+".xyzw,"+h+"\n",p+="add "+l+".xyz,"+l+".xyz,"+s+".xyz\n",p+="mul "+s+".xyz,"+o+".w,"+c+".xyz\n",p+="add "+n.scaleAndRotateTarget+".xyz,"+l+".xyz,"+s+".xyz\n";for(var d=n.rotationRegisters.length,_=0;_<d;_++)p+="mov "+o+".xyz,"+r+".xyz\n",p+="mov "+o+".w,"+n.vertexZeroConst+"\n",p+="mul "+h+","+n.vertexTime+","+r+".w\n",p+="sin "+u+","+h+"\n",p+="cos "+h+","+h+"\n",p+="mul "+l+".xyz,"+u+","+o+".xyz\n",p+="mul "+c+".xyz,"+u+","+o+".xyz\n",p+="neg "+c+".xyz,"+c+".xyz\n",p+="crs "+o+".xyz,"+l+".xyz,"+n.rotationRegisters[_]+".xyz\n",p+="mul "+s+".xyz,"+h+","+n.rotationRegisters[_]+"\n",p+="add "+o+".xyz,"+o+".xyz,"+s+".xyz\n",p+="dp3 "+s+".w,"+l+".xyz,"+n.rotationRegisters[_]+"\n",p+="neg "+o+".w,"+s+".w\n",p+="crs "+l+".xyz,"+o+".xyz,"+c+".xyz\n",p+="mul "+s+".xyzw,"+o+".xyzw,"+h+"\n",p+="add "+l+".xyz,"+l+".xyz,"+s+".xyz\n",p+="mul "+s+".xyz,"+o+".w,"+c+".xyz\n",p+="add "+n.rotationRegisters[_]+","+l+".xyz,"+s+".xyz\n";return p},gXa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},gXa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[gXa.ROTATIONALVELOCITY_VECTOR3D];if(!e)throw new Error("there is no "+gXa.ROTATIONALVELOCITY_VECTOR3D+" in param!");if(e.length<=0?e.z=1:e.normalize(),this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z,e.w<=0)throw new Error("the cycle duration must greater than zero");this._pOneData[3]=Math.PI/e.w},gXa.ROTATIONALVELOCITY_VECTOR3D="RotationalVelocityVector3D",gXa),ParticleScaleState=(CXa=ParticleStateBase,__extends(DXa,CXa),Object.defineProperty(DXa.prototype,"minScale",{get:function(){return this._minScale},set:function(t){this._minScale=t,this.updateScaleData()},enumerable:!0,configurable:!0}),Object.defineProperty(DXa.prototype,"maxScale",{get:function(){return this._maxScale},set:function(t){this._maxScale=t,this.updateScaleData()},enumerable:!0,configurable:!0}),Object.defineProperty(DXa.prototype,"cycleDuration",{get:function(){return this._cycleDuration},set:function(t){this._cycleDuration=t,this.updateScaleData()},enumerable:!0,configurable:!0}),Object.defineProperty(DXa.prototype,"cyclePhase",{get:function(){return this._cyclePhase},set:function(t){this._cyclePhase=t,this.updateScaleData()},enumerable:!0,configurable:!0}),DXa.prototype.setRenderState=function(t,e,i,n){var r=n.getRegisterIndex(this._pAnimationNode,DXa.SCALE_INDEX);this._particleScaleNode.mode==ParticlePropertiesMode.LOCAL_STATIC?this._usesCycle?this._usesPhase?i.activateVertexBuffer(r,this._particleScaleNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_4):i.activateVertexBuffer(r,this._particleScaleNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3):i.activateVertexBuffer(r,this._particleScaleNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_2):t.setVertexConst(r,this._scaleData.x,this._scaleData.y,this._scaleData.z,this._scaleData.w)},DXa.prototype.updateScaleData=function(){if(this._particleScaleNode.mode==ParticlePropertiesMode.GLOBAL)if(this._usesCycle){if(this._cycleDuration<=0)throw new Error("the cycle duration must be greater than zero");this._scaleData=new Vector3D((this._minScale+this._maxScale)/2,Math.abs(this._minScale-this._maxScale)/2,2*Math.PI/this._cycleDuration,this._cyclePhase*Math.PI/180)}else this._scaleData=new Vector3D(this._minScale,this._maxScale-this._minScale,0,0)},DXa.SCALE_INDEX=0,DXa),ParticleScaleNode=(QXa=ParticleNodeBase,__extends(RXa,QXa),RXa.prototype.getAGALVertexCode=function(t,e,i,n){var r="",o=i.getFreeVertexSingleTemp(),s=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();return n.setRegisterIndex(this,ParticleScaleState.SCALE_INDEX,s.index),this._iUsesCycle&&(r+="mul "+o+","+n.vertexTime+","+s+".z\n",this._iUsesPhase&&(r+="add "+o+","+o+","+s+".w\n"),r+="sin "+o+","+o+"\n"),r+="mul "+o+","+s+".y,"+(this._iUsesCycle?o:n.vertexLife)+"\n",(r+="add "+o+","+s+".x,"+o+"\n")+"mul "+n.scaleAndRotateTarget+".xyz,"+n.scaleAndRotateTarget+".xyz,"+o+"\n"},RXa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},RXa.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[RXa.SCALE_VECTOR3D];if(!e)throw new Error("there is no "+RXa.SCALE_VECTOR3D+" in param!");if(this._iUsesCycle){if(this._pOneData[0]=(e.x+e.y)/2,this._pOneData[1]=Math.abs(e.x-e.y)/2,e.z<=0)throw new Error("the cycle duration must be greater than zero");this._pOneData[2]=2*Math.PI/e.z,this._iUsesPhase&&(this._pOneData[3]=e.w*Math.PI/180)}else this._pOneData[0]=e.x,this._pOneData[1]=e.y-e.x},RXa.SCALE_VECTOR3D="ScaleVector3D",RXa),ParticleSegmentedColorState=(iYa=ParticleStateBase,__extends(jYa,iYa),Object.defineProperty(jYa.prototype,"startColor",{get:function(){return this._startColor},set:function(t){this._startColor=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(jYa.prototype,"endColor",{get:function(){return this._endColor},set:function(t){this._endColor=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(jYa.prototype,"numSegmentPoint",{get:function(){return this._numSegmentPoint},enumerable:!0,configurable:!0}),Object.defineProperty(jYa.prototype,"segmentPoints",{get:function(){return this._segmentPoints},set:function(t){this._segmentPoints=t,this.updateColorData()},enumerable:!0,configurable:!0}),Object.defineProperty(jYa.prototype,"usesMultiplier",{get:function(){return this._usesMultiplier},enumerable:!0,configurable:!0}),Object.defineProperty(jYa.prototype,"usesOffset",{get:function(){return this._usesOffset},enumerable:!0,configurable:!0}),jYa.prototype.setRenderState=function(t,e,i,n){t.usesFragmentAnimation&&(0<this._numSegmentPoint&&t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,jYa.TIME_DATA_INDEX),this._timeLifeData[0],this._timeLifeData[1],this._timeLifeData[2],this._timeLifeData[3]),this._usesMultiplier&&t.setVertexConstFromArray(n.getRegisterIndex(this._pAnimationNode,jYa.START_MULTIPLIER_INDEX),this._multiplierData),this._usesOffset&&t.setVertexConstFromArray(n.getRegisterIndex(this._pAnimationNode,jYa.START_OFFSET_INDEX),this._offsetData))},jYa.prototype.updateColorData=function(){this._timeLifeData=new Float32Array(4),this._multiplierData=new Float32Array(4*(this._numSegmentPoint+1)),this._offsetData=new Float32Array(4*(this._numSegmentPoint+1));for(var t=0,e=3<this._numSegmentPoint?3:this._numSegmentPoint,i=0;i<e;i++)this._timeLifeData[t++]=0==i?this._segmentPoints[i].life:this._segmentPoints[i].life-this._segmentPoints[i-1].life;if(i=e,0==this._numSegmentPoint?this._timeLifeData[t++]=1:this._timeLifeData[t++]=1-this._segmentPoints[i-1].life,this._usesMultiplier){for(t=0,this._multiplierData[t++]=this._startColor.redMultiplier,this._multiplierData[t++]=this._startColor.greenMultiplier,this._multiplierData[t++]=this._startColor.blueMultiplier,this._multiplierData[t++]=this._startColor.alphaMultiplier,i=0;i<this._numSegmentPoint;i++)0==i?(this._multiplierData[t++]=(this._segmentPoints[i].color.redMultiplier-this._startColor.redMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.greenMultiplier-this._startColor.greenMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.blueMultiplier-this._startColor.blueMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.alphaMultiplier-this._startColor.alphaMultiplier)/this._timeLifeData[i]):(this._multiplierData[t++]=(this._segmentPoints[i].color.redMultiplier-this._segmentPoints[i-1].color.redMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.greenMultiplier-this._segmentPoints[i-1].color.greenMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.blueMultiplier-this._segmentPoints[i-1].color.blueMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._segmentPoints[i].color.alphaMultiplier-this._segmentPoints[i-1].color.alphaMultiplier)/this._timeLifeData[i]);i=this._numSegmentPoint,0==this._numSegmentPoint?(this._multiplierData[t++]=this._endColor.redMultiplier-this._startColor.redMultiplier,this._multiplierData[t++]=this._endColor.greenMultiplier-this._startColor.greenMultiplier,this._multiplierData[t++]=this._endColor.blueMultiplier-this._startColor.blueMultiplier,this._multiplierData[t++]=this._endColor.alphaMultiplier-this._startColor.alphaMultiplier):(this._multiplierData[t++]=(this._endColor.redMultiplier-this._segmentPoints[i-1].color.redMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._endColor.greenMultiplier-this._segmentPoints[i-1].color.greenMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._endColor.blueMultiplier-this._segmentPoints[i-1].color.blueMultiplier)/this._timeLifeData[i],this._multiplierData[t++]=(this._endColor.alphaMultiplier-this._segmentPoints[i-1].color.alphaMultiplier)/this._timeLifeData[i])}if(this._usesOffset){for(t=0,this._offsetData[t++]=this._startColor.redOffset/255,this._offsetData[t++]=this._startColor.greenOffset/255,this._offsetData[t++]=this._startColor.blueOffset/255,this._offsetData[t++]=this._startColor.alphaOffset/255,i=0;i<this._numSegmentPoint;i++)0==i?(this._offsetData[t++]=(this._segmentPoints[i].color.redOffset-this._startColor.redOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.greenOffset-this._startColor.greenOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.blueOffset-this._startColor.blueOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.alphaOffset-this._startColor.alphaOffset)/this._timeLifeData[i]/255):(this._offsetData[t++]=(this._segmentPoints[i].color.redOffset-this._segmentPoints[i-1].color.redOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.greenOffset-this._segmentPoints[i-1].color.greenOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.blueOffset-this._segmentPoints[i-1].color.blueOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._segmentPoints[i].color.alphaOffset-this._segmentPoints[i-1].color.alphaOffset)/this._timeLifeData[i]/255);i=this._numSegmentPoint,0==this._numSegmentPoint?(this._offsetData[t++]=(this._endColor.redOffset-this._startColor.redOffset)/255,this._offsetData[t++]=(this._endColor.greenOffset-this._startColor.greenOffset)/255,this._offsetData[t++]=(this._endColor.blueOffset-this._startColor.blueOffset)/255,this._offsetData[t++]=(this._endColor.alphaOffset-this._startColor.alphaOffset)/255):(this._offsetData[i]=(this._endColor.redOffset-this._segmentPoints[i-1].color.redOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._endColor.greenOffset-this._segmentPoints[i-1].color.greenOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._endColor.blueOffset-this._segmentPoints[i-1].color.blueOffset)/this._timeLifeData[i]/255,this._offsetData[t++]=(this._endColor.alphaOffset-this._segmentPoints[i-1].color.alphaOffset)/this._timeLifeData[i]/255)}},jYa.START_MULTIPLIER_INDEX=0,jYa.START_OFFSET_INDEX=1,jYa.TIME_DATA_INDEX=2,jYa),ParticleSegmentedColorNode=(xYa=ParticleNodeBase,__extends(yYa,xYa),yYa.prototype._iProcessAnimationSetting=function(t){this._iUsesMultiplier&&(t.hasColorMulNode=!0),this._iUsesOffset&&(t.hasColorAddNode=!0)},yYa.prototype.getAGALVertexCode=function(t,e,i,n){var r,o="";if(t.usesFragmentAnimation){this._iUsesMultiplier&&(r=i.getFreeVertexVectorTemp(),i.addVertexTempUsages(r,1));var s=i.getFreeVertexVectorTemp();i.addVertexTempUsages(s,1);var a=i.getFreeVertexVectorTemp(),l=new ShaderRegisterElement(a.regName,a.index,0),c=new ShaderRegisterElement(a.regName,a.index,1);this._iUsesMultiplier&&i.removeVertexTempUsage(r),i.removeVertexTempUsage(s);var h,u,p,d,_,f=i.getFreeVertexConstant();if(n.setRegisterIndex(this,ParticleSegmentedColorState.TIME_DATA_INDEX,f.index),this._iUsesMultiplier)for(u=i.getFreeVertexConstant(),n.setRegisterIndex(this,ParticleSegmentedColorState.START_MULTIPLIER_INDEX,u.index),p=new Array,h=0;h<this._iNumSegmentPoint+1;h++)p.push(i.getFreeVertexConstant());if(this._iUsesOffset)for(d=i.getFreeVertexConstant(),n.setRegisterIndex(this,ParticleSegmentedColorState.START_OFFSET_INDEX,d.index),_=new Array,h=0;h<this._iNumSegmentPoint+1;h++)_.push(i.getFreeVertexConstant());for(this._iUsesMultiplier&&(o+="mov "+r+","+u+"\n"),this._iUsesOffset&&(o+="add "+n.colorAddTarget+","+n.colorAddTarget+","+d+"\n"),h=0;h<this._iNumSegmentPoint;h++){switch(h){case 0:o+="min "+c+","+n.vertexLife+","+f+".x\n";break;case 1:o+="sub "+l+","+n.vertexLife+","+f+".x\n",o+="max "+c+","+l+","+n.vertexZeroConst+"\n",o+="min "+c+","+c+","+f+".y\n";break;case 2:o+="sub "+l+","+l+","+f+".y\n",o+="max "+c+","+l+","+n.vertexZeroConst+"\n",o+="min "+c+","+c+","+f+".z\n";break;case 3:o+="sub "+l+","+l+","+f+".z\n",o+="max "+c+","+l+","+n.vertexZeroConst+"\n",o+="min "+c+","+c+","+f+".w\n"}this._iUsesMultiplier&&(o+="mul "+s+","+c+","+p[h]+"\n",o+="add "+r+","+r+","+s+"\n"),this._iUsesOffset&&(o+="mul "+s+","+c+","+_[h]+"\n",o+="add "+n.colorAddTarget+","+n.colorAddTarget+","+s+"\n")}if(0==this._iNumSegmentPoint)c=n.vertexLife;else{switch(this._iNumSegmentPoint){case 1:o+="sub "+l+","+n.vertexLife+","+f+".x\n";break;case 2:o+="sub "+l+","+l+","+f+".y\n";break;case 3:o+="sub "+l+","+l+","+f+".z\n";break;case 4:o+="sub "+l+","+l+","+f+".w\n"}o+="max "+c+","+l+","+n.vertexZeroConst+"\n"}this._iUsesMultiplier&&(o+="mul "+s+","+c+","+p[this._iNumSegmentPoint]+"\n",o+="add "+r+","+r+","+s+"\n",o+="mul "+n.colorMulTarget+","+n.colorMulTarget+","+r+"\n"),this._iUsesOffset&&(o+="mul "+s+","+c+","+_[this._iNumSegmentPoint]+"\n",o+="add "+n.colorAddTarget+","+n.colorAddTarget+","+s+"\n")}return o},yYa),ParticleSpriteSheetState=(XYa=ParticleStateBase,__extends(YYa,XYa),Object.defineProperty(YYa.prototype,"cyclePhase",{get:function(){return this._cyclePhase},set:function(t){this._cyclePhase=t,this.updateSpriteSheetData()},enumerable:!0,configurable:!0}),Object.defineProperty(YYa.prototype,"cycleDuration",{get:function(){return this._cycleDuration},set:function(t){this._cycleDuration=t,this.updateSpriteSheetData()},enumerable:!0,configurable:!0}),YYa.prototype.setRenderState=function(t,e,i,n){var r;!t.usesUVTransform&&(t.setVertexConst(n.getRegisterIndex(this._pAnimationNode,YYa.UV_INDEX_0),this._spriteSheetData[0],this._spriteSheetData[1],this._spriteSheetData[2],this._spriteSheetData[3]),this._usesCycle)&&(r=n.getRegisterIndex(this._pAnimationNode,YYa.UV_INDEX_1),this._particleSpriteSheetNode.mode==ParticlePropertiesMode.LOCAL_STATIC?this._usesPhase?i.activateVertexBuffer(r,this._particleSpriteSheetNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3):i.activateVertexBuffer(r,this._particleSpriteSheetNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_2):t.setVertexConst(r,this._spriteSheetData[4],this._spriteSheetData[5]))},YYa.prototype.updateSpriteSheetData=function(){this._spriteSheetData=new Array(8);var t=this._totalFrames/this._numColumns;if(this._spriteSheetData[0]=t,this._spriteSheetData[1]=1/this._numColumns,this._spriteSheetData[2]=1/this._numRows,this._usesCycle){if(this._cycleDuration<=0)throw new Error("the cycle duration must be greater than zero");this._spriteSheetData[4]=t/this._cycleDuration,this._spriteSheetData[5]=this._cycleDuration,this._usesPhase&&(this._spriteSheetData[6]=this._cyclePhase)}},YYa.UV_INDEX_0=0,YYa.UV_INDEX_1=1,YYa),ParticleSpriteSheetNode=(iZa=ParticleNodeBase,__extends(jZa,iZa),Object.defineProperty(jZa.prototype,"numColumns",{get:function(){return this._iNumColumns},enumerable:!0,configurable:!0}),Object.defineProperty(jZa.prototype,"numRows",{get:function(){return this._iNumRows},enumerable:!0,configurable:!0}),Object.defineProperty(jZa.prototype,"totalFrames",{get:function(){return this._iTotalFrames},enumerable:!0,configurable:!0}),jZa.prototype.getAGALUVCode=function(t,e,i,n){var r=i.getFreeVertexConstant(),o=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleSpriteSheetState.UV_INDEX_0,r.index),n.setRegisterIndex(this,ParticleSpriteSheetState.UV_INDEX_1,o.index);var s=new ShaderRegisterElement(r.regName,r.index,0),a=new ShaderRegisterElement(r.regName,r.index,1),l=new ShaderRegisterElement(r.regName,r.index,2),c=new ShaderRegisterElement(o.regName,o.index,0),h=new ShaderRegisterElement(o.regName,o.index,1),u=new ShaderRegisterElement(o.regName,o.index,2),p=i.getFreeVertexVectorTemp(),d=new ShaderRegisterElement(p.regName,p.index,0),_=new ShaderRegisterElement(p.regName,p.index,1),p=new ShaderRegisterElement(p.regName,p.index,2),f=new ShaderRegisterElement(p.regName,p.index,3),m=new ShaderRegisterElement(n.uvTarget.regName,n.uvTarget.index,0),g=new ShaderRegisterElement(n.uvTarget.regName,n.uvTarget.index,1),y="";return y+="mul "+m+","+m+","+a+"\n",1<this._iNumRows&&(y+="mul "+g+","+g+","+l+"\n"),this._iUsesCycle?(this._iUsesPhase?y+="add "+d+","+n.vertexTime+","+u+"\n":y+="mov "+d+","+n.vertexTime+"\n",y+="div "+d+","+d+","+h+"\n",y+="frc "+d+","+d+"\n",y+="mul "+d+","+d+","+h+"\n",y+="mul "+p+","+d+","+c+"\n"):y+="mul "+p.toString()+","+n.vertexLife+","+s+"\n",1<this._iNumRows&&(y+="frc "+f+","+p+"\n",y+="sub "+_+","+p+","+f+"\n",y+="mul "+_+","+_+","+l+"\n",y+="add "+g+","+g+","+_+"\n"),y+="div "+f+","+p+","+a+"\n",y+="frc "+p+","+f+"\n",y+="sub "+f+","+f+","+p+"\n",y+="mul "+p+","+f+","+a+"\n",1<this._iNumRows&&(y+="frc "+p+","+p+"\n"),y+"add "+m+","+m+","+p+"\n"},jZa.prototype.getAnimationState=function(t){return t.getAnimationState(this)},jZa.prototype._iProcessAnimationSetting=function(t){t.hasUVNode=!0},jZa.prototype._iGeneratePropertyOfOneParticle=function(t){if(this._iUsesCycle){var e=t[jZa.UV_VECTOR3D];if(!e)throw new Error("there is no "+jZa.UV_VECTOR3D+" in param!");if(e.x<=0)throw new Error("the cycle duration must be greater than zero");var i=this._iTotalFrames/this._iNumColumns;this._pOneData[0]=i/e.x,this._pOneData[1]=e.x,this._iUsesPhase&&(this._pOneData[2]=e.y)}},jZa.UV_VECTOR3D="UVVector3D",jZa),ParticleUVState=(RZa=ParticleStateBase,__extends(SZa,RZa),SZa.prototype.setRenderState=function(t,e,i,n){var r,o;t.usesUVTransform||(r=n.getRegisterIndex(this._pAnimationNode,SZa.UV_INDEX),o=this._particleUVNode._iUvData,t.setVertexConst(r,o.x,o.y))},SZa.UV_INDEX=0,SZa),ParticleUVNode=(a$a=ParticleNodeBase,__extends(b$a,a$a),Object.defineProperty(b$a.prototype,"cycle",{get:function(){return this._cycle},set:function(t){this._cycle=t,this.updateUVData()},enumerable:!0,configurable:!0}),Object.defineProperty(b$a.prototype,"scale",{get:function(){return this._scale},set:function(t){this._scale=t,this.updateUVData()},enumerable:!0,configurable:!0}),Object.defineProperty(b$a.prototype,"axis",{get:function(){return this._axis},set:function(t){this._axis=t},enumerable:!0,configurable:!0}),b$a.prototype.getAGALUVCode=function(t,e,i,n){var r="",o=i.getFreeVertexConstant();n.setRegisterIndex(this,ParticleUVState.UV_INDEX,o.index);var s="x"==this._axis?0:"y"==this._axis?1:2,a=new ShaderRegisterElement(n.uvTarget.regName,n.uvTarget.index,s),l=i.getFreeVertexSingleTemp();return 1!=this._scale&&(r+="mul "+a+","+a+","+o+".y\n"),r+="mul "+l+","+n.vertexTime+","+o+".x\n",(r+="sin "+l+","+l+"\n")+"add "+a+","+a+","+l+"\n"},b$a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},b$a.prototype.updateUVData=function(){this._iUvData=new Vector3D(2*Math.PI/this._cycle,this._scale,0,0)},b$a.prototype._iProcessAnimationSetting=function(t){t.hasUVNode=!0},b$a.U_AXIS="x",b$a.V_AXIS="y",b$a),ParticleVelocityState=(v$a=ParticleStateBase,__extends(w$a,v$a),Object.defineProperty(w$a.prototype,"velocity",{get:function(){return this._velocity},set:function(t){this._velocity=t},enumerable:!0,configurable:!0}),w$a.prototype.getVelocities=function(){return this._pDynamicProperties},w$a.prototype.setVelocities=function(t){this._pDynamicProperties=t,this._pDynamicPropertiesDirty=new Object},w$a.prototype.setRenderState=function(t,e,i,n){this._particleVelocityNode.mode!=ParticlePropertiesMode.LOCAL_DYNAMIC||this._pDynamicPropertiesDirty[i._iUniqueId]||this._pUpdateDynamicProperties(i);var r=n.getRegisterIndex(this._pAnimationNode,w$a.VELOCITY_INDEX);this._particleVelocityNode.mode==ParticlePropertiesMode.GLOBAL?t.setVertexConst(r,this._velocity.x,this._velocity.y,this._velocity.z):i.activateVertexBuffer(r,this._particleVelocityNode._iDataOffset,t.stage,ContextGLVertexBufferFormat.FLOAT_3)},w$a.VELOCITY_INDEX=0,w$a),ParticleVelocityNode=(H$a=ParticleNodeBase,__extends(I$a,H$a),I$a.prototype.getAGALVertexCode=function(t,e,i,n){var r=this._pMode==ParticlePropertiesMode.GLOBAL?i.getFreeVertexConstant():i.getFreeVertexAttribute();n.setRegisterIndex(this,ParticleVelocityState.VELOCITY_INDEX,r.index);var o=i.getFreeVertexVectorTemp(),s="";return s+="mul "+o+","+n.vertexTime+","+r+"\n",s+="add "+n.positionTarget+".xyz,"+o+","+n.positionTarget+".xyz\n",e.needVelocity&&(s+="add "+n.velocityTarget+".xyz,"+r+".xyz,"+n.velocityTarget+".xyz\n"),s},I$a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},I$a.prototype._iGeneratePropertyOfOneParticle=function(t){var e=t[I$a.VELOCITY_VECTOR3D];if(!e)throw new Error("there is no "+I$a.VELOCITY_VECTOR3D+" in param!");this._pOneData[0]=e.x,this._pOneData[1]=e.y,this._pOneData[2]=e.z},I$a.VELOCITY_VECTOR3D="VelocityVector3D",I$a),SkeletonBinaryLERPState=(W$a=AnimationStateBase,__extends(X$a,W$a),Object.defineProperty(X$a.prototype,"blendWeight",{get:function(){return this._blendWeight},set:function(t){this._blendWeight=t,this._pPositionDeltaDirty=!0,this._skeletonPoseDirty=!0},enumerable:!0,configurable:!0}),X$a.prototype.phase=function(t){this._skeletonPoseDirty=!0,this._pPositionDeltaDirty=!0,this._inputA.phase(t),this._inputB.phase(t)},X$a.prototype._pUpdateTime=function(t){this._skeletonPoseDirty=!0,this._inputA.update(t),this._inputB.update(t),W$a.prototype._pUpdateTime.call(this,t)},X$a.prototype.getSkeletonPose=function(t){return this._skeletonPoseDirty&&this.updateSkeletonPose(t),this._skeletonPose},X$a.prototype._pUpdatePositionDelta=function(){this._pPositionDeltaDirty=!1;var t=this._inputA.positionDelta,e=this._inputB.positionDelta;this._pRootDelta.x=t.x+this._blendWeight*(e.x-t.x),this._pRootDelta.y=t.y+this._blendWeight*(e.y-t.y),this._pRootDelta.z=t.z+this._blendWeight*(e.z-t.z)},X$a.prototype.updateSkeletonPose=function(t){var e;this._skeletonPoseDirty=!1;var i,n,r,o,s,a=this._skeletonPose.jointPoses,l=this._inputA.getSkeletonPose(t).jointPoses,c=this._inputB.getSkeletonPose(t).jointPoses,h=t.numJoints;a.length!=h&&(a.length=h);for(var u=0;u<h;++u)null==(e=a[u])&&(e=a[u]=new JointPose),i=l[u],n=c[u],r=i.translation,o=n.translation,e.orientation.lerp(i.orientation,n.orientation,this._blendWeight),(s=e.translation).x=r.x+this._blendWeight*(o.x-r.x),s.y=r.y+this._blendWeight*(o.y-r.y),s.z=r.z+this._blendWeight*(o.z-r.z)},X$a),SkeletonBinaryLERPNode=(r_a=AnimationNodeBase,__extends(s_a,r_a),s_a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},s_a),AnimationStateEvent=(v_a=EventBase,__extends(w_a,v_a),Object.defineProperty(w_a.prototype,"animator",{get:function(){return this._animator},enumerable:!0,configurable:!0}),Object.defineProperty(w_a.prototype,"animationState",{get:function(){return this._animationState},enumerable:!0,configurable:!0}),Object.defineProperty(w_a.prototype,"animationNode",{get:function(){return this._animationNode},enumerable:!0,configurable:!0}),w_a.prototype.clone=function(){return new w_a(this.type,this._animator,this._animationState,this._animationNode)},w_a.PLAYBACK_COMPLETE="playbackComplete",w_a.TRANSITION_COMPLETE="transitionComplete",w_a),AnimationClipState=(C_a=AnimationStateBase,__extends(D_a,C_a),Object.defineProperty(D_a.prototype,"blendWeight",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._pBlendWeight},enumerable:!0,configurable:!0}),Object.defineProperty(D_a.prototype,"currentFrame",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._pCurrentFrame},enumerable:!0,configurable:!0}),Object.defineProperty(D_a.prototype,"nextFrame",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._pNextFrame},enumerable:!0,configurable:!0}),D_a.prototype.update=function(t){this._animationClipNode.looping||(t>this._pStartTime+this._animationClipNode.totalDuration?t=this._pStartTime+this._animationClipNode.totalDuration:t<this._pStartTime&&(t=this._pStartTime)),this._pTime!=t-this._pStartTime&&this._pUpdateTime(t)},D_a.prototype.phase=function(t){var e=t*this._animationClipNode.totalDuration+this._pStartTime;this._pTime!=e-this._pStartTime&&this._pUpdateTime(e)},D_a.prototype._pUpdateTime=function(t){this._pFramesDirty=!0,this._pTimeDir=t-this._pStartTime>this._pTime?1:-1,C_a.prototype._pUpdateTime.call(this,t)},D_a.prototype._pUpdateFrames=function(){this._pFramesDirty=!1;var t=this._animationClipNode.looping,e=this._animationClipNode.totalDuration,i=this._animationClipNode.lastFrame,n=this._pTime;if(t&&(e<=n||n<0)&&(n%=e)<0&&(n+=e),!t&&e<=n)this.notifyPlaybackComplete(),this._pCurrentFrame=i,this._pNextFrame=i,this._pBlendWeight=0;else if(!t&&n<=0)this._pCurrentFrame=0,this._pNextFrame=0,this._pBlendWeight=0;else if(this._animationClipNode.fixedFrameRate){var r=n/e*i;this._pCurrentFrame=Math.floor(r),this._pBlendWeight=r-this._pCurrentFrame,this._pNextFrame=this._pCurrentFrame+1}else{this._pCurrentFrame=0;for(var o,s=this._pNextFrame=0,a=this._animationClipNode.durations;o=s,s+=a[this._pNextFrame],this._pCurrentFrame=this._pNextFrame++,s<n;);this._pCurrentFrame==i&&(this._pCurrentFrame=0,this._pNextFrame=1),this._pBlendWeight=(n-o)/a[this._pCurrentFrame]}},D_a.prototype.notifyPlaybackComplete=function(){null==this._animationStatePlaybackComplete&&(this._animationStatePlaybackComplete=new AnimationStateEvent(AnimationStateEvent.PLAYBACK_COMPLETE,this._pAnimator,this,this._animationClipNode)),this._animationClipNode.dispatchEvent(this._animationStatePlaybackComplete)},D_a),SkeletonClipState=(T_a=AnimationClipState,__extends(U_a,T_a),Object.defineProperty(U_a.prototype,"currentPose",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._currentPose},enumerable:!0,configurable:!0}),Object.defineProperty(U_a.prototype,"nextPose",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._nextPose},enumerable:!0,configurable:!0}),U_a.prototype.getSkeletonPose=function(t){return this._skeletonPoseDirty&&this.updateSkeletonPose(t),this._skeletonPose},U_a.prototype._pUpdateTime=function(t){this._skeletonPoseDirty=!0,T_a.prototype._pUpdateTime.call(this,t)},U_a.prototype._pUpdateFrames=function(){T_a.prototype._pUpdateFrames.call(this),this._currentPose=this._frames[this._pCurrentFrame],this._skeletonClipNode.looping&&this._pNextFrame>=this._skeletonClipNode.lastFrame?(this._nextPose=this._frames[0],this._pAnimator.dispatchCycleEvent()):this._nextPose=this._frames[this._pNextFrame]},U_a.prototype.updateSkeletonPose=function(t){if(this._skeletonPoseDirty=!1,this._skeletonClipNode.totalDuration){this._pFramesDirty&&this._pUpdateFrames();var e,i,n,r,o,s,a=this._currentPose.jointPoses,l=this._nextPose.jointPoses,c=t.numJoints,h=this._skeletonPose.jointPoses;if(h.length!=c&&(h.length=c),c!=a.length||c!=l.length)throw new Error("joint counts don't match!");for(var u=0;u<c;++u)null==(o=h[u])&&(o=h[u]=new JointPose),n=a[u],r=l[u],e=n.translation,i=r.translation,this._skeletonClipNode.highQuality?o.orientation.slerp(n.orientation,r.orientation,this._pBlendWeight):o.orientation.lerp(n.orientation,r.orientation,this._pBlendWeight),0<u&&((s=o.translation).x=e.x+this._pBlendWeight*(i.x-e.x),s.y=e.y+this._pBlendWeight*(i.y-e.y),s.z=e.z+this._pBlendWeight*(i.z-e.z))}},U_a.prototype._pUpdatePositionDelta=function(){var t,e,i;this._pPositionDeltaDirty=!1,this._pFramesDirty&&this._pUpdateFrames();var n=this._skeletonClipNode.totalDelta;(0<this._pTimeDir&&this._pNextFrame<this._pOldFrame||this._pTimeDir<0&&this._pNextFrame>this._pOldFrame)&&(this._rootPos.x-=n.x*this._pTimeDir,this._rootPos.y-=n.y*this._pTimeDir,this._rootPos.z-=n.z*this._pTimeDir);var r=this._rootPos.x,o=this._rootPos.y,s=this._rootPos.z;this._skeletonClipNode.stitchFinalFrame&&this._pNextFrame==this._skeletonClipNode.lastFrame?(t=this._frames[0].jointPoses[0].translation,e=this._frames[1].jointPoses[0].translation,i=this._currentPose.jointPoses[0].translation,this._rootPos.x=i.x+t.x+this._pBlendWeight*(e.x-t.x),this._rootPos.y=i.y+t.y+this._pBlendWeight*(e.y-t.y),this._rootPos.z=i.z+t.z+this._pBlendWeight*(e.z-t.z)):(t=this._currentPose.jointPoses[0].translation,e=this._frames[this._pNextFrame].jointPoses[0].translation,this._rootPos.x=t.x+this._pBlendWeight*(e.x-t.x),this._rootPos.y=t.y+this._pBlendWeight*(e.y-t.y),this._rootPos.z=t.z+this._pBlendWeight*(e.z-t.z)),this._pRootDelta.x=this._rootPos.x-r,this._pRootDelta.y=this._rootPos.y-o,this._pRootDelta.z=this._rootPos.z-s,this._pOldFrame=this._pNextFrame},U_a),SkeletonClipNode=(r0a=AnimationClipNodeBase,__extends(s0a,r0a),Object.defineProperty(s0a.prototype,"frames",{get:function(){return this._frames},enumerable:!0,configurable:!0}),s0a.prototype.addFrame=function(t,e){this._frames.push(t),this._pDurations.push(e),this._pNumFrames=this._pDurations.length,this._pStitchDirty=!0},s0a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},s0a.prototype._pUpdateStitch=function(){r0a.prototype._pUpdateStitch.call(this);for(var t,e,i=this._pNumFrames-1;i--;)this._pTotalDuration+=this._pDurations[i],t=this._frames[i].jointPoses[0].translation,e=this._frames[i+1].jointPoses[0].translation.subtract(t),this._pTotalDelta.x+=e.x,this._pTotalDelta.y+=e.y,this._pTotalDelta.z+=e.z;!this._pStitchFinalFrame&&this._pLooping||(this._pTotalDuration+=this._pDurations[this._pNumFrames-1],t=this._frames[0].jointPoses[0].translation,e=this._frames[1].jointPoses[0].translation.subtract(t),this._pTotalDelta.x+=e.x,this._pTotalDelta.y+=e.y,this._pTotalDelta.z+=e.z)},s0a),SkeletonDifferenceState=(A0a=AnimationStateBase,__extends(B0a,A0a),Object.defineProperty(B0a.prototype,"blendWeight",{get:function(){return this._blendWeight},set:function(t){this._blendWeight=t,this._pPositionDeltaDirty=!0,this._skeletonPoseDirty=!0},enumerable:!0,configurable:!0}),B0a.prototype.phase=function(t){this._skeletonPoseDirty=!0,this._pPositionDeltaDirty=!0,this._baseInput.phase(t),this._baseInput.phase(t)},B0a.prototype._pUpdateTime=function(t){this._skeletonPoseDirty=!0,this._baseInput.update(t),this._differenceInput.update(t),A0a.prototype._pUpdateTime.call(this,t)},B0a.prototype.getSkeletonPose=function(t){return this._skeletonPoseDirty&&this.updateSkeletonPose(t),this._skeletonPose},B0a.prototype._pUpdatePositionDelta=function(){this._pPositionDeltaDirty=!1;var t=this._baseInput.positionDelta,e=this._differenceInput.positionDelta;this.positionDelta.x=t.x+this._blendWeight*e.x,this.positionDelta.y=t.y+this._blendWeight*e.y,this.positionDelta.z=t.z+this._blendWeight*e.z},B0a.prototype.updateSkeletonPose=function(t){var e;this._skeletonPoseDirty=!1;var i,n,r,o,s,a=this._skeletonPose.jointPoses,l=this._baseInput.getSkeletonPose(t).jointPoses,c=this._differenceInput.getSkeletonPose(t).jointPoses,h=t.numJoints;a.length!=h&&(a.length=h);for(var u=0;u<h;++u)null==(e=a[u])&&(e=a[u]=new JointPose),i=l[u],n=c[u],r=i.translation,o=n.translation,B0a._tempQuat.multiply(n.orientation,i.orientation),e.orientation.lerp(i.orientation,B0a._tempQuat,this._blendWeight),(s=e.translation).x=r.x+this._blendWeight*o.x,s.y=r.y+this._blendWeight*o.y,s.z=r.z+this._blendWeight*o.z},B0a._tempQuat=new Quaternion,B0a),SkeletonDifferenceNode=(X0a=AnimationNodeBase,__extends(Y0a,X0a),Y0a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},Y0a),SkeletonDirectionalState=(_0a=AnimationStateBase,__extends(a1a,_0a),Object.defineProperty(a1a.prototype,"direction",{get:function(){return this._direction},set:function(t){this._direction!=t&&(this._direction=t,this._blendDirty=!0,this._skeletonPoseDirty=!0,this._pPositionDeltaDirty=!0)},enumerable:!0,configurable:!0}),a1a.prototype.phase=function(t){this._blendDirty&&this.updateBlend(),this._skeletonPoseDirty=!0,this._pPositionDeltaDirty=!0,this._inputA.phase(t),this._inputB.phase(t)},a1a.prototype._pUdateTime=function(t){this._blendDirty&&this.updateBlend(),this._skeletonPoseDirty=!0,this._inputA.update(t),this._inputB.update(t),_0a.prototype._pUpdateTime.call(this,t)},a1a.prototype.getSkeletonPose=function(t){return this._skeletonPoseDirty&&this.updateSkeletonPose(t),this._skeletonPose},a1a.prototype._pUpdatePositionDelta=function(){this._pPositionDeltaDirty=!1,this._blendDirty&&this.updateBlend();var t=this._inputA.positionDelta,e=this._inputB.positionDelta;this.positionDelta.x=t.x+this._blendWeight*(e.x-t.x),this.positionDelta.y=t.y+this._blendWeight*(e.y-t.y),this.positionDelta.z=t.z+this._blendWeight*(e.z-t.z)},a1a.prototype.updateSkeletonPose=function(t){var e;this._skeletonPoseDirty=!1,this._blendDirty&&this.updateBlend();var i,n,r,o,s,a=this._skeletonPose.jointPoses,l=this._inputA.getSkeletonPose(t).jointPoses,c=this._inputB.getSkeletonPose(t).jointPoses,h=t.numJoints;a.length!=h&&(a.length=h);for(var u=0;u<h;++u)null==(e=a[u])&&(e=a[u]=new JointPose),i=l[u],n=c[u],r=i.translation,o=n.translation,e.orientation.lerp(i.orientation,n.orientation,this._blendWeight),(s=e.translation).x=r.x+this._blendWeight*(o.x-r.x),s.y=r.y+this._blendWeight*(o.y-r.y),s.z=r.z+this._blendWeight*(o.z-r.z)},a1a.prototype.updateBlend=function(){this._blendDirty=!1,(this._direction<0||360<this._direction)&&(this._direction%=360,this._direction<0&&(this._direction+=360)),this._direction<90?(this._inputA=this._forward,this._inputB=this._right,this._blendWeight=this._direction/90):this._direction<180?(this._inputA=this._right,this._inputB=this._backward,this._blendWeight=(this._direction-90)/90):this._direction<270?(this._inputA=this._backward,this._inputB=this._left,this._blendWeight=(this._direction-180)/90):(this._inputA=this._left,this._inputB=this._forward,this._blendWeight=(this._direction-270)/90)},a1a),SkeletonDirectionalNode=(w1a=AnimationNodeBase,__extends(x1a,w1a),x1a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},x1a),SkeletonNaryLERPState=(A1a=AnimationStateBase,__extends(B1a,A1a),B1a.prototype.phase=function(t){this._skeletonPoseDirty=!0,this._pPositionDeltaDirty=!0;for(var e=0;e<this._skeletonAnimationNode.numInputs;++e)this._blendWeights[e]&&this._inputs[e].update(t)},B1a.prototype._pUdateTime=function(t){for(var e=0;e<this._skeletonAnimationNode.numInputs;++e)this._blendWeights[e]&&this._inputs[e].update(t);A1a.prototype._pUpdateTime.call(this,t)},B1a.prototype.getSkeletonPose=function(t){return this._skeletonPoseDirty&&this.updateSkeletonPose(t),this._skeletonPose},B1a.prototype.getBlendWeightAt=function(t){return this._blendWeights[t]},B1a.prototype.setBlendWeightAt=function(t,e){this._blendWeights[t]=e,this._pPositionDeltaDirty=!0,this._skeletonPoseDirty=!0},B1a.prototype._pUpdatePositionDelta=function(){var t,e;this._pPositionDeltaDirty=!1,this.positionDelta.x=0,this.positionDelta.y=0;for(var i=this.positionDelta.z=0;i<this._skeletonAnimationNode.numInputs;++i)(e=this._blendWeights[i])&&(t=this._inputs[i].positionDelta,this.positionDelta.x+=e*t.x,this.positionDelta.y+=e*t.y,this.positionDelta.z+=e*t.z)},B1a.prototype.updateSkeletonPose=function(t){var e;this._skeletonPoseDirty=!1;var i,n,r,o,s,a,l,c,h,u,p,d,_,f,m,g,y,b=this._skeletonPose.jointPoses,v=t.numJoints;b.length!=v&&(b.length=v);for(var x=0;x<this._skeletonAnimationNode.numInputs;++x)if(e=this._blendWeights[x])if(i=this._inputs[x].getSkeletonPose(t).jointPoses,c)for(h=0;h<t.numJoints;++h)n=b[h],r=i[h],p=(l=c[h].orientation).x,d=l.y,_=l.z,u=l.w,l=r.orientation,s=r.translation,p*(m=l.x)+d*(g=l.y)+_*(y=l.z)+u*(f=l.w)<0&&(m=-m,g=-g,y=-y,f=-f),(a=n.orientation).x+=e*m,a.y+=e*g,a.z+=e*y,a.w+=e*f,(o=n.translation).x+=e*s.x,o.y+=e*s.y,o.z+=e*s.z;else for(c=i,h=0;h<v;++h)null==(n=b[h])&&(n=b[h]=new JointPose),l=(r=i[h]).orientation,s=r.translation,(a=n.orientation).x=e*l.x,a.y=e*l.y,a.z=e*l.z,a.w=e*l.w,(o=n.translation).x=e*s.x,o.y=e*s.y,o.z=e*s.z;for(h=0;h<t.numJoints;++h)b[h].orientation.normalize()},B1a),SkeletonNaryLERPNode=(l2a=AnimationNodeBase,__extends(m2a,l2a),Object.defineProperty(m2a.prototype,"numInputs",{get:function(){return this._numInputs},enumerable:!0,configurable:!0}),m2a.prototype.getInputIndex=function(t){return this._iInputs.indexOf(t)},m2a.prototype.getInputAt=function(t){return this._iInputs[t]},m2a.prototype.addInput=function(t){this._iInputs[this._numInputs++]=t},m2a.prototype.getAnimationState=function(t){return t.getAnimationState(this)},m2a),VertexClipState=(s2a=AnimationClipState,__extends(t2a,s2a),Object.defineProperty(t2a.prototype,"currentElements",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._currentGraphics},enumerable:!0,configurable:!0}),Object.defineProperty(t2a.prototype,"nextElements",{get:function(){return this._pFramesDirty&&this._pUpdateFrames(),this._nextGraphics},enumerable:!0,configurable:!0}),t2a.prototype._pUpdateFrames=function(){s2a.prototype._pUpdateFrames.call(this),this._currentGraphics=this._frames[this._pCurrentFrame],this._vertexClipNode.looping&&this._pNextFrame>=this._vertexClipNode.lastFrame?(this._nextGraphics=this._frames[0],this._pAnimator.dispatchCycleEvent()):this._nextGraphics=this._frames[this._pNextFrame]},t2a.prototype._pUpdatePositionDelta=function(){},t2a),VertexClipNode=(x2a=AnimationClipNodeBase,__extends(y2a,x2a),Object.defineProperty(y2a.prototype,"frames",{get:function(){return this._frames},enumerable:!0,configurable:!0}),y2a.prototype.addFrame=function(t,e,i){void 0===i&&(i=null),this._frames.push(t),this._pDurations.push(e),this._translations.push(i||new Vector3D),this._pNumFrames=this._pDurations.length,this._pStitchDirty=!0},y2a.prototype._pUpdateStitch=function(){x2a.prototype._pUpdateStitch.call(this);for(var t,e,i=this._pNumFrames-1;i--;)this._pTotalDuration+=this._pDurations[i],t=this._translations[i],e=this._translations[i+1].subtract(t),this._pTotalDelta.x+=e.x,this._pTotalDelta.y+=e.y,this._pTotalDelta.z+=e.z;1<this._pNumFrames&&(this._pStitchFinalFrame||!this._pLooping)&&(this._pTotalDuration+=this._pDurations[this._pNumFrames-1],t=this._translations[0],e=this._translations[1].subtract(t),this._pTotalDelta.x+=e.x,this._pTotalDelta.y+=e.y,this._pTotalDelta.z+=e.z)},y2a),CrossfadeTransitionState=(G2a=SkeletonBinaryLERPState,__extends(H2a,G2a),H2a.prototype._pUpdateTime=function(t){this.blendWeight=Math.abs(t-this._crossfadeTransitionNode.startBlend)/(1e3*this._crossfadeTransitionNode.blendSpeed),1<=this.blendWeight&&(this.blendWeight=1,null==this._animationStateTransitionComplete&&(this._animationStateTransitionComplete=new AnimationStateEvent(AnimationStateEvent.TRANSITION_COMPLETE,this._pAnimator,this,this._crossfadeTransitionNode)),this._crossfadeTransitionNode.dispatchEvent(this._animationStateTransitionComplete)),G2a.prototype._pUpdateTime.call(this,t)},H2a),CrossfadeTransitionNode=(M2a=SkeletonBinaryLERPNode,__extends(N2a,M2a),N2a),AnimatorEvent=(P2a=EventBase,__extends(Q2a,P2a),Object.defineProperty(Q2a.prototype,"animator",{get:function(){return this._animator},enumerable:!0,configurable:!0}),Q2a.prototype.clone=function(){return new Q2a(this.type,this._animator)},Q2a.START="animatorStart",Q2a.STOP="animatorStop",Q2a.CYCLE_COMPLETE="animatorCycleComplete",Q2a),AnimatorBase=(U2a=AssetBase,__extends(V2a,U2a),V2a.prototype.getAnimationState=function(t){var e=t.stateClass,i=t.id;return null==this._animationStates[i]&&(this._animationStates[i]=new e(this,t)),this._animationStates[i]},V2a.prototype.getAnimationStateByName=function(t){return this.getAnimationState(this._pAnimationSet.getAnimation(t))},Object.defineProperty(V2a.prototype,"absoluteTime",{get:function(){return this._pAbsoluteTime},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"animationSet",{get:function(){return this._pAnimationSet},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"activeState",{get:function(){return this._pActiveState},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"activeAnimation",{get:function(){return this._pAnimationSet.getAnimation(this._pActiveAnimationName)},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"activeAnimationName",{get:function(){return this._pActiveAnimationName},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){this._autoUpdate!=t&&(this._autoUpdate=t,this._autoUpdate?this.start():this.stop())},enumerable:!0,configurable:!0}),Object.defineProperty(V2a.prototype,"time",{get:function(){return this._time},set:function(t){this._time!=t&&this.update(t)},enumerable:!0,configurable:!0}),V2a.prototype.phase=function(t){this._pActiveState.phase(t)},Object.defineProperty(V2a.prototype,"playbackSpeed",{get:function(){return this._playbackSpeed},set:function(t){this._playbackSpeed=t},enumerable:!0,configurable:!0}),V2a.prototype.setRenderState=function(t,e){throw new AbstractMethodError},V2a.prototype.start=function(){!this._isPlaying&&this._autoUpdate&&(this._time=this._pAbsoluteTime=getTimer(),this._isPlaying=!0,this._broadcaster.start(),this.hasEventListener(AnimatorEvent.START)&&(null==this._startEvent&&(this._startEvent=new AnimatorEvent(AnimatorEvent.START,this)),this.dispatchEvent(this._startEvent)))},V2a.prototype.stop=function(){this._isPlaying&&(this._isPlaying=!1,this._broadcaster.stop(),this.hasEventListener(AnimatorEvent.STOP)&&(null==this._stopEvent&&(this._stopEvent=new AnimatorEvent(AnimatorEvent.STOP,this)),this.dispatchEvent(this._stopEvent)))},V2a.prototype.update=function(t){var e=(t-this._time)*this.playbackSpeed;this._pUpdateDeltaTime(e),this._time=t},V2a.prototype.reset=function(t,e){void 0===e&&(e=0),this.getAnimationState(this._pAnimationSet.getAnimation(t)).offset(e+this._pAbsoluteTime)},V2a.prototype.addOwner=function(t){this._pOwners.push(t)},V2a.prototype.removeOwner=function(t){this._pOwners.splice(this._pOwners.indexOf(t),1)},V2a.prototype._pUpdateDeltaTime=function(t){this._pAbsoluteTime+=t,this._pActiveState.update(this._pAbsoluteTime),this.updatePosition&&this.applyPositionDelta()},V2a.prototype.onEnterFrame=function(t){this.update(getTimer())},V2a.prototype.applyPositionDelta=function(){var t,e=this._pActiveState.positionDelta,i=e.length;if(0<i){t=this._pOwners.length;for(var n=0;n<t;++n)this._pOwners[n].transform.translateLocal(e,i)}},V2a.prototype.dispatchCycleEvent=function(){this.hasEventListener(AnimatorEvent.CYCLE_COMPLETE)&&(null==this._cycleEvent&&(this._cycleEvent=new AnimatorEvent(AnimatorEvent.CYCLE_COMPLETE,this)),this.dispatchEvent(this._cycleEvent))},V2a.prototype.clone=function(){throw new AbstractMethodError},V2a.prototype.dispose=function(){},V2a.prototype.invalidateElements=function(){for(var t=this._pOwners.length,e=0;e<t;e++)this._pOwners[e].invalidateElements()},V2a.prototype.testGPUCompatibility=function(t){throw new AbstractMethodError},Object.defineProperty(V2a.prototype,"assetType",{get:function(){return V2a.assetType},enumerable:!0,configurable:!0}),V2a.prototype.getRenderableElements=function(t,e){return e},V2a.assetType="[asset Animator]",V2a),ParticleAnimator=(x3a=AnimatorBase,__extends(y3a,x3a),y3a.prototype.clone=function(){return new y3a(this._particleAnimationSet)},y3a.prototype.setRenderState=function(t,e){for(var i=this._particleAnimationSet._iAnimationRegisterData,n=e.shape.particleCollection,r=e.shape.elements,o=this._particleAnimationSet.getAnimationElements(n,r),s=0;s<this._animationParticleStates.length;s++)this._animationParticleStates[s].setRenderState(t,e,o,i);var a=this.getAnimatorElements(n,r);for(s=0;s<this._animatorParticleStates.length;s++)this._animatorParticleStates[s].setRenderState(t,e,a,i)},y3a.prototype.testGPUCompatibility=function(t){},y3a.prototype.start=function(){x3a.prototype.start.call(this);for(var t=0;t<this._timeParticleStates.length;t++)this._timeParticleStates[t].offset(this._pAbsoluteTime)},y3a.prototype._pUpdateDeltaTime=function(t){this._pAbsoluteTime+=t;for(var e=0;e<this._timeParticleStates.length;e++)this._timeParticleStates[e].update(this._pAbsoluteTime)},y3a.prototype.resetTime=function(t){void 0===t&&(t=0);for(var e=0;e<this._timeParticleStates.length;e++)this._timeParticleStates[e].offset(this._pAbsoluteTime+t);this.update(this.time)},y3a.prototype.dispose=function(){for(var t in this._animatorSubGeometries)this._animatorSubGeometries[t].dispose()},y3a.prototype.getAnimatorElements=function(t,e){var i;this._animatorParticleStates.length&&((i=this._animatorSubGeometries[e.id]=new AnimationElements).createVertexData(e.numVertices,this._totalLenOfOneVertex),i.animationParticles=this._particleAnimationSet.getAnimationElements(t,e).animationParticles)},y3a),SkeletonAnimationSet=(W3a=AnimationSetBase,__extends(X3a,W3a),Object.defineProperty(X3a.prototype,"jointsPerVertex",{get:function(){return this._jointsPerVertex},enumerable:!0,configurable:!0}),Object.defineProperty(X3a.prototype,"matricesIndex",{get:function(){return this._matricesIndex},enumerable:!0,configurable:!0}),X3a.prototype.getAGALVertexCode=function(t,e,i){this._matricesIndex=e.numUsedVertexConstants;var n=this._matricesIndex,r=this._matricesIndex+1,o=this._matricesIndex+2,s=e.getFreeVertexAttribute();t.jointIndexIndex=s.index;var a=e.getFreeVertexAttribute();t.jointWeightIndex=a.index;for(var l=[s+".x",s+".y",s+".z",s+".w"],c=[a+".x",a+".y",a+".z",a+".w"],h=e.getFreeVertexVectorTemp(),u="dp4",p="",d=i.animatableAttributes.length,_=0;_<d;++_){for(var f=i.animatableAttributes[_],m=i.animationTargetRegisters[_],g=0;g<this._jointsPerVertex;++g)e.getFreeVertexConstant(),e.getFreeVertexConstant(),e.getFreeVertexConstant(),p+=u+" "+h+".x, "+f+", vc["+l[g]+"+"+n+"]\n"+u+" "+h+".y, "+f+", vc["+l[g]+"+"+r+"]\n"+u+" "+h+".z, "+f+", vc["+l[g]+"+"+o+"]\nmov "+h+".w, "+f+".w\nmul "+h+", "+h+", "+c[g]+"\n",p+=0==g?"mov "+m+", "+h+"\n":"add "+m+", "+m+", "+h+"\n";u="dp3"}return p},X3a.prototype.getAGALFragmentCode=function(t,e,i){return""},X3a.prototype.getAGALUVCode=function(t,e,i){return"mov "+i.animatedUV+","+i.uvInput+"\n"},X3a.prototype.doneAGALCode=function(t){},X3a),SkeletonAnimator=(x4a=AnimatorBase,__extends(y4a,x4a),Object.defineProperty(y4a.prototype,"globalMatrices",{get:function(){return this._globalPropertiesDirty&&this.updateGlobalProperties(),this._globalMatrices},enumerable:!0,configurable:!0}),Object.defineProperty(y4a.prototype,"globalPose",{get:function(){return this._globalPropertiesDirty&&this.updateGlobalProperties(),this._globalPose},enumerable:!0,configurable:!0}),Object.defineProperty(y4a.prototype,"skeleton",{get:function(){return this._skeleton},enumerable:!0,configurable:!0}),Object.defineProperty(y4a.prototype,"forceCPU",{get:function(){return this._forceCPU},enumerable:!0,configurable:!0}),Object.defineProperty(y4a.prototype,"useCondensedIndices",{get:function(){return this._useCondensedIndices},set:function(t){this._useCondensedIndices=t},enumerable:!0,configurable:!0}),y4a.prototype.clone=function(){return new y4a(this._skeletonAnimationSet,this._skeleton,this._forceCPU)},y4a.prototype.play=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=NaN),this._pActiveAnimationName!=t){if(this._pActiveAnimationName=t,!this._pAnimationSet.hasAnimation(t))throw new Error("Animation root node "+t+" not found!");e&&this._pActiveNode?(this._pActiveNode=e.getAnimationNode(this,this._pActiveNode,this._pAnimationSet.getAnimation(t),this._pAbsoluteTime),this._pActiveNode.addEventListener(AnimationStateEvent.TRANSITION_COMPLETE,this._onTransitionCompleteDelegate)):this._pActiveNode=this._pAnimationSet.getAnimation(t),this._pActiveState=this.getAnimationState(this._pActiveNode),this.updatePosition&&(this._pActiveState.update(this._pAbsoluteTime),this._pActiveState.positionDelta),this._activeSkeletonState=this._pActiveState,this.start(),isNaN(i)||this.reset(t,i)}},y4a.prototype.setRenderState=function(t,e){this._globalPropertiesDirty&&this.updateGlobalProperties();var i=e.shape.elements;if(i.useCondensedIndices=this._useCondensedIndices,this._useCondensedIndices)this.updateCondensedMatrices(i.condensedIndexLookUp),t.setVertexConstFromArray(this._skeletonAnimationSet.matricesIndex,this._condensedMatrices);else{if(this._pAnimationSet.usesCPU)return void(this._morphedElementsDirty[i.id]&&this.morphElements(e,i));t.setVertexConstFromArray(this._skeletonAnimationSet.matricesIndex,this._globalMatrices)}},y4a.prototype.testGPUCompatibility=function(t){!this._useCondensedIndices&&(this._forceCPU||4<this._jointsPerVertex||128<t.numUsedVertexConstants+3*this._numJoints)&&this._pAnimationSet.cancelGPUCompatibility()},y4a.prototype._pUpdateDeltaTime=function(t){x4a.prototype._pUpdateDeltaTime.call(this,t),this._globalPropertiesDirty=!0,this._pAnimationSet.usesCPU&&this.invalidateElements()},y4a.prototype.updateCondensedMatrices=function(t){var e,i=0,n=0,r=t.length;this._condensedMatrices=new Float32Array(12*r);for(var o=0;o<r;o++)for(e=12*t[o],n=12;n--;)this._condensedMatrices[i++]=this._globalMatrices[e++]},y4a.prototype.updateGlobalProperties=function(){this._globalPropertiesDirty=!1,this.localToGlobalPose(this._activeSkeletonState.getSkeletonPose(this._skeleton),this._globalPose,this._skeleton);for(var t,e,i,n,r,o,s,a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A,S,w,C,P,E,T,M,D,I,O,L,F,B,N=0,R=this._globalPose.jointPoses,V=this._skeleton.joints,k=0;k<this._numJoints;++k)L=(O=R[k]).orientation,F=O.translation,o=(B=2*(e=L.x))*(i=L.y),s=B*(n=L.z),a=B*(r=L.w),l=(B=2*i)*n,c=2*i*r,h=2*n*r,u=(B=(e*=e)-(i*=i))-(n*=n)+(r*=r),p=o-h,d=s+c,_=o+h,f=-B-n+r,m=l-a,g=s-c,y=l+a,b=-e-i+n+r,v=(t=V[k].inverseBindPose)[0],x=t[4],A=t[8],S=t[12],w=t[1],C=t[5],P=t[9],E=t[13],T=t[2],M=t[6],D=t[10],I=t[14],this._globalMatrices[N]=u*v+p*w+d*T,this._globalMatrices[N+1]=u*x+p*C+d*M,this._globalMatrices[N+2]=u*A+p*P+d*D,this._globalMatrices[N+3]=u*S+p*E+d*I+F.x,this._globalMatrices[N+4]=_*v+f*w+m*T,this._globalMatrices[N+5]=_*x+f*C+m*M,this._globalMatrices[N+6]=_*A+f*P+m*D,this._globalMatrices[N+7]=_*S+f*E+m*I+F.y,this._globalMatrices[N+8]=g*v+y*w+b*T,this._globalMatrices[N+9]=g*x+y*C+b*M,this._globalMatrices[N+10]=g*A+y*P+b*D,this._globalMatrices[N+11]=g*S+y*E+b*I+F.z,N+=12},y4a.prototype.getRenderableElements=function(t,e){return this._morphedElementsDirty[e.id]=!0,this._pAnimationSet.usesCPU?((i=this._morphedElements[e.id])||(e.normals,e.tangents,(i=this._morphedElements[e.id]=e.clone()).autoDeriveNormals=!1,i.autoDeriveTangents=!1,e.addEventListener(ElementsEvent.INVALIDATE_INDICES,this._onIndicesUpdateDelegate),e.addEventListener(ElementsEvent.INVALIDATE_VERTICES,this._onVerticesUpdateDelegate)),i):e;var i},y4a.prototype.morphElements=function(t,e){this._morphedElementsDirty[e.id]=!1;var i=e.numVertices,n=e.positions.get(i),r=e.normals.get(i),o=e.tangents.get(i),s=e.positions.dimensions,a=e.positions.stride,l=e.normals.stride,c=e.tangents.stride,h=e.jointIndices.get(i),u=e.jointWeights.get(i),p=e.jointIndices.stride,d=this._morphedElements[e.id],_=d.positions.get(i),f=d.normals.get(i),m=d.tangents.get(i);d.positions.attributesBuffer.invalidate(),d.normals.attributesBuffer.invalidate(),d.tangents.attributesBuffer.invalidate();for(var g,y,b,v,x,A,S,w,C,P,E,T,M,D,I,O,L,F,B,N,R,V,k,U,j,G,z,$,X,W,H=0,q=0,J=0,Q=0,K=0;H<i;){for(T=n[q=H*a],M=n[q+1],D=3==s?n[q+2]:0,I=r[J=H*l],O=r[J+1],L=r[J+2],F=o[Q=H*c],B=o[Q+1],N=o[Q+2],g=P=C=w=S=A=x=v=b=y=0,K=H*p;g<this._jointsPerVertex;)0<(E=u[K+g])?(W=h[K+g]<<2,y+=E*((R=this._globalMatrices[W])*T+(V=this._globalMatrices[1+W])*M+(k=this._globalMatrices[2+W])*D+this._globalMatrices[3+W]),b+=E*((U=this._globalMatrices[4+W])*T+(j=this._globalMatrices[5+W])*M+(G=this._globalMatrices[6+W])*D+this._globalMatrices[7+W]),v+=E*((z=this._globalMatrices[8+W])*T+($=this._globalMatrices[9+W])*M+(X=this._globalMatrices[10+W])*D+this._globalMatrices[11+W]),x+=E*(R*I+V*O+k*L),A+=E*(U*I+j*O+G*L),S+=E*(z*I+$*O+X*L),w+=E*(R*F+V*B+k*N),C+=E*(U*F+j*B+G*N),P+=E*(z*F+$*B+X*N),g++):g=this._jointsPerVertex;_[q]=y,_[q+1]=b,3==s&&(_[q+2]=v),f[J]=x,f[J+1]=A,f[J+2]=S,m[Q]=w,m[Q+1]=C,m[Q+2]=P,H++}},y4a.prototype.localToGlobalPose=function(t,e,i){var n,r,o,s,a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A=e.jointPoses,S=i.joints,w=t.numJointPoses,C=t.jointPoses;A.length!=w&&(A.length=w);for(var P=0;P<w;++P)null==(n=A[P])&&(n=A[P]=new JointPose),r=S[P].parentIndex,s=C[P],h=n.orientation,c=n.translation,r<0?(l=s.translation,a=s.orientation,h.x=a.x,h.y=a.y,h.z=a.z,h.w=a.w,c.x=l.x,c.y=l.y,c.z=l.z):(a=(o=A[r]).orientation,l=s.translation,f=a.x,m=a.y,g=a.z,y=a.w,_=-f*(b=l.x)-m*(v=l.y)-g*(x=l.z),u=y*b+m*x-g*v,p=y*v-f*x+g*b,d=y*x+f*v-m*b,l=o.translation,c.x=-_*f+u*y-p*g+d*m+l.x,c.y=-_*m+u*g+p*y-d*f+l.y,c.z=-_*g-u*m+p*f+d*y+l.z,u=a.x,p=a.y,d=a.z,_=a.w,f=(a=s.orientation).x,m=a.y,g=a.z,y=a.w,h.w=_*y-u*f-p*m-d*g,h.x=_*f+u*y+p*g-d*m,h.y=_*m-u*g+p*y+d*f,h.z=_*g+u*m-p*f+d*y)},y4a.prototype.onTransitionComplete=function(t){t.type==AnimationStateEvent.TRANSITION_COMPLETE&&(t.animationNode.removeEventListener(AnimationStateEvent.TRANSITION_COMPLETE,this._onTransitionCompleteDelegate),this._pActiveState==t.animationState&&(this._pActiveNode=this._pAnimationSet.getAnimation(this._pActiveAnimationName),this._pActiveState=this.getAnimationState(this._pActiveNode),this._activeSkeletonState=this._pActiveState))},y4a.prototype.onIndicesUpdate=function(t){var e=t.target;this._morphedElements[e.id].setIndices(e.indices)},y4a.prototype.onVerticesUpdate=function(t){var e=t.target;if(t.attributesView==e.uvs||t.attributesView==e.getCustomAtributes("secondaryUVs")){var i=this._morphedElements[e.id],n=i.uvs.get(e.numVertices);i.invalidateVertices(i.uvs);for(var r=i.uvs.stride,o=t.attributesView.get(e.numVertices),s=e.numVertices*r,a=0;a<s;a+=r)n[a]=o[a],n[a+1]=o[a+1]}},y4a),VertexAnimationSet=(u7a=AnimationSetBase,__extends(v7a,u7a),Object.defineProperty(v7a.prototype,"numPoses",{get:function(){return this._numPoses},enumerable:!0,configurable:!0}),Object.defineProperty(v7a.prototype,"blendMode",{get:function(){return this._blendMode},enumerable:!0,configurable:!0}),v7a.prototype.getAGALVertexCode=function(t,e,i){return this._iAnimationRegisterData=t.animationRegisterData,null==this._iAnimationRegisterData&&(this._iAnimationRegisterData=t.animationRegisterData=new AnimationRegisterData),this._blendMode==VertexAnimationMode.ABSOLUTE?this.getAbsoluteAGALCode(t,e,i):this.getAdditiveAGALCode(t,e,i)},v7a.prototype.getAGALFragmentCode=function(t,e,i){return""},v7a.prototype.getAGALUVCode=function(t,e,i){return"mov "+i.animatedUV+","+i.uvInput+"\n"},v7a.prototype.doneAGALCode=function(t){},v7a.prototype.getAbsoluteAGALCode=function(t,e,i){var n="",r=e.getFreeVertexVectorTemp();e.addVertexTempUsages(r,1);var o,s=e.getFreeVertexVectorTemp(),a=new Array(".x",".y",".z",".w"),l=i.animatableAttributes.length,c=e.getFreeVertexConstant();this._iAnimationRegisterData.weightsIndex=c.index,this._iAnimationRegisterData.poseIndices=new Array(this._numPoses);var h=0;2<l&&(l=2);for(var u=0;u<l;++u){n+="mul "+r+", "+i.animatableAttributes[u]+", "+c+a[0]+"\n";for(var p=1;p<this._numPoses;++p)o=e.getFreeVertexAttribute(),this._iAnimationRegisterData.poseIndices[h++]=o.index,n+="mul "+s+", "+o+", "+c+a[p]+"\n",p<this._numPoses-1&&(n+="add "+r+", "+r+", "+s+"\n");n+="add "+i.animationTargetRegisters[u]+", "+r+", "+s+"\n"}return(0<t.tangentDependencies||t.outputsNormals)&&(n+="dp3 "+r+".x, "+i.animatableAttributes[2]+", "+i.animationTargetRegisters[1]+"\nmul "+r+", "+i.animationTargetRegisters[1]+", "+r+".x\nsub "+i.animationTargetRegisters[2]+", "+i.animationTargetRegisters[2]+", "+r+"\n"),n},v7a.prototype.getAdditiveAGALCode=function(t,e,i){var n,r="",o=i.animatableAttributes.length,s=[".x",".y",".z",".w"],a=e.getFreeVertexVectorTemp(),l=e.getFreeVertexConstant();this._iAnimationRegisterData.weightsIndex=l.index,this._iAnimationRegisterData.poseIndices=new Array(this._numPoses);var c=0;2<o&&(o=2),r+="mov "+i.animationTargetRegisters[0]+", "+i.animatableAttributes[0]+"\n",0<t.normalDependencies&&(r+="mov "+i.animationTargetRegisters[1]+", "+i.animatableAttributes[1]+"\n");for(var h=0;h<o;++h)for(var u=0;u<this._numPoses;++u)n=e.getFreeVertexAttribute(),this._iAnimationRegisterData.poseIndices[c++]=n.index,r+="mul "+a+", "+n+", "+l+s[u]+"\nadd "+i.animationTargetRegisters[h]+", "+i.animationTargetRegisters[h]+", "+a+"\n";return(0<t.tangentDependencies||t.outputsNormals)&&(r+="dp3 "+a+".x, "+i.animatableAttributes[2]+", "+i.animationTargetRegisters[1]+"\nmul "+a+", "+i.animationTargetRegisters[1]+", "+a+".x\nsub "+i.animationTargetRegisters[2]+", "+i.animatableAttributes[2]+", "+a+"\n"),r},v7a),VertexAnimator=(g8a=AnimatorBase,__extends(h8a,g8a),h8a.prototype.clone=function(){return new h8a(this._vertexAnimationSet)},h8a.prototype.play=function(t,e,i){if(void 0===i&&(i=NaN),this._pActiveAnimationName!=t){if(this._pActiveAnimationName=t,!this._pAnimationSet.hasAnimation(t))throw new Error("Animation root node "+t+" not found!");this._pActiveNode=this._pAnimationSet.getAnimation(t),this._pActiveState=this.getAnimationState(this._pActiveNode),this.updatePosition&&(this._pActiveState.update(this._pAbsoluteTime),this._pActiveState.positionDelta),this._activeVertexState=this._pActiveState,this.start(),isNaN(i)||this.reset(t,i)}},h8a.prototype._pUpdateDeltaTime=function(t){g8a.prototype._pUpdateDeltaTime.call(this,t);var e=!1;this._poses[0]!=this._activeVertexState.currentElements&&(this._poses[0]=this._activeVertexState.currentElements,e=!0),this._poses[1]!=this._activeVertexState.nextElements&&(this._poses[1]=this._activeVertexState.nextElements),this._weights[0]=1-(this._weights[1]=this._activeVertexState.blendWeight),e&&this.invalidateElements()},h8a.prototype.setRenderState=function(t,e){var i=e.shape,n=e.stageElements.elements;if(this._poses.length){var r,o,s=t.animationRegisterData,a=this._vertexAnimationSet.numPoses;t.setVertexConstFromArray(s.weightsIndex,this._weights),r=this._vertexAnimationSet.blendMode==VertexAnimationMode.ABSOLUTE?1:0;for(var l=0;r<a;++r)n=this._poses[r]||i.elements,(o=t.stage.getAbstraction(n))._indexMappings=t.stage.getAbstraction(i.elements).getIndexMappings(),o.activateVertexBufferVO(s.poseIndices[l++],n.positions),0<t.normalDependencies&&o.activateVertexBufferVO(s.poseIndices[l++],n.normals)}else this.setNullPose(t,n)},h8a.prototype.setNullPose=function(t,e){var i=t.animationRegisterData;t.setVertexConstFromArray(i.weightsIndex,this._weights);var n=t.stage.getAbstraction(e),r=0;if(this._vertexAnimationSet.blendMode==VertexAnimationMode.ABSOLUTE)for(var o=this._vertexAnimationSet.numPoses,s=1;s<o;++s)n.activateVertexBufferVO(i.poseIndices[r++],e.positions),0<t.normalDependencies&&n.activateVertexBufferVO(i.poseIndices[r++],e.normals)},h8a.prototype.testGPUCompatibility=function(t){},h8a.prototype.getRenderableElements=function(t,e){return this._vertexAnimationSet.blendMode==VertexAnimationMode.ABSOLUTE&&this._poses.length&&this._poses[0]||e},h8a),g8a,u7a,x4a,W3a,x3a,U2a,P2a,M2a,G2a,x2a,s2a,l2a,A1a,w1a,_0a,X0a,A0a,r0a,T_a,C_a,v_a,r_a,W$a,H$a,v$a,a$a,RZa,iZa,XYa,xYa,iYa,QXa,CXa,fXa,UWa,tWa,iWa,MVa,DVa,qVa,eVa,MUa,BUa,_Ta,NTa,vTa,kTa,SSa,NRa,jRa,jQa,RPa,OPa,wPa,mPa,$Oa,LOa,xOa,aOa,PNa,zNa,eNa,VMa,wMa,kMa;function h8a(t){var e=g8a.call(this,t)||this;return e._poses=new Array,e._weights=new Float32Array([1,0,0,0]),e._vertexAnimationSet=t,e}function v7a(t,e){void 0===t&&(t=2),void 0===e&&(e="absolute");var i=u7a.call(this)||this;return i._numPoses=t,i._blendMode=e,i}function y4a(t,e,i){void 0===i&&(i=!1);var n=x4a.call(this,t)||this;n._globalPose=new SkeletonPose,n._morphedElements=new Object,n._morphedElementsDirty=new Object,n._skeletonAnimationSet=t,n._skeleton=e,n._forceCPU=i,n._jointsPerVertex=t.jointsPerVertex,n._numJoints=n._skeleton.numJoints,n._globalMatrices=new Float32Array(12*n._numJoints);for(var r=0,o=0;o<n._numJoints;++o)n._globalMatrices[r++]=1,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=1,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=0,n._globalMatrices[r++]=1,n._globalMatrices[r++]=0;return n._onTransitionCompleteDelegate=function(t){return n.onTransitionComplete(t)},n._onIndicesUpdateDelegate=function(t){return n.onIndicesUpdate(t)},n._onVerticesUpdateDelegate=function(t){return n.onVerticesUpdate(t)},n}function X3a(t){void 0===t&&(t=4);var e=W3a.call(this)||this;return e._jointsPerVertex=t,e}function y3a(t){var e,i,n=x3a.call(this,t)||this;n._animationParticleStates=new Array,n._animatorParticleStates=new Array,n._timeParticleStates=new Array,n._totalLenOfOneVertex=0,n._animatorSubGeometries=new Object,n._particleAnimationSet=t;for(var r=0;r<n._particleAnimationSet.particleNodes.length;r++)i=n._particleAnimationSet.particleNodes[r],e=n.getAnimationState(i),i.mode==ParticlePropertiesMode.LOCAL_DYNAMIC?(n._animatorParticleStates.push(e),i._iDataOffset=n._totalLenOfOneVertex,n._totalLenOfOneVertex+=i.dataLength):n._animationParticleStates.push(e),e.needUpdateTime&&n._timeParticleStates.push(e);return n}function V2a(t){var e=U2a.call(this)||this;return e._autoUpdate=!0,e._time=0,e._playbackSpeed=1,e._pOwners=new Array,e._pAbsoluteTime=0,e._animationStates=new Object,e.updatePosition=!0,e._pAnimationSet=t,e._broadcaster=new RequestAnimationFrame(e.onEnterFrame,e),e}function Q2a(t,e){var i=P2a.call(this,t)||this;return i._animator=e,i}function N2a(){var t=M2a.call(this)||this;return t._pStateClass=CrossfadeTransitionState,t}function H2a(t,e){var i=G2a.call(this,t,e)||this;return i._crossfadeTransitionNode=e,i}function y2a(){var t=x2a.call(this)||this;return t._frames=new Array,t._translations=new Array,t._pStateClass=VertexClipState,t}function t2a(t,e){var i=s2a.call(this,t,e)||this;return i._vertexClipNode=e,i._frames=i._vertexClipNode.frames,i}function m2a(){var t=l2a.call(this)||this;return t._iInputs=new Array,t._pStateClass=SkeletonNaryLERPState,t}function B1a(t,e){var i=A1a.call(this,t,e)||this;i._skeletonPose=new SkeletonPose,i._skeletonPoseDirty=!0,i._blendWeights=new Array,i._inputs=new Array,i._skeletonAnimationNode=e;for(var n=i._skeletonAnimationNode.numInputs;n--;)i._inputs[n]=t.getAnimationState(i._skeletonAnimationNode._iInputs[n]);return i}function x1a(){var t=w1a.call(this)||this;return t._pStateClass=SkeletonDirectionalState,t}function a1a(t,e){var i=_0a.call(this,t,e)||this;return i._skeletonPose=new SkeletonPose,i._skeletonPoseDirty=!0,i._blendWeight=0,i._direction=0,i._blendDirty=!0,i._skeletonAnimationNode=e,i._forward=t.getAnimationState(i._skeletonAnimationNode.forward),i._backward=t.getAnimationState(i._skeletonAnimationNode.backward),i._left=t.getAnimationState(i._skeletonAnimationNode.left),i._right=t.getAnimationState(i._skeletonAnimationNode.right),i}function Y0a(){var t=X0a.call(this)||this;return t._pStateClass=SkeletonDifferenceState,t}function B0a(t,e){var i=A0a.call(this,t,e)||this;return i._blendWeight=0,i._skeletonPose=new SkeletonPose,i._skeletonPoseDirty=!0,i._skeletonAnimationNode=e,i._baseInput=t.getAnimationState(i._skeletonAnimationNode.baseInput),i._differenceInput=t.getAnimationState(i._skeletonAnimationNode.differenceInput),i}function s0a(){var t=r0a.call(this)||this;return t._frames=new Array,t.highQuality=!1,t._pStateClass=SkeletonClipState,t}function U_a(t,e){var i=T_a.call(this,t,e)||this;return i._rootPos=new Vector3D,i._skeletonPose=new SkeletonPose,i._skeletonPoseDirty=!0,i._skeletonClipNode=e,i._frames=i._skeletonClipNode.frames,i}function D_a(t,e){var i=C_a.call(this,t,e)||this;return i._pFramesDirty=!0,i._animationClipNode=e,i}function w_a(t,e,i,n){var r=v_a.call(this,t)||this;return r._animator=e,r._animationState=i,r._animationNode=n,r}function s_a(){var t=r_a.call(this)||this;return t._pStateClass=SkeletonBinaryLERPState,t}function X$a(t,e){var i=W$a.call(this,t,e)||this;return i._blendWeight=0,i._skeletonPose=new SkeletonPose,i._skeletonPoseDirty=!0,i._skeletonAnimationNode=e,i._inputA=t.getAnimationState(i._skeletonAnimationNode.inputA),i._inputB=t.getAnimationState(i._skeletonAnimationNode.inputB),i}function I$a(t,e){void 0===e&&(e=null);var i=H$a.call(this,"ParticleVelocity",t,3)||this;return i._pStateClass=ParticleVelocityState,i._iVelocity=e||new Vector3D,i}function w$a(t,e){var i=v$a.call(this,t,e)||this;return i._particleVelocityNode=e,i._velocity=i._particleVelocityNode._iVelocity,i}function b$a(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n="x");var r=a$a.call(this,"ParticleUV",ParticlePropertiesMode.GLOBAL,4,ParticleAnimationSet.POST_PRIORITY+1)||this;return r._pStateClass=ParticleUVState,r._cycle=e,r._scale=i,r._axis=n,r.updateUVData(),r}function SZa(t,e){var i=RZa.call(this,t,e)||this;return i._particleUVNode=e,i}function jZa(t,e,i,n,r,o,s,a){void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=1),void 0===s&&(s=0),void 0===a&&(a=Number.MAX_VALUE);var l=iZa.call(this,"ParticleSpriteSheet",t,e?i?3:2:1,ParticleAnimationSet.POST_PRIORITY+1)||this;return l._pStateClass=ParticleSpriteSheetState,l._iUsesCycle=e,l._iUsesPhase=i,l._iNumColumns=n,l._iNumRows=r,l._iCyclePhase=s,l._iCycleDuration=o,l._iTotalFrames=Math.min(a,n*r),l}function YYa(t,e){var i=XYa.call(this,t,e)||this;return i._particleSpriteSheetNode=e,i._usesCycle=i._particleSpriteSheetNode._iUsesCycle,i._usesPhase=i._particleSpriteSheetNode._iUsesCycle,i._totalFrames=i._particleSpriteSheetNode._iTotalFrames,i._numColumns=i._particleSpriteSheetNode._iNumColumns,i._numRows=i._particleSpriteSheetNode._iNumRows,i._cycleDuration=i._particleSpriteSheetNode._iCycleDuration,i._cyclePhase=i._particleSpriteSheetNode._iCyclePhase,i.updateSpriteSheetData(),i}function yYa(t,e,i,n,r,o){var s=xYa.call(this,"ParticleSegmentedColor",ParticlePropertiesMode.GLOBAL,0,ParticleAnimationSet.COLOR_PRIORITY)||this;if(s._pStateClass=ParticleSegmentedColorState,4<i)throw new Error("the numSegmentPoint must be less or equal 4");return s._iUsesMultiplier=t,s._iUsesOffset=e,s._iNumSegmentPoint=i,s._iStartColor=n,s._iEndColor=r,s._iSegmentPoints=o,s}function jYa(t,e){var i=iYa.call(this,t,e)||this;return i._usesMultiplier=e._iUsesMultiplier,i._usesOffset=e._iUsesOffset,i._startColor=e._iStartColor,i._endColor=e._iEndColor,i._segmentPoints=e._iSegmentPoints,i._numSegmentPoint=e._iNumSegmentPoint,i.updateColorData(),i}function RXa(t,e,i,n,r,o,s){void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=1),void 0===s&&(s=0);var a=QXa.call(this,"ParticleScale",t,e&&i?4:e||i?3:2,3)||this;return a._pStateClass=ParticleScaleState,a._iUsesCycle=e,a._iUsesPhase=i,a._iMinScale=n,a._iMaxScale=r,a._iCycleDuration=o,a._iCyclePhase=s,a}function DXa(t,e){var i=CXa.call(this,t,e)||this;return i._particleScaleNode=e,i._usesCycle=i._particleScaleNode._iUsesCycle,i._usesPhase=i._particleScaleNode._iUsesPhase,i._minScale=i._particleScaleNode._iMinScale,i._maxScale=i._particleScaleNode._iMaxScale,i._cycleDuration=i._particleScaleNode._iCycleDuration,i._cyclePhase=i._particleScaleNode._iCyclePhase,i.updateScaleData(),i}function gXa(t,e){void 0===e&&(e=null);var i=fXa.call(this,"ParticleRotationalVelocity",t,4)||this;return i._pStateClass=ParticleRotationalVelocityState,i._iRotationalVelocity=e||new Vector3D,i}function VWa(t,e){var i=UWa.call(this,t,e)||this;return i._particleRotationalVelocityNode=e,i._rotationalVelocity=i._particleRotationalVelocityNode._iRotationalVelocity,i.updateRotationalVelocityData(),i}function uWa(t,e){void 0===e&&(e=null);var i=tWa.call(this,"ParticleRotateToPosition",t,3,3)||this;return i._pStateClass=ParticleRotateToPositionState,i._iPosition=e||new Vector3D,i}function jWa(t,e){var i=iWa.call(this,t,e)||this;return i._matrix=new Matrix3D,i._particleRotateToPositionNode=e,i._position=i._particleRotateToPositionNode._iPosition,i}function NVa(){var t=MVa.call(this,"ParticleRotateToHeading",ParticlePropertiesMode.GLOBAL,0,3)||this;return t._pStateClass=ParticleRotateToHeadingState,t}function EVa(t,e){var i=DVa.call(this,t,e)||this;return i._matrix=new Matrix3D,i}function rVa(t,e){void 0===e&&(e=null);var i=qVa.call(this,"ParticlePosition",t,3)||this;return i._pStateClass=ParticlePositionState,i._iPosition=e||new Vector3D,i}function fVa(t,e){var i=eVa.call(this,t,e)||this;return i._particlePositionNode=e,i._position=i._particlePositionNode._iPosition,i}function NUa(t,e){void 0===e&&(e=null);var i=MUa.call(this,"ParticleOscillator",t,4)||this;return i._pStateClass=ParticleOscillatorState,i._iOscillator=e||new Vector3D,i}function CUa(t,e){var i=BUa.call(this,t,e)||this;return i._particleOscillatorNode=e,i._oscillator=i._particleOscillatorNode._iOscillator,i.updateOscillatorData(),i}function aUa(t,e,i,n,r,o,s,a){void 0===e&&(e=!0),void 0===i&&(i=!1),void 0===n&&(n=!1),void 0===r&&(r=100),void 0===o&&(o=1),void 0===s&&(s=0),void 0===a&&(a=null);var l=this,c=3;return n&&c++,(l=_Ta.call(this,"ParticleOrbit",t,c)||this)._pStateClass=ParticleOrbitState,l._iUsesEulers=e,l._iUsesCycle=i,l._iUsesPhase=n,l._iRadius=r,l._iCycleDuration=o,l._iCyclePhase=s,l._iEulers=a||new Vector3D,l}function OTa(t,e){var i=NTa.call(this,t,e)||this;return i._particleOrbitNode=e,i._usesEulers=i._particleOrbitNode._iUsesEulers,i._usesCycle=i._particleOrbitNode._iUsesCycle,i._usesPhase=i._particleOrbitNode._iUsesPhase,i._eulers=i._particleOrbitNode._iEulers,i._radius=i._particleOrbitNode._iRadius,i._cycleDuration=i._particleOrbitNode._iCycleDuration,i._cyclePhase=i._particleOrbitNode._iCyclePhase,i.updateOrbitData(),i}function wTa(t,e,i,n){void 0===e&&(e=!0),void 0===i&&(i=!1),void 0===n&&(n=null);var r=vTa.call(this,"ParticleInitialColor",t,e&&i?8:4,ParticleAnimationSet.COLOR_PRIORITY)||this;return r._pStateClass=ParticleInitialColorState,r._iUsesMultiplier=e,r._iUsesOffset=i,r._iInitialColor=n||new ColorTransform,r}function lTa(t,e){var i=kTa.call(this,t,e)||this;return i._particleInitialColorNode=e,i._usesMultiplier=e._iUsesMultiplier,i._usesOffset=e._iUsesOffset,i._initialColor=e._iInitialColor,i.updateColorData(),i}function TSa(t,e,i){void 0===t&&(t=!0),void 0===e&&(e=!0),void 0===i&&(i=!1);var n=SSa.call(this,"ParticleFollow",ParticlePropertiesMode.LOCAL_DYNAMIC,t&&e?6:3,ParticleAnimationSet.POST_PRIORITY)||this;return n._pStateClass=ParticleFollowState,n._iUsesPosition=t,n._iUsesRotation=e,n._iSmooth=i,n}function ORa(t,e){var i=NRa.call(this,t,e,!0)||this;return i._targetPos=new Vector3D,i._targetEuler=new Vector3D,i._temp=new Vector3D,i._particleFollowNode=e,i._smooth=e._iSmooth,i}function kRa(t,e,i,n,r,o,s,a,l){void 0===e&&(e=!0),void 0===i&&(i=!0),void 0===n&&(n=!1),void 0===r&&(r=!1),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=1),void 0===l&&(l=0);var c=jRa.call(this,"ParticleColor",t,e&&i?16:8,ParticleAnimationSet.COLOR_PRIORITY)||this;return c._pStateClass=ParticleColorState,c._iUsesMultiplier=e,c._iUsesOffset=i,c._iUsesCycle=n,c._iUsesPhase=r,c._iStartColor=o||new ColorTransform,c._iEndColor=s||new ColorTransform,c._iCycleDuration=a,c._iCyclePhase=l,c}function kQa(t,e,i){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1);var n=jQa.call(this)||this;return n._animationElements=new Object,n._particleNodes=new Array,n._localDynamicNodes=new Array,n._localStaticNodes=new Array,n._totalLenOfOneVertex=0,n.addAnimation(n._timeNode=new ParticleTimeNode(t,e,i)),n}function SPa(){var t=RPa.call(this)||this;return t._animations=new Array,t._animationNames=new Array,t._animationDictionary=new Object,t}function PPa(t){return OPa.call(this,t)||this}function xPa(t,e,i){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1);var n=wPa.call(this,"ParticleTime",ParticlePropertiesMode.LOCAL_STATIC,4,0)||this;return n._pStateClass=ParticleTimeState,n._iUsesDuration=t,n._iUsesLooping=e,n._iUsesDelay=i,n}function nPa(t,e){var i=mPa.call(this,t,e,!0)||this;return i._particleTimeNode=e,i}function _Oa(t,e){var i=$Oa.call(this,t,e)||this;return i._particleColorNode=e,i._usesMultiplier=i._particleColorNode._iUsesMultiplier,i._usesOffset=i._particleColorNode._iUsesOffset,i._usesCycle=i._particleColorNode._iUsesCycle,i._usesPhase=i._particleColorNode._iUsesPhase,i._startColor=i._particleColorNode._iStartColor,i._endColor=i._particleColorNode._iEndColor,i._cycleDuration=i._particleColorNode._iCycleDuration,i._cyclePhase=i._particleColorNode._iCyclePhase,i.updateColorData(),i}function MOa(t){void 0===t&&(t=null);var e=LOa.call(this,"ParticleBillboard",ParticlePropertiesMode.GLOBAL,0,4)||this;return e._pStateClass=ParticleBillboardState,e._iBillboardAxis=t,e}function yOa(t,e){var i=xOa.call(this,t,e)||this;return i._matrix=new Matrix3D,i._billboardAxis=e._iBillboardAxis,i}function bOa(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null);var n=aOa.call(this,"ParticleBezierCurve",t,6)||this;return n._pStateClass=ParticleBezierCurveState,n._iControlPoint=e||new Vector3D,n._iEndPoint=i||new Vector3D,n}function QNa(t,e){var i=PNa.call(this,t,e)||this;return i._particleBezierCurveNode=e,i._controlPoint=i._particleBezierCurveNode._iControlPoint,i._endPoint=i._particleBezierCurveNode._iEndPoint,i}function ANa(t,e){void 0===e&&(e=null);var i=zNa.call(this,"ParticleAcceleration",t,3)||this;return i._pStateClass=ParticleAccelerationState,i._acceleration=e||new Vector3D,i}function fNa(t,e,i,n){void 0===n&&(n=1);var r=eNa.call(this)||this;return r._pDataLength=3,t+=fNa.MODES[e],r.name=t,r._pMode=e,r._priority=n,r._pDataLength=i,r._pOneData=new Array(r._pDataLength),r}function WMa(t,e){var i=VMa.call(this,t,e)||this;return i._particleAccelerationNode=e,i._acceleration=i._particleAccelerationNode._acceleration,i.updateAccelerationData(),i}function xMa(t,e,i){void 0===i&&(i=!1);var n=wMa.call(this,t,e)||this;return n._pDynamicProperties=new Array,n._pDynamicPropertiesDirty=new Object,n._pParticleAnimator=t,n._particleNode=e,n._pNeedUpdateTime=i,n}function pMa(t,e){this._pRootDelta=new Vector3D,this._pPositionDeltaDirty=!0,this._pStartTime=0,this._pAnimator=t,this._pAnimationNode=e}function lMa(){var t=kMa.call(this)||this;return t._pLooping=!0,t._pTotalDuration=0,t._pStitchDirty=!0,t._pStitchFinalFrame=!1,t._pNumFrames=0,t._pDurations=new Array,t._pTotalDelta=new Vector3D,t.fixedFrameRate=!0,t}function assert(t,e){if(void 0===e&&(e="assertion failed"),""===t&&(t=!0),!t)throw"undefined"!=typeof console&&"assert"in console&&console.assert(!1,e),new Error(e)}function memCopy(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),0<n||0<r&&r<e.length?(r<=0&&(r=e.length-n),t.set(e.subarray(n,n+r),i)):t.set(e,i)}var Bounds=(P8a.FromUntyped=function(t){return new P8a(t.xMin,t.yMin,t.xMax,t.yMax)},P8a.FromRectangle=function(t){return new P8a(20*t.x|0,20*t.y|0,20*(t.x+t.width)|0,20*(t.y+t.height)|0)},P8a.prototype.setElements=function(t,e,i,n){this.xMin=t,this.yMin=e,this.xMax=i,this.yMax=n},P8a.prototype.copyFrom=function(t){this.setElements(t.xMin,t.yMin,t.xMax,t.yMax)},P8a.prototype.contains=function(t,e){return t<this.xMin!=t<this.xMax&&e<this.yMin!=e<this.yMax},P8a.prototype.unionInPlace=function(t){t.isEmpty()||(this.extendByPoint(t.xMin,t.yMin),this.extendByPoint(t.xMax,t.yMax))},P8a.prototype.extendByPoint=function(t,e){this.extendByX(t),this.extendByY(e)},P8a.prototype.extendByX=function(t){134217728!==this.xMin?(this.xMin=Math.min(this.xMin,t),this.xMax=Math.max(this.xMax,t)):this.xMin=this.xMax=t},P8a.prototype.extendByY=function(t){134217728!==this.yMin?(this.yMin=Math.min(this.yMin,t),this.yMax=Math.max(this.yMax,t)):this.yMin=this.yMax=t},P8a.prototype.intersects=function(t){return this.contains(t.xMin,t.yMin)||this.contains(t.xMax,t.yMax)},P8a.prototype.isEmpty=function(){return this.xMax<=this.xMin||this.yMax<=this.yMin},Object.defineProperty(P8a.prototype,"width",{get:function(){return this.xMax-this.xMin},set:function(t){this.xMax=this.xMin+t},enumerable:!0,configurable:!0}),Object.defineProperty(P8a.prototype,"height",{get:function(){return this.yMax-this.yMin},set:function(t){this.yMax=this.yMin+t},enumerable:!0,configurable:!0}),P8a.prototype.getBaseWidth=function(t){var e=Math.abs(Math.cos(t)),i=Math.abs(Math.sin(t));return e*(this.xMax-this.xMin)+i*(this.yMax-this.yMin)},P8a.prototype.getBaseHeight=function(t){var e=Math.abs(Math.cos(t));return Math.abs(Math.sin(t))*(this.xMax-this.xMin)+e*(this.yMax-this.yMin)},P8a.prototype.setEmpty=function(){this.xMin=this.yMin=this.xMax=this.yMax=0},P8a.prototype.setToSentinels=function(){this.xMin=this.yMin=this.xMax=this.yMax=134217728},P8a.prototype.clone=function(){return new P8a(this.xMin,this.yMin,this.xMax,this.yMax)},P8a.prototype.toString=function(){return"{ xMin: "+this.xMin+", xMin: "+this.yMin+", xMax: "+this.xMax+", xMax: "+this.yMax+" }"},P8a),ImageType,L9a;function P8a(t,e,i,n){this.xMin=0|t,this.yMin=0|e,this.xMax=0|i,this.yMax=0|n}function clamp(t,e,i){return Math.max(e,Math.min(i,t))}function roundToMultipleOfFour(t){return t+3&-4}function isNullOrUndefined(t){return null==t}function utf8decode(t){for(var e=new Uint8Array(4*t.length),i=0,n=0,r=t.length;n<r;n++){var o,s=t.charCodeAt(n);s<=127?e[i++]=s:(55296<=s&&s<=56319&&(56320<=(o=t.charCodeAt(n+1))&&o<=57343&&(s=((1023&s)<<10)+(1023&o)+65536,++n)),0!=(4292870144&s)?(e[i++]=248|s>>>24&3,e[i++]=128|s>>>18&63,e[i++]=128|s>>>12&63,e[i++]=128|s>>>6&63):0!=(4294901760&s)?(e[i++]=240|s>>>18&7,e[i++]=128|s>>>12&63,e[i++]=128|s>>>6&63):0!=(4294965248&s)?(e[i++]=224|s>>>12&15,e[i++]=128|s>>>6&63):e[i++]=192|s>>>6&31,e[i++]=128|63&s)}return e.subarray(0,i)}function utf8encode(t){for(var e=0,i="";e<t.length;){var n=255&t[e++];if(n<=127)i+=String.fromCharCode(n);else{var r=192,o=5;do{if((n&(r>>1|128))===r)break;r=r>>1|128,--o}while(0<=o);if(o<=0){i+=String.fromCharCode(n);continue}for(var s=n&(1<<o)-1,a=!1,l=5;o<=l;--l){var c=t[e++];if(128!=(192&c)){a=!0;break}s=s<<6|63&c}if(a){for(var h=e-(7-l);h<e;++h)i+=String.fromCharCode(255&t[h]);continue}i+=65536<=s?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}}return i}L9a=ImageType=ImageType||{},L9a[L9a.None=0]="None",L9a[L9a.PremultipliedAlphaARGB=1]="PremultipliedAlphaARGB",L9a[L9a.StraightAlphaARGB=2]="StraightAlphaARGB",L9a[L9a.StraightAlphaRGBA=3]="StraightAlphaRGBA",L9a[L9a.JPEG=4]="JPEG",L9a[L9a.PNG=5]="PNG",L9a[L9a.GIF=6]="GIF";var ArrayBufferPool=(M9a.prototype.acquire=function(t){if(M9a._enabled)for(var e=this._list,i=0;i<e.length;i++){var n=e[i];if(n.byteLength>=t)return e.splice(i,1),n}return new ArrayBuffer(t)},M9a.prototype.release=function(t){var e;M9a._enabled&&((e=this._list).length===this._maxSize&&e.shift(),e.push(t))},M9a.prototype.ensureUint8ArrayLength=function(t,e){if(t.length>=e)return t;var i=Math.max(t.length+e,1+(3*t.length>>1)),n=new Uint8Array(this.acquire(i),0,i);return n.set(t),this.release(t.buffer),n},M9a.prototype.ensureFloat64ArrayLength=function(t,e){if(t.length>=e)return t;var i=Math.max(t.length+e,1+(3*t.length>>1)),n=new Float64Array(this.acquire(i*Float64Array.BYTES_PER_ELEMENT),0,i);return n.set(t),this.release(t.buffer),n},M9a._enabled=!0,M9a),IntegerUtilities,dab,eab;function M9a(t){void 0===t&&(t=32),this._list=[],this._maxSize=t}function ensureTypedArrayCapacity(t,e){var i;return t.length<e&&(t=new(i=t).constructor(IntegerUtilities.nearestPowerOfTwo(e))).set(i,0),t}function fab(t){return 256*t<<16>>16}function gab(t){return t/256}dab=IntegerUtilities=IntegerUtilities||{},eab=new ArrayBuffer(8),dab.i8=new Int8Array(eab),dab.u8=new Uint8Array(eab),dab.i32=new Int32Array(eab),dab.f32=new Float32Array(eab),dab.f64=new Float64Array(eab),dab.nativeLittleEndian=1===new Int8Array(new Int32Array([1]).buffer)[0],dab.floatToInt32=function(t){return dab.f32[0]=t,dab.i32[0]},dab.int32ToFloat=function(t){return dab.i32[0]=t,dab.f32[0]},dab.swap16=function(t){return(255&t)<<8|t>>8&255},dab.swap32=function(t){return(255&t)<<24|(65280&t)<<8|t>>8&65280|t>>24&255},dab.toS8U8=fab,dab.fromS8U8=gab,dab.clampS8U8=function(t){return fab(t)/256},dab.toS16=function(t){return t<<16>>16},dab.bitCount=function(t){return 16843009*((t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135)>>24},dab.ones=function(t){return 16843009*((t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135)>>24},dab.trailingZeros=function(t){return dab.ones((t&-t)-1)},dab.getFlags=function(t,e){var i="";for(t=0;t<e.length;t++)t&1<<t&&(i+=e[t]+" ");return 0===i.length?"":i.trim()},dab.isPowerOfTwo=function(t){return t&&0==(t&t-1)},dab.roundToMultipleOfFour=function(t){return t+3&-4},dab.nearestPowerOfTwo=function(t){return t--,t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,t|=t>>16,++t},dab.roundToMultipleOfPowerOfTwo=function(t,e){var i=(1<<e)-1;return t+i&~i},dab.toHEX=function(t){return"0x"+("00000000"+(t=t<0?4294967295+t+1:t).toString(16)).substr(-8)};var ABCBlock=function(){},SymbolExport=function(t,e){this.symbolId=t,this.className=e},UnparsedTag=function(t,e,i){this.tagCode=t,this.byteOffset=e,this.byteLength=i},DictionaryEntry=(Hab=UnparsedTag,__extends(Iab,Hab),Iab),EagerlyParsedDictionaryEntry=(Oab=DictionaryEntry,__extends(Pab,Oab),Pab),Oab,Hab;function Pab(t,e,i,n){var r=Oab.call(this,t,e.tagCode,e.byteOffset,e.byteLength)||this;return r.type=i,r.definition=n,r.ready=!1,r}function Iab(t,e,i,n){var r=Hab.call(this,e,i,n)||this;return r.id=t,r}function axCoerceString(t){return"string"==typeof t?t:null==t?null:t+""}var Errors={NotImplementedError:{code:1001,message:"The method %1 is not implemented."},InvalidPrecisionError:{code:1002,message:"Number.toPrecision has a range of 1 to 21. Number.toFixed and Number.toExponential have a range of 0 to 20. Specified value is not within expected range."},InvalidRadixError:{code:1003,message:"The radix argument must be between 2 and 36; got %1."},InvokeOnIncompatibleObjectError:{code:1004,message:"Method %1 was invoked on an incompatible object."},ArrayIndexNotIntegerError:{code:1005,message:"Array index is not a positive integer (%1)."},CallOfNonFunctionError:{code:1006,message:"%1 is not a function."},ConstructOfNonFunctionError:{code:1007,message:"Instantiation attempted on a non-constructor."},ConvertNullToObjectError:{code:1009,message:"Cannot access a property or method of a null object reference."},ConvertUndefinedToObjectError:{code:1010,message:"A term is undefined and has no properties."},ClassNotFoundError:{code:1014,message:"Class %1 could not be found."},DescendentsError:{code:1016,message:"Descendants operator (..) not supported on type %1."},StackOverflowError:{code:1023,message:"Stack overflow occurred."},CpoolIndexRangeError:{code:1032,message:"Cpool index %1 is out of range %2."},CpoolEntryWrongTypeError:{code:1033,message:"Cpool entry %1 is wrong type."},CheckTypeFailedError:{code:1034,message:"Type Coercion failed: cannot convert %1 to %2."},CannotAssignToMethodError:{code:1037,message:"Cannot assign to a method %1 on %2."},CantUseInstanceofOnNonObjectError:{code:1040,message:"The right-hand side of instanceof must be a class or function."},IsTypeMustBeClassError:{code:1041,message:"The right-hand side of operator must be a class."},InvalidMagicError:{code:1042,message:"Not an ABC file. major_version=%1 minor_version=%2."},UnsupportedTraitsKindError:{code:1045,message:"Unsupported traits kind=%1."},PrototypeTypeError:{code:1049,message:"Prototype objects must be vanilla Objects."},ConvertToPrimitiveError:{code:1050,message:"Cannot convert %1 to primitive."},InvalidURIError:{code:1052,message:"Invalid URI passed to %1 function."},WriteSealedError:{code:1056,message:"Cannot create property %1 on %2."},WrongArgumentCountError:{code:1063,message:"Argument count mismatch on %1. Expected %2, got %3."},UndefinedVarError:{code:1065,message:"Variable %1 is not defined."},ReadSealedError:{code:1069,message:"Property %1 not found on %2 and there is no default value."},ConstWriteError:{code:1074,message:"Illegal write to read-only property %1 on %2."},XMLPrefixNotBound:{code:1083,message:'The prefix "%1" for element "%2" is not bound.'},XMLUnterminatedElementTag:{code:1085,message:'The element type "%1" must be terminated by the matching end-tag "</%2>".'},XMLOnlyWorksWithOneItemLists:{code:1086,message:"The %1 method only works on lists containing one item."},XMLAssignmentToIndexedXMLNotAllowed:{code:1087,message:"Assignment to indexed XML is not allowed."},XMLMarkupMustBeWellFormed:{code:1088,message:"The markup in the document following the root element must be well-formed."},XMLAssigmentOneItemLists:{code:1089,message:"Assignment to lists with more than one item is not supported."},XMLMalformedElement:{code:1090,message:"XML parser failure: element is malformed."},XMLUnterminatedCData:{code:1091,message:"XML parser failure: Unterminated CDATA section."},XMLUnterminatedXMLDecl:{code:1092,message:"XML parser failure: Unterminated XML declaration."},XMLUnterminatedDocTypeDecl:{code:1093,message:"XML parser failure: Unterminated DOCTYPE declaration."},XMLUnterminatedComment:{code:1094,message:"XML parser failure: Unterminated comment."},XMLUnterminatedElement:{code:1096,message:"XML parser failure: Unterminated element."},XMLNamespaceWithPrefixAndNoURI:{code:1098,message:"Illegal prefix %1 for no namespace."},RegExpFlagsArgumentError:{code:1100,message:"Cannot supply flags when constructing one RegExp from another."},InvalidBaseClassError:{code:1108,message:"The OP_newclass opcode was used with the incorrect base class."},XMLInvalidName:{code:1117,message:"Invalid XML name: %1."},XMLIllegalCyclicalLoop:{code:1118,message:"Illegal cyclical loop between nodes."},FilterError:{code:1123,message:"Filter operator not supported on type %1."},OutOfRangeError:{code:1125,message:"The index %1 is out of range %2."},VectorFixedError:{code:1126,message:"Cannot change the length of a fixed Vector."},TypeAppOfNonParamType:{code:1127,message:"Type application attempted on a non-parameterized type."},WrongTypeArgCountError:{code:1128,message:"Incorrect number of type parameters for %1. Expected %2, got %3."},JSONCyclicStructure:{code:1129,message:"Cyclic structure cannot be converted to JSON string."},JSONInvalidReplacer:{code:1131,message:"Replacer argument to JSON stringifier must be an array or a two parameter function."},JSONInvalidParseInput:{code:1132,message:"Invalid JSON parse input."},InvalidRangeError:{code:1506,message:"The specified range is invalid."},NullArgumentError:{code:1507,message:"Argument %1 cannot be null."},InvalidArgumentError:{code:1508,message:"The value specified for argument %1 is invalid."},ArrayFilterNonNullObjectError:{code:1510,message:"When the callback argument is a method of a class, the optional this argument must be null."},InvalidParamError:{code:2004,message:"One of the parameters is invalid."},ParamRangeError:{code:2006,message:"The supplied index is out of bounds."},NullPointerError:{code:2007,message:"Parameter %1 must be non-null."},InvalidEnumError:{code:2008,message:"Parameter %1 must be one of the accepted values."},CantInstantiateError:{code:2012,message:"%1 class cannot be instantiated."},InvalidBitmapData:{code:2015,message:"Invalid BitmapData."},EOFError:{code:2030,message:"End of file was encountered.",fqn:"flash.errors.EOFError"},CompressedDataError:{code:2058,message:"There was an error decompressing the data.",fqn:"flash.errors.IOError"},EmptyStringError:{code:2085,message:"Parameter %1 must be non-empty string."},ProxyGetPropertyError:{code:2088,message:"The Proxy class does not implement getProperty. It must be overridden by a subclass."},ProxySetPropertyError:{code:2089,message:"The Proxy class does not implement setProperty. It must be overridden by a subclass."},ProxyCallPropertyError:{code:2090,message:"The Proxy class does not implement callProperty. It must be overridden by a subclass."},ProxyHasPropertyError:{code:2091,message:"The Proxy class does not implement hasProperty. It must be overridden by a subclass."},ProxyDeletePropertyError:{code:2092,message:"The Proxy class does not implement deleteProperty. It must be overridden by a subclass."},ProxyGetDescendantsError:{code:2093,message:"The Proxy class does not implement getDescendants. It must be overridden by a subclass."},ProxyNextNameIndexError:{code:2105,message:"The Proxy class does not implement nextNameIndex. It must be overridden by a subclass."},ProxyNextNameError:{code:2106,message:"The Proxy class does not implement nextName. It must be overridden by a subclass."},ProxyNextValueError:{code:2107,message:"The Proxy class does not implement nextValue. It must be overridden by a subclass."},TooFewArgumentsError:{code:2001,message:"Too few arguments were specified; got %1, %2 expected."},ParamTypeError:{code:2005,message:"Parameter %1 is of the incorrect type. Should be type %2."},SocketConnectError:{code:2011,message:"Socket connection failed to %1:%2."},CantAddSelfError:{code:2024,message:"An object cannot be added as a child of itself."},NotAChildError:{code:2025,message:"The supplied DisplayObject must be a child of the caller."},UnhandledError:{code:2044,message:"Unhandled %1:."},AllowDomainArgumentError:{code:2052,message:"Only String arguments are permitted for allowDomain and allowInsecureDomain."},DelayRangeError:{code:2066,message:"The Timer delay specified is out of range."},ExternalInterfaceNotAvailableError:{code:2067,message:"The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime."},InvalidLoaderMethodError:{code:2069,message:"The Loader class does not implement this method."},InvalidStageMethodError:{code:2071,message:"The Stage class does not implement this property or method."},TimelineObjectNameSealedError:{code:2078,message:"The name property of a Timeline-placed object cannot be modified."},AlreadyConnectedError:{code:2082,message:"Connect failed because the object is already connected."},CloseNotConnectedError:{code:2083,message:"Close failed because the object is not connected."},ArgumentSizeError:{code:2084,message:"The AMF encoding of the arguments cannot exceed 40K."},AsyncError:{code:2095,message:"%1 was unable to invoke callback %2."},LoadingObjectNotSWFError:{code:2098,message:"The loading object is not a .swf file, you cannot request SWF properties from it."},LoadingObjectNotInitializedError:{code:2099,message:"The loading object is not sufficiently loaded to provide this information."},DecodeParamError:{code:2101,message:"The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs."},SceneNotFoundError:{code:2108,message:"Scene %1 was not found."},FrameLabelNotFoundError:{code:2109,message:"Frame label %1 not found in scene %2."},InvalidLoaderInfoMethodError:{code:2118,message:"The LoaderInfo class does not implement this method."},SecuritySwfNotAllowedError:{code:2121,message:"Security sandbox violation: %1: %2 cannot access %3. This may be worked around by calling Security.allowDomain."},UnknownFileTypeError:{code:2124,message:"Loaded file is an unknown type."},CantAddParentError:{code:2150,message:"An object cannot be added as a child to one of it's children (or children's children, etc.)."},Matrix3DRefCannontBeShared:{code:2189,message:"A Matrix3D can not be assigned to more than one DisplayObject."},ObjectWithStringsParamError:{code:2196,message:"Parameter %1 must be an Object with only String values."},AllowCodeImportError:{code:3226,message:"Cannot import a SWF file when LoaderContext.allowCodeImport is false."},PermissionDenied:{code:3315,message:"The current security context does not allow this operation."},InternalErrorIV:{code:3343,message:"Internal Error."}},InflateState,Wab;Wab=InflateState=InflateState||{},Wab[Wab.INIT=0]="INIT",Wab[Wab.BLOCK_0=1]="BLOCK_0",Wab[Wab.BLOCK_1=2]="BLOCK_1",Wab[Wab.BLOCK_2_PRE=3]="BLOCK_2_PRE",Wab[Wab.BLOCK_2=4]="BLOCK_2",Wab[Wab.DONE=5]="DONE",Wab[Wab.ERROR=6]="ERROR",Wab[Wab.VERIFY_HEADER=7]="VERIFY_HEADER";var WINDOW_SIZE=32768,WINDOW_SHIFT_POSITION=65536,MAX_WINDOW_SIZE=WINDOW_SHIFT_POSITION+258,Inflate=(Xab.prototype.push=function(t){},Xab.prototype.close=function(){},Xab.create=function(t){return new BasicInflate(t)},Xab.prototype._processZLibHeader=function(t,e,i){if(i<e+2)return 0;var n=t[e]<<8|t[e+1],r=null;return 2048!=(3840&n)?r="inflate: unknown compression method":n%31!=0?r="inflate: bad FCHECK":0!=(32&n)&&(r="inflate: FDICT bit set"),r?(this.onError&&this.onError(r),-1):2},Xab.inflate=function(t,e,i){var n=new Uint8Array(e),r=0,o=Xab.create(i);return o.onData=function(t){var e=Math.min(t.length,n.length-r);e&&memCopy(n,t,r,0,e),r+=e},o.onError=function(t){throw new Error(t)},o.push(t),o.close(),n},Xab),BasicInflate=(nbb=Inflate,__extends(obb,nbb),obb.prototype.push=function(t){var e;(!this._buffer||this._buffer.length<this._bufferSize+t.length)&&(e=new Uint8Array(this._bufferSize+t.length),this._buffer&&e.set(this._buffer),this._buffer=e),this._buffer.set(t,this._bufferSize),this._bufferSize+=t.length,this._bufferPosition=0;var i=!1;do{var n=this._windowPosition;if(this._state===InflateState.INIT&&(i=this._decodeInitState()))break;switch(this._state){case InflateState.BLOCK_0:i=this._decodeBlock0();break;case InflateState.BLOCK_2_PRE:if(i=this._decodeBlock2Pre())break;case InflateState.BLOCK_1:case InflateState.BLOCK_2:i=this._decodeBlock();break;case InflateState.ERROR:case InflateState.DONE:this._bufferPosition=this._bufferSize;break;case InflateState.VERIFY_HEADER:var r=this._processZLibHeader(this._buffer,this._bufferPosition,this._bufferSize);0<r?(this._bufferPosition+=r,this._state=InflateState.INIT):0===r?i=!0:this._state=InflateState.ERROR}0<this._windowPosition-n&&this.onData(this._window.subarray(n,this._windowPosition)),this._windowPosition>=WINDOW_SHIFT_POSITION&&("copyWithin"in this._buffer?this._window.copyWithin(0,this._windowPosition-WINDOW_SIZE,this._windowPosition):this._window.set(this._window.subarray(this._windowPosition-WINDOW_SIZE,this._windowPosition)),this._windowPosition=WINDOW_SIZE)}while(!i&&this._bufferPosition<this._bufferSize);this._bufferPosition<this._bufferSize?("copyWithin"in this._buffer?this._buffer.copyWithin(0,this._bufferPosition,this._bufferSize):this._buffer.set(this._buffer.subarray(this._bufferPosition,this._bufferSize)),this._bufferSize-=this._bufferPosition):this._bufferSize=0},obb.prototype._decodeInitState=function(){if(this._isFinalBlock)return this._state=InflateState.DONE,!1;var t,e=this._buffer,i=this._bufferSize,n=this._bitBuffer,r=this._bitLength,o=this._bufferPosition;if((i-o<<3)+r<3)return!0;r<3&&(n|=e[o++]<<r,r+=8);var s=7&n;switch(n>>=3,r-=3,s>>1){case 0:if(r=n=0,i-o<4)return!0;var a=e[o]|e[o+1]<<8,l=e[o+2]|e[o+3]<<8;if(o+=4,65535!=(a^l)){this._error("inflate: invalid block 0 length"),t=InflateState.ERROR;break}t=0==a?InflateState.INIT:(this._block0Read=a,InflateState.BLOCK_0);break;case 1:t=InflateState.BLOCK_1,this._literalTable=fixedLiteralTable,this._distanceTable=fixedDistanceTable;break;case 2:if((i-o<<3)+r<26)return!0;for(;r<14;)n|=e[o++]<<r,r+=8;var c=4+(n>>10&15);if((i-o<<3)+r<14+3*c)return!0;var h={numLiteralCodes:257+(31&n),numDistanceCodes:1+(n>>5&31),codeLengthTable:void 0,bitLengths:void 0,codesRead:0,dupBits:0};n>>=14,r-=14;for(var u=new Uint8Array(19),p=0;p<c;++p)r<3&&(n|=e[o++]<<r,r+=8),u[codeLengthOrder[p]]=7&n,n>>=3,r-=3;for(;p<19;p++)u[codeLengthOrder[p]]=0;h.bitLengths=new Uint8Array(h.numLiteralCodes+h.numDistanceCodes),h.codeLengthTable=makeHuffmanTable(u),this._block2State=h,t=InflateState.BLOCK_2_PRE;break;default:return this._error("inflate: unsupported block type"),t=InflateState.ERROR,!1}return this._isFinalBlock=!!(1&s),this._state=t,this._bufferPosition=o,this._bitBuffer=n,this._bitLength=r,!1},obb.prototype._error=function(t){this.onError&&this.onError(t)},obb.prototype._decodeBlock0=function(){var t=this._bufferPosition,e=this._windowPosition,i=this._block0Read,n=MAX_WINDOW_SIZE-e,r=this._bufferSize-t,o=r<i,s=Math.min(n,r,i);return this._window.set(this._buffer.subarray(t,t+s),e),this._windowPosition=e+s,this._bufferPosition=t+s,this._block0Read=i-s,i===s?(this._state=InflateState.INIT,!1):o&&n<r},obb.prototype._readBits=function(t){var e=this._bitBuffer,i=this._bitLength;if(i<t){var n=this._bufferPosition,r=this._bufferSize;do{if(r<=n)return this._bufferPosition=n,this._bitBuffer=e,this._bitLength=i,-1;e|=this._buffer[n++]<<i,i+=8}while(i<t);this._bufferPosition=n}return this._bitBuffer=e>>t,this._bitLength=i-t,e&(1<<t)-1},obb.prototype._readCode=function(t){var e=this._bitBuffer,i=this._bitLength,n=t.maxBits;if(i<n){var r=this._bufferPosition,o=this._bufferSize;do{if(o<=r)return this._bufferPosition=r,this._bitBuffer=e,this._bitLength=i,-1;e|=this._buffer[r++]<<i,i+=8}while(i<n);this._bufferPosition=r}var s=t.codes[e&(1<<n)-1],a=s>>16;return 32768&s?(this._error("inflate: invalid encoding"),this._state=InflateState.ERROR,-1):(this._bitBuffer=e>>a,this._bitLength=i-a,65535&s)},obb.prototype._decodeBlock2Pre=function(){var t=this._block2State,e=t.numLiteralCodes+t.numDistanceCodes,i=t.bitLengths,n=t.codesRead,r=0<n?i[n-1]:0,o=t.codeLengthTable;if(0<t.dupBits){if((s=this._readBits(t.dupBits))<0)return!0;for(;s--;)i[n++]=r;t.dupBits=0}for(;n<e;){var s,a,l=this._readCode(o);if(l<0)return t.codesRead=n,!0;if(l<16)i[n++]=r=l;else{switch(l){case 16:a=2,s=3,l=r;break;case 17:s=a=3,l=0;break;case 18:a=7,s=11,l=0}for(;s--;)i[n++]=l;if((s=this._readBits(a))<0)return t.codesRead=n,t.dupBits=a,!0;for(;s--;)i[n++]=l;r=l}}return this._literalTable=makeHuffmanTable(i.subarray(0,t.numLiteralCodes)),this._distanceTable=makeHuffmanTable(i.subarray(t.numLiteralCodes)),this._state=InflateState.BLOCK_2,this._block2State=null,!1},obb.prototype._decodeBlock=function(){var t,e,i,n,r,o,s,a=this._literalTable,l=this._distanceTable,c=this._window,h=this._windowPosition,u=this._copyState;if(0!==u.state)switch(u.state){case 1:if(e=0,(e=this._readBits(u.lenBits))<0)return!0;u.len+=e,u.state=2;case 2:if((i=this._readCode(l))<0)return!0;u.distBits=distanceExtraBits[i],u.dist=distanceCodes[i],u.state=3;case 3:if((e=0)<u.distBits&&(e=this._readBits(u.distBits))<0)return!0;for(o=u.dist+e,n=u.len,t=h-o;n--;)c[h++]=c[t++];if(u.state=0,WINDOW_SHIFT_POSITION<=h)return this._windowPosition=h,!1}do{if((i=this._readCode(a))<0)return this._windowPosition=h,!0;if(i<256)c[h++]=i;else{if(!(256<i)){this._state=InflateState.INIT;break}if(this._windowPosition=h,r=lengthExtraBits[i-=257],n=lengthCodes[i],(e=0===r?0:this._readBits(r))<0)return u.state=1,u.len=n,u.lenBits=r,!0;if(n+=e,(i=this._readCode(l))<0)return u.state=2,u.len=n,!0;if(s=distanceExtraBits[i],o=distanceCodes[i],(e=0===s?0:this._readBits(s))<0)return u.state=3,u.len=n,u.dist=o,u.distBits=s,!0;for(t=h-(o+=e);n--;)c[h++]=c[t++]}}while(h<WINDOW_SHIFT_POSITION);return this._windowPosition=h,!1},obb),codeLengthOrder,distanceCodes,distanceExtraBits,fixedDistanceTable,lengthCodes,lengthExtraBits,fixedLiteralTable,areTablesInitialized=!1,nbb;function obb(t){var e=nbb.call(this,t)||this;return e._buffer=null,e._bufferSize=0,e._bufferPosition=0,e._bitBuffer=0,e._bitLength=0,e._window=new Uint8Array(MAX_WINDOW_SIZE),e._windowPosition=0,e._state=t?InflateState.VERIFY_HEADER:InflateState.INIT,e._isFinalBlock=!1,e._literalTable=null,e._distanceTable=null,e._block0Read=0,e._block2State=null,e._copyState={state:0,len:0,lenBits:0,dist:0,distBits:0},areTablesInitialized||(initializeTables(),areTablesInitialized=!0),e}function Xab(t){}function initializeTables(){codeLengthOrder=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),distanceCodes=new Uint16Array(30),distanceExtraBits=new Uint8Array(30);for(var t=0,e=0,i=1;t<30;++t)distanceCodes[t]=i,i+=1<<(distanceExtraBits[t]=~~((e+=2<t?1:0)/2));for(var n=new Uint8Array(288),t=0;t<32;++t)n[t]=5;for(fixedDistanceTable=makeHuffmanTable(n.subarray(0,32)),lengthCodes=new Uint16Array(29),lengthExtraBits=new Uint8Array(29),e=t=0,i=3;t<29;++t)lengthCodes[t]=i-(28==t?1:0),i+=1<<(lengthExtraBits[t]=~~((e+=4<t?1:0)/4%6));for(t=0;t<288;++t)n[t]=t<144||279<t?8:t<256?9:7;fixedLiteralTable=makeHuffmanTable(n)}function makeHuffmanTable(t){for(var e=Math.max.apply(null,t),i=t.length,n=1<<e,r=new Uint32Array(n),o=e<<16|65535,s=0;s<n;s++)r[s]=o;for(var a=0,l=1,c=2;l<=e;a<<=1,++l,c<<=1)for(var h=0;h<i;++h)if(t[h]===l){for(var u=0,p=0;p<l;++p)u=2*u+(a>>p&1);for(p=u;p<n;p+=c)r[p]=l<<16|h;++a}return{codes:r,maxBits:e}}var SpecialInflateAdapter=(Ocb=Inflate,__extends(Pcb,Ocb),Pcb.prototype.push=function(t){if(this._verifyHeader){var e;this._buffer?((e=new Uint8Array(this._buffer.length+t.length)).set(this._buffer),e.set(t,this._buffer.length),this._buffer=null):e=new Uint8Array(t);var i=this._processZLibHeader(e,0,e.length);if(0===i)return void(this._buffer=e);this._verifyHeader=!0,0<i&&(t=e.subarray(i))}this._specialInflate.push(t)},Pcb.prototype.close=function(){this._specialInflate&&(this._specialInflate.close(),this._specialInflate=null)},Pcb),DeflateState,Ocb,Xcb;function Pcb(t,e){var i=Ocb.call(this,t)||this;return i._verifyHeader=t,i._specialInflate=e(),i._specialInflate.setDataCallback(function(t){this.onData(t)}.bind(i)),i}Xcb=DeflateState=DeflateState||{},Xcb[Xcb.WRITE=0]="WRITE",Xcb[Xcb.DONE=1]="DONE",Xcb[Xcb.ZLIB_HEADER=2]="ZLIB_HEADER";var Adler32=(Ycb.prototype.update=function(t,e,i){for(var n=this.a,r=this.b,o=e;o<i;++o)r=(r+(n=(n+(255&t[o]))%65521))%65521;this.a=n,this.b=r},Ycb.prototype.getChecksum=function(){return this.b<<16|this.a},Ycb),Deflate=(ddb.prototype.push=function(t){this._state===DeflateState.ZLIB_HEADER&&(this.onData(new Uint8Array([120,156])),this._state=DeflateState.WRITE);for(var e=t.length,i=e+5*Math.ceil(e/65535),n=new Uint8Array(i),r=0,o=0;65535<e;)n.set(new Uint8Array([0,255,255,0,0]),r),r+=5,n.set(t.subarray(o,o+65535),r),o+=65535,r+=65535,e-=65535;n.set(new Uint8Array([0,255&e,e>>8&255,255&~e,~e>>8&255]),r),r+=5,n.set(t.subarray(o,e),r),this.onData(n),this._adler32&&this._adler32.update(t,0,e)},ddb.prototype.close=function(){var t;this._state=DeflateState.DONE,this.onData(new Uint8Array([1,0,0,255,255])),this._adler32&&(t=this._adler32.getChecksum(),this.onData(new Uint8Array([255&t,t>>8&255,t>>16&255,t>>>24&255])))},ddb),InputStream=(mdb.prototype.append=function(t){var e=this.pos+this.available,i=e+t.length;if(i>this.buffer.length){for(var n=2*this.buffer.length;n<i;)n*=2;var r=new Uint8Array(n);r.set(this.buffer),this.buffer=r}this.buffer.set(t,e),this.available+=t.length},mdb.prototype.compact=function(){0!==this.available&&(this.buffer.set(this.buffer.subarray(this.pos,this.pos+this.available),0),this.pos=0)},mdb.prototype.readByte=function(){if(this.available<=0)throw new Error("Unexpected end of file");return this.available--,this.buffer[this.pos++]},mdb),OutputStream=(sdb.prototype.writeBytes=function(t){this.onData.call(null,t),this.processed+=t.length},sdb),OutWindow=(vdb.prototype.create=function(t){this.buf=new Uint8Array(t),this.pos=0,this.size=t,this.isFull=!1,this.writePos=0,this.totalPos=0},vdb.prototype.putByte=function(t){this.totalPos++,this.buf[this.pos++]=t,this.pos===this.size&&(this.flush(),this.pos=0,this.isFull=!0)},vdb.prototype.getByte=function(t){return this.buf[t<=this.pos?this.pos-t:this.size-t+this.pos]},vdb.prototype.flush=function(){this.writePos<this.pos&&(this.outStream.writeBytes(this.buf.subarray(this.writePos,this.pos)),this.writePos=this.pos===this.size?0:this.pos)},vdb.prototype.copyMatch=function(t,e){for(var i=this.pos,n=this.size,r=this.buf,o=t<=i?i-t:n-t+i,s=e;0<s;){for(var a=Math.min(Math.min(s,n-i),n-o),l=0;l<a;l++){var c=r[o++];r[i++]=c}i===n&&(this.pos=i,this.flush(),i=0,this.isFull=!0),o===n&&(o=0),s-=a}this.pos=i,this.totalPos+=e},vdb.prototype.checkDistance=function(t){return t<=this.pos||this.isFull},vdb.prototype.isEmpty=function(){return 0===this.pos&&!this.isFull},vdb),kNumBitModelTotalBits=11,kNumMoveBits=5,PROB_INIT_VAL=1<<kNumBitModelTotalBits>>1;function vdb(t){this.outStream=t,this.buf=null,this.pos=0,this.size=0,this.isFull=!1,this.writePos=0,this.totalPos=0}function sdb(t){this.onData=t,this.processed=0}function mdb(){this.available=0,this.pos=0,this.buffer=new Uint8Array(2e3)}function ddb(t){this._writeZlibHeader=t,this._state=t?DeflateState.ZLIB_HEADER:DeflateState.WRITE,this._adler32=t?new Adler32:null}function Ycb(){this.a=1,this.b=0}function createProbsArray(t){for(var e=new Uint16Array(t),i=0;i<t;i++)e[i]=PROB_INIT_VAL;return e}var kTopValue=1<<24,RangeDecoder=(Odb.prototype.init=function(){0!==this.inStream.readByte()&&(this.corrupted=!0),this.range=-1;for(var t=0,e=0;e<4;e++)t=t<<8|this.inStream.readByte();t===this.range&&(this.corrupted=!0),this.code=t},Odb.prototype.isFinishedOK=function(){return 0===this.code},Odb.prototype.decodeDirectBits=function(t){var e=0,i=this.range,n=this.code;do{var r=(n=n-(i=i>>>1|0)|0)>>31;(n=n+(i&r)|0)===i&&(this.corrupted=!0),0<=i&&i<kTopValue&&(i<<=8,n=n<<8|this.inStream.readByte()),e=(e<<1)+r+1|0}while(--t);return this.range=i,this.code=n,e},Odb.prototype.decodeBit=function(t,e){var i=this.range,n=this.code,r=t[e],o=(i>>>kNumBitModelTotalBits)*r,s=n>>>0<o?(r=r+((1<<kNumBitModelTotalBits)-r>>kNumMoveBits)|0,i=0|o,0):(r=r-(r>>kNumMoveBits)|0,n=n-o|0,i=i-o|0,1);return t[e]=65535&r,0<=i&&i<kTopValue&&(i<<=8,n=n<<8|this.inStream.readByte()),this.range=i,this.code=n,s},Odb);function Odb(t){this.inStream=t,this.range=0,this.code=0,this.corrupted=!1}function bitTreeReverseDecode(t,e,i,n){for(var r=1,o=0,s=0;s<i;s++){var a=n.decodeBit(t,r+e),r=(r<<1)+a;o|=a<<s}return o}var BitTreeDecoder=(keb.prototype.decode=function(t){for(var e=1,i=0;i<this.numBits;i++)e=(e<<1)+t.decodeBit(this.probs,e);return e-(1<<this.numBits)},keb.prototype.reverseDecode=function(t){return bitTreeReverseDecode(this.probs,0,this.numBits,t)},keb);function keb(t){this.numBits=t,this.probs=createProbsArray(1<<t)}function createBitTreeDecoderArray(t,e){var i=[];i.length=e;for(var n=0;n<e;n++)i[n]=new BitTreeDecoder(t);return i}var kNumPosBitsMax=4,kNumStates=12,kNumLenToPosStates=4,kNumAlignBits=4,kEndPosModelIndex=14,kNumFullDistances=1<<(kEndPosModelIndex>>1),kMatchMinLen=2,LenDecoder=(ueb.prototype.decode=function(t,e){return 0===t.decodeBit(this.choice,0)?this.lowCoder[e].decode(t):0===t.decodeBit(this.choice,1)?8+this.midCoder[e].decode(t):16+this.highCoder.decode(t)},ueb);function ueb(){this.choice=createProbsArray(2),this.lowCoder=createBitTreeDecoderArray(3,1<<kNumPosBitsMax),this.midCoder=createBitTreeDecoderArray(3,1<<kNumPosBitsMax),this.highCoder=new BitTreeDecoder(8)}function updateState_Literal(t){return t<4?0:t<10?t-3:t-6}function updateState_Match(t){return t<7?7:10}function updateState_Rep(t){return t<7?8:11}function updateState_ShortRep(t){return t<7?9:11}var LZMA_DIC_MIN=4096,MAX_DECODE_BITS_CALLS=48,LzmaDecoderInternal=(Beb.prototype.decodeProperties=function(t){var e=t[0];if(225<=e)throw new Error("Incorrect LZMA properties");this.lc=e%9,e=e/9|0,this.pb=e/5|0,this.lp=e%5;for(var i=this.dictSizeInProperties=0;i<4;i++)this.dictSizeInProperties|=t[i+1]<<8*i;this.dictSize=this.dictSizeInProperties,this.dictSize<LZMA_DIC_MIN&&(this.dictSize=LZMA_DIC_MIN)},Beb.prototype.create=function(){this.outWindow.create(this.dictSize),this.init(),this.rangeDec.init(),this.reps[0]=0,this.reps[1]=0,this.reps[2]=0,this.reps[3]=0,this.state=0,this.leftToUnpack=this.unpackSize},Beb.prototype.decodeLiteral=function(t,e){var i=this.outWindow,n=this.rangeDec,r=0;i.isEmpty()||(r=i.getByte(1));var o=1,s=768*(((i.totalPos&(1<<this.lp)-1)<<this.lc)+(r>>8-this.lc));if(7<=t){var a=i.getByte(e+1);do{var l=a>>7&1;a<<=1;var c=n.decodeBit(this.litProbs,s+((1+l<<8)+o)),o=o<<1|c;if(l!==c)break}while(o<256)}for(;o<256;)o=o<<1|n.decodeBit(this.litProbs,s+o);return o-256&255},Beb.prototype.decodeDistance=function(t){var e=t;kNumLenToPosStates-1<e&&(e=kNumLenToPosStates-1);var i=this.rangeDec,n=this.posSlotDecoder[e].decode(i);if(n<4)return n;var r=(n>>1)-1,o=(2|1&n)<<r;return n<kEndPosModelIndex?o+bitTreeReverseDecode(this.posDecoders,o-n,r,i)|0:(o=o+(i.decodeDirectBits(r-kNumAlignBits)<<kNumAlignBits)|0)+this.alignDecoder.reverseDecode(i)|0},Beb.prototype.init=function(){this.litProbs=createProbsArray(768<<this.lc+this.lp),this.posSlotDecoder=createBitTreeDecoderArray(6,kNumLenToPosStates),this.alignDecoder=new BitTreeDecoder(kNumAlignBits),this.posDecoders=createProbsArray(1+kNumFullDistances-kEndPosModelIndex),this.isMatch=createProbsArray(kNumStates<<kNumPosBitsMax),this.isRep=createProbsArray(kNumStates),this.isRepG0=createProbsArray(kNumStates),this.isRepG1=createProbsArray(kNumStates),this.isRepG2=createProbsArray(kNumStates),this.isRep0Long=createProbsArray(kNumStates<<kNumPosBitsMax),this.lenDecoder=new LenDecoder,this.repLenDecoder=new LenDecoder},Beb.prototype.decode=function(t){for(var e=this.rangeDec,i=this.outWindow,n=this.pb,r=this.dictSize,o=this.markerIsMandatory,s=this.leftToUnpack,a=this.isMatch,l=this.isRep,c=this.isRepG0,h=this.isRepG1,u=this.isRepG2,p=this.isRep0Long,d=this.lenDecoder,_=this.repLenDecoder,f=this.reps[0],m=this.reps[1],g=this.reps[2],y=this.reps[3],b=this.state;;){if(t&&e.inStream.available<MAX_DECODE_BITS_CALLS){this.outWindow.flush();break}if(0===s&&!o&&(this.outWindow.flush(),e.isFinishedOK()))return LZMA_RES_FINISHED_WITHOUT_MARKER;var v,x,A=i.totalPos&(1<<n)-1;if(0!==e.decodeBit(a,(b<<kNumPosBitsMax)+A)){if(0!==e.decodeBit(l,b)){if(0===s)return LZMA_RES_ERROR;if(i.isEmpty())return LZMA_RES_ERROR;if(0===e.decodeBit(c,b)){if(0===e.decodeBit(p,(b<<kNumPosBitsMax)+A)){b=updateState_ShortRep(b),i.putByte(i.getByte(f+1)),s--;continue}}else 0===e.decodeBit(h,b)?x=m:(0===e.decodeBit(u,b)?x=g:(x=y,y=g),g=m),m=f,f=x;v=_.decode(e,A),b=updateState_Rep(b)}else{if(y=g,g=m,m=f,v=d.decode(e,A),b=updateState_Match(b),-1===(f=this.decodeDistance(v)))return this.outWindow.flush(),e.isFinishedOK()?LZMA_RES_FINISHED_WITH_MARKER:LZMA_RES_ERROR;if(0===s)return LZMA_RES_ERROR;if(r<=f||!i.checkDistance(f))return LZMA_RES_ERROR}v+=kMatchMinLen;var S=!1;if(void 0!==s&&s<v&&(v=s,S=!0),i.copyMatch(f+1,v),s-=v,S)return LZMA_RES_ERROR}else{if(0===s)return LZMA_RES_ERROR;i.putByte(this.decodeLiteral(b,f)),b=updateState_Literal(b),s--}}return this.state=b,this.reps[0]=f,this.reps[1]=m,this.reps[2]=g,this.reps[3]=y,this.leftToUnpack=s,LZMA_RES_NOT_COMPLETE},Beb.prototype.flushOutput=function(){this.outWindow.flush()},Beb),LZMA_RES_ERROR=0,LZMA_RES_FINISHED_WITH_MARKER=1,LZMA_RES_FINISHED_WITHOUT_MARKER=2,LZMA_RES_NOT_COMPLETE=3,SWF_LZMA_HEADER_LENGTH=17,STANDARD_LZMA_HEADER_LENGTH=13,EXTRA_LZMA_BYTES_NEEDED=5,LzmaDecoderState,tfb;function Beb(t,e){this.rangeDec=new RangeDecoder(t),this.outWindow=new OutWindow(e),this.markerIsMandatory=!1,this.lc=0,this.pb=0,this.lp=0,this.dictSize=0,this.dictSizeInProperties=0,this.unpackSize=void 0,this.leftToUnpack=void 0,this.reps=new Int32Array(4),this.state=0}tfb=LzmaDecoderState=LzmaDecoderState||{},tfb[tfb.WAIT_FOR_LZMA_HEADER=0]="WAIT_FOR_LZMA_HEADER",tfb[tfb.WAIT_FOR_SWF_HEADER=1]="WAIT_FOR_SWF_HEADER",tfb[tfb.PROCESS_DATA=2]="PROCESS_DATA",tfb[tfb.CLOSED=3]="CLOSED",tfb[tfb.ERROR=4]="ERROR";var LzmaDecoder=(ufb.prototype.push=function(t){if(this._state<LzmaDecoderState.PROCESS_DATA){var e=this.buffer?this.buffer.length:0,i=(this._state===LzmaDecoderState.WAIT_FOR_SWF_HEADER?SWF_LZMA_HEADER_LENGTH:STANDARD_LZMA_HEADER_LENGTH)+EXTRA_LZMA_BYTES_NEEDED;if(e+t.length<i){var n=new Uint8Array(e+t.length);return 0<e&&n.set(this.buffer),n.set(t,e),void(this.buffer=n)}var r=new Uint8Array(i);if(0<e&&r.set(this.buffer),r.set(t.subarray(0,i-e),e),this._inStream=new InputStream,this._inStream.append(r.subarray(i-EXTRA_LZMA_BYTES_NEEDED)),this._outStream=new OutputStream(function(t){this.onData.call(null,t)}.bind(this)),this._decoder=new LzmaDecoderInternal(this._inStream,this._outStream),this._state===LzmaDecoderState.WAIT_FOR_SWF_HEADER)this._decoder.decodeProperties(r.subarray(12,17)),this._decoder.markerIsMandatory=!1,this._decoder.unpackSize=((r[4]|r[5]<<8|r[6]<<16|r[7]<<24)>>>0)-8;else{this._decoder.decodeProperties(r.subarray(0,5));for(var o=0,s=!1,a=0;a<8;a++){var l=r[5+a];255!==l&&(s=!0),o|=l<<8*a}this._decoder.markerIsMandatory=!s,this._decoder.unpackSize=s?o:void 0}this._decoder.create(),t=t.subarray(i),this._state=LzmaDecoderState.PROCESS_DATA}else if(this._state!==LzmaDecoderState.PROCESS_DATA)return;try{this._inStream.append(t);var c=this._decoder.decode(!0);this._inStream.compact(),c!==LZMA_RES_NOT_COMPLETE&&this._checkError(c)}catch(t){this._decoder.flushOutput(),this._decoder=null,this._error(t)}},ufb.prototype.close=function(){if(this._state===LzmaDecoderState.PROCESS_DATA){this._state=LzmaDecoderState.CLOSED;try{var t=this._decoder.decode(!1);this._checkError(t)}catch(t){this._decoder.flushOutput(),this._error(t)}this._decoder=null}},ufb.prototype._error=function(t){this._state=LzmaDecoderState.ERROR,this.onError&&this.onError(t)},ufb.prototype._checkError=function(t){var e;t===LZMA_RES_ERROR?e="LZMA decoding error":t===LZMA_RES_NOT_COMPLETE?e="Decoding is not complete":t===LZMA_RES_FINISHED_WITH_MARKER?void 0!==this._decoder.unpackSize&&this._decoder.unpackSize!==this._outStream.processed&&(e="Finished with end marker before than specified size"):e="Internal LZMA Error",e&&this._error(e)},ufb);function ufb(t){void 0===t&&(t=!1),this._state=t?LzmaDecoderState.WAIT_FOR_SWF_HEADER:LzmaDecoderState.WAIT_FOR_LZMA_HEADER,this.buffer=null}function axCoerceString$1(t){return"string"==typeof t?t:null==t?null:t+""}for(var PlainObjectDataBuffer=function(t,e,i){this.buffer=t,this.length=e,this.littleEndian=i},bitMasks=new Uint32Array(33),i=1,mask=0,TypedArrayViewFlags,Pfb;i<=32;i++)bitMasks[i]=mask=mask<<1|1;Pfb=TypedArrayViewFlags=TypedArrayViewFlags||{},Pfb[Pfb.U8=1]="U8",Pfb[Pfb.I32=2]="I32",Pfb[Pfb.F32=4]="F32";var DataBuffer=(Qfb.FromArrayBuffer=function(t,e){void 0===e&&(e=-1);var i=Object.create(Qfb.prototype);return i._buffer=t,i._length=-1===e?t.byteLength:e,i._position=0,i._resetViews(),i._littleEndian=Qfb._nativeLittleEndian,i._bitBuffer=0,i._bitLength=0,i},Qfb.FromPlainObject=function(t){var e=Qfb.FromArrayBuffer(t.buffer,t.length);return e._littleEndian=t.littleEndian,e},Qfb.prototype.toPlainObject=function(){return new PlainObjectDataBuffer(this._buffer,this._length,this._littleEndian)},Qfb.prototype.clone=function(){var t=Qfb.FromArrayBuffer(new Uint8Array(this._u8).buffer,this._length);return t._position=this._position,t._littleEndian=this._littleEndian,t._bitBuffer=this._bitBuffer,t._bitLength=this._bitLength,t},Qfb.prototype._resetViews=function(){this._u8=new Uint8Array(this._buffer),this._i32=null,this._f32=null},Qfb.prototype._requestViews=function(t){0==(3&this._buffer.byteLength)&&(null===this._i32&&t&TypedArrayViewFlags.I32&&(this._i32=new Int32Array(this._buffer)),null===this._f32&&t&TypedArrayViewFlags.F32&&(this._f32=new Float32Array(this._buffer)))},Qfb.prototype.getBytes=function(){return new Uint8Array(this._buffer,0,this._length)},Qfb.prototype._ensureCapacity=function(t){var e=this._buffer;if(!(e.byteLength>=t)){for(var i=Math.max(e.byteLength,1);i<t;)i*=2;4294967295<i&&(assert(this.sec),this.sec.throwError("RangeError",Errors.ParamRangeError));var n=Qfb._arrayBufferPool.acquire(i),r=this._u8;this._buffer=n,this._resetViews(),this._u8.set(r);for(var o=this._u8,s=r.length;s<o.length;s++)o[s]=0;Qfb._arrayBufferPool.release(e)}},Qfb.prototype.clear=function(){this._length=0,this._position=0},Qfb.prototype.readBoolean=function(){return 0!==this.readUnsignedByte()},Qfb.prototype.readByte=function(){return this.readUnsignedByte()<<24>>24},Qfb.prototype.readUnsignedByte=function(){return this._position+1>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError)),this._u8[this._position++]},Qfb.prototype.readBytes=function(t,e,i){var n=this._position;e>>>=0,0==(i>>>=0)&&(i=this._length-n),n+i>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError)),t.length<e+i&&(t._ensureCapacity(e+i),t.length=e+i),t._u8.set(new Uint8Array(this._buffer,n,i),e),this._position+=i},Qfb.prototype.readShort=function(){return this.readUnsignedShort()<<16>>16},Qfb.prototype.readUnsignedShort=function(){var t=this._u8,e=this._position;e+2>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError));var i=t[e+0],n=t[e+1];return this._position=e+2,this._littleEndian?n<<8|i:i<<8|n},Qfb.prototype.readInt=function(){var t=this._u8,e=this._position;e+4>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError));var i=t[e+0],n=t[e+1],r=t[e+2],o=t[e+3];return this._position=e+4,this._littleEndian?o<<24|r<<16|n<<8|i:i<<24|n<<16|r<<8|o},Qfb.prototype.readUnsignedInt=function(){return this.readInt()>>>0},Qfb.prototype.readFloat=function(){var t=this._position;if(t+4>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError)),this._position=t+4,this._requestViews(TypedArrayViewFlags.F32),this._littleEndian&&0==(3&t)&&this._f32)return this._f32[t>>2];var e=this._u8,i=IntegerUtilities.u8;return this._littleEndian?(i[0]=e[t+0],i[1]=e[t+1],i[2]=e[t+2],i[3]=e[t+3]):(i[3]=e[t+0],i[2]=e[t+1],i[1]=e[t+2],i[0]=e[t+3]),IntegerUtilities.f32[0]},Qfb.prototype.readDouble=function(){var t=this._u8,e=this._position;e+8>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError));var i=IntegerUtilities.u8;return this._littleEndian?(i[0]=t[e+0],i[1]=t[e+1],i[2]=t[e+2],i[3]=t[e+3],i[4]=t[e+4],i[5]=t[e+5],i[6]=t[e+6],i[7]=t[e+7]):(i[0]=t[e+7],i[1]=t[e+6],i[2]=t[e+5],i[3]=t[e+4],i[4]=t[e+3],i[5]=t[e+2],i[6]=t[e+1],i[7]=t[e+0]),this._position=e+8,IntegerUtilities.f64[0]},Qfb.prototype.writeBoolean=function(t){this.writeByte(t?1:0)},Qfb.prototype.writeByte=function(t){var e=this._position+1;this._ensureCapacity(e),this._u8[this._position++]=t,e>this._length&&(this._length=e)},Qfb.prototype.writeUnsignedByte=function(t){var e=this._position+1;this._ensureCapacity(e),this._u8[this._position++]=t,e>this._length&&(this._length=e)},Qfb.prototype.writeRawBytes=function(t){var e=this._position+t.length;this._ensureCapacity(e),this._u8.set(t,this._position),(this._position=e)>this._length&&(this._length=e)},Qfb.prototype.writeBytes=function(t,e,i){isNullOrUndefined(t)&&(assert(this.sec),this.sec.throwError("TypeError",Errors.NullPointerError,"bytes")),e>>>=0,i>>>=0,arguments.length<2&&(e=0),arguments.length<3&&(i=0),e===clamp(e,0,t.length)&&e+i===clamp(e+i,0,t.length)||(assert(this.sec),this.sec.throwError("RangeError",Errors.ParamRangeError)),0===i&&(i=t.length-e),this.writeRawBytes(new Uint8Array(t._buffer,e,i))},Qfb.prototype.writeShort=function(t){this.writeUnsignedShort(t)},Qfb.prototype.writeUnsignedShort=function(t){var e=this._position;this._ensureCapacity(e+2);var i=this._u8;this._littleEndian?(i[e+0]=t,i[e+1]=t>>8):(i[e+0]=t>>8,i[e+1]=t),e+=2,(this._position=e)>this._length&&(this._length=e)},Qfb.prototype.writeInt=function(t){this.writeUnsignedInt(t)},Qfb.prototype.write2Ints=function(t,e){this.write2UnsignedInts(t,e)},Qfb.prototype.write4Ints=function(t,e,i,n){this.write4UnsignedInts(t,e,i,n)},Qfb.prototype.writeUnsignedInt=function(t){var e,i=this._position;this._ensureCapacity(i+4),this._requestViews(TypedArrayViewFlags.I32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&i)&&this._i32?this._i32[i>>2]=t:(e=this._u8,this._littleEndian?(e[i+0]=t,e[i+1]=t>>8,e[i+2]=t>>16,e[i+3]=t>>24):(e[i+0]=t>>24,e[i+1]=t>>16,e[i+2]=t>>8,e[i+3]=t)),i+=4,(this._position=i)>this._length&&(this._length=i)},Qfb.prototype.write2UnsignedInts=function(t,e){var i=this._position;this._ensureCapacity(i+8),this._requestViews(TypedArrayViewFlags.I32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&i)&&this._i32?(this._i32[i>>2]=t,this._i32[1+(i>>2)]=e,i+=8,(this._position=i)>this._length&&(this._length=i)):(this.writeUnsignedInt(t),this.writeUnsignedInt(e))},Qfb.prototype.write4UnsignedInts=function(t,e,i,n){var r=this._position;this._ensureCapacity(r+16),this._requestViews(TypedArrayViewFlags.I32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&r)&&this._i32?(this._i32[r>>2]=t,this._i32[1+(r>>2)]=e,this._i32[2+(r>>2)]=i,this._i32[3+(r>>2)]=n,r+=16,(this._position=r)>this._length&&(this._length=r)):(this.writeUnsignedInt(t),this.writeUnsignedInt(e),this.writeUnsignedInt(i),this.writeUnsignedInt(n))},Qfb.prototype.writeFloat=function(t){var e,i,n=this._position;this._ensureCapacity(n+4),this._requestViews(TypedArrayViewFlags.F32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&n)&&this._f32?this._f32[n>>2]=t:(e=this._u8,IntegerUtilities.f32[0]=t,i=IntegerUtilities.u8,this._littleEndian?(e[n+0]=i[0],e[n+1]=i[1],e[n+2]=i[2],e[n+3]=i[3]):(e[n+0]=i[3],e[n+1]=i[2],e[n+2]=i[1],e[n+3]=i[0])),n+=4,(this._position=n)>this._length&&(this._length=n)},Qfb.prototype.write2Floats=function(t,e){var i=this._position;this._ensureCapacity(i+8),this._requestViews(TypedArrayViewFlags.F32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&i)&&this._f32?(this._f32[i>>2]=t,this._f32[1+(i>>2)]=e,i+=8,(this._position=i)>this._length&&(this._length=i)):(this.writeFloat(t),this.writeFloat(e))},Qfb.prototype.write6Floats=function(t,e,i,n,r,o){var s=this._position;this._ensureCapacity(s+24),this._requestViews(TypedArrayViewFlags.F32),this._littleEndian===Qfb._nativeLittleEndian&&0==(3&s)&&this._f32?(this._f32[s>>2]=t,this._f32[1+(s>>2)]=e,this._f32[2+(s>>2)]=i,this._f32[3+(s>>2)]=n,this._f32[4+(s>>2)]=r,this._f32[5+(s>>2)]=o,s+=24,(this._position=s)>this._length&&(this._length=s)):(this.writeFloat(t),this.writeFloat(e),this.writeFloat(i),this.writeFloat(n),this.writeFloat(r),this.writeFloat(o))},Qfb.prototype.writeDouble=function(t){var e=this._position;this._ensureCapacity(e+8);var i=this._u8;IntegerUtilities.f64[0]=t;var n=IntegerUtilities.u8;this._littleEndian?(i[e+0]=n[0],i[e+1]=n[1],i[e+2]=n[2],i[e+3]=n[3],i[e+4]=n[4],i[e+5]=n[5],i[e+6]=n[6],i[e+7]=n[7]):(i[e+0]=n[7],i[e+1]=n[6],i[e+2]=n[5],i[e+3]=n[4],i[e+4]=n[3],i[e+5]=n[2],i[e+6]=n[1],i[e+7]=n[0]),e+=8,(this._position=e)>this._length&&(this._length=e)},Qfb.prototype.readRawBytes=function(){return new Int8Array(this._buffer,0,this._length)},Qfb.prototype.writeUTF=function(t){var e=utf8decode(t=axCoerceString$1(t));this.writeShort(e.length),this.writeRawBytes(e)},Qfb.prototype.writeUTFBytes=function(t){var e=utf8decode(t=axCoerceString$1(t));this.writeRawBytes(e)},Qfb.prototype.readUTF=function(){return this.readUTFBytes(this.readShort())},Qfb.prototype.readUTFBytes=function(t){t>>>=0;var e=this._position;return e+t>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError)),this._position+=t,utf8encode(new Uint8Array(this._buffer,e,t))},Object.defineProperty(Qfb.prototype,"length",{get:function(){return this._length},set:function(t){(t>>>=0)>this._buffer.byteLength&&this._ensureCapacity(t),this._length=t,this._position=clamp(this._position,0,this._length)},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"bytesAvailable",{get:function(){return this._length-this._position},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"position",{get:function(){return this._position},set:function(t){this._position=t>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"buffer",{get:function(){return this._buffer},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"bytes",{get:function(){return this._u8},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"ints",{get:function(){return this._requestViews(TypedArrayViewFlags.I32),this._i32},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"objectEncoding",{get:function(){return this._objectEncoding},set:function(t){t>>>=0,this._objectEncoding=t},enumerable:!0,configurable:!0}),Object.defineProperty(Qfb.prototype,"endian",{get:function(){return this._littleEndian?"littleEndian":"bigEndian"},set:function(t){t=axCoerceString$1(t),this._littleEndian="auto"===t?Qfb._nativeLittleEndian:"littleEndian"===t},enumerable:!0,configurable:!0}),Qfb.prototype.toString=function(){return utf8encode(new Uint8Array(this._buffer,0,this._length))},Qfb.prototype.toBlob=function(t){return new Blob([new Uint8Array(this._buffer,this._position,this._length)],{type:t})},Qfb.prototype.writeMultiByte=function(t,e){console.log("packageInternal flash.utils.ObjectOutput::writeMultiByte")},Qfb.prototype.readMultiByte=function(t,e){console.log("packageInternal flash.utils.ObjectInput::readMultiByte")},Qfb.prototype.getValue=function(t){if(!((t|=0)>=this._length))return this._u8[t]},Qfb.prototype.setValue=function(t,e){var i=1+(t|=0);this._ensureCapacity(i),this._u8[t]=e,i>this._length&&(this._length=i)},Qfb.prototype.readFixed=function(){return this.readInt()/65536},Qfb.prototype.readFixed8=function(){return this.readShort()/256},Qfb.prototype.readFloat16=function(){var t=this.readUnsignedShort(),e=t>>15?-1:1,i=(31744&t)>>10,n=1023&t;return i?31==i?n?NaN:1/0*e:e*Math.pow(2,i-15)*(1+n/1024):e*Math.pow(2,-14)*(n/1024)},Qfb.prototype.readEncodedU32=function(){var t=this.readUnsignedByte();return 128&t&&16384&(t=127&t|this.readUnsignedByte()<<7)&&2097152&(t=16383&t|this.readUnsignedByte()<<14)&&268435456&(t=2097151&t|this.readUnsignedByte()<<21)?268435455&t|this.readUnsignedByte()<<28:t},Qfb.prototype.readBits=function(t){return this.readUnsignedBits(t)<<32-t>>32-t},Qfb.prototype.readUnsignedBits=function(t){for(var e=this._bitBuffer,i=this._bitLength;i<t;)e=e<<8|this.readUnsignedByte(),i+=8;var n=e>>>(i-=t)&bitMasks[t];return this._bitBuffer=e,this._bitLength=i,n},Qfb.prototype.readFixedBits=function(t){return this.readBits(t)/65536},Qfb.prototype.readString=function(t){var e=this._position;if(t)e+t>this._length&&(assert(this.sec),this.sec.throwError("flash.errors.EOFError",Errors.EOFError)),this._position+=t;else{t=0;for(var i=e;i<this._length&&this._u8[i];i++)t++;this._position+=t+1}return utf8encode(new Uint8Array(this._buffer,e,t))},Qfb.prototype.align=function(){this._bitBuffer=0,this._bitLength=0},Qfb.prototype.deflate=function(){this.compress("deflate")},Qfb.prototype.inflate=function(){this.uncompress("deflate")},Qfb.prototype.compress=function(t){var e;switch(t=0===arguments.length?"zlib":axCoerceString$1(t)){case"zlib":e=new Deflate(!0);break;case"deflate":e=new Deflate(!1);break;default:return}var i=new Qfb;e.onData=i.writeRawBytes.bind(i),e.push(this._u8.subarray(0,this._length)),e.close(),this._ensureCapacity(i._u8.length),this._u8.set(i._u8),this.length=i.length,this._position=0},Qfb.prototype.uncompress=function(t){var e;switch(t=0===arguments.length?"zlib":axCoerceString$1(t)){case"zlib":e=Inflate.create(!0);break;case"deflate":e=Inflate.create(!1);break;case"lzma":e=new LzmaDecoder(!1);break;default:return}var i,n=new Qfb;e.onData=n.writeRawBytes.bind(n),e.onError=function(t){return i=t},e.push(this._u8.subarray(0,this._length)),i&&(assert(this.sec),this.sec.throwError("IOError",Errors.CompressedDataError)),e.close(),this._ensureCapacity(n._u8.length),this._u8.set(n._u8),this.length=n.length,this._position=0},Qfb._nativeLittleEndian=1===new Int8Array(new Int32Array([1]).buffer)[0],Qfb.INITIAL_SIZE=128,Qfb._arrayBufferPool=new ArrayBufferPool,Qfb),FillType,hib;function Qfb(t){void 0===t&&(t=Qfb.INITIAL_SIZE),this._buffer||(this._buffer=new ArrayBuffer(t),this._length=0,this._position=0,this._resetViews(),this._littleEndian=Qfb._nativeLittleEndian,this._bitBuffer=0,this._bitLength=0)}hib=FillType=FillType||{},hib[hib.Solid=0]="Solid",hib[hib.LinearGradient=16]="LinearGradient",hib[hib.RadialGradient=18]="RadialGradient",hib[hib.FocalRadialGradient=19]="FocalRadialGradient",hib[hib.RepeatingBitmap=64]="RepeatingBitmap",hib[hib.ClippedBitmap=65]="ClippedBitmap",hib[hib.NonsmoothedRepeatingBitmap=66]="NonsmoothedRepeatingBitmap",hib[hib.NonsmoothedClippedBitmap=67]="NonsmoothedClippedBitmap";var PathSegment=(iib.FromDefaults=function(t){var e=new DataBuffer,i=new DataBuffer;e.endian=i.endian="auto";var n=null;return t&&((n=new DataBuffer).endian="auto"),new iib(e,i,n,null,null,!1)},iib.prototype.moveTo=function(t,e){this.commands.writeUnsignedByte(9),this.data.write2Ints(t,e)},iib.prototype.morphMoveTo=function(t,e,i,n){this.moveTo(t,e),this.morphData.write2Ints(i,n)},iib.prototype.lineTo=function(t,e){this.commands.writeUnsignedByte(10),this.data.write2Ints(t,e)},iib.prototype.morphLineTo=function(t,e,i,n){this.lineTo(t,e),this.morphData.write2Ints(i,n)},iib.prototype.curveTo=function(t,e,i,n){this.commands.writeUnsignedByte(11),this.data.write4Ints(t,e,i,n)},iib.prototype.morphCurveTo=function(t,e,i,n,r,o,s,a){this.curveTo(t,e,i,n),this.morphData.write4Ints(r,o,s,a)},iib.prototype.toReversed=function(){return assert(!this.isReversed),new iib(this.commands,this.data,this.morphData,null,null,!0)},iib.prototype.clone=function(){return new iib(this.commands,this.data,this.morphData,null,null,this.isReversed)},iib.prototype.storeStartAndEnd=function(){var t=this.data.ints,e=t[0]+","+t[1],i=(this.data.length>>2)-2,n=t[i]+","+t[1+i];this.isReversed?(this.startPoint=n,this.endPoint=e):(this.startPoint=e,this.endPoint=n)},iib.prototype.connectsTo=function(t){return t!==this&&(assert(this.endPoint),assert(t.startPoint),this.endPoint===t.startPoint)},iib.prototype.startConnectsTo=function(t){return t!==this&&this.startPoint===t.startPoint},iib.prototype.flipDirection=function(){var t=this.startPoint;this.startPoint=this.endPoint,this.endPoint=t,this.isReversed=!this.isReversed},iib.prototype.serializeAJS=function(t,e,i){if(this.isReversed)this._serializeReversedAJS(t,e,i);else{var n=this.commands.bytes,r=this.data.length>>2,o=this.morphData?this.morphData.ints:null,s=this.data.ints;assert(9===n[0]);var a=0;s[0]===i.x&&s[1]===i.y&&a++;for(var l=this.commands.length,c=2*a,h=a;h<l;h++){switch(n[h]){case 9:t.moveTo(s[c]/20,s[c+1]/20),e&&e.moveTo(o[c]/20,o[c+1]/20);break;case 10:t.lineTo(s[c]/20,s[c+1]/20),e&&e.lineTo(o[c]/20,o[c+1]/20);break;case 11:t.curveTo(s[c]/20,s[c+1]/20,s[c+2]/20,s[c+3]/20),e&&e.curveTo(o[c]/20,o[c+1]/20,o[c+2]/20,o[c+3]/20),c+=2}c+=2}i.x=s[r-2],i.y=s[r-1]}},iib.prototype._serializeReversedAJS=function(t,e,i){var n=this.commands.length,r=(this.data.length>>2)-2,o=this.commands.bytes;assert(9===o[0]);var s=this.data.ints,a=this.morphData?this.morphData.ints:null;if(s[r]===i.x&&s[r+1]===i.y||(t.moveTo(s[r]/20,s[r+1]/20),e&&e.moveTo(a[r]/20,a[r+1]/20)),1===n)return i.x=s[0],void(i.y=s[1]);for(var l=n;1<l--;)switch(r-=2,o[l],o[l]){case 9:t.moveTo(s[r]/20,s[r+1]/20),e&&e.moveTo(a[r]/20,a[r+1]/20);break;case 10:t.lineTo(s[r]/20,s[r+1]/20),e&&e.lineTo(a[r]/20,a[r+1]/20);break;case 11:r-=2,t.curveTo(s[r+2]/20,s[r+3]/20,s[r]/20,s[r+1]/20),e&&e.curveTo(a[r+2]/20,a[r+3]/20,a[r]/20,a[r+1]/20)}i.x=s[0],i.y=s[1]},iib._counter=0,iib),GradientType,qjb;function iib(t,e,i,n,r,o){this.commands=t,this.data=e,this.morphData=i,this.prev=n,this.next=r,this.isReversed=o,this.isValidFill=!0,this.id=iib._counter++}qjb=GradientType=GradientType||{},qjb[qjb.LINEAR=0]="LINEAR",qjb[qjb.RADIAL=1]="RADIAL";var GraphicsFillStyle=(Object.defineProperty(rjb.prototype,"data_type",{get:function(){return rjb.data_type},enumerable:!0,configurable:!0}),rjb.data_type="[graphicsdata FillStyle]",rjb),GradientFillStyle=(ujb=GraphicsFillStyle,__extends(vjb,ujb),vjb.prototype.getUVMatrix=function(){this.matrix||(this.matrix=new Matrix);var t=this.matrix.a,e=this.matrix.b,i=this.matrix.c,n=this.matrix.d,r=this.matrix.tx,o=this.matrix.ty,s=n/(t*n-e*i),a=-e/(t*n-e*i),l=-i/(t*n-e*i),c=t/(t*n-e*i),h=(i*o-n*r)/(t*n-e*i),u=-(t*o-e*r)/(t*n-e*i);return this.type==GradientType.LINEAR?this.matrix=new Matrix(s/1638.4*(1-1/256),0,l/1638.4*(1-1/256),0,this.uvRectangle.x+(819.2+h)/1638.4*(1-1/256),this.uvRectangle.y):this.type==GradientType.RADIAL&&(this.matrix=new Matrix(s/819.2,a/819.2,l/819.2,c/819.2,(819.2+h)/819.2-1,(819.2+u)/819.2-1)),this.matrix},vjb.prototype.getColorAtPosition=function(t){var e=-1,i=-1;if(t<=this.ratio_min)i=e=0;else if(t>=this.ratio_max)e=this.ratios.length-1,i=this.ratios.length-1;else for(var n=0,n=0;n<this.ratios.length-1;n++){if(t==this.ratios[n]){i=e=n;break}if(t==this.ratios[n+1]){i=e=n+1;break}if(t>=this.ratios[n]&&t<=this.ratios[n+1]){i=(e=n)+1;break}}if(e==i)return[this.alphas[e],this.colors_r[e],this.colors_g[e],this.colors_b[e]];var r=(t-this.ratios[e])/(this.ratios[i]-this.ratios[e]),o=1-r;return[this.alphas[i]*r+this.alphas[e]*o,this.colors_r[i]*r+this.colors_r[e]*o,this.colors_g[i]*r+this.colors_g[e]*o,this.colors_b[i]*r+this.colors_b[e]*o]},vjb.prototype.toString=function(){for(var t="",e=this.colors.length;0<e;)e--,t+=this.colors[e]+"#"+this.alphas[e]+"#"+this.ratios[e]+"#";return t},Object.defineProperty(vjb.prototype,"data_type",{get:function(){return vjb.data_type},enumerable:!0,configurable:!0}),vjb.data_type="[graphicsdata GradientFillStyle]",vjb),BitmapFillStyle=(Object.defineProperty(bkb.prototype,"data_type",{get:function(){return bkb.data_type},enumerable:!0,configurable:!0}),bkb.prototype.getUVMatrix=function(){this.matrix||(this.matrix=new Matrix);var t=this.material.ambientMethod.texture._images[0];if(!t)throw"BitmapFillStyle.getUVMatrix - no texture found";var e=t.width,i=t.height,n=this.matrix.a,r=this.matrix.b,o=this.matrix.c,s=this.matrix.d,a=this.matrix.tx,l=this.matrix.ty,c=s/(n*s-r*o),h=-r/(n*s-r*o),u=-o/(n*s-r*o),p=n/(n*s-r*o),d=(o*l-s*a)/(n*s-r*o),_=-(n*l-r*a)/(n*s-r*o);return this.matrix.a=c/e,this.matrix.b=h/i,this.matrix.c=u/e,this.matrix.d=p/i,this.matrix.tx=d/e,this.matrix.ty=_/i,this.matrix},bkb.data_type="[graphicsdata BitmapFillStyle]",bkb),LineScaleMode,ujb,vkb;function bkb(t,e,i,n){this.material=t,this.matrix=e,this.repeat=i,this.smooth=n}function vjb(t,e,i,n,r,o,s,a){var l=ujb.call(this)||this;if(e.length!=i.length||e.length!=n.length)throw"GradientFillStyle: Error - colors, alphas and ratios must be of same length";l.colors=e,l.colors_r=[],l.colors_g=[],l.colors_b=[],l.colors_r.length=l.colors_g.length=l.colors_g.length=l.colors.length,l.alphas=i,l.ratios=n,l.matrix=r,l.type=t,l.uvRectangle=new Rectangle,l.ratios.sort(function(t,e){return t-e}),l.ratio_min=l.ratios[0],l.ratio_max=l.ratios[l.ratios.length-1],l.ratios.length;for(var c,h=e.length;0<h;)h--,c=ColorUtils.float32ColorToARGB(e[h]),l.colors_r[h]=c[1],l.colors_g[h]=c[2],l.colors_b[h]=c[3];return l}function rjb(t,e){void 0===t&&(t=16777215),void 0===e&&(e=1),this.color=t,this.alpha=e}vkb=LineScaleMode=LineScaleMode||{},vkb[vkb.HORIZONTAL=0]="HORIZONTAL",vkb[vkb.NONE=1]="NONE",vkb[vkb.NORMAL=2]="NORMAL",vkb[vkb.VERTICAL=3]="VERTICAL",vkb[vkb.HAIRLINE=4]="HAIRLINE";var CapsStyle=(wkb.ROUND=1,wkb.NONE=0,wkb.SQUARE=2,wkb),JointStyle=(xkb.BEVEL=1,xkb.MITER=2,xkb.ROUND=0,xkb),GraphicsStrokeStyle=(Object.defineProperty(ykb.prototype,"data_type",{get:function(){return ykb.data_type},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"half_thickness",{get:function(){return this._thickness/2},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness=t},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"jointstyle",{get:function(){return this._jointstyle},set:function(t){this._jointstyle=t},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"miter_limit",{get:function(){return this._miter_limit},set:function(t){this._miter_limit=t},enumerable:!0,configurable:!0}),Object.defineProperty(ykb.prototype,"capstyle",{get:function(){return this._capstyle},set:function(t){this._capstyle=t},enumerable:!0,configurable:!0}),ykb.data_type="[graphicsdata StrokeStyle]",ykb),SegmentedPath=(Mkb.prototype.addSegment=function(t){assert(t),assert(null===t.next),assert(null===t.prev);var e=this._head;e&&(assert(t!==e),(e.next=t).prev=e),this._head=t},Mkb.prototype.removeSegment=function(t){t.prev&&(t.prev.next=t.next),t.next&&(t.next.prev=t.prev)},Mkb.prototype.insertSegment=function(t,e){var i=e.prev;t.prev=i,t.next=e,i&&(i.next=t),e.prev=t},Mkb.prototype.head=function(){return this._head},Mkb.prototype.rgbaToArgb=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},Mkb.prototype.getAlpha=function(t){return 255&t},Mkb.prototype.rgbToArgb=function(t){return(4278190080&t)>>>24<<24|(255&t)<<16|(65280&t)>>>8<<8|(16711680&t)>>>16},Mkb.prototype.serializeAJS=function(t,e){var i=this.head();if(i){if(this.fillStyle){var n=(l=this.fillStyle).morph;switch(l.type){case FillType.Solid:l.alpha=this.getAlpha(l.color)/255,l.color=this.rgbaToArgb(l.color),t.style=new GraphicsFillStyle(l.color,l.alpha),n&&(n.alpha=this.getAlpha(n.color)/255,n.color=this.rgbaToArgb(n.color),e.style=new GraphicsFillStyle(n.color,n.alpha));break;case FillType.LinearGradient:case FillType.RadialGradient:case FillType.FocalRadialGradient:for(var r=l.type===FillType.LinearGradient?GradientType.LINEAR:GradientType.RADIAL,o=[],s=0;s<l.colors.length;s++)o[s]=this.getAlpha(l.colors[s])/255,l.colors[s]=this.rgbaToArgb(l.colors[s]);var a=new Matrix(l.transform.a,l.transform.b,l.transform.c,l.transform.d,l.transform.tx,l.transform.ty);if(t.style=new GradientFillStyle(r,l.colors,o,l.ratios,a,l.spreadMethod,l.interpolationMode,l.focalPoint/2|0),n){for(r=n.type===FillType.LinearGradient?GradientType.LINEAR:GradientType.RADIAL,o=[],s=0;s<n.colors.length;s++)o[s]=this.getAlpha(n.colors[s])/255,n.colors[s]=this.rgbaToArgb(n.colors[s]);a=new Matrix(n.transform.a,n.transform.b,n.transform.c,n.transform.d,n.transform.tx,n.transform.ty),e.style=new GradientFillStyle(r,n.colors,o,n.ratios,a,n.spreadMethod,n.interpolationMode,n.focalPoint/2|0)}break;case FillType.ClippedBitmap:case FillType.RepeatingBitmap:case FillType.NonsmoothedClippedBitmap:case FillType.NonsmoothedRepeatingBitmap:a=new Matrix(l.transform.a,l.transform.b,l.transform.c,l.transform.d,l.transform.tx,l.transform.ty),t.style=new BitmapFillStyle(l.material,a,l.repeat,l.smooth),n&&(a=new Matrix(n.transform.a,n.transform.b,n.transform.c,n.transform.d,n.transform.tx,n.transform.ty),e.style=new BitmapFillStyle(l.material,a,l.repeat,l.smooth));break;default:console.log("Invalid fill style type: "+l.type)}}else{var l,n=(l=this.lineStyle).morph;switch(assert(l),l.type){case FillType.Solid:l.noHscale,l.noVscale;var c=(0|clamp(l.width,0,5100))/20;l.alpha=this.getAlpha(l.color)/255,l.color=this.rgbaToArgb(l.color);var h=LineScaleMode.NORMAL;.05==c&&(h=LineScaleMode.HAIRLINE),l.startCapsStyle!=l.endCapsStyle&&console.log("Warning: different end vs start capstyöe"),l.startCapsStyle=CapsStyle.ROUND,l.jointStyle=0,t.style=new GraphicsStrokeStyle(l.color,l.alpha,c,l.jointStyle,l.startCapsStyle,l.miterLimit,h),n&&(c=(0|clamp(n.width,0,5100))/20,n.alpha=this.getAlpha(n.color)/255,n.color=this.rgbaToArgb(n.color),e.style=new GraphicsStrokeStyle(n.color,n.alpha,c,l.jointStyle,l.startCapsStyle,l.miterLimit,h));break;case FillType.LinearGradient:case FillType.RadialGradient:case FillType.FocalRadialGradient:for(l.noHscale,l.noVscale,c=(0|clamp(l.width,0,5100))/20,l.alpha=this.getAlpha(l.color)/255,l.color=this.rgbaToArgb(l.color),t.style=new GraphicsStrokeStyle(l.color,l.alpha,c,l.jointStyle,l.endCapsStyle,l.miterLimit),r=l.type===FillType.LinearGradient?GradientType.LINEAR:GradientType.RADIAL,o=[],s=0;s<l.colors.length;s++)l.colors[s]=this.rgbaToArgb(l.colors[s]),o[s]=1;for(s=0;s<l.colors.length;s++)o[s]=1;t.style=new GradientFillStyle(r,l.colors,o,l.ratios,l.transform,l.spreadMethod,l.interpolationMode,l.focalPoint/2|0);break;case FillType.ClippedBitmap:case FillType.RepeatingBitmap:case FillType.NonsmoothedClippedBitmap:case FillType.NonsmoothedRepeatingBitmap:l.noHscale,l.noVscale,c=0|clamp(l.width,0,5100),t.style=new GraphicsStrokeStyle(l.color,1,c,l.jointStyle,l.endCapsStyle,l.miterLimit)}}for(;i;)i.storeStartAndEnd(),i=i.prev;for(var u=this.head(),p=u,d=null,_=null,f=u.prev;u;){for(;f;)f.startConnectsTo(u)&&f.flipDirection(),f.connectsTo(u)?(f.next!==u&&(this.removeSegment(f),this.insertSegment(f,u)),f=(u=f).prev):(f.startConnectsTo(p)&&f.flipDirection(),p.connectsTo(f)?(this.removeSegment(f),f=(p.next=f).prev,(p.next.prev=p).next.next=null,p=p.next):f=f.prev);if(f=u.prev,d?((_.next=u).prev=_,(_=p).next=null):(d=u,_=p),!f)break;f=(u=p=f).prev}for(var m={x:0,y:0},f=d;f;)f.isValidFill&&f.serializeAJS(t,e,m),f=f.next;return t}},Mkb),PlainObjectShapeData=function(t,e,i,n,r,o,s,a,l,c,h){this.commands=t,this.commandsPosition=e,this.coordinates=i,this.morphCoordinates=n,this.coordinatesPosition=r,this.styles=o,this.stylesLength=s,this.morphStyles=a,this.morphStylesLength=l,this.hasFills=c,this.hasLines=h},DefaultSize,ylb;function Mkb(t,e){this.fillStyle=t,this.lineStyle=e,this._head=null}function ykb(t,e,i,n,r,o,s){void 0===t&&(t=16777215),void 0===e&&(e=1),void 0===i&&(i=10),void 0===n&&(n=JointStyle.ROUND),void 0===r&&(r=CapsStyle.SQUARE),void 0===o&&(o=10),void 0===s&&(s=LineScaleMode.NORMAL),this._color=t,this._alpha=e,this._thickness=i,this._jointstyle=n,this._capstyle=r,this._miter_limit=o,this.scaleMode=s}function xkb(){}function wkb(){}ylb=DefaultSize=DefaultSize||{},ylb[ylb.Commands=32]="Commands",ylb[ylb.Coordinates=128]="Coordinates",ylb[ylb.Styles=16]="Styles";var ShapeData=(zlb.FromPlainObject=function(t){var e=new zlb(!1);return e.commands=t.commands,e.coordinates=t.coordinates,e.morphCoordinates=t.morphCoordinates,e.commandsPosition=t.commandsPosition,e.coordinatesPosition=t.coordinatesPosition,e.styles=DataBuffer.FromArrayBuffer(t.styles,t.stylesLength),e.styles.endian="auto",t.morphStyles&&(e.morphStyles=DataBuffer.FromArrayBuffer(t.morphStyles,t.morphStylesLength),e.morphStyles.endian="auto"),e.hasFills=t.hasFills,e.hasLines=t.hasLines,e},zlb.prototype.moveTo=function(t,e){this.ensurePathCapacities(1,2),this.commands[this.commandsPosition++]=9,this.coordinates[this.coordinatesPosition++]=t,this.coordinates[this.coordinatesPosition++]=e},zlb.prototype.lineTo=function(t,e){this.ensurePathCapacities(1,2),this.commands[this.commandsPosition++]=10,this.coordinates[this.coordinatesPosition++]=t,this.coordinates[this.coordinatesPosition++]=e},zlb.prototype.curveTo=function(t,e,i,n){this.ensurePathCapacities(1,4),this.commands[this.commandsPosition++]=11,this.coordinates[this.coordinatesPosition++]=t,this.coordinates[this.coordinatesPosition++]=e,this.coordinates[this.coordinatesPosition++]=i,this.coordinates[this.coordinatesPosition++]=n},zlb.prototype.cubicCurveTo=function(t,e,i,n,r,o){this.ensurePathCapacities(1,6),this.commands[this.commandsPosition++]=12,this.coordinates[this.coordinatesPosition++]=t,this.coordinates[this.coordinatesPosition++]=e,this.coordinates[this.coordinatesPosition++]=i,this.coordinates[this.coordinatesPosition++]=n,this.coordinates[this.coordinatesPosition++]=r,this.coordinates[this.coordinatesPosition++]=o},zlb.prototype.beginFill=function(t){this.ensurePathCapacities(1,0),this.commands[this.commandsPosition++]=1,this.styles.writeUnsignedInt(t),this.hasFills=!0},zlb.prototype.writeMorphFill=function(t){this.morphStyles.writeUnsignedInt(t)},zlb.prototype.endFill=function(){this.ensurePathCapacities(1,0),this.commands[this.commandsPosition++]=4},zlb.prototype.endLine=function(){this.ensurePathCapacities(1,0),this.commands[this.commandsPosition++]=8},zlb.prototype.lineStyle=function(t,e,i,n,r,o,s){assert(t===(0|t),0<=t&&t<=5100),this.ensurePathCapacities(2,0),this.commands[this.commandsPosition++]=5,this.coordinates[this.coordinatesPosition++]=t;var a=this.styles;a.writeUnsignedInt(e),a.writeBoolean(i),a.writeUnsignedByte(n),a.writeUnsignedByte(r),a.writeUnsignedByte(o),a.writeUnsignedByte(s),this.hasLines=!0},zlb.prototype.writeMorphLineStyle=function(t,e){this.morphCoordinates[this.coordinatesPosition-1]=t,this.morphStyles.writeUnsignedInt(e)},zlb.prototype.beginBitmap=function(t,e,i,n,r){assert(3===t||7===t),this.ensurePathCapacities(1,0),this.commands[this.commandsPosition++]=t;var o=this.styles;o.writeUnsignedInt(e),this._writeStyleMatrix(i,!1),o.writeBoolean(n),o.writeBoolean(r),this.hasFills=!0},zlb.prototype.writeMorphBitmap=function(t){this._writeStyleMatrix(t,!0)},zlb.prototype.beginGradient=function(t,e,i,n,r,o,s,a){assert(2===t||6===t),this.ensurePathCapacities(1,0),this.commands[this.commandsPosition++]=t;var l=this.styles;l.writeUnsignedByte(n),assert(a===(0|a)),l.writeShort(a),this._writeStyleMatrix(r,!1);var c=e.length;l.writeByte(c);for(var h=0;h<c;h++)l.writeUnsignedByte(i[h]),l.writeUnsignedInt(e[h]);l.writeUnsignedByte(o),l.writeUnsignedByte(s),this.hasFills=!0},zlb.prototype.writeMorphGradient=function(t,e,i){this._writeStyleMatrix(i,!0);for(var n=this.morphStyles,r=0;r<t.length;r++)n.writeUnsignedByte(e[r]),n.writeUnsignedInt(t[r])},zlb.prototype.writeCommandAndCoordinates=function(t,e,i){this.ensurePathCapacities(1,2),this.commands[this.commandsPosition++]=t,this.coordinates[this.coordinatesPosition++]=e,this.coordinates[this.coordinatesPosition++]=i},zlb.prototype.writeCoordinates=function(t,e){this.ensurePathCapacities(0,2),this.coordinates[this.coordinatesPosition++]=t,this.coordinates[this.coordinatesPosition++]=e},zlb.prototype.writeMorphCoordinates=function(t,e){this.morphCoordinates=ensureTypedArrayCapacity(this.morphCoordinates,this.coordinatesPosition),this.morphCoordinates[this.coordinatesPosition-2]=t,this.morphCoordinates[this.coordinatesPosition-1]=e},zlb.prototype.clear=function(){this.commandsPosition=this.coordinatesPosition=0,this.commands=new Uint8Array(DefaultSize.Commands),this.coordinates=new Int32Array(DefaultSize.Coordinates),this.styles=new DataBuffer(DefaultSize.Styles),this.styles.endian="auto",this.hasFills=this.hasLines=!1},zlb.prototype.isEmpty=function(){return 0===this.commandsPosition},zlb.prototype.clone=function(){var t=new zlb(!1);return t.commands=new Uint8Array(this.commands),t.commandsPosition=this.commandsPosition,t.coordinates=new Int32Array(this.coordinates),t.coordinatesPosition=this.coordinatesPosition,t.styles=new DataBuffer(this.styles.length),t.styles.writeRawBytes(this.styles.bytes.subarray(0,this.styles.length)),this.morphStyles&&(t.morphStyles=new DataBuffer(this.morphStyles.length),t.morphStyles.writeRawBytes(this.morphStyles.bytes.subarray(0,this.morphStyles.length))),t.hasFills=this.hasFills,t.hasLines=this.hasLines,t},zlb.prototype.toPlainObject=function(){return new PlainObjectShapeData(this.commands,this.commandsPosition,this.coordinates,this.morphCoordinates,this.coordinatesPosition,this.styles.buffer,this.styles.length,this.morphStyles&&this.morphStyles.buffer,this.morphStyles?this.morphStyles.length:0,this.hasFills,this.hasLines)},Object.defineProperty(zlb.prototype,"buffers",{get:function(){var t=[this.commands.buffer,this.coordinates.buffer,this.styles.buffer];return this.morphCoordinates&&t.push(this.morphCoordinates.buffer),this.morphStyles&&t.push(this.morphStyles.buffer),t},enumerable:!0,configurable:!0}),zlb.prototype._writeStyleMatrix=function(t,e){(e?this.morphStyles:this.styles).write6Floats(t.a,t.b,t.c,t.d,t.tx,t.ty)},zlb.prototype.ensurePathCapacities=function(t,e){this.commands=ensureTypedArrayCapacity(this.commands,this.commandsPosition+t),this.coordinates=ensureTypedArrayCapacity(this.coordinates,this.coordinatesPosition+e)},zlb),DrawMode=(Lmb.BOTH=1,Lmb.STROKE=0,Lmb.FILL=2,Lmb),HitTestCache=function(){this.cells=new Array,this.lastCollisionIndex=-1},TriangleElementsUtils=(Mmb.hitTest=function(t,e,i,n,r,o,s){void 0===s&&(s=0);var a,l,c,h,u,p,d,_,f,m,g=r.positions,y=r.getCustomAtributes("curves"),b=g.stride,v=y?y.stride:null,x=g.get(o,s),A=y?y.get(o,s):null,S=r.indices?(a=r.indices.get(o,s),x=g.get(g.count),A=y?y.get(y.count):null,o*r.indices.dimensions):(x=g.get(o,s),A=y?y.get(o,s):null,o),w=r.hitTestCache[s]||(r.hitTestCache[s]=new HitTestCache),C=w.lastCollisionIndex;if(-1!=C&&C<S)t:if(h=a?(l=a[C+2],c=a[C+1],a[C]):(l=C+2,c=C+1,C),u=x[l*b],p=x[l*b+1],d=x[c*b],_=x[c*b+1],f=x[h*b],m=x[h*b+1],!(0<(u-t)*(_-p)+(p-e)*-(d-u)||0<(d-t)*(m-_)+(_-e)*-(f-d)||0<(f-t)*(p-m)+(m-e)*-(u-f))){if(A&&-128!=A[l*v+2]){var P=(Z=((J=t-u)*(q=m-p)-(H=f-u)*(Q=e-p))/(K=(X=d-u)*q-H*(W=_-p))*.5+(Y=(X*Q-J*W)/K))*Z-Y,E=A[l*v];if(0<P&&-128==E)break t;if(P<0&&127==E)break t}return!0}if(150<S){var T=w.cells,M=T.length?w.divisions:w.divisions=Math.min(Math.ceil(Math.sqrt(S)),32),D=M/n.width,I=M/n.height,O=n.x,L=n.y;if(!T.length){T.length=M*M;for(var F=0;F<S;F+=3){h=a?(l=a[F+2],c=a[F+1],a[F]):(l=F+2,c=F+1,F),u=x[l*b],p=x[l*b+1],d=x[c*b],_=x[c*b+1],f=x[h*b],m=x[h*b+1];for(var B=Math.floor((Math.min(u,d,f)-O)*D),N=Math.floor((Math.min(p,_,m)-L)*I),R=Math.floor((Math.max(u,d,f)-O)*D),V=Math.floor((Math.max(p,_,m)-L)*I),k=B;k<=R;k++)for(var U=N;U<=V;U++){var j,G=k+U*M;(j=T[G]||(T[G]=new Array)).push(F)}}}if(null==(j=T[Math.floor((t-O)*D)+Math.floor((e-L)*I)*M]))return!(w.lastCollisionIndex=-1);for(var z=j.length,$=0;$<z;$++)if(F=j[$],(h=a?a[F]:F)!=C&&(c=a?(l=a[F+2],a[F+1]):(l=F+2,F+1),u=x[l*b],p=x[l*b+1],d=x[c*b],_=x[c*b+1],f=x[h*b],m=x[h*b+1],!(0<(u-t)*(_-p)+(p-e)*-(d-u)||0<(d-t)*(m-_)+(_-e)*-(f-d)||0<(f-t)*(p-m)+(m-e)*-(u-f)))){if(A&&-128!=A[l*v+2]){if(P=(Z=((J=t-u)*(q=m-p)-(H=f-u)*(Q=e-p))/(K=(X=d-u)*q-H*(W=_-p))*.5+(Y=(X*Q-J*W)/K))*Z-Y,E=A[l*v],0<P&&-128==E)continue;if(P<0&&127==E)continue}return w.lastCollisionIndex=F,!0}return!(w.lastCollisionIndex=-1)}for(F=0;F<S;F+=3)if((h=a?a[F]:F)!=C&&(c=a?(l=a[F+2],a[F+1]):(l=F+2,F+1),u=x[l*b],p=x[l*b+1],d=x[c*b],_=x[c*b+1],f=x[h*b],m=x[h*b+1],!(0<(u-t)*(_-p)+(p-e)*-(d-u)||0<(d-t)*(m-_)+(_-e)*-(f-d)||0<(f-t)*(p-m)+(m-e)*-(u-f)))){if(A&&-128!=A[l*v+2]){var X,W,H,q,J,Q,K,Y,Z,P=(Z=((J=t-u)*(q=m-p)-(H=f-u)*(Q=e-p))/(K=(X=d-u)*q-H*(W=_-p))*.5+(Y=(X*Q-J*W)/K))*Z-Y,E=A[l*v];if(0<P&&-128==E)continue;if(P<0&&127==E)continue}return w.lastCollisionIndex=F,!0}return!(w.lastCollisionIndex=-1)},Mmb.getBoxBounds=function(t,e,i,n,r,o,s){void 0===s&&(s=0);var a,l,c=t.dimensions,h=t.stride,u=0,p=0,d=0,_=0,f=0,m=0,g=e?(l=o*e.dimensions,a=e.get(o,s),t.get(t.count)):(l=o,t.get(o,s));if(0==l)return r;var y,b,v,x,A,S=0;for(i&&(A=i._rawData),null==r?(r=n||new Box,y=a?a[S]*h:S*h,i?3==c?(b=g[y]*A[0]+g[y+1]*A[4]+g[y+2]*A[8]+A[12],v=g[y]*A[1]+g[y+1]*A[5]+g[y+2]*A[9]+A[13],x=g[y]*A[2]+g[y+1]*A[6]+g[y+2]*A[10]+A[14]):(b=g[y]*A[0]+g[y+1]*A[4]+A[12],v=g[y]*A[1]+g[y+1]*A[5]+A[13]):(b=g[y],v=g[y+1],x=3==c?g[y+2]:0),_=u=b,f=p=v,m=d=3==c?x:0,S++):(_=(u=r.x)+r.width,f=(p=r.y)+r.height,m=(d=r.z)+r.depth);S<l;S++)y=a?a[S]*h:S*h,i?3==c?(b=g[y]*A[0]+g[y+1]*A[4]+g[y+2]*A[8]+A[12],v=g[y]*A[1]+g[y+1]*A[5]+g[y+2]*A[9]+A[13],x=g[y]*A[2]+g[y+1]*A[6]+g[y+2]*A[10]+A[14]):(b=g[y]*A[0]+g[y+1]*A[4]+A[12],v=g[y]*A[1]+g[y+1]*A[5]+A[13]):(b=g[y],v=g[y+1],x=3==c?g[y+2]:0),b<u?u=b:_<b&&(_=b),v<p?p=v:f<v&&(f=v),3==c&&(x<d?d=x:m<x&&(m=x));return r.width=_-(r.x=u),r.height=f-(r.y=p),r.depth=m-(r.z=d),r},Mmb.getSphereBounds=function(t,e,i,n,r,o,s){void 0===s&&(s=0);for(var a,l,c,h,u=t.get(o,s),p=t.dimensions,d=t.stride,_=0,f=o*d,m=0;m<f;m+=d)_<(a=(l=u[m]-e.x)*l+(c=u[m+1]-e.y)*c+(h=3==p?u[m+2]-e.z:-e.z)*h)&&(_=a);return null==r&&(r=new Sphere),r.x=e.x,r.y=e.y,r.z=e.z,r.radius=Math.sqrt(_),r},Mmb.updateTriangleGraphicsSlice9=function(t,e,i,n,r,o){if(void 0===r&&(r=!1),void 0===o&&(o=!1),9!=t.slice9Indices.length)throw"ElementUtils: Error - triangleElement does not provide valid slice9Indices!";var s,a=t.slice9Indices.length,l=e.width-(t.slice9offsets.x+t.slice9offsets.width)/i,c=e.height-(t.slice9offsets.y+t.slice9offsets.height)/n;if(l<0&&(l=0,i=(t.slice9offsets.x+t.slice9offsets.width)/e.width),c<0&&(c=0,n=(t.slice9offsets.y+t.slice9offsets.height)/e.height),o){for(var h=new Uint8Array(8*t.positions.count);_<2*t.positions.count;)h[_]=s[_++],h[_]=s[_++];var u,p=new AttributesBuffer(8,t.positions.count);p.bufferView=h,(u=new TriangleElements(p)).setPositions(new Float2Attributes(p)),u.slice9offsets=t.slice9offsets,u.initialSlice9Positions=t.initialSlice9Positions,u.slice9Indices=t.slice9Indices,s=u.positions.get(u.positions.count),_=0}else s=t.positions.get(t.positions.count);var d,_=0;if(r){for((d=[]).length=2*t.positions.count;_<2*t.positions.count;)d[_]=s[_++],d[_]=s[_++];t.initialSlice9Positions=d}else d=t.initialSlice9Positions;var f=t.slice9Indices,m=0,_=0,g=[];g.length=3;var y=[];y.length=3,g[0]=e.x,g[1]=e.x+t.slice9offsets.x/i,g[2]=e.x+t.slice9offsets.x/i+l,y[0]=e.y,y[1]=e.y+t.slice9offsets.y/n,y[2]=e.y+t.slice9offsets.y/n+c;for(var b=-1,v=0,x=0,A=0,S=0,w=0,m=0;m<a;m++)for(2==b&&(v++,b=-1),x=1==v?l:1/i,A=1==++b?c:1/n,S=g[v],w=y[b];_<f[m];)s[_]=S+d[_++]*x,s[_]=w+d[_++]*A;return o?(u.positions.invalidate(),u):(t.positions.invalidate(),t)},Mmb),ElementsBase=(Zob=AssetBase,__extends($ob,Zob),Object.defineProperty($ob.prototype,"concatenatedBuffer",{get:function(){return this._concatenatedBuffer},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"indices",{get:function(){return this._indices},enumerable:!0,configurable:!0}),$ob.prototype.getCustomAtributesNames=function(){return this._customAttributesNames},$ob.prototype.getCustomAtributes=function(t){return this._customAttributes[t]},Object.defineProperty($ob.prototype,"numElements",{get:function(){return this._numElements},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"numVertices",{get:function(){return this._numVertices},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"condensedIndexLookUp",{get:function(){return this._condensedIndexLookUp},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"autoDeriveNormals",{get:function(){return this._autoDeriveNormals},set:function(t){this._autoDeriveNormals!=t&&(this._autoDeriveNormals=t)},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"autoDeriveTangents",{get:function(){return this._autoDeriveTangents},set:function(t){this._autoDeriveTangents!=t&&(this._autoDeriveTangents=t)},enumerable:!0,configurable:!0}),Object.defineProperty($ob.prototype,"useCondensedIndices",{get:function(){return this._useCondensedIndices},set:function(t){this._useCondensedIndices!=t&&(this._useCondensedIndices=t)},enumerable:!0,configurable:!0}),$ob.prototype.copyTo=function(t){for(var e in this.indices&&t.setIndices(this.indices.clone()),this._customAttributes)t.setCustomAttributes(e,this.getCustomAtributes(e).clone())},$ob.prototype.dispose=function(){for(var t in this.clear(),this._indices&&(this._indices.dispose(),this._indices=null),this._customAttributes)this._customAttributes[t].dispose(),delete this._customAttributes},$ob.prototype.setIndices=function(t,e){void 0===e&&(e=0),t instanceof Short3Attributes?(this._indices&&this.clearIndices(),this._indices=t):t?(this._indices||(this._indices=new Short3Attributes),this._indices.set(t,e)):this._indices&&(this._indices.dispose(),this._indices=null,this.clearIndices()),this._indices?(this._numElements=this._indices.count,this.invalidateIndices()):this._numElements=0},$ob.prototype.setCustomAttributes=function(t,e,i){if(void 0===i&&(i=0),e!=this._customAttributes[t]){if(e instanceof AttributesView)this.clearVertices(this._customAttributes[t]),this._customAttributes[t]=e;else if(e)this._customAttributes[t]||(this._customAttributes[t]=new Float3Attributes(this._concatenatedBuffer)),this._customAttributes[t].set(e,i);else if(this._customAttributes[t])return this.clearVertices(this._customAttributes[t]),this._customAttributesNames.splice(this._customAttributesNames.indexOf(t),1),void delete this._customAttributes[t];this.invalidateVertices(this._customAttributes[t]),this._verticesDirty[this._customAttributes[t].id]=!1,-1==this._customAttributesNames.indexOf(t)&&this._customAttributesNames.push(t)}},$ob.prototype.clone=function(){throw new AbstractMethodError},$ob.prototype.applyTransformation=function(t,e,i){throw new AbstractMethodError},$ob.prototype.scale=function(t,e,i){throw new AbstractMethodError},$ob.prototype.scaleUV=function(t,e,i,n){throw new AbstractMethodError},$ob.prototype.getBoxBounds=function(t,e,i,n,r,o,s,a){throw new AbstractMethodError},$ob.prototype.getSphereBounds=function(t,e,i,n,r,o,s,a){throw new AbstractMethodError},$ob.prototype.hitTestPoint=function(t,e,i,n,r,o,s,a){throw new AbstractMethodError},$ob.prototype.invalidateIndices=function(){this._invalidateIndices||(this._invalidateIndices=new ElementsEvent(ElementsEvent.INVALIDATE_INDICES,this._indices)),this.dispatchEvent(this._invalidateIndices)},$ob.prototype.clearIndices=function(){this.dispatchEvent(new ElementsEvent(ElementsEvent.CLEAR_INDICES,this._indices))},$ob.prototype.invalidateVertices=function(t){t&&!this._verticesDirty[t.id]&&(this._verticesDirty[t.id]=!0,this._invalidateVertices[t.id]||(this._invalidateVertices[t.id]=new ElementsEvent(ElementsEvent.INVALIDATE_VERTICES,t)),this.dispatchEvent(this._invalidateVertices[t.id]))},$ob.prototype.clearVertices=function(t){t&&(t.dispose(),this.dispatchEvent(new ElementsEvent(ElementsEvent.CLEAR_VERTICES,t)),this._verticesDirty[t.id]=null,this._invalidateVertices[t.id]=null)},$ob.prototype.testCollision=function(t,e,i,n,r,o,s){throw new AbstractMethodError},$ob),TriangleElements=(cqb=ElementsBase,__extends(dqb,cqb),dqb.prototype.updateSlice9=function(t,e){},Object.defineProperty(dqb.prototype,"assetType",{get:function(){return dqb.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"jointsPerVertex",{get:function(){return this._jointsPerVertex},set:function(t){this._jointsPerVertex!=t&&(this._jointsPerVertex=t,this._jointIndices&&(this._jointIndices.dimensions=this._jointsPerVertex),this._jointWeights&&(this._jointWeights.dimensions=this._jointsPerVertex))},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"positions",{get:function(){return this._positions||this.setPositions(new Float3Attributes(this._concatenatedBuffer)),this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"normals",{get:function(){return this._normals&&!this._verticesDirty[this._normals.id]||this.setNormals(this._normals),this._normals},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"tangents",{get:function(){return this._tangents&&!this._verticesDirty[this._tangents.id]||this.setTangents(this._tangents),this._tangents},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"faceNormals",{get:function(){return this._faceNormalsDirty&&this.updateFaceNormals(),this._faceNormals},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"faceTangents",{get:function(){return this._faceTangentsDirty&&this.updateFaceTangents(),this._faceTangents},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"uvs",{get:function(){var t,e;return!this._uvs&&dqb.isIE&&((t=new AttributesView(Float32Array,2)).set(this._positions.get(this._positions.count)),e=t.attributesBuffer,this._uvs=new Float2Attributes(e),t.dispose()),this._uvs},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"jointIndices",{get:function(){return this._jointIndices},enumerable:!0,configurable:!0}),Object.defineProperty(dqb.prototype,"jointWeights",{get:function(){return this._jointWeights},enumerable:!0,configurable:!0}),dqb.prototype.getBoxBounds=function(t,e,i,n,r,o,s,a){return void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=0),void 0===a&&(a=0),TriangleElementsUtils.getBoxBounds(this.positions,this.indices,n,r,o,s||this._numElements||this._numVertices,a)},dqb.prototype.getSphereBounds=function(t,e,i,n,r,o,s,a){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=0),void 0===a&&(a=0),TriangleElementsUtils.getSphereBounds(this.positions,e,i,r,o,s||this._numVertices,a)},dqb.prototype.hitTestPoint=function(t,e,i,n,r,o,s,a,l,c){return void 0===s&&(s=0),void 0===a&&(a=0),TriangleElementsUtils.hitTest(i,n,0,o,this,s||this._numElements||this._numVertices,a)},dqb.prototype.setPositions=function(t,e){void 0===e&&(e=0),t!=this._positions&&(t instanceof AttributesView?(this.clearVertices(this._positions),this._positions=t):t?(this._positions||(this._positions=new Float3Attributes(this._concatenatedBuffer)),this._positions.set(t,e)):(this.clearVertices(this._positions),this._positions=new Float3Attributes(this._concatenatedBuffer)),this._numVertices=this._positions.count,this._autoDeriveNormals&&this.invalidateVertices(this._normals),this._autoDeriveTangents&&this.invalidateVertices(this._tangents),this.invalidateVertices(this._positions),this._verticesDirty[this._positions.id]=!1)},dqb.prototype.setNormals=function(t,e){if(void 0===e&&(e=0),this._autoDeriveNormals)this._normals=ElementsUtils.generateNormals(this.indices,this.faceNormals,this._normals,this._concatenatedBuffer);else{if(t==this._normals)return;if(t instanceof Float3Attributes)this.clearVertices(this._normals),this._normals=t;else if(t)this._normals||(this._normals=new Float3Attributes(this._concatenatedBuffer)),this._normals.set(t,e);else if(this._normals)return this.clearVertices(this._normals),void(this._normals=null)}this.invalidateVertices(this._normals),this._verticesDirty[this._normals.id]=!1},dqb.prototype.setTangents=function(t,e){if(void 0===e&&(e=0),this._autoDeriveTangents)this._tangents=ElementsUtils.generateTangents(this.indices,this.faceTangents,this.faceNormals,this._tangents,this._concatenatedBuffer);else{if(t==this._tangents)return;if(t instanceof Float3Attributes)this.clearVertices(this._tangents),this._tangents=t;else if(t)this._tangents||(this._tangents=new Float3Attributes(this._concatenatedBuffer)),this._tangents.set(t,e);else if(this._tangents)return this.clearVertices(this._tangents),void(this._tangents=null)}this.invalidateVertices(this._tangents),this._verticesDirty[this._tangents.id]=!1},dqb.prototype.setUVs=function(t,e){if(void 0===e&&(e=0),t!=this._uvs){if(t instanceof AttributesView)this.clearVertices(this._uvs),this._uvs=t;else if(t)this._uvs||(this._uvs=new Float2Attributes(this._concatenatedBuffer)),this._uvs.set(t,e);else if(this._uvs)return this.clearVertices(this._uvs),void(this._uvs=null);this.invalidateVertices(this._uvs),this._verticesDirty[this._uvs.id]=!1}},dqb.prototype.setJointIndices=function(t,e){if(void 0===e&&(e=0),t!=this._jointIndices){if(t instanceof AttributesView)this.clearVertices(this._jointIndices),this._jointIndices=t;else if(t){if(this._jointIndices||(this._jointIndices=new AttributesView(Float32Array,this._jointsPerVertex,this._concatenatedBuffer)),this._useCondensedIndices){var i,n=0,r=0,o=new Object;for(this._condensedIndexLookUp=new Array;n<t.length;)null==o[i=t[n]]&&(o[i]=r,this._condensedIndexLookUp[r++]=i),t[n++]=o[i]}this._jointIndices.set(t,e)}else if(this._jointIndices)return this.clearVertices(this._jointIndices),void(this._jointIndices=null);this.invalidateVertices(this._jointIndices),this._verticesDirty[this._jointIndices.id]=!1}},dqb.prototype.setJointWeights=function(t,e){if(void 0===e&&(e=0),t!=this._jointWeights){if(t instanceof AttributesView)this.clearVertices(this._jointWeights),this._jointWeights=t;else if(t)this._jointWeights||(this._jointWeights=new AttributesView(Float32Array,this._jointsPerVertex,this._concatenatedBuffer)),this._jointWeights.set(t,e);else if(this._jointWeights)return this.clearVertices(this._jointWeights),void(this._jointWeights=null);this.invalidateVertices(this._jointWeights),this._verticesDirty[this._jointWeights.id]=!1}},dqb.prototype.dispose=function(){cqb.prototype.dispose.call(this),this._positions&&(this._positions.dispose(),this._positions=null),this._normals&&(this._normals.dispose(),this._normals=null),this._tangents&&(this._tangents.dispose(),this._tangents=null),this._uvs&&(this._uvs.dispose(),this._uvs=null),this._jointIndices&&(this._jointIndices.dispose(),this._jointIndices=null),this._jointWeights&&(this._jointWeights.dispose(),this._jointWeights=null),this._faceNormals&&(this._faceNormals.dispose(),this._faceNormals=null),this._faceTangents&&(this._faceTangents.dispose(),this._faceTangents=null)},dqb.prototype.setIndices=function(t,e){void 0===e&&(e=0),cqb.prototype.setIndices.call(this,t,e),this._faceNormalsDirty=!0,this._faceTangentsDirty=!0,this._autoDeriveNormals&&this.invalidateVertices(this._normals),this._autoDeriveTangents&&this.invalidateVertices(this._tangents)},dqb.prototype.copyTo=function(t){cqb.prototype.copyTo.call(this,t);var e=this._autoDeriveNormals,i=this._autoDeriveTangents;t.autoDeriveNormals=this._autoDeriveNormals=!1,t.autoDeriveTangents=this._autoDeriveTangents=!1,t.setPositions(this.positions.clone()),this.normals&&t.setNormals(this.normals.clone()),this.tangents&&t.setTangents(this.tangents.clone()),this.uvs&&t.setUVs(this.uvs.clone()),t.jointsPerVertex=this._jointsPerVertex,this.jointIndices&&t.setJointIndices(this.jointIndices.clone()),this.jointWeights&&t.setJointWeights(this.jointWeights.clone()),t.autoDeriveNormals=this._autoDeriveNormals=e,t.autoDeriveTangents=this._autoDeriveTangents=i,this.slice9Indices&&(t.originalSlice9Size=this.originalSlice9Size,t.slice9offsets=this.slice9offsets,t.slice9Indices=this.slice9Indices,t.initialSlice9Positions=this.initialSlice9Positions)},dqb.prototype.clone=function(){var t=new dqb(this._concatenatedBuffer?this._concatenatedBuffer.clone():null);return this.copyTo(t),t},dqb.prototype.scaleUV=function(t,e,i,n){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),this.uvs&&ElementsUtils.scale(t,e,0,this.uvs,i||this._numVertices,n)},dqb.prototype.scale=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),ElementsUtils.scale(t,t,t,this.positions,e||this._numVertices,i)},dqb.prototype.applyTransformation=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),ElementsUtils.applyTransformation(t,this.positions,this.normals,this.tangents,e||this._numVertices,i)},dqb.prototype.updateFaceTangents=function(){this._faceTangents=ElementsUtils.generateFaceTangents(this.indices,this.positions,this.uvs||this.positions,this._faceTangents,this.numElements),this._faceTangentsDirty=!1},dqb.prototype.updateFaceNormals=function(){this._faceNormals=ElementsUtils.generateFaceNormals(this.indices,this.positions,this._faceNormals,this.numElements),this._faceNormalsDirty=!1},dqb.prototype.testCollision=function(t,e,i,n,r,o,s){void 0===s&&(s=0);var a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A,S,w,C,P,E,T,M,D,I,O,L,F,B,N,R,V,k,U,j,G,z=e.rayPosition,$=e.rayDirection,X=-1,W=r.bothSides,H=this.positions.get(o,s),q=this.positions.dimensions,J=this.positions.stride;this.indices&&(o=(G=this.indices.get(this.numElements)).length);for(var Q=0;Q<o;Q+=3)if(h=G?(l=G[Q]*J,c=G[Q+1]*J,G[Q+2]*J):(l=Q*J,c=(Q+1)*J,(Q+2)*J),w=H[l],T=H[c]-w,I=H[h]-w,C=H[l+1],M=H[c+1]-C,O=H[h+1]-C,3==q?(P=H[l+2],E=H[c+2],_=M*(L=H[h+2]-P)-(D=E-P)*O,f=D*I-T*L,m=T*O-M*I,_*=F=1/Math.sqrt(_*_+f*f+m*m),f*=F,m*=F):m=(f=_=L=D=E=P=0)<T*O-M*I?1:-1,B=_*$.x+f*$.y+m*$.z,!W&&B<0||W&&0!=B){if(N=-(_*w+f*C+m*P),a=-(_*z.x+f*z.y+m*z.z+N)/B,U=(u=(g=z.x+a*$.x)-w)*T+(p=(y=z.y+a*$.y)-C)*M+(d=(b=z.z+a*$.z)-P)*D,j=u*I+p*O+d*L,v=1/((V=T*T+M*M+D*D)*(k=I*I+O*O+L*L)-(R=T*I+M*O+D*L)*R),!isFinite(v))continue;if(S=v*(-R*U+V*j),(A=v*(k*U-R*j))<0)continue;if(S<0)continue;if(!((x=1-A-S)<0)&&0<a&&a<e.rayEntryDistance){var K,Y,Z,tt,et,it,X=Q/3;if(e.rayEntryDistance=a,e.position=new Vector3D(g,y,b),e.normal=new Vector3D(_,f,m),this.uvs&&(K=this.uvs.get(this.numVertices),Y=this.uvs.stride,tt=G?G[Q]*Y:Q*Y,Z=new Vector3D(K[tt],K[tt+1]),tt=G?G[Q+1]*Y:(Q+1)*Y,et=new Vector3D(K[tt],K[tt+1]),tt=G?G[Q+2]*Y:(Q+2)*Y,it=new Vector3D(K[tt],K[tt+1]),e.uv=new Point(x*Z.x+A*et.x+S*it.x,x*Z.y+A*et.y+S*it.y)),e.elementIndex=X,!n)return!0}}return 0<=X},dqb.isIE=!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g),dqb.assetType="[asset TriangleElements]",dqb),_Stage_TriangleElements=(rsb=_Stage_ElementsBase,__extends(ssb,rsb),ssb.prototype.onClear=function(t){rsb.prototype.onClear.call(this,t),this._triangleElements=null},ssb.prototype._setRenderState=function(t,e){rsb.prototype._setRenderState.call(this,t,e),0<=e.normalIndex&&this._triangleElements.autoDeriveNormals&&this._triangleElements.normals,0<=e.tangentIndex&&this._triangleElements.autoDeriveTangents&&this._triangleElements.tangents,0<=e.curvesIndex&&this.activateVertexBufferVO(e.curvesIndex,this._triangleElements.getCustomAtributes("curves")),0<=e.uvIndex&&this.activateVertexBufferVO(e.uvIndex,this._triangleElements.uvs||this._triangleElements.positions),0<=e.secondaryUVIndex&&this.activateVertexBufferVO(e.secondaryUVIndex,this._triangleElements.getCustomAtributes("secondaryUVs")||this._triangleElements.uvs||this._triangleElements.positions),0<=e.normalIndex&&this.activateVertexBufferVO(e.normalIndex,this._triangleElements.normals),0<=e.tangentIndex&&this.activateVertexBufferVO(e.tangentIndex,this._triangleElements.tangents),0<=e.jointIndexIndex&&this.activateVertexBufferVO(e.jointIndexIndex,this._triangleElements.jointIndices),0<=e.jointWeightIndex&&this.activateVertexBufferVO(e.jointIndexIndex,this._triangleElements.jointWeights),this.activateVertexBufferVO(0,this._triangleElements.positions)},ssb.prototype.draw=function(t,e,i,n){var r;0<=e.sceneMatrixIndex?(e.sceneMatrix.copyFrom(t.renderSceneTransform,!0),e.viewMatrix.copyFrom(e.view.viewMatrix3D,!0)):((r=Matrix3D.CALCULATION_MATRIX).copyFrom(t.renderSceneTransform),r.append(e.view.viewMatrix3D),e.viewMatrix.copyFrom(r,!0));var o=this._stage.context;o.setProgramConstantsFromArray(ContextGLProgramType.VERTEX,e.vertexConstantData),o.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,e.fragmentConstantData),this._indices?this.getIndexBufferGL().draw(ContextGLDrawMode.TRIANGLES,3*n,3*i||this.numIndices):this._stage.context.drawVertices(ContextGLDrawMode.TRIANGLES,n,i||this.numVertices)},ssb.prototype._pGetOverflowElements=function(){return new ssb(this._triangleElements,this._stage)},ssb),_Render_TriangleElements=(Fsb=_Render_ElementsBase,__extends(Gsb,Fsb),Gsb.prototype._includeDependencies=function(t){},Gsb.prototype._getVertexCode=function(t,e,i){var n,r="",o=0<t.globalPosDependencies?i.globalPositionVertex:i.animatedPosition,s=e.getFreeVertexConstant();return e.getFreeVertexConstant(),e.getFreeVertexConstant(),e.getFreeVertexConstant(),t.viewMatrixIndex=4*s.index,0<t.projectionDependencies?(i.projectionFragment=e.getFreeVarying(),r+="m44 "+(n=e.getFreeVertexVectorTemp())+", "+o+", "+s+"\nmov "+i.projectionFragment+", "+n+"\nmov op, "+n+"\n"):r+="m44 op, "+o+", "+s+"\n",r},Gsb.prototype._getFragmentCode=function(t,e,i){return""},Gsb),Fsb,rsb,cqb,Zob;function Gsb(){return null!==Fsb&&Fsb.apply(this,arguments)||this}function ssb(t,e){var i=rsb.call(this,t,e)||this;return i._triangleElements=t,i}function dqb(){var t=null!==cqb&&cqb.apply(this,arguments)||this;return t._faceNormalsDirty=!0,t._faceTangentsDirty=!0,t.hitTestCache=new Object,t}function $ob(t){void 0===t&&(t=null);var e=Zob.call(this)||this;return e._customAttributesNames=new Array,e._customAttributes=new Object,e._autoDeriveNormals=!0,e._autoDeriveTangents=!0,e._numElements=0,e._numVertices=0,e._verticesDirty=new Object,e._invalidateVertices=new Object,e.usages=0,e._concatenatedBuffer=t,e}function Mmb(){}function Lmb(){}function zlb(t){void 0===t&&(t=!0),t&&this.clear()}RenderGroup.registerElements(_Render_TriangleElements,TriangleElements),Stage.registerAbstraction(_Stage_TriangleElements,TriangleElements);var LineElementsUtils=(Ssb.hitTest=function(t,e,i,n,r,o,s,a){void 0===a&&(a=0);var l,c,h,u=o.positions,p=u.stride,d=u.get(s,a),_=o.indices?(l=o.indices.get(s,a),d=u.get(u.count),s*o.indices.dimensions):(d=u.get(s,a),s),f=o.hitTestCache[a]||(o.hitTestCache[a]=new HitTestCache),m=f.lastCollisionIndex;if(-1!=m&&m<_){U=l?(c=l[m]*p,l[m+1]*p):(c=m*p,(m+1)*p),j=d[c],G=d[c+1],z=d[U];var g=j-t,y=G-e,b=(h=d[U+1])-G,v=-(z-j),x=Math.sqrt(b*b+v*v);if(!(Math.abs(g*b+y*v)>n*x||(k=g*v-y*b)>x*x||k<0))return!0}if(150<_){var A=f.cells,S=A.length?f.divisions:f.divisions=Math.min(Math.ceil(Math.sqrt(_)),32),w=S/r.width,C=S/r.height,P=r.x,E=r.y;if(!A.length){A.length=S*S;for(var T=0;T<_;T+=3){U=l?(c=l[T]*p,l[T+1]*p):(c=T*p,(T+1)*p),j=d[c],G=d[c+1],z=d[U],h=d[U+1];for(var M=Math.floor((Math.min(j,z)-P)*w),D=Math.floor((Math.min(G,h)-E)*C),I=Math.floor((Math.max(j,z)-P)*w),O=Math.floor((Math.max(G,h)-E)*C),L=M;L<=I;L++)for(var F=D;F<=O;F++){var B,N=L+F*S;(B=A[N]||(A[N]=new Array)).push(T)}}}if(null==(B=A[Math.floor((t-P)*w)+Math.floor((e-E)*C)*S]))return!(f.lastCollisionIndex=-1);for(var R=B.length,V=0;V<R;V++)if(T=B[V],U=l?(c=l[T]*p,l[T+1]*p):(c=T*p,(T+1)*p),j=d[c],G=d[c+1],z=d[U],g=j-t,y=G-e,b=(h=d[U+1])-G,v=-(z-j),x=Math.sqrt(b*b+v*v),!(Math.abs(g*b+y*v)>n*x||(k=g*v-y*b)>x*x||k<0))return f.lastCollisionIndex=T,!0;return!(f.lastCollisionIndex=-1)}for(T=0;T<_;T+=6){var k,U=l?(c=l[T]*p,l[T+1]*p):(c=T*p,(T+1)*p),j=d[c],G=d[c+1],z=d[U],g=j-t,y=G-e,b=(h=d[U+1])-G,v=-(z-j),x=Math.sqrt(b*b+v*v);if(!(Math.abs(g*b+y*v)>n*x||(k=g*v-y*b)>x*x||k<0))return f.lastCollisionIndex=T,!0}return!(f.lastCollisionIndex=-1)},Ssb.getBoxBounds=function(t,e,i,n,r,o,s,a){void 0===a&&(a=0);var l,c,h=t.dimensions,u=t.stride,p=0,d=0,_=0,f=0,m=e?(c=s*e.dimensions,l=e.get(s,a),t.get(t.count)):(c=s,t.get(s,a));if(0==c)return o;var g,y,b,v,x=0;for(i&&(v=i._rawData),x=0;x<c;x+=3)g=l?l[x]*u:x*u,i?6==h?(y=m[g]*v[0]+m[1+g]*v[4]+m[2+g]*v[8]+v[12],b=m[g]*v[1]+m[1+g]*v[5]+m[2+g]*v[9]+v[13],m[g],v[2],m[1+g],v[6],m[2+g],v[10],v[14]):(y=m[g]*v[0]+m[1+g]*v[4]+v[12],b=m[g]*v[1]+m[1+g]*v[5]+v[13]):(y=m[g],b=m[1+g],6==h&&m[2+g]),0==x?(_=p=y,f=d=b):(y<p?p=y:_<y&&(_=y),b<d?d=b:f<b&&(f=b));var A=i?n.x*v[0]+n.y*v[4]:n.x,S=i?n.x*v[1]+n.y*v[5]:n.y,w=new Box(p-A,d-S);return w.right=_+A,w.bottom=f+S,w.union(o,o||r)},Ssb.getSphereBounds=function(t,e,i,n,r,o,s){void 0===s&&(s=0);for(var a,l,c,h,u=t.get(o,s),p=t.dimensions,d=t.stride,_=0,f=o*d,m=0;m<f;m+=d)_<(a=(l=u[m]-e.x)*l+(c=u[m+1]-e.y)*c+(h=6==p?u[m+2]-e.z:-e.z)*h)&&(_=a);return null==r&&(r=new Sphere),r.x=e.x,r.y=e.y,r.z=e.z,r.radius=Math.sqrt(_),r},Ssb),LineElements=(xub=ElementsBase,__extends(yub,xub),yub.prototype.getThicknessScale=function(t,e,i){return i||this.stroke.scaleMode!=LineScaleMode.HAIRLINE?(e?this._thicknessScale.copyFrom(e.transform.concatenatedMatrix3D.decompose()[3]):this._thicknessScale.identity(),this._thicknessScale.x*=t.focalLength*t.pixelRatio/1e3,this._thicknessScale.y*=t.focalLength/1e3,this.stroke&&this.stroke.scaleMode==LineScaleMode.NORMAL?(this._thicknessScale.x=!i||.5<this.stroke.half_thickness*this._thicknessScale.x?this.stroke.half_thickness:.5/this._thicknessScale.x,this._thicknessScale.y=!i||.5<this.stroke.half_thickness*this._thicknessScale.y?this.stroke.half_thickness:.5/this._thicknessScale.y):this.stroke&&this.stroke.scaleMode!=LineScaleMode.HAIRLINE||(this._thicknessScale.x=.5/this._thicknessScale.x,this._thicknessScale.y=.5/this._thicknessScale.y)):this._thicknessScale.identity(),this._thicknessScale},Object.defineProperty(yub.prototype,"assetType",{get:function(){return yub.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(yub.prototype,"positions",{get:function(){return this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(yub.prototype,"thickness",{get:function(){return this._thickness},enumerable:!0,configurable:!0}),Object.defineProperty(yub.prototype,"colors",{get:function(){return this._colors||this.setColors(this._colors),this._colors},enumerable:!0,configurable:!0}),yub.prototype.getBoxBounds=function(t,e,i,n,r,o,s,a){return void 0===e&&(e=null),void 0===i&&(i=!1),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=0),void 0===a&&(a=0),LineElementsUtils.getBoxBounds(this.positions,this.indices,n,this.getThicknessScale(t,e,i),r,o,s||this._numElements||this._numVertices,a)},yub.prototype.getSphereBounds=function(t,e,i,n,r,o,s,a){return void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=0),void 0===a&&(a=0),LineElementsUtils.getSphereBounds(this.positions,e,i,r,o,s||this._numVertices,a)},yub.prototype.hitTestPoint=function(t,e,i,n,r,o,s,a,l,c){void 0===s&&(s=0),void 0===a&&(a=0);var h=this.getThicknessScale(t,e,!0),u=(h.x+h.y)/2;return LineElementsUtils.hitTest(i,n,0,u,o,this,s||this._numElements||this._numVertices,a)},yub.prototype.setPositions=function(t,e){if(void 0===e&&(e=0),t instanceof AttributesView)this.clearVertices(this._positions),this._positions=t;else if(t){for(var i,n=0,r=0,o=0,s=new Float32Array(4*t.length),a=new Uint16Array(t.length);n<t.length;)o/6&1?(s[o]=t[n+3],s[o+1]=t[n+4],s[o+2]=t[n+5],s[o+3]=t[n],s[o+4]=t[n+1],s[o+5]=t[n+2]):(s[o]=t[n],s[o+1]=t[n+1],s[o+2]=t[n+2],s[o+3]=t[n+3],s[o+4]=t[n+4],s[o+5]=t[n+5]),o+=6,4==++r&&(i=o/6-4,a.set([i,1+i,2+i,3+i,2+i,1+i],n),r=0,n+=6);this._positions.set(s,4*e),this.setIndices(a,e)}else this.clearVertices(this._positions),this._positions=new AttributesView(Float32Array,6,this._concatenatedBuffer);this._numVertices=this._positions.count,this.invalidateVertices(this._positions),this._verticesDirty[this._positions.id]=!1},yub.prototype.setThickness=function(t,e){if(void 0===e&&(e=0),t instanceof Float1Attributes)this._thickness=t;else if(t){this._thickness||(this._thickness=new Float1Attributes(this._concatenatedBuffer));for(var i=0,n=0,r=0,o=new Float32Array(4*t.length);i<t.length;)o[r]=1&Math.floor(.5*r+.5)?-t[i]:t[i],4==++n&&(n=0,i++),r++;this._thickness.set(o,4*e)}else this._thickness&&(this._thickness.dispose(),this._thickness=null);this.invalidateVertices(this._thickness),this._verticesDirty[this._thickness.id]=!1},yub.prototype.setColors=function(t,e){if(void 0===e&&(e=0),t){if(t==this._colors)return;if(t instanceof Byte4Attributes)this.clearVertices(this._colors),this._colors=t;else{this._colors||(this._colors=new Byte4Attributes(this._concatenatedBuffer));for(var i=0,n=0,r=0,o=new Uint8Array(4*t.length);i<t.length;)r/4&1?(o[r]=t[i+4],o[r+1]=t[i+5],o[r+2]=t[i+6],o[r+3]=t[i+7]):(o[r]=t[i],o[r+1]=t[i+1],o[r+2]=t[i+2],o[r+3]=t[i+3]),4==++n&&(n=0,i+=8),r+=4;this._colors.set(o,4*e)}}else this._colors=ElementsUtils.generateColors(this.indices,this._colors,this._concatenatedBuffer,this._numVertices);this.invalidateVertices(this._colors),this._verticesDirty[this._colors.id]=!1},yub.prototype.dispose=function(){xub.prototype.dispose.call(this),this._positions.dispose(),this._positions=null,this._thickness&&(this._thickness.dispose(),this._thickness=null),this._colors&&(this._colors.dispose(),this._colors=null)},yub.prototype.clone=function(){var t=new yub(this._concatenatedBuffer?this._concatenatedBuffer.clone():null);return t.setIndices(this.indices.clone()),t.setPositions(this._positions.clone()),t.setThickness(this._thickness.clone()),t.setColors(this._colors.clone()),t},yub.prototype.testCollision=function(t,e,i,n,r,o,s){void 0===s&&(s=0);var a=this.getThicknessScale(t,e.entity,!0),l=(a.x+a.y)/2,c=-e.rayPosition.z/e.rayDirection.z,h=new Vector3D(e.rayPosition.x+c*e.rayDirection.x,e.rayPosition.y+c*e.rayDirection.y);return!!LineElementsUtils.hitTest(h.x,h.y,0,l,i,this,this._numElements,s)&&(e.rayEntryDistance=c,e.position=h,e.normal=new Vector3D(0,0,1),!0)},yub.assetType="[asset LineElements]",yub),_Stage_LineElements=(Kvb=_Stage_ElementsBase,__extends(Lvb,Kvb),Lvb.prototype.onClear=function(t){Kvb.prototype.onClear.call(this,t),this._lineElements=null},Lvb.prototype._setRenderState=function(t,e){Kvb.prototype._setRenderState.call(this,t,e);var i=e.view,n=t.renderGroup.getRenderElements(t.stageElements.elements);0<=e.colorBufferIndex&&this.activateVertexBufferVO(e.colorBufferIndex,this._lineElements.colors),this.activateVertexBufferVO(0,this._lineElements.positions,3),this.activateVertexBufferVO(n.secondaryPositionIndex,this._lineElements.positions,3,12),this.activateVertexBufferVO(n.thicknessIndex,this._lineElements.thickness),0<=e.uvIndex&&this.activateVertexBufferVO(e.uvIndex,this._lineElements.positions,2);var r=n._dataIndex,o=e.vertexConstantData;o[r+4]=1,o[r+5]=1,o[r+6]=1,o[r+7]=1,o[r+10]=-1,this._scale.copyFrom(t.sourceEntity.transform.concatenatedMatrix3D.decompose()[3]);var s=this._lineElements.stroke;s&&s.scaleMode==LineScaleMode.NORMAL?(o[r+12]=s.half_thickness*this._scale.x*this._thickness/1e3>.5/(i.focalLength*i.pixelRatio)?this._scale.x*this._thickness/1e3:.5/(s.half_thickness*i.focalLength*i.pixelRatio),o[r+13]=s.half_thickness*this._scale.y*this._thickness/1e3>.5/i.focalLength?this._scale.y*this._thickness/1e3:.5/(s.half_thickness*i.focalLength)):s&&s.scaleMode!=LineScaleMode.HAIRLINE?(o[r+12]=this._thickness/Math.min(i.width,i.height),o[r+13]=this._thickness/Math.min(i.width,i.height)):(o[r+12]=this._thickness/(i.focalLength*i.pixelRatio),o[r+13]=this._thickness/i.focalLength),o[r+14]=i.projection.near,this._stage.context},Lvb.prototype.draw=function(t,e,i,n){var r=this._stage.context;e.viewMatrix.copyFrom(e.view.frustumMatrix3D,!0);var o=Matrix3D.CALCULATION_MATRIX;o.copyFrom(t.sourceEntity.transform.concatenatedMatrix3D),o.append(e.view.projection.transform.inverseConcatenatedMatrix3D),e.sceneMatrix.copyFrom(o,!0),r.setProgramConstantsFromArray(ContextGLProgramType.VERTEX,e.vertexConstantData),r.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,e.fragmentConstantData),this._indices?this.getIndexBufferGL().draw(ContextGLDrawMode.TRIANGLES,3*n,3*i||this.numIndices):this._stage.context.drawVertices(ContextGLDrawMode.TRIANGLES,n,i||this.numVertices)},Lvb.prototype._pGetOverflowElements=function(){return new Lvb(this._lineElements,this._stage)},Lvb),_Render_LineElements=(bwb=_Render_ElementsBase,__extends(cwb,bwb),cwb.prototype._includeDependencies=function(t){},cwb.prototype._getVertexCode=function(t,e,i){var n=0<t.globalPosDependencies?i.globalPositionVertex:i.animatedPosition,r=e.getFreeVertexAttribute();this.secondaryPositionIndex=r.index;var o=e.getFreeVertexAttribute();this.thicknessIndex=o.index;var s=e.getFreeVertexConstant();e.getFreeVertexConstant(),e.getFreeVertexConstant(),e.getFreeVertexConstant(),t.viewMatrixIndex=4*s.index;var a=e.getFreeVertexConstant();this._dataIndex=4*a.index;var l=e.getFreeVertexConstant(),c=e.getFreeVertexConstant(),h=e.getFreeVertexConstant(),u=e.getFreeVertexConstant();e.getFreeVertexConstant(),e.getFreeVertexConstant(),e.getFreeVertexConstant(),t.sceneMatrixIndex=4*u.index;var p=e.getFreeVertexVectorTemp();e.addVertexTempUsages(p,1);var d=e.getFreeVertexVectorTemp();e.addVertexTempUsages(d,1);var _=e.getFreeVertexVectorTemp();e.addVertexTempUsages(_,1);var f=e.getFreeVertexVectorTemp();e.addVertexTempUsages(f,1);var m=e.getFreeVertexVectorTemp();e.addVertexTempUsages(m,1);var g=e.getFreeVertexVectorTemp();e.addVertexTempUsages(g,1);var y="m44 "+p+", "+n+", "+u+"\t\t\t\nm44 "+d+", "+r+", "+u+"\t\t\t\nsub "+_+", "+d+", "+p+" \t\t\t\nslt "+f+".x, "+p+".z, "+h+".z\t\t\t\nsub "+f+".y, "+l+".x, "+f+".x\t\t\t\nadd "+g+".x, "+p+".z, "+h+".z\t\t\t\nsub "+g+".y, "+p+".z, "+d+".z\t\t\t\nseq "+g+".z, "+g+".y "+c+".x\t\t\t\nadd "+g+".y, "+g+".y, "+g+".z\t\t\t\ndiv "+g+".z, "+g+".x, "+g+".y\t\t\t\nmul "+g+".xyz, "+g+".zzz, "+_+".xyz\t\nadd "+m+".xyz, "+p+".xyz, "+g+".xyz\t\nmov "+m+".w, "+l+".x\t\t\t\nmul "+p+", "+p+", "+f+".yyyy\t\t\t\nmul "+m+", "+m+", "+f+".xxxx\t\t\t\nadd "+p+", "+p+", "+m+"\t\t\t\t\nnrm "+_+".xyz, "+_+".xyz\t\t\t\nnrm "+f+".xyz, "+p+".xyz\t\t\t\nmov "+f+".w, "+l+".x\t\t\t\t\ncrs "+m+".xyz, "+_+", "+f+"\t\t\t\nnrm "+m+".xyz, "+m+".xyz\t\t\t\nmul "+m+".xyz, "+m+".xyz, "+o+".xxx\t\nmov "+m+".w, "+l+".x\t\t\t\ndp3 "+g+".x, "+p+", "+c+"\t\t\t\nmul "+m+".xyz, "+m+".xyz, "+g+".xxx\t\nmul "+m+".xyz, "+m+".xyz, "+h+".xy\t\nadd "+p+".xyz, "+p+".xyz, "+m+".xyz\t\nm44 op, "+p+", "+s+"\t\t\t\n";return e.removeVertexTempUsage(p),e.removeVertexTempUsage(d),e.removeVertexTempUsage(_),e.removeVertexTempUsage(f),e.removeVertexTempUsage(m),e.removeVertexTempUsage(g),y},cwb.prototype._getFragmentCode=function(t,e,i){return""},cwb),bwb,Kvb,xub;function cwb(){var t=null!==bwb&&bwb.apply(this,arguments)||this;return t.secondaryPositionIndex=-1,t.thicknessIndex=-1,t}function Lvb(t,e){var i=Kvb.call(this,t,e)||this;return i._scale=new Vector3D,i._thickness=1,i._lineElements=t,i}function yub(t){void 0===t&&(t=null);var e=xub.call(this,t)||this;return e._thicknessScale=new Vector3D,e.hitTestCache=new Object,e._positions=new AttributesView(Float32Array,6,t),e}function Ssb(){}RenderGroup.registerElements(_Render_LineElements,LineElements),Stage.registerAbstraction(_Stage_LineElements,LineElements);var Shape=(Bwb=AssetBase,__extends(Cwb,Bwb),Cwb.getShape=function(t,e,i,n,r){if(void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=0),Cwb._pool.length){var o=Cwb._pool.pop();return o.elements=t,o.material=e,o.style=i,o.count=n,o.offset=r,o}return new Cwb(t,e,i,n,r)},Cwb.clearPool=function(){Cwb._pool=[]},Object.defineProperty(Cwb.prototype,"elements",{get:function(){return this._elements},set:function(t){this._elements!=t&&(this._elements&&(this._elements.removeEventListener(ElementsEvent.INVALIDATE_VERTICES,this._onInvalidateVerticesDelegate),this._elements.usages--,this._elements.usages||this._elements.dispose()),this._elements=t,this._elements&&(this._elements.addEventListener(ElementsEvent.INVALIDATE_VERTICES,this._onInvalidateVerticesDelegate),this._elements.usages++),this.invalidateElements())},enumerable:!0,configurable:!0}),Object.defineProperty(Cwb.prototype,"assetType",{get:function(){return Cwb.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Cwb.prototype,"material",{get:function(){return this._material},set:function(t){this._material!=t&&(this._material=t,this.invalidateMaterial())},enumerable:!0,configurable:!0}),Object.defineProperty(Cwb.prototype,"style",{get:function(){return this._style},set:function(t){this._style!=t&&(this._style&&this._style.removeEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this._style=t,this._style&&this._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this.invalidateStyle())},enumerable:!0,configurable:!0}),Cwb.prototype.dispose=function(){Bwb.prototype.clear.call(this),this.usages=0,this.elements=null,this.material=null,this.style=null,this.particleCollection=null,Cwb._pool.push(this)},Cwb.prototype.invalidateElements=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_ELEMENTS,this))},Cwb.prototype.invalidateMaterial=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_MATERIAL,this))},Cwb.prototype.invalidateStyle=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_STYLE,this))},Cwb.prototype._onInvalidateProperties=function(t){this.invalidateStyle()},Cwb.prototype._onInvalidateVertices=function(t){t.attributesView==t.target.positions&&this.invalidate()},Cwb.prototype.applyTransformation=function(t){this._elements.applyTransformation(t,this.count,this.offset)},Cwb.prototype.scale=function(t){this._elements.scale(t,this.count,this.offset)},Cwb.prototype.scaleUV=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1),this._elements.scaleUV(t,e,this.count,this.offset)},Cwb._pool=new Array,Cwb.assetType="[asset Shape]",Cwb),_Render_Shape=($wb=_Render_RenderableBase,__extends(_wb,$wb),_wb.prototype.onClear=function(t){$wb.prototype.onClear.call(this,t),this.shape=null},_wb.prototype._getStageElements=function(){return this._offset=this.shape.offset,this._count=this.shape.count,this._stage.getAbstraction(this.sourceEntity.animator?this.sourceEntity.animator.getRenderableElements(this,this.shape.elements):this.shape.elements)},_wb.prototype._getRenderMaterial=function(){return this.renderGroup.getRenderElements(this.shape.elements).getAbstraction(this._asset.material||this.sourceEntity.material||this.getDefaultMaterial())},_wb.prototype._getStyle=function(){return this._asset.style||this.sourceEntity.style},_wb.prototype.getDefaultMaterial=function(){return this.stageElements.elements instanceof LineElements?MaterialUtils.getDefaultColorMaterial():MaterialUtils.getDefaultTextureMaterial()},_wb),_Pick_Shape=(exb=_Pick_PickableBase,__extends(fxb,exb),fxb.prototype.onInvalidate=function(t){exb.prototype.onInvalidate.call(this,t),this._orientedBoxBoundsDirty=!0,this._orientedSphereBoundsDirty=!0},fxb.prototype._onInvalidateElements=function(t){this._orientedBoxBoundsDirty=!0,this._orientedSphereBoundsDirty=!0},fxb.prototype.onClear=function(t){this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate),exb.prototype.onClear.call(this,t)},fxb.prototype.hitTestPoint=function(t,e,i){var n=this.getBoxBounds();return!(null==n||!n.contains(t,e,i))&&this._asset.elements.hitTestPoint(this._view,this.sourceEntity,t,e,i,n,this._asset.count,this._asset.offset)},fxb.prototype.getBoxBounds=function(t,e,i,n){return void 0===t&&(t=null),void 0===e&&(e=!0),void 0===i&&(i=null),void 0===n&&(n=null),t?this._asset.elements.getBoxBounds(this._view,this.sourceEntity,e,t,i,n,this._asset.count,this._asset.offset):(this._orientedBoxBoundsDirty&&(this._orientedBoxBoundsDirty=!1,this._orientedBoxBounds=this._asset.elements.getBoxBounds(this._view,this.sourceEntity,e,null,this._orientedBoxBounds,null,this._asset.count,this._asset.offset)),null!=this._orientedBoxBounds&&(n=this._orientedBoxBounds.union(n,n||i)),n)},fxb.prototype.getSphereBounds=function(t,e,i,n,r){return void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=null),e?this._asset.elements.getSphereBounds(this._view,t,e,i,n,r,this._asset.count,this._asset.offset):(this._orientedSphereBoundsDirty&&(this._orientedSphereBoundsDirty=!1,this._orientedSphereBounds=this._asset.elements.getSphereBounds(this._view,t,null,i,this._orientedSphereBounds,null,this._asset.count,this._asset.offset)),null!=this._orientedSphereBounds&&(r=this._orientedSphereBounds.union(r,r||n)),r)},fxb.prototype.testCollision=function(t,e){var i=this.getBoxBounds();return!(null==i||!i.rayIntersection(t.rayPosition,t.rayDirection))&&this._asset.elements.testCollision(this._view,t,i,e,this._asset.material||t.entity.material,this._asset.count||this._asset.elements.numVertices,this._asset.offset)},fxb),exb,$wb,Bwb;function fxb(t,e){var i=exb.call(this,t,e)||this;return i._orientedBoxBoundsDirty=!0,i._orientedSphereBoundsDirty=!0,i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)},i._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate),i}function _wb(t,e){var i=$wb.call(this,t,e)||this;return i.shape=t,i}function Cwb(t,e,i,n,r){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=0),void 0===r&&(r=0);var o=Bwb.call(this)||this;return o.usages=0,o._onInvalidatePropertiesDelegate=function(t){return o._onInvalidateProperties(t)},o._onInvalidateVerticesDelegate=function(t){return o._onInvalidateVertices(t)},o._elements=t,o._elements.addEventListener(ElementsEvent.INVALIDATE_VERTICES,o._onInvalidateVerticesDelegate),o._elements.usages++,o._material=e,o._style=i,o._style&&o._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES,o._onInvalidatePropertiesDelegate),o.count=n,o.offset=r,o}RenderEntity.registerRenderable(_Render_Shape,Shape),PickEntity.registerPickable(_Pick_Shape,Shape);var TextureAtlas=(Dxb.clearAllMaterials=function(){for(var t in Dxb._allColors)Dxb._allColors[t].material=null;for(var t in Dxb._allGradients)Dxb._allGradients[t].material=null},Dxb.getTextureForColor=function(t,e){var i=t.toString()+"#"+e.toString();if(Dxb._allColors.hasOwnProperty(i))return Dxb._allColors[i];for(var n,r=Dxb._allTextureAtlas.length,o=0,o=0;o<r;o++)if(Dxb._allTextureAtlas[o].fit_color()){n=Dxb._allTextureAtlas[o];break}n||(n=new Dxb,Dxb._allTextureAtlas.push(n));var s={colorPos:n.draw_color(t,e),bitmap:n.bitmap,material:null,uvRectangle:null};return Dxb._allColors[i]=s},Dxb.getTextureForGradient=function(t){var e=t.toString();if(Dxb._allGradients.hasOwnProperty(e))return t.uvRectangle=Dxb._allGradients[e].uvRectangle,Dxb._allGradients[e];for(var i,n=Dxb._allTextureAtlas.length,r=0,r=0;r<n;r++)if(Dxb._allTextureAtlas[r].fit_gradient()){i=Dxb._allTextureAtlas[r];break}i||(i=new Dxb,Dxb._allTextureAtlas.push(i)),i.draw_gradient(t);var o={colorPos:null,bitmap:i.bitmap,material:null,uvRectangle:new Rectangle};return o.uvRectangle.copyFrom(t.uvRectangle),Dxb._allGradients[e]=o},Dxb.prototype.fit_gradient=function(){return 0<this.availableRows},Dxb.prototype.fit_color=function(){return 0<this.availableColors||0<this.availableRows},Dxb.prototype.draw_gradient=function(t){if(!(this.availableRows<0)){var e;for(this.gradient_row++,this.availableRows--,e=0;e<256;e++)this.bitmap.setPixelFromArray(e,this.gradient_row,t.getColorAtPosition(e));return this.bitmap.invalidate(),t.uvRectangle.x=1/512,t.uvRectangle.y=1/512+this.gradient_row/256,t.uvRectangle.width=1-1/512,t.uvRectangle.height=t.uvRectangle.y,this.availableRows}console.log("error in TextureAtlasManager.draw_color")},Dxb.prototype.draw_color=function(t,e){void 0===e&&(e=1),this.color_position--,this.color_position<0&&(0<this.availableRows?(this.color_row--,this.availableRows--,this.color_position=255):console.log("error in TextureAtlasManager.draw_color"));var i=ColorUtils.float32ColorToARGB(t);return i[0]=e,this.bitmap.setPixelFromArray(this.color_position,this.color_row,i),this.bitmap.invalidate(),new Point(1/512+this.color_position/256,1/512+this.color_row/256)},Dxb._allTextureAtlas=[],Dxb._allGradients={},Dxb._allColors={},Dxb),MaterialManager=(Xxb._colorMaterials={},Xxb._textureMaterials={},Xxb._useTextureAtlasForColors=!0,Xxb.get_material_for_color=function(t,e){var i;if(void 0===e&&(e=1),0==t&&(t=1),16744704==t&&(e=1),!Xxb.materialClass)throw"no materialClass registered on MaterialManager!";if(Xxb._useTextureAtlasForColors)return i=TextureAtlas.getTextureForColor(t,e),Xxb._colorMaterials[i.bitmap.id]?i.material=Xxb._colorMaterials[i.bitmap.id]:((n=new Xxb.materialClass(i.bitmap)).alphaBlending=!0,n.useColorTransform=!0,n.bothSides=!0,Xxb._colorMaterials[i.bitmap.id]=n,i.material=n),i;i={};var n,r=t+"_"+Math.round(100*e).toString();return Xxb._colorMaterials[r]?i.material=Xxb._colorMaterials[r]:((n=new Xxb.materialClass(t,e)).alphaBlending=!0,n.useColorTransform=!0,n.bothSides=!0,i.material=n,Xxb._colorMaterials[r]=n),i},Xxb.get_material_for_gradient=function(t){if(!Xxb.materialClass)throw"no materialClass registered on MaterialManager!";var e=TextureAtlas.getTextureForGradient(t),i=e.bitmap.id.toString()+t.type.toString();if(Xxb._textureMaterials[i])return e.material=Xxb._textureMaterials[i],e;var n=new Xxb.materialClass(e.bitmap);return n.useColorTransform=!0,n.alphaBlending=!0,n.bothSides=!0,Xxb._textureMaterials[i]=n,e.material=n,e},Xxb.get_material_for_BitmapImage2D=function(t){var e=new Xxb.materialClass(t);return e.ambientMethod.texture=new Xxb.textureClass(t),e.alphaBlending=!0,e.useColorTransform=!0,e.bothSides=!0,e},Xxb),GraphicsFactoryHelper=(hyb.drawRectangles=function(t,e,i){if(!(0<t.length%4)){var n=[];n.length=t.length/4*12;for(var r=0,o=0,s=t.length,a=0,l=0,c=0,h=0,r=0;r<s;r+=4)a=t[r],l=t[r+1],c=t[r+2],h=t[r+3],n[o++]=a,n[o++]=l,n[o++]=a+c,n[o++]=l,n[o++]=a+c,n[o++]=l+h,n[o++]=a,n[o++]=l,n[o++]=a,n[o++]=l+h,n[o++]=a+c,n[o++]=l+h;var u=MaterialManager.get_material_for_color(e,i),p=u.material,d=new AttributesView(Float32Array,p.curves?3:2);d.set(n);var _=d.attributesBuffer.cloneBufferView();d.dispose();var f=new TriangleElements(_);f.setPositions(new Float2Attributes(_));var m,g=Shape.getShape(f,p);return u.colorPos&&(g.style=new Style,m=new ImageSampler,p.animateUVs=!0,g.style.color=e,g.style.addSamplerAt(m,p.getTextureAt(0)),g.style.uvMatrix=new Matrix(0,0,0,0,u.colorPos.x,u.colorPos.y)),g}console.log("GraphicsFactoryHelper.drawRectangles: inputRectangles.length is not a multiple of 4",t)},hyb.updateRectanglesShape=function(t,e){var i=[];i.length=e.length/4*12;for(var n=0,r=0,o=e.length,s=0,a=0,l=0,c=0,n=0;n<o;n+=4)s=e[n],a=e[n+1],l=e[n+2],c=e[n+3],i[r++]=s,i[r++]=a,i[r++]=s+l,i[r++]=a,i[r++]=s+l,i[r++]=a+c,i[r++]=s,i[r++]=a,i[r++]=s,i[r++]=a+c,i[r++]=s+l,i[r++]=a+c;var h=t.elements;h.concatenatedBuffer.count=i.length/2,h.setPositions(i),h.invalidate()},hyb.isClockWiseXY=function(t,e,i,n,r,o){return!((t-i)*(o-n)-(e-n)*(r-i)<0)},hyb.getSign=function(t,e,i,n,r,o){return(t-r)*(n-o)-(e-o)*(i-r)},hyb.pointInTri=function(t,e,i,n,r,o,s,a){var l=0<hyb.getSign(t,e,s,a,i,n),c=0<hyb.getSign(i,n,s,a,r,o),h=0<hyb.getSign(r,o,s,a,t,e);return l==c&&c==h},hyb.getControlXForCurveX=function(t,e,i){return e},hyb.getControlYForCurveY=function(t,e,i){return e},hyb.drawPoint=function(t,e,i,n){hyb.addTriangle(t-2,e-2,t+2,e-2,t+2,e+2,0,i,n),hyb.addTriangle(t-2,e-2,t-2,e+2,t+2,e+2,0,i,n)},hyb.drawElipse=function(t,e,i,n,r,o,s,a,l){for(var c=(s-o)/a,h=t+i*Math.cos(o*(Math.PI/180)),u=e+n*Math.sin(o*(Math.PI/180)),p=1;p<=c;p++){var d=t+i*Math.cos((o+p*a)*(Math.PI/180)),_=e+n*Math.sin((o+p*a)*(Math.PI/180));hyb.addTriangle(t,e,d,_,h,u,0,r,l),h=d,u=_}},hyb.drawElipseStrokes=function(t,e,i,n,r,o,s,a,l,c){for(var h=(s-o)/a,u=t+(i+l)*Math.cos(o*(Math.PI/180)),p=e+(n+l)*Math.sin(o*(Math.PI/180)),d=t+(i-l)*Math.cos(o*(Math.PI/180)),_=e+(n-l)*Math.sin(o*(Math.PI/180)),f=1;f<=h;f++){var m=t+(i+l)*Math.cos((o+f*a)*(Math.PI/180)),g=e+(n+l)*Math.sin((o+f*a)*(Math.PI/180)),y=t+(i-l)*Math.cos((o+f*a)*(Math.PI/180)),b=e+(n-l)*Math.sin((o+f*a)*(Math.PI/180));hyb.addTriangle(m,g,y,b,u,p,0,r,c),hyb.addTriangle(d,_,y,b,u,p,0,r,c),u=m,p=g,d=y,_=b}},hyb.addTriangle=function(t,e,i,n,r,o,s,a,l){var c=t,h=e,u=i,p=n,d=r,_=o;hyb.isClockWiseXY(c,h,u,p,d,_)&&(t=d,e=_,i=u,n=p,r=c,o=h);var f=a.length;0==s?(a[f++]=t,a[f++]=e,l&&(a[f++]=45736980577097704e-57),a[f++]=i,a[f++]=n,l&&(a[f++]=45736980577097704e-57),a[f++]=r,a[f++]=o,l&&(a[f++]=45736980577097704e-57)):s<0?(a[f++]=t,a[f++]=e,l&&(a[f++]=11708844992641982e-54),a[f++]=i,a[f++]=n,l&&(a[f++]=22778106537599901e-57),a[f++]=r,a[f++]=o,l&&(a[f++]=17796490496925177e-59)):0<s&&(a[f++]=t,a[f++]=e,l&&(a[f++]=11708846393940446e-54),a[f++]=i,a[f++]=n,l&&(a[f++]=22779507836064226e-57),a[f++]=r,a[f++]=o,l&&(a[f++]=1793662034335766e-58))},hyb.createCap=function(t,e,i,n,r,o,s,a,l,c,h,u,p,d){var _,f,m,g;s*=c,a*=c,l==CapsStyle.ROUND?(m=r+s*h,g=o+a*u,hyb.tesselateCurve(i,n,i+s*h,n+a*u,_=t+s*h,f=e+a*u,p,!0),hyb.tesselateCurve(_,f,m,g,r,o,p,!0),hyb.addTriangle(i,n,_,f,r,o,-1,p,d)):l==CapsStyle.SQUARE&&(hyb.addTriangle(m=r+s*h,g=o+a*u,i+s*h,n+a*u,i,n,0,p,d),hyb.addTriangle(m,g,i,n,r,o,0,p,d))},hyb.getLineFormularData=function(t,e){var i=e.x-t.x,n=e.y-t.y,r=new Point;return 0!=i&&0!=n&&(r.x=n/i),r.y=-(r.x*t.x-t.y),r},hyb.getQuadricBezierPosition=function(t,e,i,n){var r=1-t;return r*r*e+2*r*t*i+t*t*n},hyb.subdivideCurve=function(t,e,i,n,r,o,s,a,l,c,h,u,p,d){var _=Math.atan2(n-e,i-t)*MathConsts.RADIANS_TO_DEGREES,f=Math.atan2(o-n,r-i)*MathConsts.RADIANS_TO_DEGREES-_;if(180<f&&(f-=360),f<-180&&(f+=360),175<=Math.abs(f))return p.push(t,e,i,n,r,o),void d.push(s,a,l,c,h,u);if(f<0?(hyb.getSign(t,e,l,c,r,o),hyb.getSign(t,e,i,n,r,o),((e-o)*(i-t)+(r-t)*(n-e))*((e-o)*(l-t)+(r-t)*(c-e))<0):(hyb.getSign(s,a,l,c,h,u),hyb.getSign(s,a,i,n,h,u),((a-o)*(i-s)+(h-s)*(n-a))*((a-u)*(l-s)+(h-s)*(c-a))<0))return p.push(t,e,i,n,r,o),void d.push(s,a,l,c,h,u);var m=t+.5*(i-t),g=e+.5*(n-e),y=i+.5*(r-i),b=n+.5*(o-n),v=m+.5*(y-m),x=g+.5*(b-g),A=s+.5*(l-s),S=a+.5*(c-a),w=l+.5*(h-l),C=c+.5*(u-c),P=A+.5*(w-A),E=S+.5*(C-S);hyb.subdivideCurve(t,e,m,g,v,x,s,a,A,S,P,E,p,d),hyb.subdivideCurve(v,x,y,b,r,o,P,E,w,C,h,u,p,d)},hyb.tesselateCurve=function(t,e,i,n,r,o,s,a,l){if(void 0===a&&(a=!1),void 0===l&&(l=0),6<=l)return a?void s.push(t,e,i,n,r,o):void s.push(i,n,r,o);for(var c=Math.atan2(n-e,i-t)*MathConsts.RADIANS_TO_DEGREES,h=Math.atan2(o-n,r-i)*MathConsts.RADIANS_TO_DEGREES-c;180<h;)h-=360;for(;h<-180;)h+=360;var u=r-t,p=o-e,d=Math.sqrt(u*u+p*p),_=t+.5*(i-t),f=e+.5*(n-e),m=i+.5*(r-i),g=n+.5*(o-n),y=_+.5*(m-_),b=f+.5*(g-f);Math.abs(h)<=1||d<1?a?s.push(t,e,y,b,r,o):s.push(r,o):(a&&s.push(t,e,y,b,r,o),hyb.tesselateCurve(t,e,_,f,y,b,s,a,++l),hyb.tesselateCurve(y,b,m,g,r,o,s,a,l))},hyb),Tess2={},tess2=Tess2;function hyb(){}function Xxb(){}function Dxb(){this.availableRows=256,this.gradient_row=-1,this.color_row=255,this.color_position=256,this.availableGradients=256,this.availableColors=0,this.bitmap=new BitmapImage2D(256,256,!0,16711680),this.availableRows=256,this.availableColors=0}Tess2.WINDING_ODD=0,Tess2.WINDING_NONZERO=1,Tess2.WINDING_POSITIVE=2,Tess2.WINDING_NEGATIVE=3,Tess2.WINDING_ABS_GEQ_TWO=4,Tess2.POLYGONS=0,Tess2.CONNECTED_POLYGONS=1,Tess2.BOUNDARY_CONTOURS=2,Tess2.tesselate=function(t){for(var e=t.debug||!1,i=new Tesselator,n=0;n<t.contours.length;n++)i.addContour(t.vertexSize||2,t.contours[n]);return i.tesselate(t.windingRule||Tess2.WINDING_ODD,t.elementType||Tess2.POLYGONS,t.polySize||3,t.vertexSize||2,t.normal||[0,0,1]),{vertices:i.vertices,vertexIndices:i.vertexIndices,vertexCount:i.vertexCount,elements:i.elements,elementCount:i.elementCount,mesh:e?i.mesh:void 0}};var assert$1=function(t){if(!t)throw"Assertion Failed!"};function TESSvertex(){this.next=null,this.prev=null,this.anEdge=null,this.coords=[0,0,0],this.s=0,this.t=0,this.pqHandle=0,this.n=0,this.idx=0}function TESSface(){this.next=null,this.prev=null,this.anEdge=null,this.trail=null,this.n=0,this.marked=!1,this.inside=!1}function TESShalfEdge(t){this.next=null,this.Sym=null,this.Onext=null,this.Lnext=null,this.Org=null,this.Lface=null,this.activeRegion=null,this.winding=0,this.side=t}function TESSmesh(){var t=new TESSvertex,e=new TESSface,i=new TESShalfEdge(0),n=new TESShalfEdge(1);(t.next=t.prev=t).anEdge=null,(e.next=e.prev=e).anEdge=null,e.trail=null,e.marked=!1,e.inside=!1,(i.next=i).Sym=n,i.Onext=null,i.Lnext=null,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,(n.next=n).Sym=i,n.Onext=null,n.Lnext=null,n.Org=null,n.Lface=null,n.winding=0,n.activeRegion=null,this.vHead=t,this.fHead=e,this.eHead=i,this.eHeadSym=n}TESShalfEdge.prototype={get Rface(){return this.Sym.Lface},set Rface(t){this.Sym.Lface=t},get Dst(){return this.Sym.Org},set Dst(t){this.Sym.Org=t},get Oprev(){return this.Sym.Lnext},set Oprev(t){this.Sym.Lnext=t},get Lprev(){return this.Onext.Sym},set Lprev(t){this.Onext.Sym=t},get Dprev(){return this.Lnext.Sym},set Dprev(t){this.Lnext.Sym=t},get Rprev(){return this.Sym.Onext},set Rprev(t){this.Sym.Onext=t},get Dnext(){return this.Sym.Onext.Sym},set Dnext(t){this.Sym.Onext.Sym=t},get Rnext(){return this.Sym.Lnext.Sym},set Rnext(t){this.Sym.Lnext.Sym=t}},TESSmesh.prototype={makeEdge_:function(t){var e=new TESShalfEdge(0),i=new TESShalfEdge(1);t.Sym.side<t.side&&(t=t.Sym);var n=t.Sym.next;return(((i.next=n).Sym.next=e).next=t).Sym.next=i,e.Sym=i,(e.Onext=e).Lnext=i,e.Org=null,e.Lface=null,e.winding=0,e.activeRegion=null,i.Sym=e,(i.Onext=i).Lnext=e,i.Org=null,i.Lface=null,i.winding=0,i.activeRegion=null,e},splice_:function(t,e){var i=t.Onext,n=e.Onext;i.Sym.Lnext=e,(n.Sym.Lnext=t).Onext=n,e.Onext=i},makeVertex_:function(t,e,i){var n=t;assert$1(null!==n);for(var r=i.prev,o=((((n.prev=r).next=n).next=i).prev=n).anEdge=e;o.Org=n,(o=o.Onext)!==e;);},makeFace_:function(t,e,i){var n=t;assert$1(null!==n);var r=i.prev;((((n.prev=r).next=n).next=i).prev=n).anEdge=e,n.trail=null,n.marked=!1,n.inside=i.inside;for(var o=e;o.Lface=n,(o=o.Lnext)!==e;);},killEdge_:function(t){t.Sym.side<t.side&&(t=t.Sym);var e=t.next,i=t.Sym.next;(e.Sym.next=i).Sym.next=e},killVertex_:function(t,e){for(var i=t.anEdge,n=i;n.Org=e,(n=n.Onext)!==i;);var r=t.prev,o=t.next;(o.prev=r).next=o},killFace_:function(t,e){for(var i=t.anEdge,n=i;n.Lface=e,(n=n.Lnext)!==i;);var r=t.prev,o=t.next;(o.prev=r).next=o},makeEdge:function(){var t=new TESSvertex,e=new TESSvertex,i=new TESSface,n=this.makeEdge_(this.eHead);return this.makeVertex_(t,n,this.vHead),this.makeVertex_(e,n.Sym,this.vHead),this.makeFace_(i,n,this.fHead),n},splice:function(t,e){var i,n,r=!1,o=!1;t!==e&&(e.Org!==t.Org&&(o=!0,this.killVertex_(e.Org,t.Org)),e.Lface!==t.Lface&&(r=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(e,t),o||(i=new TESSvertex,this.makeVertex_(i,e,t.Org),t.Org.anEdge=t),r||(n=new TESSface,this.makeFace_(n,e,t.Lface),t.Lface.anEdge=t))},delete:function(t){var e,i=t.Sym,n=!1;t.Lface!==t.Rface&&(n=!0,this.killFace_(t.Lface,t.Rface)),t.Onext===t?this.killVertex_(t.Org,null):(t.Rface.anEdge=t.Oprev,t.Org.anEdge=t.Onext,this.splice_(t,t.Oprev),n||(e=new TESSface,this.makeFace_(e,t,t.Lface))),i.Onext===i?(this.killVertex_(i.Org,null),this.killFace_(i.Lface,null)):(t.Lface.anEdge=i.Oprev,i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev)),this.killEdge_(t)},addEdgeVertex:function(t){var e=this.makeEdge_(t),i=e.Sym;this.splice_(e,t.Lnext),e.Org=t.Dst;var n=new TESSvertex;return this.makeVertex_(n,i,e.Org),e.Lface=i.Lface=t.Lface,e},splitEdge:function(t,e){var i=this.addEdgeVertex(t).Sym;return this.splice_(t.Sym,t.Sym.Oprev),this.splice_(t.Sym,i),t.Dst=i.Org,i.Dst.anEdge=i.Sym,i.Rface=t.Rface,i.winding=t.winding,i.Sym.winding=t.Sym.winding,i},connect:function(t,e){var i,n=!1,r=this.makeEdge_(t),o=r.Sym;return e.Lface!==t.Lface&&(n=!0,this.killFace_(e.Lface,t.Lface)),this.splice_(r,t.Lnext),this.splice_(o,e),r.Org=t.Dst,o.Org=e.Org,r.Lface=o.Lface=t.Lface,t.Lface.anEdge=o,n||(i=new TESSface,this.makeFace_(i,r,t.Lface)),r},zapFace:function(t){for(var e,i,n,r,o=t.anEdge,s=o.Lnext;s=(e=s).Lnext,(e.Lface=null)===e.Rface&&(e.Onext===e?this.killVertex_(e.Org,null):(e.Org.anEdge=e.Onext,this.splice_(e,e.Oprev)),(i=e.Sym).Onext===i?this.killVertex_(i.Org,null):(i.Org.anEdge=i.Onext,this.splice_(i,i.Oprev)),this.killEdge_(e)),e!=o;);n=t.prev,((r=t.next).prev=n).next=r},countFaceVerts_:function(t){for(var e=t.anEdge,i=0;i++,(e=e.Lnext)!==t.anEdge;);return i},mergeConvexFaces:function(t){for(var e,i,n,r,o=this.fHead.next;o!==this.fHead;o=o.next)if(o.inside)for(r=(e=o.anEdge).Org;i=e.Lnext,(n=e.Sym)&&n.Lface&&n.Lface.inside&&this.countFaceVerts_(o)+this.countFaceVerts_(n.Lface)-2<=t&&Geom.vertCCW(e.Lprev.Org,e.Org,n.Lnext.Lnext.Org)&&Geom.vertCCW(n.Lprev.Org,n.Org,e.Lnext.Lnext.Org)&&(i=n.Lnext,this.delete(n),n=e=null),!e||e.Lnext.Org!==r;)e=i;return!0},check:function(){var t,e,i,n,r,o=this.fHead,s=this.vHead,a=this.eHead,l=o;for(l=o;(t=l.next)!==o;l=t)for(assert$1(t.prev===l),n=t.anEdge;assert$1(n.Sym!==n),assert$1(n.Sym.Sym===n),assert$1(n.Lnext.Onext.Sym===n),assert$1(n.Onext.Sym.Lnext===n),assert$1(n.Lface===t),(n=n.Lnext)!==t.anEdge;);for(assert$1(t.prev===l&&null===t.anEdge),i=i=s;(e=i.next)!==s;i=e)for(assert$1(e.prev===i),n=e.anEdge;assert$1(n.Sym!==n),assert$1(n.Sym.Sym===n),assert$1(n.Lnext.Onext.Sym===n),assert$1(n.Onext.Sym.Lnext===n),assert$1(n.Org===e),(n=n.Onext)!==e.anEdge;);for(assert$1(e.prev===i&&null===e.anEdge),r=r=a;(n=r.next)!==a;r=n)assert$1(n.Sym.next===r.Sym),assert$1(n.Sym!==n),assert$1(n.Sym.Sym===n),assert$1(null!==n.Org),assert$1(null!==n.Dst),assert$1(n.Lnext.Onext.Sym===n),assert$1(n.Onext.Sym.Lnext===n);assert$1(n.Sym.next===r.Sym&&n.Sym===this.eHeadSym&&n.Sym.Sym===n&&null===n.Org&&null===n.Dst&&null===n.Lface&&null===n.Rface)}};var Geom={};function DictNode(){this.key=null,this.next=null,this.prev=null}function Dict(t,e){this.head=new DictNode,this.head.next=this.head,this.head.prev=this.head,this.frame=t,this.leq=e}function PQnode(){this.handle=null}function PQhandleElem(){this.key=null,this.node=null}function PriorityQ(t,e){this.size=0,this.max=t,this.nodes=[],this.nodes.length=t+1;for(var i=0;i<this.nodes.length;i++)this.nodes[i]=new PQnode;for(this.handles=[],this.handles.length=t+1,i=0;i<this.handles.length;i++)this.handles[i]=new PQhandleElem;this.initialized=!1,this.freeList=0,this.leq=e,this.nodes[1].handle=1,this.handles[1].key=null}function ActiveRegion(){this.eUp=null,this.nodeUp=null,this.windingNumber=0,this.inside=!1,this.sentinel=!1,this.dirty=!1,this.fixUpperEdge=!1}Geom.vertEq=function(t,e){return t.s===e.s&&t.t===e.t},Geom.vertLeq=function(t,e){return t.s<e.s||t.s===e.s&&t.t<=e.t},Geom.transLeq=function(t,e){return t.t<e.t||t.t===e.t&&t.s<=e.s},Geom.edgeGoesLeft=function(t){return Geom.vertLeq(t.Dst,t.Org)},Geom.edgeGoesRight=function(t){return Geom.vertLeq(t.Org,t.Dst)},Geom.vertL1dist=function(t,e){return Math.abs(t.s-e.s)+Math.abs(t.t-e.t)},Geom.edgeEval=function(t,e,i){assert$1(Geom.vertLeq(t,e)&&Geom.vertLeq(e,i));var n=e.s-t.s,r=i.s-e.s;return 0<n+r?n<r?e.t-t.t+(t.t-i.t)*(n/(n+r)):e.t-i.t+(i.t-t.t)*(r/(n+r)):0},Geom.edgeSign=function(t,e,i){assert$1(Geom.vertLeq(t,e)&&Geom.vertLeq(e,i));var n=e.s-t.s,r=i.s-e.s;return 0<n+r?(e.t-i.t)*n+(e.t-t.t)*r:0},Geom.transEval=function(t,e,i){assert$1(Geom.transLeq(t,e)&&Geom.transLeq(e,i));var n=e.t-t.t,r=i.t-e.t;return 0<n+r?n<r?e.s-t.s+(t.s-i.s)*(n/(n+r)):e.s-i.s+(i.s-t.s)*(r/(n+r)):0},Geom.transSign=function(t,e,i){assert$1(Geom.transLeq(t,e)&&Geom.transLeq(e,i));var n=e.t-t.t,r=i.t-e.t;return 0<n+r?(e.s-i.s)*n+(e.s-t.s)*r:0},Geom.vertCCW=function(t,e,i){return 0<=t.s*(e.t-i.t)+e.s*(i.t-t.t)+i.s*(t.t-e.t)},Geom.interpolate=function(t,e,i,n){return(t=t<0?0:t)<=(i=i<0?0:i)?0==i?(e+n)/2:e+t/(t+i)*(n-e):n+i/(t+i)*(e-n)},Geom.intersect=function(t,e,i,n,r){var o,s,a;Geom.vertLeq(t,e)||(a=t,t=e,e=a),Geom.vertLeq(i,n)||(a=i,i=n,n=a),Geom.vertLeq(t,i)||(a=t,t=i,i=a,a=e,e=n,n=a),Geom.vertLeq(i,e)?Geom.vertLeq(e,n)?((o=Geom.edgeEval(t,i,e))+(s=Geom.edgeEval(i,e,n))<0&&(o=-o,s=-s),r.s=Geom.interpolate(o,i.s,s,e.s)):((o=Geom.edgeSign(t,i,e))+(s=-Geom.edgeSign(t,n,e))<0&&(o=-o,s=-s),r.s=Geom.interpolate(o,i.s,s,n.s)):r.s=(i.s+e.s)/2,Geom.transLeq(t,e)||(a=t,t=e,e=a),Geom.transLeq(i,n)||(a=i,i=n,n=a),Geom.transLeq(t,i)||(a=t,t=i,i=a,a=e,e=n,n=a),Geom.transLeq(i,e)?Geom.transLeq(e,n)?((o=Geom.transEval(t,i,e))+(s=Geom.transEval(i,e,n))<0&&(o=-o,s=-s),r.t=Geom.interpolate(o,i.t,s,e.t)):((o=Geom.transSign(t,i,e))+(s=-Geom.transSign(t,n,e))<0&&(o=-o,s=-s),r.t=Geom.interpolate(o,i.t,s,n.t)):r.t=(i.t+e.t)/2},Dict.prototype={min:function(){return this.head.next},max:function(){return this.head.prev},insert:function(t){return this.insertBefore(this.head,t)},search:function(t){for(var e=this.head;null!==(e=e.next).key&&!this.leq(this.frame,t,e.key););return e},insertBefore:function(t,e){for(;null!==(t=t.prev).key&&!this.leq(this.frame,t.key,e););var i=new DictNode;return i.key=e,i.next=t.next,((t.next.prev=i).prev=t).next=i},delete:function(t){t.next.prev=t.prev,t.prev.next=t.next}},PriorityQ.prototype={floatDown_:function(t){for(var e,i,n=this.nodes,r=this.handles,o=n[t].handle;;){if((i=t<<1)<this.size&&this.leq(r[n[i+1].handle].key,r[n[i].handle].key)&&++i,assert$1(i<=this.max),e=n[i].handle,i>this.size||this.leq(r[o].key,r[e].key)){r[n[t].handle=o].node=t;break}r[n[t].handle=e].node=t,t=i}},floatUp_:function(t){for(var e,i,n=this.nodes,r=this.handles,o=n[t].handle;;){if(e=n[i=t>>1].handle,0==i||this.leq(r[e].key,r[o].key)){r[n[t].handle=o].node=t;break}r[n[t].handle=e].node=t,t=i}},init:function(){for(var t=this.size;1<=t;--t)this.floatDown_(t);this.initialized=!0},min:function(){return this.handles[this.nodes[1].handle].key},isEmpty:function(){this.size},insert:function(t){var e,i,n;if(2*(e=++this.size)>this.max){this.max*=2,n=this.nodes.length,this.nodes.length=this.max+1;for(var r=n;r<this.nodes.length;r++)this.nodes[r]=new PQnode;for(n=this.handles.length,this.handles.length=this.max+1,r=n;r<this.handles.length;r++)this.handles[r]=new PQhandleElem}return 0===this.freeList?i=e:(i=this.freeList,this.freeList=this.handles[i].node),this.nodes[e].handle=i,this.handles[i].node=e,this.handles[i].key=t,this.initialized&&this.floatUp_(e),i},extractMin:function(){var t=this.nodes,e=this.handles,i=t[1].handle,n=e[i].key;return 0<this.size&&(t[1].handle=t[this.size].handle,e[t[1].handle].node=1,e[i].key=null,e[i].node=this.freeList,this.freeList=i,--this.size,0<this.size&&this.floatDown_(1)),n},delete:function(t){var e,i=this.nodes,n=this.handles;assert$1(1<=t&&t<=this.max&&null!==n[t].key),i[e=n[t].node].handle=i[this.size].handle,n[i[e].handle].node=e,--this.size,e<=this.size&&(e<=1||this.leq(n[i[e>>1].handle].key,n[i[e].handle].key)?this.floatDown_(e):this.floatUp_(e)),n[t].key=null,n[t].node=this.freeList,this.freeList=t}};var Sweep={};function Tesselator(){this.mesh=null,this.normal=[0,0,0],this.sUnit=[0,0,0],this.tUnit=[0,0,0],this.bmin=[0,0],this.bmax=[0,0],this.windingRule=Tess2.WINDING_ODD,this.dict=null,this.pq=null,this.event=null,this.vertexIndexCounter=0,this.vertices=[],this.vertexIndices=[],this.vertexCount=0,this.elements=[],this.elementCount=0}Sweep.regionBelow=function(t){return t.nodeUp.prev.key},Sweep.regionAbove=function(t){return t.nodeUp.next.key},Sweep.debugEvent=function(t){},Sweep.addWinding=function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},Sweep.edgeLeq=function(t,e,i){var n=t.event,r=e.eUp,o=i.eUp;return r.Dst===n?o.Dst===n?Geom.vertLeq(r.Org,o.Org)?Geom.edgeSign(o.Dst,r.Org,o.Org)<=0:0<=Geom.edgeSign(r.Dst,o.Org,r.Org):Geom.edgeSign(o.Dst,n,o.Org)<=0:o.Dst===n?0<=Geom.edgeSign(r.Dst,n,r.Org):Geom.edgeEval(r.Dst,n,r.Org)>=Geom.edgeEval(o.Dst,n,o.Org)},Sweep.deleteRegion=function(t,e){e.fixUpperEdge&&assert$1(0===e.eUp.winding),e.eUp.activeRegion=null,t.dict.delete(e.nodeUp)},Sweep.fixUpperEdge=function(t,e,i){assert$1(e.fixUpperEdge),t.mesh.delete(e.eUp),e.fixUpperEdge=!1,(e.eUp=i).activeRegion=e},Sweep.topLeftRegion=function(t,e){for(var i,n=e.eUp.Org;(e=Sweep.regionAbove(e)).eUp.Org===n;);if(e.fixUpperEdge){if(null===(i=t.mesh.connect(Sweep.regionBelow(e).eUp.Sym,e.eUp.Lnext)))return null;Sweep.fixUpperEdge(t,e,i),e=Sweep.regionAbove(e)}return e},Sweep.topRightRegion=function(t){var e=t.eUp.Dst;for(t=null;(t=Sweep.regionAbove(t)).eUp.Dst===e;);return t},Sweep.addRegionBelow=function(t,e,i){var n=new ActiveRegion;return n.eUp=i,n.nodeUp=t.dict.insertBefore(e.nodeUp,n),n.fixUpperEdge=!1,n.sentinel=!1,n.dirty=!1,i.activeRegion=n},Sweep.isWindingInside=function(t,e){switch(t.windingRule){case Tess2.WINDING_ODD:return 0!=(1&e);case Tess2.WINDING_NONZERO:return 0!=e;case Tess2.WINDING_POSITIVE:return 0<e;case Tess2.WINDING_NEGATIVE:return e<0;case Tess2.WINDING_ABS_GEQ_TWO:return 2<=e||e<=-2}return assert$1(!1),!1},Sweep.computeWinding=function(t,e){e.windingNumber=Sweep.regionAbove(e).windingNumber+e.eUp.winding,e.inside=Sweep.isWindingInside(t,e.windingNumber)},Sweep.finishRegion=function(t,e){var i=e.eUp,n=i.Lface;n.inside=e.inside,n.anEdge=i,Sweep.deleteRegion(t,e)},Sweep.finishLeftRegions=function(t,e,i){for(var n,r=null,o=e,s=e.eUp;o!==i;){if(o.fixUpperEdge=!1,(n=(r=Sweep.regionBelow(o)).eUp).Org!=s.Org){if(!r.fixUpperEdge){Sweep.finishRegion(t,o);break}n=t.mesh.connect(s.Lprev,n.Sym),Sweep.fixUpperEdge(t,r,n)}s.Onext!==n&&(t.mesh.splice(n.Oprev,n),t.mesh.splice(s,n)),Sweep.finishRegion(t,o),s=r.eUp,o=r}return s},Sweep.addRightEdges=function(t,e,i,n,r,o){for(var s,a,l,c=!0,h=i;assert$1(Geom.vertLeq(h.Org,h.Dst)),Sweep.addRegionBelow(t,e,h.Sym),(h=h.Onext)!==n;);for(null===r&&(r=Sweep.regionBelow(e).eUp.Rprev),a=e,l=r;(h=(s=Sweep.regionBelow(a)).eUp.Sym).Org===l.Org;)h.Onext!==l&&(t.mesh.splice(h.Oprev,h),t.mesh.splice(l.Oprev,h)),s.windingNumber=a.windingNumber-h.winding,s.inside=Sweep.isWindingInside(t,s.windingNumber),a.dirty=!0,!c&&Sweep.checkForRightSplice(t,a)&&(Sweep.addWinding(h,l),Sweep.deleteRegion(t,a),t.mesh.delete(l)),c=!1,a=s,l=h;a.dirty=!0,assert$1(a.windingNumber-h.winding===s.windingNumber),o&&Sweep.walkDirtyRegions(t,a)},Sweep.spliceMergeVertices=function(t,e,i){t.mesh.splice(e,i)},Sweep.vertexWeights=function(t,e,i){var n=Geom.vertL1dist(e,t),r=Geom.vertL1dist(i,t),o=.5*r/(n+r),s=.5*n/(n+r);t.coords[0]+=o*e.coords[0]+s*i.coords[0],t.coords[1]+=o*e.coords[1]+s*i.coords[1],t.coords[2]+=o*e.coords[2]+s*i.coords[2]},Sweep.getIntersectData=function(t,e,i,n,r,o){e.coords[0]=e.coords[1]=e.coords[2]=0,e.idx=-1,Sweep.vertexWeights(e,i,n),Sweep.vertexWeights(e,r,o)},Sweep.checkForRightSplice=function(t,e){var i=Sweep.regionBelow(e),n=e.eUp,r=i.eUp;if(Geom.vertLeq(n.Org,r.Org)){if(0<Geom.edgeSign(r.Dst,n.Org,r.Org))return!1;Geom.vertEq(n.Org,r.Org)?n.Org!==r.Org&&(t.pq.delete(n.Org.pqHandle),Sweep.spliceMergeVertices(t,r.Oprev,n)):(t.mesh.splitEdge(r.Sym),t.mesh.splice(n,r.Oprev),e.dirty=i.dirty=!0)}else{if(Geom.edgeSign(n.Dst,r.Org,n.Org)<0)return!1;Sweep.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(n.Sym),t.mesh.splice(r.Oprev,n)}return!0},Sweep.checkForLeftSplice=function(t,e){var i,n=Sweep.regionBelow(e),r=e.eUp,o=n.eUp;if(assert$1(!Geom.vertEq(r.Dst,o.Dst)),Geom.vertLeq(r.Dst,o.Dst)){if(Geom.edgeSign(r.Dst,o.Dst,r.Org)<0)return!1;Sweep.regionAbove(e).dirty=e.dirty=!0,i=t.mesh.splitEdge(r),t.mesh.splice(o.Sym,i),i.Lface.inside=e.inside}else{if(0<Geom.edgeSign(o.Dst,r.Dst,o.Org))return!1;e.dirty=n.dirty=!0,i=t.mesh.splitEdge(o),t.mesh.splice(r.Lnext,o.Sym),i.Rface.inside=e.inside}return!0},Sweep.checkForIntersect=function(t,e){var i,n,r=Sweep.regionBelow(e),o=e.eUp,s=r.eUp,a=o.Org,l=s.Org,c=o.Dst,h=s.Dst,u=new TESSvertex;if(assert$1(!Geom.vertEq(h,c)),assert$1(Geom.edgeSign(c,t.event,a)<=0),assert$1(0<=Geom.edgeSign(h,t.event,l)),assert$1(a!==t.event&&l!==t.event),assert$1(!e.fixUpperEdge&&!r.fixUpperEdge),a===l)return!1;if(Math.min(a.t,c.t)>Math.max(l.t,h.t))return!1;if(Geom.vertLeq(a,l)){if(0<Geom.edgeSign(h,a,l))return!1}else if(Geom.edgeSign(c,l,a)<0)return!1;return Sweep.debugEvent(t),Geom.intersect(c,a,h,l,u),assert$1(Math.min(a.t,c.t)<=u.t),assert$1(u.t<=Math.max(l.t,h.t)),assert$1(Math.min(h.s,c.s)<=u.s),assert$1(u.s<=Math.max(l.s,a.s)),Geom.vertLeq(u,t.event)&&(u.s=t.event.s,u.t=t.event.t),i=Geom.vertLeq(a,l)?a:l,Geom.vertLeq(i,u)&&(u.s=i.s,u.t=i.t),Geom.vertEq(u,a)||Geom.vertEq(u,l)?(Sweep.checkForRightSplice(t,e),!1):!Geom.vertEq(c,t.event)&&0<=Geom.edgeSign(c,t.event,u)||!Geom.vertEq(h,t.event)&&Geom.edgeSign(h,t.event,u)<=0?h===t.event?(t.mesh.splitEdge(o.Sym),t.mesh.splice(s.Sym,o),e=Sweep.topLeftRegion(t,e),o=Sweep.regionBelow(e).eUp,Sweep.finishLeftRegions(t,Sweep.regionBelow(e),r),Sweep.addRightEdges(t,e,o.Oprev,o,o,!0),TRUE):c===t.event?(t.mesh.splitEdge(s.Sym),t.mesh.splice(o.Lnext,s.Oprev),r=e,e=Sweep.topRightRegion(e),n=Sweep.regionBelow(e).eUp.Rprev,r.eUp=s.Oprev,s=Sweep.finishLeftRegions(t,r,null),Sweep.addRightEdges(t,e,s.Onext,o.Rprev,n,!0),!0):(0<=Geom.edgeSign(c,t.event,u)&&(Sweep.regionAbove(e).dirty=e.dirty=!0,t.mesh.splitEdge(o.Sym),o.Org.s=t.event.s,o.Org.t=t.event.t),Geom.edgeSign(h,t.event,u)<=0&&(e.dirty=r.dirty=!0,t.mesh.splitEdge(s.Sym),s.Org.s=t.event.s,s.Org.t=t.event.t),!1):(t.mesh.splitEdge(o.Sym),t.mesh.splitEdge(s.Sym),t.mesh.splice(s.Oprev,o),o.Org.s=u.s,o.Org.t=u.t,o.Org.pqHandle=t.pq.insert(o.Org),Sweep.getIntersectData(t,o.Org,a,c,l,h),!(Sweep.regionAbove(e).dirty=e.dirty=r.dirty=!0))},Sweep.walkDirtyRegions=function(t,e){for(var i,n,r=Sweep.regionBelow(e);;){for(;r.dirty;)e=r,r=Sweep.regionBelow(r);if(!e.dirty&&(r=e,null==(e=Sweep.regionAbove(e))||!e.dirty))return;if(e.dirty=!1,i=e.eUp,n=r.eUp,i.Dst!==n.Dst&&Sweep.checkForLeftSplice(t,e)&&(r.fixUpperEdge?(Sweep.deleteRegion(t,r),t.mesh.delete(n),n=(r=Sweep.regionBelow(e)).eUp):e.fixUpperEdge&&(Sweep.deleteRegion(t,e),t.mesh.delete(i),i=(e=Sweep.regionAbove(r)).eUp)),i.Org!==n.Org)if(i.Dst===n.Dst||e.fixUpperEdge||r.fixUpperEdge||i.Dst!==t.event&&n.Dst!==t.event)Sweep.checkForRightSplice(t,e);else if(Sweep.checkForIntersect(t,e))return;i.Org===n.Org&&i.Dst===n.Dst&&(Sweep.addWinding(n,i),Sweep.deleteRegion(t,e),t.mesh.delete(i),e=Sweep.regionAbove(r))}},Sweep.connectRightVertex=function(t,e,i){var n,r=i.Onext,o=Sweep.regionBelow(e),s=e.eUp,a=o.eUp,l=!1;s.Dst!==a.Dst&&Sweep.checkForIntersect(t,e),Geom.vertEq(s.Org,t.event)&&(t.mesh.splice(r.Oprev,s),e=Sweep.topLeftRegion(t,e),r=Sweep.regionBelow(e).eUp,Sweep.finishLeftRegions(t,Sweep.regionBelow(e),o),l=!0),Geom.vertEq(a.Org,t.event)&&(t.mesh.splice(i,a.Oprev),i=Sweep.finishLeftRegions(t,o,null),l=!0),l?Sweep.addRightEdges(t,e,i.Onext,r,r,!0):(n=Geom.vertLeq(a.Org,s.Org)?a.Oprev:s,n=t.mesh.connect(i.Lprev,n),Sweep.addRightEdges(t,e,n,n.Onext,n.Onext,!1),n.Sym.activeRegion.fixUpperEdge=!0,Sweep.walkDirtyRegions(t,e))},Sweep.connectLeftDegenerate=function(t,e,i){var n,r,o,s,a=e.eUp;return Geom.vertEq(a.Org,i)?(assert$1(!1),void Sweep.spliceMergeVertices(t,a,i.anEdge)):Geom.vertEq(a.Dst,i)?(assert$1(!1),e=Sweep.topRightRegion(e),n=o=(r=(s=Sweep.regionBelow(e)).eUp.Sym).Onext,s.fixUpperEdge&&(assert$1(n!==r),Sweep.deleteRegion(t,s),t.mesh.delete(r),r=n.Oprev),t.mesh.splice(i.anEdge,r),Geom.edgeGoesLeft(n)||(n=null),void Sweep.addRightEdges(t,e,r.Onext,o,n,!0)):(t.mesh.splitEdge(a.Sym),e.fixUpperEdge&&(t.mesh.delete(a.Onext),e.fixUpperEdge=!1),t.mesh.splice(i.anEdge,a),void Sweep.sweepEvent(t,i))},Sweep.connectLeftVertex=function(t,e){var i,n,r,o,s,a,l=new ActiveRegion;l.eUp=e.anEdge.Sym,i=t.dict.search(l).key,(n=Sweep.regionBelow(i))&&(o=i.eUp,s=n.eUp,0!==Geom.edgeSign(o.Dst,e,o.Org)?(r=Geom.vertLeq(s.Dst,o.Dst)?i:n,i.inside||r.fixUpperEdge?(a=r===i?t.mesh.connect(e.anEdge.Sym,o.Lnext):t.mesh.connect(s.Dnext,e.anEdge).Sym,r.fixUpperEdge?Sweep.fixUpperEdge(t,r,a):Sweep.computeWinding(t,Sweep.addRegionBelow(t,i,a)),Sweep.sweepEvent(t,e)):Sweep.addRightEdges(t,i,e.anEdge,e.anEdge,null,!0)):Sweep.connectLeftDegenerate(t,i,e))},Sweep.sweepEvent=function(t,e){t.event=e,Sweep.debugEvent(t);for(var i=e.anEdge;null===i.activeRegion;)if((i=i.Onext)==e.anEdge)return void Sweep.connectLeftVertex(t,e);var n=Sweep.topLeftRegion(t,i.activeRegion);assert$1(null!==n);var r=Sweep.regionBelow(n),o=r.eUp,s=Sweep.finishLeftRegions(t,r,null);s.Onext===o?Sweep.connectRightVertex(t,n,s):Sweep.addRightEdges(t,n,s.Onext,o,o,!0)},Sweep.addSentinel=function(t,e,i,n){var r=new ActiveRegion,o=t.mesh.makeEdge();o.Org.s=i,o.Org.t=n,o.Dst.s=e,o.Dst.t=n,t.event=o.Dst,r.eUp=o,r.windingNumber=0,r.inside=!1,r.fixUpperEdge=!1,r.sentinel=!0,r.dirty=!1,r.nodeUp=t.dict.insert(r)},Sweep.initEdgeDict=function(t){t.dict=new Dict(t,Sweep.edgeLeq);var e=t.bmax[0]-t.bmin[0],i=t.bmax[1]-t.bmin[1],n=t.bmin[0]-e,r=t.bmax[0]+e,o=t.bmin[1]-i,s=t.bmax[1]+i;Sweep.addSentinel(t,n,r,o),Sweep.addSentinel(t,n,r,s)},Sweep.doneEdgeDict=function(t){for(var e,i=0;null!==(e=t.dict.min().key);)e.sentinel||(assert$1(e.fixUpperEdge),assert$1(1==++i)),assert$1(0==e.windingNumber),Sweep.deleteRegion(t,e)},Sweep.removeDegenerateEdges=function(t){for(var e,i,n=t.mesh.eHead,r=n.next;r!==n;r=e)e=r.next,i=r.Lnext,Geom.vertEq(r.Org,r.Dst)&&r.Lnext.Lnext!==r&&(Sweep.spliceMergeVertices(t,i,r),t.mesh.delete(r),i=(r=i).Lnext),i.Lnext===r&&(i!==r&&(i!==e&&i!==e.Sym||(e=e.next),t.mesh.delete(i)),r!==e&&r!==e.Sym||(e=e.next),t.mesh.delete(r))},Sweep.initPriorityQ=function(t){for(var e,i,n=0,r=(i=t.mesh.vHead).next;r!==i;r=r.next)n++;for(n+=8,e=t.pq=new PriorityQ(n,Geom.vertLeq),r=(i=t.mesh.vHead).next;r!==i;r=r.next)r.pqHandle=e.insert(r);return r===i&&(e.init(),!0)},Sweep.donePriorityQ=function(t){t.pq=null},Sweep.removeDegenerateFaces=function(t,e){for(var i,n,r=e.fHead.next;r!==e.fHead;r=i)i=r.next,n=r.anEdge,assert$1(n.Lnext!==n),n.Lnext.Lnext===n&&(Sweep.addWinding(n.Onext,n),t.mesh.delete(n));return!0},Sweep.computeInterior=function(t){var e,i;if(Sweep.removeDegenerateEdges(t),!Sweep.initPriorityQ(t))return!1;for(Sweep.initEdgeDict(t);null!==(e=t.pq.extractMin());){for(;null!==(i=t.pq.min())&&Geom.vertEq(i,e);)i=t.pq.extractMin(),Sweep.spliceMergeVertices(t,e.anEdge,i.anEdge);Sweep.sweepEvent(t,e)}return t.event=t.dict.min().key.eUp.Org,Sweep.debugEvent(t),Sweep.doneEdgeDict(t),Sweep.donePriorityQ(t),!!Sweep.removeDegenerateFaces(t,t.mesh)&&(t.mesh.check(),!0)},Tesselator.prototype={dot_:function(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]},normalize_:function(t){var e=t[0]*t[0]+t[1]*t[1]+t[2]*t[2];assert$1(0<e),e=Math.sqrt(e),t[0]/=e,t[1]/=e,t[2]/=e},longAxis_:function(t){var e=0;return Math.abs(t[1])>Math.abs(t[0])&&(e=1),Math.abs(t[2])>Math.abs(t[e])&&(e=2),e},computeNormal_:function(t){for(var e,i,n,r,o,s=[0,0,0],a=[0,0,0],l=[0,0,0],c=[0,0,0],h=[0,0,0],u=[null,null,null],p=[null,null,null],d=this.mesh.vHead,_=d.next,f=0;f<3;++f)n=_.coords[f],a[f]=n,p[f]=_,s[f]=n,u[f]=_;for(_=d.next;_!==d;_=_.next)for(f=0;f<3;++f)(n=_.coords[f])<a[f]&&(a[f]=n,p[f]=_),n>s[f]&&(s[f]=n,u[f]=_);if(f=0,s[1]-a[1]>s[0]-a[0]&&(f=1),s[2]-a[2]>s[f]-a[f]&&(f=2),a[f]>=s[f])return t[0]=0,t[1]=0,void(t[2]=1);for(o=0,e=p[f],i=u[f],l[0]=e.coords[0]-i.coords[0],l[1]=e.coords[1]-i.coords[1],l[2]=e.coords[2]-i.coords[2],_=d.next;_!==d;_=_.next)c[0]=_.coords[0]-i.coords[0],c[1]=_.coords[1]-i.coords[1],c[2]=_.coords[2]-i.coords[2],h[0]=l[1]*c[2]-l[2]*c[1],h[1]=l[2]*c[0]-l[0]*c[2],h[2]=l[0]*c[1]-l[1]*c[0],(r=h[0]*h[0]+h[1]*h[1]+h[2]*h[2])>o&&(o=r,t[0]=h[0],t[1]=h[1],t[2]=h[2]);o<=0&&(t[0]=t[1]=t[2]=0,t[this.longAxis_(l)]=1)},checkOrientation_:function(){for(var t,e,i=this.mesh.fHead,n=this.mesh.vHead,r=0,o=i.next;o!==i;o=o.next)if(!((e=o.anEdge).winding<=0))for(;r+=(e.Org.s-e.Dst.s)*(e.Org.t+e.Dst.t),(e=e.Lnext)!==o.anEdge;);if(r<0){for(t=n.next;t!==n;t=t.next)t.t=-t.t;this.tUnit[0]=-this.tUnit[0],this.tUnit[1]=-this.tUnit[1],this.tUnit[2]=-this.tUnit[2]}},projectPolygon_:function(){var t,e,i,n,r,o=this.mesh.vHead,s=[0,0,0],a=!1;for(s[0]=this.normal[0],s[1]=this.normal[1],s[2]=this.normal[2],0===s[0]&&0===s[1]&&0===s[2]&&(this.computeNormal_(s),a=!0),e=this.sUnit,i=this.tUnit,e[n=this.longAxis_(s)]=0,e[(n+1)%3]=1,e[(n+2)%3]=0,i[n]=0,i[(n+1)%3]=0,i[(n+2)%3]=0<s[n]?1:-1,t=o.next;t!==o;t=t.next)t.s=this.dot_(t.coords,e),t.t=this.dot_(t.coords,i);for(a&&this.checkOrientation_(),r=!0,t=o.next;t!==o;t=t.next)r?(this.bmin[0]=this.bmax[0]=t.s,this.bmin[1]=this.bmax[1]=t.t,r=!1):(t.s<this.bmin[0]&&(this.bmin[0]=t.s),t.s>this.bmax[0]&&(this.bmax[0]=t.s),t.t<this.bmin[1]&&(this.bmin[1]=t.t),t.t>this.bmax[1]&&(this.bmax[1]=t.t))},addWinding_:function(t,e){t.winding+=e.winding,t.Sym.winding+=e.Sym.winding},tessellateMonoRegion_:function(t,e){var i,n=e.anEdge;for(assert$1(n.Lnext!==n&&n.Lnext.Lnext!==n);Geom.vertLeq(n.Dst,n.Org);n=n.Lprev);for(;Geom.vertLeq(n.Org,n.Dst);n=n.Lnext);for(i=n.Lprev;n.Lnext!==i;)if(Geom.vertLeq(n.Dst,i.Org)){for(;i.Lnext!==n&&(Geom.edgeGoesLeft(i.Lnext)||Geom.edgeSign(i.Org,i.Dst,i.Lnext.Dst)<=0);)i=t.connect(i.Lnext,i).Sym;i=i.Lprev}else{for(;i.Lnext!=n&&(Geom.edgeGoesRight(n.Lprev)||0<=Geom.edgeSign(n.Dst,n.Org,n.Lprev.Org));)n=t.connect(n,n.Lprev).Sym;n=n.Lnext}for(assert$1(i.Lnext!==n);i.Lnext.Lnext!==n;)i=t.connect(i.Lnext,i).Sym;return!0},tessellateInterior_:function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)if(e=i.next,i.inside&&!this.tessellateMonoRegion_(t,i))return!1;return!0},discardExterior_:function(t){for(var e,i=t.fHead.next;i!==t.fHead;i=e)e=i.next,i.inside||t.zapFace(i)},setWindingNumber_:function(t,e,i){for(var n,r=t.eHead.next;r!==t.eHead;r=n)n=r.next,r.Rface.inside!==r.Lface.inside?r.winding=r.Lface.inside?e:-e:i?t.delete(r):r.winding=0},getNeighbourFace_:function(t){return t.Rface&&t.Rface.inside?t.Rface.n:-1},outputPolymesh_:function(t,e,i,n){var r,o,s,a,l,c=0,h=0;for(3<i&&t.mergeConvexFaces(i),r=t.vHead.next;r!==t.vHead;r=r.next)r.n=-1;for(p=t.fHead.next;p!=t.fHead;p=p.next)if(p.n=-1,p.inside){for(o=p.anEdge,s=0;-1===(r=o.Org).n&&(r.n=h,h++),s++,(o=o.Lnext)!==p.anEdge;);assert$1(s<=i),p.n=c,++c}for(this.elementCount=c,e==Tess2.CONNECTED_POLYGONS&&(c*=2),this.elements=[],this.elements.length=c*i,this.vertexCount=h,this.vertices=[],this.vertices.length=h*n,this.vertexIndices=[],this.vertexIndices.length=h,r=t.vHead.next;r!==t.vHead;r=r.next){-1!=r.n&&(l=r.n*n,this.vertices[0+l]=r.coords[0],this.vertices[1+l]=r.coords[1],2<n&&(this.vertices[2+l]=r.coords[2]),this.vertexIndices[r.n]=r.idx)}for(var u=0,p=t.fHead.next;p!==t.fHead;p=p.next)if(p.inside){for(o=p.anEdge,s=0;r=o.Org,this.elements[u++]=r.n,s++,(o=o.Lnext)!==p.anEdge;);for(a=s;a<i;++a)this.elements[u++]=-1;if(e==Tess2.CONNECTED_POLYGONS){for(o=p.anEdge;this.elements[u++]=this.getNeighbourFace_(o),(o=o.Lnext)!==p.anEdge;);for(a=s;a<i;++a)this.elements[u++]=-1}}},outputContours_:function(t,e){var i,n,r=0,o=0;for(this.vertexCount=0,this.elementCount=0,c=t.fHead.next;c!==t.fHead;c=c.next)if(c.inside){for(n=i=c.anEdge;this.vertexCount++,(i=i.Lnext)!==n;);this.elementCount++}this.elements=[],this.elements.length=2*this.elementCount,this.vertices=[],this.vertices.length=this.vertexCount*e,this.vertexIndices=[],this.vertexIndices.length=this.vertexCount;for(var s=0,a=0,l=0,r=0,c=t.fHead.next;c!==t.fHead;c=c.next)if(c.inside){for(o=0,n=i=c.anEdge;this.vertices[s++]=i.Org.coords[0],this.vertices[s++]=i.Org.coords[1],2<e&&(this.vertices[s++]=i.Org.coords[2]),this.vertexIndices[a++]=i.Org.idx,o++,(i=i.Lnext)!==n;);this.elements[l++]=r,r+=this.elements[l++]=o}},addContour:function(t,e){var i,n;for(null===this.mesh&&(this.mesh=new TESSmesh),t<2&&(t=2),3<t&&(t=3),i=null,n=0;n<e.length;n+=t)null==i?(i=this.mesh.makeEdge(),this.mesh.splice(i,i.Sym)):(this.mesh.splitEdge(i),i=i.Lnext),i.Org.coords[0]=e[n+0],i.Org.coords[1]=e[n+1],i.Org.coords[2]=2<t?e[n+2]:0,i.Org.idx=this.vertexIndexCounter++,i.winding=1,i.Sym.winding=-1},tesselate:function(t,e,i,n,r){if(this.vertices=[],this.elements=[],this.vertexIndices=[],this.vertexIndexCounter=0,r&&(this.normal[0]=r[0],this.normal[1]=r[1],this.normal[2]=r[2]),this.windingRule=t,n<2&&(n=2),3<n&&(n=3),!this.mesh)return!1;this.projectPolygon_(),Sweep.computeInterior(this);var o=this.mesh;return e==Tess2.BOUNDARY_CONTOURS?this.setWindingNumber_(o,1,!0):this.tessellateInterior_(o),o.check(),e==Tess2.BOUNDARY_CONTOURS?this.outputContours_(o,n):this.outputPolymesh_(o,e,i,n),!0}};var tess2$1=tess2,GraphicsFactoryFills=(TJb.draw_pathes=function(t){for(var e=t.queued_fill_pathes.length,i=0,i=0;i<e;i++){var n,r,o,s,a,l,c,h=TJb.pathToAttributesBuffer(t.queued_fill_pathes[i]);h&&0<h.length&&((r=new TriangleElements(h)).setPositions(new Float2Attributes(h)),t.queued_fill_pathes[i].style.data_type==GraphicsFillStyle.data_type?(c=(s=MaterialManager.get_material_for_color(t.queued_fill_pathes[i].style.color,t.queued_fill_pathes[i].style.alpha)).material,o=t.addShape(Shape.getShape(r,c)),s.colorPos&&(o.style=new Style,n=new ImageSampler,c.animateUVs=!0,o.style.addSamplerAt(n,c.getTextureAt(0)),o.style.uvMatrix=new Matrix(0,0,0,0,s.colorPos.x,s.colorPos.y))):t.queued_fill_pathes[i].style.data_type==GradientFillStyle.data_type?(a=t.queued_fill_pathes[i].style,c=(s=MaterialManager.get_material_for_gradient(a)).material,(o=t.addShape(Shape.getShape(r,c))).style=new Style,n=new ImageSampler,o.style.addSamplerAt(n,c.getTextureAt(0)),c.animateUVs=!0,o.style.uvMatrix=a.getUVMatrix(),a.type==GradientType.LINEAR?c.getTextureAt(0).mappingMode=MappingMode.LINEAR:a.type==GradientType.RADIAL&&(n.imageRect=a.uvRectangle,c.imageRect=!0,c.getTextureAt(0).mappingMode=MappingMode.RADIAL)):t.queued_fill_pathes[i].style.data_type==BitmapFillStyle.data_type&&(c=(l=t.queued_fill_pathes[i].style).material,(o=t.addShape(Shape.getShape(r,c))).style=new Style,(n=new ImageSampler).repeat=l.repeat,o.style.addSamplerAt(n,c.getTextureAt(0)),c.style.sampler=n,c.animateUVs=!0,o.style.uvMatrix=l.getUVMatrix()))}t.queued_fill_pathes.length=0},TJb.pathToAttributesBuffer=function(t,e){t.prepare();for(var i,n,r,o=t._positions,s=0,a=[],l=0,c=[],h=0,u=0,p=0,d=0,_=0,f=0,m=0,g=Math.pow(10,3),y=1/g,b=0;b<o.length;b++){var v,x=o[b],A=x[0],S=x[1],w=x[x.length-2],C=x[x.length-1];Math.abs(A-w)+Math.abs(S-C)<=y&&(x.pop(),x.pop()),5<x.length&&(v=x.map(function(t){return Math.round(t*g)/g*20}),c.push(v))}try{for(h=(i=tess2$1.tesselate({contours:c,windingRule:tess2$1.WINDING_ODD,elementType:tess2$1.POLYGONS,polySize:3,vertexSize:2,debug:!0})).elements.length/3,s=m=f=_=d=p=u=0;s<h;++s)u=i.vertices[2*i.elements[3*s]],p=i.vertices[2*i.elements[3*s]+1],d=i.vertices[2*i.elements[3*s+1]],_=i.vertices[2*i.elements[3*s+1]+1],f=i.vertices[2*i.elements[3*s+2]],m=i.vertices[2*i.elements[3*s+2]+1],GraphicsFactoryHelper.isClockWiseXY(u,p,d,_,f,m)?(a[l++]=f,a[l++]=m,a[l++]=d,a[l++]=_,a[l++]=u,a[l++]=p):(a[l++]=u,a[l++]=p,a[l++]=d,a[l++]=_,a[l++]=f,a[l++]=m)}catch(t){console.log("error when trying to tesselate",c)}return a.forEach(function(t,e){return a[e]=t/20}),0<(a=a.concat(t.verts)).length?((n=new AttributesView(Float32Array,2)).set(a),r=n.attributesBuffer.cloneBufferView(),n.dispose(),r):null},TJb),GraphicsPathCommand=(HKb.NO_OP=0,HKb.MOVE_TO=1,HKb.LINE_TO=2,HKb.CURVE_TO=3,HKb.BUILD_JOINT=13,HKb.BUILD_ROUND_JOINT=14,HKb.WIDE_LINE_TO=4,HKb.WIDE_MOVE_TO=5,HKb.CUBIC_CURVE=6,HKb),GraphicsFactoryStrokes=(IKb.draw_pathes=function(t){for(var e=t.queued_stroke_pathes.length,i=0,i=0;i<e;i++){var n,r,o,s=t.queued_stroke_pathes[i],a=s.style,l=MaterialManager.get_material_for_color(a.color,a.alpha),c=l.material;s.prepare(),(n=IKb.getLineElements([s],c.curves,s.stroke.scaleMode))&&(n.stroke=s.stroke,r=t.addShape(Shape.getShape(n,c)),l.colorPos&&(r.style=new Style,o=new ImageSampler,c.animateUVs=!0,r.style.addSamplerAt(o,c.getTextureAt(0)),c.style.sampler=o,r.style.uvMatrix=new Matrix(0,0,0,0,l.colorPos.x,l.colorPos.y)))}t.queued_stroke_pathes.length=0},IKb.getLineElements=function(t,e,i){void 0===i&&(i=LineScaleMode.NORMAL);for(var n,r,o,s=[],a=[],l=t.length,c=0,h=0,u=0,p=0,d=0,_=0,f=0,m=0,g=0,y=0,y=0;y<l;y++)for(n=t[y]._positions,r=t[y].stroke,g=i!=LineScaleMode.HAIRLINE?r.half_thickness:.5,h=0;h<n.length;h++)for(d=(o=n[h])[0],_=o[1],c=2;c<o.length;c+=2)u=o[c],p=o[c+1],u==d&&p==_||(s[f++]=d,s[f++]=_,s[f++]=0,s[f++]=u,s[f++]=p,s[f++]=0,a[m++]=g),d=u,_=p;if(0!=s.length){var b=new LineElements(new AttributesBuffer);return b.setPositions(s),b.setThickness(a),b}},IKb.getTriangleElements=function(t,e,i){void 0===i&&(i=LineScaleMode.NORMAL);for(var n,r,o,s,a,l=[],c=t.length,h=0,u=0,p=new Point,d=new Point,_=new Point,f=new Point,m=new Point,g=0,y=0,b=0,v=0,x=0,A=0,S=0,w=0,C=0,P=0,E=0,T=0,M=0,D=0,I=0,O=0,L=0,F=0,B=0,N=0,R=0,V=0,k=0,U=0,j=0,G=0,z=0,$=0,X=!0,W=!1,H=!1,q=0,J=0,Q=0,K=0,Y=0,Z=0,tt=0,et=0,it=[],nt=[],rt=0,ot=0,st=0,st=0;st<c;st++)for(n=t[st]._positions,tt=(r=t[st].stroke).half_thickness,et=r.half_thickness,LineScaleMode.NORMAL,u=0;u<n.length;u++){for(H=!0,(o=n[u])[0]!=o[o.length-2]||o[1]!=o[o.length-1]?H=!1:(d.x=o[o.length-2]-o[o.length-4],d.y=o[o.length-1]-o[o.length-3],d.normalize(),Q=Math.atan2(d.y,d.x)*MathConsts.RADIANS_TO_DEGREES,o[o.length-2],o[o.length-1]),b=o[0],v=o[1],it=[],nt=[],ot=rt=0,s=-1*d.y,a=d.x,h=2;h<o.length;h+=2)g=o[h],y=o[h+1],g==b&&y==v||(p.x=g-b,p.y=y-v,p.normalize(),180<(J=(q=Math.atan2(p.y,p.x)*MathConsts.RADIANS_TO_DEGREES)-Q)&&(J-=360),J<-180&&(J+=360),Q=q,_.x=-1*p.y,_.y=p.x,x=b+_.x*tt,A=v+_.y*et,S=b-_.x*tt,w=v-_.y*et,W=!1,2!=h||H?(K=J<0?-180-J:180-J,0==J||180==Math.abs(J)?W=2==h:Math.abs(K)<5?W=!0:(W=!0,K=-.5*K*MathConsts.DEGREES_TO_RADIANS,f.x=p.x*Math.cos(K)+p.y*Math.sin(K),f.y=p.y*Math.cos(K)-p.x*Math.sin(K),f.normalize(),Z=Math.abs(J)<=1||359<=Math.abs(J)||179<=Math.abs(J)&&Math.abs(J)<=181?(Y=J<0?tt:-tt,J<0?et:-et):(Y=tt/Math.sin(K),et/Math.sin(K)),C=b-f.x*Y,P=v-f.y*Z,E=b+f.x*Y,T=v+f.y*Z,0<J?(I=b-s*tt,O=v-a*et,x=C,A=P,S=M=b-_.x*tt,w=D=v-_.y*et):(B=b+s*tt,N=v+a*et,S=E,w=T,x=L=b+_.x*tt,A=F=v+_.y*et),X=!0,r.jointstyle==JointStyle.MITER&&(Math.sqrt((Y*Y+Z*Z)/(tt*tt+et*et)-1)<=r.miter_limit?(X=!1,S=E,w=T,x=C,A=P):0<J?(M-=p.x*(r.miter_limit*tt),D-=p.y*(r.miter_limit*et),m.x=-1*a,m.y=s,I-=m.x*(r.miter_limit*tt),O-=m.y*(r.miter_limit*et)):(L-=p.x*(r.miter_limit*tt),F-=p.y*(r.miter_limit*et),m.x=-1*a,m.y=s,B-=m.x*(r.miter_limit*tt),N-=m.y*(r.miter_limit*et))),X&&(it[rt++]=r.jointstyle!=JointStyle.ROUND?GraphicsPathCommand.BUILD_JOINT:GraphicsPathCommand.BUILD_ROUND_JOINT,0<J?(nt[ot++]=C,nt[ot++]=P,nt[ot++]=I,nt[ot++]=O,nt[ot++]=M,nt[ot++]=D):(nt[ot++]=B,nt[ot++]=N,nt[ot++]=E,nt[ot++]=T,nt[ot++]=L,nt[ot++]=F),r.jointstyle==JointStyle.ROUND&&(nt[ot++]=b-f.x*Math.abs(tt),nt[ot++]=v-f.y*Math.abs(et),0<J?(nt[ot++]=I,nt[ot++]=O,nt[ot++]=M,nt[ot++]=D):(nt[ot++]=B,nt[ot++]=N,nt[ot++]=L,nt[ot++]=F))))):W=!0,s=_.x,a=_.y,W&&(it[rt++]=GraphicsPathCommand.LINE_TO,nt[ot++]=x,nt[ot++]=A,nt[ot++]=S,nt[ot++]=w),b=g,v=y,h==o.length-2&&(it[rt++]=GraphicsPathCommand.NO_OP,H?(nt[ot++]=nt[0],nt[ot++]=nt[1],nt[ot++]=nt[2],nt[ot++]=nt[3]):(nt[ot++]=b+_.x*tt,nt[ot++]=v+_.y*et,nt[ot++]=b-_.x*tt,nt[ot++]=v-_.y*et)));for(h=ot=rt=0;h<it.length;h++)it[h]==GraphicsPathCommand.LINE_TO?(R=nt[ot++],V=nt[ot++],k=nt[ot++],U=nt[ot++],j=nt[ot],G=nt[ot+1],z=nt[ot+2],$=nt[ot+3],GraphicsFactoryHelper.addTriangle(R,V,j,G,k,U,0,l,e),GraphicsFactoryHelper.addTriangle(k,U,j,G,z,$,0,l,e)):it[h]>=GraphicsPathCommand.BUILD_JOINT&&(j=nt[ot++],G=nt[ot++],R=nt[ot++],V=nt[ot++],k=nt[ot++],U=nt[ot++],GraphicsFactoryHelper.addTriangle(R,V,k,U,j,G,0,l,e),it[h]==GraphicsPathCommand.BUILD_ROUND_JOINT&&(z=nt[ot++],$=nt[ot++],R=nt[ot++],V=nt[ot++],k=nt[ot++],U=nt[ot++],GraphicsFactoryHelper.tesselateCurve(R,V,z,$,k,U,l,!0)));H||(d.x=o[2]-o[0],d.y=o[3]-o[1],d.normalize(),GraphicsFactoryHelper.createCap(o[0],o[1],nt[0],nt[1],nt[2],nt[3],d.x,d.y,r.capstyle,-1,tt,et,l,e),d.x=o[o.length-2]-o[o.length-4],d.y=o[o.length-1]-o[o.length-3],d.normalize(),GraphicsFactoryHelper.createCap(o[o.length-2],o[o.length-1],nt[nt.length-4],nt[nt.length-3],nt[nt.length-2],nt[nt.length-1],d.x,d.y,r.capstyle,1,tt,et,l,e))}if(0!=l.length){var at=new AttributesView(Float32Array,e?3:2);at.set(l);var lt=at.attributesBuffer.cloneBufferView();at.dispose();var ct=new TriangleElements(lt);return ct.setPositions(new Float2Attributes(lt)),ct}},IKb),GraphicsPathWinding=(vMb.EVEN_ODD="evenOdd",vMb.NON_ZERO="nonZero",vMb),GraphicsPath=(Object.defineProperty(wMb.prototype,"dirty",{get:function(){return this._lastDirtyID!==this._dirtyID},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"data_type",{get:function(){return wMb.data_type},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"style",{get:function(){return this._style},set:function(t){this._style=t,this._dirtyID++},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"fill",{get:function(){return null!=this._style&&this._style.data_type==GraphicsFillStyle.data_type?this._style:null},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"stroke",{get:function(){return null!=this._style&&this._style.data_type==GraphicsStrokeStyle.data_type?this._style:null},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"commands",{get:function(){return this._commands},enumerable:!0,configurable:!0}),Object.defineProperty(wMb.prototype,"data",{get:function(){return this._data},enumerable:!0,configurable:!0}),wMb.prototype.cacheSegment=function(t,e,i,n,r,o,s,a,l){void 0===a&&(a=null),void 0===l&&(l=null);var c=i.toString()+"#";c+=o<n?n.toString()+"#"+o.toString():o.toString()+"#"+n.toString(),c+=s<r?r.toString()+"#"+s.toString():s.toString()+"#"+r.toString(),null!=a&&null!=l&&(c+=a.toString()+"#"+l.toString());var h=this._cache[c];null==h&&(this._cache[c]=h=[]),h.push(t),h.push(e),2<h.length&&(this._cacheSharedSegments[c]=h)},wMb.prototype.curveTo=function(t,e,i,n){if(t!=i||e!=n)return this._cur_point.x!=i||this._cur_point.y!=n||this._cur_point.x==t&&this._cur_point.y==e?void((this._cur_point.x!=i||this._cur_point.y!=n)&&this._cur_point.x==t&&this._cur_point.y==e||this._cur_point.x==i&&this._cur_point.y==n&&this._cur_point.x==t&&this._cur_point.y==e?this.lineTo(i,n):(0==this._commands[this._commands.length-1].length&&(this._commands[this._commands.length-1].push(GraphicsPathCommand.MOVE_TO),this._data[this._data.length-1].push(this._cur_point.x),this._data[this._data.length-1].push(this._cur_point.y)),this._commands[this._commands.length-1].push(GraphicsPathCommand.CURVE_TO),this._data[this._data.length-1].push(t),this._data[this._data.length-1].push(e),this._data[this._data.length-1].push(i),this._data[this._data.length-1].push(n),this._cur_point.x=i,this._cur_point.y=n,this._dirtyID++)):(this.lineTo(t,e),void this.moveTo(i,n));this.lineTo(t,e)},wMb.prototype.cubicCurveTo=function(t,e,i,n,r,o){console.log("cubicCurveTo not yet fully supported."),this._cur_point.x==r&&this._cur_point.y==o||(0==this._commands[this._commands.length-1].length&&(this._commands[this._commands.length-1].push(GraphicsPathCommand.MOVE_TO),this._data[this._data.length-1].push(this._cur_point.x),this._data[this._data.length-1].push(this._cur_point.y)),this._commands[this._commands.length-1].push(GraphicsPathCommand.CURVE_TO),this._data[this._data.length-1].push(t),this._data[this._data.length-1].push(e),this._data[this._data.length-1].push(r),this._data[this._data.length-1].push(o),this._cur_point.x=r,this._cur_point.y=o,this._dirtyID++)},wMb.prototype.lineTo=function(t,e){0==this._commands[this._commands.length-1].length&&(this._commands[this._commands.length-1].push(GraphicsPathCommand.MOVE_TO),this._data[this._data.length-1].push(this._cur_point.x),this._data[this._data.length-1].push(this._cur_point.y)),this._commands[this._commands.length-1].push(GraphicsPathCommand.LINE_TO),this._data[this._data.length-1].push(t),this._data[this._data.length-1].push(e),this._cur_point.x=t,this._cur_point.y=e,this._dirtyID++},wMb.prototype.moveTo=function(t,e){this._cur_point.x==t&&this._cur_point.y==e||(0<this._commands[this._commands.length-1].length&&(this._commands.push([GraphicsPathCommand.MOVE_TO]),this._data.push([t,e])),this._startPoint.x=t,this._startPoint.y=e,this._cur_point.x=t,this._cur_point.y=e,this._dirtyID++)},wMb.prototype.wideLineTo=function(t,e){},wMb.prototype.wideMoveTo=function(t,e){},wMb.prototype.mergeContours=function(){var t,e,i,n,r,o,s,a,l,c=-1;this._startMerge==this._endMerge&&(t=this._connectedIdx[this._mergetarget][this._startMerge],e=this.data[this._mergetarget][this._positionOffset[this._mergetarget][this._startMerge]-2],i=this.data[this._mergetarget][this._positionOffset[this._mergetarget][this._startMerge]-1],n=this.data[this._mergetarget][this._positionOffset[this._mergetarget][this._startMerge]],r=this.data[this._mergetarget][this._positionOffset[this._mergetarget][this._startMerge]+1],o=this.data[this._mergeSource][this._positionOffset[this._mergeSource][t]],s=this.data[this._mergeSource][this._positionOffset[this._mergeSource][t]+1],a=this.data[this._mergeSource][this._positionOffset[this._mergeSource][t]+2],l=this.data[this._mergeSource][this._positionOffset[this._mergeSource][t]+3],e==o&&i==s&&n==a&&r==l&&(c=1));var h=this._connectedIdx[this._mergetarget][this._startMerge],u=this._connectedIdx[this._mergetarget][this._endMerge],p=Math.abs(this._startMerge-this._endMerge)+1,d=this._commands[this._mergeSource].length-p,c=-1;u<h&&(c=1);for(var _,f=h,m=0,g=0,y=0,b=0,v=0,x=0,A=0,S=0,w=(this._positionOffset[this._mergeSource][h],0);w<d;w++)switch((f+=c)>=this._commands[this._mergeSource].length&&(f-=this._commands[this._mergeSource].length),f<0&&(f+=this._commands[this._mergeSource].length),this._commands[this._mergeSource][f]){case GraphicsPathCommand.LINE_TO:m=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]],g=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]+1],this._positions[this._mergetarget].push(m),this._positions[this._mergetarget].push(g),y=m,b=g;break;case GraphicsPathCommand.CURVE_TO:for(v=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]],x=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]+1],m=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]+2],g=this.data[this._mergeSource][this._positionOffset[this._mergeSource][f]+3],_=[],GraphicsFactoryHelper.tesselateCurve(y,b,v,x,m,g,_),S=_.length,A=0;A<S;A+=2)this._positions[this._mergetarget].push(_[A]),this._positions[this._mergetarget].push(_[A+1]);y=m,b=g}this._startMerge=-1,this._endMerge=-1,this._mergetarget=-1,this._mergeSource=-1},wMb.prototype.prepare=function(){if(this._dirtyID!==this._lastDirtyID){this._lastDirtyID=this._dirtyID;var t,e,i=[],n=[],r=0,o=0,s=0,a=this.commands.length;if(1!==a||this.commands[0]){for(var l=0;l<a;l++){var c=this.commands[l],h=this.data[l];this._positions[l]=[],this._connectedIdx[l]=[],this._positionOffset[l]=[],n[l]=!1,i[l]=[],.01<Math.abs(h[0]-h[h.length-2])+Math.abs(h[1]-h[h.length-1])&&this.forceClose&&(c[c.length]=GraphicsPathCommand.LINE_TO,h[h.length]=h[0],h[h.length]=h[1])}a=this.commands.length;for(var u=0;u<a;u++){var p=this.commands[u],d=this.data[u],o=0,_=d[o++],f=d[o++],m=0,g=0,y=0,s=0;this._positions[u].push(_),this._positions[u].push(f),this._startMerge=-1,this._endMerge=-1,this._mergetarget=-1,this._mergeSource=-1,o=0,_=d[o++],f=d[o++];for(var b=1;b<p.length;b++)switch(p[b]){case GraphicsPathCommand.MOVE_TO:console.log("ERROR ! ONLY THE FIRST COMMAND FOR A CONTOUR IS ALLOWED TO BE A 'MOVE_TO' COMMAND");break;case GraphicsPathCommand.LINE_TO:m=d[o++],g=d[o++],this._positions[u].push(m),this._positions[u].push(g),_=m,f=g;break;case GraphicsPathCommand.CURVE_TO:for(y=d[o++],s=d[o++],m=d[o++],g=d[o++],e=[],GraphicsFactoryHelper.tesselateCurve(_,f,y,s,m,g,e),r=e.length,t=0;t<r;t+=2)this._positions[u].push(e[t]),this._positions[u].push(e[t+1]);_=m,f=g}}}}},wMb.prototype.invalidate=function(){this._orientedBoxBoundsDirty=!0,this._dirtyID++},wMb.prototype.getBoxBounds=function(t,e,i){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),t?this._internalGetBoxBounds(t,e,i):(this._orientedBoxBoundsDirty&&(this._orientedBoxBoundsDirty=!1,this._orientedBoxBounds=this._internalGetBoxBounds(null,this._orientedBoxBounds,null)),null!=this._orientedBoxBounds&&(i=this._orientedBoxBounds.union(i,i||e)),i)},wMb.prototype._internalGetBoxBounds=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null);var n=0,r=0,o=0,s=0,a=this._positions.length;if(0==a)return i;var l,c,h,u=0,p=0,d=this._positions[p++],_=d.length;for(t&&(h=t._rawData),null==i?(i=e||new Box,c=t?(l=d[u]*h[0]+d[u+1]*h[4]+h[12],d[u]*h[1]+d[u+1]*h[5]+h[13]):(l=d[u],d[u+1]),o=n=l,s=r=c,u+=2):(o=(n=i.x)+i.width,s=(r=i.y)+i.height);u<_;u+=2)c=t?(l=d[u]*h[0]+d[u+1]*h[4]+h[12],d[u]*h[1]+d[u+1]*h[5]+h[13]):(l=d[u],d[u+1]),l<n?n=l:o<l&&(o=l),c<r?r=c:s<c&&(s=c),_-2<=u&&p<a&&(u=0,_=(d=this._positions[p++]).length);return i.width=o-(i.x=n),i.height=s-(i.y=r),i.depth=0,i},wMb.data_type="[graphicsdata path]",wMb),ElementsType=(lOb.TRIANGLE="triangle",lOb.LINE="line",lOb),ParticleGraphicsTransform=(Object.defineProperty(mOb.prototype,"vertexTransform",{get:function(){return this._defaultVertexTransform},set:function(t){this._defaultVertexTransform=t,this._defaultInvVertexTransform=t.clone(),this._defaultInvVertexTransform.invert(),this._defaultInvVertexTransform.transpose()},enumerable:!0,configurable:!0}),Object.defineProperty(mOb.prototype,"UVTransform",{get:function(){return this._defaultUVTransform},set:function(t){this._defaultUVTransform=t},enumerable:!0,configurable:!0}),Object.defineProperty(mOb.prototype,"invVertexTransform",{get:function(){return this._defaultInvVertexTransform},enumerable:!0,configurable:!0}),mOb),Graphics=(pOb=AssetBase,__extends(qOb,pOb),qOb.getGraphics=function(){return qOb._pool.length?qOb._pool.pop():new qOb},qOb.clearPool=function(){qOb._pool=[]},Object.defineProperty(qOb.prototype,"start",{get:function(){return!this._start&&this.sourceGraphics?this.sourceGraphics.start:this._start},set:function(t){this._start=t},enumerable:!0,configurable:!0}),Object.defineProperty(qOb.prototype,"end",{get:function(){return!this._end&&this.sourceGraphics?this.sourceGraphics.end:this._end},set:function(t){this._end=t},enumerable:!0,configurable:!0}),qOb.prototype.updateSlice9=function(t,e){if(this._scaleX!=t||this._scaleY!=e){this._scaleX=t,this._scaleY=e;for(var i=this._shapes.length,n=0;n<i;n++)TriangleElementsUtils.updateTriangleGraphicsSlice9(this._shapes[n].elements,this.originalSlice9Size,t,e);this.invalidate()}},Object.defineProperty(qOb.prototype,"assetType",{get:function(){return qOb.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(qOb.prototype,"count",{get:function(){return this._shapes.length+this._queued_stroke_pathes.length+this._queued_fill_pathes.length+this._queuedShapeTags.length},enumerable:!0,configurable:!0}),Object.defineProperty(qOb.prototype,"queued_stroke_pathes",{get:function(){return this._queued_stroke_pathes},set:function(t){this._queued_stroke_pathes=t},enumerable:!0,configurable:!0}),Object.defineProperty(qOb.prototype,"queued_fill_pathes",{get:function(){return this._queued_fill_pathes},set:function(t){this._queued_fill_pathes=t},enumerable:!0,configurable:!0}),qOb.prototype.add_queued_path=function(t){t.style&&(t.style.data_type!=GraphicsFillStyle.data_type&&t.style.data_type!=GradientFillStyle.data_type&&t.style.data_type!=BitmapFillStyle.data_type||(this._drawingDirty=!0,this._queued_fill_pathes.push(t)),t.style.data_type==GraphicsStrokeStyle.data_type&&(this._queued_stroke_pathes.push(t),this.endFill()))},qOb.prototype.addShape=function(t){t.usages++;var e=this.getShapeIndex(t);return-1!=e&&this.removeShapeAt(e),this._shapes.push(t),t.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateDelegate),t.addEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateDelegate),t.addEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateDelegate),t.addEventListener(AssetEvent.INVALIDATE,this._onInvalidateDelegate),this._scaleX=0,this._scaleY=0,this.invalidate(),t},qOb.prototype.removeShape=function(t){var e=this.getShapeIndex(t);if(-1==e)throw new ArgumentError("Shape parameter is not a shape of the caller");this.removeShapeAt(e)},qOb.prototype.removeShapeAt=function(t){if(t<0||t>=this._shapes.length)throw new RangeError$1("Index is out of range");var e=this._shapes.splice(t,1)[0];e.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateDelegate),e.removeEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateDelegate),e.removeEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateDelegate),e.removeEventListener(AssetEvent.INVALIDATE,this._onInvalidateDelegate),e.usages--,e.usages||e.dispose(),this.invalidate()},qOb.prototype.getShapeAt=function(t){return this._shapes[t]},qOb.prototype.getShapeIndex=function(t){return this._shapes.indexOf(t)},qOb.prototype.applyTransformation=function(t){for(var e=this._shapes.length,i=0;i<e;++i)this._shapes[i].applyTransformation(t)},qOb.prototype.copyTo=function(t,e){void 0===e&&(e=!1),this._drawingDirty&&this.endFill(),this.slice9Rectangle&&(t.slice9Rectangle=new Rectangle,t.slice9Rectangle.copyFrom(this.slice9Rectangle),t.originalSlice9Size=new Rectangle,t.originalSlice9Size.copyFrom(this.originalSlice9Size),t.minSlice9Width=this.minSlice9Width,t.minSlice9Height=this.minSlice9Height),t.sourceGraphics=this,t._addShapes(this._shapes,e)},qOb.prototype.scale=function(t){for(var e=this._shapes.length,i=0;i<e;++i)this._shapes[i].scale(t)},qOb.prototype.clear=function(){for(var t,e=this._shapes.length,i=0;i<e;i++)(t=this._shapes[i]).removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateDelegate),t.removeEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateDelegate),t.removeEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateDelegate),t.removeEventListener(AssetEvent.INVALIDATE,this._onInvalidateDelegate),t.usages--,t.usages||t.dispose();this._shapes.length=0,this.invalidate(),this._active_fill_path=null,this._active_stroke_path=null,this._queued_fill_pathes.length=0,this._queued_stroke_pathes.length=0,this._current_position.x=0,this._current_position.y=0,this._drawingDirty=!1,this._lineStyle=null,this._fillStyle=null},qOb.prototype.dispose=function(){if(this.clear(),this._bitmapFillPool){for(var t in this._bitmapFillPool)this._bitmapFillPool[t].material.dispose();this._bitmapFillPool=null}this._bitmapFillPool=null,qOb._pool.push(this)},qOb.prototype.scaleUV=function(t,e){void 0===t&&(t=1),void 0===e&&(e=1);for(var i=this._shapes.length,n=0;n<i;++n)this._shapes[n].scaleUV(t,e)},qOb.prototype._acceptTraverser=function(t){this._drawingDirty&&this.endFill();for(var e=this._shapes.length-1;0<=e;e--)t.applyTraversable(this._shapes[e])},qOb.prototype._onInvalidate=function(t){this.invalidate()},qOb.prototype.draw_fills=function(){GraphicsFactoryFills.draw_pathes(this),this._active_fill_path=null},qOb.prototype.draw_strokes=function(){GraphicsFactoryStrokes.draw_pathes(this),this._active_stroke_path=null},qOb.prototype.beginBitmapFill=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=!1),this.draw_fills(),this._bitmapFillPool||(this._bitmapFillPool={});var r=this._bitmapFillPool[t.id];r?(r.matrix=e,r.repeat=i,r.smooth=n):r=this._bitmapFillPool[t.id]=new BitmapFillStyle(MaterialManager.get_material_for_BitmapImage2D(t),e,i,n),this._fillStyle=r},qOb.prototype.beginFill=function(t,e){void 0===e&&(e=1),0==t&&(t=65793),this.draw_fills(),this._fillStyle=new GraphicsFillStyle(t,e)},qOb.prototype.beginGradientFill=function(t,e,i,n,r,o,s,a){void 0===r&&(r=null),void 0===o&&(o="pad"),void 0===s&&(s="rgb"),void 0===a&&(a=0),this.draw_fills(),this._fillStyle=new GradientFillStyle(t,e,i,n,r,o,s,a)},qOb.prototype.copyFrom=function(t){t.copyTo(this)},qOb.prototype.cubicCurveTo=function(t,e,i,n,r,o){throw new PartialImplementationError("cubicCurveTo")},qOb.prototype.curveTo=function(t,e,i,n){this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&this._active_fill_path.curveTo(t,e,i,n),null!=this._active_stroke_path&&this._active_stroke_path.curveTo(t,e,i,n),this._current_position.x=i,this._current_position.y=n,this.invalidate()},qOb.prototype.drawCircle=function(t,e,i){var n;this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&(this._active_fill_path.moveTo(t,e),n=i,null!=this._active_stroke_path&&(n-=this._active_stroke_path.style.thickness/2),GraphicsFactoryHelper.drawElipse(t,e,n,n,this._active_fill_path.verts,0,360,5,!1)),null!=this._active_stroke_path&&(this._active_stroke_path.moveTo(t,e),GraphicsFactoryHelper.drawElipseStrokes(t,e,i,i,this._active_stroke_path.verts,0,360,5,this._active_stroke_path.style.thickness/2,!1)),this.invalidate()},qOb.prototype.drawEllipse=function(t,e,i,n){var r,o;this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&(this._active_fill_path.moveTo(t,e),r=i,o=n,null!=this._active_stroke_path&&(r-=this._active_stroke_path.style.thickness/2,o-=this._active_stroke_path.style.thickness/2),GraphicsFactoryHelper.drawElipse(t,e,r,o,this._active_fill_path.verts,0,360,5,!1)),null!=this._active_stroke_path&&(this._active_stroke_path.moveTo(t,e),GraphicsFactoryHelper.drawElipseStrokes(t,e,i,n,this._active_stroke_path.verts,0,360,5,this._active_stroke_path.style.thickness/2,!1)),this.invalidate()},qOb.prototype.drawGraphicsData=function(t){},qOb.prototype.drawPath=function(t,e,i){},qOb.prototype.drawRect=function(t,e,i,n){var r,o,s;this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&(this._active_fill_path.moveTo(t,e),r=i,o=n,s=0,null!=this._active_stroke_path&&(s=this._active_stroke_path.style.thickness/2,r-=this._active_stroke_path.style.thickness,o-=this._active_stroke_path.style.thickness),GraphicsFactoryHelper.addTriangle(t+s,e+o+s,t+s,e+s,t+r+s,e+s,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+s,e+o+s,t+s+r,e+s,t+r+s,e+o+s,0,this._active_fill_path.verts,!1)),null!=this._active_stroke_path&&(this._active_stroke_path.moveTo(t,e),this._active_stroke_path.lineTo(t+i,e),this._active_stroke_path.lineTo(t+i,e+n),this._active_stroke_path.lineTo(t,e+n),this._active_stroke_path.lineTo(t,e)),this.invalidate()},qOb.prototype.drawRoundRect=function(t,e,i,n,r,o){void 0===o&&(o=NaN),this._drawingDirty=!0,this._createGraphicPathes(),isNaN(o)&&(o=r);var s=i,a=n,l=r/2,c=o/2,h=0;null!=this._active_fill_path&&(this._active_fill_path.moveTo(t,e),null!=this._active_stroke_path&&(h=this._active_stroke_path.style.thickness/2,s-=this._active_stroke_path.style.thickness,a-=this._active_stroke_path.style.thickness),GraphicsFactoryHelper.addTriangle(t+h,e+a-c,t+h,e+c,t+s-h,e+c,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+a-c,t+s-h,e+c,t+s-h,e+a-c,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+h,t+s-l,e+c,t+l,e+c,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+h,t+s-l,e+h,t+s-l,e+c,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+a-c,t+s-l,e+a-h,t+l,e+a-h,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+a-c,t+s-l,e+a-c,t+s-l,e+a-h,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.drawElipse(t+l,e+c,l-h,c-h,this._active_fill_path.verts,180,270,5,!1),GraphicsFactoryHelper.drawElipse(t+s-l,e+c,l-h,c-h,this._active_fill_path.verts,270,360,5,!1),GraphicsFactoryHelper.drawElipse(t+s-l,e+a-c,l-h,c-h,this._active_fill_path.verts,0,90,5,!1),GraphicsFactoryHelper.drawElipse(t+l,e+a-c,l-h,c-h,this._active_fill_path.verts,90,180,5,!1)),null!=this._active_stroke_path&&(this._active_stroke_path.moveTo(t,e),h=this._active_stroke_path.style.thickness/2,GraphicsFactoryHelper.addTriangle(t-h,e+a-c,t-h,e+c,t+h,e+c,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t-h,e+a-c,t+h,e+a-c,t+h,e+c,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e-h,t+s-l,e-h,t+l,e+h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+h,t+s-l,e-h,t+s-l,e+h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+s-h,e+a-c,t+s-h,e+c,t+s+h,e+a-c,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+s+h,e+a-c,t+s+h,e+c,t+s-h,e+c,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+a+h,t+s-l,e+a+h,t+l,e+a-h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l,e+a-h,t+s-l,e+a+h,t+s-l,e+a-h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.drawElipseStrokes(t+l,e+c,l,c,this._active_stroke_path.verts,180,270,5,h,!1),GraphicsFactoryHelper.drawElipseStrokes(t+s-l,e+c,l,c,this._active_stroke_path.verts,270,360,5,h,!1),GraphicsFactoryHelper.drawElipseStrokes(t+s-l,e+a-c,l,c,this._active_stroke_path.verts,0,90,5,h,!1),GraphicsFactoryHelper.drawElipseStrokes(t+l,e+a-c,l,c,this._active_stroke_path.verts,90,180,5,h,!1)),this.invalidate()},qOb.prototype.drawRoundRectComplex=function(t,e,i,n,r,o,s,a){var l=i,c=n,h=r,u=o,p=s,d=a;this._drawingDirty=!0,this._createGraphicPathes();var _=0;null!=this._active_fill_path&&(this._active_fill_path.moveTo(t,e),null!=this._active_stroke_path&&(_=this._active_stroke_path.style.thickness/2,l-=this._active_stroke_path.style.thickness,c-=this._active_stroke_path.style.thickness),GraphicsFactoryHelper.addTriangle(t+h,e+h,t+l-u,e+u,t+l-d,e+c-d,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+h,t+l-d,e+c-d,t+p,e+c-p,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+_,e+h,t+h,e+h,t+_,e+c-p,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+h,t+_,e+c-p,t+p,e+c-p,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+_,t+h,e+h,t+l-u,e+_,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+h,t+l-u,e+u,t+l-u,e+_,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l-_,e+u,t+l-u,e+u,t+l-_,e+c-d,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l-u,e+u,t+l-d,e+c-d,t+l-_,e+c-d,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+p,e+c-_,t+l-d,e+c-_,t+p,e+c-p,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+p,e+c-p,t+l-d,e+c-_,t+l-d,e+c-d,0,this._active_fill_path.verts,!1),GraphicsFactoryHelper.drawElipse(t+h,e+h,h-_,h-_,this._active_fill_path.verts,180,270,5,!1),GraphicsFactoryHelper.drawElipse(t+l-u,e+u,u-_,u-_,this._active_fill_path.verts,270,360,5,!1),GraphicsFactoryHelper.drawElipse(t+l-d,e+c-d,d-_,d-_,this._active_fill_path.verts,0,90,5,!1),GraphicsFactoryHelper.drawElipse(t+p,e+c-p,p-_,p-_,this._active_fill_path.verts,90,180,5,!1)),null!=this._active_stroke_path&&(this._active_stroke_path.moveTo(t,e),_=this._active_stroke_path.style.thickness/2,GraphicsFactoryHelper.addTriangle(t-_,e+c-p,t-_,e+h,t+_,e+h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t-_,e+c-p,t+_,e+c-p,t+_,e+h,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e-_,t+l-u,e-_,t+u,e+_,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+h,e+_,t+l-u,e-_,t+l-u,e+_,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l-_,e+c-d,t+l-_,e+u,t+l+_,e+c-d,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+l+_,e+c-d,t+l+_,e+u,t+l-_,e+u,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+p,e+c+_,t+l-d,e+c+_,t+p,e+c-_,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.addTriangle(t+p,e+c-_,t+l-d,e+c+_,t+l-d,e+c-_,0,this._active_stroke_path.verts,!1),GraphicsFactoryHelper.drawElipseStrokes(t+h,e+h,h,h,this._active_stroke_path.verts,180,270,5,_,!1),GraphicsFactoryHelper.drawElipseStrokes(t+l-u,e+u,u,u,this._active_stroke_path.verts,270,360,5,_,!1),GraphicsFactoryHelper.drawElipseStrokes(t+l-d,e+c-d,d,d,this._active_stroke_path.verts,0,90,5,_,!1),GraphicsFactoryHelper.drawElipseStrokes(t+p,e+c-p,p,p,this._active_stroke_path.verts,90,180,5,_,!1)),this.invalidate()},qOb.prototype.drawTriangles=function(t,e,i,n){this._drawingDirty=!0,this._active_fill_path,this._active_stroke_path},qOb.prototype.endFill=function(){if(this._queuedShapeTags.length){var t=this._queuedShapeTags,e=t.length;this._queuedShapeTags=[];for(var i=0;i<e;i++)this.convertRecordsToShapeData(t[i]);t.length=0}this._drawingDirty=!1,this._active_stroke_path&&this._active_fill_path&&(this._active_stroke_path.forceClose=!0),this.draw_fills(),this.draw_strokes(),this._active_fill_path=null,this._active_stroke_path=null,this._fillStyle=null},qOb.prototype.lineBitmapStyle=function(t,e,i,n){},qOb.prototype.lineGradientStyle=function(t,e,i,n,r,o,s,a){this._drawingDirty=!0,this._lineStyle=new GraphicsStrokeStyle(e[0],i[0],1)},qOb.prototype.lineStyle=function(t,e,i,n,r,o,s,a){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=1),void 0===o&&(o=CapsStyle.NONE),void 0===s&&(s=JointStyle.MITER),void 0===a&&(a=100),this._drawingDirty=!0,this._lineStyle=new GraphicsStrokeStyle(e,i,t,s,o,a)},qOb.prototype.lineTo=function(t,e){this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&this._active_fill_path.lineTo(t,e),null!=this._active_stroke_path&&this._active_stroke_path.lineTo(t,e),this._current_position.x=t,this._current_position.y=e,this.invalidate()},qOb.prototype.moveTo=function(t,e){this._drawingDirty=!0,this._createGraphicPathes(),null!=this._active_fill_path&&this._active_fill_path.moveTo(t,e),null!=this._active_stroke_path&&this._active_stroke_path.moveTo(t,e),this._current_position.x=t,this._current_position.y=e,this.invalidate()},qOb.prototype.queueShapeTag=function(t){this._queuedShapeTags.push(t),this._drawingDirty=!0},qOb.prototype._createGraphicPathes=function(){null==this._fillStyle||null!=this._active_fill_path&&this._active_fill_path.style==this._fillStyle||(this._active_fill_path=new GraphicsPath,this._active_fill_path.style=this._fillStyle,0==this._current_position.x&&0==this._current_position.y||this._active_fill_path.moveTo(this._current_position.x,this._current_position.y),this._queued_fill_pathes.push(this._active_fill_path)),null==this._lineStyle||null!=this._active_stroke_path&&this._active_stroke_path.style==this._lineStyle||(this._active_stroke_path=new GraphicsPath,this._active_stroke_path.style=this._lineStyle,0==this._current_position.x&&0==this._current_position.y||this._active_stroke_path.moveTo(this._current_position.x,this._current_position.y),this._queued_stroke_pathes.push(this._active_stroke_path))},qOb.prototype._addShapes=function(t,e){var i;void 0===e&&(e=!1);for(var n=t.length,r=0;r<n;r++)i=t[r],this.slice9Rectangle?i=Shape.getShape(TriangleElementsUtils.updateTriangleGraphicsSlice9(i.elements,this.originalSlice9Size,1,1,!1,!0),i.material,i.style):e&&(i=Shape.getShape(i.elements,i.material,i.style,i.count,i.offset)),i.particleCollection=t[r].particleCollection,i.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateDelegate),i.addEventListener(RenderableEvent.INVALIDATE_MATERIAL,this._onInvalidateDelegate),i.addEventListener(RenderableEvent.INVALIDATE_STYLE,this._onInvalidateDelegate),i.addEventListener(AssetEvent.INVALIDATE,this._onInvalidateDelegate),this._shapes.push(i),i.usages++;this._scaleX=0,this._scaleY=0,this._scale.identity(),this.invalidate()},qOb.prototype._isShapeMaterial=function(t){for(var e=this._shapes.length,i=0;i<e;i++)if(t==this._shapes[i].material)return!0;return!1},qOb.prototype.convertRecordsToShapeData=function(t){for(var e,i,n,r=t.records,o=t.fillStyles,s=t.lineStyles,a=t.recordsMorph||null,l=t.parser,c=createPathsList(o,!1,!!a,l),h=createPathsList(s,!0,!!a,l),u=null!==a,p={fill0:0,fill1:0,line:0},d=[],_=r.length,f=0,m=0,g=0,y=0,b=0,v=0;b<_;b++){var x,A=r[b];if(u&&(x=a[v++]),0===A.type){for(var S=0;S<3;S++)d[S]=void 0;16&A.flags&&(e=e||[],this.push.apply(e,c),c=createPathsList(A.fillStyles,!1,u,l),this.push.apply(e,h),h=createPathsList(A.lineStyles,!0,u,l),p={fill0:0,fill1:0,line:0}),2&A.flags&&(p.fill0=A.fillStyle0),4&A.flags&&(p.fill1=A.fillStyle1),8&A.flags&&(p.line=A.lineStyle),p.fill0&&(d[0]={path:c[p.fill0-1]}),p.fill1&&(d[1]={path:c[p.fill1-1]}),p.line&&(d[2]={path:h[p.line-1]}),1&A.flags&&(f=0|A.moveX,m=0|A.moveY),p.fill1&&p.fill0&&p.fill0==p.fill1&&(d[0]=d[1]=void 0),u&&(0===x.type?(g=0|x.moveX,y=0|x.moveY):v--);for(var w=0;w<3;w++)(C=d[w])&&(C.segment=PathSegment.FromDefaults(u),C.path.addSegment(C.segment),u?C.segment.morphMoveTo(f,m,g,y):C.segment.moveTo(f,m))}else{if(assert(1===A.type),u){for(;x&&0===x.type;)x=a[v++];x=x||A}if(32&A.flags&&(!u||32&x.flags)){f+=0|A.deltaX,m+=0|A.deltaY,u&&(g+=0|x.deltaX,y+=0|x.deltaY);for(var C,P=0;P<3;P++)(C=d[P])&&(u?C.segment.morphLineTo(f,m,g,y):C.segment.lineTo(f,m))}else{var E=this.transformCurve(A,f,m),f=E.x,m=E.y,T=void 0;u&&(g=(T=this.transformCurve(x,g,y)).x,y=T.y);for(var M=0;M<3;M++){var D,I=d[M];I&&(D=I.segment,u?D.morphCurveTo(E.cx,E.cy,f,m,T.cx,T.cy,g,y):D.curveTo(E.cx,E.cy,f,m))}}}}if(e=(e||[]).concat(c||[],h||[],[]),u)for(this.start=[],this.end=[],b=0;b<e.length;b++)i=new GraphicsPath,n=new GraphicsPath,e[b].serializeAJS(i,n),this.start.push(i),this.end.push(n);else for(b=0;b<e.length;b++)i=new GraphicsPath,e[b].serializeAJS(i,null),this.add_queued_path(i)},qOb.prototype.transformCurve=function(t,e,i){var n,r,o,s;return 32&t.flags?(o=e+((n=0|t.deltaX)>>1),s=i+((r=0|t.deltaY)>>1),e+=n,i+=r):(o=e+t.controlDeltaX|0,s=i+t.controlDeltaY|0,e=o+t.anchorDeltaX|0,i=s+t.anchorDeltaY|0),{cx:o,cy:s,x:e,y:i}},qOb._pool=new Array,qOb.assetType="[asset Graphics]",qOb),IDENTITY_MATRIX={a:1,b:0,c:0,d:1,tx:0,ty:0},pOb;function qOb(){var e=pOb.call(this)||this;return e._bitmapFillPool={},e._queuedShapeTags=[],e._shapes=[],e._current_position=new Point,e._scale=new Vector3D,e._scaleX=0,e._scaleY=0,e._drawingDirty=!1,e.usages=0,e.push=Array.prototype.push,e._drawingDirty=!1,e._current_position=new Point,e._queued_fill_pathes=[],e._queued_stroke_pathes=[],e._active_fill_path=null,e._active_stroke_path=null,e._fillStyle=null,e._lineStyle=null,e._onInvalidateDelegate=function(t){return e._onInvalidate(t)},e}function mOb(){}function lOb(){}function wMb(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=GraphicsPathWinding.EVEN_ODD),this._orientedBoxBoundsDirty=!0,this._lastDirtyID=0,this._dirtyID=-1,this._startMerge=-1,this._endMerge=-1,this._mergeSource=-1,this._mergetarget=-1,this._connectedIdx=[],this._positionOffset=[],this.forceClose=!1,this._cache={},this._cacheSharedSegments={},this._data=[],this._commands=[],this._style=null,this.verts=[],this._positions=[],null!=t&&null!=e?(this._data[0]=e,this._commands[0]=t):(this._data[0]=[],this._commands[0]=[]),this._startPoint=new Point,this._cur_point=new Point,this._winding_rule=i,this._winding_directions=[]}function vMb(){}function IKb(){}function HKb(){}function TJb(){}function processStyle(t,e,i,n){var r,o=t;if(i&&(o.morph=processMorphStyle(t,e)),e){if(o.miterLimit=2*(t.miterLimitFactor||1.5),t.color||!t.hasFill)return o.type=FillType.Solid,o;var s=processStyle(t.fillStyle,!1,!1,n);return o.type=s.type,o.transform=s.transform,o.colors=s.colors,o.ratios=s.ratios,o.focalPoint=s.focalPoint,o.bitmapId=s.bitmapId,o.material=s.material,o.repeat=s.repeat,t.fillStyle=null,o}if(void 0===t.type||t.type===FillType.Solid)return o;switch(t.type){case FillType.LinearGradient:case FillType.RadialGradient:case FillType.FocalRadialGradient:for(var a=t.records,l=o.colors=[],c=o.ratios=[],h=0;h<a.length;h++){var u=a[h];0!=c.length&&c[c.length-1]==u.ratio||(l.push(u.color),c.push(u.ratio))}r=1;break;case FillType.RepeatingBitmap:case FillType.ClippedBitmap:case FillType.NonsmoothedRepeatingBitmap:case FillType.NonsmoothedClippedBitmap:o.smooth=t.type!==FillType.NonsmoothedRepeatingBitmap&&t.type!==FillType.NonsmoothedClippedBitmap,o.repeat=t.type!==FillType.ClippedBitmap&&t.type!==FillType.NonsmoothedClippedBitmap,o.material=n.getMaterial(t.bitmapId),r=.05;break;default:console.log("shape parser encountered invalid fill style "+t.type)}if(!t.matrix)return o.transform=IDENTITY_MATRIX,o;var p=t.matrix;return o.transform={a:p.a*r,b:p.b*r,c:p.c*r,d:p.d*r,tx:p.tx/20,ty:p.ty/20},t.matrix=null,o}function processMorphStyle(t,e){var i,n=Object.create(t);if(e){if(n.width=t.widthMorph,t.color||!t.hasFill)return n.color=t.colorMorph,n;var r=processMorphStyle(t.fillStyle,!1);return n.transform=r.transform,n.colors=r.colors,n.ratios=r.ratios,n}if(void 0===t.type)return n;if(t.type===FillType.Solid)return n.color=t.colorMorph,n;switch(t.type){case FillType.LinearGradient:case FillType.RadialGradient:case FillType.FocalRadialGradient:for(var o=t.records,s=n.colors=[],a=n.ratios=[],l=0;l<o.length;l++){var c=o[l];s.push(c.colorMorph),a.push(c.ratioMorph)}i=1;break;case FillType.RepeatingBitmap:case FillType.ClippedBitmap:case FillType.NonsmoothedRepeatingBitmap:case FillType.NonsmoothedClippedBitmap:i=.05;break;default:console.log("shape parser encountered invalid fill style")}if(!t.matrix)return n.transform=IDENTITY_MATRIX,n;var h=t.matrixMorph;return n.transform={a:h.a*i,b:h.b*i,c:h.c*i,d:h.d*i,tx:h.tx/20,ty:h.ty/20},n}function createPathsList(t,e,i,n){for(var r=[],o=0;o<t.length;o++){var s=processStyle(t[o],e,i,n);r[o]=e?new SegmentedPath(null,s):new SegmentedPath(s,null)}return r}console.debug("AwayJS - Graphics - 0.5.17");var DisplayObjectEvent=(wSb=EventBase,__extends(xSb,wSb),Object.defineProperty(xSb.prototype,"object",{get:function(){return this._object},enumerable:!0,configurable:!0}),xSb.prototype.clone=function(){return new xSb(this.type,this._object)},xSb.VISIBLITY_UPDATED="visiblityUpdated",xSb.SCENETRANSFORM_CHANGED="scenetransformChanged",xSb.PARTITION_CHANGED="partitionChanged",xSb),FocusEvent=(BSb=EventBase,__extends(CSb,BSb),CSb.prototype.clone=function(){var t=new CSb(this.type);return t.view=this.view,t.entity=this.entity,t},CSb.FOCUS_IN="focusIn3d",CSb.FOCUS_OUT="focusOut3d",CSb),PrefabBase=(FSb=AssetBase,__extends(GSb,FSb),GSb.prototype.getNewObject=function(){var t=this._pCreateObject();return this._pObjects.push(t),t},GSb.prototype._pCreateObject=function(){throw new AbstractMethodError},GSb.prototype._iValidate=function(){},GSb),PrimitivePrefabBase=(JSb=PrefabBase,__extends(KSb,JSb),Object.defineProperty(KSb.prototype,"assetType",{get:function(){return KSb.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(KSb.prototype,"elementsType",{get:function(){return this._elementsType},enumerable:!0,configurable:!0}),Object.defineProperty(KSb.prototype,"material",{get:function(){return this._material},set:function(t){if(t!=this._material){this._material=t;for(var e=this._pObjects.length,i=0;i<e;i++)this._pObjects[i].material=this._material}},enumerable:!0,configurable:!0}),Object.defineProperty(KSb.prototype,"scaleU",{get:function(){return this._scaleU},set:function(t){this._scaleU!=t&&(this._scaleU=t,this._pInvalidateUVs())},enumerable:!0,configurable:!0}),Object.defineProperty(KSb.prototype,"scaleV",{get:function(){return this._scaleV},set:function(t){this._scaleV!=t&&(this._scaleV=t,this._pInvalidateUVs())},enumerable:!0,configurable:!0}),KSb.prototype._pBuildGraphics=function(t,e){throw new AbstractMethodError},KSb.prototype._pBuildUVs=function(t,e){throw new AbstractMethodError},KSb.prototype._pInvalidatePrimitive=function(){this._primitiveDirty=!0},KSb.prototype._pInvalidateUVs=function(){this._uvDirty=!0},KSb.prototype.updateGraphics=function(){this._pBuildGraphics(this._elements,this._elementsType),this._primitiveDirty=!1},KSb.prototype.updateUVs=function(){this._pBuildUVs(this._elements,this._elementsType),this._uvDirty=!1},KSb.prototype._iValidate=function(){this._primitiveDirty&&this.updateGraphics(),this._uvDirty&&this.updateUVs()},KSb.prototype._pCreateObject=function(){var t=new Sprite(null,this._material);return t.graphics.addShape(Shape.getShape(this._elements)),t._iSourcePrefab=this,t},KSb.assetType="[asset PrimitivePrefab]",KSb),PrimitiveCubePrefab=(ZSb=PrimitivePrefabBase,__extends($Sb,ZSb),Object.defineProperty($Sb.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"depth",{get:function(){return this._depth},set:function(t){this._depth=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"tile6",{get:function(){return this._tile6},set:function(t){this._tile6=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty($Sb.prototype,"segmentsD",{get:function(){return this._segmentsD},set:function(t){this._segmentsD=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),$Sb.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a,l,c,h,u,p,d,_,f=0,m=this._width/2,g=this._height/2,y=this._depth/2;if(e==ElementsType.TRIANGLE){var b=t,v=2*((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1)),x=12*(this._segmentsW*this._segmentsH+this._segmentsW*this._segmentsD+this._segmentsH*this._segmentsD);for(v==b.numVertices&&null!=b.indices?(b.invalidateIndices(),b.invalidateVertices(b.positions),b.invalidateVertices(b.normals),b.invalidateVertices(b.tangents)):(b.setIndices(new Uint16Array(x)),b.setPositions(new Float32Array(3*v)),b.setNormals(new Float32Array(3*v)),b.setTangents(new Float32Array(3*v)),this._pInvalidateUVs()),i=b.indices.get(b.numElements),w=b.positions.get(v),n=b.normals.get(v),r=b.tangents.get(v),o=b.concatenatedBuffer.stride/4,E=P=0,u=this._width/this._segmentsW,p=this._height/this._segmentsH,d=this._depth/this._segmentsD,T=0;T<=this._segmentsW;T++)for(_=T*u-m,h=0;h<=this._segmentsH;h++)w[P]=_,w[P+1]=h*p-g,w[P+2]=-y,n[P]=0,n[P+1]=0,n[P+2]=-1,r[P]=1,r[P+1]=0,r[P+2]=0,w[P+=o]=_,w[P+1]=h*p-g,w[P+2]=y,n[P]=0,n[P+1]=0,n[P+2]=1,r[P]=-1,r[P+1]=0,r[P+2]=0,P+=o,T&&h&&(l=2+(s=2*((T-1)*(this._segmentsH+1)+(h-1))),c=2+(a=2*(T*(this._segmentsH+1)+(h-1))),i[E++]=s,i[E++]=l,i[E++]=c,i[E++]=s,i[E++]=c,i[E++]=a,i[E++]=a+1,i[E++]=c+1,i[E++]=l+1,i[E++]=a+1,i[E++]=l+1,i[E++]=s+1);for(f+=2*(this._segmentsW+1)*(this._segmentsH+1),T=0;T<=this._segmentsW;T++)for(_=T*u-m,h=0;h<=this._segmentsD;h++)w[P]=_,w[P+1]=g,w[P+2]=h*d-y,n[P]=0,n[P+1]=1,n[P+2]=0,r[P]=1,r[P+1]=0,r[P+2]=0,w[P+=o]=_,w[P+1]=-g,w[P+2]=h*d-y,n[P]=0,n[P+1]=-1,n[P+2]=0,r[P]=1,r[P+1]=0,r[P+2]=0,P+=o,T&&h&&(l=(s=f+2*((T-1)*(this._segmentsD+1)+(h-1)))+2,c=(a=f+2*(T*(this._segmentsD+1)+(h-1)))+2,i[E++]=s,i[E++]=l,i[E++]=c,i[E++]=s,i[E++]=c,i[E++]=a,i[E++]=a+1,i[E++]=c+1,i[E++]=l+1,i[E++]=a+1,i[E++]=l+1,i[E++]=s+1);for(f+=2*(this._segmentsW+1)*(this._segmentsD+1),T=0;T<=this._segmentsD;T++)for(_=y-T*d,h=0;h<=this._segmentsH;h++)w[P]=-m,w[P+1]=h*p-g,w[P+2]=_,n[P]=-1,n[P+1]=0,n[P+2]=0,r[P]=0,r[P+1]=0,r[P+2]=-1,w[P+=o]=m,w[P+1]=h*p-g,w[P+2]=_,n[P]=1,n[P+1]=0,n[P+2]=0,r[P]=0,r[P+1]=0,r[P+2]=1,P+=o,T&&h&&(l=(s=f+2*((T-1)*(this._segmentsH+1)+(h-1)))+2,c=(a=f+2*(T*(this._segmentsH+1)+(h-1)))+2,i[E++]=s,i[E++]=l,i[E++]=c,i[E++]=s,i[E++]=c,i[E++]=a,i[E++]=a+1,i[E++]=c+1,i[E++]=l+1,i[E++]=a+1,i[E++]=l+1,i[E++]=s+1)}else if(e==ElementsType.LINE){for(var A=t,S=4*this._segmentsH+4*this._segmentsW+4*this._segmentsD,w=new Float32Array(6*S),C=new Float32Array(S),P=0,E=0,T=0;T<this._segmentsH;++T)w[P++]=-m,w[P++]=T*this._height/this._segmentsH-g,w[P++]=-y,w[P++]=m,w[P++]=T*this._height/this._segmentsH-g,w[P++]=-y,C[E++]=1,w[P++]=-m,w[P++]=g-T*this._height/this._segmentsH,w[P++]=y,w[P++]=m,w[P++]=g-T*this._height/this._segmentsH,w[P++]=y,C[E++]=1;for(T=0;T<this._segmentsW;++T)w[P++]=T*this._width/this._segmentsW-m,w[P++]=-g,w[P++]=-y,w[P++]=T*this._width/this._segmentsW-m,w[P++]=g,w[P++]=-y,C[E++]=1,w[P++]=m-T*this._width/this._segmentsW,w[P++]=-g,w[P++]=y,w[P++]=m-T*this._width/this._segmentsW,w[P++]=g,w[P++]=y,C[E++]=1;for(T=0;T<this._segmentsH;++T)w[P++]=-m,w[P++]=T*this._height/this._segmentsH-g,w[P++]=-y,w[P++]=-m,w[P++]=T*this._height/this._segmentsH-g,w[P++]=y,C[E++]=1,w[P++]=m,w[P++]=g-T*this._height/this._segmentsH,w[P++]=-y,w[P++]=m,w[P++]=g-T*this._height/this._segmentsH,w[P++]=y,C[E++]=1;for(T=0;T<this._segmentsD;++T)w[P++]=m,w[P++]=-g,w[P++]=T*this._depth/this._segmentsD-y,w[P++]=m,w[P++]=g,w[P++]=T*this._depth/this._segmentsD-y,C[E++]=1,w[P++]=-m,w[P++]=-g,w[P++]=y-T*this._depth/this._segmentsD,w[P++]=-m,w[P++]=g,w[P++]=y-T*this._depth/this._segmentsD,C[E++]=1;for(T=0;T<this._segmentsD;++T)w[P++]=-m,w[P++]=-g,w[P++]=y-T*this._depth/this._segmentsD,w[P++]=m,w[P++]=-g,w[P++]=y-T*this._depth/this._segmentsD,C[E++]=1,w[P++]=-m,w[P++]=g,w[P++]=T*this._depth/this._segmentsD-y,w[P++]=m,w[P++]=g,w[P++]=T*this._depth/this._segmentsD-y,C[E++]=1;for(T=0;T<this._segmentsW;++T)w[P++]=m-T*this._width/this._segmentsW,w[P++]=-g,w[P++]=-y,w[P++]=m-T*this._width/this._segmentsW,w[P++]=-g,w[P++]=y,C[E++]=1,w[P++]=T*this._width/this._segmentsW-m,w[P++]=g,w[P++]=-y,w[P++]=T*this._width/this._segmentsW-m,w[P++]=g,w[P++]=y,C[E++]=1;A.setPositions(w),A.setThickness(C)}},$Sb.prototype._pBuildUVs=function(t,e){var i,n,r,o,s,a,l,c,h,u,p,d,_,f,m,g;if(e==ElementsType.TRIANGLE){g=2*((this._segmentsW+1)*(this._segmentsH+1)+(this._segmentsW+1)*(this._segmentsD+1)+(this._segmentsH+1)*(this._segmentsD+1));var y=t;for(y.uvs&&g==y.numVertices?y.invalidateVertices(y.uvs):y.setUVs(new Float32Array(2*g)),o=y.uvs.get(g),s=y.uvs.stride,this._tile6?(a=c=1/3,l=h=.5):(a=l=1,c=h=0),u=+c,p=+h,d=2*c,_=(r=0)*h,f=a/this._segmentsW,m=l/this._segmentsH,i=0;i<=this._segmentsW;i++)for(n=0;n<=this._segmentsH;n++)o[r]=(u+i*f)*this._scaleU,o[r+1]=(p+(l-n*m))*this._scaleV,o[r+=s]=(d+(a-i*f))*this._scaleU,o[r+1]=(_+(l-n*m))*this._scaleV,r+=s;for(u=+c,d=0*c,_=p=0*h,f=a/this._segmentsW,m=l/this._segmentsD,i=0;i<=this._segmentsW;i++)for(n=0;n<=this._segmentsD;n++)o[r]=(u+i*f)*this._scaleU,o[r+1]=(p+(l-n*m))*this._scaleV,o[r+=s]=(d+i*f)*this._scaleU,o[r+1]=(_+n*m)*this._scaleV,r+=s;for(u=0*c,d=2*c,_=p=+h,f=a/this._segmentsD,m=l/this._segmentsH,i=0;i<=this._segmentsD;i++)for(n=0;n<=this._segmentsH;n++)o[r]=(u+i*f)*this._scaleU,o[r+1]=(p+(l-n*m))*this._scaleV,o[r+=s]=(d+(a-i*f))*this._scaleU,o[r+1]=(_+(l-n*m))*this._scaleV,r+=s}},$Sb),PrimitiveSpherePrefab=(kUb=PrimitivePrefabBase,__extends(lUb,kUb),Object.defineProperty(lUb.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(lUb.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(lUb.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(lUb.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),lUb.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a;if(e==ElementsType.TRIANGLE){var l,c,h,u=t;for((a=(this._segmentsH+1)*(this._segmentsW+1))==u.numVertices&&null!=u.indices?(u.invalidateIndices(),u.invalidateVertices(u.positions),u.invalidateVertices(u.normals),u.invalidateVertices(u.tangents)):(u.setIndices(new Uint16Array((this._segmentsH-1)*this._segmentsW*6)),u.setPositions(new Float32Array(3*a)),u.setNormals(new Float32Array(3*a)),u.setTangents(new Float32Array(3*a)),this._pInvalidateUVs()),i=u.indices.get(u.numElements),T=u.positions.get(a),n=u.normals.get(a),r=u.tangents.get(a),o=u.concatenatedBuffer.stride/4,O=I=D=0;O<=this._segmentsH;++O){l=D;for(var p=Math.PI*O/this._segmentsH,d=-this._radius*Math.cos(p),_=this._radius*Math.sin(p),f=0;f<=this._segmentsW;++f){var m,g,y,b,v=2*Math.PI*f/this._segmentsW,x=_*Math.cos(v),A=_*Math.sin(v),S=1/Math.sqrt(x*x+A*A+d*d),w=Math.sqrt(A*A+x*x),C=this._yUp?(c=0,h=.007<w?x/w:0,s=-d,A):(c=.007<w?x/w:0,h=0,s=A,d);f==this._segmentsW?(T[D]=T[l],T[D+1]=T[l+1],T[D+2]=T[l+2],n[D]=n[l]+x*S*.5,n[D+1]=n[l+1]+s*S*.5,n[D+2]=n[l+2]+C*S*.5):(T[D]=x,T[D+1]=s,T[D+2]=C,n[D]=x*S,n[D+1]=s*S,n[D+2]=C*S),r[D]=.007<w?-A/w:1,r[D+1]=c,r[D+2]=h,0<f&&0<O&&(m=(this._segmentsW+1)*O+f,g=(this._segmentsW+1)*O+f-1,y=(this._segmentsW+1)*(O-1)+f-1,b=(this._segmentsW+1)*(O-1)+f,O==this._segmentsH?(T[D]=T[l],T[D+1]=T[l+1],T[D+2]=T[l+2],i[I++]=m,i[I++]=y,i[I++]=b):1==O?(i[I++]=m,i[I++]=g,i[I++]=y):(i[I++]=m,i[I++]=g,i[I++]=y,i[I++]=m,i[I++]=y,i[I++]=b)),D+=o}}}else if(e==ElementsType.LINE){for(var P=t,E=this._segmentsH*this._segmentsW*2+this._segmentsW,T=new Float32Array(6*E),M=new Float32Array(E),D=0,I=0,O=0;O<=this._segmentsH;++O)for(p=Math.PI*O/this._segmentsH,d=-this._radius*Math.cos(p),_=this._radius*Math.sin(p),f=0;f<=this._segmentsW;++f){var L,v=2*Math.PI*f/this._segmentsW,x=_*Math.cos(v),A=_*Math.sin(v);C=this._yUp?(s=-d,A):(s=A,d),0<f&&(T[D++]=x,T[D++]=s,T[D++]=C,M[I++]=1,0<O)&&(L=1==O?3-(6*(this._segmentsW-f)+12*f):3-12*this._segmentsW,T[D]=T[D+++L],T[D]=T[D+++L],T[D]=T[D+++L],T[D++]=x,T[D++]=s,T[D++]=C,M[I++]=1),f<this._segmentsW&&(T[D++]=x,T[D++]=s,T[D++]=C)}P.setPositions(T),P.setThickness(M)}},lUb.prototype._pBuildUVs=function(t,e){var i,n,r,o=(this._segmentsH+1)*(this._segmentsW+1);if(e==ElementsType.TRIANGLE){o=(this._segmentsH+1)*(this._segmentsW+1);var s=t;s.uvs&&o==s.numVertices?s.invalidateVertices(s.uvs):s.setUVs(new Float32Array(2*o)),n=s.uvs.get(o),r=s.uvs.stride;for(var a=0,l=0;l<=this._segmentsH;++l)for(i=0;i<=this._segmentsW;++i)n[a]=i/this._segmentsW*this._scaleU,n[a+1]=l/this._segmentsH*this._scaleV,a+=r}},lUb),DisplayObject=(mVb=AssetBase,__extends(nVb,mVb),nVb.prototype.getScriptPrecedence=function(){if(!this._parent)return[];var t=this._parent.getScriptPrecedence();return this.placeObjectTag&&t.push(this.placeObjectTag.actionBlocksPrecedence),t},nVb.prototype.dispatchFrameEvents=function(t){this.dispatchEvent(t[0]),this.dispatchEvent(t[1])},nVb.prototype.dispatchEnterFrame=function(t){this.dispatchEvent(t)},nVb.prototype.dispatchExitFrame=function(t){this.dispatchEvent(t)},nVb.prototype.getMouseCursor=function(){return"initial"},Object.defineProperty(nVb.prototype,"tabEnabled",{get:function(){return this._tabEnabled},set:function(t){this._tabEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"tabIndex",{get:function(){return this._tabIndex},set:function(t){this._tabIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){this._isInFocus=t},enumerable:!0,configurable:!0}),nVb.prototype.setFocus=function(t,e,i){this._isInFocus!=t&&(this._isInFocus=t,this._isInFocus?nVb.focusEvent.type=FocusEvent.FOCUS_IN:nVb.focusEvent.type=FocusEvent.FOCUS_OUT,this.dispatchEnterFrame(nVb.focusEvent))},Object.defineProperty(nVb.prototype,"inheritColorTransform",{get:function(){return this._inheritColorTransform},set:function(t){this._inheritColorTransform!=t&&(this._inheritColorTransform=t,this._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM))},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"alpha",{get:function(){return this._transform.colorTransform.alphaMultiplier},set:function(t){this._transform.colorTransform.alphaMultiplier=t,this._transform.invalidateColorTransform()},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"defaultBoundingVolume",{get:function(){return this._defaultBoundingVolume},set:function(t){this._defaultBoundingVolume!=t&&(this._defaultBoundingVolume=t,this._boundsPrimitive&&(this._boundsPrimitive.dispose(),this._boundsPrimitive=null),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"eulers",{get:function(){return this._eulers||(this._eulers=new Vector3D),this._eulers.x=this.rotationX,this._eulers.y=this.rotationY,this._eulers.z=this.rotationZ,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:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"index",{get:function(){return this._parent?this._parent.getChildIndex(this):0},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"isRenderable",{get:function(){return this._renderMode&&this._iAssignedColorTransform()._isRenderable()},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"loader",{get:function(){return this._loader},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"mask",{set:function(t){t&&(t.maskMode=!0),this.masks||(this.masks=[]),this.masks.push(t)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"maskMode",{get:function(){return this._maskMode},set:function(t){var e;this._maskMode!=t&&(this._partition&&(e=this._partition.parent)&&e.removeChild(this._partition),this._implicitPartition&&this._implicitPartition.clearEntity(this),this._maskMode=t,this._partition&&e&&e.addChild(this._partition),this._implicitPartition&&this._implicitPartition.invalidateEntity(this),this._explicitMaskId=t?this.id:-1,this._updateMaskMode())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"pickObject",{get:function(){return this._pickObject&&this._pickObjectDirty&&this._updatePickObject(),this._pickObject},set:function(t){this._pickObject!=t&&(this._pickObject&&(this._pickObject.partition=null),this._pickObject=t.pickObjectFromTimeline?t.clone():t,this._pickObject&&(this._pickObject.partition=new BasicPartition(this._pickObject),this._pickObject.mouseChildren=!1,this._pickObject.mouseEnabled=!1,this._updatePickObject()))},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"mouseEnabled",{get:function(){return this._explicitMouseEnabled},set:function(t){this._explicitMouseEnabled!=t&&(this._explicitMouseEnabled=t)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"name",{get:function(){return this._pName?this._pName:""},set:function(t){this._pName=t},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"parent",{get:function(){return this._parent},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"partition",{get:function(){return this._partition},set:function(t){this._partition!=t&&(this._partition&&this._partition.parent&&this._partition.parent.removeChild(this._partition),this._partition=t,this._setPartition(this._parent?this._parent._implicitPartition:null))},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"registrationPoint",{get:function(){return this._registrationMatrix3D?new Vector3D(-this._registrationMatrix3D._rawData[12]*this.scaleX,-this._registrationMatrix3D._rawData[13]*this.scaleY,-this._registrationMatrix3D._rawData[14]*this.scaleZ):null},set:function(t){if(t)this._registrationMatrix3D||(this._registrationMatrix3D=new 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;else{if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[12]=0,this._registrationMatrix3D._rawData[13]=0,this._registrationMatrix3D._rawData[14]=0,this._registrationMatrix3D.isIdentity()&&(this._registrationMatrix3D=null)}this._registrationMatrix3D.invalidatePosition(),this._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"registrationScale",{get:function(){return this._registrationMatrix3D?new Vector3D(this._registrationMatrix3D._rawData[0],this._registrationMatrix3D._rawData[5],this._registrationMatrix3D._rawData[10]):null},set:function(t){if(t)this._registrationMatrix3D||(this._registrationMatrix3D=new Matrix3D),this._registrationMatrix3D._rawData[0]=t.x,this._registrationMatrix3D._rawData[5]=t.y,this._registrationMatrix3D._rawData[10]=t.z;else{if(!this._registrationMatrix3D)return;this._registrationMatrix3D._rawData[0]=1,this._registrationMatrix3D._rawData[5]=1,this._registrationMatrix3D._rawData[10]=1,this._registrationMatrix3D.isIdentity()&&(this._registrationMatrix3D=null)}this._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"rotationX",{get:function(){return this._transform.rotation.x*MathConsts.RADIANS_TO_DEGREES},set:function(t){this.rotationX!=t&&(this._transform.rotation.x=t*MathConsts.DEGREES_TO_RADIANS,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"rotationY",{get:function(){return this._transform.rotation.y*MathConsts.RADIANS_TO_DEGREES},set:function(t){this.rotationY!=t&&(this._transform.rotation.y=t*MathConsts.DEGREES_TO_RADIANS,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"rotationZ",{get:function(){return this._transform.rotation.z*MathConsts.RADIANS_TO_DEGREES},set:function(t){this.rotationZ!=t&&(this._transform.rotation.z=t*MathConsts.DEGREES_TO_RADIANS,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){this._setScaleX(t)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){this._setScaleY(t)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"scaleZ",{get:function(){return this._transform.scale.z},set:function(t){this._setScaleZ(t)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"skewX",{get:function(){return this._transform.skew.x},set:function(t){this.skewX!=t&&(this._transform.skew.x=t,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"skewY",{get:function(){return this._transform.skew.y},set:function(t){this.skewY!=t&&(this._transform.skew.y=t,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"skewZ",{get:function(){return this._transform.skew.z},set:function(t){this.skewZ!=t&&(this._transform.skew.z=t,this._transform.invalidateMatrix3D())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"scenePosition",{get:function(){return this._scenePositionDirty&&(this._registrationMatrix3D&&this.alignmentMode==AlignmentMode.REGISTRATION_POINT?(this._scenePosition.x=-this._registrationMatrix3D._rawData[12],this._scenePosition.y=-this._registrationMatrix3D._rawData[13],this._scenePosition.z=-this._registrationMatrix3D._rawData[14],this._scenePosition=this._transform.concatenatedMatrix3D.transformVector(this._scenePosition,this._scenePosition)):this._transform.concatenatedMatrix3D.copyColumnTo(3,this._scenePosition),this._scenePositionDirty=!1),this._scenePosition},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"animator",{get:function(){return this._animator},set:function(t){this._animator&&this._animator.removeOwner(this),this._animator=t,this._animator&&this._animator.addOwner(this)},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"material",{get:function(){return this._material},set:function(t){this._material!=t&&(this._material=t,this._invalidateMaterial())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"style",{get:function(){return this._style},set:function(t){this._style!=t&&(this._style&&this._style.removeEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this._style=t,this._style&&this._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this._invalidateStyle())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"boundsVisible",{get:function(){return this._boundsVisible},set:function(t){t!=this._boundsVisible&&(this._boundsVisible=t,this._boundsVisible&&!this.partition&&(this.partition=new BasicPartition(this)),this.invalidate())},enumerable:!0,configurable:!0}),nVb.prototype.getBoundsPrimitive=function(t){if(null==this._boundsPrimitive){switch(this._defaultBoundingVolume){case BoundingVolumeType.BOX:case BoundingVolumeType.BOX_BOUNDS:case BoundingVolumeType.BOX_BOUNDS_FAST:case BoundingVolumeType.BOX_FAST:this._boundsPrefab=new PrimitiveCubePrefab(null,ElementsType.LINE),this._boundsPrimitive=this._boundsPrefab.getNewObject();break;case BoundingVolumeType.SPHERE:case BoundingVolumeType.SPHERE_BOUNDS:case BoundingVolumeType.SPHERE_BOUNDS_FAST:case BoundingVolumeType.SPHERE_FAST:this._boundsPrefab=new PrimitiveSpherePrefab(null,ElementsType.LINE),this._boundsPrimitive=this._boundsPrefab.getNewObject()}this._boundsPrefabDirty=!0,this._boundsPrimitiveDirty=!0}return this._boundsPrefabDirty&&this._updateBoundsPrefab(t),this._boundsPrimitiveDirty&&this._updateBoundsPrimitive(),this._boundsPrimitive},Object.defineProperty(nVb.prototype,"transform",{get:function(){return this._transform},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"visible",{get:function(){return this._explicitVisibility},set:function(t){this._explicitVisibility!=t&&(this._explicitVisibility=t,this._invalidateHierarchicalProperties(HierarchicalProperties.VISIBLE))},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"masks",{get:function(){return this._explicitMasks},set:function(t){if(this._explicitMasks!=t){if(null!=(this._explicitMasks=t)&&t.length)for(var e=t.length,i=0;i<e;i++)t[i].maskMode=!0;this._invalidateHierarchicalProperties(HierarchicalProperties.MASKS)}},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"x",{get:function(){return this._transform.position.x},set:function(t){this._transform.position.x!=t&&(this._transform.matrix3D._rawData[12]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"y",{get:function(){return this._transform.position.y},set:function(t){this._transform.position.y!=t&&(this._transform.matrix3D._rawData[13]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"z",{get:function(){return this._transform.position.z},set:function(t){this._transform.position.z!=t&&(this._transform.matrix3D._rawData[14]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),nVb.prototype.isEntity=function(){return!1},nVb.prototype.addEventListener=function(t,e){switch(mVb.prototype.addEventListener.call(this,t,e),t){case DisplayObjectEvent.SCENETRANSFORM_CHANGED:this._listenToSceneTransformChanged=!0}},nVb.prototype.clone=function(){var t=new nVb;return this.copyTo(t),t},nVb.prototype.copyTo=function(t){t.defaultBoundingVolume=this._defaultBoundingVolume,this._registrationMatrix3D&&(t._registrationMatrix3D=this._registrationMatrix3D.clone()),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._explicitMouseEnabled,t.extra=this.extra,t.maskMode=this._maskMode,t.castsShadows=this.castsShadows,t.isSlice9ScaledMC=this.isSlice9ScaledMC,t.assetNamespace=this.assetNamespace,t._symbol=this._symbol,t.avm1Symbol=this.avm1Symbol,t.isAVMScene=this.isAVMScene,this._explicitMasks&&(t.masks=this._explicitMasks),this._animator&&(t.animator=this._animator.clone()),this._transform.copyRawDataTo(t._transform)},nVb.prototype.dispose=function(){this.disposeValues()},nVb.prototype.disposeValues=function(){this._parent&&this._parent.removeChild(this),this.material=null,this._animator&&this._animator.dispose(),this._adapter&&(this._adapter.dispose(),this._adapter=null),this._pickObject=null,this._explicitMasks=null},nVb.prototype.lookAt=function(t,e){void 0===e&&(e=null),this.transform.lookAt(t,e)},nVb.prototype.localToGlobal3D=function(t){return this._transform.concatenatedMatrix3D.transformVector(t)},nVb.prototype.movePivot=function(t,e,i){0==t&&0==e&&0==i||(this._registrationMatrix3D||(this._registrationMatrix3D=new 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._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM))},nVb.prototype.reset=function(){this.visible=!0,this.noTimelineUpdate||this._transform.clearMatrix3D(),this._transform.clearColorTransform(),this.masks=null,this.maskMode=!1},nVb.prototype.getRenderSceneTransform=function(t){if(this.orientationMode!=OrientationMode.CAMERA_PLANE)return this._transform.concatenatedMatrix3D;var e=t.decompose();return e[0].copyFrom(this.scenePosition),e[3].copyFrom(this._transform.scale),this._orientationMatrix.recompose(e),this._registrationMatrix3D&&(this._orientationMatrix.prepend(this._registrationMatrix3D),this.alignmentMode!=AlignmentMode.REGISTRATION_POINT&&this._orientationMatrix.appendTranslation(-this._registrationMatrix3D._rawData[12]*this._transform.scale.x,-this._registrationMatrix3D._rawData[13]*this._transform.scale.y,-this._registrationMatrix3D._rawData[14]*this._transform.scale.z)),this._orientationMatrix},nVb.prototype.removeEventListener=function(t,e){if(mVb.prototype.removeEventListener.call(this,t,e),!this.hasEventListener(t))switch(t){case DisplayObjectEvent.SCENETRANSFORM_CHANGED:this._listenToSceneTransformChanged=!0}},nVb.prototype.isOnDisplayList=function(){for(var t=this;t;){if(t.isAVMScene)return!0;t=t.parent}return!1},nVb.prototype._setParent=function(t){this._partition&&(!t&&this._parent&&this._parent._implicitPartition?(this._parent._implicitPartition.removeChild(this._partition),this.clear()):this._implicitPartition&&this._implicitPartition==this._partition&&this.isEntity()&&this._implicitPartition.invalidateEntity(this)),this._parent=t,this._setPartition(t&&t._implicitPartition?t._implicitPartition:null),this._invalidateHierarchicalProperties(HierarchicalProperties.ALL)},nVb.prototype._invalidateHierarchicalProperties=function(t){var e=(this._hierarchicalPropsDirty^t)&t;return!e||(this._hierarchicalPropsDirty|=t,e&HierarchicalProperties.SCENE_TRANSFORM&&(this.transform.invalidateConcatenatedMatrix3D(),this._scenePositionDirty=!0,this._boundsPrimitiveDirty=!0,this._pickObjectDirty=!0,this._implicitPartition&&this.isEntity()&&this._implicitPartition.invalidateEntity(this),this._listenToSceneTransformChanged&&this.queueDispatch(this._sceneTransformChanged||(this._sceneTransformChanged=new DisplayObjectEvent(DisplayObjectEvent.SCENETRANSFORM_CHANGED,this)))),!1)},nVb.prototype._setPartition=function(t){t&&null==this._partition&&(this._partition=t.getPartition(this)||this._partition),this._partition&&t&&t.addChild(this._partition);var e=this._partition||t;return this._implicitPartition==e||(this._implicitPartition&&this.clear(),this._implicitPartition=e,this._implicitPartition&&this.isEntity()&&this._implicitPartition.invalidateEntity(this),this.dispatchEvent(new DisplayObjectEvent(DisplayObjectEvent.PARTITION_CHANGED,this)),!1)},nVb.prototype._onUpdateConcatenatedMatrix3D=function(t){this._concatenatedMatrix3D.copyFrom(this._transform.matrix3D),this._registrationMatrix3D&&(this._concatenatedMatrix3D.prepend(this._registrationMatrix3D),this.alignmentMode!=AlignmentMode.REGISTRATION_POINT&&this._concatenatedMatrix3D.appendTranslation(-this._registrationMatrix3D._rawData[12]*this._transform.scale.x,-this._registrationMatrix3D._rawData[13]*this._transform.scale.y,-this._registrationMatrix3D._rawData[14]*this._transform.scale.z)),this._parent&&this._concatenatedMatrix3D.append(this._parent._transform.concatenatedMatrix3D),this._matrix3DDirty=!1,this._hierarchicalPropsDirty^=HierarchicalProperties.SCENE_TRANSFORM,this._iController&&this._iController.updateController()},nVb.prototype._iInternalUpdate=function(){this._iController&&this._iController.update();for(var t=this._queuedEvents.length,e=0;e<t;++e)this.dispatchEvent(this._queuedEvents[e]);this._queuedEvents.length=0},nVb.prototype._iIsVisible=function(){return this._hierarchicalPropsDirty&HierarchicalProperties.VISIBLE&&this._updateVisible(),this._implicitVisibility},Object.defineProperty(nVb.prototype,"maskId",{get:function(){return this._hierarchicalPropsDirty&HierarchicalProperties.MASK_ID&&this._updateMaskId(),this._implicitMaskId},enumerable:!0,configurable:!0}),Object.defineProperty(nVb.prototype,"maskOwners",{get:function(){return this._hierarchicalPropsDirty&HierarchicalProperties.MASKS&&this._updateMaskOwners(),this._maskOwners},enumerable:!0,configurable:!0}),nVb.prototype._iAssignedColorTransform=function(){return this._hierarchicalPropsDirty&HierarchicalProperties.COLOR_TRANSFORM&&this._updateColorTransform(),this._pImplicitColorTransform||(this._pImplicitColorTransform=new ColorTransform)},nVb.prototype._startDrag=function(){this._isDragEntity=!0},nVb.prototype._stopDrag=function(){this._isDragEntity=!1},nVb.prototype.isDragEntity=function(){return this._isDragEntity},nVb.prototype._iIsMouseEnabled=function(){return this._hierarchicalPropsDirty&HierarchicalProperties.MOUSE_ENABLED&&this._updateMouseEnabled(),this._implicitMouseEnabled&&this._explicitMouseEnabled},nVb.prototype.isDescendant=function(t){for(var e=this;e.parent;)if((e=e.parent)==t)return!0;return!1},nVb.prototype.isAncestor=function(t){return t.isDescendant(this)},nVb.prototype._acceptTraverser=function(t){},nVb.prototype._onInvalidateMatrix3D=function(t){this._matrix3DDirty||(this._matrix3DDirty=!0,this._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM))},nVb.prototype._onInvalidateColorTransform=function(t){this._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM)},nVb.prototype.queueDispatch=function(t){this._queuedEvents.push(t)},nVb.prototype._setScaleX=function(t){this.scaleX!=t&&(this._transform.scale.x=t,this._transform.invalidateMatrix3D())},nVb.prototype._setScaleY=function(t){this.scaleY!=t&&(this._transform.scale.y=t,this._transform.invalidateMatrix3D())},nVb.prototype._setScaleZ=function(t){this.scaleZ!=t&&(this._transform.scale.z=t,this._transform.invalidateMatrix3D())},nVb.prototype._updateMouseEnabled=function(){this._implicitMouseEnabled=!this._parent||this._parent.mouseChildren&&this._parent._implicitMouseEnabled,this._hierarchicalPropsDirty^=HierarchicalProperties.MOUSE_ENABLED},nVb.prototype._updateVisible=function(){this._implicitVisibility=this._parent?this._explicitVisibility&&this._parent._iIsVisible():this._explicitVisibility,this._hierarchicalPropsDirty^=HierarchicalProperties.VISIBLE},nVb.prototype._updateMaskId=function(){this._implicitMaskId=-1!=this._explicitMaskId?this._explicitMaskId:this._parent&&-1!=this._parent.maskId?this._parent.maskId:-1,this._hierarchicalPropsDirty^=HierarchicalProperties.MASK_ID},nVb.prototype._updateMaskOwners=function(){this._maskOwners=this._parent&&this._parent.maskOwners&&-1==this.maskId?this._explicitMasks?this._parent.maskOwners.concat([this]):this._parent.maskOwners.concat():null!=this._explicitMasks?[this]:null,this._hierarchicalPropsDirty^=HierarchicalProperties.MASKS},nVb.prototype._updateColorTransform=function(){this._pImplicitColorTransform||(this._pImplicitColorTransform=new ColorTransform),this._inheritColorTransform&&this._parent&&this._parent._iAssignedColorTransform()?(this._pImplicitColorTransform.copyFrom(this._parent._iAssignedColorTransform()),this._pImplicitColorTransform.prepend(this._transform.colorTransform)):this._pImplicitColorTransform.copyFrom(this._transform.colorTransform),this._hierarchicalPropsDirty^=HierarchicalProperties.COLOR_TRANSFORM},nVb.prototype._updateBoundsPrefab=function(t){if(this._boundsPrefab instanceof PrimitiveCubePrefab){var e=t.getBoundsPicker(this.partition).getBoundingVolume(null,this._defaultBoundingVolume).getBox();if(null==e)return;this._boundsPrefab.width=e.width,this._boundsPrefab.height=e.height,this._boundsPrefab.depth=e.depth,this._boundsPrimitive.registrationPoint=new 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 PrimitiveSpherePrefab){var i=t.getBoundsPicker(this.partition).getBoundingVolume(null,this._defaultBoundingVolume).getSphere();if(console.log(i),null==i)return;this._boundsPrefab.radius=i.radius,this._boundsPrimitive.registrationPoint=new Vector3D(-i.x*this._boundsPrimitive.transform.scale.x,-i.y*this._boundsPrimitive.transform.scale.y,-i.z*this._boundsPrimitive.transform.scale.z)}},nVb.prototype._updatePickObject=function(){this._pickObject.pickObjectFromTimeline&&(this._pickObject.transform.matrix3D=this.transform.concatenatedMatrix3D)},nVb.prototype._updateBoundsPrimitive=function(){this._boundsPrimitiveDirty=!1,this._boundsPrimitive.transform.matrix3D=this.transform.concatenatedMatrix3D},nVb.prototype._updateMaskMode=function(){this.maskMode&&(this.mouseEnabled=!1),this._invalidateHierarchicalProperties(HierarchicalProperties.MASK_ID)},nVb.prototype.invalidate=function(){mVb.prototype.invalidate.call(this),this._implicitPartition&&this.isEntity()&&this._implicitPartition.invalidateEntity(this)},nVb.prototype.clear=function(){mVb.prototype.clear.call(this),this._pImplicitColorTransform=null,this._maskOwners=null},nVb.prototype._invalidateMaterial=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_MATERIAL,this))},nVb.prototype._invalidateStyle=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_STYLE,this))},nVb.prototype.invalidateElements=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_ELEMENTS,this))},nVb.prototype._onInvalidateProperties=function(t){this._invalidateStyle()},nVb.prototype._getDefaultBoundingVolume=function(){return BoundingVolumeType.BOX_BOUNDS_FAST},nVb.focusEvent=new FocusEvent(FocusEvent.FOCUS_IN),nVb),mVb,kUb,ZSb,JSb,FSb,BSb,wSb;function nVb(){var e=mVb.call(this)||this;return e._queuedEvents=new Array,e._concatenatedMatrix3D=new Matrix3D,e._sessionID=-1,e._depthID=-16384,e._scenePosition=new Vector3D,e._explicitVisibility=!0,e._explicitMaskId=-1,e._implicitVisibility=!0,e._implicitMaskId=-1,e._explicitMouseEnabled=!0,e._implicitMouseEnabled=!0,e._orientationMatrix=new Matrix3D,e._inheritColorTransform=!0,e._maskMode=!1,e._renderMode=!0,e.isSlice9ScaledMC=!1,e.isSlice9ScaledSprite=!1,e.instanceID="",e.addedOnFrame=0,e.isAVMScene=!1,e.placeObjectTag=null,e.alignmentMode=AlignmentMode.REGISTRATION_POINT,e.castsShadows=!0,e.orientationMode=OrientationMode.DEFAULT,e.zOffset=0,e.hasDispatchedAddedToStage=!1,e.cursorType="",e._isInFocus=!1,e._tabEnabled=!1,e._tabIndex=-1,e._onInvalidatePropertiesDelegate=function(t){return e._onInvalidateProperties(t)},e._transform=new Transform(null,e._concatenatedMatrix3D),e._transform.addEventListener(TransformEvent.INVALIDATE_MATRIX3D,function(t){return e._onInvalidateMatrix3D(t)}),e._transform.addEventListener(TransformEvent.UPDATE_CONCATENATED_MATRIX3D,function(t){return e._onUpdateConcatenatedMatrix3D(t)}),e._transform.addEventListener(TransformEvent.INVALIDATE_COLOR_TRANSFORM,function(t){return e._onInvalidateColorTransform(t)}),e._defaultBoundingVolume=e._getDefaultBoundingVolume(),e}function lUb(t,e,i,n,r,o){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=50),void 0===n&&(n=16),void 0===r&&(r=12),void 0===o&&(o=!0);var s=kUb.call(this,t,e)||this;return s._radius=i,s._segmentsW=n,s._segmentsH=r,s._yUp=o,s}function $Sb(t,e,i,n,r,o,s,a,l){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=100),void 0===n&&(n=100),void 0===r&&(r=100),void 0===o&&(o=1),void 0===s&&(s=1),void 0===a&&(a=1),void 0===l&&(l=!0);var c=ZSb.call(this,t,e)||this;return c._width=i,c._height=n,c._depth=r,c._segmentsW=o,c._segmentsH=s,c._segmentsD=a,c._tile6=l,c}function KSb(t,e){void 0===t&&(t=null),void 0===e&&(e="triangle");var i,n=JSb.call(this)||this;return n._primitiveDirty=!0,n._uvDirty=!0,n._scaleU=1,n._scaleV=1,n._material=t,n._elementsType=e,n._elementsType==ElementsType.TRIANGLE?((i=new TriangleElements(new AttributesBuffer)).autoDeriveNormals=!1,i.autoDeriveTangents=!1,n._elements=i):n._elementsType==ElementsType.LINE&&(n._elements=new LineElements(new AttributesBuffer)),n}function GSb(){var t=FSb.call(this)||this;return t._pObjects=new Array,t}function CSb(t){return BSb.call(this,t)||this}function xSb(t,e){var i=wSb.call(this,t)||this;return i._object=e,i}function sortByDepth(t,e){return t._depthID-e._depthID}var DisplayObjectContainer=(WWb=DisplayObject,__extends(XWb,WWb),Object.defineProperty(XWb.prototype,"assetType",{get:function(){return XWb.assetType},enumerable:!0,configurable:!0}),XWb.prototype.dispatchFrameEvents=function(t){this.dispatchEvent(t[0]);for(var e=this._children.length;0<e;)e--,this._children[e].dispatchFrameEvents(t);this.dispatchEvent(t[1])},XWb.prototype.dispatchEnterFrame=function(t){for(var e=this._children.length;0<e;)--e<this._children.length&&this._children[e].dispatchEnterFrame(t);this.dispatchEvent(t)},XWb.prototype.dispatchExitFrame=function(t){for(var e=this._children.length;0<e;)--e<this._children.length&&this._children[e].dispatchExitFrame(t);this.dispatchEvent(t)},Object.defineProperty(XWb.prototype,"mouseChildren",{get:function(){return this._hierarchicalPropsDirty&HierarchicalProperties.MOUSE_ENABLED&&this._updateMouseEnabled(),this._mouseChildren},set:function(t){this._mouseChildren!=t&&(this._mouseChildren=t,this._invalidateHierarchicalProperties(HierarchicalProperties.MOUSE_ENABLED))},enumerable:!0,configurable:!0}),Object.defineProperty(XWb.prototype,"numChildren",{get:function(){return this._children.length},enumerable:!0,configurable:!0}),XWb.prototype.addChild=function(t){return this.addChildAt(t,this._children.length)},XWb.prototype.addChildAtDepth=function(t,e,i){if(void 0===i&&(i=!0),null==t)throw new ArgumentError("Parameter child cannot be null.");t.parent&&t.parent.removeChildAtInternal(t.parent.getChildIndex(t)),this.isSlice9ScaledMC&&"[asset Sprite]"==t.assetType&&(t.isSlice9ScaledSprite=!0);var n=this.getDepthIndexInternal(e);return-1!=n&&(i?this.removeChildAt(n):this.addChildAtDepth(this._children[n],e+1,!1)),this._nextHighestDepth<e+1&&(this._nextHighestDepth=e+1),this._depth_childs[e]=t,this._children.push(t),t._depthID=e,t._setParent(this),this._children.sort(sortByDepth),this.doingSwap||t.adapter!=t&&t.adapter.initAdapter(),t},XWb.prototype.addChildAt=function(t,e){return this.addChildAtDepth(t,e<this._children.length?this._children[e]._depthID:this.getNextHighestDepth(),!1)},XWb.prototype.addChildren=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=t.length,n=0;n<i;n++)this.addChild(t[n])},XWb.prototype.clone=function(){var t=new XWb;return this.copyTo(t),t},XWb.prototype.copyTo=function(t){WWb.prototype.copyTo.call(this,t),t.mouseChildren=this._mouseChildren;for(var e=this._children.length,i=0;i<e;++i){var n=this._children[i].adapter.clone().adaptee;t.addChild(n)}},XWb.prototype.contains=function(t){return 0<=this._children.indexOf(t)},XWb.prototype.disposeValues=function(){for(var t=this._children.length-1;0<=t;t--)this.removeChild(this._children[t]);WWb.prototype.disposeValues.call(this)},XWb.prototype.getChildAtDepth=function(t){return this._depth_childs[t]},XWb.prototype.getChildAt=function(t){var e=this._children[t];if(null==e)throw new RangeError$1("Index does not exist in the child list of the caller");return e},XWb.prototype.getChildByName=function(t){for(var e=this._children.length,i=0;i<e;++i)if(this._children[i].name==t)return this._children[i];return null},XWb.prototype.getChildIndex=function(t){var e=this._children.indexOf(t);if(-1==e)throw new ArgumentError("Child parameter is not a child of the caller");return e},XWb.prototype.getNextHighestDepth=function(){return this._nextHighestDepthDirty&&this._updateNextHighestDepth(),this._nextHighestDepth},XWb.prototype.getObjectsUnderPoint=function(t){return new Array},XWb.prototype.removeChild=function(t){if(null==t)throw new ArgumentError("Parameter child cannot be null");return this.removeChildAt(this.getChildIndex(t)),t},XWb.prototype.removeChildAtDepth=function(t){return this.removeChildAt(this.getDepthIndexInternal(t))},XWb.prototype.removeChildAt=function(t){var e=this.removeChildAtInternal(t);return e._setParent(null),e},XWb.prototype.removeChildren=function(t,e){if(void 0===t&&(t=0),void 0===e&&(e=2147483647),t<0)throw new RangeError$1("beginIndex is out of range of the child list");if(e>this._children.length)throw new RangeError$1("endIndex is out of range of the child list");for(var i=e-1;t<=i;i--)this.removeChildAtInternal(i)._setParent(null)},XWb.prototype.setChildIndex=function(t,e){},XWb.prototype.swapChildren=function(t,e){t.parent==this&&e.parent==this&&this.swapChildrenAt(this.getChildIndex(t),this.getChildIndex(e))},XWb.prototype.swapChildrenAt=function(t,e){var i=this._children[e]._depthID,n=this._children[t];this.addChildAtDepth(this._children[e],this._children[t]._depthID),this.addChildAtDepth(n,i)},XWb.prototype._invalidateHierarchicalProperties=function(t){if(WWb.prototype._invalidateHierarchicalProperties.call(this,t))return!0;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._invalidateHierarchicalProperties(t);return!1},XWb.prototype._setPartition=function(t){if(WWb.prototype._setPartition.call(this,t))return!0;for(var e=this._children.length,i=0;i<e;++i)this._children[i]._setPartition(this._implicitPartition);return!1},XWb.prototype.removeChildAtInternal=function(t){var e=this._children.splice(t,1)[0];return this._nextHighestDepth==e._depthID+1&&(this._nextHighestDepthDirty=!0),delete this._depth_childs[e._depthID],e._depthID=-16384,e},XWb.prototype.getDepthIndexInternal=function(t){return this._depth_childs[t]?this._children.indexOf(this._depth_childs[t]):-1},XWb.prototype._updateNextHighestDepth=function(){this._nextHighestDepthDirty=!1,this._nextHighestDepth=0;for(var t=this._children.length,e=0;e<t;e++)this._nextHighestDepth<this._children[e]._depthID&&(this._nextHighestDepth=this._children[e]._depthID);this._nextHighestDepth+=1},XWb.prototype._updateMaskMode=function(){this.maskMode&&(this.mouseChildren=!1),WWb.prototype._updateMaskMode.call(this)},XWb.assetType="[asset DisplayObjectContainer]",XWb),Sprite=(dYb=DisplayObjectContainer,__extends(eYb,dYb),eYb.getNewSprite=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=null),eYb._sprites.length){var i=eYb._sprites.pop();return i.graphics=t||Graphics.getGraphics(),i.material=e,i}return new eYb(t,e)},eYb.clearPool=function(){eYb._sprites=[]},Object.defineProperty(eYb.prototype,"assetType",{get:function(){return eYb.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(eYb.prototype,"graphics",{get:function(){return this._iSourcePrefab&&this._iSourcePrefab._iValidate(),this.isSlice9ScaledSprite&&this._graphics.updateSlice9(this.parent.scaleX,this.parent.scaleY),this._graphics},set:function(t){if(null==t)throw new Error("Cannot have graphics set to null");this._setGraphics(t)},enumerable:!0,configurable:!0}),eYb.prototype._setGraphics=function(t){this._graphics!=t&&(this._graphics&&(this._graphics.removeEventListener(AssetEvent.INVALIDATE,this._onGraphicsInvalidateDelegate),this._graphics.usages--),this._graphics=t,this._graphics.usages++,this._onGraphicsInvalidate(null))},eYb.prototype._setParent=function(t){dYb.prototype._setParent.call(this,t),t?this._graphics.addEventListener(AssetEvent.INVALIDATE,this._onGraphicsInvalidateDelegate):this._graphics.removeEventListener(AssetEvent.INVALIDATE,this._onGraphicsInvalidateDelegate)},eYb.prototype.isEntity=function(){return Boolean(this._graphics&&this._graphics.count)},eYb.prototype.dispose=function(){this.disposeValues(),eYb._sprites.push(this)},eYb.prototype.disposeValues=function(){dYb.prototype.disposeValues.call(this)},eYb.prototype.clone=function(){var t=eYb.getNewSprite();return this.copyTo(t),t},eYb.prototype.copyTo=function(t,e){void 0===e&&(e=!1),dYb.prototype.copyTo.call(this,t),t._iSourcePrefab=this._iSourcePrefab,this._graphics.copyTo(t._graphics,e)},eYb.prototype._iInternalUpdate=function(){dYb.prototype._iInternalUpdate.call(this)},eYb.prototype._onGraphicsInvalidate=function(t){var e=this.isEntity();this._isEntity!=e&&(!e&&this._implicitPartition&&this._implicitPartition.clearEntity(this),this._isEntity=e),this.invalidate()},eYb.prototype._acceptTraverser=function(t){this.graphics._acceptTraverser(t)},eYb.prototype.bakeTransformations=function(){this._graphics.applyTransformation(this.transform.matrix3D),this.transform.clearMatrix3D()},eYb._sprites=new Array,eYb.assetType="[asset Sprite]",eYb),dYb,WWb;function eYb(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=dYb.call(this)||this;return i._isEntity=!1,i._onGraphicsInvalidateDelegate=function(t){return i._onGraphicsInvalidate(t)},i.graphics=t||Graphics.getGraphics(),i.material=e,i}function XWb(){var t=WWb.call(this)||this;return t._mouseChildren=!0,t._depth_childs={},t._nextHighestDepth=0,t._children=new Array,t.doingSwap=!1,t.tabChildren=!1,t}PartitionBase.registerAbstraction(EntityNode,Sprite);var MorphSprite=(vYb=Sprite,__extends(wYb,vYb),wYb.getNewMorphSprite=function(t,e){if(void 0===t&&(t=null),void 0===e&&(e=null),wYb._morphSprites.length){var i=wYb._morphSprites.pop();return i.graphics=t||Graphics.getGraphics(),i.material=e,i}return new wYb(t,e)},wYb.prototype._setGraphics=function(t){this._graphics!=t&&(this._graphics&&(this._graphics.removeEventListener(AssetEvent.INVALIDATE,this._onGraphicsInvalidateDelegate),this._graphics.usages--),this._graphics||(this._graphics=Graphics.getGraphics()),this._graphics.copyFrom(t),this._onGraphicsInvalidate(null))},Object.defineProperty(wYb.prototype,"assetType",{get:function(){return wYb.assetType},enumerable:!0,configurable:!0}),wYb.prototype.reset=function(){vYb.prototype.reset.call(this),this.setRatio(0)},wYb.prototype._blendStyle=function(t,e,i,n){var r=1-n,o=n;if(t.style.data_type!=e.style.data_type)throw"Error in morph data - different styles of pathes";switch(t.style.data_type){case GraphicsFillStyle.data_type:var s=t.style,a=e.style,l=r*s.alpha+o*a.alpha,c=ColorUtils.interpolateFloat32Color(s.color,a.color,n);i.style=new GraphicsFillStyle(c,l);break;case GradientFillStyle.data_type:for(var h=[],u=[],p=[],d=(s=t.style,a=e.style,s.colors.length),_=0;_<d;_++)h[h.length]=ColorUtils.interpolateFloat32Color(s.colors[_],a.colors[_],n),p[p.length]=r*s.alphas[_]+o*a.alphas[_],u[u.length]=r*s.ratios[_]+o*a.ratios[_];var f=s.matrix,m=a.matrix;(g=new Matrix).a=f.a*r+m.a*o,g.b=f.b*r+m.b*o,g.c=f.c*r+m.c*o,g.d=f.d*r+m.d*o,g.tx=f.tx*r+m.tx*o,g.ty=f.ty*r+m.ty*o,i.style=new GradientFillStyle(s.type,h,p,u,g,s.spreadMethod,s.interpolationMethod,s.focalPointRatio);break;case BitmapFillStyle.data_type:var g,s=t.style,a=e.style,f=s.matrix,m=a.matrix;(g=new Matrix).a=f.a*r+m.a*o,g.b=f.b*r+m.b*o,g.c=f.c*r+m.c*o,g.d=f.d*r+m.d*o,g.tx=f.tx*r+m.tx*o,g.ty=f.ty*r+m.ty*o,i.style=new BitmapFillStyle(s.material,g,s.repeat,s.smooth);break;case GraphicsStrokeStyle.data_type:s=t.style,a=e.style,l=r*s.alpha+o*a.alpha,c=ColorUtils.interpolateFloat32Color(s.color,a.color,n);var y=r*s.thickness+o*a.thickness;i.style=new GraphicsStrokeStyle(c,l,y,s.jointstyle,s.capstyle,s.miter_limit,s.scaleMode)}},wYb.prototype._blendContours=function(t,e,i,n){var r=1-n,o=n,s=t._commands.length;if(e._commands.length!==s)throw"Error in morph data - different number of contour";for(var a=0;a<s;a++){var l=t._commands[a],c=t._data[a],h=e._commands[a],u=e._data[a],p=0,d=0,_=0,f=0,m=0,g=0,y=l.length;if(h.length!=y)throw y=Math.min(h.length,y),"Error in morph data - different number of commands in contour";for(var b,v,x=0;x<y;x++)switch(l[x]){case GraphicsPathCommand.MOVE_TO:if(h[x]!=GraphicsPathCommand.MOVE_TO)throw"Error in morph data - both shapes must start with Move too command";_=c[p++],f=c[p++],m=u[d++],g=u[d++],i.moveTo(r*_+o*m,r*f+o*g);break;case GraphicsPathCommand.LINE_TO:h[x]==GraphicsPathCommand.LINE_TO?(_=c[p++],f=c[p++],m=u[d++],g=u[d++],i.lineTo(r*_+o*m,r*f+o*g)):h[x]==GraphicsPathCommand.CURVE_TO&&(b=_+(c[p++]-_)/2,v=f+(c[p++]-f)/2,i.curveTo(r*b+o*u[d++],r*v+o*u[d++],r*c[p-2]+o*u[d++],r*c[p-1]+o*u[d++]),_=c[p-2],f=c[p-1],m=u[d-2],g=u[d-1]);break;case GraphicsPathCommand.CURVE_TO:h[x]==GraphicsPathCommand.LINE_TO?(b=m+(u[d++]-m)/2,v=g+(u[d++]-g)/2,i.curveTo(r*c[p++]+o*b,r*c[p++]+o*v,r*c[p++]+o*u[d-2],r*c[p++]+o*u[d-1]),_=c[p-2],f=c[p-1],m=u[d-2],g=u[d-1]):h[x]==GraphicsPathCommand.CURVE_TO&&(i.curveTo(r*c[p++]+o*u[d++],r*c[p++]+o*u[d++],r*c[p++]+o*u[d++],r*c[p++]+o*u[d++]),_=c[p-2],f=c[p-1],m=u[d-2],g=u[d-1])}}},wYb.prototype.setRatio=function(t){var e=65535*t|0,i=this._graphics;if(this._ratio!==e){if(this._ratio=e,i.endFill(),i.clear(),i.start.length!==i.end.length)throw"Error in morph data - different number of pathes";for(var n=i.start.length,r=0;r<n;r++){var o=new GraphicsPath,s=i.start[r],a=i.end[r];this._blendStyle(s,a,o,t),this._blendContours(s,a,o,t),i.add_queued_path(o)}i.endFill()}},wYb.prototype.dispose=function(){this.disposeValues(),this._frameCaches={},wYb._morphSprites.push(this)},wYb.prototype.clone=function(){var t=wYb.getNewMorphSprite();return this.copyTo(t),t},wYb.assetType="[asset MorphSprite]",wYb._morphSprites=new Array,wYb),vYb;function wYb(){var t=null!==vYb&&vYb.apply(this,arguments)||this;return t._frameCaches={},t}PartitionBase.registerAbstraction(EntityNode,MorphSprite);var FrameScriptManager=(yZb.setInterval=function(t,e){return this._intervalID++,e<4&&(e=4),this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:!1},this._intervalID},yZb.setTimeOut=function(t,e){return this._intervalID++,e<4&&(e=4),this._active_intervals[this._intervalID]={f:t,t:e,dt:0,isTimeout:!0},this._intervalID},yZb.clearInterval=function(t){delete this._active_intervals[t]},yZb.clearTimeout=function(t){delete this._active_intervals[t]},yZb.execute_intervals=function(t){var e;for(var i in void 0===t&&(t=0),this._active_intervals)for((e=this._active_intervals[i]).dt+=t;this._active_intervals[i]&&e.dt>=e.t;)e.dt-=e.t,e.f(),e.isTimeout&&delete this._active_intervals[i]},yZb.add_child_to_dispose=function(t){this._queued_dispose.push(t)},yZb.add_queue=function(){yZb._queue.length<2&&yZb._queue.push({queued_mcs:[],queued_scripts:[],queued_mcs_pass2:[],queued_scripts_pass2:[],constructors:[]})},yZb.get_queue=function(){for(;yZb._queue.length<2;)yZb.add_queue();return 0<yZb.queueLevel?yZb._queue[1]:yZb._queue[0]},yZb.add_script_to_queue=function(t,e){for(var i=yZb.get_queue(),n=i.queued_mcs_pass2.length;0<n;)n--,i.queued_mcs.push(i.queued_mcs_pass2[n]),i.queued_scripts.push(i.queued_scripts_pass2[n]);i.queued_mcs_pass2.length=0,i.queued_scripts_pass2.length=0,t.adapter.allowScript=!0,i.queued_mcs.push(t),i.queued_scripts.push(e)},yZb.add_loaded_action_to_queue=function(t){var e=yZb.get_queue();e.queued_mcs.push(t),e.queued_scripts.push(null)},yZb.add_script_to_queue_pass2=function(t,e){var i=yZb.get_queue();t.adapter.allowScript=!0,i.queued_mcs_pass2.push(t),i.queued_scripts_pass2.push(e)},yZb.queue_as3_constructor=function(t){if(!yZb.useAVM1){for(;yZb._constructor_queue.length<=yZb._constructor_queueLevel;)yZb._constructor_queue.push([]);yZb._constructor_queue[yZb._constructor_queueLevel].push(t)}},yZb.execute_as3_constructors=function(){var t,e,i=null,n=[[]],r=yZb._constructor_queues;if(1<yZb._constructor_queue.length)e=yZb._constructor_queue.pop(),yZb._constructor_queueLevel--,r=yZb._constructor_queues_dyn;else{if(1!=yZb._constructor_queue.length)return;e=yZb._constructor_queue[0].concat(),yZb._constructor_queue[0].length=0}for(var o=e.length,s=0;s<o;s++)i=e.shift(),n[n.length-1].push(i),(0<yZb.queueLevel||i.isAVMScene||!i.parent||i.parent.isAVMScene||s==o-1)&&n.push([]);for(t=n.length;0<t;)0<n[--t].length&&r.unshift(n[t]);if(0!=r.length)for(;0<r.length;)for(var a=r.shift(),l=0;l<a.length;l++){var c=a[l],h=c.adapter,u=h.executeConstructor;u&&(h.executeConstructor=null,u()),c.just_added_to_timeline&&""!=c.instanceID&&h&&h.dispatchStaticEvent&&(h.dispatchStaticEvent("added",h),c.just_added_to_timeline=!1,c.hasDispatchedAddedToStage=c.isOnDisplayList(),c.hasDispatchedAddedToStage&&h.dispatchStaticEvent("addedToStage",h))}},yZb.isOnStage=function(t){for(var e=t;e&&!e.isAVMScene;)e=e.parent;return!(!e||!e.isAVMScene)},yZb.execute_avm1_constructors=function(){var t=yZb.get_queue();if(0!=t.queued_mcs.length||0!=t.queued_mcs_pass2.length){for(var e=t.queued_mcs_pass2.length;0<e;)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,n=t.queued_mcs;if(yZb.useAVM1){for(e=n.length;0<e;){var r,o=n[--e];yZb.isOnStage(o)&&o.onInitialize&&(r=o.onInitialize,o.onInitialize=null,r())}for(e=0;e<n.length;e++)o=n[e],yZb.isOnStage(o)&&(o.onConstruct&&(r=o.onConstruct,o.onConstruct=null,r()),(i=o.adapter.executeConstructor)&&(o.adapter.executeConstructor=null,i()))}}},yZb.execute_queue=function(){var t=yZb.get_queue();if(0!=t.queued_mcs.length||0!=t.queued_mcs_pass2.length)for(;0<t.queued_mcs.length||0<t.queued_mcs_pass2.length;){var e=t.queued_mcs.concat(),i=t.queued_scripts.concat();t.queued_mcs.length=0,t.queued_scripts.length=0;for(var n,r,o=t.queued_mcs_pass2.length;0<o;)o--,e.push(t.queued_mcs_pass2[o]),i.push(t.queued_scripts_pass2[o]);if(t.queued_mcs_pass2.length=0,t.queued_scripts_pass2.length=0,yZb.useAVM1){for(o=0;o<e.length;o++){var s,a=e[o];yZb.isOnStage(a)&&a.onInitialize&&(s=a.onInitialize,a.onInitialize=null,s())}for(o=0;o<e.length;o++)a=e[o],yZb.isOnStage(a)&&(a.onConstruct&&(s=a.onConstruct,a.onConstruct=null,s()),(n=a.adapter.executeConstructor)&&(a.adapter.executeConstructor=null,n()))}for(o=0;o<e.length;o++){if(a=e[o],yZb.useAVM1){if(!yZb.isOnStage(a))continue;a.onLoaded&&(s=a.onLoaded,a.onLoaded=null,s()),a.adapter.hasOnLoadExecuted||(a.adapter.hasOnLoadExecuted=!0,(r=a.adapter.alGet("onLoad"))&&r.alCall(a.adapter))}null!=i[o]&&(a=e[o])&&a.adapter&&a.adapter.executeScript&&a.adapter.executeScript(i[o])}}},yZb.execute_dispose=function(){for(var t=this._queued_dispose.length,e=0;e<t;e++)this._queued_dispose[e].dispose();this._queued_dispose.length=0},yZb.frameScriptDebug=void 0,yZb.useAVM1=!1,yZb._queued_dispose=[],yZb._queue=[],yZb._active_intervals=new Object,yZb._intervalID=0,yZb._constructor_queue=[],yZb._constructor_queues=[],yZb._constructor_queues_dyn=[],yZb._constructor_queueLevel=0,yZb.queueLevel=0,yZb),Timeline=(v$b.prototype.resetScripts=function(){this._framescripts={},this._framescripts_translated={}},v$b.prototype.init=function(){if(null!=this.frame_command_indices&&null!=this.frame_recipe&&null!=this.keyframe_durations){this.keyframe_firstframes=[],this.keyframe_constructframes=[],this.keyframe_indices=[];var t=0,e=0,i=0,n=0,r=0;this.keyframe_to_frameidx={};for(var o=this.keyframe_to_frameidx[0]=0,e=0;e<this.numKeyFrames;e++){this.keyframe_to_frameidx[e]=o;var s=this.keyframe_durations[e];for(o+=s,1&this.frame_recipe[e]&&(r=n),this.keyframe_firstframes[n]=t,this.keyframe_constructframes[n++]=r,i=0;i<s;i++)this.keyframe_indices[t++]=e}}},v$b.prototype.get_framescript=function(t){if(null==this._framescripts[t])return"";if("string"==typeof this._framescripts[t])return this._framescripts[t];throw new Error("Framescript is already translated to Function!!!")},v$b.prototype.add_framescript=function(t,e){this._framescripts[e]||(this._framescripts[e]=[]),this._framescripts[e].push(t)},v$b.prototype.regexIndexOf=function(t,e,i){var n=t.substring(i||0).search(e);return 0<=n?n+(i||0):n},v$b.prototype.get_deferred_script=function(t,e){},v$b.prototype.add_script_for_postcontruct=function(t,e,i){void 0===i&&(i=!1),t.adapter.clearPropsDic?i?FrameScriptManager.add_script_to_queue(t,e):FrameScriptManager.add_script_to_queue_pass2(t,e):null!=this._framescripts[e]&&(null==this._framescripts_translated[e]&&(this._framescripts[e]=t.adapter.addScript(this._framescripts[e],e),this._framescripts_translated[e]=!0),i?FrameScriptManager.add_script_to_queue(t,this._framescripts[e]):FrameScriptManager.add_script_to_queue_pass2(t,this._framescripts[e]))},v$b.prototype.get_script_for_frame=function(t,e){if(0<=e&&null!=this._framescripts[e])return null==this._framescripts_translated[e]&&(this._framescripts[e]=t.adapter.addScript(this._framescripts[e],e),this._framescripts_translated[e]=!0),this._framescripts[e]},Object.defineProperty(v$b.prototype,"numFrames",{get:function(){return this.keyframe_indices.length},enumerable:!0,configurable:!0}),v$b.prototype.getPotentialChildPrototype=function(t){return this._potentialPrototypes[t]},v$b.prototype.getKeyframeIndexForFrameIndex=function(t){return this.keyframe_indices[t]},v$b.prototype.getPotentialChildInstance=function(t,e){var i=this._potentialPrototypes[t];if(i.isAsset(Sprite)){var n=Sprite.getNewSprite(i.graphics);return n.mouseEnabled=!1,n}if(i.isAsset(MorphSprite)){var r=MorphSprite.getNewMorphSprite(i.graphics);return r.mouseEnabled=!1,r}return i.adapter.clone(!1).adaptee},v$b.prototype.initChildInstance=function(t,e){var i=this.potentialPrototypesInitEventsMap[e];t.adapter.placeObjectTag=null,t.adapter.initEvents=null,t.instanceID=e,t.addedOnFrame=parseInt(e.split("#")[1]),i&&(i.variableName||i.events&&0<i.events.length)&&(t.adapter.placeObjectTag=i,t.adapter.initEvents=this.potentialPrototypesInitEventsMap[e])},v$b.prototype.registerPotentialChild=function(t){var e=this._potentialPrototypes.length;return this._potentialPrototypes[e]=t,e},v$b.prototype.extractHitArea=function(t){t.reset(!1),this.gotoFrame(t,this.numFrames-1,!1);for(var e,i,n=t.numChildren,r=new DisplayObjectContainer;0<n;)n--,(e=(i=t.getChildAt(n)).clone()).x=i.x,e.scaleX=i.scaleX,e.y=i.y,e.scaleY=i.scaleY,e.rotationZ=i.rotationZ,r.addChild(e);return r.pickObjectFromTimeline=!0,t.pickObject=r,t.reset(!1),r},v$b.prototype.getCurrentFrameLabel=function(t){for(var e in this._labels)if(this._labels[e].keyFrameIndex==t.constructedKeyFrameIndex)return this._labels[e].name;return null},v$b.prototype.getCurrentLabel=function(t){var e=null,i=-1;for(var n in this._labels)this._labels[n].keyFrameIndex>i&&this._labels[n].keyFrameIndex<=t.constructedKeyFrameIndex&&(i=this._labels[n].keyFrameIndex,e=this._labels[n].name);return e},v$b.prototype.jumpToLabel=function(t,e,i){void 0===i&&(i=0);var n=this._labels[e].keyFrameIndex;0<=n&&(t.currentFrameIndex=this.keyframe_firstframes[n]+i)},v$b.prototype.getScriptForLabel=function(t,e){var i=this._labels[e.toLowerCase()].keyFrameIndex;if(i<0)return null;var n=this.keyframe_firstframes[i];return 0<=n&&null!=this._framescripts[n]?(null==this._framescripts_translated[n]&&(this._framescripts[n]=t.adapter.addScript(this._framescripts[n],n),this._framescripts_translated[n]=!0),this._framescripts[n]):void 0},v$b.prototype.gotoFrame=function(t,e,i,n,r){void 0===i&&(i=!0),void 0===n&&(n=!1),void 0===r&&(r=!1);var o,s,a=t.constructedKeyFrameIndex,l=this.keyframe_indices[e],c=!1;if(a==l){if(!r)return;c=!0}if(a+1!=l){var h=this.keyframe_constructframes[l],u=a<l;c&&(u=!1);var p=a<h,d=u&&!p?a+1:h;if(p)for(o=t.numChildren-1;0<=o;o--)t._children[o]._depthID<0&&t.removeChildAt(o);t.adapter&&t.adapter.$Bg__setPropDict&&t.adapter.clearPropsDic&&t.adapter.clearPropsDic();var _={},f={};if(u){var m={};for(var g in _=t.getSessionIDDepths())m[g]={id:_[g],instanceID:"oldID"};_=m}for(this.pass1(t,d,l,_,f,n),o=t.numChildren-1;0<=o;o--)""!==(s=t._children[o]).instanceID&&(_[s._depthID]?"oldID"==_[s._depthID].instanceID||(_[s._depthID].instanceID==s.instanceID?u||(s._adapter?(s.adapter.isColorTransformByScript()||s.transform.clearColorTransform(),s.adapter.isBlockedByScript()||s.noTimelineUpdate||(s.transform.clearMatrix3D(),s.masks=null,s.maskMode=!1),s.adapter.isVisibilityByScript()||(s.visible=!0)):(s.transform.clearColorTransform(),s.transform.clearMatrix3D(),s.visible=!0,s.masks=null,s.maskMode=!1)):_[s._depthID].instanceID!=s.instanceID&&t.removeChildAt(o)):t.removeChildAt(o));for(var g in t.preventScript=!0,_)f[g]||"oldID"==_[g].instanceID||(s=t.getPotentialChildInstance(_[g].id,_[g].instanceID,!1))._sessionID<=-1&&(s=t.getPotentialChildInstance(_[g].id,_[g].instanceID,!0),t._addTimelineChildAt(s,Number(g),_[g].id));for(var g in t.preventScript=!1,i&&this.add_script_for_postcontruct(t,e,!n),_)f[g]&&"oldID"!=_[g].instanceID&&(s=t.getPotentialChildInstance(_[g].id,_[g].instanceID,!1))._sessionID<=-1&&(s=t.getPotentialChildInstance(_[g].id,_[g].instanceID,!0),t._addTimelineChildAt(s,Number(g),_[g].id));this.pass2(t),t.constructedKeyFrameIndex=l,t.finalizeTimelineConstruction()}else this.constructNextFrame(t,i,!0)},v$b.prototype.pass1=function(t,e,i,n,r,o){var s;this._update_indices.length=0;for(var a,l,c=this._update_frames.length=0,h=e;h<=i;h++){var u=this.frame_command_indices[h],p=this.frame_recipe[h];if(2&p)for(l=(a=this.command_index_stream[u])+this.command_length_stream[u++],s=a;s<l;s++)delete n[this.remove_child_stream[s]-16383];if(4&p){if(l=(a=this.command_index_stream[u])+this.command_length_stream[u++],o)for(s=l-1;a<=s;s--)n[this.add_child_stream[2*s+1]-16383]={id:this.add_child_stream[2*s],instanceID:this.add_child_stream[2*s]+"#"+this.keyframe_firstframes[h]};else for(s=a;s<l;s++)n[this.add_child_stream[2*s+1]-16383]={id:this.add_child_stream[2*s],instanceID:this.add_child_stream[2*s]+"#"+this.keyframe_firstframes[h]};if(h==i)if(o)for(s=l-1;a<=s;s--)r[this.add_child_stream[2*s+1]-16383]=!0;else for(s=a;s<l;s++)r[this.add_child_stream[2*s+1]-16383]=!0}8&p&&(this._update_frames[c]=this.keyframe_firstframes[h],this._update_indices[c++]=u++),16&p&&h==i&&this.start_sounds(t,u)}},v$b.prototype.pass2=function(t){for(var e=this._update_indices.length,i=0;i<e;i++)this.update_childs(t,this._update_indices[i],this._update_frames[i])},v$b.prototype.constructNextFrame=function(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!1);var n=t.currentFrameIndex,r=this.keyframe_indices[n];if(e&&this.add_script_for_postcontruct(t,n,i),t.constructedKeyFrameIndex!=r){t.constructedKeyFrameIndex=r;var o=this.frame_command_indices[r],s=this.frame_recipe[r];if(1&s)for(var a=t.numChildren-1;0<=a;a--)t._children[a]._depthID<0&&t.removeChildAt(a);else 2&s&&this.remove_childs_continous(t,o++);4&s&&this.add_childs_continous(t,o++),8&s&&this.update_childs(t,o++),16&s&&this.start_sounds(t,o++),t.finalizeTimelineConstruction()}},v$b.prototype.remove_childs_continous=function(t,e){for(var i,n=this.command_index_stream[e],r=n+this.command_length_stream[e],o=n;o<r;o++){i=this.remove_child_stream[o]-16383;var s=t.getDepthIndexInternal(i);0<=s&&t.removeChildAt(s)}},v$b.prototype.add_childs_continous=function(t,e){for(var i,n,r=this.command_index_stream[e],o=r+this.command_length_stream[e],s=r;s<o;s++)i=2*s,void 0!==this.add_child_stream[i]?(n=t.getPotentialChildInstance(this.add_child_stream[i],this.add_child_stream[i]+"#"+t.currentFrameIndex,!0),t._addTimelineChildAt(n,this.add_child_stream[1+i]-16383,this.add_child_stream[i])):console.log("ERROR in timeline. could not find child-id in child_stream for idx",i,this.add_child_stream)},v$b.prototype.start_sounds=function(t,e){for(var i=this.command_index_stream[e],n=i+this.command_length_stream[e],r=i;r<n;r++){var o,s=this.audioPool[this.add_sounds_stream[r]];s&&(15==s.cmd?(o=s.sound,0<s.props.loopCount?o.loopsToPlay=s.props.loopCount:o.loopsToPlay=0,t.startSound(s.id,o,o.loopsToPlay)):16==s.cmd&&t.stopSound(s.id))}},v$b.prototype.update_childs=function(t,e,i){var n,r,o;void 0===i&&(i=-1);for(var s,a=this.command_index_stream[e],l=a+this.command_length_stream[e],c=a;c<l;c++)if(s=t.getChildAtSessionID(this.update_child_stream[c])){if(0<i&&s.addedOnFrame>i)continue;for(this._blocked=Boolean(s._adapter&&s.adapter.isBlockedByScript()),o=(r=this.update_child_props_indices_stream[c])+this.update_child_props_length_stream[c],n=r;n<o;n++)this._functions[this.property_type_stream[n]](s,t,this.property_index_stream[n])}},v$b.prototype.update_mtx_all=function(t,e,i){var n;this._blocked||t.noTimelineUpdate||(i*=6,(n=t.transform.matrix3D)._rawData[0]=this.properties_stream_f32_mtx_all[i++],n._rawData[1]=this.properties_stream_f32_mtx_all[i++],n._rawData[4]=this.properties_stream_f32_mtx_all[i++],n._rawData[5]=this.properties_stream_f32_mtx_all[i++],n._rawData[12]=this.properties_stream_f32_mtx_all[i++],n._rawData[13]=this.properties_stream_f32_mtx_all[i],t.transform.invalidateComponents())},v$b.prototype.update_colortransform=function(t,e,i){var n;Boolean(t._adapter&&t.adapter.isColorTransformByScript())||(i*=8,(n=t.transform.colorTransform||(t.transform.colorTransform=new ColorTransform))._rawData[0]=this.properties_stream_f32_ct[i++],n._rawData[1]=this.properties_stream_f32_ct[i++],n._rawData[2]=this.properties_stream_f32_ct[i++],n._rawData[3]=this.properties_stream_f32_ct[i++],n._rawData[4]=this.properties_stream_f32_ct[i++],n._rawData[5]=this.properties_stream_f32_ct[i++],n._rawData[6]=this.properties_stream_f32_ct[i++],n._rawData[7]=this.properties_stream_f32_ct[i],t.transform.invalidateColorTransform())},v$b.prototype.update_masks=function(t,e,i){var n,r=new Array,o=this.properties_stream_int[i++];if(0!=o){for(var s=0;s<o;s++)(n=e.getChildAtSessionID(this.properties_stream_int[i++]))&&r.push(n);t.masks=r}else t.masks=null},v$b.prototype.update_name=function(t,e,i){e.adapter.unregisterScriptObject(t),t.name=this.properties_stream_strings[i],e.adapter.registerScriptObject(t)},v$b.prototype.update_button_name=function(t,e,i){t.name=this.properties_stream_strings[i],t.addButtonListeners(),e.adapter.registerScriptObject(t)},v$b.prototype.update_visibility=function(t,e,i){t._adapter&&t.adapter.isVisibilityByScript()||(t.visible=Boolean(i))},v$b.prototype.update_mtx_scale_rot=function(t,e,i){var n;this._blocked||t.noTimelineUpdate||(i*=4,(n=t.transform.matrix3D)._rawData[0]=this.properties_stream_f32_mtx_scale_rot[i++],n._rawData[1]=this.properties_stream_f32_mtx_scale_rot[i++],n._rawData[4]=this.properties_stream_f32_mtx_scale_rot[i++],n._rawData[5]=this.properties_stream_f32_mtx_scale_rot[i],t.transform.invalidateComponents(),t._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM))},v$b.prototype.update_mtx_pos=function(t,e,i){var n;this._blocked||t.noTimelineUpdate||(i*=2,(n=t.transform.matrix3D)._rawData[12]=this.properties_stream_f32_mtx_pos[i++],n._rawData[13]=this.properties_stream_f32_mtx_pos[i],t.transform.invalidatePosition())},v$b.prototype.enable_maskmode=function(t,e,i){t.maskMode=!0},v$b.prototype.remove_masks=function(t,e,i){t.masks=null},v$b.prototype.update_filters=function(t,e,i){var n=this.properties_stream_int[i++],r=this.properties_stream_int[i++];0!=r?t.adapter.updateFilters(this.properties_stream_filters.slice(n,n+r)):t.adapter.updateFilters(null)},v$b.prototype.swap_graphics=function(t,e,i){var n;t.isAsset(Sprite)&&(n=this.graphicsPool[this.properties_stream_int[i]],t.graphics=n)},v$b.prototype.start_audio=function(t,e,i){},v$b.prototype.set_ratio=function(t,e,i){t.setRatio(this.properties_stream_int[i]/65535)},v$b.prototype.update_blendmode=function(t,e,i){console.log("update blendmode "+i)},v$b.prototype.update_rendermode=function(t,e,i){console.log("update rendermode "+i)},v$b.prototype.dispose=function(){for(var t=0;t<this._potentialPrototypes.length;t++)this._potentialPrototypes[t].dispose&&this._potentialPrototypes[t].dispose();this.keyframe_indices=[],this.avm1Exports={},this.avm1InitActions={},this.avm1ButtonActions=[],this.graphicsPool={},this.audioPool={},this.potentialPrototypesInitEventsMap={},this._potentialPrototypes=[],this._labels={},this._framescripts={},this._framescripts_translated={}},v$b),TouchPoint=function(t,e,i){this.x=t,this.y=e,this.id=i},ControllerBase=(R2b.prototype.pNotifyUpdate=function(){this._pTargetObject&&this._pTargetObject._invalidateHierarchicalProperties(HierarchicalProperties.SCENE_TRANSFORM)},Object.defineProperty(R2b.prototype,"targetObject",{get:function(){return this._pTargetObject},set:function(t){this._pTargetObject!=t&&(this._pTargetObject&&this._pAutoUpdate&&(this._pTargetObject._iController=null),this._pTargetObject=t,this._pTargetObject&&this._pAutoUpdate&&(this._pTargetObject._iController=this),this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(R2b.prototype,"autoUpdate",{get:function(){return this._pAutoUpdate},set:function(t){this._pAutoUpdate!=t&&(this._pAutoUpdate=t,this._pTargetObject&&(this._pAutoUpdate?this._pTargetObject._iController=this:this._pTargetObject._iController=null))},enumerable:!0,configurable:!0}),R2b.prototype.update=function(t){throw new AbstractMethodError},R2b.prototype.updateController=function(){this._pControllerDirty&&this._pAutoUpdate&&(this._pControllerDirty=!1,this.pNotifyUpdate())},R2b),FirstPersonController=(W2b=ControllerBase,__extends(X2b,W2b),Object.defineProperty(X2b.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t,this._steps!=t&&(this._steps=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(X2b.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){this._panAngle!=t&&(this._panAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(X2b.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t)),this._tiltAngle!=t&&(this._tiltAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(X2b.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){this._minTiltAngle!=t&&(this._minTiltAngle=t,this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(X2b.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){this._maxTiltAngle!=t&&(this._maxTiltAngle=t,this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(X2b.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){this._wrapPanAngle!=t&&(this._wrapPanAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),X2b.prototype.update=function(t){if(void 0===t&&(t=!0),this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){if(this._pControllerDirty=!0,this._wrapPanAngle){for(this._panAngle<0?(this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle,this._panAngle=this._panAngle%360+360):(this._iCurrentPanAngle+=this._panAngle%360-this._panAngle,this._panAngle=this._panAngle%360);this._panAngle-this._iCurrentPanAngle<-180;)this._iCurrentPanAngle-=360;for(;180<this._panAngle-this._iCurrentPanAngle;)this._iCurrentPanAngle+=360}t?(this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1),this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)):(this._iCurrentTiltAngle=this._tiltAngle,this._iCurrentPanAngle=this._panAngle),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,this._walkIncrement&&(this.fly?this.targetObject.transform.moveForward(this._walkIncrement):(this.targetObject.x+=this._walkIncrement*Math.sin(this._panAngle*MathConsts.DEGREES_TO_RADIANS),this.targetObject.z+=this._walkIncrement*Math.cos(this._panAngle*MathConsts.DEGREES_TO_RADIANS)),this._walkIncrement=0),this._strafeIncrement&&(this.targetObject.transform.moveRight(this._strafeIncrement),this._strafeIncrement=0)},X2b.prototype.incrementWalk=function(t){0!=t&&(this._walkIncrement+=t,this.pNotifyUpdate())},X2b.prototype.incrementStrafe=function(t){0!=t&&(this._strafeIncrement+=t,this.pNotifyUpdate())},X2b),LookAtController=(n3b=ControllerBase,__extends(o3b,n3b),Object.defineProperty(o3b.prototype,"lookAtPosition",{get:function(){return this._pLookAtPosition},set:function(t){this._pLookAtObject&&(this._pLookAtObject.removeEventListener(DisplayObjectEvent.SCENETRANSFORM_CHANGED,this._onLookAtObjectChangedDelegate),this._pLookAtObject=null),this._pLookAtPosition=t,this.pNotifyUpdate()},enumerable:!0,configurable:!0}),Object.defineProperty(o3b.prototype,"lookAtObject",{get:function(){return this._pLookAtObject},set:function(t){this._pLookAtPosition&&(this._pLookAtPosition=null),this._pLookAtObject!=t&&(this._pLookAtObject&&this._pLookAtObject.removeEventListener(DisplayObjectEvent.SCENETRANSFORM_CHANGED,this._onLookAtObjectChangedDelegate),this._pLookAtObject=t,this._pLookAtObject&&this._pLookAtObject.addEventListener(DisplayObjectEvent.SCENETRANSFORM_CHANGED,this._onLookAtObjectChangedDelegate),this.pNotifyUpdate())},enumerable:!0,configurable:!0}),o3b.prototype.update=function(t){this._pTargetObject&&(this._pLookAtPosition?this._pTargetObject.lookAt(this._pLookAtPosition):this._pLookAtObject&&this._pTargetObject.lookAt(this._pLookAtObject.transform.concatenatedMatrix3D.position))},o3b.prototype.onLookAtObjectChanged=function(t){this.pNotifyUpdate()},o3b),HoverController=(x3b=LookAtController,__extends(y3b,x3b),Object.defineProperty(y3b.prototype,"steps",{get:function(){return this._steps},set:function(t){t=t<1?1:t,this._steps!=t&&(this._steps=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"panAngle",{get:function(){return this._panAngle},set:function(t){t=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,t)),this._panAngle!=t&&(this._panAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"tiltAngle",{get:function(){return this._tiltAngle},set:function(t){t=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,t)),this._tiltAngle!=t&&(this._tiltAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance!=t&&(this._distance=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"minPanAngle",{get:function(){return this._minPanAngle},set:function(t){this._minPanAngle!=t&&(this._minPanAngle=t,this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"maxPanAngle",{get:function(){return this._maxPanAngle},set:function(t){this._maxPanAngle!=t&&(this._maxPanAngle=t,this.panAngle=Math.max(this._minPanAngle,Math.min(this._maxPanAngle,this._panAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"minTiltAngle",{get:function(){return this._minTiltAngle},set:function(t){this._minTiltAngle!=t&&(this._minTiltAngle=t,this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"maxTiltAngle",{get:function(){return this._maxTiltAngle},set:function(t){this._maxTiltAngle!=t&&(this._maxTiltAngle=t,this.tiltAngle=Math.max(this._minTiltAngle,Math.min(this._maxTiltAngle,this._tiltAngle)))},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"yFactor",{get:function(){return this._yFactor},set:function(t){this._yFactor!=t&&(this._yFactor=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),Object.defineProperty(y3b.prototype,"wrapPanAngle",{get:function(){return this._wrapPanAngle},set:function(t){this._wrapPanAngle!=t&&(this._wrapPanAngle=t,this.pNotifyUpdate())},enumerable:!0,configurable:!0}),y3b.prototype.update=function(t){if(void 0===t&&(t=!0),this._tiltAngle!=this._iCurrentTiltAngle||this._panAngle!=this._iCurrentPanAngle){if(this._pControllerDirty=!0,this._wrapPanAngle){for(this._panAngle<0?(this._iCurrentPanAngle+=this._panAngle%360+360-this._panAngle,this._panAngle=this._panAngle%360+360):(this._iCurrentPanAngle+=this._panAngle%360-this._panAngle,this._panAngle=this._panAngle%360);this._panAngle-this._iCurrentPanAngle<-180;)this._iCurrentPanAngle-=360;for(;180<this._panAngle-this._iCurrentPanAngle;)this._iCurrentPanAngle+=360}t?(this._iCurrentTiltAngle+=(this._tiltAngle-this._iCurrentTiltAngle)/(this.steps+1),this._iCurrentPanAngle+=(this._panAngle-this._iCurrentPanAngle)/(this.steps+1)):(this._iCurrentPanAngle=this._panAngle,this._iCurrentTiltAngle=this._tiltAngle),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*MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS),this.targetObject.y=e.y+this.distance*Math.sin(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS)*this.yFactor,this.targetObject.z=e.z+this.distance*Math.cos(this._iCurrentPanAngle*MathConsts.DEGREES_TO_RADIANS)*Math.cos(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS),this._upAxis.x=-Math.sin(this._iCurrentPanAngle*MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS),this._upAxis.y=Math.cos(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS),this._upAxis.z=-Math.cos(this._iCurrentPanAngle*MathConsts.DEGREES_TO_RADIANS)*Math.sin(this._iCurrentTiltAngle*MathConsts.DEGREES_TO_RADIANS),this._pTargetObject&&(this._pLookAtPosition?this._pTargetObject.lookAt(this._pLookAtPosition,this._upAxis):this._pLookAtObject&&this._pTargetObject.lookAt(this._pLookAtObject.transform.concatenatedMatrix3D.position,this._upAxis))},y3b),FollowController=(Y3b=HoverController,__extends(Z3b,Y3b),Z3b.prototype.update=function(t){this.lookAtObject&&(this.panAngle=this._pLookAtObject.rotationY-180,Y3b.prototype.update.call(this))},Z3b),SpringController=(d4b=LookAtController,__extends(e4b,d4b),e4b.prototype.update=function(t){var e,i;this._pLookAtObject&&this._pTargetObject&&(this._pControllerDirty=!0,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),i=this._pTargetObject.transform.position.add(this._velocity),this._pTargetObject.transform.moveTo(i.x,i.y,i.z),d4b.prototype.update.call(this))},e4b),Billboard=(o4b=DisplayObjectContainer,__extends(p4b,o4b),p4b.getNewBillboard=function(t,e,i){if(void 0===e&&(e="auto"),void 0===i&&(i=!1),p4b._billboards.length){var n=p4b._billboards.pop();return n.material=t,n}return new p4b(t)},Object.defineProperty(p4b.prototype,"assetType",{get:function(){return p4b.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"billboardRect",{get:function(){return this._billboardRect},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"billboardHeight",{get:function(){return this._billboardHeight},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"billboardWidth",{get:function(){return this._billboardWidth},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"material",{get:function(){return this._material},set:function(t){t!=this._material&&(this._material&&this._material.removeEventListener(MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate),this._material=t,this._material&&this._material.addEventListener(MaterialEvent.INVALIDATE_TEXTURES,this._onInvalidateTextureDelegate),this._updateDimensions(),this._invalidateMaterial())},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"width",{get:function(){return this._width},set:function(t){this._width!=t&&(this._width=t,this.scaleX=this._width/this._billboardRect.width)},enumerable:!0,configurable:!0}),Object.defineProperty(p4b.prototype,"height",{get:function(){return this._height},set:function(t){this._height!=t&&(this._height=t,this.scaleY=this._height/this._billboardRect.height)},enumerable:!0,configurable:!0}),p4b.prototype.isEntity=function(){return!0},p4b.prototype.dispose=function(){this.disposeValues(),p4b._billboards.push(this)},p4b.prototype.clone=function(){var t=p4b.getNewBillboard(this._material);return this.copyTo(t),t},p4b.prototype._acceptTraverser=function(t){t.applyTraversable(this)},p4b.prototype._updateDimensions=function(){var t,e=this.material.getTextureAt(0),i=e?(this._style?this._style.getImageAt(e):null)||(this.material.style?this.material.style.getImageAt(e):null)||e.getImageAt(0):null;i?((t=(this._style?this._style.getSamplerAt(e):null)||(this.material.style?this.material.style.getSamplerAt(e):null)||e.getSamplerAt(0)||ImageUtils.getDefaultSampler()).imageRect?(this._billboardWidth=t.imageRect.width*i.width,this._billboardHeight=t.imageRect.height*i.height):(this._billboardWidth=i.rect.width,this._billboardHeight=i.rect.height),this._billboardRect=t.frameRect||new Rectangle(0,0,this._billboardWidth,this._billboardHeight)):(this._billboardWidth=1,this._billboardHeight=1,this._billboardRect=new Rectangle(0,0,1,1)),this.invalidate(),this.invalidateElements(),this.preserveDimensions?(this.scaleX=this._width/this._billboardRect.width,this.scaleY=this._height/this._billboardRect.height):(this._width=this._billboardRect.width*this.scaleX,this._height=this._billboardRect.height*this.scaleY)},p4b.prototype._onInvalidateProperties=function(t){void 0===t&&(t=null),o4b.prototype._onInvalidateProperties.call(this,t),this._updateDimensions()},p4b.prototype._onInvalidateTexture=function(t){this._updateDimensions()},p4b._billboards=new Array,p4b.assetType="[asset Billboard]",p4b),_Render_Billboard=(J4b=_Render_RenderableBase,__extends(K4b,J4b),K4b.prototype._getStageElements=function(){var t=this._asset.billboardWidth,e=this._asset.billboardHeight,i=this._asset.billboardRect,n=t.toString()+e.toString()+i.toString();this._id=n;var r=K4b._samplerElements[n];return r?r.setPositions(Array(-i.x,e-i.y,0,t-i.x,e-i.y,0,t-i.x,-i.y,0,-i.x,-i.y,0)):((r=K4b._samplerElements[n]=new TriangleElements(new AttributesBuffer(11,4))).autoDeriveNormals=!1,r.autoDeriveTangents=!1,r.setIndices(Array(0,1,2,0,2,3)),r.setPositions(Array(-i.x,e-i.y,0,t-i.x,e-i.y,0,t-i.x,-i.y,0,-i.x,-i.y,0)),r.setNormals(Array(1,0,0,1,0,0,1,0,0,1,0,0)),r.setTangents(Array(0,0,-1,0,0,-1,0,0,-1,0,0,-1)),r.setUVs(Array(0,1,1,1,1,0,0,0))),this._stage.getAbstraction(r)},K4b.prototype._getRenderMaterial=function(){return this.renderGroup.getRenderElements(this.stageElements.elements).getAbstraction(this._asset.material||MaterialUtils.getDefaultColorMaterial())},K4b.prototype._getStyle=function(){return this._asset.style},K4b._samplerElements=new Object,K4b),_Pick_Billboard=(Q4b=_Pick_PickableBase,__extends(R4b,Q4b),R4b.prototype._onInvalidateElements=function(t){this._billboardBoxDirty=!0},R4b.prototype.onClear=function(t){this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate),Q4b.prototype.onClear.call(this,t)},R4b.prototype.hitTestPoint=function(t,e,i){return!0},R4b.prototype.getBoxBounds=function(t,e,i,n){var r;return void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),this._billboardBoxDirty&&(this._billboardBoxDirty=!1,r=this._asset.billboardRect,this._billboardBox=new Box(r.x,r.y,0,r.width,r.height,0)),(t?t.transformBox(this._billboardBox):this._billboardBox).union(n,n||i)},R4b.prototype.getSphereBounds=function(t,e,i,n,r){return void 0===r&&(r=null),r},R4b.prototype.testCollision=function(t,e){var i=-t.rayPosition.z/t.rayDirection.z,n=new Vector3D(t.rayPosition.x+i*t.rayDirection.x,t.rayPosition.y+i*t.rayDirection.y);return t.traversable=this._asset,t.rayEntryDistance=i,t.position=n,t.normal=new Vector3D(0,0,1),!0},R4b),Q4b,J4b,o4b,d4b,Y3b,x3b,n3b,W2b;function R4b(t,e){var i=Q4b.call(this,t,e)||this;return i._billboardBoxDirty=!0,i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)},i._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate),i}function K4b(){return null!==J4b&&J4b.apply(this,arguments)||this}function p4b(t,e,i){var n=o4b.call(this)||this;return n.preserveDimensions=!1,n._onInvalidateTextureDelegate=function(t){return n._onInvalidateTexture(t)},n.material=t,n._updateDimensions(),n}function e4b(t,e,i,n,r){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=1),void 0===n&&(n=40),void 0===r&&(r=4);var o=d4b.call(this,t,e)||this;return o.positionOffset=new Vector3D(0,500,-1e3),o.stiffness=i,o.damping=r,o.mass=n,o._velocity=new Vector3D,o._dv=new Vector3D,o._stretch=new Vector3D,o._force=new Vector3D,o._acceleration=new Vector3D,o._desiredPosition=new Vector3D,o}function Z3b(t,e,i,n){return void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=45),void 0===n&&(n=700),Y3b.call(this,t,e,0,i,n)||this}function y3b(t,e,i,n,r,o,s,a,l,c,h,u){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=90),void 0===r&&(r=1e3),void 0===o&&(o=-90),void 0===s&&(s=90),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=8),void 0===h&&(h=2),void 0===u&&(u=!1);var p=x3b.call(this,t,e)||this;return p._iCurrentPanAngle=0,p._iCurrentTiltAngle=90,p._panAngle=0,p._tiltAngle=90,p._distance=1e3,p._minPanAngle=-1/0,p._maxPanAngle=1/0,p._minTiltAngle=-90,p._maxTiltAngle=90,p._steps=8,p._yFactor=2,p._wrapPanAngle=!1,p._upAxis=new Vector3D,p.distance=r,p.panAngle=i,p.tiltAngle=n,p.minPanAngle=null!=a?a:-1/0,p.maxPanAngle=null!=l?l:1/0,p.minTiltAngle=o,p.maxTiltAngle=s,p.steps=c,p.yFactor=h,p.wrapPanAngle=u,p._iCurrentPanAngle=p._panAngle,p._iCurrentTiltAngle=p._tiltAngle,p}function o3b(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=n3b.call(this,t)||this;return i._pOrigin=new Vector3D(0,0,0),i._onLookAtObjectChangedDelegate=function(t){return i.onLookAtObjectChanged(t)},e?i.lookAtObject=e:i.lookAtPosition=new Vector3D,i}function X2b(t,e,i,n,r,o,s){void 0===t&&(t=null),void 0===e&&(e=0),void 0===i&&(i=90),void 0===n&&(n=-90),void 0===r&&(r=90),void 0===o&&(o=8),void 0===s&&(s=!1);var a=W2b.call(this,t)||this;return 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=!1,a.fly=!1,a.panAngle=e,a.tiltAngle=i,a.minTiltAngle=n,a.maxTiltAngle=r,a.steps=o,a.wrapPanAngle=s,a._iCurrentPanAngle=a._panAngle,a._iCurrentTiltAngle=a._tiltAngle,a}function R2b(t){void 0===t&&(t=null),this._pAutoUpdate=!0,this.targetObject=t}function v$b(){var n=this;this._functions=[],this._update_indices=[],this._update_frames=[],this.isButton=!1,this.numKeyFrames=0,this.keyframe_indices=[],this.avm1Exports={},this.avm1InitActions={},this.avm1ButtonActions=[],this.graphicsPool={},this.audioPool={},this.potentialPrototypesInitEventsMap={},this._potentialPrototypes=[],this._labels={},this._framescripts={},this._framescripts_translated={},this.keyframe_to_frameidx={},this._functions[1]=function(t,e,i){return n.update_mtx_all(t,e,i)},this._functions[2]=function(t,e,i){return n.update_colortransform(t,e,i)},this._functions[3]=function(t,e,i){return n.update_masks(t,e,i)},this._functions[4]=function(t,e,i){return n.update_name(t,e,i)},this._functions[5]=function(t,e,i){return n.update_button_name(t,e,i)},this._functions[6]=function(t,e,i){return n.update_visibility(t,e,i)},this._functions[7]=function(t,e,i){return n.update_blendmode(t,e,i)},this._functions[8]=function(t,e,i){return n.update_rendermode(t,e,i)},this._functions[9]=function(t,e,i){return n.update_filters(t,e,i)},this._functions[11]=function(t,e,i){return n.update_mtx_scale_rot(t,e,i)},this._functions[12]=function(t,e,i){return n.update_mtx_pos(t,e,i)},this._functions[200]=function(t,e,i){return n.enable_maskmode(t,e,i)},this._functions[201]=function(t,e,i){return n.remove_masks(t,e,i)},this._functions[202]=function(t,e,i){return n.swap_graphics(t,e,i)},this._functions[203]=function(t,e,i){return n.set_ratio(t,e,i)},this._functions[204]=function(t,e,i){return n.start_audio(t,e,i)}}function yZb(){}RenderEntity.registerRenderable(_Render_Billboard,Billboard),PickEntity.registerPickable(_Pick_Billboard,Billboard),PartitionBase.registerAbstraction(EntityNode,Billboard);var CameraEvent=(n5b=EventBase,__extends(o5b,n5b),Object.defineProperty(o5b.prototype,"camera",{get:function(){return this._camera},enumerable:!0,configurable:!0}),o5b.prototype.clone=function(){return new o5b(this.type,this._camera)},o5b.PROJECTION_CHANGED="projectionChanged",o5b),Camera=(s5b=DisplayObjectContainer,__extends(t5b,s5b),t5b.prototype.isEntity=function(){return!0},Object.defineProperty(t5b.prototype,"assetType",{get:function(){return t5b.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(t5b.prototype,"projection",{get:function(){return this._projection},set:function(t){if(this._projection!=t){if(!t)throw new Error("Projection cannot be null!");this._projection.transform=null,this._projection=t,this._projection.transform=this._transform,this.dispatchEvent(new CameraEvent(CameraEvent.PROJECTION_CHANGED,this))}},enumerable:!0,configurable:!0}),t5b.prototype.project=function(t,e){return void 0===e&&(e=null),this._projection.project(this._transform.inverseConcatenatedMatrix3D.transformVector(t,e),e)},t5b.prototype.unproject=function(t,e,i,n){return void 0===n&&(n=null),this._transform.concatenatedMatrix3D.transformVector(this._projection.unproject(t,e,i,n))},t5b.prototype._getDefaultBoundingVolume=function(){return BoundingVolumeType.NULL},t5b.assetType="[asset Camera]",t5b),CameraNode=(D5b=EntityNode,__extends(E5b,D5b),E5b.prototype.acceptTraverser=function(t){},E5b),D5b,s5b,n5b;function E5b(){return null!==D5b&&D5b.apply(this,arguments)||this}function t5b(t){void 0===t&&(t=null);var e=s5b.call(this)||this;return e._projection=t||new PerspectiveProjection,e._projection.transform=e._transform,e.z=-1e3,e}function o5b(t,e){var i=n5b.call(this,t)||this;return i._camera=e,i}PartitionBase.registerAbstraction(CameraNode,Camera);var LineSegment=(G5b=DisplayObject,__extends(H5b,G5b),Object.defineProperty(H5b.prototype,"assetType",{get:function(){return H5b.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(H5b.prototype,"startPosition",{get:function(){return this._startPosition},set:function(t){this._startPosition!=t&&(this._startPosition=t,this.invalidateElements())},enumerable:!0,configurable:!0}),Object.defineProperty(H5b.prototype,"endPosition",{get:function(){return this._endPosition},set:function(t){this._endPosition!=t&&(this._endPosition=t,this.invalidateElements())},enumerable:!0,configurable:!0}),Object.defineProperty(H5b.prototype,"thickness",{get:function(){return 2*this._halfThickness},set:function(t){this._halfThickness!=t&&(this._halfThickness=.5*t,this.invalidateElements())},enumerable:!0,configurable:!0}),H5b.prototype.isEntity=function(){return!0},H5b.prototype._acceptTraverser=function(t){t.applyTraversable(this)},H5b.assetType="[asset LineSegment]",H5b),_Render_LineSegment=(R5b=_Render_RenderableBase,__extends(S5b,R5b),S5b.prototype._getStageElements=function(){var t=S5b._lineGraphics[this._asset.id]||(S5b._lineGraphics[this._asset.id]=new LineElements),e=this._asset.startPosition,i=this._asset.endPosition,n=new Float32Array(6),r=new Float32Array(1);return n[0]=e.x,n[1]=e.y,n[2]=e.z,n[3]=i.x,n[4]=i.y,n[5]=i.z,r[0]=this._asset.thickness,t.setPositions(n),t.setThickness(r),this._stage.getAbstraction(t)},S5b.prototype._getRenderMaterial=function(){return this.renderGroup.getRenderElements(this.stageElements.elements).getAbstraction(this._asset.material||MaterialUtils.getDefaultColorMaterial())},S5b.prototype._getStyle=function(){return this._asset.style},S5b._lineGraphics=new Object,S5b),_Pick_LineSegment=(Y5b=_Pick_PickableBase,__extends(Z5b,Y5b),Z5b.prototype._onInvalidateElements=function(t){this._lineSegmentBoxDirty=!0,this._lineSegmentSphereDirty=!0},Z5b.prototype.onClear=function(t){this._asset.removeEventListener(RenderableEvent.INVALIDATE_ELEMENTS,this._onInvalidateElementsDelegate),Y5b.prototype.onClear.call(this,t)},Z5b.prototype.hitTestPoint=function(t,e,i){return!0},Z5b.prototype.getBoxBounds=function(t,e,i,n){var r,o;return void 0===t&&(t=null),void 0===i&&(i=null),void 0===n&&(n=null),this._lineSegmentBoxDirty&&(this._lineSegmentBoxDirty=!1,r=this._asset.startPosition,o=this._asset.endPosition,this._lineSegmentBox=new Box(Math.min(r.x,o.x),Math.min(r.y,o.y),Math.min(r.z,o.z),Math.abs(r.x-o.x),Math.abs(r.y-o.y),Math.abs(r.z-o.z))),(t?t.transformBox(this._lineSegmentBox):this._lineSegmentBox).union(n,n||i)},Z5b.prototype.getSphereBounds=function(t,e,i,n,r){var o,s,a,l,c;return void 0===e&&(e=null),void 0===n&&(n=null),void 0===r&&(r=null),this._lineSegmentSphereDirty&&(this._lineSegmentSphereDirty=!1,o=this._asset.startPosition,a=((s=this._asset.endPosition).x-o.x)/2,l=(s.y-o.y)/2,c=(s.z-o.z)/2,this._lineSegmentSphere=new Sphere(o.x+a,o.y+l,o.z+c,Math.sqrt(a*a+l*l+c*c))),(e?e.transformSphere(this._lineSegmentSphere):this._lineSegmentSphere).union(r,r||n)},Z5b.prototype.testCollision=function(t,e){return t.traversable=null,!1},Z5b),Y5b,R5b,G5b;function Z5b(t,e){var i=Y5b.call(this,t,e)||this;return i._lineSegmentBoxDirty=!0,i._lineSegmentSphereDirty=!0,i._onInvalidateElementsDelegate=function(t){return i._onInvalidateElements(t)},i._asset.addEventListener(RenderableEvent.INVALIDATE_ELEMENTS,i._onInvalidateElementsDelegate),i}function S5b(){return null!==R5b&&R5b.apply(this,arguments)||this}function H5b(t,e,i,n){void 0===n&&(n=1);var r=G5b.call(this)||this;return r.material=t,r._startPosition=e,r._endPosition=i,r._halfThickness=.5*n,r}RenderEntity.registerRenderable(_Render_LineSegment,LineSegment),PickEntity.registerPickable(_Pick_LineSegment,LineSegment),PartitionBase.registerAbstraction(EntityNode,LineSegment);var LoaderContainer=(z6b=DisplayObjectContainer,__extends(A6b,z6b),Object.defineProperty(A6b.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0}),Object.defineProperty(A6b.prototype,"contentLoader",{get:function(){return this._contentLoader},enumerable:!0,configurable:!0}),A6b.prototype.addEventListener=function(t,e){(this._contentLoader&&t==URLLoaderEvent.LOAD_ERROR||t==ParserEvent.PARSE_ERROR)&&this._contentLoader.addEventListener(t,this._errorDelegateSelector[t]),z6b.prototype.addEventListener.call(this,t,e)},A6b.prototype.removeEventListener=function(t,e){(this._contentLoader&&t==URLLoaderEvent.LOAD_ERROR||t==ParserEvent.PARSE_ERROR)&&this._contentLoader.removeEventListener(t,this._errorDelegateSelector[t]),z6b.prototype.removeEventListener.call(this,t,e)},A6b.prototype.close=function(){this._contentLoader&&(this._useAssetLib&&AssetLibraryBundle.getInstance(this._assetLibId).stopLoader(this._contentLoader),this._disposeLoader())},A6b.prototype.load=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this._getLoader().load(t,e,i,n)},A6b.prototype.loadData=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this._getLoader().loadData(t,"",e,i,n)},A6b.prototype._getLoader=function(){return this._contentLoader&&this.close(),this._contentLoader=this._useAssetLib?AssetLibraryBundle.getInstance(this._assetLibId).getLoader():new Loader,this._contentLoader.addEventListener(LoaderEvent.LOADER_START,this._onLoaderStartDelegate),this._contentLoader.addEventListener(URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate),this._contentLoader.addEventListener(URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate),this._contentLoader.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),this._contentLoader.addEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),this.hasEventListener(URLLoaderEvent.LOAD_ERROR)&&this._contentLoader.addEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this.hasEventListener(ParserEvent.PARSE_ERROR)&&this._contentLoader.addEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),this._contentLoader},A6b.prototype._disposeLoader=function(){this._contentLoader.removeEventListener(LoaderEvent.LOADER_START,this._onLoaderStartDelegate),this._contentLoader.removeEventListener(URLLoaderEvent.LOAD_PROGRESS,this._onLoadProgressDelegate),this._contentLoader.removeEventListener(URLLoaderEvent.LOAD_COMPLETE,this._onLoadCompleteDelegate),this._contentLoader.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),this._contentLoader.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),this.hasEventListener(URLLoaderEvent.LOAD_ERROR)&&this._contentLoader.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this.hasEventListener(ParserEvent.PARSE_ERROR)&&this._contentLoader.removeEventListener(ParserEvent.PARSE_ERROR,this._onParseErrorDelegate),this._useAssetLib||this._contentLoader.stop(),this._contentLoader=null},A6b.prototype.unload=function(){},A6b.enableParser=function(t){Loader.enableParser(t)},A6b.enableParsers=function(t){Loader.enableParsers(t)},A6b.prototype._onLoaderStart=function(t){this.dispatchEvent(t)},A6b.prototype._onLoadProgress=function(t){this.dispatchEvent(t)},A6b.prototype._onLoadComplete=function(t){this.dispatchEvent(t)},A6b.prototype._onAssetComplete=function(t){this.dispatchEvent(t)},A6b.prototype._onLoadError=function(t){return!!this.hasEventListener(URLLoaderEvent.LOAD_ERROR)&&(this.dispatchEvent(t),!0)},A6b.prototype._onParseError=function(t){return!!this.hasEventListener(ParserEvent.PARSE_ERROR)&&(this.dispatchEvent(t),!0)},A6b.prototype._onLoaderComplete=function(t){this._content=t.content,this._content&&this.addChild(this._content),this.dispatchEvent(t),this._disposeLoader()},A6b),MouseEvent$1=(f7b=EventBase,__extends(g7b,f7b),Object.defineProperty(g7b.prototype,"bubbles",{get:function(){var t=this._iAllowedToPropagate&&this._iAllowedToImmediatlyPropagate;return this._iAllowedToPropagate=!0,this._iAllowedToImmediatlyPropagate=!0,t},enumerable:!0,configurable:!0}),g7b.prototype.stopPropagation=function(){this._iAllowedToPropagate=!1,this._iParentEvent&&this._iParentEvent.stopPropagation()},g7b.prototype.stopImmediatePropagation=function(){this._iAllowedToPropagate=!1,this._iAllowedToImmediatlyPropagate=!1,this._iParentEvent&&this._iParentEvent.stopImmediatePropagation()},g7b.prototype.clone=function(){var t=new g7b(this.type);return t.screenX=this.screenX,t.screenY=this.screenY,t.view=this.view,t.entity=this.entity,t.pickerEntity=this.pickerEntity,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},Object.defineProperty(g7b.prototype,"scenePosition",{get:function(){return this.entity.transform.concatenatedMatrix3D.transformVector(this.position)},enumerable:!0,configurable:!0}),Object.defineProperty(g7b.prototype,"sceneNormal",{get:function(){var t=this.entity.transform.concatenatedMatrix3D.deltaTransformVector(this.normal);return t.normalize(),t},enumerable:!0,configurable:!0}),g7b.MOUSE_OVER="mouseOver3d",g7b.MOUSE_OUT="mouseOut3d",g7b.ROLL_OVER="rollOver3d",g7b.ROLL_OUT="rollOut3d",g7b.MOUSE_UP="mouseUp3d",g7b.MOUSE_UP_OUTSIDE="mouseUpOutside3d",g7b.MOUSE_DOWN="mouseDown3d",g7b.MOUSE_MOVE="mouseMove3d",g7b.DRAG_MOVE="dragMove3d",g7b.DRAG_OUT="dragOut3d",g7b.DRAG_OVER="dragOver3d",g7b.DRAG_START="dragStart3d",g7b.DRAG_STOP="dragStop3d",g7b.FOCUS_IN="focusIn3d",g7b.FOCUS_OUT="focusOut3d",g7b.CLICK="click3d",g7b.DOUBLE_CLICK="doubleClick3d",g7b.MOUSE_WHEEL="mouseWheel3d",g7b),LightEvent=(l7b=EventBase,__extends(m7b,l7b),m7b.prototype.clone=function(){return new m7b(this.type)},m7b.CASTS_SHADOW_CHANGE="castsShadowChange",m7b),TextureProjectorEvent=(o7b=EventBase,__extends(p7b,o7b),p7b.prototype.clone=function(){return new p7b(this.type)},p7b.TEXTURE_CHANGE="textureChange",p7b),MethodEvent=(r7b=EventBase,__extends(s7b,r7b),s7b.SHADER_INVALIDATED="shaderInvalidated",s7b),TextureBase=(u7b=AssetBase,__extends(v7b,u7b),Object.defineProperty(v7b.prototype,"mappingMode",{get:function(){return this._mappingMode},set:function(t){this._mappingMode!=t&&(this._mappingMode=t)},enumerable:!0,configurable:!0}),v7b.prototype.getNumImages=function(){return this._numImages},v7b.prototype.setNumImages=function(t){this._numImages!=t&&(this._numImages=t,this._images.length=t,this._samplers.length=t,this.invalidate())},v7b.prototype.getImageAt=function(t){return this._images[t]},v7b.prototype.setImageAt=function(t,e){this._images[e]=t,this.invalidate()},v7b.prototype.getSamplerAt=function(t){return this._samplers[t]},v7b.prototype.setSamplerAt=function(t,e){this._samplers[e]=t,this.invalidate()},v7b.prototype.invalidateShaderProgram=function(){this.invalidate(),this.dispatchEvent(new MethodEvent(MethodEvent.SHADER_INVALIDATED))},v7b),Texture2D=(F7b=TextureBase,__extends(G7b,F7b),Object.defineProperty(G7b.prototype,"assetType",{get:function(){return G7b.assetType},enumerable:!0,configurable:!0}),G7b.assetType="[texture Texture2D]",G7b),TextureCube=(J7b=TextureBase,__extends(K7b,J7b),Object.defineProperty(K7b.prototype,"assetType",{get:function(){return K7b.assetType},enumerable:!0,configurable:!0}),K7b.assetType="[texture TextureCube]",K7b),ImageTextureCube=(L7b=TextureCube,__extends(M7b,L7b),Object.defineProperty(M7b.prototype,"assetType",{get:function(){return M7b.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(M7b.prototype,"sampler",{get:function(){return this._samplers[0]},set:function(t){this._samplers[0]!=t&&this.setSamplerAt(t,0)},enumerable:!0,configurable:!0}),Object.defineProperty(M7b.prototype,"image",{get:function(){return this._images[0]},set:function(t){this._images[0]!=t&&this.setImageAt(t,0)},enumerable:!0,configurable:!0}),M7b.assetType="[texture ImageTextureCube]",M7b),_Shader_ImageTexture=(R7b=_Shader_TextureBase,__extends(S7b,R7b),S7b.prototype._getFragmentCode=function(t,e,i,n){this._imageIndex=this._shader.renderMaterial.getImageIndex(this._texture,0);var r=this.getTextureReg(this._imageIndex,e,i);return this._textureIndex=r.index,"tex "+t+", "+n+", "+r+" <"+this._shader.renderMaterial.images[this._imageIndex].getType()+",linear,miplinear,wrap>\n"},S7b.prototype.activate=function(){var t=this._shader.renderMaterial.samplers[this._imageIndex];this._shader.renderMaterial.images[this._imageIndex].activate(this._textureIndex,t)},S7b.prototype._setRenderState=function(t){var e=t.samplers[this._imageIndex],i=t.images[this._imageIndex];i&&e&&i.activate(this._textureIndex,e)},S7b),R7b,L7b,J7b,F7b,u7b,r7b,o7b,l7b,f7b,z6b;function S7b(){return null!==R7b&&R7b.apply(this,arguments)||this}function M7b(t){void 0===t&&(t=null);var e=L7b.call(this)||this;return e.setNumImages(1),e.image=t,e}function K7b(){return null!==J7b&&J7b.apply(this,arguments)||this}function G7b(t){void 0===t&&(t=null);var e=F7b.call(this)||this;return e._mappingMode=t||MappingMode.LINEAR,e}function v7b(){var t=u7b.call(this)||this;return t._numImages=0,t._images=new Array,t._samplers=new Array,t}function s7b(t){return r7b.call(this,t)||this}function p7b(t){return o7b.call(this,t)||this}function m7b(t){return l7b.call(this,t)||this}function g7b(t){return f7b.call(this,t)||this}function A6b(t,e){var i;void 0===t&&(t=!0),void 0===e&&(e=null);var n=z6b.call(this)||this;return n._useAssetLib=t,n._assetLibId=e,n._onLoaderStartDelegate=function(t){return n._onLoaderStart(t)},n._onLoadProgressDelegate=function(t){return n._onLoadProgress(t)},n._onLoadCompleteDelegate=function(t){return n._onLoadComplete(t)},n._onAssetCompleteDelegate=function(t){return n._onAssetComplete(t)},n._onLoaderCompleteDelegate=function(t){return n._onLoaderComplete(t)},n._onLoadErrorDelegate=function(t){return n._onLoadError(t)},n._onParseErrorDelegate=function(t){return n._onParseError(t)},n._errorDelegateSelector=((i={})[URLLoaderEvent.LOAD_ERROR]=n._onLoadErrorDelegate,i[ParserEvent.PARSE_ERROR]=n._onParseErrorDelegate,i),n}ShaderBase.registerAbstraction(_Shader_ImageTexture,ImageTextureCube);var ImageTexture2D=(a8b=Texture2D,__extends(b8b,a8b),Object.defineProperty(b8b.prototype,"assetType",{get:function(){return b8b.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(b8b.prototype,"sampler",{get:function(){return this._samplers[0]},set:function(t){this._samplers[0]!=t&&this.setSamplerAt(t,0)},enumerable:!0,configurable:!0}),Object.defineProperty(b8b.prototype,"image",{get:function(){return this._images[0]},set:function(t){if(this._images[0]!=t){if(!ImageUtils.isImage2DValid(t))throw new ErrorBase("Invalid imageData: Width and height must be power of 2 and cannot exceed 2048");this.setImageAt(t,0)}},enumerable:!0,configurable:!0}),b8b.assetType="[texture ImageTexture2D]",b8b),_Shader_ImageTexture2D=(h8b=_Shader_ImageTexture,__extends(i8b,h8b),i8b.prototype._getFragmentCode=function(t,e,i,n){var r,o,s="";return this._texture.mappingMode==MappingMode.RADIAL&&(s+="mul "+(r=e.getFreeFragmentVectorTemp())+".xy, "+n+", "+n+"\n",s+="add "+r+".x, "+r+".x, "+r+".y\n",s+="sub "+r+".y, "+r+".y, "+r+".y\n",s+="sqt "+r+".x, "+r+".x, "+r+".x\n",n=r),this._shader.useImageRect&&(o=e.getFreeFragmentConstant(),this._samplerIndex=4*o.index,s+="mul "+(r=e.getFreeFragmentVectorTemp())+", "+n+", "+o+".xy\n",s+="add "+r+", "+r+", "+o+".zw\n",n=r),s+=h8b.prototype._getFragmentCode.call(this,t,e,i,n),this._shader.usesPremultipliedAlpha&&(s+="div "+t+".xyz, "+t+", "+t+".w\n"),s},i8b.prototype.activate=function(){h8b.prototype.activate.call(this);var t,e,i=this._shader.renderMaterial.samplers[this._imageIndex];this._shader.useImageRect&&(t=this._samplerIndex,e=this._shader.fragmentConstantData,i.imageRect?(e[t]=i.imageRect.width,e[t+1]=i.imageRect.height,e[t+2]=i.imageRect.x,e[t+3]=i.imageRect.y):(e[t]=1,e[t+1]=1,e[t+2]=0,e[t+3]=0))},i8b.prototype._setRenderState=function(t){h8b.prototype._setRenderState.call(this,t);var e,i,n=t.samplers[this._imageIndex];this._shader.useImageRect&&n&&(e=this._samplerIndex,i=this._shader.fragmentConstantData,n.imageRect?(i[e]=n.imageRect.width,i[e+1]=n.imageRect.height,i[e+2]=n.imageRect.x,i[e+3]=n.imageRect.y):(i[e]=1,i[e+1]=1,i[e+2]=0,i[e+3]=0))},i8b),h8b,a8b;function i8b(){return null!==h8b&&h8b.apply(this,arguments)||this}function b8b(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=a8b.call(this,e)||this;return i.setNumImages(1),i.image=t,i}ShaderBase.registerAbstraction(_Shader_ImageTexture2D,ImageTexture2D);var DepthTextureCube=(x8b=ImageTextureCube,__extends(y8b,x8b),Object.defineProperty(y8b.prototype,"assetType",{get:function(){return y8b.assetType},enumerable:!0,configurable:!0}),y8b.assetType="[texture DepthTextureCube]",y8b),_Shader_DepthTexture=(A8b=_Shader_ImageTexture,__extends(B8b,A8b),B8b.prototype._initVO=function(t){this._decodeReg=null,this._decodeIndex=-1},B8b.prototype._initConstants=function(){var t=this._shader.fragmentConstantData,e=this._decodeIndex;t[e]=1,t[e+1]=1/255,t[e+2]=1/65025,t[e+3]=1/16581375},B8b.prototype._getFragmentCode=function(t,e,i,n){-1==this._decodeIndex&&(this._decodeIndex=4*(this._decodeReg=e.getFreeFragmentConstant()).index);var r=e.getFreeFragmentVectorTemp();return A8b.prototype._getFragmentCode.call(this,r,e,i,n)+"dp4 "+t+".w, "+r+", "+this._decodeReg+"\n"},B8b),A8b,x8b;function B8b(){return null!==A8b&&A8b.apply(this,arguments)||this}function y8b(t){return void 0===t&&(t=null),x8b.call(this,t)||this}ShaderBase.registerAbstraction(_Shader_DepthTexture,DepthTextureCube);var ShadowTexture2D=(K8b=ImageTexture2D,__extends(L8b,K8b),Object.defineProperty(L8b.prototype,"assetType",{get:function(){return L8b.assetType},enumerable:!0,configurable:!0}),L8b.assetType="[texture ShadowTexture2D]",L8b),_Shader_ShadowTexture2D=(N8b=_Shader_DepthTexture,__extends(O8b,N8b),O8b.prototype._getFragmentCode=function(t,e,i,n){return N8b.prototype._getFragmentCode.call(this,t,e,i,n)+"slt "+t+".w, "+n+".z, "+t+".w\n"},O8b),N8b,K8b;function O8b(){return null!==N8b&&N8b.apply(this,arguments)||this}function L8b(t){return void 0===t&&(t=null),K8b.call(this,t)||this}ShaderBase.registerAbstraction(_Shader_ShadowTexture2D,ShadowTexture2D);var MethodBase=(T8b=AssetBase,__extends(U8b,T8b),U8b.prototype.dispose=function(){},U8b.prototype.iAddOwner=function(t){var e=this._owners.indexOf(t);if(-1!=e)this._counts[e]++;else{this._owners.push(t),this._counts.push(1);for(var i=this._textures.length,n=0;n<i;n++)t.addTexture(this._textures[n])}},U8b.prototype.iRemoveOwner=function(t){var e=this._owners.indexOf(t);if(1!=this._counts[e])this._counts[e]--;else{this._owners.splice(e,1),this._counts.splice(e,1);for(var i=this._textures.length,n=0;n<i;n++)t.removeTexture(this._textures[n])}},U8b.prototype.iAddTexture=function(t){this._textures.push(t);for(var e=this._owners.length,i=0;i<e;i++)this._owners[i].addTexture(t)},U8b.prototype.iRemoveTexture=function(t){this._textures.splice(this._textures.indexOf(t),1);for(var e=this._owners.length,i=0;i<e;i++)this._owners[i].removeTexture(t)},U8b.prototype.invalidateShaderProgram=function(){this.invalidate(),this.dispatchEvent(new MethodEvent(MethodEvent.SHADER_INVALIDATED))},U8b.prototype.copyFrom=function(t){},U8b),_Shader_MethodBase=(j9b=AbstractionBase,__extends(k9b,j9b),k9b.prototype._isUsed=function(){return!0},k9b.prototype._usesTangentSpace=function(){return!0},k9b.prototype._initVO=function(t){},k9b.prototype._initConstants=function(){},k9b.prototype._reset=function(t){this._invalid=!0,t.useChunk=!1,t.needsProjection=!1,t.needsView=!1,t.needsNormals=!1,t.needsTangents=!1,t.needsGlobalVertexPos=!1,t.needsGlobalFragmentPos=!1,this._cleanCompilationData()},k9b.prototype._cleanCompilationData=function(){},k9b.prototype._getVertexCode=function(t,e){return""},k9b.prototype._getFragmentCode=function(t,e,i){return""},k9b.prototype._activate=function(){},k9b.prototype._setRenderState=function(t){},k9b.prototype._deactivate=function(){this._invalid=!1},k9b),ShadowMapperBase=(w9b=MethodBase,__extends(x9b,w9b),Object.defineProperty(x9b.prototype,"textureMap",{get:function(){return this._textureMap},enumerable:!0,configurable:!0}),Object.defineProperty(x9b.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(x9b.prototype,"light",{get:function(){return this._light},set:function(t){this._light!=t&&(this._light=t)},enumerable:!0,configurable:!0}),Object.defineProperty(x9b.prototype,"epsilon",{get:function(){return this._epsilon},set:function(t){this._epsilon=t},enumerable:!0,configurable:!0}),Object.defineProperty(x9b.prototype,"size",{get:function(){return this._size},set:function(t){this._size!=t&&(this._size=t,this._updateSize())},enumerable:!0,configurable:!0}),x9b.prototype.update=function(t,e){this._updateProjection(e.view.projection),this._renderMap(t,e)},x9b.prototype._updateProjection=function(t){throw new AbstractMethodError},x9b.prototype._renderMap=function(t,e){throw new AbstractMethodError},x9b.prototype._updateSize=function(){throw new AbstractMethodError},x9b.prototype.dispose=function(){this._light=null},x9b),_Shader_ShadowMapperBase=(I9b=_Shader_MethodBase,__extends(J9b,I9b),J9b.prototype._cleanCompilationData=function(){I9b.prototype._cleanCompilationData.call(this),this._depthMapCoordReg=null},Object.defineProperty(J9b.prototype,"texture",{get:function(){return this._texture},enumerable:!0,configurable:!0}),Object.defineProperty(J9b.prototype,"depthMapCoordReg",{get:function(){return this._depthMapCoordReg},enumerable:!0,configurable:!0}),J9b.prototype.onClear=function(t){I9b.prototype.onClear.call(this,t),this._shader.renderMaterial.renderGroup._removeMapper(this._mapper)},J9b.prototype._initVO=function(t){this._texture=this._shader.getAbstraction(this._mapper.textureMap),this._texture._initVO(t)},J9b.prototype._initConstants=function(){this._texture._initConstants()},J9b.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant();return this._fragmentAlphaIndex=4*n.index,"add "+t+".w, "+t+".w, "+n+".x\nsat "+t+".w, "+t+".w\n"},J9b.prototype._activate=function(){this._shader.fragmentConstantData[this._fragmentAlphaIndex]=1-this._mapper.alpha,this._texture.activate()},J9b.prototype._setRenderState=function(t){this._texture._setRenderState(t)},J9b),DirectionalShadowMapper=(U9b=ShadowMapperBase,__extends(V9b,U9b),Object.defineProperty(V9b.prototype,"assetType",{get:function(){return V9b.assetType},enumerable:!0,configurable:!0}),V9b.prototype.dispose=function(){U9b.prototype.dispose.call(this),this._textureMap.image=null,this._textureMap=null,this._image2D=null},Object.defineProperty(V9b.prototype,"snap",{get:function(){return this._snap},set:function(t){this._snap=t},enumerable:!0,configurable:!0}),Object.defineProperty(V9b.prototype,"lightOffset",{get:function(){return this._lightOffset},set:function(t){this._lightOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(V9b.prototype,"depthProjection",{get:function(){return this._overallDepthProjection.viewMatrix3D},enumerable:!0,configurable:!0}),Object.defineProperty(V9b.prototype,"depth",{get:function(){return this._maxZ-this._minZ},enumerable:!0,configurable:!0}),V9b.prototype._updateSize=function(){this._image2D._setSize(this._size,this._size)},V9b.prototype._updateProjection=function(t){this._updateProjectionFromFrustumCorners(t,t.viewFrustumCorners,this._matrix),this._overallDepthProjection.frustumMatrix3D=this._matrix,this._updateCullPlanes(t)},V9b.prototype._renderMap=function(t,e){var i=e.depthRenderGroup.getRenderer(t);i.cullPlanes=this._cullPlanes,i.view.preservePixelRatio=!1,i.view.target=this._image2D,i.view.projection=this._overallDepthProjection,i.render()},V9b.prototype._updateCullPlanes=function(t){var e=this._overallDepthProjection.viewFrustumPlanes,i=t.viewFrustumPlanes;this._cullPlanes.length=4,this._cullPlanes[0]=e[0],this._cullPlanes[1]=e[1],this._cullPlanes[2]=e[2],this._cullPlanes[3]=e[3];for(var n=this._light.sceneDirection,r=n.x,o=n.y,s=n.z,a=4,l=0;l<6;++l){var c=i[l];c.a*r+c.b*o+c.c*s<0&&(this._cullPlanes[a++]=c)}},V9b.prototype._updateProjectionFromFrustumCorners=function(t,e,i){var n,r,o,s,a,l,c=t.transform.concatenatedMatrix3D.position,h=this._light.sceneDirection;for(this._overallDepthProjection.transform.matrix3D=this._light.transform.concatenatedMatrix3D,n=Math.floor((c.x-h.x*this._lightOffset)/this._snap)*this._snap,r=Math.floor((c.y-h.y*this._lightOffset)/this._snap)*this._snap,o=Math.floor((c.z-h.z*this._lightOffset)/this._snap)*this._snap,this._overallDepthProjection.transform.moveTo(n,r,o),this._overallDepthProjection.transform.inverseConcatenatedMatrix3D.transformVectors(e,this._localFrustum),s=f=this._localFrustum[0],a=m=this._localFrustum[1],this._maxZ=this._localFrustum[2],l=3;l<24;)(n=this._localFrustum[l])<s&&(s=n),f<n&&(f=n),(r=this._localFrustum[l+1])<a&&(a=r),m<r&&(m=r),(o=this._localFrustum[l+2])>this._maxZ&&(this._maxZ=o),l+=3;var u=f-s,p=m-a,d=(this._minZ=1)/(this._maxZ-this._minZ);s<0&&(s-=this._snap),a<0&&(a-=this._snap),s=Math.floor(s/this._snap)*this._snap,a=Math.floor(a/this._snap)*this._snap;var _=2*this._snap,f=s+(u=Math.floor(u/_+2)*_),m=a+(p=Math.floor(p/_+2)*_),u=1/u,p=1/p,g=i._rawData;g[0]=2*u,g[5]=2*p,g[10]=d,g[12]=-(f+s)*u,g[13]=-(m+a)*p,g[14]=-this._minZ*d,g[15]=1,g[1]=g[2]=g[3]=g[4]=g[6]=g[7]=g[8]=g[9]=g[11]=0,i.invalidatePosition()},V9b.assetType="[asset DirectionalShadowMapper]",V9b),_Shader_DirectionalShadowMapper=(Eac=_Shader_ShadowMapperBase,__extends(Fac,Eac),Fac.prototype._initVO=function(t){Eac.prototype._initVO.call(this,t),t.needsView=!0,t.needsGlobalVertexPos=!0},Fac.prototype._initConstants=function(){Eac.prototype._initConstants.call(this);var t=this._shader.vertexConstantData,e=this._vertexScalingIndex;t[e]=.5,t[e+1]=.5,t[e+2]=0,t[e+3]=1,this._depthProjectionMatrix=new Matrix3D(new Float32Array(this._shader.vertexConstantData.buffer,4*(e+4),16))},Fac.prototype._getVertexCode=function(t,e){var i="",n=t.getFreeVertexVectorTemp(),r=t.getFreeVertexConstant();this._vertexScalingIndex=4*r.index;var o=t.getFreeVertexConstant();return t.getFreeVertexConstant(),t.getFreeVertexConstant(),t.getFreeVertexConstant(),this._depthMapCoordReg=t.getFreeVarying(),i+("m44 "+n+", "+e.globalPositionVertex+", "+o+"\ndiv "+n+", "+n+", "+n+".w\nmul "+n+".xy, "+n+".xy, "+r+".xy\nadd "+this._depthMapCoordReg)+", "+n+", "+r+".xxwz\n"},Fac.prototype._activate=function(){Eac.prototype._activate.call(this);var t=this._shader.vertexConstantData;this._vertexScalingIndex,t[this._vertexScalingIndex+3]=-1/(this._mapper.depth*this._mapper.epsilon),this._depthProjectionMatrix.copyFrom(this._mapper.depthProjection,!0)},Fac),Eac,U9b,I9b,w9b,j9b,T8b;function Fac(){return null!==Eac&&Eac.apply(this,arguments)||this}function V9b(t){void 0===t&&(t=null);var e=U9b.call(this)||this;return e._lightOffset=1e4,e._snap=64,e._size=2048,e._image2D=t||new Image2D(e._size,e._size),e._textureMap=new ShadowTexture2D(e._image2D),e.iAddTexture(e._textureMap),e._cullPlanes=[],e._overallDepthProjection=new OrthographicProjection,e._overallDepthProjection.transform=new Transform,e._localFrustum=[],e._matrix=new Matrix3D,e}function J9b(t,e){var i=I9b.call(this,t,e)||this;return i.autoUpdate=!0,i._mapper=t,i._shader=e,i._shader.renderMaterial.renderGroup._addMapper(i._mapper),i}function x9b(){var t=null!==w9b&&w9b.apply(this,arguments)||this;return t._epsilon=.02,t._alpha=1,t.autoUpdate=!0,t}function k9b(t,e){var i=j9b.call(this,t,e)||this;return i.chunkVO=new ChunkVO,i}function U8b(){var t=T8b.call(this)||this;return t._textures=new Array,t._owners=new Array,t._counts=new Array,t}ShaderBase.registerAbstraction(_Shader_DirectionalShadowMapper,DirectionalShadowMapper);var LightBase=(Qac=AssetBase,__extends(Rac,Qac),Object.defineProperty(Rac.prototype,"transform",{get:function(){return this._transform},set:function(t){this._transform!=t&&(this._transform&&this._transform.removeEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateConcatenatedMatrix3DDelegate),this._transform=t,this._transform&&this._transform.addEventListener(TransformEvent.INVALIDATE_CONCATENATED_MATRIX3D,this._onInvalidateConcatenatedMatrix3DDelegate))},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"shadowsEnabled",{get:function(){return this._shadowsEnabled},set:function(t){this._shadowsEnabled!=t&&((this._shadowsEnabled=t)&&null==this._shadowMapper?(this._shadowMapper=this._createShadowMapper(),this._shadowMapper.light=this):t||(this._shadowMapper.dispose(),this._shadowMapper=null),this.dispatchEvent(new LightEvent(LightEvent.CASTS_SHADOW_CHANGE)))},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"specular",{get:function(){return this._specular},set:function(t){t<0&&(t=0),this._specular=t,this._updateSpecular()},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"diffuse",{get:function(){return this._diffuse},set:function(t){t<0&&(t=0),this._diffuse=t,this._updateDiffuse()},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t,this._colorR=(this._color>>16&255)/255,this._colorG=(this._color>>8&255)/255,this._colorB=(255&this._color)/255,this._updateDiffuse(),this._updateSpecular()},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"ambient",{get:function(){return this._ambient},set:function(t){t<0?t=0:1<t&&(t=1),this._ambient=t,this._updateAmbient()},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"ambientColor",{get:function(){return this._ambientColor},set:function(t){this._ambientColor!=t&&(this._ambientColor=t,this._updateAmbient())},enumerable:!0,configurable:!0}),Object.defineProperty(Rac.prototype,"shadowMapper",{get:function(){return this.shadowsEnabled=!0,this._shadowMapper},set:function(t){this._shadowMapper!=t&&(this._shadowMapper=t,this._shadowMapper.light=this)},enumerable:!0,configurable:!0}),Rac.prototype._createShadowMapper=function(){throw new AbstractMethodError},Rac.prototype._updateSpecular=function(){this._specularR=this._colorR*this._specular,this._specularG=this._colorG*this._specular,this._specularB=this._colorB*this._specular},Rac.prototype._updateDiffuse=function(){this._diffuseR=this._colorR*this._diffuse,this._diffuseG=this._colorG*this._diffuse,this._diffuseB=this._colorB*this._diffuse},Rac.prototype._updateAmbient=function(){this._ambientR=(this._ambientColor>>16&255)/255*this._ambient,this._ambientG=(this._ambientColor>>8&255)/255*this._ambient,this._ambientB=(255&this._ambientColor)/255*this._ambient},Rac.prototype._onInvalidateConcatenatedMatrix3D=function(t){},Rac),DirectionalLight=(cbc=LightBase,__extends(dbc,cbc),Object.defineProperty(dbc.prototype,"assetType",{get:function(){return dbc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(dbc.prototype,"sceneDirection",{get:function(){return this._sceneDirectionDirty&&this._updateSceneDirection(),this._sceneDirection},enumerable:!0,configurable:!0}),Object.defineProperty(dbc.prototype,"direction",{get:function(){return this._direction},set:function(t){this._direction=t,this._tmpLookAt||(this._tmpLookAt=new Vector3D),this._tmpLookAt.x=this.transform.position.x+this._direction.x,this._tmpLookAt.y=this.transform.position.y+this._direction.y,this._tmpLookAt.z=this.transform.position.z+this._direction.z,this.transform.lookAt(this._tmpLookAt)},enumerable:!0,configurable:!0}),dbc.prototype._onInvalidateConcatenatedMatrix3D=function(t){this._sceneDirectionDirty=!0},dbc.prototype._updateSceneDirection=function(){this._sceneDirectionDirty=!1,this.transform.concatenatedMatrix3D.copyColumnTo(2,this._sceneDirection),this._sceneDirection.normalize()},dbc.prototype._createShadowMapper=function(){return new DirectionalShadowMapper},dbc.assetType="[light DirectionalLight]",dbc),LightProbe=(jbc=LightBase,__extends(kbc,jbc),Object.defineProperty(kbc.prototype,"assetType",{get:function(){return kbc.assetType},enumerable:!0,configurable:!0}),kbc.assetType="[light LightProbe]",kbc),ShadowTextureCube=(obc=ImageTextureCube,__extends(pbc,obc),Object.defineProperty(pbc.prototype,"assetType",{get:function(){return pbc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(pbc.prototype,"mapper",{get:function(){return this._mapper},enumerable:!0,configurable:!0}),pbc.assetType="[texture ShadowTextureCube]",pbc),_Shader_ShadowTextureCube=(tbc=_Shader_DepthTexture,__extends(ubc,tbc),ubc.prototype._getFragmentCode=function(t,e,i,n){var r=e.getFreeFragmentConstant();this._positionIndex=4*r.index;var o=e.getFreeFragmentConstant(),s="",a=e.getFreeFragmentVectorTemp();return(s+="sub "+a+", "+n+", "+r+"\ndp3 "+a+".w, "+a+".xyz, "+a+".xyz\nnrm "+a+".xyz, "+a+".xyz\n")+tbc.prototype._getFragmentCode.call(this,t,e,i,a)+"add "+a+".w, "+a+".w, "+o+".x\nmul "+a+".w, "+a+".w, "+r+".w\nslt "+t+".w, "+a+".w, "+t+".w\n"},ubc.prototype._activate=function(){tbc.prototype.activate.call(this);var t=this._shader.fragmentConstantData,e=this._positionIndex,i=this._texture.mapper.light.transform.concatenatedMatrix3D.position,n=this._texture.mapper.light.fallOff;t[e]=i.x,t[e+1]=i.y,t[e+2]=i.z,t[e+3]=1/(2*n*n),t[e+4]=-Math.pow(1/(n*this._texture.mapper.epsilon),2)},ubc),tbc,obc,jbc,cbc,Qac;function ubc(){return null!==tbc&&tbc.apply(this,arguments)||this}function pbc(t,e){void 0===e&&(e=null);var i=obc.call(this,e)||this;return i._mapper=t,i}function kbc(t,e){void 0===e&&(e=null);var i=jbc.call(this)||this;return i.diffuseSampler=new ImageSampler,i.specularSampler=new ImageSampler,i.diffuseMap=t,i.specularMap=e,i}function dbc(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=cbc.call(this,e)||this;return i._sceneDirectionDirty=!0,t&&(i.direction=t),i._sceneDirection=new Vector3D,i}function Rac(t){void 0===t&&(t=null);var e=Qac.call(this)||this;return e._color=16777215,e._colorR=1,e._colorG=1,e._colorB=1,e._ambientColor=16777215,e._ambient=0,e._specular=1,e._diffuse=1,e._shadowsEnabled=!1,e._ambientR=0,e._ambientG=0,e._ambientB=0,e._specularR=1,e._specularG=1,e._specularB=1,e._diffuseR=1,e._diffuseG=1,e._diffuseB=1,e._onInvalidateConcatenatedMatrix3DDelegate=function(t){return e._onInvalidateConcatenatedMatrix3D(t)},e.transform=t||new Transform,e}ShaderBase.registerAbstraction(_Shader_ShadowTextureCube,ShadowTextureCube);var PointShadowMapper=(Hbc=ShadowMapperBase,__extends(Ibc,Hbc),Object.defineProperty(Ibc.prototype,"assetType",{get:function(){return Ibc.assetType},enumerable:!0,configurable:!0}),Ibc.prototype.dispose=function(){Hbc.prototype.dispose.call(this),this._textureMap.image=null,this._textureMap=null,this._imageCube=null},Ibc.prototype.initCameras=function(){this._depthProjections=new Array,this.addProjection(0,90,0),this.addProjection(0,-90,0),this.addProjection(-90,0,0),this.addProjection(90,0,0),this.addProjection(0,0,0),this.addProjection(0,180,0)},Ibc.prototype.addProjection=function(t,e,i){var n=new PerspectiveProjection;n.transform=new Transform,n.transform.rotateTo(t,e,i),n.near=.01,n.fieldOfView=90,this._depthProjections.push(n)},Ibc.prototype._updateSize=function(){this._imageCube._setSize(this._size)},Ibc.prototype._updateProjection=function(t){for(var e=this._light.fallOff,i=this._light.transform.concatenatedMatrix3D.position,n=0;n<6;++n)this._depthProjections[n].far=e,this._depthProjections[n].transform.moveTo(i.x,i.y,i.z),this._needsRender[n]=!0},Ibc.prototype._renderMap=function(t,e){for(var i=e.distanceRenderGroup.getRenderer(t),n=0;n<6;++n)this._needsRender[n]&&(i.view.target=this._imageCube,i.view.projection=this._depthProjections[n],i.render(null,n))},Ibc.assetType="[asset PointShadowMapper]",Ibc),_Shader_PointShadowMapper=(Xbc=_Shader_ShadowMapperBase,__extends(Ybc,Xbc),Ybc.prototype._initVO=function(t){Xbc.prototype._initVO.call(this,t),t.needsGlobalFragmentPos=!0},Ybc.prototype._getVertexCode=function(t,e){return this._depthMapCoordReg=e.globalPositionVarying,""},Ybc),Xbc,Hbc;function Ybc(){return null!==Xbc&&Xbc.apply(this,arguments)||this}function Ibc(t){void 0===t&&(t=null);var e=Hbc.call(this)||this;return e._needsRender=new Array,e._size=512,e._imageCube=t||new ImageCube(e._size),e._textureMap=new ShadowTextureCube(e,e._imageCube),e.iAddTexture(e._textureMap),e.initCameras(),e}ShaderBase.registerAbstraction(_Shader_PointShadowMapper,PointShadowMapper);var PointLight=(acc=LightBase,__extends(bcc,acc),Object.defineProperty(bcc.prototype,"assetType",{get:function(){return bcc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._radius<0?this._radius=0:this._radius>this._fallOff&&(this._fallOff=this._radius),this._fallOffFactor=1/(this._fallOff*this._fallOff-this._radius*this._radius)},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"fallOff",{get:function(){return this._fallOff},set:function(t){this._fallOff=t,this._fallOff<0&&(this._fallOff=0),this._fallOff<this._radius&&(this._radius=this._fallOff),this._fallOffFactor=1/(this._fallOff*this._fallOff-this._radius*this._radius)},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"fallOffFactor",{get:function(){return this._fallOffFactor},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"x",{get:function(){return this._transform.position.x},set:function(t){this._transform.position.x!=t&&(this._transform.matrix3D._rawData[12]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"y",{get:function(){return this._transform.position.y},set:function(t){this._transform.position.y!=t&&(this._transform.matrix3D._rawData[13]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"z",{get:function(){return this._transform.position.z},set:function(t){this._transform.position.z!=t&&(this._transform.matrix3D._rawData[14]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(bcc.prototype,"scenePosition",{get:function(){return this._transform.concatenatedMatrix3D.position},enumerable:!0,configurable:!0}),bcc.prototype._createShadowMapper=function(){return new PointShadowMapper},bcc.assetType="[light PointLight]",bcc),TextureProjector=(kcc=AssetBase,__extends(lcc,kcc),Object.defineProperty(lcc.prototype,"transform",{get:function(){return this._transform},set:function(t){this._transform!=t&&(this._transform=t)},enumerable:!0,configurable:!0}),Object.defineProperty(lcc.prototype,"projection",{get:function(){return this._projection},enumerable:!0,configurable:!0}),Object.defineProperty(lcc.prototype,"assetType",{get:function(){return lcc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(lcc.prototype,"texture",{get:function(){return this._texture},set:function(t){t!=this._texture&&((this._texture=t).getImageAt(0).width,t.getImageAt(0).height,this.dispatchEvent(new TextureProjectorEvent(TextureProjectorEvent.TEXTURE_CHANGE)))},enumerable:!0,configurable:!0}),lcc.assetType="[asset TextureProjector]",lcc),AmbientBasicMethod=(rcc=MethodBase,__extends(scc,rcc),Object.defineProperty(scc.prototype,"assetType",{get:function(){return scc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(scc.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength!=t&&(this._strength=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(scc.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!=t&&(this._alpha=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(scc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.iRemoveTexture(this._texture),this._texture=t,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),scc.prototype.copyFrom=function(t){},scc.assetType="[asset AmbientBasicMethod]",scc),_Shader_AmbientBasicMethod=(ycc=_Shader_MethodBase,__extends(zcc,ycc),zcc.prototype.onClear=function(t){ycc.prototype.onClear.call(this,t),this._method=null,this._shader=null,this._texture&&(this._texture.onClear(new AssetEvent(AssetEvent.CLEAR,this._method.texture)),this._texture=null)},zcc.prototype._initVO=function(t){this._method.texture?(this._texture=this._shader.getAbstraction(this._method.texture),this._texture._initVO(t),this._method.texture instanceof TextureCube?t.needsNormals=!0:this._shader.uvDependencies++):this._texture&&(this._texture=null)},zcc.prototype._initConstants=function(){this._texture&&this._texture._initConstants()},zcc.prototype._getFragmentCode=function(t,e,i){var n,r,o="";return this._texture?(o+=this._texture._getFragmentCode(t,e,i,this._method.texture instanceof TextureCube?i.normalFragment:i.uvVarying),0<this._shader.alphaThreshold&&(n=e.getFreeFragmentConstant(),this._colorIndex=4*n.index,o+="sub "+t+".w, "+t+".w, "+n+".x\nkil "+t+".w\nadd "+t+".w, "+t+".w, "+n+".x\n")):(r=e.getFreeFragmentConstant(),this._colorIndex=4*r.index,o+="mov "+t+", "+r+"\n"),o},zcc.prototype._activate=function(){var t,e,i;this._texture?(this._texture.activate(),this._invalid&&0<this._shader.alphaThreshold&&(this._shader.fragmentConstantData[this._colorIndex]=this._shader.alphaThreshold)):this._invalid&&(t=this._colorIndex,e=this._shader.fragmentConstantData,i=this._shader.numLights?16777215:this._shader.renderMaterial.style.color,e[t]=(i>>16&255)/255*this._method.strength,e[t+1]=(i>>8&255)/255*this._method.strength,e[t+2]=(255&i)/255*this._method.strength,e[t+3]=this._method.alpha)},zcc.prototype._setRenderState=function(t){this._texture&&this._texture._setRenderState(t)},zcc),ycc,rcc,kcc,acc;function zcc(t,e){var i=ycc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function scc(){var t=rcc.call(this)||this;return t._alpha=1,t._strength=1,t}function lcc(t,e){void 0===e&&(e=null);var i=kcc.call(this)||this;return i._transform=e||new Transform,i._projection=new PerspectiveProjection,i._projection.transform=i._transform,(i._texture=t).getImageAt(0).width,t.getImageAt(0).height,i}function bcc(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=acc.call(this,e)||this;return i._radius=9e4,i._fallOff=1e5,t&&(i._transform.matrix3D._rawData[12]=t.x,i._transform.matrix3D._rawData[13]=t.y,i._transform.matrix3D._rawData[14]=t.z,i._transform.invalidatePosition()),i._fallOffFactor=1/(i._fallOff*i._fallOff-i._radius*i._radius),i}ShaderBase.registerAbstraction(_Shader_AmbientBasicMethod,AmbientBasicMethod);var AmbientDepthMethod=(Pcc=AmbientBasicMethod,__extends(Qcc,Pcc),Object.defineProperty(Qcc.prototype,"assetType",{get:function(){return Qcc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Qcc.prototype,"castingLight",{get:function(){return this._castingLight},enumerable:!0,configurable:!0}),Qcc.assetType="[asset AmbientDepthMethod]",Qcc),_Shader_AmbientDepthMethod=(Tcc=_Shader_AmbientBasicMethod,__extends(Ucc,Tcc),Ucc.prototype._initVO=function(t){this._shadowTexture._initVO(t)},Ucc.prototype._initConstants=function(){this._shadowTexture._initConstants();var t=this._shader.fragmentConstantData,e=this._decRegIndex;t[e]=1,t[e+1]=1/255,t[e+2]=1/65025,t[e+3]=1/16581375},Ucc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentConstant();return this._decRegIndex=4*r.index,n+(this._shadowTexture._getFragmentCode(t,e,i,i.uvVarying)+"dp4 ")+t+".x, "+t+", "+r+"\nmov "+t+".yz, "+t+".xx\t\t\t\nmov "+t+".w, "+r+".x\nsub "+t+".xyz, "+r+".xxx, "+t+".xyz\n"},Ucc),Tcc,Pcc;function Ucc(t,e){var i=Tcc.call(this,t,e)||this;return i._shadowTexture=e.getAbstraction(t.castingLight.shadowMapper.textureMap),i}function Qcc(t){var e=Pcc.call(this)||this;return(e._castingLight=t).shadowsEnabled=!0,e._shadowMapper=t.shadowMapper,e.iAddTexture(t.shadowMapper.textureMap),e}ShaderBase.registerAbstraction(_Shader_AmbientDepthMethod,AmbientDepthMethod);var CompositeMethodBase=(edc=MethodBase,__extends(fdc,edc),Object.defineProperty(fdc.prototype,"baseMethod",{get:function(){return this._baseMethod},set:function(t){this._baseMethod!=t&&(this._baseMethod.removeEventListener(MethodEvent.SHADER_INVALIDATED,this._onShaderInvalidatedDelegate),this._baseMethod=t,this._baseMethod.addEventListener(MethodEvent.SHADER_INVALIDATED,this._onShaderInvalidatedDelegate),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),fdc.prototype.createBaseMethod=function(){throw new AbstractMethodError},fdc.prototype.iAddOwner=function(t){edc.prototype.iAddOwner.call(this,t),this._baseMethod.iAddOwner(t)},fdc.prototype.iRemoveOwner=function(t){edc.prototype.iRemoveOwner.call(this,t),this._baseMethod.iRemoveOwner(t)},fdc.prototype.dispose=function(){this._baseMethod.removeEventListener(MethodEvent.SHADER_INVALIDATED,this._onShaderInvalidatedDelegate)},fdc.prototype.onShaderInvalidated=function(t){this.invalidateShaderProgram()},fdc),_Shader_CompositeMethodBase=(ndc=AbstractionBase,__extends(odc,ndc),odc.prototype._isUsed=function(){return!0},odc.prototype._usesTangentSpace=function(){return this._baseChunk._usesTangentSpace()},odc.prototype._initVO=function(t){this._baseChunk._initVO(t)},odc.prototype._initConstants=function(){this._baseChunk._initConstants()},odc.prototype._activate=function(){this._baseChunk._activate()},odc.prototype._setRenderState=function(t){this._baseChunk._setRenderState(t)},odc.prototype._deactivate=function(){this._baseChunk._deactivate(),this._invalid=!1},odc.prototype._getVertexCode=function(t,e){return this._baseChunk._getVertexCode(t,e)},odc.prototype._getFragmentCode=function(t,e,i){return this._baseChunk._getFragmentCode(t,e,i)},odc.prototype._reset=function(t){this._baseChunk._reset(t),this._invalid=!0,this._cleanCompilationData()},odc.prototype._cleanCompilationData=function(){this._baseChunk._cleanCompilationData()},odc),_Shader_LightingCompositeMethod=(Adc=_Shader_CompositeMethodBase,__extends(Bdc,Adc),Bdc.prototype._getFragmentPreLightingCode=function(t,e){return this._baseChunk._getFragmentPreLightingCode(t,e)},Bdc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r=this._baseChunk._getFragmentCodePerLight(t,e,i,n);return this._totalLightColorReg=this._baseChunk._totalLightColorReg,r},Bdc.prototype._getFragmentCodePerProbe=function(t,e,i,n){var r=this._baseChunk._getFragmentCodePerProbe(t,e,i,n);return this._totalLightColorReg=this._baseChunk._totalLightColorReg,r},Bdc),DiffuseBasicMethod=(Odc=MethodBase,__extends(Pdc,Odc),Object.defineProperty(Pdc.prototype,"assetType",{get:function(){return Pdc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Pdc.prototype,"multiply",{get:function(){return this._multiply},set:function(t){this._multiply!=t&&(this._multiply=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Pdc.prototype,"color",{get:function(){return this._color},set:function(t){this._color!=t&&(this._color=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Pdc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.iRemoveTexture(this._texture),this._texture=t,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Pdc.prototype.dispose=function(){this._texture=null},Pdc.prototype.copyFrom=function(t){var e=t;this.texture=e.texture,this.multiply=e.multiply,this.color=e.color},Pdc.assetType="[asset DiffuseBasicMethod]",Pdc),_Shader_DiffuseBasicMethod=(Wdc=_Shader_MethodBase,__extends(Xdc,Wdc),Xdc.prototype.onInvalidate=function(t){Wdc.prototype.onInvalidate.call(this,t),this._updateProperties()},Xdc.prototype._isUsed=function(){return Boolean(this._shader.numLights)},Xdc.prototype._initVO=function(t){this._method.texture?(this._texture=this._shader.getAbstraction(this._method.texture),this._texture._initVO(t),this._method.texture instanceof TextureCube?t.needsNormals=!0:this._shader.uvDependencies++):this._texture&&(this._texture=null),this._shader.numLights&&(this._shader.usesCommonData=!0,t.needsNormals=!0)},Xdc.prototype._initConstants=function(){this._texture&&this._texture._initConstants(),this._updateProperties()},Xdc.prototype._cleanCompilationData=function(){Wdc.prototype._cleanCompilationData.call(this),this._totalLightColorReg=null},Xdc.prototype._getFragmentPreLightingCode=function(t,e){return this._pIsFirstLight=!0,t.addFragmentTempUsages(this._totalLightColorReg=t.getFreeFragmentVectorTemp(),1),""},Xdc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="dp3 "+r+".x, "+t+", "+n.normalFragment+"\nmax "+r+".w, "+r+".x, "+n.commons+".y\n",this._shader.usesLightFallOff&&(o+="mul "+r+".w, "+r+".w, "+t+".w\n"),null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),o+="mul "+r+", "+r+".w, "+e+"\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+r+"\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},Xdc.prototype._getFragmentCodePerProbe=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="tex "+r+", "+n.normalFragment+", "+t+" <cube,linear,miplinear>\nmul "+r+".xyz, "+r+".xyz, "+e+"\n",null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+r+"\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},Xdc.prototype._getFragmentCode=function(t,e,i){var n,r="";i.shadowTarget&&(r+=this._applyShadow(e,i)),e.addFragmentTempUsages(n=e.getFreeFragmentVectorTemp(),1);var o,s=e.getFreeFragmentConstant();return this._ambientColorRegister=4*s.index,this._texture?r+=this._texture._getFragmentCode(n,e,i,this._method.texture instanceof TextureCube?i.normalFragment:i.uvVarying):(o=e.getFreeFragmentConstant(),this._diffuseColorRegister=4*o.index,r+="mov "+n+", "+o+"\n"),r+="sat "+this._totalLightColorReg+", "+this._totalLightColorReg+"\nmul "+n+".xyz, "+n+", "+this._totalLightColorReg+"\n",this._method.multiply?r+="add "+n+".xyz, "+n+", "+s+"\nmul "+t+".xyz, "+t+", "+n+"\n":this._texture?r+="mul "+t+".xyz, "+t+", "+s+"\nmul "+this._totalLightColorReg+".xyz, "+t+", "+this._totalLightColorReg+"\nsub "+t+".xyz, "+t+", "+this._totalLightColorReg+"\nadd "+t+".xyz, "+t+", "+n+"\n":r+="mul "+this._totalLightColorReg+".xyz, "+s+", "+this._totalLightColorReg+"\nsub "+this._totalLightColorReg+".xyz, "+s+", "+this._totalLightColorReg+"\nadd "+n+".xyz, "+n+", "+this._totalLightColorReg+"\nmul "+t+".xyz, "+t+", "+n+"\n",e.removeFragmentTempUsage(this._totalLightColorReg),e.removeFragmentTempUsage(n),r},Xdc.prototype._applyShadow=function(t,e){return"mul "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+e.shadowTarget+".w\n"},Xdc.prototype._activate=function(){var t,e;this._texture?this._texture.activate():(t=this._diffuseColorRegister,e=this._shader.fragmentConstantData,this._method.multiply?(e[t]=this._colorR*this._ambientColorR,e[t+1]=this._colorG*this._ambientColorG,e[t+2]=this._colorB*this._ambientColorB):(e[t]=this._colorR,e[t+1]=this._colorG,e[t+2]=this._colorB),e[t+3]=1)},Xdc.prototype._updateProperties=function(){this._ambientColor=this._shader.renderMaterial.style.color,this._ambientColorR=(this._ambientColor>>16&255)/255,this._ambientColorG=(this._ambientColor>>8&255)/255,this._ambientColorB=(255&this._ambientColor)/255,this._color=this._method.color,this._colorR=(this._color>>16&255)/255,this._colorG=(this._color>>8&255)/255,this._colorB=(255&this._color)/255},Xdc.prototype._setRenderState=function(t){this._texture&&this._texture._setRenderState(t);var e=this._ambientColorRegister,i=this._shader.fragmentConstantData;i[e]=this._shader.ambientR*this._ambientColorR,i[e+1]=this._shader.ambientG*this._ambientColorG,i[e+2]=this._shader.ambientB*this._ambientColorB,i[e+3]=1},Xdc),Wdc,Odc,Adc,ndc,edc;function Xdc(t,e){var i=Wdc.call(this,t,e)||this;return i._ambientColorR=1,i._ambientColorG=1,i._ambientColorB=1,i._color=16777215,i._colorR=1,i._colorG=1,i._colorB=1,i._method=t,i._shader=e,i}function Pdc(){var t=Odc.call(this)||this;return t._multiply=!0,t._ambientColorR=1,t._ambientColorG=1,t._ambientColorB=1,t._color=16777215,t._colorR=1,t._colorG=1,t._colorB=1,t}function Bdc(){return null!==Adc&&Adc.apply(this,arguments)||this}function odc(t,e){var i=ndc.call(this,t,e)||this;return i.chunkVO=new ChunkVO,i._baseChunk=e.getAbstraction(t.baseMethod),i}function fdc(t){void 0===t&&(t=null);var e=edc.call(this)||this;return e._onShaderInvalidatedDelegate=function(t){return e.onShaderInvalidated(t)},e._baseMethod=t||e.createBaseMethod(),e._baseMethod.addEventListener(MethodEvent.SHADER_INVALIDATED,e._onShaderInvalidatedDelegate),e}ShaderBase.registerAbstraction(_Shader_DiffuseBasicMethod,DiffuseBasicMethod);var DiffuseCompositeMethod=(Dec=CompositeMethodBase,__extends(Eec,Dec),Eec.prototype.createBaseMethod=function(){return new DiffuseBasicMethod},Object.defineProperty(Eec.prototype,"texture",{get:function(){return this._baseMethod.texture},set:function(t){this._baseMethod.texture=t},enumerable:!0,configurable:!0}),Object.defineProperty(Eec.prototype,"color",{get:function(){return this._baseMethod.color},set:function(t){this._baseMethod.color=t},enumerable:!0,configurable:!0}),Object.defineProperty(Eec.prototype,"multiply",{get:function(){return this._baseMethod.multiply},set:function(t){this._baseMethod.multiply=t},enumerable:!0,configurable:!0}),Eec),DiffuseCelMethod=(Jec=DiffuseCompositeMethod,__extends(Kec,Jec),Object.defineProperty(Kec.prototype,"assetType",{get:function(){return Kec.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Kec.prototype,"levels",{get:function(){return this._levels},set:function(t){this._levels=t},enumerable:!0,configurable:!0}),Object.defineProperty(Kec.prototype,"smoothness",{get:function(){return this._smoothness},set:function(t){this._smoothness=t},enumerable:!0,configurable:!0}),Kec.assetType="[asset DiffuseCelMethod]",Kec),_Shader_DiffuseCelMethod=(Rec=_Shader_LightingCompositeMethod,__extends(Sec,Rec),Sec.prototype._initConstants=function(){Rec.prototype._initConstants.call(this);var t=this._shader.fragmentConstantData,e=this._clampDataIndex;t[e+1]=1,t[e+2]=0},Sec.prototype._cleanCompilationData=function(){Rec.prototype._cleanCompilationData.call(this),this._clampDataRegister=null},Sec.prototype._getFragmentPreLightingCode=function(t,e){return this._clampDataRegister=t.getFreeFragmentConstant(),this._clampDataIndex=4*this._clampDataRegister.index,Rec.prototype._getFragmentPreLightingCode.call(this,t,e)},Sec.prototype._activate=function(){var t,e;Rec.prototype._activate.call(this),this._invalid&&((t=this._shader.fragmentConstantData)[e=this._clampDataIndex]=this._method.levels,t[e+3]=this._method.smoothness)},Sec.prototype.clampDiffuse=function(t,e,i){return"mul "+t+".w, "+t+".w, "+this._clampDataRegister+".x\nfrc "+t+".z, "+t+".w\nsub "+t+".y, "+t+".w, "+t+".z\nmov "+t+".x, "+this._clampDataRegister+".x\nsub "+t+".x, "+t+".x, "+this._clampDataRegister+".y\nrcp "+t+".x,"+t+".x\nmul "+t+".w, "+t+".y, "+t+".x\nsub "+t+".y, "+t+".w, "+t+".x\ndiv "+t+".z, "+t+".z, "+this._clampDataRegister+".w\nsat "+t+".z, "+t+".z\nmul "+t+".w, "+t+".w, "+t+".z\nsub "+t+".z, "+this._clampDataRegister+".y, "+t+".z\nmul "+t+".y, "+t+".y, "+t+".z\nadd "+t+".w, "+t+".w, "+t+".y\nsat "+t+".w, "+t+".w\n"},Sec),Rec,Jec,Dec;function Sec(t,e){var n=Rec.call(this,t,e)||this;return n._method=t,n._shader=e,n._baseChunk._modulateFunction=function(t,e,i){return n.clampDiffuse(t,e,i)},n}function Kec(t,e,i){void 0===t&&(t=3),void 0===e&&(e=.1),void 0===i&&(i=null);var n=Jec.call(this,i)||this;return n._levels=t,n._smoothness=e,n}function Eec(t){return void 0===t&&(t=null),Dec.call(this,t)||this}ShaderBase.registerAbstraction(_Shader_DiffuseCelMethod,DiffuseCelMethod);var DiffuseGradientMethod=(gfc=DiffuseBasicMethod,__extends(hfc,gfc),Object.defineProperty(hfc.prototype,"assetType",{get:function(){return hfc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(hfc.prototype,"gradient",{get:function(){return this._gradient},set:function(t){this._gradient!=t&&(this._gradient&&this.iRemoveTexture(this._gradient),this._gradient=t,this._gradient&&this.iAddTexture(this._gradient),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),hfc.assetType="[asset DiffuseGradientMethod]",hfc),_Shader_DiffuseGradientMethod=(lfc=_Shader_DiffuseBasicMethod,__extends(mfc,lfc),mfc.prototype._initVO=function(t){lfc.prototype._initVO.call(this,t),this._gradient=this._shader.getAbstraction(this._method.gradient||new ImageTexture2D),this._gradient._initVO(t)},mfc.prototype._initConstants=function(){this._gradient._initConstants()},mfc.prototype._getFragmentPreLightingCode=function(t,e){var i=lfc.prototype._getFragmentPreLightingCode.call(this,t,e);return this._pIsFirstLight=!0,i},mfc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="dp3 "+r+".w, "+t+".xyz, "+n.normalFragment+".xyz\nmul "+r+".w, "+r+".w, "+n.commons+".x\nadd "+r+".w, "+r+".w, "+n.commons+".x\nmul "+r+".xyz, "+r+".w, "+t+".w\n",null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),o+=this._gradient._getFragmentCode(r,i,n,r)+"mul "+r+".xyz, "+r+".xyz, "+e+".xyz\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+".xyz, "+r+".xyz\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},mfc.prototype._activate=function(){lfc.prototype._activate.call(this),this._gradient.activate()},mfc.prototype._setRenderState=function(t){lfc.prototype._setRenderState.call(this,t),this._gradient._setRenderState(t)},mfc),lfc,gfc;function mfc(t,e){return lfc.call(this,t,e)||this}function hfc(t){var e=gfc.call(this)||this;return e._gradient=t,e.iAddTexture(e._gradient),e}ShaderBase.registerAbstraction(_Shader_DiffuseGradientMethod,DiffuseGradientMethod);var DiffuseLightMapMethod=(Afc=DiffuseCompositeMethod,__extends(Bfc,Afc),Object.defineProperty(Bfc.prototype,"assetType",{get:function(){return Bfc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Bfc.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){if(t!=Bfc.ADD&&t!=Bfc.MULTIPLY)throw new Error("Unknown blendmode!");this._blendMode!=t&&(this._blendMode=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Bfc.prototype,"lightMap",{get:function(){return this._lightMap},set:function(t){this._lightMap!=t&&(this._lightMap&&this.iRemoveTexture(this._lightMap),this._lightMap=t,this._lightMap&&this.iAddTexture(this._lightMap),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Bfc.prototype,"useSecondaryUV",{get:function(){return this._useSecondaryUV},set:function(t){this._useSecondaryUV!=t&&(this._useSecondaryUV=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Bfc.MULTIPLY="multiply",Bfc.ADD="add",Bfc.assetType="[asset DiffuseLightMapMethod]",Bfc),_Shader_DiffuseLightMapMethod=(Kfc=_Shader_LightingCompositeMethod,__extends(Lfc,Kfc),Lfc.prototype._initVO=function(t){this._lightMap=this._shader.getAbstraction(this._method.lightMap||new ImageTexture2D),this._lightMap._initVO(t),this._method.useSecondaryUV?this._shader.secondaryUVDependencies++:this._shader.uvDependencies++},Lfc.prototype._initConstants=function(){this._lightMap._initConstants()},Lfc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentVectorTemp(),r=this._lightMap._getFragmentCode(n,e,i,this._method.useSecondaryUV?i.secondaryUVVarying:i.uvVarying);switch(this._method.blendMode){case DiffuseLightMapMethod.MULTIPLY:r+="mul "+this._totalLightColorReg+", "+this._totalLightColorReg+", "+n+"\n";break;case DiffuseLightMapMethod.ADD:r+="add "+this._totalLightColorReg+", "+this._totalLightColorReg+", "+n+"\n"}return r+Kfc.prototype._getFragmentCode.call(this,t,e,i)},Lfc.prototype._activate=function(){Kfc.prototype._activate.call(this),this._lightMap.activate()},Lfc.prototype._setRenderState=function(t){Kfc.prototype._setRenderState.call(this,t),this._lightMap._setRenderState(t)},Lfc),Kfc,Afc;function Lfc(t,e){var i=Kfc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Bfc(t,e,i,n){void 0===e&&(e="multiply"),void 0===i&&(i=!1),void 0===n&&(n=null);var r=Afc.call(this,n)||this;return r._lightMap=t,r.blendMode=e,r._useSecondaryUV=i,r._lightMap&&r.iAddTexture(r._lightMap),r}ShaderBase.registerAbstraction(_Shader_DiffuseLightMapMethod,DiffuseLightMapMethod);var DiffuseWrapMethod=(Wfc=DiffuseBasicMethod,__extends(Xfc,Wfc),Object.defineProperty(Xfc.prototype,"assetType",{get:function(){return Xfc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Xfc.prototype,"wrapFactor",{get:function(){return this._wrapFactor},set:function(t){this._wrapFactor=t,this._wrapFactor=1/(t+1),this.invalidate()},enumerable:!0,configurable:!0}),Xfc.assetType="[asset DiffuseWrapMethod]",Xfc),_Shader_DiffuseWrapMethod=(_fc=_Shader_DiffuseBasicMethod,__extends(agc,_fc),agc.prototype._cleanCompilationData=function(){_fc.prototype._cleanCompilationData.call(this),this._wrapDataRegister=null},agc.prototype._getFragmentPreLightingCode=function(t,e){var i=_fc.prototype._getFragmentPreLightingCode.call(this,t,e);return this._pIsFirstLight=!0,this._wrapDataRegister=t.getFreeFragmentConstant(),this._wrapDataIndex=4*this._wrapDataRegister.index,i},agc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="dp3 "+r+".x, "+t+".xyz, "+n.normalFragment+".xyz\nadd "+r+".y, "+r+".x, "+this._wrapDataRegister+".x\nmul "+r+".y, "+r+".y, "+this._wrapDataRegister+".y\nsat "+r+".w, "+r+".y\nmul "+r+".xz, "+r+".w, "+t+".wz\n",null!=this._modulateFunction&&(o+=this._modulateFunction(t,i,n)),o+="mul "+r+", "+r+".x, "+e+"\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+".xyz, "+r+".xyz\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},agc.prototype._activate=function(){var t,e;_fc.prototype._activate.call(this),this._invalid&&(t=this._wrapDataIndex,(e=this._shader.fragmentConstantData)[t]=this._method.wrapFactor,e[t+1]=1/(this._method.wrapFactor+1))},agc),_fc,Wfc;function agc(t,e){return _fc.call(this,t,e)||this}function Xfc(t){void 0===t&&(t=.5);var e=Wfc.call(this)||this;return e.wrapFactor=t,e}ShaderBase.registerAbstraction(_Shader_DiffuseWrapMethod,DiffuseWrapMethod);var EffectAlphaMaskMethod=(ogc=MethodBase,__extends(pgc,ogc),Object.defineProperty(pgc.prototype,"assetType",{get:function(){return pgc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(pgc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.iRemoveTexture(this._texture),this._texture=t,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(pgc.prototype,"useSecondaryUV",{get:function(){return this._useSecondaryUV},set:function(t){this._useSecondaryUV!=t&&(this._useSecondaryUV=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),pgc.assetType="[asset EffectAlphaMaskMethod]",pgc),_Shader_EffectAlphaMaskMethod=(vgc=_Shader_MethodBase,__extends(wgc,vgc),wgc.prototype._initVO=function(t){this._alphaMask=this._shader.getAbstraction(this._method.texture||new ImageTexture2D),this._alphaMask._initVO(t),this._method.useSecondaryUV?this._shader.secondaryUVDependencies++:this._shader.uvDependencies++},wgc.prototype._initConstants=function(){this._alphaMask._initConstants()},wgc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentVectorTemp();return this._alphaMask._getFragmentCode(n,e,i,this._method.useSecondaryUV?i.secondaryUVVarying:i.uvVarying)+"mul "+t+", "+t+", "+n+".x\n"},wgc.prototype._activate=function(){vgc.prototype._activate.call(this),this._alphaMask.activate()},wgc.prototype._setRenderState=function(t){this._alphaMask._setRenderState(t)},wgc),vgc,ogc;function wgc(t,e){var i=vgc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function pgc(t,e){void 0===e&&(e=!1);var i=ogc.call(this)||this;return i._texture=t,i._useSecondaryUV=e,i._texture&&i.iAddTexture(i._texture),i}ShaderBase.registerAbstraction(_Shader_EffectAlphaMaskMethod,EffectAlphaMaskMethod);var EffectColorMatrixMethod=(Ggc=MethodBase,__extends(Hgc,Ggc),Object.defineProperty(Hgc.prototype,"assetType",{get:function(){return Hgc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Hgc.prototype,"matrix",{get:function(){return this._matrix},set:function(t){if(20!=t.length)throw new Error("Matrix length must be 20!");this._matrix=t,this.invalidate()},enumerable:!0,configurable:!0}),Hgc.assetType="[asset EffectColorMatrixMethod]",Hgc),_Shader_EffectColorMatrixMethod=(Lgc=_Shader_MethodBase,__extends(Mgc,Lgc),Mgc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentConstant();e.getFreeFragmentConstant(),e.getFreeFragmentConstant(),e.getFreeFragmentConstant();var o=e.getFreeFragmentConstant();this._colorMatrixIndex=4*r.index;var s=e.getFreeFragmentVectorTemp();return n+"m44 "+s+", "+t+", "+r+"\nadd "+t+", "+s+", "+o+"\n"},Mgc.prototype._activate=function(){var t,e,i;this._invalid&&(t=this._method.matrix,e=this._colorMatrixIndex,(i=this._shader.fragmentConstantData)[e]=t[0],i[e+1]=t[1],i[e+2]=t[2],i[e+3]=t[3],i[e+4]=t[5],i[e+5]=t[6],i[e+6]=t[7],i[e+7]=t[8],i[e+8]=t[10],i[e+9]=t[11],i[e+10]=t[12],i[e+11]=t[13],i[e+12]=t[15],i[e+13]=t[16],i[e+14]=t[17],i[e+15]=t[18],i[e+16]=t[4],i[e+17]=t[9],i[e+18]=t[14],i[e+19]=t[19])},Mgc),Lgc,Ggc;function Mgc(t,e){var i=Lgc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Hgc(t){var e=Ggc.call(this)||this;if(20!=t.length)throw new Error("Matrix length must be 20!");return e._matrix=t,e}ShaderBase.registerAbstraction(_Shader_EffectColorMatrixMethod,EffectColorMatrixMethod);var EffectColorTransformMethod=($gc=MethodBase,__extends(_gc,$gc),Object.defineProperty(_gc.prototype,"assetType",{get:function(){return _gc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(_gc.prototype,"colorTransform",{get:function(){return this._colorTransform},set:function(t){this._colorTransform=t,this.invalidate()},enumerable:!0,configurable:!0}),_gc.assetType="[asset EffectColorTransformMethod]",_gc),_Shader_EffectColorTransformMethod=(dhc=_Shader_MethodBase,__extends(ehc,dhc),ehc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentConstant(),o=e.getFreeFragmentConstant();return this._colorTransformIndex=4*r.index,n+"mul "+t+", "+t+", "+r+"\nadd "+t+", "+t+", "+o+"\n"},ehc.prototype._activate=function(){var t,e,i;this._invalid&&(t=this._colorTransformIndex,e=this._shader.fragmentConstantData,i=this._method.colorTransform._rawData,e[t]=i[0],e[t+1]=i[1],e[t+2]=i[2],e[t+3]=i[3],e[t+4]=i[4],e[t+5]=i[5],e[t+6]=i[6],e[t+7]=i[7])},ehc),dhc,$gc;function ehc(t,e){var i=dhc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function _gc(t){void 0===t&&(t=null);var e=$gc.call(this)||this;return e._colorTransform=t,e}ShaderBase.registerAbstraction(_Shader_EffectColorTransformMethod,EffectColorTransformMethod);var EffectEnvMapMethod=(rhc=MethodBase,__extends(shc,rhc),Object.defineProperty(shc.prototype,"assetType",{get:function(){return shc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(shc.prototype,"envMap",{get:function(){return this._envMap},set:function(t){this._envMap!=t&&(this._envMap&&this.iRemoveTexture(this._envMap),this._envMap=t,this._envMap&&this.iAddTexture(this._envMap),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(shc.prototype,"mask",{get:function(){return this._mask},set:function(t){t!=this._mask&&(this._mask&&this.iRemoveTexture(this._mask),this._mask=t,this._mask&&this.iAddTexture(this._mask),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(shc.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=t,this.invalidate()},enumerable:!0,configurable:!0}),shc.prototype.dispose=function(){},shc.assetType="[asset EffectEnvMapMethod]",shc),_Shader_EffectEnvMapMethod=(zhc=_Shader_MethodBase,__extends(Ahc,zhc),Ahc.prototype._initVO=function(t){t.needsNormals=!0,t.needsView=!0,this._envMap=this._shader.getAbstraction(this._method.envMap),this._envMap._initVO(t),this._method.mask?(this._maskMap=this._shader.getAbstraction(this._method.mask),this._shader.uvDependencies++):this._maskMap&&(this._maskMap=null)},Ahc.prototype._initConstants=function(){this._envMap._initConstants()},Ahc.prototype.dispose=function(){this._envMap=null,this._maskMap=null},Ahc.prototype._activate=function(){this._envMap.activate(),this._maskMap&&this._maskMap.activate(),this._invalid&&this._updateProperties()},Ahc.prototype._setRenderState=function(t){this._envMap._setRenderState(t),this._maskMap&&this._maskMap._setRenderState(t)},Ahc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant(),r="";this._fragmentIndex=4*n.index;var o=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(o,1);var s=e.getFreeFragmentVectorTemp();return e.addFragmentTempUsages(s,1),r+="dp3 "+o+".w, "+i.viewDirFragment+".xyz, "+i.normalFragment+".xyz\nadd "+o+".w, "+o+".w, "+o+".w\nmul "+o+".xyz, "+i.normalFragment+".xyz, "+o+".w\nsub "+o+".xyz, "+o+".xyz, "+i.viewDirFragment+".xyz\n"+this._envMap._getFragmentCode(o,e,i,o)+"sub "+s+".w, "+o+".w, fc0.x\nkil "+s+".w\nsub "+o+", "+o+", "+t+"\n",this._maskMap&&(r+=this._maskMap._getFragmentCode(s,e,i,i.uvVarying)+"mul "+o+", "+s+", "+o+"\n"),r+="mul "+o+", "+o+", "+n+".x\nadd "+t+", "+t+", "+o+"\n",e.removeFragmentTempUsage(o),e.removeFragmentTempUsage(s),r},Ahc.prototype._updateProperties=function(){this._shader.fragmentConstantData[this._fragmentIndex]=this._method.alpha},Ahc),zhc,rhc;function Ahc(t,e){var i=zhc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function shc(t,e){void 0===e&&(e=1);var i=rhc.call(this)||this;return i._envMap=t,i._alpha=e,i.iAddTexture(i._envMap),i}ShaderBase.registerAbstraction(_Shader_EffectEnvMapMethod,EffectEnvMapMethod);var EffectFogMethod=(Nhc=MethodBase,__extends(Ohc,Nhc),Object.defineProperty(Ohc.prototype,"assetType",{get:function(){return Ohc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Ohc.prototype,"minDistance",{get:function(){return this._minDistance},set:function(t){this._minDistance=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(Ohc.prototype,"maxDistance",{get:function(){return this._maxDistance},set:function(t){this._maxDistance=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(Ohc.prototype,"fogColor",{get:function(){return this._fogColor},set:function(t){this._fogColor=t,this.invalidate()},enumerable:!0,configurable:!0}),Ohc.assetType="[asset EffectFogMethod]",Ohc),_Shader_EffectFogMethod=(Whc=_Shader_MethodBase,__extends(Xhc,Whc),Xhc.prototype._initVO=function(t){t.needsProjection=!0},Xhc.prototype._activate=function(){var t,e,i;this._invalid&&(t=this._shader.fragmentConstantData,e=this._fogColorIndex,i=this._method.fogColor,t[e]=(i>>16&255)/255,t[e+1]=(i>>8&255)/255,t[e+2]=(255&i)/255,t[e+3]=1,t[e+4]=this._method.minDistance,t[e+5]=1/(this._method.maxDistance-this._method.minDistance),t[e+6]=0,t[e+7]=0)},Xhc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant(),r=e.getFreeFragmentConstant(),o=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(o,1);var s=e.getFreeFragmentVectorTemp(),a="";return this._fogColorIndex=4*n.index,a+="sub "+s+".w, "+i.projectionFragment+".z, "+r+".x\nmul "+s+".w, "+s+".w, "+r+".y\nsat "+s+".w, "+s+".w\nsub "+o+", "+n+", "+t+"\nmul "+o+", "+o+", "+s+".w\nadd "+t+", "+t+", "+o+"\n",e.removeFragmentTempUsage(o),a},Xhc),Whc,Nhc;function Xhc(t,e){var i=Whc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Ohc(t,e,i){void 0===t&&(t=0),void 0===e&&(e=1e3),void 0===i&&(i=8421504);var n=Nhc.call(this)||this;return n._minDistance=t,n._maxDistance=e,n._fogColor=i,n}ShaderBase.registerAbstraction(_Shader_EffectFogMethod,EffectFogMethod);var EffectFresnelEnvMapMethod=(lic=EffectEnvMapMethod,__extends(mic,lic),Object.defineProperty(mic.prototype,"assetType",{get:function(){return mic.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(mic.prototype,"fresnelPower",{get:function(){return this._fresnelPower},set:function(t){this._fresnelPower=t},enumerable:!0,configurable:!0}),Object.defineProperty(mic.prototype,"normalReflectance",{get:function(){return this._normalReflectance},set:function(t){this._normalReflectance!=t&&(this._normalReflectance=t,this.invalidate())},enumerable:!0,configurable:!0}),mic.assetType="[asset EffectFresnelEnvMapMethod]",mic),_Shader_EffectFresnelEnvMapMethod=(uic=_Shader_EffectEnvMapMethod,__extends(vic,uic),vic.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant(),r="",o=i.viewDirFragment,s=i.normalFragment;this._fragmentIndex=4*n.index;var a=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(a,1);var l=e.getFreeFragmentVectorTemp();return e.addFragmentTempUsages(l,1),r+="dp3 "+a+".w, "+o+".xyz, "+s+".xyz\nadd "+a+".w, "+a+".w, "+a+".w\nmul "+a+".xyz, "+s+".xyz, "+a+".w\nsub "+a+".xyz, "+a+".xyz, "+o+".xyz\n"+this._envMap._getFragmentCode(a,e,i,a)+"sub "+l+".w, "+a+".w, fc0.x\nkil "+l+".w\nsub "+a+", "+a+", "+t+"\n",r+="dp3 "+o+".w, "+o+".xyz, "+s+".xyz\nsub "+o+".w, "+n+".w, "+o+".w\npow "+o+".w, "+o+".w, "+n+".z\nsub "+s+".w, "+n+".w, "+o+".w\nmul "+s+".w, "+n+".y, "+s+".w\nadd "+o+".w, "+o+".w, "+s+".w\nmul "+o+".w, "+n+".x, "+o+".w\n",this._maskMap&&(r+=this._maskMap._getFragmentCode(l,e,i,i.uvVarying)+"mul "+o+".w, "+l+".x, "+o+".w\n"),r+="mul "+a+", "+a+", "+o+".w\nadd "+t+", "+t+", "+a+"\n",e.removeFragmentTempUsage(a),e.removeFragmentTempUsage(l),r},vic.prototype._updateProperties=function(){var t=this._fragmentIndex,e=this._shader.fragmentConstantData;e[t]=this._method.alpha,e[t+1]=this._method.normalReflectance,e[t+2]=this._method.fresnelPower},vic),uic,lic;function vic(){return null!==uic&&uic.apply(this,arguments)||this}function mic(t,e,i,n){void 0===e&&(e=1),void 0===i&&(i=5),void 0===n&&(n=0);var r=lic.call(this,t,e)||this;return r._fresnelPower=i,r._normalReflectance=n,r}ShaderBase.registerAbstraction(_Shader_EffectFresnelEnvMapMethod,EffectFresnelEnvMapMethod);var EffectLightMapMethod=(Hic=MethodBase,__extends(Iic,Hic),Object.defineProperty(Iic.prototype,"assetType",{get:function(){return Iic.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Iic.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){if(this._blendMode!=t){if(t!=Iic.ADD&&t!=Iic.MULTIPLY)throw new Error("Unknown blendmode!");this._blendMode=t,this.invalidateShaderProgram()}},enumerable:!0,configurable:!0}),Object.defineProperty(Iic.prototype,"lightMap",{get:function(){return this._lightMap},set:function(t){this._lightMap!=t&&(this._lightMap&&this.iRemoveTexture(this._lightMap),this._lightMap=t,this._lightMap&&this.iAddTexture(this._lightMap),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Iic.prototype,"useSecondaryUV",{get:function(){return this._useSecondaryUV},set:function(t){this._useSecondaryUV!=t&&(this._useSecondaryUV=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Iic.MULTIPLY="multiply",Iic.ADD="add",Iic.assetType="[asset EffectLightMapMethod]",Iic),_Shader_EffectLightMapMethod=(Qic=_Shader_MethodBase,__extends(Ric,Qic),Ric.prototype._initVO=function(t){this._lightMap=this._shader.getAbstraction(this._method.lightMap),this._lightMap._initVO(t),this._method.useSecondaryUV?this._shader.secondaryUVDependencies++:this._shader.uvDependencies++},Ric.prototype._initConstants=function(){this._lightMap._initConstants()},Ric.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentVectorTemp(),r=this._lightMap._getFragmentCode(n,e,i,this._method.useSecondaryUV?i.secondaryUVVarying:i.uvVarying);switch(this._method.blendMode){case EffectLightMapMethod.MULTIPLY:r+="mul "+t+", "+t+", "+n+"\n";break;case EffectLightMapMethod.ADD:r+="add "+t+", "+t+", "+n+"\n"}return r},Ric.prototype._activate=function(){this._lightMap.activate()},Ric.prototype._setRenderState=function(t){this._lightMap._setRenderState(t)},Ric),Qic,Hic;function Ric(t,e){var i=Qic.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Iic(t,e,i){void 0===e&&(e="multiply"),void 0===i&&(i=!1);var n=Hic.call(this)||this;if(e!=Iic.ADD&&e!=Iic.MULTIPLY)throw new Error("Unknown blendmode!");return n._lightMap=t,n._blendMode=e,n._useSecondaryUV=i,n._lightMap&&n.iAddTexture(n._lightMap),n}ShaderBase.registerAbstraction(_Shader_EffectLightMapMethod,EffectLightMapMethod);var EffectProjectiveTextureMethod=(ajc=MethodBase,__extends(bjc,ajc),Object.defineProperty(bjc.prototype,"assetType",{get:function(){return bjc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(bjc.prototype,"exposure",{get:function(){return this._exposure},set:function(t){this._exposure!=t&&(this._exposure=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(bjc.prototype,"mode",{get:function(){return this._mode},set:function(t){this._mode!=t&&(this._mode=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(bjc.prototype,"projector",{get:function(){return this._projector},set:function(t){this._projector!=t&&(this._projector&&this._projector.removeEventListener(TextureProjectorEvent.TEXTURE_CHANGE,this._onTextureChangedDelegate),this._projector=t,this._projector&&this._projector.addEventListener(TextureProjectorEvent.TEXTURE_CHANGE,this._onTextureChangedDelegate),this.updateTexture())},enumerable:!0,configurable:!0}),bjc.prototype._onTextureChanged=function(t){this.updateTexture()},bjc.prototype.updateTexture=function(){this._texture&&this.iRemoveTexture(this._texture),this._texture=this._projector?this._projector.texture:null,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram()},bjc.OVERLAY="overlay",bjc.MULTIPLY="multiply",bjc.ADD="add",bjc.MIX="mix",bjc.assetType="[asset EffectProjectiveTextureMethod]",bjc),_Shader_EffectProjectiveTextureMethod=(ljc=_Shader_MethodBase,__extends(mjc,ljc),mjc.prototype._initVO=function(t){this._texture=this._shader.getAbstraction(this._method.projector.texture),this._texture._initVO(t)},mjc.prototype._initConstants=function(){this._texture._initConstants();var t=this._exposureIndex,e=this._shader.fragmentConstantData;e[t]=this._method.exposure,e[t+1]=.5,e[t+2]=4,e[t+3]=-1,this._projectionMatrix=new Matrix3D(new Float32Array(this._shader.vertexConstantData.buffer,4*this._projectionIndex,16))},mjc.prototype._cleanCompilationData=function(){ljc.prototype._cleanCompilationData.call(this),this._uvVarying=null,this._projectionMatrix=null},mjc.prototype._getVertexCode=function(t,e){var i="",n=t.getFreeVertexConstant();return t.getFreeVertexConstant(),t.getFreeVertexConstant(),t.getFreeVertexConstant(),this._projectionIndex=4*n.index,this._uvVarying=t.getFreeVarying(),i+("m44 "+this._uvVarying+", "+e.animatedPosition)+", "+n+"\n"},mjc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(r,1);var o=e.getFreeFragmentVectorTemp(),s=e.getFreeFragmentConstant();if(this._exposureIndex=4*s.index,n+=this._texture._getFragmentCode(r,e,i,this._uvVarying),n+="mul "+r+", "+r+", "+s+".xxx\nadd "+r+", "+r+", "+s+".xxx\n",this._method.mode==EffectProjectiveTextureMethod.MULTIPLY)n+="mul "+t+".xyz, "+t+".xyz, "+r+".xyz\t\t\t\n";else if(this._method.mode==EffectProjectiveTextureMethod.ADD)n+="add "+t+".xyz, "+t+".xyz, "+r+".xyz\t\t\t\n";else if(this._method.mode==EffectProjectiveTextureMethod.MIX)n+="sub "+r+".xyz, "+r+".xyz, "+t+".xyz\t\t\t\t\nmul "+r+".xyz, "+r+".xyz, "+r+".w\t\t\t\t\t\t\nadd "+t+".xyz, "+t+".xyz, "+r+".xyz\t\t\t\n";else{if(this._method.mode!=EffectProjectiveTextureMethod.OVERLAY)throw new ErrorBase('Unknown mode "'+this._method.mode+'"');n+="sge "+o+", "+t+", "+s+".yyy\n",n+="sub "+t+", "+t+", "+o+"\n",n+="sub "+r+", "+r+", "+o+"\n",n+="mul "+r+", "+r+", "+t+"\n",n+="sub "+t+", "+s+".yyy, "+o+"\n",n+="mul "+t+", "+s+".zzz, "+t+"\n",n+="mul "+r+", "+r+", "+t+"\n",n+="add "+t+", "+r+", "+o+"\n"}return e.removeFragmentTempUsage(r),n},mjc.prototype._setRenderState=function(t){var e=Matrix3D.CALCULATION_MATRIX;e.copyFrom(this._method.projector.projection.viewMatrix3D),e.prepend(t.renderSceneTransform),this._projectionMatrix.copyFrom(e,!0),this._texture._setRenderState(t)},mjc.prototype._activate=function(){this._texture.activate(),this._invalid&&(this._shader.fragmentConstantData[this._exposureIndex]=this._method.exposure)},mjc),ljc,ajc;function mjc(t,e){var i=ljc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function bjc(t,e,i){void 0===e&&(e="multiply"),void 0===i&&(i=1);var n=ajc.call(this)||this;return n._onTextureChangedDelegate=function(t){return n._onTextureChanged(t)},n._projector=t,n._exposure=i,n._mode=e,n._projector.addEventListener(TextureProjectorEvent.TEXTURE_CHANGE,n._onTextureChangedDelegate),n}ShaderBase.registerAbstraction(_Shader_EffectProjectiveTextureMethod,EffectProjectiveTextureMethod);var EffectRefractionEnvMapMethod=(Gjc=EffectEnvMapMethod,__extends(Hjc,Gjc),Object.defineProperty(Hjc.prototype,"assetType",{get:function(){return Hjc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Hjc.prototype,"refractionIndex",{get:function(){return this._refractionIndex},set:function(t){this._refractionIndex=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(Hjc.prototype,"dispersionR",{get:function(){return this._dispersionR},set:function(t){this._dispersionR!=t&&(this._dispersionR=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Hjc.prototype,"dispersionG",{get:function(){return this._dispersionG},set:function(t){this._dispersionG!=t&&(this._dispersionG=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(Hjc.prototype,"dispersionB",{get:function(){return this._dispersionB},set:function(t){this._dispersionB!=t&&(this._dispersionB=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Hjc.assetType="[asset EffectRefractionEnvMapMethod]",Hjc),_Shader_EffectRefractionEnvMapMethod=(Tjc=_Shader_EffectEnvMapMethod,__extends(Ujc,Tjc),Ujc.prototype._initVO=function(t){Tjc.prototype._initVO.call(this,t),this._useDispersion=!(this._method.dispersionR==this._method.dispersionB&&this._method.dispersionR==this._method.dispersionG)},Ujc.prototype._getFragmentCode=function(t,e,i){var n,r,o,s=e.getFreeFragmentConstant(),a=e.getFreeFragmentConstant(),l="";this._fragmentIndex=4*s.index,n=e.getFreeFragmentVectorTemp(),e.addFragmentTempUsages(n,1),r=e.getFreeFragmentVectorTemp(),e.addFragmentTempUsages(r,1),o=e.getFreeFragmentVectorTemp(),e.addFragmentTempUsages(o,1);var c=i.viewDirFragment,h=i.normalFragment;return l+="neg "+c+".xyz, "+c+".xyz\n",l+="dp3 "+o+".x, "+c+".xyz, "+h+".xyz\nmul "+o+".w, "+o+".x, "+o+".x\nsub "+o+".w, "+a+".x, "+o+".w\nmul "+o+".w, "+s+".x, "+o+".w\nmul "+o+".w, "+s+".x, "+o+".w\nsub "+o+".w, "+a+".x, "+o+".w\nsqt "+o+".y, "+o+".w\nmul "+o+".x, "+s+".x, "+o+".x\nadd "+o+".x, "+o+".x, "+o+".y\nmul "+o+".xyz, "+o+".x, "+h+".xyz\nmul "+n+", "+s+".x, "+c+"\nsub "+n+".xyz, "+n+".xyz, "+o+".xyz\nnrm "+n+".xyz, "+n+".xyz\n"+this._envMap._getFragmentCode(r,e,i,n)+"sub "+r+".w, "+r+".w, fc0.x\t\nkil "+r+".w\n",this._useDispersion&&(l+="dp3 "+o+".x, "+c+".xyz, "+h+".xyz\nmul "+o+".w, "+o+".x, "+o+".x\nsub "+o+".w, "+a+".x, "+o+".w\nmul "+o+".w, "+s+".y, "+o+".w\nmul "+o+".w, "+s+".y, "+o+".w\nsub "+o+".w, "+a+".x, "+o+".w\nsqt "+o+".y, "+o+".w\nmul "+o+".x, "+s+".y, "+o+".x\nadd "+o+".x, "+o+".x, "+o+".y\nmul "+o+".xyz, "+o+".x, "+h+".xyz\nmul "+n+", "+s+".y, "+c+"\nsub "+n+".xyz, "+n+".xyz, "+o+".xyz\nnrm "+n+".xyz, "+n+".xyz\n"+this._envMap._getFragmentCode(o,e,i,n)+"mov "+r+".y, "+o+".y\n",l+="dp3 "+o+".x, "+c+".xyz, "+h+".xyz\nmul "+o+".w, "+o+".x, "+o+".x\nsub "+o+".w, "+a+".x, "+o+".w\nmul "+o+".w, "+s+".z, "+o+".w\nmul "+o+".w, "+s+".z, "+o+".w\nsub "+o+".w, "+a+".x, "+o+".w\nsqt "+o+".y, "+o+".w\nmul "+o+".x, "+s+".z, "+o+".x\nadd "+o+".x, "+o+".x, "+o+".y\nmul "+o+".xyz, "+o+".x, "+h+".xyz\nmul "+n+", "+s+".z, "+c+"\nsub "+n+".xyz, "+n+".xyz, "+o+".xyz\nnrm "+n+".xyz, "+n+".xyz\n"+this._envMap._getFragmentCode(o,e,i,n)+"mov "+r+".z, "+o+".z\n"),l+="sub "+r+".xyz, "+r+".xyz, "+t+".xyz\nmul "+r+".xyz, "+r+".xyz, "+s+".w\nadd "+t+".xyz, "+t+".xyz, "+r+".xyz\n",e.removeFragmentTempUsage(o),e.removeFragmentTempUsage(n),e.removeFragmentTempUsage(r),l+"neg "+c+".xyz, "+c+".xyz\n"},Ujc.prototype._updateProperties=function(){var t=this._fragmentIndex,e=this._shader.fragmentConstantData,i=this._method.refractionIndex;e[t]=this._method.dispersionR+i,this._useDispersion&&(e[t+1]=this._method.dispersionG+i,e[t+2]=this._method.dispersionB+i),e[t+3]=this._method.alpha},Ujc),Tjc,Gjc;function Ujc(){return null!==Tjc&&Tjc.apply(this,arguments)||this}function Hjc(t,e,i,n,r,o){void 0===e&&(e=1),void 0===i&&(i=.1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0);var s=Gjc.call(this,t,e)||this;return s._dispersionR=0,s._dispersionG=0,s._dispersionB=0,s._refractionIndex=i,s._dispersionR=n,s._dispersionG=r,s._dispersionB=o,s}ShaderBase.registerAbstraction(_Shader_EffectRefractionEnvMapMethod,EffectRefractionEnvMapMethod);var EffectRimLightMethod=(ikc=MethodBase,__extends(jkc,ikc),Object.defineProperty(jkc.prototype,"assetType",{get:function(){return jkc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(jkc.prototype,"color",{get:function(){return this._color},set:function(t){this._power!=t&&(this._color=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(jkc.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength!=t&&(this._strength=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(jkc.prototype,"power",{get:function(){return this._power},set:function(t){this._power!=t&&(this._power=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(jkc.prototype,"blendMode",{get:function(){return this._blendMode},set:function(t){this._blendMode!=t&&(this._blendMode=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),jkc.ADD="add",jkc.MULTIPLY="multiply",jkc.MIX="mix",jkc.assetType="[asset EffectRimLightMethod]",jkc),_Shader_EffectRimLightMethod=(tkc=_Shader_MethodBase,__extends(ukc,tkc),ukc.prototype._initVO=function(t){t.needsNormals=!0,t.needsView=!0},ukc.prototype._activate=function(){var t,e,i;this._invalid&&(t=this._rimColorIndex,e=this._shader.fragmentConstantData,i=this._method.color,e[t]=(i>>16&255)/255,e[t+1]=(i>>8&255)/255,e[t+2]=(255&i)/255,e[t+3]=1,e[t+4]=this._method.strength,e[t+5]=this._method.power)},ukc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant(),r=e.getFreeFragmentConstant(),o=e.getFreeFragmentVectorTemp(),s="";return this._rimColorIndex=4*n.index,s+="dp3 "+o+".x, "+i.viewDirFragment+".xyz, "+i.normalFragment+".xyz\nsat "+o+".x, "+o+".x\nsub "+o+".x, "+n+".w, "+o+".x\npow "+o+".x, "+o+".x, "+r+".y\nmul "+o+".x, "+o+".x, "+r+".x\nsub "+o+".x, "+n+".w, "+o+".x\nmul "+t+".xyz, "+t+".xyz, "+o+".x\nsub "+o+".w, "+n+".w, "+o+".x\n",this._method.blendMode==EffectRimLightMethod.ADD?s+="mul "+o+".xyz, "+o+".w, "+n+".xyz\nadd "+t+".xyz, "+t+".xyz, "+o+".xyz\n":this._method.blendMode==EffectRimLightMethod.MULTIPLY?s+="mul "+o+".xyz, "+o+".w, "+n+".xyz\nmul "+t+".xyz, "+t+".xyz, "+o+".xyz\n":s+="sub "+o+".xyz, "+n+".xyz, "+t+".xyz\nmul "+o+".xyz, "+o+".xyz, "+o+".w\nadd "+t+".xyz, "+t+".xyz, "+o+".xyz\n",s},ukc),tkc,ikc;function ukc(t,e){var i=tkc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function jkc(t,e,i,n){void 0===t&&(t=16777215),void 0===e&&(e=.4),void 0===i&&(i=2),void 0===n&&(n="mix");var r=ikc.call(this)||this;return r._blendMode=n,r._strength=e,r._power=i,r._color=t,r}ShaderBase.registerAbstraction(_Shader_EffectRimLightMethod,EffectRimLightMethod);var NormalBasicMethod=(Jkc=MethodBase,__extends(Kkc,Jkc),Object.defineProperty(Kkc.prototype,"assetType",{get:function(){return Kkc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Kkc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.iRemoveTexture(this._texture),this._texture=t,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Kkc.prototype.copyFrom=function(t){null!=t.texture&&(this.texture=t.texture)},Kkc.prototype.dispose=function(){this._texture&&(this._texture=null)},Kkc.assetType="[asset NormalBasicMethod]",Kkc),_Shader_NormalBasicMethod=(Qkc=_Shader_MethodBase,__extends(Rkc,Qkc),Rkc.prototype._isUsed=function(){return!(!this._texture||!this._shader.normalDependencies)},Rkc.prototype._initVO=function(t){this._method.texture&&(this._texture=this._shader.getAbstraction(this._method.texture),this._texture._initVO(t),this._shader.uvDependencies++)},Rkc.prototype._initConstants=function(){this._method.texture&&this._texture._initConstants()},Rkc.prototype._outputsTangentNormals=function(){return!0},Rkc.prototype._activate=function(){this._texture&&this._texture.activate()},Rkc.prototype._setRenderState=function(t){this._texture&&this._texture._setRenderState(t)},Rkc.prototype._getFragmentCode=function(t,e,i){var n="";return this._texture&&(n+=this._texture._getFragmentCode(t,e,i,i.uvVarying)),n+("sub "+t+".xyz, "+t+".xyz, "+i.commons)+".xxx\nnrm "+t+".xyz, "+t+"\n"},Rkc),Qkc,Jkc;function Rkc(t,e){var i=Qkc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Kkc(t){void 0===t&&(t=null);var e=Jkc.call(this)||this;return e._texture=t,e._texture&&e.iAddTexture(e._texture),e}ShaderBase.registerAbstraction(_Shader_NormalBasicMethod,NormalBasicMethod);var NormalHeightMapMethod=(_kc=NormalBasicMethod,__extends(alc,_kc),Object.defineProperty(alc.prototype,"assetType",{get:function(){return alc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(alc.prototype,"worldXYRatio",{get:function(){return this._worldXYRatio},enumerable:!0,configurable:!0}),Object.defineProperty(alc.prototype,"worldXZRatio",{get:function(){return this._worldXZRatio},enumerable:!0,configurable:!0}),alc.prototype.copyFrom=function(t){_kc.prototype.copyFrom.call(this,t),this._worldXYRatio=t._worldXYRatio,this._worldXZRatio=t._worldXZRatio},alc.assetType="[asset NormalHeightMapMethod]",alc),_Shader_NormalHeightMapMethod=(hlc=_Shader_NormalBasicMethod,__extends(ilc,hlc),ilc.prototype._initConstants=function(){hlc.prototype._initConstants.call(this);var t=this._fragmentConstantsIndex,e=this._shader.fragmentConstantData,i=this._method.texture.image;e[t]=1/i.width,e[t+1]=1/i.height,e[t+2]=0,e[t+3]=1,e[t+4]=this._method.worldXYRatio,e[t+5]=this._method.worldXZRatio},Object.defineProperty(ilc.prototype,"tangentSpace",{get:function(){return!1},enumerable:!0,configurable:!0}),ilc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(r,1);var o=e.getFreeFragmentConstant(),s=e.getFreeFragmentConstant();return this._fragmentConstantsIndex=4*o.index,n+=this._texture._getFragmentCode(t,e,i,i.uvVarying)+"add "+r+", "+i.uvVarying+", "+o+".xzzz\n"+this._texture._getFragmentCode(r,e,i,r)+"sub "+t+".x, "+t+".x, "+r+".x\nadd "+r+", "+i.uvVarying+", "+o+".zyzz\n"+this._texture._getFragmentCode(r,e,i,r)+"sub "+t+".z, "+t+".z, "+r+".x\nmov "+t+".y, "+o+".w\nmul "+t+".xz, "+t+".xz, "+s+".xy\nnrm "+t+".xyz, "+t+".xyz\n",e.removeFragmentTempUsage(r),n},ilc),hlc,_kc;function ilc(t,e){return hlc.call(this,t,e)||this}function alc(t,e,i,n){var r=_kc.call(this)||this;return r.texture=t,r._worldXYRatio=e/i,r._worldXZRatio=n/i,r}ShaderBase.registerAbstraction(_Shader_NormalHeightMapMethod,NormalHeightMapMethod);var NormalSimpleWaterMethod=(vlc=NormalBasicMethod,__extends(wlc,vlc),Object.defineProperty(wlc.prototype,"assetType",{get:function(){return wlc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(wlc.prototype,"water1OffsetX",{get:function(){return this._water1OffsetX},set:function(t){this._water1OffsetX=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(wlc.prototype,"water1OffsetY",{get:function(){return this._water1OffsetY},set:function(t){this._water1OffsetY=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(wlc.prototype,"water2OffsetX",{get:function(){return this._water2OffsetX},set:function(t){this._water2OffsetX=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(wlc.prototype,"water2OffsetY",{get:function(){return this._water2OffsetY},set:function(t){this._water2OffsetY=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(wlc.prototype,"secondaryNormalMap",{get:function(){return this._secondaryNormalMap},set:function(t){this._secondaryNormalMap!=t&&(this._secondaryNormalMap&&this.iRemoveTexture(this._secondaryNormalMap),this._secondaryNormalMap=t,this._secondaryNormalMap&&this.iAddTexture(this._secondaryNormalMap),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),wlc.prototype.dispose=function(){vlc.prototype.dispose.call(this),this._secondaryNormalMap=null},wlc.assetType="[asset NormalSimpleWaterMethod]",wlc),_Shader_NormalSimpleWaterMethod=(Flc=_Shader_NormalBasicMethod,__extends(Glc,Flc),Glc.prototype._initConstants=function(){Flc.prototype._initConstants.call(this);var t=this._fragmentConstantsIndex,e=this._shader.fragmentConstantData;e[t]=.5,e[t+1]=0,e[t+2]=0,e[t+3]=1},Glc.prototype._initVO=function(t){Flc.prototype._initVO.call(this,t),this._method.secondaryNormalMap&&(this._secondaryNormalMap=this._shader.getAbstraction(this._method.secondaryNormalMap),this._shader.uvDependencies++)},Glc.prototype.onClear=function(t){Flc.prototype.onClear.call(this,t),this._secondaryNormalMap=null},Glc.prototype._activate=function(){var t,e;Flc.prototype._activate.call(this),this._invalid&&((t=this._shader.fragmentConstantData)[(e=this._fragmentConstantsIndex)+4]=this._method.water1OffsetX,t[e+5]=this._method.water1OffsetY,t[e+6]=this._method.water2OffsetX,t[e+7]=this._method.water2OffsetY),this._secondaryNormalMap&&this._secondaryNormalMap.activate()},Glc.prototype._setRenderState=function(t){Flc.prototype._setRenderState.call(this,t),this._secondaryNormalMap&&this._secondaryNormalMap._setRenderState(t)},Glc.prototype._getFragmentCode=function(t,e,i){var n="",r=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(r,1);var o=e.getFreeFragmentConstant(),s=e.getFreeFragmentConstant();return this._fragmentConstantsIndex=4*o.index,n+="add "+r+", "+i.uvVarying+", "+s+".xyxy\n",this._texture&&(n+=this._texture._getFragmentCode(t,e,i,r)),n+="add "+r+", "+i.uvVarying+", "+s+".zwzw\n",this._secondaryNormalMap&&(n+=this._secondaryNormalMap._getFragmentCode(r,e,i,r)),n+("add "+t+", "+t+", "+r+"\t\t\nmul "+t+", "+t+", "+o+".x\t\nsub "+t+".xyz, "+t+".xyz, "+i.commons)+".xxx\t\nnrm "+t+".xyz, "+t+".xyz\t\t\t\t\t\t\t\n"},Glc),Flc,vlc;function Glc(t,e){return Flc.call(this,t,e)||this}function wlc(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=vlc.call(this,t)||this;return i._water1OffsetX=0,i._water1OffsetY=0,i._water2OffsetX=0,i._water2OffsetY=0,i._secondaryNormalMap=e,i._secondaryNormalMap&&i.iAddTexture(i._secondaryNormalMap),i}ShaderBase.registerAbstraction(_Shader_NormalSimpleWaterMethod,NormalSimpleWaterMethod);var ShadowMethodBase=(Xlc=CompositeMethodBase,__extends(Ylc,Xlc),Object.defineProperty(Ylc.prototype,"castingLight",{get:function(){return this._castingLight},enumerable:!0,configurable:!0}),Ylc),_Shader_ShadowMethodBase=(_lc=_Shader_CompositeMethodBase,__extends(amc,_lc),amc.prototype._initVO=function(t){_lc.prototype._initVO.call(this,t),this._baseTexture=this._baseChunk.texture},amc),ShadowDitheredMethod=(fmc=ShadowMethodBase,__extends(gmc,fmc),Object.defineProperty(gmc.prototype,"assetType",{get:function(){return gmc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(gmc.prototype,"numSamples",{get:function(){return this._numSamples},set:function(t){t<1?t=1:24<t&&(t=24),this._numSamples!=t&&(this._numSamples=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(gmc.prototype,"range",{get:function(){return 2*this._range},set:function(t){this._range=t/2},enumerable:!0,configurable:!0}),gmc.prototype.initGrainTexture=function(){gmc._grainBitmapImage2D=new BitmapImage2D(64,64,!1);for(var t,e,i=new Array,n=1/(this._depthMapSize*this._range),r=0;r<4096;++r)(t=2*(Math.random()-.5))<0?t-=n:t+=n,(e=2*(Math.random()-.5))<0?e-=n:e+=n,1<t?t=1:t<-1&&(t=-1),1<e?e=1:e<-1&&(e=-1),i[r]=Math.floor(255*(.5*t+.5))<<16|Math.floor(255*(.5*e+.5))<<8;gmc._grainBitmapImage2D.setArray(gmc._grainBitmapImage2D.rect,i),gmc._grainTexture=new ImageTexture2D(gmc._grainBitmapImage2D)},gmc.prototype.dispose=function(){0==--gmc._grainUsages&&(gmc._grainTexture.dispose(),gmc._grainBitmapImage2D.dispose(),gmc._grainTexture=null)},gmc.assetType="[asset ShadowDitheredMethod]",gmc),_Shader_ShadowDitheredMethod=(smc=_Shader_ShadowMethodBase,__extends(tmc,smc),tmc.prototype._initVO=function(t){smc.prototype._initVO.call(this,t),t.needsProjection=!0,this._grainMap=this._shader.getAbstraction(ShadowDitheredMethod._grainTexture)},tmc.prototype._initConstants=function(){smc.prototype._initConstants.call(this),this._shader.fragmentConstantData[this._fragmentConstantsIndex]=1/this._method.numSamples},tmc.prototype._activate=function(){smc.prototype._activate.call(this);var t=this._shader.fragmentConstantData,e=this._fragmentConstantsIndex;t[e+1]=(this._shader.renderMaterial.renderGroup.view.width-1)/63,t[e+2]=(this._shader.renderMaterial.renderGroup.view.height-1)/63,t[e+3]=2*this._method.range/this._method.castingLight.shadowMapper.size,this._grainMap.activate()},tmc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant();this._fragmentConstantsIndex=4*n.index;var r="",o=this._method.numSamples,s=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(s,1);var a=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(a,1);var l=i.projectionFragment;r+="div "+s+", "+l+", "+l+".w\nmul "+s+".xy, "+s+".xy, "+n+".yz\n";for(var c=o;0<c;)r+=c==o?this._grainMap._getFragmentCode(s,e,i,s):"mov "+a+", "+s+".zwxy \n"+this._grainMap._getFragmentCode(s,e,i,a),r+="sub "+s+".zw, "+s+".xy, fc0.xx\nmul "+s+".zw, "+s+".zw, "+n+".w\n",r+=c==o?"add "+s+".xy, "+s+".zw, "+this._baseChunk.depthMapCoordReg+".xy\n"+this._baseTexture._getFragmentCode(t,e,i,s):this._addSample(s,t,e,i),4<c&&(r+="add "+s+".xy, "+s+".xy, "+s+".zw\n"+this._addSample(s,t,e,i)),1<c&&(r+="sub "+s+".xy, "+this._baseChunk.depthMapCoordReg+".xy, "+s+".zw\n"+this._addSample(s,t,e,i)),5<c&&(r+="sub "+s+".xy, "+s+".xy, "+s+".zw\n"+this._addSample(s,t,e,i)),2<c&&(r+="neg "+s+".w, "+s+".w\nadd "+s+".xy, "+s+".wz, "+this._baseChunk.depthMapCoordReg+".xy\n"+this._addSample(s,t,e,i)),6<c&&(r+="add "+s+".xy, "+s+".xy, "+s+".wz\n"+this._addSample(s,t,e,i)),3<c&&(r+="sub "+s+".xy, "+this._baseChunk.depthMapCoordReg+".xy, "+s+".wz\n"+this._addSample(s,t,e,i)),7<c&&(r+="sub "+s+".xy, "+s+".xy, "+s+".wz\n"+this._addSample(s,t,e,i)),c-=8;return e.removeFragmentTempUsage(a),e.removeFragmentTempUsage(s),r+("mul "+t+".w, "+t+".w, "+n+".x\n"+smc.prototype._getFragmentCode.call(this,t,e,i))},tmc.prototype._setRenderState=function(t){smc.prototype._setRenderState.call(this,t),this._grainMap._setRenderState(t)},tmc.prototype._addSample=function(t,e,i,n){var r=i.getFreeFragmentVectorTemp();i.addFragmentTempUsages(r,1);var o=this._baseTexture._getFragmentCode(r,i,n,t)+"add "+e+".w, "+e+".w, "+r+".w\n";return i.removeFragmentTempUsage(r),o},tmc),smc,fmc,_lc,Xlc;function tmc(t,e){return smc.call(this,t,e)||this}function gmc(t,e,i){void 0===e&&(e=4),void 0===i&&(i=1);var n=fmc.call(this,t)||this;return n._depthMapSize=n._castingLight.shadowMapper.size,n.numSamples=e,n.range=i,++gmc._grainUsages,gmc._grainTexture||n.initGrainTexture(),n}function amc(t,e){var i=_lc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Ylc(t){var e=Xlc.call(this,t.shadowMapper)||this;return e._castingLight=t,e}ShaderBase.registerAbstraction(_Shader_ShadowDitheredMethod,ShadowDitheredMethod);var ShadowFilteredMethod=(Qmc=ShadowMethodBase,__extends(Rmc,Qmc),Object.defineProperty(Rmc.prototype,"assetType",{get:function(){return Rmc.assetType},enumerable:!0,configurable:!0}),Rmc.assetType="[asset ShadowFilteredMethod]",Rmc),_Shader_ShadowFilteredMethod=(Smc=_Shader_ShadowMethodBase,__extends(Tmc,Smc),Tmc.prototype._initConstants=function(){Smc.prototype._initConstants.call(this);var t=this._shader.fragmentConstantData,e=this._fragmentConstantsIndex;t[e]=.5;var i=this._method.castingLight.shadowMapper.size;t[e+1]=i,t[e+2]=1/i},Tmc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant();this._fragmentConstantsIndex=4*n.index;var r="",o=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(o,1);var s=e.getFreeFragmentVectorTemp();return e.addFragmentTempUsages(s,1),r+="mov "+o+", "+this._baseChunk.depthMapCoordReg+"\n"+this._baseTexture._getFragmentCode(s,e,i,o)+"mov "+o+".w, "+s+".w\nadd "+o+".x, "+this._baseChunk.depthMapCoordReg+".x, "+n+".z\n"+this._baseTexture._getFragmentCode(s,e,i,o)+"mul "+s+".x, "+this._baseChunk.depthMapCoordReg+".x, "+n+".y\nfrc "+s+".x, "+s+".x\nsub "+s+".w, "+s+".w, "+o+".w\nmul "+s+".w, "+s+".w, "+s+".x\nadd "+t+".w, "+o+".w, "+s+".w\nmov "+o+".x, "+this._baseChunk.depthMapCoordReg+".x\nadd "+o+".y, "+this._baseChunk.depthMapCoordReg+".y, "+n+".z\n"+this._baseTexture._getFragmentCode(s,e,i,o)+"mov "+o+".w, "+s+".w\nadd "+o+".x, "+this._baseChunk.depthMapCoordReg+".x, "+n+".z\n"+this._baseTexture._getFragmentCode(s,e,i,o)+"mul "+s+".x, "+this._baseChunk.depthMapCoordReg+".x, "+n+".y\nfrc "+s+".x, "+s+".x\nsub "+s+".w, "+s+".w, "+o+".w\nmul "+s+".w, "+s+".w, "+s+".x\nadd "+o+".w, "+o+".w, "+s+".w\nmul "+s+".x, "+this._baseChunk.depthMapCoordReg+".y, "+n+".y\nfrc "+s+".x, "+s+".x\nsub "+o+".w, "+o+".w, "+t+".w\nmul "+o+".w, "+o+".w, "+s+".x\nadd "+t+".w, "+t+".w, "+o+".w\n",e.removeFragmentTempUsage(s),e.removeFragmentTempUsage(o),Smc.prototype._getFragmentCode.call(this,t,e,i),r},Tmc),Smc,Qmc;function Tmc(t,e){return Smc.call(this,t,e)||this}function Rmc(){return null!==Qmc&&Qmc.apply(this,arguments)||this}ShaderBase.registerAbstraction(_Shader_ShadowFilteredMethod,ShadowFilteredMethod);var ShadowHardMethod=(enc=ShadowMethodBase,__extends(fnc,enc),Object.defineProperty(fnc.prototype,"assetType",{get:function(){return fnc.assetType},enumerable:!0,configurable:!0}),fnc.assetType="[asset ShadowHardMethod]",fnc),_Shader_ShadowHardMethod=(gnc=_Shader_ShadowMethodBase,__extends(hnc,gnc),hnc.prototype._getFragmentCode=function(t,e,i){return this._baseTexture._getFragmentCode(t,e,i,this._baseChunk.depthMapCoordReg)+gnc.prototype._getFragmentCode.call(this,t,e,i)},hnc),gnc,enc;function hnc(t,e){return gnc.call(this,t,e)||this}function fnc(){return null!==enc&&enc.apply(this,arguments)||this}ShaderBase.registerAbstraction(_Shader_ShadowHardMethod,ShadowHardMethod);var ShadowSoftMethod=(onc=ShadowMethodBase,__extends(pnc,onc),Object.defineProperty(pnc.prototype,"assetType",{get:function(){return pnc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(pnc.prototype,"offsets",{get:function(){return this._offsets},enumerable:!0,configurable:!0}),Object.defineProperty(pnc.prototype,"numSamples",{get:function(){return this._numSamples},set:function(t){this._numSamples=t,this._numSamples<1?this._numSamples=1:32<this._numSamples&&(this._numSamples=32),this._offsets=PoissonLookup.getDistribution(this._numSamples),this.invalidateShaderProgram()},enumerable:!0,configurable:!0}),Object.defineProperty(pnc.prototype,"range",{get:function(){return this._range},set:function(t){this._range=t},enumerable:!0,configurable:!0}),pnc.assetType="[asset ShadowSoftMethod]",pnc),_Shader_ShadowSoftMethod=(wnc=_Shader_ShadowMethodBase,__extends(xnc,wnc),xnc.prototype._initConstants=function(){wnc.prototype._initConstants.call(this),this._shader.fragmentConstantData[this._fragmentConstantsIndex]=1/this._method.numSamples,this._shader.fragmentConstantData[this._fragmentConstantsIndex+1]=0},xnc.prototype._activate=function(){wnc.prototype._activate.call(this);for(var t=.5*this._method.range/this._method.castingLight.shadowMapper.size,e=this._shader.fragmentConstantData,i=this._fragmentConstantsIndex+2,n=this._method.numSamples<<1,r=0;r<n;++r)e[i+r]=this._method.offsets[r]*t},xnc.prototype._getFragmentCode=function(t,e,i){var n=e.getFreeFragmentConstant();this._fragmentConstantsIndex=4*n.index;var r="",o=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(o,1);for(var s=new Array(n+".zw"),a=this._method.numSamples>>1,l=0;l<a;++l){var c=e.getFreeFragmentConstant();s.push(c+".xy"),s.push(c+".zw")}for(var h=e.getFreeFragmentVectorTemp(),l=0;l<this._method.numSamples;++l)r+=0==l?"add "+o+", "+this._baseChunk.depthMapCoordReg+", "+n+".zwyy\n"+this._baseTexture._getFragmentCode(t,e,i,o):"add "+o+".xy, "+this._baseChunk.depthMapCoordReg+".xy, "+s[l]+"\n"+this._baseTexture._getFragmentCode(h,e,i,o)+"add "+t+".w, "+t+".w, "+h+".w\n";return e.removeFragmentTempUsage(o),r+("mul "+t+".w, "+t+".w, "+n+".x\n"+wnc.prototype._getFragmentCode.call(this,t,e,i))},xnc),wnc,onc;function xnc(t,e){return wnc.call(this,t,e)||this}function pnc(t,e,i){void 0===e&&(e=5),void 0===i&&(i=1);var n=onc.call(this,t)||this;return n.numSamples=e,n.range=i,n}ShaderBase.registerAbstraction(_Shader_ShadowSoftMethod,ShadowSoftMethod);var SpecularBasicMethod=(Qnc=MethodBase,__extends(Rnc,Qnc),Object.defineProperty(Rnc.prototype,"assetType",{get:function(){return Rnc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Rnc.prototype,"gloss",{get:function(){return this._gloss},set:function(t){this._gloss!=t&&(this._gloss=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Rnc.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength!=t&&(this._strength=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Rnc.prototype,"color",{get:function(){return this._color},set:function(t){this._color!=t&&(this._color=t,0==this._color||0==t?this.invalidateShaderProgram():this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Rnc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.iRemoveTexture(this._texture),this._texture=t,this._texture&&this.iAddTexture(this._texture),this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Rnc.prototype.dispose=function(){this._texture=null},Rnc.prototype.copyFrom=function(t){var e=t;this.texture=e.texture,this.strength=e.strength,this.color=e.color,this.gloss=e.gloss},Rnc.assetType="[asset SpecularBasicMethod]",Rnc),_Shader_SpecularBasicMethod=(Znc=_Shader_MethodBase,__extends($nc,Znc),$nc.prototype._isUsed=function(){return!!this._shader.numLights},$nc.prototype._initVO=function(t){t.needsNormals=0<this._shader.numLights,t.needsView=0<this._shader.numLights,this._method.texture?(this._texture=this._shader.getAbstraction(this._method.texture),this._texture._initVO(t),this._shader.uvDependencies++):this._texture&&(this._texture=null)},$nc.prototype._initConstants=function(){this._method.texture&&this._texture._initConstants()},$nc.prototype._cleanCompilationData=function(){Znc.prototype._cleanCompilationData.call(this),this._totalLightColorReg=null,this._specularTexData=null,this._specularDataRegister=null},$nc.prototype._getFragmentPreLightingCode=function(t,e){var i="";return this._pIsFirstLight=!0,this._specularDataRegister=t.getFreeFragmentConstant(),this._specularDataIndex=4*this._specularDataRegister.index,this._texture&&(this._specularTexData=t.getFreeFragmentVectorTemp(),t.addFragmentTempUsages(this._specularTexData,1),i+=this._texture._getFragmentCode(this._specularTexData,t,e,e.uvVarying)),this._totalLightColorReg=t.getFreeFragmentVectorTemp(),t.addFragmentTempUsages(this._totalLightColorReg,1),i},$nc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="add "+r+", "+t+", "+n.viewDirFragment+"\nnrm "+r+".xyz, "+r+"\ndp3 "+r+".w, "+n.normalFragment+", "+r+"\nsat "+r+".w, "+r+".w\n",this._texture?o+="mul "+this._specularTexData+".w, "+this._specularTexData+".y, "+this._specularDataRegister+".w\npow "+r+".w, "+r+".w, "+this._specularTexData+".w\n":o+="pow "+r+".w, "+r+".w, "+this._specularDataRegister+".w\n",this._shader.usesLightFallOff&&(o+="mul "+r+".w, "+r+".w, "+t+".w\n"),null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),o+="mul "+r+".xyz, "+e+", "+r+".w\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+r+"\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},$nc.prototype._getFragmentCodePerProbe=function(t,e,i,n){var r,o="";this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1));var s=n.normalFragment,a=n.viewDirFragment;return o+="dp3 "+r+".w, "+s+", "+a+"\nadd "+r+".w, "+r+".w, "+r+".w\nmul "+r+", "+r+".w, "+s+"\nsub "+r+", "+r+", "+a+"\ntex "+r+", "+r+", "+t+" <cube,linear,miplinear>\nmul "+r+".xyz, "+r+", "+e+"\n",null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+r+"\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},$nc.prototype._getFragmentCode=function(t,e,i){var n="";return i.shadowTarget&&(n+="mul "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+i.shadowTarget+".w\n"),this._texture&&(n+="mul "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+this._specularTexData+".x\n",e.removeFragmentTempUsage(this._specularTexData)),n+="mul "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+", "+this._specularDataRegister+"\nadd "+t+".xyz, "+t+", "+this._totalLightColorReg+"\n",e.removeFragmentTempUsage(this._totalLightColorReg),n},$nc.prototype._activate=function(){var t,e;this._texture&&this._texture.activate(),this._invalid&&(t=this._specularDataIndex,(e=this._shader.fragmentConstantData)[t]=(this._method.color>>16&255)/255*this._method.strength,e[t+1]=(this._method.color>>8&255)/255*this._method.strength,e[t+2]=(255&this._method.color)/255*this._method.strength,e[t+3]=this._method.gloss)},$nc.prototype._setRenderState=function(t){this._texture&&this._texture._setRenderState(t)},$nc),Znc,Qnc;function $nc(t,e){var i=Znc.call(this,t,e)||this;return i._method=t,i._shader=e,i}function Rnc(){var t=Qnc.call(this)||this;return t._gloss=50,t._strength=1,t._color=16777215,t}ShaderBase.registerAbstraction(_Shader_SpecularBasicMethod,SpecularBasicMethod);var SpecularAnisotropicMethod=(Boc=SpecularBasicMethod,__extends(Coc,Boc),Object.defineProperty(Coc.prototype,"assetType",{get:function(){return Coc.assetType},enumerable:!0,configurable:!0}),Coc.assetType="[asset SpecularAnisotropicMethod]",Coc),_Shader_SpecularAnisotropicMethod=(Doc=_Shader_SpecularBasicMethod,__extends(Eoc,Doc),Eoc.prototype._initVO=function(t){Doc.prototype._initVO.call(this,t),t.needsTangents=0<this._shader.numLights},Eoc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";return this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1)),o+="nrm "+r+".xyz, "+n.tangentVarying+".xyz\ndp3 "+r+".w, "+r+".xyz, "+t+".xyz\ndp3 "+r+".z, "+r+".xyz, "+n.viewDirFragment+".xyz\n",o+="sin "+r+".x, "+r+".w\nsin "+r+".y, "+r+".z\nmul "+r+".x, "+r+".x, "+r+".y\ncos "+r+".z, "+r+".z\ncos "+r+".w, "+r+".w\nmul "+r+".w, "+r+".w, "+r+".z\nsub "+r+".w, "+r+".x, "+r+".w\n",this._texture?o+="mul "+this._specularTexData+".w, "+this._specularTexData+".y, "+this._specularDataRegister+".w\npow "+r+".w, "+r+".w, "+this._specularTexData+".w\n":o+="pow "+r+".w, "+r+".w, "+this._specularDataRegister+".w\n",o+="mul "+r+".w, "+r+".w, "+t+".w\n",null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),o+="mul "+r+".xyz, "+e+".xyz, "+r+".w\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+".xyz, "+r+".xyz\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},Eoc),Doc,Boc;function Eoc(t,e){return Doc.call(this,t,e)||this}function Coc(){return Boc.call(this)||this}ShaderBase.registerAbstraction(_Shader_SpecularAnisotropicMethod,SpecularAnisotropicMethod);var SpecularCompositeMethod=(Ooc=CompositeMethodBase,__extends(Poc,Ooc),Poc.prototype.createBaseMethod=function(){return new SpecularBasicMethod},Object.defineProperty(Poc.prototype,"gloss",{get:function(){return this._baseMethod.gloss},set:function(t){this._baseMethod.gloss=t},enumerable:!0,configurable:!0}),Object.defineProperty(Poc.prototype,"strength",{get:function(){return this._baseMethod.strength},set:function(t){this._baseMethod.strength=t},enumerable:!0,configurable:!0}),Object.defineProperty(Poc.prototype,"color",{get:function(){return this._baseMethod.color},set:function(t){this._baseMethod.color=t},enumerable:!0,configurable:!0}),Object.defineProperty(Poc.prototype,"texture",{get:function(){return this._baseMethod.texture},set:function(t){this._baseMethod.texture=t},enumerable:!0,configurable:!0}),Poc),SpecularCelMethod=(Voc=SpecularCompositeMethod,__extends(Woc,Voc),Object.defineProperty(Woc.prototype,"assetType",{get:function(){return Woc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Woc.prototype,"smoothness",{get:function(){return this._smoothness},set:function(t){this._smoothness!=t&&(this._smoothness=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Woc.prototype,"specularCutOff",{get:function(){return this._specularCutOff},set:function(t){this._specularCutOff!=t&&(this._specularCutOff=t,this.invalidate())},enumerable:!0,configurable:!0}),Woc.assetType="[asset SpecularCelMethod]",Woc),_Shader_SpecularCelMethod=(bpc=_Shader_LightingCompositeMethod,__extends(cpc,bpc),cpc.prototype._activate=function(){var t,e;bpc.prototype._activate.call(this),this._invalid&&(t=this._cutoffDataIndex,(e=this._shader.fragmentConstantData)[t]=this._method.smoothness,e[t+1]=this._method.specularCutOff)},cpc.prototype._cleanCompilationData=function(){bpc.prototype._cleanCompilationData.call(this),this._cutoffDataRegister=null},cpc.prototype.clampSpecular=function(t,e,i){return"sub "+t+".y, "+t+".w, "+this._cutoffDataRegister+".y\ndiv "+t+".y, "+t+".y, "+this._cutoffDataRegister+".x\nsat "+t+".y, "+t+".y\nsge "+t+".w, "+t+".w, "+this._cutoffDataRegister+".y\nmul "+t+".w, "+t+".w, "+t+".y\n"},cpc.prototype._getFragmentPreLightingCode=function(t,e){return this._cutoffDataRegister=t.getFreeFragmentConstant(),this._cutoffDataIndex=4*this._cutoffDataRegister.index,bpc.prototype._getFragmentPreLightingCode.call(this,t,e)},cpc),bpc,Voc,Ooc;function cpc(t,e){var n=bpc.call(this,t,e)||this;return n._method=t,n._shader=e,n._baseChunk._modulateFunction=function(t,e,i){return n.clampSpecular(t,e,i)},n}function Woc(t,e,i){void 0===t&&(t=.5),void 0===e&&(e=.1),void 0===i&&(i=null);var n=Voc.call(this,i)||this;return n._specularCutOff=t,n._smoothness=e,n}function Poc(t){return void 0===t&&(t=null),Ooc.call(this,t)||this}ShaderBase.registerAbstraction(_Shader_SpecularCelMethod,SpecularCelMethod);var SpecularFresnelMethod=(qpc=SpecularCompositeMethod,__extends(rpc,qpc),Object.defineProperty(rpc.prototype,"assetType",{get:function(){return rpc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(rpc.prototype,"basedOnSurface",{get:function(){return this._basedOnSurface},set:function(t){this._basedOnSurface!=t&&(this._basedOnSurface=t,this.invalidateShaderProgram())},enumerable:!0,configurable:!0}),Object.defineProperty(rpc.prototype,"fresnelPower",{get:function(){return this._fresnelPower},set:function(t){this._fresnelPower!=t&&(this._fresnelPower=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(rpc.prototype,"normalReflectance",{get:function(){return this._normalReflectance},set:function(t){this._normalReflectance!=t&&(this._normalReflectance=t,this.invalidate())},enumerable:!0,configurable:!0}),rpc.assetType="[asset SpecularFresnelMethod]",rpc),_Shader_SpecularFresnelMethod=(Apc=_Shader_LightingCompositeMethod,__extends(Bpc,Apc),Bpc.prototype._cleanCompilationData=function(){Apc.prototype._cleanCompilationData.call(this),this._fresnelDataRegister=null},Bpc.prototype._activate=function(){var t,e;Apc.prototype._activate.call(this),this._invalid&&((t=this._shader.fragmentConstantData)[e=this._fresnelDataIndex]=this._method.normalReflectance,t[e+1]=this._method.fresnelPower,t[e+2]=1,t[e+3]=0)},Bpc.prototype._getFragmentPreLightingCode=function(t,e){return this._fresnelDataRegister=t.getFreeFragmentConstant(),this._fresnelDataIndex=4*this._fresnelDataRegister.index,Apc.prototype._getFragmentPreLightingCode.call(this,t,e)},Bpc.prototype.modulateSpecular=function(t,e,i){return"dp3 "+t+".y, "+i.viewDirFragment+".xyz, "+(this._method.basedOnSurface?i.normalFragment:t)+".xyz\nsub "+t+".y, "+this._fresnelDataRegister+".z, "+t+".y\npow "+t+".x, "+t+".y, "+this._fresnelDataRegister+".y\nsub "+t+".y, "+this._fresnelDataRegister+".z, "+t+".y\nmul "+t+".y, "+this._fresnelDataRegister+".x, "+t+".y\nadd "+t+".y, "+t+".x, "+t+".y\nmul "+t+".w, "+t+".w, "+t+".y\n"},Bpc),Apc,qpc;function Bpc(t,e){var n=Apc.call(this,t,e)||this;return n._method=t,n._shader=e,n._baseChunk._modulateFunction=function(t,e,i){return n.modulateSpecular(t,e,i)},n}function rpc(t,e,i,n){void 0===t&&(t=!0),void 0===e&&(e=5),void 0===i&&(i=.028),void 0===n&&(n=null);var r=qpc.call(this,n)||this;return r._basedOnSurface=t,r._fresnelPower=e,r._normalReflectance=i,r}ShaderBase.registerAbstraction(_Shader_SpecularFresnelMethod,SpecularFresnelMethod);var SpecularPhongMethod=(Ppc=SpecularBasicMethod,__extends(Qpc,Ppc),Object.defineProperty(Qpc.prototype,"assetType",{get:function(){return Qpc.assetType},enumerable:!0,configurable:!0}),Qpc.assetType="[asset SpecularPhongMethod]",Qpc),_Shader_SpecularPhongMethod=(Rpc=_Shader_SpecularBasicMethod,__extends(Spc,Rpc),Spc.prototype._getFragmentCodePerLight=function(t,e,i,n){var r,o="";this._pIsFirstLight?r=this._totalLightColorReg:(r=i.getFreeFragmentVectorTemp(),i.addFragmentTempUsages(r,1));var s=n.viewDirFragment,a=n.normalFragment;return o+="dp3 "+r+".w, "+t+", "+a+"\nadd "+r+".w, "+r+".w, "+r+".w\nmul "+r+".xyz, "+a+", "+r+".w\nsub "+r+".xyz, "+r+", "+t+"\nadd "+r+".w, "+r+".w, "+n.commons+".w\nsat "+r+".w, "+r+".w\nmul "+r+".xyz, "+r+", "+r+".w\ndp3 "+r+".w, "+r+", "+s+"\nsat "+r+".w, "+r+".w\n",this._texture?o+="mul "+this._specularTexData+".w, "+this._specularTexData+".y, "+this._specularDataRegister+".w\npow "+r+".w, "+r+".w, "+this._specularTexData+".w\n":o+="pow "+r+".w, "+r+".w, "+this._specularDataRegister+".w\n",this._shader.usesLightFallOff&&(o+="mul "+r+".w, "+r+".w, "+t+".w\n"),null!=this._modulateFunction&&(o+=this._modulateFunction(r,i,n)),o+="mul "+r+".xyz, "+e+".xyz, "+r+".w\n",this._pIsFirstLight||(o+="add "+this._totalLightColorReg+".xyz, "+this._totalLightColorReg+".xyz, "+r+".xyz\n",i.removeFragmentTempUsage(r)),this._pIsFirstLight=!1,o},Spc),Rpc,Ppc;function Spc(t,e){return Rpc.call(this,t,e)||this}function Qpc(){return Ppc.call(this)||this}ShaderBase.registerAbstraction(_Shader_SpecularPhongMethod,SpecularPhongMethod);var LightSources=(bqc.LIGHTS=1,bqc.PROBES=2,bqc.ALL=3,bqc),PassBase=(cqc=EventDispatcher,__extends(dqc,cqc),Object.defineProperty(dqc.prototype,"shader",{get:function(){return this._shader},enumerable:!0,configurable:!0}),Object.defineProperty(dqc.prototype,"preserveAlpha",{get:function(){return this._preserveAlpha},set:function(t){this._preserveAlpha!=t&&(this._preserveAlpha=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(dqc.prototype,"forceSeparateMVP",{get:function(){return this._forceSeparateMVP},set:function(t){this._forceSeparateMVP!=t&&(this._forceSeparateMVP=t,this.invalidate())},enumerable:!0,configurable:!0}),dqc.prototype.invalidate=function(){this._shader.invalidateProgram(),this.dispatchEvent(new PassEvent(PassEvent.INVALIDATE,this))},dqc.prototype.dispose=function(){this._renderMaterial=null,this._renderElements=null,this._stage=null,this._shader&&(this._shader.dispose(),this._shader=null)},dqc.prototype._setRenderState=function(t){this._shader._setRenderState(t)},dqc.prototype._activate=function(){this._shader._activate()},dqc.prototype._deactivate=function(){this._shader._deactivate()},dqc.prototype._includeDependencies=function(t){t.alphaThreshold=this._renderMaterial.material.alphaThreshold,t.useImageRect=this._renderMaterial.material.imageRect,t.usesCurves=this._renderMaterial.material.curves,t.useBothSides=this._renderMaterial.material.bothSides,t.usesUVTransform=this._renderMaterial.material.animateUVs,t.usesColorTransform=this._renderMaterial.material.useColorTransform,this._forceSeparateMVP&&this._shader.globalPosDependencies++},dqc.prototype._initConstantData=function(){},dqc.prototype._getVertexCode=function(t,e){return""},dqc.prototype._getFragmentCode=function(t,e){return""},dqc.prototype._getPostAnimationFragmentCode=function(t,e){return""},dqc.prototype._getNormalVertexCode=function(t,e){return""},dqc.prototype._getNormalFragmentCode=function(t,e){return""},dqc),LightingShader=(vqc=ShaderBase,__extends(wqc,vqc),wqc.prototype._includeDependencies=function(){this.numPointLights=this._lightingPass.numPointLights,this.numDirectionalLights=this._lightingPass.numDirectionalLights,this.numLightProbes=this._lightingPass.numLightProbes;var t=this._lightingPass.numPointLights+this._lightingPass.numDirectionalLights,e=this._lightingPass.numLightProbes,i=this._lightingPass._iUsesDiffuse(this)?this._lightingPass.diffuseLightSources:0,n=this._lightingPass._iUsesSpecular(this)?this._lightingPass.specularLightSources:0,r=i|n;this.usesLightFallOff=this._lightingPass.enableLightFallOff&&this.profile!=ContextGLProfile.BASELINE_CONSTRAINED,this.usesCommonData=this.usesLightFallOff||this.usesCommonData,this.numLights=t+e,this.usesLights=0<t&&0!=(r&LightSources.LIGHTS),this.usesProbes=0<e&&0!=(r&LightSources.PROBES),this.usesLightsForSpecular=0<t&&0!=(n&LightSources.LIGHTS),this.usesProbesForSpecular=0<e&&0!=(n&LightSources.PROBES),this.usesLightsForDiffuse=0<t&&0!=(i&LightSources.LIGHTS),this.usesProbesForDiffuse=0<e&&0!=(i&LightSources.PROBES),this.usesShadows=this._lightingPass._iUsesShadows(this),vqc.prototype._includeDependencies.call(this)},wqc.prototype._setRenderState=function(t){vqc.prototype._setRenderState.call(this,t),this._lightingPass.lightPicker&&this._lightingPass.lightPicker.collectLights(t.sourceEntity),this.usesLights&&this.updateLights(),this.usesProbes&&this.updateProbes()},wqc.prototype._initRegisterIndices=function(){if(vqc.prototype._initRegisterIndices.call(this),this.lightVertexConstantIndex=-1,this.lightFragmentConstantIndex=-1,this.probeWeightsIndex=-1,this._numProbeRegisters=Math.ceil(this.numLightProbes/4),this.usesTangentSpace||!this.usesGlobalPosFragment?(this._pointLightVertexConstants=new Array(this.numPointLights),this._pointLightFragmentConstants=new Array(2*this.numPointLights)):(this._pointLightVertexConstants=null,this._pointLightFragmentConstants=new Array(3*this.numPointLights)),this.usesTangentSpace?(this._dirLightVertexConstants=new Array(this.numDirectionalLights),this._dirLightFragmentConstants=new Array(2*this.numDirectionalLights)):(this._dirLightVertexConstants=null,this._dirLightFragmentConstants=new Array(3*this.numDirectionalLights)),this.usesLights){var t,e;if(this._dirLightVertexConstants)for(e=this._dirLightVertexConstants.length,t=0;t<e;++t)this._dirLightVertexConstants[t]=this._registerCache.getFreeVertexConstant(),-1==this.lightVertexConstantIndex&&(this.lightVertexConstantIndex=4*this._dirLightVertexConstants[t].index);if(this._pointLightVertexConstants)for(e=this._pointLightVertexConstants.length,t=0;t<e;++t)this._pointLightVertexConstants[t]=this._registerCache.getFreeVertexConstant(),-1==this.lightVertexConstantIndex&&(this.lightVertexConstantIndex=4*this._pointLightVertexConstants[t].index);for(e=this._dirLightFragmentConstants.length,t=0;t<e;++t)this._dirLightFragmentConstants[t]=this._registerCache.getFreeFragmentConstant(),-1==this.lightFragmentConstantIndex&&(this.lightFragmentConstantIndex=4*this._dirLightFragmentConstants[t].index);for(e=this._pointLightFragmentConstants.length,t=0;t<e;++t)this._pointLightFragmentConstants[t]=this._registerCache.getFreeFragmentConstant(),-1==this.lightFragmentConstantIndex&&(this.lightFragmentConstantIndex=4*this._pointLightFragmentConstants[t].index)}},wqc.prototype._compileDependencies=function(){vqc.prototype._compileDependencies.call(this),this._vertexCode+=this._lightingPass._getPreLightingVertexCode(this._registerCache,this._sharedRegisters),this._postAnimationFragmentCode+=this._lightingPass._getPreLightingFragmentCode(this._registerCache,this._sharedRegisters),this.usesShadows&&this._compileShadowCode(),this.usesLights&&this._compileLightCode(),this.usesProbes&&this._compileLightProbeCode()},wqc.prototype._compileShadowCode=function(){0<this.normalDependencies?this._sharedRegisters.shadowTarget=this._sharedRegisters.normalFragment:(this._sharedRegisters.shadowTarget=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addFragmentTempUsages(this._sharedRegisters.shadowTarget,1))},wqc.prototype._compileLightCode=function(){for(var t,e=0,i=0,n=this.usesLightsForSpecular,r=this.usesLightsForDiffuse,o=0;o<this.numDirectionalLights;++o)this.usesTangentSpace?(h=this._dirLightVertexConstants[e++],t=this._registerCache.getFreeVarying(),this._vertexCode+="m33 "+t+".xyz, "+h+", "+this._sharedRegisters.animatedTangent+"\nmov "+t+".w, "+h+".w\n",h=this._registerCache.getFreeFragmentVectorTemp(),this._registerCache.addVertexTempUsages(h,1),this._postAnimationFragmentCode+="nrm "+h+".xyz, "+t+"\nmov "+h+".w, "+t+".w\n"):h=this._dirLightFragmentConstants[i++],l=this._dirLightFragmentConstants[i++],c=this._dirLightFragmentConstants[i++],r&&(this._postAnimationFragmentCode+=this._lightingPass._getPerLightDiffuseFragmentCode(h,l,this._registerCache,this._sharedRegisters)),n&&(this._postAnimationFragmentCode+=this._lightingPass._getPerLightSpecularFragmentCode(h,c,this._registerCache,this._sharedRegisters)),this.usesTangentSpace&&this._registerCache.removeVertexTempUsage(h);for(o=i=e=0;o<this.numPointLights;++o){var s,a=this.usesTangentSpace||!this.usesGlobalPosFragment?this._pointLightVertexConstants[e++]:this._pointLightFragmentConstants[i++],l=this._pointLightFragmentConstants[i++],c=this._pointLightFragmentConstants[i++],h=this._registerCache.getFreeFragmentVectorTemp();this._registerCache.addFragmentTempUsages(h,1),this.usesTangentSpace?(t=this._registerCache.getFreeVarying(),s=this._registerCache.getFreeVertexVectorTemp(),this._vertexCode+="sub "+s+", "+a+", "+this._sharedRegisters.animatedPosition+"\nm33 "+t+".xyz, "+s+", "+this._sharedRegisters.animatedTangent+"\nmov "+t+".w, "+this._sharedRegisters.animatedPosition+".w\n"):this.usesGlobalPosFragment?(t=h,this._postAnimationFragmentCode+="sub "+h+", "+a+", "+this._sharedRegisters.globalPositionVarying+"\n"):(t=this._registerCache.getFreeVarying(),this._vertexCode+="sub "+t+", "+a+", "+this._sharedRegisters.globalPositionVertex+"\n"),this.usesLightFallOff?this._postAnimationFragmentCode+="dp3 "+h+".w, "+t+", "+t+"\nsub "+h+".w, "+h+".w, "+l+".w\nmul "+h+".w, "+h+".w, "+c+".w\nsat "+h+".w, "+h+".w\nsub "+h+".w, "+this._sharedRegisters.commons+".w, "+h+".w\nnrm "+h+".xyz, "+t+"\n":this._postAnimationFragmentCode+="nrm "+h+".xyz, "+t+"\nmov "+h+".w, "+t+".w\n",-1==this.lightFragmentConstantIndex&&(this.lightFragmentConstantIndex=4*a.index),r&&(this._postAnimationFragmentCode+=this._lightingPass._getPerLightDiffuseFragmentCode(h,l,this._registerCache,this._sharedRegisters)),n&&(this._postAnimationFragmentCode+=this._lightingPass._getPerLightSpecularFragmentCode(h,c,this._registerCache,this._sharedRegisters)),this._registerCache.removeFragmentTempUsage(h)}},wqc.prototype._compileLightProbeCode=function(){var t,e,i,n=[".x",".y",".z",".w"],r=new Array,o=this.usesProbesForSpecular,s=this.usesProbesForDiffuse;for(s&&(this.lightProbeDiffuseIndices=new Array),o&&(this.lightProbeSpecularIndices=new Array),e=0;e<this._numProbeRegisters;++e)r[e]=this._registerCache.getFreeFragmentConstant(),0==e&&(this.probeWeightsIndex=4*r[e].index);for(e=0;e<this.numLightProbes;++e)t=r[Math.floor(e/4)].toString()+n[e%4],s&&(i=this._registerCache.getFreeTextureReg(),this.lightProbeDiffuseIndices[e]=i.index,this._postAnimationFragmentCode+=this._lightingPass._getPerProbeDiffuseFragmentCode(i,t,this._registerCache,this._sharedRegisters)),o&&(i=this._registerCache.getFreeTextureReg(),this.lightProbeSpecularIndices[e]=i.index,this._postAnimationFragmentCode+=this._lightingPass._getPerProbeSpecularFragmentCode(i,t,this._registerCache,this._sharedRegisters))},wqc.prototype.updateLights=function(){var t,e,i,n,r,o=0,s=0,a=0,l=this.usesShadows?2:1;this.ambientR=this.ambientG=this.ambientB=0,n=this.lightVertexConstantIndex,s=this.lightFragmentConstantIndex;var c=0,h=this._lightingPass.lightPicker.directionalLights;for((r=this._lightingPass.directionalLightsOffset)>(i=this._lightingPass.lightPicker.directionalLights.length)&&(c=1,r-=i);c<l;++c)for(c&&(h=this._lightingPass.lightPicker.castingDirectionalLights),(i=h.length)>this.numDirectionalLights&&(i=this.numDirectionalLights),o=0;o<i;++o){var u,p,d,_=(t=h[r+o]).sceneDirection;this.ambientR+=t._ambientR,this.ambientG+=t._ambientG,this.ambientB+=t._ambientB,this.usesTangentSpace?(u=-_.x,p=-_.y,d=-_.z,this.vertexConstantData[n++]=this._pInverseSceneMatrix[0]*u+this._pInverseSceneMatrix[4]*p+this._pInverseSceneMatrix[8]*d,this.vertexConstantData[n++]=this._pInverseSceneMatrix[1]*u+this._pInverseSceneMatrix[5]*p+this._pInverseSceneMatrix[9]*d,this.vertexConstantData[n++]=this._pInverseSceneMatrix[2]*u+this._pInverseSceneMatrix[6]*p+this._pInverseSceneMatrix[10]*d,this.vertexConstantData[n++]=1):(this.fragmentConstantData[s++]=-_.x,this.fragmentConstantData[s++]=-_.y,this.fragmentConstantData[s++]=-_.z,this.fragmentConstantData[s++]=1),this.fragmentConstantData[s++]=t._diffuseR,this.fragmentConstantData[s++]=t._diffuseG,this.fragmentConstantData[s++]=t._diffuseB,this.fragmentConstantData[s++]=1,this.fragmentConstantData[s++]=t._specularR,this.fragmentConstantData[s++]=t._specularG,this.fragmentConstantData[s++]=t._specularB,this.fragmentConstantData[s++]=1,++a==this.numDirectionalLights&&(o=i,c=l)}if(this.numDirectionalLights>a)for(o=s+12*(this.numDirectionalLights-a);s<o;)this.fragmentConstantData[s++]=0;a=0;var f=this._lightingPass.lightPicker.pointLights;for((r=this._lightingPass.pointLightsOffset)>(i=this._lightingPass.lightPicker.pointLights.length)?(c=1,r-=i):c=0;c<l;++c)for(c&&(f=this._lightingPass.lightPicker.castingPointLights),i=f.length,o=0;o<i;++o){_=(e=f[r+o]).transform.concatenatedMatrix3D.position,this.ambientR+=e._ambientR,this.ambientG+=e._ambientG,this.ambientB+=e._ambientB,this.usesTangentSpace?(u=_.x,p=_.y,d=_.z,this.vertexConstantData[n++]=this._pInverseSceneMatrix[0]*u+this._pInverseSceneMatrix[4]*p+this._pInverseSceneMatrix[8]*d+this._pInverseSceneMatrix[12],this.vertexConstantData[n++]=this._pInverseSceneMatrix[1]*u+this._pInverseSceneMatrix[5]*p+this._pInverseSceneMatrix[9]*d+this._pInverseSceneMatrix[13],this.vertexConstantData[n++]=this._pInverseSceneMatrix[2]*u+this._pInverseSceneMatrix[6]*p+this._pInverseSceneMatrix[10]*d+this._pInverseSceneMatrix[14],this.vertexConstantData[n++]=1):this.usesGlobalPosFragment?(this.fragmentConstantData[s++]=_.x,this.fragmentConstantData[s++]=_.y,this.fragmentConstantData[s++]=_.z,this.fragmentConstantData[s++]=1):(this.vertexConstantData[n++]=_.x,this.vertexConstantData[n++]=_.y,this.vertexConstantData[n++]=_.z,this.vertexConstantData[n++]=1),this.fragmentConstantData[s++]=e._diffuseR,this.fragmentConstantData[s++]=e._diffuseG,this.fragmentConstantData[s++]=e._diffuseB;var m=e.radius;this.fragmentConstantData[s++]=m*m,this.fragmentConstantData[s++]=e._specularR,this.fragmentConstantData[s++]=e._specularG,this.fragmentConstantData[s++]=e._specularB,this.fragmentConstantData[s++]=e.fallOffFactor,++a==this.numPointLights&&(o=i,c=l)}if(this.numPointLights>a)for(o=s+12*(a-this.numPointLights);s<o;++s)this.fragmentConstantData[s]=0},wqc.prototype.updateProbes=function(){var t,e=this._lightingPass.lightPicker.lightProbes,i=this._lightingPass.lightPicker.lightProbeWeights,n=e.length-this._lightingPass.lightProbesOffset,r=this.usesProbesForDiffuse,o=this.usesProbesForSpecular;if(r||o){n>this.numLightProbes&&(n=this.numLightProbes);for(var s=0;s<n;++s)t=e[this._lightingPass.lightProbesOffset+s],r&&this._stage.getAbstraction(t.diffuseMap).activate(this.lightProbeDiffuseIndices[s],t.diffuseSampler),o&&this._stage.getAbstraction(t.specularMap).activate(this.lightProbeSpecularIndices[s],t.diffuseSampler);for(s=0;s<n;++s)this.fragmentConstantData[this.probeWeightsIndex+s]=i[this._lightingPass.lightProbesOffset+s]}},wqc),MethodPassMode=(yrc.EFFECTS=1,yrc.LIGHTING=2,yrc.SUPER_SHADER=3,yrc),MethodPass=(zrc=PassBase,__extends(Arc,zrc),Object.defineProperty(Arc.prototype,"mode",{get:function(){return this._mode},set:function(t){this._mode!=t&&(this._mode=t,this._updateLights())},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"includeCasters",{get:function(){return this._includeCasters},set:function(t){this._includeCasters!=t&&(this._includeCasters=t,this._updateLights())},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"lightPicker",{get:function(){return this._lightPicker},set:function(t){this._lightPicker&&this._lightPicker.removeEventListener(AssetEvent.INVALIDATE,this._onLightsChangeDelegate),this._lightPicker=t,this._lightPicker&&this._lightPicker.addEventListener(AssetEvent.INVALIDATE,this._onLightsChangeDelegate),this._updateLights()},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"enableLightFallOff",{get:function(){return this._renderMaterial.enableLightFallOff},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"diffuseLightSources",{get:function(){return this._renderMaterial.diffuseLightSources},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"specularLightSources",{get:function(){return this._renderMaterial.specularLightSources},enumerable:!0,configurable:!0}),Arc.prototype._updateShader=function(){!(this.numDirectionalLights||this.numPointLights||this.numLightProbes)||this._shader instanceof LightingShader?null==this._shader&&(null!=this._shader&&(this._shader.dispose(),this._shader=null),this._shader=new ShaderBase(this._renderElements,this._renderMaterial,this,this._stage)):(null!=this._shader&&(this._shader.dispose(),this._shader=null),this._shader=new LightingShader(this._renderElements,this._renderMaterial,this,this._stage))},Arc.prototype._initConstantData=function(){for(var t=this._chunks.length,e=0;e<t;++e)this._chunks[e]._initConstants()},Object.defineProperty(Arc.prototype,"colorTransform",{get:function(){return this.colorTransformMethod?this.colorTransformMethod.colorTransform:null},set:function(t){t?(null==this.colorTransformMethod&&(this.colorTransformMethod=new EffectColorTransformMethod),this.colorTransformMethod.colorTransform=t):t||this.colorTransformMethod&&(this.colorTransformMethod=null)},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"colorTransformMethod",{get:function(){return this._colorTransformMethod},set:function(t){this._colorTransformMethod!=t&&(this._colorTransformMethod&&(this._removeDependency(this._colorTransformMethod),this._colorTransformChunk=null),(this._colorTransformMethod=t)&&(this._colorTransformChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Arc.prototype._removeDependency=function(t,e){void 0===e&&(e=!1);var i=this._methods.indexOf(t);-1!=i&&(e||this._numEffectDependencies--,t.removeEventListener(MethodEvent.SHADER_INVALIDATED,this._onMethodInvalidatedDelegate),this._methods.splice(i,1),this._chunks.splice(i,1),this.invalidate())},Arc.prototype._addDependency=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=-1),t.addEventListener(MethodEvent.SHADER_INVALIDATED,this._onMethodInvalidatedDelegate);var n=this._shader.getAbstraction(t);e?(-1!=i?(this._methods.splice(i+this._methods.length-this._numEffectDependencies,0,t),this._chunks.splice(i+this._chunks.length-this._numEffectDependencies,0,n)):(this._methods.push(t),this._chunks.push(n)),this._numEffectDependencies++):(this._methods.splice(this._methods.length-this._numEffectDependencies,0,t),this._chunks.splice(this._chunks.length-this._numEffectDependencies,0,n)),this.invalidate()},Arc.prototype.addEffectMethod=function(t){this._addDependency(t,!0)},Object.defineProperty(Arc.prototype,"numEffectMethods",{get:function(){return this._numEffectDependencies},enumerable:!0,configurable:!0}),Arc.prototype.hasEffectMethod=function(t){return-1!=this._methods.indexOf(t)},Arc.prototype.getEffectMethodAt=function(t){return t<0||t>this._numEffectDependencies-1?null:this._methods[t+this._methods.length-this._numEffectDependencies]},Arc.prototype.addEffectMethodAt=function(t,e){this._addDependency(t,!0,e)},Arc.prototype.removeEffectMethod=function(t){this._removeDependency(t,!0)},Arc.prototype.removeEffectMethodAt=function(t){var e=this.getEffectMethodAt(t);null!=e&&this._removeDependency(e,!0)},Object.defineProperty(Arc.prototype,"normalMethod",{get:function(){return this._normalMethod},set:function(t){this._normalMethod!=t&&(this._normalMethod&&(this._removeDependency(this._normalMethod),this._normalChunk=null),(this._normalMethod=t)&&(this._normalChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"ambientMethod",{get:function(){return this._ambientMethod},set:function(t){this._ambientMethod!=t&&(this._ambientMethod&&(this._removeDependency(this._ambientMethod),this._ambientChunk=null),(this._ambientMethod=t)&&(this._ambientChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"shadowMethod",{get:function(){return this._shadowMethod},set:function(t){this._shadowMethod!=t&&(this._shadowMethod&&(this._removeDependency(this._shadowMethod),this._shadowChunk=null),(this._shadowMethod=t)&&(this._shadowChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"diffuseMethod",{get:function(){return this._diffuseMethod},set:function(t){this._diffuseMethod!=t&&(this._diffuseMethod&&(this._removeDependency(this._diffuseMethod),this._diffuseChunk=null),t&&(this._diffuseChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Object.defineProperty(Arc.prototype,"specularMethod",{get:function(){return this._specularMethod},set:function(t){this._specularMethod!=t&&(this._specularMethod&&(this._removeDependency(this._specularMethod),this._specularChunk=null),t&&(this._specularChunk=this._shader.getAbstraction(t),this._addDependency(t)))},enumerable:!0,configurable:!0}),Arc.prototype.dispose=function(){for(this._lightPicker&&this._lightPicker.removeEventListener(AssetEvent.INVALIDATE,this._onLightsChangeDelegate);this._methods.length;)this._removeDependency(this._methods[0]);zrc.prototype.dispose.call(this),this._chunks=null,this._methods=null},Arc.prototype.onMethodInvalidated=function(t){this.invalidate()},Arc.prototype._activate=function(){var t;zrc.prototype._activate.call(this);for(var e=this._chunks.length,i=0;i<e;++i)(t=this._chunks[i]).chunkVO.useChunk&&t._activate()},Arc.prototype._setRenderState=function(t){var e;zrc.prototype._setRenderState.call(this,t);for(var i=this._chunks.length,n=0;n<i;++n)(e=this._chunks[n]).chunkVO.useChunk&&e._setRenderState(t)},Arc.prototype._deactivate=function(){var t;zrc.prototype._deactivate.call(this);for(var e=this._chunks.length,i=0;i<e;++i)(t=this._chunks[i]).chunkVO.useChunk&&t._deactivate()},Arc.prototype._includeDependencies=function(t){zrc.prototype._includeDependencies.call(this,t),t.usesFragmentAnimation=Boolean(this._mode==MethodPassMode.SUPER_SHADER);for(var e=this._chunks.length,i=0;i<e;++i)this.setupAndCountDependencies(t,this._chunks[i]);var n,r=!0;for(i=0;i<e;++i)((n=this._chunks[i]).chunkVO.useChunk=n._isUsed())&&!n._usesTangentSpace()&&(r=!1);t.outputsNormals=this._normalChunk&&this._normalChunk.chunkVO.useChunk,t.outputsTangentNormals=t.outputsNormals&&this._normalChunk._outputsTangentNormals(),t.usesTangentSpace=t.outputsTangentNormals&&!t.usesProbes&&r,t.usesTangentSpace||(0<t.viewDirDependencies?t.globalPosDependencies++:0<this.numPointLights&&t.usesLights&&(t.globalPosDependencies++,Boolean(this._mode&MethodPassMode.EFFECTS)&&(t.usesGlobalPosFragment=!0)))},Arc.prototype.setupAndCountDependencies=function(t,e){var i=e.chunkVO;e._reset(i),e._initVO(i),i.needsProjection&&t.projectionDependencies++,(i.needsGlobalVertexPos||i.needsGlobalFragmentPos)&&(t.globalPosDependencies++,i.needsGlobalFragmentPos&&(t.usesGlobalPosFragment=!0)),i.needsNormals&&t.normalDependencies++,i.needsTangents&&t.tangentDependencies++,i.needsView&&t.viewDirDependencies++},Arc.prototype._getPreLightingVertexCode=function(t,e){return""},Arc.prototype._getPreLightingFragmentCode=function(t,e){var i="";return this._diffuseChunk&&this._diffuseChunk.chunkVO.useChunk&&(i+=this._diffuseChunk._getFragmentPreLightingCode(t,e)),this._specularChunk&&this._specularChunk.chunkVO.useChunk&&(i+=this._specularChunk._getFragmentPreLightingCode(t,e)),i},Arc.prototype._getPerLightDiffuseFragmentCode=function(t,e,i,n){return this._diffuseChunk._getFragmentCodePerLight(t,e,i,n)},Arc.prototype._getPerLightSpecularFragmentCode=function(t,e,i,n){return this._specularChunk._getFragmentCodePerLight(t,e,i,n)},Arc.prototype._getPerProbeDiffuseFragmentCode=function(t,e,i,n){return this._diffuseChunk._getFragmentCodePerProbe(t,e,i,n)},Arc.prototype._getPerProbeSpecularFragmentCode=function(t,e,i,n){return this._specularChunk._getFragmentCodePerProbe(t,e,i,n)},Arc.prototype._getNormalVertexCode=function(t,e){return this._normalChunk._getVertexCode(t,e)},Arc.prototype._getNormalFragmentCode=function(t,e){var i=this._normalChunk._getFragmentCode(e.normalFragment,t,e);return this._normalChunk.chunkVO.needsView&&t.removeFragmentTempUsage(e.viewDirFragment),(this._normalChunk.chunkVO.needsGlobalFragmentPos||this._normalChunk.chunkVO.needsGlobalVertexPos)&&t.removeVertexTempUsage(e.globalPositionVertex),i},Arc.prototype._getVertexCode=function(t,e){var i,n="";this._ambientChunk&&this._ambientChunk.chunkVO.useChunk&&(n+=this._ambientChunk._getVertexCode(t,e)),this._shadowChunk&&(n+=this._shadowChunk._getVertexCode(t,e)),this._diffuseChunk&&this._diffuseChunk.chunkVO.useChunk&&(n+=this._diffuseChunk._getVertexCode(t,e)),this._specularChunk&&this._specularChunk.chunkVO.useChunk&&(n+=this._specularChunk._getVertexCode(t,e));for(var r=this._chunks.length,o=r-this._numEffectDependencies;o<r;o++)(i=this._chunks[o]).chunkVO.useChunk&&(n+=i._getVertexCode(t,e),(i.chunkVO.needsGlobalVertexPos||i.chunkVO.needsGlobalFragmentPos)&&t.removeVertexTempUsage(e.globalPositionVertex));return this._colorTransformChunk&&this._colorTransformChunk.chunkVO.useChunk&&(n+=this._colorTransformChunk._getVertexCode(t,e)),n},Arc.prototype._getFragmentCode=function(t,e){var i="";return this._ambientChunk&&this._ambientChunk.chunkVO.useChunk&&(i+=this._ambientChunk._getFragmentCode(e.shadedTarget,t,e),this._ambientChunk.chunkVO.needsNormals&&t.removeFragmentTempUsage(e.normalFragment),this._ambientChunk.chunkVO.needsView&&t.removeFragmentTempUsage(e.viewDirFragment)),i},Arc.prototype._getPostAnimationFragmentCode=function(t,e){var i,n,r="";this._shadowChunk&&(r+=this._shadowChunk._getFragmentCode(e.shadowTarget,t,e)),this._diffuseChunk&&this._diffuseChunk.chunkVO.useChunk&&(r+=this._diffuseChunk._getFragmentCode(e.shadedTarget,t,e),this._diffuseChunk.chunkVO.needsNormals&&t.removeFragmentTempUsage(e.normalFragment),this._diffuseChunk.chunkVO.needsView&&t.removeFragmentTempUsage(e.viewDirFragment)),this._specularChunk&&this._specularChunk.chunkVO.useChunk&&(r+=this._specularChunk._getFragmentCode(e.shadedTarget,t,e),this._specularChunk.chunkVO.needsNormals&&t.removeFragmentTempUsage(e.normalFragment),this._specularChunk.chunkVO.needsView&&t.removeFragmentTempUsage(e.viewDirFragment)),this._shadowChunk&&!this._shader.normalDependencies&&t.removeFragmentTempUsage(e.shadowTarget),this.preserveAlpha&&0<this._numEffectDependencies&&(i=t.getFreeFragmentSingleTemp(),t.addFragmentTempUsages(i,1),r+="mov "+i+", "+e.shadedTarget+".w\n");for(var o=this._chunks.length,s=o-this._numEffectDependencies;s<o;s++)(n=this._chunks[s]).chunkVO.useChunk&&(r+=n._getFragmentCode(e.shadedTarget,t,e),n.chunkVO.needsNormals&&t.removeFragmentTempUsage(e.normalFragment),n.chunkVO.needsView&&t.removeFragmentTempUsage(e.viewDirFragment));return this.preserveAlpha&&0<this._numEffectDependencies&&(r+="mov "+e.shadedTarget+".w, "+i+"\n",t.removeFragmentTempUsage(i)),this._colorTransformChunk&&this._colorTransformChunk.chunkVO.useChunk&&(r+=this._colorTransformChunk._getFragmentCode(e.shadedTarget,t,e)),r},Arc.prototype._iUsesShadows=function(t){return Boolean(this._shadowChunk&&(0<this._lightPicker.castingDirectionalLights.length||0<this._lightPicker.castingPointLights.length))},Arc.prototype._iUsesSpecular=function(t){return Boolean(this._specularChunk)},Arc.prototype._iUsesDiffuse=function(t){return Boolean(this._diffuseChunk)},Arc.prototype.onLightsChange=function(t){this._updateLights()},Arc.prototype._updateLights=function(){var t=this.numDirectionalLights,e=this.numPointLights,i=this.numLightProbes;this._lightPicker&&this._mode&MethodPassMode.LIGHTING?(this.numDirectionalLights=this.calculateNumDirectionalLights(this._lightPicker.numDirectionalLights),this.numPointLights=this.calculateNumPointLights(this._lightPicker.numPointLights),this.numLightProbes=this.calculateNumProbes(this._lightPicker.numLightProbes),this._includeCasters&&(this.numDirectionalLights+=this._lightPicker.numCastingDirectionalLights,this.numPointLights+=this._lightPicker.numCastingPointLights)):(this.numDirectionalLights=0,this.numPointLights=0,this.numLightProbes=0),t==this.numDirectionalLights&&e==this.numPointLights&&i==this.numLightProbes||(this._updateShader(),this.invalidate())},Arc.prototype.calculateNumDirectionalLights=function(t){return Math.min(t-this.directionalLightsOffset,this._maxLights)},Arc.prototype.calculateNumPointLights=function(t){var e=this._maxLights-this.numDirectionalLights;return Math.min(t-this.pointLightsOffset,e)},Arc.prototype.calculateNumProbes=function(t){var e=0;return 0!=(this._renderMaterial.specularLightSources&LightSources.PROBES)&&++e,0!=(this._renderMaterial.diffuseLightSources&LightSources.PROBES)&&++e,Math.min(t-this.lightProbesOffset,4/e|0)},Arc),BasicMaterialPass=(ztc=PassBase,__extends(Atc,ztc),Atc.prototype._includeDependencies=function(t){ztc.prototype._includeDependencies.call(this,t),null!=this._shaderTexture&&t.uvDependencies++},Atc.prototype.invalidate=function(){ztc.prototype.invalidate.call(this),this._shaderTexture=this._renderMaterial.material.getTextureAt(0)?this._shader.getAbstraction(this._renderMaterial.material.getTextureAt(0)):null},Atc.prototype.dispose=function(){this._shaderTexture&&(this._shaderTexture.onClear(new AssetEvent(AssetEvent.CLEAR,this._renderMaterial.material.getTextureAt(0))),this._shaderTexture=null),ztc.prototype.dispose.call(this)},Atc.prototype._getFragmentCode=function(t,e){var i,n="";this.preserveAlpha&&(i=t.getFreeFragmentSingleTemp(),t.addFragmentTempUsages(i,1),n+="mov "+i+", "+e.shadedTarget+".w\n");var r,o,s=e.shadedTarget;return null!=this._shaderTexture?(n+=this._shaderTexture._getFragmentCode(s,t,e,e.uvVarying),0<this._shader.alphaThreshold&&(r=t.getFreeFragmentConstant(),this._fragmentConstantsIndex=4*r.index,n+="sub "+s+".w, "+s+".w, "+r+".x\nkil "+s+".w\nadd "+s+".w, "+s+".w, "+r+".x\n")):-1!=this._shader.colorBufferIndex?n+="mov "+s+", "+e.colorVarying+"\n":(o=t.getFreeFragmentConstant(),this._fragmentConstantsIndex=4*o.index,n+="mov "+s+", "+o+"\n"),this.preserveAlpha&&(n+="mul "+e.shadedTarget+".w, "+e.shadedTarget+".w, "+i+"\n",t.removeFragmentTempUsage(i)),n},Atc.prototype._setRenderState=function(t){ztc.prototype._setRenderState.call(this,t),null!=this._shaderTexture&&this._shaderTexture._setRenderState(t)},Atc.prototype._activate=function(){var t,e;ztc.prototype._activate.call(this),null!=this._shaderTexture?(this._shaderTexture.activate(),0<this._shader.alphaThreshold&&(this._shader.fragmentConstantData[this._fragmentConstantsIndex]=this._shader.alphaThreshold)):-1==this._shader.colorBufferIndex&&(t=this._fragmentConstantsIndex,(e=this._shader.fragmentConstantData)[t]=this._diffuseR,e[t+1]=this._diffuseG,e[t+2]=this._diffuseB,e[t+3]=this._diffuseA)},Atc),LightPickerBase=(Ptc=AssetBase,__extends(Qtc,Ptc),Qtc.prototype.dispose=function(){},Object.defineProperty(Qtc.prototype,"assetType",{get:function(){return Qtc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"numDirectionalLights",{get:function(){return this._numDirectionalLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"numPointLights",{get:function(){return this._numPointLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"numCastingDirectionalLights",{get:function(){return this._numCastingDirectionalLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"numCastingPointLights",{get:function(){return this._numCastingPointLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"numLightProbes",{get:function(){return this._numLightProbes},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"pointLights",{get:function(){return this._pointLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"directionalLights",{get:function(){return this._directionalLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"castingPointLights",{get:function(){return this._castingPointLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"castingDirectionalLights",{get:function(){return this._castingDirectionalLights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"lightProbes",{get:function(){return this._lightProbes},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"lightProbeWeights",{get:function(){return this._lightProbeWeights},enumerable:!0,configurable:!0}),Object.defineProperty(Qtc.prototype,"allPickedLights",{get:function(){return this._allPickedLights},enumerable:!0,configurable:!0}),Qtc.prototype.collectLights=function(t){this.updateProbeWeights(t)},Qtc.prototype.updateProbeWeights=function(t){for(var e,i,n,r,o,s=t.scenePosition,a=s.x,l=s.y,c=s.z,h=0,u=0;u<this._numLightProbes;++u)o=1e-5<(o=(i=a-(e=this._lightProbes[u].transform.concatenatedMatrix3D.position).x)*i+(n=l-e.y)*n+(r=c-e.z)*r)?1/o:5e7,h+=this._lightProbeWeights[u]=o;for(h=1/h,u=0;u<this._numLightProbes;++u)this._lightProbeWeights[u]*=h},Qtc.assetType="[asset LightPicker]",Qtc),StaticLightPicker=(duc=LightPickerBase,__extends(euc,duc),Object.defineProperty(euc.prototype,"lights",{get:function(){return this._lights},set:function(t){var e,i=0,n=0,r=0,o=0,s=0;this._lights&&this.clearListeners(),this._lights=t,this._allPickedLights=t,this._pointLights=new Array,this._castingPointLights=new Array,this._directionalLights=new Array,this._castingDirectionalLights=new Array,this._lightProbes=new Array;for(var a=t.length,l=0;l<a;++l)(e=t[l]).addEventListener(LightEvent.CASTS_SHADOW_CHANGE,this._onCastShadowChangeDelegate),e instanceof PointLight?e.shadowsEnabled?this._castingPointLights[r++]=e:this._pointLights[i++]=e:e instanceof DirectionalLight?e.shadowsEnabled?this._castingDirectionalLights[o++]=e:this._directionalLights[n++]=e:e instanceof LightProbe&&(this._lightProbes[s++]=e);this._numDirectionalLights==n&&this._numPointLights==i&&this._numLightProbes==s&&this._numCastingPointLights==r&&this._numCastingDirectionalLights==o||(this._numDirectionalLights=n,this._numCastingDirectionalLights=o,this._numPointLights=i,this._numCastingPointLights=r,this._numLightProbes=s,this._lightProbeWeights=new Array(4*Math.ceil(s/4)),this.dispatchEvent(new AssetEvent(AssetEvent.INVALIDATE,this)))},enumerable:!0,configurable:!0}),euc.prototype.clearListeners=function(){for(var t=this._lights.length,e=0;e<t;++e)this._lights[e].removeEventListener(LightEvent.CASTS_SHADOW_CHANGE,this._onCastShadowChangeDelegate)},euc.prototype.onCastShadowChange=function(t){var e=t.target;e instanceof PointLight?this.updatePointCasting(e):e instanceof DirectionalLight&&this.updateDirectionalCasting(e),this.dispatchEvent(new AssetEvent(AssetEvent.INVALIDATE,this))},euc.prototype.updateDirectionalCasting=function(t){var e=t;t.shadowsEnabled?(--this._numDirectionalLights,++this._numCastingDirectionalLights,this._directionalLights.splice(this._directionalLights.indexOf(e),1),this._castingDirectionalLights.push(t)):(++this._numDirectionalLights,--this._numCastingDirectionalLights,this._castingDirectionalLights.splice(this._castingDirectionalLights.indexOf(e),1),this._directionalLights.push(t))},euc.prototype.updatePointCasting=function(t){var e=t;t.shadowsEnabled?(--this._numPointLights,++this._numCastingPointLights,this._pointLights.splice(this._pointLights.indexOf(e),1),this._castingPointLights.push(t)):(++this._numPointLights,--this._numCastingPointLights,this._castingPointLights.splice(this._castingPointLights.indexOf(e),1),this._pointLights.push(t))},euc),CascadeShadowMapper=(zuc=DirectionalShadowMapper,__extends(Auc,zuc),Object.defineProperty(Auc.prototype,"assetType",{get:function(){return Auc.assetType},enumerable:!0,configurable:!0}),Auc.prototype.dispose=function(){this._image2D.removeEventListener(AssetEvent.CLEAR,this._onClearDelegate),zuc.prototype.dispose.call(this)},Auc.prototype.getSplitRatio=function(t){return this._splitRatios[t]},Auc.prototype.setSplitRatio=function(t,e){if(e<0?e=0:1<e&&(e=1),t>=this._numCascades)throw new Error("index must be smaller than the number of cascades!");this._splitRatios[t]=e},Auc.prototype.getDepthProjections=function(t){return this._depthProjections[t].viewMatrix3D},Auc.prototype.init=function(){this._splitRatios=new Array(this._numCascades),this._nearPlaneDistances=new Array(this._numCascades);for(var t=1,e=this._numCascades-1;0<=e;--e)this._splitRatios[e]=t,t*=.4;for(this._texOffsetsX=Array(-1,1,-1,1),this._texOffsetsY=Array(1,1,-1,-1),this._pScissorRects=new Array(4),this._depthProjections=new Array,e=0;e<this._numCascades;++e)this._depthProjections[e]=new PerspectiveProjection},Auc.prototype.onClear=function(t){this._scissorRectsInvalid=!0},Object.defineProperty(Auc.prototype,"numCascades",{get:function(){return this._numCascades},set:function(t){if(t!=this._numCascades){if(t<1||4<t)throw new Error("numCascades must be an integer between 1 and 4");this._numCascades=t,this._scissorRectsInvalid=!0,this.init(),this.dispatchEvent(new AssetEvent(AssetEvent.INVALIDATE,this))}},enumerable:!0,configurable:!0}),Auc.prototype._renderMap=function(t,e){this._scissorRectsInvalid&&this.updateScissorRects(),e.depthRenderGroup.getRenderer(t).cullPlanes=this._cullPlanes},Auc.prototype.updateScissorRects=function(){var t=.5*this._image2D.width;this._pScissorRects[0]=new Rectangle(0,0,t,t),this._pScissorRects[1]=new Rectangle(t,0,t,t),this._pScissorRects[2]=new Rectangle(0,t,t,t),this._pScissorRects[3]=new Rectangle(t,t,t,t),this._scissorRectsInvalid=!1},Auc.prototype._updateProjection=function(t){var e,i=t.near,n=t.far-i;this._updateProjectionFromFrustumCorners(t,t.viewFrustumCorners,this._matrix),this._matrix.appendScale(.96,.96,1),this._overallDepthProjection.frustumMatrix3D=this._matrix,this._updateCullPlanes(t);for(var r=0;r<this._numCascades;++r)e=this._depthProjections[r].frustumMatrix3D,this._nearPlaneDistances[r]=i+this._splitRatios[r]*n,this._depthProjections[r].transform.matrix3D=this._overallDepthProjection.transform.matrix3D,this.updateProjectionPartition(e,this._splitRatios[r],this._texOffsetsX[r],this._texOffsetsY[r]),this._depthProjections[r].frustumMatrix3D=e},Auc.prototype.updateProjectionPartition=function(t,e,i,n){for(var r,o,s,a,l,c,h=Number.POSITIVE_INFINITY,u=Number.POSITIVE_INFINITY,p=Number.NEGATIVE_INFINITY,d=Number.NEGATIVE_INFINITY,_=Number.NEGATIVE_INFINITY,f=0;f<12;)(r=this._localFrustum[f])<h&&(h=r),p<r&&(p=r),(o=this._localFrustum[f+1])<u&&(u=o),d<o&&(d=o),(s=this._localFrustum[f+2])>_&&(_=s),(a=r+(this._localFrustum[f+12]-r)*e)<h&&(h=a),p<a&&(p=a),(l=o+(this._localFrustum[f+13]-o)*e)<u&&(u=l),d<l&&(d=l),(c=s+(this._localFrustum[f+14]-s)*e)>_&&(_=c),f+=3;var m=p-h,g=d-u,y=1/(_-1);h<0&&(h-=this._snap),u<0&&(u-=this._snap),h=Math.floor(h/this._snap)*this._snap,u=Math.floor(u/this._snap)*this._snap;var b=2*this._snap,p=h+(m=Math.floor(m/b+1)*b),d=u+(g=Math.floor(g/b+1)*b),m=1/m,g=1/g,v=t._rawData;v[0]=2*m,v[5]=2*g,v[10]=y,v[12]=-(p+h)*m,v[13]=-(d+u)*g,v[14]=-1*y,v[15]=1,v[1]=v[2]=v[3]=v[4]=v[6]=v[7]=v[8]=v[9]=v[11]=0,t.appendScale(.96,.96,1),t.appendTranslation(i,n,0),t.appendScale(.5,.5,1)},Object.defineProperty(Auc.prototype,"_iNearPlaneDistances",{get:function(){return this._nearPlaneDistances},enumerable:!0,configurable:!0}),Auc.assetType="[asset CascadeShadowMapper]",Auc),_Shader_CascadeShadowMapper=(ovc=_Shader_DirectionalShadowMapper,__extends(pvc,ovc),pvc.prototype._initVO=function(t){ovc.prototype._initVO.call(this,t),t.needsProjection=!0},pvc.prototype._initConstants=function(){ovc.prototype._initConstants.call(this);var t=this._shader.fragmentConstantData,e=this._shader.vertexConstantData,i=this._fragmentConstantsIndex;t[i]=1,t[i+1]=1/255,t[i+2]=1/65025,t[i+3]=1/16581375,t[i+6]=.5,t[i+7]=-.5,e[i=this._vertexConstantsIndex]=.5,e[i+1]=-.5,e[i+2]=0;var n=this._mapper.numCascades;this._projectionMatrices=new Array(n);for(var r=0;r<n;++r)this._projectionMatrices[r]=new Matrix3D(new Float32Array(this._shader.vertexConstantData.buffer,4*(this._vertexConstantsIndex+4+16*r),16))},pvc.prototype._cleanCompilationData=function(){ovc.prototype._cleanCompilationData.call(this),this._cascadeProjections=null,this._depthMapCoordVaryings=null,this._projectionMatrices=null},pvc.prototype._getVertexCode=function(t,e){var i="",n=t.getFreeVertexConstant();this._vertexConstantsIndex=4*n.index,this._cascadeProjections=new Array(this._mapper.numCascades),this._depthMapCoordVaryings=new Array(this._mapper.numCascades);for(var r=0;r<this._mapper.numCascades;++r)this._depthMapCoordVaryings[r]=t.getFreeVarying(),this._cascadeProjections[r]=t.getFreeVertexConstant(),t.getFreeVertexConstant(),t.getFreeVertexConstant(),t.getFreeVertexConstant();for(var o=t.getFreeVertexVectorTemp(),r=0;r<this._mapper.numCascades;++r)i+="m44 "+o+", "+e.globalPositionVertex+", "+this._cascadeProjections[r]+"\nadd "+this._depthMapCoordVaryings[r]+", "+o+", "+n+".zzwz\n";return i},pvc.prototype._getFragmentCode=function(t,e,i){var n,r=this._mapper.numCascades,o=e.getFreeFragmentConstant(),s=e.getFreeFragmentConstant(),a=e.getFreeFragmentConstant(),l=Array(a+".x",a+".y",a+".z",a+".w");this._fragmentConstantsIndex=4*o.index;var c=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(c,1);var h=e.getFreeFragmentVectorTemp();e.addFragmentTempUsages(h,1),n="mov "+h+", "+this._depthMapCoordVaryings[r-1]+"\n";for(var u=r-2;0<=u;--u){var p=this._depthMapCoordVaryings[u];n+="slt "+c+".z, "+i.projectionFragment+".z, "+l[u]+"\n";var d=e.getFreeFragmentVectorTemp();n+="sub "+d+", "+p+", "+h+"\nmul "+d+", "+d+", "+c+".z\nadd "+h+", "+h+", "+d+"\n"}return e.removeFragmentTempUsage(c),n+="div "+h+", "+h+", "+h+".w\nmul "+h+".xy, "+h+".xy, "+s+".zw\nadd "+h+".xy, "+h+".xy, "+s+".zz\n",e.removeFragmentTempUsage(h),n},pvc.prototype._activate=function(){this._shader.vertexConstantData[this._vertexConstantsIndex+3]=-1/(this._mapper.depth*this._mapper.epsilon);for(var t=this._mapper.numCascades,e=0;e<t;++e)this._projectionMatrices[e].copyFrom(this._mapper.getDepthProjections(e),!0);var i=this._shader.fragmentConstantData,n=this._fragmentConstantsIndex;i[n+5]=1-this._mapper.alpha;var r=this._mapper._iNearPlaneDistances;n+=8;for(var o=0;o<t;++o)i[n+o]=r[o]},pvc.prototype._setRenderState=function(t){},pvc),ovc,zuc,duc,Ptc,ztc,zrc,vqc,cqc;function pvc(){return null!==ovc&&ovc.apply(this,arguments)||this}function Auc(t,e){void 0===t&&(t=null),void 0===e&&(e=3);var i=zuc.call(this,t)||this;if(i._scissorRectsInvalid=!0,i._onClearDelegate=function(t){return i.onClear(t)},t.addEventListener(AssetEvent.CLEAR,i._onClearDelegate),e<1||4<e)throw new Error("numCascades must be an integer between 1 and 4");return i._numCascades=e,i.init(),i}function euc(t){var e=duc.call(this)||this;return e._onCastShadowChangeDelegate=function(t){return e.onCastShadowChange(t)},e.lights=t,e}function Qtc(){var t=Ptc.call(this)||this;return t._numPointLights=0,t._numDirectionalLights=0,t._numCastingPointLights=0,t._numCastingDirectionalLights=0,t._numLightProbes=0,t}function Atc(t,e){var i=ztc.call(this,t,e)||this;return i._diffuseR=1,i._diffuseG=1,i._diffuseB=1,i._diffuseA=1,i._shader=new ShaderBase(e,t,i,i._stage),i.invalidate(),i}function Arc(t,e,i){var n=zrc.call(this,e,i)||this;return n._maxLights=3,n._mode=3,n._includeCasters=!0,n._chunks=new Array,n._methods=new Array,n._numEffectDependencies=0,n.numDirectionalLights=0,n.numPointLights=0,n.numLightProbes=0,n.pointLightsOffset=0,n.directionalLightsOffset=0,n.lightProbesOffset=0,n._mode=t,n._onLightsChangeDelegate=function(t){return n.onLightsChange(t)},n._onMethodInvalidatedDelegate=function(t){return n.onMethodInvalidated(t)},n.lightPicker=e.lightPicker,null==n._shader&&n._updateShader(),n}function yrc(){}function wqc(t,e,i,n){var r=vqc.call(this,t,e,i,n)||this;return r._includeCasters=!0,r._lightingPass=i,r}function dqc(t,e){var i=cqc.call(this)||this;return i._preserveAlpha=!0,i._forceSeparateMVP=!1,i._renderMaterial=t,i._renderElements=e,i._stage=e.stage,i}function bqc(){}ShaderBase.registerAbstraction(_Shader_CascadeShadowMapper,CascadeShadowMapper);var NearDirectionalShadowMapper=(Xvc=DirectionalShadowMapper,__extends(Yvc,Xvc),Object.defineProperty(Yvc.prototype,"assetType",{get:function(){return Yvc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(Yvc.prototype,"coverageRatio",{get:function(){return this._coverageRatio},set:function(t){1<t?t=1:t<0&&(t=0),this._coverageRatio=t},enumerable:!0,configurable:!0}),Object.defineProperty(Yvc.prototype,"fadeRatio",{get:function(){return this._fadeRatio},set:function(t){this._fadeRatio=t},enumerable:!0,configurable:!0}),Yvc.prototype._updateProjection=function(t){for(var e=t.viewFrustumCorners,i=0;i<12;++i){var n=e[i];this._localFrustum[i]=n,this._localFrustum[i+12]=n+(e[i+12]-n)*this._coverageRatio}this._updateProjectionFromFrustumCorners(t,this._localFrustum,this._matrix),this._overallDepthProjection.frustumMatrix3D=this._matrix},Yvc.assetType="[asset NearDirectionalShadowMapper]",Yvc),_Shader_NearDirectionalShadowMapper=(hwc=_Shader_DirectionalShadowMapper,__extends(iwc,hwc),iwc.prototype._initConstants=function(){hwc.prototype._initConstants.call(this);var t=this._shader.fragmentConstantData,e=this._fragmentDistanceIndex;t[e+2]=0,t[e+3]=1},iwc.prototype._initVO=function(t){hwc.prototype._initVO.call(this,t),t.needsProjection=!0},iwc.prototype._getFragmentCode=function(t,e,i){var n=hwc.prototype._getFragmentCode.call(this,t,e,i),r=e.getFreeFragmentConstant(),o=e.getFreeFragmentSingleTemp();return this._fragmentDistanceIndex=4*r.index,n+("abs "+o+", "+i.projectionFragment)+".w\nsub "+o+", "+o+", "+r+".x\nmul "+o+", "+o+", "+r+".y\nsat "+o+", "+o+"\nsub "+o+", "+r+".w,"+o+"\nsub "+t+".w, "+r+".w,"+t+".w\nmul "+t+".w, "+t+".w, "+o+"\nsub "+t+".w, "+r+".w,"+t+".w\n"},iwc.prototype._setRenderState=function(t){var e=this._shader.view.projection.near,i=this._shader.view.projection.far-e,n=(r=this._mapper.coverageRatio)*(1-this._mapper.fadeRatio),r=e+r*i,n=e+n*i,o=this._shader.fragmentConstantData,s=this._fragmentDistanceIndex;o[s]=n,o[s+1]=1/(r-n),hwc.prototype._setRenderState.call(this,t)},iwc),hwc,Xvc;function iwc(){return null!==hwc&&hwc.apply(this,arguments)||this}function Yvc(t,e,i){void 0===t&&(t=null),void 0===e&&(e=.5),void 0===i&&(i=.1);var n=Xvc.call(this,t)||this;return n.coverageRatio=e,n._fadeRatio=i,n}ShaderBase.registerAbstraction(_Shader_NearDirectionalShadowMapper,NearDirectionalShadowMapper);var DepthTexture2D=(zwc=ImageTexture2D,__extends(Awc,zwc),Object.defineProperty(Awc.prototype,"assetType",{get:function(){return Awc.assetType},enumerable:!0,configurable:!0}),Awc.assetType="[texture DepthTexture2D]",Awc),zwc;function Awc(t){return void 0===t&&(t=null),zwc.call(this,t)||this}ShaderBase.registerAbstraction(_Shader_DepthTexture,DepthTexture2D);var VideoTexture=(Cwc=ImageTexture2D,__extends(Dwc,Cwc),Object.defineProperty(Dwc.prototype,"assetType",{get:function(){return Dwc.assetType},enumerable:!0,configurable:!0}),Dwc.assetType="[texture VideoTexture]",Dwc),MaterialBase=(Ewc=AssetBase,__extends(Fwc,Ewc),Object.defineProperty(Fwc.prototype,"alpha",{get:function(){return this._alpha},set:function(t){1<t?t=1:t<0&&(t=0),this._alpha!=t&&(this._alpha=t,null==this._colorTransform&&(this._colorTransform=new ColorTransform),this._colorTransform.alphaMultiplier=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"colorTransform",{get:function(){return this._colorTransform},set:function(t){this._colorTransform=t,this.invalidate()},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"alphaBlending",{get:function(){return this._alphaBlending},set:function(t){this._alphaBlending!=t&&(this._alphaBlending=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"curves",{get:function(){return this._curves},set:function(t){this._curves!=t&&(this._curves=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"imageRect",{get:function(){return this._imageRect},set:function(t){this._imageRect!=t&&(this._imageRect=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"style",{get:function(){return this._style},set:function(t){this._style!=t&&(this._style&&this._style.removeEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this._style=t,this._style&&this._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES,this._onInvalidatePropertiesDelegate),this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"animateUVs",{get:function(){return this._pAnimateUVs},set:function(t){this._pAnimateUVs!=t&&(this._pAnimateUVs=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"useColorTransform",{get:function(){return this._pUseColorTransform},set:function(t){this._pUseColorTransform!=t&&(this._pUseColorTransform=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"bothSides",{get:function(){return this._bothSides},set:function(t){(this._bothSides=t)||(this._bothSides=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"blendMode",{get:function(){return this._pBlendMode},set:function(t){this._pBlendMode!=t&&(this._pBlendMode=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(Fwc.prototype,"alphaThreshold",{get:function(){return this._pAlphaThreshold},set:function(t){t<0?t=0:1<t&&(t=1),this._pAlphaThreshold!=t&&(this._pAlphaThreshold=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Fwc.prototype.getNumTextures=function(){return this._textures.length},Fwc.prototype.getTextureAt=function(t){return this._textures[t]},Fwc.prototype.dispose=function(){this.clear()},Fwc.prototype.invalidatePasses=function(){this.dispatchEvent(new MaterialEvent(MaterialEvent.INVALIDATE_PASSES,this))},Fwc.prototype.invalidateTextures=function(){this.dispatchEvent(new MaterialEvent(MaterialEvent.INVALIDATE_TEXTURES,this))},Fwc.prototype.addTextureAt=function(t,e){var i=this._textures.indexOf(t);i!=e&&(-1!=i&&this._textures.splice(i,1),this._textures.splice(e,0,t),t.addEventListener(AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate),this.onTextureInvalidate())},Fwc.prototype.addTexture=function(t){-1==this._textures.indexOf(t)&&(this._textures.push(t),t.addEventListener(AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate),this.onTextureInvalidate())},Fwc.prototype.removeTexture=function(t){this._textures.splice(this._textures.indexOf(t),1),t.removeEventListener(AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate),this.onTextureInvalidate()},Fwc.prototype.onTextureInvalidate=function(t){this.invalidatePasses(),this.invalidateTextures()},Fwc.prototype._onInvalidateProperties=function(t){this.invalidatePasses(),this.invalidateTextures()},Fwc),_Render_MaterialPassBase=(cxc=_Render_MaterialBase,__extends(dxc,cxc),Object.defineProperty(dxc.prototype,"shader",{get:function(){return this._shader},enumerable:!0,configurable:!0}),Object.defineProperty(dxc.prototype,"numUsedStreams",{get:function(){return this._shader.numUsedStreams},enumerable:!0,configurable:!0}),Object.defineProperty(dxc.prototype,"numUsedTextures",{get:function(){return this._shader.numUsedTextures},enumerable:!0,configurable:!0}),dxc.prototype._includeDependencies=function(t){t.alphaThreshold=this._material.alphaThreshold,t.useImageRect=this._material.imageRect,t.usesCurves=this._material.curves,t.useBothSides=this._material.bothSides,t.usesUVTransform=this._material.animateUVs,t.usesColorTransform=this._material.useColorTransform},dxc.prototype.invalidate=function(){this._shader.invalidateProgram(),this.dispatchEvent(new PassEvent(PassEvent.INVALIDATE,this))},dxc.prototype.dispose=function(){this._shader&&(this._shader.dispose(),this._shader=null)},dxc.prototype._setRenderState=function(t){this._shader._setRenderState(t)},dxc.prototype._activate=function(){this._shader._activate()},dxc.prototype._deactivate=function(){this._shader._deactivate()},dxc.prototype._initConstantData=function(){},dxc.prototype._getVertexCode=function(t,e){return""},dxc.prototype._getFragmentCode=function(t,e){return""},dxc.prototype._getPostAnimationFragmentCode=function(t,e){return""},dxc.prototype._getNormalVertexCode=function(t,e){return""},dxc.prototype._getNormalFragmentCode=function(t,e){return""},dxc),_Render_DepthMaterial=(qxc=_Render_MaterialPassBase,__extends(rxc,qxc),rxc.prototype.invalidate=function(){qxc.prototype.invalidate.call(this),this._shaderTexture=this._material.getTextureAt(0)?this._shader.getAbstraction(this._material.getTextureAt(0)):null},rxc.prototype._includeDependencies=function(t){qxc.prototype._includeDependencies.call(this,t),t.projectionDependencies++,0<t.alphaThreshold&&t.uvDependencies++},rxc.prototype._initConstantData=function(){var t=this._fragmentConstantsIndex,e=this._shader.fragmentConstantData;e[t]=1,e[t+1]=255,e[t+2]=65025,e[t+3]=16581375,e[t+4]=1/255,e[t+5]=1/255,e[t+6]=1/255,e[t+7]=0},rxc.prototype._getFragmentCode=function(t,e){var i="",n=e.shadedTarget,r=t.getFreeFragmentConstant(),o=t.getFreeFragmentConstant();this._fragmentConstantsIndex=4*r.index;var s=t.getFreeFragmentVectorTemp();t.addFragmentTempUsages(s,1);var a,l=t.getFreeFragmentVectorTemp();return t.addFragmentTempUsages(l,1),i+="div "+s+", "+e.projectionFragment+", "+e.projectionFragment+".w\nmul "+s+", "+r+", "+s+".z\nfrc "+s+", "+s+"\nmul "+l+", "+s+".yzww, "+o+"\n",this._shaderTexture&&0<this._shader.alphaThreshold&&(a=t.getFreeFragmentVectorTemp(),i+=this._shaderTexture._getFragmentCode(a,t,e,e.uvVarying),i+="sub "+a+".w, "+a+".w, "+t.getFreeFragmentConstant()+".x\nkil "+a+".w\n"),i+="sub "+n+", "+s+", "+l+"\n",t.removeFragmentTempUsage(s),t.removeFragmentTempUsage(l),i},rxc.prototype._activate=function(){qxc.prototype._activate.call(this),this._shaderTexture&&0<this._shader.alphaThreshold&&(this._shaderTexture.activate(),this._shader.fragmentConstantData[this._fragmentConstantsIndex+8]=this._shader.alphaThreshold)},rxc),_Render_DistanceMaterial=(Hxc=_Render_MaterialPassBase,__extends(Ixc,Hxc),Ixc.prototype.invalidate=function(){Hxc.prototype.invalidate.call(this),this._shaderTexture=this._material.getTextureAt(0)?this._shader.getAbstraction(this._material.getTextureAt(0)):null},Ixc.prototype._initConstantData=function(){var t=this._fragmentConstantsIndex,e=this._shader.fragmentConstantData;e[t+4]=1/255,e[t+5]=1/255,e[t+6]=1/255,e[t+7]=0},Ixc.prototype._includeDependencies=function(t){Hxc.prototype._includeDependencies.call(this,t),t.projectionDependencies++,t.viewDirDependencies++,0<t.alphaThreshold&&t.uvDependencies++,0<t.viewDirDependencies&&t.globalPosDependencies++},Ixc.prototype._getFragmentCode=function(t,e){var i,n=e.shadedTarget,r=t.getFreeFragmentConstant(),o=t.getFreeFragmentConstant();this._fragmentConstantsIndex=4*r.index;var s=t.getFreeFragmentVectorTemp();t.addFragmentTempUsages(s,1);var a,l=t.getFreeFragmentVectorTemp();return t.addFragmentTempUsages(l,1),i="dp3 "+s+".z, "+e.viewDirVarying+".xyz, "+e.viewDirVarying+".xyz\nmul "+s+", "+r+", "+s+".z\nfrc "+s+", "+s+"\nmul "+l+", "+s+".yzww, "+o+"\n",this._shaderTexture&&0<this._shader.alphaThreshold&&(a=t.getFreeFragmentVectorTemp(),i+=this._shaderTexture._getFragmentCode(a,t,e,e.uvVarying),i+="sub "+a+".w, "+a+".w, "+t.getFreeFragmentConstant()+".x\nkil "+a+".w\n"),i+"sub "+n+", "+s+", "+l+"\n"},Ixc.prototype._activate=function(){Hxc.prototype._activate.call(this);var t=1/(2*(t=this._shader.view.projection.far)*t),e=this._fragmentConstantsIndex,i=this._shader.fragmentConstantData;i[e]=+t,i[e+1]=255*t,i[e+2]=65025*t,i[e+3]=16581375*t,this._shaderTexture&&0<this._shader.alphaThreshold&&(this._shaderTexture.activate(),i[e+8]=this._shader.alphaThreshold)},Ixc),BasicMaterial=(_xc=MaterialBase,__extends(ayc,_xc),Object.defineProperty(ayc.prototype,"assetType",{get:function(){return ayc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(ayc.prototype,"preserveAlpha",{get:function(){return this._preserveAlpha},set:function(t){this._preserveAlpha!=t&&(this._preserveAlpha=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(ayc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.removeTexture(this._texture),this._texture=t,this._texture&&this.addTexture(this._texture))},enumerable:!0,configurable:!0}),ayc.assetType="[materials BasicMaterial]",ayc),_Render_BasicMaterial=(gyc=_Render_MaterialBase,__extends(hyc,gyc),hyc.prototype.onClear=function(t){gyc.prototype.onClear.call(this,t),this._basicMaterial=null},hyc.prototype._pUpdateRender=function(){gyc.prototype._pUpdateRender.call(this),this.requiresBlending=this._basicMaterial.blendMode!=BlendMode.NORMAL||this._basicMaterial.alphaBlending||this._basicMaterial.colorTransform&&this._basicMaterial.colorTransform.alphaMultiplier<1,this._pass.preserveAlpha=this._basicMaterial.preserveAlpha,this._pass.shader.setBlendMode(this._basicMaterial.blendMode==BlendMode.NORMAL&&this.requiresBlending?BlendMode.LAYER:this._basicMaterial.blendMode)},hyc),gyc,_xc,Hxc,qxc,cxc,Ewc,Cwc;function hyc(t,e){var i=gyc.call(this,t,e)||this;return i._basicMaterial=t,i._pAddPass(i._pass=new BasicMaterialPass(i,e)),i}function ayc(t,e){void 0===t&&(t=null),void 0===e&&(e=1);var i=_xc.call(this,t,e)||this;return i._preserveAlpha=!1,t instanceof ImageBase&&(i.texture=new ImageTexture2D),i}function Ixc(t,e){var i=Hxc.call(this,t,e)||this;return i._shader=new ShaderBase(e,i,i,i._stage),i._pAddPass(i),i.invalidate(),i}function rxc(t,e){var i=qxc.call(this,t,e)||this;return i._shader=new ShaderBase(e,i,i,i._stage),i._pAddPass(i),i.invalidate(),i}function dxc(){return null!==cxc&&cxc.apply(this,arguments)||this}function Fwc(t,e){void 0===t&&(t=16777215),void 0===e&&(e=1);var i=Ewc.call(this)||this;return i._textures=new Array,i._pUseColorTransform=!1,i._alphaBlending=!1,i._alpha=1,i._pAlphaThreshold=0,i._pAnimateUVs=!1,i._style=new Style,i._iBaseScreenPassIndex=0,i._bothSides=!1,i._pBlendMode=BlendMode.NORMAL,i._imageRect=!1,i._curves=!1,i._onInvalidatePropertiesDelegate=function(t){return i._onInvalidateProperties(t)},i._style.addEventListener(StyleEvent.INVALIDATE_PROPERTIES,i._onInvalidatePropertiesDelegate),t instanceof ImageBase?i._style.image=t:i._style.color=Number(t),i.alpha=e,i._onTextureInvalidateDelegate=function(t){return i.onTextureInvalidate(t)},i}function Dwc(){return Cwc.call(this)||this}RenderGroup.registerDefaultMaterial(_Render_BasicMaterial,BasicMaterial),RenderGroup.registerDepthMaterial(_Render_DepthMaterial,BasicMaterial),RenderGroup.registerDistanceMaterial(_Render_DistanceMaterial,BasicMaterial),MaterialUtils.setDefaultMaterialClass(BasicMaterial);var MethodMaterialMode=(myc.SINGLE_PASS="singlePass",myc.MULTI_PASS="multiPass",myc),MethodMaterial=(nyc=MaterialBase,__extends(oyc,nyc),Object.defineProperty(oyc.prototype,"assetType",{get:function(){return oyc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"lightPicker",{get:function(){return this._pLightPicker},set:function(t){this._pLightPicker!=t&&(this._pLightPicker&&this._pLightPicker.removeEventListener(AssetEvent.INVALIDATE,this._onLightChangeDelegate),this._pLightPicker=t,this._pLightPicker&&this._pLightPicker.addEventListener(AssetEvent.INVALIDATE,this._onLightChangeDelegate),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"enableLightFallOff",{get:function(){return this._enableLightFallOff},set:function(t){this._enableLightFallOff!=t&&(this._enableLightFallOff=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"diffuseLightSources",{get:function(){return this._diffuseLightSources},set:function(t){this._diffuseLightSources!=t&&(this._diffuseLightSources=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"specularLightSources",{get:function(){return this._specularLightSources},set:function(t){this._specularLightSources!=t&&(this._specularLightSources=t,this.invalidatePasses())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"mode",{get:function(){return this._mode},set:function(t){this._mode!=t&&(this._mode=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"depthCompareMode",{get:function(){return this._depthCompareMode},set:function(t){this._depthCompareMode!=t&&(this._depthCompareMode=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"ambientMethod",{get:function(){return this._ambientMethod},set:function(t){this._ambientMethod!=t&&(this._ambientMethod&&this._ambientMethod.iRemoveOwner(this),this._ambientMethod=t,this._ambientMethod&&this._ambientMethod.iAddOwner(this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"shadowMethod",{get:function(){return this._shadowMethod},set:function(t){this._shadowMethod!=t&&(this._shadowMethod&&this._shadowMethod.iRemoveOwner(this),this._shadowMethod=t,this._shadowMethod&&this._shadowMethod.iAddOwner(this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"diffuseMethod",{get:function(){return this._diffuseMethod},set:function(t){this._diffuseMethod!=t&&(this._diffuseMethod&&this._diffuseMethod.iRemoveOwner(this),this._diffuseMethod=t,this._diffuseMethod&&this._diffuseMethod.iAddOwner(this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"specularMethod",{get:function(){return this._specularMethod},set:function(t){this._specularMethod!=t&&(this._specularMethod&&this._specularMethod.iRemoveOwner(this),this._specularMethod=t,this._specularMethod&&this._specularMethod.iAddOwner(this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"normalMethod",{get:function(){return this._normalMethod},set:function(t){this._normalMethod!=t&&(this._normalMethod&&this._normalMethod.iRemoveOwner(this),this._normalMethod=t,this._normalMethod&&this._normalMethod.iAddOwner(this),this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(oyc.prototype,"numEffectMethods",{get:function(){return this._effectMethods.length},enumerable:!0,configurable:!0}),oyc.prototype.addEffectMethod=function(t){t.iAddOwner(this),this._effectMethods.push(t),this.invalidate()},oyc.prototype.getEffectMethodAt=function(t){return this._effectMethods[t]},oyc.prototype.addEffectMethodAt=function(t,e){t.iAddOwner(this),this._effectMethods.splice(e,0,t),this.invalidate()},oyc.prototype.removeEffectMethod=function(t){t.iRemoveOwner(this),this._effectMethods.splice(this._effectMethods.indexOf(t),1),this.invalidate()},oyc.prototype.onLightsChange=function(t){this.invalidate()},oyc.assetType="[materials MethodMaterial]",oyc),_Render_MethodMaterial=(Kyc=_Render_MaterialBase,__extends(Lyc,Kyc),Object.defineProperty(Lyc.prototype,"numLights",{get:function(){return this._methodMaterial.lightPicker?this._methodMaterial.lightPicker.numLightProbes+this._methodMaterial.lightPicker.numDirectionalLights+this._methodMaterial.lightPicker.numPointLights+this._methodMaterial.lightPicker.numCastingDirectionalLights+this._methodMaterial.lightPicker.numCastingPointLights:0},enumerable:!0,configurable:!0}),Object.defineProperty(Lyc.prototype,"numNonCasters",{get:function(){return this._methodMaterial.lightPicker?this._methodMaterial.lightPicker.numLightProbes+this._methodMaterial.lightPicker.numDirectionalLights+this._methodMaterial.lightPicker.numPointLights:0},enumerable:!0,configurable:!0}),Object.defineProperty(Lyc.prototype,"lightPicker",{get:function(){return this._methodMaterial.lightPicker},enumerable:!0,configurable:!0}),Object.defineProperty(Lyc.prototype,"enableLightFallOff",{get:function(){return this._methodMaterial.enableLightFallOff},enumerable:!0,configurable:!0}),Object.defineProperty(Lyc.prototype,"diffuseLightSources",{get:function(){return this._methodMaterial.diffuseLightSources},enumerable:!0,configurable:!0}),Object.defineProperty(Lyc.prototype,"specularLightSources",{get:function(){return this._methodMaterial.specularLightSources},enumerable:!0,configurable:!0}),Lyc.prototype._pUpdateRender=function(){if(Kyc.prototype._pUpdateRender.call(this),this.initPasses(),this.setBlendAndCompareModes(),this._pClearPasses(),this._methodMaterial.mode==MethodMaterialMode.MULTI_PASS&&(this._casterLightPass&&this._pAddPass(this._casterLightPass),this._nonCasterLightPasses))for(var t=0;t<this._nonCasterLightPasses.length;++t)this._pAddPass(this._nonCasterLightPasses[t]);this._pass&&this._pAddPass(this._pass)},Lyc.prototype.initPasses=function(){0==this.numLights||0<this._methodMaterial.numEffectMethods||this._methodMaterial.mode==MethodMaterialMode.SINGLE_PASS?this.initEffectPass():this._pass&&this.removeEffectPass(),this._methodMaterial.shadowMethod&&this._methodMaterial.mode==MethodMaterialMode.MULTI_PASS?this.initCasterLightPass():this._casterLightPass&&this.removeCasterLightPass(),0<this.numNonCasters&&this._methodMaterial.mode==MethodMaterialMode.MULTI_PASS?this.initNonCasterLightPasses():this._nonCasterLightPasses&&this.removeNonCasterLightPasses()},Lyc.prototype.setBlendAndCompareModes=function(){var t=Boolean(this._casterLightPass||this._pass);if(this._casterLightPass&&(this._casterLightPass.forceSeparateMVP=t,this._casterLightPass.shader.setBlendMode(BlendMode.NORMAL),this._casterLightPass.shader.depthCompareMode=this._methodMaterial.depthCompareMode),this._nonCasterLightPasses){var e=0;this._casterLightPass||(this._nonCasterLightPasses[0].forceSeparateMVP=t,this._nonCasterLightPasses[0].shader.setBlendMode(BlendMode.NORMAL),this._nonCasterLightPasses[0].shader.depthCompareMode=this._methodMaterial.depthCompareMode,e=1);for(var i=e;i<this._nonCasterLightPasses.length;++i)this._nonCasterLightPasses[i].forceSeparateMVP=t,this._nonCasterLightPasses[i].shader.setBlendMode(BlendMode.ADD),this._nonCasterLightPasses[i].shader.depthCompareMode=ContextGLCompareMode.LESS_EQUAL}this._casterLightPass||this._nonCasterLightPasses?(this.requiresBlending=!1,this._pass&&(this._pass.mode=MethodPassMode.EFFECTS,this._pass.forceSeparateMVP=t,this._pass.shader.depthCompareMode=ContextGLCompareMode.LESS_EQUAL,this._pass.shader.setBlendMode(BlendMode.LAYER))):this._pass&&(this.requiresBlending=this._methodMaterial.blendMode!=BlendMode.NORMAL||this._methodMaterial.alphaBlending||this._methodMaterial.colorTransform&&this._methodMaterial.colorTransform.alphaMultiplier<1,this._pass.mode=MethodPassMode.SUPER_SHADER,this._pass.preserveAlpha=this.requiresBlending,this._pass.forceSeparateMVP=!1,this._pass.colorTransform=this._methodMaterial.colorTransform,this._pass.shader.setBlendMode(this._methodMaterial.blendMode==BlendMode.NORMAL&&this.requiresBlending?BlendMode.LAYER:this._methodMaterial.blendMode),this._pass.shader.depthCompareMode=this._methodMaterial.depthCompareMode)},Lyc.prototype.initCasterLightPass=function(){null==this._casterLightPass&&(this._casterLightPass=new MethodPass(MethodPassMode.LIGHTING,this,this._renderElements)),this._casterLightPass.lightPicker=new StaticLightPicker([this._methodMaterial.shadowMethod.castingLight]),this._casterLightPass.shadowMethod=this._methodMaterial.shadowMethod,this._casterLightPass.diffuseMethod=this._methodMaterial.diffuseMethod,this._casterLightPass.ambientMethod=this._methodMaterial.ambientMethod,this._casterLightPass.normalMethod=this._methodMaterial.normalMethod,this._casterLightPass.specularMethod=this._methodMaterial.specularMethod},Lyc.prototype.removeCasterLightPass=function(){this._casterLightPass.dispose(),this._pRemovePass(this._casterLightPass),this._casterLightPass=null},Lyc.prototype.initNonCasterLightPasses=function(){var t;this.removeNonCasterLightPasses();var e=this._methodMaterial.lightPicker.numDirectionalLights,i=this._methodMaterial.lightPicker.numPointLights,n=this._methodMaterial.lightPicker.numLightProbes,r=0,o=0,s=0;for(this._casterLightPass||(e+=this._methodMaterial.lightPicker.numCastingDirectionalLights,i+=this._methodMaterial.lightPicker.numCastingPointLights),this._nonCasterLightPasses=new Array;r<e||o<i||s<n;)(t=new MethodPass(MethodPassMode.LIGHTING,this,this._renderElements)).includeCasters=null==this._methodMaterial.shadowMethod,t.directionalLightsOffset=r,t.pointLightsOffset=o,t.lightProbesOffset=s,t.lightPicker=this._methodMaterial.lightPicker,t.diffuseMethod=this._methodMaterial.diffuseMethod,t.ambientMethod=this._methodMaterial.ambientMethod,t.normalMethod=this._methodMaterial.normalMethod,t.specularMethod=this._methodMaterial.specularMethod,this._nonCasterLightPasses.push(t),r+=t.numDirectionalLights,o+=t.numPointLights,s+=t.numLightProbes},Lyc.prototype.removeNonCasterLightPasses=function(){if(this._nonCasterLightPasses){for(var t=0;t<this._nonCasterLightPasses.length;++t)this._pRemovePass(this._nonCasterLightPasses[t]);this._nonCasterLightPasses=null}},Lyc.prototype.removeEffectPass=function(){this._pass.ambientMethod!=this._methodMaterial.ambientMethod&&this._pass.ambientMethod.dispose(),this._pass.diffuseMethod!=this._methodMaterial.diffuseMethod&&this._pass.diffuseMethod.dispose(),this._pass.specularMethod!=this._methodMaterial.specularMethod&&this._pass.specularMethod.dispose(),this._pass.normalMethod!=this._methodMaterial.normalMethod&&this._pass.normalMethod.dispose(),this._pRemovePass(this._pass),this._pass=null},Lyc.prototype.initEffectPass=function(){null==this._pass&&(this._pass=new MethodPass(MethodPassMode.SUPER_SHADER,this,this._renderElements)),this._methodMaterial.mode==MethodMaterialMode.SINGLE_PASS?(this._pass.ambientMethod=this._methodMaterial.ambientMethod,this._pass.diffuseMethod=this._methodMaterial.diffuseMethod,this._pass.specularMethod=this._methodMaterial.specularMethod,this._pass.normalMethod=this._methodMaterial.normalMethod,this._pass.shadowMethod=this._methodMaterial.shadowMethod):this._methodMaterial.mode==MethodMaterialMode.MULTI_PASS&&(0==this.numLights?this._pass.ambientMethod=this._methodMaterial.ambientMethod:this._pass.ambientMethod=null,this._pass.preserveAlpha=!1,this._pass.normalMethod=this._methodMaterial.normalMethod);for(var t,e=0,i=Math.max(this._methodMaterial.numEffectMethods,this._pass.numEffectMethods);e<i;)(t=this._methodMaterial.getEffectMethodAt(e))!=this._pass.getEffectMethodAt(e)&&(this._pass.removeEffectMethodAt(e),null!=t&&(e<this._pass.numEffectMethods?this._pass.addEffectMethodAt(t,e):this._pass.addEffectMethod(t))),e++},Lyc.prototype.onClear=function(t){Kyc.prototype.onClear.call(this,t)},Lyc),Kyc,nyc;function Lyc(t,e){var i=Kyc.call(this,t,e)||this;return i._methodMaterial=t,i._renderElements=e,i}function oyc(t,e){void 0===t&&(t=16777215),void 0===e&&(e=1);var i=nyc.call(this,t,e)||this;return i._effectMethods=new Array,i._enableLightFallOff=!0,i._specularLightSources=1,i._diffuseLightSources=3,i._ambientMethod=new AmbientBasicMethod,i._diffuseMethod=new DiffuseBasicMethod,i._normalMethod=new NormalBasicMethod,i._specularMethod=new SpecularBasicMethod,i._depthCompareMode=ContextGLCompareMode.LESS_EQUAL,i._mode=MethodMaterialMode.SINGLE_PASS,i._ambientMethod.iAddOwner(i),i._diffuseMethod.iAddOwner(i),i._normalMethod.iAddOwner(i),i._specularMethod.iAddOwner(i),i._onLightChangeDelegate=function(t){return i.onLightsChange(t)},t instanceof ImageBase&&(i._ambientMethod.texture=new ImageTexture2D),i}function myc(){}RenderGroup.registerDefaultMaterial(_Render_MethodMaterial,MethodMaterial),RenderGroup.registerDepthMaterial(_Render_DepthMaterial,MethodMaterial),RenderGroup.registerDistanceMaterial(_Render_DistanceMaterial,MethodMaterial),console.debug("AwayJS - Materials - 0.6.2");var TesselatedFontChar=(dzc.prototype.dispose=function(){this.stroke_data&&(this.stroke_data=null),this.fill_data&&(this.fill_data=null),this.fill_data_path&&(this.fill_data_path=null)},dzc),BitmapFontChar=function(t,e,i,n,r,o,s,a,l,c){this.id=t,this.x=e,this.y=i,this.width=n,this.height=r,this.x_offset=o,this.y_offset=s,this.x_advance=a,this.page=l,this.channel=c},BitmapFontTable=(rzc=AssetBase,__extends(szc,rzc),szc.prototype.getGlyphCount=function(){return this._font_chars.length},Object.defineProperty(szc.prototype,"assetType",{get:function(){return szc.assetType},enumerable:!0,configurable:!0}),szc.prototype.initFontSize=function(t){this.fallbackTable&&this.fallbackTable.initFontSize(t),this._adjust_size&&(t*=this._adjust_size),this._current_size!=t&&(this._current_size=t,this._size_multiply=t/this._init_size)},szc.prototype.getCharDataCanvas=function(t){var e=this._font_chars_dic[t];return e?[e.x,e.y,e.width,e.height,e.x_offset*this._size_multiply,e.y_offset*this._size_multiply]:[]},szc.prototype.getCharData=function(t){var e=this._font_chars_dic[t];if(e){var i=e.height/this._init_size*this._current_size,n=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,n]}return[]},szc.prototype.getCharVertCnt=function(t){return 24},Object.defineProperty(szc.prototype,"texture_width",{get:function(){return this._texture_width},set:function(t){this._texture_width=t},enumerable:!0,configurable:!0}),Object.defineProperty(szc.prototype,"texture_height",{get:function(){return this._texture_height},set:function(t){this._texture_height=t},enumerable:!0,configurable:!0}),szc.prototype.hasChar=function(t){return null!=this._font_chars_dic[t]},szc.prototype.getCharWidth=function(t){var e=this._font_chars_dic[t];return e?this._size_multiply*e.x_advance:0},szc.prototype.fillTextRun=function(t,e,i,n){},szc.prototype.getLineHeight=function(){return this._current_size},szc.prototype.dispose=function(){for(var t=this._materials.length,e=0;e<t;++e)this._materials[e].dispose();this._materials.length=0,this._font_chars.length=0,this._font_chars_dic=null},szc.prototype.addMaterial=function(t){this._materials.push(t)},szc.prototype.getMaterial=function(t){return void 0===t&&(t=0),this._materials[t]},Object.defineProperty(szc.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:!0,configurable:!0}),Object.defineProperty(szc.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:!0,configurable:!0}),Object.defineProperty(szc.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:!0,configurable:!0}),Object.defineProperty(szc.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:!0,configurable:!0}),szc.prototype.get_font_chars=function(){return this._font_chars},szc.prototype.get_font_em_size=function(){return this._font_em_size},szc.prototype.set_whitespace_width=function(t){this._whitespace_width=t},szc.prototype.get_whitespace_width=function(){return this._whitespace_width},szc.prototype.set_font_em_size=function(t){this._font_em_size=t},szc.prototype.getChar=function(t){return this._font_chars_dic[t]},szc.prototype.setChar=function(t,e,i,n,r,o,s,a,l,c){var h=new BitmapFontChar(t,e,i,n,r,o,s,a,l,c);this._font_chars.push(h),this._font_chars_dic[t]=h},szc.assetType="[asset BitmapFontTable]",szc),Font=(fAc=AssetBase,__extends(gAc,fAc),gAc.registerFont=function(t){},Object.defineProperty(gAc.prototype,"font_styles",{get:function(){return this._font_styles},enumerable:!0,configurable:!0}),Object.defineProperty(gAc.prototype,"assetType",{get:function(){return gAc.assetType},enumerable:!0,configurable:!0}),gAc.prototype.dispose=function(){for(var t=this._font_styles.length,e=0;e<t;++e)this._font_styles[e].dispose();this._font_styles.length=0},gAc.prototype.replace_font_table=function(t,e){for(var i=this._font_styles.length,n=0;n<i;++n)this._font_styles[n].name==t&&(this._font_styles[n]=e)},gAc.prototype.get_font_table=function(t,e,i,n){void 0===e&&(e=TesselatedFontTable.assetType),void 0===i&&(i=null),void 0===n&&(n=!0);for(var r=this._font_styles.length,o=0;o<r;++o)if(this._font_styles[o].assetType==e&&this._font_styles[o].name==t)return this._font_styles[o];if(!n)return null;var s=null;return e==TesselatedFontTable.assetType?s=new TesselatedFontTable(i):e==BitmapFontTable.assetType&&(s=new BitmapFontTable),s.name=t,(s.font=this)._font_styles.push(s),s},gAc.assetType="[asset Font]",gAc),DefaultFontManager=(wAc.getDefaultFont=function(){return null==wAc._default_font&&wAc.setDefaultFont(),wAc._default_font},wAc.applySharedFonts=function(t){if(t!=wAc.shared_fonts_ns){wAc._registered_fonts[t]||(wAc._registered_fonts[t]={}),wAc._registered_fonts[wAc.shared_fonts_ns]||(wAc._registered_fonts[wAc.shared_fonts_ns]={}),wAc._default_font||wAc._registered_fonts[wAc.shared_fonts_ns].arial&&(wAc._default_font=wAc._registered_fonts[wAc.shared_fonts_ns].arial);var e=wAc._registered_fonts[wAc.shared_fonts_ns];for(var i in e){if(wAc._registered_fonts[t][i])for(var n=wAc._registered_fonts[wAc.shared_fonts_ns][i].font_styles.length,r=0;r<n;r++){var o=wAc._registered_fonts[wAc.shared_fonts_ns][i].font_styles[r],s=wAc._registered_fonts[t][i].get_font_table(o.name,TesselatedFontTable.assetType,null,!1);s?0==s.getGlyphCount()&&wAc._registered_fonts[t][i].replace_font_table(o.name,o):wAc._registered_fonts[t][i].font_styles.push(o)}else wAc._registered_fonts[t][i]=e[i];wAc._registered_fonts[t][i].font&&(wAc._registered_fonts[t][i]=e[i])}}},wAc.getFont=function(t,e){if(!t)return wAc.getDefaultFont();var i=(t=t.toString().toLowerCase()).split(" ");t="";for(var n=0;n<i.length;n++)"bold"!=i[n]&&"italic"!=i[n]&&"regular"!=i[n]&&(t+=i[n]+(n==i.length-1?"":" "));if(wAc._registered_fonts||(wAc._registered_fonts={}),wAc._registered_fonts[t])return wAc._registered_fonts[t];var r=new Font;return r.name=t,wAc._default_font||(wAc._default_font=r),wAc._registered_fonts[t]=r},wAc.setDefaultFont=function(t){void 0===t&&(t=null),t=t||new Font,wAc._default_font=t},wAc.clearAll=function(){wAc._default_font=null,wAc._registered_fonts={},wAc.shared_fonts_ns=null},wAc._registered_fonts={},wAc.deviceFont=null,wAc),ONCE_EMIT_TABLE=Object.create(null),fAc,rzc;function wAc(){}function gAc(){var t=fAc.call(this)||this;return t._font_styles=[],t.fontName=null,t.regularFontStyle=null,t}function szc(){var t=rzc.call(this)||this;return 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,t}function dzc(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),this.fnt_channel=0,this.kerningCharCodes=[],this.kerningValues=[],this.fill_data=t,this.stroke_data=e,this.fill_data_path=i}function once(t,e){void 0===e&&(e="");var i=ONCE_EMIT_TABLE[t._id+e];return ONCE_EMIT_TABLE[t._id+e]=!0,!i}var TesselatedFontTable=(NAc=AssetBase,__extends(OAc,NAc),Object.defineProperty(OAc.prototype,"fallbackTable",{get:function(){return DefaultFontManager.deviceFont&&DefaultFontManager.deviceFont.font_styles[0]!=this?DefaultFontManager.deviceFont.font_styles[0]:null},enumerable:!0,configurable:!0}),OAc.prototype.addFNTChannel=function(t){this._fnt_channels.push(t)},OAc.prototype.getGlyphCount=function(){return this._font_chars.length},OAc.prototype._drawDebugRect=function(t,e,i,n,r){t[t.length]=e,t[t.length]=n,t[t.length]=e+1,t[t.length]=r,t[t.length]=e,t[t.length]=r,t[t.length]=e,t[t.length]=n,t[t.length]=e+1,t[t.length]=n,t[t.length]=e+1,t[t.length]=r,t[t.length]=i,t[t.length]=n,t[t.length]=i-1,t[t.length]=r,t[t.length]=i,t[t.length]=r,t[t.length]=i,t[t.length]=n,t[t.length]=i-1,t[t.length]=n,t[t.length]=i-1,t[t.length]=r,t[t.length]=e+1,t[t.length]=n,t[t.length]=e+1,t[t.length]=n+1,t[t.length]=i-1,t[t.length]=n,t[t.length]=e+1,t[t.length]=n+1,t[t.length]=i-1,t[t.length]=n+1,t[t.length]=i-1,t[t.length]=n,t[t.length]=e+1,t[t.length]=r,t[t.length]=e+1,t[t.length]=r-1,t[t.length]=i-1,t[t.length]=r,t[t.length]=e+1,t[t.length]=r-1,t[t.length]=i-1,t[t.length]=r-1,t[t.length]=i-1,t[t.length]=r},OAc.prototype.generateFNTTextures=function(t,e,i){if(console.log("generateFNTTextures"),e&&(this._fntSizeLimit=.5*e,this.initFontSize(e)),this._opentype_font)for(var n=0;n<this._opentype_font.glyphs.length;n++){var r=this._opentype_font.charToGlyph(String.fromCharCode(this._opentype_font.glyphs.glyphs[n].unicode));if(r){for(var o=r.getPath(),s=new GraphicsPath,a=0,l=o.commands.length,c=0,h=0,u=this._ascent,a=0;a<l;a++){var p=o.commands[a];"M"===p.type?(s.moveTo(p.x,p.y+u),c=p.x,h=p.y+u):"L"===p.type?s.lineTo(p.x,p.y+u):"Q"===p.type?s.curveTo(p.x1,p.y1+u,p.x,p.y+u):"C"===p.type?s.cubicCurveTo(p.x1,p.y1+u,p.x2,p.y2+u,p.x,p.y+u):"Z"===p.type&&s.lineTo(c,h)}var d=new TesselatedFontChar(null,null,s);d.char_width=r.advanceWidth*(1/r.path.unitsPerEm*72),d.fill_data=GraphicsFactoryFills.pathToAttributesBuffer(s,!0),d.fill_data?(this._font_chars.push(d),this._font_chars_dic[this._opentype_font.glyphs.glyphs[n].unicode]=d):console.log("error tesselating opentype glyph",this._opentype_font.glyphs.glyphs[n])}else console.log("no char found for",this._opentype_font.glyphs.glyphs[n])}var _,f,m,g=0,y=0,b=[[]],v=0,x=[],A=Number.MIN_VALUE,S=Number.MIN_VALUE,w=Number.MAX_VALUE,C=Number.MAX_VALUE,P=0,E=0,T=0;for(a=0;a<this._font_chars.length;a++){for(_=this._font_chars[a].fill_data,f=new Float32Array(_.buffer),A=Number.MIN_VALUE,S=Number.MIN_VALUE,w=Number.MAX_VALUE,C=Number.MAX_VALUE,m=E=P=0;m<_.count;m++)(P=f[2*m])<C&&(C=P),S<P&&(S=P),(E=f[2*m+1])<w&&(w=E),A<E&&(A=E);this._font_chars[a].fnt_rect=new Rectangle(C/this._font_chars[a].char_width,w/this._font_em_size,(S-C)/this._font_chars[a].char_width,(A-w)/this._font_em_size),T+=(S-C+t+t)*(A-w+t+t),x[x.length]={idx:a,minx:C,miny:w,width:S-C,height:A-w}}x.sort(function(t,e){return t.height>e.height?-1:1});var M,D=0,I=i,O=1;if(e)this.initFontSize(e),O=this._size_multiply;else{O=I/Math.sqrt(T)*1.2;for(var L=!0,F=0;L;)for(L=!1,y=t,a=g=0;a<x.length;a++){if(F=x[a].height*O,E=P=0,(g+=t)+x[a].width*O+t>=I&&(y+=D+2*(g=t),D=0),D<F&&(D=F),I<=y+F+2*t){L=!0,O*=.995;break}g+=x[a].width*O+t}}for(this._fntSizeLimit=O*this._font_em_size*.5,y=t,a=g=0;a<x.length;a++){for(_=(M=this._font_chars[x[a].idx]).fill_data,f=new Float32Array(_.buffer),C=x[a].minx,S=Number.MIN_VALUE,w=x[a].miny,A=Number.MIN_VALUE,E=P=0,(g+=t)+x[a].width*O+t>=I&&(y+=D+2*(g=t),D=0),x[a].height*=O,x[a].height>D&&(D=x[a].height),I<=y+D+2*t&&(y=g=t,D=0,b[++v]=[]),M.fnt_channel=v,m=0;m<_.count;m++)P=(f[2*m]-C)*O+g,E=(f[2*m+1]-w)*O+y,S<(b[v][b[v].length]=P)&&(S=P),A<(b[v][b[v].length]=E)&&(A=E);M.fnt_uv=new Rectangle(g/I,1-y/I,(S-g)/I,(A-y)/I),g+=x[a].width*O+t}var B=[];for(a=0;a<b.length;a++){var N=new AttributesView(Float32Array,2);N.set(b[a]);var R=N.attributesBuffer.cloneBufferView();N.dispose();var V=new TriangleElements(R);V.setPositions(new Float2Attributes(R));var k=Shape.getShape(V),U=new ImageSampler;k.style=new Style;var j=MaterialManager.get_material_for_color(16777215,1);k.material=j.material,j.colorPos&&(k.style.addSamplerAt(U,k.material.getTextureAt(0)),k.material.animateUVs=!0,k.style.uvMatrix=new Matrix(0,0,0,0,j.colorPos.x,j.colorPos.y)),B[a]=k}return B},OAc.prototype.getRatio=function(t){return this._size_multiply},OAc.prototype.hasChar=function(t){var e=!!this._font_chars_dic[t];return!e&&this._opentype_font&&(e=!!this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)))),!e&&this.fallbackTable&&(e=!!this.fallbackTable.hasChar(t)),e},OAc.prototype.changeOpenTypeFont=function(t,e){void 0===e&&(e=!0),e&&this._opentype_font,this._opentype_font=t},OAc.prototype.initFontSize=function(t){this.fallbackTable&&this.fallbackTable.initFontSize(t),this._current_size!==t&&(this._current_size=t,this._size_multiply=t/this._font_em_size,this._size_multiply)},OAc.prototype.getCharVertCnt=function(t){var e=this._font_chars_dic[t];return e?e.fill_data.length:0},OAc.prototype.getCharWidth=function(t){if("32"==t)return Math.floor(this._whitespace_width*this._size_multiply*20)/20;if("9"==t)return Math.floor(this._whitespace_width*this._size_multiply*8*20)/20;var e=this.getChar(t);return e?Math.floor(e.char_width*this._size_multiply*20)/20:"9679"==t?(e=this.createPointGlyph_9679(),Math.floor(e.char_width*this._size_multiply*20)/20):this.fallbackTable?this.fallbackTable.getCharWidth(t):0},Object.defineProperty(OAc.prototype,"usesCurves",{get:function(){return this._usesCurves},enumerable:!0,configurable:!0}),OAc.prototype.getLineHeight=function(){return this._opentype_font?this._size_multiply*(this._ascent-this.descent):this._size_multiply*this._font_em_size},OAc.prototype.getUnderLineHeight=function(){return this._size_multiply*(this._ascent-this.descent/2)},Object.defineProperty(OAc.prototype,"assetType",{get:function(){return OAc.assetType},enumerable:!0,configurable:!0}),OAc.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(OAc.prototype,"fntSizeLimit",{get:function(){return this._fntSizeLimit},set:function(t){this._fntSizeLimit=t},enumerable:!0,configurable:!0}),Object.defineProperty(OAc.prototype,"ascent",{get:function(){return this._ascent},set:function(t){this._ascent=t},enumerable:!0,configurable:!0}),Object.defineProperty(OAc.prototype,"descent",{get:function(){return this._descent},set:function(t){this._descent=t},enumerable:!0,configurable:!0}),Object.defineProperty(OAc.prototype,"offset_x",{get:function(){return this._offset_x},set:function(t){this._offset_x=t},enumerable:!0,configurable:!0}),Object.defineProperty(OAc.prototype,"offset_y",{get:function(){return this._offset_y},set:function(t){this._offset_y=t},enumerable:!0,configurable:!0}),OAc.prototype.get_font_chars=function(){return this._font_chars},OAc.prototype.get_font_em_size=function(){return this._font_em_size},OAc.prototype.set_whitespace_width=function(t){this._whitespace_width=t},OAc.prototype.get_whitespace_width=function(){return this._whitespace_width},OAc.prototype.set_font_em_size=function(t){this._font_em_size=t},OAc.prototype.buildTextLineFromIndices=function(t,e,i,n,r,o){var s,a,l,c,h,u=t.getTextShapeForIdentifierAndFormat(e.color.toString(),e),p=i;n-=this._ascent*this._size_multiply;for(var d=0,_=0,f=r.length,_=0;_<f;_++){if(d=r[_],s=this._glyphIdxToChar[d],h=this._size_multiply,s&&(null==s.fill_data&&(1==s.fill_data_path.commands[0][0]&&0==s.fill_data_path.data[0][0]&&0==s.fill_data_path.data[0][1]&&(s.fill_data_path.data[0].shift(),s.fill_data_path.data[0].shift(),s.fill_data_path.commands[0].shift(),s.fill_data_path.commands[0][0]=2),s.fill_data=GraphicsFactoryFills.pathToAttributesBuffer(s.fill_data_path,!0)),a=s.fill_data))if(l=new Float32Array(a.buffer),this.usesCurves)for(c=0;c<a.count;c++)u.verts[u.verts.length]=l[3*c]*h+i,u.verts[u.verts.length]=l[3*c+1]*h+n,u.verts[u.verts.length]=l[3*c+2];else for(c=0;c<a.count;c++)u.verts[u.verts.length]=l[2*c]*h+i,u.verts[u.verts.length]=l[2*c+1]*h+n;i+=o[_]}return new Point(i-p,this.getLineHeight())},OAc.prototype.fillTextRun=function(t,e,i,n){var r=0<=this._fntSizeLimit&&(0==this._fntSizeLimit||this._fntSizeLimit>=e.size),o=t.getTextShapeForIdentifierAndFormat(e.color.toString()+r.toString()+"0",e),s={},a={},l=ColorUtils.float32ColorToARGB(e.color);(T=new MethodMaterial(this._fnt_channels[0])).colorTransform=new ColorTransform(l[1]/255,l[2]/255,l[3]/255),T.bothSides=!0,T.alphaBlending=!0,T.useColorTransform=!0,T.style.sampler=new ImageSampler(!1,!0,!0),o.fntMaterial=r?T:null,s[e.color.toString()+r.toString()+"0"]=o;var c=e.clone();c.color=16777215;var h=t.getTextShapeForIdentifierAndFormat(r.toString()+"0",c);a[r.toString()+"0"]=h,(T=new MethodMaterial(this._fnt_channels[0])).bothSides=!0,T.alphaBlending=!0,T.useColorTransform=!0,T.style.sampler=new ImageSampler(!1,!0,!0),h.fntMaterial=r?T:null;var u,p,d,_,f,m=null,g=0,y=i+5*n,b=0,v=0,x=0,A=0,S=0,w=!1,C=t.selectionBeginIndex,P=t.selectionEndIndex;t.selectionEndIndex<t.selectionBeginIndex&&(C=t.selectionEndIndex,P=t.selectionBeginIndex);var E=0;for(c.underline&&i+1<t.words.length&&(E=t.words[i+1]),g=i;g<y;g+=5){for(S=t.words[g],x=t.words[g+1],A=t.words[g+2],"BoldStyle"==this.name&&(A-=.2*this.getLineHeight()),"DJB Get Digital"==e.font_name&&(A-=2),v=S+t.words[g+4],b=S;b<v;b++)if(w=!1,t.chars_codes[b],m=t.isInFocus&&C<=b&&b<P?h:o,32!=t.chars_codes[b]&&9!=t.chars_codes[b])if(u=this.getChar(t.chars_codes[b].toString()),f=this._size_multiply,!u&&this.fallbackTable&&(u=this.fallbackTable.getChar(t.chars_codes[b].toString()),f=this.fallbackTable._size_multiply),u){if(r){var T,M,D=m.format,I=t.isInFocus&&C<=b&&b<P?a[r.toString()+u.fnt_channel]:s[D.color.toString()+r.toString()+u.fnt_channel];I||(M=t.getTextShapeForIdentifierAndFormat(D.color.toString()+r.toString()+u.fnt_channel.toString(),D),l=ColorUtils.float32ColorToARGB(D.color),(T=new MethodMaterial(this._fnt_channels[u.fnt_channel])).colorTransform=new ColorTransform(l[1]/255,l[2]/255,l[3]/255),T.bothSides=!0,T.alphaBlending=!0,T.useColorTransform=!0,T.style.sampler=new ImageSampler(!1,!0,!0),M.fntMaterial=T,I=s[D.color.toString()+r.toString()+u.fnt_channel]=M);var O=x+u.char_width*f*u.fnt_rect.x,L=O+u.char_width*f*u.fnt_rect.width,F=A+this._font_em_size*f*u.fnt_rect.y,B=F+this._font_em_size*f*u.fnt_rect.height;I.verts[I.verts.length]=O,I.verts[I.verts.length]=F,I.verts[I.verts.length]=u.fnt_uv.x,I.verts[I.verts.length]=u.fnt_uv.y,I.verts[I.verts.length]=L,I.verts[I.verts.length]=F,I.verts[I.verts.length]=u.fnt_uv.x+u.fnt_uv.width,I.verts[I.verts.length]=u.fnt_uv.y,I.verts[I.verts.length]=L,I.verts[I.verts.length]=B,I.verts[I.verts.length]=u.fnt_uv.x+u.fnt_uv.width,I.verts[I.verts.length]=u.fnt_uv.y-u.fnt_uv.height,I.verts[I.verts.length]=O,I.verts[I.verts.length]=F,I.verts[I.verts.length]=u.fnt_uv.x,I.verts[I.verts.length]=u.fnt_uv.y,I.verts[I.verts.length]=O,I.verts[I.verts.length]=B,I.verts[I.verts.length]=u.fnt_uv.x,I.verts[I.verts.length]=u.fnt_uv.y-u.fnt_uv.height,I.verts[I.verts.length]=L,I.verts[I.verts.length]=B,I.verts[I.verts.length]=u.fnt_uv.x+u.fnt_uv.width,I.verts[I.verts.length]=u.fnt_uv.y-u.fnt_uv.height}else if(p=u.fill_data,d=new Float32Array(p.buffer),this.usesCurves)for(_=0;_<p.count;_++)m.verts[m.verts.length]=d[3*_]*f+x,m.verts[m.verts.length]=d[3*_+1]*f+A,m.verts[m.verts.length]=d[3*_+2];else if(w)for(_=0;_<p.count;_++)m.verts[m.verts.length]=(u.char_width-d[2*_])*f+x,m.verts[m.verts.length]=(d[2*_+1]-this.vertical_glyph_offset)*f+A;else for(_=0;_<p.count;_++)m.verts[m.verts.length]=d[2*_]*f+x,m.verts[m.verts.length]=(d[2*_+1]-this.vertical_glyph_offset)*f+A;x+=u.char_width*f}else once(this,"miss"+t.chars_codes[b])&&console.debug("[TesselatedFontTable] Error: char not found in fontTable",t.chars_codes[b],t.chars_codes[b].toString());var N=.25*t.internalScale.y,R=A+this.getUnderLineHeight()+N,V=A+this.getUnderLineHeight()-N;c.underline&&i+1<t.words.length&&(m.verts[m.verts.length]=E,m.verts[m.verts.length]=V,m.verts[m.verts.length]=E,m.verts[m.verts.length]=R,m.verts[m.verts.length]=x,m.verts[m.verts.length]=R,m.verts[m.verts.length]=x,m.verts[m.verts.length]=R,m.verts[m.verts.length]=x,m.verts[m.verts.length]=V,m.verts[m.verts.length]=E,m.verts[m.verts.length]=V)}d=null},OAc.prototype.createPointGlyph_9679=function(){var t=[];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,!1);var e=new AttributesView(Float32Array,2);e.set(t);var i=e.attributesBuffer.cloneBufferView();e.dispose();var n=new TesselatedFontChar(i,null,null);return n.char_width=this._font_em_size,this._font_chars.push(n),this._font_chars_dic[9679]=n},OAc.prototype.getChar=function(t){if(null==(i=this._font_chars_dic[t])){if(this._opentype_font){var e=this._opentype_font.charToGlyph(String.fromCharCode(parseInt(t)));if(e){for(var i,n=e.getPath(),r=new GraphicsPath,o=0,s=n.commands.length,a=0,l=0,c=this._ascent,o=0;o<s;o++){var h=n.commands[o];"M"===h.type?(r.moveTo(h.x,h.y+c),a=h.x,l=h.y+c):"L"===h.type?r.lineTo(h.x,h.y+c):"Q"===h.type?r.curveTo(h.x1,h.y1+c,h.x,h.y+c):"C"===h.type?r.cubicCurveTo(h.x1,h.y1+c,h.x2,h.y2+c,h.x,h.y+c):"Z"===h.type&&r.lineTo(a,l)}if((i=new TesselatedFontChar(null,null,r)).char_width=e.advanceWidth*(1/e.path.unitsPerEm*72),i.fill_data=GraphicsFactoryFills.pathToAttributesBuffer(r,!0),!i.fill_data)return once(this,"tess"+t)&&console.debug("[TesselatedFontTable] Error:tesselating opentype glyph:",t.charCodeAt(0)),null;this._font_chars.push(i),this._font_chars_dic[t]=i}}"9679"==t&&(i=this.createPointGlyph_9679())}else if(null==i.fill_data&&null==i.stroke_data&&null!=i.fill_data_path&&(1==i.fill_data_path.commands[0][0]&&0==i.fill_data_path.data[0][0]&&0==i.fill_data_path.data[0][1]&&(i.fill_data_path.data[0].shift(),i.fill_data_path.data[0].shift(),i.fill_data_path.commands[0].shift(),i.fill_data_path.commands[0][0]=2),i.fill_data=GraphicsFactoryFills.pathToAttributesBuffer(i.fill_data_path,!0),!i.fill_data))return once(this,"tess"+t)&&console.debug("[TesselatedFontTable] Error:tesselating glyph:",t.charCodeAt(0)),null;return i},OAc.prototype.setChar=function(t,e,i,n,r,o,s){if(void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=!1),void 0===o&&(o=0),void 0===s&&(s=null),e=Math.floor(20*e)/20,null==i&&null==n&&null==s)throw"TesselatedFontTable: trying to create a TesselatedFontChar with no data (fills_data, stroke_data and fill_data_path is null)";if(0<this._font_chars.length){if(r!=this._usesCurves)throw"TesselatedFontTable: Can not set different types of graphic-glyphs (curves vs non-cuves) on the same FontTable!"}else this._usesCurves=r;var a=new TesselatedFontChar(i,n,s);a.char_width=e,a.glyph_idx=o,a.name=t,this._glyphIdxToChar[o]=a,this._font_chars.push(a),this._font_chars_dic[t]=a},OAc.prototype.buildTextRuns=function(t,e){if(2*t.length!=e.length)throw"Invalid data passed to TesselatedFontTable.buildTextRuns(). output_verts.length is not double textRuns.length.";for(var i,n=0,r=0,o=0,s=0,a=0,l=t.length,n=0;n<l;n++)for((i=t[n])[0],r=i[1],i[2],a=i.length,s=3;s<a;s+=2){if(o=i[s],i[s+1],this.getChar(o.toString()),(r==DrawMode.BOTH||r==DrawMode.STROKE)&&null==e[2*n])throw"Trying to render strokes for a textrun, but no output_vert list was set for this textrun strokes";if((r==DrawMode.BOTH||r==DrawMode.FILL)&&null==e[2*n+1])throw"Trying to render fills for a textrun, but no output_vert list was set for this textrun fills"}},OAc.assetType="[asset TesselatedFontTable]",OAc),TextFieldAutoSize=(LDc.CENTER="center",LDc.LEFT="left",LDc.NONE="none",LDc.RIGHT="right",LDc),TextFieldType=(MDc.DYNAMIC="dynamic",MDc.INPUT="input",MDc.STATIC="input",MDc),FontStyleName=(NDc.STANDART="standart",NDc.BOLD="bold",NDc.ITALIC="italic",NDc.BOLDITALIC="boldItalic",NDc),TextFormatAlign=(ODc.CENTER="center",ODc.JUSTIFY="justify",ODc.LEFT="left",ODc.RIGHT="right",ODc),PUBLIC_FIELDS=["font","align","leftMargin","rightMargin","indent","size","color","bold","italic","underline","leading","letterSpacing"],TextFormat=(PDc=AssetBase,__extends(QDc,PDc),Object.defineProperty(QDc.prototype,"updateID",{get:function(){return this._updateID},enumerable:!0,configurable:!0}),QDc.prototype.hasPropertySet=function(t){return null!==this["_"+t]},Object.defineProperty(QDc.prototype,"align",{get:function(){return this._align?this._align:TextFormatAlign.LEFT},set:function(t){this._align!==t&&this._updateID++,this._align=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"blockIndent",{get:function(){return this._blockIndent?this._blockIndent:0},set:function(t){this._blockIndent!==t&&this._updateID++,this._blockIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"leftMargin",{get:function(){return this._leftMargin?this._leftMargin:0},set:function(t){t!==this._leftMargin&&this._updateID++,this._leftMargin=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"rightMargin",{get:function(){return this._rightMargin?this._rightMargin:0},set:function(t){t!==this._rightMargin&&this._updateID++,this._rightMargin=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"indent",{get:function(){return this._indent?this._indent:0},set:function(t){t!==this._indent&&this._updateID++,this._indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"color",{get:function(){return null!==this._color?this._color:0},set:function(t){t!==this._color&&this._updateID++,this._color=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"kerning",{get:function(){return!!this._kerning&&this._kerning},set:function(t){t!==this._kerning&&this._updateID++,this._kerning=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"leading",{get:function(){return this._leading?this._leading:0},set:function(t){t!==this._leading&&this._updateID++,this._leading=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"letterSpacing",{get:function(){return this._letterSpacing?this._letterSpacing:0},set:function(t){t!==this._letterSpacing&&this._updateID++,this._letterSpacing=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"size",{get:function(){return this._size?this._size:12},set:function(t){t!==this._size&&this._updateID++,this._size=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"bold",{get:function(){return!!this._bold&&this._bold},set:function(t){t!==this._bold&&this._updateID++,this._bold=t,this._font&&(this.font_table=this.font.get_font_table(this.style_name,TesselatedFontTable.assetType))},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"italic",{get:function(){return!!this._italic&&this._italic},set:function(t){t!==this._italic&&this._updateID++,this._italic=t,this._font&&(this.font_table=this.font.get_font_table(this.style_name,TesselatedFontTable.assetType))},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"underline",{get:function(){return!!this._underline&&this._underline},set:function(t){t!==this._underline&&this._updateID++,this._underline=t},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"font_table",{get:function(){return this._font_table||(this.font_table=this.font.get_font_table(this.style_name,TesselatedFontTable.assetType)),this._font_table},set:function(t){t!==this._font_table&&this._updateID++,this._font_table=t,this._style_name=this._font_table.name,this._style_name==FontStyleName.ITALIC&&(this._italic=!0),this._style_name==FontStyleName.BOLD&&(this._bold=!0),this._style_name==FontStyleName.BOLDITALIC&&(this._bold=!0,this._italic=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"font_name",{get:function(){return this._font_name?this._font_name:""},set:function(t){t!==this._font_name&&this._updateID++;var e=DefaultFontManager.getFont(t);e?(this._font=e,this.font_table=e.get_font_table(FontStyleName.STANDART,TesselatedFontTable.assetType),this.font_table||console.log("could not find font-table on font",t,this._font),0==this.font_table.get_font_chars().length&&(this.font_table=e.get_font_table(FontStyleName.STANDART,TesselatedFontTable.assetType),this.font_table||console.log("could not find font-table on font",t,this._font)),this._font_name=t):console.log("could not find font for name ",t)},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"style_name",{get:function(){return this._italic||this._bold?this._italic&&!this._bold?this._style_name=FontStyleName.ITALIC:!this._italic&&this._bold?this._style_name=FontStyleName.BOLD:this._italic&&this._bold&&(this._style_name=FontStyleName.BOLDITALIC):this._style_name=FontStyleName.STANDART,this._style_name},set:function(t){t!==this._style_name&&this._updateID++,this._style_name=t,this._style_name!=FontStyleName.BOLD&&this._style_name!=FontStyleName.BOLDITALIC||(this._bold=!0),this._style_name!=FontStyleName.ITALIC&&this._style_name!=FontStyleName.BOLDITALIC||(this._italic=!0),this._font&&(this.font_table=this.font.get_font_table(this._style_name,TesselatedFontTable.assetType))},enumerable:!0,configurable:!0}),Object.defineProperty(QDc.prototype,"font",{get:function(){return this._font||(this._font=DefaultFontManager.getFont(null),this._font_table=this._font.get_font_table(FontStyleName.STANDART,TesselatedFontTable.assetType)),this._font},set:function(t){"string"!=typeof t?(t!==this._font&&this._updateID++,this._font=t,this._font_table=this._font.get_font_table(this._style_name,TesselatedFontTable.assetType)):this.font_name=t},enumerable:!0,configurable:!0}),QDc.prototype.clone=function(){var t=new QDc;return this.applyToFormat(t),t},QDc.prototype.applyToFormat=function(t){for(var e=0,i=PUBLIC_FIELDS;e<i.length;e++){var n=i[e];null!==this["_"+n]&&(t[n]=this["_"+n])}return t},Object.defineProperty(QDc.prototype,"assetType",{get:function(){return QDc.assetType},enumerable:!0,configurable:!0}),QDc.assetType="[asset TextFormat]",QDc),TextLineMetrics=function(t,e,i,n,r,o){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),this.x=t,this.width=e,this.height=i,this.ascent=n,this.descent=r,this.leading=o},KeyboardEvent$1=(HEc=EventBase,__extends(IEc,HEc),Object.defineProperty(IEc.prototype,"char",{get:function(){return this._char},enumerable:!0,configurable:!0}),Object.defineProperty(IEc.prototype,"charCode",{get:function(){return this._charCode},enumerable:!0,configurable:!0}),IEc.prototype.clone=function(){return new IEc(this.type,this._char,this._charCode)},IEc.KEYDOWN="keydown",IEc.KEYUP="keyup",IEc),TextfieldEvent=(NEc=EventBase,__extends(OEc,NEc),OEc.prototype.clone=function(){return new OEc(this.type)},OEc.CHANGED="onChanged",OEc),TextSprite=(QEc=Sprite,__extends(REc,QEc),REc.prototype._acceptTraverser=function(t){var e=this.parentTextField;e.reConstruct(!0),!e._textFormat||e._textFormat.font_table.isAsset(TesselatedFontTable)||e._textFormat.material||(e.transform.colorTransform||(e.transform.colorTransform=new ColorTransform),this.transform.colorTransform.color=null!=e.textColor?e.textColor:e._textFormat.color,this._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM)),this._graphics._acceptTraverser(t)},REc),TextShape=function(){this.verts=[]},HTMLTextProcessor=(UEc.get=function(){return UEc.instance||(UEc.instance=new UEc),UEc.instance},UEc.prototype.processHTML=function(t,e){e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=(e=e.replace(new RegExp("&nbsp;","g")," ")).replace(new RegExp("√","g"),String.fromCharCode(8730))).replace(new RegExp("×","g"),String.fromCharCode(215))).replace(new RegExp("<\\\\","g"),"</")).replace(new RegExp("<br>","g"),"<br/>")).replace(new RegExp("<BR>","g"),"<br/>")).replace(new RegExp("<BR/>","g"),"<br/>")).replace(new RegExp("<B","g"),"<b")).replace(new RegExp("</B>","g"),"</b>")).replace(new RegExp("<I","g"),"<i")).replace(new RegExp("</I>","g"),"</i>")).replace(new RegExp("<P","g"),"<p")).replace(new RegExp("</P>","g"),"</p>")).replace(new RegExp("<U","g"),"<u")).replace(new RegExp("</U>","g"),"</u>")).replace(new RegExp("<LI","g"),"<li")).replace(new RegExp("</LI>","g"),"</li>")).replace(new RegExp("<FONT","g"),"<font")).replace(new RegExp("</FONT>","g"),"</font>")).replace(new RegExp("& ","g"),"&amp; ");for(var i=0,n=[],r=[],o=[];i<e.length;)if("<"==e[i]){if("p"==e[i+1])n[n.length]="p";else if("b"==e[i+1]&&"r"!=e[i+2])n[n.length]="b";else if("i"==e[i+1])n[n.length]="i";else if("u"==e[i+1])n[n.length]="u";else if("f"==e[i+1]&&"o"==e[i+2]&&"n"==e[i+3]&&"t"==e[i+4])n[n.length]="font",i+=2;else if("l"==e[i+1]&&"i"==e[i+2])n[n.length]="li",i++;else if("/"==e[i+1]&&"p"==e[i+2]){for(var s=n.length,a=-1;0<s;)if("p"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=4;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}else if("/"==e[i+1]&&"b"==e[i+2]){for(s=n.length,a=-1;0<s;)if("b"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=4;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}else if("/"==e[i+1]&&"i"==e[i+2]){for(s=n.length,a=-1;0<s;)if("i"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=4;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}else if("/"==e[i+1]&&"u"==e[i+2]){for(s=n.length,a=-1;0<s;)if("u"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=4;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}else if("/"==e[i+1]&&"l"==e[i+2]&&"i"==e[i+3]){for(s=n.length,a=-1;0<s;)if("li"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=7;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}else if("/"==e[i+1]&&"f"==e[i+2]&&"o"==e[i+3]&&"n"==e[i+4]&&"t"==e[i+5]){for(s=n.length,a=-1;0<s;)if("font"==n[--s]){a=s;break}if(a<0)r[r.length]=i,o[o.length]=7;else{for(s=n.length-1;a<s;)r[r.length]=i,o[o.length]="</"+n[s]+">",n.pop(),s--;n.pop()}}i++}else i++;for(s=n.length;0<s;)s--,r[r.length]=i,o[o.length]="</"+n[s]+">";for(var l=0,c=o.length,h=0;h<c;h++)"number"==typeof o[h]?(e=e.slice(0,r[h]+l)+e.slice(r[h]+l+o[h]),l-=o[h]):(e=e.slice(0,r[h]+l)+o[h]+e.slice(r[h]+l),l+=o[h].length);var u={text:""};t._textFormat.italic=!1,t._textFormat.bold=!1,t._textFormats=[t._textFormat],t._textFormatsIdx=[0];var p,d=(new DOMParser).parseFromString("<p>"+e+"</p>","application/xml");return d&&d.firstChild&&(u.multiline=0<d.firstChild.childNodes.length,0<(p=d).firstChild.childNodes.length&&"parsererror"==d.firstChild.childNodes[0].nodeName&&(p=d.firstChild.childNodes[1]),this.readHTMLTextPropertiesRecursive(t,p,u,t._textFormat)),""==u.text||13!=u.text.charCodeAt(u.text.length-1)&&10!=u.text.charCodeAt(u.text.length-1)||(u.text=u.text.slice(0,u.text.length-1)),""!=u.text&&3<=u.text.length&&"n"==u.text[u.text.length-1]&&"\\"==u.text[u.text.length-2]&&"\\"==u.text[u.text.length-3]?u.text=u.text.slice(0,u.text.length-3):""!=u.text&&2<=u.text.length&&"n"==u.text[u.text.length-1]&&"\\"==u.text[u.text.length-2]&&(u.text=u.text.slice(0,u.text.length-2)),""!=u.text&&3<=u.text.length&&"n"==u.text[u.text.length-1]&&"\\"==u.text[u.text.length-2]&&"\\"==u.text[u.text.length-3]?u.text=u.text.slice(0,u.text.length-3):""!=u.text&&2<=u.text.length&&"n"==u.text[u.text.length-1]&&"\\"==u.text[u.text.length-2]&&(u.text=u.text.slice(0,u.text.length-2)),t._textFormatsIdx[t._textFormatsIdx.length-1]=u.text.length,u.text},UEc.prototype.readHTMLTextPropertiesRecursive=function(t,e,i,n){var r,o=[],s=[];e.attributes&&((e.attributes.size||e.attributes.SIZE)&&(r=(r=e.attributes.size?e.attributes.size.nodeValue:e.attributes.SIZE.nodeValue).replace(/[^0-9.]/g,""),o[o.length]=parseInt(r),s[s.length]="size"),(e.attributes.color||e.attributes.COLOR)&&(r=(r=e.attributes.color?e.attributes.color.nodeValue:e.attributes.COLOR.nodeValue).replace("#","0x"),o[o.length]=parseInt(r),s[s.length]="color"),(e.attributes.indent||e.attributes.INDENT)&&(r=(r=e.attributes.indent?e.attributes.indent.nodeValue:e.attributes.INDENT.nodeValue).replace(/[^0-9.]/g,""),o[o.length]=parseInt(r),s[s.length]="indent"),(e.attributes.leftMargin||e.attributes.LEFTMARGIN)&&(r=(r=e.attributes.leftMargin?e.attributes.leftMargin.nodeValue:e.attributes.LEFTMARGIN.nodeValue).replace(/[^0-9.]/g,""),o[o.length]=parseInt(r),s[s.length]="leftMargin"),(e.attributes.rightMargin||e.attributes.RIGHTMARGIN)&&(r=(r=e.attributes.rightMargin?e.attributes.rightMargin.nodeValue:e.attributes.RIGHTMARGIN.nodeValue).replace(/[^0-9.]/g,""),o[o.length]=parseInt(r),s[s.length]="rightMargin"),(e.attributes.align||e.attributes.ALIGN)&&(r=e.attributes.align?e.attributes.align.nodeValue:e.attributes.ALIGN.nodeValue,o[o.length]=r,s[s.length]="align"),(e.attributes.face||e.attributes.FACE)&&(r=e.attributes.face?e.attributes.face.nodeValue:e.attributes.FACE.nodeValue,o[o.length]=r,s[s.length]="font_name"));for(var a=o.length,l=!1;0<a;)if(n[s[--a]]!=o[a]){l=!0;break}"p"==e.tagName||("b"==e.tagName?n.bold||(l=!0,o[o.length]=!0,s[s.length]="bold"):"i"==e.tagName?n.italic||(l=!0,o[o.length]=!0,s[s.length]="italic"):"u"==e.tagName?n.underline||(l=!0,o[o.length]=!0,s[s.length]="underline"):"font"==e.tagName?l=!0:"li"==e.tagName?i.text+=" ● ":"br"==e.tagName&&(i.text+="\\n"));var c=n;if(l){for(c=n.clone(),a=o.length;0<a;)c[s[--a]]=o[a];t._textFormats.push(c),t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length,t._textFormatsIdx.push(i.text.length)}if(e.childNodes&&0<e.childNodes.length)for(var h=0;h<e.childNodes.length;h++)t._textFormats[t._textFormats.length-1]!=c&&(t._textFormats.push(c),t._textFormatsIdx[t._textFormatsIdx.length-1]=i.text.length,t._textFormatsIdx.push(i.text.length)),this.readHTMLTextPropertiesRecursive(t,e.childNodes[h],i,c);else e.nodeValue&&""!=e.nodeValue.replace(/[\s\r\n]/gi,"")&&(i.text+=e.nodeValue.replace("\n","\\n"));"li"!=e.tagName&&"p"!=e.tagName||(i.text+="\\n")},UEc),TextField=(sFc=DisplayObjectContainer,__extends(tFc,sFc),tFc.getNewTextField=function(){return tFc._textFields.length?tFc._textFields.pop():new tFc},tFc.clearPool=function(){tFc._textFields=[]},tFc.prototype.updateMaskMode=function(){if(this.inMaskMode&&(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()),!this.inMaskMode)return this.inMaskMode=!0,this.maskChild||(this.maskChild=new Sprite),this.textChild||(this.textChild=new TextSprite),this.textChild.mouseEnabled=!1,(this.textChild.parentTextField=this).maskChild.mouseEnabled=!1,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=!0,this.textChild.masks=[this.maskChild],this._graphics.clear(),void(this.targetGraphics=this.textChild.graphics)},tFc.prototype.getMouseCursor=function(){return this.cursorType},Object.defineProperty(tFc.prototype,"isInFocus",{get:function(){return this._isInFocus},set:function(t){},enumerable:!0,configurable:!0}),tFc.prototype.setFocus=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!0),this._isInFocus!=t&&(sFc.prototype.setFocus.call(this,t,e,i),this.enableInput(t),t?this.setSelection(0,this._iText.length):this.setSelection(0,0),t&&i&&this.adapter!=this&&this.adapter.selectTextField(e),this._glyphsDirty=!0,this._implicitPartition&&this._implicitPartition.invalidateEntity(this))},tFc.prototype.enableInput=function(t){var e;void 0===t&&(t=!0),0<=this.cursorIntervalID&&(window.clearInterval(this.cursorIntervalID),this.cursorIntervalID=-1),t&&this._isInFocus&&this.selectable&&(this.drawSelectionGraphics(),(e=this).cursorIntervalID=window.setInterval(function(){e.cursorBlinking=!e.cursorBlinking,e.selectable||(e.cursorBlinking=!0),e._shapesDirty=!0,e.invalidate()},500))},tFc.prototype.findCharIdxForMouse=function(t){var e=this.textChild.transform.globalToLocal(new Point(t.scenePosition.x,t.scenePosition.y)),i=this.getLineIndexAtPoint(e.x,e.y),n=this.getCharIndexAtPoint(e.x,e.y,i);return i>=this.lines_start_x.length&&(i=this.lines_start_x.length-1),i<0&&(i=0),0<=i&&n<0&&void 0!==this.lines_start_x[i]&&(n=e.x<=this.lines_start_x[i]?this.lines_charIdx_start[i]:this.lines_charIdx_end[i]),(i<0||n<0)&&(n=0),n},tFc.prototype.startSelectionByMouse=function(t){this._selectionBeginIndex=this.findCharIdxForMouse(t),this._selectionEndIndex=this._selectionBeginIndex,this._glyphsDirty=!0,this.reConstruct(),this.cursorBlinking=!1,this.drawSelectionGraphics()},tFc.prototype.stopSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t),this._glyphsDirty=!0,this.reConstruct(),this.drawSelectionGraphics()},tFc.prototype.updateSelectionByMouse=function(t){this._selectionEndIndex=this.findCharIdxForMouse(t),this._glyphsDirty=!0,this.reConstruct(),this.drawSelectionGraphics()},tFc.prototype.drawSelectionGraphics=function(){this._selectionBeginIndex<0&&(this._selectionBeginIndex=0),this._selectionBeginIndex>this.char_positions_x.length&&(this._selectionBeginIndex=this.char_positions_x.length),this._selectionEndIndex<0&&(this._selectionEndIndex=0),this._selectionEndIndex>this.char_positions_x.length&&(this._selectionEndIndex=this.char_positions_x.length),this._selectionBeginIndex===this._selectionEndIndex?(this.showSelection=!1,this.drawCursor()):(this.showSelection=!0,this.drawSelectedBG())},tFc.prototype.scrollToCursor=function(t,e){},tFc.prototype.drawCursor=function(){var t,e,i,n,r,o,s,a,l,c;this._shapesDirty=!0,!this.cursorBlinking&&this.selectable&&this.selectionBeginIndex===this.selectionEndIndex&&(e=t=0,i=this.newTextFormat,0==this.char_positions_x.length?(t=this.textOffsetX+this._width/2+this._textWidth/2,"justify"==i.align||"center"==i.align||("right"==i.align?t=this.textOffsetX+this._width-2:"left"==i.align&&(t=this.textOffsetX+4+this._textWidth))):i=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],this.tf_per_char[this._selectionBeginIndex-1]):(t=this.char_positions_x[this._selectionBeginIndex],e=this.char_positions_y[this._selectionBeginIndex],this.tf_per_char[this._selectionBeginIndex]),i.font_table.initFontSize(i.size),n=i.font_table.getLineHeight(),r=this.getTextColorForTextFormat(i),(o=this.internalScale.x)<=0&&(o=1),s=[t-.5*o,e,o,n],this.cursorShape?GraphicsFactoryHelper.updateRectanglesShape(this.cursorShape,s):(this.cursorShape=GraphicsFactoryHelper.drawRectangles(s,r,1),this.cursorShape.usages++),this.cursorShape.style.color!==r&&(a=ColorUtils.float32ColorToARGB(r)[0],(l=MaterialManager.get_material_for_color(r,a/255||1)).colorPos&&(this.cursorShape.style=new Style,c=new ImageSampler,l.material.animateUVs=!0,this.cursorShape.style.color=r,this.cursorShape.style.addSamplerAt(c,l.material.getTextureAt(0)),this.cursorShape.style.uvMatrix=new Matrix(0,0,0,0,l.colorPos.x,l.colorPos.y))),this.scrollToCursor(t,e))},tFc.prototype.drawSelectedBG=function(){this._shapesDirty=!0,this._selectionBeginIndex<0&&(this._selectionBeginIndex=0),this._selectionBeginIndex>this.char_positions_x.length&&(this._selectionBeginIndex=this.char_positions_x.length);var t=this._selectionBeginIndex,e=this._selectionEndIndex;this._selectionEndIndex<this._selectionBeginIndex&&(t=this._selectionEndIndex,e=this._selectionBeginIndex);var i=0,n=0,r=-1,o=null,s=-1,a=0,l=0,c=[];if(0!=this.char_positions_x.length&&this._selectionEndIndex!=this._selectionBeginIndex)for(var h=e>this.char_positions_x.length?this.char_positions_x.length:e,u=t;u<h;u++)o=u==this.char_positions_x.length?(i=this.char_positions_x[u-1]+this.chars_width[u-1],n=this.char_positions_y[u-1],this.tf_per_char[u-1]):(i=this.char_positions_x[u],n=this.char_positions_y[u],this.tf_per_char[u]),s<0&&(s=i),0<=r&&r!=n&&(c.push(s,r,a,l),a=0,s=i),a+=this.chars_width[u],r=n,o.font_table.initFontSize(o.size),l=Math.max(l,o.font_table.getLineHeight());if(0<a)return c.push(s,r,a,l),void(this.bgShapeSelect?GraphicsFactoryHelper.updateRectanglesShape(this.bgShapeSelect,c):(this.bgShapeSelect=GraphicsFactoryHelper.drawRectangles(c,0,1),this.bgShapeSelect.usages++));this.scrollToCursor(s+a,r+l)},tFc.prototype.drawBG=function(){this._graphics.beginFill(this.backgroundColor,this._background?1:0),this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this.width,this.height),this._graphics.endFill()},tFc.prototype.drawBorder=function(){var t=this.border?.25*this.internalScale.x:0,e=this.border?.25*this.internalScale.y:0;this._graphics.beginFill(this._borderColor,1),this._graphics.drawRect(this.textOffsetX,this.textOffsetY,this._width,2*e),this._graphics.drawRect(this.textOffsetX,this.textOffsetY+this._height-2*e,this._width,2*e),this._graphics.drawRect(this.textOffsetX,this.textOffsetY+2*e,2*t,this._height-2*e),this._graphics.drawRect(this.textOffsetX+this._width-2*t,this.textOffsetY+2*e,2*t,this._height-2*e),this._graphics.endFill()},tFc.prototype.getTextShapeForIdentifierAndFormat=function(t,e){return this.textShapes.hasOwnProperty(t)||(this.textShapes[t]=new TextShape,this.textShapes[t].format=e),this.textShapes[t]},Object.defineProperty(tFc.prototype,"autoSize",{get:function(){return this._autoSize},set:function(t){if(this._autoSize!=t){if("string"==typeof t){if(t!=TextFieldAutoSize.CENTER&&t!=TextFieldAutoSize.NONE&&t!=TextFieldAutoSize.LEFT&&t!=TextFieldAutoSize.RIGHT)return}else"boolean"==typeof t&&(t=t?TextFieldAutoSize.LEFT:TextFieldAutoSize.NONE),"number"==typeof t&&(t=0<t?TextFieldAutoSize.LEFT:TextFieldAutoSize.NONE);this._autoSize=t,this._positionsDirty=!0,this._autoSize!=TextFieldAutoSize.NONE&&this.invalidate()}},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"internalScale",{get:function(){return this._internalScale},enumerable:!0,configurable:!0}),tFc.prototype._iInternalUpdate=function(){sFc.prototype._iInternalUpdate.call(this),this.reConstruct(!0),!this._textFormat||this._textFormat.font_table.isAsset(TesselatedFontTable)||this._textFormat.material||(this.transform.colorTransform||(this.transform.colorTransform=new ColorTransform),this.transform.colorTransform.color=null!=this.textColor?this.textColor:this._textFormat.color,this._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM)),this._internalScale.x,this._internalScale.y},tFc.prototype._onGraphicsInvalidate=function(t){var e=this.isEntity();this._isEntity!=e&&(!e&&this._implicitPartition&&this._implicitPartition.clearEntity(this),this._isEntity=e),this.invalidate()},Object.defineProperty(tFc.prototype,"assetType",{get:function(){return tFc.assetType},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"background",{get:function(){return this._background},set:function(t){this._background!=t&&(this._background=t,this._shapesDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"backgroundColor",{get:function(){return this._backgroundColor},set:function(t){this._backgroundColor=t,this._shapesDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"border",{get:function(){return this._border},set:function(t){t!=this._border&&(this._border=t,this._shapesDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){t!=this.borderColor&&(this._borderColor=t,this._shapesDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"bottomScrollV",{get:function(){return this._bottomScrollV},set:function(t){t!=this._bottomScrollV&&(this._bottomScrollV=t)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"caretIndex",{get:function(){return this._caretIndex},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"defaultTextFormat",{get:function(){return null==this._defaultTextFormat&&(this._defaultTextFormat=new TextFormat),this._defaultTextFormat},set:function(t){this._defaultTextFormat!=t&&(this._defaultTextFormat=t,this._textDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"height",{get:function(){return this._autoSize!=TextFieldAutoSize.NONE&&this.reConstruct(),this._height},set:function(t){this._height!=t&&this._autoSize==TextFieldAutoSize.NONE&&(this._height=t,this._positionsDirty=!0,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"htmlText",{get:function(){return this._htmlText},set:function(t){var e;t!=this._htmlText&&(this._htmlText=t,e=HTMLTextProcessor.get().processHTML(this,t),this._labelData=null,this._text=e,this._iText=e,this._textDirty=!0,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this),this.newTextFormat=this._textFormats[this._textFormats.length-1])},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"length",{get:function(){return this._iText.length},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"maxScrollH",{get:function(){return this.reConstruct(),this._maxScrollH},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"maxScrollV",{get:function(){return this.reConstruct(),this._maxScrollV},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"numLines",{get:function(){return this.reConstruct(),this._numLines},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"restrict",{get:function(){return this._restrict},set:function(t){t!=this._restrict&&(this._restrict=t,this._restrictRegex=null,void 0!==t&&(2<=(t=t.toString()).length&&"-"==t[0]&&!isNaN(parseInt(t[1]))&&(t="0"+t),t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=(t=t.replace(/\\/g,"")).replace(/\^/g,"")).replace(/([^a-zA-Z0-9])\-/g,"$1\\-")).replace(/\./g,"\\.")).replace(/\</g,"\\<")).replace(/\>/g,"\\>")).replace(/\+/g,"\\+")).replace(/\*/g,"\\*")).replace(/\?/g,"\\?")).replace(/\[/g,"\\[")).replace(/\]/g,"\\]")).replace(/\$/g,"\\$")).replace(/\(/g,"\\(")).replace(/\)/g,"\\)")).replace(/\{/g,"\\{")).replace(/\}/g,"\\}")).replace(/\=/g,"\\=")).replace(/\!/g,"\\!")).replace(/\:/g,"\\:")).replace(/\|/g,"\\|")).replace(/\//g,"\\/")).replace(/\%/g,"\\%"),this._restrictRegex=new RegExp("[^"+t+"]","g")))},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"scrollH",{get:function(){return this._scrollH},set:function(t){t!=this._scrollH&&(this._scrollH=t)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"scrollV",{get:function(){return this._scrollV},set:function(t){Math.floor(t)!=this._scrollH&&(this._scrollV=Math.floor(t),this._scrollV>this._maxScrollV&&(this._scrollV=this._maxScrollV),this.textChild&&(this.textChild.y=-this.lines_start_y[this._scrollV]))},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"selectable",{get:function(){return this._selectable},set:function(t){this.selectable!=t&&(this._selectable=t,(this.mouseEnabled=t)?(this.addEventListener(MouseEvent$1.DRAG_START,this.startSelectionByMouseDelegate),this.addEventListener(MouseEvent$1.DRAG_STOP,this.stopSelectionByMouseDelegate),this.addEventListener(MouseEvent$1.DRAG_MOVE,this.updateSelectionByMouseDelegate)):(this.removeEventListener(MouseEvent$1.DRAG_START,this.startSelectionByMouseDelegate),this.removeEventListener(MouseEvent$1.DRAG_STOP,this.stopSelectionByMouseDelegate),this.removeEventListener(MouseEvent$1.DRAG_MOVE,this.updateSelectionByMouseDelegate)))},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"selectionBeginIndex",{get:function(){return this._selectionBeginIndex},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"selectionEndIndex",{get:function(){return this._selectionEndIndex},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"text",{get:function(){return this._text},set:function(t){t=(t=void 0===t?"":t.toString()).replace(String.fromCharCode(160)," "),this._text!=t&&(this._labelData=null,""==(this._text=t)||13!=t.charCodeAt(t.length-1)&&10!=t.charCodeAt(t.length-1)||(t=t.slice(0,t.length-1)),""!=t&&3<=t.length&&"n"==t[t.length-1]&&"\\"==t[t.length-2]&&"\\"==t[t.length-3]&&(t=t.slice(0,t.length-3)),""!=t&&3<=t.length&&"n"==t[t.length-1]&&"\\"==t[t.length-2]&&(t=t.slice(0,t.length-2)),this._iText=t,this._textFormats=[this.newTextFormat],this._textFormatsIdx=[this._iText.length],this._textDirty=!0,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this))},enumerable:!0,configurable:!0}),tFc.prototype.setLabelData=function(t){this._labelData=t,this.isStatic=!0,this._iText="",this._textDirty=!1,this._positionsDirty=!1,this._glyphsDirty=!0,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this)},Object.defineProperty(tFc.prototype,"newTextFormat",{get:function(){return this._newTextFormat?this._newTextFormat:this._textFormat?this._textFormat:new TextFormat},set:function(t){this._newTextFormat=t?t.applyToFormat(this._textFormat.clone()):null},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"textFormat",{get:function(){return null==this._textFormat&&(this._textFormat=new TextFormat),this._textFormat},set:function(t){this._textFormat!=t&&(this._textDirty=!0,this._textFormat=t,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this))},enumerable:!0,configurable:!0}),tFc.prototype._acceptTraverser=function(t){this.maskMode||this._graphics._acceptTraverser(t)},Object.defineProperty(tFc.prototype,"scaleX",{get:function(){return this._transform.scale.x},set:function(t){this._transform.scale.x!=t&&this._setScaleX(t)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"scaleY",{get:function(){return this._transform.scale.y},set:function(t){this._transform.scale.y!=t&&this._setScaleY(t)},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"textColor",{get:function(){return this._textColor},set:function(t){if(this._textColor!=t){if(this._textColor=t,this._textFormats){for(var e=this._textFormats.length;0<e;)e--,this._textFormats[e]&&(this._textFormats[e].color=t);this._textDirty=!0}!this._textFormat||this._textFormat.font_table.isAsset(TesselatedFontTable)||this._textFormat.material?(this._glyphsDirty=!0,this._implicitPartition&&this._implicitPartition.invalidateEntity(this)):(this.transform.colorTransform||(this.transform.colorTransform=new ColorTransform),this.transform.colorTransform.color=t,this._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM))}},enumerable:!0,configurable:!0}),tFc.prototype.getTextColorForTextFormat=function(t){return t.hasPropertySet("color")?t.color:this._textColor},Object.defineProperty(tFc.prototype,"textInteractionMode",{get:function(){return this._textInteractionMode},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"textWidth",{get:function(){return this.reConstruct(),this._textWidth},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"textHeight",{get:function(){return this.reConstruct(),this._textHeight},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"type",{get:function(){return this._type},set:function(t){this._type!=t&&(this._type=t,this._textDirty=!0,this._implicitPartition&&this._implicitPartition.invalidateEntity(this),t==TextFieldType.INPUT?(this.enableInput(!0),this.addEventListener(KeyboardEvent$1.KEYDOWN,this.onKeyDelegate)):(this.enableInput(!1),this.removeEventListener(KeyboardEvent$1.KEYDOWN,this.onKeyDelegate)))},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"x",{get:function(){return this._autoSize==TextFieldAutoSize.NONE||this._wordWrap||this.reConstruct(),this._transform.position.x},set:function(t){this._autoSize==TextFieldAutoSize.NONE||this._wordWrap||this.reConstruct(),this._transform.position.x!=t&&(this._transform.matrix3D._rawData[12]=t,this._transform.invalidatePosition())},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"width",{get:function(){return this._autoSize==TextFieldAutoSize.NONE||this._wordWrap||this.reConstruct(),this._width},set:function(t){this._width!=t&&(this._width=t,this._positionsDirty=!0,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(tFc.prototype,"wordWrap",{get:function(){return this._wordWrap},set:function(t){this._wordWrap!=t&&(this._wordWrap=t,this._positionsDirty=!0,t||this.invalidate())},enumerable:!0,configurable:!0}),tFc.prototype.isEntity=function(){return!0},tFc.prototype.clear=function(){sFc.prototype.clear.call(this)},tFc.prototype.dispose=function(){this.disposeValues(),tFc._textFields.push(this)},tFc.prototype.disposeValues=function(){sFc.prototype.disposeValues.call(this),this.maskChild&&(this.maskChild.dispose(),this.maskChild=null),this.textChild&&(this.textChild.dispose(),this.textChild=null),this.cursorShape&&(this.cursorShape.dispose(),this.cursorShape=null),this.bgShapeSelect&&(this.bgShapeSelect.dispose(),this.bgShapeSelect=null),this._labelData&&(this._labelData=null),this._clearTextShapes(),this._textFormat=null},tFc.prototype.reConstruct=function(t){void 0===t&&(t=!1),(this._textDirty||this._positionsDirty||this._glyphsDirty||this._shapesDirty)&&(this._textDirty&&(this._positionsDirty=!0,this.chars_codes.length=0,this.chars_width.length=0,this.char_positions_x.length=0,this.char_positions_y.length=0,this.tf_per_char.length=0,this.words.length=0,this._textRuns_words.length=0,this._textRuns_formats.length=0,this._paragraph_textRuns_indices.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,""!=this._iText&&null!=this._textFormat&&this.buildParagraphs()),this._positionsDirty&&(this._glyphsDirty=!0,""!=this._iText&&null!=this._textFormat?this.getWordPositions():(this._textWidth=0,this._textHeight=0,this._autoSize!=TextFieldAutoSize.NONE&&(this.wordWrap||this.adjustPositionForAutoSize(0),this._height=4,this._type==TextFieldType.INPUT&&(this.newTextFormat.font_table.initFontSize(this.newTextFormat.size),this._height=this.newTextFormat.font_table.getLineHeight()+4)),this._type==TextFieldType.INPUT&&this.drawSelectionGraphics()),this.updateMaskMode()),this._textDirty=!1,this._positionsDirty=!1,t&&(this._glyphsDirty&&(this._labelData?this.buildGlyphsForLabelData():this.buildGlyphs()),this._glyphsDirty=!1,this._labelData||(this.buildShapes(),this._shapesDirty=!1)))},tFc.prototype.reset=function(){sFc.prototype.reset.call(this),this.sourceTextField&&this.sourceTextField.copyTo(this)},tFc.prototype.buildParagraphs=function(){var t,e=this._iText.toString(),i=0,n=this._textFormatsIdx.length,r=0,o=0,s=0,a=0,l=!0,c=0,h=0,u=0;this._paragraph_textRuns_indices[this._paragraph_textRuns_indices.length]=this._textRuns_formats.length;for(var p=h=0,d=0,i=0;i<n;i++){l=!(u=c=0),t=this._textFormats[i];var _=this._width-(t.indent+t.leftMargin+t.rightMargin);if(t.font_table.initFontSize(t.size),(d=i==n-1?e.length:this._textFormatsIdx[i])>p){for(this._textRuns_formats[this._textRuns_formats.length]=t,this._textRuns_words[this._textRuns_words.length]=this.words.length,r=p;r<d;r++)(92==(o=e.charCodeAt(r))||10==o||13==o)&&(10==o||13==o||r<e.length-1)&&(a=e.charCodeAt(r+1),10==o||13==o||10==a||110==a||114==a||92==a&&r<e.length-2&&110==e.charCodeAt(r+2))?(this._textRuns_words[this._textRuns_words.length]=c,this._textRuns_words[this._textRuns_words.length]=h,this._textRuns_words[this._textRuns_words.length]=u,this._paragraph_textRuns_indices[this._paragraph_textRuns_indices.length]=this._textRuns_formats.length,this._textRuns_formats[this._textRuns_formats.length]=t,this._textRuns_words[this._textRuns_words.length]=this.words.length,r+=10==o||13==o?0:110==a||114==a?1:2,this.chars_codes[this.chars_codes.length]=55,this.chars_width[this.chars_width.length]=0,this.tf_per_char[this.tf_per_char.length]=t,l=!0,c=u=0,this._maxWidthLine<h&&(this._maxWidthLine=h),h=0):(this.chars_codes[this.chars_codes.length]=o,s=(this.tf_per_char[this.tf_per_char.length]=t).font_table.getCharWidth(o.toString()),32!=o&&9!=o&&r<d-1&&(s+=32==e.charCodeAt(r+1)||9==e.charCodeAt(r+1)?0:t.letterSpacing),h+=s,this.chars_width[this.chars_width.length]=s,l=32==o||9==o?(u++,this.words[this.words.length]=this.chars_codes.length-1,this.words[this.words.length]=0,this.words[this.words.length]=0,this.words[this.words.length]=s,this.words[this.words.length]=1,c++,!0):(this.multiline&&this._autoSize==TextFieldAutoSize.NONE&&this._wordWrap&&this.words[this.words.length-2]+s>=_&&(l=!0),l?(this.words[this.words.length]=this.chars_codes.length-1,this.words[this.words.length]=0,this.words[this.words.length]=0,this.words[this.words.length]=s,this.words[this.words.length]=1,c++):(this.words[this.words.length-2]+=s,this.words[this.words.length-1]++),!1));this._textRuns_words[this._textRuns_words.length]=c,this._textRuns_words[this._textRuns_words.length]=h,this._textRuns_words[this._textRuns_words.length]=u,this._maxWidthLine<h&&(this._maxWidthLine=h)}p=d}},tFc.prototype.adjustPositionForAutoSize=function(t){var e=this._width;this._width=4+t,this._autoSize==TextFieldAutoSize.RIGHT?(this._transform.matrix3D._rawData[12]-=this._width-e,this._transform.invalidatePosition()):this._autoSize==TextFieldAutoSize.CENTER&&(this._transform.matrix3D._rawData[12]-=(this._width-e)/2,this._transform.invalidatePosition())},tFc.prototype.getWordPositions=function(){var t,e,i=0,n=this._textRuns_formats.length,r=0,o=0,s=0,a=0,l=0,c=this._numLines=0,h=0,u=0,p=this.textOffsetY+2;this._autoSize!=TextFieldAutoSize.NONE&&!this._wordWrap&&this._textDirty&&(e=this._maxWidthLine+this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin,this.adjustPositionForAutoSize(e));var d=this._width-(this._textFormat.indent+this._textFormat.leftMargin+this._textFormat.rightMargin),_=0,f=this._paragraph_textRuns_indices.length,c=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;for(var m=[],g=[],_=this.lines_charIdx_end.length=0;_<f;_++){for(n=_==f-1?this._textRuns_formats.length:this._paragraph_textRuns_indices[_+1],s=0,m[m.length]=0,i=this._paragraph_textRuns_indices[_];i<n;i++)(t=this._textRuns_formats[i]).font_table.initFontSize(t.size),m[m.length-1]<t.font_table.getLineHeight()+t.leading&&(m[m.length-1]=t.font_table.getLineHeight()+t.leading),o=this._textRuns_words[4*i]+5*this._textRuns_words[4*i+1],s+=this._textRuns_words[4*i+2];this.lines_wordStartIndices[this.lines_wordStartIndices.length]=this._textRuns_words[4*this._paragraph_textRuns_indices[_]],this.lines_wordEndIndices[this.lines_wordEndIndices.length]=o,this.lines_width[this.lines_width.length]=0;var y=this.lines_numSpacesPerline[this.lines_numSpacesPerline.length]=0;this.lines_height[this.lines_height.length]=m[y],g[c]=t;for(var b=0,i=this._paragraph_textRuns_indices[_];i<n;i++)if((t=this._textRuns_formats[i]).font_table.initFontSize(t.size),l=t.indent,o=this._textRuns_words[4*i]+5*this._textRuns_words[4*i+1],!this.multiline||s<=d||!this.wordWrap)for(r=this._textRuns_words[4*i];r<o;r+=5)h+=u=this.words[r+3],this.lines_wordEndIndices[c]=r+5,this.lines_width[c]+=u,g[c]=t,32!=this.chars_codes[this.words[r]]&&9!=this.chars_codes[this.words[r]]||(this.lines_numSpacesPerline[c]+=1);else for(l=u=0,r=this._textRuns_words[4*i];r<o;r+=5){u=this.words[r+3];var v=!1;32!=this.chars_codes[this.words[r]]&&9!=this.chars_codes[this.words[r]]||(this.lines_numSpacesPerline[c]+=1,v=!0),v||this.lines_width[c]+u<=d-l-t.font_table.getCharWidth("32")||0==this.lines_width[c]?(this.lines_wordEndIndices[c]=r+5,this.lines_width[c]+=u,g[c]=t):(c++,this.lines_wordStartIndices[c]=r,this.lines_wordEndIndices[c]=r+5,this.lines_width[c]=u,this.lines_numSpacesPerline[c]=0,this.lines_height[this.lines_height.length]=m[y],l=(g[c]=t).indent)}y++,c++}var x,A,S,w,C,P=this.textOffsetX,E=this.lines_wordStartIndices.length,T=0;for(this._biggestLine=0,this._numLines=E,C=0;C<E;C++){h=this.lines_width[C],A=this.lines_height[C],x=this.lines_wordStartIndices[C],S=this.lines_wordEndIndices[C],this.lines_numSpacesPerline[C],t=g[C],w=d-h,P=this.textOffsetX+t.leftMargin+t.indent,t.align==TextFormatAlign.JUSTIFY?0!=C&&(P-=t.indent):t.align==TextFormatAlign.CENTER?P+=0<w?w/2:2:t.align==TextFormatAlign.RIGHT?P+=0<w?w-2:2:t.align==TextFormatAlign.LEFT&&(P+=2);var M=0,D=0,I=P;for(this.lines_start_x[C]=P,this.lines_start_y[C]=p,this.lines_charIdx_start[C]=T,b=0,r=x;r<S;r+=5){this.words[r+1]=P,I=0,M=(x=this.words[r])+this.words[r+4];var O=this.tf_per_char[x];O.font_table.initFontSize(O.size);var L=0<(L=A-(O.font_table.getLineHeight()+O.leading))?L-2:0;for(this.words[r+2]=p+L,D=x;D<M;D++)this.char_positions_x[this.char_positions_x.length]=P+I,this.char_positions_y[this.char_positions_y.length]=p+L,I+=this.chars_width[D],T++;P+=I,b+=I}this.lines_charIdx_end[C]=T,p+=A,a<b&&(this._biggestLine=C,a=b)}if(this._textWidth=a,this._textHeight=p,this.autoSize!=TextFieldAutoSize.NONE&&(this._height=this._textHeight+4),this._textWidth>this._width){x=this.lines_charIdx_start[this._biggestLine],D=this.lines_charIdx_end[this._biggestLine];for(var F=0;x<D;)if(D--,(F+=this.chars_width[D])>this._width){this._maxScrollH=D;break}}if(this._textHeight>this._height)for(var B=this.lines_height.length,F=4;0<B;)if(B--,(F+=this.lines_height[B])>this._height){this._maxScrollV=B+1;break}this.updateMaskMode()},tFc.prototype.buildGlyphsForLabelData=function(){this._clearTextShapes();for(var t,e,i=[],n=[],r=[],o=[],s=this.staticMatrix.tx/20,a=this.staticMatrix.ty/20,l=0,c=0;c<this._labelData.records.length;c++){i[c]=new TextFormat,n[c]=[],r[c]=[],(t=this._labelData.records[c]).font_table?i[c].font_table=t.font_table:0<c?i[c].font_table=i[c-1].font_table:console.log("error - no font for label"),t.fontHeight?i[c].size=t.fontHeight/20:0<c&&(i[c].size=i[c-1].size),t.color?i[c].color=ColorUtils.f32_RGBA_To_f32_ARGB(t.color):0<c&&(i[c].color=i[c-1].color),null!=t.moveY&&(l=a+=t.moveY/20-l),null!=t.moveX&&(s=this.staticMatrix.tx/20+t.moveX/20),o.push(s),o.push(a);for(var h=0;h<t.entries.length;h++)n[c][h]=t.entries[h].glyphIndex,r[c][h]=t.entries[h].advance/20,s+=t.entries[h].advance/20}for(var u,p=0,d=i.length,_=0,f=0,p=0;p<d;p++)i[p].font_table.initFontSize(i[p].size),f+=(u=i[p].font_table.buildTextLineFromIndices(this,i[p],o[2*p],o[2*p+1],n[p],r[p])).y,_=u.x>_?u.x:_;for(var m in this._textWidth=_,this._textHeight=f,this.targetGraphics=this._graphics,this.targetGraphics.clear(),this.drawBG(),(this.border||!this._background&&this._type!=TextFieldType.INPUT)&&this.drawBorder(),this.textShapes){e=this.textShapes[m];var g=new AttributesView(Float32Array,2);g.set(e.verts);var y=g.attributesBuffer.cloneBufferView();g.dispose(),e.elements=new TriangleElements(y),e.elements.setPositions(new Float2Attributes(y)),e.shape=this.targetGraphics.addShape(Shape.getShape(e.elements)),e.shape.usages++;var b,v,x,A=new ImageSampler;e.shape.style=new Style,e.format.material&&0==this._textColor?(e.shape.material=this._textFormat.material,e.shape.style.addSamplerAt(A,e.shape.material.getTextureAt(0)),e.shape.material.animateUVs=!0,e.shape.style.uvMatrix=new Matrix(0,0,0,0,e.format.uv_values[0],e.format.uv_values[1])):(b=this.getTextColorForTextFormat(e.format),0==(v=ColorUtils.float32ColorToARGB(b)[0])&&(v=255),x=MaterialManager.get_material_for_color(b,v/255),e.shape.material=x.material,x.colorPos&&(e.shape.style.addSamplerAt(A,e.shape.material.getTextureAt(0)),e.shape.material.animateUVs=!0,e.shape.style.uvMatrix=new Matrix(0,0,0,0,x.colorPos.x,x.colorPos.y)))}},tFc.prototype.buildGlyphs=function(){this._clearTextShapes();for(var t,e=this._textRuns_formats,i=this._textRuns_words,n=e.length,r=0;r<n;r++)e[r].font_table.initFontSize(e[r].size),e[r].font_table.fillTextRun(this,e[r],i[4*r],i[4*r+1]);for(var o in this.textShapes){t=this.textShapes[o];var s=this.getTextColorForTextFormat(t.format),a=ColorUtils.float32ColorToARGB(s)[0];0==a&&(a=255);var l=t.fntMaterial?4:2,c=new AttributesView(Float32Array,l);c.set(t.verts);var h=c.attributesBuffer.cloneBufferView();c.dispose(),t.elements=new TriangleElements(h),t.elements.setPositions(new Float2Attributes(h)),t.fntMaterial&&t.elements.setUVs(new Float2Attributes(h)),t.shape=Shape.getShape(t.elements),t.shape.usages++;var u,p=new ImageSampler(!1,!0,!0);t.shape.style=new Style,t.fntMaterial?(t.shape.material=t.fntMaterial,t.shape.style.addSamplerAt(p,t.shape.material.getTextureAt(0))):t.format.material&&0==this._textColor?(t.shape.material=this._textFormat.material,t.shape.style.addSamplerAt(p,t.shape.material.getTextureAt(0)),t.shape.material.animateUVs=!0,t.shape.style.uvMatrix=new Matrix(0,0,0,0,t.format.uv_values[0],t.format.uv_values[1])):(u=MaterialManager.get_material_for_color(s,a/255),t.shape.material=u.material,u.colorPos&&(t.shape.style.addSamplerAt(p,t.shape.material.getTextureAt(0)),t.shape.material.animateUVs=!0,t.shape.style.uvMatrix=new Matrix(0,0,0,0,u.colorPos.x,u.colorPos.y)))}},tFc.prototype.buildShapes=function(){var t;for(var e in this.targetGraphics?this._graphics.clear():this.targetGraphics=this._graphics,this.targetGraphics.clear(),this.drawBG(),!this._border&&this._background||this.drawBorder(),this.drawSelectionGraphics(),this.bgShapeSelect&&this.isInFocus&&this.showSelection&&this.targetGraphics.addShape(this.bgShapeSelect),this.textShapes)t=this.textShapes[e],this.targetGraphics.addShape(t.shape);this.type===TextFieldType.INPUT&&this.isInFocus&&this.cursorShape&&!this.cursorBlinking&&this.targetGraphics.addShape(this.cursorShape)},tFc.prototype.appendText=function(t){t.length&&(this._iText+=t,this._textDirty=!0,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this))},tFc.prototype.closeParagraph=function(){this._iText+="\n",this._textDirty=!0,this._autoSize!=TextFieldAutoSize.NONE?this.invalidate():this._implicitPartition&&this._implicitPartition.invalidateEntity(this)},tFc.prototype.getCharBoundaries=function(t){return console.log("Textfield.getCharBoundaries() not implemented"),this._charBoundaries},tFc.prototype.getCharIndexAtPoint=function(t,e,i){void 0===i&&(i=-1),i<0&&(i=this.getLineIndexAtPoint(t,e));for(var n=this.lines_charIdx_start[i],r=this.lines_charIdx_end[i],o=n;o<r;o++)if(t>=this.char_positions_x[o]){if(t<=this.char_positions_x[o]+this.chars_width[o]/2)return o;if(t<=this.char_positions_x[o]+this.chars_width[o])return o+1}return-1},tFc.prototype.getFirstCharInParagraph=function(t){return console.log("Textfield.getFirstCharInParagraph() not implemented"),this._firstCharInParagraph},tFc.prototype.getImageReference=function(t){return console.log("TextField.getImageReference() not implemented"),this._imageReference},tFc.prototype.getLineIndexAtPoint=function(t,e){for(var i=this.lines_start_y.length,n=0;n<i-1;n++)if(e>=this.lines_start_y[n]&&e<=this.lines_start_y[n+1])return n;return e>=this.lines_start_y[i-1]?i-1:0},tFc.prototype.getLineIndexOfChar=function(t){for(var e,i=this.lines_charIdx_start.length-1;e<i;e++)if(t>=this.lines_charIdx_start[e]&&t<=this.lines_charIdx_end[e+1])return e;return i},tFc.prototype.getLineLength=function(t){return 0==this.lines_width.length?0:t>=this.lines_width.length?this.lines_width[this.lines_width.length-1]:this.lines_width[t]},tFc.prototype.getLineMetrics=function(t){var e=new TextLineMetrics;return this.lines_width.length&&(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]),e},tFc.prototype.getLineOffset=function(t){return 0==this.lines_charIdx_start.length?0:t>=this.lines_charIdx_start.length?this.lines_charIdx_start[this.lines_charIdx_start.length-1]:this.lines_charIdx_start[t]},tFc.prototype.getLineText=function(t){return 0==this.lines_charIdx_start.length?"":(t>=this.lines_width.length&&(t=this.lines_width.length-1),this._iText.slice(this.lines_charIdx_start[t],this.lines_charIdx_end[t]))},tFc.prototype.getParagraphLength=function(t){return this._paragraphLength},tFc.prototype.getTextFormat=function(t,e){return void 0===t&&(t=-1),void 0===e&&(e=-1),(0<=t||0<=e)&&console.warn("Textfield.getTextFormat() not correctly implemented for multi-formatted text"),this._textFormat},tFc.prototype.replaceSelectedText=function(t){var e=this._selectionBeginIndex,i=this._selectionEndIndex;if(i!=e){i<e&&(e=this._selectionEndIndex,i=this._selectionBeginIndex);var n=this._iText.slice(0,e-1),r=this._iText.slice(i,this._iText.length);return this.text=n+t+r,this._selectionBeginIndex=e,void(this._selectionEndIndex=this._selectionBeginIndex+t.length)}n=this._iText.slice(0,e),r=this._iText.slice(i,this._iText.length),this.text=n+t+r,this._selectionBeginIndex=e+1,this._selectionEndIndex=this._selectionBeginIndex},tFc.prototype.replaceText=function(t,e,i){var n=this._iText.slice(0,t-1),r=this._iText.slice(e,this._iText.length);this.text=n+i+r,this._selectionEndIndex=this._selectionBeginIndex+i.length},tFc.prototype.setSelection=function(t,e){this._selectionBeginIndex==t&&this._selectionBeginIndex==e||(this._selectionBeginIndex=t,this._selectionEndIndex=e,this._glyphsDirty=!0,this.reConstruct(),this.drawSelectionGraphics())},tFc.prototype.setTextFormat=function(t,e,i){if(void 0===e&&(e=-1),void 0===i&&(i=-1),this._textDirty&&this.reConstruct(),0!=this.chars_codes.length&&t)if(-1==e&&-1==i||0==e&&-1==i||(-1==e||0==e)&&i>=this.chars_codes.length)for(var n=this._textFormats.length,r=0;r<n;r++)(this._textFormats[r]=this._textFormats[r].clone()).updateID,t.applyToFormat(this._textFormats[r]);else{var o,s,a=0,l=[],c=[],h=0,u=-1,p=this._textFormats.length,d=this.chars_codes.length;-1==e&&(e=0),-1==i&&(i=d),i<e&&(s=i,i=e,e=s),i==e&&i++;for(var _=0;_<p;_++)if(0<_&&(h=u),u=this._textFormatsIdx[_],o=this._textFormats[_],h<=e&&e<u){for(h<e&&(l.push(o),c.push(e));u<i;){var f=this._textFormats[_].clone();t.applyToFormat(f),l.push(f),c.push(u),++_<p?(u=this._textFormatsIdx[_],o=this._textFormats[_]):u=i+1}u==i&&(f=o.clone(),t.applyToFormat(f),l.push(f),c.push(i)),i<u&&(f=o.clone(),t.applyToFormat(f),l.push(f),c.push(i),l.push(o),c.push(u))}else l.push(this._textFormats[_]),c.push(this._textFormatsIdx[_]);for(this._textFormats.length=0,a=this._textFormatsIdx.length=0;a<l.length;a++)this._textFormats[a]=l[a],this._textFormatsIdx[a]=c[a];this._textDirty=!0}},tFc.isFontCompatible=function(t,e){return!1},tFc.prototype.onKey=function(t){this.addChar(t.char,t.isShift,t.isCTRL,t.isAlt)},tFc.prototype.addCharCode=function(t){this.addChar(String.fromCharCode(t))},tFc.prototype.deleteSelectedText=function(t){if(void 0===t&&(t="Backspace"),0!=this.text.length){if(this._selectionBeginIndex!=this._selectionEndIndex){var e=0!=this._selectionBeginIndex?this._iText.slice(0,this._selectionBeginIndex):"",i=this._selectionEndIndex<this._iText.length?this._iText.slice(this._selectionEndIndex,this._iText.length):"";return this.text=e+i,void(this._selectionEndIndex=this._selectionBeginIndex)}if("Backspace"==t){if(0==this._selectionBeginIndex)return;e=this._iText.slice(0,this._selectionBeginIndex-1),i=this._iText.slice(this._selectionEndIndex,this._iText.length),this.text=e+i,--this._selectionBeginIndex,this._selectionEndIndex=this._selectionBeginIndex}else"Delete"==t&&(e=this._iText.slice(0,this._selectionBeginIndex),i=this._iText.slice(this._selectionEndIndex+1,this._iText.length),this.text=e+i,this._selectionEndIndex=this._selectionBeginIndex)}},tFc.prototype.addChar=function(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=!1);var r,o,s=this._iText;if(this._selectionBeginIndex||(this._selectionBeginIndex=0),this._selectionEndIndex||(this._selectionEndIndex=0),this._selectionEndIndex<this._selectionBeginIndex&&(r=this._selectionEndIndex,this._selectionEndIndex=this._selectionBeginIndex,this._selectionBeginIndex=r),"Backspace"==t||"Delete"==t)this.deleteSelectedText(t);else if("ArrowRight"==t)e||this._selectionEndIndex==this._selectionBeginIndex?this._selectionEndIndex>this._selectionBeginIndex?(this._selectionEndIndex+=1,e||(this._selectionBeginIndex=this._selectionEndIndex)):(this._selectionBeginIndex+=1,e||(this._selectionEndIndex=this._selectionBeginIndex)):this._selectionEndIndex>this._selectionBeginIndex?this._selectionBeginIndex=this._selectionEndIndex:this._selectionEndIndex=this._selectionBeginIndex;else if("ArrowLeft"==t)e||this._selectionEndIndex==this._selectionBeginIndex?this._selectionEndIndex>this._selectionBeginIndex?(--this._selectionBeginIndex,e||(this._selectionEndIndex=this._selectionBeginIndex)):(--this._selectionEndIndex,e||(this._selectionBeginIndex=this._selectionEndIndex)):this._selectionEndIndex>this._selectionBeginIndex?this._selectionEndIndex=this._selectionBeginIndex:this._selectionBeginIndex=this._selectionEndIndex;else if("Enter"==t&&this.multiline)this._insertNewText("\n");else if(1==t.length){if(this._restrictRegex){var a,l,c=t.replace(this._restrictRegex,"");if(c.length<t.length&&(a=t.toUpperCase().replace(this._restrictRegex,""),l=t.toLowerCase().replace(this._restrictRegex,""),(t=a).length<l.length&&(t=l),c.length>t.length&&(t=c)),""==t)return}if(this.newTextFormat.font_table){var h=this.newTextFormat.font_table,u=t.charCodeAt(0).toString();if(!(h.hasChar(u)||h.hasChar(u.toLowerCase())||h.hasChar(u.toUpperCase())))return void console.log("Char not found",u)}this._insertNewText(t)}else 1<t.length&&console.log("invalid keyboard input: ",t);if(this._glyphsDirty=!0,this.reConstruct(),this.drawSelectionGraphics(),this.invalidate(),s!==this._iText&&this.dispatchEvent(tFc._onChangedEvent),t&&0<t.length&&this.adapter!=this){switch(t){case"Backspace":o=8;break;case"Delete":o=46;break;case"ArrowRight":o=39;break;case"ArrowLeft":o=37;break;case".":o=189;break;default:o=t.charCodeAt(0)}this.adapter.dispatchKeyEvent(o,e,i,n)}},tFc.prototype._insertNewText=function(t){var e,i,n;this._selectionBeginIndex!=this._selectionEndIndex?(e=this._iText.slice(0,this._selectionBeginIndex),i=this._iText.slice(this._selectionEndIndex,this._iText.length),0<this.maxChars&&e.length+i.length+t.length>this.maxChars&&0<(n=this.maxChars-e.length+i.length)&&(t=t.slice(0,n)),this.text=e+t+i,this._selectionBeginIndex+=1,this._selectionEndIndex=this._selectionBeginIndex):0<this.maxChars&&this._iText.length>=this.maxChars||(e=this._iText.slice(0,this._selectionBeginIndex),i=this._iText.slice(this._selectionEndIndex,this._iText.length),this.text=e+t+i,this._selectionBeginIndex+=1,this._selectionEndIndex=this._selectionBeginIndex)},tFc.prototype.clone=function(){var t=tFc.getNewTextField();return this.copyTo(t),t},tFc.prototype.copyTo=function(t){sFc.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,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,t.html?t.htmlText=this.htmlText:t.text=this.text,this._labelData&&t.setLabelData(this._labelData)},tFc.prototype._clearTextShapes=function(){var t;for(var e in this.targetGraphics&&this.targetGraphics.clear(),this.textShapes)(t=this.textShapes[e]).shape.dispose(),t.shape=null,t.elements=null,t.verts.length=0,delete this.textShapes[e]},tFc._textFields=[],tFc.assetType="[asset TextField]",tFc._onChangedEvent=new TextfieldEvent(TextfieldEvent.CHANGED),tFc),sFc,QEc,NEc,HEc,PDc,NAc;function tFc(){var e=sFc.call(this)||this;return e._isEntity=!1,e.textOffsetX=0,e.textOffsetY=0,e._selectionBeginIndex=0,e._selectionEndIndex=0,e._biggestLine=0,e._iText="",e._text="",e.inMaskMode=!1,e.cursorIntervalID=-1,e.cursorBlinking=!1,e.showSelection=!1,e._textDirty=!1,e._positionsDirty=!1,e._glyphsDirty=!1,e._shapesDirty=!1,e.chars_codes=[],e.chars_width=[],e.tf_per_char=[],e.words=[],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=!1,e._internalScale=new 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._onGraphicsInvalidateDelegate=function(t){return e._onGraphicsInvalidate(t)},e.cursorIntervalID=-1,e._tabEnabled=!0,e.cursorType="text",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=TextFieldType.DYNAMIC,e._selectable=!1,e._numLines=0,e.multiline=!1,e._autoSize=TextFieldAutoSize.NONE,e._wordWrap=!1,e._background=!1,e._backgroundColor=16777215,e._border=!1,e._borderColor=0,e.html=!1,e.maxChars=0,e._selectionBeginIndex=0,e._selectionEndIndex=0,e._graphics=Graphics.getGraphics(),e._graphics.addEventListener(AssetEvent.INVALIDATE,e._onGraphicsInvalidateDelegate),e.mouseEnabled=e._selectable,e}function UEc(){}function REc(){return null!==QEc&&QEc.apply(this,arguments)||this}function OEc(t){return NEc.call(this,t)||this}function IEc(t,e,i){void 0===i&&(i=0);var n=HEc.call(this,t)||this;return n._char=e,n._charCode=i,n.isShift=!1,n.isCTRL=!1,n.isAlt=!1,n}function QDc(t,e,i,n,r,o,s,a,l,c,h,u,p){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===h&&(h=null),void 0===u&&(u=null),void 0===p&&(p=null);var d=PDc.call(this)||this;return d._updateID=0,d.tabStops=[],d._align=l,d._leftMargin=c,d._rightMargin=h,d._indent=u,d._font_name=t,d._size=e,d._color=i,d._bold=n,d._italic=r,d._underline=o,d._leading=p,d._letterSpacing=null,d.url=s,d.link_target=a,d._font=null,d._font_table=null,d._style_name=FontStyleName.STANDART,d}function ODc(){}function NDc(){}function MDc(){}function LDc(){}function OAc(t){void 0===t&&(t=null);var e=NAc.call(this)||this;if(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=!1,e._glyphIdxToChar={},e._fnt_channels=[],e.vertical_glyph_offset=0,e._font_em_size=32,e._whitespace_width=14,t){e._opentype_font=t,e._font_em_size=72,e._ascent=t.tables.hhea.ascender/(e._opentype_font.unitsPerEm/72),e._descent=t.tables.hhea.descender/(e._opentype_font.unitsPerEm/72)-2,e._current_size=0,e._size_multiply=0;var i=e._opentype_font.charToGlyph(String.fromCharCode(32));return i&&(e._whitespace_width=i.advanceWidth/(e._opentype_font.unitsPerEm/72)),e}return e}PartitionBase.registerAbstraction(EntityNode,TextField);var MovieClip=(bKc=Sprite,__extends(cKc,bKc),cKc.getNewMovieClip=function(t){if(void 0===t&&(t=null),cKc._movieClips.length){var e=cKc._movieClips.pop();return e.timeline=t||new Timeline,e.graphics=Graphics.getGraphics(),e}return new cKc(t)},cKc.clearPool=function(){cKc._movieClips=[]},cKc.prototype.initSoundStream=function(t,e){this._soundStreams||(this._soundStreams=new cKc.movieClipSoundsManagerClass(this)),this._soundStreams.initSoundStream(t,e)},cKc.prototype.addSoundStreamBlock=function(t,e){this._soundStreams||(this._soundStreams=new cKc.movieClipSoundsManagerClass(this)),this._soundStreams.addSoundStreamBlock(t,e)},cKc.prototype.stopCurrentStream=function(t){if(this._soundStreams)return this._soundStreams.stopStream(t)},cKc.prototype.resetStreamStopped=function(){this._soundStreams&&this._soundStreams.resetStreamStopped()},cKc.prototype._syncSounds=function(t){return this._soundStreams?this._soundStreams.syncSounds(t,this._isPlaying,this.parent):0},cKc.prototype.startSound=function(t,e,i){this._sounds[t]&&this._sounds[t].stop(),e.loopsToPlay=i,e.play(0,!1),this._sounds[t]=e,cKc._activeSounds[t]||(cKc._activeSounds[t]=[]),cKc._activeSounds[t].push(e)},cKc.prototype.stopSounds=function(t){if(void 0===t&&(t=null),t)this._sounds[t]&&(this._sounds[t].stop(),delete this._sounds[t]);else{for(var e in this._sounds)this._sounds[e].stop();this._sounds={}}for(var i,n=this._children.length,r=0;r<n;++r)(i=this._children[r]).isAsset(cKc)&&i.stopSounds(t);this.stopCurrentStream(this._currentFrameIndex),cKc._activeSounds={},this._soundStreams&&this._soundStreams.syncSounds(0,!1,this.parent)},Object.defineProperty(cKc.prototype,"isPlaying",{get:function(){return this._isPlaying},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"soundVolume",{get:function(){return this._soundVolume},set:function(t){if(this._soundVolume!=t){for(var e in this._soundVolume=t,this._sounds)this._sounds[e].volume=t;for(var i,n=this._children.length,r=0;r<n;++r)(i=this._children[r]).isAsset(cKc)&&(i.soundVolume=t)}},enumerable:!0,configurable:!0}),cKc.prototype.stopSound=function(t){if(this._sounds[t]&&(this._sounds[t].stop(),delete this._sounds[t]),cKc._activeSounds[t]){for(var e=0;e<cKc._activeSounds[t].length;e++)cKc._activeSounds[t][e].stop();delete cKc._activeSounds[t]}},cKc.prototype.buttonReset=function(){this._isButton&&!this.buttonEnabled&&(this.currentFrameIndex=0)},cKc.prototype.getMouseCursor=function(){return"scene"!=this.name&&this._useHandCursor&&this.buttonMode?this.cursorType:"initial"},cKc.prototype.registerScriptObject=function(t){(this[t.name]=t).isAsset(cKc)&&t.removeButtonListeners()},cKc.prototype.unregisterScriptObject=function(t){delete this[t.name],t.isAsset(cKc)&&t.removeButtonListeners()},cKc.prototype.dispose=function(){this.disposeValues(),cKc._movieClips.push(this)},cKc.prototype.disposeValues=function(){bKc.prototype.disposeValues.call(this),this._potentialInstances={},this._depth_sessionIDs={},this._sessionID_childs={},this._timeline=null},cKc.prototype.reset_textclones=function(){if(this.timeline)for(var t in this._potentialInstances)null!=this._potentialInstances[t]&&(this._potentialInstances[t].isAsset(TextField)?this._potentialInstances[t].text=this.timeline.getPotentialChildPrototype(parseInt(t)).text:this._potentialInstances[t].isAsset(cKc)&&this._potentialInstances[t].reset_textclones())},Object.defineProperty(cKc.prototype,"useHandCursor",{get:function(){return this._useHandCursor},set:function(t){this._useHandCursor=t},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"buttonMode",{get:function(){return this._buttonMode},set:function(t){this._buttonMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"isButton",{get:function(){return this._isButton},set:function(t){this._isButton=t},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"isInit",{get:function(){return this._isInit},set:function(t){this._isInit=t},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"timeline",{get:function(){return this._timeline},set:function(t){this._timeline!=t&&(this._timeline=t,this.reset(!1))},enumerable:!0,configurable:!0}),Object.defineProperty(cKc.prototype,"numFrames",{get:function(){return this._timeline.numFrames},enumerable:!0,configurable:!0}),cKc.prototype.jumpToLabel=function(t,e){void 0===e&&(e=0),this._timeline.jumpToLabel(this,t,e)},cKc.prototype.reset=function(t){void 0===t&&(t=!0),bKc.prototype.reset.call(this),this.resetStreamStopped(),this._time=0,this._adapter&&this.adapter.freeFromScript(),this.constructedKeyFrameIndex=-1;for(var e,i=this.numChildren-1;0<=i;i--)this.removeChildAt(i);this.graphics.clear(),t&&(e=this._timeline.keyframe_indices.length,this._isPlaying=Boolean(1<e),e?(this._currentFrameIndex=0,this._timeline.constructNextFrame(this,t&&!this.doingSwap&&!this.preventScript,!0)):this._currentFrameIndex=-1),this._skipAdvance=!0},cKc.prototype.resetSessionIDs=function(){this._depth_sessionIDs={}},Object.defineProperty(cKc.prototype,"currentFrameIndex",{get:function(){return this._currentFrameIndex},set:function(t){var e=!0,i=this._timeline.keyframe_indices.length;this.resetStreamStopped(),i&&(t<0?t=0:i<=t&&(t=i-1,e=!1),this._skipAdvance=!1,this._currentFrameIndex!=t&&(this._currentFrameIndex=t,this._timeline.gotoFrame(this,t,e,!1,!0)))},enumerable:!0,configurable:!0}),cKc.prototype.addButtonListeners=function(){this._isButton=!0,this.stop(),this.addEventListener(MouseEvent$1.MOUSE_OVER,this._onMouseOver),this.addEventListener(MouseEvent$1.MOUSE_OUT,this._onMouseOut),this.addEventListener(MouseEvent$1.MOUSE_DOWN,this._onMouseDown),this.addEventListener(MouseEvent$1.MOUSE_UP,this._onMouseUp),this.addEventListener(MouseEvent$1.DRAG_OVER,this._onDragOver),this.addEventListener(MouseEvent$1.DRAG_OUT,this._onDragOut),this.mouseChildren=!1},cKc.prototype.removeButtonListeners=function(){this.removeEventListener(MouseEvent$1.MOUSE_OVER,this._onMouseOver),this.removeEventListener(MouseEvent$1.MOUSE_OUT,this._onMouseOut),this.removeEventListener(MouseEvent$1.MOUSE_DOWN,this._onMouseDown),this.removeEventListener(MouseEvent$1.MOUSE_UP,this._onMouseUp),this.removeEventListener(MouseEvent$1.DRAG_OVER,this._onDragOver),this.removeEventListener(MouseEvent$1.DRAG_OUT,this._onDragOut)},cKc.prototype.getChildAtSessionID=function(t){return this._sessionID_childs[t]},cKc.prototype.getSessionIDDepths=function(){return this._depth_sessionIDs},cKc.prototype.swapChildrenAt=function(t,e){var i=this._children[e]._depthID,n=this._children[t];this.doingSwap=!0,this.addChildAtDepth(this._children[e],this._children[t]._depthID),this.addChildAtDepth(n,i),this._depth_sessionIDs[i]=n._sessionID,this._depth_sessionIDs[this._children[t]._depthID]=this._children[e]._sessionID,this.doingSwap=!1},cKc.prototype.swapDepths=function(t,e){var i=this.getChildAtDepth(e),n=t._depthID;n!=e&&(delete this._depth_sessionIDs[n],this._depth_sessionIDs[e]=t._sessionID,this.doingSwap=!0,bKc.prototype.removeChildAtDepth.call(this,n),i&&(bKc.prototype.removeChildAtDepth.call(this,e),bKc.prototype.addChildAtDepth.call(this,i,n)),bKc.prototype.addChildAtDepth.call(this,t,e),this.doingSwap=!1)},cKc.prototype._addTimelineChildAt=function(t,e,i){this._depth_sessionIDs[e]=t._sessionID=i,t.addedByTimeline=!0,t.adapter!=t&&t.adapter.deleteOwnProperties&&t.adapter.deleteOwnProperties(),this.doingSwap||t.reset(),t.just_added_to_timeline=!0;var n=this.addChildAtDepth(t,e);return this._sessionID_childs[i]=t,n},cKc.prototype.finalizeTimelineConstruction=function(){FrameScriptManager.queue_as3_constructor(this)},cKc.prototype.removeChildAtInternal=function(t){var e=this._children[t];return this.doingSwap||(e._adapter&&e.adapter.freeFromScript(),this.adapter.unregisterScriptObject(e)),delete this._sessionID_childs[e._sessionID],this.doingSwap?e._sessionID=-2:e._sessionID=-1,e.adapter&&e.adapter.dispatchStaticEvent&&e.adapter.dispatchStaticEvent("removed",e.adapter),this.isOnDisplayList()&&e.adapter.dispatch_REMOVED_FROM_STAGE&&e.adapter.dispatch_REMOVED_FROM_STAGE(e),bKc.prototype.removeChildAtInternal.call(this,t)},Object.defineProperty(cKc.prototype,"assetType",{get:function(){return cKc.assetType},enumerable:!0,configurable:!0}),cKc.prototype.play=function(){1<this._timeline.keyframe_indices.length&&(this._isPlaying=!0)},cKc.prototype.update=function(t){this.advanceFrame()},cKc.prototype.getPotentialChildInstance=function(t,e,i){return void 0===i&&(i=!1),(!this._potentialInstances[t]||-2==this._potentialInstances[t]._sessionID||this._potentialInstances[t].cloneForEveryInstance&&i)&&(this._potentialInstances[t]=this._timeline.getPotentialChildInstance(t,e)),this._timeline.initChildInstance(this._potentialInstances[t],e),this._potentialInstances[t]},cKc.prototype.stop=function(){this.resetStreamStopped(),this._isPlaying=!1},cKc.prototype.clone=function(){var t=cKc.getNewMovieClip(this._timeline);return this.copyTo(t),t},cKc.prototype.copyTo=function(t){bKc.prototype.copyTo.call(this,t),t.loop=this.loop,t._soundStreams=this._soundStreams,t.symbolID=this.symbolID},cKc.prototype.advanceFrameInternal=function(){var t;this._timeline&&0<this._timeline.numFrames&&this._isPlaying&&!this._skipAdvance&&(this._currentFrameIndex==this._timeline.keyframe_indices.length-1?this.loop?0==this._currentFrameIndex||(this._currentFrameIndex=0,this.resetStreamStopped(),this._timeline.gotoFrame(this,0,!0,!0,!0)):this._isPlaying=!1:(this._currentFrameIndex++,this._timeline.constructNextFrame(this)));for(var e=0;e<this._children.length;e++)(t=this._children[e])&&t.isAsset(cKc)&&t.advanceFrame(),t&&t.isAsset(Sprite)&&t.numChildren&&t.adapter.advanceFrame&&t.adapter.advanceFrame();this._skipAdvance=!1},cKc.prototype.advanceFrame=function(){for(0==this._skipFramesForStream&&this.advanceFrameInternal(),this._skipFramesForStream=this._syncSounds(this._currentFrameIndex);0<this._skipFramesForStream;)FrameScriptManager.execute_queue(),this.advanceFrameInternal(),this._skipFramesForStream=this._syncSounds(this._currentFrameIndex)},cKc.prototype.logHierarchy=function(t){void 0===t&&(t=0),this.printHierarchyName(t,this);for(var e,i=this._children.length,n=0;n<i;n++)(e=this._children[n]).isAsset(cKc)?e.logHierarchy(t+1):this.printHierarchyName(t+1,e)},cKc.prototype.printHierarchyName=function(t,e){for(var i="",n=0;n<t;++n)i+="--";i+=" "+e.name+" = "+e.id,console.log(i)},cKc.prototype.clear=function(){for(var t in this.resetStreamStopped(),this._potentialInstances){var e=this._potentialInstances[t];e&&!e.name&&(e.isAsset(Sprite)||FrameScriptManager.add_child_to_dispose(e),delete this._potentialInstances[t])}bKc.prototype.clear.call(this)},cKc.avm1ScriptQueue=[],cKc.avm1ScriptQueueScripts=[],cKc.avm1LoadedActions=[],cKc.movieClipSoundsManagerClass=null,cKc._movieClips=new Array,cKc._activeSounds={},cKc.assetType="[asset MovieClip]",cKc),bKc;function cKc(t){void 0===t&&(t=null);var e=bKc.call(this)||this;return e.symbolID=0,e.preventScript=!1,e._buttonMode=!1,e._isButton=!1,e._time=0,e._currentFrameIndex=-1,e._isPlaying=!0,e._isInit=!0,e._potentialInstances={},e._depth_sessionIDs={},e._sessionID_childs={},e._sounds={},e._skipFramesForStream=0,e.buttonEnabled=!0,e.loop=!0,e.constructedKeyFrameIndex=-1,e._soundVolume=1,e._parentSoundVolume=1,e.doingSwap=!1,e._isButton=!1,e._buttonMode=!1,e._useHandCursor=!0,e.cursorType="pointer",e.inheritColorTransform=!0,e._onMouseOver=function(t){e.buttonEnabled?e.currentFrameIndex=1:e.currentFrameIndex=0},e._onMouseOut=function(t){e.currentFrameIndex=0},e._onMouseDown=function(t){e.buttonEnabled?e.currentFrameIndex=2:e.currentFrameIndex=0},e._onMouseUp=function(t){e.currentFrameIndex=0==e.currentFrameIndex?0:1},e._onDragOver=function(t){e.buttonEnabled?e.currentFrameIndex=2:e.currentFrameIndex=0},e._onDragOut=function(t){e.currentFrameIndex=1},e._timeline=t||new Timeline,e}PartitionBase.registerAbstraction(EntityNode,MovieClip);var SimpleButton=(DLc=Sprite,__extends(ELc,DLc),Object.defineProperty(ELc.prototype,"downState",{get:function(){return this._downState},set:function(t){this._downState=t},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"enabled",{get:function(){return this._enabled},set:function(t){this.enabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"hitTestState",{get:function(){return this._hitTestState},set:function(t){this._hitTestState=t},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"overState",{get:function(){return this._overState},set:function(t){this._overState=t},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"soundTransform",{get:function(){return console.log("soundTransform not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("soundTransform not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"trackAsMenu",{get:function(){return console.log("trackAsMenu not implemented yet in flash/SimpleButton"),!1},set:function(t){console.log("trackAsMenu not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"upState",{get:function(){return this._upState},set:function(t){this._upState=t},enumerable:!0,configurable:!0}),Object.defineProperty(ELc.prototype,"useHandCursor",{get:function(){return console.log("useHandCursor not implemented yet in flash/SimpleButton"),!1},set:function(t){console.log("useHandCursor not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),ELc),SkyboxElements=(RLc=TriangleElements,__extends(SLc,RLc),Object.defineProperty(SLc.prototype,"assetType",{get:function(){return SLc.assetType},enumerable:!0,configurable:!0}),SLc.assetType="[asset SkyboxElements]",SLc),_Render_SkyboxElements=(TLc=_Render_ElementsBase,__extends(ULc,TLc),ULc.prototype._includeDependencies=function(t){},ULc.prototype._getVertexCode=function(t,e,i){var n="",r=0<t.globalPosDependencies?i.globalPositionVertex:i.animatedPosition,o=e.getFreeVertexConstant();e.getFreeVertexConstant(),e.getFreeVertexConstant(),e.getFreeVertexConstant(),t.viewMatrixIndex=4*o.index;var s=e.getFreeVertexConstant();t.scenePositionIndex=4*s.index;var a=e.getFreeVertexConstant(),l=e.getFreeVertexVectorTemp();return n+="mul "+l+", "+r+", "+a+"\nadd "+l+", "+l+", "+s+"\n",0<t.projectionDependencies?(i.projectionFragment=e.getFreeVarying(),n+="m44 "+l+", "+l+", "+o+"\nmov "+i.projectionFragment+", "+l+"\nmov op, "+l+"\n"):n+="m44 op, "+l+", "+o+"\n",n},ULc.prototype._getFragmentCode=function(t,e,i){return""},ULc),_Stage_SkyboxElements=(gMc=_Stage_TriangleElements,__extends(hMc,gMc),hMc.prototype.draw=function(t,e,i,n){var r=e.scenePositionIndex,o=e.view.projection.transform.concatenatedMatrix3D.position;e.vertexConstantData[r++]=2*o.x,e.vertexConstantData[r++]=2*o.y,e.vertexConstantData[r++]=2*o.z,e.vertexConstantData[r++]=1,e.vertexConstantData[r++]=e.vertexConstantData[r++]=e.vertexConstantData[r++]=e.view.projection.far/Math.sqrt(3),e.vertexConstantData[r]=1;var s=new Vector3D;this._skyboxProjection.copyFrom(e.view.viewMatrix3D),this._skyboxProjection.copyRowTo(2,s);var a=s.x,l=s.y,c=s.z,h=-(s.x*o.x+s.y*o.y+s.z*o.z+Math.sqrt(a*a+l*l+c*c)),u=new Vector3D(0<=a?1:-1,0<=l?1:-1,1,1),p=this._skyboxProjection.clone();p.invert();var d=p.transformVector(u);this._skyboxProjection.copyRowTo(3,u);var _=(d.x*u.x+d.y*u.y+d.z*u.z+d.w*u.w)/(a*d.x+l*d.y+c*d.z+h*d.w);this._skyboxProjection.copyRowFrom(2,new Vector3D(a*_,l*_,c*_,h*_)),0<=e.sceneMatrixIndex&&e.sceneMatrix.copyFrom(t.renderSceneTransform,!0),e.viewMatrix.copyFrom(this._skyboxProjection,!0);var f=this._stage.context;f.setProgramConstantsFromArray(ContextGLProgramType.VERTEX,e.vertexConstantData),f.setProgramConstantsFromArray(ContextGLProgramType.FRAGMENT,e.fragmentConstantData),this._indices?this.getIndexBufferGL().draw(ContextGLDrawMode.TRIANGLES,0,this.numIndices):this._stage.context.drawVertices(ContextGLDrawMode.TRIANGLES,n,i||this.numVertices)},hMc),gMc,TLc,RLc,DLc;function hMc(){var t=null!==gMc&&gMc.apply(this,arguments)||this;return t._skyboxProjection=new Matrix3D,t}function ULc(){return null!==TLc&&TLc.apply(this,arguments)||this}function SLc(){return null!==RLc&&RLc.apply(this,arguments)||this}function ELc(t,e,i,n){return DLc.call(this)||this}RenderGroup.registerElements(_Render_SkyboxElements,SkyboxElements),Stage.registerAbstraction(_Stage_SkyboxElements,SkyboxElements);var Skybox=(zMc=DisplayObject,__extends(AMc,zMc),Object.defineProperty(AMc.prototype,"animationSet",{get:function(){return this._animationSet},enumerable:!0,configurable:!0}),Object.defineProperty(AMc.prototype,"blendMode",{get:function(){return this._pBlendMode},set:function(t){this._pBlendMode!=t&&(this._pBlendMode=t,this.invalidate())},enumerable:!0,configurable:!0}),Object.defineProperty(AMc.prototype,"iOwners",{get:function(){return this._owners},enumerable:!0,configurable:!0}),Object.defineProperty(AMc.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!=t&&(this._texture&&this.removeTexture(this._texture),this._texture=t,this._texture&&this.addTexture(this._texture),this.invalidatePasses())},enumerable:!0,configurable:!0}),AMc.prototype.getNumTextures=function(){return this._textures.length},AMc.prototype.getTextureAt=function(t){return this._textures[t]},AMc.prototype.isEntity=function(){return!0},Object.defineProperty(AMc.prototype,"assetType",{get:function(){return AMc.assetType},enumerable:!0,configurable:!0}),AMc.prototype.invalidatePasses=function(){this.dispatchEvent(new MaterialEvent(MaterialEvent.INVALIDATE_PASSES,this))},AMc.prototype.invalidateElements=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_ELEMENTS,this))},AMc.prototype.invalidateMaterial=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_MATERIAL,this))},AMc.prototype.invalidateStyle=function(){this.dispatchEvent(new RenderableEvent(RenderableEvent.INVALIDATE_STYLE,this))},AMc.prototype.addTexture=function(t){this._textures.push(t),t.addEventListener(AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate),this.onTextureInvalidate()},AMc.prototype.removeTexture=function(t){this._textures.splice(this._textures.indexOf(t),1),t.removeEventListener(AssetEvent.INVALIDATE,this._onTextureInvalidateDelegate),this.onTextureInvalidate()},AMc.prototype.onTextureInvalidate=function(t){this.invalidate()},AMc.prototype._onInvalidateProperties=function(t){this.invalidateMaterial(),this.invalidatePasses()},AMc.prototype._acceptTraverser=function(t){t.applyTraversable(this)},AMc.prototype.iAddOwner=function(t){},AMc.prototype.iRemoveOwner=function(t){},AMc.prototype._getDefaultBoundingVolume=function(){return BoundingVolumeType.NULL},AMc.prototype.testCollision=function(t,e){return t.traversable=null,!1},AMc.assetType="[asset Skybox]",AMc),_Render_SkyboxMaterial=(RMc=_Render_MaterialPassBase,__extends(SMc,RMc),SMc.prototype.onClear=function(t){RMc.prototype.onClear.call(this,t),this._texture.onClear(new AssetEvent(AssetEvent.CLEAR,this._skybox.texture)),this._texture=null,this._skybox=null},SMc.prototype._pUpdateRender=function(){RMc.prototype._pUpdateRender.call(this),this.requiresBlending=this._material.blendMode!=BlendMode.NORMAL,this.shader.setBlendMode(this._material.blendMode==BlendMode.NORMAL&&this.requiresBlending?BlendMode.LAYER:this._material.blendMode)},SMc.prototype._includeDependencies=function(t){RMc.prototype._includeDependencies.call(this,t),t.usesPositionFragment=!0},SMc.prototype._getFragmentCode=function(t,e){return this._texture._getFragmentCode(e.shadedTarget,t,e,e.positionVarying)},SMc.prototype._setRenderState=function(t){RMc.prototype._setRenderState.call(this,t),this._texture._setRenderState(t)},SMc.prototype._activate=function(){RMc.prototype._activate.call(this),this._stage.context.setDepthTest(!1,ContextGLCompareMode.LESS),this._texture.activate()},SMc),_Render_Skybox=(_Mc=_Render_RenderableBase,__extends(aNc,_Mc),aNc.prototype._getStageElements=function(){var t=aNc._elements;return t||((t=new SkyboxElements(new AttributesBuffer(11,4))).autoDeriveNormals=!1,t.autoDeriveTangents=!1,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))),this._stage.getAbstraction(t)},aNc.prototype._getRenderMaterial=function(){return this.renderGroup.getRenderElements(this.stageElements.elements).getAbstraction(this._asset)},aNc.prototype._getStyle=function(){return this._asset.style},aNc),SkyboxNode=(cNc=EntityNode,__extends(dNc,cNc),dNc.prototype.isInFrustum=function(t,e,i,n){return!!this.isVisible()},dNc.prototype.isCastingShadow=function(){return!1},dNc),cNc,_Mc,RMc,zMc;function dNc(){return null!==cNc&&cNc.apply(this,arguments)||this}function aNc(){return null!==_Mc&&_Mc.apply(this,arguments)||this}function SMc(t,e){var i=RMc.call(this,t,e)||this;return i._skybox=t,i._shader=new ShaderBase(e,i,i,i._stage),i._texture=i._shader.getAbstraction(i._skybox.texture),i._pAddPass(i),i}function AMc(t,e){void 0===t&&(t=16777215);var i=zMc.call(this)||this;return i._textures=new Array,i._pBlendMode=BlendMode.NORMAL,i.animateUVs=!1,i.bothSides=!1,i.curves=!1,i.imageRect=!1,i._onTextureInvalidateDelegate=function(t){return i.onTextureInvalidate(t)},i._owners=[i],i.style=new Style,t instanceof ImageCube?(i._style.image=t,i.texture=new ImageTextureCube):i._style.color=Number(t),i}RenderGroup.registerDefaultMaterial(_Render_SkyboxMaterial,Skybox),RenderEntity.registerRenderable(_Render_Skybox,Skybox),PartitionBase.registerAbstraction(SkyboxNode,Skybox);var CastError=(iNc=ErrorBase,__extends(jNc,iNc),jNc),ResizeEvent=(lNc=EventBase,__extends(mNc,lNc),Object.defineProperty(mNc.prototype,"oldHeight",{get:function(){return this._oldHeight},enumerable:!0,configurable:!0}),Object.defineProperty(mNc.prototype,"oldWidth",{get:function(){return this._oldWidth},enumerable:!0,configurable:!0}),mNc.prototype.clone=function(){return new mNc(this.type,this._oldHeight,this._oldWidth)},mNc.RESIZE="resize",mNc),DefaultSceneGraphFactory=(rNc=DefaultGraphicsFactory,__extends(sNc,rNc),sNc.prototype.createMovieClip=function(t,e){return void 0===t&&(t=null),new MovieClip(t)},sNc.prototype.createSprite=function(t,e,i){return void 0===t&&(t=null),t?t.getNewObject():new Sprite},sNc.prototype.createDisplayObjectContainer=function(t){return new DisplayObjectContainer},sNc.prototype.createTextField=function(t){return new TextField},sNc.prototype.createBillboard=function(t,e){return new Billboard(t)},sNc.prototype.createMaterial=function(t,e,i){return new MethodMaterial(t,e)},sNc),SceneGraphNode=(FNc=NodeBase,__extends(GNc,FNc),GNc.prototype.acceptTraverser=function(t){var e;if(this._partition.root==this._entity&&this._partition.updateEntities(),(t.partition==this._partition||t==t.getTraverser(this._partition))&&t.enterNode(this))for(e=this._numNodes-1;0<=e;e--)this._pChildNodes[e].acceptTraverser(t)},GNc.prototype.iAddNode=function(t){for(var e=(t.parent=this)._entity!=t.entity?t.entity._depthID:-16384,i=this._childDepths.length,n=i;n--&&!(this._childDepths[n]<e););++n<i?(this._pChildNodes.splice(n,0,t),this._childDepths.splice(n,0,e)):(this._pChildNodes.push(t),this._childDepths.push(e)),this._numNodes++},GNc.prototype.isVisible=function(){return this._entity._iIsVisible()},GNc.prototype.iRemoveNode=function(t){var e=this._pChildNodes.indexOf(t);this._pChildNodes.splice(e,1),this._childDepths.splice(e,1),this._numNodes--},GNc),SceneGraphPartition=(QNc=PartitionBase,__extends(RNc,QNc),RNc.prototype.getPartition=function(t){return new RNc(t)},RNc),TMP_COLOR_MATRIX=new ColorTransform,TMP_RAW=[],TMP_AREA_SIZE=5,TMP_PIXEL=new Uint8ClampedArray(TMP_AREA_SIZE*TMP_AREA_SIZE*4),TMP_POINT=new Point(0,0),SceneImage2D=(WNc=BitmapImage2D,__extends(XNc,WNc),Object.defineProperty(XNc.prototype,"data",{get:function(){var t,e=this._data;return this._imageDataDirty&&(this._stage.setRenderTarget(this,!1),(t=this._stage.context._gl).readPixels(0,0,this.rect.width,this.rect.height,t.RGBA,t.UNSIGNED_BYTE,e),this._stage.setRenderTarget(null)),this.resetDirty(),e},enumerable:!0,configurable:!0}),XNc.prototype.pushDirtyRegion=function(t){if(this._imageDataDirty=!0,this._fullDirty)this._updateRegions&&this._updateRegions.length&&(this._updateRegions.length=0);else{var e,i,n,r=t.equals(this._rect);if(this._dirtyRegions||(this._dirtyRegions=[]),r?(this._dirtyRegions=[this._rect],this._fullDirty=!0):this._dirtyRegions.push(t),!this._maxDirtyArea||r?this._maxDirtyArea=t.clone():(e=t._rawData,(n=(i=this._maxDirtyArea)._rawData)[0]=e[0]<n[0]?e[0]:n[0],n[1]=e[1]<n[1]?e[1]:n[1],i.right=i.right<t.right?i.right:t.right,i.bottom=i.bottom<t.bottom?i.bottom:t.bottom,n[0]<0&&(n[0]=0),n[1]<0&&(n[1]=0),n[2]>this.width&&(n[2]=this.width),n[3]>this.height&&(n[3]=this.height)),this._updateRegions)for(var o=this._updateRegions.length-1;0<=o;o--)this._updateRegions[o].intersects(t)&&this._updateRegions.splice(o,1)}},XNc.prototype.resetDirty=function(){this._dirtyRegions=[],this._updateRegions=[],this._maxDirtyArea=null,this._fullDirty=!1,this._imageDataDirty=!1},XNc.prototype.getImageDirtyUnderPoint=function(t,e){if(!this._imageDataDirty)return!1;TMP_POINT.setTo(t,e);for(var i=0,n=this._updateRegions;i<n.length;i++){var r=(u=n[i])._rawData[0],o=u._rawData[1],s=u._rawData[2],a=u._rawData[3];if(r<=t&&t<r+s&&o<=e&&e<o+a)return!1}var l=this._maxDirtyArea._rawData;if(!(t>=l[0]&&t<l[0]+l[2]))return!1;if(!(e>=l[1]&&e<l[1]+l[3]))return!1;for(var c=0,h=this._dirtyRegions;c<h.length;c++){var u,r=(u=h[c])._rawData[0],o=u._rawData[1],s=u._rawData[2],a=u._rawData[3];if(r<=t&&t<r+s&&o<=e&&e<o+a)return!0}return!1},Object.defineProperty(XNc.prototype,"assetType",{get:function(){return XNc.assetType},enumerable:!0,configurable:!0}),XNc.prototype.createRenderer=function(){var t=new PerspectiveProjection;t.coordinateSystem=CoordinateSystem.RIGHT_HANDED,t.originX=-1,t.originY=1,XNc._root=new DisplayObjectContainer,XNc._renderer=RenderGroup.getInstance(new View(t,this._stage,null,null,null,!0),RendererType.DEFAULT).getRenderer(new SceneGraphPartition(XNc._root)),XNc._root.partition=XNc._renderer.partition,XNc._renderer.disableClear=!0,XNc._renderer.view.backgroundAlpha=0,XNc._renderer.view.projection=t,XNc._renderer.view.projection.transform=new Transform,XNc._renderer.view.projection.transform.moveTo(0,0,-1e3),XNc._renderer.view.projection.transform.lookAt(new Vector3D),XNc._renderer.renderableSorter=null},XNc.prototype.createBillboardRenderer=function(){var t=new PerspectiveProjection;t.coordinateSystem=CoordinateSystem.RIGHT_HANDED,t.originX=-1,t.originY=1,XNc._billboardRoot=new DisplayObjectContainer,XNc._billboardRenderer=RenderGroup.getInstance(new View(t,this._stage,null,null,null,!0),RendererType.DEFAULT).getRenderer(new SceneGraphPartition(XNc._billboardRoot)),XNc._billboardRoot.partition=XNc._billboardRenderer.partition,XNc._billboardRenderer.disableClear=!0,XNc._billboardRenderer.view.backgroundAlpha=0,XNc._billboardRenderer.view.projection=t,XNc._billboardRenderer.view.projection.transform=new Transform,XNc._billboardRenderer.view.projection.transform.moveTo(0,0,-1e3),XNc._billboardRenderer.view.projection.transform.lookAt(new Vector3D),XNc._billboardRenderer.renderableSorter=null;var e=new MethodMaterial(new BitmapImage2D(128,128,!0,0));e.bothSides=!0,e.alphaBlending=!0,(XNc._billboard=new Billboard(e)).style=new Style,XNc._billboardRoot.addChild(XNc._billboard)},XNc.prototype.dispose=function(){WNc.prototype.dispose.call(this),this._dirtyRegions=null,this._updateRegions=null,this._maxDirtyArea=null},XNc.prototype.fillRect=function(t,e){XNc._renderer||this.createRenderer(),XNc._renderer.view.target=this,XNc._renderer.view.projection.scale=1e3/this.rect.height;var i=this._transparent?(e>>24&255)/255:1,n=16777215&e;XNc._renderer.view.x=t.x,XNc._renderer.view.y=t.y,XNc._renderer.view.width=t.width,XNc._renderer.view.height=t.height,XNc._renderer.view.backgroundAlpha=i,XNc._renderer.view.backgroundColor=n,XNc._renderer.view.clear(!0,!0),this.pushDirtyRegion(t)},XNc.prototype.copyPixels=function(t,e,i,n,r,o){this._stage.context.setCulling(ContextGLTriangleFace.NONE),this._stage.context.setBlendFactors(ContextGLBlendFactor.ONE,ContextGLBlendFactor.ONE_MINUS_SOURCE_ALPHA),o=this.transparent!==t.transparent||o,this._stage.copyPixels(t,this,e,i,n,r,o),this.pushDirtyRegion(new Rectangle(i.x,i.y,e.width,e.height))},XNc.prototype.threshold=function(t,e,i,n,r,o,s,a){this._stage.context.setCulling(ContextGLTriangleFace.NONE),this._stage.context.setBlendFactors(ContextGLBlendFactor.ONE,ContextGLBlendFactor.ZERO),this._stage.threshold(t,this,e,i,n,r,o,s,a),this.pushDirtyRegion(new Rectangle(i.x,i.y,e.width,e.height)),this._imageDataDirty=!0},XNc.prototype.colorTransform=function(t,e){this._stage.context.setCulling(ContextGLTriangleFace.NONE),this._stage.context.setBlendFactors(ContextGLBlendFactor.ONE,ContextGLBlendFactor.ZERO),XNc._tmpImage||(XNc._tmpImage=new XNc(1024,1024,!0,0,!0,this._stage));var i=XNc._tmpImage;this._stage.colorTransform(this,i,t,e),this._stage.copyPixels(i,this,t,new Point(0,0),null,null,!1),this.pushDirtyRegion(new Rectangle(t.x,t.y,t.width,t.height)),this._imageDataDirty=!0},XNc.prototype.getPixel32=function(t,e){if(this._imageDataDirty&&this.getImageDirtyUnderPoint(t,e)){this._stage.setRenderTarget(this,!1);var i=TMP_PIXEL,n=this._stage.context._gl,r=Math.min(this.width,this.height,TMP_AREA_SIZE),o=(r-1)/2|1,s=t-o,a=e-o;s<0&&(s=0),a<0&&(a=0),s>=this.width-r&&(s=this.width-r-1),a>=this.height-r&&(a=this.height-r-1),n.readPixels(s,a,r,r,n.RGBA,n.UNSIGNED_BYTE,i),this._stage.setRenderTarget(null);var l=t-s,c=e-a,h=new Rectangle(s,a,r,r);this.lock(),this.setPixels(h,i),this._locked=!1,this._updateRegions||(this._updateRegions=[]),this._updateRegions.push(h),this._fullDirty=!1;var u=4*(l+c*r),p=i[3+u];return p?(p<<24|(255*i[0+u]/p|0)<<16|(255*i[1+u]/p|0)<<8|255*i[2+u]/p|0)>>>0:0}return WNc.prototype.getPixel32.call(this,t,e)},XNc.prototype.getPixel=function(t,e){return 16777215&this.getPixel32(t,e)},XNc.prototype.draw=function(t,e,i,n,r,o){t instanceof DisplayObject?this._drawAsDisplay(t,e,i,n,r,o):this._drawAsBitmap(t,e,i,n,r,o),this.pushDirtyRegion(this._rect),this._imageDataDirty=!0},XNc.prototype._mapBlendMode=function(t){switch(void 0===t&&(t=""),t){case null:case"":case BlendMode.NORMAL:case BlendMode.LAYER:return BlendMode.LAYER;case BlendMode.MULTIPLY:case BlendMode.ADD:case BlendMode.ALPHA:return t}return BlendMode.LAYER},XNc.prototype._drawAsBitmap=function(t,e,i,n,r,o){XNc._billboardRenderer||this.createBillboardRenderer();var s,a=XNc._billboardRenderer,l=XNc._billboardRoot,c=XNc._billboard;a.disableClear=!0,a.view.target=this,a.view.projection.scale=1e3/this.rect.height,c.material.style.image=t,c.material.blendMode=this._mapBlendMode(n),e?((s=l.transform.matrix3D).identity(),s._rawData[0]=e.a,s._rawData[1]=-e.b,s._rawData[4]=e.c,s._rawData[5]=-e.d,s._rawData[12]=e.tx,s._rawData[13]=this.rect.height-e.ty,l.transform.invalidateComponents()):(l.transform.rotateTo(0,0,0),l.transform.scaleTo(1,-1,1),l.transform.moveTo(0,this.rect.height,0)),a.render()},XNc.prototype._drawAsDisplay=function(t,e,i,n,r,o){XNc._renderer||this.createRenderer();for(var s=XNc._root,a=XNc._renderer,l=t.parent,c=t._depthID,h=l?l.getChildIndex(t):0,u=t.visible,p=t.transform,d=0;d<4;d++)TMP_RAW[0+d]=p.position._rawData[d],TMP_RAW[4+d]=p.rotation._rawData[d],TMP_RAW[8+d]=p.scale._rawData[d];TMP_COLOR_MATRIX.copyRawDataFrom(t.transform.colorTransform._rawData);var _,f=t.transform.matrix3D._rawData[10];e?((_=s.transform.matrix3D).identity(),_._rawData[0]=e.a,_._rawData[1]=-e.b,_._rawData[4]=e.c,_._rawData[5]=-e.d,_._rawData[10]=f,_._rawData[12]=e.tx,_._rawData[13]=this.rect.height-e.ty,s.transform.invalidateComponents()):(s.transform.rotateTo(0,0,0),s.transform.scaleTo(1,-1,1),s.transform.moveTo(0,this.rect.height,0)),a.view.target=this,a.view.projection.scale=1e3/this.rect.height,a.view.x=0,a.view.y=0,a.view.width=this.width,a.view.height=this.height,s.removeChildren(0,s.numChildren),s.addChild(t),t.transform.matrix3D=null,t.visible=!0,t.transform.colorTransform=null,n=n||t.blendMode||"",s.blendMode=this._mapBlendMode(n),a.render(),t.visible=u,p.moveTo(TMP_RAW[0],TMP_RAW[1],TMP_RAW[2]),p.rotateTo(TMP_RAW[4],TMP_RAW[5],TMP_RAW[6]),p.scaleTo(TMP_RAW[8],TMP_RAW[9],TMP_RAW[10]),t.transform.colorTransform=TMP_COLOR_MATRIX,l&&(l.adapter&&l.adapter!=l&&t.adapter&&t.adapter!=t&&l.adapter.addChildAt?l.adapter.addChildAt(t.adapter,h):l.addChildAtDepth(t,c,!0))},XNc.assetType="[image SceneImage2D]",XNc),WNc,QNc,FNc,rNc,lNc,iNc;function XNc(t,e,i,n,r,o){void 0===i&&(i=!0),void 0===n&&(n=4294967295),void 0===r&&(r=!0),void 0===o&&(o=null);var s=WNc.call(this,t,e,i,n,r,o)||this;return s._updateRegions=[],s._dirtyRegions=[],s._maxDirtyArea=null,s._fullDirty=!1,s}function RNc(t,e){void 0===e&&(e=!1);var i=QNc.call(this,t,e)||this;return i._rootNode=new SceneGraphNode(t,i),i}function GNc(){var t=null!==FNc&&FNc.apply(this,arguments)||this;return t._numNodes=0,t._pChildNodes=new Array,t._childDepths=new Array,t}function sNc(){return null!==rNc&&rNc.apply(this,arguments)||this}function mNc(t,e,i){void 0===e&&(e=NaN),void 0===i&&(i=NaN);var n=lNc.call(this,t)||this;return n._oldHeight=e,n._oldWidth=i,n}function jNc(t){return iNc.call(this,t)||this}Stage.registerAbstraction(_Stage_BitmapImage2D,SceneImage2D);var TMP_POINT$1={x:0,y:0},MouseManager=(PPc.prototype.startDragObject=function(t){this._isAVM1Dragging=!0,this._mouseDragEntity=t,this._mouseDragPickerEntity=t},PPc.prototype.stopDragObject=function(){this._isAVM1Dragging=!1},Object.defineProperty(PPc.prototype,"showCursor",{get:function(){return this._showCursor},set:function(t){this._showCursor=t},enumerable:!0,configurable:!0}),Object.defineProperty(PPc.prototype,"eventBubbling",{get:function(){return this._eventBubbling},set:function(t){this._eventBubbling=t},enumerable:!0,configurable:!0}),Object.defineProperty(PPc.prototype,"useSoftkeyboard",{get:function(){return this._useSoftkeyboard},set:function(t){(this._useSoftkeyboard=t)?t&&(window.removeEventListener("keydown",this.onKeyDownDelegate),window.removeEventListener("keyup",this.onKeyUpDelegate)):(window.addEventListener("keydown",this.onKeyDownDelegate),window.addEventListener("keyup",this.onKeyUpDelegate))},enumerable:!0,configurable:!0}),PPc.prototype.registerContainer=function(t){t&&-1==this._containerLookup.indexOf(t)&&(t.addEventListener("click",this.onClickDelegate),t.addEventListener("dblclick",this.onDoubleClickDelegate),t.addEventListener("touchstart",this.onMouseDownDelegate),t.addEventListener("mousedown",this.onMouseDownDelegate),t.addEventListener("touchmove",this.onMouseMoveDelegate),t.addEventListener("mousemove",this.onMouseMoveDelegate),t.addEventListener("mouseup",this.onMouseUpDelegate),t.addEventListener("touchend",this.onMouseUpDelegate),t.addEventListener("touchend",this.onClickDelegate),t.addEventListener("mousewheel",this.onMouseWheelDelegate),t.addEventListener("mouseover",this.onMouseOverDelegate),t.addEventListener("mouseout",this.onMouseOutDelegate),window.addEventListener("keydown",this.onKeyDownDelegate),window.addEventListener("keyup",this.onKeyUpDelegate),this._containerLookup.push(t))},PPc.prototype.unregisterContainer=function(t){t&&-1!=this._containerLookup.indexOf(t)&&(t.removeEventListener("click",this.onClickDelegate),t.removeEventListener("dblclick",this.onDoubleClickDelegate),t.removeEventListener("touchstart",this.onMouseDownDelegate),t.removeEventListener("mousedown",this.onMouseDownDelegate),t.removeEventListener("touchmove",this.onMouseMoveDelegate),t.removeEventListener("mousemove",this.onMouseMoveDelegate),t.removeEventListener("mouseup",this.onMouseUpDelegate),t.removeEventListener("touchend",this.onMouseUpDelegate),t.removeEventListener("touchend",this.onClickDelegate),t.removeEventListener("mousewheel",this.onMouseWheelDelegate),t.removeEventListener("mouseover",this.onMouseOverDelegate),t.removeEventListener("mouseout",this.onMouseOutDelegate),window.removeEventListener("keydown",this.onKeyDownDelegate),window.removeEventListener("keyup",this.onKeyUpDelegate),this._containerLookup.splice(this._containerLookup.indexOf(t),1))},PPc.prototype.dispose=function(){this._stage=null,this.onClickDelegate=null,this.onDoubleClickDelegate=null,this.onMouseDownDelegate=null,this.onMouseMoveDelegate=null,this.onMouseUpDelegate=null,this.onMouseWheelDelegate=null,this.onMouseOverDelegate=null,this.onMouseOutDelegate=null,this.onKeyDownDelegate=null,this.onKeyUpDelegate=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},PPc.clearInstance=function(){this._instance&&(this._instance.dispose(),this._instance=null)},PPc.getInstance=function(t){return this._instance?this._instance:t?this._instance=new PPc(t):new PPc(t)},PPc.prototype.setFocus=function(t){this._currentFocusEntity!=t&&(this._currentFocusEntity&&this._currentFocusEntity.setFocus(!1,!1),this._currentFocusEntity=t,this._currentFocusEntity&&this._currentFocusEntity.setFocus(!0,!1))},PPc.prototype.getFocus=function(){return this._currentFocusEntity},PPc.prototype.focusNextTab=function(){var t;0==this._sceneLookup.length||(t=this._sceneLookup[0].tabPicker.getNextTabEntity(this._currentFocusEntity))!=this._currentFocusEntity&&(this._currentFocusEntity&&this._currentFocusEntity.setFocus(!1,!1),this._currentFocusEntity=t,this._currentFocusEntity.setFocus(!0,!1))},PPc.prototype.focusPreviousTab=function(){var t;0==this._sceneLookup.length||(t=this._sceneLookup[0].tabPicker.getPrevTabEntity(this._currentFocusEntity))!=this._currentFocusEntity&&(this._currentFocusEntity&&this._currentFocusEntity.setFocus(!1,!1),this._currentFocusEntity=t,this._currentFocusEntity.setFocus(!0,!1))},PPc.prototype.dispatchEvent=function(t,e){if(this._eventBubbling)for(;e;){if(t.commonAncestor&&e==t.commonAncestor)return;e._iIsMouseEnabled()&&(e.dispatchEvent(t),FrameScriptManager.execute_queue()),e=t._iAllowedToPropagate?e.parent:null}else e&&(e.dispatchEvent(t),FrameScriptManager.execute_queue())},PPc.prototype.setupAndDispatchEvent=function(t,e,i){t=this.setUpEvent(t,e,i),this.dispatchEvent(t,t.pickerEntity)},PPc.prototype.fireMouseEvents=function(t){if(!t.forceMouseMove||this._isTouch||this._iUpdateDirty||(this._iCollision=t.getViewCollision(t._mouseX,t._mouseY)),this._rollOut.commonAncestor=null,this._rollOver.commonAncestor=null,this._iCollisionEntity=this._iCollision?this._iCollision.pickerEntity:null,this._iCollisionEntity!=this._prevICollisionEntity){if(this._prevICollisionEntity&&(this._isTouch||this._mouseDragging?this._mouseDragging&&this._mouseDragPickerEntity&&this._mouseDragPickerEntity==this._prevICollisionEntity&&this.queueDispatch(this._dragOut,this._mouseMoveEvent,this._prevICollision):this.queueDispatch(this._mouseOut,this._mouseMoveEvent,this._prevICollision)),!this._prevICollisionEntity&&this._iCollisionEntity&&(this.queueDispatch(this._rollOut,this._mouseMoveEvent,this._prevICollision),this.queueDispatch(this._rollOver,this._mouseMoveEvent,this._iCollision)),this._prevICollisionEntity&&!this._iCollisionEntity&&(this.queueDispatch(this._rollOut,this._mouseMoveEvent,this._prevICollision),this.queueDispatch(this._rollOver,this._mouseMoveEvent,this._iCollision)),this._prevICollisionEntity&&this._iCollisionEntity){for(var e=[],i=this._prevICollisionEntity;i&&!i.isAVMScene;)e.push(i),i=i.parent;for(var n=null,i=this._iCollisionEntity;i&&!i.isAVMScene;)i=-1==e.indexOf(i)?i.parent:(n=i,null);n!=this._prevICollisionEntity&&this.queueDispatch(this._rollOut,this._mouseMoveEvent,this._prevICollision,n),n!=this._iCollisionEntity&&this.queueDispatch(this._rollOver,this._mouseMoveEvent,this._iCollision,n)}this._collisionIsEnabledButton=!!this._iCollisionEntity&&this._iCollisionEntity.buttonEnabled,this._iCollisionEntity&&(this._isTouch||this._mouseDragging?this._mouseDragging&&this._mouseDragPickerEntity&&this._mouseDragPickerEntity==this._iCollisionEntity&&this.queueDispatch(this._dragOver,this._mouseMoveEvent,this._iCollision):this.queueDispatch(this._mouseOver,this._mouseMoveEvent,this._iCollision)),this._prevICollision=this._iCollision,this._prevICollisionEntity=this._iCollisionEntity}else{var r=!!this._iCollisionEntity&&this._iCollisionEntity.buttonEnabled;this._collisionIsEnabledButton!=r&&r&&(this._isTouch?this._mouseDragPickerEntity&&this._mouseDragPickerEntity==this._iCollisionEntity&&this.queueDispatch(this._dragOver,this._mouseMoveEvent,this._iCollision):this.queueDispatch(this._mouseOver,this._mouseMoveEvent,this._iCollision)),this._collisionIsEnabledButton=r}var o,s;this._mouseDragging||(document.body.style.cursor=this._showCursor?this._iCollisionEntity?this._iCollisionEntity.getMouseCursor():"initial":"none");for(var a,l,c=this._queuedEvents.length,h=0;h<c;++h)s=(o=this._queuedEvents[h]).pickerEntity,o.type==MouseEvent$1.MOUSE_DOWN?(this._mouseDragging=!0,!this._eventBubbling&&this._stage&&this._stage.dispatchEvent(o),this._isTouch&&this.setupAndDispatchEvent(this._mouseOver,this._mouseMoveEvent,this._iCollision),this._mouseDragEntity=o.entity,this._mouseDragPickerEntity=o.pickerEntity,s&&this.dispatchEvent(o,s),(this._allowFocusOnUnfocusable||this._mouseDragPickerEntity&&this._mouseDragPickerEntity.tabEnabled)&&(this._currentFocusEntity&&this._currentFocusEntity.setFocus(!1,!0),this._currentFocusEntity=this._mouseDragPickerEntity,this._currentFocusEntity&&this._currentFocusEntity.setFocus(!0,!0)),this._mouseDragEntity&&this.setupAndDispatchEvent(this._dragStart,o,this._pickGroup.getAbstraction(this._mouseDragEntity).pickingCollision)):o.type==MouseEvent$1.MOUSE_UP?(!this._eventBubbling&&this._stage&&this._stage.dispatchEvent(o),l=a=null,this._isAVM1Dragging&&this._mouseDragPickerEntity?(l=this._mouseDragPickerEntity,a=this._mouseDragEntity):this._mouseDragging&&this._mouseDragPickerEntity&&this._mouseDragPickerEntity!=s?(this._mouseDragPickerEntity.buttonEnabled&&this.setupAndDispatchEvent(this._mouseOut,o,this._pickGroup.getAbstraction(this._mouseDragEntity).pickingCollision),this._eventBubbling||this.setupAndDispatchEvent(this._mouseUpOutside,o,this._pickGroup.getAbstraction(this._mouseDragEntity).pickingCollision)):this._mouseDragging&&this._mouseDragPickerEntity&&this._mouseDragPickerEntity==s&&(l=this._mouseDragPickerEntity,a=this._mouseDragEntity),this._mouseDragging&&s&&this.setupAndDispatchEvent(this._mouseOver,o,this._iCollision),this._isTouch&&a&&this.setupAndDispatchEvent(this._mouseOut,this._mouseMoveEvent,this._pickGroup.getAbstraction(a).pickingCollision),l?this.dispatchEvent(o,l):this._eventBubbling&&this._stage&&this._stage.dispatchEvent(o),a&&this.setupAndDispatchEvent(this._dragStop,o,this._pickGroup.getAbstraction(a).pickingCollision),this._mouseDragPickerEntity=null,this._mouseDragEntity=null,this._mouseDragging=!1,this._isAVM1Dragging=!1):o.type==MouseEvent$1.MOUSE_MOVE?(this._eventBubbling&&o.pickerEntity?this.dispatchEvent(o,o.pickerEntity):this._stage&&this._stage.dispatchEvent(o),this._mouseDragEntity&&this.setupAndDispatchEvent(this._dragMove,o,this._pickGroup.getAbstraction(this._mouseDragEntity).pickingCollision)):this.dispatchEvent(o,s);this._queuedEvents.length=0,this._iUpdateDirty=!1},PPc.prototype.registerScene=function(t){t&&this._sceneLookup.push(t)},PPc.prototype.unregisterScene=function(t){t&&this._sceneLookup.splice(this._sceneLookup.indexOf(t),1)},PPc.prototype.addEventsForSceneBinary=function(t,e){var i={clientX:null,clientY:null,touches:[],changedTouches:[],preventDefault:function(){}},n=new Float32Array(t),r=0,o=0;o++;var s,a=n[o++],l=n[o++],c=n[o++];if(1!=l&&6!=l&&12!=l&&262!=l&&518!=l){for(r=0;r<a;r++)(s={}).identifier=n[o++],s.clientX=n[o++],s.clientY=n[o++],i.touches[r]=s;i.changedTouches[0]=i.touches[c],i.changedTouches[0].clientX,i.changedTouches[0].clientY}else if(1==a)(s={}).identifier=n[o++],s.clientX=n[o++],s.clientY=n[o++],i.clientX=s.clientX,i.clientY=s.clientY,i.clientX,i.clientY;else for(r=0;r<a;r++)(s={}).identifier=n[o++],s.clientX=n[o++],s.clientY=n[o++],r!=c?i.touches[0]=s:(i.clientX=s.clientX,i.clientY=s.clientY,i.clientX,i.clientY);0==l||5==l||11==l||261==l||517==l?this.onMouseDown(i):1==l||6==l||12==l||262==l||518==l?this.onMouseUp(i):2==l?this.onMouseMove(i):console.log("recieved unknown touch event-type: "+l)},PPc.prototype.fireEventsForSceneFromString=function(t,e){var i,n={clientX:null,clientY:null,preventDefault:function(){}},r=t.split(","),o=0,s=0,a=parseInt(r[s++]),l=parseInt(r[s++]),c=parseInt(r[s++]);if(n.touches=[],n.changedTouches=[],1!=l&&6!=l){for(o=0;o<a;o++)(i={}).identifier=r[s++],i.clientX=r[s++],i.clientY=r[s++],n.touches[o]=i,n.changedTouches[o]=i;n.changedTouches[o]=n.touches[c]}else for(o=0;o<a;o++)o!=c?((i={}).identifier=r[s++],i.clientX=r[s++],i.clientY=r[s++],n.touches[o]=i,n.changedTouches[o]=i):(n.clientX=r[s++],n.clientY=r[s++],s++);0==l?this.onMouseDown(n):1==l?this.onMouseUp(n):2==l?this.onMouseMove(n):261==l?this.onMouseDown(n):6==l&&this.onMouseUp(n)},PPc.prototype.mapContainerToView=function(t,e,i){void 0===i&&(i={x:0,y:0});var n=this._containerLookup[0],r=n.parentElement?n.getBoundingClientRect():{x:0,y:0,width:0,height:0};return i.x=(t-r.left)*n.clientWidth/r.width,i.y=(e-r.top)*n.clientHeight/r.height,i},PPc.prototype.setUpEvent=function(t,e,i,n){var r,o,s;return void 0===n&&(n=null),t._iAllowedToImmediatlyPropagate=!0,t._iAllowedToPropagate=!0,e&&(r=null!=e.clientX?e.clientX:e.changedTouches?e.changedTouches[0].clientX:0,o=null!=e.clientY?e.clientY:e.changedTouches?e.changedTouches[0].clientY:0,s=this.mapContainerToView(r,o,TMP_POINT$1),t.delta=e.wheelDelta,t.ctrlKey=e.ctrlKey,t.altKey=e.altKey,t.shiftKey=e.shiftKey,t.screenX=s.x,t.screenY=s.y),i?(t.entity=i.entity,t.pickerEntity=i.pickerEntity,t.traversable=i.traversable,t.uv=i.uv,t.position=i.position?i.position.clone():null,t.normal=i.normal?i.normal.clone():null,t.elementIndex=i.elementIndex):(t.entity=null,t.pickerEntity=null,t.traversable=null,t.uv=null,t.position=this._nullVector,t.normal=this._nullVector,t.elementIndex=0),t.commonAncestor=n,t},PPc.prototype.queueDispatch=function(t,e,i,n){void 0===n&&(n=null),this._queuedEvents.push(this.setUpEvent(t,e,i,n))},PPc.prototype.onKeyDown=function(t){var e;PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.allowKeyInput&&(t.preventDefault(),this._currentFocusEntity||this._stage)&&((e=new KeyboardEvent$1(KeyboardEvent$1.KEYDOWN,t.key,t.code)).isShift=t.shiftKey,e.isCTRL=t.ctrlKey,e.isAlt=t.altKey,e.keyCode=t.keyCode,this._currentFocusEntity&&this._currentFocusEntity.dispatchEvent(e),this._stage&&this._stage.dispatchEvent(e))},PPc.prototype.onKeyUp=function(t){var e;PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.allowKeyInput&&(t.preventDefault(),this._currentFocusEntity||this._stage)&&((e=new KeyboardEvent$1(KeyboardEvent$1.KEYUP,t.key,t.code)).isShift=t.shiftKey,e.isCTRL=t.ctrlKey,e.isAlt=t.altKey,e.keyCode=t.keyCode,this._currentFocusEntity&&this._currentFocusEntity.dispatchEvent(e),this._stage&&this._stage.dispatchEvent(e))},PPc.prototype.onMouseMove=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this._isTouch="mousemove"!=t.type,this.updateColliders(t),this.queueDispatch(this._mouseMove,this._mouseMoveEvent=t,this._iCollision)},PPc.prototype.onMouseOut=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.updateColliders(t),this.queueDispatch(this._mouseOut,t,this._iCollision)},PPc.prototype.onMouseOver=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.updateColliders(t),this.queueDispatch(this._mouseOver,t,this._iCollision)},PPc.prototype.onClick=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.updateColliders(t),this.queueDispatch(this._mouseClick,t,this._iCollision)},PPc.prototype.onDoubleClick=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.updateColliders(t),this.queueDispatch(this._mouseDoubleClick,t,this._iCollision)},PPc.prototype.onMouseDown=function(t){if(this._isTouch="mousedown"!=t.type,!this._isDown){if(PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this._isDown=!0,this.updateColliders(t),this._isTouch)for(var e in t.preventDefault(),this._containerLookup)this._containerLookup[e].focus();this.queueDispatch(this._mouseDown,t,this._iCollision)}},PPc.prototype.onMouseUp=function(t){if(this._isDown){if(PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this._isDown=!1,this.updateColliders(t),this._isTouch)for(var e in t.preventDefault(),this._containerLookup)this._containerLookup[e].focus();this.queueDispatch(this._mouseUp,t,this._iCollision)}},PPc.prototype.onMouseWheel=function(t){PPc.inputRecorder&&PPc.inputRecorder.recordEvent(t),this.updateColliders(t),this.queueDispatch(this._mouseWheel,t,this._iCollision)},PPc.prototype.updateColliders=function(t){for(var e,i=null!=t.clientX?t.clientX:t.changedTouches[0].clientX,n=null!=t.clientY?t.clientY:t.changedTouches[0].clientY,r=this.mapContainerToView(i,n,TMP_POINT$1),i=r.x,n=r.y,o=this._sceneLookup.length,s=0;s<o;s++){if((e=this._sceneLookup[s])._touchPoints.length=0,t.touches)for(var a,l=t.touches.length,c=0;c<l;c++)a=t.touches[c],r=this.mapContainerToView(a.clientX,a.clientY,TMP_POINT$1),e._touchPoints.push(new TouchPoint(r.x,r.y,a.identifier));if(!this._iUpdateDirty&&(e._mouseX=i,e._mouseY=n,e.disableMouseEvents||(this._iCollision=e.getViewCollision(e._mouseX,e._mouseY)),e.layeredView&&this._iCollision))break}this._iUpdateDirty=!0},PPc),PrimitiveCapsulePrefab=(IRc=PrimitivePrefabBase,__extends(JRc,IRc),Object.defineProperty(JRc.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JRc.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JRc.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(JRc.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t%2==0?t+1:t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(JRc.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),JRc.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a,l,c,h,u=0,p=0,d=0;if(e==ElementsType.TRIANGLE){var _=t;for(this._numVertices=(this._segmentsH+1)*(this._segmentsW+1),d=(this._segmentsH-1)*this._segmentsW*6,this._numVertices==_.numVertices?(_.invalidateIndices(),_.invalidateVertices(_.positions),_.invalidateVertices(_.normals),_.invalidateVertices(_.tangents)):(_.setIndices(new Uint16Array(d)),_.setPositions(new Float32Array(3*this._numVertices)),_.setNormals(new Float32Array(3*this._numVertices)),_.setTangents(new Float32Array(3*this._numVertices)),this._pInvalidateUVs()),i=_.indices.get(_.numElements),n=_.positions.get(this._numVertices),r=_.normals.get(this._numVertices),o=_.tangents.get(this._numVertices),s=_.concatenatedBuffer.stride/4,a=0;a<=this._segmentsH;++a)for(var f=Math.PI*a/this._segmentsH,m=-this._radius*Math.cos(f),g=this._radius*Math.sin(f),y=p,b=0;b<=this._segmentsW;++b){var v,x,A,S,w=2*Math.PI*b/this._segmentsW,C=g*Math.cos(w),P=a>this._segmentsH/2?this._height/2:-this._height/2,E=g*Math.sin(w),T=1/Math.sqrt(C*C+E*E+m*m),M=Math.sqrt(E*E+C*C),D=this._yUp?(c=0,h=.007<M?C/M:0,l=-m,E):(c=.007<M?C/M:0,h=0,l=E,m);b==this._segmentsW?(n[p]=n[y],n[p+1]=n[y+1],n[p+2]=n[y+2],r[p]=.5*(r[y]+C*T),r[p+1]=.5*(r[y+1]+l*T),r[p+2]=.5*(r[y+2]+D*T),o[p]=.5*(o[y]+(.007<M?-E/M:1)),o[p+1]=.5*(o[y+1]+c),o[p+2]=.5*(o[y+2]+h)):(n[p]=C,n[p+1]=this._yUp?l-P:l,n[p+2]=this._yUp?D:D+P,r[p]=C*T,r[p+1]=l*T,r[p+2]=D*T,o[p]=.007<M?-E/M:1,o[p+1]=c,o[p+2]=h),0<b&&0<a&&(v=(this._segmentsW+1)*a+b,x=(this._segmentsW+1)*a+b-1,A=(this._segmentsW+1)*(a-1)+b-1,S=(this._segmentsW+1)*(a-1)+b,a==this._segmentsH?(n[p]=n[y],n[p+1]=n[y+1],n[p+2]=n[y+2],i[u++]=v,i[u++]=A,i[u++]=S):1==a?(i[u++]=v,i[u++]=x,i[u++]=A):(i[u++]=v,i[u++]=x,i[u++]=A,i[u++]=v,i[u++]=A,i[u++]=S)),p+=s}}},JRc.prototype._pBuildUVs=function(t,e){var i,n,r;if(e==ElementsType.TRIANGLE){var o=t;o.uvs&&this._numVertices==o.numVertices?o.invalidateVertices(o.uvs):o.setUVs(new Float32Array(2*this._numVertices)),n=o.uvs.get(this._numVertices),r=o.uvs.stride;for(var s=0,a=0;a<=this._segmentsH;++a)for(i=0;i<=this._segmentsW;++i)n[s]=i/this._segmentsW*this._scaleU,n[s+1]=a/this._segmentsH*this._scaleV,s+=r}},JRc),PrimitiveCylinderPrefab=(ISc=PrimitivePrefabBase,__extends(JSc,ISc),Object.defineProperty(JSc.prototype,"topRadius",{get:function(){return this._topRadius},set:function(t){this._topRadius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JSc.prototype,"bottomRadius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JSc.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JSc.prototype,"segmentsW",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:!0,configurable:!0}),JSc.prototype.setSegmentsW=function(t){this._pSegmentsW=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},Object.defineProperty(JSc.prototype,"segmentsH",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:!0,configurable:!0}),JSc.prototype.setSegmentsH=function(t){this._pSegmentsH=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},Object.defineProperty(JSc.prototype,"topClosed",{get:function(){return this._topClosed},set:function(t){this._topClosed=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JSc.prototype,"bottomClosed",{get:function(){return this._bottomClosed},set:function(t){this._bottomClosed=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(JSc.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),JSc.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a,l,c,h,u,p,d,_,f=0,m=0,g=0,y=0;this._numVertices=0;var b=2*Math.PI/this._pSegmentsW;if(e==ElementsType.TRIANGLE){var v,x,A,S,w,C,P,E,T=t;if(this._surfaceClosed&&(this._numVertices+=(this._pSegmentsH+1)*(this._pSegmentsW+1),f+=this._pSegmentsH*this._pSegmentsW*6),this._topClosed&&(this._numVertices+=2*(this._pSegmentsW+1),f+=3*this._pSegmentsW),this._bottomClosed&&(this._numVertices+=2*(this._pSegmentsW+1),f+=3*this._pSegmentsW),this._numVertices==T.numVertices?(T.positions.invalidate(),T.normals.invalidate(),T.tangents.invalidate(),T.indices.invalidate()):(T.setIndices(new Uint16Array(f)),T.setPositions(new Float32Array(3*this._numVertices)),T.setNormals(new Float32Array(3*this._numVertices)),T.setTangents(new Float32Array(3*this._numVertices)),this._pInvalidateUVs()),i=T.indices.get(T.numElements),I=T.positions.get(this._numVertices),n=T.normals.get(this._numVertices),r=T.tangents.get(this._numVertices),o=T.concatenatedBuffer.stride/4,F=L=0,this._topClosed&&0<this._topRadius)for(a=-.5*this._height,U=this._yUp?(d=1,p=-a,_=0):(_=-1,p=d=0,a),I[L]=0,I[L+1]=p,I[L+2]=U,n[L]=0,n[L+1]=d,n[L+2]=_,r[L]=1,r[L+1]=0,r[L+2]=0,L+=o,g++,s=0;s<=this._pSegmentsW;++s)R=s*b,V=this._topRadius*Math.cos(R),k=this._topRadius*Math.sin(R),U=this._yUp?(p=-a,k):(p=k,a),s==this._pSegmentsW?(I[L]=I[m+o],I[L+1]=I[m+o+1],I[L+2]=I[m+o+2]):(I[L]=V,I[L+1]=p,I[L+2]=U),n[L]=0,n[L+1]=d,n[L+2]=_,r[L]=1,r[L+1]=0,r[L+2]=0,L+=o,0<s&&(i[F++]=g-1,i[F++]=y,i[F++]=g),g++;if(this._bottomClosed&&0<this._pBottomRadius)for(a=.5*this._height,m=g*o,y=g,U=this._yUp?(d=-1,p=-a,_=0):(_=1,p=d=0,a),0<s&&(I[L]=0,I[L+1]=p,I[L+2]=U,n[L]=0,n[L+1]=d,n[L+2]=_,r[L]=1,r[L+1]=0,r[L+2]=0,L+=o),g++,s=0;s<=this._pSegmentsW;++s)R=s*b,V=this._pBottomRadius*Math.cos(R),k=this._pBottomRadius*Math.sin(R),U=this._yUp?(p=-a,k):(p=k,a),s==this._pSegmentsW?(I[L]=I[m+o],I[L+1]=I[m+o+1],I[L+2]=I[m+o+2]):(I[L]=V,I[L+1]=p,I[L+2]=U),n[L]=0,n[L+1]=d,n[L+2]=_,r[L]=1,r[L+1]=0,r[L+2]=0,L+=o,0<s&&(i[F++]=g-1,i[F++]=g,i[F++]=y),g++;if(u=0==(h=(c=this._pBottomRadius-this._topRadius)/this._height)?1:this._height/c,this._surfaceClosed)for(B=0;B<=this._pSegmentsH;++B)for(l=this._topRadius-B/this._pSegmentsH*(this._topRadius-this._pBottomRadius),a=-this._height/2+B/this._pSegmentsH*this._height,m=g*o,s=0;s<=this._pSegmentsW;++s)R=s*b,V=l*Math.cos(R),k=l*Math.sin(R),w=u*Math.cos(R),C=u*Math.sin(R),E=this._yUp?(d=0,_=-w,p=-a,U=k,P=h,C):(d=-w,_=0,p=k,U=a,P=C,h),s==this._pSegmentsW?(I[L]=I[m],I[L+1]=I[m+1],I[L+2]=I[m+2],n[L]=w,n[L+1]=h,n[L+2]=C,r[L]=C):(I[L]=V,I[L+1]=p,I[L+2]=U,n[L]=w,n[L+1]=P,n[L+2]=E,r[L]=-C),r[L+1]=d,r[L+2]=_,L+=o,0<s&&0<B&&(A=(x=(v=g)-1)-this._pSegmentsW-1,S=v-this._pSegmentsW-1,i[F++]=v,i[F++]=x,i[F++]=A,i[F++]=v,i[F++]=A,i[F++]=S),g++}else if(e==ElementsType.LINE){for(var M=t,D=this._pSegmentsH*this._pSegmentsW*2+this._pSegmentsW,I=new Float32Array(6*D),O=new Float32Array(D),L=0,F=0,B=0;B<=this._pSegmentsH;++B)for(l=this._topRadius-B/this._pSegmentsH*(this._topRadius-this._pBottomRadius),a=-this._height/2+B/this._pSegmentsH*this._height,s=0;s<=this._pSegmentsW;++s){var N,R=s*b,V=l*Math.cos(R),k=l*Math.sin(R),U=this._yUp?(p=-a,k):(p=k,a);0<s&&(I[L++]=V,I[L++]=p,I[L++]=U,O[F++]=1,0<B)&&(N=1==B?3-(6*(this._pSegmentsW-s)+12*s):3-12*this._pSegmentsW,I[L]=I[L+++N],I[L]=I[L+++N],I[L]=I[L+++N],I[L++]=V,I[L++]=p,I[L++]=U,O[F++]=1),s<this._pSegmentsW&&(I[L++]=V,I[L++]=p,I[L++]=U)}M.setPositions(I),M.setThickness(O)}},JSc.prototype._pBuildUVs=function(t,e){var i,n,r,o,s,a,l;if(e==ElementsType.TRIANGLE){var c=t;c.uvs&&this._numVertices==c.numVertices?c.invalidateVertices(c.uvs):c.setUVs(new Float32Array(2*this._numVertices)),a=c.uvs.get(this._numVertices),l=c.uvs.stride;var h=2*Math.PI/this._pSegmentsW,u=0;if(this._topClosed)for(a[u]=.5*this._scaleU,a[u+1]=.5*this._scaleV,u+=l,i=0;i<=this._pSegmentsW;++i)s=i*h,r=.5+.5*-Math.cos(s),o=.5+.5*Math.sin(s),a[u]=r*this._scaleU,a[u+1]=o*this._scaleV,u+=l;if(this._bottomClosed)for(a[u]=.5*this._scaleU,a[u+1]=.5*this._scaleV,u+=l,i=0;i<=this._pSegmentsW;++i)s=i*h,r=.5+.5*Math.cos(s),o=.5+.5*Math.sin(s),a[u]=r*this._scaleU,a[u+1]=o*this._scaleV,u+=l;if(this._surfaceClosed)for(n=0;n<=this._pSegmentsH;++n)for(i=0;i<=this._pSegmentsW;++i)a[u]=i/this._pSegmentsW*this._scaleU,a[u+1]=n/this._pSegmentsH*this._scaleV,u+=l}},JSc),PrimitiveConePrefab=(dUc=PrimitiveCylinderPrefab,__extends(eUc,dUc),Object.defineProperty(eUc.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),eUc),PrimitivePlanePrefab=(oUc=PrimitivePrefabBase,__extends(pUc,oUc),Object.defineProperty(pUc.prototype,"segmentsW",{get:function(){return this._segmentsW},set:function(t){this._segmentsW=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(pUc.prototype,"segmentsH",{get:function(){return this._segmentsH},set:function(t){this._segmentsH=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(pUc.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(pUc.prototype,"doubleSided",{get:function(){return this._doubleSided},set:function(t){this._doubleSided=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(pUc.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(pUc.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),pUc.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a,l,c=this._segmentsW+1;if(e==ElementsType.TRIANGLE){var h,u,p,d=t,_=(this._segmentsH+1)*c;for(this._doubleSided&&(_*=2),o=this._segmentsH*this._segmentsW*6,this._doubleSided&&(o*=2),null!=d.indices&&o==d.indices.length?d.invalidateIndices():(d.setIndices(new Uint16Array(o)),this._pInvalidateUVs()),i=d.indices.get(d.numElements),_==d.numVertices?(d.invalidateVertices(d.positions),d.invalidateVertices(d.normals),d.invalidateVertices(d.tangents)):(d.setPositions(new Float32Array(3*_)),d.setNormals(new Float32Array(3*_)),d.setTangents(new Float32Array(3*_)),this._pInvalidateUVs()),v=d.positions.get(_),h=d.normals.get(_),u=d.tangents.get(_),s=d.concatenatedBuffer.stride/4,w=S=A=0;w<=this._segmentsH;++w)for(l=0;l<=this._segmentsW;++l){if(n=(l/this._segmentsW-.5)*this._width,r=(w/this._segmentsH-.5)*this._height,v[S]=n,this._yUp?(v[S+1]=0,v[S+2]=r):(v[S+1]=r,v[S+2]=0),h[S]=0,this._yUp?(h[S+1]=1,h[S+2]=0):(h[S+1]=0,h[S+2]=-1),u[S]=1,u[S+1]=0,u[S+2]=0,S+=s,this._doubleSided){for(var f=S;f<S+3;++f)v[f]=v[f-3],h[f]=-h[f-3],u[f]=-u[f-3];S+=s}l!=this._segmentsW&&w!=this._segmentsH&&(a=l+w*c,p=this._doubleSided?2:1,i[A++]=a*p,i[A++]=(a+c)*p,i[A++]=(a+c+1)*p,i[A++]=a*p,i[A++]=(a+c+1)*p,i[A++]=(a+1)*p,this._doubleSided&&(i[A++]=(a+c+1)*p+1,i[A++]=(a+c)*p+1,i[A++]=a*p+1,i[A++]=(a+1)*p+1,i[A++]=(a+c+1)*p+1,i[A++]=a*p+1))}}else if(e==ElementsType.LINE){for(var m=t,g=this._segmentsH+1+c,y=this._width/2,b=this._height/2,v=new Float32Array(6*g),x=new Float32Array(g),A=0,S=0,w=0;w<=this._segmentsH;++w)v[S++]=-y,v[S++]=0,v[S++]=w*this._height-b,v[S++]=y,v[S++]=0,v[S++]=w*this._height-b,x[A++]=1;for(l=0;l<=this._segmentsW;++l)v[S++]=l*this._width-y,v[S++]=0,v[S++]=-b,v[S++]=l*this._width-y,v[S++]=0,v[S++]=b,x[A++]=1;m.setPositions(v),m.setThickness(x)}},pUc.prototype._pBuildUVs=function(t,e){var i,n,r;if(e==ElementsType.TRIANGLE){r=(this._segmentsH+1)*(this._segmentsW+1),this._doubleSided&&(r*=2);var o=t;o.uvs&&r==o.numVertices?o.invalidateVertices(o.uvs):o.setUVs(new Float32Array(2*r)),i=o.uvs.get(r),n=o.uvs.stride;for(var s=0,a=0;a<=this._segmentsH;++a)for(var l=0;l<=this._segmentsW;++l)i[s]=l/this._segmentsW*this._scaleU,i[s+1]=(1-a/this._segmentsH)*this._scaleV,s+=n,this._doubleSided&&(i[s]=l/this._segmentsW*this._scaleU,i[s+1]=(1-a/this._segmentsH)*this._scaleV,s+=n)}},pUc),PrimitivePolygonPrefab=(lVc=PrimitiveCylinderPrefab,__extends(mVc,lVc),Object.defineProperty(mVc.prototype,"radius",{get:function(){return this._pBottomRadius},set:function(t){this._pBottomRadius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(mVc.prototype,"sides",{get:function(){return this._pSegmentsW},set:function(t){this.setSegmentsW(t)},enumerable:!0,configurable:!0}),Object.defineProperty(mVc.prototype,"subdivisions",{get:function(){return this._pSegmentsH},set:function(t){this.setSegmentsH(t)},enumerable:!0,configurable:!0}),mVc),PrimitiveTorusPrefab=(vVc=PrimitivePrefabBase,__extends(wVc,vVc),Object.defineProperty(wVc.prototype,"radius",{get:function(){return this._radius},set:function(t){this._radius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(wVc.prototype,"tubeRadius",{get:function(){return this._tubeRadius},set:function(t){this._tubeRadius=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),Object.defineProperty(wVc.prototype,"segmentsR",{get:function(){return this._segmentsR},set:function(t){this._segmentsR=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(wVc.prototype,"segmentsT",{get:function(){return this._segmentsT},set:function(t){this._segmentsT=t,this._pInvalidatePrimitive(),this._pInvalidateUVs()},enumerable:!0,configurable:!0}),Object.defineProperty(wVc.prototype,"yUp",{get:function(){return this._yUp},set:function(t){this._yUp=t,this._pInvalidatePrimitive()},enumerable:!0,configurable:!0}),wVc.prototype._pBuildGraphics=function(t,e){var i,n,r,o,s,a,l,c,h,u,p,d,_,f,m,g,y=0;if(e==ElementsType.TRIANGLE){var b=t;this._numVertices=(this._segmentsT+1)*(this._segmentsR+1),y=this._segmentsT*this._segmentsR*6,this._numVertices==b.numVertices?(b.invalidateIndices(),b.invalidateVertices(b.positions),b.invalidateVertices(b.normals),b.invalidateVertices(b.tangents)):(b.setIndices(new Uint16Array(y)),b.setPositions(new Float32Array(3*this._numVertices)),b.setNormals(new Float32Array(3*this._numVertices)),b.setTangents(new Float32Array(3*this._numVertices)),this._pInvalidateUVs()),i=b.indices.get(b.numElements),n=b.positions.get(this._numVertices),r=b.normals.get(this._numVertices),o=b.tangents.get(this._numVertices),s=b.concatenatedBuffer.stride/4,g=m=0;for(var v,x,A,S,w,C,P,E,T,M,D,I=2*Math.PI/this._segmentsR,O=2*Math.PI/this._segmentsT,L=0,F=0,B=0;B<=this._segmentsT;++B)for(L=m,a=0;a<=this._segmentsR;++a)_=a*I,f=B*O,u=(D=Math.cos(f))*Math.cos(_),p=D*Math.sin(_),d=Math.sin(f),l=this._radius*Math.cos(_)+this._tubeRadius*u,c=this._radius*Math.sin(_)+this._tubeRadius*p,h=B==this._segmentsT?0:this._tubeRadius*d,x=this._yUp?(w=-d,C=p,A=0,S=D?u/D:l/this._radius,v=-h,c):(w=p,C=d,A=D?u/D:l/this._radius,S=0,v=c,h),a==this._segmentsR?(n[m]=l,n[m+1]=n[L+1],n[m+2]=n[L+2]):(n[m]=l,n[m+1]=v,n[m+2]=x),r[m]=u,r[m+1]=w,r[m+2]=C,o[m]=-(D?p/D:c/this._radius),o[m+1]=A,o[m+2]=S,m+=s,0<a&&0<B&&(T=(E=(P=F)-1)-this._segmentsR-1,M=P-this._segmentsR-1,i[g++]=P,i[g++]=E,i[g++]=T,i[g++]=P,i[g++]=T,i[g++]=M),F++}},wVc.prototype._pBuildUVs=function(t,e){var i,n,r;if(e==ElementsType.TRIANGLE){var o=t;o.uvs&&this._numVertices==o.numVertices?o.invalidateVertices(o.uvs):o.setUVs(new Float32Array(2*this._numVertices)),n=o.uvs.get(this._numVertices),r=o.uvs.stride;for(var s=0,a=0;a<=this._segmentsT;++a)for(i=0;i<=this._segmentsR;++i)n[s]=i/this._segmentsR*this._scaleU,n[s+1]=a/this._segmentsT*this._scaleV,s+=r}},wVc),Merge=(Object.defineProperty(AWc.prototype,"disposeSources",{get:function(){return this._disposeSources},set:function(t){this._disposeSources=t},enumerable:!0,configurable:!0}),Object.defineProperty(AWc.prototype,"keepMaterial",{get:function(){return this._keepMaterial},set:function(t){this._keepMaterial=t},enumerable:!0,configurable:!0}),Object.defineProperty(AWc.prototype,"objectSpace",{get:function(){return this._objectSpace},set:function(t){this._objectSpace=t},enumerable:!0,configurable:!0}),AWc.prototype.applyToContainer=function(t,e){this.reset(),this.parseContainer(t,e),this.collect(t,!1),this.merge(t,this._disposeSources)},AWc.prototype.applyToSprites=function(t,e){if(this.reset(),e.length){for(var i=0;i<e.length;i++)e[i]!=t&&this.collect(e[i],this._disposeSources);this.collect(t,!1),this.merge(t,this._disposeSources)}},AWc.prototype.apply=function(t,e){this.reset(),this.collect(e,this._disposeSources),this.collect(t,!1),this.merge(t,this._disposeSources)},AWc.prototype.reset=function(){this._toDispose=new Array,this._shapeVOs=new Array},AWc.prototype.merge=function(t,e){for(var i=t.graphics,n=1<this._shapeVOs.length,r=0;r<this._shapeVOs.length;r++){var o=new TriangleElements(new AttributesBuffer);o.autoDeriveNormals=!1,o.autoDeriveTangents=!1;var s=this._shapeVOs[r];o.setIndices(s.indices),o.setPositions(s.vertices),o.setNormals(s.normals),o.setTangents(s.tangents),o.setUVs(s.uvs),this._keepMaterial&&n?i.addShape(Shape.getShape(o,s.material)):i.addShape(Shape.getShape(o))}if(this._keepMaterial&&!n&&this._shapeVOs.length&&(t.material=this._shapeVOs[0].material),e)for(var a=this._toDispose.length;r<a;r++)this._toDispose[r].dispose();this._toDispose=null},AWc.prototype.collect=function(t,e){for(var i,n=0;n<t.graphics.count;n++){var r,o,s,a,l,c=t.graphics.getShapeAt(n).elements,h=this.getShapeData(t.graphics.getShapeAt(n).material),u=this._objectSpace?h.vertices:new Array,p=this._objectSpace?h.normals:new Array,d=this._objectSpace?h.tangents:new Array,_=u.length,f=p.length,m=d.length,g=h.uvs.length;for(this.copyAttributes(c.positions,u,c.numVertices,_),this.copyAttributes(c.normals,p,c.numVertices,f),this.copyAttributes(c.tangents,d,c.numVertices,m),this.copyAttributes(c.uvs,h.uvs,c.numVertices,g),a=this._objectSpace?0:h.vertices.length/3,s=h.indices.length,o=c.numElements,l=c.indices.get(o),r=0;r<o;r++)i=3*r,h.indices[s++]=l[i]+a,h.indices[s++]=l[1+i]+a,h.indices[s++]=l[2+i]+a;if(!this._objectSpace)for(t.transform.concatenatedMatrix3D.transformVectors(u,u),t.transform.concatenatedMatrix3D.deltaTransformVectors(p,p),t.transform.concatenatedMatrix3D.deltaTransformVectors(d,d),_=h.vertices.length,f=h.normals.length,m=h.tangents.length,o=u.length,r=0;r<o;r++)h.vertices[_++]=u[r],h.normals[f++]=p[r],h.tangents[m++]=d[r]}e&&this._toDispose.push(t)},AWc.prototype.copyAttributes=function(t,e,i,n){for(var r=t.get(i),o=t.dimensions,s=t.stride,a=i*s,l=0;l<a;l+=s)for(var c=0;c<o;c++)e[n++]=r[l+c]},AWc.prototype.getShapeData=function(t){var e,i,n;if(this._keepMaterial){for(n=this._shapeVOs.length,i=0;i<n;i++)if(this._shapeVOs[i].material==t){e=this._shapeVOs[i];break}}else this._shapeVOs.length&&(e=this._shapeVOs[0]);return e||((e=new ShapeVO).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)),e},AWc.prototype.parseContainer=function(t,e){var i,n;for(e instanceof Sprite&&e!=t&&this.collect(e,this._disposeSources),n=0;n<e.numChildren;++n)i=e.getChildAt(n),this.parseContainer(t,i)},AWc),ShapeVO=function(){},Scene=(Object.defineProperty(EXc.prototype,"partition",{get:function(){return this._partition},set:function(t){this._partition!=t&&(this._partition=t,this._mousePicker=this._pickGroup.getRaycastPicker(this._partition),this._tabPicker=this._pickGroup.getTabPicker(this._partition),this._mousePicker.findClosestCollision=!0,this._camera&&(this._camera.clear(),this._partition.invalidateEntity(this._camera),this._camera.partition=this._partition),this._mousePicker=this._pickGroup.getRaycastPicker(this._partition),this._tabPicker=this._pickGroup.getTabPicker(this._partition),this._mousePicker.findClosestCollision=!0,this._partition.root.partition=this._partition)},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"view",{get:function(){return this._view},set:function(t){this._view!=t&&(this._view&&(this._renderer&&(RenderGroup.clearInstance(this._view,this._rendererType),this._renderer=null),PickGroup.clearInstance(this._view),this._mouseManager.unregisterContainer(this._view.stage.container),this._mouseManager.unregisterScene(this)),this._view=t,this._pickGroup=PickGroup.getInstance(this._view),this._mouseManager=MouseManager.getInstance(this._pickGroup),this._mouseManager.registerContainer(this._view.stage.container),this._mouseManager.registerScene(this),this._camera&&(this._view.projection=this._camera.projection))},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"renderer",{get:function(){return this._renderer||(this._renderer=RenderGroup.getInstance(this._view,this._rendererType).getRenderer(this._partition)),this._renderer},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"root",{get:function(){return this._partition.root},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"mouseX",{get:function(){return this._mouseX},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"mouseY",{get:function(){return this._mouseY},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"touchPoints",{get:function(){return this._touchPoints},enumerable:!0,configurable:!0}),EXc.prototype.getLocalMouseX=function(t){return t.transform.inverseConcatenatedMatrix3D.transformVector(this._renderer.view.unproject(this._mouseX,this._mouseY,1e3)).x},EXc.prototype.getLocalMouseY=function(t){return t.transform.inverseConcatenatedMatrix3D.transformVector(this._renderer.view.unproject(this._mouseX,this._mouseY,1e3)).y},EXc.prototype.getLocalTouchPoints=function(t){for(var e,i=new Array,n=this._touchPoints.length,r=0;r<n;r++)e=t.transform.inverseConcatenatedMatrix3D.transformVector(this._renderer.view.unproject(this._touchPoints[r].x,this._touchPoints[r].y,1e3)),i.push(new TouchPoint(e.x,e.y,this._touchPoints[r].id));return i},Object.defineProperty(EXc.prototype,"rendererType",{get:function(){return this._rendererType},set:function(t){this._rendererType!=t&&(this._renderer&&(RenderGroup.clearInstance(this._view,this._rendererType),this._renderer=null),this._rendererType=t)},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"camera",{get:function(){return this._camera},set:function(t){this._camera!=t&&(this._camera&&(this._camera.clear(),this._camera.removeEventListener(CameraEvent.PROJECTION_CHANGED,this._onProjectionChangedDelegate)),this._camera=t,this._camera.addEventListener(CameraEvent.PROJECTION_CHANGED,this._onProjectionChangedDelegate),this._view&&(this._view.projection=this._camera.projection),this._partition.invalidateEntity(this._camera),this._camera.partition=this._partition)},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"deltaTime",{get:function(){return this._deltaTime},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"mouseManager",{get:function(){return this._mouseManager},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"mousePicker",{get:function(){return this._mousePicker},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"tabPicker",{get:function(){return this._tabPicker},enumerable:!0,configurable:!0}),Object.defineProperty(EXc.prototype,"renderedFacesCount",{get:function(){return 0},enumerable:!0,configurable:!0}),EXc.prototype.fireMouseEvents=function(){this.disableMouseEvents||this._mouseManager.fireMouseEvents(this)},EXc.prototype.render=function(t){void 0===t&&(t=!0),this._updateTime(),t&&!this.disableMouseEvents&&this._mouseManager.fireMouseEvents(this),this.beforeRenderCallback&&this.beforeRenderCallback(),this.renderer.render()},EXc.prototype._updateTime=function(){var t=getTimer();0==this._time&&(this._time=t),this._deltaTime=t-this._time,this._time=t},EXc.prototype.dispose=function(){this._renderer&&(RenderGroup.clearInstance(this._view,this._rendererType),this._renderer=null),this._mouseManager.unregisterScene(this),this._mouseManager=null},EXc.prototype._onProjectionChanged=function(t){this._view.projection=this._camera.projection},EXc.prototype.getViewCollision=function(t,e){var i=this._view.unproject(t,e,0),n=this._view.unproject(t,e,1).subtract(i);return this._mousePicker.getCollision(i,n)},EXc),vVc,lVc,oUc,dUc,ISc,IRc;function EXc(t,e,i,n){var r=this;void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),this._time=0,this._deltaTime=0,this._touchPoints=new Array,this._onProjectionChangedDelegate=function(t){return r._onProjectionChanged(t)},this._rendererType=n||RendererType.DEFAULT,this.view=i||new View,this.partition=t||new BasicPartition(new DisplayObjectContainer),this.camera=e||new Camera}function AWc(t,e,i){void 0===t&&(t=!1),void 0===e&&(e=!1),void 0===i&&(i=!1),this._keepMaterial=t,this._disposeSources=e,this._objectSpace=i}function wVc(t,e,i,n,r,o,s){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=50),void 0===n&&(n=50),void 0===r&&(r=16),void 0===o&&(o=8),void 0===s&&(s=!0);var a=vVc.call(this,t,e)||this;return a._numVertices=0,a._radius=i,a._tubeRadius=n,a._segmentsR=r,a._segmentsT=o,a._yUp=s,a}function mVc(t,e,i,n,r){return void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=100),void 0===n&&(n=16),void 0===r&&(r=!0),lVc.call(this,t,e,i,0,0,n,1,!0,!1,!1,r)||this}function pUc(t,e,i,n,r,o,s,a){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=100),void 0===n&&(n=100),void 0===r&&(r=1),void 0===o&&(o=1),void 0===s&&(s=!0),void 0===a&&(a=!1);var l=oUc.call(this,t,e)||this;return l._segmentsW=r,l._segmentsH=o,l._yUp=s,l._width=i,l._height=n,l._doubleSided=a,l}function eUc(t,e,i,n,r,o,s,a){return void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=50),void 0===n&&(n=100),void 0===r&&(r=16),void 0===o&&(o=1),void 0===s&&(s=!0),void 0===a&&(a=!0),dUc.call(this,t,e,0,i,n,r,o,!1,s,!0,a)||this}function JSc(t,e,i,n,r,o,s,a,l,c,h){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=50),void 0===n&&(n=50),void 0===r&&(r=100),void 0===o&&(o=16),void 0===s&&(s=1),void 0===a&&(a=!0),void 0===l&&(l=!0),void 0===c&&(c=!0),void 0===h&&(h=!0);var u=ISc.call(this,t,e)||this;return u._numVertices=0,u._topRadius=i,u._pBottomRadius=n,u._height=r,u._pSegmentsW=o,u._pSegmentsH=s,u._topClosed=a,u._bottomClosed=l,u._surfaceClosed=c,u._yUp=h,u}function JRc(t,e,i,n,r,o,s){void 0===t&&(t=null),void 0===e&&(e="triangle"),void 0===i&&(i=50),void 0===n&&(n=100),void 0===r&&(r=16),void 0===o&&(o=15),void 0===s&&(s=!0);var a=IRc.call(this,t,e)||this;return a._numVertices=0,a._radius=i,a._height=n,a._segmentsW=r,a._segmentsH=o%2==0?o+1:o,a._yUp=s,a}function PPc(t){var e=this;this._sceneLookup=new Array,this._containerLookup=new Array,this.allowKeyInput=!0,this._collisionIsEnabledButton=!1,this._eventBubbling=!0,this._allowFocusOnUnfocusable=!0,this._nullVector=new Vector3D,this._queuedEvents=new Array,this._mouseUp=new MouseEvent$1(MouseEvent$1.MOUSE_UP),this._mouseUpOutside=new MouseEvent$1(MouseEvent$1.MOUSE_UP_OUTSIDE),this._mouseClick=new MouseEvent$1(MouseEvent$1.CLICK),this._mouseOut=new MouseEvent$1(MouseEvent$1.MOUSE_OUT),this._dragOut=new MouseEvent$1(MouseEvent$1.DRAG_OUT),this._dragOver=new MouseEvent$1(MouseEvent$1.DRAG_OVER),this._mouseDown=new MouseEvent$1(MouseEvent$1.MOUSE_DOWN),this._mouseMove=new MouseEvent$1(MouseEvent$1.MOUSE_MOVE),this._mouseOver=new MouseEvent$1(MouseEvent$1.MOUSE_OVER),this._mouseWheel=new MouseEvent$1(MouseEvent$1.MOUSE_WHEEL),this._mouseDoubleClick=new MouseEvent$1(MouseEvent$1.DOUBLE_CLICK),this._rollOver=new MouseEvent$1(MouseEvent$1.ROLL_OVER),this._rollOut=new MouseEvent$1(MouseEvent$1.ROLL_OUT),this._dragMove=new MouseEvent$1(MouseEvent$1.DRAG_MOVE),this._dragStart=new MouseEvent$1(MouseEvent$1.DRAG_START),this._dragStop=new MouseEvent$1(MouseEvent$1.DRAG_STOP),this._useSoftkeyboard=!1,this._isAVM1Dragging=!1,this._isDown=!1,this._pickGroup=t,this.onClickDelegate=function(t){return e.onClick(t)},this.onDoubleClickDelegate=function(t){return e.onDoubleClick(t)},this.onMouseDownDelegate=function(t){return e.onMouseDown(t)},this.onMouseMoveDelegate=function(t){return e.onMouseMove(t)},this.onMouseUpDelegate=function(t){return e.onMouseUp(t)},this.onMouseWheelDelegate=function(t){return e.onMouseWheel(t)},this.onMouseOverDelegate=function(t){return e.onMouseOver(t)},this.onMouseOutDelegate=function(t){return e.onMouseOut(t)},this.onKeyDownDelegate=function(t){return e.onKeyDown(t)},this.onKeyUpDelegate=function(t){return e.onKeyUp(t)},this.buttonEnabledDirty=!1,this._isTouch="ontouchstart"in window||0<navigator.msMaxTouchPoints,this._showCursor=!0,this._mouseDragging=!1}MaterialManager.materialClass=MethodMaterial,MaterialManager.textureClass=ImageTexture2D,console.debug("AwayJS - Scene - 0.13.70");var jsGlobal=Function("return this")();function pow2(t){return t===(0|t)?t<0?1/(1<<-t):1<<t:Math.pow(2,t)}function clamp$1(t,e,i){return Math.max(e,Math.min(i,t))}function roundHalfEven(t){if(.5!==Math.abs(t%1))return Math.round(t);var e=Math.floor(t);return e%2==0?e:Math.ceil(t)}function altTieBreakRound(t,e){return.5!==Math.abs(t%1)||e?Math.round(t):0|t}function epsilonEquals(t,e){return Math.abs(t-e)<1e-7}var NumberUtilities={pow2:pow2,clamp:clamp$1,roundHalfEven:roundHalfEven,altTieBreakRound:altTieBreakRound,epsilonEquals:epsilonEquals};function repeatString(t,e){for(var i="",n=0;n<e;n++)i+=t;return i}function memorySizeToString(t){return(t|=0)<1024?t+" B":t<1048576?(t/1024).toFixed(2)+"KB":(t/1048576).toFixed(2)+"MB"}function toSafeString(t){return"string"==typeof t?'"'+t+'"':"number"==typeof t||"boolean"==typeof t?String(t):t instanceof Array?"[] "+t.length:typeof t}function toSafeArrayString(t){for(var e=[],i=0;i<t.length;i++)e.push(toSafeString(t[i]));return e.join(", ")}function utf8decode$1(t){for(var e=new Uint8Array(4*t.length),i=0,n=0,r=t.length;n<r;n++){var o,s=t.charCodeAt(n);s<=127?e[i++]=s:(55296<=s&&s<=56319&&(56320<=(o=t.charCodeAt(n+1))&&o<=57343&&(s=((1023&s)<<10)+(1023&o)+65536,++n)),0!=(4292870144&s)?(e[i++]=248|s>>>24&3,e[i++]=128|s>>>18&63,e[i++]=128|s>>>12&63,e[i++]=128|s>>>6&63):0!=(4294901760&s)?(e[i++]=240|s>>>18&7,e[i++]=128|s>>>12&63,e[i++]=128|s>>>6&63):0!=(4294965248&s)?(e[i++]=224|s>>>12&15,e[i++]=128|s>>>6&63):e[i++]=192|s>>>6&31,e[i++]=128|63&s)}return e.subarray(0,i)}function utf8encode$1(t){for(var e=0,i="";e<t.length;){var n=255&t[e++];if(n<=127)i+=String.fromCharCode(n);else{var r=192,o=5;do{if((n&(r>>1|128))===r)break;r=r>>1|128,--o}while(0<=o);if(o<=0){i+=String.fromCharCode(n);continue}for(var s=n&(1<<o)-1,a=!1,l=5;o<=l;--l){var c=t[e++];if(128!=(192&c)){a=!0;break}s=s<<6|63&c}if(a){for(var h=e-(7-l);h<e;++h)i+=String.fromCharCode(255&t[h]);continue}i+=65536<=s?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}}return i}function base64EncodeBytes(t){for(var e,i="",n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=t.byteLength,o=r%3,s=r-o,a=0;a<s;a+=3)i+=concat4(n[(16515072&(e=t[a]<<16|t[a+1]<<8|t[a+2]))>>18],n[(258048&e)>>12],n[(4032&e)>>6],n[63&e]);return 1==o?i+=concat3(n[(252&(e=t[s]))>>2],n[(3&e)<<4],"=="):2==o&&(i+=concat4(n[(64512&(e=t[s]<<8|t[1+s]))>>10],n[(1008&e)>>4],n[(15&e)<<2],"=")),i}var base64DecodeMap=[62,0,0,0,63,52,53,54,55,56,57,58,59,60,61,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,0,0,0,0,0,0,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],base64DecodeMapOffset=43,base64EOF=61;function decodeRestrictedBase64ToBytes(t){for(var e,i,n,r=t.length,o="="===t.charAt(r-2)?2:"="===t.charAt(r-1)?1:0,s=new Uint8Array(3*(t.length>>2)-o),a=0,l=0;a<t.length;){if(e=t.charCodeAt(a++),i=base64DecodeMap[e-base64DecodeMapOffset],e=t.charCodeAt(a++),n=base64DecodeMap[e-base64DecodeMapOffset],s[l++]=i<<2|(48&n)>>4,(e=t.charCodeAt(a++))==base64EOF)return s;if(i=base64DecodeMap[e-base64DecodeMapOffset],s[l++]=(15&n)<<4|(60&i)>>2,(e=t.charCodeAt(a++))==base64EOF)return s;n=base64DecodeMap[e-base64DecodeMapOffset],s[l++]=(3&i)<<6|n}return s}function escapeString(t){return void 0!==t&&(t=t.replace(/[^\w$]/gi,"$"),/^\d/.test(t)&&(t="$"+t)),t}function fromCharCodeArray(t){for(var e="",i=0;i<t.length;i+=16384){var n=Math.min(t.length-i,16384);e+=String.fromCharCode.apply(null,t.subarray(i,i+n))}return e}var _encoding="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789$_";function variableLengthEncodeInt32(t){for(var e=_encoding,i=32-Math.clz32(t),n=Math.ceil(i/6),r=e[n],o=n-1;0<=o;o--)r+=e[t>>6*o&63];return r}function toEncoding(t){return _encoding[t]}function fromEncoding(t){return 65<=t&&t<=90?t-65:97<=t&&t<=122?t-71:48<=t&&t<=57?t+4:36===t?62:95===t?63:void 0}function variableLengthDecodeInt32(t){for(var e=fromEncoding(t.charCodeAt(0)),i=0,n=0;n<e;n++){var r=6*(e-n-1);i|=fromEncoding(t.charCodeAt(1+n))<<r}return i}function trimMiddle(t,e){if(t.length<=e)return t;var i=e>>1,n=e-i-1;return t.substr(0,i)+"…"+t.substr(t.length-n,n)}function multiple(t,e){for(var i="",n=0;n<e;n++)i+=t;return i}function indexOfAny(t,e,i){for(var n=t.length,r=0;r<e.length;r++){var o=t.indexOf(e[r],i);0<=o&&(n=Math.min(n,o))}return n===t.length?-1:n}var _concat3array=new Array(3),_concat4array=new Array(4),_concat9array=new Array(9);function concat3(t,e,i){return _concat3array[0]=t,_concat3array[1]=e,_concat3array[2]=i,_concat3array.join("")}function concat4(t,e,i,n){return _concat4array[0]=t,_concat4array[1]=e,_concat4array[2]=i,_concat4array[3]=n,_concat4array.join("")}function concat9(t,e,i,n,r,o,s,a,l){return _concat9array[0]=t,_concat9array[1]=e,_concat9array[2]=i,_concat9array[3]=n,_concat9array[4]=r,_concat9array[5]=o,_concat9array[6]=s,_concat9array[7]=a,_concat9array[8]=l,_concat9array.join("")}var StringUtilities={repeatString:repeatString,memorySizeToString:memorySizeToString,toSafeString:toSafeString,toSafeArrayString:toSafeArrayString,utf8decode:utf8decode$1,utf8encode:utf8encode$1,base64EncodeBytes:base64EncodeBytes,base64DecodeMap:base64DecodeMap,base64DecodeMapOffset:base64DecodeMapOffset,base64EOF:base64EOF,decodeRestrictedBase64ToBytes:decodeRestrictedBase64ToBytes,escapeString:escapeString,fromCharCodeArray:fromCharCodeArray,variableLengthEncodeInt32:variableLengthEncodeInt32,toEncoding:toEncoding,fromEncoding:fromEncoding,variableLengthDecodeInt32:variableLengthDecodeInt32,trimMiddle:trimMiddle,multiple:multiple,indexOfAny:indexOfAny,_concat3array:_concat3array,_concat4array:_concat4array,_concat9array:_concat9array,concat3:concat3,concat4:concat4,concat9:concat9},Cache=(ZZc.prototype.get=function(t){return this._data[t]},ZZc.prototype.set=function(t,e){return!(this._size>=this._maxSize||(this._data[t]=e,this._size++,0))},ZZc);function ZZc(t){this._data=Object.create(null),this._size=0,this._maxSize=t}function toS8U8(t){return 256*t<<16>>16}function fromS8U8(t){return t/256}function clampS8U8(t){return fromS8U8(toS8U8(t))}function toS16(t){return t<<16>>16}function ones(t){return 16843009*((t=(858993459&(t-=t>>1&1431655765))+(t>>2&858993459))+(t>>4)&252645135)>>24}function RGBAToARGB(t){return t>>8&16777215|(255&t)<<24}Math.imul||(Math.imul=function(t,e){var i=65535&t,n=65535&e;return i*n+((t>>>16&65535)*n+i*(e>>>16&65535)<<16>>>0)|0}),Math.clz32||(Math.clz32=function(t){return t|=t>>1,t|=t>>2,t|=t>>4,t|=t>>8,32-ones(t|=t>>16)});var rgbaToCSSStyleCache=new Cache(1024);function rgbaToCSSStyle(t){var e=rgbaToCSSStyleCache.get(t);return"string"==typeof e||(e=concat9("rgba(",t>>24&255,",",t>>16&255,",",t>>8&255,",",(255&t)/255,")"),rgbaToCSSStyleCache.set(t,e)),e}var ShumwayCom={getWeakMapKeys:function(t){return null}},Shumway={version:"",build:""},inBrowser="undefined"!=typeof window&&"document"in window&&"plugins"in window.document,inFirefox="undefined"!=typeof navigator&&0<=navigator.userAgent.indexOf("Firefox");function dumpLine(t){"undefined"!=typeof dump&&dump(t+"\n")}jsGlobal.performance||(jsGlobal.performance={}),jsGlobal.performance.now||(jsGlobal.performance.now=function(){return Date.now()});var START_TIME=performance.now(),UINT32_CHAR_BUFFER_LENGTH=10,UINT32_MAX_DIV_10=429496729,UINT32_MAX_MOD_10=5;function isString(t){return"string"==typeof t}function isNumber(t){return"number"==typeof t}function isInteger(t){return(0|t)===t}function isObject(t){return"object"==typeof t||"function"==typeof t}function toNumber(t){return+t}function isNumericString(t){return String(Number(t))===t}function isNumeric(t){if("number"==typeof t)return 1;if("string"==typeof t){var e=t.charCodeAt(0);return!(65<=e&&e<=90||97<=e&&e<=122||36===e||95===e)&&(isIndex(t)||isNumericString(t))}}function isIndex(t){var e=0;if("number"==typeof t)return t===(e=0|t)&&0<=e||t>>>0===t;if("string"!=typeof t)return!1;var i=t.length;if(0===i)return!1;if("0"===t)return!0;if(UINT32_CHAR_BUFFER_LENGTH<i)return!1;var n=0;if((e=t.charCodeAt(n++)-48)<1||9<e)return!1;for(var r=0,o=0;n<i;){if((o=t.charCodeAt(n++)-48)<0||9<o)return!1;e=10*(r=e)+o}return r<UINT32_MAX_DIV_10||r===UINT32_MAX_DIV_10&&o<=UINT32_MAX_MOD_10}function isNullOrUndefined$1(t){return null==t}function polyfillWeakMap(){var t;function e(){this.id="$weakmap"+t++}"function"!=typeof jsGlobal.WeakMap&&(t=0,e.prototype={has:function(t){return t.hasOwnProperty(this.id)},get:function(t,e){return t.hasOwnProperty(this.id)?t[this.id]:e},set:function(t,e){Object.defineProperty(t,this.id,{value:e,enumerable:!1,configurable:!0})},delete:function(t){delete t[this.id]}},jsGlobal.WeakMap=e)}polyfillWeakMap();var WeakList=(O$c.prototype.clear=function(){this._map?this._map.clear():this._list.length=0},O$c.prototype.push=function(e){this._map?(assert$2(!this._map.has(e)),this._map.set(e,this._id++),this._newAdditions.forEach(function(t){t.push(e)})):(assert$2(-1===this._list.indexOf(e)),this._list.push(e))},O$c.prototype.remove=function(t){this._map?(assert$2(this._map.has(t)),this._map.delete(t)):(assert$2(-1<this._list.indexOf(t)),this._list[this._list.indexOf(t)]=null,assert$2(-1===this._list.indexOf(t)))},O$c.prototype.forEach=function(e){if(this._map){var t=[];this._newAdditions.push(t);var i=this._map,n=ShumwayCom.getWeakMapKeys(i);return n.sort(function(t,e){return i.get(t)-i.get(e)}),n.forEach(function(t){0!==t._referenceCount&&e(t)}),t.forEach(function(t){0!==t._referenceCount&&e(t)}),void this._newAdditions.splice(this._newAdditions.indexOf(t),1)}for(var r=this._list,o=0,s=0;s<r.length;s++)(a=r[s])&&(0===a._referenceCount?(r[s]=null,o++):e(a));if(16<o&&o>r.length>>2){for(var a,l=[],s=0;s<r.length;s++)(a=r[s])&&0<a._referenceCount&&l.push(a);this._list=l}},Object.defineProperty(O$c.prototype,"length",{get:function(){return this._map?-1:this._list.length},enumerable:!0,configurable:!0}),O$c),IndentingWriter=(Object.defineProperty(d_c.prototype,"suppressOutput",{get:function(){return this._suppressOutput},set:function(t){this._suppressOutput=t},enumerable:!0,configurable:!0}),d_c.prototype.write=function(t,e){void 0===t&&(t=""),void 0===e&&(e=!1),this._suppressOutput||this._outNoNewline((e?this._padding:"")+t)},d_c.prototype.writeLn=function(t){void 0===t&&(t=""),this._suppressOutput||this._out(this._padding+t)},d_c.prototype.writeObject=function(t,e){void 0===t&&(t=""),this._suppressOutput||this._out(this._padding+t,e)},d_c.prototype.writeTimeLn=function(t){void 0===t&&(t=""),this._suppressOutput||this._out(this._padding+performance.now().toFixed(2)+" "+t)},d_c.prototype.writeComment=function(t){var e=(t||"").split("\n");if(1===e.length)this.writeLn("// "+e[0]);else{this.writeLn("/**");for(var i=0;i<e.length;i++)this.writeLn(" * "+e[i]);this.writeLn(" */")}},d_c.prototype.writeLns=function(t){for(var e=(t||"").split("\n"),i=0;i<e.length;i++)this.writeLn(e[i])},d_c.prototype.errorLn=function(t){1&d_c.logLevel&&this.boldRedLn(t)},d_c.prototype.warnLn=function(t){2&d_c.logLevel&&this.yellowLn(t)},d_c.prototype.debugLn=function(t){4&d_c.logLevel&&this.purpleLn(t)},d_c.prototype.logLn=function(t){8&d_c.logLevel&&this.writeLn(t)},d_c.prototype.infoLn=function(t){16&d_c.logLevel&&this.writeLn(t)},d_c.prototype.yellowLn=function(t){this.colorLn(d_c.YELLOW,t)},d_c.prototype.greenLn=function(t){this.colorLn(d_c.GREEN,t)},d_c.prototype.boldRedLn=function(t){this.colorLn(d_c.BOLD_RED,t)},d_c.prototype.redLn=function(t){this.colorLn(d_c.RED,t)},d_c.prototype.purpleLn=function(t){this.colorLn(d_c.PURPLE,t)},d_c.prototype.colorLn=function(t,e){this._suppressOutput||(inBrowser?this._out(this._padding+e):this._out(this._padding+t+e+d_c.ENDC))},d_c.prototype.redLns=function(t){this.colorLns(d_c.RED,t)},d_c.prototype.colorLns=function(t,e){for(var i=(e||"").split("\n"),n=0;n<i.length;n++)this.colorLn(t,i[n])},d_c.prototype.enter=function(t){this._suppressOutput||this._out(this._padding+t),this.indent()},d_c.prototype.leaveAndEnter=function(t){this.leave(t),this.indent()},d_c.prototype.leave=function(t){this.outdent(),!this._suppressOutput&&t&&this._out(this._padding+t)},d_c.prototype.indent=function(){this._padding+=this._tab},d_c.prototype.outdent=function(){0<this._padding.length&&(this._padding=this._padding.substring(0,this._padding.length-this._tab.length))},d_c.prototype.writeArray=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1),e=e||!1;for(var n=0,r=t.length;n<r;n++){var o="";e&&(o=null===t[n]?"null":void 0===t[n]?"undefined":t[n].constructor.name,o+=" ");var s=i?"":(""+n).padRight(" ",4);this.writeLn(s+o+t[n])}},d_c.PURPLE="33[94m",d_c.YELLOW="33[93m",d_c.GREEN="33[92m",d_c.RED="33[91m",d_c.BOLD_RED="33[1;91m",d_c.ENDC="33[0m",d_c.logLevel=31,d_c._consoleOut=console.log.bind(console),d_c._consoleOutNoNewline=console.log.bind(console),d_c),Bounds$1=(U_c.FromUntyped=function(t){return new U_c(t.xMin,t.yMin,t.xMax,t.yMax)},U_c.FromRectangle=function(t){return new U_c(20*t.x|0,20*t.y|0,20*(t.x+t.width)|0,20*(t.y+t.height)|0)},U_c.prototype.setElements=function(t,e,i,n){this.xMin=t,this.yMin=e,this.xMax=i,this.yMax=n},U_c.prototype.copyFrom=function(t){this.setElements(t.xMin,t.yMin,t.xMax,t.yMax)},U_c.prototype.contains=function(t,e){return t<this.xMin!=t<this.xMax&&e<this.yMin!=e<this.yMax},U_c.prototype.unionInPlace=function(t){t.isEmpty()||(this.extendByPoint(t.xMin,t.yMin),this.extendByPoint(t.xMax,t.yMax))},U_c.prototype.extendByPoint=function(t,e){this.extendByX(t),this.extendByY(e)},U_c.prototype.extendByX=function(t){134217728!==this.xMin?(this.xMin=Math.min(this.xMin,t),this.xMax=Math.max(this.xMax,t)):this.xMin=this.xMax=t},U_c.prototype.extendByY=function(t){134217728!==this.yMin?(this.yMin=Math.min(this.yMin,t),this.yMax=Math.max(this.yMax,t)):this.yMin=this.yMax=t},U_c.prototype.intersects=function(t){return this.contains(t.xMin,t.yMin)||this.contains(t.xMax,t.yMax)},U_c.prototype.isEmpty=function(){return this.xMax<=this.xMin||this.yMax<=this.yMin},Object.defineProperty(U_c.prototype,"width",{get:function(){return this.xMax-this.xMin},set:function(t){this.xMax=this.xMin+t},enumerable:!0,configurable:!0}),Object.defineProperty(U_c.prototype,"height",{get:function(){return this.yMax-this.yMin},set:function(t){this.yMax=this.yMin+t},enumerable:!0,configurable:!0}),U_c.prototype.getBaseWidth=function(t){var e=Math.abs(Math.cos(t)),i=Math.abs(Math.sin(t));return e*(this.xMax-this.xMin)+i*(this.yMax-this.yMin)},U_c.prototype.getBaseHeight=function(t){var e=Math.abs(Math.cos(t));return Math.abs(Math.sin(t))*(this.xMax-this.xMin)+e*(this.yMax-this.yMin)},U_c.prototype.setEmpty=function(){this.xMin=this.yMin=this.xMax=this.yMax=0},U_c.prototype.setToSentinels=function(){this.xMin=this.yMin=this.xMax=this.yMax=134217728},U_c.prototype.clone=function(){return new U_c(this.xMin,this.yMin,this.xMax,this.yMax)},U_c.prototype.toString=function(){return"{ xMin: "+this.xMin+", xMin: "+this.yMin+", xMax: "+this.xMax+", xMax: "+this.yMax+" }"},U_c),DebugBounds=(t0c.FromUntyped=function(t){return new t0c(t.xMin,t.yMin,t.xMax,t.yMax)},t0c.FromRectangle=function(t){return new t0c(20*t.x|0,20*t.y|0,20*(t.x+t.width)|0,20*(t.y+t.height)|0)},t0c.prototype.setElements=function(t,e,i,n){this.xMin=t,this.yMin=e,this.xMax=i,this.yMax=n},t0c.prototype.copyFrom=function(t){this.setElements(t.xMin,t.yMin,t.xMax,t.yMax)},t0c.prototype.contains=function(t,e){return t<this.xMin!=t<this.xMax&&e<this.yMin!=e<this.yMax},t0c.prototype.unionInPlace=function(t){t.isEmpty()||(this.extendByPoint(t.xMin,t.yMin),this.extendByPoint(t.xMax,t.yMax))},t0c.prototype.extendByPoint=function(t,e){this.extendByX(t),this.extendByY(e)},t0c.prototype.extendByX=function(t){134217728!==this.xMin?(this.xMin=Math.min(this.xMin,t),this.xMax=Math.max(this.xMax,t)):this.xMin=this.xMax=t},t0c.prototype.extendByY=function(t){134217728!==this.yMin?(this.yMin=Math.min(this.yMin,t),this.yMax=Math.max(this.yMax,t)):this.yMin=this.yMax=t},t0c.prototype.intersects=function(t){return this.contains(t._xMin,t._yMin)||this.contains(t._xMax,t._yMax)},t0c.prototype.isEmpty=function(){return this._xMax<=this._xMin||this._yMax<=this._yMin},Object.defineProperty(t0c.prototype,"xMin",{get:function(){return this._xMin},set:function(t){assert$2(isInteger(t)),this._xMin=t,this.assertValid()},enumerable:!0,configurable:!0}),Object.defineProperty(t0c.prototype,"yMin",{get:function(){return this._yMin},set:function(t){assert$2(isInteger(t)),this._yMin=0|t,this.assertValid()},enumerable:!0,configurable:!0}),Object.defineProperty(t0c.prototype,"xMax",{get:function(){return this._xMax},set:function(t){assert$2(isInteger(t)),this._xMax=0|t,this.assertValid()},enumerable:!0,configurable:!0}),Object.defineProperty(t0c.prototype,"width",{get:function(){return this._xMax-this._xMin},enumerable:!0,configurable:!0}),Object.defineProperty(t0c.prototype,"yMax",{get:function(){return this._yMax},set:function(t){assert$2(isInteger(t)),this._yMax=0|t,this.assertValid()},enumerable:!0,configurable:!0}),Object.defineProperty(t0c.prototype,"height",{get:function(){return this._yMax-this._yMin},enumerable:!0,configurable:!0}),t0c.prototype.getBaseWidth=function(t){var e=Math.abs(Math.cos(t)),i=Math.abs(Math.sin(t));return e*(this._xMax-this._xMin)+i*(this._yMax-this._yMin)},t0c.prototype.getBaseHeight=function(t){var e=Math.abs(Math.cos(t));return Math.abs(Math.sin(t))*(this._xMax-this._xMin)+e*(this._yMax-this._yMin)},t0c.prototype.setEmpty=function(){this._xMin=this._yMin=this._xMax=this._yMax=0},t0c.prototype.clone=function(){return new t0c(this.xMin,this.yMin,this.xMax,this.yMax)},t0c.prototype.toString=function(){return"{ xMin: "+this._xMin+", yMin: "+this._yMin+", xMax: "+this._xMax+", yMax: "+this._yMax+" }"},t0c.prototype.assertValid=function(){},t0c),Color=(W0c.FromARGB=function(t){return new W0c((t>>16&255)/255,(t>>8&255)/255,(t>>0&255)/255,(t>>24&255)/255)},W0c.FromRGBA=function(t){return W0c.FromARGB(RGBAToARGB(t))},W0c.prototype.toRGBA=function(){return 255*this.r<<24|255*this.g<<16|255*this.b<<8|255*this.a},W0c.prototype.toCSSStyle=function(){return rgbaToCSSStyle(this.toRGBA())},W0c.prototype.set=function(t){this.r=t.r,this.g=t.g,this.b=t.b,this.a=t.a},W0c.randomColor=function(t){return void 0===t&&(t=1),new W0c(Math.random(),Math.random(),Math.random(),t)},W0c.parseColor=function(t){if(W0c.colorCache||(W0c.colorCache=Object.create(null)),W0c.colorCache[t])return W0c.colorCache[t];var e=document.createElement("span");document.body.appendChild(e),e.style.backgroundColor=t;var i=getComputedStyle(e).backgroundColor;document.body.removeChild(e);var n=(n=/^rgb\((\d+), (\d+), (\d+)\)$/.exec(i))||/^rgba\((\d+), (\d+), (\d+), ([\d.]+)\)$/.exec(i),r=new W0c(0,0,0,0);return r.r=parseFloat(n[1])/255,r.g=parseFloat(n[2])/255,r.b=parseFloat(n[3])/255,r.a=n[4]?parseFloat(n[4])/255:1,W0c.colorCache[t]=r},W0c.Red=new W0c(1,0,0,1),W0c.Green=new W0c(0,1,0,1),W0c.Blue=new W0c(0,0,1,1),W0c.None=new W0c(0,0,0,0),W0c.White=new W0c(1,1,1,1),W0c.Black=new W0c(0,0,0,1),W0c.colorCache={},W0c),ImageType$1,i1c;function W0c(t,e,i,n){this.r=t,this.g=e,this.b=i,this.a=n}function t0c(t,e,i,n){assert$2(isInteger(t)),assert$2(isInteger(e)),assert$2(isInteger(i)),assert$2(isInteger(n)),this._xMin=0|t,this._yMin=0|e,this._xMax=0|i,this._yMax=0|n,this.assertValid()}function U_c(t,e,i,n){this.xMin=0|t,this.yMin=0|e,this.xMax=0|i,this.yMax=0|n}function d_c(t,e){void 0===t&&(t=!1),this._tab=" ",this._padding="",this._suppressOutput=t,this._out=e||d_c._consoleOut,this._outNoNewline=e||d_c._consoleOutNoNewline}function O$c(){void 0!==ShumwayCom&&ShumwayCom.getWeakMapKeys?(this._map=new WeakMap,this._id=0,this._newAdditions=[]):this._list=[]}i1c=ImageType$1=ImageType$1||{},i1c[i1c.None=0]="None",i1c[i1c.PremultipliedAlphaARGB=1]="PremultipliedAlphaARGB",i1c[i1c.StraightAlphaARGB=2]="StraightAlphaARGB",i1c[i1c.StraightAlphaRGBA=3]="StraightAlphaRGBA",i1c[i1c.JPEG=4]="JPEG",i1c[i1c.PNG=5]="PNG",i1c[i1c.GIF=6]="GIF";var PromiseWrapper=(j1c.prototype.then=function(t,e){return this.promise.then(t,e)},j1c);function j1c(){this.promise=new Promise(function(t,e){this.resolve=t,this.reject=e}.bind(this))}function o1c(t,e,i){t[e]||Object.defineProperty(t,e,{value:i,writable:!0,configurable:!0,enumerable:!1})}"undefined"!=typeof exports&&(exports.Shumway=Shumway),o1c(String.prototype,"padRight",function(t,e){var i=this,n=i.replace(/\033\[[0-9]*m/g,"").length;if(!t||e<=n)return i;for(var r=(e-n)/t.length,o=0;o<r;o++)i+=t;return i}),o1c(String.prototype,"padLeft",function(t,e){var i=this,n=i.length;if(!t||e<=n)return i;for(var r=(e-n)/t.length,o=0;o<r;o++)i=t+i;return i}),o1c(String.prototype,"trim",function(){return this.replace(/^\s+|\s+$/g,"")}),o1c(String.prototype,"endsWith",function(t){return-1!==this.indexOf(t,this.length-t.length)}),o1c(Array.prototype,"replace",function(t,e){if(t===e)return 0;for(var i=0,n=0;n<this.length;n++)this[n]===t&&(this[n]=e,i++);return i});var OptionSet=(K1c.isOptionSet=function(t){return t instanceof K1c||!("object"!=typeof t||null===t||t instanceof Option)&&"options"in t&&"name"in t&&"settings"in t},K1c.prototype.register=function(t){if(K1c.isOptionSet(t))for(var e=0;e<this.options.length;e++){var i=this.options[e];if(K1c.isOptionSet(i)&&i.name===t.name)return i}if(this.options.push(t),this.settings)if(K1c.isOptionSet(t)){var n=this.settings[t.name];isObject(n)&&(t.settings=n.settings,t.open=n.open)}else if(void 0!==this.settings[t.longName])switch(t.type){case"boolean":t.value=!!this.settings[t.longName];break;case"number":t.value=+this.settings[t.longName];break;default:t.value=this.settings[t.longName]}return t},K1c.prototype.trace=function(e){e.enter(this.name+" {"),this.options.forEach(function(t){t.trace(e)}),e.leave("}")},K1c.prototype.getSettings=function(){var e={};return this.options.forEach(function(t){K1c.isOptionSet(t)?e[t.name]={settings:t.getSettings(),open:t.open}:e[t.longName]=t.value}),e},K1c.prototype.setSettings=function(e){e&&this.options.forEach(function(t){K1c.isOptionSet(t)?t.name in e&&t.setSettings(e[t.name].settings):t.longName in e&&(t.value=e[t.longName])})},K1c),Option=(Y1c.prototype.parse=function(t){this.value=t},Y1c.prototype.trace=function(t){t.writeLn(("-"+this.shortName+"|--"+this.longName).padRight(" ",30)+" = "+this.type+" "+this.value+" ["+this.defaultValue+"] ("+this.description+")")},Y1c),ROOT="Shumway Options",shumwayOptions=new OptionSet(ROOT),loggingOptions=shumwayOptions.register(new OptionSet("Logging Options")),omitRepeatedWarnings=loggingOptions.register(new Option("wo","warnOnce","boolean",!0,"Omit Repeated Warnings")),release=!0,Debug=(f2c.release=release,f2c.assert=assert$2,f2c.error=error,f2c.assertUnreachable=assertUnreachable,f2c.assertNotImplemented=assertNotImplemented,f2c.warning=warning,f2c.notImplemented=notImplemented,f2c.dummyConstructor=dummyConstructor,f2c.warnCounts=warnCounts,f2c.abstractMethod=abstractMethod,f2c.somewhatImplemented=somewhatImplemented,f2c.unexpected=unexpected,f2c.unexpectedCase=unexpectedCase,f2c);function f2c(){}function Y1c(t,e,i,n,r,o){void 0===o&&(o=null),this.longName=e,this.shortName=t,this.type=i,this.defaultValue=n,this.value=n,this.description=r,this.config=o}function K1c(t,e){void 0===e&&(e=null),this.open=!1,this.name=t,this.settings=e||{},this.options=[]}function notImplemented(t){}function somewhatImplemented(t){}function error(t){throw console.error(t),new Error(t)}function assert$2(t,e){if(void 0===e&&(e="assertion failed"),""===t&&(t=!0),!t){if("undefined"!=typeof console&&"assert"in console)throw console.assert(!1,e),new Error(e);error(e.toString())}}function assertUnreachable(t){var e=(new Error).stack.split("\n")[1];throw new Error("Reached unreachable location "+e+t)}function assertNotImplemented(t,e){t||error("notImplemented: "+e)}var _warnedCounts=Object.create(null);function warning(t,e,i){}function warnCounts(){var t=[];for(var e in _warnedCounts)t.push({key:e,count:_warnedCounts[e]});return t.sort(function(t,e){return e.count-t.count}),t.reduce(function(t,e){return t+"\n"+e.count+"\t"+e.key},"")}function dummyConstructor(t){}function abstractMethod(t){}function unexpected(t){assert$2(!1,"Unexpected: "+t)}function unexpectedCase(t){assert$2(!1,"Unexpected Case: "+t)}function registerDebugMethod(t,e){var i=e.name;if(delete e.name,!e||!i)throw new Error("Method name should not be empty");var n=window._AWAY_DEBUG_=window._AWAY_DEBUG_||{};n.hasOwnProperty(i)&&console.warn("Overrides existed debug method definition: "+i),Object.assign(t,e),n[i]=t}var SOUND_SIZE_16_BIT=1,SOUND_TYPE_STEREO=1,SOUND_FORMAT_PCM_BE=0,SOUND_FORMAT_ADPCM=1,SOUND_FORMAT_MP3=2,SOUND_FORMAT_PCM_LE=3,SOUND_RATES=[5512,11250,22500,44100],WaveHeader=new Uint8Array([82,73,70,70,0,0,0,0,87,65,86,69,102,109,116,32,16,0,0,0,1,0,2,0,68,172,0,0,16,177,2,0,4,0,16,0,100,97,116,97,0,0,0,0]);function packageWave(t,e,i,n,r){var o=n>>3,s=i*e*o,a=i*o,l=t.length+(1&t.length),c=new ArrayBuffer(WaveHeader.length+l),h=new Uint8Array(c);if(h.set(WaveHeader),r)for(var u=0,p=WaveHeader.length;u<t.length;u+=2,p+=2)h[p]=t[u+1],h[p+1]=t[u];else h.set(t,WaveHeader.length);var d=new DataView(c);return d.setUint32(4,l+36,!0),d.setUint16(22,i,!0),d.setUint32(24,e,!0),d.setUint32(28,s,!0),d.setUint16(32,a,!0),d.setUint16(34,n,!0),d.setUint32(40,l,!0),{data:h,mimeType:"audio/wav"}}function defineSound(t){var e,i,n=t.soundType==SOUND_TYPE_STEREO?2:1,r=t.samplesCount,o=SOUND_RATES[t.soundRate],s=t.soundData;switch(t.soundFormat){case SOUND_FORMAT_PCM_BE:if(e=new Float32Array(r*n),t.soundSize==SOUND_SIZE_16_BIT){for(var a=0,l=0;a<e.length;a++,l+=2)e[a]=(s[l]<<24|s[l+1]<<16)/2147483648;i=packageWave(s,o,n,16,!0)}else{for(a=0;a<e.length;a++)e[a]=(s[a]-128)/128;i=packageWave(s,o,n,8,!1)}break;case SOUND_FORMAT_PCM_LE:if(e=new Float32Array(r*n),t.soundSize==SOUND_SIZE_16_BIT){for(l=a=0;a<e.length;a++,l+=2)e[a]=(s[l+1]<<24|s[l]<<16)/2147483648;i=packageWave(s,o,n,16,!1)}else{for(a=0;a<e.length;a++)e[a]=(s[a]-128)/128;i=packageWave(s,o,n,8,!1)}break;case SOUND_FORMAT_MP3:i={data:new Uint8Array(s.subarray(2)),mimeType:"audio/mpeg"};break;case SOUND_FORMAT_ADPCM:var c=new Int16Array(r*n);for(decodeACPCMSoundData(s,c,n),e=new Float32Array(r*n),a=0;a<e.length;a++)e[a]=c[a]/32768;i=packageWave(new Uint8Array(c.buffer),o,n,16,!new Uint8Array(new Uint16Array([1]).buffer)[0])}var h={type:"sound",id:t.id,sampleRate:o,channels:n,pcm:e,packaged:null};return i&&(h.packaged=i),h}var ACPCMIndexTables=[[-1,2],[-1,-1,2,4],[-1,-1,-1,-1,2,4,6,8],[-1,-1,-1,-1,-1,-1,-1,-1,1,2,4,6,8,10,13,16]],ACPCMStepSizeTable=[7,8,9,10,11,12,13,14,16,17,19,21,23,25,28,31,34,37,41,45,50,55,60,66,73,80,88,97,107,118,130,143,157,173,190,209,230,253,279,307,337,371,408,449,494,544,598,658,724,796,876,963,1060,1166,1282,1411,1552,1707,1878,2066,2272,2499,2749,3024,3327,3660,4026,4428,4871,5358,5894,6484,7132,7845,8630,9493,10442,11487,12635,13899,15289,16818,18500,20350,22385,24623,27086,29794,32767];function decodeACPCMSoundData(e,t,i){function n(t){for(;s<t;)o=o<<8|e[r++],s+=8;return o>>>(s-=t)&(1<<t)-1}for(var r=0,o=0,s=0,a=0,l=n(2),c=ACPCMIndexTables[l];a<t.length;){var h,u,p=t[a++]=n(16)<<16>>16,d=n(6);1<i&&(h=t[a++]=n(16)<<16>>16,u=n(6));for(var _=1<<l+1,f=0;f<4095;f++){for(var m=n(l+2),g=ACPCMStepSizeTable[d],y=0,b=_>>1;b;b>>=1,g>>=1)m&b&&(y+=g);if(p+=(m&_?-1:1)*(y+g),t[a++]=p=p<-32768?-32768:32767<p?32767:p,d=(d+=c[m&~_])<0?0:88<d?88:d,1<i){for(m=n(l+2),g=ACPCMStepSizeTable[u],y=0,b=_>>1;b;b>>=1,g>>=1)m&b&&(y+=g);h+=(m&_?-1:1)*(y+g),t[a++]=h=h<-32768?-32768:32767<h?32767:h,u=(u+=c[m&~_])<0?0:88<u?88:u}}}}var nextSoundStreamId=0,SoundStream=(y3c.FromTag=function(t){var e=t.streamType==SOUND_TYPE_STEREO?2:1,i=new y3c(t.samplesCount,SOUND_RATES[t.streamRate],e,t.streamSize);switch(t.streamCompression){case SOUND_FORMAT_PCM_BE:case SOUND_FORMAT_PCM_LE:i.format="wave",t.soundSize==SOUND_SIZE_16_BIT?i.decode=t.streamCompression===SOUND_FORMAT_PCM_BE?SwfSoundStream_decode_PCM_be:SwfSoundStream_decode_PCM_le:i.decode=SwfSoundStream_decode_PCM;break;case SOUND_FORMAT_MP3:i.format="mp3",i.decode=SwfSoundStream_decode_MP3;break;default:return null}return i},y3c);function y3c(t,e,i,n){this.streamId=nextSoundStreamId++,this.samplesCount=t,this.sampleRate=e,this.channels=i,this.streamSize=n,this.format=null,this.currentSample=0,this.allChunks=[]}function SwfSoundStream_decode_PCM(t){for(var e=new Float32Array(t.length),i=0;i<e.length;i++)e[i]=(t[i]-128)/128;return this.currentSample+=e.length/this.channels,{streamId:this.streamId,samplesCount:e.length/this.channels,pcm:e,data:t,seek:0}}function SwfSoundStream_decode_PCM_be(t){for(var e=new Float32Array(t.length/2),i=0,n=0;i<e.length;i++,n+=2)e[i]=(t[n]<<24|t[n+1]<<16)/2147483648;return this.currentSample+=e.length/this.channels,{streamId:this.streamId,samplesCount:e.length/this.channels,pcm:e,data:t,seek:0}}function SwfSoundStream_decode_PCM_le(t){for(var e=new Float32Array(t.length/2),i=0,n=0;i<e.length;i++,n+=2)e[i]=(t[n+1]<<24|t[n]<<16)/2147483648;return this.currentSample+=e.length/this.channels,{streamId:this.streamId,samplesCount:e.length/this.channels,pcm:e,data:t,seek:0}}function SwfSoundStream_decode_MP3(t){var e=t[1]<<8|t[0],i=t[3]<<8|t[2];return this.currentSample+=e,{streamId:this.streamId,samplesCount:e,data:new Uint8Array(t.subarray(4)),seek:i}}for(var WebAudioAdapter=(Object.defineProperty(U3c.prototype,"currentTime",{get:function(){return this._sound.currentTime},enumerable:!0,configurable:!0}),Object.defineProperty(U3c.prototype,"sound",{get:function(){return this._sound},enumerable:!0,configurable:!0}),U3c.prototype.playFrom=function(t){this.stop(),this._sound.play(t)},U3c.prototype.stop=function(){this._sound&&this._sound.stop()},Object.defineProperty(U3c.prototype,"paused",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(U3c.prototype,"isPlaying",{get:function(){return this._sound.isPlaying},enumerable:!0,configurable:!0}),Object.defineProperty(U3c.prototype,"isReady",{get:function(){return!!this._sound},enumerable:!0,configurable:!0}),U3c.prototype.queueData=function(t){t.pcm&&this._frameData.push(t)},U3c.prototype.finish=function(){for(var t=0,e=0;e<this._frameData.length;e++)t+=this._frameData[e].data.length;for(var i=new Int8Array(t),e=0;e<this._frameData.length;e++)i.set(this._frameData[e].data,this._position),this._position+=this._frameData[e].data.length;var n=packageWave(i,this._data.sampleRate,this._data.channels,this._data.streamSize,!1),r=new WaveAudio(new WaveAudioData(n.data.buffer));this._sound=r},U3c),WebAudioMP3Adapter=(c4c=WebAudioAdapter,__extends(d4c,c4c),d4c.prototype.queueData=function(t){t.data&&this._frameData.push(t)},d4c.prototype.finish=function(){for(var t=0,e=0;e<this._frameData.length;e++)t+=this._frameData[e].data.length;for(var i=new Uint8Array(t),e=0;e<this._frameData.length;e++)i.set(this._frameData[e].data,this._position),this._position+=this._frameData[e].data.length;var n=new WaveAudio(new WaveAudioData(i.buffer));this._sound=n},d4c),MovieClipSoundStream=(k4c.prototype.appendBlock=function(t,e){var i=this.decode(e),n=this.position;this.seekIndex[t]=n+i.seek,this.seekIndex[t],this.data.channels,this.data.sampleRate,this.isMP3&&this.data.channels,this.position=n+i.samplesCount,this.soundStreamAdapter.queueData(i)},Object.defineProperty(k4c.prototype,"stopped",{get:function(){return this._stopped},set:function(t){this._stopped=t},enumerable:!0,configurable:!0}),k4c.prototype.stop=function(){this.soundStreamAdapter.stop()},k4c.prototype.playFrame=function(t){if(this._stopped||isNaN(this.seekIndex[t]))return 0;this.isPlaying=!0,this.finalized||(this.finalized=!0,this.soundStreamAdapter.finish());var e=this.data,i=this.seekIndex[t]/e.channels/e.sampleRate,n=this.soundStreamAdapter.currentTime;return this.isMP3&&(i*=e.channels),MovieClipSoundsManager.addActiveSound(this.soundStreamAdapter.sound),this.soundStreamAdapter.isPlaying||this.soundStreamAdapter.playFrom(i),n-i<0?Math.ceil(1e3*(n-i)/(1e3/k4c.frameRate)):Math.floor(1e3*(n-i)/(1e3/k4c.frameRate))},k4c.frameRate=25,k4c),MovieClipSoundsManager=(v4c.addActiveSound=function(t){v4c.activeSounds[t.id]||(v4c.activeSounds[t.id]={}),v4c.activeSounds[t.id].active=!0,v4c.activeSounds[t.id].sound=t},v4c.enterFrame=function(){for(var t in v4c.activeSounds)v4c.activeSounds[t].active=!1},v4c.exitFrame=function(){for(var t in v4c.activeSounds){var e=v4c.activeSounds[t];e.active||(e.sound.stop(),delete v4c.activeSounds[t])}},v4c.prototype.initSoundStream=function(t){this.soundStreamHead=t},v4c.prototype.addSoundStreamBlock=function(t,e){this.soundStreamHead&&((0==this._soundStreams.length||1<t-this.lastFrameNum)&&this._soundStreams.push(new MovieClipSoundStream(this.soundStreamHead)),this.lastFrameNum=t,this._soundStreams[this._soundStreams.length-1].appendBlock(t,e),this._frameToSoundStream[t]=this._soundStreams[this._soundStreams.length-1])},v4c.prototype.stopStream=function(t){this._frameToSoundStream[t]&&(this._frameToSoundStream[t].stopped=!0)},v4c.prototype.resetStreamStopped=function(){for(var t=0;t<this._soundStreams.length;t++)this._soundStreams[t].stopped=!1},v4c.prototype.syncSounds=function(t,e,i){return e&&i&&this._frameToSoundStream[t]&&!this._frameToSoundStream[t].stopped?this._frameToSoundStream[t].playFrame(t):0},v4c.activeSounds={},v4c),StreamNoDataError={},masks=new Uint32Array(33),i$1=1,mask$1=0,c4c;i$1<=32;++i$1)masks[i$1]=mask$1=mask$1<<1|1;function v4c(){this.lastFrameNum=-2,this._soundStreams=[],this._frameToSoundStream={}}function k4c(t){this._stopped=!1,this.decode=t.decode.bind(t),this.data={sampleRate:t.sampleRate,channels:t.channels,streamSize:t.streamSize},this.seekIndex=[],this.position=0,this.isMP3="mp3"===t.format,this.soundStreamAdapter=new(this.isMP3?WebAudioMP3Adapter:WebAudioAdapter)(this.data)}function d4c(t){return c4c.call(this,t)||this}function U3c(t){this._sound=null,this._frameData=[],this._data=t,this._position=0}var Stream=(I4c.prototype.align=function(){this.bitBuffer=this.bitLength=0},I4c.prototype.ensure=function(t){if(this.pos+t>this.end)throw StreamNoDataError},I4c.prototype.remaining=function(){return this.end-this.pos},I4c.prototype.substream=function(t,e){var i=new I4c(this.bytes);return i.pos=t,i.end=e,i},I4c.prototype.push=function(t){var e=this.bytes,i=this.end+t.length;if(i>e.length)throw"stream buffer overfow";e.set(t,this.end),this.end=i},I4c.prototype.readSi8=function(){return this.view.getInt8(this.pos++)},I4c.prototype.readSi16=function(){var t=this.view.getInt16(this.pos,!0);return this.pos+=2,t},I4c.prototype.readSi32=function(){var t=this.view.getInt32(this.pos,!0);return this.pos+=4,t},I4c.prototype.readUi8=function(){return this.bytes[this.pos++]},I4c.prototype.readUi16=function(){var t=this.view.getUint16(this.pos,!0);return this.pos+=2,t},I4c.prototype.readUi32=function(){var t=this.view.getUint32(this.pos,!0);return this.pos+=4,t},I4c.prototype.readFixed=function(){var t=this.view.getInt32(this.pos,!0)/65536;return this.pos+=4,t},I4c.prototype.readFixed8=function(){var t=this.view.getInt16(this.pos,!0)/256;return this.pos+=2,t},I4c.prototype.readFloat16=function(){var t=this.view.getUint16(this.pos,!1);this.pos+=2;var e=t>>15?-1:1,i=(31744&t)>>10,n=1023&t;return i?31==i?n?NaN:1/0*e:e*Math.pow(2,i-15)*(1+n/1024):e*Math.pow(2,-14)*(n/1024)},I4c.prototype.readFloat=function(){var t=this.view.getFloat32(this.pos,!0);return this.pos+=4,t},I4c.prototype.readDouble=function(){var t=this.view.getFloat64(this.pos,!0);return this.pos+=8,t},I4c.prototype.readEncodedU32=function(){var t=this.bytes,e=t[this.pos++];return 128&e&&16384&(e=127&e|t[this.pos++]<<7)&&2097152&(e=16383&e|t[this.pos++]<<14)&&268435456&(e=2097151&e|t[this.pos++]<<21)?268435455&e|t[this.pos++]<<28:e},I4c.prototype.readBool=function(){return!!this.bytes[this.pos++]},I4c.prototype.readSb=function(t){return this.readUb(t)<<32-t>>32-t},I4c.prototype.readUb=function(t){for(var e=this.bitBuffer,i=this.bitLength,n=0;i<t;)24<i&&(n=e<<(t-=i),i=0),e=e<<8|this.bytes[this.pos++],i+=8;return n|=e>>>(i-=t)&masks[t],this.bitBuffer=e,this.bitLength=i,n},I4c.prototype.readFb=function(t){return this.readSb(t)/65536},I4c.prototype.readString=function(t){var e,i=this.bytes,n=this.pos;if(-1<t)e=i.subarray(n,n+=t);else{t=0;for(var r=n;i[r];r++)t++;e=i.subarray(n,n+=t),n++}this.pos=n;var o=utf8encode(e);return 0<=o.indexOf("\0")&&(o=o.split("\0").join("")),o},I4c),FilterType,DefinitionTags,ImageDefinitionTags,FontDefinitionTags,ControlTags,lad,kad,jad,iad,had;function I4c(t,e,i,n){void 0===e&&(e=0),t.buffer instanceof ArrayBuffer&&(e+=t.byteOffset,t=t.buffer),void 0===i&&(i=t.byteLength-e),void 0===n&&(n=i),this.bytes=new Uint8Array(t,e,n),this.view=new DataView(t,e,n),this.pos=0,this.end=i,this.bitBuffer=0,this.bitLength=0}function getSwfTagCodeName(t){return"SwfTagCode: "+t}function parseBbox(t){t.align();var e=t.readUb(5),i=t.readSb(e),n=t.readSb(e),r=t.readSb(e),o=t.readSb(e);return t.align(),{xMin:i,xMax:n,yMin:r,yMax:o}}function parseRgb(t){return(t.readUi8()<<24|t.readUi8()<<16|t.readUi8()<<8|255)>>>0}function parseRgba(t){return t.readUi8()<<24|t.readUi8()<<16|t.readUi8()<<8|t.readUi8()}function parseArgb(t){return t.readUi8()|t.readUi8()<<24|t.readUi8()<<16|t.readUi8()<<8}function parseMatrix(t){var e,i={a:1,b:0,c:0,d:1,tx:0,ty:0};return t.align(),t.readUb(1)&&(e=t.readUb(5),i.a=t.readFb(e),i.d=t.readFb(e)),t.readUb(1)&&(e=t.readUb(5),i.b=t.readFb(e),i.c=t.readFb(e)),e=t.readUb(5),i.tx=t.readSb(e),i.ty=t.readSb(e),t.align(),i}function parseColorTransform(t,e){var i={redMultiplier:255,greenMultiplier:255,blueMultiplier:255,alphaMultiplier:255,redOffset:0,greenOffset:0,blueOffset:0,alphaOffset:0};t.align();var n=t.readUb(1),r=t.readUb(1),o=t.readUb(4);return r&&(i.redMultiplier=t.readSb(o),i.greenMultiplier=t.readSb(o),i.blueMultiplier=t.readSb(o),e&&(i.alphaMultiplier=t.readSb(o))),n&&(i.redOffset=t.readSb(o),i.greenOffset=t.readSb(o),i.blueOffset=t.readSb(o),e&&(i.alphaOffset=t.readSb(o))),t.align(),i}function parsePlaceObjectTag(t,e,i,n){var r={code:i};if(r.actionBlocksPrecedence=t.pos,4===i)return r.symbolId=t.readUi16(),r.depth=t.readUi16(),r.flags|=4,r.matrix=parseMatrix(t),t.pos<n&&(r.flags|=8,r.cxform=parseColorTransform(t,!1)),r;var o=r.flags=26<i?t.readUi16():t.readUi8();if(r.depth=t.readUi16(),2048&o&&(r.className=t.readString(-1)),2&o&&(r.symbolId=t.readUi16()),4&o&&(r.matrix=parseMatrix(t)),8&o&&(r.cxform=parseColorTransform(t,!0)),16&o&&(r.ratio=t.readUi16()),32&o&&(r.name=t.readString(-1)),64&o&&(r.clipDepth=t.readUi16()),256&o)for(var s=t.readUi8(),a=r.filters=[];s--;)a.push(parseFilter(t));if(512&o&&(r.blendMode=t.readUi8()),1024&o&&(r.bmpCache=t.readUi8()),8192&o&&(r.visibility=t.readBool()),16384&o&&(r.backgroundColor=parseArgb(t)),128&o){t.readUi16(),6<=e?t.readUi32():t.readUi16();for(var l,c=r.events=[];l=parseEvents(t,e);){if(t.pos>n){console.log("PlaceObject handler attempted to read clip events beyond tag end"),t.pos=n;break}c.push(l)}}return r}function parseEvents(t,e){var i=6<=e?t.readUi32():t.readUi16();if(!i)return null;var n={};6===e&&(i&=-262145),n.flags=i;var r=t.readUi32();131072&i&&(n.keyCode=t.readUi8(),r--);var o=t.pos+r;return n.actionsBlock=t.bytes.subarray(t.pos,o),t.pos=o,n}function parseFilter(t){var e={},i=e.type=t.readUi8();switch(i){case FilterType.DROPSHADOW:case FilterType.GLOW:case FilterType.BEVEL:case FilterType.GRADIENTGLOW:case FilterType.GRADIENTBEVEL:for(var n=e,r=i===FilterType.GRADIENTGLOW||i===FilterType.GRADIENTBEVEL?t.readUi8():i===FilterType.BEVEL?2:1,o=n.colors=[],s=r;s--;)o.push(parseRgba(t));if(i===FilterType.GRADIENTGLOW||i===FilterType.GRADIENTBEVEL)for(var a=n.ratios=[],s=r;s--;)a.push(t.readUi8());return n.blurX=t.readFixed(),n.blurY=t.readFixed(),i!==FilterType.GLOW&&(n.angle=t.readFixed(),n.distance=t.readFixed()),n.strength=t.readFixed8(),n.inner=!!t.readUb(1),n.knockout=!!t.readUb(1),n.compositeSource=!!t.readUb(1),i===FilterType.BEVEL||i===FilterType.GRADIENTGLOW||i===FilterType.GRADIENTBEVEL?(n.onTop=!!t.readUb(1),n.quality=t.readUb(4)):n.quality=t.readUb(5),n;case FilterType.BLUR:var l=e;return l.blurX=t.readFixed(),l.blurY=t.readFixed(),l.quality=t.readUb(5),t.readUb(3),l;case FilterType.CONVOLUTION:var c=e,h=c.matrixX=t.readUi8(),u=c.matrixY=t.readUi8();c.divisor=t.readFloat(),c.bias=t.readFloat();var p=c.matrix=[];for(s=h*u;s--;)p.push(t.readFloat());return c.color=parseRgba(t),t.readUb(6),c.clamp=!!t.readUb(1),c.preserveAlpha=!!t.readUb(1),c;case FilterType.COLORMATRIX:var d=e,p=d.matrix=[];for(s=20;s--;)p.push(t.readFloat());return d}return e}function parseRemoveObjectTag(t,e,i){var n={code:i};return 5===i?(n.depth=t.readUi16(),n.symbolId=t.readUi16()):n.depth=t.readUi16(),n}function parseDefineImageTag(t,e,i,n,r){var o,s,a={code:i};switch(a.id=t.readUi16(),21<i?(s=t.readUi32(),90===i&&(a.deblock=t.readFixed8()),s+=t.pos,o=a.imgData=t.bytes.subarray(t.pos,s),a.alphaData=t.bytes.subarray(s,n)):o=a.imgData=t.bytes.subarray(t.pos,n),t.pos=n,o[0]<<8|o[1]){case 65496:case 65497:a.mimeType="image/jpeg";break;case 35152:a.mimeType="image/png";break;case 18249:a.mimeType="image/gif";break;default:a.mimeType="application/octet-stream"}return 6===i&&(a.jpegTables={data:r}),a}function parseDefineButtonTag(t,e,i,n){var r={code:i};r.id=t.readUi16();var o,s=r.characters=[];if(7==i){for(;o=parseButtonCharacter(t,e,i);)s.push(o);r.actionsData=t.bytes.subarray(t.pos,n),t.pos=n}else{var a=t.readUi8();r.trackAsMenu=!!(a>>7&1);for(var l=t.readUi16();o=parseButtonCharacter(t,e,i);)s.push(o);if(l){for(var c=r.buttonActions=[];t.pos<n;){var h=parseButtonCondAction(t,n);if(t.pos>n)break;c.push(h)}t.pos=n}}return r}function parseButtonCharacter(t,e,i){var n=t.readUi8();if(!n)return null;var r={};if(e<8&&(n&=-769),r.flags=n,r.symbolId=t.readUi16(),r.depth=t.readUi16(),r.matrix=parseMatrix(t),34===i&&(r.cxform=parseColorTransform(t,!0)),16&r.flags)for(var o=t.readUi8(),s=r.filters=[],a=o;a--;)s.push(parseFilter(t));return 32&r.flags&&(r.blendMode=t.readUi8()),r}function parseButtonCondAction(t,e){var i=t.pos,n=t.readUi16(),r=n?i+n:e,o=t.readUi16();return t.pos=r,{keyCode:(65024&o)>>9,stateTransitionFlags:511&o,actionsData:t.bytes.subarray(i+4,r)}}function parseDefineBinaryDataTag(t,e,i,n){var r={code:i};return r.id=t.readUi16(),t.pos+=4,r.data=t.bytes.subarray(t.pos,n),t.pos=n,r}function parseDefineFontTag(t,e,i){var n={code:i};n.id=t.readUi16();for(var r=t.readUi16(),o=r/2,s=[],a=o-1;a--;)s.push(t.readUi16());n.offsets=[r].concat(s);for(var l=n.glyphs=[],a=o;a--;)l.push(parseGlyph(t,e,i));return n}function parseGlyph(t,e,i){t.align();var n=t.readUb(4),r=t.readUb(4);return parseShapeRecords(t,e,i,!1,n,r,!1)}function parseDefineTextTag(t,e,i){var n={code:i};n.id=t.readUi16(),n.bbox=parseBbox(t),n.matrix=parseMatrix(t);for(var r,o=t.readUi8(),s=t.readUi8(),a=n.records=[];r=parseTextRecord(t,e,i,o,s);)a.push(r);return n}function parseTextRecord(t,e,i,n,r){t.align();var o=t.readUb(8);if(!o)return null;var s={};8&(s.flags=o)&&(s.fontId=t.readUi16()),4&o&&(s.color=(33===i?parseRgba:parseRgb)(t)),1&o&&(s.moveX=t.readSi16()),2&o&&(s.moveY=t.readSi16()),8&o&&(s.fontHeight=t.readUi16());for(var a=t.readUi8(),l=s.entries=[],c=a;c--;)l.push({glyphIndex:t.readUb(n),advance:t.readSb(r)});return s}function parseDefineSoundTag(t,e,i,n){var r={code:i};r.id=t.readUi16();var o=t.readUi8();return r.soundFormat=o>>4&15,r.soundRate=o>>2&3,r.soundSize=o>>1&1,r.soundType=1&o,r.samplesCount=t.readUi32(),r.soundData=t.bytes.subarray(t.pos,n),t.pos=n,r}function parseStartSoundTag(t,e,i){var n={code:i};return 15==i&&(n.soundId=t.readUi16()),89==i&&(n.soundClassName=t.readString(-1)),n.soundInfo=parseSoundInfo(t),n}function parseSoundInfo(t){var e={},i=e.flags=t.readUi8();if(1&i&&(e.inPoint=t.readUi32()),2&i&&(e.outPoint=t.readUi32()),4&i&&(e.loopCount=t.readUi16()),8&i)for(var n=t.readUi8(),r=e.envelopes=[],o=n;o--;)r.push({pos44:t.readUi32(),volumeLeft:t.readUi16(),volumeRight:t.readUi16()});return e}function parseSoundStreamHeadTag(t,e){var i={},n=t.readUi8();i.playbackRate=n>>2&3,i.playbackSize=n>>1&1,i.playbackType=1&n;var r=t.readUi8(),o=i.streamCompression=r>>4&15;return i.streamRate=r>>2&3,i.streamSize=0==(r>>1&1)?8:16,i.streamType=1&r,i.samplesCount=t.readUi16(),2==o&&2<=e-t.pos&&(i.latencySeek=t.readSi16()),i}function parseDefineBitmapTag(t,e,i,n){var r={code:i};r.id=t.readUi16();var o=r.format=t.readUi8();return r.width=t.readUi16(),r.height=t.readUi16(),r.hasAlpha=36===i,3===o&&(r.colorTableSize=t.readUi8()),r.bmpData=t.bytes.subarray(t.pos,n),t.pos=n,r}function parseDefineEditTextTag(t,e,i){var n={code:i};n.id=t.readUi16(),n.bbox=parseBbox(t);var r=n.flags=t.readUi16();return 1&r&&(n.fontId=t.readUi16()),32768&r&&(n.fontClass=t.readString(-1)),1&r&&(n.fontHeight=t.readUi16()),4&r&&(n.color=parseRgba(t)),2&r&&(n.maxLength=t.readUi16()),8192&r&&(n.align=t.readUi8(),n.leftMargin=t.readUi16(),n.rightMargin=t.readUi16(),n.indent=t.readSi16(),n.leading=t.readSi16()),n.variableName=t.readString(-1),128&r&&(n.initialText=t.readString(-1)),n}function parseDefineFont2Tag(t,e,i,n){var r={code:i};r.id=t.readUi16();var o=r.flags=t.readUi8(),s=!!(4&o);5<e?r.language=t.readUi8():(o=r.flags=-65&o,t.pos+=1,r.language=0);var a=t.readUi8();r.name=t.readString(a),75===i&&(r.resolution=20);var l=t.readUi16();if(0===l)return r;var c=t.pos,h=r.offsets=[],u=l;if(8&o){for(;u--;)h.push(t.readUi32());r.mapOffset=t.readUi32()}else{for(;u--;)h.push(t.readUi16());r.mapOffset=t.readUi16()}var p=r.glyphs=[];for(u=l;u--;)1!=r.offsets[l-u]+c-t.pos?p.push(parseGlyph(t,e,i)):(t.pos+=1,p.push([]));var d=r.codes=[];for(u=l;u--;)d.push(s?t.readUi16():t.readUi8());if(128&o){r.ascent=t.readUi16(),r.descent=t.readUi16(),r.leading=t.readSi16();for(var _=r.advance=[],u=l;u--;)_.push(t.readSi16());var f=r.bbox=[];for(u=l;u--;)f.push(parseBbox(t));var m=t.readUi16(),g=r.kerning=[];for(u=m;u--&&n-t.pos>=2+(s?4:2);)g.push(parseKerning(t,s))}return r}function parseKerning(t,e){var i={};return e?(i.code1=t.readUi16(),i.code2=t.readUi16()):(i.code1=t.readUi8(),i.code2=t.readUi8()),i.adjustment=t.readUi16(),i}function parseDefineFont4Tag(t,e,i,n){var r={code:i};r.id=t.readUi16();var o=r.flags=t.readUi8();return r.name=t.readString(-1),4&o&&(r.data=t.bytes.subarray(t.pos,n),t.pos=n),r}function parseDefineScalingGridTag(t,e,i){var n={code:i};return n.symbolId=t.readUi16(),n.splitter=parseBbox(t),n}function parseDefineSceneTag(t,e){for(var i={code:e},n=t.readEncodedU32(),r=i.scenes=[],o=n;o--;)r.push({offset:t.readEncodedU32(),name:t.readString(-1)});for(var s=t.readEncodedU32(),a=i.labels=[],o=s;o--;)a.push({frame:t.readEncodedU32(),name:t.readString(-1)});return i}function parseDefineShapeTag(t,e,i){var n={code:i};n.id=t.readUi16(),n.lineBounds=parseBbox(t);var r=0,o=46===i||84===i;o&&(r|=8,n.lineBoundsMorph=parseBbox(t));var s=83===i||84===i;s&&(n.fillBounds=parseBbox(t),o&&(n.fillBoundsMorph=parseBbox(t)),r|=7&t.readUi8()),n.flags=r,o&&(t.pos+=4),n.fillStyles=parseFillStyles(t,e,i,o),n.lineStyles=parseLineStyles(t,e,i,o,s),t.align();var a=t.readUb(4),l=t.readUb(4);return n.records=parseShapeRecords(t,e,i,o,a,l,s),o&&(t.align(),a=t.readUb(4),l=t.readUb(4),n.recordsMorph=parseShapeRecords(t,e,i,o,a,l,s)),n}function parseShapeRecords(t,e,i,n,r,o,s){for(var a=[];;){var l,c={},h=c.type=t.readUb(1),u=t.readUb(5);if(!h&&!u)break;h?(l=2+(15&u),32&(u=(240&u)<<1)?(c.isGeneral=t.readUb(1))?(u|=64,c.deltaX=t.readSb(l),c.deltaY=t.readSb(l)):(c.isVertical=t.readUb(1))?(u|=128,c.deltaY=t.readSb(l)):c.deltaX=t.readSb(l):(c.controlDeltaX=t.readSb(l),c.controlDeltaY=t.readSb(l),c.anchorDeltaX=t.readSb(l),c.anchorDeltaY=t.readSb(l))):(i<=2&&(u&=-17),1&u&&(l=t.readUb(5),c.moveX=t.readSb(l),c.moveY=t.readSb(l)),2&u&&(c.fillStyle0=t.readUb(r)),4&u&&(c.fillStyle1=t.readUb(r)),8&u&&(c.lineStyle=t.readUb(o)),16&u&&(c.fillStyles=parseFillStyles(t,e,i,n),c.lineStyles=parseLineStyles(t,e,i,n,s),t.align(),r=t.readUb(4),o=t.readUb(4))),c.flags=u,a.push(c)}return a}function parseFillStyles(t,e,i,n){var r=t.readUi8();2<i&&255===r&&(r=t.readUi16());for(var o=[],s=r;s--;)o.push(parseFillStyle(t,e,i,n));return o}function parseFillStyle(t,e,i,n){var r={},o=r.type=t.readUi8();switch(o){case 0:var s=r;return s.color=(22<i||n?parseRgba:parseRgb)(t),n&&(s.colorMorph=parseRgba(t)),s;case 16:case 18:case 19:var a=r;a.matrix=parseMatrix(t),n&&(a.matrixMorph=parseMatrix(t)),83===i?(a.spreadMode=t.readUb(2),a.interpolationMode=t.readUb(2)):t.readUb(4);for(var l=t.readUb(4),c=a.records=[],h=l;h--;)c.push(parseGradientRecord(t,i,n));return 19===o&&(a.focalPoint=t.readSi16(),n&&(a.focalPointMorph=t.readSi16())),a;case 64:case 65:case 66:case 67:var u=r;return u.bitmapId=t.readUi16(),u.condition=64===o||67===o,u.matrix=parseMatrix(t),n&&(u.matrixMorph=parseMatrix(t)),u}return r}function parseGradientRecord(t,e,i){var n={};return n.ratio=t.readUi8(),n.color=(22<e?parseRgba:parseRgb)(t),i&&(n.ratioMorph=t.readUi8(),n.colorMorph=parseRgba(t)),n}function parseLineStyles(t,e,i,n,r){var o=t.readUi8();2<i&&255===o&&(o=t.readUi16());for(var s=[],a=o;a--;){var l,c,h={};h.width=t.readUi16(),n&&(h.widthMorph=t.readUi16()),r?(t.align(),h.startCapsStyle=t.readUb(2),l=h.jointStyle=t.readUb(2),c=h.hasFill=t.readUb(1),h.noHscale=!!t.readUb(1),h.noVscale=!!t.readUb(1),h.pixelHinting=!!t.readUb(1),t.readUb(5),h.noClose=!!t.readUb(1),h.endCapsStyle=t.readUb(2),2===l&&(h.miterLimitFactor=t.readFixed8()),c?h.fillStyle=parseFillStyle(t,e,i,n):(h.color=parseRgba(t),n&&(h.colorMorph=parseRgba(t)))):(h.color=(22<i?parseRgba:parseRgb)(t),n&&(h.colorMorph=parseRgba(t))),s.push(h)}return s}function parseDefineVideoStreamTag(t,e,i){var n={code:i};return n.id=t.readUi16(),n.numFrames=t.readUi16(),n.width=t.readUi16(),n.height=t.readUi16(),t.readUb(4),n.deblocking=t.readUb(3),n.smoothing=!!t.readUb(1),n.codecId=t.readUi8(),n}function parseVideoFrameTag(t,e,i,n){var r={code:i};return r.streamId=t.readUi16(),r.frameNum=t.readUi16(),r.videoData=t.bytes.subarray(t.pos,n),t.pos=n,r}had=FilterType=FilterType||{},had[had.DROPSHADOW=0]="DROPSHADOW",had[had.BLUR=1]="BLUR",had[had.GLOW=2]="GLOW",had[had.BEVEL=3]="BEVEL",had[had.GRADIENTGLOW=4]="GRADIENTGLOW",had[had.CONVOLUTION=5]="CONVOLUTION",had[had.COLORMATRIX=6]="COLORMATRIX",had[had.GRADIENTBEVEL=7]="GRADIENTBEVEL",iad=DefinitionTags=DefinitionTags||{},iad[iad.CODE_DEFINE_SHAPE=2]="CODE_DEFINE_SHAPE",iad[iad.CODE_DEFINE_BITS=6]="CODE_DEFINE_BITS",iad[iad.CODE_DEFINE_BUTTON=7]="CODE_DEFINE_BUTTON",iad[iad.CODE_DEFINE_FONT=10]="CODE_DEFINE_FONT",iad[iad.CODE_DEFINE_TEXT=11]="CODE_DEFINE_TEXT",iad[iad.CODE_DEFINE_SOUND=14]="CODE_DEFINE_SOUND",iad[iad.CODE_DEFINE_BITS_LOSSLESS=20]="CODE_DEFINE_BITS_LOSSLESS",iad[iad.CODE_DEFINE_BITS_JPEG2=21]="CODE_DEFINE_BITS_JPEG2",iad[iad.CODE_DEFINE_SHAPE2=22]="CODE_DEFINE_SHAPE2",iad[iad.CODE_DEFINE_SHAPE3=32]="CODE_DEFINE_SHAPE3",iad[iad.CODE_DEFINE_TEXT2=33]="CODE_DEFINE_TEXT2",iad[iad.CODE_DEFINE_BUTTON2=34]="CODE_DEFINE_BUTTON2",iad[iad.CODE_DEFINE_BITS_JPEG3=35]="CODE_DEFINE_BITS_JPEG3",iad[iad.CODE_DEFINE_BITS_LOSSLESS2=36]="CODE_DEFINE_BITS_LOSSLESS2",iad[iad.CODE_DEFINE_EDIT_TEXT=37]="CODE_DEFINE_EDIT_TEXT",iad[iad.CODE_DEFINE_SPRITE=39]="CODE_DEFINE_SPRITE",iad[iad.CODE_DEFINE_MORPH_SHAPE=46]="CODE_DEFINE_MORPH_SHAPE",iad[iad.CODE_DEFINE_FONT2=48]="CODE_DEFINE_FONT2",iad[iad.CODE_DEFINE_VIDEO_STREAM=60]="CODE_DEFINE_VIDEO_STREAM",iad[iad.CODE_DEFINE_FONT3=75]="CODE_DEFINE_FONT3",iad[iad.CODE_DEFINE_SHAPE4=83]="CODE_DEFINE_SHAPE4",iad[iad.CODE_DEFINE_MORPH_SHAPE2=84]="CODE_DEFINE_MORPH_SHAPE2",iad[iad.CODE_DEFINE_BINARY_DATA=87]="CODE_DEFINE_BINARY_DATA",iad[iad.CODE_DEFINE_BITS_JPEG4=90]="CODE_DEFINE_BITS_JPEG4",iad[iad.CODE_DEFINE_FONT4=91]="CODE_DEFINE_FONT4",jad=ImageDefinitionTags=ImageDefinitionTags||{},jad[jad.CODE_DEFINE_BITS=6]="CODE_DEFINE_BITS",jad[jad.CODE_DEFINE_BITS_JPEG2=21]="CODE_DEFINE_BITS_JPEG2",jad[jad.CODE_DEFINE_BITS_JPEG3=35]="CODE_DEFINE_BITS_JPEG3",jad[jad.CODE_DEFINE_BITS_JPEG4=90]="CODE_DEFINE_BITS_JPEG4",kad=FontDefinitionTags=FontDefinitionTags||{},kad[kad.CODE_DEFINE_FONT=10]="CODE_DEFINE_FONT",kad[kad.CODE_DEFINE_FONT2=48]="CODE_DEFINE_FONT2",kad[kad.CODE_DEFINE_FONT3=75]="CODE_DEFINE_FONT3",kad[kad.CODE_DEFINE_FONT4=91]="CODE_DEFINE_FONT4",lad=ControlTags=ControlTags||{},lad[lad.CODE_PLACE_OBJECT=4]="CODE_PLACE_OBJECT",lad[lad.CODE_PLACE_OBJECT2=26]="CODE_PLACE_OBJECT2",lad[lad.CODE_PLACE_OBJECT3=70]="CODE_PLACE_OBJECT3",lad[lad.CODE_REMOVE_OBJECT=5]="CODE_REMOVE_OBJECT",lad[lad.CODE_REMOVE_OBJECT2=28]="CODE_REMOVE_OBJECT2",lad[lad.CODE_START_SOUND=15]="CODE_START_SOUND",lad[lad.CODE_START_SOUND2=89]="CODE_START_SOUND2",lad[lad.CODE_VIDEO_FRAME=61]="CODE_VIDEO_FRAME";var tagHandlers={0:void 0,1:void 0,2:parseDefineShapeTag,4:parsePlaceObjectTag,5:parseRemoveObjectTag,6:parseDefineImageTag,7:parseDefineButtonTag,8:void 0,9:void 0,10:parseDefineFontTag,11:parseDefineTextTag,12:void 0,13:void 0,14:parseDefineSoundTag,15:parseStartSoundTag,17:void 0,18:void 0,19:void 0,20:parseDefineBitmapTag,21:parseDefineImageTag,22:parseDefineShapeTag,23:void 0,24:void 0,26:parsePlaceObjectTag,28:parseRemoveObjectTag,32:parseDefineShapeTag,33:parseDefineTextTag,34:parseDefineButtonTag,35:parseDefineImageTag,36:parseDefineBitmapTag,37:parseDefineEditTextTag,39:void 0,43:void 0,45:void 0,46:parseDefineShapeTag,48:parseDefineFont2Tag,56:void 0,57:void 0,58:void 0,59:void 0,60:parseDefineVideoStreamTag,61:parseVideoFrameTag,62:void 0,64:void 0,65:void 0,66:void 0,69:void 0,70:parsePlaceObjectTag,71:void 0,72:void 0,73:void 0,74:void 0,75:parseDefineFont2Tag,76:void 0,77:void 0,78:parseDefineScalingGridTag,82:void 0,83:parseDefineShapeTag,84:parseDefineShapeTag,86:parseDefineSceneTag,87:parseDefineBinaryDataTag,88:void 0,89:parseStartSoundTag,90:parseDefineImageTag,91:parseDefineFont4Tag};function parseHeader(t){var e=t.readUb(5),i=t.readSb(e),n=t.readSb(e),r=t.readSb(e),o=t.readSb(e);t.align();var s=t.readUi8();return{frameRate:t.readUi8()+s/256,frameCount:t.readUi16(),bounds:new Bounds(i,r,n,o)}}function defineShape(t,e){t.parser=e;var i=new Graphics;return i.queueShapeTag(t),{type:t.recordsMorph?"morphshape":"shape",id:t.id,fillBounds:t.fillBounds,lineBounds:t.lineBounds,morphFillBounds:t.fillBoundsMorph||null,morphLineBounds:t.lineBoundsMorph||null,shape:t.recordsMorph?new MorphSprite(i):i,require:null}}var pow=Math.pow,logE=Math.log,fromCharCode=String.fromCharCode;function maxPower2(t){for(var e=0,i=t;2<=i;)i/=2,++e;return pow(2,e)}function toString16(t){return fromCharCode(t>>8&255,255&t)}function isScaledFont2(t){for(var e=0,i=0,n=0,r=0,o=0;o<t.length;o++){var s=t[o];if(s)for(var a,l=0,c=0,h=0;h<s.length;h++)(a=s[h]).type?32&a.flags?(l+=a.deltaX||0,c+=-(a.deltaY||0)):(l+=a.controlDeltaX,c+=-a.controlDeltaY,l+=a.anchorDeltaX,c+=-a.anchorDeltaY):1&a.flags&&(l=a.moveX,c=-a.moveY),l<e&&(e=l),c<i&&(i=c),n<l&&(n=l),r<c&&(r=c)}return 5e3<Math.max(n-e,r-i)}function defineFont(t,e){var i="swf-font-"+t.id,n=t.name||i;"Helvetica"==n&&(n="arial");var r=DefaultFontManager.getFont(n,e),o={type:"font",id:t.id,name:n,bold:!!(1&t.flags),italic:!!(2&t.flags),codes:null,metrics:null,data:t.data,originalSize:!1,away:r,fontStyleName:FontStyleName.STANDART};r.name=n;var s=FontStyleName.STANDART;o.bold&&!o.italic?s=FontStyleName.BOLD:!o.bold&&o.italic?s=FontStyleName.ITALIC:o.bold&&o.italic&&(s=FontStyleName.BOLDITALIC),o.fontStyleName=s;var a=r.get_font_table(s,TesselatedFontTable.assetType),l=t.glyphs,c=l?l.length:0;if(!c)return o;var h=[],u={},p=[],d=!("advance"in t),_=48===t.code,f=75===t.code;d&&(t.advance=[]);var m=Math.max.apply(null,t.codes)||35;if(t.codes){for(var g=0;g<t.codes.length;g++)((P=t.codes[g])<32||P in u)&&(8232==++m&&(m=8240),P=m),h.push(P),u[P]=g;for(h.sort(function(t,e){return t-e}),g=0;void 0!==(P=h[g++]);){for(var y=C=P,b=[g-1];void 0!==(P=h[g])&&y+1===P;)++y,b.push(g),++g;p.push([C,y,b])}}else{for(b=[],g=0;g<c;g++)P=57344+g,h.push(P),u[P]=g,b.push(g);p.push([57344,57344+c-1,b])}var v=t.resolution||1;_&&isScaledFont2(l)&&(v=20,o.originalSize=!0);var x=Math.ceil(t.ascent/v)||1024,A=-Math.ceil(t.descent/v)||0;0!=a.ascent||(a.ascent=x,a.descent=A);var S,w=a.ascent;for(t.leading,g=0;S=p[g++];)var C=S[0],P=(y=S[1],S[2][0]);for(var E=2*maxPower2(p.length+1),T=[],M=(g=0,{});void 0!==(P=h[g++]);){for(var D=l[u[P]],I=0,O=0,L=[],F=-1,B=0;B<D.length;B++){(Z=D[B]).type?(F<0&&(L[F=0]={data:[],commands:[],xMin:0,xMax:0,yMin:0,yMax:0}),32&Z.flags?(L[F].commands.push(2),I+=(Z.deltaX||0)/v,O+=-(Z.deltaY||0)/v):(L[F].commands.push(3),I+=J=Z.controlDeltaX/v,O+=Q=-Z.controlDeltaY/v,L[F].data.push(I,O),I+=Z.anchorDeltaX/v,O+=-Z.anchorDeltaY/v),L[F].data.push(I,O)):1&Z.flags&&(L[++F]={data:[],commands:[],xMin:0,xMax:0,yMin:0,yMax:0},L[F].commands.push(1),I=Z.moveX/v,O=-Z.moveY/v,L[F].data.push(I,O)),-1<F&&(L[F].xMin>I&&(L[F].xMin=I),L[F].yMin>O&&(L[F].yMin=O),L[F].xMax<I&&(L[F].xMax=I),L[F].yMax<O&&(L[F].yMax=O))}f||L.sort(function(t,e){return(e.xMax-e.xMin)*(e.yMax-e.yMin)-(t.xMax-t.xMin)*(t.yMax-t.yMin)}),M[P]=L}for(var N,R=0,g=0;void 0!==(P=h[g++]);){for(var V=new GraphicsPath,k=(D=l[u[P]],u[P]),L=M[P],U=O=I=0,j=-1024,G=0,z=-1024,$=(F=-1,[]),X=[],B=0;B<L.length;B++)$=$.concat(L[B].data),X=X.concat(L[B].commands);var W=O=I=0,H=0,q=0;for(B=0;B<X.length;B++){var J,Q,K=X[B];1===K?(W=$[q++],H=$[q++],V.moveTo(W,-1*H+w),I=W,O=H):2===K?(I=W=$[q++],O=H=$[q++],V.lineTo(W,-1*H+w)):3===K&&(J=(W=$[q++])-I,Q=(H=$[q++])-O,J=I=W,Q=O=H,I=W=$[q++],O=H=$[q++],V.curveTo(J,-1*Q+w,W,-1*H+w)),I<U&&(U=I),O<G&&(G=O),j<I&&(j=I),z<O&&(z=O)}B||(U=j=G=z=0),T.push(G);var Y=0,Y=d?(t.advance.push((j-U)*v*1.3),j-U):t.advance[g-1]/v;32==P&&(R=t.advance[g-1]/v),a.setChar(P.toString(),Y,null,null,!1,k,V)}if(f||(N=Math.min.apply(null,T))<0&&(A=A||N),t.kerning&&t.kerning.length){var Z,tt=t.kerning,et=tt.length,E=2*maxPower2(et);for(toString16(14+6*et),toString16(et),toString16(E),toString16(logE(et)/logE(2)),toString16(2*et-E),g=0;Z=tt[g++];)toString16(u[Z.code1]),toString16(u[Z.code2]),toString16(Z.adjustment)}return a.set_font_em_size(1024),R&&a.set_whitespace_width(R),o}function defineText(t){return{type:"text",id:t.id,fillBounds:t.bbox,variableName:t.variableName,tag:t,bold:!1,italic:!1}}function defineButton(t,e){for(var i,n=t.characters,r={up:[],over:[],down:[],hitTest:[]},o=0;i=n[o++];){var s,a=e[i.symbolId];a?(s={symbolId:a.id,code:4,depth:i.depth,flags:0,matrix:null,cxform:null},i.matrix&&(s.flags|=4,s.matrix=i.matrix),i.cxform&&(s.flags|=8,s.cxform=i.cxform),1&i.flags&&r.up.push(s),2&i.flags&&r.over.push(s),4&i.flags&&r.down.push(s),8&i.flags&&r.hitTest.push(s)):console.log("undefined character in button "+t.id)}return{type:"button",id:t.id,buttonActions:t.buttonActions,states:r}}function parseColorMapped(t){var e=t.width,i=t.height,n=t.hasAlpha,r=roundToMultipleOfFour(e)-e,o=n?4:3,s=(t.colorTableSize+1)*o,a=s+(e+r)*i,l=Inflate.inflate(t.bmpData,a,!0),c=new Uint8ClampedArray(e*i*4),h=s,u=0,p=0;if(n)for(var d=0;d<i;d++){for(var _=0;_<e;_++)p=l[h++]<<2,c[u++]=l[p+0],c[u++]=l[p+1],c[u++]=l[p+2],c[u++]=l[p+3];h+=r}else for(d=0;d<i;d++){for(_=0;_<e;_++)p=l[h++]*o,c[u++]=l[p+0],c[u++]=l[p+1],c[u++]=l[p+2],c[u++]=255;h+=r}return c}function parse24BPP(t){for(var e,i=t.width,n=t.height,r=(t.hasAlpha,n*i*4),o=Inflate.inflate(t.bmpData,r,!0),s=new Uint8ClampedArray(r),a=0,l=0;l<r;l+=4)e=o[l]?255/o[l]:255,s[a++]=o[l+1]*e,s[a++]=o[l+2]*e,s[a++]=o[l+3]*e,s[a++]=o[l];return assert(a===r,"We should be at the end of the data buffer now."),s}function parse15BPP(t){return console.log("parse15BPP"),null}function defineBitmap(t){var e,i=ImageType.None;switch(t.format){case 3:e=parseColorMapped(t),i=ImageType.PremultipliedAlphaARGB;break;case 5:e=parse24BPP(t),i=ImageType.PremultipliedAlphaARGB;break;case 4:e=parse15BPP(),i=ImageType.PremultipliedAlphaARGB;break;default:console.log("invalid bitmap format")}return{definition:{type:"image",id:t.id,width:t.width,height:t.height,mimeType:"application/octet-stream",data:e,dataType:i,image:null},type:"image"}}function readUint16(t,e){return t[e]<<8|t[e+1]}function readInt32(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function parseJpegChunks(t,e){for(var i=0,n=t.length;i<n&&(255!==t[i]||i+1<n&&(0===t[i+1]||255===t[i+1]));)++i;if(!(n<=i))do{var r=i++,o=t[i++];for((192<=o&&o<=199||201<=o&&o<=207||218<=o&&o<=239||254===o)&&(i+=readUint16(t,i));i<n&&(255!==t[i]||i+1<n&&(0===t[i+1]||255===t[i+1]));)++i;216!==o&&217!==o&&e.push(t.subarray(r,i))}while(i<n)}function parsePngHeaders(t,e){var i;73===e[12]&&72===e[13]&&68===e[14]&&82===e[15]&&(t.width=readInt32(e,16),t.height=readInt32(e,20),i=e[26],t.hasAlpha=4===i||6===i)}function joinChunks(t){for(var e=0,i=0;i<t.length;i++)e+=t[i].length;for(var n=new Uint8Array(e),r=0,i=0;i<t.length;i++){var o=t[i];n.set(o,r),r+=o.length}return n}function injectJPEGTables(t,e){var i;e.parsedChunks||(i=[],parseJpegChunks(e.data,i),e.parsedChunks=i);for(var n=0;n<t.length&&!(192<=t[n][1]&&t[n][1]<=192);)n++;Array.prototype.splice.apply(t,Array.prototype.concat.call([n,0],e.parsedChunks))}var JPEG_SOI=new Uint8Array([255,216]),JPEG_EOI=new Uint8Array([255,217]);function defineImage(t){var i={type:"image",id:t.id,mimeType:t.mimeType},e=t.imgData;if("image/jpeg"===t.mimeType){var n=[];n.push(JPEG_SOI),parseJpegChunks(e,n),t.jpegTables&&injectJPEGTables(n,t.jpegTables),n.push(JPEG_EOI),n.forEach(function(t){var e=t[1];192<=e&&e<=195&&(i.height=readUint16(t,5),i.width=readUint16(t,7))}),i.data=joinChunks(n),i.dataType=ImageType.JPEG;var r=t.alphaData;if(r){var o=i.width*i.height;try{i.alphaData=Inflate.inflate(r,o,!0)}catch(t){i.alphaData=new Uint8Array(o)}}}else parsePngHeaders(i,e),i.data=e,i.dataType=ImageType.PNG;return i}function defineLabel(t){return{type:"label",id:t.id,fillBounds:t.bbox,matrix:t.matrix,tag:{hasText:!0,initialText:"",html:!0,readonly:!0},records:t.records,coords:null,static:!0,require:null}}var SWFFrame=function(t,e,i,n,r,o,s){t&&Object.freeze(t),this.controlTags=t,this.labelNames=e,r&&Object.freeze(r),this.soundStreamHead=i,this.soundStreamBlock=n,this.actionBlocks=r,o&&Object.freeze(o),this.initActionBlocks=o,this.buttonStateName="",s&&Object.freeze(s),this.exports=s},SWFParser=(ndd=ParserBase,__extends(odd,ndd),Object.defineProperty(odd.prototype,"swfFile",{get:function(){return this._swfFile},enumerable:!0,configurable:!0}),Object.defineProperty(odd.prototype,"factory",{get:function(){return this._factory},set:function(t){this._factory=t,odd.factory=t,this._progressState=4},enumerable:!0,configurable:!0}),odd.prototype.onFactoryRequest=function(t){this.factory=odd.factory||new DefaultSceneGraphFactory},odd.supportsType=function(t){return t=t.toLowerCase(),console.log("SWFParser supportsType extension: ",t,"result: ","swf"==t),"swf"==t},odd.supportsData=function(t){return!(67!==t[0]&&70!==t[0]&&90!==t[0]||87!==t[1]||83!==t[2])},odd.prototype._iResolveDependency=function(t){if(1!=t.assets.length)throw"SWFParser: error when resolving dependency";var e=this.eagerlyParsedSymbolsMap[t.id];if(e)switch(e.type){case"image":var i=t.assets[0];this._awaySymbols[t.id]=i;break;case"font":break;case"sound":var n=t.assets[0];this._awaySymbols[t.id]=n;break;default:console.log("finished unknown parsing",t)}else console.log("no eagerlyParsedSymbolsMap for id",t.id);this.externalDependenciesCount--,0==this.externalDependenciesCount&&(this.parseSymbolsToAwayJS(),this._progressState=5)},odd.prototype._iResolveDependencyFailure=function(t){this.externalDependenciesCount--,0==this.externalDependenciesCount&&(this.parseSymbolsToAwayJS(),this._progressState=5)},odd.prototype._iResolveDependencyName=function(t,e){var i=e.name,n=e.name;return e.name=i,n},odd.prototype._pProceedParsing=function(){if(0==this._progressState){var t=this._pGetByteData(),e=new Uint8Array(t.arraybytes);if(this.initSWFLoading(e,e.length),this._swfFile.url=this._iFileName,this._factory)this.parseSymbols();else{if(!this.onFactoryRequest)throw"Error in SWFParser. no factory and noFactoryRequest method exists.";this._progressState=3,this.onFactoryRequest(this._swfFile),this._factory&&this.parseSymbols()}}else if(4==this._progressState){if(!this.onFactoryRequest)throw"Error in SWFParser. no factory and noFactoryRequest method exists.";this._factory&&this.parseSymbols()}return 5!=this._progressState?ParserBase.MORE_TO_PARSE:ParserBase.PARSING_DONE},odd.prototype.parseSymbols=function(){if(this._factory.url=this._iFileName,this._pContent=this._factory.createDisplayObjectContainer(),this._awaySymbols={},this._mapMatsForBitmaps={},this.abcBlocks.length&&this._factory.executeABCBytes&&this._factory.executeABCBytes(this.abcBlocks),(this.externalDependenciesCount=0)<this.eagerlyParsedSymbolsList.length)for(var t=0;t<this.eagerlyParsedSymbolsList.length;t++){var e=this.eagerlyParsedSymbolsList[t];if(e)switch(e.type){case"image":this._pAddDependency(e.id.toString(),null,new Image2DParser(this._factory,e.definition.alphaData),new Blob([e.definition.data],{type:e.definition.mimeType}),!1,!0),this.externalDependenciesCount++;break;case"sound":if(!e.definition.packaged){console.warn("SWF-parser: Missed packaged data for sound-id:",e.id.toString());break}this._pAddDependency(e.id.toString(),null,new WaveAudioParser,new Blob([e.definition.packaged.data],{type:e.definition.packaged.mimeType}),!1,!0),this.externalDependenciesCount++;break;case"font":break;default:console.log("encountered eagerly parsed unknown type: ",e)}}0<this.externalDependenciesCount?(this._progressState=2,this._pPauseAndRetrieveDependencies()):(this.parseSymbolsToAwayJS(),this._progressState=5)},odd.prototype.getMaterial=function(t){var e,i=this._mapMatsForBitmaps[t];return i||(i=new MethodMaterial,(e=this._awaySymbols[t])&&(e.isAsset(BitmapImage2D)||e.isAsset(SceneImage2D))||(e=new BitmapImage2D(512,512,!0,4278190335,!0)),i.ambientMethod.texture=new ImageTexture2D(e),i.alphaBlending=!0,i.useColorTransform=!0,i.bothSides=!0,this._mapMatsForBitmaps[t]=i),i},odd.prototype.parseSymbolsToAwayJS=function(){new DOMParser;for(var t=this.dictionary,e={},i=0;i<t.length;i++)if(t[i]){performance.now();var n=this.getSymbol(t[i].id);switch(n.type){case"morphshape":n.shape.name=n.id,n.shape.name="AwayJS_morphshape_"+n.id.toString(),n.shape.className=n.className,this._awaySymbols[t[i].id]=n.shape,e[t[i].id]=n.shape;break;case"shape":n.shape.name="AwayJS_shape_"+n.id.toString(),n.shape.className=n.className,this._awaySymbols[t[i].id]=n.shape,e[t[i].id]=n.shape;break;case"font":n.away.className=n.className,e[(this._awaySymbols[t[i].id]=n).name]=n.away;break;case"sprite":(d=this.framesToTimeline(n,n.frames,null,null)).className=n.className,d.buttonMode?this._buttonIds[n.id]=!0:this._mcIds[n.id]=!0,d.name="AwayJS_mc_"+n.id.toString(),this._awaySymbols[t[i].id]=d,e[t[i].id]=d;break;case"text":(s=this._factory.createTextField(n))._symbol=n,s.textFormat=new TextFormat,s.className=n.className;var r=this._awaySymbols[n.tag.fontId];r&&(s.textFormat.font=r.away,s.textFormat.font_table=r.away.get_font_table(r.fontStyleName,TesselatedFontTable.assetType)),s.textFormat.size=n.tag.fontHeight/20,s.textColor=4&n.tag.flags?ColorUtils.f32_RGBA_To_f32_ARGB(n.tag.color):16777215,s.textFormat.leftMargin=n.tag.leftMargin/20,s.textFormat.rightMargin=n.tag.rightMargin/20,s.textFormat.letterSpacing=n.tag.letterSpacing/20,s.textFormat.leading=n.tag.leading/20,s.textFormat.align=this.textFormatAlignMap[n.tag.align],s.textOffsetX=n.fillBounds.xMin/20,s.textOffsetY=n.fillBounds.yMin/20,s.width=(n.fillBounds.xMax-n.fillBounds.xMin)/20,s.height=(n.fillBounds.yMax-n.fillBounds.yMin)/20,s.border=!!(2048&n.tag.flags),s.background=s.border,s.multiline=!!(32&n.tag.flags),s.wordWrap=!!(64&n.tag.flags),s.selectable=!(!n.tag.flags||4096&n.tag.flags),n.tag.maxLength&&0<n.tag.maxLength&&(s.maxChars=n.tag.maxLength),8&n.tag.flags?s.type="dynamic":s.type="input",512&n.tag.flags?(s.html=!0,n.tag.initialText&&""!=n.tag.initialText&&(s.htmlText=n.tag.initialText)):(s.html=!1,n.tag.initialText&&""!=n.tag.initialText&&(s.text=n.tag.initialText)),s.name="tf_"+n.id.toString(),e[t[i].id]=s,this._awaySymbols[t[i].id]=s;break;case"sound":var o=this._awaySymbols[t[i].id];o?(o.className=this.symbolClassesMap[n.id]?this.symbolClassesMap[n.id]:null,o.name=o.className,e[t[i].id]=o):console.warn("SWF-parser: no sound loaded for sound-id:",t[i].id);break;case"button":(d=this.framesToTimeline(n,null,n.states,n.buttonActions,this._buttonSounds[n.id])).name="AwayJS_button_"+n.id.toString(),d.className=n.className,e[t[i].id]=d,this._awaySymbols[t[i].id]=d,this._buttonIds[n.id]=!0;break;case"label":var s,a=null,l=!1;(s=this._factory.createTextField(n)).className=n.className;for(var c=0;c<n.records.length;c++){var h=n.records[c];h.fontId&&(a=this._awaySymbols[h.fontId])&&(h.font_table=a.away.get_font_table(a.fontStyleName,TesselatedFontTable.assetType),h.font_table||(l=!0,console.log("no font_table set")))}s.staticMatrix=n.matrix,s.textOffsetX=n.fillBounds.xMin/20,s.textOffsetY=n.fillBounds.yMin/20,s.width=n.fillBounds.xMax/20-n.fillBounds.xMin/20-1,s.height=n.fillBounds.yMax/20-n.fillBounds.yMin/20-1,l||s.setLabelData(n),s.name="AwayJS_label_"+n.id.toString(),e[t[i].id]=s,(this._awaySymbols[t[i].id]=s).selectable=!(!n.tag.flags||4096&n.tag.flags);break;case"image":var u=this._awaySymbols[t[i].id];!u&&n.definition&&(u=new BitmapImage2D(n.definition.width,n.definition.height,!0,16711680,!1),n.definition.data.length!=4*n.definition.width*n.definition.height&&n.definition.data.length!=3*n.definition.width*n.definition.height&&(n.definition.data=new Uint8ClampedArray(4*n.definition.width*n.definition.height)),u.setPixels(new Rectangle(0,0,n.definition.width,n.definition.height),n.definition.data)),u&&((this._awaySymbols[t[i].id]=u).className=this.symbolClassesMap[n.id]?this.symbolClassesMap[n.id]:n.className,u.name=u.className,e[t[i].id]=u);break;case"binary":this._factory.createBinarySymbol&&this._factory.createBinarySymbol(n),this._awaySymbols[t[i].id]=n;break;default:console.log("unknown symbol type:",n.type,n)}}var p=(p=this.dictionary[0])||{id:0,className:this.symbolClassesMap[0]},d=this.framesToTimeline(p,this._swfFile.frames,null,null);for(var _ in e)this._pFinalizeAsset(e[_]);d.isAVMScene=!0,this._pFinalizeAsset(d,"scene"),DefaultFontManager.applySharedFonts(this._iFileName)},odd.prototype.framesToTimeline=function(t,e,i,n,r){if(void 0===r&&(r=null),!i&&!e)throw"error when creating timeline - neither movieclip frames nor button-states present";var o=!1;if(t.isButton=!1,i&&!e)for(_t in o=!0,t.isButton=!0,e=[],i){var s=new SWFFrame;s.controlTags=i[_t],s.buttonStateName=_t,e[e.length]=s}var a=this._factory.createMovieClip(null,t);a.symbolID=t.id;var l,c,h,u,p,d,_,f,m,g,y,b,v,x,A,S=a.timeline,w=[],C=[],P=[],E=[],T=[],M=[],D=[],I=[],O=[],L=[],F=[],B=[],N=[],R=[],V=[],k=[],U=[],j=[],G={},z={},$=0,X=[],W=[],H=[],q=[],J=[],Q=[],K={},Y=0,Z=e.length,tt=0,et=0,it=null,nt=-1,rt=-1,ot=-1,st=!0;for(MovieClip.movieClipSoundsManagerClass=MovieClipSoundsManager,Ot=0;Ot<Z;Ot++){if(X.length=0,W.length=0,H.length=0,q.length=0,J.length=0,Q.length=0,e[Ot].soundStreamHead&&a.initSoundStream(e[Ot].soundStreamHead,Z),e[Ot].soundStreamBlock&&a.addSoundStreamBlock(Ot,e[Ot].soundStreamBlock),e[Ot].initActionBlocks&&(S.avm1InitActions[Ot]=e[Ot].initActionBlocks),e[Ot].exports)for(_t in S.avm1Exports[Ot]=e[Ot].exports,e[Ot].exports){var at=e[Ot].exports[_t],lt=this._awaySymbols[at.symbolId];lt?lt.isAsset?lt.name=at.className.toLowerCase():lt.away:console.log("\n\nerror: no away-asset for export\n\n",e[Ot].exports[_t])}if(_=!(e[Ot].controlTags&&0!=e[Ot].controlTags.length||e[Ot].labelNames&&0!=e[Ot].labelNames.length||e[Ot].actionBlocks&&0!=e[Ot].actionBlocks.length),0!=w.length&&_)if(o){for(_t in tt=0,tt|=1,C.push(T.length),w[w.length]=1,P.push(tt),G)(h=z[(l=G[_t]).id])||(h=z[l.id]={}),h[c=l.name]||(h[c]=[]),h[c].push(l.sessionID);G={},$++}else w[w.length-1]+=1;else{if(tt=0,o){for(_t in tt|=1,G)(h=z[(l=G[_t]).id])||(h=z[l.id]={}),h[c=l.name]||(h[c]=[]),h[c].push(l.sessionID);G={}}if(C.push(T.length),w[w.length]=1,!_&&e[Ot].labelNames&&0<e[Ot].labelNames.length)for(d=e[Ot].labelNames.length,p=0;p<d;p++){var ct=u=e[Ot].labelNames[p];this.swfFile.swfVersion<=9&&(u=u.toLowerCase()),S._labels[u]||(S._labels[u]={keyFrameIndex:$,name:ct})}if(!_&&e[Ot].actionBlocks&&0<e[Ot].actionBlocks.length&&S.add_framescript(e[Ot].actionBlocks,Ot),r&&r[$]&&0!=r[$].id&&(it=this._awaySymbols[r[$].id])&&(S.audioPool[et]={cmd:15,id:r[$].id,sound:it,props:r[$].info},q.push(et++)),$++,!_&&e[Ot].controlTags&&0<e[Ot].controlTags.length){for(f=e[Ot].controlTags.length,m=0;m<f;m++)switch((A=void 0===(g=e[Ot].controlTags[m]).tagCode?g:this.getParsedTag(g)).code){case 15:it=this._awaySymbols[A.soundId],A.soundInfo&&32&A.soundInfo.flags?S.audioPool[et]={cmd:16,id:A.soundId,sound:this._awaySymbols[A.soundId],props:A.soundInfo}:S.audioPool[et]={cmd:15,id:A.soundId,sound:this._awaySymbols[A.soundId],props:A.soundInfo},q.push(et++);break;case 16:S.audioPool[et]={cmd:16,id:A.soundId,sound:this._awaySymbols[A.soundId],props:A.soundInfo},q.push(et++);break;case 5:case 28:(l=G[A.depth])||console.log("Error in timeline. remove cant find the obejct to remove"),X[X.length]={depth:0|A.depth},G[A.depth]=null,K[A.depth.toString()]=null,(h=z[l.id])||(h=z[l.id]={}),h[c=l.name]||(h[c]=[]),h[c].push(l.sessionID),delete G[A.depth];break;case 4:case 26:case 70:if(l=G[(y=A).depth],b=-1<y.symbolId,1&y.flags&&!l)break;var ht,it=null,nt=-1,rt=-1,ot=-1;if(b)if((it=this._awaySymbols[y.symbolId]).isAsset(BitmapImage2D)&&((ht=new MethodMaterial(it)).alphaBlending=it.transparent,it=Billboard.getNewBillboard(ht)),v=this.dictionary[y.symbolId],it.isAsset(Graphics))if(rt=y.symbolId,S.graphicsPool[y.symbolId]||(S.graphicsPool[y.symbolId]=it),(x=this._factory.createSprite(null,it,v)).mouseEnabled=!1,l&&l.awayChild.isAsset(Sprite))nt=l.sessionID;else{if(null!=y&&(y.name&&""!=y.name||this._buttonIds[y.symbolId]||this._mcIds[y.symbolId])&&(y.name&&""!=y.name||(y.name="instance"+y.symbolId+"_"+Y++)),l&&(X[X.length]={depth:0|A.depth},(h=z[l.id])||(h=z[l.id]={}),h[c=l.name]||(h[c]=[]),h[c].push(l.sessionID),G[A.depth]=null,K[A.depth.toString()]=null,delete G[A.depth]),z[y.symbolId])if(c=y.name?y.name:"noname",z[y.symbolId][c]&&0<z[y.symbolId][c].length)nt=z[y.symbolId][c].shift();else for(_t in z[y.symbolId])if(0<z[y.symbolId][_t].length){nt=z[y.symbolId][_t].shift();break}-1==nt&&(nt=S.registerPotentialChild(x)),(y.name||y.variableName||y.events&&0<y.events.length)&&(S.potentialPrototypesInitEventsMap[nt+"#"+Ot]=y),l=G[A.depth]={sessionID:nt,id:y.symbolId,masks:[],isMask:!1,clipDepth:0,depth:0,awayChild:x,name:y.name?y.name:"noname"},W[W.length]={sessionID:nt,depth:A.depth,id:y.symbolId,name:y.name}}else{if(y.name&&""!=y.name||(y.name="instance"+y.symbolId+"_"+Y++),z[y.symbolId])if(c=y.name?y.name:"noname",z[y.symbolId][c]&&0<z[y.symbolId][c].length)nt=z[y.symbolId][c].shift();else for(_t in z[y.symbolId])if(0<z[y.symbolId][_t].length){nt=z[y.symbolId][_t].shift();break}-1==nt&&(nt=S.registerPotentialChild(it)),(y.name||y.variableName||y.events&&0<y.events.length)&&(S.potentialPrototypesInitEventsMap[nt+"#"+Ot]=y),st=!0,G[A.depth]&&G[A.depth].id==y.symbolId&&(st=!1),l=G[A.depth]={sessionID:nt,id:y.symbolId,masks:[],isMask:!1,clipDepth:0,depth:0,awayChild:it,name:y.name?y.name:"noname"},st&&(W[W.length]={sessionID:nt,depth:A.depth,id:y.symbolId,name:y.name})}if(16&y.flags&&(it=it||this._awaySymbols[l.id]).isAsset(MorphSprite)&&(ot=y.ratio),!l)throw"error in add command";H[H.length]={child:l,placeObjectTag:y,swapGraphicsID:rt,ratio:ot,depth:A.depth};break;default:console.log("unknown timeline command tag",A)}var ut=I.length;if(dt=X.length){ut=I.length;for(var pt=0;pt<dt;pt++)I.push(X[pt].depth);tt|=2,E.push(I.length-ut),T.push(ut)}if(dt=W.length){for(ut=M.length,pt=0;pt<dt;pt++)M.push(W[pt].sessionID),M.push(W[pt].depth);tt|=4,E.push(dt),T.push(ut/2)}var dt=H.length;for(var _t in G)G[_t].oldMasks=G[_t].masks,G[_t].masks=[],G[_t].maskingChanged=!1;if(dt)for(pt=0;pt<dt;pt++)y=H[pt].placeObjectTag,(l=H[pt].child).maskingChanged=!0,64&y.flags&&(G[y.depth].isMask=!0,G[y.depth].clipDepth=y.clipDepth-1,G[y.depth].depth=y.depth);for(var _t in G)if(G[_t].isMask)for(var ft=G[_t].clipDepth;ft>G[_t].depth;)G[ft]&&G[ft].masks.push(G[_t].sessionID),ft--;var mt=0,gt=0,yt=[];for(var _t in G){var bt=G[_t];if(bt.masks.sort(),bt.oldMasks.sort(),bt.masks.length!=bt.oldMasks.length)yt.push(bt),bt.maskingChanged=!0;else for(mt=0,gt=bt.masks.length,mt=0;mt<gt;mt++)if(bt.masks[mt]!=bt.oldMasks[mt]){yt.push(bt),bt.maskingChanged=!0;break}}for(gt=yt.length,mt=0;mt<gt;mt++){var vt=!1;if(dt)for(pt=0;pt<dt;pt++)H[pt].child==yt[mt]&&(vt=!0);vt||(H[H.length]={child:yt[mt],placeObjectTag:null,swapGraphicsID:null,ratio:null,depth:null})}if(dt=H.length){ut=O.length;for(var xt,At=0,pt=0;pt<dt;pt++){y=(xt=H[pt]).placeObjectTag,l=xt.child;var St,wt=B.length,Ct=0;if(null!=xt.swapGraphicsID&&0<=xt.swapGraphicsID&&(Ct++,B.push(202),N.push(R.length),R.push(xt.swapGraphicsID)),null!=y&&(y.name&&""!=y.name||this._buttonIds[y.symbolId]||this._mcIds[y.symbolId])&&(Ct++,this._buttonIds[y.symbolId]?B.push(5):B.push(4),N.push(j.length),j.push(y.name)),null!=y&&4&y.flags?(Ct++,B.push(1),N.push(k.length/6),0==y.matrix.a&&0==y.matrix.b&&0==y.matrix.c&&0!=y.matrix.d?y.matrix.a=1:0==y.matrix.d&&0==y.matrix.b&&0==y.matrix.c&&0!=y.matrix.a&&(y.matrix.d=1),k[k.length]=y.matrix.a,k[k.length]=y.matrix.b,k[k.length]=y.matrix.c,k[k.length]=y.matrix.d,k[k.length]=y.matrix.tx/20,k[k.length]=y.matrix.ty/20,K[xt.depth.toString()]=y.matrix):null==xt.depth||(St=K[xt.depth.toString()])&&(Ct++,B.push(1),N.push(k.length/6),k[k.length]=St.a,k[k.length]=St.b,k[k.length]=St.c,k[k.length]=St.d,k[k.length]=St.tx/20,k[k.length]=St.ty/20),null!=y&&8&y.flags&&(B.push(2),N.push(U.length/8),Ct++,U[U.length]=y.cxform.redMultiplier/255,U[U.length]=y.cxform.greenMultiplier/255,U[U.length]=y.cxform.blueMultiplier/255,U[U.length]=y.cxform.alphaMultiplier/255,U[U.length]=y.cxform.redOffset,U[U.length]=y.cxform.greenOffset,U[U.length]=y.cxform.blueOffset,U[U.length]=y.cxform.alphaOffset),null!=xt.ratio&&0<=xt.ratio&&(Ct++,B.push(203),N.push(R.length),R.push(0|xt.ratio)),l.maskingChanged){Ct++,B.push(3),N.push(R.length),R.push(l.masks.length);for(var Pt=0,Et=l.masks;Pt<Et.length;Pt++){var Tt=Et[Pt];R.push(Tt)}}if(null!=y&&64&y.flags&&(Ct++,B.push(200),N.push(0)),null!=y&&256&y.flags){Ct++,B.push(9),N.push(R.length),R.push(V.length),R.push(y.filters.length);for(var Mt=0;Mt<y.filters.length;Mt++)V.push(y.filters[Mt])}null!=y&&8192&y.flags&&(Ct++,B.push(6),N.push(y.visibility?1:0)),0<Ct&&(At++,O.push(l.sessionID),L.push(wt),F.push(Ct))}0<At&&(tt|=8,E.push(dt),T.push(ut))}if(dt=q.length){for(tt|=16,ut=D.length,pt=0;pt<dt;pt++)D.push(q[pt]);E.push(dt),T.push(ut)}}0==P.length&&(tt|=1),P.push(tt)}}var Dt=["_up","_over","_down","_hit"];if(4==Z){for(var It=0,Ot=0;Ot<Z;Ot++)e[Ot].labelNames&&0<e[Ot].labelNames.length&&e[Ot].labelNames[0]==Dt[Ot]&&It++;4==It&&(o=!0)}return S.numKeyFrames=$,S.keyframe_durations=new Uint32Array(w),S.frame_command_indices=new Uint32Array(C),S.frame_recipe=new Uint32Array(P),S.command_length_stream=new Uint32Array(E),S.command_index_stream=new Uint32Array(T),S.add_child_stream=new Uint32Array(M),S.add_sounds_stream=new Uint32Array(D),S.remove_child_stream=new Uint32Array(I),S.update_child_stream=new Uint32Array(O),S.update_child_props_indices_stream=new Uint32Array(L),S.update_child_props_length_stream=new Uint32Array(F),S.property_type_stream=new Uint32Array(B),S.property_index_stream=new Uint32Array(N),S.properties_stream_int=new Uint32Array(R),S.properties_stream_f32_mtx_scale_rot=new Float32Array([]),S.properties_stream_f32_mtx_pos=new Float32Array([]),S.properties_stream_f32_mtx_all=new Float32Array(k),S.properties_stream_f32_ct=new Float32Array(U),S.properties_stream_strings=j,S.properties_stream_filters=V,S.init(),o?(a.buttonMode=!0,S.isButton=!0,n&&(S.avm1ButtonActions=n),S.extractHitArea(a)):a.mouseEnabled=!1,a},odd.prototype._pStartParsing=function(t){ndd.prototype._pStartParsing.call(this,t)},odd.prototype.dispose=function(){this.swfData=null,this._dataStream=null},odd.prototype.updateTimers=function(t){},odd.prototype.initSWFLoading=function(t,e){assert(67===t[0]||70===t[0]||90===t[0],"Unsupported compression format: "+t[0]),assert(87===t[1]),assert(83===t[2]),assert(30<=t.length,"At least the header must be complete here."),this._swfFile.bytesTotal=e,this._swfFile.frames=[],this.abcBlocks=[],this.dictionary=[],this.fonts=[],this.symbolClassesMap=[],this.symbolClassesList=[],this.eagerlyParsedSymbolsMap=[],this.eagerlyParsedSymbolsList=[],this._jpegTables=null,this._currentFrameLabels=[],this._currentSoundStreamHead=null,this._currentSoundStreamBlock=null,this._currentControlTags=null,this._currentActionBlocks=null,this._currentInitActionBlocks=null,this._currentExports=null,this._endTagEncountered=!1,this._isEncrypted=!1,this._currentEncrActionBlocks=null,this.readHeaderAndInitialize(t)},odd.prototype.finishLoading=function(){this._swfFile.compression!==CompressionMethod.None&&(this._decompressor.close(),this._decompressor=null,this.scanLoadedData())},odd.prototype.getSymbol=function(t){if(this.eagerlyParsedSymbolsMap[t])return this.eagerlyParsedSymbolsMap[t];var e,i=this.dictionary[t];return i?((e=39===i.tagCode?this.parseSpriteTimeline(i):this.getParsedTag(i)).className=this.symbolClassesMap[t]||null,e.env=this.env,e):null},odd.prototype.getParsedTag=function(t){this._dataStream.align(),this._dataStream.pos=t.byteOffset;var e=tagHandlers[t.tagCode],i=Math.min(t.byteOffset+t.byteLength,this._dataStream.end),n=e(this._dataStream,this._swfFile.swfVersion,t.tagCode,i,this._jpegTables);return this._dataStream.pos!==i&&this.emitTagSlopWarning(t,i),defineSymbol(n,this.dictionary,this)},odd.prototype.readHeaderAndInitialize=function(t){var e=67===t[0],i=90===t[0];e?this._swfFile.compression=CompressionMethod.Deflate:i&&(this._swfFile.compression=CompressionMethod.LZMA),this._swfFile.swfVersion=t[3],this._swfFile.mapSWFVersionToFPVersion(),this._swfFile.swfVersion,this._loadStarted=Date.now(),this._uncompressedLength=readSWFLength(t),this._swfFile.bytesLoaded=t.length,this.swfData=new Uint8Array(this._swfFile.compression===CompressionMethod.None?this._swfFile.bytesTotal:this._uncompressedLength),this._dataStream=new Stream(this.swfData.buffer),this._dataStream.pos=8,this._dataView=this._dataStream.view,e?(this.swfData.set(t.subarray(0,8)),this._uncompressedLoadedLength=8,this._decompressor=Inflate.create(!0),this._decompressor.onData=this.processFirstBatchOfDecompressedData.bind(this),this._decompressor.onError=function(t){throw new Error(t)},this._decompressor.push(t.subarray(8))):i?(this.swfData.set(t.subarray(0,8)),this._uncompressedLoadedLength=8,this._decompressor=new LzmaDecoder(!0),this._decompressor.onData=this.processFirstBatchOfDecompressedData.bind(this),this._decompressor.onError=function(t){},this._decompressor.push(t)):(this.swfData.set(t),this._uncompressedLoadedLength=t.length,this._decompressor=null,this.parseHeaderContents()),this._lastScanPosition=this._dataStream.pos,this.scanLoadedData()},odd.prototype.parseHeaderContents=function(){var t=parseHeader(this._dataStream);this._swfFile.bounds=this._swfFile.bounds=t.bounds,this._swfFile.frameRate=this._swfFile.frameRate=t.frameRate,this._swfFile.frameCount=this._swfFile.frameCount=t.frameCount},odd.prototype.processFirstBatchOfDecompressedData=function(t){this.processDecompressedData(t),this.parseHeaderContents(),this._decompressor.onData=this.processDecompressedData.bind(this)},odd.prototype.processDecompressedData=function(t){var e=Math.min(t.length,this._uncompressedLength-this._uncompressedLoadedLength);memCopy(this.swfData,t,this._uncompressedLoadedLength,0,e),this._uncompressedLoadedLength+=e},odd.prototype.scanLoadedData=function(){this._dataStream.pos=this._lastScanPosition,this.scanTagsToOffset(this._uncompressedLoadedLength,!0),this._lastScanPosition=this._dataStream.pos},odd.prototype.scanTagsToOffset=function(t,e){for(var i,n=new UnparsedTag(0,0,0);(i=this._dataStream.pos)<t-1&&this.parseNextTagHeader(n);){if(0===n.tagCode)return void(e&&(this._endTagEncountered=!0));var r=n.byteOffset+n.byteLength;if(t<r)return void(this._dataStream.pos=i);this.scanTag(n,e),this._dataStream.pos!==r&&this.emitTagSlopWarning(n,r)}},odd.prototype.parseNextTagHeader=function(t){var e=this._dataStream.pos,i=this._dataView.getUint16(e,!0);e+=2,t.tagCode=i>>6;var n=63&i;if(63===n){if(e+4>this._uncompressedLoadedLength)return!1;n=this._dataView.getUint32(e,!0),e+=4}return this._dataStream.pos=e,t.byteOffset=e,t.byteLength=n,!0},odd.prototype.Utf8ArrayToStr=function(t){for(var e,i,n,r="",o=t.length,s=0;s<o;)switch((e=t[s++])>>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:r+=String.fromCharCode(e);break;case 12:case 13:i=t[s++],r+=String.fromCharCode((31&e)<<6|63&i);break;case 14:i=t[s++],n=t[s++],r+=String.fromCharCode((15&e)<<12|(63&i)<<6|(63&n)<<0)}return r},odd.prototype.scanTag=function(t,e){var i,n,r=this._dataStream,o=r.pos;assert(o===t.byteOffset);var s,a,l,c,h,u,p,d,_,f,m=t.tagCode,g=t.byteLength;if(39===m){this.addLazySymbol(m,o,g);var y=o+g;return r.pos+=4,this.scanTagsToOffset(y,!1),void(this._dataStream.pos!==y&&this.emitTagSlopWarning(t,y))}if(ImageDefinitionTags[m]){var b=this.addLazySymbol(m,o,g);this.decodeEmbeddedImage(b)}else{if(14===m){b=this.addLazySymbol(m,o,g);var v=this.getParsedTag(b),x=new EagerlyParsedDictionaryEntry(v.id,b,"sound",v);return this.eagerlyParsedSymbolsMap[x.id]=x,void this.eagerlyParsedSymbolsList.push(x)}if(FontDefinitionTags[m])b=this.addLazySymbol(m,o,g),this.registerEmbeddedFont(b);else{if(DefinitionTags[m])return this.addLazySymbol(m,o,g),void this.jumpToNextTag(g);if(e||76===m||56===m)if(ControlTags[m])this.addControlTag(m,o,g);else switch(m){case 69:this.setFileAttributes(g);break;case 86:this.setSceneAndFrameLabelData(g);break;case 9:this._swfFile.backgroundColor=this._swfFile.backgroundColor=parseRgb(this._dataStream);break;case 8:this._jpegTables||(this._jpegTables=0===g?new Uint8Array(0):this.swfData.subarray(r.pos,r.pos+g-2)),this.jumpToNextTag(g);break;case 82:case 72:this._swfFile.useAVM1?this.jumpToNextTag(g):(s=o+g,a=new ABCBlock,82===m?(a.flags=r.readUi32(),a.name=r.readString(-1)):(a.flags=0,a.name=""),a.data=this.swfData.subarray(r.pos,s),this.abcBlocks.push(a),r.pos=s);break;case 76:s=o+g;for(var A=r.readUi16();A--;){var S=r.readUi16(),w=r.readString(-1);this.symbolClassesMap[S]=w,this.symbolClassesList.push({id:S,className:w})}r.pos=s;break;case 59:this._swfFile.useAVM1&&(l=this._currentInitActionBlocks||(this._currentInitActionBlocks=[]),c=this._dataView.getUint16(r.pos,!0),h=this.swfData.subarray(o+2,o+g),d=this._isEncrypted&&null!==(i=this._currentEncrActionBlocks)&&void 0!==i?i.pop():void 0,l.push({spriteId:c,actionsData:h,encryptedData:d})),this.jumpToNextTag(g);break;case 12:this._swfFile.useAVM1&&(u=this._currentActionBlocks||(this._currentActionBlocks=[]),p=this.swfData.subarray(r.pos,r.pos+g),d=this._isEncrypted&&null!==(n=this._currentEncrActionBlocks)&&void 0!==n?n.pop():void 0,u.push({actionsData:p,precedence:r.pos,encryptedData:d})),this.jumpToNextTag(g);break;case 18:case 45:var C=parseSoundStreamHeadTag(this._dataStream,o+g);this._currentSoundStreamHead=SoundStream.FromTag(C);break;case 19:this._currentSoundStreamBlock=this.swfData.subarray(r.pos,r.pos+=g);break;case 43:s=r.pos+g,this._currentFrameLabels[this._currentFrameLabels.length]=r.readString(-1),r.pos=s;break;case 1:this.finishFrame();break;case 0:return;case 56:s=r.pos+g;for(var P=r.readUi16(),E=this._currentExports||(this._currentExports=[]);P--;){S=r.readUi16();var T=r.readString(-1);if(r.pos>s){r.pos=s;break}E.push(new SymbolExport(S,T))}r.pos=s;break;case 17:s=r.pos+g;var M=r.readUi16();this._buttonSounds[M]={};for(var D=0;D<4;D++)this._buttonSounds[M][D]={},this._buttonSounds[M][D].id=r.readUi16(),0!=this._buttonSounds[M][D].id&&(this._buttonSounds[M][D].info=parseSoundInfo(r));r.pos=s;break;case 23:case 13:case 62:case 78:case 57:case 71:this.jumpToNextTag(g);break;case 77:this.parseMetaData(g);break;case 74:case 73:case 65:case 66:case 58:case 64:case 63:case 88:case 40:case 41:case 24:case 25:case 93:case 55:case 49:this.jumpToNextTag(g);break;case 51:case 44:case 50:case 53:case 42:case 38:case 52:case 3:case 31:case 47:case 16:case 29:this.jumpToNextTag(g);break;case 255:console.log("Tag 255 present. SWF is encrypted"),this._isEncrypted=!0,this.jumpToNextTag(g);break;case 253:this._isEncrypted&&(_=this._currentEncrActionBlocks||(this._currentEncrActionBlocks=[]),f=this.swfData.subarray(o+2,o+g),_.push({data:f,bytePos:o+2,size:g,rawTagId:m})),this.jumpToNextTag(g);break;default:100<m?console.log("Encountered undefined tag "+m+", probably used for AVM1 obfuscation. See http://ijs.mtasa.com/files/swfdecrypt.cpp."):console.log("Tag not handled by the parser: "+m+": "+getSwfTagCodeName(m)),this.jumpToNextTag(g)}else this.jumpToNextTag(g)}}},odd.prototype.parseSpriteTimeline=function(t){var e=this.swfData,i=this._dataStream,n=this._dataView,r={id:t.id,type:"sprite",frames:[]},o=t.byteOffset+t.byteLength,s=r.frames,a=[],l=[],c=null,h=null,u=null,p=null;i.pos=t.byteOffset+2,r.frameCount=n.getUint16(i.pos,!0),i.pos+=2;for(var d=new UnparsedTag(0,0,0);i.pos<o;){this.parseNextTagHeader(d);var _,f,m=d.byteLength,g=d.tagCode;if(i.pos+m>o){console.log("DefineSprite child tags exceed DefineSprite tag length and are dropped");break}if(ControlTags[g])l.push(new UnparsedTag(g,i.pos,m)),i.pos+=m;else{switch(g){case 12:this._swfFile.useAVM1&&(u=u||[],_=e.subarray(i.pos,i.pos+m),u.push({actionsData:_,precedence:i.pos}));break;case 59:this._swfFile.useAVM1&&(p=p||[],f=n.getUint16(i.pos,!0),i.pos+=2,_=e.subarray(i.pos,i.pos+m),p.push({spriteId:f,actionsData:_}));break;case 43:var y=i.pos+m;a[a.length]=i.readString(-1),i.pos=y,m=0;break;case 1:s.push(new SWFFrame(l,a.concat(),c,h,u,p,null)),a.length=0,l=[],p=u=h=c=null;break;case 0:i.pos=o,m=0;break;case 18:case 45:var b=i.pos,v=parseSoundStreamHeadTag(i,y=i.pos+m),c=SoundStream.FromTag(v);i.pos=b;break;case 19:b=i.pos,y=i.pos+m,h=this.swfData.subarray(i.pos,y),i.pos=b}i.pos+=m,assert(i.pos<=o)}}return r},odd.prototype.parseMetaData=function(t){this._dataStream.pos+=t},odd.prototype.jumpToNextTag=function(t){this._dataStream.pos+=t},odd.prototype.emitTagSlopWarning=function(t,e){this._dataStream.pos,t.byteOffset,this._dataStream.pos=e},odd.prototype.finishFrame=function(){0===this.pendingUpdateDelays&&this._swfFile.framesLoaded++,this._swfFile.frames.push(new SWFFrame(this._currentControlTags,this._currentFrameLabels.concat(),this._currentSoundStreamHead,this._currentSoundStreamBlock,this._currentActionBlocks,this._currentInitActionBlocks,this._currentExports)),this._currentFrameLabels.length=0,this._currentControlTags=null,this._currentSoundStreamHead=null,this._currentSoundStreamBlock=null,this._currentActionBlocks=null,this._currentInitActionBlocks=null,this._currentExports=null},odd.prototype.setFileAttributes=function(t){this._swfFile.attributes&&this.jumpToNextTag(t);var e=this.swfData[this._dataStream.pos];this._dataStream.pos+=4,this._swfFile.attributes={network:1&e,relativeUrls:2&e,noCrossDomainCaching:4&e,doAbc:8&e,hasMetadata:16&e,useGpu:32&e,useDirectBlit:64&e},this._swfFile.useAVM1=!this._swfFile.attributes.doAbc},odd.prototype.setSceneAndFrameLabelData=function(t){this._swfFile.sceneAndFrameLabelData?this.jumpToNextTag(t):this._swfFile.sceneAndFrameLabelData=this._swfFile.sceneAndFrameLabelData=parseDefineSceneTag(this._dataStream,86)},odd.prototype.addControlTag=function(t,e,i){(this._currentControlTags||(this._currentControlTags=[])).push(new UnparsedTag(t,e,i)),this.jumpToNextTag(i)},odd.prototype.addLazySymbol=function(t,e,i){var n=this._dataView.getUint16(this._dataStream.pos,!0),r=new DictionaryEntry(n,t,e,i);return this.dictionary[n]=r},odd.prototype.decodeEmbeddedFont=function(t){var e=this.getParsedTag(t),i=new EagerlyParsedDictionaryEntry(e.id,t,"font",e);this.eagerlyParsedSymbolsMap[i.id]=i,this.eagerlyParsedSymbolsList.push(i);var n=flagsToFontStyle(e.bold,e.italic);this.fonts.push({name:e.name,id:e.id,style:n})},odd.prototype.registerEmbeddedFont=function(t){var e,i,n,r,o=this._dataStream,s=this._dataView.getUint16(o.pos,!0);10===t.tagCode?(e="__autofont__"+t.byteOffset,n="regular"):(n=flagsToFontStyle(!!(1&(i=this.swfData[o.pos+2])),!!(2&i)),r=this.swfData[o.pos+4],o.pos+=5,e=o.readString(r)),this.fonts.push({name:e,id:s,style:n}),o.pos=t.byteOffset+t.byteLength},odd.prototype.decodeEmbeddedImage=function(t){var e=this.getParsedTag(t),i=new EagerlyParsedDictionaryEntry(e.id,t,"image",e);this.eagerlyParsedSymbolsMap[i.id]=i,this.eagerlyParsedSymbolsList.push(i)},odd.factory=null,odd),ndd;function odd(t){void 0===t&&(t=null);var e=ndd.call(this,URLLoaderDataFormat.ARRAY_BUFFER)||this;return e._parsed_header=!1,e._debug=!1,e._isEncrypted=!1,e._currentEncrActionBlocks=[],e.soundExports={},e.externalDependenciesCount=0,e._buttonIds={},e._mcIds={},e.textFormatAlignMap=[TextFormatAlign.LEFT,TextFormatAlign.RIGHT,TextFormatAlign.CENTER,TextFormatAlign.JUSTIFY],e._buttonSounds={},e._swfFile=new SWFFile,e._factory=t,e._progressState=0,e}function flagsToFontStyle(t,e){return t&&e?"boldItalic":t?"bold":e?"italic":"regular"}function readSWFLength(t){return(t[4]|t[5]<<8|t[6]<<16|t[7]<<24)>>>0}function defineSymbol(t,e,i){switch(t.code){case 6:case 21:case 35:case 90:return defineImage(t);case 20:case 36:return defineBitmap(t);case 7:case 34:return defineButton(t,e);case 37:return defineText(t);case 10:case 48:case 75:case 91:return defineFont(t,i._iFileName);case 46:case 84:case 2:case 22:case 32:case 83:return defineShape(t,i);case 14:return defineSound(t);case 60:return{type:"video",id:t.id,width:t.width,height:t.height,deblocking:t.deblocking,smoothing:t.smoothing,codec:t.codecId};case 39:return t;case 87:return{type:"binary",id:t.id,data:t.data};case 11:case 33:return defineLabel(t);default:return t}}var StageAlign=(Uhd.BOTTOM="B",Uhd.BOTTOM_LEFT="BL",Uhd.BOTTOM_RIGHT="BR",Uhd.LEFT="L",Uhd.RIGHT="R",Uhd.TOP="T",Uhd.TOP_LEFT="TL",Uhd.TOP_RIGHT="TR",Uhd),StageScaleMode=(Vhd.EXACT_FIT="EXACT_FIT",Vhd.NO_BORDER="noBorder",Vhd.NO_SCALE="noScale",Vhd.SHOW_ALL="showAll",Vhd),hasshownServerError=!1,TEST_MODE,Xhd;function Vhd(){}function Uhd(){}function serverError(t){hasshownServerError||(hasshownServerError=!0,alert("Can not connect to Server. Is Server.js running ?"))}Xhd=TEST_MODE=TEST_MODE||{},Xhd.TESTING="TESTING",Xhd.RECORDING="RECORDING";var AVMTestHandler=(Yhd.prototype.addMessage=function(t){this._finished||(this.frames[this.frames.length-1].messages.push(t),this.checkIfFinished())},Yhd.prototype.setSWF=function(t){this.swfInfo={frameRate:t.frameRate,swfVersion:t.swfVersion,asVersion:t.useAVM1?2:3,width:t.bounds.width/20,height:t.bounds.height/20}},Yhd.prototype.recordEvent=function(t){var e;this.config.settings.snapShotOnMouseDown&&"mousedown"==t.type&&this.takeSnapshot(),this.config.settings.snapShotOnMouseUP&&"mouseup"==t.type&&this.takeSnapshot(),this.config.recordtest&&this.config.settings.recordInput&&(this.events[this.frameIdx]||(this.events[this.frameIdx]=[]),e={type:t.type,screenX:t.screenX,screenY:t.screenY,clientX:t.clientX,clientY:t.clientY,ctrlKey:t.ctrlKey,altKey:t.altKey,shiftKey:t.shiftKey},this.events[this.frameIdx].push(e))},Yhd.prototype.dispatchEvents=function(){if(!this.config.recordtest&&this.config.events&&this.config.events[this.frameIdx])for(var t=0;t<this.config.events[this.frameIdx].length;t++){var e=this.config.events[this.frameIdx][t];switch(e.preventDefault=function(){},e.type){case"click":MouseManager.getInstance(null).onClick(e);break;case"dblclick":MouseManager.getInstance(null).onDoubleClick(e);break;case"touchstart":MouseManager.getInstance(null).onMouseDown(e);break;case"mousedown":this.config.settings.snapShotOnMouseDown&&this.takeSnapshot(),MouseManager.getInstance(null).onMouseDown(e);break;case"touchmove":case"mousemove":MouseManager.getInstance(null).onMouseMove(e);break;case"mouseup":this.config.settings.snapShotOnMouseUP&&this.takeSnapshot(),MouseManager.getInstance(null).onMouseUp(e);break;case"touchend":MouseManager.getInstance(null).onMouseUp(e);break;case"touchend":MouseManager.getInstance(null).onClick(e);break;case"mousewheel":MouseManager.getInstance(null).onMouseWheel(e);break;case"mouseover":MouseManager.getInstance(null).onMouseOver(e);break;case"mouseout":MouseManager.getInstance(null).onMouseOut(e);break;case"keydown":MouseManager.getInstance(null).onKeyDown(e);break;case"keyup":MouseManager.getInstance(null).onKeyUp(e)}}},Yhd.prototype.closeBrowserTab=function(){this._finished&&(0==this.snapShotsUploaded&&0==this.snapshotCnt||this.snapShotsUploaded==this.snapshotCnt)&&this.finishAndUploadTest()},Yhd.prototype.takeSnapshot=function(){var r,o;this._finished||(o=(r=this).snapshotCnt++,this.addMessage("AWAYFLTEST SNAPSHOT "+o),this._avmStage.snapshot(function(t){t.toBlob(function(t){console.log("snapshot done");var e=new FormData,i="snapshot_"+o+".png";e.append("file",t,i);var n=new XMLHttpRequest;n.onreadystatechange=function(t){4==n.readyState&&(200==n.status||0==n.status?(r.snapShotsUploaded++,r.closeBrowserTab()):serverError())},n.onerror=function(t){serverError()};try{n.open("POST","http://localhost:"+r.config.port+"/uploadImage",!0),n.send(e)}catch(t){serverError()}})}))},Yhd.prototype.nextFrame=function(){this.frameIdx++,0<this.config.settings.stopRecAfterFrame&&this.frameIdx>this.config.settings.stopRecAfterFrame&&this.finishTest(),this._finished||(0!=this.config.settings.snapShotFrames&&this.frameIdx%this.config.settings.snapShotFrames==0&&this.takeSnapshot(),this.config.settings.onlyTraces||(0<this.frames[this.frames.length-1].messages.length?this.frames.push({messages:[],frameIdx:this.frameIdx}):this.frames[this.frames.length-1].frameIdx=this.frameIdx))},Yhd.prototype.checkIfFinished=function(){if(this.config.frames){if(this.config.frames.length<this.frames.length)return void this.finishTest();for(var t,e=-1,i=0;i<this.config.frames.length;i++)this.config.frames[i].frameIdx==this.frames[this.frames.length-1].frameIdx&&(e=i);if(-1==e)return void this.finishTest();e==this.config.frames.length-1&&(t=this.config.frames[e].messages.length,this.frames[this.frames.length-1].messages.length>=t&&this.finishTest())}},Yhd.prototype.finishTest=function(){this._finished||(this._finished=!0,this.closeBrowserTab())},Yhd.prototype.finishAndUploadTest=function(){0==this.frames[this.frames.length-1].messages.length&&this.frames.pop();var t,e=window.location.pathname.split("/").pop().replace(".html",""),i={player:"awayflplayer",duration:Date.now()-this.config.startRecTime,date:(new Date).toLocaleString(),url:e,swf:this.config.swfPath,swfInfos:this.swfInfo,settings:this.config.settings,frames:this.frames,events:this.events,seed:this.config.seed},n=JSON.stringify(i),r=new FormData,o=new Blob([n],{type:"text/xml"});this.config.recordtest?(t=this.config.swfPath.replace(/\\/g,"/"),r.append("file",o,t),r.append("record","true")):(t=this.config.swfPath.replace(/\\/g,"/")+"/"+this.config.testPath,r.append("file",o,t));var s=new XMLHttpRequest;s.onreadystatechange=function(t){4==s.readyState&&(200==s.status||0==s.status?console.log("AWAYFLTEST END"):serverError())},s.onerror=function(t){serverError()};try{s.open("POST","http://localhost:"+this.config.port+"/upload",!0),s.send(r)}catch(e){serverError()}},Yhd),AVMStage=(Eid=DisplayObjectContainer,__extends(Fid,Eid),Fid.instance=function(){if(!Fid._instance)throw"AVMStage._instance should exists but does not";return Fid._instance},Object.defineProperty(Fid.prototype,"config",{get:function(){return this._gameConfig},enumerable:!0,configurable:!0}),Fid.prototype.registerAVMStageHandler=function(t){this._avmHandlers[t.avmVersion]=t},Fid.prototype.initAwayEninge=function(){this._scene=new Scene(new BasicPartition(new DisplayObjectContainer)),this._rendererStage=this.scene.view.stage,this._rendererStage.container.style.visibility="hidden",this._rendererStage.antiAlias=0,this._scene.renderer.renderableSorter=null,this._scene.forceMouseMove=!0,this._scene.mousePicker.shapeFlag=!0,this._projection=new PerspectiveProjection,this._projection.coordinateSystem=CoordinateSystem.RIGHT_HANDED,this._projection.originX=-1,this._projection.originY=1;var t=new Camera;t.projection=this._projection,this._scene.camera=t,this._projection.fieldOfView=360*Math.atan(window.innerHeight/1e3/2)/Math.PI,this.partition=new SceneGraphPartition(this,!0),this._scene.root.addChild(this)},Fid.prototype.playSWF=function(t,e){var i=this;this._gameConfig={files:[{data:t,path:e,resourceType:"GAME"}]},this.addEventListener(LoaderEvent.LOADER_COMPLETE,function(t){return i.play()}),this.loadNextResource()},Fid.prototype.snapshot=function(t){var e=new BitmapImage2D(this._stageWidth,this._stageHeight,!0,4294967295,!1);this._scene.renderer.queueSnapshot(e),this._scene.renderer.view.target=e,this._scene.render(),this._scene.renderer.view.target=null,e.invalidate();for(var i=e.data,n=new BitmapImage2D(this._stageWidth,this._stageHeight,!0,4278255615,!1),r=0,o=0,s=0,a=0,o=0;o<this._stageHeight;o++)for(r=0;r<this._stageWidth;r++)s=4*((this._stageHeight-1-o)*this._stageWidth+r),a=ColorUtils.ARGBtoFloat32(i[s+3],i[s],i[s+1],i[s+2]),n.setPixel32(r,o,a);n.invalidate();var l=document.createElement("canvas");l.width=n.width,l.height=n.height;var c=l.getContext("2d"),h=c.getImageData(0,0,n.width,n.height);h.data.set(n.data),c.putImageData(h,0,0),t&&t(l)},Fid.prototype.loadNextResource=function(t){var i=this;if(void 0===t&&(t=null),this._curFile=this._gameConfig.files.shift(),this._curFile){var n=new SWFParser;if(n._iFileName=this._curFile.path,"GAME"==this._curFile.resourceType){if(this._swfFile)throw"Only playing of 1 SWF file is supported at the moment";n.onFactoryRequest=function(t){i._swfFile=t,i.frameRate=i._swfFile.frameRate,i.color=ColorUtils.f32_RGBA_To_f32_ARGB(t.backgroundColor),i.stageWidth=i._swfFile.bounds.width/20,i.stageHeight=i._swfFile.bounds.height/20;var e=i._swfFile.useAVM1?"AVM1":"AVM2";if(i._avmHandler=i._avmHandlers[e],i.avmTestHandler&&!i.avmTestHandler.config.settings.onlyTraces&&i.avmTestHandler.setSWF(i._swfFile),!i._avmHandler)throw"no avm-handler installed for "+e;i._avmHandler.init(i,i._swfFile,function(t){n.factory=i._avmHandler.factory,SWFParser.factory=i._avmHandler.factory,t&&i.dispatchEvent(new AVMEvent(AVMEvent.AVM_COMPLETE,e))})}}AssetLibrary.addEventListener(LoaderEvent.LOADER_START,this._onLoaderStartDelegate),AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.addEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.addEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this._curFile.data?AssetLibrary.loadData(this._curFile.data,null,this._curFile.path,n):AssetLibrary.load(new URLRequest(this._curFile.path),null,this._curFile.path,n)}else{if(!this._swfFile)throw"no valid SWFFile was loaded!";t&&this.dispatchEvent(t)}},Fid.prototype.load=function(){this.loadNextResource()},Fid.prototype.onLoaderStart=function(t){this.dispatchEvent(t)},Fid.prototype._onAssetComplete=function(t){"GAME"==this._curFile.resourceType&&(0==Fid.runtimeStartTime&&(Fid.runtimeStartTime=Date.now()),this._avmHandler.addAsset(t.asset,!0)),this.dispatchEvent(t)},Fid.prototype.onLoaderComplete=function(t){AssetLibrary.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),this.loadNextResource(t)},Fid.prototype._onLoadError=function(t){AssetLibrary.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),console.log("error loading swf"),this.dispatchEvent(t)},Fid.prototype.play=function(t){void 0===t&&(t=0),this.resizeCallback(null),this._timer=new RequestAnimationFrame(this.main_loop,this),this._timer.start();var e=this.getChildAt(0);e?(t&&(e.currentFrameIndex=t),this.showNextFrame(0),this._rendererStage.container.style.visibility="visible"):console.warn("warning: AVMPlayer.play called, but no scene is loaded")},Fid.prototype.updateFPS=function(){this._fpsTextField.style.visibility=this._currentFps&&this._frameRate?"visible":"hidden",this._fpsTextField.innerText=this._currentFps.toFixed(2)+"/"+this._frameRate+" fps",this._currentFps=0},Fid.prototype.setStageDimensions=function(t,e,i,n){this._x=t,this._y=e,this._w=i,this._h=n,this.resizeStageInternal()},Fid.prototype.resizeStageInternal=function(){var t="string"==typeof this._x?parseFloat(this._x.replace("%",""))/100*window.innerWidth:this._x,e="string"==typeof this._y?parseFloat(this._y.replace("%",""))/100*window.innerHeight:this._y,i="string"==typeof this._w?parseFloat(this._w.replace("%",""))/100*window.innerWidth:this._w,n="string"==typeof this._h?parseFloat(this._h.replace("%",""))/100*window.innerHeight:this._h,r=t,o=e,s=i,a=n;switch(this._scaleMode){case StageScaleMode.NO_SCALE:this._projection.fieldOfView=360*Math.atan(n/1e3/2)/Math.PI;break;case StageScaleMode.SHOW_ALL:a=n,(s=this._stageWidth/this._stageHeight*a)>i&&(a=(s=i)*(this._stageHeight/this._stageWidth)),r+=(i-s)/2,o+=(n-a)/2,this._projection.fieldOfView=360*Math.atan(this._stageHeight/1e3/2)/Math.PI;break;case StageScaleMode.EXACT_FIT:case StageScaleMode.NO_BORDER:this._projection.fieldOfView=360*Math.atan(n/1e3/2)/Math.PI;break;default:console.log("Stage: only implemented StageScaleMode are NO_SCALE, SHOW_ALL")}switch(this._align){case StageAlign.TOP_LEFT:this._scene.view.x=r,this._scene.view.y=o;break;default:this._scene.view.x=r,this._scene.view.y=o,console.log("Stage: only implemented StageAlign is TOP_LEFT")}this._scene.view.x=r,this._scene.view.y=o,this._scene.view.width=s,this._scene.view.height=a,this._fpsTextField&&(this._fpsTextField.style.left=.5*window.innerWidth-50+"px"),this._avmHandler&&this._avmHandler.resizeStage()},Fid.prototype.resizeCallback=function(t){this.resizeStageInternal()},Fid.prototype.pause=function(){AudioManager.setVolume(0),this._isPaused=!0},Fid.prototype.unPause=function(){AudioManager.setVolume(1),this._isPaused=!1},Object.defineProperty(Fid.prototype,"isPaused",{get:function(){return this._isPaused},set:function(t){this._isPaused=t},enumerable:!0,configurable:!0}),Fid.prototype.main_loop=function(t){if(!this._isPaused){if(!this._avmHandler)throw"error - can not render when no avm-stage is available";var e;this._scene&&this._scene.renderer?(e=Math.floor(1e3/this._frameRate),this._time+=Math.min(t,e),this._time>=e&&(this._currentFps++,this.showNextFrame(this._time),this._time-=e)):this._timer.stop()}},Fid.prototype.requestRender=function(){this._scene&&this._scene.renderer?(FrameScriptManager.execute_queue(),this._scene.render(!0)):this._timer.stop()},Fid.prototype.showNextFrame=function(t){if(this._isPaused)return MovieClipSoundsManager.enterFrame(),void MovieClipSoundsManager.exitFrame();MovieClipSoundsManager.enterFrame(),this.avmTestHandler&&this.avmTestHandler.dispatchEvents(),this._scene.fireMouseEvents(),this._avmHandler.enterFrame(t),this.avmTestHandler&&this.avmTestHandler.nextFrame(),this._scene&&this._scene.renderer?(this._scene.render(!0),MovieClipSoundsManager.exitFrame()):this._timer.stop()},Object.defineProperty(Fid.prototype,"align",{get:function(){return this._align},set:function(t){this._alignAllowUpdate&&(this._align=t,this.resizeCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"accessibilityImplementation",{get:function(){return console.log("AVMStage: get accessibilityImplementation not implemented"),this._align},set:function(t){console.log("AVMStage: accessibilityImplementation not implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"color",{get:function(){return this._scene.renderer.view.backgroundColor},set:function(t){this._scene.renderer.view.backgroundColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"frameRate",{get:function(){return this._frameRate},set:function(t){this._frameRate=t},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"mouseX",{get:function(){return this._scene.getLocalMouseX(this)},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"mouseY",{get:function(){return this._scene.getLocalMouseY(this)},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleModeAllowUpdate&&(this._scaleMode=t,this.resizeCallback())},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"showFrameRate",{get:function(){return this._showFrameRate},set:function(t){var e=this;t!=this._showFrameRate&&((this._showFrameRate=t)?(this._fpsTextField=document.createElement("div"),this._fpsTextField.style.cssFloat="none",this._fpsTextField.style.backgroundColor="#000",this._fpsTextField.style.position="fixed",this._fpsTextField.style.top="5px",this._fpsTextField.style.width="100px",this._fpsTextField.style.height="20px",this._fpsTextField.style.right="5px",this._fpsTextField.style.textAlign="center",this._fpsTextField.style.color="#ffffff",this._fpsTextField.style.fontSize="16",this._fpsTextField.style.visibility="hidden",this._fpsTextField.innerHTML="",document.body.appendChild(this._fpsTextField),this._showFrameRateIntervalID=setInterval(function(){return e.updateFPS()},1e3)):this._showFrameRateIntervalID&&(clearInterval(this._showFrameRateIntervalID),this._showFrameRateIntervalID=-1,document.body.removeChild(this._fpsTextField),this._fpsTextField=null))},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"stageHeight",{get:function(){return this._stageHeight},set:function(t){this._stageHeight=t,this.resizeCallback()},enumerable:!0,configurable:!0}),Object.defineProperty(Fid.prototype,"stageWidth",{get:function(){return this._stageWidth},set:function(t){this._stageWidth=t,this.resizeCallback()},enumerable:!0,configurable:!0}),Fid.runtimeStartTime=0,Fid._instance=null,Fid.forceINT=!1,Fid),globalRedirectRules=[],instance,Eid;function Fid(t){var e=Eid.call(this)||this;if(e._gameConfig=null,e._curFile=null,Fid._instance)throw"Only one AVMStage is allowed to be constructed";return Fid._instance=e,Loader.enableParsers([WaveAudioParser,SWFParser,Image2DParser]),e._time=0,e._currentFps=0,e._avmHandlers={},e._stageWidth=550,e._stageHeight=400,e._scaleMode=StageScaleMode.SHOW_ALL,e._align=StageAlign.TOP_LEFT,e._scaleModeAllowUpdate=!0,e._alignAllowUpdate=!0,t.stageScaleMode&&(e._scaleMode=t.stageScaleMode,e._scaleModeAllowUpdate=!1),t.stageAlign&&(e._align=t.stageAlign,e._alignAllowUpdate=!1),t.forceINT&&(Fid.forceINT=t.forceINT),e._frameRate=30,e._showFrameRate=!1,e._showFrameRateIntervalID=-1,e._x=t.x?t.x:0,e._y=t.y?t.y:0,e._w=t.w?t.w:"100%",e._h=t.h?t.h:"100%",e._isPaused=!1,e._gameConfig=t,e.initAwayEninge(),e._scene.renderer.view.backgroundColor=16777215,AudioManager.setVolume(1),e._resizeCallbackDelegate=function(t){return e.resizeCallback(t)},window.addEventListener("resize",e._resizeCallbackDelegate),e._onLoaderStartDelegate=function(t){return e.onLoaderStart(t)},e._onLoaderCompleteDelegate=function(t){return e.onLoaderComplete(t)},e._onAssetCompleteDelegate=function(t){return e._onAssetComplete(t)},e._onLoadErrorDelegate=function(t){return e._onLoadError(t)},e._gameConfig.testConfig&&(e.avmTestHandler=new AVMTestHandler(e._gameConfig.testConfig,e)),e}function Yhd(t,e){var i=this;this.frameIdx=0,this.snapshotCnt=0,this.snapShotsUploaded=0,this.config=t,this._avmStage=e,this.frameIdx=0,this.events={},this.reportedSWFInfos=!1,this.frames=[{messages:[],frameIdx:this.frameIdx}],this._finished=!1,this.snapshotCnt=0,this.config.recordtest&&(MouseManager.inputRecorder=this),window.addEventListener("keydown",function(t){t.ctrlKey&&69==t.keyCode&&i.finishTest()})}function matchRedirect(l,t){var c=void 0;return(t?globalRedirectRules.concat(t):globalRedirectRules).forEach(function(t){var e=t.test,i=t.resolve,n=t.supressErrors,r=void 0!==n&&n,o=t.supressLoad,s=void 0!==o&&o,a=!1;"function"==typeof e?a=e(l):e instanceof RegExp?a=e.test(l):"string"==typeof e&&(a=e===l),a&&(c&&console.warn("[LOADER] Duplicate redirect rules, latest rule would be used!"),c={url:l,supressErrors:r,supressLoad:s},"function"==typeof i?c.url=i(l):i instanceof RegExp?c.url=l.match(i)[0]:"string"==typeof i?c.url=i:"string"==typeof a&&(c.url=a),void 0===c.url&&(console.warn("[LOADER] Redirect url is null, would be used original url!"),c.url=l))}),c}var Telemetry={instance:instance};function boxValue(t){return isNullOrUndefined$1(t)||isObject(t)?t:Object(t)}function toKeyValueArray(t){var e=Object.prototype.hasOwnProperty,i=[];for(var n in t)e.call(t,n)&&i.push([n,t[n]]);return i}function isPrototypeWriteable(t){return Object.getOwnPropertyDescriptor(t,"prototype").writable}function hasOwnProperty(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function propertyIsEnumerable(t,e){return Object.prototype.propertyIsEnumerable.call(t,e)}function getPropertyDescriptor(t,e){do{var i=Object.getOwnPropertyDescriptor(t,e);if(i)return i;t=Object.getPrototypeOf(t)}while(t);return null}function hasOwnGetter(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!(!i||!i.get)}function getOwnGetter(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return i?i.get:null}function hasOwnSetter(t,e){var i=Object.getOwnPropertyDescriptor(t,e);return!(!i||!i.set)}function createMap(){return Object.create(null)}function createArrayMap(){return[]}function defineReadOnlyProperty(t,e,i){Object.defineProperty(t,e,{value:i,writable:!1,configurable:!0,enumerable:!1})}function copyProperties(t,e){for(var i in e)t[i]=e[i]}function copyOwnProperties(t,e){for(var i in e)hasOwnProperty(e,i)&&(t[i]=e[i])}function copyOwnPropertyDescriptors(t,e,i,n,r){for(var o in void 0===i&&(i=null),void 0===n&&(n=!0),void 0===r&&(r=!1),e)if(hasOwnProperty(e,o)&&(!i||i(o))){var s=Object.getOwnPropertyDescriptor(e,o);if(!n&&hasOwnProperty(t,o))continue;try{r&&!1===s.writable&&(s.writable=!0),Object.defineProperty(t,o,s)}catch(t){assert$2("Can't define: "+o)}}}function copyPropertiesByList(t,e,i){for(var n=0;n<i.length;n++){var r=i[n];t[r]=e[r]}}function defineNonEnumerableGetter(t,e,i){Object.defineProperty(t,e,{get:i,configurable:!0,enumerable:!1})}function defineNonEnumerableProperty(t,e,i){Object.defineProperty(t,e,{value:i,writable:!0,configurable:!0,enumerable:!1})}var ObjectUtilities={boxValue:boxValue,toKeyValueArray:toKeyValueArray,isPrototypeWriteable:isPrototypeWriteable,hasOwnProperty:hasOwnProperty,propertyIsEnumerable:propertyIsEnumerable,getPropertyDescriptor:getPropertyDescriptor,hasOwnGetter:hasOwnGetter,getOwnGetter:getOwnGetter,hasOwnSetter:hasOwnSetter,createArrayMap:createArrayMap,createMap:createMap,defineReadOnlyProperty:defineReadOnlyProperty,copyProperties:copyProperties,copyOwnProperties:copyOwnProperties,copyOwnPropertyDescriptors:copyOwnPropertyDescriptors,copyPropertiesByList:copyPropertiesByList,defineNonEnumerableGetter:defineNonEnumerableGetter,defineNonEnumerableProperty:defineNonEnumerableProperty};function popManyInto(t,e,i){for(var n=e-1;0<=n;n--)i[n]=t.pop();i.length=e}function pushMany(t,e){for(var i=0;i<e.length;i++)t.push(e[i])}var ClipboardService={setClipboard:function(t){}},FlashLog=(Object.defineProperty(ald.prototype,"currentTimestamp",{get:function(){return Date.now()-this._startTime},enumerable:!0,configurable:!0}),ald.prototype._writeLine=function(t){},ald.prototype.writeAS3Trace=function(t){this.isAS3TraceOn&&this._writeLine(this.currentTimestamp+" AVMINF: "+t)},ald),_md5R=new Uint8Array([7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21]),_md5K=new Int32Array([-680876936,-389564586,606105819,-1044525330,-176418897,1200080426,-1473231341,-45705983,1770035416,-1958414417,-42063,-1990404162,1804603682,-40341101,-1502002290,1236535329,-165796510,-1069501632,643717713,-373897302,-701558691,38016083,-660478335,-405537848,568446438,-1019803690,-187363961,1163531501,-1444681467,-51403784,1735328473,-1926607734,-378558,-2022574463,1839030562,-35309556,-1530992060,1272893353,-155497632,-1094730640,681279174,-358537222,-722521979,76029189,-640364487,-421815835,530742520,-995338651,-198630844,1126891415,-1416354905,-57434055,1700485571,-1894986606,-1051523,-2054922799,1873313359,-30611744,-1560198380,1309151649,-145523070,-1120210379,718787259,-343485551]);function ald(){this.isAS3TraceOn=!0,this._startTime=Date.now()}function hashBytesTo32BitsMD5(t,e,i){for(var n,r=_md5R,o=_md5K,s=1732584193,a=-271733879,l=-1732584194,c=271733878,h=i+72&-64,u=new Uint8Array(h),p=0;p<i;++p)u[p]=t[e++];for(u[p++]=128,n=h-8;p<n;)u[p++]=0;u[p++]=i<<3&255,u[p++]=i>>5&255,u[p++]=i>>13&255,u[p++]=i>>21&255,u[p++]=i>>>29&255,u[p++]=0,u[p++]=0,u[p++]=0;var d=new Int32Array(16);for(p=0;p<h;){for(v=0;v<16;++v,p+=4)d[v]=u[p]|u[p+1]<<8|u[p+2]<<16|u[p+3]<<24;for(var _,f,m=s,g=a,y=l,b=c,v=0;v<64;++v){f=v<16?(_=g&y|~g&b,v):v<32?(_=b&g|~b&y,5*v+1&15):v<48?(_=g^y^b,3*v+5&15):(_=y^(g|~b),7*v&15);var x=b,A=m+_+o[v]+d[f]|0,S=r[v],b=y,y=g,g=g+(A<<S|A>>>32-S)|0,m=x}s=s+m|0,a=a+g|0,l=l+y|0,c=c+b|0}return s}function mixHash(t,e){return(31*t|0)+e|0}var HashUtilities={_md5R:_md5R,_md5K:_md5K,hashBytesTo32BitsMD5:hashBytesTo32BitsMD5,mixHash:mixHash},ExternalInterfaceService={enabled:!0,callback:null,initJS:function(t){this.callback=t},registerCallback:function(e){var i=this;window.flash||(window.flash={}),window.flash[e]=function(t){i.callback(e,t)}},unregisterCallback:function(t){window.flash||(window.flash={}),delete window.flash[t]},eval:function(t){return window.eval(t)},call:function(t){},getId:function(){return null}},FileLoadingService;console.debug("AwayFL - SWF-Loader - 0.4.40");var AVM1PropertyDescriptor=function(t,e,i,n,r){this.flags=t,this.value=e,this.get=i,this.set=n,this.watcher=r},NullPrototypeObject=function(){},DEBUG_PROPERTY_PREFIX="$Bg",AVM1Object=(Pld=NullPrototypeObject,__extends(Qld,Pld),Object.defineProperty(Qld.prototype,"eventObserver",{get:function(){return this._eventObserver},set:function(t){this._eventObserver=t},enumerable:!0,configurable:!0}),Qld.prototype.dispose=function(){},Qld.prototype.updateFilters=function(t){for(var e=0;e<t.length;e++)t[e]},Qld.prototype.isBlockedByScript=function(){return this._blockedByScript},Qld.prototype.isColorTransformByScript=function(){return this._ctBlockedByScript},Qld.prototype.isVisibilityByScript=function(){return this._visibilityByScript},Qld.prototype.initAdapter=function(){},Qld.prototype.freeFromScript=function(){this.protoTypeChanged=!1,this._blockedByScript=!1,this._ctBlockedByScript=!1,this._visibilityByScript=!1},Qld.prototype.clone=function(){return new Qld(this._avm1Context)},Object.defineProperty(Qld.prototype,"context",{get:function(){return this._avm1Context},enumerable:!0,configurable:!0}),Object.defineProperty(Qld.prototype,"alPrototype",{get:function(){return this._prototype},set:function(t){for(var e=t;e;){if(e===this)return;e=e.alPrototype}this._prototype=t},enumerable:!0,configurable:!0}),Qld.prototype.alGetPrototypeProperty=function(){return this.alGet("prototype")},Qld.prototype.alSetOwnPrototypeProperty=function(t){this.alSetOwnProperty("prototype",new AVM1PropertyDescriptor(65,t))},Qld.prototype.alGetConstructorProperty=function(){return this.alGet("__constructor__")},Qld.prototype.alSetOwnConstructorProperty=function(t){this.alSetOwnProperty("__constructor__",new AVM1PropertyDescriptor(65,t))},Qld.prototype._debugEscapeProperty=function(t){var e=this.context,i=alToString(e,t);return e.isPropertyCaseSensitive||(i=i.toLowerCase()),DEBUG_PROPERTY_PREFIX+i},Qld.prototype.alGetOwnProperty=function(t){return"string"!=typeof t||this.context.isPropertyCaseSensitive||(t=t.toLowerCase()),this._ownProperties[t]},Qld.prototype.alSetOwnProperty=function(t,e){var i=this.context.normalizeName(t);e.originalName||this.context.isPropertyCaseSensitive||(e.originalName=t),this._ownProperties[i]=e},Qld.prototype.alHasOwnProperty=function(t){var e=this.context.normalizeName(t);return!!this._ownProperties[e]},Qld.prototype.alDeleteOwnProperty=function(t){var e=this.context.normalizeName(t);delete this._ownProperties[e]},Qld.prototype.deleteOwnProperties=function(){for(var t=this.alGetOwnPropertiesKeys(),e=0;e<t.length;e++)this.alDeleteOwnProperty(t[e])},Qld.prototype.alGetOwnPropertiesKeys=function(){var t,e=[];if(this.context.isPropertyCaseSensitive)for(var i in this._ownProperties)1&(t=this._ownProperties[i]).flags||e.push(i);else for(var i in this._ownProperties)1&(t=this._ownProperties[i]).flags||e.push(t.originalName);return e},Qld.prototype.alGetProperty=function(t){return this.alGetOwnProperty(t)||(this._prototype?this._prototype.alGetProperty(t):void 0)},Qld.prototype.alGet=function(t){var e=this.context.normalizeName(t),i=this.alGetProperty(e);if(i){if(64&i.flags)return i.value&&i.value.nodeValue?i.value.nodeValue:i.value;var n=i.get;if(n)return n.alCall(this)}},Qld.prototype.alCanPut=function(t){var e=this.alGetOwnProperty(t);if(e)return 128&e.flags?!!e.set:!(4&e.flags);var i=this._prototype;return!i||i.alCanPut(t)},Qld.prototype.alPut=function(t,e){var i=t;if(t=this.context.normalizeName(t),e&&"object"==typeof e&&"symbol"===e.avmType&&"this"!=t&&"_parent"!=t&&!e.dynamicallyCreated&&e.adaptee&&e.adaptee.parent&&e.adaptee.parent.adapter&&e.adaptee.parent.adapter.scriptRefsToChilds&&(e.adaptee.parent.adapter.scriptRefsToChilds[e.adaptee.name]={obj:this,name:t}),this.alCanPut(t)){var n,r,o,s=this.alGetOwnProperty(t);if(s&&64&s.flags)return s.watcher&&(e=s.watcher.callback.alCall(this,[s.watcher.name,s.value,e,s.watcher.userData])),void(t in this._ownProperties?s.value=e:this.alSetOwnProperty(i,new AVM1PropertyDescriptor(s.flags,e)));(void 0!==e||"_x"!=t&&"_y"!=t&&"_xscale"!=t&&"_yscale"!=t&&"_width"!=t&&"_height"!=t)&&((n=this.alGetProperty(t))&&128&n.flags?(n.watcher&&(r=n.get?n.get.alCall(this):void 0,e=n.watcher.callback.alCall(this,[n.watcher.name,r,e,n.watcher.userData])),n.set.alCall(this,[e])):(n&&n.watcher&&(e=n.watcher.callback.alCall(this,[n.watcher.name,n.value,e,n.watcher.userData])),e&&e.isTextVar?(e=e.value,(o=new AVM1PropertyDescriptor(n?n.flags:64,e)).isTextVar=!0):o=new AVM1PropertyDescriptor(n?n.flags:64,e),this.alSetOwnProperty(i,o)))}},Qld.prototype.alHasProperty=function(t){return!!this.alGetProperty(t)},Qld.prototype.alDeleteProperty=function(t){var e=this.alGetOwnProperty(t);return!e||!(2&e.flags)&&(this.alDeleteOwnProperty(t),!0)},Qld.prototype.alAddPropertyWatcher=function(t,e,i){var n=this.alGetProperty(t);return!!n&&(n.watcher={name:t,callback:e,userData:i},!0)},Qld.prototype.alRemotePropertyWatcher=function(t){var e=this.alGetProperty(t);return!(!e||!e.watcher||(e.watcher=void 0))},Qld.prototype.alDefaultValue=function(t){if(void 0===t&&(t=0),1===t){if(alIsFunction(i=this.alGet(this.context.normalizeName("toString"))))return i.alCall(this);if(alIsFunction(e=this.alGet(this.context.normalizeName("valueOf"))))return e.alCall(this)}else{var e,i;if(alIsFunction(e=this.alGet(this.context.normalizeName("valueOf"))))return e.alCall(this);if(alIsFunction(i=this.alGet(this.context.normalizeName("toString"))))return i.alCall(this)}return this},Qld.prototype.alGetKeys=function(){var t=this.alGetOwnPropertiesKeys(),e=this._prototype;if(!e)return t;var i=e.alGetKeys();if(0===t.length)return i;var n=this.context;if(n.isPropertyCaseSensitive){for(var r=Object.create(null),o=t.length,s=0;s<o;s++)r[t[s]]=!0;for(o=i.length,s=0;s<o;s++)r[i[s]]=!0;return Object.getOwnPropertyNames(r)}var a,l,c,h=[t,i],u=Object.create(null),p=[];for(s=0;s<h.length;s++)for(var d=(a=h[s]).length;d--;)l=a[d],u[c=n.normalizeName(l)]||(u[c]=!0,p.push(l));return p},Qld),AVM1Function=(ind=AVM1Object,__extends(jnd,ind),jnd.prototype.alConstruct=function(t){throw new Error("not implemented AVM1Function.alConstruct")},jnd.prototype.alCall=function(t,e){throw new Error("not implemented AVM1Function.alCall")},jnd.prototype.toJSFunction=function(e){void 0===e&&(e=null);var i=this,n=this.context;return function(){var t=Array.prototype.slice.call(arguments,0);return n.executeFunction(i,e,t)}},jnd),ind,Pld;function jnd(t){var e=ind.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),e.isOnEnter=!1,e}function Qld(t){var e=Pld.call(this)||this;e.initialDepth=0,e.scriptRefsToChilds={},e._avm1Context=t,e._ownProperties=Object.create(null),e.scriptRefsToChilds={},e._prototype=null,e._blockedByScript=!1,e._ctBlockedByScript=!1,e._visibilityByScript=!1;var i=e,n=new AVM1PropertyDescriptor(131,null,{alCall:function(t,e){return i.alPrototype}},{alCall:function(t,e){i.alPrototype=e[0]}});return e.alSetOwnProperty("__proto__",n),e}function toAS3Point(t){if(!t)return new Point(0,0);var e,i,n=t.context;return t instanceof AVM1Object&&(e=alCoerceNumber(n,t.alGet("x")),i=alCoerceNumber(n,t.alGet("y"))),new Point(e,i)}function copyAS3PointTo(t,e){e.alPut("x",t.x),e.alPut("y",t.y)}var AVM1Point=(znd=AVM1Object,__extends(And,znd),And.fromAS3Point=function(t,e){return new And(t,e.x,e.y)},And),AVM1PointFunction=(Hnd=AVM1Function,__extends(Ind,Hnd),Ind.prototype.alConstruct=function(t){return t&&0<t.length?new AVM1Point(this.context,t[0],t[1]):new AVM1Point(this.context,0,0)},Ind.prototype.distance=function(t,e){return Point.distance(toAS3Point(t),toAS3Point(e))},Ind.prototype.interpolate=function(t,e,i){i=alToNumber(this.context,i);var n=Point.interpolate(toAS3Point(t),toAS3Point(e),i);return AVM1Point.fromAS3Point(this.context,n)},Ind.prototype.polar=function(t,e){return t=alToNumber(this.context,t),e=alToNumber(this.context,e),AVM1Point.fromAS3Point(this.context,Point.polar(t,e))},Ind),AVM1PointPrototype=(Und=AVM1Object,__extends(Vnd,Und),Vnd.prototype.getLength=function(){return toAS3Point(this).length},Vnd.prototype.add=function(t){return AVM1Point.fromAS3Point(this.context,toAS3Point(this).add(toAS3Point(t)))},Vnd.prototype.clone=function(){var t=new AVM1Point(this.context);return this instanceof AVM1Object&&(t.alPut("x",this.alGet("x")),t.alPut("y",this.alGet("y"))),t},Vnd.prototype.equals=function(t){return toAS3Point(this).equals(toAS3Point(t))},Vnd.prototype.normalize=function(t){t=alToNumber(this.context,t);var e=toAS3Point(this);e.normalize(t),copyAS3PointTo(e,this)},Vnd.prototype.offset=function(t,e){t=alToNumber(this.context,t),e=alToNumber(this.context,e);var i=toAS3Point(this);i.offset(t,e),copyAS3PointTo(i,this)},Vnd.prototype.subtract=function(t){return AVM1Point.fromAS3Point(this.context,toAS3Point(this).subtract(toAS3Point(t)))},Vnd.prototype._toString=function(){return"(x="+this.alGet("x")+", y="+this.alGet("y")+")"},Vnd),Und,Hnd,znd;function Vnd(t,e){var i=Und.call(this,t)||this;return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(i,{constructor:{value:e,writable:!0},length:{get:i.getLength},add:{value:i.add,writable:!0},clone:{value:i.clone,writable:!0},equals:{value:i.equals,writable:!0},normalize:{value:i.normalize,writable:!0},offset:{value:i.offset,writable:!0},subtract:{value:i.subtract,writable:!0},toString:{value:i._toString,writable:!0}}),i}function Ind(t){var e=Hnd.call(this,t)||this;return alDefineObjectProperties(e,{prototype:{value:new AVM1PointPrototype(t,e)},distance:{value:e.distance,writable:!0},interpolate:{value:e.interpolate,writable:!0},polar:{value:e.polar,writable:!0}}),e}function And(t,e,i){var n=znd.call(this,t)||this;return n.alPrototype=t.globals.Point.alGetPrototypeProperty(),n.alPut("x",e),n.alPut("y",i),n}function toAS3Rectangle(t){var e,i,n,r,o=t.context;return t instanceof AVM1Object&&(e=alCoerceNumber(o,t.alGet("x")),i=alCoerceNumber(o,t.alGet("y")),n=alCoerceNumber(o,t.alGet("width")),r=alCoerceNumber(o,t.alGet("height"))),new Rectangle(e,i,n,r)}function copyAS3RectangleTo(t,e){e.alPut("x",t.x),e.alPut("y",t.y),e.alPut("width",t.width),e.alPut("height",t.height)}var AVM1Rectangle=(ood=AVM1Object,__extends(pod,ood),pod.fromAS3Rectangle=function(t,e){return new pod(t,e.x,e.y,e.width,e.height)},pod),AVM1RectangleFunction=(yod=AVM1Function,__extends(zod,yod),zod.prototype.alConstruct=function(t){return t&&0<t.length?new AVM1Rectangle(this.context,t[0],t[1],t[2],t[3]):new AVM1Rectangle(this.context,0,0,0,0)},zod),AVM1RectanglePrototype=(Dod=AVM1Object,__extends(Eod,Dod),Eod.prototype.getBottom=function(){return alToNumber(this.context,this.alGet("y"))+alToNumber(this.context,this.alGet("height"))},Eod.prototype.setBottom=function(t){this.alPut("height",alToNumber(this.context,t)-alToNumber(this.context,this.alGet("y")))},Eod.prototype.getBottomRight=function(){return new AVM1Point(this.context,Eod.prototype.getRight.call(this),Eod.prototype.getBottom.call(this))},Eod.prototype.setBottomRight=function(t){Eod.prototype.setRight.call(this,t.alGet("x")),Eod.prototype.setBottom.call(this,t.alGet("y"))},Eod.prototype.getLeft=function(){return alToNumber(this.context,this.alGet("x"))},Eod.prototype.setLeft=function(t){this.alPut("x",alToNumber(this.context,t))},Eod.prototype.getSize=function(){return new AVM1Point(this.context,this.alGet("width"),this.alGet("height"))},Eod.prototype.setSize=function(t){this.alPut("width",t.alGet("x")),this.alPut("height",t.alGet("y"))},Eod.prototype.getRight=function(){return alToNumber(this.context,this.alGet("x"))+alToNumber(this.context,this.alGet("width"))},Eod.prototype.setRight=function(t){this.alPut("width",alToNumber(this.context,t)-alToNumber(this.context,this.alGet("x")))},Eod.prototype.getTop=function(){return alToNumber(this.context,this.alGet("y"))},Eod.prototype.setTop=function(t){this.alPut("y",alToNumber(this.context,t))},Eod.prototype.getTopLeft=function(){return new AVM1Point(this.context,Eod.prototype.getLeft.call(this),Eod.prototype.getTop.call(this))},Eod.prototype.setTopLeft=function(t){Eod.prototype.setLeft.call(this,t.alGet("x")),Eod.prototype.setTop.call(this,t.alGet("y"))},Eod.prototype.clone=function(){var t=new AVM1Rectangle(this.context);return this instanceof AVM1Object&&(t.alPut("x",this.alGet("x")),t.alPut("y",this.alGet("y")),t.alPut("width",this.alGet("width")),t.alPut("height",this.alGet("height"))),t},Eod.prototype.contains=function(t,e){return t=alToNumber(this.context,t),e=alToNumber(this.context,e),toAS3Rectangle(this).contains(t,e)},Eod.prototype.containsPoint=function(t){var e=toAS3Rectangle(this),i=toAS3Point(t);return e.containsPoint(i)},Eod.prototype.containsRectangle=function(t){var e=toAS3Rectangle(this),i=toAS3Rectangle(t);return e.containsRect(i)},Eod.prototype.equals=function(t){var e=toAS3Rectangle(this),i=toAS3Rectangle(t);return e.equals(i)},Eod.prototype.inflate=function(t,e){t=alToNumber(this.context,t),e=alToNumber(this.context,e);var i=toAS3Rectangle(this);i.inflate(t,e),copyAS3RectangleTo(i,this)},Eod.prototype.inflatePoint=function(t){var e=toAS3Rectangle(this),i=toAS3Point(t);e.inflatePoint(i),copyAS3RectangleTo(e,this)},Eod.prototype.intersection=function(t){var e=toAS3Rectangle(this),i=toAS3Rectangle(t);return AVM1Rectangle.fromAS3Rectangle(this.context,e.intersection(i))},Eod.prototype.intersects=function(t){var e=toAS3Rectangle(this),i=toAS3Rectangle(t);return e.intersects(i)},Eod.prototype.isEmpty=function(){return toAS3Rectangle(this).isEmpty()},Eod.prototype.offset=function(t,e){t=alToNumber(this.context,t),e=alToNumber(this.context,e);var i=toAS3Rectangle(this);i.offset(t,e),copyAS3RectangleTo(i,this)},Eod.prototype.offsetPoint=function(t){var e=toAS3Rectangle(this),i=toAS3Point(t);e.offsetPoint(i),copyAS3RectangleTo(e,this)},Eod.prototype.setEmpty=function(){this.alPut("x",0),this.alPut("y",0),this.alPut("width",0),this.alPut("height",0)},Eod.prototype._toString=function(){return"(x="+this.alGet("x")+", y="+this.alGet("y")+", w="+this.alGet("width")+", h="+this.alGet("height")+")"},Eod.prototype.union=function(t){var e=toAS3Rectangle(this),i=toAS3Rectangle(t);return AVM1Rectangle.fromAS3Rectangle(this.context,e.union(i))},Eod),Dod,yod,ood;function Eod(t,e){var i=Dod.call(this,t)||this;return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(i,{constructor:{value:e,writable:!0},bottom:{get:i.getBottom,set:i.setBottom},bottomRight:{get:i.getBottomRight,set:i.setBottomRight},left:{get:i.getLeft,set:i.setLeft},right:{get:i.getRight,set:i.setRight},size:{get:i.getSize,set:i.setSize},top:{get:i.getTop,set:i.setTop},topLeft:{get:i.getTopLeft,set:i.setTopLeft},clone:{value:i.clone,writable:!0},contains:{value:i.contains,writable:!0},containsPoint:{value:i.containsPoint,writable:!0},containsRectangle:{value:i.containsRectangle,writable:!0},equals:{value:i.equals,writable:!0},inflate:{value:i.inflate,writable:!0},inflatePoint:{value:i.inflatePoint,writable:!0},intersection:{value:i.intersection,writable:!0},intersects:{value:i.intersects,writable:!0},isEmpty:{value:i.isEmpty,writable:!0},offset:{value:i.offset,writable:!0},offsetPoint:{value:i.offsetPoint,writable:!0},setEmpty:{value:i.setEmpty,writable:!0},toString:{value:i._toString,writable:!0},union:{value:i.union,writable:!0}}),i}function zod(t){var e=yod.call(this,t)||this;return alDefineObjectProperties(e,{prototype:{value:new AVM1RectanglePrototype(t,e)}}),e}function pod(t,e,i,n,r){var o=ood.call(this,t)||this;return o.alPrototype=t.globals.Rectangle.alGetPrototypeProperty(),o.alPut("x",e),o.alPut("y",i),o.alPut("width",n),o.alPut("height",r),o}function defaultTo(t,e){return void 0===t?e:t}function fromAVM1Object(t){var e=t.context;if(!(t instanceof AVM1Object))return new AVM1ColorTransform(e,1,1,1,1,0,0,0,0);var i=t.alGet("alphaOffset");null==i&&(i=t.alGet("ab"));var n=t.alGet("alphaMultiplier");null==n&&null!=(n=t.alGet("aa"))&&(n/=100);var r=t.alGet("redOffset");null==r&&(r=t.alGet("rb"));var o=t.alGet("redMultiplier");null==o&&null!=(o=t.alGet("ra"))&&(o/=100);var s=t.alGet("greenOffset");null==s&&(s=t.alGet("gb"));var a=t.alGet("greenMultiplier");null==a&&null!=(a=t.alGet("ga"))&&(a/=100);var l=t.alGet("blueOffset");null==l&&(l=t.alGet("bb"));var c=t.alGet("blueMultiplier");return null==c&&null!=(c=t.alGet("ba"))&&(c/=100),new AVM1ColorTransform(e,alCoerceNumber(e,defaultTo(o,1)),alCoerceNumber(e,defaultTo(a,1)),alCoerceNumber(e,defaultTo(c,1)),alCoerceNumber(e,defaultTo(n,1)),alCoerceNumber(e,defaultTo(r,0)),alCoerceNumber(e,defaultTo(s,0)),alCoerceNumber(e,defaultTo(l,0)),alCoerceNumber(e,defaultTo(i,0)))}function toAwayColorTransform(t){var e=t.context;return t instanceof AVM1ColorTransform?new ColorTransform(alCoerceNumber(e,defaultTo(t._rawData[0],1)),alCoerceNumber(e,defaultTo(t._rawData[1],1)),alCoerceNumber(e,defaultTo(t._rawData[2],1)),alCoerceNumber(e,defaultTo(t._rawData[3],1)),alCoerceNumber(e,defaultTo(t._rawData[4],0)),alCoerceNumber(e,defaultTo(t._rawData[5],0)),alCoerceNumber(e,defaultTo(t._rawData[6],0)),alCoerceNumber(e,defaultTo(t._rawData[7],0))):new ColorTransform(1,1,1,1,0,0,0,0)}var AVM1ColorTransform=(Ipd=AVM1Object,__extends(Jpd,Ipd),Jpd.prototype.getRedMultiplier=function(){return this._rawData[0]},Jpd.prototype.setRedMultiplier=function(t){this._rawData[0]=t},Jpd.prototype.getGreenMultiplier=function(){return this._rawData[1]},Jpd.prototype.setGreenMultiplier=function(t){this._rawData[1]=t},Jpd.prototype.getBlueMultiplier=function(){return this._rawData[2]},Jpd.prototype.setBlueMultiplier=function(t){this._rawData[2]=t},Jpd.prototype.getAlphaMultiplier=function(){return this._rawData[3]},Jpd.prototype.setAlphaMultiplier=function(t){this._rawData[3]=t},Jpd.prototype.getRedOffset=function(){return this._rawData[4]},Jpd.prototype.setRedOffset=function(t){this._rawData[4]=t},Jpd.prototype.getGreenOffset=function(){return this._rawData[5]},Jpd.prototype.setGreenOffset=function(t){this._rawData[5]=t},Jpd.prototype.getBlueOffset=function(){return this._rawData[6]},Jpd.prototype.setBlueOffset=function(t){this._rawData[6]=t},Jpd.prototype.getAlphaOffset=function(){return this._rawData[7]},Jpd.prototype.setAlphaOffset=function(t){this._rawData[7]=t},Jpd.prototype.getRM=function(){return 100*this._rawData[0]},Jpd.prototype.setRM=function(t){this._rawData[0]=t/100},Jpd.prototype.getGM=function(){return 100*this._rawData[1]},Jpd.prototype.setGM=function(t){this._rawData[1]=t/100},Jpd.prototype.getBM=function(){return 100*this._rawData[2]},Jpd.prototype.setBM=function(t){this._rawData[2]=t/100},Jpd.prototype.getAM=function(){return 100*this._rawData[3]},Jpd.prototype.setAM=function(t){this._rawData[3]=t/100},Jpd.prototype.getRO=function(){return this._rawData[4]},Jpd.prototype.setRO=function(t){this._rawData[4]=t},Jpd.prototype.getGO=function(){return this._rawData[5]},Jpd.prototype.setGO=function(t){this._rawData[5]=t},Jpd.prototype.getBO=function(){return this._rawData[6]},Jpd.prototype.setBO=function(t){this._rawData[6]=t},Jpd.prototype.getAO=function(){return this._rawData[7]},Jpd.prototype.setAO=function(t){this._rawData[7]=t},Jpd.prototype.getRgb=function(){return this._rawData[4]<<16|this._rawData[5]<<8|this._rawData[6]},Jpd.prototype.setRgb=function(t){var e=ColorUtils.float32ColorToARGB(t);this._rawData[4]=e[1],this._rawData[5]=e[2],this._rawData[6]=e[3],this._rawData[0]=0,this._rawData[1]=0,this._rawData[2]=0},Jpd.prototype.concat=function(t){console.warn("AVM1ColorTransform concat is not implemented")},Jpd.prototype._toString=function(){return"[object Object]"},Jpd.fromAwayColorTransform=function(t,e){return new Jpd(t,e.redMultiplier,e.greenMultiplier,e.blueMultiplier,e.alphaMultiplier,e.redOffset,e.greenOffset,e.blueOffset,e.alphaOffset)},Jpd),AVM1ColorTransformFunction=(nqd=AVM1Function,__extends(oqd,nqd),oqd.prototype.alConstruct=function(t){var e=Object.create(AVM1ColorTransform.prototype);return t=t||[],AVM1ColorTransform.apply(e,[this.context].concat(t)),e},oqd),AVM1ColorTransformPrototype=(tqd=AVM1Object,__extends(uqd,tqd),uqd),tqd,nqd,Ipd;function uqd(t,e){var i=tqd.call(this,t)||this;return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(i,{constructor:{value:e,writable:!0}}),i}function oqd(t){var e=nqd.call(this,t)||this;return alDefineObjectProperties(e,{prototype:{value:new AVM1ColorTransformPrototype(t,e)}}),e}function Jpd(t,e,i,n,r,o,s,a,l){void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=1),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),void 0===l&&(l=0);var c=Ipd.call(this,t)||this;return c._rawData=[e,i,n,r,o,s,a,l],c.alPrototype=t.globals.ColorTransform.alGetPrototypeProperty(),alDefineObjectProperties(c,{rgb:{get:c.getRgb,set:c.setRgb},ra:{get:c.getRM,set:c.setRM},ga:{get:c.getGM,set:c.setGM},ba:{get:c.getBM,set:c.setBM},aa:{get:c.getAM,set:c.setAM},rb:{get:c.getRO,set:c.setRO},gb:{get:c.getGO,set:c.setGO},bb:{get:c.getBO,set:c.setBO},ab:{get:c.getAO,set:c.setAO},redMultiplier:{get:c.getRedMultiplier,set:c.setRedMultiplier},greenMultiplier:{get:c.getGreenMultiplier,set:c.setGreenMultiplier},blueMultiplier:{get:c.getBlueMultiplier,set:c.setBlueMultiplier},alphaMultiplier:{get:c.getAlphaMultiplier,set:c.setAlphaMultiplier},redOffset:{get:c.getRedOffset,set:c.setRedOffset},greenOffset:{get:c.getGreenOffset,set:c.setGreenOffset},blueOffset:{get:c.getBlueOffset,set:c.setBlueOffset},alphaOffset:{get:c.getAlphaOffset,set:c.setAlphaOffset},concat:{value:c.concat,writable:!0},toString:{value:c._toString,writable:!0}}),c}function toAS3Matrix(t){var e,i,n,r,o,s,a=t.context;return t instanceof AVM1Object&&(e=alCoerceNumber(a,t.alGet("a")),i=alCoerceNumber(a,t.alGet("b")),n=alCoerceNumber(a,t.alGet("c")),r=alCoerceNumber(a,t.alGet("d")),o=alCoerceNumber(a,t.alGet("tx")),s=alCoerceNumber(a,t.alGet("ty"))),new Matrix(e,i,n,r,o,s)}function copyAS3MatrixTo(t,e){e.alPut("a",t.a),e.alPut("b",t.b),e.alPut("c",t.c),e.alPut("d",t.d),e.alPut("tx",t.tx),e.alPut("ty",t.ty)}var AVM1Matrix=(Iqd=AVM1Object,__extends(Jqd,Iqd),Jqd.fromAS3Matrix=function(t,e){return new Jqd(t,e.a,e.b,e.c,e.d,e.tx,e.ty)},Jqd),AVM1MatrixFunction=(Uqd=AVM1Function,__extends(Vqd,Uqd),Vqd.prototype.alConstruct=function(t){return t&&0<t.length?new AVM1Matrix(this.context,t[0],t[1],t[2],t[3],t[4],t[5]):new AVM1Matrix(this.context)},Vqd),AVM1MatrixPrototype=(Zqd=AVM1Object,__extends($qd,Zqd),$qd.prototype.clone=function(){var t=new AVM1Matrix(this.context);return this instanceof AVM1Object&&(t.alPut("a",this.alGet("a")),t.alPut("b",this.alGet("b")),t.alPut("c",this.alGet("c")),t.alPut("d",this.alGet("d")),t.alPut("tx",this.alGet("tx")),t.alPut("ty",this.alGet("ty"))),t},$qd.prototype.concat=function(t){var e=toAS3Matrix(this),i=toAS3Matrix(t);e.concat(i),copyAS3MatrixTo(e,this)},$qd.prototype.createBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alCoerceNumber(this.context,i),n=alCoerceNumber(this.context,n),r=alCoerceNumber(this.context,r);var o=toAS3Matrix(this);o.createBox(t,e,i,n,r),copyAS3MatrixTo(o,this)},$qd.prototype.createGradientBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alCoerceNumber(this.context,i),n=alCoerceNumber(this.context,n),r=alCoerceNumber(this.context,r);var o=toAS3Matrix(this);o.createGradientBox(t,e,i,n,r),copyAS3MatrixTo(o,this)},$qd.prototype.deltaTransformPoint=function(t){var e=toAS3Point(t),i=toAS3Matrix(this);return AVM1Point.fromAS3Point(this.context,i.deltaTransformPoint(e))},$qd.prototype.identity=function(){this.alPut("a",1),this.alPut("b",0),this.alPut("c",0),this.alPut("d",1),this.alPut("tx",0),this.alPut("ty",0)},$qd.prototype.invert=function(){var t=toAS3Matrix(this);t.invert(),copyAS3MatrixTo(t,this)},$qd.prototype.rotate=function(t){t=alCoerceNumber(this.context,t);var e=toAS3Matrix(this);e.rotate(t),copyAS3MatrixTo(e,this)},$qd.prototype.scale=function(t,e){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e);var i=toAS3Matrix(this);i.scale(t,e),copyAS3MatrixTo(i,this)},$qd.prototype._toString=function(){return toAS3Matrix(this).toString()},$qd.prototype.transformPoint=function(t){var e=toAS3Point(t),i=toAS3Matrix(this);return AVM1Point.fromAS3Point(this.context,i.transformPoint(e))},$qd.prototype.translate=function(t,e){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e);var i=toAS3Matrix(this);i.translate(t,e),copyAS3MatrixTo(i,this)},$qd),AVM1Stage=(Hrd=AVM1Object,__extends(Ird,Hrd),Ird.createAVM1Class=function(t){var e=new Ird(t);return wrapAVM1NativeMembers(t,e,Ird.prototype,["align#","displayState#","fullScreenSourceRect#","height#","scaleMode#","showMenu#","width#"],!1),e},Ird.bindStage=function(t,e,i,n,r){e.avmStage=i,e.avm1Handler=n,Ird.avmStage=i},Ird.prototype.getAlign=function(){return this.avmStage.align},Ird.prototype.setAlign=function(t){this.avmStage.align=t},Ird.prototype.getDisplayState=function(){return null},Ird.prototype.setDisplayState=function(t){},Ird.prototype.getFullScreenSourceRect=function(){return null},Ird.prototype.setFullScreenSourceRect=function(t){},Ird.prototype.getHeight=function(){return this.avmStage.stageHeight},Ird.prototype.getScaleMode=function(){return this.avmStage.scaleMode},Ird.prototype.setScaleMode=function(t){this.avmStage.scaleMode=t},Ird.prototype.getShowMenu=function(){return null},Ird.prototype.setShowMenu=function(t){},Ird.prototype.getWidth=function(){return this.avmStage.stageWidth},Ird),Hrd,Zqd,Uqd,Iqd;function Ird(){return null!==Hrd&&Hrd.apply(this,arguments)||this}function $qd(t,e){var i=Zqd.call(this,t)||this;return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(i,{constructor:{value:e,writable:!0},clone:{value:i.clone,writable:!0},concat:{value:i.concat,writable:!0},createBox:{value:i.createBox,writable:!0},createGradientBox:{value:i.createGradientBox,writable:!0},deltaTransformPoint:{value:i.deltaTransformPoint,writable:!0},identity:{value:i.identity,writable:!0},invert:{value:i.invert,writable:!0},rotate:{value:i.rotate,writable:!0},scale:{value:i.scale,writable:!0},toString:{value:i._toString,writable:!0},transformPoint:{value:i.transformPoint,writable:!0},translate:{value:i.translate,writable:!0}}),i}function Vqd(t){var e=Uqd.call(this,t)||this;return alDefineObjectProperties(e,{prototype:{value:new AVM1MatrixPrototype(t,e)}}),e}function Jqd(t,e,i,n,r,o,s){void 0===e&&(e=1),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=1),void 0===o&&(o=0),void 0===s&&(s=0);var a=Iqd.call(this,t)||this;return a.alPrototype=t.globals.Matrix.alGetPrototypeProperty(),a.alPut("a",e),a.alPut("b",i),a.alPut("c",n),a.alPut("d",r),a.alPut("tx",o),a.alPut("ty",s),a}function toAS3BitmapData(t){return t instanceof AVM1BitmapData&&t.as3BitmapData}var AVM1BitmapData=(Wrd=AVM1Object,__extends(Xrd,Wrd),Xrd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,Xrd,["loadBitmap"],["height#","rectangle#","transparent#","width#","applyFilter","clone","colorTransform","compare","copyChannel","copyPixels","dispose","draw","fillRect","floodFill","generateFilterRect","getColorBoundsRect","getPixel","getPixel32","hitTest","merge","noise","paletteMap","perlinNoise","pixelDissolve","scroll","setPixel","setPixel32","threshold"],null,Xrd.prototype.avm1Constructor)},Object.defineProperty(Xrd.prototype,"as3BitmapData",{get:function(){return this.adaptee},enumerable:!0,configurable:!0}),Xrd.prototype.avm1Constructor=function(t,e,i,n){t=alToNumber(this.context,t),e=alToNumber(this.context,e),i=arguments.length<3||alToBoolean(this.context,i),n=arguments.length<4?4294967295:alToInt32(this.context,n);var r=new SceneImage2D(t,e,i,n,!1,AVM1Stage.avmStage.scene.renderer.stage);this.adaptee=r},Xrd.fromAS3BitmapData=function(t,e){var i=new Xrd(t);return i.alPrototype=t.globals.BitmapData.alGetPrototypeProperty(),i.adaptee=e,i},Xrd.loadBitmap=function(t,e){e=alToString(t,e);var i=AssetLibrary.getAsset(e);if(i&&i.isAsset(BitmapImage2D)){var n=new Xrd(t);return n.adaptee=i,n}return null},Xrd.prototype.getHeight=function(){return this.adaptee.height},Xrd.prototype.getRectangle=function(){var t=this.as3BitmapData;return new AVM1Rectangle(this.context,0,0,t.width,t.height)},Xrd.prototype.getTransparent=function(){return this.adaptee.transparent},Xrd.prototype.getWidth=function(){return this.adaptee.width},Xrd.prototype.applyFilter=function(t,e,i,n){return t.as3BitmapData,toAS3Rectangle(e),toAS3Point(i),0},Xrd.prototype.clone=function(){var t=new Xrd(this.context);return t.alPrototype=this.context.globals.BitmapData.alGetPrototypeProperty(),t.adaptee=this.adaptee.clone(),t},Xrd.prototype.colorTransform=function(t,e){var i=toAS3Rectangle(t),n=toAwayColorTransform(e);this.adaptee.colorTransform(i,n)},Xrd.prototype.compare=function(t){return t instanceof Xrd},Xrd.prototype.copyChannel=function(t,e,i,n,r){var o=t.as3BitmapData,s=toAS3Rectangle(e),a=toAS3Point(i);n=alCoerceNumber(this.context,n),r=alCoerceNumber(this.context,r),this.as3BitmapData.copyChannel(o,s,a,n,r)},Xrd.prototype.copyPixels=function(t,e,i,n,r,o){t?(t.as3BitmapData,toAS3Rectangle(e),toAS3Point(i),n&&n.as3BitmapData,r&&toAS3Point(r),o=alToBoolean(this.context,o)):console.warn("[AVM1BitmapData::copyPixels] Empty source!")},Xrd.prototype.dispose=function(){this.as3BitmapData.dispose()},Xrd.prototype.draw=function(t,e,i,n,r,o){var s,a,l,c;t?(s=t.adaptee,a=e?toAS3Matrix(e):null,l=i?toAwayColorTransform(i):null,c=r?toAS3Rectangle(r):null,n=(n="number"==typeof n?BlendModesMap[n]:alCoerceString(this.context,n))||null,o=alToBoolean(this.context,o),this.as3BitmapData.draw(s,a,l,n,c,o)):console.warn("[AVM1BitmapData::draw] Empty source!")},Xrd.prototype.fillRect=function(t,e){var i=toAS3Rectangle(t);e=alToInt32(this.context,e),this.as3BitmapData.fillRect(i,e)},Xrd.prototype.floodFill=function(t,e,i){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alToInt32(this.context,i),Debug.notImplemented("AVM1BitmapData.floodFill")},Xrd.prototype.generateFilterRect=function(t,e){Debug.notImplemented("AVM1BitmapData.generateFilterRect")},Xrd.prototype.getColorBoundsRect=function(t,e,i){return t=alToInt32(this.context,t),e=alToInt32(this.context,e),i=alToBoolean(this.context,i),Debug.notImplemented("AVM1BitmapData.getColorBoundsRect"),null},Xrd.prototype.getPixel=function(t,e){return this.adaptee.getPixel(t,e)},Xrd.prototype.getPixel32=function(t,e){return this.adaptee.getPixel32(t,e)},Xrd.prototype.hitTest=function(t,e,i,n,r){return Debug.somewhatImplemented("AVM1BitmapData.hitTest"),toAS3Point(t),e=alToInt32(this.context,e),Debug.notImplemented("AVM1BitmapData.hitTest"),!1},Xrd.prototype.merge=function(t,e,i,n,r,o,s){var a=t.as3BitmapData,l=toAS3Rectangle(e),c=toAS3Point(i);n=alToInt32(this.context,n),r=alToInt32(this.context,r),o=alToInt32(this.context,o),s=alToInt32(this.context,s),this.as3BitmapData.merge(a,l,c,n,r,o,s)},Xrd.prototype.noise=function(t,e,i,n,r){t=alToInt32(this.context,t),e=arguments.length<2?0:alToInt32(this.context,e),i=arguments.length<3?255:alToInt32(this.context,i),n=arguments.length<4?7:alToInt32(this.context,n),r=!(arguments.length<5)&&alToBoolean(this.context,r),Debug.notImplemented("AVM1BitmapData.noise")},Xrd.prototype.paletteMap=function(t,e,i,n,r,o,s){Debug.notImplemented("AVM1BitmapData.paletteMap")},Xrd.prototype.perlinNoise=function(t,e,i,n,r,o,s,a,l){var c=this;t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alCoerceNumber(this.context,i),n=alCoerceNumber(this.context,n),r=alToBoolean(this.context,r),o=alToBoolean(this.context,o),s=void 0===s?7:alCoerceNumber(this.context,s),a=alToBoolean(this.context,a),isNullOrUndefined$1(l)||AVM1ArrayNative.mapToJSArray(l,function(t){return alCoerceNumber(c.context,t)},this),Debug.notImplemented("AVM1BitmapData.perlinNoise")},Xrd.prototype.pixelDissolve=function(t,e,i,n,r,o){t.as3BitmapData;var s=toAS3Rectangle(e);return toAS3Point(i),n=arguments.length<4?0:alToInt32(this.context,n),r=arguments.length<5?s.width*s.height/30:alToInt32(this.context,r),o=arguments.length<6?0:alToInt32(this.context,o),Debug.notImplemented("AVM1BitmapData.pixelDissolve"),0},Xrd.prototype.scroll=function(t,e){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),Debug.notImplemented("AVM1BitmapData.scroll")},Xrd.prototype.setPixel=function(t,e,i){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alToInt32(this.context,i),this.adaptee.setPixel(t,e,i)},Xrd.prototype.setPixel32=function(t,e,i){t=alCoerceNumber(this.context,t),e=alCoerceNumber(this.context,e),i=alToInt32(this.context,i),this.adaptee.setPixel32(t,e,i)},Xrd.prototype.threshold=function(t,e,i,n,r,o,s,a){return t.as3BitmapData,toAS3Rectangle(e),toAS3Point(i),n=alCoerceString(this.context,n),r=alToInt32(this.context,r),o=arguments.length<6?0:alToInt32(this.context,o),s=arguments.length<7?4294967295:alToInt32(this.context,s),a=!(arguments.length<8)&&alToBoolean(this.context,a),Debug.notImplemented("AVM1BitmapData.threshold"),0},Xrd),MovieClipProperties,Wrd,mud;function Xrd(){return null!==Wrd&&Wrd.apply(this,arguments)||this}mud=MovieClipProperties=MovieClipProperties||{},mud[mud._x=0]="_x",mud[mud._y=1]="_y",mud[mud._xscale=2]="_xscale",mud[mud._yscale=3]="_yscale",mud[mud._currentframe=4]="_currentframe",mud[mud._totalframes=5]="_totalframes",mud[mud._alpha=6]="_alpha",mud[mud._visible=7]="_visible",mud[mud._width=8]="_width",mud[mud._height=9]="_height",mud[mud._rotation=10]="_rotation",mud[mud._target=11]="_target",mud[mud._framesloaded=12]="_framesloaded",mud[mud._name=13]="_name",mud[mud._droptarget=14]="_droptarget",mud[mud._url=15]="_url",mud[mud._highquality=16]="_highquality",mud[mud._focusrect=17]="_focusrect",mud[mud._soundbuftime=18]="_soundbuftime",mud[mud._quality=19]="_quality",mud[mud._xmouse=20]="_xmouse",mud[mud._ymouse=21]="_ymouse";var AVM1TextFormat=(nud=AVM1Object,__extends(oud,nud),oud.createAVM1Class=function(t){var e=["align#","blockIndent#","bold#","bullet#","color#","font#","getTextExtent","indent#","italic#","kerning#","leading#","leftMargin#","letterSpacing#","rightMargin#","size#","tabStops#","target#","adaptee#","underline#","url#"],i=wrapAVM1NativeClass(t,!0,oud,[],e,null,oud.prototype.avm1Constructor),n=i.alGetPrototypeProperty(),r=null;return e.forEach(function(t){"#"===t[t.length-1]&&(t=t.slice(0,-1)),(r=n.alGetOwnProperty(t)).flags&=-2,n.alSetOwnProperty(t,r)}),i},oud.createFromNative=function(t,e){var i=t.globals.TextFormat,n=new oud(t);return n.alPrototype=i.alGetPrototypeProperty(),n.adaptee=e,n},oud.prototype.alPut=function(t,e){"font"==t&&this.setFont(e),nud.prototype.alPut.call(this,t,e)},oud.prototype.avm1Constructor=function(t,e,i,n,r,o,s,a,l,c,h,u,p){var d=this.context;t=null==t?null:alToString(d,t),e=null==e?null:alToNumber(d,e),i=null==i?null:alToNumber(d,i),n=null==n?null:alToBoolean(d,n),r=null==r?null:alToBoolean(d,r),o=null==o?null:alToBoolean(d,o),s=null==s?null:alToString(d,s),a=null==a?null:alToString(d,a),l=null==l?null:alToString(d,l),c=null==c?null:alToNumber(d,c),h=null==h?null:alToNumber(d,h),u=null==u?null:alToNumber(d,u),p=null==p?null:alToNumber(d,p);var _=new TextFormat(t,e,i,n,r,o,s,a,l,c,h,u,p);this.adaptee=_},oud.alInitStatic=function(t){var e=new TextField;e.multiline=!0,this._measureTextField=e},oud.prototype.getAdaptee=function(){return this.adaptee.id},oud.prototype.setAdaptee=function(t){},oud.prototype.getAlign=function(){return this.adaptee.align},oud.prototype.setAlign=function(t){var e=alToString(this.context,t);""==e&&(e="center"),this.adaptee.align=e},oud.prototype.getBlockIndent=function(){return this.adaptee.blockIndent},oud.prototype.setBlockIndent=function(t){this.adaptee.blockIndent=alToNumber(this.context,t)},oud.prototype.getBold=function(){return this.adaptee.bold},oud.prototype.setBold=function(t){this.adaptee.bold=alToBoolean(this.context,t)},oud.prototype.getBullet=function(){return this.adaptee.bullet},oud.prototype.setBullet=function(t){this.adaptee.bullet=alToBoolean(this.context,t)},oud.prototype.getColor=function(){return this.adaptee.color},oud.prototype.setColor=function(t){this.adaptee.color=alToNumber(this.context,t)},oud.prototype.getFont=function(){return this.adaptee.font_name},oud.prototype.setFont=function(t){this.adaptee.font_name=alToString(this.context,t)},oud.prototype.getIndent=function(){return this.adaptee.indent},oud.prototype.setIndent=function(t){this.adaptee.indent=alToNumber(this.context,t)},oud.prototype.getItalic=function(){return this.adaptee.italic},oud.prototype.setItalic=function(t){this.adaptee.italic=alToBoolean(this.context,t)},oud.prototype.getKerning=function(){return this.adaptee.kerning},oud.prototype.setKerning=function(t){this.adaptee.kerning=alToBoolean(this.context,t)},oud.prototype.getLeading=function(){return this.adaptee.leading},oud.prototype.setLeading=function(t){this.adaptee.leading=alToNumber(this.context,t)},oud.prototype.getLeftMargin=function(){return this.adaptee.leftMargin},oud.prototype.setLeftMargin=function(t){this.adaptee.leftMargin=alToNumber(this.context,t)},oud.prototype.getLetterSpacing=function(){return this.adaptee.letterSpacing},oud.prototype.setLetterSpacing=function(t){this.adaptee.letterSpacing=alToNumber(this.context,t)},oud.prototype.getRightMargin=function(){return this.adaptee.rightMargin},oud.prototype.setRightMargin=function(t){this.adaptee.rightMargin=alToNumber(this.context,t)},oud.prototype.getSize=function(){return this.adaptee.size},oud.prototype.setSize=function(t){this.adaptee.size=alToNumber(this.context,t)},oud.prototype.getTabStops=function(){return new AVM1ArrayNative(this.context,this.adaptee.tabStops)},oud.prototype.setTabStops=function(t){var e=this;this.adaptee.tabStops=AVM1ArrayNative.mapToJSArray(t,function(t){return alToNumber(e.context,t)})},oud.prototype.getTarget=function(){return""},oud.prototype.setTarget=function(t){},oud.prototype.getTextExtent=function(t,e){t=alCoerceString(this.context,t),e=+e;var i=this.context.getStaticState(oud)._measureTextField;!isNaN(e)&&0<e?(i.width=e+4,i.wordWrap=!0):i.wordWrap=!1,i.defaultTextFormat=this.adaptee,i.text=t;var n=alNewObject(this.context),r=i.textWidth,o=i.textHeight;return n.alPut("width",r),n.alPut("height",o),n.alPut("textFieldWidth",r+4),n.alPut("textFieldHeight",o+4),i.getLineMetrics(0),n},oud.prototype.getUnderline=function(){return this.adaptee.underline},oud.prototype.setUnderline=function(t){this.adaptee.underline=alToBoolean(this.context,t)},oud.prototype.getUrl=function(){return this.adaptee.url},oud.prototype.setUrl=function(t){this.adaptee.url=alToString(this.context,t)},oud),AVM1Key=(svd=AVM1Object,__extends(tvd,svd),tvd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!1,tvd,["BACKSPACE","CAPSLOCK","CONTROL","DELETEKEY","DOWN","END","ENTER","ESCAPE","HOME","INSERT","LEFT","PGDN","PGUP","RIGHT","SHIFT","SPACE","TAB","UP","isDown","getCode"],[])},tvd.alInitStatic=function(t){this._keyStates=[],this._lastKeyCode=0},tvd.bindStage=function(i,n,t,e){tvd.keyDownDelegate&&e.removeEventListener("keydown",tvd.keyDownDelegate),tvd.keyUpDelegate&&e.removeEventListener("keyup",tvd.keyUpDelegate),tvd.keyDownDelegate=function(t){var e=i.getStaticState(tvd);e._lastKeyCode=t.keyCode,e._keyStates[t.keyCode]=1,alCallProperty(n,"broadcastMessage",["onKeyDown"])},tvd.keyUpDelegate=function(t){var e=i.getStaticState(tvd);e._lastKeyCode=t.keyCode,delete e._keyStates[t.keyCode],alCallProperty(n,"broadcastMessage",["onKeyUp"])},e.addEventListener("keydown",tvd.keyDownDelegate),e.addEventListener("keyup",tvd.keyUpDelegate)},tvd.isDown=function(t,e){return!!t.getStaticState(tvd)._keyStates[e]},tvd.getCode=function(t){return t.getStaticState(tvd)._lastKeyCode},tvd.BACKSPACE=8,tvd.CAPSLOCK=20,tvd.CONTROL=17,tvd.DELETEKEY=46,tvd.DOWN=40,tvd.END=35,tvd.ENTER=13,tvd.ESCAPE=27,tvd.HOME=36,tvd.INSERT=45,tvd.LEFT=37,tvd.PGDN=34,tvd.PGUP=33,tvd.RIGHT=39,tvd.SHIFT=16,tvd.SPACE=32,tvd.TAB=9,tvd.UP=38,tvd.keyDownDelegate=null,tvd.keyUpDelegate=null,tvd),AVM1Transform=(Hvd=AVM1Object,__extends(Ivd,Hvd),Ivd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,Ivd,[],["matrix#","concatenatedMatrix#","colorTransform#","pixelBounds#"],null,Ivd.prototype.avm1Constructor)},Object.defineProperty(Ivd.prototype,"as3Transform",{get:function(){return this._targetAwayObject.transform},enumerable:!0,configurable:!0}),Ivd.prototype.avm1Constructor=function(t){this._target=this.context.resolveTarget(t),this._targetAwayObject=getAwayJSAdaptee(this._target)},Ivd.prototype.getMatrix=function(){var t=this._targetAwayObject.transform;return AVM1Matrix.fromAS3Matrix(this.context,t.matrix)},Ivd.prototype.setMatrix=function(t){this._targetAwayObject.transform.matrix=toAS3Matrix(t)},Ivd.prototype.getConcatenatedMatrix=function(){var t=this._targetAwayObject.transform;return AVM1Matrix.fromAS3Matrix(this.context,t.concatenatedMatrix)},Ivd.prototype.getColorTransform=function(){var t=this._targetAwayObject.transform;return AVM1ColorTransform.fromAwayColorTransform(this.context,t.colorTransform)},Ivd.prototype.setColorTransform=function(t){this._targetAwayObject.transform.colorTransform=toAwayColorTransform(t)},Ivd.prototype.getPixelBounds=function(){var t=this._targetAwayObject.transform;return AVM1Rectangle.fromAS3Rectangle(this.context,t.pixelBounds)},Ivd),AVM1SymbolBase=(Rvd=AVM1Object,__extends(Svd,Rvd),Svd.prototype.initAVM1SymbolInstance=function(t,e){this.avmType="symbol",this.scriptRefsToChilds={},this._mouseListenerCount=0,this._avm1Context=t,this._ownProperties=Object.create(null),this._prototype=null;var i=this;this._onClipEventsListeners=[];var n=new AVM1PropertyDescriptor(131,null,{alCall:function(t,e){return i.alPrototype}},{alCall:function(t,e){i.alPrototype=e[0]}});this.alSetOwnProperty("__proto__",n);var r=(this.adaptee=e).name,o=this.get_parent();r&&o&&o._addChildName(this,r)},Svd.prototype.bindEvents=function(t,e){this._events=t;var i=Object.create(null);this._eventsMap=i,this._eventsListeners=Object.create(null),this._eventHandlers=Object.create(null);var n=this,r=this.context;t.forEach(function(t){var e=t.propertyName=r.normalizeName(t.propertyName);i[e]=t,n._updateEvent(t)})},Svd.prototype.unbindEvents=function(){var t=this._events,e=this,i=this.context;t.forEach(function(t){i.unregisterEventPropertyObserver(t.propertyName,e),e._removeEventListener(t)}),this._events=null,this._eventsMap=null,this._eventsListeners=null,this._eventHandlers=null},Svd.prototype._initEventsHandlers=function(){throw"AVM1SymbolBase _initEventsHandlers must be overwritten"},Svd.prototype.updateEventByPropName=function(t){this._eventsMap?this._eventsMap[t]&&this._updateEvent(this._eventsMap[t]):(this._initEventsHandlers(),console.log("no eventsmap set",this))},Svd.prototype.updateAllEvents=function(){this._events.forEach(function(t){this._updateEvent(t)},this)},Svd.prototype._updateEvent=function(t){avm1HasEventProperty(this.context,this,t.propertyName)?this._addEventListener(t):this._removeEventListener(t)},Svd.prototype._addOnClipEventListener=function(t,e,i){void 0===e&&(e=null),void 0===i&&(i=null),t.propertyName=this.context.normalizeName(t.propertyName),this._onClipEventsListeners.push({event:t,callback:e}),!this.enabled&&t.allowDisable||this.addEventListenerOnAdapter(t,e,i)},Svd.prototype._addEventListener=function(t,e){void 0===e&&(e=null);var i=this.context.normalizeName(t.propertyName),n=this._eventsListeners[i],r=this;n||(n=e||function(){var t=null;"onchanged"==i.toLowerCase()&&(t=[r]),avm1BroadcastNativeEvent(this.context,this,i,t)}.bind(this),this._eventsListeners[i]=n,this._eventHandlers[i]=t),!this.enabled&&t.allowDisable||this.addEventListenerOnAdapter(t,n)},Svd.prototype.addEventListenerOnAdapter=function(t,e,i){void 0===i&&(i=null),t.stageEvent?this.context.globals.Stage.avm1Handler.addAVM1EventListener(this.adaptee,t.eventName,e,i):(this.adaptee.addEventListener(t.eventName,e),this._updateMouseEnabled(t,!0))},Svd.prototype.removeEventListenerOnAdapter=function(t,e){var i;t.stageEvent?(i=this.context.globals.Stage.avm1Handler)&&i.removeAVM1EventListener(this.adaptee,t.eventName,e):(this.adaptee.removeEventListener(t.eventName,e),this._updateMouseEnabled(t,!1))},Svd.prototype._updateMouseEnabled=function(t,e){this.adaptee.isAVMScene||t.isMouse&&(e?(this._mouseListenerCount++,this.adaptee.mouseEnabled=!0,this.adaptee.mouseChildren=!1):(this._mouseListenerCount--,this._mouseListenerCount<=0&&(this._mouseListenerCount=0,this.adaptee.mouseEnabled=!1,this.adaptee.mouseChildren=!0)))},Svd.prototype.freeFromScript=function(){for(var t in Rvd.prototype.freeFromScript.call(this),this.enabled=!0,this.adaptee.mouseEnabled=!1,this.adaptee.mouseChildren=!0,this._eventsListeners)this.removeEventListenerOnAdapter(this._eventHandlers[t],this._eventsListeners[t]);this._eventsListeners={};for(var e=this._onClipEventsListeners.length;0<e;)e--,this.removeEventListenerOnAdapter(this._onClipEventsListeners[e].event,this._onClipEventsListeners[e].callback);this._onClipEventsListeners=[],this._mouseListenerCount=0},Svd.prototype._removeEventListener=function(t){var e=this.context.normalizeName(t.propertyName),i=this._eventsListeners[e];i&&(this.removeEventListenerOnAdapter(t,i),delete this._eventsListeners[e])},Svd.prototype.onEventPropertyModified=function(t){t=this.context.normalizeName(t);var e=this._eventsMap[t];this._updateEvent(e)},Svd.prototype.getEnabled=function(){return this.enabled},Svd.prototype.setEnabled=function(t){t!=this.enabled&&(this.enabled=t,this.setEnabledListener(t))},Svd.prototype.setEnabledListener=function(t){if(!1!==t&&0!==t){for(var e in this._eventsListeners)this._eventHandlers[e].allowDisable&&this.addEventListenerOnAdapter(this._eventHandlers[e],this._eventsListeners[e]);for(var e in this._onClipEventsListeners)this._onClipEventsListeners[e].event.allowDisable&&this.addEventListenerOnAdapter(this._onClipEventsListeners[e].event,this._onClipEventsListeners[e].callback)}else{for(var e in this._eventsListeners)this._eventHandlers[e].allowDisable&&this.removeEventListenerOnAdapter(this._eventHandlers[e],this._eventsListeners[e]);for(var e in this._onClipEventsListeners)this._onClipEventsListeners[e].event.allowDisable&&this.removeEventListenerOnAdapter(this._onClipEventsListeners[e].event,this._onClipEventsListeners[e].callback)}},Svd.prototype.get_alpha=function(){return 100*this.adaptee.alpha},Svd.prototype.set_alpha=function(t){this._ctBlockedByScript=!0,t=alToNumber(this.context,t),isNaN(t)||(this.adaptee.alpha=t/100)},Svd.prototype.getBlendMode=function(){return""},Svd.prototype.setBlendMode=function(t){},Svd.prototype.getCacheAsBitmap=function(){return this.adaptee.cacheAsBitmap},Svd.prototype.setCacheAsBitmap=function(t){t=alToBoolean(this.context,t),this.adaptee.cacheAsBitmap=t},Svd.prototype.getFilters=function(){return null},Svd.prototype.setFilters=function(t){},Svd.prototype.get_focusrect=function(){return!1},Svd.prototype.set_focusrect=function(t){},Svd.prototype.get_height=function(){var t=PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view).getBoundsPicker(this.adaptee.partition).getBoxBounds(this.adaptee);return null==t?0:toTwipFloor(t.height)},Svd.prototype.set_height=function(t){t=toTwipFloor(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view).getBoundsPicker(this.adaptee.partition).height=t)},Svd.prototype.get_highquality=function(){switch(this.get_quality()){case"BEST":return 2;case"HIGH":return 1;default:return 0}},Svd.prototype.set_highquality=function(t){var e;switch(alToInteger(this.context,t)){case 2:e="BEST";break;case 1:e="HIGH";break;default:e="LOW"}this.set_quality(e)},Svd.prototype.getMenu=function(){},Svd.prototype.setMenu=function(t){},Svd.prototype.get_name=function(){return this.adaptee?this.adaptee.name:void 0},Svd.prototype.set_name=function(t){t=alCoerceString(this.context,t);var e=this.adaptee.name;this.adaptee.name=t;var i=this.get_parent();i&&(i.registerScriptObject(this.adaptee),i._updateChildName(this,e,t))},Svd.prototype.get_parent=function(){return getAVM1Object(this.adaptee.parent,this.context)||void 0},Svd.prototype.set_parent=function(t){},Svd.prototype.getOpaqueBackground=function(){return 0},Svd.prototype.setOpaqueBackground=function(t){},Svd.prototype.get_quality=function(){return"HIGH"},Svd.prototype.set_quality=function(t){},Svd.prototype.set_root=function(t){},Svd.prototype.get_root=function(){for(var t=this.adaptee,e=null;t&&!t.isAVMScene;){if((e=getAVM1Object(t,this.context))&&e.get_lockroot())return e;t=t.parent}if(t)return getAVM1Object(t,this.context)},Svd.prototype.get_rotation=function(){if(void 0!==this._rotation)return this._rotation;for(var t=Math.round(this.adaptee.rotationZ);180<t;)t-=360;for(;t<-180;)t+=360;return t},Svd.prototype.set_rotation=function(t){t=alToNumber(this.context,t),this._blockedByScript=!0,isNaN(t)||(this._rotation=t,this.adaptee.rotationZ=t)},Svd.prototype.getScale9Grid=function(){return AVM1Rectangle.fromAS3Rectangle(this.context,this.adaptee.scale9Grid)},Svd.prototype.setScale9Grid=function(t){this.adaptee.scale9Grid=isNullOrUndefined$1(t)?null:toAS3Rectangle(t)},Svd.prototype.getScrollRect=function(){return AVM1Rectangle.fromAS3Rectangle(this.context,this.adaptee.scrollRect)},Svd.prototype.setScrollRect=function(t){this.adaptee.scrollRect=isNullOrUndefined$1(t)?null:toAS3Rectangle(t)},Svd.prototype.get_soundbuftime=function(){return 0},Svd.prototype.set_soundbuftime=function(t){},Svd.prototype.getTabEnabled=function(){return!!this.adaptee&&this.adaptee.tabEnabled},Svd.prototype.setTabEnabled=function(t){this.adaptee&&(this.adaptee.tabEnabled=t)},Svd.prototype.getTabIndex=function(){return this.adaptee.tabIndex},Svd.prototype.setTabIndex=function(t){this.adaptee.tabIndex=t},Svd.prototype.get_target=function(){var t=this.adaptee;if(t===t.root)return"/";var e="";do{if(isNullOrUndefined$1(t))return;e="/"+t.name+e,t=t.parent}while(t&&!t.isAVMScene);return e},Svd.prototype.removeMovieClip=function(){this.adaptee.isAVMScene||this.adaptee.parent&&-1<=away2avmDepth(this.adaptee._depthID)&&this.adaptee.parent.removeChild(this.adaptee)},Svd.prototype.getTransform=function(){return this.context.swfVersion<8?this.transformPreFP8:(this._avmTransform||(this._avmTransform=this.context.globals.Transform.alConstruct([this])),this._avmTransform)},Svd.prototype.setTransform=function(t){this.context.swfVersion<8?this.transformPreFP8=t:t instanceof AVM1Transform&&console.log("not implemented: AVM1SymbolBase.setTransform")},Svd.prototype.get_visible=function(){return this.adaptee.visible},Svd.prototype.set_visible=function(t){this._visibilityByScript=!0,t=alToBoolean(this.context,t),this.adaptee.visible=t},Svd.prototype.get_url=function(){return this.adaptee.assetNamespace},Svd.prototype.get_width=function(){var t=PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view).getBoundsPicker(this.adaptee.partition).getBoxBounds(this.adaptee);return null==t?0:toTwipRound(t.width)},Svd.prototype.set_width=function(t){t=toTwipRound(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view).getBoundsPicker(this.adaptee.partition).width=t)},Svd.prototype.get_x=function(){return toTwipFloor(this.adaptee.x)},Svd.prototype.set_x=function(t){t=toTwipFloor(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(this.adaptee.x=t)},Svd.prototype.get_xmouse=function(){return toTwipFloor(this.context.globals.Stage.avmStage.scene.getLocalMouseX(this.adaptee))},Svd.prototype.get_xscale=function(){return void 0!==this._xscale?this._xscale:100*this.adaptee.scaleX},Svd.prototype.set_xscale=function(t){t=alToNumber(this.context,t),this._blockedByScript=!0,isNaN(t)||(this._xscale=t,this.adaptee.scaleX=t/100)},Svd.prototype.get_y=function(){return toTwipFloor(this.adaptee.y)},Svd.prototype.set_y=function(t){t=toTwipFloor(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(this.adaptee.y=t)},Svd.prototype.get_ymouse=function(){return toTwipFloor(this.context.globals.Stage.avmStage.scene.getLocalMouseY(this.adaptee))},Svd.prototype.get_yscale=function(){return void 0!==this._yscale?this._yscale:100*this.adaptee.scaleY},Svd.prototype.set_yscale=function(t){t=alToNumber(this.context,t),this._blockedByScript=!0,isNaN(t)||(this._yscale=t,this.adaptee.scaleY=t/100)},Svd.prototype.getDepth=function(){return this.protoTypeChanged?null:away2avmDepth(this.adaptee._depthID)},Svd.prototype.toString=function(){for(var t=this.adaptee,e=[];t;)t=t.isAVMScene?(e.push("_level0"),null):(e.push(t.name),t.parent);for(var i=e.length,n="";0<i;)n+=e[--i],0<i&&(n+=".");return n},Svd),AVM1EventHandler=function(t,e,i,n,r,o){this.propertyName=t,this.eventName=e,this.stageEvent=i,this.allowDisable=n,this.isMouse=r,this.isButton=o},AVM1EventProps=function(){},AVM1KeyCodeMap=[-1,37,39,36,35,45,46,-1,8,-1,-1,-1,-1,13,38,40,33,34,9,27],ClipEventMappings=Object.create(null),Rvd,Hvd,svd,nud;function Svd(){var t=null!==Rvd&&Rvd.apply(this,arguments)||this;return t.hasSwappedDepth=!1,t.dynamicallyCreated=!1,t.enabled=!0,t}function Ivd(){return null!==Hvd&&Hvd.apply(this,arguments)||this}function tvd(){return null!==svd&&svd.apply(this,arguments)||this}function oud(){return null!==nud&&nud.apply(this,arguments)||this}ClipEventMappings[262144]=!0,ClipEventMappings[512]=!0,ClipEventMappings[131072]=new AVM1EventHandler("onKey",KeyboardEvent$1.KEYDOWN,!0,!0,!1,!1),ClipEventMappings[1]=new AVM1EventHandler("onLoad","load",!1,!1,!1,!1),ClipEventMappings[4]=new AVM1EventHandler("onUnload","unload",!1,!1,!1,!1),ClipEventMappings[256]=new AVM1EventHandler("onData","data",!1,!1,!1,!1),ClipEventMappings[2]=new AVM1EventHandler("onEnterFrame","enterFrame",!1,!1,!1,!1),ClipEventMappings[64]=new AVM1EventHandler("onKeyDown",KeyboardEvent$1.KEYDOWN,!0,!0,!1,!1),ClipEventMappings[128]=new AVM1EventHandler("onKeyUp",KeyboardEvent$1.KEYUP,!0,!0,!1,!1),ClipEventMappings[8]=new AVM1EventHandler("onMouseMove",MouseEvent$1.MOUSE_MOVE,!0,!0,!0,!1),ClipEventMappings[16]=new AVM1EventHandler("onMouseDown",MouseEvent$1.MOUSE_DOWN,!0,!0,!0,!1),ClipEventMappings[32]=new AVM1EventHandler("onMouseUp",MouseEvent$1.MOUSE_UP,!0,!0,!0,!1),ClipEventMappings[1024]=new AVM1EventHandler("onPress",MouseEvent$1.MOUSE_DOWN,!1,!0,!0,!0),ClipEventMappings[2048]=new AVM1EventHandler("onRelease",MouseEvent$1.MOUSE_UP,!1,!0,!0,!0),ClipEventMappings[4096]=new AVM1EventHandler("onReleaseOutside",MouseEvent$1.MOUSE_UP_OUTSIDE,!1,!0,!0,!0),ClipEventMappings[8192]=new AVM1EventHandler("onRollOver",MouseEvent$1.MOUSE_OVER,!1,!0,!0,!0),ClipEventMappings[16384]=new AVM1EventHandler("onRollOut",MouseEvent$1.MOUSE_OUT,!1,!0,!0,!0),ClipEventMappings[32768]=new AVM1EventHandler("onDragOver",MouseEvent$1.DRAG_OVER,!1,!0,!0,!0),ClipEventMappings[65536]=new AVM1EventHandler("onDragOut",MouseEvent$1.DRAG_OUT,!1,!0,!0,!0);var setFocusEventMapping=new AVM1EventHandler("onSetFocus",FocusEvent.FOCUS_IN,!1,!0,!1,!1),unFocusEventMapping=new AVM1EventHandler("onKillFocus",FocusEvent.FOCUS_OUT,!1,!0,!1,!1),onChangedEventMapping=new AVM1EventHandler("onChanged",TextfieldEvent.CHANGED,!1,!0,!1,!1),EventsListForMC=[ClipEventMappings[1],ClipEventMappings[4],ClipEventMappings[256],ClipEventMappings[2],ClipEventMappings[64],ClipEventMappings[128],ClipEventMappings[8],ClipEventMappings[16],ClipEventMappings[32],ClipEventMappings[1024],ClipEventMappings[2048],ClipEventMappings[4096],ClipEventMappings[8192],ClipEventMappings[16384],ClipEventMappings[32768],ClipEventMappings[65536],ClipEventMappings[131072],setFocusEventMapping,unFocusEventMapping,onChangedEventMapping],EventsListForButton=[ClipEventMappings[1],ClipEventMappings[4],ClipEventMappings[256],ClipEventMappings[2],ClipEventMappings[64],ClipEventMappings[128],ClipEventMappings[1024],ClipEventMappings[2048],ClipEventMappings[4096],ClipEventMappings[8192],ClipEventMappings[16384],ClipEventMappings[32768],ClipEventMappings[65536],ClipEventMappings[131072],setFocusEventMapping,unFocusEventMapping,onChangedEventMapping],AVM1TextField=(Jxd=AVM1SymbolBase,__extends(Kxd,Jxd),Kxd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,Kxd,[],["_alpha#","addListener","antiAliasType#","autoSize#","background#","backgroundColor#","border#","borderColor#","bottomScroll#","condenseWhite#","embedFonts#","filters#","getAwayJSID","getNewTextFormat","getTextFormat","gridFitType#","getDepth","_height#","_highquality#","hscroll#","html#","htmlText#","length#","maxChars#","maxhscroll#","maxscroll#","multiline#","_name#","_parent#","password#","_quality#","_rotation#","replaceSel","removeMovieClip","removeTextField","restrict#","scroll#","selectable#","setNewTextFormat","setTextFormat","_soundbuftime#","tabEnabled#","tabIndex#","_target#","toString","text#","textColor#","textHeight#","textWidth#","type#","_url#","variable#","_visible#","_width#","wordWrap#","_x#","_xmouse#","_xscale#","_y#","_ymouse#","_yscale#"])},Kxd.prototype.dispatchKeyEvent=function(t,e,i,n){var r,o;this.context.globals.Stage&&this.context.globals.Stage.avmStage&&this.context.globals.Stage.avmStage.scene&&this.context.globals.Stage.avmStage.scene.mouseManager.useSoftkeyboard&&((o=this.context.getStaticState(AVM1Key))._lastKeyCode=t,o._keyStates[t]=1,alCallProperty(AVM1Globals.instance.Key,"broadcastMessage",["onKeyDown"]),(r=new KeyboardEvent$1(KeyboardEvent$1.KEYDOWN,"",t)).isShift=e,r.isCTRL=i,r.isAlt=n,this.context.globals.Stage.avmStage.dispatchEvent(r),delete o._keyStates[t],alCallProperty(AVM1Globals.instance.Key,"broadcastMessage",["onKeyUp"]),(r=new KeyboardEvent$1(KeyboardEvent$1.KEYUP,"",t)).isShift=e,r.isCTRL=i,r.isAlt=n,this.context.globals.Stage.avmStage.dispatchEvent(r))},Kxd.syncAllTextfields=function(){for(var t in Kxd.allTextfields)Kxd.allTextfields[t]?Kxd.allTextfields[t].syncTextFieldValue():delete Kxd.allTextfields[t]},Kxd.syncQueedTextfields=function(){if(0<Kxd.textFieldVars.length){for(var t=Kxd.textFieldVars.length,e=0;e<t;e++)Kxd.textFieldVars[e].syncTextFieldValue();Kxd.textFieldVars.length=0}},Kxd.prototype.getAwayJSID=function(){return this.adaptee.id},Kxd.prototype.selectTextField=function(t){void 0===t&&(t=!1),AVM1Globals.softKeyboardManager&&("dummy_txt"!=this.adaptee.name&&0!=this.adaptee.name.indexOf("temp")||(t=!0),AVM1Globals.softKeyboardManager.openKeyboard(this.adaptee,t))},Kxd.prototype.removeTextField=function(){this.removeMovieClip()},Kxd.prototype.alPut=function(t,e){Jxd.prototype.alPut.call(this,t,e)},Kxd.prototype.initAdapter=function(){var t=this;this.adaptee._symbol&&this.setVariable(this.adaptee._symbol.variableName||""),this.adaptee.addEventListener(TextfieldEvent.CHANGED,function(){t.updateVarFromText(),t.syncTextFieldValue()})},Kxd.prototype.initAVM1SymbolInstance=function(t,e){Jxd.prototype.initAVM1SymbolInstance.call(this,t,e),this.adaptee=e,this._initEventsHandlers(),this._variable="",this._exitFrameHandler=null,this.adaptee=e},Kxd.prototype.clone=function(){return getAVM1Object(this.adaptee.clone(),this._avm1Context)},Kxd.prototype.getAntiAliasType=function(){return""},Kxd.prototype.setAntiAliasType=function(t){},Kxd.prototype.get_width=function(){return this.syncTextFieldValue(),toTwipRound(this.adaptee.width)},Kxd.prototype.get_height=function(){return this.syncTextFieldValue(),toTwipRound(this.adaptee.height)},Kxd.prototype.set_width=function(t){t=toTwipRound(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(this.adaptee.width=t)},Kxd.prototype.set_height=function(t){t=toTwipRound(alToNumber(this.context,t)),this._blockedByScript=!0,isNaN(t)||(this.adaptee.height=t)},Kxd.prototype.get_x=function(){return this.syncTextFieldValue(),toTwipFloor(this.adaptee.x+this.adaptee.scaleX*this.adaptee.textOffsetX)},Kxd.prototype.get_y=function(){return this.syncTextFieldValue(),toTwipFloor(this.adaptee.y+this.adaptee.scaleY*this.adaptee.textOffsetY)},Kxd.prototype.set_x=function(t){this.syncTextFieldValue(),this.adaptee.x=toTwipFloor(t-this.adaptee.scaleX*this.adaptee.textOffsetX)},Kxd.prototype.set_y=function(t){this.syncTextFieldValue(),this.adaptee.y=toTwipFloor(t-this.adaptee.scaleY*this.adaptee.textOffsetY)},Kxd.prototype.getAutoSize=function(){return this.adaptee.autoSize},Kxd.prototype.setAutoSize=function(t){!0===t?t="left":!1===t&&(t="none"),t=alCoerceString(this.context,t),this.adaptee.autoSize=t},Kxd.prototype.getBackground=function(){return this.adaptee.background},Kxd.prototype.setBackground=function(t){t=alToBoolean(this.context,t),this.adaptee.background=t},Kxd.prototype.getBackgroundColor=function(){return this.adaptee.backgroundColor},Kxd.prototype.setBackgroundColor=function(t){t=alToInt32(this.context,t),this.adaptee.backgroundColor=t},Kxd.prototype.getBorder=function(){return this.adaptee.border},Kxd.prototype.setBorder=function(t){t=alToBoolean(this.context,t),this.adaptee.border=t},Kxd.prototype.getBorderColor=function(){return this.adaptee.borderColor},Kxd.prototype.setBorderColor=function(t){t=alToInt32(this.context,t),this.adaptee.borderColor=t},Kxd.prototype.getBottomScroll=function(){return this.adaptee.bottomScrollV+1},Kxd.prototype.getCondenseWhite=function(){return this.adaptee.condenseWhite},Kxd.prototype.setCondenseWhite=function(t){t=alToBoolean(this.context,t),this.adaptee.condenseWhite=t},Kxd.prototype.getEmbedFonts=function(){return this.adaptee.embedFonts},Kxd.prototype.setEmbedFonts=function(t){t=alToBoolean(this.context,t),this.adaptee.embedFonts=t},Kxd.prototype.getNewTextFormat=function(){return AVM1TextFormat.createFromNative(this.context,this.adaptee.defaultTextFormat)},Kxd.prototype.getTextFormat=function(t,e){void 0===t&&(t=-1),void 0===e&&(e=-1),t=alToInteger(this.context,t),e=alToInteger(this.context,e);var i=this.adaptee.getTextFormat(t,e);return AVM1TextFormat.createFromNative(this.context,i)},Kxd.prototype.getGridFitType=function(){return""},Kxd.prototype.setGridFitType=function(t){},Kxd.prototype.getHscroll=function(){return this.adaptee.scrollH+1},Kxd.prototype.setHscroll=function(t){(t=alCoerceNumber(this.context,t))<=0&&(t=1),this.adaptee.scrollH=t-1},Kxd.prototype.getHtml=function(){return this.adaptee.html},Kxd.prototype.setHtml=function(t){this.adaptee.html=!!t},Kxd.prototype.getHtmlText=function(){return this.adaptee.html?this.adaptee.htmlText:this.adaptee.text},Kxd.prototype.setHtmlText=function(t){t=void 0===t?"undefined":alToString(this.context,t),this.adaptee.html?this.adaptee.htmlText=t:this.adaptee.text=t,this.updateVarFromText(),this.syncTextFieldValue()},Kxd.prototype.getLength=function(){return this.adaptee.length},Kxd.prototype.getMaxChars=function(){return 0==this.adaptee.maxChars?null:this.adaptee.maxChars},Kxd.prototype.setMaxChars=function(t){t=alCoerceNumber(this.context,t),this.adaptee.maxChars=t},Kxd.prototype.getRestrict=function(){return this.adaptee.restrict},Kxd.prototype.setRestrict=function(t){t=alCoerceString(this.context,t),this.adaptee.restrict=t},Kxd.prototype.getMaxhscroll=function(){return this.adaptee.maxScrollH+1},Kxd.prototype.getMaxscroll=function(){return this.adaptee.maxScrollV+1},Kxd.prototype.getMultiline=function(){return this.adaptee.multiline},Kxd.prototype.setMultiline=function(t){t=alToBoolean(this.context,t),this.adaptee.multiline=t},Kxd.prototype.getPassword=function(){return this.adaptee.displayAsPassword},Kxd.prototype.setPassword=function(t){t=alToBoolean(this.context,t),this.adaptee.displayAsPassword=t},Kxd.prototype.getScroll=function(){return this.adaptee.scrollV+1},Kxd.prototype.setScroll=function(t){(t=alCoerceNumber(this.context,t))<=0&&(t=1),this.adaptee.scrollV=t-1},Kxd.prototype.getSelectable=function(){return this.adaptee.selectable},Kxd.prototype.setSelectable=function(t){"false"==t&&(t=!1),(t=alToBoolean(this.context,t))||this.context.globals.Stage.avmStage.scene.mouseManager.getFocus()!=this.adaptee||this.context.globals.Stage.avmStage.scene.mouseManager.setFocus(null),this.adaptee.selectable=t},Kxd.prototype.replaceSel=function(t){t=alToString(this.context,t),this.adaptee.replaceSelectedText(t)},Kxd.prototype.setNewTextFormat=function(t){var e;t instanceof AVM1TextFormat?(e=t.adaptee,this.adaptee.textFormat||(this.adaptee.textFormat=new TextFormat),this.adaptee.newTextFormat=e):console.log("AVM1Textfield.setNewtextFormat - trying to set something other than a TextFormat",t)},Kxd.prototype.setTextFormat=function(){this._variable&&this.syncTextFieldValue();var t,e,i=-1,n=-1;switch(arguments.length){case 0:return;case 1:t=arguments[0];break;case 2:i=alToNumber(this.context,arguments[0]),t=arguments[1];break;default:i=alToNumber(this.context,arguments[0]),n=alToNumber(this.context,arguments[1]),t=arguments[2]}0<=i&&-1==n&&(n=i),t instanceof AVM1TextFormat&&(e=t.adaptee,this.adaptee.setTextFormat(e,i,n))},Kxd.prototype.getText=function(){return this._variable&&this.syncTextFieldValue(),this.adaptee.text},Kxd.prototype.setText=function(t){t=void 0===t?"":alToString(this.context,t);var e,i=this.context.utils;this.adaptee.parent&&(e=getAVM1Object(this.adaptee.parent,this.context),i.setProperty(e,this._variable,t)),this.adaptee.text=t,this._variable&&(this.updateVarFromText(),this.syncTextFieldValue())},Kxd.prototype.getTextColor=function(){return this.adaptee.textColor},Kxd.prototype.setTextColor=function(t){t=alToInt32(this.context,t),this.adaptee.textColor=t},Kxd.prototype.getTextHeight=function(){return this._variable&&this.syncTextFieldValue(),this.adaptee.textHeight},Kxd.prototype.setTextHeight=function(t){},Kxd.prototype.getTextWidth=function(){return this._variable&&this.syncTextFieldValue(),this.adaptee.textWidth},Kxd.prototype.setTextWidth=function(t){},Kxd.prototype.getType=function(){return this.adaptee.type},Kxd.prototype.setType=function(t){(t=alCoerceString(this.context,t))&&(t=t.toLowerCase()),this.adaptee.type=t},Kxd.prototype.getVariable=function(){return this._variable},Kxd.prototype.setVariable=function(t){var e;(t=alCoerceString(this.context,t))!==this._variable&&(e=this.adaptee,(Kxd.allTextfields[e.id]=this)._prevTextVarContent=this.adaptee.text,this._syncTextFieldValue(e,t),this._exitFrameHandler&&!t&&(e.removeEventListener("exitFrame",this._exitFrameHandler),this._exitFrameHandler=null),this._variable=t,!this._exitFrameHandler&&t&&(this._exitFrameHandler=this._onAS3ObjectExitFrame.bind(this),e.addEventListener("exitFrame",this._exitFrameHandler)))},Kxd.prototype._onAS3ObjectExitFrame=function(){this._variable&&this._syncTextFieldValue(this.adaptee,this._variable)},Kxd.prototype.syncTextFieldValue=function(){this._syncTextFieldValue(this.adaptee,this._variable)},Kxd.prototype.updateVarFromText=function(){this._textVarHolder&&(this.context.utils.setProperty(this._textVarHolder,this._textVarPropName,this.adaptee.html?this.adaptee.htmlText:this.adaptee.text),this._prevTextVarContent=this.adaptee.text)},Kxd.prototype._syncTextFieldValue=function(t,e){if(e&&""!=e){var i,n=this.context.utils;if(null==this._textVarHolder)if(0<=e.indexOf(".")||0<=e.indexOf(":")){var r=e.split(/[.:\/]/g);if(this._textVarPropName=r.pop(),"_root"==r[0]||"_level0"==r[0]||"_level"==r[0]||""===r[0]){var o=t.parent;for(this._textVarHolder=null;o;)o=o.isAVMScene?(this._textVarHolder=o.adapter,null):o.parent;if(null===this._textVarHolder)return;r.shift(),""===r[0]&&r.shift()}else if("_global"==r[0])r.shift(),this._textVarHolder=this.context.globals;else{if(!t.parent)return;this._textVarHolder=getAVM1Object(t.parent,this.context)}for(var s=null;0<r.length;)if(s=r.shift(),this._textVarHolder=n.getProperty(this._textVarHolder,s),!this._textVarHolder)return}else if(this._textVarPropName=e,t.parent&&t.parent.parent){this._textVarHolder=getAVM1Object(t.parent,this.context);for(var a=t.parent.parent,l=a.numChildren,c=0;c<l;c++)(i=a.getChildAt(c))!=t.parent&&i.name==t.parent.name&&n.hasProperty(i.adapter,this._textVarPropName)&&(this._textVarHolder=i.adapter)}if(!this._textVarHolder)return Kxd.textFieldVars.push(this),t.html?this._prevTextVarContent=t.htmlText:void(this._prevTextVarContent=t.text);if(!n.hasProperty(this._textVarHolder,this._textVarPropName)){if(t.html){var h={isTextVar:!0,value:void 0};return""!=t.htmlText&&(h.value=t.htmlText),n.setProperty(this._textVarHolder,this._textVarPropName,h),n.setProperty(this._textVarHolder,this._textVarPropName+"_internal_TF",this),void(this._prevTextVarContent=t.htmlText)}return h={isTextVar:!0,value:void 0},""!=t.text&&(h.value=t.text),n.setProperty(this._textVarHolder,this._textVarPropName,h),n.setProperty(this._textVarHolder,this._textVarPropName+"_internal_TF",this),void(this._prevTextVarContent=t.text)}n.hasProperty(this._textVarHolder,this._textVarPropName+"_internal_TF")||n.setProperty(this._textVarHolder,this._textVarPropName+"_internal_TF",this);var u=n.getProperty(this._textVarHolder,this._textVarPropName);if("string"!=typeof u&&(u=alToString(this.context,u)),t.html){if(u!==this._prevTextVarContent)return t.htmlText=void 0===u?"":u,void(this._prevTextVarContent=u);t.htmlText===u||void 0===u&&""===t.htmlText||(t.htmlText=void 0===u?"":u)}else{if(u!==this._prevTextVarContent)return t.text=void 0===u?"":u,void(this._prevTextVarContent=u);t.text===u||void 0===u&&""===t.text||(t.text=void 0===u?"":u)}}},Kxd.prototype.getWordWrap=function(){return this.adaptee.wordWrap},Kxd.prototype.setWordWrap=function(t){t=alToBoolean(this.context,t),this.adaptee.wordWrap=t},Kxd.prototype._initEventsHandlers=function(){this.bindEvents(EventsListForMC)},Kxd.allTextfields={},Kxd.textFieldVars=[],Kxd),AVM1LoaderHelper=(Object.defineProperty(azd.prototype,"loader",{get:function(){return this._loader},enumerable:!0,configurable:!0}),Object.defineProperty(azd.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0}),azd.prototype.onAssetComplete=function(t){var e=t.asset;if(e.isAsset(MovieClip)){if(e.assetNamespace!=this._url)return;e.isAVMScene&&(this._content=e,this.result.resolve(e),e.adapter.initAdapter())}},azd.prototype.onLoaderComplete=function(t){t.url==this._url&&(AssetLibrary.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate))},azd.prototype.onLoadError=function(t){AssetLibrary.removeEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.removeEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.removeEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),console.log("load error in loadMovie",t)},azd.prototype.load=function(t,e){return this._url=t,this.result=new PromiseWrapper,AssetLibrary.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),AssetLibrary.addEventListener(LoaderEvent.LOADER_COMPLETE,this._onLoaderCompleteDelegate),AssetLibrary.addEventListener(URLLoaderEvent.LOAD_ERROR,this._onLoadErrorDelegate),AssetLibrary.load(new URLRequest(t),null,t,new SWFParser(AVM1Globals._scenegraphFactory)),this.result.promise},azd),Jxd;function azd(t){var e=this;this.result=new PromiseWrapper,this._context=t,this._onAssetCompleteDelegate=function(t){return e.onAssetComplete(t)},this._onLoaderCompleteDelegate=function(t){return e.onLoaderComplete(t)},this._onLoadErrorDelegate=function(t){return e.onLoadError(t)},this._loader=new Loader}function Kxd(){var t=null!==Jxd&&Jxd.apply(this,arguments)||this;return t._prevTextVarContent="",t._textVarHolder=null,t._textVarPropName="",t}function convertAS3RectangeToBounds(t,e){var i=alNewObject(e);return i.alPut("xMin",t.left),i.alPut("yMin",t.top),i.alPut("xMax",t.right),i.alPut("yMax",t.bottom),i}var AVM1MovieClip=(pzd=AVM1SymbolBase,__extends(qzd,pzd),qzd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,qzd,[],["$version#","_alpha#","getAwayJSID","attachAudio","attachBitmap","attachMovie","beginFill","beginBitmapFill","beginGradientFill","blendMode#","cacheAsBitmap#","_callFrame","clear","createEmptyMovieClip","createTextField","_currentframe#","curveTo","_droptarget#","duplicateMovieClip","enabled#","endFill","filters#","_framesloaded#","_focusrect#","forceSmoothing#","getBounds","getBytesLoaded","getBytesTotal","getDepth","getInstanceAtDepth","getNextHighestDepth","getRect","getSWFVersion","getTextSnapshot","getURL","globalToLocal","gotoAndPlay","gotoAndStop","_height#","_highquality#","hitArea#","hitTest","lineGradientStyle","lineStyle","lineTo","loadMovie","loadVariables","localToGlobal","_lockroot#","menu#","moveTo","_name#","nextFrame","opaqueBackground#","_parent#","play","prevFrame","_quality#","removeMovieClip","_root#","_rotation#","scale9Grid#","scrollRect#","setMask","_soundbuftime#","startDrag","stop","stopDrag","swapDepths","tabChildren#","tabEnabled#","tabIndex#","_target#","_totalframes#","trackAsMenu#","transform#","toString","unloadMovie","_url#","useHandCursor#","_visible#","_width#","_x#","_xmouse#","_xscale#","_y#","_ymouse#","_yscale#"])},qzd.prototype._updateMouseEnabled=function(t,e){this.adaptee.isAVMScene||t.isMouse&&(e?(this._mouseListenerCount++,this.adaptee.mouseEnabled=!0,this.adaptee.mouseChildren=!1,t.isButton&&(this._mouseButtonListenerCount++,this.adaptee.buttonMode=!0)):(this._mouseListenerCount--,this._mouseListenerCount<=0&&(this._mouseListenerCount=0,this.adaptee.mouseEnabled=!1,this.adaptee.mouseChildren=!0),t.isButton&&(this._mouseButtonListenerCount--,this._mouseButtonListenerCount<=0&&(this._mouseButtonListenerCount=0,this.adaptee.buttonMode=!1)))),this.enabled||(this.adaptee.mouseChildren=!1)},qzd.prototype.clone=function(){var t,e,i=getAVM1Object(this.adaptee.clone(),this._avm1Context);return"piratefont"==this.adaptee.name&&((e=t=i.adaptee.timeline).frame_command_indices=[t.frame_command_indices[0]],e.frame_recipe=[t.frame_recipe[0]],e.keyframe_constructframes=[t.keyframe_constructframes[0]],e.keyframe_durations=[t.keyframe_durations[0]],e.keyframe_firstframes=[t.keyframe_firstframes[0]],e.keyframe_indices=[t.keyframe_indices[0]]),this.adaptee.cloneForEveryInstance=!0,i.adaptee.cloneForEveryInstance=!0,i},qzd.prototype.attachCustomConstructor=function(){var t,e;!this.adaptee||(t=this.adaptee.avm1Symbol)&&(this.alPut("__proto__",t._ownProperties.prototype.value),(e=this).executeConstructor=function(){t.alCall(e),e.updateAllEvents()})},qzd.prototype.compareAVM1FrameScripts=function(t,e){if(!t.precedence)return e.precedence?-1:0;if(!e.precedence)return 1;for(var i=0;i<t.precedence.length&&i<e.precedence.length&&t.precedence[i]===e.precedence[i];)i++;return i>=t.precedence.length?t.precedence.length===e.precedence.length?0:-1:i>=e.precedence.length?1:t.precedence[i]-e.precedence[i]},qzd.prototype.executeScript=function(t){if("number"==typeof t&&(t=this.adaptee.timeline.get_script_for_frame(this.adaptee,this.adaptee.currentFrameIndex)),qzd.currentMCAssetNameSpace=this.adaptee.assetNamespace,AVM1TextField.syncQueedTextfields(),t){if(this.adaptee.parent){for(var e=[],i=0;i<t.length;i++){var n=t[i],r=function(t){this._avm1Context.executeActions(t,this)}.bind(this,n.data);r.precedence=this.adaptee.getScriptPrecedence().concat(n.precedence),r.context=this.adaptee,e.push(r)}if(e.length){e.sort(this.compareAVM1FrameScripts);for(var o=e,i=0;i<o.length;i++){var s=o[i],a=s.context;s.call(a)}}}}else{var l=this.adaptee.name.replace(/[^\w]/g,"");window.alert("actionsBlocks is empty, can not execute framescript"+l+this.adaptee.currentFrameIndex)}},qzd.prototype.addScript=function(t,e){for(var i=t,n=[],r=0;r<i.length;r++){var o=i[r];if(Array.isArray(o))for(var s=0;s<o.length;s++){var a=o[s];"string"!=typeof(l=this.adaptee.name)&&(l=l.toString()),a.data=this._avm1Context.actionsDataFactory.createActionsData(a,"script_"+l.replace(/[^\w]/g,"")+"_"+this.adaptee.id+"_frame_"+e+"_idx_"+r),n[n.length]=a}else{var l,a=o;"string"!=typeof(l=this.adaptee.name)&&(l=l.toString()),a.data=this._avm1Context.actionsDataFactory.createActionsData(a,"script_"+l.replace(/[^\w]/g,"")+"_"+this.adaptee.id+"_frame_"+e+"_idx_"+r),n[n.length]=a}}return n},qzd.prototype.stopAllSounds=function(){for(var t,e=this.alGetKeys(),i=0;i<e.length;i++){var n=this.alGetProperty(e[i]),r=n?n.value:null;r&&r._sound&&r._sound.isAsset&&r._sound.isAsset(WaveAudio)&&r.stop()}for(i=this.adaptee.numChildren;0<i;)i--,(t=this.adaptee.getChildAt(i)).isAsset(MovieClip)&&t.adapter!=t&&t.adapter.freeFromScript()},qzd.prototype.freeFromScript=function(){this.hasSwappedDepth=!1,pzd.prototype.freeFromScript.call(this),this._mouseButtonListenerCount=0},qzd.prototype.initAdapter=function(){for(var t in this._dropTarget="",this._mouseButtonListenerCount=0,qzd.currentMCAssetNameSpace=this.adaptee.assetNamespace,this.adaptee.timeline.avm1InitActions)this.executeScript(this.addScript(this.adaptee.timeline.avm1InitActions[t],"initActionsData"+t));this.initEvents&&initializeAVM1Object(this.adaptee,this._avm1Context,this.initEvents),this.attachCustomConstructor(),this.initialDepth=this.adaptee._depthID,(this.adaptee.onLoaded||this.adaptee.onConstruct||this.executeConstructor)&&FrameScriptManager.add_loaded_action_to_queue(this.adaptee)},qzd.prototype.registerScriptObject=function(t,e){void 0===e&&(e=!0),t.adapter!=t&&t.adapter.setEnabled(!0);var i=t.name;if(i){this.context.swfVersion<8&&(i=i.toLowerCase());var n=this.alHasOwnProperty(i);if(e&&n){if(!this.alGetOwnProperty(i).isTextVar)return;this.alPut(i,getAVM1Object(t,this.context))}(!this._childrenByName[i]||this._childrenByName[i].adaptee&&null==this._childrenByName[i].adaptee.parent||this._childrenByName[i].adaptee&&this._childrenByName[i].adaptee._depthID>t._depthID)&&(this._childrenByName[i]=getAVM1Object(t,this.context),e||this.alPut(i,this._childrenByName[i]))}},qzd.prototype.unregisterScriptObject=function(t){var e=t.name;if(e&&(this.context.swfVersion<8&&(e=e.toLowerCase()),this.context.swfVersion<8&&this.alDeleteOwnProperty(e),this._childrenByName[e]&&this._childrenByName[e].adaptee.id==t.id)){for(var i=this.adaptee._children,n=i.length,r=null,o=null,s=0;s<n;s++)(r=i[s])!=t&&r.name&&r.name.toLowerCase()==e&&(!o||o._depthID>r._depthID)&&(o=r);o?this._childrenByName[e]=getAVM1Object(o,this.context):delete this._childrenByName[e]}},qzd.prototype.getLatestObjectForName=function(t){if(!this.alHasOwnProperty(t)){for(var e=this.adaptee._children,i=e.length,n=null,r=null,o=0;o<i;o++)(n=e[o]).name&&n.name.toLowerCase()==t&&(!r||r._depthID>n._depthID)&&(r=n);r&&(this._childrenByName[t]=getAVM1Object(r,this.context),this.unregisteredColors[t]&&(this.unregisteredColors[t].changeTarget(r.adapter),this.unregisteredColors[t]=null))}},Object.defineProperty(qzd.prototype,"graphics",{get:function(){return this.adaptee.graphics},enumerable:!0,configurable:!0}),qzd.prototype.initAVM1SymbolInstance=function(t,e){var i=this;this._childrenByName=Object.create(null),pzd.prototype.initAVM1SymbolInstance.call(this,t,e),this.dragListenerDelegate=function(t){return i.dragListener(t)},this.stopDragDelegate=function(t){return i.stopDrag(t)},this.dynamicallyCreated=!1,this.adaptee=e,this._initEventsHandlers()},qzd.prototype._lookupChildByName=function(t){return this._childrenByName[t]},qzd.prototype._lookupChildInAS3Object=function(t){return this.context.isPropertyCaseSensitive,getAVM1Object(this.adaptee.getChildByName(t),this.context)},Object.defineProperty(qzd.prototype,"__targetPath",{get:function(){var t=this.get_target(),e=this.adaptee.root,i="_level"+this.context.levelsContainer._getLevelForRoot(e);return"/"!=t?i+t.replace(/\//g,"."):i},enumerable:!0,configurable:!0}),qzd.prototype.getAwayJSID=function(){return this.adaptee.id},qzd.prototype.attachAudio=function(t){isNullOrUndefined$1(t)},qzd.prototype.attachBitmap=function(t,e,i,n){void 0===i&&(i="auto"),void 0===n&&(n=!1),i=alCoerceString(this.context,i),n=alToBoolean(this.context,n);var r=t.as3BitmapData;r.transparent=!0;var o=new MethodMaterial(r);o.alphaBlending=!0,o.useColorTransform=!0;var s=new Billboard(o,i,n);this._insertChildAtDepth(s,e)},qzd.prototype._constructMovieClipSymbol=function(t,e){t=alToString(this.context,t),e=alToString(this.context,e);var i,n=AssetLibrary.getAsset(t,this.adaptee.assetNamespace);if(n)return(i=n.adaptee.clone()).name=e,getAVM1Object(i,this._avm1Context),i},qzd.prototype.get$version=function(){return""},qzd.prototype.rgbaToArgb=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},qzd.prototype.attachMovie=function(t,e,i,n){if(this._constructMovieClipSymbol){e&&alIsArray(this.context,e)&&(e=e.value[0]);var r,o=this._constructMovieClipSymbol(t,e);if(o){o.name||(o.name=""),i=alToNumber(this.context,i),e&&(r=this._childrenByName[e.toLowerCase()]),o.reset();var s=this._insertChildAtDepth(o,avm2AwayDepth(i));return n&&s._init(n),r&&r.avmColor&&r.avmColor.changeTarget(s),o.timeline&&o.timeline.isButton&&o.addButtonListeners(),s.dynamicallyCreated=!0,e&&this.registerScriptObject(o,!0),s}}},qzd.prototype.beginFill=function(t,e){t=alToInt32(this.context,t),void 0===e&&(2==arguments.length?e=0:arguments.length<=1&&(e=100)),e=alToNumber(this.context,e),this.graphics.beginFill(t,e/100)},qzd.prototype.beginBitmapFill=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=!1),void 0===n&&(n=!1),alInstanceOf(this.context,t,this.context.globals.BitmapData)&&(toAS3BitmapData(t),isNullOrUndefined$1(e)||toAS3Matrix(e),i=alToBoolean(this.context,i),n=alToBoolean(this.context,n))},qzd.prototype.beginGradientFill=function(t,e,i,n,r,o,s,a){var l=this;void 0===o&&(o="pad"),void 0===s&&(s="rgb"),void 0===a&&(a=0),this.context;var c=AVM1ArrayNative.mapToJSArray(e,function(t){return alToInt32(l.context,t)}),h=AVM1ArrayNative.mapToJSArray(i,function(t){return alToNumber(l.context,t)/100}),u=AVM1ArrayNative.mapToJSArray(n,function(t){return alToNumber(l.context,t)});o=alToString(this.context,o),s=alToString(this.context,s),a=alToNumber(this.context,a),this.graphics.beginGradientFill(t,c,h,u,null,o,s,a)},qzd.prototype._callFrame=function(t){var e;"string"==typeof t?e=this.adaptee.timeline.getScriptForLabel(this.adaptee,t):"number"==typeof t&&(e=this.adaptee.timeline.get_script_for_frame(this.adaptee,t-1)),e&&this.executeScript(e)},qzd.prototype.clear=function(){this.graphics.clear()},qzd.prototype._insertChildAtDepth=function(t,e){return this.adaptee.addChildAtDepth(t,e),getAVM1Object(t,this._avm1Context)},qzd.prototype._updateChildName=function(t,e,i){e&&this._removeChildName(t,e),i&&this._addChildName(t,i)},qzd.prototype._removeChildName=function(t,e){var i;this.context.isPropertyCaseSensitive||(e=e.toLowerCase()),this._childrenByName&&this._childrenByName[e]&&this._childrenByName[e]===t&&((i=this._lookupChildInAS3Object(e))?this._childrenByName[e]=i:delete this._childrenByName[e])},qzd.prototype._addChildName=function(t,e){this.context.isPropertyCaseSensitive||(e=e.toLowerCase());var i=this._childrenByName[e];(!i||i.getDepth()>t.getDepth())&&(this._childrenByName[e]=t)},qzd.prototype.createEmptyMovieClip=function(t,e){t=alToString(this.context,t);var i=new MovieClip;i.name=t,i.assetNamespace=this.adaptee.assetNamespace,getAVM1Object(i,this._avm1Context);var n=this._insertChildAtDepth(i,avm2AwayDepth(e));return n.dynamicallyCreated=!0,this.registerScriptObject(i,!1),i.mouseEnabled=!1,n},qzd.prototype.createTextField=function(t,e,i,n,r,o){t=alToString(this.context,t);var s=new TextField;s.name=t,s.textFormat=new TextFormat,getAVM1Object(s,this._avm1Context);var a=this._insertChildAtDepth(s,avm2AwayDepth(e));return this.registerScriptObject(s,!1),s.x=i,s.y=n,s.width=r,s.height=o,a.dynamicallyCreated=!0,a},qzd.prototype.get_currentframe=function(){return this.adaptee.currentFrameIndex+1},qzd.prototype.curveTo=function(t,e,i,n){t=alToNumber(this.context,t),e=alToNumber(this.context,e),i=alToNumber(this.context,i),n=alToNumber(this.context,n),this.graphics.curveTo(t,e,i,n)},qzd.prototype.setDropTarget=function(t){if(t){for(var e=[];t;)t=t.isAVMScene?null:(null!=t.name&&e.push(t.name),t.parent);for(var i=e.length,n="";0<i;)""!=e[--i]&&(n+="/"),n+=e[i];this._dropTarget=n}else this._dropTarget=""},qzd.prototype.get_droptarget=function(){return this._dropTarget},qzd.prototype.duplicateMovieClip=function(t,e,i){if((t=alToString(this.context,t))==this.adaptee.name)return this;var n,r=(r=this.get_parent())||this.context.resolveTarget(null);this.adaptee._symbol||(n=this.clone().adaptee),n.reset(),n.name=t,n.adapter.placeObjectTag=this.placeObjectTag,n.adapter.initEvents=this.initEvents;var o=r._insertChildAtDepth(n,avm2AwayDepth(e));o.dynamicallyCreated=!0,o._avm1Context=this._avm1Context,r.registerScriptObject(n,!1);var s=n.transform.matrix3D,a=this.adaptee.transform.matrix3D._rawData;return s._rawData[0]=a[0],s._rawData[1]=a[1],s._rawData[4]=a[4],s._rawData[5]=a[5],s._rawData[12]=a[12],s._rawData[13]=a[13],n.transform.invalidateComponents(),n.alpha=this.adaptee.alpha,n.blendMode=this.adaptee.blendMode,n.cacheAsBitmap=this.adaptee.cacheAsBitmap,i&&o._init(i),o},qzd.prototype.endFill=function(){this.graphics.endFill()},qzd.prototype.getForceSmoothing=function(){return!1},qzd.prototype.setForceSmoothing=function(t){t=alToBoolean(this.context,t)},qzd.prototype.get_framesloaded=function(){return 0},qzd.prototype.getBounds=function(t){var e=getAwayJSAdaptee(t);if(e)return convertAS3RectangeToBounds(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view).getBoundsPicker(this.adaptee.partition).getBoxBounds(e,!0),this.context)},qzd.prototype.getBytesLoaded=function(){return 0<=this.adaptee.currentFrameIndex?100:-1},qzd.prototype.getBytesTotal=function(){return 100},qzd.prototype.getInstanceAtDepth=function(t){var e=this.adaptee.getChildAtDepth(avm2AwayDepth(t));return e?e.isAsset(Billboard)||e.isAsset(MovieClip)?this:getAVM1Object(e,this.context):null},qzd.prototype.getNextHighestDepth=function(){return this.context.swfVersion<7?0:away2avmDepth(this.adaptee.getNextHighestDepth())},qzd.prototype.getRect=function(t){var e=getAwayJSAdaptee(t);if(e)return convertAS3RectangeToBounds(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view).getBoundsPicker(this.adaptee.partition).getBoxBounds(e),this.context)},qzd.prototype.getSWFVersion=function(){return 0},qzd.prototype.getTextSnapshot=function(){},qzd.prototype.getURL=function(t,e,i){0!==(t=String(t)).toLowerCase().indexOf("fscommand:")?window.open(t,e):console.log("fsCommand not implemented ")},qzd.prototype.globalToLocal=function(t){var e;t&&(e=toAS3Point(t),this.adaptee.transform.globalToLocal(e,e),copyAS3PointTo(e,t))},qzd.prototype.gotoAndPlay=function(t){if(!this.protoTypeChanged&&null!=t){if(Array.isArray(t)){if(0==t.length)return;t=t[0]}if(t instanceof AVM1ArrayNative){if(!t.value||0==t.value.length)return;t=t.value[0]}if("string"==typeof t){var e=9<this.context.swfVersion?t:t.toLowerCase();if(null==this.adaptee.timeline._labels[e])return t=parseInt(t),void(isNaN(t)||(this.adaptee.currentFrameIndex=t-1,this.adaptee.play()))}"number"==typeof t&&t<=0||(this.adaptee.play(),this._gotoFrame(t))}},qzd.prototype.gotoAndStop=function(t){if(!this.protoTypeChanged&&null!=t){if(Array.isArray(t)){if(0==t.length)return;t=t[0]}if(t instanceof AVM1ArrayNative){if(!t.value||0==t.value.length)return;t=t.value[0]}"number"==typeof t&&t<=0||(this.adaptee.stop(),this._gotoFrame(t))}},qzd.prototype._gotoFrame=function(t){if("number"==typeof t&&t%1!=0&&(t=t.toString()),"string"==typeof t){var e=9<this.context.swfVersion?t:t.toLowerCase();if(null==this.adaptee.timeline._labels[e])return t=parseInt(t),void(isNaN(t)||(this.adaptee.currentFrameIndex=t-1));this.adaptee.jumpToLabel(e)}else this.adaptee.currentFrameIndex=t-1},qzd.prototype.getHitArea=function(){return this._hitArea},qzd.prototype.setHitArea=function(t){var e=(this._hitArea=t)?getAwayJSAdaptee(t):null;e&&!e.isAsset(MovieClip)&&(e=null)},qzd.prototype.hitTest=function(t,e,i){if(arguments.length<=1){var n=arguments[0];return"string"==typeof n&&(n=this.context.resolveTarget(n)),!(isNullOrUndefined$1(n)||!hasAwayJSAdaptee(n))&&PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view).getBoundsPicker(this.adaptee.partition).hitTestObject(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view).getBoundsPicker(getAwayJSAdaptee(n).partition))}t=alToNumber(this.context,t),e=alToNumber(this.context,e);var r=this.get_root();return r?(t+=r.get_x(),e+=r.get_y(),i=alToBoolean(this.context,i),PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view).getBoundsPicker(this.adaptee.partition).hitTestPoint(t,e,i)):(console.warn("[AVM1MovieClip:: hitTest] Root return undef! Return false to prevent crash!"),!1)},qzd.prototype.lineGradientStyle=function(t,e,i,n,r,o,s,a){var l=this;void 0===o&&(o="pad"),void 0===s&&(s="rgb"),void 0===a&&(a=0),this.context;var c=AVM1ArrayNative.mapToJSArray(e,function(t){return alToInt32(l.context,t)}),h=AVM1ArrayNative.mapToJSArray(i,function(t){return alToNumber(l.context,t)/100}),u=AVM1ArrayNative.mapToJSArray(n,function(t){return alToNumber(l.context,t)});o=alToString(this.context,o),s=alToString(this.context,s),a=alToNumber(this.context,a),this.graphics.lineGradientStyle(t,c,h,u,null,o,s,a)},qzd.prototype.lineStyle=function(t,e,i,n,r,o,s,a){void 0===t&&(t=NaN),void 0===e&&(e=0),void 0===i&&(i=100),void 0===n&&(n=!1),void 0===r&&(r="normal"),void 0===o&&(o="round"),void 0===s&&(s="round"),void 0===a&&(a=3),t=alToNumber(this.context,t),e=alToInt32(this.context,e),n=alToBoolean(this.context,n),r=alToString(this.context,r);var l=qzd.capStyleMapStringToInt[alToString(this.context,o)],c=qzd.jointStyleMapStringToInt[alToString(this.context,s)];a=alToNumber(this.context,a),this.graphics.lineStyle(t,e,i/100,n,qzd.noScaleDictionary[r],l,c,a)},qzd.prototype.lineTo=function(t,e){t=toTwipFloor(alToNumber(this.context,t)),e=toTwipFloor(alToNumber(this.context,e)),this.graphics.lineTo(t,e)},qzd.prototype.loadMovie=function(t,e){var i=new AVM1LoaderHelper(this.context);i.load(t,e).then(function(){null!=i.content&&(this.adaptee.timeline=i.content.timeline,this.adaptee.assetNamespace=i.content.assetNamespace,this.adaptee.reset(!0))}.bind(this))},qzd.prototype.loadVariables=function(t,e){this.context.actions._loadVariables(this,t,e)},qzd.prototype.localToGlobal=function(t){var e;t&&(e=toAS3Point(t),this.adaptee.transform.localToGlobal(e,e),copyAS3PointTo(e,t))},qzd.prototype.get_lockroot=function(){return this._lockroot},qzd.prototype.set_lockroot=function(t){this._lockroot=alToBoolean(this.context,t)},qzd.prototype.moveTo=function(t,e){t=toTwipFloor(alToNumber(this.context,t)),e=toTwipFloor(alToNumber(this.context,e)),this.graphics.moveTo(t,e)},qzd.prototype.nextFrame=function(){this.adaptee.stop(),++this.adaptee.currentFrameIndex},qzd.prototype.nextScene=function(){},qzd.prototype.play=function(){this.adaptee.play()},qzd.prototype.prevFrame=function(){this.adaptee.stop(),--this.adaptee.currentFrameIndex},qzd.prototype.prevScene=function(){},qzd.prototype.setMask=function(t){var e;null!=t?(e=this.context.resolveTarget(t))&&(this.adaptee.mask=getAwayJSAdaptee(e)):this.adaptee.mask=null},qzd.prototype.startDrag=function(t,e,i,n,r){var o;qzd.currentDraggedMC&&qzd.currentDraggedMC!=this&&qzd.currentDraggedMC.stopDrag(),t=alToBoolean((qzd.currentDraggedMC=this).context,t),this._dragBounds=null,n<e&&(o=n,n=e,e=o),r<i&&(o=r,r=i,i=o),1<arguments.length&&(e=alToNumber(this.context,e),i=alToNumber(this.context,i),n=alToNumber(this.context,n),r=alToNumber(this.context,r),this._dragBounds=new Rectangle(e,i,n-e,r-i)),this.isDragging||(this.isDragging=!0,this.startDragPoint=this.adaptee.parent.transform.globalToLocal(new Point(this.context.globals.Stage.avmStage.mouseX,this.context.globals.Stage.avmStage.mouseY)),t&&(this.adaptee.x=this.startDragPoint.x,this.adaptee.y=this.startDragPoint.y),this._dragBounds&&this.checkBounds(),this.startDragMCPosition.x=this.adaptee.x,this.startDragMCPosition.y=this.adaptee.y,AVM1Stage.avmStage.addEventListener("mouseMove3d",this.dragListenerDelegate),AVM1Stage.avmStage.scene.mousePicker.dragEntity=this.adaptee,MouseManager.getInstance(AVM1Stage.avmStage.scene.renderer.renderGroup.pickGroup).startDragObject(this.adaptee))},qzd.prototype.dragListener=function(t){var e;this.adaptee.parent&&(e=this.adaptee.parent.transform.globalToLocal(new Point(this.context.globals.Stage.avmStage.mouseX,this.context.globals.Stage.avmStage.mouseY)),this.adaptee.x=this.startDragMCPosition.x+(e.x-this.startDragPoint.x),this.adaptee.y=this.startDragMCPosition.y+(e.y-this.startDragPoint.y),this._dragBounds&&this.checkBounds())},qzd.prototype.checkBounds=function(){this.adaptee.x<this._dragBounds.left&&(this.adaptee.x=this._dragBounds.left),this.adaptee.x>this._dragBounds.right&&(this.adaptee.x=this._dragBounds.right),this.adaptee.y<this._dragBounds.top&&(this.adaptee.y=this._dragBounds.top),this.adaptee.y>this._dragBounds.bottom&&(this.adaptee.y=this._dragBounds.bottom)},qzd.prototype.stop=function(){return this.adaptee.stop()},qzd.prototype.stopDrag=function(t){qzd.currentDraggedMC&&qzd.currentDraggedMC!=this&&qzd.currentDraggedMC.stopDrag(),this.isDragging=!1,qzd.currentDraggedMC=null,AVM1Stage.avmStage.scene.mousePicker.dragEntity=null,MouseManager.getInstance(AVM1Stage.avmStage.scene.renderer.renderGroup.pickGroup).stopDragObject(),AVM1Stage.avmStage.removeEventListener("mouseMove3d",this.dragListenerDelegate),window.removeEventListener("mouseup",this.stopDragDelegate),window.removeEventListener("touchend",this.stopDragDelegate)},qzd.prototype.swapDepths=function(t){var e;this.adaptee.isAVMScene||!this.get_parent()||(e=getAwayJSAdaptee(this.get_parent()))&&void 0!==t&&("number"==typeof t?e.swapDepths(this.adaptee,avm2AwayDepth(t)):t.adaptee&&(t._blockedByScript=!0,t._ctBlockedByScript=!0,e.swapChildren(this.adaptee,t.adaptee)),this._blockedByScript=!0,this._ctBlockedByScript=!0,this.adaptee._depthID==this.initialDepth?this.hasSwappedDepth=!1:this.hasSwappedDepth=!0,this.adaptee.name&&e&&e.adapter&&e.adapter.getLatestObjectForName(this.adaptee.name.toLowerCase()))},qzd.prototype.getTabChildren=function(){return getAwayObjectOrTemplate(this).tabChildren},qzd.prototype.setTabChildren=function(t){getAwayObjectOrTemplate(this).tabChildren=alToBoolean(this.context,t)},qzd.prototype.get_totalframes=function(){return this.adaptee.numFrames},qzd.prototype.getTrackAsMenu=function(){return getAwayObjectOrTemplate(this).trackAsMenu},qzd.prototype.setTrackAsMenu=function(t){getAwayObjectOrTemplate(this).trackAsMenu=alToBoolean(this.context,t)},qzd.prototype.unloadMovie=function(){var t=this.adaptee;this.adaptee.constructedKeyFrameIndex=0,this.adaptee.stop(),t.removeChildren(0,t.numChildren),(this.dynamicallyCreated||this.hasSwappedDepth)&&t.parent&&t.parent.adapter&&t.parent.adapter.unregisterScriptObject(t)},qzd.prototype.getUseHandCursor=function(){return this.adaptee.useHandCursor},qzd.prototype.setUseHandCursor=function(t){this.adaptee&&(this.adaptee.useHandCursor=t)},qzd.prototype.setParameters=function(t){for(var e in t)this.alHasProperty(e)||this.alPut(e,t[e])},qzd.prototype._resolveLevelNProperty=function(t){if("_level0"===t||"_level"===t)return this.context.resolveRoot();if("_root"===t)return this.context.resolveRoot();if(0===t.indexOf("_level")){var e=t.substring(6),i=0|e;if(0<i&&e==i)return this.context.resolveLevel(i)}return null},qzd.prototype._getCachedPropertyResult=function(t){return this._cachedPropertyResult?this._cachedPropertyResult.value=t:this._cachedPropertyResult={flags:65,value:t},this._cachedPropertyResult},qzd.prototype.alGetOwnProperty=function(t){var e=pzd.prototype.alGetOwnProperty.call(this,t);if(e)return e;if("_"===t[0])if("l"===t[1]&&0===t.indexOf("_level")||"r"===t[1]&&0===t.indexOf("_root")){var i=this._resolveLevelNProperty(t);if(i)return this._getCachedPropertyResult(i)}else if(t.toLowerCase()in MovieClipProperties)return pzd.prototype.alGetOwnProperty.call(this,t.toLowerCase());if(hasAwayJSAdaptee(this)){var n=this._lookupChildByName(t);if(n)return this._getCachedPropertyResult(n)}},qzd.prototype.alGetOwnPropertiesKeys=function(){var t=pzd.prototype.alGetOwnPropertiesKeys.call(this);if(!hasAwayJSAdaptee(this))return t;var e=this.adaptee;if(0===e._children.length)return t;for(var i=Object.create(null),n=t.length,r=0,r=0;r<n;r++)i[t[r]]=!0;var o=e._children.length;for(r=0;r<o;r++)i[e._children[r].name]=!0;return Object.getOwnPropertyNames(i)},qzd.prototype._init=function(e){var i=this;e instanceof AVM1Object&&alForEachProperty(e,function(t){i.alPut(t,e.alGet(t))},null)},qzd.prototype._initEventsHandlers=function(){this.bindEvents(EventsListForMC)},qzd.currentMCAssetNameSpace="",qzd.currentDraggedMC=null,qzd.pokiSDKonStopActionChildName=null,qzd.pokiSDKonStopAction=null,qzd.capStyleMapStringToInt={none:0,round:1,square:2},qzd.jointStyleMapStringToInt={round:0,bevel:1,miter:2},qzd.noScaleDictionary={normal:LineScaleMode.NORMAL,none:LineScaleMode.NONE,vertical:LineScaleMode.VERTICAL,horizontal:LineScaleMode.HORIZONTAL},qzd),pzd;function qzd(){var t=null!==pzd&&pzd.apply(this,arguments)||this;return t.onLoaded=null,t.executeConstructor=null,t.unregisteredColors={},t.isDragging=!1,t.startDragPoint=new Point,t.startDragMCPosition=new Point,t}function _updateAllSymbolEvents(t){hasAwayJSAdaptee(t)&&t.updateAllEvents()}var AVM1Broadcaster=(TDd=AVM1Object,__extends(UDd,TDd),UDd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,UDd,["initialize"],[])},UDd.initialize=function(n,t){var e=new AVM1PropertyDescriptor(65,new AVM1ArrayNative(n,[]));t.alSetOwnProperty("_listeners",e),e=new AVM1PropertyDescriptor(65,new AVM1NativeFunction(n,function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];this.alGet("_listeners")instanceof AVM1ArrayNative&&avm1BroadcastEvent(n,this,t,e)})),t.alSetOwnProperty("broadcastMessage",e),e=new AVM1PropertyDescriptor(65,new AVM1NativeFunction(n,function(t){var e=this.alGet("_listeners");return e instanceof AVM1ArrayNative&&(e.value.push(t),_updateAllSymbolEvents(this),!0)})),t.alSetOwnProperty("addListener",e),e=new AVM1PropertyDescriptor(65,new AVM1NativeFunction(n,function(t){var e=this.alGet("_listeners");if(!(e instanceof AVM1ArrayNative))return!1;var i=e.value,n=i.indexOf(t);return!(n<0||(i.splice(n,1),_updateAllSymbolEvents(this),0))})),t.alSetOwnProperty("removeListener",e)},UDd),capabilitiesProperties=["avHardwareDisable","hasAccessibility","hasAudio","hasAudioEncoder","hasEmbeddedVideo","hasIME","hasMP3","hasPrinting","hasScreenBroadcast","hasScreenPlayback","hasStreamingAudio","hasStreamingVideo","hasVideoEncoder","isDebugger","language","localFileReadDisable","manufacturer","os","pixelAspectRatio","playerType","screenColor","screenDPI","screenResolutionX","screenResolutionY","serverString","version"],AVM1Capabilities=(hEd=AVM1Object,__extends(iEd,hEd),iEd),AVM1Security=(nEd=AVM1Object,__extends(oEd,nEd),oEd.prototype.getSandboxType=function(){return null},oEd.prototype.allowDomain=function(t){t=alCoerceString(this.context,t)},oEd.prototype.allowInsecureDomain=function(t){t=alCoerceString(this.context,t)},oEd.prototype.loadPolicyFile=function(t){t=alCoerceString(this.context,t)},oEd),AVM1System=(uEd=AVM1Object,__extends(vEd,uEd),vEd.alInitStatic=function(t){this._capabilities=new AVM1Capabilities(t),this._security=new AVM1Security(t)},vEd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!1,vEd,["capabilities#","security#"],[])},vEd.getCapabilities=function(t){return t.getStaticState(vEd)._capabilities},vEd.getSecurity=function(t){return t.getStaticState(vEd)._security},vEd),StateTransitions,uEd,nEd,hEd,TDd,AEd;function vEd(){return null!==uEd&&uEd.apply(this,arguments)||this}function oEd(t){var e=nEd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{sandboxType:{get:e.getSandboxType},allowDomain:{value:e.allowDomain},allowInsecureDomain:{value:e.allowInsecureDomain},loadPolicyFile:{value:e.loadPolicyFile}}),e}function iEd(t){var e=hEd.call(this,t)||this;e.alPrototype=t.builtins.Object.alGetPrototypeProperty();var i=null;return capabilitiesProperties.forEach(function(t){i=new AVM1PropertyDescriptor(131,null,{alCall:function(){return null}}),e.alSetOwnProperty(t,i)},e),e}function UDd(){return null!==TDd&&TDd.apply(this,arguments)||this}AEd=StateTransitions=StateTransitions||{},AEd[AEd.IdleToOverUp=1]="IdleToOverUp",AEd[AEd.OverUpToIdle=2]="OverUpToIdle",AEd[AEd.OverUpToOverDown=4]="OverUpToOverDown",AEd[AEd.OverDownToOverUp=8]="OverDownToOverUp",AEd[AEd.OverDownToOutDown=16]="OverDownToOutDown",AEd[AEd.OutDownToOverDown=32]="OutDownToOverDown",AEd[AEd.OutDownToIdle=64]="OutDownToIdle",AEd[AEd.IdleToOverDown=128]="IdleToOverDown",AEd[AEd.OverDownToIdle=256]="OverDownToIdle";var AVM1KeyCodeMap$1=[-1,37,39,36,35,45,46,-1,8,-1,-1,-1,-1,13,38,40,33,34,9,27],buttonActionsMap={1:ClipEventMappings[8192],2:ClipEventMappings[16384],4:ClipEventMappings[1024],8:ClipEventMappings[2048],64:ClipEventMappings[4096],160:ClipEventMappings[32768],272:ClipEventMappings[65536]},AVM1Button=(BEd=AVM1MovieClip,__extends(CEd,BEd),CEd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,CEd,[],["$version#","_alpha#","getAwayJSID","attachAudio","attachBitmap","attachMovie","beginFill","beginBitmapFill","beginGradientFill","blendMode#","cacheAsBitmap#","_callFrame","clear","createEmptyMovieClip","createTextField","_currentframe#","curveTo","_droptarget#","duplicateMovieClip","enabled#","endFill","filters#","_framesloaded#","_focusrect#","forceSmoothing#","getBounds","getBytesLoaded","getBytesTotal","getDepth","getInstanceAtDepth","getNextHighestDepth","getRect","getSWFVersion","getTextSnapshot","getURL","globalToLocal","gotoAndPlay","gotoAndStop","_height#","_highquality#","hitArea#","hitTest","lineGradientStyle","lineStyle","lineTo","loadMovie","loadVariables","localToGlobal","_lockroot#","menu#","moveTo","_name#","nextFrame","opaqueBackground#","_parent#","play","prevFrame","_quality#","removeMovieClip","_root#","_rotation#","scale9Grid#","scrollRect#","setMask","_soundbuftime#","startDrag","stop","stopDrag","swapDepths","tabChildren#","tabEnabled#","tabIndex#","_target#","_totalframes#","trackAsMenu#","toString","unloadMovie","_url#","useHandCursor#","_visible#","_width#","_x#","_xmouse#","_xscale#","_y#","_ymouse#","_yscale#"])},CEd.prototype._updateMouseEnabled=function(t,e){this.adaptee.isAVMScene||t.isMouse&&(e?(this._mouseListenerCount++,this.adaptee.mouseEnabled=!0,this.adaptee.mouseChildren=!1,t.isButton&&(this._mouseButtonListenerCount++,this.adaptee.buttonMode=!0)):(this._mouseListenerCount--,this._mouseListenerCount<=0&&(this._mouseListenerCount=0,this.adaptee.mouseEnabled=!1,this.adaptee.mouseChildren=!1),t.isButton&&(this._mouseButtonListenerCount--,this._mouseButtonListenerCount<=0&&(this._mouseButtonListenerCount=0,this.adaptee.buttonMode=!1))))},CEd.prototype.initAVM1SymbolInstance=function(t,e){BEd.prototype.initAVM1SymbolInstance.call(this,t,e);for(var i=this.adaptee,n=this._requiredListeners=Object.create(null),r=this._actions=i.timeline.avm1ButtonActions,o=null,s=null,a=!1,l=r.length,c=0;c<l;c++)if((o=r[c]).actionsBlock||(o.actionsBlock=t.actionsDataFactory.createActionsData(o.actionsData,"s"+i.id+"e"+c)),o.keyCode,0!=o.stateTransitionFlags){for(var h in s=this._mouseEventHandler.bind(this,o.stateTransitionFlags),a=!1,buttonActionsMap)o.stateTransitionFlags&parseInt(h)&&(a=!0,n[buttonActionsMap[h].eventName]={handler:buttonActionsMap[h],boundListener:s});a||console.warn("unknown button event flag",o.stateTransitionFlags)}this.adaptee.addButtonListeners(),this._initEventsHandlers(),this._addListeners()},CEd.prototype.initAdapter=function(){BEd.prototype.initAdapter.call(this),this._addListeners()},CEd.prototype.stop=function(){return this.adaptee.stop()},CEd.prototype.getEnabled=function(){return this.enabled},CEd.prototype.setEnabled=function(t){(this.adaptee.buttonEnabled=t)!=this.enabled&&(this.enabled=t,this.setEnabledListener(t),this.adaptee.mouseEnabled=!0)},CEd.prototype.getTrackAsMenu=function(){return!1},CEd.prototype.setTrackAsMenu=function(t){},CEd.prototype._addListeners=function(){for(var t in this._requiredListeners)this._eventHandlers[t]=this._requiredListeners[t].handler,this._eventsListeners[t]=this._requiredListeners[t].boundListener;this.setEnabledListener(this.enabled)},CEd.prototype._removeListeners=function(){for(var t in this._requiredListeners)this.adaptee.removeEventListener(t,this._requiredListeners[t].boundListener)},CEd.prototype._keyDownHandler=function(t){for(var e=this._actions,i=e.length,n=0;n<i;n++){var r=e[n];r.keyCode&&(r.keyCode<32&&AVM1KeyCodeMap$1[r.keyCode]===t.axGetPublicProperty("keyCode")||r.keyCode===t.axGetPublicProperty("charCode"))&&this._runAction(r)}},CEd.prototype._mouseEventHandler=function(t){for(var e=this._actions,i=e.length,n=0;n<i;n++){var r=e[n];r.stateTransitionFlags===t&&this._runAction(r)}},CEd.prototype._runAction=function(t){var e=this._avm1Context;this.adaptee.parent&&e.executeActions(t.actionsBlock,getAVM1Object(this.adaptee.parent,this.context))},CEd.prototype._initEventsHandlers=function(){this.bindEvents(EventsListForButton)},CEd),AVM1Color=(fFd=AVM1Object,__extends(gFd,fFd),gFd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,gFd,[],["getRGB","getTransform","setRGB","setTransform"],null,gFd.prototype.avm1Constructor)},gFd.prototype.avm1Constructor=function(t){t&&(this._target=this.context.resolveTarget(t),this._target&&this._target.adaptee&&!this._target.adaptee.isAVMScene&&((this._target.avmColor=this)._targetAwayObject=getAwayJSAdaptee(this._target)))},gFd.prototype.changeTarget=function(t){t&&t instanceof AVM1SymbolBase?(this._target=t,(this._target.avmColor=this)._target._ctBlockedByScript=!0,this._targetAwayObject=getAwayJSAdaptee(this._target)):this._target=null},gFd.prototype.getRGB=function(){var t=gFd.prototype.getTransform.call(this);return t?t.getRgb():null},gFd.prototype.getTransform=function(){return this._targetAwayObject?AVM1ColorTransform.fromAwayColorTransform(this.context,this._targetAwayObject.transform.colorTransform):null},gFd.prototype.setRGB=function(t){var e=gFd.prototype.getTransform.call(this);e&&(e.setRgb(t),gFd.prototype.setTransform.call(this,e)),this._target&&(this._target._ctBlockedByScript=!0)},gFd.prototype.setTransform=function(t){var e;this._targetAwayObject&&t&&((e=t)instanceof AVM1ColorTransform||t instanceof AVM1Object&&(e=fromAVM1Object(t)),e&&(this._targetAwayObject.transform.colorTransform._rawData[0]=e._rawData[0],this._targetAwayObject.transform.colorTransform._rawData[1]=e._rawData[1],this._targetAwayObject.transform.colorTransform._rawData[2]=e._rawData[2],this._targetAwayObject.transform.colorTransform._rawData[3]=e._rawData[3],this._targetAwayObject.transform.colorTransform._rawData[4]=e._rawData[4],this._targetAwayObject.transform.colorTransform._rawData[5]=e._rawData[5],this._targetAwayObject.transform.colorTransform._rawData[6]=e._rawData[6],this._targetAwayObject.transform.colorTransform._rawData[7]=e._rawData[7],this._targetAwayObject.transform.invalidateColorTransform(),this._targetAwayObject.invalidate(),this._targetAwayObject._invalidateHierarchicalProperties(HierarchicalProperties.COLOR_TRANSFORM))),this._target&&(this._target._ctBlockedByScript=!0)},gFd),AVM1Mouse=(pFd=AVM1Object,__extends(qFd,pFd),qFd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!1,qFd,["show","hide"],[])},qFd.bindStage=function(t,e,i,n){qFd.mouseDownDelegate&&i.removeEventListener("mouseDown",qFd.mouseDownDelegate),qFd.mouseMoveDelegate&&i.removeEventListener("mouseMove",qFd.mouseMoveDelegate),qFd.mouseOutDelegate&&i.removeEventListener("mouseOut",qFd.mouseOutDelegate),qFd.mouseUpDelegate&&i.removeEventListener("mouseUp",qFd.mouseUpDelegate),qFd.mouseDownDelegate=function(t){alCallProperty(e,"broadcastMessage",["onMouseDown"])},qFd.mouseMoveDelegate=function(t){alCallProperty(e,"broadcastMessage",["onMouseMove"])},qFd.mouseOutDelegate=function(t){alCallProperty(e,"broadcastMessage",["onMouseOut"])},qFd.mouseUpDelegate=function(t){alCallProperty(e,"broadcastMessage",["onMouseUp"])},i.addEventListener("mouseDown",qFd.mouseDownDelegate),i.addEventListener("mouseMove",qFd.mouseMoveDelegate),i.addEventListener("mouseOut",qFd.mouseOutDelegate),i.addEventListener("mouseUp",qFd.mouseUpDelegate)},qFd.hide=function(){AVM1Globals.instance.Stage.avmStage.scene.mouseManager.showCursor=!1},qFd.show=function(){AVM1Globals.instance.Stage.avmStage.scene.mouseManager.showCursor=!0},qFd.mouseDownDelegate=null,qFd.mouseMoveDelegate=null,qFd.mouseOutDelegate=null,qFd.mouseUpDelegate=null,qFd),AVM1MovieClipLoader=(AFd=AVM1Object,__extends(BFd,AFd),BFd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,BFd,[],["loadClip","unloadClip","getProgress"],null,BFd.prototype.avm1Constructor)},BFd.prototype.avm1Constructor=function(){AVM1Broadcaster.initialize(this.context,this)},BFd.prototype.loadClip=function(t,e){if("number"==typeof e){if(0===e)return!1}else if(!this.context.resolveTarget(e))return!1;var i=new AVM1LoaderHelper(this.context);return this._loaderHelper=i,!(this._target=null)},BFd.prototype.unloadClip=function(t){return!0},BFd.prototype.getProgress=function(t){return 0},BFd),AFd,pFd,fFd,BEd;function BFd(){return null!==AFd&&AFd.apply(this,arguments)||this}function qFd(){return null!==pFd&&pFd.apply(this,arguments)||this}function gFd(){return null!==fFd&&fFd.apply(this,arguments)||this}function CEd(){return null!==BEd&&BEd.apply(this,arguments)||this}function loadAVM1DataObject(e,t,i,n,r,o){var s=new URLRequest(t),a=s.url||"",l=a.replace(/\?.*$/,""),c=matchRedirect(a,null);if(c){if(c.supressLoad)return console.log("[LOADER] Load surpressed ",c.url),0;console.log("[LOADER] Override loading url:",c.url),s.url=c.url}else console.log("[LOADER] start loading the url:",l);i&&(s.method=i),r&&(s.data=r);var h=new URLLoader;h.dataFormat="text";var u=function(t){h.removeEventListener(URLLoaderEvent.LOAD_COMPLETE,u),avm1BroadcastEvent(e,o,"onData",[h.data])};h.addEventListener(URLLoaderEvent.LOAD_COMPLETE,u),o._as3Loader=h,c&&c.supressErrors&&h.addEventListener(URLLoaderEvent.LOAD_ERROR,function(t){console.log("[LOADER] Error supressed by redirect rule as empty complete events!",t),h.dispatchEvent(new URLLoaderEvent(URLLoaderEvent.LOAD_COMPLETE,h))}),h.load(s)}var AVM1LoadVarsFunction=(WFd=AVM1Function,__extends(XFd,WFd),XFd.prototype.alConstruct=function(t){var e=new AVM1Object(this.context);return e.alPrototype=this.alGetPrototypeProperty(),e.isAVM1DataObject=!0,e},XFd.prototype.alCall=function(t,e){return this.alConstruct(e)},XFd),AVM1LoadVarsPrototype=(cGd=AVM1Object,__extends(dGd,cGd),dGd.prototype.getBytesLoaded=function(){if(this._as3Loader)return this._as3Loader.bytesLoaded},dGd.prototype.getBytesTotal=function(){if(this._as3Loader)return this._as3Loader.bytesTotal},dGd.prototype.load=function(t){return!!(t=alCoerceString(this.context,t))&&(loadAVM1DataObject(this.context,t,null,null,null,this),!0)},dGd.prototype.defaultOnData=function(t){isNullOrUndefined$1(t)?avm1BroadcastEvent(this.context,this,"onLoad",[!1]):(dGd.prototype.decode.call(this,t),this.alPut("loaded",!0),avm1BroadcastEvent(this.context,this,"onLoad",[!0]))},dGd.prototype.decode=function(t){t=alCoerceString(this.context,t)},dGd.prototype._toString=function(){return this.context,""},dGd.prototype.send=function(t,e,i){return t=alCoerceString(this.context,t),i=isNullOrUndefined$1(i)?"POST":alCoerceString(this.context,i),!1},dGd.prototype.sendAndLoad=function(t,e,i){if(t=alCoerceString(this.context,t),i=isNullOrUndefined$1(i)?"POST":alCoerceString(this.context,i),!(t&&e instanceof AVM1Object))return!1;if(!e.isAVM1DataObject)return!1;var n=isNullOrUndefined$1(n=this.alGet("contentType"))?"application/x-www-form-urlencoded":alCoerceString(this.context,n),r=alToString(this.context,this);return loadAVM1DataObject(this.context,t,i,n,r,e),!0},dGd),AVM1Sound=(sGd=AVM1Object,__extends(tGd,sGd),tGd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,tGd,[],["attachSound","duration#","getBytesLoaded","getBytesTotal","getPan","setPan","getTransform","setTransform","getVolume","setVolume","start","stop","onSoundComplete"],null,tGd.prototype.avm1Constructor)},tGd.prototype.avm1Constructor=function(t){this._target=this.context.resolveTarget(t),this._sound=null,this._channel=null,this._linkageID=null,this._assetNameSpace=AVM1MovieClip.currentMCAssetNameSpace},tGd.prototype.alPut=function(t,e){sGd.prototype.alPut.call(this,t,e),t&&"onsoundcomplete"==t.toLowerCase()&&this.onSoundComplete(e)},tGd.prototype.alDeleteProperty=function(t){return sGd.prototype.alDeleteProperty.call(this,t),t&&"onsoundcomplete"==t.toLowerCase()&&this.onSoundComplete(),!0},tGd.prototype.attachSound=function(t){var e,i=this;"string"!=typeof t&&"number"!=typeof t||(e=AssetLibrary.getAsset(t,this._assetNameSpace))&&(this._linkageID=t,this._sound=e.clone(),this._sound&&(this._sound.onSoundComplete=function(){return i.soundCompleteInternal()}))},tGd.prototype.soundCompleteInternal=function(){this.loopsToPlay--,0<this.loopsToPlay?(this.stop(),this._sound.play(0,!1)):this._onCompleteCallback&&this._onCompleteCallback()},tGd.prototype.onSoundComplete=function(t){void 0===t&&(t=null);var e=this;this._onCompleteCallback=null,t&&(this._onCompleteCallback=function(){t.alCall(e)}),this._sound},tGd.prototype.loadSound=function(t,e){console.warn("AVM1Sound.loadSound")},tGd.prototype.getBytesLoaded=function(){return console.warn("AVM1Sound.getBytesLoaded"),0},tGd.prototype.getBytesTotal=function(){return console.warn("AVM1Sound.getBytesTotal"),0},tGd.prototype.getDuration=function(){return console.warn("AVM1Sound.getDuration"),0},tGd.prototype.getPan=function(){return console.warn("AVM1Sound.getPan"),0},tGd.prototype.setPan=function(t){console.warn("AVM1Sound.setPan")},tGd.prototype.getTransform=function(){return console.warn("AVM1Sound.getTransform"),null},tGd.prototype.setTransform=function(t){console.warn("AVM1Sound.setTransform")},tGd.prototype.getVolume=function(){return this._sound?100*this._sound.volume:(console.warn("AVM1Sound.getVolume called, but no WaveAudio set"),100)},tGd.prototype.setVolume=function(t){this._sound?(this._target&&this._target.adaptee&&(this._target.adaptee.soundVolume=t/100),this._sound.volume=t/100):console.warn("AVM1Sound.setVolume called, but no WaveAudio set")},tGd.prototype.start=function(t,e){this._sound&&(e=isNaN(e)||e<1?1:Math.floor(e),this.loopsToPlay=e,this._target&&this._target.adaptee&&this._target.adaptee.startSound(this._linkageID,this._sound,this.loopsToPlay))},tGd.prototype.stop=function(t){this._sound&&this._target&&this._target.adaptee&&this._target.adaptee.stopSounds(this._linkageID)},tGd),AVM1SharedObject=(NGd=AVM1Object,__extends(OGd,NGd),OGd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,OGd,["getLocal"],["data#","flush","clear"])},OGd.prototype.setName=function(t){if(this._data=alNewObject(this.context),t=alCoerceString(this.context,t),this._storage_name=t,"undefined"!=typeof Storage){var e=JSON.parse(localStorage.getItem(t));if(e)return void(this._data=this.getAVM1Value(e))}return console.log("no shared object found"),null},OGd.getLocal=function(t,e,i,n){(i||n)&&console.warn("SharedObject.getLocal: params 'localPath' and 'secure' not supported");var r=new OGd(t);return r.setName(e),r},OGd.prototype.getData=function(){return this._data},OGd.prototype.clear=function(){localStorage.removeItem(this._storage_name)},OGd.prototype.getAVM1Value=function(t){if("number"==typeof t||"string"==typeof t||"boolean"==typeof t)return t;if(Array.isArray(t)){for(var e=0;e<t.length;e++)t[e]=this.getAVM1Value(t[e]);return new AVM1ArrayNative(this.context,t)}if("object"==typeof t){var i=alNewObject(this.context);for(var n in t)i.alSetOwnProperty(n,new AVM1PropertyDescriptor(64,this.getAVM1Value(t[n])));return i}},OGd.prototype.getJSValue=function(t){if("number"==typeof t||"string"==typeof t||"boolean"==typeof t)return t;if(alIsArray(this.context,t)){console.log("array");var e=t.value,i=[];if(e)for(var n=e.length,r=0;r<n;r++)i[r]=this.getJSValue(e[r]);return i}if(t instanceof AVM1Object){var o={};for(var s in t._ownProperties)"__proto__"!=s&&"__constructor__"!=s&&(o[s]=this.getJSValue(t._ownProperties[s].value));return o}console.log("unknown datatype")},OGd.prototype.flush=function(t){var e=this.getJSValue(this._data);return localStorage.setItem(this._storage_name,JSON.stringify(e)),!1},OGd),XMLNode=(kHd.prototype.axCallPublicProperty=function(t,e){return null},kHd.prototype.axGetPublicProperty=function(t){return null},kHd.prototype.axSetPublicProperty=function(t,e){return null},kHd.prototype.removeChild=function(t){},Object.defineProperty(kHd.prototype,"attributes",{get:function(){return console.log("attributes not implemented yet in flash/XMLNode"),null},set:function(t){console.log("attributes not implemented yet in flash/XMLNode")},enumerable:!0,configurable:!0}),Object.defineProperty(kHd.prototype,"childNodes",{get:function(){return console.log("childNodes not implemented yet in flash/XMLNode"),[]},enumerable:!0,configurable:!0}),Object.defineProperty(kHd.prototype,"localName",{get:function(){return console.log("localName not implemented yet in flash/XMLNode"),""},enumerable:!0,configurable:!0}),Object.defineProperty(kHd.prototype,"namespaceURI",{get:function(){return console.log("namespaceURI not implemented yet in flash/XMLNode"),""},enumerable:!0,configurable:!0}),Object.defineProperty(kHd.prototype,"prefix",{get:function(){return console.log("prefix not implemented yet in flash/XMLNode"),""},enumerable:!0,configurable:!0}),kHd.prototype.appendChild=function(t){console.log("appendChild not implemented yet in flash/XMLNode")},kHd.prototype.cloneNode=function(t){return console.log("cloneNode not implemented yet in flash/XMLNode"),null},kHd.prototype.getNamespaceForPrefix=function(t){return console.log("getNamespaceForPrefix not implemented yet in flash/XMLNode"),""},kHd.prototype.getPrefixForNamespace=function(t){return console.log("getPrefixForNamespace not implemented yet in flash/XMLNode"),""},kHd.prototype.hasChildNodes=function(){return console.log("hasChildNodes not implemented yet in flash/XMLNode"),!1},kHd.prototype.insertBefore=function(t,e){console.log("insertBefore not implemented yet in flash/XMLNode")},kHd.prototype.removeNode=function(){console.log("removeNode not implemented yet in flash/XMLNode")},kHd.prototype.toString=function(){return console.log("toString not implemented yet in flash/XMLNode"),""},kHd),AVM1XMLNodeType,NGd,sGd,cGd,WFd,FHd;function kHd(t,e){}function OGd(t){var e=NGd.call(this,t)||this;return alDefineObjectProperties(e,{data:{get:e.getData},clear:{value:e.clear,writable:!0},flush:{value:e.flush,writable:!0}}),e}function tGd(){var t=null!==sGd&&sGd.apply(this,arguments)||this;return t.loopsToPlay=0,t}function dGd(t,e){var i=cGd.call(this,t)||this;return alDefineObjectProperties(i,{constructor:{value:e,writable:!0},toString:{value:i._toString},load:{value:i.load},onData:{value:i.defaultOnData},decode:{value:i.decode},send:{value:i.load},sendAndload:{value:i.load}}),i}function XFd(t){var e=WFd.call(this,t)||this;return e.alSetOwnPrototypeProperty(new AVM1LoadVarsPrototype(t,e)),e}function toAS3XMLNode(t){if(!(t instanceof AVM1Object))return null;var e=t.context;return alInstanceOf(e,t,e.globals.XMLNode)?t.as3XMLNode:null}function fromAS3XMLNode(t,e){if(!isNullOrUndefined$1(e)){var i=e._as2Node;return i||((i=new AVM1Object(t)).alPrototype=t.globals.XMLNode.alGetPrototypeProperty(),AVM1XMLNodePrototype.prototype.initializeFromAS3Node.call(i,e)),i}}FHd=AVM1XMLNodeType=AVM1XMLNodeType||{},FHd[FHd.ELEMENT_NODE=1]="ELEMENT_NODE",FHd[FHd.TEXT_NODE=3]="TEXT_NODE";var AVM1XMLNodeFunction=(GHd=AVM1Function,__extends(HHd,GHd),HHd.prototype.alConstruct=function(t){if(!t&&t.length<2)Debug.notImplemented("Unsupported amount of parameters for AVM1XMLNode constructor");else{var e=alCoerceNumber(this.context,t[0]),i=alCoerceString(this.context,t[1]);if(e===AVM1XMLNodeType.ELEMENT_NODE||e===AVM1XMLNodeType.TEXT_NODE){var n=new AVM1Object(this.context);return n.alPrototype=this.alGetPrototypeProperty(),AVM1XMLNodePrototype.prototype.initializeNode.call(n,e,i),n}Debug.notImplemented("Unsupported AVM1XMLNode type: "+e)}},HHd.prototype.alCall=function(t,e){return this.alConstruct(e)},HHd),AVM1XMLNodeChildNodes=(QHd=AVM1Object,__extends(RHd,QHd),Object.defineProperty(RHd.prototype,"as3ChildNodes",{get:function(){return this._as3XMLNode.axGetPublicProperty("childNodes").value},enumerable:!0,configurable:!0}),RHd.prototype.getLength=function(){return this.as3ChildNodes.length},RHd.prototype.alGetOwnProperty=function(t){if(alIsIndex(this.context,t)){var e=alToInteger(this.context,t);if(0<=e&&e<this.as3ChildNodes.length)return this._cachedNodePropertyDescriptor.value=fromAS3XMLNode(this.context,this.as3ChildNodes[e]),this._cachedNodePropertyDescriptor}return QHd.prototype.alGetOwnProperty.call(this,t)},RHd),AVM1XMLNodeAttributes=(XHd=AVM1Object,__extends(YHd,XHd),YHd.prototype.alGetOwnProperty=function(t){var e=alCoerceString(this.context,t);if(this._as3Attributes.hasOwnProperty(e))return this._cachedNodePropertyDescriptor.value=this._as3Attributes[e],this._cachedNodePropertyDescriptor},YHd.prototype.alSetOwnProperty=function(t,e){var i,n=alCoerceString(this.context,t);64&e.flags&&(i=alCoerceString(this.context,e.value),this._as3Attributes[n]=i)},YHd.prototype.alHasOwnProperty=function(t){var e=alCoerceString(this.context,t);return this._as3Attributes.hasOwnProperty(e)},YHd.prototype.alDeleteOwnProperty=function(t){var e=alCoerceString(this.context,t);delete this._as3Attributes[e]},YHd.prototype.alGetOwnPropertiesKeys=function(){var e=this;return Object.keys(this._as3Attributes).map(function(t){return alCoerceString(e.context,e._as3Attributes[t].name)})},YHd),AVM1XMLNodePrototype=(mId=AVM1Object,__extends(nId,mId),nId.prototype.initializeNode=function(t,e){this.as3XMLNode=new XMLNode(t,e),this._attributes=void 0,this._childNodes=void 0,nId.addMap(this.as3XMLNode,this)},nId.prototype.initializeFromAS3Node=function(t){this.as3XMLNode=t,this._attributes=void 0,this._childNodes=void 0,nId.addMap(this.as3XMLNode,this)},nId.prototype._toString=function(){return this.as3XMLNode.toString()},nId.prototype.appendChild=function(t){this.as3XMLNode.appendChild(toAS3XMLNode(t))},nId.prototype.getAttributes=function(){var t=this.as3XMLNode.attributes;if(!isNullOrUndefined$1(t))return this._attributes||(this._attributes=new AVM1XMLNodeAttributes(this.context,t)),this._attributes},nId.prototype.setAttributes=function(t){var n,r,o=this;isNullOrUndefined$1(t)?this._attributes=void 0:t instanceof AVM1XMLNodeAttributes?this._attributes=t:(n=this.context,r={},alForEachProperty(t,function(t){var e=alCoerceString(n,t),i=alCoerceString(n,o.alGet(t));r[e]=i},this),this._attributes=new AVM1XMLNodeAttributes(n,r))},nId.prototype.getChildNodes=function(){return this._childNodes||(this._childNodes=new AVM1XMLNodeChildNodes(this.context,this.as3XMLNode)),this._childNodes},nId.prototype.cloneNode=function(t){t=alToBoolean(this.context,t);var e=this.as3XMLNode.axCallPublicProperty("cloneNode",[t]);return fromAS3XMLNode(this.context,e)},nId.prototype.getFirstChild=function(){return fromAS3XMLNode(this.context,this.as3XMLNode.firstChild)},nId.prototype.getNamespaceForPrefix=function(t){return this.as3XMLNode.axCallPublicProperty("getNamespaceForPrefix",[t])},nId.prototype.getPrefixForNamespace=function(t){return this.as3XMLNode.axCallPublicProperty("getNamespaceForPrefix",[t])},nId.prototype.hasChildNodes=function(){return this.as3XMLNode.hasChildNodes()},nId.prototype.insertBefore=function(t,e){this.as3XMLNode.axCallPublicProperty("insertBefore",[toAS3XMLNode(t),toAS3XMLNode(e)])},nId.prototype.getLastChild=function(){return fromAS3XMLNode(this.context,this.as3XMLNode.lastChild)},nId.prototype.getLocalName=function(){return this.as3XMLNode.localName},nId.prototype.getNamespaceURI=function(){return this.as3XMLNode.namespaceURI},nId.prototype.getNextSibling=function(){return fromAS3XMLNode(this.context,this.as3XMLNode.nextSibling)},nId.prototype.getNodeName=function(){return this.as3XMLNode.nodeName},nId.prototype.setNodeName=function(t){t=alCoerceString(this.context,t),this.as3XMLNode.nodeName=t},nId.prototype.getNodeType=function(){return this.as3XMLNode.nodeType},nId.prototype.getNodeValue=function(){return this.as3XMLNode.nodeValue},nId.prototype.setNodeValue=function(t){t=alCoerceString(this.context,t),this.as3XMLNode.nodeValue=t},nId.prototype.getParentNode=function(){return fromAS3XMLNode(this.context,this.as3XMLNode.parentNode)},nId.prototype.getPrefix=function(){return this.as3XMLNode.prefix},nId.prototype.getPreviousSibling=function(){return fromAS3XMLNode(this.context,this.as3XMLNode.previousSibling)},nId.prototype.removeNode=function(){this.as3XMLNode.removeNode()},nId.addMap=function(t,e){t._as2Node=e},nId),AVM1XMLFunction=(NId=AVM1Function,__extends(OId,NId),OId.prototype.alConstruct=function(t){var e=t&&alCoerceString(this.context,t[0]),i=new AVM1Object(this.context);return i.alPrototype=this.alGetPrototypeProperty(),i.isAVM1DataObject=!0,e=e||"",AVM1XMLPrototype.prototype.initializeDocument.call(i,e),i},OId.prototype.alCall=function(t,e){return this.alConstruct(e)},OId),AVM1XMLPrototype=(XId=AVM1Object,__extends(YId,XId),YId.prototype.initializeDocument=function(t){t=alCoerceString(this.context,t)||null;var e=(new DOMParser).parseFromString(t,"application/xml");AVM1XMLNodePrototype.prototype.initializeFromAS3Node.call(this,e),this.as3XMLDocument=e},YId.prototype.addRequestHeader=function(t,e){Debug.notImplemented("AVM1XMLPrototype.addRequestHeader")},YId.prototype.createElement=function(t){t=alCoerceString(this.context,t);var e=this.as3XMLDocument.axCallPublicProperty("createElement",[t]);return fromAS3XMLNode(this.context,e)},YId.prototype.createTextNode=function(t){t=alCoerceString(this.context,t);var e=this.as3XMLDocument.axCallPublicProperty("createTextNode",[t]);return fromAS3XMLNode(this.context,e)},YId.prototype.getBytesLoaded=function(){if(this._as3Loader)return this._as3Loader.bytesLoaded},YId.prototype.getBytesTotal=function(){if(this._as3Loader)return this._as3Loader.bytesTotal},YId.prototype.load=function(t){return!!(t=alCoerceString(this.context,t))&&(loadAVM1DataObject(this.context,t,null,null,null,this),!0)},YId.prototype.defaultOnData=function(t){isNullOrUndefined$1(t)?avm1BroadcastEvent(this.context,this,"onLoad",[!1]):(YId.prototype.parseXML.call(this,t),this.alPut("loaded",!0),avm1BroadcastEvent(this.context,this,"onLoad",[!0]))},YId.prototype.parseXML=function(t){t=alCoerceString(this.context,t);var e=(new DOMParser).parseFromString(t,"application/xml");AVM1XMLNodePrototype.prototype.initializeFromAS3Node.call(this,e),this.as3XMLDocument=e},YId.prototype.send=function(t,e,i){return t=alCoerceString(this.context,t),e=isNullOrUndefined$1(e)?void 0:alCoerceString(this.context,e),i=isNullOrUndefined$1(i)?void 0:alCoerceString(this.context,i),Debug.notImplemented("AVM1XMLPrototype.send"),!1},YId.prototype.sendAndLoad=function(t,e){var i,n;(t=alCoerceString(this.context,t))&&e.isAVM1DataObject&&(Debug.somewhatImplemented("AVM1XMLPrototype.send"),i=isNullOrUndefined$1(i=this.alGet("contentType"))?void 0:alCoerceString(this.context,i),n=alToString(this.context,this),loadAVM1DataObject(this.context,t,"POST",i,n,e))},YId),AVM1ExternalInterface=(uJd=AVM1Object,__extends(vJd,uJd),vJd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,vJd,["available#","addCallback","call"],[])},vJd.getAvailable=function(t){return!0},vJd.addCallback=function(t,n,r,e){if(n=alCoerceString(t,n),!alIsFunction(e))return!1;try{return window.flashObject||(window.flashObject={}),window.flashObject[n]=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=r.alGet(n.toLowerCase());i&&alIsFunction(i)?i.alCall(r,t):i&&i.value&&i.value.alCall(r,t)},!0}catch(t){}return!1},vJd.call=function(t,e){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];var r=[],o=i.length,s=0;for(s=0;s<o;s++)r.push(i[s]);1==r.length&&(r=r[0]);try{for(var a=e.split("."),l=window,s=0;s<a.length;s++)l=l[a[s]];return l(r),""}catch(t){return}},vJd),AVM1BitmapFilterFunction=(PJd=AVM1Function,__extends(QJd,PJd),QJd.prototype.alConstruct=function(t){var e=new AVM1Object(this.context);return e.alPrototype=this.alGetPrototypeProperty(),e},QJd),AVM1BitmapFilterPrototype=(VJd=AVM1Object,__extends(WJd,VJd),WJd.prototype.clone=function(){var t=new AVM1Object(this.context);return t.alPrototype=this.alGetPrototypeProperty(),t},WJd),VJd,PJd,uJd,XId,NId,mId,XHd,QHd,GHd;function WJd(t,e){var i=VJd.call(this,t)||this;return alDefineObjectProperties(i,{constructor:{value:e,writable:!0},clone:{value:i.clone,writable:!0}}),i}function QJd(t){var e=PJd.call(this,t)||this;return e.alSetOwnPrototypeProperty(new AVM1BitmapFilterPrototype(t,e)),e}function vJd(){return null!==uJd&&uJd.apply(this,arguments)||this}function YId(t,e,i){var n=XId.call(this,t)||this;return n.alPrototype=i.alGetPrototypeProperty(),alDefineObjectProperties(n,{constructor:{value:e,writable:!0},addRequestHeader:{value:n.addRequestHeader},createElement:{value:n.createElement},createTextNode:{value:n.createTextNode},getBytesLoaded:{value:n.getBytesLoaded},getBytesTotal:{value:n.getBytesTotal},ignoreWhite:{value:!1,writable:!0},load:{value:n.load},parseXML:{value:n.parseXML},send:{value:n.send},sendAndLoad:{value:n.sendAndLoad},onData:{value:n.defaultOnData,writable:!0}}),n}function OId(t,e){var i=NId.call(this,t)||this;return i.alSetOwnPrototypeProperty(new AVM1XMLPrototype(t,i,e)),i}function nId(t,e){var i=mId.call(this,t)||this;return alDefineObjectProperties(i,{constructor:{value:e,writable:!0},attributes:{get:i.getAttributes,set:i.setAttributes},childNodes:{get:i.getChildNodes},firstChild:{get:i.getFirstChild},lastChild:{get:i.getLastChild},localName:{get:i.getLocalName},namespaceURI:{get:i.getNamespaceURI},nextSibling:{get:i.getNextSibling},nodeName:{get:i.getNodeName,set:i.setNodeName},nodeType:{get:i.getNodeType},nodeValue:{get:i.getNodeValue,set:i.setNodeValue},parentNode:{get:i.getParentNode},prefix:{get:i.getPrefix},previousSibling:{get:i.getPreviousSibling},appendChild:{value:i.appendChild},cloneNode:{value:i.cloneNode},getNamespaceForPrefix:{value:i.getNamespaceForPrefix},getPrefixForNamespace:{value:i.getPrefixForNamespace},hasChildNodes:{value:i.hasChildNodes},insertBefore:{value:i.insertBefore},removeNode:{value:i.removeNode},toString:{value:i._toString}}),i}function YHd(t,e){var i=XHd.call(this,t)||this;return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),i._as3Attributes=e,i._cachedNodePropertyDescriptor=new AVM1PropertyDescriptor(64,void 0),i}function RHd(t,e){var i=QHd.call(this,t)||this;return i._as3XMLNode=e,i._cachedNodePropertyDescriptor=new AVM1PropertyDescriptor(70,void 0),alDefineObjectProperties(i,{length:{get:i.getLength}}),i}function HHd(t){var e=GHd.call(this,t)||this;return e.alSetOwnPrototypeProperty(new AVM1XMLNodePrototype(t,e)),e}function createFilterClass(n,t,e,i,r){var o=e.alGetPrototypeProperty(),s=Object.create(AVM1BitmapFilterPrototype.prototype);AVM1Object.call(s,n),s.alPrototype=o;var a=Object.create(AVM1BitmapFilterFunction.prototype);AVM1Function.call(a,n),a.alSetOwnPrototypeProperty(s),a.alConstruct=function(t){var e=new AVM1Object(n);if(e.alPrototype=s,t)for(var i=0;i<t.length;i++)e.alPut(r[i<<1],t[i]);return e},alDefineObjectProperties(s,{constructor:{value:a,writable:!0},clone:{value:function(){var t=new AVM1Object(n);t.alPrototype=s;for(var e=0;e<r.length;e+=2)t.alPut(r[e],this.alGet(r[e]));return t},writable:!0}}),t.alPut(i,a)}function createFiltersClasses(t){var e=alNewObject(t),i=new AVM1BitmapFilterFunction(t);return e.alPut("BitmapFilter",i),createFilterClass(t,e,i,"BevelFilter",["distance","Number","angle","Number","highlightColor","Number","highlightAlpha","Number","shadowColor","Number","shadowAlpha","Number","blurX","Number","blurY","Number","strength","Number","quality","Number","type","String","knockout","Boolean"]),createFilterClass(t,e,i,"BlurFilter",["blurX","Number","blurY","Number","quality","Number"]),createFilterClass(t,e,i,"ColorMatrixFilter",["matrix","Numbers"]),createFilterClass(t,e,i,"ConvolutionFilter",["matrixX","Number","matrixY","Number","matrix","Numbers","divisor","Number","bias","Number","preserveAlpha","Boolean","clamp","Boolean","color","Number","alpha","Number"]),createFilterClass(t,e,i,"DisplacementMapFilter",["mapBitmap","BitmapData","mapPoint","Point","componentX","Number","componentY","Number","scaleX","Number","scaleY","Number","mode","String","color","Number","alpha","Number"]),createFilterClass(t,e,i,"DropShadowFilter",["distance","Number","angle","Number","color","Number","alpha","Number","blurX","Number","blurY","Number","strength","Number","quality","Number","inner","Boolean","knockout","Boolean","hideObject","Boolean"]),createFilterClass(t,e,i,"GlowFilter",["color","Number","alpha","Number","blurX","Number","blurY","Number","strength","Number","quality","Number","inner","Boolean","knockout","Boolean"]),createFilterClass(t,e,i,"GradientBevelFilter",["distance","Number","angle","Number","colors","Numbers","alphas","Numbers","ratios","Numbers","blurX","Number","blurY","Number","strength","Number","quality","Number","type","String","knockout","Boolean"]),createFilterClass(t,e,i,"GradientGlowFilter",["distance","Number","angle","Number","colors","Numbers","alphas","Numbers","ratios","Numbers","blurX","Number","blurY","Number","strength","Number","quality","Number","type","String","knockout","Boolean"]),e}var commonjsGlobal="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function createCommonjsModule(t,e){return t(e={exports:{}},e.exports),e.exports}var stringify_1=createCommonjsModule(function(t,e){function r(n,r){var o=[],s=[];return null==r&&(r=function(t,e){return o[0]===e?"[Circular ~]":"[Circular ~."+s.slice(0,o.indexOf(e)).join(".")+"]"}),function(t,e){var i;return 0<o.length?(~(i=o.indexOf(this))?o.splice(i+1):o.push(this),~i?s.splice(i,1/0,t):s.push(t),~o.indexOf(e)&&(e=r.call(this,t,e))):o.push(e),null==n?e:n.call(this,t,e)}}(t.exports=function(t,e,i,n){return JSON.stringify(t,r(e,n),i)}).getSerialize=r}),stringify_2=stringify_1.getSerialize,Mash=function(){var n=4022871197;return function(t){if(t){t=t.toString();for(var e=0;e<t.length;e++){var i=.02519603282416938*(n+=t.charCodeAt(e));i-=n=i>>>0,n=(i*=n)>>>0,n+=4294967296*(i-=n)}return 2.3283064365386963e-10*(n>>>0)}n=4022871197}},uheprng=function(t){return function(){for(var e,i=1,n=48,r=new Array(48),o=0,s=new Mash,a=0;a<48;a++)r[a]=s(Math.random());function l(){48<=++n&&(n=0);var t=1768863*r[n]+2.3283064365386963e-10*i;return r[n]=t-(i=0|t)}function c(t){return Math.floor(t*(l()+11102230246251565e-32*(2097152*l()|0)))}c.string=function(t){for(var e="",i=0;i<t;i++)e+=String.fromCharCode(33+c(94));return e};return c.cleanString=function(t){return(t=(t=t.replace(/(^\s*)|(\s*$)/gi,"")).replace(/[\x00-\x1F]/gi,"")).replace(/\n /,"\n")},c.hashString=function(t){for(t=c.cleanString(t),s(t),a=0;a<t.length;a++)for(o=t.charCodeAt(a),e=0;e<48;e++)r[e]-=s(o),r[e]<0&&(r[e]+=1)},c.seed=function(t){null==t&&(t=Math.random()),"string"!=typeof t&&(t=stringify_1(t,function(t,e){return"function"==typeof e?e.toString():e})),c.initState(),c.hashString(t)},c.addEntropy=function(){var t=[];for(a=0;a<arguments.length;a++)t.push(arguments[a]);!function(){var t=Array.prototype.slice.call(arguments);for(a=0;a<t.length;a++)for(e=0;e<48;e++)r[e]-=s(t[a]),r[e]<0&&(r[e]+=1)}(o+++(new Date).getTime()+t.join("")+Math.random())},c.initState=function(){for(s(),a=0;a<48;a++)r[a]=s(" ");i=1,n=48},c.done=function(){s=null},void 0!==t&&c.seed(t),(c.range=c).random=function(){return c(Number.MAX_VALUE-1)/Number.MAX_VALUE},c.floatBetween=function(t,e){return c.random()*(e-t)+t},c.intBetween=function(t,e){return Math.floor(c.random()*(e-t+1))+t},c}()};uheprng.create=function(t){return new uheprng(t)};var randomSeed=uheprng,randomSeed_1=randomSeed.create,AVM1Selection=(nLd=AVM1Object,__extends(oLd,nLd),oLd.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,oLd,[],["addListener","getFocus","getBeginIndex","getEndIndex","removeListener","setFocus","setSelection","getCaretIndex"],null,oLd.prototype.avm1Constructor)},oLd.prototype.avm1Constructor=function(t,e){this.url=t,this.targetMC=e,this._queued_focus=!1},oLd.prototype.addListener=function(t){},oLd.prototype.removeListener=function(t){return!0},oLd.prototype.getBeginIndex=function(){var t=MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.renderer.view)).getFocus();return t&&t.isAsset(TextField)?t.selectionBeginIndex:-1},oLd.prototype.getEndIndex=function(){var t=MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).getFocus();return t&&t.isAsset(TextField)?t.selectionEndIndex:-1},oLd.prototype.getCaretIndex=function(){var t=MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).getFocus();return t&&t.isAsset(TextField)?t.selectionBeginIndex:-1},oLd.prototype.getFocus=function(){var t=MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).getFocus();if(t){for(var e=[];t;)t=t.isAVMScene?null:(e.push(t.name),t.parent);for(var i=e.length,n="";0<i;)n+=e[--i],0<i&&(n+=".");return n}return""},oLd.prototype.setFocus=function(t){var e;if(""!==t)return"string"==typeof t?(e=this.context.resolveTarget(t))&&e.adaptee||(e=this.context.resolveTarget(t+"_internal_TF"))&&e.adaptee?void MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).setFocus(e.adaptee):void 0:((e=this.context.resolveTarget(t))&&e.adaptee?MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).setFocus(e.adaptee):warning("AVM1Selection.setFocus - no object found '"+t.toString()+"'"),!0)},oLd.prototype.setSelection=function(t,e){var i=MouseManager.getInstance(PickGroup.getInstance(this.context.globals.Stage.avmStage.scene.view)).getFocus();i&&i.isAsset(TextField)&&i.setSelection(t,e)},oLd),_escape=jsGlobal.escape,_internalTimeouts=[],AVM1MatrixFunction$1=(HLd=AVM1Object,__extends(ILd,HLd),ILd),TraceLevel=(KLd.ALL="all",KLd.NONE="none",KLd.IMPORTANT="important",KLd),AVM1Globals=(LLd=AVM1Object,__extends(MLd,LLd),MLd.generateRandomSeed=function(){for(var t="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",e=10+Math.round(10*Math.random()),i="",n=0;n<e;n++)i+=t[Math.floor(Math.random()*t.length)];return i},MLd.setRandom=function(t){return void 0===t&&(t=null),t?(t==MLd.GENERATE_SEED&&(t=MLd.generateRandomSeed()),MLd.randomProvider=randomSeed_1(t),t):MLd.randomProvider=null},MLd.registerCustomClass=function(t,e){MLd._registeredCustomClasses[t]=e,MLd.instance&&MLd.instance.alPut(t,e)},MLd.registerCustomClassInstance=function(t,e){MLd._registeredCustomClassInstances[t]=e,MLd.instance&&MLd.instance.alPut(t,e)},MLd.createGlobalsObject=function(t){var e=new MLd(t);return wrapAVM1NativeMembers(t,e,e,["flash","ASSetPropFlags","BitmapData","clearInterval","clearTimeout","ExternalInterface","escape","unescape","setInterval","setTimeout","showRedrawRegions","trace","updateAfterEvent","myName","NaN","Infinity","isFinite","isNaN","parseFloat","parseInt","undefined","Object","Function","Array","Number","Math","Boolean","Date","Selection","String","Error","MovieClip","AsBroadcaster","System","Stage","Button","TextField","Color","Key","Mouse","MovieClipLoader","XML","XMLNode","LoadVars","Sound","SharedObject","ContextMenu","ContextMenuItem","TextFormat"],!1),MLd.instance=e},MLd.prototype.ASSetPropFlags=function(t,e,i,n){},MLd.prototype.clearIntervals=function(){for(var t=0,e=_internalTimeouts.length,t=0;t<e;t++)FrameScriptManager.clearInterval(_internalTimeouts[t]);_internalTimeouts.length=0},MLd.prototype.clearInterval=function(t){var e=_internalTimeouts[t-1];e&&(FrameScriptManager.clearInterval(e),delete _internalTimeouts[t-1])},MLd.prototype.clearTimeout=function(t){var e=_internalTimeouts[t-1];e&&(FrameScriptManager.clearTimeout(e),delete _internalTimeouts[t-1])},MLd.prototype.escape=function(t){return encodeURIComponent(t).replace(/!|'|\(|\)|\*|-|\.|_|~/g,function(t){switch(t){case"*":return"%2A";case"-":return"%2D";case".":return"%2E";case"_":return"%5F";default:return _escape(t)}})},MLd.prototype.unescape=function(t){return decodeURIComponent(t)},MLd.prototype.setInterval=function(){if(!(arguments.length<2)){var t,i=this.context,e=void 0,n=2;if(alIsFunction(arguments[0]))t=arguments[0].toJSFunction(),e=arguments[1];else{if(arguments.length<3)return;var r=arguments[0],o=arguments[1],e=arguments[2],n=3;if(!(r instanceof AVM1Object)||"string"!=typeof o)return;t=function(){var t,e=r.alGet(o);alIsFunction(e)&&(t=Array.prototype.slice.call(arguments,0),i.executeFunction(e,r,t))}}if(void 0!==e){e=alToInteger(i,e);var s,a=Array.prototype.slice.call(arguments,n);return t&&(s=FrameScriptManager.setInterval(function(){t.apply(null,a)},e)),_internalTimeouts.push(s)}}},MLd.prototype.setTimeout=function(){if(!(arguments.length<2)&&alIsFunction(arguments[0])){for(var t=arguments[0].toJSFunction(),e=alToInteger(this.context,arguments[1]),i=[],n=arguments.length,r=2;r<n;r++)i.push(arguments[r]);var o=FrameScriptManager.setTimeOut(function(){t.apply(null,i)},e);return _internalTimeouts.push(o)}},MLd.prototype.showRedrawRegions=function(t,e){},MLd.prototype.trace=function(t){this&&this.context.actions.trace(t)},MLd.prototype.updateAfterEvent=function(){},MLd.prototype.isFinite=function(t){return isFinite(alToNumber(this.context,t))},MLd.prototype.isNaN=function(t){return" "===t||isNaN(alToNumber(this.context,t))},MLd.prototype.parseFloat=function(t){return parseFloat(alToString(this.context,t))},MLd.prototype.parseInt=function(t,e){return parseInt(alToString(this.context,t),alToInt32(this.context,e))},MLd.prototype._initBuiltins=function(t){var e=t.builtins;for(var i in this.Object=e.Object,this.Function=e.Function,this.Array=e.Array,this.Number=e.Number,this.Math=e.Math,this.Boolean=e.Boolean,this.Date=e.Date,this.String=e.String,this.Error=e.Error,this.Selection=AVM1Selection.createAVM1Class(t)._ownProperties.prototype.value,this.ExternalInterface=AVM1ExternalInterface.createAVM1Class(t),this.MovieClip=AVM1MovieClip.createAVM1Class(t),this.AsBroadcaster=AVM1Broadcaster.createAVM1Class(t),this.System=AVM1System.createAVM1Class(t),this.Stage=AVM1Stage.createAVM1Class(t),this.Button=AVM1Button.createAVM1Class(t),this.TextField=AVM1TextField.createAVM1Class(t),this.Color=AVM1Color.createAVM1Class(t),this.Key=AVM1Key.createAVM1Class(t),this.Mouse=AVM1Mouse.createAVM1Class(t),this.MovieClipLoader=AVM1MovieClipLoader.createAVM1Class(t),this.LoadVars=new AVM1LoadVarsFunction(t),this.Sound=AVM1Sound.createAVM1Class(t),this.SharedObject=AVM1SharedObject.createAVM1Class(t),this.ContextMenu=void 0,this.ContextMenuItem=void 0,this.TextFormat=AVM1TextFormat.createAVM1Class(t),this.XMLNode=new AVM1XMLNodeFunction(t),this.XML=new AVM1XMLFunction(t,this.XMLNode),this.BitmapData=AVM1BitmapData.createAVM1Class(t),this.Matrix=new AVM1MatrixFunction$1(t),this.Point=new AVM1PointFunction(t),this.Rectangle=new AVM1RectangleFunction(t),this.Transform=AVM1Transform.createAVM1Class(t),this.ColorTransform=new AVM1ColorTransformFunction(t),AVM1Broadcaster.initialize(t,this.Stage),AVM1Broadcaster.initialize(t,this.Key),AVM1Broadcaster.initialize(t,this.Mouse),MLd._registeredCustomClasses)this.alPut(i,MLd._registeredCustomClasses[i]);for(var i in MLd._registeredCustomClassInstances)this.alPut(i,MLd._registeredCustomClassInstances[i])},MLd.prototype._initializeFlashObject=function(t){this.flash=alNewObject(t);var e=alNewObject(t);e.alPut("BitmapData",this.BitmapData),this.flash.alPut("display",e);var i=alNewObject(t);i.alPut("ExternalInterface",AVM1ExternalInterface.createAVM1Class(t)),this.flash.alPut("external",i);var n=createFiltersClasses(t);this.flash.alPut("filters",n),this.filters=n;var r=alNewObject(t);r.alPut("ColorTransform",this.ColorTransform),r.alPut("Matrix",this.Matrix),r.alPut("Point",this.Point),r.alPut("Rectangle",this.Rectangle),r.alPut("Transform",this.Transform),this.flash.alPut("geom",r);var o=alNewObject(t);this.flash.alPut("text",o)},MLd.swfStartTime=Date.now(),MLd._registeredCustomClasses={},MLd._registeredCustomClassInstances={},MLd.GENERATE_SEED="GENERATE_SEED",MLd.tracelevel=TraceLevel.NONE,MLd.toStringPrecision=-1,MLd),AVM1NativeActions=(UMd.prototype.asfunction=function(t){},UMd.prototype.call=function(t){this.context.resolveTarget(null)._callFrame(t)},UMd.prototype.chr=function(t){return t=alToInteger(this.context,t),this.context.swfVersion<=5&&(t&=255),t?String.fromCharCode(t):""},UMd.prototype.duplicateMovieClip=function(t,e,i){var n=alCoerceNumber(this.context,i)-DEPTH_OFFSET;this.context.resolveTarget(t).duplicateMovieClip(e,n,null)},UMd.prototype.fscommand=function(t,e){},UMd.prototype.getTimer=function(){return Date.now()-AVM1Globals.swfStartTime},UMd.prototype.getURL=function(t,e,i){t=String(t),"string"!=typeof e||0!==e.indexOf("_level")?0!==t.toLowerCase().indexOf("fscommand:")?window.open(t,e):console.log("fsCommand not implemented "):this.loadMovieNum(t,+e.substr(6),i)},UMd.prototype.gotoAndPlay=function(t,e){var i=this.context.resolveTarget(null);i.adaptee.play(),this._gotoFrame(i.adaptee,t,e)},UMd.prototype.gotoAndStop=function(t,e){var i=this.context.resolveTarget(null);"number"==typeof e&&e<=0||(i.adaptee.stop(),this._gotoFrame(i.adaptee,t,e))},UMd.prototype._gotoFrame=function(t,e,i){if(Array.isArray(e)){if(0==e.length)return;e=e[0]}if(e instanceof AVM1ArrayNative){if(!e.value||0==e.value.length)return;e=e.value[0]}if("number"==typeof e&&e%1!=0&&(e=e.toString()),"string"==typeof e){var n=9<this.context.swfVersion?e:e.toLowerCase();if(null===t.timeline._labels[n])return e=parseInt(e),void(isNaN(e)||(t.currentFrameIndex=e-1));t.jumpToLabel(n,i)}else t.currentFrameIndex=e-1},UMd.prototype.ifFrameLoaded=function(t,e){var i=this.context.resolveTarget(null),n=arguments.length<2?t:e,r=i.alGet("_framesloaded"),o=i.alGet("_totalframes");return Math.min(n+1,o)<=r},UMd.prototype.length_=function(t){return(""+t).length},UMd.prototype.loadMovie=function(t,e,i){var n,r,o;t&&0===t.toLowerCase().indexOf("fscommand:")?this.fscommand(t.substring("fscommand:".length),e):((o="string"==typeof e&&0===e.indexOf("_level"))&&(r=e.substr(6),o=(n=parseInt(r,10)).toString()===r),o?this.loadMovieNum(t,n,i):this.context.resolveTarget(e).loadMovie(t,i))},UMd.prototype.loadMovieNum=function(t,e,i){},UMd.prototype.loadVariables=function(t,e,i){void 0===i&&(i=""),t=alCoerceString(this.context,t),i=alCoerceString(this.context,i);var n=this.context.resolveTarget(e);n&&this._loadVariables(n,t,i)},UMd.prototype.loadVariablesNum=function(t,e,i){void 0===i&&(i=""),t=alCoerceString(this.context,t),e=alToInteger(this.context,e),i=alCoerceString(this.context,i);var n=this.context.resolveLevel(e);n&&this._loadVariables(n,t,i)},UMd.prototype._loadVariables=function(i,t,e){var n=this.context,r=new URLRequest(t);e&&(r.method=e);var o=new URLLoader;o.dataFormat="variables";var s=function(t){if(o.removeEventListener(URLLoaderEvent.LOAD_COMPLETE,s),o.dataFormat==URLLoaderDataFormat.VARIABLES)for(var e in o.data)n.utils.setProperty(i,e,o.data[e]);i instanceof AVM1MovieClip&&avm1BroadcastEvent(n,i,"onData")};o.addEventListener(URLLoaderEvent.LOAD_COMPLETE,s),o.load(r)},UMd.prototype.mbchr=function(t){return(t=alToInteger(this.context,t))?String.fromCharCode(t):""},UMd.prototype.mblength=function(t){return(""+t).length},UMd.prototype.mbord=function(t){return(""+t).charCodeAt(0)},UMd.prototype.mbsubstring=function(t,e,i){return e!==(0|e)||i!==(0|i)?"":(i<0&&(i=void 0),(""+t).substr(e=e<1?0:e-1,i))},UMd.prototype.nextFrame=function(){var t=getAwayJSAdaptee(this.context.resolveTarget(null));t.stop(),++t.currentFrameIndex},UMd.prototype.nextScene=function(){},UMd.prototype.ord=function(t){return(""+t).charCodeAt(0)},UMd.prototype.play=function(){this.context.resolveTarget(null).play()},UMd.prototype.prevFrame=function(){var t=getAwayJSAdaptee(this.context.resolveTarget(null));--t.currentFrameIndex,t.stop()},UMd.prototype.prevScene=function(){},UMd.prototype.print=function(t,e){},UMd.prototype.printAsBitmap=function(t,e){},UMd.prototype.printAsBitmapNum=function(t,e){},UMd.prototype.printNum=function(t,e){},UMd.prototype.random=function(t){return AVM1Globals.randomProvider?0|AVM1Globals.randomProvider.random()*(0|t):0|Math.random()*(0|t)},UMd.prototype.removeMovieClip=function(t){var e;!t||(e=this.context.resolveTarget(t))&&e.removeMovieClip()},UMd.prototype.startDrag=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=this.context.resolveTarget(t);n&&n.startDrag.apply(n,e)},UMd.prototype.stop=function(){this.context.resolveTarget(null).stop()},UMd.prototype._stopSoundsOnObjectsRecursivly=function(t){if(t._children)for(var e=0;e<t._children.length;e++)t._children[e].isAsset(MovieClip)?t._children[e].stopSounds():this._stopSoundsOnObjectsRecursivly(t._children[e])},UMd.prototype.stopAllSounds=function(){AudioManager.stopAllSounds(),this._stopSoundsOnObjectsRecursivly(AVM1Stage.avmStage)},UMd.prototype.stopDrag=function(){AVM1MovieClip.currentDraggedMC&&AVM1MovieClip.currentDraggedMC.stopDrag()},UMd.prototype.substring=function(t,e,i){return this.mbsubstring(t,e,i)},UMd.prototype.toggleHighQuality=function(){},UMd.prototype.trace=function(t){if(AVM1Globals.tracelevel!=TraceLevel.NONE){var e,i=!1;switch(typeof t){case"undefined":e="undefined";break;case"string":i=0<(e=t).length&&"!"==e[0];break;default:e=alToString(this.context,t)}AVM1Globals.tracelevel==TraceLevel.IMPORTANT&&!i||console.log("%cAVM1 trace: %c "+e+" ","color: #054996","background: #eee; color: #054996")}},UMd.prototype.unloadMovie=function(t){var e=this.context.resolveTarget(t);e&&e.unloadMovie()},UMd.prototype.unloadMovieNum=function(t){0!==(t=alToInt32(this.context,t))&&this.context.levelsContainer._removeRoot(t)},UMd),AVM1ObjectPrototype=(EOd=AVM1Object,__extends(FOd,EOd),FOd.prototype._initializePrototype=function(){alDefineObjectProperties(this,{constructor:{value:this.context.builtins.Object,writable:!0},valueOf:{value:this._valueOf,writable:!0},toString:{value:this._toString,writable:!0},addProperty:{value:this.addProperty},hasOwnProperty:{value:this.hasOwnProperty},isPropertyEnumerable:{value:this.isPropertyEnumerable},isPrototypeOf:{value:this.isPrototypeOf},unwatch:{value:this.unwatch},watch:{value:this.watch}})},FOd.prototype._valueOf=function(){return this},FOd.prototype._toString=function(){return alIsFunction(this)?"[type "+alGetObjectClass(this)+"]":"[object "+alGetObjectClass(this)+"]"},FOd.prototype.addProperty=function(t,e,i){if("string"!=typeof t||""===t)return!1;if(!alIsFunction(e))return!1;if(!alIsFunction(i)&&null!==i)return!1;var n=this.alGetOwnProperty(t);return!(n&&2&n.flags||(this.alSetOwnProperty(t,new AVM1PropertyDescriptor(128,null,e,i||void 0)),0))},FOd.prototype.hasOwnProperty=function(t){return this.alHasOwnProperty(t)},FOd.prototype.isPropertyEnumerable=function(t){return!(1&this.alGetProperty(t).flags)},FOd.prototype.isPrototypeOf=function(t){return alInstanceOf(this.context,this,t)},FOd.prototype.unwatch=function(t){return t=alCoerceString(this.context,t),this.alRemotePropertyWatcher(t)},FOd.prototype.watch=function(t,e,i){return t=alCoerceString(this.context,t),!!alIsFunction(e)&&this.alAddPropertyWatcher(t,e,i)},FOd),AVM1ObjectFunction=(SOd=AVM1Function,__extends(TOd,SOd),TOd.prototype.registerClass=function(t,e){this.context.registerClass(t,e)},TOd.prototype.alConstruct=function(t){if(t){var e=t[0];if(e instanceof AVM1Object)return e;switch(typeof e){case"string":case"boolean":case"number":return alToObject(this.context,e)}}return alNewObject(this.context)},TOd.prototype.alCall=function(t,e){return e&&null!==e[0]&&void 0!==e[0]?alToObject(this.context,e[0]):alNewObject(this.context)},TOd),AVM1FunctionPrototype=(aPd=AVM1Object,__extends(bPd,aPd),bPd.prototype._initializePrototype=function(){var t=this.context;this.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(this,{constructor:{value:t.builtins.Function,writable:!0},call:this.call,apply:this.apply})},bPd.prototype.call=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return alEnsureType(this,AVM1Function).alCall(t,e)},bPd.prototype.apply=function(t,e){var i=alEnsureType(this,AVM1Function),n=e?alEnsureType(e,AVM1ArrayNative).value:void 0;return i.alCall(t,n)},bPd),AVM1FunctionFunction=(mPd=AVM1Function,__extends(nPd,mPd),nPd.prototype.alConstruct=function(t){return t?t[0]:void 0},nPd.prototype.alCall=function(t,e){return e?e[0]:void 0},nPd),AVM1BooleanNative=(tPd=AVM1Object,__extends(uPd,tPd),uPd.prototype.valueOf=function(){return this.value},uPd),AVM1BooleanPrototype=(yPd=AVM1Object,__extends(zPd,yPd),zPd.prototype._valueOf=function(){return alEnsureType(this,AVM1BooleanNative).value},zPd.prototype._toString=function(){return alEnsureType(this,AVM1BooleanNative).value?"true":"false"},zPd),AVM1BooleanFunction=(CPd=AVM1Function,__extends(DPd,CPd),DPd.prototype.alConstruct=function(t){var e=!!t&&alToBoolean(this.context,t[0]);return new AVM1BooleanNative(this.context,e)},DPd.prototype.alCall=function(t,e){return!!e&&alToBoolean(this.context,e[0])},DPd),AVM1NumberNative=(KPd=AVM1Object,__extends(LPd,KPd),LPd.prototype.valueOf=function(){return this.value},LPd),AVM1NumberPrototype=(PPd=AVM1Object,__extends(QPd,PPd),QPd.prototype._valueOf=function(){return alEnsureType(this,AVM1NumberNative).value},QPd.prototype._toString=function(t){return alEnsureType(this,AVM1NumberNative).value.toString(t||10)},QPd),AVM1NumberFunction=(UPd=AVM1Function,__extends(VPd,UPd),VPd.prototype.alConstruct=function(t){var e=t?alToNumber(this.context,t[0]):0;return new AVM1NumberNative(this.context,e)},VPd.prototype.alCall=function(t,e){return e?alToNumber(this.context,e[0]):0},VPd),AVM1StringNative=(aQd=AVM1Object,__extends(bQd,aQd),bQd.prototype.toString=function(){return this.value},bQd),AVM1StringPrototype=(fQd=AVM1Object,__extends(gQd,fQd),gQd.prototype._valueOf=function(){return alEnsureType(this,AVM1StringNative).value},gQd.prototype._toString=function(){return alEnsureType(this,AVM1StringNative).value},gQd.prototype.getLength=function(){return alEnsureType(this,AVM1StringNative).value.length},gQd.prototype.charAt=function(t){return alToString(this.context,this).charAt(alToInteger(this.context,t))},gQd.prototype.charCodeAt=function(t){return alToString(this.context,this).charCodeAt(alToInteger(this.context,t))},gQd.prototype.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var i=[alToString(this.context,this)],n=0;n<t.length;++n)i.push(alToString(this.context,t[n]));return i.join("")},gQd.prototype.indexOf=function(t,e){var i=alToString(this.context,this);return t=alToString(this.context,t),e=alToInteger(this.context,e),i.indexOf(t,e)},gQd.prototype.lastIndexOf=function(t,e){var i=alToString(this.context,this);return t=alToString(this.context,t),(e=arguments.length<2?NaN:alToNumber(this.context,e))<0?-1:i.lastIndexOf(t,isNaN(e)?void 0:e)},gQd.prototype.slice=function(t,e){if(0!==arguments.length){var i=alToString(this.context,this);return t=alToInteger(this.context,t),e=void 0===e?void 0:alToInteger(this.context,e),i.slice(t,e)}},gQd.prototype.split=function(t,e){var i=alToString(this.context,this);return void 0!==t?(t=alToString(this.context,t),e=(void 0===e?-1:alToInt32(this.context,e))>>>0,new AVM1ArrayNative(this.context,i.split(t,e))):new AVM1ArrayNative(this.context,[i])},gQd.prototype.substr=function(t,e){var i=alToString(this.context,this),n=i.length;if(t=alToInteger(this.context,t),e=void 0===e?n:alToInteger(this.context,e),t<0&&(t=Math.max(0,n+t)),e<0){if(-e<=t)return"";e=Math.max(0,n+e)}return i.substr(t,e)},gQd.prototype.substring=function(t,e){var i=alToString(this.context,this);return(t=alToInteger(this.context,t))>=i.length?"":(e=void 0===e?void 0:alToInteger(this.context,e),i.substring(t,e))},gQd.prototype.toLowerCase=function(){return alToString(this.context,this).toLowerCase()},gQd.prototype.toUpperCase=function(){return alToString(this.context,this).toUpperCase()},gQd),AVM1StringFunction=(IQd=AVM1Function,__extends(JQd,IQd),JQd.prototype.alConstruct=function(t){var e=t?alToString(this.context,t[0]):"";return new AVM1StringNative(this.context,e)},JQd.prototype.alCall=function(t,e){return e?alToString(this.context,e[0]):""},JQd.prototype.fromCharCode=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t=t.map(function(t){return 65535&alToInt32(e.context,t)}),String.fromCharCode.apply(String,t)},JQd),cachedArrayPropertyDescriptor=new AVM1PropertyDescriptor(64,void 0),AVM1ArrayNative=(UQd=AVM1Object,__extends(VQd,UQd),VQd.prototype.alGetOwnProperty=function(t){if(alIsIndex(this.context,t)){var e=alToInt32(this.context,t);if(Object.getOwnPropertyDescriptor(this.value,e))return cachedArrayPropertyDescriptor.value=this.value[e],cachedArrayPropertyDescriptor}return UQd.prototype.alGetOwnProperty.call(this,t)},VQd.prototype.alSetOwnProperty=function(t,e){if(alIsIndex(this.context,t)){var i=alToInt32(this.context,t);if(!(64&e.flags)||1&e.flags||2&e.flags)throw new Error("Special property is non-supported for array");this.value[i]=e.value}else UQd.prototype.alSetOwnProperty.call(this,t,e)},VQd.prototype.alDeleteOwnProperty=function(t){var e;alIsIndex(this.context,t)?(e=alToInt32(this.context,t),delete this.value[e]):UQd.prototype.alDeleteOwnProperty.call(this,t)},VQd.prototype.alGetOwnPropertiesKeys=function(){var t=UQd.prototype.alGetOwnPropertiesKeys.call(this),e=[];for(var i in this.value)e.push(i);return e.concat(t)},VQd.mapToJSArray=function(t,i,n){if(t instanceof VQd)return t.value.map(i,n);if(!alIsArrayLike(t.context,t))throw new Error("Invalid type");var r=[];return alIterateArray(t.context,t,function(t,e){r.push(i.call(n,t,e))}),r},VQd),AVM1ArraySortOnOptions,UQd,IQd,fQd,aQd,UPd,PPd,KPd,CPd,yPd,tPd,mPd,aPd,SOd,EOd,LLd,HLd,nLd,nRd;function VQd(t,e){var i=UQd.call(this,t)||this;return i.alPrototype=t.builtins.Array.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.Array),i.value=e,i}function JQd(t){var e=IQd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1StringPrototype(t)},fromCharCode:{value:e.fromCharCode}}),e}function gQd(t){var e=fQd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.String,writable:!0},valueOf:{value:e._valueOf,writable:!0},toString:{value:e._toString,writable:!0},length:{get:e.getLength},charAt:{value:e.charAt,writable:!0},charCodeAt:{value:e.charCodeAt,writable:!0},concat:{value:e.concat,writable:!0},indexOf:{value:e.indexOf,writable:!0},lastIndexOf:{value:e.lastIndexOf,writable:!0},slice:{value:e.slice,writable:!0},split:{value:e.split,writable:!0},substr:{value:e.substr,writable:!0},substring:{value:e.substring,writable:!0},toLowerCase:{value:e.toLowerCase,writable:!0},toUpperCase:{value:e.toUpperCase,writable:!0}}),e}function bQd(t,e){var i=aQd.call(this,t)||this;return i.alPrototype=t.builtins.String.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.String),i.value=e,i}function VPd(t){var e=UPd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1NumberPrototype(t)},MAX_VALUE:Number.MAX_VALUE,MIN_VALUE:Number.MIN_VALUE,NaN:Number.NaN,NEGATIVE_INFINITY:Number.NEGATIVE_INFINITY,POSITIVE_INFINITY:Number.POSITIVE_INFINITY}),e}function QPd(t){var e=PPd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.Number,writable:!0},valueOf:{value:e._valueOf,writable:!0},toString:{value:e._toString,writable:!0}}),e}function LPd(t,e){var i=KPd.call(this,t)||this;return i.alPrototype=t.builtins.Number.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.Number),i.value=e,i}function DPd(t){var e=CPd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1BooleanPrototype(t)}}),e}function zPd(t){var e=yPd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.Boolean,writable:!0},valueOf:{value:e._valueOf,writable:!0},toString:{value:e._toString,writable:!0}}),e}function uPd(t,e){var i=tPd.call(this,t)||this;return i.alPrototype=t.builtins.Boolean.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.Boolean),i.value=e,i}function nPd(t){var e=mPd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:t.builtins.Function.alGetPrototypeProperty()}}),e}function bPd(t){return aPd.call(this,t)||this}function TOd(t){var e=SOd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:t.builtins.Object.alGetPrototypeProperty()},registerClass:{value:e.registerClass}}),e}function FOd(t){return EOd.call(this,t)||this}function UMd(t){this.context=t}function MLd(t){var e=LLd.call(this,t)||this;return e.NaN=Number.NaN,e.Infinity=Number.POSITIVE_INFINITY,e.undefined=void 0,e._initBuiltins(t),t.swfVersion,e._initializeFlashObject(t),e}function KLd(){}function ILd(t){return HLd.call(this,t)||this}function oLd(){var t=null!==nLd&&nLd.apply(this,arguments)||this;return t.url="",t.targetMC=null,t._queued_focus_value=null,t._queued_focus=!1,t.callbackName="",t.callbackTarget=null,t}nRd=AVM1ArraySortOnOptions=AVM1ArraySortOnOptions||{},nRd[nRd.CASEINSENSITIVE=1]="CASEINSENSITIVE",nRd[nRd.DESCENDING=2]="DESCENDING",nRd[nRd.UNIQUESORT=4]="UNIQUESORT",nRd[nRd.RETURNINDEXEDARRAY=8]="RETURNINDEXEDARRAY",nRd[nRd.NUMERIC=16]="NUMERIC";var sortArray=function(t,i){var e=alEnsureType(t,AVM1ArrayNative).value;if(alIsFunction(i)){var n=[void 0,void 0];e.sort(function(t,e){return n[0]=t,n[1]=e,i.alCall(null,n)})}else{var r="number"==typeof i&&(i&AVM1ArraySortOnOptions.NUMERIC||-1==i),o="number"==typeof i&&i&AVM1ArraySortOnOptions.DESCENDING;if(r)e.sort(function(t,e){for(;t instanceof AVM1ArrayNative;)(t=alEnsureType(t,AVM1ArrayNative).value)&&0<t.length&&(t=t[0]);for(;e instanceof AVM1ArrayNative;)(e=alEnsureType(e,AVM1ArrayNative).value)&&0<e.length&&(e=e[0]);return t-e});else{for(var s=e.length;0<s;)void 0!==e[--s]&&null!==e[s]||(e[s]="00000000000AwayInternal");for(e.sort(function(t,e){for(;t instanceof AVM1ArrayNative;)(t=alEnsureType(t,AVM1ArrayNative).value)&&0<t.length&&(t=t[0]);for(;e instanceof AVM1ArrayNative;)(e=alEnsureType(e,AVM1ArrayNative).value)&&0<e.length&&(e=e[0]);return t<e?-1:1}),s=e.length;0<s;)"00000000000AwayInternal"==e[--s]&&(e[s]=void 0)}o&&e.reverse()}return t},AVM1ArrayPrototype=(BRd=AVM1Object,__extends(CRd,BRd),CRd.prototype._toString=function(){for(var t,e=this.alGet("length"),i=0,n="",i=0;i<e;i++)n+=void 0!==(t=this.alGet(i))?alToString(this.context,t)+(i==e-1?"":","):i==e-1?"":",";return n},CRd.prototype.getLength=function(){return alEnsureType(this,AVM1ArrayNative).value.length},CRd.prototype.setLength=function(t){null===t&&(t=0),isIndex(t)&&(t=alToInt32(this.context,t)>>>0,alEnsureType(this,AVM1ArrayNative).value.length=t)},CRd.prototype.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this instanceof AVM1ArrayNative){for(var i=alEnsureType(this,AVM1ArrayNative).value,n=0;n<t.length;n++)t[n]instanceof AVM1ArrayNative&&(t[n]=alEnsureType(t[n],AVM1ArrayNative).value);return new AVM1ArrayNative(this.context,Array.prototype.concat.apply(i,t))}for(var r=[],o=this,s=alIsArrayLike(this.context,this),n=0;s?alIterateArray(this.context,o,function(t){return r.push(t)}):r.push(alToString(this.context,o)),!(n>=t.length);)o=t[n++],s=alIsArray(this.context,o);return new AVM1ArrayNative(this.context,r)},CRd.prototype.join=function(t){if(t=void 0===t?",":alCoerceString(this.context,t),this instanceof AVM1ArrayNative){var e=alEnsureType(this,AVM1ArrayNative).value;if(0===e.length)return"";if(e.every(function(t){return!(t instanceof AVM1Object)}))return e.join(t)}var i=this.context,n=alToInt32(i,this.alGet("length"))>>>0;if(0==n)return"";for(var r=[],o=0;o<n;o++){var s=this.alGet(o);r[o]=null==s?"":alCoerceString(i,s)}return r.join(t)},CRd.prototype.pop=function(){if(this instanceof AVM1ArrayNative)return alEnsureType(this,AVM1ArrayNative).value.pop();var t=alToInt32(this.context,this.alGet("length"))>>>0;if(0!=t){var e=t-1,i=this.alGet(e);return this.alDeleteProperty(e),this.alPut("length",e),i}},CRd.prototype.push=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this instanceof AVM1ArrayNative){var i=alEnsureType(this,AVM1ArrayNative).value;return Array.prototype.push.apply(i,t)}for(var n=alToInt32(this.context,this.alGet("length"))>>>0,r=0;r<t.length;r++)this.alPut(n,t[r]),n++;return this.alPut("length",n),n},CRd.prototype.reverse=function(){for(var t=[],e=this.alGet("length"),i=0,i=0;i<e;i++)t[i]=this.alGet(i);for(i=e-1;0<=i;)this.alPut(e-1-i,t[i]),i--;return this.value},CRd.prototype.shift=function(){if(this instanceof AVM1ArrayNative)return alEnsureType(this,AVM1ArrayNative).value.shift();var t=alToInt32(this.context,this.alGet("length"))>>>0;if(0!=t){for(var e=this.alGet(0),i=1;i<t;i++)this.alHasProperty(i)?this.alPut(i-1,this.alGet(i)):this.alDeleteProperty(i-1);return this.alDeleteProperty(t-1),this.alPut("length",t-1),e}},CRd.prototype.slice=function(t,e){if(t=alToInteger(this.context,t),e=void 0!==e?alToInteger(this.context,e):void 0,this instanceof AVM1ArrayNative){var i=alEnsureType(this,AVM1ArrayNative).value;return new AVM1ArrayNative(this.context,i.slice(t,e))}var n=[],r=alToInt32(this.context,this.alGet("length"))>>>0;t=t<0?Math.max(r+t,0):Math.min(r,t),e=void 0===e?r:e<0?Math.max(r+e,0):Math.min(r,e);for(var o=t,s=0;o<e;o++,s++)this.alHasProperty(o)&&(n[s]=this.alGet(o));return new AVM1ArrayNative(this.context,n)},CRd.prototype.splice=function(t,e){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];t=alToInteger(this.context,t);var r=alToInt32(this.context,this.alGet("length"))>>>0;if(t=t<0?Math.max(r+t,0):Math.min(r,t),e=e||"number"==typeof e?alToInteger(this.context,e):r-t,this instanceof AVM1ArrayNative){var o=alEnsureType(this,AVM1ArrayNative).value;return new AVM1ArrayNative(this.context,Array.prototype.splice.apply(o,[t,e].concat(i)))}for(var s=[],a=0;a<e;a++)this.alHasProperty(t+a)&&(s[a]=this.alGet(t+a));var l=i.length-e;if(l<0){for(a=t-l;a<r;a++)this.alHasProperty(a)?this.alPut(a+l,this.alGet(a)):this.alDeleteProperty(a+l);for(a=l;a<0;a++)this.alDeleteProperty(r+a)}else if(0<l)for(a=r-1;t+l<=a;a--)this.alHasProperty(a)?this.alPut(a+l,this.alGet(a)):this.alDeleteProperty(a+l);for(a=0;a<i.length;a++)this.alPut(t+a,i[a]);return this.alPut("length",r+l),new AVM1ArrayNative(this.context,s)},CRd.prototype.sort=function(t){return sortArray(this,t)},CRd.prototype.sortOn=function(t,e){var p=this.context,d=[],_=[];if(alIsString(p,t))d=[alToString(p,t)],_=[alToInt32(p,e)];else{if(!alIsArray(p,t))return sortArray(this,e);d=[],_=[];var i=alIsArray(p,e)?e:null,n=alToInteger(p,t.alGet("length"));i&&n!==alToInteger(p,i.alGet("length"))&&(i=null);for(var r=0;r<n;r++)d.push(alToString(p,t.alGet(r))),_.push(i?alToInt32(p,i.alGet(r)):0)}return _[0],alEnsureType(this,AVM1ArrayNative).value.sort(function(t,e){for(;t instanceof AVM1ArrayNative;)(t=alEnsureType(t,AVM1ArrayNative).value)&&0<t.length&&(t=t[0]);for(;e instanceof AVM1ArrayNative;)(e=alEnsureType(e,AVM1ArrayNative).value)&&0<e.length&&(e=e[0]);for(var i=alToObject(p,t),n=alToObject(p,e),r=0;r<d.length;r++){var o,s,a,l,c,h=i.alGet(d[r]),u=n.alGet(d[r]);if(0!=(a=_[r]&AVM1ArraySortOnOptions.NUMERIC?(o=alToNumber(p,h))<(s=alToNumber(p,u))?-1:s<o?1:0:(l=alToString(p,h),c=alToString(p,u),_[r]&AVM1ArraySortOnOptions.CASEINSENSITIVE&&(l=l.toLowerCase(),c=c.toLowerCase()),l<c?-1:c<l?1:0)))return _[r]&AVM1ArraySortOnOptions.DESCENDING?-a:a}return 0}),this},CRd.prototype.unshift=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(this instanceof AVM1ArrayNative){var i=alEnsureType(this,AVM1ArrayNative).value;return Array.prototype.unshift.apply(i,t)}for(var n=alToInt32(this.context,this.alGet("length"))>>>0,r=t.length,o=n-1;0<=o;o--)this.alHasProperty(o)?this.alPut(o+r,this.alGet(o)):this.alDeleteProperty(o+r);for(o=0;o<t.length;o++)this.alPut(o,t[o]);return n+=r,this.alPut("length",n),n},CRd),AVM1ArrayFunction=(bTd=AVM1Function,__extends(cTd,bTd),cTd.prototype.alConstruct=function(t){if(!t)return new AVM1ArrayNative(this.context,[]);if(1!==t.length||"number"!=typeof t[0])return new AVM1ArrayNative(this.context,t);var e=t[0];if(e>>>0!==e)throw new Error("Range error");return new AVM1ArrayNative(this.context,new Array(e))},cTd.prototype.alCall=function(t,e){return this.alConstruct.apply(this,e)},cTd),AVM1MathObject=(jTd=AVM1Object,__extends(kTd,jTd),kTd.prototype.abs=function(t){return Math.abs(alToNumber(this.context,t))},kTd.prototype.acos=function(t){return Math.acos(alToNumber(this.context,t))},kTd.prototype.asin=function(t){return Math.asin(alToNumber(this.context,t))},kTd.prototype.atan=function(t){return Math.atan(alToNumber(this.context,t))},kTd.prototype.atan2=function(t,e){return Math.atan2(alToNumber(this.context,t),alToNumber(this.context,e))},kTd.prototype.ceil=function(t){return Math.ceil(alToNumber(this.context,t))},kTd.prototype.cos=function(t){return Math.cos(alToNumber(this.context,t))},kTd.prototype.exp=function(t){return Math.exp(alToNumber(this.context,t))},kTd.prototype.floor=function(t){return Math.floor(alToNumber(this.context,t))},kTd.prototype.log=function(t){return Math.log(alToNumber(this.context,t))},kTd.prototype.max=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t=t.map(function(t){return alToNumber(e.context,t)}),Math.max.apply(null,t)},kTd.prototype.min=function(){for(var e=this,t=[],i=0;i<arguments.length;i++)t[i]=arguments[i];return t=t.map(function(t){return alToNumber(e.context,t)}),Math.min.apply(null,t)},kTd.prototype.pow=function(t,e){return Math.pow(alToNumber(this.context,t),alToNumber(this.context,e))},kTd.prototype.random=function(){return AVM1Globals.randomProvider?AVM1Globals.randomProvider.random():Math.random()},kTd.prototype.round=function(t){return Math.round(alToNumber(this.context,t))},kTd.prototype.sin=function(t){return Math.sin(alToNumber(this.context,t))},kTd.prototype.sqrt=function(t){return Math.sqrt(alToNumber(this.context,t))},kTd.prototype.tan=function(t){return Math.tan(alToNumber(this.context,t))},kTd),AVM1DateNative=(MTd=AVM1Object,__extends(NTd,MTd),NTd.prototype.alDefaultValue=function(t){return void 0!==t?MTd.prototype.alDefaultValue.call(this,t):6<=this.context.swfVersion?MTd.prototype.alDefaultValue.call(this,1):MTd.prototype.alDefaultValue.call(this,0)},NTd),AVM1DatePrototype=(STd=AVM1Object,__extends(TTd,STd),TTd.prototype._valueOf=function(){return alEnsureType(this,AVM1DateNative).value.valueOf()},TTd.prototype._toString=function(){return alEnsureType(this,AVM1DateNative).value.toString()},TTd.prototype._toLocaleString=function(){return alEnsureType(this,AVM1DateNative).value.toLocaleString()},TTd.prototype.toDateString=function(){return alEnsureType(this,AVM1DateNative).value.toDateString()},TTd.prototype.toTimeString=function(){return alEnsureType(this,AVM1DateNative).value.toTimeString()},TTd.prototype.toLocaleDateString=function(){return alEnsureType(this,AVM1DateNative).value.toLocaleDateString()},TTd.prototype.toLocaleTimeString=function(){return alEnsureType(this,AVM1DateNative).value.toLocaleTimeString()},TTd.prototype.getTime=function(){return alEnsureType(this,AVM1DateNative).value.getTime()},TTd.prototype.getFullYear=function(){return alEnsureType(this,AVM1DateNative).value.getFullYear()},TTd.prototype.getUTCFullYear=function(){return alEnsureType(this,AVM1DateNative).value.getUTCFullYear()},TTd.prototype.getMonth=function(){return alEnsureType(this,AVM1DateNative).value.getMonth()},TTd.prototype.getUTCMonth=function(){return alEnsureType(this,AVM1DateNative).value.getUTCMonth()},TTd.prototype.getDate=function(){return alEnsureType(this,AVM1DateNative).value.getDate()},TTd.prototype.getUTCDate=function(){return alEnsureType(this,AVM1DateNative).value.getUTCDate()},TTd.prototype.getDay=function(){return alEnsureType(this,AVM1DateNative).value.getDay()},TTd.prototype.getUTCDay=function(){return alEnsureType(this,AVM1DateNative).value.getUTCDay()},TTd.prototype.getHours=function(){return alEnsureType(this,AVM1DateNative).value.getHours()},TTd.prototype.getUTCHours=function(){return alEnsureType(this,AVM1DateNative).value.getUTCHours()},TTd.prototype.getMinutes=function(){return alEnsureType(this,AVM1DateNative).value.getMinutes()},TTd.prototype.getUTCMinutes=function(){return alEnsureType(this,AVM1DateNative).value.getUTCMinutes()},TTd.prototype.getSeconds=function(){return alEnsureType(this,AVM1DateNative).value.getSeconds()},TTd.prototype.getUTCSeconds=function(){return alEnsureType(this,AVM1DateNative).value.getUTCSeconds()},TTd.prototype.getMilliseconds=function(){return alEnsureType(this,AVM1DateNative).value.getMilliseconds()},TTd.prototype.getUTCMilliseconds=function(){return alEnsureType(this,AVM1DateNative).value.getUTCMilliseconds()},TTd.prototype.getTimezoneOffset=function(){return alEnsureType(this,AVM1DateNative).value.getTimezoneOffset()},TTd.prototype.setTime=function(t){return t=alToNumber(this.context,t),alEnsureType(this,AVM1DateNative).value.setTime(t)},TTd.prototype.setMilliseconds=function(t){return t=alToNumber(this.context,t),alEnsureType(this,AVM1DateNative).value.setMilliseconds(t)},TTd.prototype.setUTCMilliseconds=function(t){return t=alToNumber(this.context,t),alEnsureType(this,AVM1DateNative).value.setUTCMilliseconds(t)},TTd.prototype.setSeconds=function(t,e){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setSeconds(t):(e=alToNumber(this.context,e),alEnsureType(this,AVM1DateNative).value.setSeconds(t,e))},TTd.prototype.setUTCSeconds=function(t,e){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setUTCSeconds(t):(e=alToNumber(this.context,e),alEnsureType(this,AVM1DateNative).value.setUTCSeconds(t,e))},TTd.prototype.setMinutes=function(t,e,i){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setMinutes(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setMinutes(t,e):(i=alToNumber(this.context,i),alEnsureType(this,AVM1DateNative).value.setMinutes(t,e,i)))},TTd.prototype.setUTCMinutes=function(t,e,i){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setUTCMinutes(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setUTCMinutes(t,e):(i=alToNumber(this.context,i),alEnsureType(this,AVM1DateNative).value.setUTCMinutes(t,e,i)))},TTd.prototype.setHours=function(t,e,i,n){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setHours(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setHours(t,e):(i=alToNumber(this.context,i),arguments.length<=3?alEnsureType(this,AVM1DateNative).value.setHours(t,e,i):(n=alToNumber(this.context,n),alEnsureType(this,AVM1DateNative).value.setHours(t,e,i,n))))},TTd.prototype.setUTCHours=function(t,e,i,n){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setUTCHours(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setUTCHours(t,e):(i=alToNumber(this.context,i),arguments.length<=3?alEnsureType(this,AVM1DateNative).value.setUTCHours(t,e,i):(n=alToNumber(this.context,n),alEnsureType(this,AVM1DateNative).value.setUTCHours(t,e,i,n))))},TTd.prototype.setDate=function(t){return t=alToNumber(this.context,t),alEnsureType(this,AVM1DateNative).value.setDate(t)},TTd.prototype.setUTCDate=function(t){return t=alToNumber(this.context,t),alEnsureType(this,AVM1DateNative).value.setUTCDate(t)},TTd.prototype.setMonth=function(t,e){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setMonth(t):(e=alToNumber(this.context,e),alEnsureType(this,AVM1DateNative).value.setMonth(t,e))},TTd.prototype.setUTCMonth=function(t,e){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setUTCMonth(t):(e=alToNumber(this.context,e),alEnsureType(this,AVM1DateNative).value.setUTCMonth(t,e))},TTd.prototype.setFullYear=function(t,e,i){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setFullYear(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setFullYear(t,e):(i=alToNumber(this.context,i),alEnsureType(this,AVM1DateNative).value.setFullYear(t,e,i)))},TTd.prototype.setUTCFullYear=function(t,e,i){return t=alToNumber(this.context,t),arguments.length<=1?alEnsureType(this,AVM1DateNative).value.setUTCFullYear(t):(e=alToNumber(this.context,e),arguments.length<=2?alEnsureType(this,AVM1DateNative).value.setUTCFullYear(t,e):(i=alToNumber(this.context,i),alEnsureType(this,AVM1DateNative).value.setUTCFullYear(t,e,i)))},TTd.prototype.toUTCString=function(){return alEnsureType(this,AVM1DateNative).value.toUTCString()},TTd),AVM1DateFunction=(BUd=AVM1Function,__extends(CUd,BUd),CUd.prototype.alConstruct=function(t){var e,i=this.context;switch(t.length){case 0:e=new Date;break;case 1:e=new Date(alToPrimitive(i,t[0]));break;default:for(var n=[],r=0;r<t.length;r++)n.push(alToNumber(i,t[r]));e=new Date(alToNumber(i,t[0]),alToNumber(i,t[1]),2<t.length?alToNumber(i,t[2]):1,3<t.length?alToNumber(i,t[3]):0,4<t.length?alToNumber(i,t[4]):0,5<t.length?alToNumber(i,t[5]):0,6<t.length?alToNumber(i,t[6]):0)}return new AVM1DateNative(i,e)},CUd.prototype.alCall=function(t,e){return alCallProperty(this.alConstruct.apply(this,e),"toString")},CUd.prototype._UTC=function(t,e,i,n,r,o){var s=this.context;return Date.UTC(alToNumber(s,t),alToNumber(s,e),2<arguments.length?alToNumber(s,i):1,3<arguments.length?alToNumber(s,n):0,4<arguments.length?alToNumber(s,r):0,5<arguments.length?alToNumber(s,o):0,6<arguments.length?alToNumber(s,arguments[6]):0)},CUd),AVM1ErrorNative=(TUd=AVM1Object,__extends(UUd,TUd),UUd),AVM1ErrorPrototype=(YUd=AVM1Object,__extends(ZUd,YUd),ZUd.prototype._toString=function(){return this.alGet("message")},ZUd),AVM1ErrorFunction=(aVd=AVM1Function,__extends(bVd,aVd),bVd.prototype.alConstruct=function(t){var e=t&&void 0!==t[0]?alCoerceString(this.context,t[0]):void 0;return new AVM1ErrorNative(this.context,e)},bVd.prototype.alCall=function(t,e){var i=e&&void 0!==e[0]?alCoerceString(this.context,e[0]):void 0;return new AVM1ErrorNative(this.context,i)},bVd),aVd,YUd,TUd,BUd,STd,MTd,jTd,bTd,BRd;function bVd(t){var e=aVd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1ErrorPrototype(t)}}),e}function ZUd(t){var e=YUd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.Error,writable:!0},name:{value:"Error",writable:!0},message:{value:"Error",writable:!0},toString:{value:e._toString,writable:!0}}),e}function UUd(t,e){var i=TUd.call(this,t)||this;return i.alPrototype=t.builtins.Error.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.Error),void 0!==e&&i.alPut("message",e),i}function CUd(t){var e=BUd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1DatePrototype(t)},UTC:{value:e._UTC,writable:!0}}),e}function TTd(t){var e=STd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.Date,writable:!0},valueOf:{value:e._valueOf,writable:!0},toString:{value:e._toString,writable:!0},toLocaleString:{value:e._toLocaleString,writable:!0},toDateString:{value:e.toDateString,writable:!0},toTimeString:{value:e.toTimeString,writable:!0},toLocaleDateString:{value:e.toLocaleDateString,writable:!0},toLocaleTimeString:{value:e.toLocaleTimeString,writable:!0},getTime:{value:e.getTime,writable:!0},getFullYear:{value:e.getFullYear,writable:!0},getUTCFullYear:{value:e.getUTCFullYear,writable:!0},getMonth:{value:e.getMonth,writable:!0},getUTCMonth:{value:e.getUTCMonth,writable:!0},getDate:{value:e.getDate,writable:!0},getUTCDate:{value:e.getUTCDate,writable:!0},getDay:{value:e.getDay,writable:!0},getUTCDay:{value:e.getUTCDay,writable:!0},getHours:{value:e.getHours,writable:!0},getUTCHours:{value:e.getUTCHours,writable:!0},getMinutes:{value:e.getMinutes,writable:!0},getUTCMinutes:{value:e.getUTCMinutes,writable:!0},getSeconds:{value:e.getSeconds,writable:!0},getUTCSeconds:{value:e.getUTCSeconds,writable:!0},getMilliseconds:{value:e.getMilliseconds,writable:!0},getUTCMilliseconds:{value:e.getUTCMilliseconds,writable:!0},getTimezoneOffset:{value:e.getTimezoneOffset,writable:!0},setTime:{value:e.setTime,writable:!0},setMilliseconds:{value:e.setMilliseconds,writable:!0},setUTCMilliseconds:{value:e.setUTCMilliseconds,writable:!0},setSeconds:{value:e.setSeconds,writable:!0},setUTCSeconds:{value:e.setUTCSeconds,writable:!0},setMinutes:{value:e.setMinutes,writable:!0},setUTCMinutes:{value:e.setUTCMinutes,writable:!0},setHours:{value:e.setHours,writable:!0},setUTCHours:{value:e.setUTCHours,writable:!0},setDate:{value:e.setDate,writable:!0},setUTCDate:{value:e.setUTCDate,writable:!0},setMonth:{value:e.setMonth,writable:!0},setUTCMonth:{value:e.setUTCMonth,writable:!0},setFullYear:{value:e.setFullYear,writable:!0},setUTCFullYear:{value:e.setUTCFullYear,writable:!0},toUTCString:{value:e.toUTCString,writable:!0}}),e}function NTd(t,e){var i=MTd.call(this,t)||this;return i.alPrototype=t.builtins.Date.alGetPrototypeProperty(),i.alSetOwnConstructorProperty(t.builtins.Date),i.value=e,i}function kTd(t){var e=jTd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{E:Math.E,LN10:Math.LN10,LN2:Math.LN2,LOG10E:Math.LOG10E,LOG2E:Math.LOG2E,PI:Math.PI,SQRT1_2:Math.SQRT1_2,SQRT2:Math.SQRT2,abs:e.abs,acos:e.acos,asin:e.asin,atan:e.atan,atan2:e.atan2,ceil:e.ceil,cos:e.cos,exp:e.exp,floor:e.floor,log:e.log,max:e.max,min:e.min,pow:e.pow,random:e.random,round:e.round,sin:e.sin,sqrt:e.sqrt,tan:e.tan}),e}function cTd(t){var e=bTd.call(this,t)||this;return e.alPrototype=t.builtins.Function.alGetPrototypeProperty(),alDefineObjectProperties(e,{prototype:{value:new AVM1ArrayPrototype(t)}}),alDefineObjectProperties(e,{NUMERIC:{value:AVM1ArraySortOnOptions.NUMERIC}}),alDefineObjectProperties(e,{DESCENDING:{value:AVM1ArraySortOnOptions.DESCENDING}}),e}function CRd(t){var e=BRd.call(this,t)||this;return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),alDefineObjectProperties(e,{constructor:{value:t.builtins.Array,writable:!0},join:{value:e.join,writable:!0},length:{get:e.getLength,set:e.setLength},concat:{value:e.concat,writable:!0},pop:{value:e.pop,writable:!0},push:{value:e.push,writable:!0},reverse:{value:e.reverse,writable:!0},shift:{value:e.shift,writable:!0},slice:{value:e.slice,writable:!0},splice:{value:e.splice,writable:!0},sort:{value:e.sort,writable:!0},sortOn:{value:e.sortOn,writable:!0},toString:{value:e._toString,writable:!0},unshift:{value:e.unshift,writable:!0}}),e}function alEnsureType(t,e){if(t instanceof e)return t;throw new Error("Invalid type")}function installBuiltins(t){var e=t.builtins,i=new AVM1ObjectPrototype(t),n=new AVM1Object(t);n.alSetOwnPrototypeProperty(i),e.Object=n;var r=new AVM1FunctionPrototype(t),o=new AVM1Object(t);o.alSetOwnPrototypeProperty(r),e.Function=o,i._initializePrototype(),r._initializePrototype(),e.Object=new AVM1ObjectFunction(t),e.Function=new AVM1FunctionFunction(t),e.Boolean=new AVM1BooleanFunction(t),e.Number=new AVM1NumberFunction(t),e.String=new AVM1StringFunction(t),e.Array=new AVM1ArrayFunction(t),e.Date=new AVM1DateFunction(t),e.Math=new AVM1MathObject(t),e.Error=new AVM1ErrorFunction(t)}var big=createCommonjsModule(function(t){function v(t,e,i,n){var r=t.c,o=t.e+e+1;if(o<r.length){if(1===i)n=5<=r[o];else if(2===i)n=5<r[o]||5==r[o]&&(n||o<0||void 0!==r[o+1]||1&r[o-1]);else if(3===i)n=n||!!r[0];else if(n=!1,0!==i)throw Error("[big.js] Invalid rounding mode");if(o<1)r.length=1,n?(t.e=-e,r[0]=1):r[0]=t.e=0;else{if(r.length=o--,n)for(;9<++r[o];)r[o]=0,o--||(++t.e,r.unshift(1));for(o=r.length;!r[--o];)r.pop()}}else if(i<0||3<i||i!==~~i)throw Error("[big.js] Invalid rounding mode");return t}function e(t,e,i,n){var r,o,s=t.constructor,a=!t.c[0];if(void 0!==i){if(i!==~~i||i<(3==e)||1e6<i)throw Error(3==e?l+"precision":x);for(i=n-(t=new s(t)).e,t.c.length>++n&&v(t,i,s.RM),2==e&&(n=t.e+i+1);t.c.length<n;)t.c.push(0)}if(r=t.e,i=(o=t.c.join("")).length,2!=e&&(1==e||3==e&&n<=r||r<=s.NE||r>=s.PE))o=o.charAt(0)+(1<i?"."+o.slice(1):"")+(r<0?"e":"e+")+r;else if(r<0){for(;++r;)o="0"+o;o="0."+o}else if(0<r)if(++r>i)for(r-=i;r--;)o+="0";else r<i&&(o=o.slice(0,r)+"."+o.slice(r));else 1<i&&(o=o.charAt(0)+"."+o.slice(1));return t.s<0&&(!a||4==e)?"-"+o:o}var i,n,l,x,r,o;i=commonjsGlobal,x=(l="[big.js] Invalid ")+"decimal places",o=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,(r={}).abs=function(){var t=new this.constructor(this);return t.s=1,t},r.cmp=function(t){var e,i=this.c,n=(t=new this.constructor(t)).c,r=this.s,o=t.s,s=this.e,a=t.e;if(!i[0]||!n[0])return i[0]?r:n[0]?-o:0;if(r!=o)return r;if(e=r<0,s!=a)return a<s^e?1:-1;for(o=(s=i.length)<(a=n.length)?s:a,r=-1;++r<o;)if(i[r]!=n[r])return i[r]>n[r]^e?1:-1;return s==a?0:a<s^e?1:-1},r.div=function(t){var e=this.constructor,i=this.c,n=(t=new e(t)).c,r=this.s==t.s?1:-1,o=e.DP;if(o!==~~o||o<0||1e6<o)throw Error(x);if(!n[0])throw Error("[big.js] Division by zero");if(!i[0])return new e(0*r);var s,a,l,c,h,u=n.slice(),p=s=n.length,d=i.length,_=i.slice(0,s),f=_.length,m=t,g=m.c=[],y=0,b=o+(m.e=this.e-t.e)+1;for(m.s=r,r=b<0?0:b,u.unshift(0);f++<s;)_.push(0);do{for(l=0;l<10;l++){if(s!=(f=_.length))c=f<s?1:-1;else for(h=-1,c=0;++h<s;)if(n[h]!=_[h]){c=n[h]>_[h]?1:-1;break}if(!(c<0))break;for(a=f==s?n:u;f;){if(_[--f]<a[f]){for(h=f;h&&!_[--h];)_[h]=9;--_[h],_[f]+=10}_[f]-=a[f]}for(;!_[0];)_.shift()}g[y++]=c?l:++l,_[0]&&c?_[f]=i[p]||0:_=[i[p]]}while((p++<d||void 0!==_[0])&&r--);return g[0]||1==y||(g.shift(),m.e--),b<y&&v(m,o,e.RM,void 0!==_[0]),m},r.eq=function(t){return!this.cmp(t)},r.gt=function(t){return 0<this.cmp(t)},r.gte=function(t){return-1<this.cmp(t)},r.lt=function(t){return this.cmp(t)<0},r.lte=function(t){return this.cmp(t)<1},r.minus=r.sub=function(t){var e,i,n,r,o=this.constructor,s=this.s,a=(t=new o(t)).s;if(s!=a)return t.s=-a,this.plus(t);var l=this.c.slice(),c=this.e,h=t.c,u=t.e;if(!l[0]||!h[0])return h[0]?(t.s=-a,t):new o(l[0]?this:0);if(s=c-u){for((n=(r=s<0)?(s=-s,l):(u=c,h)).reverse(),a=s;a--;)n.push(0);n.reverse()}else for(i=((r=l.length<h.length)?l:h).length,s=a=0;a<i;a++)if(l[a]!=h[a]){r=l[a]<h[a];break}if(r&&(n=l,l=h,h=n,t.s=-t.s),0<(a=(i=h.length)-(e=l.length)))for(;a--;)l[e++]=0;for(a=e;s<i;){if(l[--i]<h[i]){for(e=i;e&&!l[--e];)l[e]=9;--l[e],l[i]+=10}l[i]-=h[i]}for(;0===l[--a];)l.pop();for(;0===l[0];)l.shift(),--u;return l[0]||(t.s=1,l=[u=0]),t.c=l,t.e=u,t},r.mod=function(t){var e,i=this,n=i.constructor,r=i.s,o=(t=new n(t)).s;if(!t.c[0])throw Error("[big.js] Division by zero");return e=(i.s=t.s=1)==t.cmp(i),i.s=r,t.s=o,e?new n(i):(r=n.DP,o=n.RM,n.DP=n.RM=0,i=i.div(t),n.DP=r,n.RM=o,this.minus(i.times(t)))},r.plus=r.add=function(t){var e,i=this.constructor,n=this.s,r=(t=new i(t)).s;if(n!=r)return t.s=-r,this.minus(t);var o=this.e,s=this.c,a=t.e,l=t.c;if(!s[0]||!l[0])return l[0]?t:new i(s[0]?this:0*n);if(s=s.slice(),n=o-a){for((e=0<n?(a=o,l):(n=-n,s)).reverse();n--;)e.push(0);e.reverse()}for(s.length-l.length<0&&(e=l,l=s,s=e),n=l.length,r=0;n;s[n]%=10)r=(s[--n]=s[n]+l[n]+r)/10|0;for(r&&(s.unshift(r),++a),n=s.length;0===s[--n];)s.pop();return t.c=s,t.e=a,t},r.pow=function(t){var e=this,i=new e.constructor(1),n=i,r=t<0;if(t!==~~t||t<-1e6||1e6<t)throw Error(l+"exponent");for(r&&(t=-t);1&t&&(n=n.times(e)),t>>=1;)e=e.times(e);return r?i.div(n):n},r.round=function(t,e){var i=this.constructor;if(void 0===t)t=0;else if(t!==~~t||t<-1e6||1e6<t)throw Error(x);return v(new i(this),t,void 0===e?i.RM:e)},r.sqrt=function(){var t,e,i,n=this.constructor,r=this.s,o=this.e,s=new n(.5);if(!this.c[0])return new n(this);if(r<0)throw Error("[big.js] No square root");for(o=(t=0===(r=Math.sqrt(this+""))||r===1/0?((e=this.c.join("")).length+o&1||(e+="0"),o=((o+1)/2|0)-(o<0||1&o),new n(((r=Math.sqrt(e))==1/0?"1e":(r=r.toExponential()).slice(0,r.indexOf("e")+1))+o)):new n(r)).e+(n.DP+=4);i=t,t=s.times(i.plus(this.div(i))),i.c.slice(0,o).join("")!==t.c.slice(0,o).join(""););return v(t,n.DP-=4,n.RM)},r.times=r.mul=function(t){var e,i=this.constructor,n=this.c,r=(t=new i(t)).c,o=n.length,s=r.length,a=this.e,l=t.e;if(t.s=this.s==t.s?1:-1,!n[0]||!r[0])return new i(0*t.s);for(t.e=a+l,o<s&&(e=n,n=r,r=e,l=o,o=s,s=l),e=new Array(l=o+s);l--;)e[l]=0;for(a=s;a--;){for(s=0,l=o+a;a<l;)s=e[l]+r[a]*n[l-a-1]+s,e[l--]=s%10,s=s/10|0;e[l]=(e[l]+s)%10}for(s?++t.e:e.shift(),a=e.length;!e[--a];)e.pop();return t.c=e,t},r.toExponential=function(t){return e(this,1,t,t)},r.toFixed=function(t){return e(this,2,t,this.e+t)},r.toPrecision=function(t){return e(this,3,t,t-1)},r.toString=function(){return e(this)},r.valueOf=r.toJSON=function(){return e(this,4)},(n=function e(){function i(t){if(!(this instanceof i))return void 0===t?e():new i(t);t instanceof i?(this.s=t.s,this.e=t.e,this.c=t.c.slice()):function(t,e){var i,n,r;if(0===e&&1/e<0)e="-0";else if(!o.test(e+=""))throw Error(l+"number");for(t.s="-"==e.charAt(0)?(e=e.slice(1),-1):1,-1<(i=e.indexOf("."))&&(e=e.replace(".","")),0<(n=e.search(/e/i))?(i<0&&(i=n),i+=+e.slice(n+1),e=e.substring(0,n)):i<0&&(i=e.length),r=e.length,n=0;n<r&&"0"==e.charAt(n);)++n;if(n==r)t.c=[t.e=0];else{for(;0<r&&"0"==e.charAt(--r););for(t.e=i-n-1,t.c=[],i=0;n<=r;)t.c[i++]=+e.charAt(n++)}}(this,t),this.constructor=i}return i.prototype=r,i.DP=20,i.RM=1,i.NE=-7,i.PE=21,i.version="5.2.2",i}()).default=n.Big=n,t.exports?t.exports=n:i.Big=n}),AVM1NativeFunction=(KXd=AVM1Function,__extends(LXd,KXd),LXd.prototype.alConstruct=function(t){if(!this._ctor)throw new Error("not a constructor");return this._ctor.apply(this,t)},LXd.prototype.alCall=function(t,e){if(!this._fn)throw new Error("not callable");return this._fn.apply(t,e)},LXd),AVM1EvalFunction=(TXd=AVM1Function,__extends(UXd,TXd),UXd.prototype.alConstruct=function(t){var e=new AVM1Object(this.context),i=this.alGetPrototypeProperty();i instanceof AVM1Object||(i=this.context.builtins.Object.alGetPrototypeProperty()),e.alPrototype=i,e.alSetOwnConstructorProperty(this);var n=this.alCall(e,t);return n instanceof AVM1Object?n:e},UXd),TXd,KXd;function UXd(t){var e=TXd.call(this,t)||this,i=new AVM1Object(t);return i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),i.alSetOwnProperty("constructor",new AVM1PropertyDescriptor(67)),e.alSetOwnPrototypeProperty(i),e}function LXd(t,e,i){var n=KXd.call(this,t)||this;return n._fn=e,i&&(n._ctor=i),n}function AVM1TypeError(t){}function alToPrimitive(t,e,i){if(!(e instanceof AVM1Object))return e;var n=e;return void 0!==i?n.alDefaultValue(i):n.alDefaultValue()}function bToRuntimeBool(t,e){var i=5<=t.swfVersion;return t.swfVersion,i?!!e:+e}function alToBoolean(t,e){var i=7<=t.swfVersion;switch(typeof e){case"undefined":return!1;case"object":return null!==e;case"boolean":return e;case"string":return i?!!e:!isNaN(+e)&&0!=+e;case"number":return!!e}}function alToNumber(t,e){switch("object"==typeof e&&null!==e&&(e=alToPrimitive(t,e,0)),typeof e){case"undefined":return 7<=t.swfVersion?NaN:0;case"object":return null===e?7<=t.swfVersion?NaN:0:void 0!==e.nodeValue?parseFloat(e.nodeValue):5<=t.swfVersion?NaN:0;case"boolean":return e?1:0;case"number":return e;case"string":return""===e&&t.swfVersion<5?0:""===e?NaN:+e}}function alToInteger(t,e){var i=alToNumber(t,e);return isNaN(i)?0:0===i||i===Number.POSITIVE_INFINITY||i===Number.NEGATIVE_INFINITY?i:i<0?Math.ceil(i):Math.floor(i)}function alToInt32(t,e){return 0|alToNumber(t,e)}function alToString(t,e){switch("object"==typeof e&&null!==e&&(e=alToPrimitive(t,e,1)),typeof e){case"undefined":return 7<=t.swfVersion?"undefined":"";case"object":if(null===e)return"null";if(e&&e instanceof Array){for(var i="",n=0;n<e.length;n++)i+=alToString(t,e[n]),i+=n==e.length-1?"":",";return i}return"[type "+alGetObjectClass(e)+"]";case"boolean":return e?"true":"false";case"number":if(isFinite(e)){var r=big(e);return Math.abs(r.e)<14&&(r=r.round(14-r.e,1)),r.toString()}return e.toString();case"string":return e}}function alToObject(t,e){switch(typeof e){case"undefined":throw new AVM1TypeError;case"object":if(null===e)throw new AVM1TypeError;return Array.isArray(e)?new AVM1ArrayNative(t,e):e;case"boolean":return new AVM1BooleanNative(t,e);case"number":return new AVM1NumberNative(t,e);case"string":return new AVM1StringNative(t,e)}}function alNewObject(t){var e=new AVM1Object(t);return e.alPrototype=t.builtins.Object.alGetPrototypeProperty(),e.alSetOwnConstructorProperty(t.builtins.Object),e}function alGetObjectClass(t){return t instanceof AVM1Function?"Function":"Object"}function alCoerceString(t,e){return e instanceof AVM1Object?alToString(t,e):"string"==typeof e?e:null==e?null:e+""}function alCoerceNumber(t,e){if(!isNullOrUndefined$1(e))return alToNumber(t,e)}function alIsIndex(t,e){return isIndex(e instanceof AVM1Object?alToString(t,e):e)}function alForEachProperty(t,e,i){t.alGetKeys().forEach(e,i)}function alIsFunction(t){return t instanceof AVM1Function}function alCallProperty(t,e,i){t.alGet(e).alCall(t,i)}function alInstanceOf(t,e,i){if(!(e instanceof AVM1Object))return!1;if(!(i instanceof AVM1Object))return!1;for(var n=i.alGetPrototypeProperty(),r=e;r;r=r.alPrototype)if(r===n)return!0;return!1}function alIsArray(t,e){return alInstanceOf(t,e,t.builtins.Array)}function alIsArrayLike(t,e){if(!(e instanceof AVM1Object))return!1;var i=alToInteger(t,e.alGet("length"));return!(isNaN(i)||i<0||4294967296<=i)}function alIterateArray(t,e,i,n){void 0===n&&(n=null);var r=alToInteger(t,e.alGet("length"));if(!(isNaN(r)||4294967296<=r))for(var o=0;o<r;o++)i.call(n,e.alGet(o),o)}function alIsString(t,e){return"string"==typeof e}function alDefineObjectProperties(s,a){var l=s.context;Object.getOwnPropertyNames(a).forEach(function(t){var e,i,n,r=a[t],o=0;"object"==typeof r?(r.get||r.set?(i=r.get?new AVM1NativeFunction(l,r.get):void 0,n=r.set?new AVM1NativeFunction(l,r.set):void 0,o|=128):("function"==typeof(e=r.value)&&(e=new AVM1NativeFunction(l,e)),o|=64,r.writable||(o|=4)),r.enumerable||(o|=1),r.configurable||(o|=2)):("function"==typeof(e=r)&&(e=new AVM1NativeFunction(l,e)),o|=71),s.alSetOwnProperty(t,new AVM1PropertyDescriptor(o,e,i,n))})}AVM1TypeError.prototype=Object.create(Error.prototype);var DEPTH_OFFSET=16384;function hasAwayJSAdaptee(t){return!!t.adaptee}function getAwayJSAdaptee(t){return t.adaptee}function getAwayObjectOrTemplate(t){if(t.adaptee)return t.adaptee;if(!t._as3ObjectTemplate){for(var e,i=t.alPrototype;i&&!i.initAVM1SymbolInstance&&!(e=i._as3ObjectTemplate);)i=i.alPrototype;t._as3ObjectTemplate=Object.create(e||null)}return t._as3ObjectTemplate}var BlendModesMap=[void 0,"normal","layer","multiply","screen","lighten","darken","difference","add","subtract","invert","alpha","erase","overlay","hardlight"];function avm1HasEventProperty(t,e,i){if(e.alHasProperty(i)&&e.alGet(i)instanceof AVM1Function)return 1;if(e.alHasProperty(i)&&e._ownProperties[i]&&e._ownProperties[i].value)return 1;var n=e.alGet("_listeners");return n instanceof AVM1ArrayNative&&n.value.some(function(t){return t instanceof AVM1Object&&t.alHasProperty(i)})}function avm1BroadcastNativeEvent(e,i,n,r){void 0===r&&(r=null);var t=i.alGet(n);t instanceof AVM1Function&&("onenterframe"==n.toLowerCase()&&(t.isOnEnter=!0),e.executeFunction(t,i,r));var o,s=i.alGet("_listeners");s instanceof AVM1ArrayNative&&(o=null,s.value.forEach(function(t){t instanceof AVM1Object&&(o=t.alGet(n))instanceof AVM1Function&&e.executeFunction(o,i,r)}))}function avm1BroadcastEvent(t,e,i,n){void 0===n&&(n=null);var r=e.alGet(i);r instanceof AVM1Function&&r.alCall(e,n);var o,s=e.alGet("_listeners");s instanceof AVM1ArrayNative&&(o=null,s.value.forEach(function(t){t instanceof AVM1Object&&(o=t.alGet(i))instanceof AVM1Function&&o.alCall(e,n)}))}var myCount=0;function createAVM1NativeObject(t,e,i){for(var n,r=t.alGetPrototypeProperty();r&&!r.initAVM1SymbolInstance;)r._as3ObjectTemplate&&!n&&(n=r._as3ObjectTemplate),r=r.alPrototype;var o=Object.create(r);if(r.initAVM1SymbolInstance.call(o,i,e),o.alPrototype=t.alGetPrototypeProperty(),o.alSetOwnConstructorProperty(t),e._as2Object=o,t.alCall(o),o.aCount=myCount++,n)for(var s in n)e[s]=n[s];return o}function getAVM1Object(t,e){return t?t._as2Object?t._as2Object:(t.isAsset(MovieClip)?i=t.timeline.isButton?createAVM1NativeObject(e.globals.Button,t,e):createAVM1NativeObject(e.globals.MovieClip,t,e):t.isAsset(TextField)&&(i=createAVM1NativeObject(e.globals.TextField,t,e)),i&&(t._as2Object=i,(t.adapter=i).adaptee=t),t._as2Object=i):null;var i}function wrapAVM1NativeMembers(i,l,c,t,n){function h(e){if(!isNullOrUndefined$1(e))return new AVM1NativeFunction(i,n?function(){var t=Array.prototype.slice.call(arguments,0);return t.unshift(i),e.apply(this,t)}:e)}void 0===n&&(n=!1),t&&t.forEach(function(t){var e,i,n,r,o,s,a;"#"!==t[t.length-1]?!(e=function(t){for(var e,i=c;i;i=Object.getPrototypeOf(i))if(e=Object.getOwnPropertyDescriptor(i,t))return e;return null}(t))||e.get||e.set||("function"==typeof(i=e.value)&&(i=h(i)),a=new AVM1PropertyDescriptor(67,i),l.alSetOwnProperty(t,a)):(n="get"+t[0].toUpperCase()+t.slice(1,-1),r=c[n],o="set"+t[0].toUpperCase()+t.slice(1,-1),s=c[o],a=new AVM1PropertyDescriptor(131,null,h(r),h(s)),l.alSetOwnProperty(t.slice(0,-1),a))})}function wrapAVM1NativeClass(e,t,i,n,r,o,s){var a=t?new AVM1NativeFunction(e,o||function(){},function(){var t=new i(e);return t.alPrototype=l,t.alSetOwnConstructorProperty(a),s&&s.apply(t,arguments),t}):new AVM1Object(e);wrapAVM1NativeMembers(e,a,i,n,!0);var l=new i(e);return l.alPrototype=e.builtins.Object.alGetPrototypeProperty(),wrapAVM1NativeMembers(e,l,i.prototype,r,!1),alDefineObjectProperties(a,{prototype:{value:l}}),alDefineObjectProperties(l,{constructor:{value:a,writable:!0}}),a}function initializeAVM1Object(t,e,i){var n=getAVM1Object(t,e);i.variableName&&n.alPut("variable",i.variableName);var r=i.events;if(r)for(var o,s,a,l,c,h,u=null,p=0;p<r.length;p++)for(var d in(o=r[p]).actionsBlock?(s=e.actionsDataFactory.createActionsData(o.actionsBlock,"s"+i.symbolId+"d"+i.depth+"e"+p),o.actionsBlock=null,o.compiled=s):s=o.compiled,a=clipEventHandler.bind(null,s,n),l=o.flags,ClipEventMappings)c=parseInt(d),l&(0|(c|=0))&&(262144!=c?512!=c?1!=c?(h=ClipEventMappings[c]).eventName?(o.keyCode&&((u=new AVM1EventProps).keyCode=o.keyCode,o.keyCode<32&&AVM1KeyCodeMap[o.keyCode]&&(u.keyCode=AVM1KeyCodeMap[o.keyCode])),n._addOnClipEventListener(h,a,u)):Debug.warning("ClipEvent: "+c+" not implemented"):t.onLoaded=a:t.onInitialize=a:t.onConstruct=a)}function toTwipFloor(t){var e=Math.floor(20*t)/20;return e<t&&.04995<t-e&&(e+=.05),e}function toTwipRound(t){return Math.round(20*t)/20}function avm2AwayDepth(t){return t+1}function away2avmDepth(t){return t-1}function clipEventHandler(t,e){return e.context.executeActions(t,e)}var AVM1SceneGraphFactory=(U$d=DefaultSceneGraphFactory,__extends(V$d,U$d),Object.defineProperty(V$d,"instance",{get:function(){return V$d._instance||console.log("Error. A instance of AVM1SceneGraphFactory must be created manually before accessing the singleton AVM1SceneGraphFactory._instance"),V$d._instance},enumerable:!0,configurable:!0}),V$d.prototype.createSprite=function(t){return new Sprite},V$d.prototype.createDisplayObjectContainer=function(){return new DisplayObjectContainer},V$d.prototype.createMovieClip=function(t,e){void 0===t&&(t=null),void 0===e&&(e=null);var i=new MovieClip(t||new Timeline);return e.isButton,getAVM1Object(i,this.avm1Context),i._symbol=e,i},V$d.prototype.createTextField=function(){var t=new TextField;return t.multiline=!0,t.wordWrap=!0,getAVM1Object(t,this.avm1Context),t},V$d.prototype.createBillboard=function(t){return null},V$d.prototype.createImage2D=function(t,e,i,n,r){return void 0===i&&(i=!0),void 0===n&&(n=null),void 0===r&&(r=!0),new BitmapImage2D(t,e,i,n,r)},V$d),avm1Options=shumwayOptions.register(new OptionSet("AVM1")),avm1TraceEnabled=avm1Options.register(new Option("t1","traceAvm1","boolean",!1,"trace AVM1 execution")),avm1ErrorsEnabled=avm1Options.register(new Option("e1","errorsAvm1","boolean",!1,"fail on AVM1 warnings and errors")),avm1WarningsEnabled=avm1Options.register(new Option("w1","warningsAvm1","boolean",!0,"Emit messages for AVM1 warnings and errors")),avm1TimeoutDisabled=avm1Options.register(new Option("ha1","nohangAvm1","boolean",!1,"disable fail on AVM1 hang")),avm1CompilerEnabled=avm1Options.register(new Option("ca1","compileAvm1","boolean",!0,"compiles AVM1 code")),avm1DebuggerEnabled=avm1Options.register(new Option("da1","debugAvm1","boolean",!1,"allows AVM1 code debugging")),avm1WellknownActionsCompilationsEnabled=avm1Options.register(new Option("cw1","wellknownAvm1","boolean",!0,"Replaces well-known actions patterns instead of compilation")),AVM1ActionsData=function(t,e,i,n){void 0===i&&(i=null),this.bytes=t,this.id=e,this.parent=i,this.encryptedData=n,this.ir=null,this.compiled=null},ActionsDataFactory=(l_d.prototype.createActionsData=function(t,e,i){void 0===i&&(i=null);var n=t instanceof Uint8Array,r=n?t:t.actionsData,o=n?void 0:t.encryptedData,s=this._cache.get(r);return s||(s=new AVM1ActionsData(r,e,i,o),this._cache.set(r,s)),s},l_d),AVM1Context=(t_d.prototype.resolveTarget=function(t){},t_d.prototype.resolveRoot=function(){},t_d.prototype.checkTimeout=function(){},t_d.prototype.executeActions=function(t,e){},t_d.prototype.executeFunction=function(t,e,i){},t_d.prototype.normalizeNameCaseSensitive=function(t){switch(typeof t){case"number":case"string":return t;default:return alToString(this,t)}},t_d.prototype.normalizeNameCaseInsensitive=function(t){switch(typeof t){case"number":return t.toString();case"string":break;default:t=alToString(this,t)}var e=this._nameCache[t];return e||(e=t.toLowerCase(),this._nameCache[t]=e)},t_d.prototype._getEventPropertyObservers=function(t,e){this.isPropertyCaseSensitive||(t=t.toLowerCase());var i=this.eventObservers[t];return i||(e?(i=[],this.eventObservers[t]=i):null)},t_d.prototype.registerEventPropertyObserver=function(t,e){this._getEventPropertyObservers(t,!0).push(e)},t_d.prototype.unregisterEventPropertyObserver=function(t,e){var i,n=this._getEventPropertyObservers(t,!1);n&&((i=n.indexOf(e))<0||n.splice(i,1))},t_d.prototype.broadcastEventPropertyChange=function(e){var t=this._getEventPropertyObservers(e,!1);t&&t.forEach(function(t){return t.onEventPropertyModified(e)})},t_d.prototype.addAsset=function(t,e,i){this.assets[t.toLowerCase()]=e,this.assetsSymbols[e]=i,this.awayAssets[t.toLowerCase()]=i},t_d.prototype.registerClass=function(t,e){if(null===(t=alCoerceString(this,t)))return this.utils.warn("Cannot register class for symbol: className is missing"),null;var i=AssetLibrary.getAsset(t,AVM1MovieClip.currentMCAssetNameSpace);i.adaptee?i.adaptee.avm1Symbol=e:console.warn("can not find symbol to register class "+t)},t_d.prototype.getSymbolClass=function(t){return this.assetsClasses[t]||null},t_d.prototype.getAsset=function(t){if(null!==(t=alCoerceString(this,t))){var e=this.assets[t.toLowerCase()];if(void 0!==e){var i=this.awayAssets[t.toLowerCase()];return i||console.log("error in getAsset. not implemented to grab assets from loaderInfo"),{symbolId:e,symbolProps:i}}}},t_d.prototype.reset=function(){this.eventObservers=Object.create(null),this.assets={},this.assetsSymbols=[],this.assetsClasses=[],this.awayAssets={},this.staticStates=new WeakMap,AVM1Stage.bindStage(this,this.globals.Stage,null,null,null)},t_d.prototype.setStage=function(t,e,i){AVM1Key.bindStage(this,this.globals.Key,t,i),AVM1Mouse.bindStage(this,this.globals.Mouse,t,i),AVM1Stage.bindStage(this,this.globals.Stage,t,e,i)},t_d.prototype.getStaticState=function(t){var e,i=this.staticStates.get(t);return i||(i=Object.create(null),(e=t.alInitStatic)&&e.call(i,this),this.staticStates.set(t,i)),i},t_d.prototype.resolveLevel=function(t){this.utils.warn("Unable to resolve level "+t+" root")},t_d),ActionsDataStream=(f0d.prototype.readUI8=function(){return this.array[this.position++]},f0d.prototype.readUI16=function(){var t=this.position,e=this.array,i=e[t+1]<<8|e[t];return this.position=t+2,i},f0d.prototype.readSI16=function(){var t=this.position,e=this.array,i=e[t+1]<<8|e[t];return this.position=t+2,i<32768?i:i-65536},f0d.prototype.readInteger=function(){var t=this.position,e=this.array,i=e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24;return this.position=t+4,i},f0d.prototype.readFloat=function(){var t=this.position,e=this.array,i=new ArrayBuffer(4),n=new Uint8Array(i);return n[0]=e[t],n[1]=e[t+1],n[2]=e[t+2],n[3]=e[t+3],this.position=t+4,new Float32Array(i)[0]},f0d.prototype.readDouble=function(){var t=this.position,e=this.array,i=new ArrayBuffer(8),n=new Uint8Array(i);return n[4]=e[t],n[5]=e[t+1],n[6]=e[t+2],n[7]=e[t+3],n[0]=e[t+4],n[1]=e[t+5],n[2]=e[t+6],n[3]=e[t+7],this.position=t+8,new Float64Array(i)[0]},f0d.prototype.readBoolean=function(){return!!this.readUI8()},f0d.prototype.readANSIString=function(){for(var t,e="";t=this.readUI8();)e+=String.fromCharCode(t);return e},f0d.prototype.readUTF8String=function(){for(var t,e="";t=this.readUI8();)if(t<128)e+=String.fromCharCode(t);else if(128!=(192&t)){var i=this.position-1,n=192,r=5;do{var o=n>>1|128;if((t&o)===n)break;n=o,--r}while(0<=r);for(var s=t&(1<<r)-1,a=5;r<=a;--a)if(128==(192&(t=this.readUI8())))s=s<<6|63&t;else{var l=this.position-1;for(this.position=i;this.position<l;)e+=String.fromCharCode(this.readUI8())}e+=65536<=s?String.fromCharCode(s-65536>>10&1023|55296,1023&s|56320):String.fromCharCode(s)}else e+=String.fromCharCode(t);return e},f0d.prototype.readString=function(){return this.readANSI?this.readANSIString():this.readUTF8String()},f0d.prototype.readBytes=function(t){var e=this.position,i=Math.max(this.end-e,0);i<t&&(t=i);var n=this.array.subarray(e,e+t);return this.position=e+t,n},f0d),ParsedPushRegisterAction=function(t){this.registerNumber=t},ParsedPushConstantAction=function(t){this.constantIndex=t},ActionsDataParser=(Object.defineProperty(R0d.prototype,"position",{get:function(){return this._stream.position},set:function(t){this._stream.position=t},enumerable:!0,configurable:!0}),Object.defineProperty(R0d.prototype,"eof",{get:function(){return this._stream.position>=this._stream.end},enumerable:!0,configurable:!0}),Object.defineProperty(R0d.prototype,"length",{get:function(){return this._stream.end},enumerable:!0,configurable:!0}),R0d.prototype.readNext=function(){var t=this._stream,e=t.position,i=t.readUI8(),n=128<=i?t.readUI16():0,r=t.position+n,o=null;switch(0|i){case 129:var s=t.readUI16(),a=!1;6!==(l=t.readUI8())&&7!==l?t.position--:(r++,a=6===l),o=[s,a];break;case 131:o=[t.readString(),t.readString()];break;case 138:o=[s=t.readUI16(),p=t.readUI8()];break;case 139:o=[t.readString()];break;case 140:var l,c=t.readString(),a=!1;6!==(l=t.readUI8())&&7!==l?t.position--:(r++,a=6===l),o=[c,a];break;case 150:for(var h,u,o=[];t.position<r;){switch(0|(h=t.readUI8())){case 0:u=t.readString();break;case 1:u=t.readFloat();break;case 2:u=null;break;case 3:u=void 0;break;case 4:u=new ParsedPushRegisterAction(t.readUI8());break;case 5:u=t.readBoolean();break;case 6:u=t.readDouble();break;case 7:u=t.readInteger();break;case 8:u=new ParsedPushConstantAction(t.readUI8());break;case 9:u=new ParsedPushConstantAction(t.readUI16());break;default:console.error("Unknown value type: "+h),t.position=r;continue}o.push(u)}break;case 153:case 157:o=[t.readSI16()];break;case 154:o=[y=t.readUI8()];break;case 159:o=[y=t.readUI8()],2&y&&o.push(t.readUI16());break;case 141:o=[p=t.readUI8()];break;case 136:for(var p=t.readUI16(),d=[],_=0;_<p;_++)d.push(t.readString());o=[d];break;case 155:for(var f=t.readString(),m=(p=t.readUI16(),[]),_=0;_<p;_++)m.push(t.readString());r+=S=t.readUI16(),o=[new AVM1ActionsData(t.readBytes(S),this.dataId+"_f"+t.position,this._actionsData),f,m];break;case 148:r+=S=t.readUI16(),o=[new AVM1ActionsData(t.readBytes(S),this.dataId+"_w"+t.position,this._actionsData)];break;case 135:o=[v=t.readUI8()];break;case 142:f=t.readString(),p=t.readUI16();var g=t.readUI8(),y=t.readUI16(),b=[],m=[];for(_=0;_<p;_++){var v=t.readUI8(),x=t.readString();m.push(x),v&&(b[v]={type:1,name:x,index:_})}var A=1;1&y&&(b[A++]={type:2}),4&y&&(b[A++]={type:4}),16&y&&(b[A++]={type:8}),64&y&&(b[A++]={type:64}),128&y&&(b[A++]={type:32}),256&y&&(b[A++]={type:16});var S,w=0;2&y&&(w|=2),8&y&&(w|=4),32&y&&(w|=8),r+=S=t.readUI16(),o=[new AVM1ActionsData(t.readBytes(S),this.dataId+"_f"+t.position,this._actionsData),f,m,g,b,w];break;case 143:var C=!!(4&(y=t.readUI8())),P=!!(2&y),E=!!(1&y),T=t.readUI16(),M=t.readUI16(),D=t.readUI16();r+=T+M+D,o=[C,C?t.readUI8():t.readString(),new AVM1ActionsData(t.readBytes(T),this.dataId+"_t"+t.position,this._actionsData),E,new AVM1ActionsData(t.readBytes(M),this.dataId+"_c"+t.position,this._actionsData),P,new AVM1ActionsData(t.readBytes(D),this.dataId+"_z"+t.position,this._actionsData)];break;case 137:o=[t.readUI8()]}return t.position=r,{position:e,actionCode:i,actionName:ActionNamesMap[i],args:o}},R0d.prototype.skip=function(t){for(var e=this._stream;0<t&&e.position<e.end;){var i=128<=e.readUI8()?e.readUI16():0;e.position+=i,t--}},R0d),ActionNamesMap={0:"EOA",4:"ActionNextFrame",5:"ActionPreviousFrame",6:"ActionPlay",7:"ActionStop",8:"ActionToggleQuality",9:"ActionStopSounds",10:"ActionAdd",11:"ActionSubtract",12:"ActionMultiply",13:"ActionDivide",14:"ActionEquals",15:"ActionLess",16:"ActionAnd",17:"ActionOr",18:"ActionNot",19:"ActionStringEquals",20:"ActionStringLength",21:"ActionStringExtract",23:"ActionPop",24:"ActionToInteger",28:"ActionGetVariable",29:"ActionSetVariable",32:"ActionSetTarget2",33:"ActionStringAdd",34:"ActionGetProperty",35:"ActionSetProperty",36:"ActionCloneSprite",37:"ActionRemoveSprite",38:"ActionTrace",39:"ActionStartDrag",40:"ActionEndDrag",41:"ActionStringLess",42:"ActionThrow",43:"ActionCastOp",44:"ActionImplementsOp",45:"ActionFSCommand2",48:"ActionRandomNumber",49:"ActionMBStringLength",50:"ActionCharToAscii",51:"ActionAsciiToChar",52:"ActionGetTime",53:"ActionMBStringExtract",54:"ActionMBCharToAscii",55:"ActionMBAsciiToChar",58:"ActionDelete",59:"ActionDelete2",60:"ActionDefineLocal",61:"ActionCallFunction",62:"ActionReturn",63:"ActionModulo",64:"ActionNewObject",65:"ActionDefineLocal2",66:"ActionInitArray",67:"ActionInitObject",68:"ActionTypeOf",69:"ActionTargetPath",70:"ActionEnumerate",71:"ActionAdd2",72:"ActionLess2",73:"ActionEquals2",74:"ActionToNumber",75:"ActionToString",76:"ActionPushDuplicate",77:"ActionStackSwap",78:"ActionGetMember",79:"ActionSetMember",80:"ActionIncrement",81:"ActionDecrement",82:"ActionCallMethod",83:"ActionNewMethod",84:"ActionInstanceOf",85:"ActionEnumerate2",96:"ActionBitAnd",97:"ActionBitOr",98:"ActionBitXor",99:"ActionBitLShift",100:"ActionBitRShift",101:"ActionBitURShift",102:"ActionStrictEquals",103:"ActionGreater",104:"ActionStringGreater",105:"ActionExtends",129:"ActionGotoFrame",131:"ActionGetURL",135:"ActionStoreRegister",136:"ActionConstantPool",137:"ActionStrictMode",138:"ActionWaitForFrame",139:"ActionSetTarget",140:"ActionGoToLabel",141:"ActionWaitForFrame2",142:"ActionDefineFunction2",143:"ActionTry",148:"ActionWith",150:"ActionPush",153:"ActionJump",154:"ActionGetURL2",155:"ActionDefineFunction",157:"ActionIf",158:"ActionCall",159:"ActionGotoFrame2"},ActionsDataAnalyzer=(B1d.prototype.analyze=function(t){var e=[],i=[0],n=[!0],r=!1,o=null,s=t._actionsData,a=s.encryptedData,l=void 0;a&&(l=new ActionsDataParser(new AVM1ActionsData(a.data,s.id+"enc"),t.swfVersion));for(var c,h,u,p,d,_,f,m=[0],g=!1,y=0;0<m.length;)if(c=m.shift(),!e[c])for(t.position=c;!t.eof&&!e[c]&&0!==(h=t.readNext()).actionCode;){switch(u=t.position,p=0,_=d=!(x={action:h,next:u,conditionalJumpTo:-1}),h.actionCode){case 138:case 141:d=!0,f=138===h.actionCode?h.args[1]:h.args[0],t.skip(f),p=t.position,t.position=u;break;case 153:d=_=!0,p=u+h.args[0];break;case 157:d=!0,p=u+h.args[0];break;case 42:case 62:case 0:d=_=!0,p=t.length;break;case 136:if(r){o=null;break}r=!0,0===c&&(o=h.args[0])}if(d&&((p<0||p>t.length)&&(l&&p<0?(console.debug("[LONG JUMP] Script "+s.id+", jump outside action "+p+"\n Try to parse encryptedData"),g=!0,y=Math.min(p)):(console.warn("[LONG JUMP] Script "+s.id+", jump outside action "+p+"\n Require encrypted data!"),p=t.length)),_?x.next=p:x.conditionalJumpTo=p,n[p]||(i.push(p),m.push(p),n[p]=!0)),e[c]=x,_)break;c=u}!g&&y&&console.warn("Process long jump!");var b,v,x,A=[];i.forEach(function(t){if(e[t]){for(b=[],v=t;x=e[v],b.push(x),v=x.next,!n[v]&&e[v];);A.push({label:t,items:b,jump:v})}});var S=null;return r?S=o:this.parentResults&&(S=this.parentResults.singleConstantPool),{actions:e,blocks:A,dataId:t.dataId,singleConstantPool:S,registersLimit:this.registersLimit}},B1d),cachedActionsCalls=null,U$d;function B1d(){this.parentResults=null,this.registersLimit=0}function R0d(t,e){this.swfVersion=e,this._actionsData=t,this.dataId=t.id,this._stream=new ActionsDataStream(t.bytes,e)}function f0d(t,e){this.array=t,this.position=0,this.end=t.length,this.readANSI=e<6;var i=new ArrayBuffer(4);if(new Int32Array(i)[0]=1,!new Uint8Array(i)[0])throw new Error("big-endian platform")}function t_d(t){this.swfVersion=t,this.globals=null,this.actionsDataFactory=new ActionsDataFactory,6<t?(this.isPropertyCaseSensitive=!0,this.normalizeName=this.normalizeNameCaseSensitive):(this.isPropertyCaseSensitive=!1,this._nameCache=Object.create(null),this.normalizeName=this.normalizeNameCaseInsensitive),this.builtins={},installBuiltins(this),this.eventObservers=Object.create(null),this.assets={},this.assetsSymbols=[],this.assetsClasses=[],this.awayAssets={},this.staticStates=new WeakMap}function l_d(){this._cache=new WeakMap}function V$d(t){var e=U$d.call(this)||this;return e.imageStore={},e.avm1Context=t,V$d._instance=e}function getActionsCalls(){return cachedActionsCalls=cachedActionsCalls||generateActionCalls()}var ActionsDataCompiler=(_1d.prototype.convertArgs=function(t,e,i,n){for(var r,o,s,a,l,c,h=[],u=t.length,p=0;p<u;p++)"object"!=typeof(r=t[p])||null===r||Array.isArray(r)?void 0===r?h.push("undefined"):h.push(JSON.stringify(r)):r instanceof ParsedPushConstantAction?n.singleConstantPool?(o=n.singleConstantPool[r.constantIndex],h.push(void 0===o?"undefined":JSON.stringify(o))):(s="",(a=i.constantPool)&&(s=0<=(s=void 0===(o=a[r.constantIndex])?"undefined":JSON.stringify(o)).indexOf("*/")?"":" /* "+s+" */"),h.push("constantPool["+r.constantIndex+"]"+s)):r instanceof ParsedPushRegisterAction?(l=r.registerNumber)<0||l>=n.registersLimit?h.push("undefined"):h.push("registers["+l+"]"):r instanceof AVM1ActionsData&&(i[c="code_"+e+"_"+p]=r,h.push("res."+c));return h.join(",")},_1d.prototype.convertAction=function(t,e,i,n,r,o){switch(t.action.actionCode){case 153:case 62:return"";case 136:return i.constantPool=t.action.args[0]," constantPool = ["+this.convertArgs(t.action.args[0],e,i,r)+"];\n ectx.constantPool = constantPool;\n";case 150:return" stack.push("+this.convertArgs(t.action.args,e,i,r)+");\n";case 135:var s=t.action.args[0];return s<0||s>=r.registersLimit?"":" registers["+s+"] = stack[stack.length - 1];\n";case 138:case 141:return" if (calls."+t.action.actionName+"(ectx,["+this.convertArgs(t.action.args,e,i,r)+"])) { position = "+t.conditionalJumpTo+"; checkTimeAfter -= "+(n+1)+"; break; }\n";case 157:return" if (!!stack.pop()) { position = "+t.conditionalJumpTo+"; checkTimeAfter -= "+(n+1)+"; break; }\n";default:var a,l=" calls."+t.action.actionName+"(ectx"+(t.action.args?",["+this.convertArgs(t.action.args,e,i,r)+"]":"")+");\n";return"ActionCallMethod"==t.action.actionName&&150==o.action.actionCode&&('"gotoAndStop"'!=(a=this.convertArgs(o.action.args,e-1,i,r))&&'"gotoAndPlay"'!=a||(l+=" if(ectx.scopeList && ectx.scopeList.scope && ectx.scopeList.scope.adaptee && !ectx.scopeList.scope.adaptee.parent){ ectx.framescriptmanager.execute_avm1_constructors(); return;}\n")),l}},_1d.prototype.generate=function(n){var r=this,t=n.blocks,o={},s=0,e=n.dataId,a="return function "+e+"(ectx) {\nvar position = 0;\nvar checkTimeAfter = 0;\nvar constantPool = ectx.constantPool, registers = ectx.registers, stack = ectx.stack;\n";return avm1DebuggerEnabled.value&&(a+="/* Running "+e+" */ if (Shumway.AVM1.Debugger.pause || Shumway.AVM1.Debugger.breakpoints."+e+") { debugger; }\n"),a+="while (!ectx.isEndOfActions) {\nif (checkTimeAfter <= 0) { checkTimeAfter = "+CHECK_AVM1_HANG_EVERY+"; ectx.context.checkTimeout(); }\nswitch(position) {\n",t.forEach(function(t){var i;a+=" case "+t.label+":\n",t.items.forEach(function(t,e){a+=r.convertAction(t,s++,o,e,n,i),i=t}),a+=" position = "+t.jump+";\n checkTimeAfter -= "+t.items.length+";\n break;\n"}),a+=" default: ectx.isEndOfActions = true; break;\n}\n}\nreturn stack.pop();};",a+="//# sourceURL="+e,new Function("calls","res",a)(getActionsCalls(),o)},_1d),Debugger={pause:!1,breakpoints:{}};function _1d(){}function avm1Warn(t,e,i,n,r){if(avm1ErrorsEnabled.value)try{throw new Error(t)}catch(t){}avm1WarningsEnabled.value&&Debug.warning.apply(console,arguments)}var MAX_AVM1_HANG_TIMEOUT=1e3,CHECK_AVM1_HANG_EVERY=1e3,MAX_AVM1_ERRORS_LIMIT=1e3,MAX_AVM1_STACK_LIMIT=256,AVM1ScopeListItemFlags,M2d;M2d=AVM1ScopeListItemFlags=AVM1ScopeListItemFlags||{},M2d[M2d.DEFAULT=0]="DEFAULT",M2d[M2d.TARGET=1]="TARGET",M2d[M2d.REPLACE_TARGET=2]="REPLACE_TARGET";var AVM1ScopeListItem=function(t,e){this.scope=t,this.previousScopeItem=e,this.flags=AVM1ScopeListItemFlags.DEFAULT},GlobalPropertiesScope=(P2d=AVM1Object,__extends(Q2d,P2d),Q2d),AVM1CallFrame=(U2d.prototype.setCallee=function(t,e,i,n){this.calleeThis=t,this.calleeSuper=e,this.calleeFn=i},U2d.prototype.resetCallee=function(){this.calleeThis=null,this.calleeSuper=null,this.calleeFn=null},U2d),AVM1RuntimeUtilsImpl=(c3d.prototype.hasProperty=function(t,e){return as2HasProperty(this._context,t,e)},c3d.prototype.getProperty=function(t,e){return as2GetProperty(this._context,t,e)},c3d.prototype.setProperty=function(t,e,i){return as2SetProperty(this._context,t,e,i)},c3d.prototype.warn=function(t){avm1Warn.apply(null,arguments)},c3d),AVM1ContextImpl=(m3d=AVM1Context,__extends(n3d,m3d),n3d.prototype._getExecutionContext=function(){return this.frame.ectx},n3d.prototype.resolveTarget=function(t){return avm1ResolveTarget(this._getExecutionContext(),t,!0)},n3d.prototype.resolveRoot=function(){return avm1ResolveRoot(this._getExecutionContext())},n3d.prototype.checkTimeout=function(){Date.now(),this.abortExecutionAt},n3d.prototype.pushCallFrame=function(t,e,i,n){var r=new AVM1CallFrame(this.frame,t,e,i,n);return this.frame=r},n3d.prototype.popCallFrame=function(){var t=this.frame.previousFrame;return this.frame=t},n3d.prototype.executeActions=function(t,e){if(!this.executionProhibited){var i,n=this.isActive;n||(this.isActive=!0,this.abortExecutionAt=avm1TimeoutDisabled.value?Number.MAX_VALUE:Date.now()+MAX_AVM1_HANG_TIMEOUT,this.errorsIgnored=0);try{executeActionsData(this,t,e)}catch(t){i=t}this.isActive=n,i&&console.error("error in framescripts",i)}},n3d.prototype.executeFunction=function(t,e,i){if(!this.executionProhibited){var n,r,o=this.isActive;o||(this.isActive=!0,this.abortExecutionAt=avm1TimeoutDisabled.value?Number.MAX_VALUE:Date.now()+MAX_AVM1_HANG_TIMEOUT,this.errorsIgnored=0);try{r=t.alCall(e,i)}catch(t){n=t}if(this.isActive=o,n)throw n;return r}},n3d),m3d,P2d;function n3d(t){var e=m3d.call(this,t)||this;return e.globals=AVM1Globals.createGlobalsObject(e),e.actions=new AVM1NativeActions(e),e.initialScope=new AVM1ScopeListItem(e.globals,null),e.utils=new AVM1RuntimeUtilsImpl(e),e.isActive=!1,e.executionProhibited=!1,e.actionTracer=avm1TraceEnabled.value?new ActionTracer:null,e.abortExecutionAt=0,e.stackDepth=0,e.frame=null,e.isTryCatchListening=!1,e.errorsIgnored=0,e.deferScriptExecution=!0,e}function c3d(t){this._context=t}function U2d(t,e,i,n,r){this.previousFrame=t,this.currentThis=e,this.fn=i,this.args=n,this.ectx=r,this.inSequence=!!t&&t.calleeThis===e&&t.calleeFn===i,this.resetCallee()}function Q2d(t,e){var i=P2d.call(this,t)||this;return i.alSetOwnProperty("this",new AVM1PropertyDescriptor(71,e)),i.alSetOwnProperty("_global",new AVM1PropertyDescriptor(71,t.globals)),i}AVM1Context.create=function(t){return new AVM1ContextImpl(t)};var AVM1Error=function(t){this.error=t},AVM1CriticalError=(J3d=Error,__extends(K3d,J3d),K3d),J3d;function K3d(t,e){var i=J3d.call(this,t)||this;return i.error=e,i}function isAVM1MovieClip(t){return"object"==typeof t&&t&&t instanceof AVM1MovieClip}function as2GetType(t){if(null===t)return"null";if("object"==typeof t){if(t instanceof AVM1MovieClip)return"movieclip";if(t instanceof AVM1Function)return"function"}return typeof t}function as2ToAddPrimitive(t,e){return alToPrimitive(t,e)}function as2Compare(t,e,i){var n=alToPrimitive(t,e),r=alToPrimitive(t,i);if("string"==typeof n&&"string"==typeof r)return alToString(t,n)<alToString(t,r);var o=alToNumber(t,n),s=alToNumber(t,r);return isNaN(o)||isNaN(s)?void 0:o<s}function as2Equals(t,e,i){return typeof e==typeof i?e===i:null==e&&null==i||("number"==typeof e&&"string"==typeof i?""!==i&&e===+i:"string"==typeof e&&"number"==typeof i?""!==e&&+e===i:"boolean"==typeof e&&(e=+e,"number"==typeof i||"string"==typeof i)?""!==i&&e===+i:"boolean"==typeof i&&(i=+i,"number"==typeof e||"string"==typeof e)?""!==e&&+e===i:"number"!=typeof e&&"string"!=typeof e||"object"!=typeof i||null===i?"object"==typeof e&&null!==e&&("number"==typeof i||"string"==typeof i)&&"object"!=typeof(e=alToPrimitive(t,e))&&as2Equals(t,e,i):"object"!=typeof(i=alToPrimitive(t,i))&&as2Equals(t,e,i))}function as2InstanceOf(t,e){if(isNullOrUndefined$1(t)||isNullOrUndefined$1(e))return!1;var i=e.alGetPrototypeProperty();if(!i)return!1;for(var n=t;n;){if(n===i)return!0;n=n.alPrototype}return!1}function as2HasProperty(t,e,i){var n=alToObject(t,e);return i=t.normalizeName(i),n.alHasProperty(i)}function as2GetProperty(t,e,i){var n=alToObject(t,e);if(n)return n.alGet(i)}function as2SetProperty(t,e,i,n){var r=alToObject(t,e);if(r)if("__proto__"==i){if(n){for(var o=n.alGetKeys(),s=0;s<o.length;s++){var a=o[s];""!=a&&(r.alPut(a,n.alGet(a)),as2SyncEvents(t,a,r))}r.protoTypeChanged=!(n instanceof AVM1MovieClip)}}else r.alPut(i,n),r.adaptee&&as2SyncEvents(t,i,r)}function as2DeleteProperty(t,e,i){var n=alToObject(t,e);i=t.normalizeName(i);var r=n.alDeleteProperty(i);return as2SyncEvents(t,i,n),r}function as2SyncEvents(t,e,i){void 0!==e&&(e=alCoerceString(t,e),"o"===(e=t.normalizeName(e))[0]&&"n"===e[1]&&i&&i.updateEventByPropName&&i.updateEventByPropName(e))}function as2CastError(t){return"undefined"!=typeof InternalError&&t instanceof InternalError&&"too much recursion"===t.message?new AVM1CriticalError("long running script -- AVM1 recursion limit is reached"):t}function as2Construct(t,e){if(alIsFunction(t))return t.alConstruct(e)}function as2Enumerate(t,e,i){if("boolean"!=typeof t&&"string"!=typeof t&&"number"!=typeof t){var n=Object.create(null),r=[];alForEachProperty(t,function(t){"string"==typeof t&&-1!=t.indexOf("_internal_TF")||n[t]||(r[r.length]=t,n[t]=!0)},i);for(var o=r.length,s=null;0<o;)o--,void 0===(s=t.alGet(r[o]))||s.adaptee&&s.adaptee.isAsset(TextField)&&s.adaptee.isStatic||e.call(i,r[o])}}function avm1FindSuperPropertyOwner(t,e,i){if(t.swfVersion<6)return null;var n=e.inSequence&&e.previousFrame.calleeSuper;if(!n){for(n=e.currentThis;n&&!n.alHasOwnProperty(i);)n=n.alPrototype;if(!n)return null}return n.alPrototype}var DEFAULT_REGISTER_COUNT=4;function executeActionsData(t,e,i){t.actionTracer;var n,r=new AVM1ScopeListItem(new GlobalPropertiesScope(t,i),t.initialScope),o=new AVM1ScopeListItem(i,r);o.flags|=AVM1ScopeListItemFlags.TARGET;var s=ExecutionContext.create(t,o,[],DEFAULT_REGISTER_COUNT);t.pushCallFrame(i,null,null,s);try{interpretActionsData(s,e)}catch(t){n=as2CastError(t)}if(s.dispose(),n instanceof AVM1CriticalError&&(t.executionProhibited=!0,console.error("Disabling AVM1 execution")),t.popCallFrame(),n)throw n}function createBuiltinType(t,e,i){var n,r=t.builtins,o=void 0;return e!==r.Array&&e!==r.Object&&e!==r.Date&&e!==r.String&&e!==r.Function||(o=e.alConstruct(i)),e!==r.Boolean&&e!==r.Number||(o=e.alConstruct(i).value),o instanceof AVM1Object&&(n=new AVM1PropertyDescriptor(65,e),o.alSetOwnProperty("__constructor__",n)),o}var AVM1SuperWrapper=(c5d=AVM1Object,__extends(d5d,c5d),d5d),AVM1Arguments=(h5d=AVM1ArrayNative,__extends(i5d,h5d),i5d),ExecutionContext=(o5d.alInitStatic=function(){this.cache=[]},o5d.prototype.reset=function(t,e,i){this.scopeList=t,this.constantPool=e,this.registers.length=i},o5d.prototype.clean=function(){this.scopeList=null,this.constantPool=null,this.registers.length=0,this.stack.length=0,this.frame=null,this.recoveringFromError=!1,this.isEndOfActions=!1},o5d.prototype.pushScope=function(t){var e=Object.create(this);return e.stack=[],isNullOrUndefined$1(t)||(e.scopeList=t),e},o5d.prototype.dispose=function(){this.clean();var t=this.context.getStaticState(o5d);t.cache.length<o5d.MAX_CACHED_EXECUTIONCONTEXTS&&t.cache.push(this)},o5d.create=function(t,e,i,n){var r,o=t.getStaticState(o5d);return 0<o.cache.length?(r=o.cache.pop()).reset(e,i,n):r=new o5d(t,e,i,n),r},o5d.MAX_CACHED_EXECUTIONCONTEXTS=20,o5d),AVM1InterpreterScope=(F5d=AVM1Object,__extends(G5d,F5d),G5d.prototype._toString=function(){return this},G5d),AVM1InterpretedFunction=(J5d=AVM1EvalFunction,__extends(K5d,J5d),K5d.prototype.alCall=function(t,e){var i=this.context;if(!i.executionProhibited){var n=new AVM1InterpreterScope(i),r=new AVM1ScopeListItem(n,this.scopeList),o=this.scopeList.scope;e=e||[];var s,a=ExecutionContext.create(i,r,this.constantPool,this.registersLength),l=i.frame?i.frame.fn:void 0,c=i.pushCallFrame(t,this,e,a),h=this.suppressArguments;4&h||n.alPut("arguments",new AVM1Arguments(i,e,this,l)),2&h||n.alPut("this",t),8&h||(s=new AVM1SuperWrapper(i,c),n.alPut("super",s));for(var u=a.registers,p=this.registersAllocation,d=p?p.length:0,_=0;_<d;_++){var f=p[_];if(f)switch(f.type){case 1:u[_]=e[f.index];break;case 2:u[_]=t;break;case 4:u[_]=new AVM1Arguments(i,e,this,l);break;case 8:s=s||new AVM1SuperWrapper(i,c),u[_]=s;break;case 16:u[_]=i.globals;break;case 32:var m=null;if(o&&((m=o.alGet("_parent"))||(m=o.alGet("this"))&&(m=m.alGet("_parent"))),!m&&((m=t)&&(m=m.alGet("_parent")),m&&this.isOnEnter&&m.alGet("_parent")&&(m=m.alGet("_parent")),!m&&this.scopeList&&this.scopeList.previousScopeItem&&this.scopeList.previousScopeItem.scope))for(var g=this.scopeList.previousScopeItem;g;)g.scope&&g.scope instanceof AVM1MovieClip?m=g.scope:g.scope&&(m=g.scope.alGet("this")),m=m&&m.alGet("_parent"),g=g.previousScopeItem?g.previousScopeItem:null;m&&(u[_]=m);break;case 64:u[_]=avm1ResolveRoot(a)}}var y,b,v=this.parametersNames,x=this.skipArguments;for(_=0;_<e.length||_<v.length;_++)x&&x[_]||n.alPut(v[_],e[_]);i.actionTracer;var A=this.actionsData;if(++i.stackDepth>=MAX_AVM1_STACK_LIMIT)throw new AVM1CriticalError("long running script -- AVM1 recursion limit is reached");try{y=interpretActionsData(a,A)}catch(t){b=t}if(i.stackDepth--,i.popCallFrame(),a.dispose(),b)throw b;return y}},K5d),J5d,F5d,h5d,c5d;function K5d(t,e,i,n,r,o,s,a){var l=J5d.call(this,t)||this;l.functionName=n,l.actionsData=i,l.parametersNames=r,l.registersAllocation=s,l.suppressArguments=a,l.scopeList=e.scopeList,l.constantPool=e.constantPool;for(var c=null,h=s?s.length:0,u=0;u<h;u++){var p=s[u];p&&1===p.type&&((c=c||[])[s[u].index]=!0)}l.skipArguments=c;var d=Math.min(o,255),d=Math.max(d,h+1);return l.registersLength=d,l}function G5d(t){var e=F5d.call(this,t)||this;return e.alPut("toString",new AVM1NativeFunction(t,e._toString)),e}function o5d(t,e,i,n){this.framescriptmanager=FrameScriptManager,this.context=t,this.actions=t.actions,this.isSwfVersion5=5<=t.swfVersion,this.isSwfVersion7=7<=t.swfVersion,this.registers=[],this.stack=[],this.frame=null,this.recoveringFromError=!1,this.isEndOfActions=!1,this.reset(e,i,n)}function i5d(t,e,i,n){var r=h5d.call(this,t,e)||this;return alDefineObjectProperties(r,{callee:{value:i},caller:{value:n}}),r}function d5d(t,e){var i=c5d.call(this,t)||this;return i.callFrame=e,i.alPrototype=t.builtins.Object.alGetPrototypeProperty(),i}function fixArgsCount(t,e){return isNaN(t)||t<0?(avm1Warn("Invalid amount of arguments: "+t),0):(t|=0)>e?(avm1Warn("Truncating amount of arguments: from "+t+" to "+e),e):t}function avm1ReadFunctionArgs(t){for(var e=fixArgsCount(e=+t.pop(),t.length),i=[],n=0;n<e;n++)i.push(t.pop());return i}function avm1SetTarget(t,e){var i=null;if(e){if("string"==typeof e)for(;e.length&&"."==e[e.length-1];)e=e.substring(0,e.length-1);try{avm1IsTarget(i=avm1ResolveTarget(t,e,!1))||(avm1Warn("Invalid AVM1 target object: "+e),i=void 0)}catch(t){avm1Warn("Unable to set target: "+t)}}i?(t.scopeList.flags|=AVM1ScopeListItemFlags.REPLACE_TARGET,t.scopeList.replaceTargetBy=i):(t.scopeList.flags&=~AVM1ScopeListItemFlags.REPLACE_TARGET,t.scopeList.replaceTargetBy=null)}function avm1DefineFunction(t,e,i,n,r,o,s){return new AVM1InterpretedFunction(t.context,t,e,i,n,r,o,s)}function avm1VariableNameHasPath(t){return t&&(0<=t.indexOf(".")||0<=t.indexOf(":")||0<=t.indexOf("/"))}var cachedResolvedVariableResult={scope:null,propertyName:null,value:void 0};function avm1IsTarget(t){return t instanceof AVM1Object&&hasAwayJSAdaptee(t)}function avm1ResolveSimpleVariable(t,e,i,n){var r;void 0===n&&(n=null);for(var o=cachedResolvedVariableResult,s=t;s;s=s.previousScopeItem){if(!(s.flags&AVM1ScopeListItemFlags.REPLACE_TARGET)||64&i||r||(r=s.replaceTargetBy),s.flags&AVM1ScopeListItemFlags.TARGET){if(2&i)return o.scope=r||s.scope,o.propertyName=e,o.value=32&i?o.scope.alGet(e):void 0,o;if(1&i&&r){if(r.alHasProperty(e))return o.scope=r,o.propertyName=e,o.value=32&i?r.alGet(e):void 0,o;continue}}if(s.scope.alHasProperty(e)){var a=s.scope.alGet(e);if(n&&(!a||"object"!=typeof a||!a.alHasProperty||!a.alHasProperty(n)))continue;return o.scope=s.scope,o.propertyName=e,o.value=32&i?s.scope.alGet(e):void 0,o}}}function avm1ResolveVariable(t,e,i){var n=e;if("string"==typeof(e=t.context.normalizeName(e))&&(e=e.replace("_level0","_root")),!avm1VariableNameHasPath(e))return avm1ResolveSimpleVariable(t.scopeList,e,i);if("."==e[e.length-1])return null;var r,o,s=0,a=e.length,l=!0,c=null,h=null,u=void 0,p="/"===e[0]?((r=avm1ResolveSimpleVariable(t.scopeList,"_root",33))&&(c=r.propertyName,h=r.scope,u=r.value),s++,!1):!(r=null);if(a<=s)return r;for(var d=s;s<a;){if(!(p||u instanceof AVM1Object))return avm1Warn("Unable to resolve variable on invalid object "+e.substring(d,s-1)+" (expr "+e+")"),null;if("."===e[d=s]&&"."===e[s+1])s+=2,c="_parent";else{for(;s<a&&"/"!==(o=e[s])&&"."!==o&&":"!==o;)s++;c=e.substring(d,s)}if(""===c&&s<a)s++;else{h=u;var _,f=!1;if(!l||(_=u instanceof AVM1MovieClip?u._lookupChildByName(c):void 0)&&(f=!0,u=_),!f)if(p){var m=d=s+1,g="";if("."===e[m]&&"."===e[m+1])m+=2,g="_parent";else{for(;m<a&&"/"!==(o=e[m])&&"."!==o&&":"!==o;)m++;g=e.substring(d,m)}""==g&&(g=null),!(r=avm1ResolveSimpleVariable(t.scopeList,c,i,g))&&g&&(r=avm1ResolveSimpleVariable(t.scopeList,c,i)),r&&(f=!0,c=r.propertyName,h=r.scope,u=r.value,s<a&&!u&&h&&(u=h)),p=!1}else u.alHasProperty(c)&&(u=u.alGet(c),f=!0);if(f||"_"!==c[0]||("_level0"===c?(u=t.context.resolveLevel(0),f=!0):"_root"===c&&(u=avm1ResolveRoot(t),f=!0)),!(f||2&i))return avm1Warn("Unable to resolve "+c+" on "+e.substring(d,s-1)+" (expr "+e+")"),null;if(a<=s)break;var y=e[s++];"/"!==y||":"!==(o=e[s])&&"."!==o||(y=e[s++]),l="/"===y}}return(r=cachedResolvedVariableResult).scope=h,r.propertyName=n.substring(d,s),r.value=32&i?u:void 0,r}function avm1GetTarget(t,e){for(var i=t.scopeList;i.previousScopeItem;i=i.previousScopeItem){if(i.flags&AVM1ScopeListItemFlags.REPLACE_TARGET&&e)return i.replaceTargetBy;if(i.flags&AVM1ScopeListItemFlags.TARGET)return i.scope}}function avm1ResolveTarget(t,e,i){var n,r;return avm1IsTarget(e)?e:(e=isNullOrUndefined$1(e)?"":alToString(this,e))?(r=avm1ResolveVariable(t,n=alToString(t.context,e),161|(i?0:64)))&&avm1IsTarget(r.value)?r.value:void avm1Warn("Invalid AVM1 target object: "+n):avm1GetTarget(t,!0)}function avm1ResolveRoot(t){return avm1GetTarget(t,!0).get_root()}function avm1ProcessWith(t,e,i){var n,r,o;isNullOrUndefined$1(e)?avm1Warn("The with statement object cannot be undefined."):(n=t.context,r=t.scopeList,o=new AVM1ScopeListItem(alToObject(n,e),r),interpretActionsData(t.pushScope(o),i))}function avm1ProcessTry(t,e,i,n,r,o,s,a){var l,c=t.context,h=t.scopeList,u=t.registers,p=c.isTryCatchListening;try{c.isTryCatchListening=!0,interpretActionsData(t.pushScope(),o)}catch(e){c.isTryCatchListening=p,n&&e instanceof AVM1Error?("string"==typeof r?h.scope.alPut(r,e.error):u[r]=e.error,interpretActionsData(t.pushScope(),s)):l=e}if(c.isTryCatchListening=p,i&&interpretActionsData(t.pushScope(),a),l)throw l}function avm1_0x81_ActionGotoFrame(t,e){var i=e[0];e[1]?t.actions.gotoAndPlay(i+1):t.actions.gotoAndStop(i+1)}function avm1_0x83_ActionGetURL(t,e){t.actions;var i=e[0],n=e[1];t.actions.getURL(i,n)}function avm1_0x04_ActionNextFrame(t){t.actions.nextFrame()}function avm1_0x05_ActionPreviousFrame(t){t.actions.prevFrame()}function avm1_0x06_ActionPlay(t){t.actions.play()}function avm1_0x07_ActionStop(t){t.actions.stop()}function avm1_0x08_ActionToggleQuality(t){t.actions.toggleHighQuality()}function avm1_0x09_ActionStopSounds(t){t.actions.stopAllSounds()}function avm1_0x8A_ActionWaitForFrame(t,e){var i=e[0];return e[1],!t.actions.ifFrameLoaded(i)}function avm1_0x8B_ActionSetTarget(t,e){avm1SetTarget(t,e[0])}function avm1_0x8C_ActionGoToLabel(t,e){var i=e[0];e[1]?t.actions.gotoAndPlay(i):t.actions.gotoAndStop(i)}function avm1_0x96_ActionPush(t,e){var i=t.registers,n=t.constantPool,r=t.stack;e.forEach(function(t){var e;t instanceof ParsedPushConstantAction?r.push(n[t.constantIndex]):t instanceof ParsedPushRegisterAction?(e=t.registerNumber)<0||e>=i.length?r.push(void 0):r.push(i[e]):r.push(t)})}function avm1_0x17_ActionPop(t){t.stack.pop()}function avm1_0x0A_ActionAdd(t){var e=t.stack,i=alToNumber(t.context,e.pop()),n=alToNumber(t.context,e.pop());t.isSwfVersion7||(void 0===i&&(i=0),void 0===n&&(n=0)),isFinite(i)&&isFinite(n)?e.push(Number(big(Number(i)).add(big(Number(n))))):isNaN(i)||isNaN(n)?e.push(NaN):i===n?e.push(1/0):isFinite(i)||isFinite(n)?isFinite(i)?isFinite(n)||e.push(n):e.push(i):e.push(NaN)}function avm1_0x0B_ActionSubtract(t){var e=t.stack,i=alToNumber(t.context,e.pop()),n=alToNumber(t.context,e.pop());t.isSwfVersion7||(void 0===i&&(i=0),void 0===n&&(n=0)),isFinite(i)&&isFinite(n)?e.push(Number(big(Number(n)).sub(big(Number(i))))):isNaN(i)||isNaN(n)||i===n?e.push(NaN):isFinite(i)?isFinite(n)||e.push(n):e.push(-1/0)}function avm1_0x0C_ActionMultiply(t){var e=t.stack,i=alToNumber(t.context,e.pop()),n=alToNumber(t.context,e.pop());t.isSwfVersion7||(void 0===i&&(i=0),void 0===n&&(n=0)),isFinite(i)&&isFinite(n)?e.push(Number(big(Number(i)).mul(big(Number(n))))):isNaN(i)||isNaN(n)?e.push(NaN):i===n?e.push(1/0):isFinite(i)||isFinite(n)?isFinite(i)?isFinite(n)||e.push(n):e.push(i):e.push(-1/0)}function avm1_0x0D_ActionDivide(t){var e=t.stack,i=t.isSwfVersion5,n=alToNumber(t.context,e.pop()),r=alToNumber(t.context,e.pop());t.isSwfVersion7||(void 0===n&&(n=0),void 0===r&&(r=0)),!isFinite(n)||!isFinite(r)||0==n&&0==r?0==n&&0==r||!isFinite(n)&&!isFinite(r)?e.push(NaN):0==n?e.push(r):0==r?e.push(0):isFinite(r)?isFinite(n)||e.push(0):e.push(r):0==n?e.push(i?"#ERROR#":0<r?1/0:-1/0):e.push(Number(big(Number(r)).div(big(Number(n)))))}function avm1_0x0E_ActionEquals(t){var e=t.stack,i=t.isSwfVersion5,n=alToNumber(t.context,e.pop())==alToNumber(t.context,e.pop());e.push(i?n:n?1:0)}function avm1_0x0F_ActionLess(t){var e=t.stack,i=t.isSwfVersion5,n=alToNumber(t.context,e.pop()),r=alToNumber(t.context,e.pop())<n;e.push(i?r:r?1:0)}function avm1_0x10_ActionAnd(t){var e=t.stack,i=t.isSwfVersion5,n=alToBoolean(t.context,e.pop()),r=alToBoolean(t.context,e.pop()),o=n&&r;e.push(i?o:o?1:0)}function avm1_0x11_ActionOr(t){var e=t.stack,i=t.isSwfVersion5,n=alToBoolean(t.context,e.pop()),r=alToBoolean(t.context,e.pop()),o=n||r;e.push(i?o:o?1:0)}function avm1_0x12_ActionNot(t){var e=t.context,i=t.stack,n=!alToBoolean(e,i.pop());i.push(bToRuntimeBool(e,n))}function avm1_0x13_ActionStringEquals(t){var e=t.stack,i=t.isSwfVersion5,n=alToString(t.context,e.pop())==alToString(t.context,e.pop());e.push(i?n:n?1:0)}function avm1_0x14_ActionStringLength(t){var e=t.stack,i=alToString(t.context,e.pop());e.push(t.actions.length_(i))}function avm1_0x31_ActionMBStringLength(t){var e=t.stack,i=alToString(t.context,e.pop());e.push(t.actions.length_(i))}function avm1_0x21_ActionStringAdd(t){var e=t.stack,i=alToString(t.context,e.pop()),n=alToString(t.context,e.pop());e.push(n+i)}function avm1_0x15_ActionStringExtract(t){var e=t.stack,i=e.pop(),n=e.pop(),r=alToString(t.context,e.pop());e.push(t.actions.substring(r,n,i))}function avm1_0x35_ActionMBStringExtract(t){var e=t.stack,i=e.pop(),n=e.pop(),r=alToString(t.context,e.pop());e.push(t.actions.mbsubstring(r,n,i))}function avm1_0x29_ActionStringLess(t){var e=t.stack,i=t.isSwfVersion5,n=alToString(t.context,e.pop()),r=alToString(t.context,e.pop())<n;e.push(i?r:r?1:0)}function avm1_0x18_ActionToInteger(t){var e=t.stack,i=alToInt32(t.context,e.pop());e.push(i)}function avm1_0x32_ActionCharToAscii(t){var e=t.stack,i=e.pop(),n=t.actions.ord(i);e.push(n)}function avm1_0x36_ActionMBCharToAscii(t){var e=t.stack,i=e.pop(),n=t.actions.mbord(i);e.push(n)}function avm1_0x33_ActionAsciiToChar(t){var e=t.stack,i=+e.pop(),n=t.actions.chr(i);e.push(n)}function avm1_0x37_ActionMBAsciiToChar(t){var e=t.stack,i=+e.pop(),n=t.actions.mbchr(i);e.push(n)}function avm1_0x99_ActionJump(t,e){}function avm1_0x9D_ActionIf(t,e){var i=t.stack;return e[0],!!i.pop()}function avm1_0x9E_ActionCall(t){var e=t.stack.pop();t.actions.call(e)}function avm1_0x1C_ActionGetVariable(t){var e=t.stack,i=(i=e.pop())&&alToString(t.context,i),n=e.length;e.push(void 0);var r=avm1ResolveVariable(t,i,33);isNullOrUndefined$1(r)?"TRUE"==i?e[n]=!0:"FALSE"==i?e[n]=!1:i&&0==i.indexOf("this.")?(r=avm1ResolveVariable(t,i=i.replace("this.",""),33),e[n]=r?r.value:void 0):avm1WarningsEnabled.value&&avm1Warn("AVM1 warning: cannot look up variable '"+i+"'"):e[n]=r?r.value:void 0}function avm1_0x1D_ActionSetVariable(t){var e=t.stack,i=e.pop(),n=""+e.pop(),r=avm1ResolveVariable(t,n,2);r?(r.scope.alPut(r.propertyName,i),as2SyncEvents(t.context,r.propertyName,r.scope)):avm1WarningsEnabled.value&&avm1Warn("AVM1 warning: cannot look up variable '"+n+"'")}function avm1_0x9A_ActionGetURL2(t,e){var i,n=t.stack,r=e[0],o=n.pop(),s=n.pop();1&r?i="GET":2&r&&(i="POST");var a=64&r;128&r?t.actions.loadVariables(s,o,i):a?t.actions.loadMovie(s,o,i):t.actions.getURL(s,o,i)}function avm1_0x9F_ActionGotoFrame2(t,e){var i=t.stack,n=e[0],r=[i.pop()];2&n&&r.push(e[1]),(1&n?t.actions.gotoAndPlay:t.actions.gotoAndStop).apply(t.actions,r)}function avm1_0x20_ActionSetTarget2(t){var e=t.stack;avm1SetTarget(t,alToString(t.context,e.pop()))}function avm1_0x22_ActionGetProperty(t){var e=t.stack,i=e.pop(),n=e.pop(),r=e.length;e.push(void 0);var o=avm1ResolveTarget(t,n,!0),s=MovieClipProperties[i];o&&s&&(e[r]=o.alGet(s))}function avm1_0x23_ActionSetProperty(t){var e=t.stack,i=e.pop(),n=e.pop(),r=avm1ResolveTarget(t,e.pop(),!0),o=MovieClipProperties[n];r&&o&&r.alPut(o,i)}function avm1_0x24_ActionCloneSprite(t){var e=t.stack,i=e.pop(),n=e.pop(),r=e.pop();t.actions.duplicateMovieClip(r,n,i)}function avm1_0x25_ActionRemoveSprite(t){var e=t.stack.pop();t.actions.removeMovieClip(e)}function avm1_0x27_ActionStartDrag(t){var e=t.stack,i=e.pop(),n=e.pop(),r=e.pop()?{y2:e.pop(),x2:e.pop(),y1:e.pop(),x1:e.pop()}:null,o=[i,n];r&&(o=o.concat(r.x1,r.y1,r.x2,r.y2)),t.actions.startDrag.apply(t.actions,o)}function avm1_0x28_ActionEndDrag(t){t.actions.stopDrag()}function avm1_0x8D_ActionWaitForFrame2(t,e){var i=t.stack,n=(e[0],i.pop());return!t.actions.ifFrameLoaded(n)}function avm1_0x26_ActionTrace(t){var e=t.stack.pop();t.actions.trace(e)}function avm1_0x34_ActionGetTime(t){t.stack.push(t.actions.getTimer())}function avm1_0x30_ActionRandomNumber(t){var e=t.stack;e.push(t.actions.random(e.pop()))}function avm1_0x3D_ActionCallFunction(t){var e=t.stack,i=e.pop(),n=avm1ReadFunctionArgs(e),r=e.length;e.push(void 0);var o,s=avm1ResolveVariable(t,i,33);isNullOrUndefined$1(s)?avm1Warn("AVM1 warning: cannot look up function '"+i+"'"):alIsFunction(o=s.value)?("array"==i.toLowerCase()&&(n=[n]),e[r]=o.alCall(s.scope||null,n)):avm1Warn("AVM1 warning: function '"+i+(o?"' is not callable":"' is undefined"))}function avm1_0x52_ActionCallMethod(t){var e,i,n,r,o,s=t.stack,a=s.pop(),l=s.pop(),c=avm1ReadFunctionArgs(s),h=s.length;s.push(void 0),isNullOrUndefined$1(l)?avm1Warn("AVM1 warning: method '"+a+"' can't be called on undefined object"):(n=t.context.frame,isNullOrUndefined$1(a)||""===a?(l instanceof AVM1SuperWrapper?(o=l.callFrame,(r=avm1FindSuperPropertyOwner(t.context,o,"__constructor__"))&&(i=r.alGet("__constructor__"),e=o.currentThis)):e=i=l,alIsFunction(i)?(n.setCallee(e,r,i,c),s[h]=i.alCall(e,c),n.resetCallee()):avm1Warn("AVM1 warning: obj '"+l+(l?"' is not callable":"' is undefined"))):(l instanceof AVM1SuperWrapper?(o=l.callFrame,(r=avm1FindSuperPropertyOwner(t.context,o,a))&&(i=r.alGet(a),e=o.currentThis)):(i=as2GetProperty(t.context,l,a),e=alToObject(t.context,l)),alIsFunction(i)?(n.setCallee(e,r,i,c),"toString"==a&&"number"==typeof l?1==c.length&&16==c[0]?s[h]=l.toString(16).toString():s[h]=alToString(t.context,l):s[h]=i.alCall(e,c),n.resetCallee()):"function"==typeof i?s[h]=i(c):avm1Warn("AVM1 warning: method '"+a+"' on object",l,isNullOrUndefined$1(i)?"is undefined":"is not callable")))}function avm1_0x88_ActionConstantPool(t,e){var i=e[0];t.constantPool=i}function avm1_0x9B_ActionDefineFunction(t,e){var i,n=t.stack,r=e[0],o=e[1],s=avm1DefineFunction(t,r,o,e[2],4,null,0);o?((i=t.scopeList.scope).alPut(o,s),as2SyncEvents(t.context,o,i)):n.push(s)}function avm1_0x3C_ActionDefineLocal(t){var e=t.stack,i=t.scopeList.scope,n=e.pop(),r=e.pop();i.alPut(r,n)}function avm1_0x41_ActionDefineLocal2(t){var e=t.stack,i=t.scopeList.scope,n=e.pop();i.alHasProperty(n)||i.alPut(n,void 0)}function avm1_0x3A_ActionDelete(t){var e=t.stack,i=e.pop(),n=e.pop();isNullOrUndefined$1(n)?avm1Warn("AVM1 warning: cannot delete member '"+i+"' on undefined object"):e.push(as2DeleteProperty(t.context,n,i))}function avm1_0x3B_ActionDelete2(t){var e,i=t.stack,n=i.pop(),r=avm1ResolveVariable(t,n,1);isNullOrUndefined$1(r)?avm1Warn("AVM1 warning: cannot look up variable '"+n+"'"):(e=r.scope.alGetProperty(n))&&e.value&&e.value.adaptee||i.push(as2DeleteProperty(t.context,r.scope,n))}function avm1_0x46_ActionEnumerate(t){var e=t.stack,i=e.pop();e.push(null);var n,r=avm1ResolveVariable(t,i,33);isNullOrUndefined$1(r)?avm1Warn("AVM1 warning: cannot look up variable '"+i+"'"):isNullOrUndefined$1(n=r.value)?avm1Warn("AVM1 warning: cannot iterate over undefined object"):as2Enumerate(n,function(t){e.push(t)},null)}function avm1_0x49_ActionEquals2(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(as2Equals(t.context,i,n))}function avm1_0x4E_ActionGetMember(t){var e,i,n=t.stack,r=n.pop(),o=n.pop();n.push(void 0),isNullOrUndefined$1(o)?avm1Warn("AVM1 warning: cannot get member '"+r+"' on undefined object"):o instanceof AVM1SuperWrapper?(e=o.callFrame,(i=avm1FindSuperPropertyOwner(t.context,e,r))&&(n[n.length-1]=i.alGet(r))):n[n.length-1]=as2GetProperty(t.context,o,r)}function avm1_0x42_ActionInitArray(t){var e=t.stack,i=new AVM1ArrayNative(t.context,avm1ReadFunctionArgs(e));e.push(i)}function avm1_0x43_ActionInitObject(t){for(var e=t.stack,i=fixArgsCount(i=+e.pop(),e.length>>1),n=alNewObject(t.context),r=0;r<i;r++){var o=e.pop(),s=e.pop();n.alPut(s,o)}e.push(n)}function avm1_0x53_ActionNewMethod(t){var e,i=t.stack,n=i.pop(),r=i.pop(),o=avm1ReadFunctionArgs(i),s=i.length;i.push(void 0),isNullOrUndefined$1(r)?avm1Warn("AVM1 warning: method '"+n+"' can't be constructed on undefined object"):(void 0===(e=as2Construct(isNullOrUndefined$1(n)||""===n?r:as2GetProperty(t.context,r,n),o))&&avm1Warn("AVM1 warning: method '"+n+"' on object",r,"is not constructible"),i[s]=e)}function avm1_0x40_ActionNewObject(t){var e=t.stack,i=e.pop(),n=avm1ReadFunctionArgs(e),r=e.length;e.push(void 0);var o,s,a=avm1ResolveVariable(t,i,33);isNullOrUndefined$1(a)?avm1Warn("AVM1 warning: cannot look up object '"+i+"'"):(o=a.value,void 0===(s=createBuiltinType(t.context,o,n))&&void 0===(s=as2Construct(o,n))&&avm1Warn("AVM1 warning: object '"+i+(o?"' is not constructible":"' is undefined")),e[r]=s)}function avm1_0x4F_ActionSetMember(t){var e=t.stack,i=e.pop(),n=e.pop(),r=e.pop();if(isNullOrUndefined$1(r))avm1Warn("AVM1 warning: cannot set member '"+n+"' on undefined object");else if(r instanceof AVM1SuperWrapper)avm1Warn("AVM1 warning: cannot set member '"+n+"' on super");else if(void 0!==n){if("string"==typeof n){var o=n.split(".");if(1<o.length){for(;1<o.length;){var s=o.shift(),a=r.alGet(s);if(!(a instanceof AVM1Object))return void avm1Warn("AVM1 warning: cannot set member '"+n+"' on super");r=a}1==o.length&&(n=o[0])}}as2SetProperty(t.context,r,n,i)}}function avm1_0x45_ActionTargetPath(t){var e=t.stack,i=e.pop();e.push(isAVM1MovieClip(i)?i._target:void 0)}function avm1_0x94_ActionWith(t,e){var i=t.stack,n=e[0];avm1ProcessWith(t,i.pop(),n)}function avm1_0x4A_ActionToNumber(t){var e=t.stack;e.push(alToNumber(t.context,e.pop()))}function avm1_0x4B_ActionToString(t){var e=t.stack;e.push(alToString(t.context,e.pop()))}function avm1_0x44_ActionTypeOf(t){var e=t.stack,i=as2GetType(e.pop());e.push(i)}function avm1_0x47_ActionAdd2(t){var e=t.stack,i=as2ToAddPrimitive(t.context,e.pop()),n=as2ToAddPrimitive(t.context,e.pop());"string"==typeof i||"string"==typeof n?e.push(alToString(t.context,n)+alToString(t.context,i)):(t.isSwfVersion7||(void 0===i&&(i=0),void 0===n&&(n=0)),isFinite(i)&&isFinite(n)?e.push(Number(big(Number(i)).add(big(Number(n))))):isNaN(i)||isNaN(n)?e.push(NaN):i===n?e.push(1/0):isFinite(i)||isFinite(n)?isFinite(i)?isFinite(n)||e.push(n):e.push(i):e.push(NaN))}function avm1_0x48_ActionLess2(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(as2Compare(t.context,n,i))}function avm1_0x3F_ActionModulo(t){var e=t.stack,i=alToNumber(t.context,e.pop()),n=alToNumber(t.context,e.pop());t.isSwfVersion7||(void 0===i&&(i=0),void 0===n&&(n=0)),!isFinite(i)||!isFinite(n)||0==i&&0==n?isNaN(i)||isNaN(n)||!isFinite(i)&&!isFinite(n)||isFinite(i)?e.push(NaN):e.push(n):e.push(Number(big(Number(n)).mod(big(Number(i)))))}function avm1_0x60_ActionBitAnd(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n&i)}function avm1_0x63_ActionBitLShift(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n<<i)}function avm1_0x61_ActionBitOr(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n|i)}function avm1_0x64_ActionBitRShift(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n>>i)}function avm1_0x65_ActionBitURShift(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n>>>i)}function avm1_0x62_ActionBitXor(t){var e=t.stack,i=alToInt32(t.context,e.pop()),n=alToInt32(t.context,e.pop());e.push(n^i)}function avm1_0x51_ActionDecrement(t){var e=t.stack,i=alToNumber(t.context,e.pop());i--,e.push(i)}function avm1_0x50_ActionIncrement(t){var e=t.stack,i=alToNumber(t.context,e.pop());i++,e.push(i)}function avm1_0x4C_ActionPushDuplicate(t){var e=t.stack;e.push(e[e.length-1])}function avm1_0x3E_ActionReturn(t){t.isEndOfActions=!0}function avm1_0x4D_ActionStackSwap(t){var e=t.stack;e.push(e.pop(),e.pop())}function avm1_0x87_ActionStoreRegister(t,e){var i=t.stack,n=t.registers,r=e[0];r<0||r>=n.length||(n[r]=i[i.length-1])}function avm1_0x54_ActionInstanceOf(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(as2InstanceOf(n,i))}function avm1_0x55_ActionEnumerate2(t){var e=t.stack,i=e.pop();e.push(null),isNullOrUndefined$1(i)?avm1Warn("AVM1 warning: cannot iterate over undefined object"):as2Enumerate(i,function(t){e.push(t)},null)}function avm1_0x66_ActionStrictEquals(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(n===i)}function avm1_0x67_ActionGreater(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(as2Compare(t.context,i,n))}function avm1_0x68_ActionStringGreater(t){var e=t.stack,i=t.isSwfVersion5,n=alToString(t.context,e.pop()),r=alToString(t.context,e.pop())>n;e.push(i?r:r?1:0)}function avm1_0x8E_ActionDefineFunction2(t,e){var i=t.stack,n=t.scopeList.scope,r=e[0],o=e[1],s=avm1DefineFunction(t,r,o,e[2],e[3],e[4],e[5]);o?(n.alPut(o,s),as2SyncEvents(t.context,o,n)):i.push(s)}function avm1_0x69_ActionExtends(t){var e=t.stack,i=t.context,n=alToObject(i,e.pop()),r=alToObject(i,e.pop()).alGetPrototypeProperty(),o=n.alGetPrototypeProperty();r.alPrototype=o;var s=new AVM1PropertyDescriptor(65,n);r.alSetOwnProperty("__constructor__",s)}function avm1_0x2B_ActionCastOp(t){var e=t.stack,i=e.pop(),n=e.pop();e.push(as2InstanceOf(i,n)?i:null)}function avm1_0x2C_ActionImplementsOp(t){var e=t.stack,i=e.pop(),n=+e.pop();fixArgsCount(n,e.length);for(var r=[],o=0;o<n;o++)r.push(e.pop());i._as2Interfaces=r}function avm1_0x8F_ActionTry(t,e){var i=e[0],n=e[1],r=e[2],o=e[3],s=e[4];avm1ProcessTry(t,i,e[5],o,n,r,s,e[6])}function avm1_0x2A_ActionThrow(t){var e=t.stack.pop();throw new AVM1Error(e)}function avm1_0x2D_ActionFSCommand2(t){var e=t.stack,i=avm1ReadFunctionArgs(e),n=e.length;e.push(void 0);var r=t.actions.fscommand.apply(t.actions,i);e[n]=r}function avm1_0x89_ActionStrictMode(t,e){e[0]}function wrapAvm1Error(i){return function(t,e){i(t,e),t.recoveringFromError=!1}}function generateActionCalls(){var t;return{ActionGotoFrame:(t=avm1ErrorsEnabled.value?function(t){return t}:wrapAvm1Error)(avm1_0x81_ActionGotoFrame),ActionGetURL:t(avm1_0x83_ActionGetURL),ActionNextFrame:t(avm1_0x04_ActionNextFrame),ActionPreviousFrame:t(avm1_0x05_ActionPreviousFrame),ActionPlay:t(avm1_0x06_ActionPlay),ActionStop:t(avm1_0x07_ActionStop),ActionToggleQuality:t(avm1_0x08_ActionToggleQuality),ActionStopSounds:t(avm1_0x09_ActionStopSounds),ActionWaitForFrame:t(avm1_0x8A_ActionWaitForFrame),ActionSetTarget:t(avm1_0x8B_ActionSetTarget),ActionGoToLabel:t(avm1_0x8C_ActionGoToLabel),ActionPush:t(avm1_0x96_ActionPush),ActionPop:t(avm1_0x17_ActionPop),ActionAdd:t(avm1_0x0A_ActionAdd),ActionSubtract:t(avm1_0x0B_ActionSubtract),ActionMultiply:t(avm1_0x0C_ActionMultiply),ActionDivide:t(avm1_0x0D_ActionDivide),ActionEquals:t(avm1_0x0E_ActionEquals),ActionLess:t(avm1_0x0F_ActionLess),ActionAnd:t(avm1_0x10_ActionAnd),ActionOr:t(avm1_0x11_ActionOr),ActionNot:t(avm1_0x12_ActionNot),ActionStringEquals:t(avm1_0x13_ActionStringEquals),ActionStringLength:t(avm1_0x14_ActionStringLength),ActionMBStringLength:t(avm1_0x31_ActionMBStringLength),ActionStringAdd:t(avm1_0x21_ActionStringAdd),ActionStringExtract:t(avm1_0x15_ActionStringExtract),ActionMBStringExtract:t(avm1_0x35_ActionMBStringExtract),ActionStringLess:t(avm1_0x29_ActionStringLess),ActionToInteger:t(avm1_0x18_ActionToInteger),ActionCharToAscii:t(avm1_0x32_ActionCharToAscii),ActionMBCharToAscii:t(avm1_0x36_ActionMBCharToAscii),ActionAsciiToChar:t(avm1_0x33_ActionAsciiToChar),ActionMBAsciiToChar:t(avm1_0x37_ActionMBAsciiToChar),ActionJump:t(avm1_0x99_ActionJump),ActionIf:t(avm1_0x9D_ActionIf),ActionCall:t(avm1_0x9E_ActionCall),ActionGetVariable:t(avm1_0x1C_ActionGetVariable),ActionSetVariable:t(avm1_0x1D_ActionSetVariable),ActionGetURL2:t(avm1_0x9A_ActionGetURL2),ActionGotoFrame2:t(avm1_0x9F_ActionGotoFrame2),ActionSetTarget2:t(avm1_0x20_ActionSetTarget2),ActionGetProperty:t(avm1_0x22_ActionGetProperty),ActionSetProperty:t(avm1_0x23_ActionSetProperty),ActionCloneSprite:t(avm1_0x24_ActionCloneSprite),ActionRemoveSprite:t(avm1_0x25_ActionRemoveSprite),ActionStartDrag:t(avm1_0x27_ActionStartDrag),ActionEndDrag:t(avm1_0x28_ActionEndDrag),ActionWaitForFrame2:t(avm1_0x8D_ActionWaitForFrame2),ActionTrace:t(avm1_0x26_ActionTrace),ActionGetTime:t(avm1_0x34_ActionGetTime),ActionRandomNumber:t(avm1_0x30_ActionRandomNumber),ActionCallFunction:t(avm1_0x3D_ActionCallFunction),ActionCallMethod:t(avm1_0x52_ActionCallMethod),ActionConstantPool:t(avm1_0x88_ActionConstantPool),ActionDefineFunction:t(avm1_0x9B_ActionDefineFunction),ActionDefineLocal:t(avm1_0x3C_ActionDefineLocal),ActionDefineLocal2:t(avm1_0x41_ActionDefineLocal2),ActionDelete:t(avm1_0x3A_ActionDelete),ActionDelete2:t(avm1_0x3B_ActionDelete2),ActionEnumerate:t(avm1_0x46_ActionEnumerate),ActionEquals2:t(avm1_0x49_ActionEquals2),ActionGetMember:t(avm1_0x4E_ActionGetMember),ActionInitArray:t(avm1_0x42_ActionInitArray),ActionInitObject:t(avm1_0x43_ActionInitObject),ActionNewMethod:t(avm1_0x53_ActionNewMethod),ActionNewObject:t(avm1_0x40_ActionNewObject),ActionSetMember:t(avm1_0x4F_ActionSetMember),ActionTargetPath:t(avm1_0x45_ActionTargetPath),ActionWith:t(avm1_0x94_ActionWith),ActionToNumber:t(avm1_0x4A_ActionToNumber),ActionToString:t(avm1_0x4B_ActionToString),ActionTypeOf:t(avm1_0x44_ActionTypeOf),ActionAdd2:t(avm1_0x47_ActionAdd2),ActionLess2:t(avm1_0x48_ActionLess2),ActionModulo:t(avm1_0x3F_ActionModulo),ActionBitAnd:t(avm1_0x60_ActionBitAnd),ActionBitLShift:t(avm1_0x63_ActionBitLShift),ActionBitOr:t(avm1_0x61_ActionBitOr),ActionBitRShift:t(avm1_0x64_ActionBitRShift),ActionBitURShift:t(avm1_0x65_ActionBitURShift),ActionBitXor:t(avm1_0x62_ActionBitXor),ActionDecrement:t(avm1_0x51_ActionDecrement),ActionIncrement:t(avm1_0x50_ActionIncrement),ActionPushDuplicate:t(avm1_0x4C_ActionPushDuplicate),ActionReturn:t(avm1_0x3E_ActionReturn),ActionStackSwap:t(avm1_0x4D_ActionStackSwap),ActionStoreRegister:t(avm1_0x87_ActionStoreRegister),ActionInstanceOf:t(avm1_0x54_ActionInstanceOf),ActionEnumerate2:t(avm1_0x55_ActionEnumerate2),ActionStrictEquals:t(avm1_0x66_ActionStrictEquals),ActionGreater:t(avm1_0x67_ActionGreater),ActionStringGreater:t(avm1_0x68_ActionStringGreater),ActionDefineFunction2:t(avm1_0x8E_ActionDefineFunction2),ActionExtends:t(avm1_0x69_ActionExtends),ActionCastOp:t(avm1_0x2B_ActionCastOp),ActionImplementsOp:t(avm1_0x2C_ActionImplementsOp),ActionTry:t(avm1_0x8F_ActionTry),ActionThrow:t(avm1_0x2A_ActionThrow),ActionFSCommand2:t(avm1_0x2D_ActionFSCommand2),ActionStrictMode:t(avm1_0x89_ActionStrictMode)}}function interpretAction(t,e){t.stack;var i=e.actionCode,n=e.args,r=(t.context.actionTracer,!1);switch(0|i){case 129:avm1_0x81_ActionGotoFrame(t,n);break;case 131:avm1_0x83_ActionGetURL(t,n);break;case 4:avm1_0x04_ActionNextFrame(t);break;case 5:avm1_0x05_ActionPreviousFrame(t);break;case 6:avm1_0x06_ActionPlay(t);break;case 7:avm1_0x07_ActionStop(t);break;case 8:avm1_0x08_ActionToggleQuality(t);break;case 9:avm1_0x09_ActionStopSounds(t);break;case 138:r=avm1_0x8A_ActionWaitForFrame(t,n);break;case 139:avm1_0x8B_ActionSetTarget(t,n);break;case 140:avm1_0x8C_ActionGoToLabel(t,n);break;case 150:avm1_0x96_ActionPush(t,n);break;case 23:avm1_0x17_ActionPop(t);break;case 10:avm1_0x0A_ActionAdd(t);break;case 11:avm1_0x0B_ActionSubtract(t);break;case 12:avm1_0x0C_ActionMultiply(t);break;case 13:avm1_0x0D_ActionDivide(t);break;case 14:avm1_0x0E_ActionEquals(t);break;case 15:avm1_0x0F_ActionLess(t);break;case 16:avm1_0x10_ActionAnd(t);break;case 17:avm1_0x11_ActionOr(t);break;case 18:avm1_0x12_ActionNot(t);break;case 19:avm1_0x13_ActionStringEquals(t);break;case 20:avm1_0x14_ActionStringLength(t);break;case 49:avm1_0x31_ActionMBStringLength(t);break;case 33:avm1_0x21_ActionStringAdd(t);break;case 21:avm1_0x15_ActionStringExtract(t);break;case 53:avm1_0x35_ActionMBStringExtract(t);break;case 41:avm1_0x29_ActionStringLess(t);break;case 24:avm1_0x18_ActionToInteger(t);break;case 50:avm1_0x32_ActionCharToAscii(t);break;case 54:avm1_0x36_ActionMBCharToAscii(t);break;case 51:avm1_0x33_ActionAsciiToChar(t);break;case 55:avm1_0x37_ActionMBAsciiToChar(t);break;case 153:break;case 157:r=avm1_0x9D_ActionIf(t,n);break;case 158:avm1_0x9E_ActionCall(t);break;case 28:avm1_0x1C_ActionGetVariable(t);break;case 29:avm1_0x1D_ActionSetVariable(t);break;case 154:avm1_0x9A_ActionGetURL2(t,n);break;case 159:avm1_0x9F_ActionGotoFrame2(t,n);break;case 32:avm1_0x20_ActionSetTarget2(t);break;case 34:avm1_0x22_ActionGetProperty(t);break;case 35:avm1_0x23_ActionSetProperty(t);break;case 36:avm1_0x24_ActionCloneSprite(t);break;case 37:avm1_0x25_ActionRemoveSprite(t);break;case 39:avm1_0x27_ActionStartDrag(t);break;case 40:avm1_0x28_ActionEndDrag(t);break;case 141:r=avm1_0x8D_ActionWaitForFrame2(t,n);break;case 38:avm1_0x26_ActionTrace(t);break;case 52:avm1_0x34_ActionGetTime(t);break;case 48:avm1_0x30_ActionRandomNumber(t);break;case 61:avm1_0x3D_ActionCallFunction(t);break;case 82:avm1_0x52_ActionCallMethod(t);break;case 136:avm1_0x88_ActionConstantPool(t,n);break;case 155:avm1_0x9B_ActionDefineFunction(t,n);break;case 60:avm1_0x3C_ActionDefineLocal(t);break;case 65:avm1_0x41_ActionDefineLocal2(t);break;case 58:avm1_0x3A_ActionDelete(t);break;case 59:avm1_0x3B_ActionDelete2(t);break;case 70:avm1_0x46_ActionEnumerate(t);break;case 73:avm1_0x49_ActionEquals2(t);break;case 78:avm1_0x4E_ActionGetMember(t);break;case 66:avm1_0x42_ActionInitArray(t);break;case 67:avm1_0x43_ActionInitObject(t);break;case 83:avm1_0x53_ActionNewMethod(t);break;case 64:avm1_0x40_ActionNewObject(t);break;case 79:avm1_0x4F_ActionSetMember(t);break;case 69:avm1_0x45_ActionTargetPath(t);break;case 148:avm1_0x94_ActionWith(t,n);break;case 74:avm1_0x4A_ActionToNumber(t);break;case 75:avm1_0x4B_ActionToString(t);break;case 68:avm1_0x44_ActionTypeOf(t);break;case 71:avm1_0x47_ActionAdd2(t);break;case 72:avm1_0x48_ActionLess2(t);break;case 63:avm1_0x3F_ActionModulo(t);break;case 96:avm1_0x60_ActionBitAnd(t);break;case 99:avm1_0x63_ActionBitLShift(t);break;case 97:avm1_0x61_ActionBitOr(t);break;case 100:avm1_0x64_ActionBitRShift(t);break;case 101:avm1_0x65_ActionBitURShift(t);break;case 98:avm1_0x62_ActionBitXor(t);break;case 81:avm1_0x51_ActionDecrement(t);break;case 80:avm1_0x50_ActionIncrement(t);break;case 76:avm1_0x4C_ActionPushDuplicate(t);break;case 62:avm1_0x3E_ActionReturn(t);break;case 77:avm1_0x4D_ActionStackSwap(t);break;case 135:avm1_0x87_ActionStoreRegister(t,n);break;case 84:avm1_0x54_ActionInstanceOf(t);break;case 85:avm1_0x55_ActionEnumerate2(t);break;case 102:avm1_0x66_ActionStrictEquals(t);break;case 103:avm1_0x67_ActionGreater(t);break;case 104:avm1_0x68_ActionStringGreater(t);break;case 142:avm1_0x8E_ActionDefineFunction2(t,n);break;case 105:avm1_0x69_ActionExtends(t);break;case 43:avm1_0x2B_ActionCastOp(t);break;case 44:avm1_0x2C_ActionImplementsOp(t);break;case 143:avm1_0x8F_ActionTry(t,n);break;case 42:avm1_0x2A_ActionThrow(t);break;case 45:avm1_0x2D_ActionFSCommand2(t);break;case 137:avm1_0x89_ActionStrictMode(t,n);break;case 0:t.isEndOfActions=!0;break;default:throw new Error("Unknown action code: "+i)}return r}function interpretActionWithRecovery(t,e){var i,n;try{n=interpretAction(t,e),t.recoveringFromError=!1}catch(e){if(i=t.context,e=as2CastError(e),avm1ErrorsEnabled.value&&!i.isTryCatchListening||e instanceof AVM1CriticalError)throw e;if(e instanceof AVM1Error)throw e;if(Telemetry.instance.reportTelemetry({topic:"error",error:1}),!t.recoveringFromError){if(i.errorsIgnored++>=MAX_AVM1_ERRORS_LIMIT)throw new AVM1CriticalError("long running script -- AVM1 errors limit is reached");console.error("AVM1 error: "+e),t.recoveringFromError=!0}}return n}function analyzeAndCompileActionsData(t,e){var i,n=t.context,r=new ActionsDataParser(e,n.swfVersion),o=new ActionsDataAnalyzer;o.registersLimit=t.registers.length,o.parentResults=e.parent&&e.parent.ir;var s=o.analyze(r);if(e.ir=s,avm1CompilerEnabled.value)try{i=(new ActionsDataCompiler).generate(s),e.compiled=i}catch(t){console.error("Unable to compile AVM1 function: "+t)}}function interpretActionsData(t,e){e.ir||e.compiled||analyzeAndCompileActionsData(t,e);var i=t.context,n=t.scopeList.scope.adaptee;n&&n._deferScriptExecution&&(i.deferScriptExecution=!0),n&&(AVM1MovieClip.currentMCAssetNameSpace=n.assetNamespace);var r=e.compiled;if(r)return r(t);var o=0,s=i.abortExecutionAt;avm1DebuggerEnabled.value&&Debugger.breakpoints[a.dataId];for(var a=e.ir,l=0,c=a.actions[l];c&&!t.isEndOfActions;){if(o++%CHECK_AVM1_HANG_EVERY==0&&Date.now()>=s)throw new AVM1CriticalError("long running script -- AVM1 instruction hang timeout");l=interpretActionWithRecovery(t,c.action)?c.conditionalJumpTo:c.next,c=a.actions[l]}return t.stack.pop()}var ActionTracer=(Wfe.prototype._getIndentString=function(){return this._indentStringCache[this._indentation]||(this._indentStringCache[this._indentation]=new Array(this._indentation+1).join(".."))},Wfe.prototype.print=function(t,e){for(var i=t.position,n=t.actionCode,r=t.actionName,o=[],s=0;s<e.length;s++){var a,l=e[s];l&&"object"==typeof l?(a=l.alGetConstructorProperty(),o.push("["+(a?a.name:"Object")+"]")):o.push(l)}console.log("AVM1 trace: "+this._getIndentString()+i+": "+r+"("+n.toString(16)+"), stack="+o)},Wfe.prototype.indent=function(){this._indentation++},Wfe.prototype.unindent=function(){this._indentation--},Wfe.prototype.message=function(t){console.log("AVM1 trace: ------- "+t)},Wfe),XMLNodeType=(fge.CDATA_NODE=100,fge.COMMENT_NODE=101,fge.DOCUMENT_TYPE_NODE=102,fge.ELEMENT_NODE=1,fge.PROCESSING_INSTRUCTION_NODE=103,fge.TEXT_NODE=3,fge.XML_DECLARATION=104,fge),XMLDocumentAway=(gge=XMLNode,__extends(hge,gge),hge.prototype.axCallPublicProperty=function(t,e){return null},hge.prototype.axGetPublicProperty=function(t){return null},hge.prototype.axSetPublicProperty=function(t,e){return null},hge.prototype.createElement=function(t){return console.log("createElement not implemented yet in flash/XMLDocument"),null},hge.prototype.createTextNode=function(t){return console.log("createTextNode not implemented yet in flash/XMLDocument"),null},hge.prototype.parseXML=function(t){console.log("parseXML not implemented yet in flash/XMLDocument")},hge.prototype.toString=function(){return console.log("toString not implemented yet in flash/XMLDocument"),""},hge),AVM1Movie=(rge=DisplayObject,__extends(sge,rge),sge.prototype._getLevelForRoot=function(t){return 0},sge.prototype._getRootForLevel=function(t){return null},sge.prototype._addRoot=function(t,e){},sge.prototype._removeRoot=function(t){},sge),ContextMenu=function(){},ContextMenuItem=function(){},fscommand=function(){},Security=function(){},Capabilities=function(){},ExternalInterface=function(){},Mouse=function(){},SoundChannel=function(){},SoundTransform=function(){},SoundMixer=function(){},SecurityDomain=function(){this.flash={display:{AVM1Movie:AVM1Movie,Stage:AVM1Stage},events:{Event:Event,KeyboardEvent:KeyboardEvent,MouseEvent:MouseEvent,ProgressEvent:ProgressEvent},external:{ExternalInterface:ExternalInterface},filters:{},system:{Capabilities:Capabilities,Security:Security,fscommand:fscommand},ui:{ContextMenu:ContextMenu,ContextMenuItem:ContextMenuItem,Mouse:Mouse},media:{SoundChannel:SoundChannel,SoundTransform:SoundTransform,SoundMixer:SoundMixer},xml:{XMLDocument:XMLDocumentAway}},this.player={}},AVM1Handler=(Object.defineProperty(yge.prototype,"factory",{get:function(){if(!this._factory)throw"AVM1Handler - no factory set";return this._factory},enumerable:!0,configurable:!0}),yge.prototype.init=function(t,e,i){var n,r=this;FrameScriptManager.useAVM1=!0,this._avmStage?i(!1):(this._avmStage=t,this._avmStage.scene.mouseManager._stage=this._avmStage,this._avmStage.scene.mouseManager.eventBubbling=!1,this._factory=new AVM1SceneGraphFactory(new AVM1ContextImpl(e.swfVersion)),this._factory.avm1Context.sec=new SecurityDomain,this._factory.avm1Context.setStage(this._avmStage,this,document),this._factory.avm1Context.swfVersion=e.swfVersion,this._avmStage.scaleMode=StageScaleMode.SHOW_ALL,this._avmStage.align=StageAlign.TOP,AVM1Globals.tracelevel=TraceLevel.ALL,AVM1Globals._scenegraphFactory=this._factory,AssetLibrary.enableParser(SWFParser),this.clearAllAVM1Listener(),this._avmStage.addEventListener(MouseEvent$1.MOUSE_DOWN,function(t){return r.onMouseEvent(t)}),this._avmStage.addEventListener(MouseEvent$1.MOUSE_UP,function(t){return r.onMouseEvent(t)}),this._avmStage.addEventListener(MouseEvent$1.MOUSE_MOVE,function(t){return r.onMouseEvent(t)}),this._avmStage.addEventListener(KeyboardEvent$1.KEYDOWN,function(t){return r.onKeyEvent(t)}),this._avmStage.addEventListener(KeyboardEvent$1.KEYUP,function(t){return r.onKeyEvent(t)}),this._avmStage.avmTestHandler&&(n=this._factory.avm1Context.actions.trace,this._factory.avm1Context.actions.trace=function(t){n(t),r._avmStage.avmTestHandler.addMessage(t)}),i(!0))},yge.prototype.executeEnterFrame=function(t,e){for(var i,n=t.numChildren;0<n;)n--,i=t.getChildAt(n),this.executeEnterFrame(i,e);t.isAsset(MovieClip)&&t.hasEventListener(this.enterEvent.type)&&e.push(t)},yge.prototype.enterFrame=function(t){this._avmStage.scene.renderer.stage.clear(),FrameScriptManager.execute_queue();for(var e,i=0,n=this._avmStage.numChildren,i=0;i<n;i++)(e=this._avmStage.getChildAt(i)).isAsset(MovieClip)&&e.advanceFrame();FrameScriptManager.execute_queue();var r=[],n=this._avmStage.numChildren;for(i=0;i<n;i++)e=this._avmStage.getChildAt(i),this.executeEnterFrame(e,r);for(n=r.length,i=0;i<n;i++)r[i].dispatchEvent(this.enterEvent);for(FrameScriptManager.execute_queue(),FrameScriptManager.execute_intervals(t),FrameScriptManager.execute_queue(),n=this._avmStage.numChildren,i=0;i<n;i++)(e=this._avmStage.getChildAt(i)).isAsset(MovieClip)&&e.dispatchExitFrame(this.exitEvent);FrameScriptManager.execute_queue()},yge.prototype.onKeyEvent=function(t){if(this.avm1Listener[t.type]){for(var e,i=this._collectedDispatcher.length=0,n=this._avmStage.numChildren,i=0;i<n;i++)(e=this._avmStage.getChildAt(i)).isAsset(MovieClip)&&this.collectMousEvents(e);for(n=this._collectedDispatcher.length,i=0;i<n;i++)if(this.avm1Listener[t.type]&&this.avm1Listener[t.type][this._collectedDispatcher[i].id])for(var r=0;r<this.avm1Listener[t.type][this._collectedDispatcher[i].id].length;r++)"number"==typeof this.avm1Listener[t.type][this._collectedDispatcher[i].id][r].keyCode&&this.avm1Listener[t.type][this._collectedDispatcher[i].id][r].keyCode!=t.keyCode||this.avm1Listener[t.type][this._collectedDispatcher[i].id][r].callback();FrameScriptManager.execute_queue()}},yge.prototype.addAVM1EventListener=function(t,e,i,n){this.avm1Listener[e]||(this.avm1Listener[e]={}),this.avm1Listener[e][t.id]||(this.avm1Listener[e][t.id]=[]),this.avm1Listener[e][t.id].push({type:e,callback:i}),n&&"number"==typeof n.keyCode&&(this.avm1Listener[e][t.id][this.avm1Listener[e][t.id].length-1].keyCode=n.keyCode)},yge.prototype.removeAVM1EventListener=function(t,e,i){this.avm1Listener[e]&&delete this.avm1Listener[e][t.id]},yge.prototype.clearAllAVM1Listener=function(){this.avm1Listener={}},yge.prototype.collectMousEvents=function(t){for(var e,i=t.numChildren;0<i;)i--,e=t.getChildAt(i),this.collectMousEvents(e);t.isAsset(MovieClip)&&(this._collectedDispatcher[this._collectedDispatcher.length]=t)},yge.prototype.onMouseEvent=function(t){if(this.avm1Listener[t.type]){for(var e,i,n=this._collectedDispatcher.length=0,r=this._avmStage.numChildren,n=0;n<r;n++)(e=this._avmStage.getChildAt(n)).isAsset(MovieClip)&&this.collectMousEvents(e);for(r=this._collectedDispatcher.length,n=0;n<r;n++)if(this.avm1Listener[t.type]&&this.avm1Listener[t.type][this._collectedDispatcher[n].id]){i=this.avm1Listener[t.type][this._collectedDispatcher[n].id].length;for(var o=0;o<i;o++)this.avm1Listener[t.type][this._collectedDispatcher[n].id]&&this.avm1Listener[t.type][this._collectedDispatcher[n].id][o]&&this.avm1Listener[t.type][this._collectedDispatcher[n].id][o].callback()}FrameScriptManager.execute_queue()}},yge.prototype.resizeStage=function(){},yge.prototype.addAsset=function(t,e){var i;t.isAsset(MovieClip)&&e&&t.isAVMScene&&(i=getAVM1Object(t.clone(),this._factory.avm1Context),this._avmStage.addChild(i.adaptee))},yge),rge,gge;function yge(){this.avmVersion="AVM1",this.enterEvent=new EventBase("enterFrame"),this.exitEvent=new EventBase("exitFrame"),this.avm1Listener={},this._collectedDispatcher=[]}function sge(){return null!==rge&&rge.apply(this,arguments)||this}function hge(t){return gge.call(this,XMLNodeType.DOCUMENT_TYPE_NODE,"null")||this}function fge(){}function Wfe(){this._indentation=0,this._indentStringCache=[]}console.debug("AwayFL - AVM1 - 0.2.34");var AVM1PokiSDK=(phe=AVM1Object,__extends(qhe,phe),qhe.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,qhe,["init","isAdBlocked","gameLoadingStart","gameLoadingFinished","commercialBreak","gameplayStart","gameplayStop"],[],null,qhe.prototype.avm1Constructor)},qhe.prototype.avm1Constructor=function(){},qhe.init=function(t,i,n){var e=null!=i&&null!=n?function(t){var e=i.alGet(n.toLowerCase());e&&alIsFunction(e)?e.alCall(i,[t]):e&&e.value&&e.value.alCall(i,[t])}:function(t){};if(qhe.usePokiSDK){if(!PokiSDK||!PokiSDK.hasOwnProperty("adBlocked"))throw"POKISDK is not available";e(PokiSDK.adBlocked)}else e(!0)},qhe.isAdBlocked=function(){if(!qhe.usePokiSDK)return!0;if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";return PokiSDK.adBlocked},qhe.gameLoadingStart=function(){if(qhe.usePokiSDK){if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";PokiSDK.gameLoadingStart()}},qhe.gameLoadingFinished=function(){if(qhe.usePokiSDK){if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";PokiSDK.gameLoadingFinished()}},qhe.gameplayStart=function(){if(qhe.usePokiSDK){if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";PokiSDK.gameplayStart()}},qhe.gameplayStop=function(){if(qhe.usePokiSDK){if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";PokiSDK.gameplayStop()}},qhe.commercialBreak=function(t,e,i){var n=null!=e&&null!=i?function(){i.alCall(e)}:function(){};if(qhe.usePokiSDK){if(!PokiSDK.hasOwnProperty("adBlocked"))throw"AS2 is trying to use the PokiSDK before it has been init";AudioManager.setVolume(0),PokiSDK.commercialBreak().then(function(){AudioManager.setVolume(1),n()})}else n()},qhe.happyTime=function(t,e){PokiSDK.happyTime(e)},qhe.usePokiSDK=!0,qhe),AVM2PokiSDK=function(e){window.initPokiBridge=function(t){flash.Ready(),e&&!window.pokiAdBlock||flash.AdBlocked(),window.commercialBreak=function(){e?(AVMStage.instance().pause(),PokiSDK.commercialBreak().then(function(){AVMStage.instance().unPause(),flash.commercialBreakCompleted()})):flash.commercialBreakCompleted()},window.rewardedBreak=function(){e?(AVMStage.instance().pause(),PokiSDK.rewardedBreak().then(function(t){AVMStage.instance().unPause(),flash.rewardedBreakCompleted(t)})):flash.rewardedBreakCompleted(!0)}}},phe;function qhe(){return null!==phe&&phe.apply(this,arguments)||this}function fullSerializer(t){var e=Object.assign({},t);return Object.keys(e).forEach(function(t){"object"==typeof e[t]?e[t]=fullSerializer(e[t]):"function"==typeof e[t]&&(e[t]=e[t].toString())}),e}var OBJECT_FIELDS=["id","visible","index","assetType:type","name"],AVMDebug=(Lhe.prototype._selectNode=function(t){for(var i=this.player,e=0,n=t;e<n.length&&"break"!==function(e){if(!(i=i._children.find(function(t){return t.id===e})))return"break"}(n[e]);e++);if(!i)throw new Error("Node not found");return i},Lhe.prototype._dirObjectByIds=function(t){console.dir(this._selectNode(t))},Lhe.prototype._traverse=function(t,e){var i=this;void 0===e&&(e=!1);for(var n={parentId:t.parent?t.parent.id:-1,children:void 0},r=0,o=OBJECT_FIELDS;r<o.length;r++){var s=o[r],a=s.split(":");1<a.length?n[a[1]]=t[a[0]]:n[s]=t[s]}return e&&(n.children=t._children.map(function(t){return i._traverse(t,e)})),n},Lhe.prototype._removeObjectByIds=function(t){var e=this._selectNode(t);e.parent.removeChild(e)},Lhe.prototype._applyPropsByIds=function(t,e){var i=this._selectNode(t);Object.assign(i,e)},Lhe.prototype._getSceneTree=function(t,e){void 0===t&&(t=!1);for(var i=[],n=this.player._children.slice();;){var r=n.pop();if(!r)break;i.push(this._traverse(r,!t)),t&&n.push.apply(n,r._children.reverse())}return i},Lhe.prototype._getInfo=function(){var t,e=this.player,i=e._avmHandler.avmVersion,n=e._swfFile,r=n.swfVersion,o=n.fpVersion,s=n.frameCount,a=n.frameRate,l=n.compression,c=n.bytesTotal,h=null===(t=e._gameConfig.binary.filter(function(t){return"GAME"===t.resourceType})[0])||void 0===t?void 0:t.path;return h&&-1<h.indexOf("?")&&(h=h.substring(0,h.indexOf("?"))),{file:{name:e._gameConfig.title,path:h,size:c},runtime:{swfVersion:r,fpVersion:o,frameCount:s,frameRate:a,compression:l,avm:i},config:fullSerializer(e._gameConfig)}},Lhe);function Lhe(t){this.player=t,registerDebugMethod(this._dirObjectByIds.bind(this),{name:"dirObjectByIds",description:"Export selected object to console",declaration:[{name:"ids",type:"object"}]}),registerDebugMethod(this._applyPropsByIds.bind(this),{name:"applyPropsByIds",description:"Apply propertyes by node ids",declaration:[{name:"ids",type:"object"},{name:"object",type:"object"}]}),registerDebugMethod(this._removeObjectByIds.bind(this),{name:"removeObjectByIds",description:"Remove object from sceen tree",declaration:[{name:"ids",type:"object"}]}),registerDebugMethod(this._getInfo.bind(this),{name:"getInfo",description:"Get file info for app",declaration:[{name:"return",type:"object"}]}),registerDebugMethod(this._getSceneTree.bind(this),{name:"getNodeTree",description:"Get sceen tree of app",declaration:[{name:"return",type:"object"},{name:"flat",type:"boolean"},{name:"from",type:"number"}]}),window._AWAY_DEBUG_PLAYER_=this}function getCONSTANTName(t){return String(t)}var _namespaces={},namespaceTypeNames=["Public","Protected","PackageInternal","Private","Explicit","StaticProtected"];function getNamespaceTypeName(t){return String(t)}var namespaceHashingBuffer=new Uint8Array(100),Namespace=(Aie.prototype.toString=function(){return getNamespaceTypeName(this.type)+(""!==this.uri?":"+this.uri:"")},Aie._hashNamespace=function(t,e,i){e+="",i+="";var n=Aie._knownNames.indexOf(e);if(0<=n)return t<<2|n;var r=1+e.length+i.length,o=r<101?namespaceHashingBuffer:new Uint8Array(r),s=0;o[s++]=t;for(var a=0;a<e.length;a++)o[s++]=e.charCodeAt(a);for(a=0;a<i.length;a++)o[s++]=i.charCodeAt(a);return HashUtilities.hashBytesTo32BitsMD5(o,0,s)},Aie.prototype.mangleName=function(){var t;0!==this.type||""!==this.uri?(t=Aie._hashNamespace(this.type,this.uri,this.prefix),this.mangledName=StringUtilities.variableLengthEncodeInt32(t)):this.mangledName="Bg"},Aie.prototype.isPublic=function(){return 0===this.type},Object.defineProperty(Aie.prototype,"reflectedURI",{get:function(){return this.uri||(0===this.type?null:this.uri)},enumerable:!0,configurable:!0}),Aie._knownNames=[""],Aie);function Aie(t,e,i){this.type=t,this.uri=e,this.prefix=i,this.mangledName=null,assert(void 0!==t),this.mangleName()}function internNamespace(t,e){var i=t+e;return _namespaces[i]||(_namespaces[i]=new Namespace(t,e,""))}function internPrefixedNamespace(t,e,i){var n=t+e+i;return _namespaces[n]||(_namespaces[n]=new Namespace(t,e,i))}function axCoerceString$2(t){return"string"==typeof t?t:null==t?null:t+""}var Multiname=(Wie.prototype.key=function(){if(this._key)return this._key;var t=this.toString();return this.mutable||(this._key=t),t},Wie.FromFQNString=function(t,e){var i=t.lastIndexOf("."),n=-1===i?"":t.substr(0,i),r=-1===i?t:t.substr(i+1);return new Wie(null,0,15,[internNamespace(e,n)],r)},Wie.prototype._nameToString=function(){return this.isAnyName()?"*":this.isRuntimeName()?"["+this.name+"]":this.name},Wie.prototype.isRuntime=function(){switch(this.kind){case 7:case 13:case 9:case 14:return!1}return!0},Wie.prototype.isRuntimeName=function(){switch(this.kind){case 17:case 18:case 27:case 28:return!0}return!1},Wie.prototype.isRuntimeNamespace=function(){switch(this.kind){case 15:case 16:case 17:case 18:return!0}return!1},Wie.prototype.isAnyName=function(){return null===this.name},Wie.prototype.isAnyNamespace=function(){return!(this.isRuntimeNamespace()||1<this.namespaces.length||0!==this.namespaces.length&&""!==this.namespaces[0].uri)},Wie.prototype.isQName=function(){var t=this.kind;return 29===t||7===t||13===t||15<=t&&t<=18},Object.defineProperty(Wie.prototype,"namespace",{get:function(){return this.namespaces[0]},enumerable:!0,configurable:!0}),Object.defineProperty(Wie.prototype,"uri",{get:function(){return this.namespaces[0].uri},enumerable:!0,configurable:!0}),Object.defineProperty(Wie.prototype,"prefix",{get:function(){return this.namespaces[0].prefix},set:function(t){var e=this.namespaces[0];e.prefix!==t&&(this.namespaces[0]=internPrefixedNamespace(e.type,e.uri,t))},enumerable:!0,configurable:!0}),Wie.prototype.equalsQName=function(t){return this.name===t.name&&this.namespaces[0].uri===t.namespaces[0].uri},Wie.prototype.matches=function(t){var e=t.isAnyName();if(e&&!t.isQName())return!0;if(!e&&this.name!==t.name)return!1;for(var i=this.namespaces[0].uri,n=t.namespaces.length;n--;)if(t.namespaces[n].uri===i)return!0;return!1},Wie.prototype.isAttribute=function(){switch(this.kind){case 13:case 16:case 18:case 14:case 28:return!0}return!1},Wie.prototype.getMangledName=function(){return this._mangledName||this._mangleName()},Wie.prototype._mangleName=function(){var t="$Bg"+axCoerceString$2(this.name);return this.isRuntime()||(this._mangledName=t),t},Wie.prototype.getPublicMangledName=function(){return isNumeric(this.name)?this.name:"$Bg"+axCoerceString$2(this.name)},Wie.isPublicQualifiedName=function(t){return 0===t.indexOf("$Bg")},Wie.getPublicMangledName=function(t){return isNumeric(t)?t:"$Bg"+t},Wie.prototype.toFQNString=function(t){var e=this.namespaces[0].uri;return e.length&&(e+=t?"::":"."),e+this.name},Wie.prototype.toString=function(){var t=getCONSTANTName(this.kind)+" ";return t+=this.isAttribute()?"@":"",this.isRuntimeNamespace()?t+="["+(this.namespaces?this.namespaces.map(function(t){return String(t)}).join(", "):null)+"]::"+this._nameToString():this.isQName()?(t+=this.namespaces[0]+"::",t+=this._nameToString()):(this.namespaces?t+="{"+this.namespaces.map(function(t){return String(t)}).join(", ")+"}":t+="{"+this.namespaces+"}",t+="::"+this._nameToString()),this.parameterType&&(t+="<"+this.parameterType+">"),t},Wie.prototype.toFlashlogString=function(){var t=this.uri;return t?t+"::"+this.name:this.name},Wie.stripPublicMangledName=function(t){if(0===t.indexOf("$Bg"))return t.substring(3)},Wie.FromSimpleName=function(t){t._children&&1==t._children.length&&t._children[0]._value&&(t=t._children[0]._value);var e=t.lastIndexOf(".");e<=0&&(e=t.lastIndexOf(" "));var i,n="";return 0<e&&e<t.length-1?(i=t.substring(e+1).trim(),n=t.substring(0,e).trim()):i=t,new Wie(null,0,15,[internNamespace(0,n)],i)},Wie._nextID=1,Wie);function Wie(t,e,i,n,r,o,s){void 0===o&&(o=null),void 0===s&&(s=!1),this.abc=t,this.index=e,this.kind=i,this.namespaces=n,this.name=r,this.parameterType=o,this.mutable=s,this.id=Wie._nextID++,this._mangledName=null,this.script=null,this.numeric=!1,this.numericValue=0,this.resolved={},this.scope=null,this.value=null,this._key=null}function addPrototypeFunctionAlias(t,e,i){defineNonEnumerableProperty(t,e,t.sec.AXFunction.axBox(i))}function axImplementsInterface(t){return this.classInfo.instanceInfo.getInterfaces(this.axClass).has(t)}var RuntimeTraits=(Ije.prototype.addTrait=function(t){var e=t.name,i=(i=this._traits[e.name])||(this._traits[e.name]=Object.create(null)),n=e.namespaces[0].mangledName,r=i[n];return i[n]=t,r},Ije.prototype.addSlotTrait=function(t){var e=t.slot;e?this._nextSlotID=e+1:e=t.slot=this._nextSlotID++,this.slots[e]=t},Ije.prototype.getTraitMultiname=function(t){return t.mutable?this.getTrait(t.namespaces,t.name):this.multinames[t.id]||(this.multinames[t.id]=this.getTrait(t.namespaces,t.name))},Ije.prototype.getTrait=function(t,e){var i,n=this._traits[e];if(!n)return null;for(var r=0;r<t.length;r++){var o=t[r];if(i=n[o.mangledName])return i;if(1===o.type)for(var s=this;s;){if(s.protectedNs===o&&(i=s.protectedNsMappings[e]))return i;s=s.superTraits}}return null},Ije.prototype.getTraitsList=function(){var t=[],e=this._traits;for(var i in e){var n=e[i];for(var r in n)t.push(n[r])}return t},Ije.prototype.getSlotPublicTraitNames=function(){for(var t=this.slots,e=[],i=1;i<t.length;i++){var n=t[i];n.name.namespace.isPublic()&&e.push(n.name.name)}return e},Ije.prototype.getSlot=function(t){return this.slots[t]},Ije);function Ije(t,e,i){this.superTraits=t,this.protectedNs=e,this.protectedNsMappings=i,this.slots=[],this._nextSlotID=1,this.multinames={};var n=this._traits=Object.create(null);if(t){var r=t._traits;for(var o in r)n[o]=Object.create(r[o])}}function AXBasePrototype_$BgtoString(){var t=this.hasOwnProperty("classInfo")?"Object":this.classInfo.instanceInfo.name.name;return StringUtilities.concat3("[object ",t,"]")}function isPrimitiveJSValue(t){return null==t||"number"==typeof t||"string"==typeof t||"boolean"==typeof t}var IS_AX_CLASS=Symbol("AX class marker");function AXBasePrototype_toString(){return this.$BgtoString.axCall(this)}function AXBasePrototype_$BgvalueOf(){return this}function AXBasePrototype_valueOf(){return this.$BgvalueOf.axCall(this)}var D=defineNonEnumerableProperty,AXBasePrototype=null;function isValidASValue(t){return AXBasePrototype.isPrototypeOf(t)||isPrimitiveJSValue(t)}function initializeAXBasePrototype(){var t;AXBasePrototype||(t=ASObject.prototype,AXBasePrototype=Object.create(null),D(AXBasePrototype,"axHasPropertyInternal",t.axHasPropertyInternal),D(AXBasePrototype,"axHasProperty",t.axHasProperty),D(AXBasePrototype,"axSetProperty",t.axSetProperty),D(AXBasePrototype,"axHasProperty",t.axHasProperty),D(AXBasePrototype,"axHasPublicProperty",t.axHasPublicProperty),D(AXBasePrototype,"axSetPublicProperty",t.axSetPublicProperty),D(AXBasePrototype,"axGetPublicProperty",t.axGetPublicProperty),D(AXBasePrototype,"axCallPublicProperty",t.axCallPublicProperty),D(AXBasePrototype,"axDeletePublicProperty",t.axDeletePublicProperty),D(AXBasePrototype,"axGetProperty",t.axGetProperty),D(AXBasePrototype,"axDeleteProperty",t.axDeleteProperty),D(AXBasePrototype,"axGetSuper",t.axGetSuper),D(AXBasePrototype,"axSetSuper",t.axSetSuper),D(AXBasePrototype,"axSetSlot",t.axSetSlot),D(AXBasePrototype,"axGetSlot",t.axGetSlot),D(AXBasePrototype,"axCallProperty",t.axCallProperty),D(AXBasePrototype,"axCallSuper",t.axCallSuper),D(AXBasePrototype,"axConstructProperty",t.axConstructProperty),D(AXBasePrototype,"axResolveMultiname",t.axResolveMultiname),D(AXBasePrototype,"axNextNameIndex",t.axNextNameIndex),D(AXBasePrototype,"axNextName",t.axNextName),D(AXBasePrototype,"axNextValue",t.axNextValue),D(AXBasePrototype,"axGetEnumerableKeys",t.axGetEnumerableKeys),D(AXBasePrototype,"axImplementsInterface",axImplementsInterface),D(AXBasePrototype,"traits",new RuntimeTraits(null,null,Object.create(null))),D(AXBasePrototype,"isPrototypeOf",Object.prototype.isPrototypeOf),D(AXBasePrototype,"hasOwnProperty",Object.prototype.hasOwnProperty),D(AXBasePrototype,IS_AX_CLASS,!0),AXBasePrototype.$BgtoString=AXBasePrototype_$BgtoString,AXBasePrototype.toString=AXBasePrototype_toString,AXBasePrototype.$BgvalueOf=AXBasePrototype_$BgvalueOf,AXBasePrototype.valueOf=AXBasePrototype_valueOf)}function makeMultiname(t,e){var i=new Multiname(null,0,17,[],null);return i.namespaces=e?[e]:[Namespace.PUBLIC],i.name=t,i}function qualifyPublicName(t){return isIndex(t)?t:"$Bg"+t}function axCoerceName(t){return"string"==typeof t?t:null==t?"null":t.toString()}var rn=new Multiname(null,0,17,[],null,null,!0),avm2Options=shumwayOptions.register(new OptionSet("AVM2")),options=avm2Options.register(new OptionSet("Runtime")),traceRuntime=options.register(new Option("tr","traceRuntime","boolean",!1,"trace runtime")),traceExecution=options.register(new Option("tx","traceExecution","boolean",!1,"trace execution")),traceInterpreter=options.register(new Option("ti","traceInterpreter","boolean",!1,"trace interpreter")),debuggerMode=options.register(new Option("db","debuggerMode","boolean",!0,"enable debugger mode")),Errors$1={NotImplementedError:{code:1001,message:"The method %1 is not implemented."},InvalidPrecisionError:{code:1002,message:"Number.toPrecision has a range of 1 to 21. Number.toFixed and Number.toExponential have a range of 0 to 20. Specified value is not within expected range."},InvalidRadixError:{code:1003,message:"The radix argument must be between 2 and 36; got %1."},InvokeOnIncompatibleObjectError:{code:1004,message:"Method %1 was invoked on an incompatible object."},ArrayIndexNotIntegerError:{code:1005,message:"Array index is not a positive integer (%1)."},CallOfNonFunctionError:{code:1006,message:"%1 is not a function."},ConstructOfNonFunctionError:{code:1007,message:"Instantiation attempted on a non-constructor."},ConvertNullToObjectError:{code:1009,message:"Cannot access a property or method of a null object reference."},ConvertUndefinedToObjectError:{code:1010,message:"A term is undefined and has no properties."},ClassNotFoundError:{code:1014,message:"Class %1 could not be found."},DescendentsError:{code:1016,message:"Descendants operator (..) not supported on type %1."},StackOverflowError:{code:1023,message:"Stack overflow occurred."},CpoolIndexRangeError:{code:1032,message:"Cpool index %1 is out of range %2."},CpoolEntryWrongTypeError:{code:1033,message:"Cpool entry %1 is wrong type."},CheckTypeFailedError:{code:1034,message:"Type Coercion failed: cannot convert %1 to %2."},CannotAssignToMethodError:{code:1037,message:"Cannot assign to a method %1 on %2."},CantUseInstanceofOnNonObjectError:{code:1040,message:"The right-hand side of instanceof must be a class or function."},IsTypeMustBeClassError:{code:1041,message:"The right-hand side of operator must be a class."},InvalidMagicError:{code:1042,message:"Not an ABC file. major_version=%1 minor_version=%2."},UnsupportedTraitsKindError:{code:1045,message:"Unsupported traits kind=%1."},PrototypeTypeError:{code:1049,message:"Prototype objects must be vanilla Objects."},ConvertToPrimitiveError:{code:1050,message:"Cannot convert %1 to primitive."},InvalidURIError:{code:1052,message:"Invalid URI passed to %1 function."},WriteSealedError:{code:1056,message:"Cannot create property %1 on %2."},WrongArgumentCountError:{code:1063,message:"Argument count mismatch on %1. Expected %2, got %3."},UndefinedVarError:{code:1065,message:"Variable %1 is not defined."},ReadSealedError:{code:1069,message:"Property %1 not found on %2 and there is no default value."},ConstWriteError:{code:1074,message:"Illegal write to read-only property %1 on %2."},XMLPrefixNotBound:{code:1083,message:'The prefix "%1" for element "%2" is not bound.'},XMLUnterminatedElementTag:{code:1085,message:'The element type "%1" must be terminated by the matching end-tag "</%2>".'},XMLOnlyWorksWithOneItemLists:{code:1086,message:"The %1 method only works on lists containing one item."},XMLAssignmentToIndexedXMLNotAllowed:{code:1087,message:"Assignment to indexed XML is not allowed."},XMLMarkupMustBeWellFormed:{code:1088,message:"The markup in the document following the root element must be well-formed."},XMLAssigmentOneItemLists:{code:1089,message:"Assignment to lists with more than one item is not supported."},XMLMalformedElement:{code:1090,message:"XML parser failure: element is malformed."},XMLUnterminatedCData:{code:1091,message:"XML parser failure: Unterminated CDATA section."},XMLUnterminatedXMLDecl:{code:1092,message:"XML parser failure: Unterminated XML declaration."},XMLUnterminatedDocTypeDecl:{code:1093,message:"XML parser failure: Unterminated DOCTYPE declaration."},XMLUnterminatedComment:{code:1094,message:"XML parser failure: Unterminated comment."},XMLUnterminatedElement:{code:1096,message:"XML parser failure: Unterminated element."},XMLNamespaceWithPrefixAndNoURI:{code:1098,message:"Illegal prefix %1 for no namespace."},RegExpFlagsArgumentError:{code:1100,message:"Cannot supply flags when constructing one RegExp from another."},InvalidBaseClassError:{code:1108,message:"The OP_newclass opcode was used with the incorrect base class."},XMLInvalidName:{code:1117,message:"Invalid XML name: %1."},XMLIllegalCyclicalLoop:{code:1118,message:"Illegal cyclical loop between nodes."},FilterError:{code:1123,message:"Filter operator not supported on type %1."},OutOfRangeError:{code:1125,message:"The index %1 is out of range %2."},VectorFixedError:{code:1126,message:"Cannot change the length of a fixed Vector."},TypeAppOfNonParamType:{code:1127,message:"Type application attempted on a non-parameterized type."},WrongTypeArgCountError:{code:1128,message:"Incorrect number of type parameters for %1. Expected %2, got %3."},JSONCyclicStructure:{code:1129,message:"Cyclic structure cannot be converted to JSON string."},JSONInvalidReplacer:{code:1131,message:"Replacer argument to JSON stringifier must be an array or a two parameter function."},JSONInvalidParseInput:{code:1132,message:"Invalid JSON parse input."},InvalidRangeError:{code:1506,message:"The specified range is invalid."},NullArgumentError:{code:1507,message:"Argument %1 cannot be null."},InvalidArgumentError:{code:1508,message:"The value specified for argument %1 is invalid."},ArrayFilterNonNullObjectError:{code:1510,message:"When the callback argument is a method of a class, the optional this argument must be null."},InvalidParamError:{code:2004,message:"One of the parameters is invalid."},ParamRangeError:{code:2006,message:"The supplied index is out of bounds."},NullPointerError:{code:2007,message:"Parameter %1 must be non-null."},InvalidEnumError:{code:2008,message:"Parameter %1 must be one of the accepted values."},CantInstantiateError:{code:2012,message:"%1 class cannot be instantiated."},InvalidBitmapData:{code:2015,message:"Invalid BitmapData."},EOFError:{code:2030,message:"End of file was encountered.",fqn:"flash.errors.EOFError"},CompressedDataError:{code:2058,message:"There was an error decompressing the data.",fqn:"flash.errors.IOError"},EmptyStringError:{code:2085,message:"Parameter %1 must be non-empty string."},ProxyGetPropertyError:{code:2088,message:"The Proxy class does not implement getProperty. It must be overridden by a subclass."},ProxySetPropertyError:{code:2089,message:"The Proxy class does not implement setProperty. It must be overridden by a subclass."},ProxyCallPropertyError:{code:2090,message:"The Proxy class does not implement callProperty. It must be overridden by a subclass."},ProxyHasPropertyError:{code:2091,message:"The Proxy class does not implement hasProperty. It must be overridden by a subclass."},ProxyDeletePropertyError:{code:2092,message:"The Proxy class does not implement deleteProperty. It must be overridden by a subclass."},ProxyGetDescendantsError:{code:2093,message:"The Proxy class does not implement getDescendants. It must be overridden by a subclass."},ProxyNextNameIndexError:{code:2105,message:"The Proxy class does not implement nextNameIndex. It must be overridden by a subclass."},ProxyNextNameError:{code:2106,message:"The Proxy class does not implement nextName. It must be overridden by a subclass."},ProxyNextValueError:{code:2107,message:"The Proxy class does not implement nextValue. It must be overridden by a subclass."},TooFewArgumentsError:{code:2001,message:"Too few arguments were specified; got %1, %2 expected."},ParamTypeError:{code:2005,message:"Parameter %1 is of the incorrect type. Should be type %2."},SocketConnectError:{code:2011,message:"Socket connection failed to %1:%2."},CantAddSelfError:{code:2024,message:"An object cannot be added as a child of itself."},NotAChildError:{code:2025,message:"The supplied DisplayObject must be a child of the caller."},UnhandledError:{code:2044,message:"Unhandled %1:."},AllowDomainArgumentError:{code:2052,message:"Only String arguments are permitted for allowDomain and allowInsecureDomain."},DelayRangeError:{code:2066,message:"The Timer delay specified is out of range."},ExternalInterfaceNotAvailableError:{code:2067,message:"The ExternalInterface is not available in this container. ExternalInterface requires Internet Explorer ActiveX, Firefox, Mozilla 1.7.5 and greater, or other browsers that support NPRuntime."},InvalidLoaderMethodError:{code:2069,message:"The Loader class does not implement this method."},InvalidStageMethodError:{code:2071,message:"The Stage class does not implement this property or method."},TimelineObjectNameSealedError:{code:2078,message:"The name property of a Timeline-placed object cannot be modified."},AlreadyConnectedError:{code:2082,message:"Connect failed because the object is already connected."},CloseNotConnectedError:{code:2083,message:"Close failed because the object is not connected."},ArgumentSizeError:{code:2084,message:"The AMF encoding of the arguments cannot exceed 40K."},AsyncError:{code:2095,message:"%1 was unable to invoke callback %2."},LoadingObjectNotSWFError:{code:2098,message:"The loading object is not a .swf file, you cannot request SWF properties from it."},LoadingObjectNotInitializedError:{code:2099,message:"The loading object is not sufficiently loaded to provide this information."},DecodeParamError:{code:2101,message:"The String passed to URLVariables.decode() must be a URL-encoded query string containing name/value pairs."},SceneNotFoundError:{code:2108,message:"Scene %1 was not found."},FrameLabelNotFoundError:{code:2109,message:"Frame label %1 not found in scene %2."},InvalidLoaderInfoMethodError:{code:2118,message:"The LoaderInfo class does not implement this method."},SecuritySwfNotAllowedError:{code:2121,message:"Security sandbox violation: %1: %2 cannot access %3. This may be worked around by calling Security.allowDomain."},UnknownFileTypeError:{code:2124,message:"Loaded file is an unknown type."},DefinitionNotFoundError:{code:2131,message:"Definition %1 cannot be found."},CantAddParentError:{code:2150,message:"An object cannot be added as a child to one of it's children (or children's children, etc.)."},Matrix3DRefCannontBeShared:{code:2189,message:"A Matrix3D can not be assigned to more than one DisplayObject."},ObjectWithStringsParamError:{code:2196,message:"Parameter %1 must be an Object with only String values."},AllowCodeImportError:{code:3226,message:"Cannot import a SWF file when LoaderContext.allowCodeImport is false."},PermissionDenied:{code:3315,message:"The current security context does not allow this operation."},InternalErrorIV:{code:3343,message:"Internal Error."}};for(var k in Errors$1){var error$1=Errors$1[k];error$1.typeName=k,Errors$1[error$1.code]=error$1}function getErrorMessage(t){var e="Error #"+t;if(!debuggerMode.value)return e;var i=Errors$1[t];return e+": "+(i&&i.message||"(unknown)")}function getErrorInfo(t){return Errors$1[t]}function formatErrorMessage(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];var n=t.message;return e.forEach(function(t,e){n=n.replace("%"+(e+1),t)}),"Error #"+t.code+": "+n}function validateCall(t,e,i){e&&e.axApply||t.throwError("TypeError",Errors$1.CallOfNonFunctionError,e&&e.methodInfo?e.methodInfo.getName():"value"),e.methodInfo&&i<e.methodInfo.minArgs&&t.throwError("ArgumentError",Errors$1.WrongArgumentCountError,e.methodInfo.getName(),e.methodInfo.minArgs,i)}function validateConstruct(t,e,i){var n;e&&e.axConstruct||(n=e&&e.classInfo?e.classInfo.instanceInfo.getName().name:"value",t.throwError("TypeError",Errors$1.ConstructOfNonFunctionError,n));var r=e.classInfo.getInitializer();i<r.minArgs&&t.throwError("ArgumentError",Errors$1.WrongArgumentCountError,e.classInfo.instanceInfo.getName().name,r.minArgs,i)}var ASObject=(Nke.classInitializer=function(){var t=this.dPrototype,e=Nke.prototype;addPrototypeFunctionAlias(t,"$BghasOwnProperty",e.native_hasOwnProperty),addPrototypeFunctionAlias(t,"$BgpropertyIsEnumerable",e.native_propertyIsEnumerable),addPrototypeFunctionAlias(t,"$BgsetPropertyIsEnumerable",e.native_setPropertyIsEnumerable),addPrototypeFunctionAlias(t,"$BgisPrototypeOf",e.native_isPrototypeOf),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toString)},Nke._init=function(){},Nke.init=function(){},Nke.prototype.native_isPrototypeOf=function(t){return this.isPrototypeOf(this.sec.box(t))},Nke.prototype.native_hasOwnProperty=function(t){return this.axHasOwnProperty(makeMultiname(t))},Nke.prototype.native_propertyIsEnumerable=function(t){var e=Object.getOwnPropertyDescriptor(this,qualifyPublicName(axCoerceString$2(t)));return!!e&&e.enumerable},Nke.prototype.native_setPropertyIsEnumerable=function(t,e){void 0===e&&(e=!0);var i=qualifyPublicName(axCoerceString$2(t));e=!!e;var n,r=this.axClass.classInfo.instanceInfo;r.isSealed()&&this!==this.axClass.dPrototype&&this.sec.throwError("ReferenceError",Errors$1.WriteSealedError,t,r.name.name),(n=Object.getOwnPropertyDescriptor(this.axClass.tPrototype,i))&&this!==this.axClass.dPrototype||(n=Object.getOwnPropertyDescriptor(this,i))&&n.enumerable!==e&&(n.enumerable=e,Object.defineProperty(this,i,n))},Nke.prototype.axResolveMultiname=function(t){if(t.numeric)return t.numericValue;var e=t.name;if(t.mutable)return(n=this.traits.getTrait(t.namespaces,e))?n.name.getMangledName():"$Bg"+e;var i=t.resolved[this.axClassName];if(i)return i;var n,r=(n=this.traits.getTraitMultiname(t))?n.name.getMangledName():"$Bg"+e;return t.resolved[this.axClassName]=r},Nke.prototype.axHasProperty=function(t){return this.axHasPropertyInternal(t)},Nke.prototype.axHasPublicProperty=function(t){return"number"==typeof(rn.name=t)&&(rn.numeric=!0,rn.numericValue=t),this.axHasProperty(rn)},Nke.prototype.axSetProperty=function(t,e,i){var n=t.name;if("number"==typeof n||isNumeric(n=axCoerceName(n)))this[+n]=e;else{var r=!1,o=this.traits.getTrait(t.namespaces,n);if(o){var s=o.name.getMangledName();switch(o.kind){case 1:this.sec.throwError("ReferenceError",Errors$1.CannotAssignToMethodError,n,this.axClass.name.name);case 2:this.sec.throwError("ReferenceError",Errors$1.ConstWriteError,n,this.axClass.name.name);case 4:case 6:104!==i&&this.sec.throwError("ReferenceError",Errors$1.ConstWriteError,n,this.axClass.name.name),r=!0}var a=o.getType();a&&(e=a.axCoerce(e))}else s="$Bg"+n;e&&e._children&&1==e._children.length&&e._children[0]._value&&(e=parseInt(e._children[0]._value)),this[s]=e,r&&Object.defineProperty(this,s,{writable:!1})}},Nke.prototype.axGetProperty=function(t){var e=this.axResolveMultiname(t),i=this[e];return"function"==typeof i?this.axGetMethod(e):(void 0===i&&"number"!=typeof e&&(i=this[e.replace("$Bg","")]),i)},Nke.prototype.axGetMethod=function(t){var e=this._methodClosureCache;return e||(Object.defineProperty(this,"_methodClosureCache",{value:Object.create(null)}),e=this._methodClosureCache),e[t]||(e[t]=this.sec.AXMethodClosure.Create(this,this[t]))},Nke.prototype.axGetSuper=function(t,e){var i,n=axCoerceName(t.name),r=t.namespaces,o=e.parent.object.tPrototype.traits.getTrait(r,n);if(2===o.kind||7===o.kind)i=o.get.call(this);else{var s=o.name.getMangledName();if("function"==typeof(i=this[s]))return this.axGetMethod(s)}return i},Nke.prototype.axSetSuper=function(t,e,i){var n=axCoerceName(t.name),r=t.namespaces,o=e.parent.object.tPrototype.traits.getTrait(r,n),s=o.getType();s&&(i=s.axCoerce(i)),3===o.kind||7===o.kind?o.set.call(this,i):this[o.name.getMangledName()]=i},Nke.prototype.axDeleteProperty=function(t){var e=axCoerceName(t.name),i=t.namespaces;return!this.traits.getTrait(i,e)&&delete this[t.getPublicMangledName()]},Nke.prototype.axCallProperty=function(t,e,i){var n=this[this.axResolveMultiname(t)];return validateCall(this.sec,n,e.length),n.axApply(i?null:this,e)},Nke.prototype.axCallSuper=function(t,e,i){var n=e.parent.object.tPrototype[this.axResolveMultiname(t)];return validateCall(this.sec,n,i.length),n.axApply(this,i)},Nke.prototype.axConstructProperty=function(t,e){var i=this[this.axResolveMultiname(t)];return validateConstruct(this.sec,i,e.length),i.axConstruct(e)},Nke.prototype.axHasPropertyInternal=function(t){return this.axResolveMultiname(t)in this},Nke.prototype.axHasOwnProperty=function(t){var e=this.axResolveMultiname(t);return this.hasOwnProperty(e)||this.axClass.tPrototype.hasOwnProperty(e)},Nke.prototype.axGetEnumerableKeys=function(){if(this.sec.isPrimitive(this))return[];for(var t=Object.getPrototypeOf(this),e=Object.keys(this),i=[],n=0;n<e.length;n++){var r=e[n];if(isNumeric(r))i.push(r);else{if(t.hasOwnProperty(r))continue;var o=Multiname.stripPublicMangledName(r);void 0!==o&&i.push(o)}}return i},Nke.prototype.axGetPublicProperty=function(t){return this[Multiname.getPublicMangledName(t)]},Nke.prototype.axSetPublicProperty=function(t,e){this[Multiname.getPublicMangledName(t)]=e},Nke.prototype.axCallPublicProperty=function(t,e){return this[Multiname.getPublicMangledName(t)].axApply(this,e)},Nke.prototype.axDeletePublicProperty=function(t){return delete this[Multiname.getPublicMangledName(t)]},Nke.prototype.axGetSlot=function(t){return this[this.traits.getSlot(t).name.getMangledName()]},Nke.prototype.axSetSlot=function(t,e){var i=this.traits.getSlot(t),n=i.name.getMangledName(),r=i.getType();this[n]=r?r.axCoerce(e):e},Nke.prototype.axNextNameIndex=function(t){0===t&&defineNonEnumerableProperty(this,"axEnumerableKeys",this.axGetEnumerableKeys());for(var e=this.axEnumerableKeys;t<e.length;){if(rn.name=e[t],this.axHasPropertyInternal(rn))return t+1;t++}return 0},Nke.prototype.axNextName=function(t){return this.axEnumerableKeys[t-1]},Nke.prototype.axNextValue=function(t){return this.axGetPublicProperty(this.axNextName(t))},Nke.prototype.axSetNumericProperty=function(t,e){this.axSetPublicProperty(t,e)},Nke.prototype.axGetNumericProperty=function(t){return this.axGetPublicProperty(t)},Nke.classSymbols=null,Nke.instanceSymbols=null,Nke),ASClass=(ume=ASObject,__extends(vme,ume),vme.prototype.axCoerce=function(t){return t},Object.defineProperty(vme.prototype,"prototype",{get:function(){return this.dPrototype},enumerable:!0,configurable:!0}),vme.classInitializer=null,vme),scopeStacks=[],ume;function vme(){return null!==ume&&ume.apply(this,arguments)||this}function Nke(){}function ensureBoxedReceiver(t,e,i){if(e&&"object"==typeof e)return e;var n=t.box(e);return n||(scopeStacks.length?n=scopeStacks[scopeStacks.length-1].topScope().global.object:i.receiver&&(n=i.receiver.scope.global.object)),n}function coerceArray(t){if(!t||!t.sec)throw new TypeError("Conversion to Array failed");return t.sec.AXArray.axCoerce(t)}function createArrayValueFromArgs(t,e){if(1===e.length&&"number"==typeof e[0]){var i=e[0];try{return new Array(i)}catch(e){t.throwError("RangeError",Errors$1.ArrayIndexNotIntegerError,i)}}return Array.apply(Array,e)}function axDefaultCompareFunction(t,e){return String(t).localeCompare(String(e))}function axCompare(t,e,i,n,r){return 1&i&&(t=String(t).toLowerCase(),e=String(e).toLowerCase()),(16&i?(t=+t)<(e=+e)?-1:e<t?1:0:r(t,e))*n}function axCompareFields(t,e,i,n){for(var r=0,o=0;o<i.length&&0===r;o++){var s=i[o],a=t[s],l=e[s],c=n[o];1&c&&(a=String(a).toLowerCase(),l=String(l).toLowerCase()),r=16&c?(a=+a)<(l=+l)?-1:l<a?1:0:String(a).localeCompare(String(l))}return 2&n[o-1]&&(r*=-1),r}var ASArray=(Wme=ASObject,__extends(Xme,Wme),Xme.classInitializer=function(){var t=this.dPrototype,e=Xme.prototype;defineNonEnumerableProperty(this,"$BgCASEINSENSITIVE",1),defineNonEnumerableProperty(this,"$BgDESCENDING",2),defineNonEnumerableProperty(this,"$BgUNIQUESORT",4),defineNonEnumerableProperty(this,"$BgRETURNINDEXEDARRAY",8),defineNonEnumerableProperty(this,"$BgNUMERIC",16),addPrototypeFunctionAlias(t,"$Bgpush",e.generic_push),addPrototypeFunctionAlias(t,"$Bgpop",e.generic_pop),addPrototypeFunctionAlias(t,"$Bgshift",e.generic_shift),addPrototypeFunctionAlias(t,"$Bgunshift",e.generic_unshift),addPrototypeFunctionAlias(t,"$Bgreverse",e.generic_reverse),addPrototypeFunctionAlias(t,"$Bgconcat",e.generic_concat),addPrototypeFunctionAlias(t,"$Bgslice",e.generic_slice),addPrototypeFunctionAlias(t,"$Bgsplice",e.generic_splice),addPrototypeFunctionAlias(t,"$Bgjoin",e.generic_join),addPrototypeFunctionAlias(t,"$BgtoString",e.generic_toString),addPrototypeFunctionAlias(t,"$BgindexOf",e.generic_indexOf),addPrototypeFunctionAlias(t,"$BglastIndexOf",e.generic_lastIndexOf),addPrototypeFunctionAlias(t,"$Bgevery",e.generic_every),addPrototypeFunctionAlias(t,"$Bgsome",e.generic_some),addPrototypeFunctionAlias(t,"$BgforEach",e.generic_forEach),addPrototypeFunctionAlias(t,"$Bgmap",e.generic_map),addPrototypeFunctionAlias(t,"$Bgfilter",e.generic_filter),addPrototypeFunctionAlias(t,"$Bgsort",e.generic_sort),addPrototypeFunctionAlias(t,"$BgsortOn",e.generic_sortOn),addPrototypeFunctionAlias(t,"$BghasOwnProperty",e.native_hasOwnProperty),addPrototypeFunctionAlias(t,"$BgpropertyIsEnumerable",e.native_propertyIsEnumerable),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.generic_toString)},Xme.prototype.native_hasOwnProperty=function(t){return this.axHasOwnProperty(makeMultiname(t))},Xme.prototype.native_propertyIsEnumerable=function(t){if("number"==typeof t||isNumeric(t=axCoerceName(t))){var e=Object.getOwnPropertyDescriptor(this.value,t);return!!e&&e.enumerable}Wme.prototype.native_propertyIsEnumerable.call(this,t)},Xme.axApply=function(t,e){return this.sec.createArrayUnsafe(createArrayValueFromArgs(this.sec,e))},Xme.axConstruct=function(t){return this.sec.createArrayUnsafe(createArrayValueFromArgs(this.sec,t))},Xme.prototype.push=function(){if(4294967295<this.value.length+arguments.length){for(var t=4294967295-this.value.length,e=0;e<t;e++)this.value.push(arguments[e]);return 4294967295}return this.value.push.apply(this.value,arguments)},Xme.prototype.generic_push=function(){if(this&&this.value instanceof Array)return this.push.apply(this,arguments);for(var t=this.axGetPublicProperty("length")>>>0,e=0;e<arguments.length;e++)this.axSetNumericProperty(t++,arguments[e]);return this.axSetPublicProperty("length",t),t},Xme.prototype.pop=function(){return this.value.pop()},Xme.prototype.generic_pop=function(){if(this&&this.value instanceof Array)return this.value.pop();var t=this.axGetPublicProperty("length")>>>0;if(t){var e=this.axGetNumericProperty(t-1);return rn.name=t-1,rn.namespaces=[Namespace.PUBLIC],this.axDeleteProperty(rn),this.axSetPublicProperty("length",t-1),e}this.axSetPublicProperty("length",0)},Xme.prototype.shift=function(){return this.value.shift()},Xme.prototype.generic_shift=function(){return coerceArray(this).shift()},Xme.prototype.unshift=function(){return this.value.unshift.apply(this.value,arguments)},Xme.prototype.generic_unshift=function(){var t=coerceArray(this);return t.value.unshift.apply(t.value,arguments)},Xme.prototype.reverse=function(){return this.value.reverse(),this},Xme.prototype.generic_reverse=function(){return coerceArray(this).reverse()},Xme.prototype.concat=function(){for(var t=this.value.slice(),e=0;e<arguments.length;e++){var i=arguments[e];"object"==typeof i&&i&&i.sec&&Array.isArray(i.value)?t.push.apply(t,i.value):t.push(i)}return this.sec.createArrayUnsafe(t)},Xme.prototype.generic_concat=function(){return coerceArray(this).concat.apply(this,arguments)},Xme.prototype.slice=function(t,e){return this.sec.createArray(this.value.slice(t,e))},Xme.prototype.generic_slice=function(t,e){return coerceArray(this).slice(t,e)},Xme.prototype.splice=function(){var t=this.value;if(0!==arguments.length)return this.sec.createArray(t.splice.apply(t,arguments))},Xme.prototype.generic_splice=function(){return coerceArray(this).splice.apply(this,arguments)},Xme.prototype.join=function(t){return this.value.join(t)},Xme.prototype.generic_join=function(t){return coerceArray(this).join(t)},Xme.prototype.toString=function(){return this.value.join(",")},Xme.prototype.generic_toString=function(){return coerceArray(this).join(",")},Xme.prototype.indexOf=function(t,e){return this.value.indexOf(t,0|e)},Xme.prototype.generic_indexOf=function(t,e){return coerceArray(this).indexOf(t,0|e)},Xme.prototype.lastIndexOf=function(t,e){return this.value.lastIndexOf(t,1<arguments.length?e:2147483647)},Xme.prototype.generic_lastIndexOf=function(t,e){return coerceArray(this).lastIndexOf(t,1<arguments.length?e:2147483647)},Xme.prototype.every=function(t,e){if(!t||!t.value||"function"!=typeof t.value)return!0;e=ensureBoxedReceiver(this.sec,e,t);for(var i=this.value,n=0;n<i.length;n++)if(!0!==t.value.call(e,i[n],n,this))return!1;return!0},Xme.prototype.generic_every=function(t,e){return coerceArray(this).every(t,e)},Xme.prototype.some=function(n,r){if(!n||!n.value||"function"!=typeof n.value)return!1;r=ensureBoxedReceiver(this.sec,r,n);var o=this;return this.value.some(function(t,e,i){return n.value.call(r,t,e,o)})},Xme.prototype.generic_some=function(t,e){return coerceArray(this).some(t,e)},Xme.prototype.forEach=function(i,n){var r;i&&i.value&&"function"==typeof i.value&&(n=ensureBoxedReceiver(this.sec,n,i),(r=this).value.forEach(function(t,e){i.value.call(n,t,e,r)}))},Xme.prototype.generic_forEach=function(t,e){return coerceArray(this).forEach(t,e)},Xme.prototype.map=function(i,n){if(!i||!i.value||"function"!=typeof i.value)return this.sec.createArrayUnsafe([]);n=ensureBoxedReceiver(this.sec,n,i);var r=this;return this.sec.createArrayUnsafe(this.value.map(function(t,e){return i.value.call(n,t,e,r)}))},Xme.prototype.generic_map=function(t,e){return coerceArray(this).map(t,e)},Xme.prototype.filter=function(t,e){if(!t||!t.value||"function"!=typeof t.value)return this.sec.createArrayUnsafe([]);e=ensureBoxedReceiver(this.sec,e,t);for(var i=[],n=this.value,r=0;r<n.length;r++)!0===t.value.call(e,n[r],r,this)&&i.push(n[r]);return this.sec.createArrayUnsafe(i)},Xme.prototype.generic_filter=function(t,e){return coerceArray(this).filter(t,e)},Xme.prototype.toLocaleString=function(){for(var t=this.sec.AXArray.axCoerce(this).value,e="",i=0,n=t.length;i<n;i++){var r=t[i];null!=r&&(e+=r.toLocaleString()),i+1<n&&(e+=",")}return e},Xme.prototype.sort=function(){var i,t=this.value;if(0===arguments.length)return t.sort(),this;var n=0;if(this.sec.AXFunction.axIsInstanceOf(arguments[0])?i=arguments[0].value:isNumber(arguments[0])&&(n=arguments[0]),isNumber(arguments[1])&&(n=arguments[1]),!n)return t.sort(i),this;i=i||axDefaultCompareFunction;var r=2&n?-1:1;return t.sort(function(t,e){return axCompare(t,e,n,r,i)}),this},Xme.prototype.generic_sort=function(){return coerceArray(this).sort.apply(this,arguments)},Xme.prototype.sortOn=function(i,t){0===arguments.length&&this.sec.throwError("ArgumentError",Errors$1.WrongArgumentCountError,"Array/http://adobe.com/AS3/2006/builtin::sortOn()","1","0");var e=this.value,n=[];if(isString(i))i=[Multiname.getPublicMangledName(i)],n=[0|t];else{if(!i||!Array.isArray(i.value))return this;i=i.value;for(var r=0;r<i.length;r++)i[r]=Multiname.getPublicMangledName(i[r]);if(t&&Array.isArray(t.value))if((t=t.value).length===i.length)for(r=0;r<t.length;r++)n[r]=0|t[r];else for(r=0;r<i.length;r++)n[r]=0;else for(var o=0|t,r=0;r<i.length;r++)n[r]=o}return o=n[0],e.sort(function(t,e){return axCompareFields(t,e,i,n)}),this},Xme.prototype.generic_sortOn=function(){return coerceArray(this).sortOn.apply(this,arguments)},Object.defineProperty(Xme.prototype,"length",{get:function(){return this.value.length},set:function(t){this.value.length=t>>>0},enumerable:!0,configurable:!0}),Xme.prototype.axGetEnumerableKeys=function(){return Object.keys(this.value).concat(Wme.prototype.axGetEnumerableKeys.call(this))},Xme.prototype.axHasPropertyInternal=function(t){var e=t.name;return"number"==typeof e||isNumeric(e=axCoerceName(e))?e in this.value:!!this.traits.getTrait(t.namespaces,e)||"$Bg"+e in this},Xme.prototype.axHasOwnProperty=function(t){var e=t.name;return"number"==typeof e||isNumeric(e=axCoerceName(e))?this.value.hasOwnProperty(e):!!this.traits.getTrait(t.namespaces,e)||this.hasOwnProperty("$Bg"+e)},Xme.prototype.axGetProperty=function(t){var e,i=t.name;return"number"==typeof i||isNumeric(i=axCoerceName(i))?null!=(e=this.value[i])?e:this[i]:Wme.prototype.axGetProperty.call(this,t)},Xme.prototype.axSetProperty=function(t,e,i){var n=t.name;"number"==typeof n||isNumeric(n=axCoerceName(n))?this.value[n]=e:Wme.prototype.axSetProperty.call(this,t,e,i)},Xme.prototype.axDeleteProperty=function(t){var e=t.name;return"number"==typeof e||isNumeric(e=axCoerceName(e))?delete this.value[e]:!this.traits.getTrait(t.namespaces,e)&&delete this["$Bg"+e]},Xme.prototype.axGetPublicProperty=function(t){return"number"==typeof t||isNumeric(t=axCoerceName(t))?this.value[t]:this["$Bg"+t]},Xme.prototype.axSetPublicProperty=function(t,e){"number"==typeof t||isNumeric(t=axCoerceName(t))?this.value[t]=e:this["$Bg"+t]=e},Xme),ASError=(Voe=ASObject,__extends(Woe,Voe),Woe.throwError=function(t,e){for(var i=[getErrorInfo(e)],n=2;n<arguments.length;n++)i.push(arguments[n]);var r=formatErrorMessage.apply(null,i);throw t.axConstruct([r,e])},Woe.classInitializer=function(t){defineNonEnumerableProperty(this,"$Bglength",1),defineNonEnumerableProperty(this.dPrototype,"$Bgname",this.classInfo.instanceInfo.getName().name),t===Woe&&(defineNonEnumerableProperty(this.dPrototype,"$Bgmessage","Error"),defineNonEnumerableProperty(this.dPrototype,"$BgtoString",Woe.prototype.toString))},Woe.prototype.toString=function(){return""!==this.$Bgmessage?this.$Bgname+": "+this.$Bgmessage:this.$Bgname},Object.defineProperty(Woe.prototype,"errorID",{get:function(){return this._errorID},enumerable:!0,configurable:!0}),Woe.prototype.getStackTrace=function(){return null},Woe.getErrorMessage=getErrorMessage,Woe),ASDefinitionError=(fpe=ASError,__extends(gpe,fpe),gpe),ASEvalError=(hpe=ASError,__extends(ipe,hpe),ipe),ASRangeError=(jpe=ASError,__extends(kpe,jpe),kpe),ASReferenceError=(lpe=ASError,__extends(mpe,lpe),mpe),ASSecurityError=(npe=ASError,__extends(ope,npe),ope),ASSyntaxError=(ppe=ASError,__extends(qpe,ppe),qpe),ASTypeError=(rpe=ASError,__extends(spe,rpe),spe),ASURIError=(tpe=ASError,__extends(upe,tpe),upe),ASVerifyError=(vpe=ASError,__extends(wpe,vpe),wpe),ASUninitializedError=(xpe=ASError,__extends(ype,xpe),ype),ASArgumentError=(zpe=ASError,__extends(Ape,zpe),Ape),ASIOError=(Bpe=ASError,__extends(Cpe,Bpe),Cpe),ASEOFError=(Dpe=ASError,__extends(Epe,Dpe),Epe),ASMemoryError=(Fpe=ASError,__extends(Gpe,Fpe),Gpe),ASIllegalOperationError=(Hpe=ASError,__extends(Ipe,Hpe),Ipe),WriterFlags,Hpe,Fpe,Dpe,Bpe,zpe,xpe,vpe,tpe,rpe,ppe,npe,lpe,jpe,hpe,fpe,Voe,Wme,Jpe;function Ipe(){return null!==Hpe&&Hpe.apply(this,arguments)||this}function Gpe(){return null!==Fpe&&Fpe.apply(this,arguments)||this}function Epe(){return null!==Dpe&&Dpe.apply(this,arguments)||this}function Cpe(){return null!==Bpe&&Bpe.apply(this,arguments)||this}function Ape(){return null!==zpe&&zpe.apply(this,arguments)||this}function ype(){return null!==xpe&&xpe.apply(this,arguments)||this}function wpe(){return null!==vpe&&vpe.apply(this,arguments)||this}function upe(){return null!==tpe&&tpe.apply(this,arguments)||this}function spe(){return null!==rpe&&rpe.apply(this,arguments)||this}function qpe(){return null!==ppe&&ppe.apply(this,arguments)||this}function ope(){return null!==npe&&npe.apply(this,arguments)||this}function mpe(){return null!==lpe&&lpe.apply(this,arguments)||this}function kpe(){return null!==jpe&&jpe.apply(this,arguments)||this}function ipe(){return null!==hpe&&hpe.apply(this,arguments)||this}function gpe(){return null!==fpe&&fpe.apply(this,arguments)||this}function Woe(t,e){var i=Voe.call(this)||this;return arguments.length<1&&(t=""),i.$Bgmessage=String(t),i._errorID=0|e,i}function Xme(){var t=Wme.call(this)||this;return t.value=createArrayValueFromArgs(t.sec,arguments),t}Jpe=WriterFlags=WriterFlags||{},Jpe[Jpe.None=0]="None",Jpe[Jpe.Runtime=1]="Runtime",Jpe[Jpe.Execution=2]="Execution",Jpe[Jpe.Interpreter=4]="Interpreter";var writer=new IndentingWriter(!1,function(t){dumpLine(t)}),executionWriter=null;function sliceArguments(t,e){return Array.prototype.slice.call(t,e)}var ASFunction=(Npe=ASObject,__extends(Ope,Npe),Ope.classInitializer=function(){var t=this.dPrototype,e=Ope.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$Bgcall",e.call),addPrototypeFunctionAlias(t,"$Bgapply",e.apply),defineNonEnumerableProperty(t,"value",e.native_functionValue)},Ope.prototype.setReceiver=function(t){this.receiver=t},Ope.prototype.axConstruct=function(t){var e=this.prototype;isNullOrUndefined(e)&&(e=this.sec.AXFunctionUndefinedPrototype);var i=Object.create(e);return(i.__ctorFunction=this).value.apply(i,t),i},Ope.prototype.axIsInstanceOf=function(t){return t&&t.__ctorFunction===this},Ope.prototype.native_functionValue=function(){},Object.defineProperty(Ope.prototype,"prototype",{get:function(){return this._prototypeInitialzed||(this._prototype=Object.create(this.sec.AXObject.tPrototype),this._prototypeInitialzed=!0),this._prototype},set:function(t){isNullOrUndefined(t)?t=void 0:"object"==typeof t&&!this.sec.isPrimitive(t)||this.sec.throwError("TypeError",Errors$1.PrototypeTypeError),this._prototypeInitialzed=!0,this._prototype=t},enumerable:!0,configurable:!0}),Object.defineProperty(Ope.prototype,"length",{get:function(){return this.value.methodInfo?this.value.methodInfo.parameters.length:this.value.length},enumerable:!0,configurable:!0}),Ope.prototype.toString=function(){return"function Function() {}"},Ope.prototype.call=function(t){return t=ensureBoxedReceiver(this.sec,t,this),this.value.apply(t,sliceArguments(arguments,1))},Ope.prototype.apply=function(t,e){return t=ensureBoxedReceiver(this.sec,t,this),this.value.apply(t,e?e.value:void 0)},Ope.prototype.axCall=function(t){return this.value.apply(t,sliceArguments(arguments,1))},Ope.prototype.axApply=function(t,e){return this.value.apply(t,e)},Ope),ASMethodClosure=(cqe=ASFunction,__extends(dqe,cqe),dqe.classInitializer=function(){var t=this.dPrototype,e=dqe.prototype;defineNonEnumerableProperty(t,"$Bgcall",e.call),defineNonEnumerableProperty(t,"$Bgapply",e.apply)},dqe.Create=function(t,e){var i=Object.create(this.sec.AXMethodClosure.tPrototype);return i.receiver=t,i.value=e,i.methodInfo=e.methodInfo,i.axCall=i.call,i.axApply=i.apply,i},Object.defineProperty(dqe.prototype,"prototype",{get:function(){return null},set:function(t){this.sec.throwError("ReferenceError",Errors$1.ConstWriteError,"prototype","MethodClosure")},enumerable:!0,configurable:!0}),dqe.prototype.axCall=function(t){return this.value.apply(this.receiver,sliceArguments(arguments,1))},dqe.prototype.axApply=function(t,e){return this.value.apply(this.receiver,e)},dqe.prototype.call=function(t){var e=arguments;return e.length<=6?this.value.call(this.receiver,e[1],e[2],e[3],e[4],e[5]):this.value.apply(this.receiver,sliceArguments(arguments,1))},dqe.prototype.apply=function(t,e){return this.value.apply(this.receiver,e&&e.value?e.value:e)},dqe),ASNumber=(sqe=ASObject,__extends(tqe,sqe),tqe.classInitializer=function(){var t=this.dPrototype,e=tqe.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf),addPrototypeFunctionAlias(t,"$BgtoFixed",e.toFixed),addPrototypeFunctionAlias(t,"$BgtoExponential",e.toExponential),addPrototypeFunctionAlias(t,"$BgtoPrecision",e.toPrecision),defineNonEnumerableProperty(this,"$BgNaN",Number.NaN),defineNonEnumerableProperty(this,"$BgNEGATIVE_INFINITY",-1/0),defineNonEnumerableProperty(this,"$BgPOSITIVE_INFINITY",1/0),defineNonEnumerableProperty(this,"$BgMAX_VALUE",Number.MAX_VALUE),defineNonEnumerableProperty(this,"$BgMIN_VALUE",Number.MIN_VALUE),defineNonEnumerableProperty(this,"$BgE",Math.E),defineNonEnumerableProperty(this,"$BgLN10",Math.LN10),defineNonEnumerableProperty(this,"$BgLN2",Math.LN2),defineNonEnumerableProperty(this,"$BgLOG10E",Math.LOG10E),defineNonEnumerableProperty(this,"$BgLOG2E",Math.LOG2E),defineNonEnumerableProperty(this,"$BgPI",Math.PI),defineNonEnumerableProperty(this,"$BgSQRT1_2",Math.SQRT2),defineNonEnumerableProperty(this,"$BgSQRT2",Math.SQRT2)},tqe.prototype.toString=function(t){return 0===arguments.length?t=10:((t|=0)<2||36<t)&&this.sec.throwError("RangeError",Errors$1.InvalidRadixError,t),this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.toString"),this.value.toString(t)},tqe.prototype.valueOf=function(){return this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.valueOf"),this.value},tqe.prototype.toExponential=function(t){return((t|=0)<0||20<t)&&this.sec.throwError("RangeError",Errors$1.InvalidPrecisionError),this.axClass!==this.sec.AXNumber?"NaN":this.value.toExponential(t)},tqe.prototype.toPrecision=function(t){return t?t|=0:t=1,(t<1||21<t)&&this.sec.throwError("RangeError",Errors$1.InvalidPrecisionError),this.axClass!==this.sec.AXNumber?"NaN":this.value.toPrecision(t)},tqe.prototype.toFixed=function(t){return((t|=0)<0||20<t)&&this.sec.throwError("RangeError",Errors$1.InvalidPrecisionError),this.axClass!==this.sec.AXNumber?"NaN":this.value.toFixed(t)},tqe._minValue=function(){return Number.MIN_VALUE},tqe.convertStringToDouble=function(t){var e=t.indexOf(String.fromCharCode(0));return 0<=e?+t.substring(0,e):+t},tqe.classNatives=[Math],tqe),ASInt=(Cqe=ASNumber,__extends(Dqe,Cqe),Dqe.classInitializer=function(){var t=this.dPrototype,e=Dqe.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf),defineNonEnumerableProperty(this,"$BgMAX_VALUE",2147483647),defineNonEnumerableProperty(this,"$BgMIN_VALUE",-2147483648)},Dqe.prototype.toString=function(t){return 0===arguments.length?t=10:((t|=0)<2||36<t)&&this.sec.throwError("RangeError",Errors$1.InvalidRadixError,t),this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.toString"),this.value.toString(t)},Dqe.prototype.valueOf=function(){return this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.valueOf"),this.value},Dqe.staticNatives=[Math],Dqe.instanceNatives=[ASNumber.prototype],Dqe),Cqe,sqe,cqe,Npe;function Dqe(){return null!==Cqe&&Cqe.apply(this,arguments)||this}function tqe(){return null!==sqe&&sqe.apply(this,arguments)||this}function dqe(){return null!==cqe&&cqe.apply(this,arguments)||this}function Ope(){var t=null!==Npe&&Npe.apply(this,arguments)||this;return t._prototypeInitialzed=!1,t}function transformJStoASRegExpMatchArray(t,e){var i=t.createArray(e);return i.axSetPublicProperty("index",e.index),i.axSetPublicProperty("input",e.input),i}function as3ToLowerCase(t){for(var e=null,i=0;i<t.length;i++){var n=t.charCodeAt(i);4256<=n&&n<=4293&&((e=e||new Array(t.length))[i]=String.fromCharCode(n+48))}if(e){for(i=0;i<e.length;i++)e[i]||(e[i]=t.charAt(i).toLocaleString());return e.join("")}return t.toLowerCase()}var ASString=(Oqe=ASObject,__extends(Pqe,Oqe),Pqe.classInitializer=function(){var t=this.dPrototype,e=Pqe.prototype;addPrototypeFunctionAlias(t,"$BgindexOf",e.generic_indexOf),addPrototypeFunctionAlias(t,"$BglastIndexOf",e.generic_lastIndexOf),addPrototypeFunctionAlias(t,"$BgcharAt",e.generic_charAt),addPrototypeFunctionAlias(t,"$BgcharCodeAt",e.generic_charCodeAt),addPrototypeFunctionAlias(t,"$Bgconcat",e.generic_concat),addPrototypeFunctionAlias(t,"$BglocaleCompare",e.generic_localeCompare),addPrototypeFunctionAlias(t,"$Bgmatch",e.generic_match),addPrototypeFunctionAlias(t,"$Bgreplace",e.generic_replace),addPrototypeFunctionAlias(t,"$Bgsearch",e.generic_search),addPrototypeFunctionAlias(t,"$Bgslice",e.generic_slice),addPrototypeFunctionAlias(t,"$Bgsplit",e.generic_split),addPrototypeFunctionAlias(t,"$Bgsubstring",e.generic_substring),addPrototypeFunctionAlias(t,"$Bgsubstr",e.generic_substr),addPrototypeFunctionAlias(t,"$BgtoLowerCase",e.generic_toLowerCase),addPrototypeFunctionAlias(t,"$BgtoLocaleLowerCase",e.generic_toLowerCase),addPrototypeFunctionAlias(t,"$BgtoUpperCase",e.generic_toUpperCase),addPrototypeFunctionAlias(t,"$BgtoLocaleUpperCase",e.generic_toUpperCase),addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgtoString",e.public_toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.public_valueOf),addPrototypeFunctionAlias(this,"$BgfromCharCode",Pqe.fromCharCode)},Pqe.fromCharCode=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return String.fromCharCode.apply(null,t)},Pqe.prototype.indexOf=function(t,e){return this.value.indexOf(t,e)},Pqe.prototype.lastIndexOf=function(t,e){return this.value.lastIndexOf(t,e)},Pqe.prototype.charAt=function(t){return this.value.charAt(t)},Pqe.prototype.charCodeAt=function(t){return this.value.charCodeAt(t)},Pqe.prototype.concat=function(){return this.value.concat.apply(this.value,arguments)},Pqe.prototype.localeCompare=function(t){1<arguments.length&&this.sec.throwError("ArgumentError",Errors$1.WrongArgumentCountError,"Function/<anonymous>()",0,2);var e=this.value;if((t=String(t))===e)return 0;for(var i=Math.min(e.length,t.length),n=0;n<i;n++)if(e[n]!==t[n])return e.charCodeAt(n)-t.charCodeAt(n);return e.length>t.length?1:-1},Pqe.prototype.match=function(t){t=this.sec.AXRegExp.axIsType(t)?t.value:axCoerceString$2(t);var e=this.value.match(t);if(!e)return null;try{return transformJStoASRegExpMatchArray(this.sec,e)}catch(t){return null}},Pqe.prototype.replace=function(t,e){t=this.sec.AXRegExp.axIsType(t)?t.value:axCoerceString$2(t),this.sec.AXFunction.axIsType(e)&&(e=e.value);try{return this.value.replace(t,e)}catch(t){return this.value}},Pqe.prototype.search=function(t){t=this.sec.AXRegExp.axIsType(t)?t.value:axCoerceString$2(t);try{return this.value.search(t)}catch(t){return-1}},Pqe.prototype.slice=function(t,e){return t=arguments.length<1?0:0|t,e=arguments.length<2?4294967295:0|e,this.value.slice(t,e)},Pqe.prototype.split=function(t,e){t=this.sec.AXRegExp.axIsType(t)?t.value:axCoerceString$2(t),e=void 0===e?-1:0|e;try{return this.sec.createArray(this.value.split(t,e))}catch(t){return this.sec.createArrayUnsafe([this.value])}},Pqe.prototype.substring=function(t,e){return this.value.substring(t,e)},Pqe.prototype.substr=function(t,e){return-1==e&&(e=this.value.length-t-1),this.value.substr(t,e)},Pqe.prototype.toLocaleLowerCase=function(){return this.value.toLowerCase()},Pqe.prototype.toLowerCase=function(){return as3ToLowerCase(this.value)},Pqe.prototype.toLocaleUpperCase=function(){return this.value.toUpperCase()},Pqe.prototype.toUpperCase=function(){return this.value.toUpperCase()},Pqe.prototype.generic_indexOf=function(t,e){var i=null==this?"":this;return String.prototype.indexOf.call(i,t,e)},Pqe.prototype.generic_lastIndexOf=function(t,e){var i=null==this?"":this;return String.prototype.lastIndexOf.call(i,t,e)},Pqe.prototype.generic_charAt=function(t){var e=null==this?"":this;return String.prototype.charAt.call(e,t)},Pqe.prototype.generic_charCodeAt=function(t){var e=null==this?"":this;return String.prototype.charCodeAt.call(e,t)},Pqe.prototype.generic_concat=function(){var t=null==this?"":this;return String.prototype.concat.apply(t,arguments)},Pqe.prototype.generic_localeCompare=function(t){var e=this.sec.AXString.axBox(String(this));return e.localeCompare.apply(e,arguments)},Pqe.prototype.generic_match=function(t){return this.sec.AXString.axBox(String(this)).match(t)},Pqe.prototype.generic_replace=function(t,e){return this.sec.AXString.axBox(String(this)).replace(t,e)},Pqe.prototype.generic_search=function(t){return this.sec.AXString.axBox(String(this)).search(t)},Pqe.prototype.generic_slice=function(t,e){var i=null==this?"":this;return String.prototype.slice.call(i,t,e)},Pqe.prototype.generic_split=function(t,e){return e=arguments.length<2?4294967295:0|e,this.sec.AXString.axBox(String(this)).split(t,e)},Pqe.prototype.generic_substring=function(t,e){var i=null==this?"":this;return String.prototype.substring.call(i,t,e)},Pqe.prototype.generic_substr=function(t,e){var i=null==this?"":this;return String.prototype.substr.call(i,t,e)},Pqe.prototype.generic_toLowerCase=function(){return as3ToLowerCase(String(null==this?"":this))},Pqe.prototype.generic_toUpperCase=function(){var t=null==this?"":this;return String.prototype.toUpperCase.call(t)},Pqe.prototype.toString=function(){return this.value.toString()},Pqe.prototype.public_toString=function(){return this===this.sec.AXString.dPrototype?"":(this.axClass!==this.sec.AXString&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"String.prototype.toString"),this.value.toString())},Pqe.prototype.valueOf=function(){return this.value.valueOf()},Pqe.prototype.public_valueOf=function(){return this===this.sec.AXString.dPrototype?"":(this.axClass!==this.sec.AXString&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"String.prototype.valueOf"),this.value.valueOf())},Object.defineProperty(Pqe.prototype,"length",{get:function(){return this.value.length},enumerable:!0,configurable:!0}),Pqe.classNatives=[String],Pqe),ASUint=(Sre=ASNumber,__extends(Tre,Sre),Tre.classInitializer=function(){var t=this.dPrototype,e=Tre.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf),defineNonEnumerableProperty(this,"$BgMAX_VALUE",4294967295),defineNonEnumerableProperty(this,"$BgMIN_VALUE",0)},Tre.prototype.toString=function(t){return 0===arguments.length?t=10:((t|=0)<2||36<t)&&this.sec.throwError("RangeError",Errors$1.InvalidRadixError,t),this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.toString"),this.value.toString(t)},Tre.prototype.valueOf=function(){return this.axClass!==this.sec.AXNumber&&this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"Number.prototype.valueOf"),this.value},Tre.staticNatives=[Math],Tre.instanceNatives=[ASNumber.prototype],Tre),ASBoolean=(Xre=ASObject,__extends(Yre,Xre),Yre.classInitializer=function(){var t=this.dPrototype,e=Yre.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf)},Yre.prototype.toString=function(){return this.value.toString()},Yre.prototype.valueOf=function(){return this.value.valueOf()},Yre),Xre,Sre,Oqe;function Yre(){return null!==Xre&&Xre.apply(this,arguments)||this}function Tre(){return null!==Sre&&Sre.apply(this,arguments)||this}function Pqe(){return null!==Oqe&&Oqe.apply(this,arguments)||this}function axIsCallable(t){return t&&"function"==typeof t.axApply}function axCoerceNumber(t){return"string"==typeof t||t&&"object"==typeof t&&"string"==typeof(t=t.valueOf())?ASNumber.convertStringToDouble(t):+t}var BaseVector=(bse=ASObject,__extends(cse,bse),cse.prototype.axGetProperty=function(t){var e=t.name;return(0|(e="number"==typeof e?e:axCoerceName(e)))===e||isNumeric(e)?this.axGetNumericProperty("number"==typeof e?e:0|e):bse.prototype.axGetProperty.call(this,t)},cse.prototype.axSetProperty=function(t,e,i){var n=t.name;(0|(n="number"==typeof n?n:axCoerceName(n)))===n||isNumeric(n)?this.axSetNumericProperty("number"==typeof n?n:0|n,e):bse.prototype.axSetProperty.call(this,t,e,i)},cse.prototype.axGetPublicProperty=function(t){return(0|(t="number"==typeof t?t:axCoerceName(t)))===t||isNumeric(t)?this.axGetNumericProperty("number"==typeof t?t:0|t):this["$Bg"+t]},cse.prototype.axSetPublicProperty=function(t,e){(0|(t="number"==typeof t?t:axCoerceName(t)))===t||isNumeric(t)?this.axSetNumericProperty("number"==typeof t?t:0|t,e):this["$Bg"+t]=e},cse.prototype.axNextName=function(t){return t-1},cse.prototype.checkVectorMethodArgs=function(t,e){if(isNullOrUndefined$1(t))return!1;var i=this.sec;return axIsCallable(t)||i.throwError("TypeError",Errors$1.CheckTypeFailedError,t,"Function"),t.axClass!==i.AXMethodClosure||isNullOrUndefined$1(e)||i.throwError("TypeError",Errors$1.ArrayFilterNonNullObjectError),!0},cse),Vector=(qse=ASObject,__extends(rse,qse),rse.axIsType=function(t){return this.dPrototype.isPrototypeOf(t)||this.sec.Int32Vector.axClass.dPrototype.isPrototypeOf(t)||this.sec.Uint32Vector.axClass.dPrototype.isPrototypeOf(t)||this.sec.Float64Vector.axClass.dPrototype.isPrototypeOf(t)||this.sec.ObjectVector.axClass.dPrototype.isPrototypeOf(t)},rse),GenericVector=(tse=BaseVector,__extends(use,tse),use.classInitializer=function(){var t=this.dPrototype,e=this.tPrototype;e.axGetProperty=t.axGetProperty,e.axGetNumericProperty=t.axGetNumericProperty,e.axSetProperty=t.axSetProperty,e.axSetNumericProperty=t.axSetNumericProperty,e.axHasPropertyInternal=t.axHasPropertyInternal,e.axNextName=t.axNextName,e.axNextNameIndex=t.axNextNameIndex,e.axNextValue=t.axNextValue,t.axGetProperty=ASObject.prototype.axGetProperty,t.axGetNumericProperty=ASObject.prototype.axGetNumericProperty,t.axSetProperty=ASObject.prototype.axSetProperty,t.axSetNumericProperty=ASObject.prototype.axSetNumericProperty,t.axHasPropertyInternal=ASObject.prototype.axHasPropertyInternal,t.axNextName=ASObject.prototype.axNextName,t.axNextNameIndex=ASObject.prototype.axNextNameIndex,t.axNextValue=ASObject.prototype.axNextValue;var i=use.prototype;defineNonEnumerableProperty(t,"$Bgjoin",i.join),defineNonEnumerableProperty(t,"$BgtoString",i.join),defineNonEnumerableProperty(t,"$BgtoLocaleString",i.toLocaleString),defineNonEnumerableProperty(t,"$Bgpop",i.pop),defineNonEnumerableProperty(t,"$Bgpush",i.push),defineNonEnumerableProperty(t,"$Bgreverse",i.reverse),defineNonEnumerableProperty(t,"$Bgconcat",i.concat),defineNonEnumerableProperty(t,"$Bgsplice",i.splice),defineNonEnumerableProperty(t,"$Bgslice",i.slice),defineNonEnumerableProperty(t,"$Bgshift",i.shift),defineNonEnumerableProperty(t,"$Bgunshift",i.unshift),defineNonEnumerableProperty(t,"$BgindexOf",i.indexOf),defineNonEnumerableProperty(t,"$BglastIndexOf",i.lastIndexOf),defineNonEnumerableProperty(t,"$BgforEach",i.forEach),defineNonEnumerableProperty(t,"$Bgmap",i.map),defineNonEnumerableProperty(t,"$Bgfilter",i.filter),defineNonEnumerableProperty(t,"$Bgsome",i.some),defineNonEnumerableProperty(t,"$Bgevery",i.every),defineNonEnumerableProperty(t,"$Bgsort",i.sort),defineNonEnumerableProperty(t,"checkVectorMethodArgs",i.checkVectorMethodArgs)},use.axApply=function(t,e){var i=e[0];if(this.axIsType(i))return i;var n=i.axGetPublicProperty("length");if(void 0!==n){for(var r=this.axConstruct([n,!1]),o=0;o<n;o++)r.axSetNumericProperty(o,i.axGetPublicProperty(o));return r}unexpected()},use.defaultCompareFunction=function(t,e){return String(t).localeCompare(String(e))},use.compare=function(t,e,i,n){var r=0;return n=n||use.defaultCompareFunction,r=i&use.NUMERIC?(t=toNumber(t))<(e=toNumber(e))?-1:e<t?1:0:n(t,e),i&use.DESCENDING&&(r*=-1),r},use.prototype._fill=function(t,e,i){for(var n=0;n<e;n++)this._buffer[t+n]=i},use.prototype.toString=function(){for(var t=[],e=0;e<this._buffer.length;e++){var i=this._buffer[e];t.push(null===i?"null":i+"")}return t.join(",")},use.prototype.toLocaleString=function(){for(var t=[],e=0;e<this._buffer.length;e++){var i=this._buffer[e];i&&"object"==typeof i?t.push(i.$BgtoLocaleString()):t.push(i+"")}return t.join(",")},use.prototype.sort=function(t){if(void 0===t)return this._buffer.sort(),this;if(this.sec.AXFunction.axIsType(t)){var e=t.value,i=t.receiver;return this._buffer.sort(e.bind(i)),this}var n=0|t;return n&use.NUMERIC?n&use.DESCENDING?this._buffer.sort(function(t,e){return axCoerceNumber(e)-axCoerceNumber(t)}):this._buffer.sort(function(t,e){return axCoerceNumber(t)-axCoerceNumber(e)}):n&use.CASEINSENSITIVE?n&use.DESCENDING?this._buffer.sort(function(t,e){return axCoerceString$2(e).toLowerCase()-axCoerceString$2(t).toLowerCase()}):this._buffer.sort(function(t,e){return axCoerceString$2(t).toLowerCase()-axCoerceString$2(e).toLowerCase()}):n&use.DESCENDING?this._buffer.sort(function(t,e){return e-t}):this._buffer.sort(),this},use.prototype.every=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!0;for(var i=0;i<this._buffer.length;i++)if(!t.axCall(e,this.axGetNumericProperty(i),i,this))return!1;return!0},use.prototype.filter=function(t,e){var i=this.axClass.axConstruct([0,!1]);if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._buffer.length;n++)t.call(e,this.axGetNumericProperty(n),n,this)&&i.push(this.axGetNumericProperty(n));return i},use.prototype.map=function(t,e){var i=this.axClass.axConstruct([this.length,!1]);if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._buffer.length;n++)i.push(this._coerce(t.call(e,this.axGetNumericProperty(n),n,this)));return i},use.prototype.some=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!1;for(var i=0;i<this._buffer.length;i++)if(t.call(e,this.axGetNumericProperty(i),i,this))return!0;return!1},use.prototype.forEach=function(t,e){if(this.checkVectorMethodArgs(t,e))for(var i=0;i<this._buffer.length;i++)t.call(e,this.axGetNumericProperty(i),i,this)},use.prototype.join=function(t){void 0===t&&(t=",");for(var e=this._buffer,i=this._buffer.length,n="",r=0;r<i-1;r++)n+=e[r]+t;return 0<i&&(n+=e[i-1]),n},use.prototype.indexOf=function(t,e){return void 0===e&&(e=0),this._buffer.indexOf(t,e)},use.prototype.lastIndexOf=function(t,e){return void 0===e&&(e=2147483647),this._buffer.lastIndexOf(t,e)},use.prototype.push=function(t,e,i,n,r,o,s,a){this._checkFixed();for(var l=0;l<arguments.length;l++)this._buffer.push(this._coerce(arguments[l]))},use.prototype.pop=function(){if(this._checkFixed(),0!==this._buffer.length)return this._buffer.pop()},use.prototype.concat=function(){for(var t=[],e=0;e<arguments.length;e++)t.push(arguments[e]._buffer);var i=this._buffer.concat.apply(this._buffer,t),n=this.axClass.axConstruct([]);return n._buffer=i,n},use.prototype.reverse=function(){return this._buffer.reverse(),this},use.prototype._coerce=function(t){return this.axClass.type[IS_AX_CLASS]?this.axClass.type.axCoerce(t):t},use.prototype.shift=function(){if(this._checkFixed(),0!==this._buffer.length)return this._buffer.shift()},use.prototype.unshift=function(){if(arguments.length){this._checkFixed();for(var t=0;t<arguments.length;t++)this._buffer.unshift(this._coerce(arguments[t]))}},use.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=2147483647);var i=this._buffer,n=i.length,r=Math.min(Math.max(t,0),n),o=Math.min(Math.max(e,r),n),s=this.axClass.axConstruct([o-r,this.fixed]);return s._buffer=i.slice(r,o),s},use.prototype.splice=function(t,e){var i=this._buffer,n=i.length,r=Math.min(Math.max(t,0),n),o=Math.min(Math.max(e,0),n-r),s=arguments.length-2;o!==s&&this._checkFixed();for(var a=[r,o],l=2;l<2+s;l++)a[l]=this._coerce(arguments[l]);var c=this.axClass.axConstruct([o,this.fixed]);return c._buffer=i.splice.apply(i,a),c},Object.defineProperty(use.prototype,"length",{get:function(){return this._buffer.length},set:function(t){if((t>>>=0)>this._buffer.length)for(var e=this._buffer.length;e<t;e++)this._buffer[e]=this.axClass.defaultValue;else this._buffer.length=t},enumerable:!0,configurable:!0}),Object.defineProperty(use.prototype,"fixed",{get:function(){return this._fixed},set:function(t){this._fixed=!!t},enumerable:!0,configurable:!0}),use.prototype._checkFixed=function(){this._fixed&&this.sec.throwError("RangeError",Errors$1.VectorFixedError)},use.prototype.axGetNumericProperty=function(t){var e=0|t;return(e<0||e>=this._buffer.length||e!=t)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,this._buffer.length),this._buffer[e]},use.prototype.axSetNumericProperty=function(t,e){var i=this._buffer.length,n=0|t;(n<0||i<n||n!=t||n===i&&this._fixed)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,i),this._buffer[n]=this._coerce(e)},use.prototype.axHasPropertyInternal=function(t){if((0|t.name)===t.name)return 0<=t.name&&t.name<this._buffer.length;var e=axCoerceName(t.name);if(t.isRuntimeName()&&isIndex(e)){var i=e>>>0;return 0<=i&&i<this._buffer.length}return this.axResolveMultiname(t)in this},use.prototype.axNextValue=function(t){return this._buffer[t-1]},use.prototype.axNextNameIndex=function(t){var e=t+1;return e<=this._buffer.length?e:0},use.CASEINSENSITIVE=1,use.DESCENDING=2,use.UNIQUESORT=4,use.RETURNINDEXEDARRAY=8,use.NUMERIC=16,use.defaultValue=null,use),Int32Vector=(Due=BaseVector,__extends(Eue,Due),Eue.classInitializer=function(){var t=this.dPrototype,e=this.tPrototype;e.axGetProperty=t.axGetProperty,e.axGetNumericProperty=t.axGetNumericProperty,e.axSetProperty=t.axSetProperty,e.axSetNumericProperty=t.axSetNumericProperty,e.axHasPropertyInternal=t.axHasPropertyInternal,e.axNextName=t.axNextName,e.axNextNameIndex=t.axNextNameIndex,e.axNextValue=t.axNextValue,t.axGetProperty=ASObject.prototype.axGetProperty,t.axGetNumericProperty=ASObject.prototype.axGetNumericProperty,t.axSetProperty=ASObject.prototype.axSetProperty,t.axSetNumericProperty=ASObject.prototype.axSetNumericProperty,t.axHasPropertyInternal=ASObject.prototype.axHasPropertyInternal,t.axNextName=ASObject.prototype.axNextName,t.axNextNameIndex=ASObject.prototype.axNextNameIndex,t.axNextValue=ASObject.prototype.axNextValue;var i=Eue.prototype;defineNonEnumerableProperty(t,"$Bgjoin",i.join),defineNonEnumerableProperty(t,"$BgtoString",i.join),defineNonEnumerableProperty(t,"$BgtoLocaleString",i.toLocaleString),defineNonEnumerableProperty(t,"$Bgpop",i.pop),defineNonEnumerableProperty(t,"$Bgpush",i.push),defineNonEnumerableProperty(t,"$Bgreverse",i.reverse),defineNonEnumerableProperty(t,"$Bgconcat",i.concat),defineNonEnumerableProperty(t,"$Bgsplice",i.splice),defineNonEnumerableProperty(t,"$Bgslice",i.slice),defineNonEnumerableProperty(t,"$Bgshift",i.shift),defineNonEnumerableProperty(t,"$Bgunshift",i.unshift),defineNonEnumerableProperty(t,"$BgindexOf",i.indexOf),defineNonEnumerableProperty(t,"$BglastIndexOf",i.lastIndexOf),defineNonEnumerableProperty(t,"$BgforEach",i.forEach),defineNonEnumerableProperty(t,"$Bgmap",i.map),defineNonEnumerableProperty(t,"$Bgfilter",i.filter),defineNonEnumerableProperty(t,"$Bgsome",i.some),defineNonEnumerableProperty(t,"$Bgevery",i.every),defineNonEnumerableProperty(t,"$Bgsort",i.sort),defineNonEnumerableProperty(t,"checkVectorMethodArgs",i.checkVectorMethodArgs)},Eue.axApply=function(t,e){var i=e[0];if(this.axIsType(i))return i;var n=i.axGetPublicProperty("length");if(void 0!==n){for(var r=this.axConstruct([n,!1]),o=0;o<n;o++)r.axSetNumericProperty(o,i.axGetPublicProperty(o));return r}unexpected()},Eue.prototype.internalToString=function(){for(var t="",e=this._offset,i=e+this._length,n=0;n<this._buffer.length;n++)n===e&&(t+="["),n===i&&(t+="]"),t+=this._buffer[n],n<this._buffer.length-1&&(t+=",");return this._offset+this._length===this._buffer.length&&(t+="]"),t+": offset: "+this._offset+", length: "+this._length+", capacity: "+this._buffer.length},Eue.prototype.toString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},Eue.prototype.toLocaleString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},Eue.prototype._view=function(){return this._buffer.subarray(this._offset,this._offset+this._length)},Eue.prototype._ensureCapacity=function(t){var e=this._offset+t;if(!(e<this._buffer.length)){if(t<=this._buffer.length){var i=this._buffer.length-t>>2;return this._buffer.set(this._view(),i),void(this._offset=i)}var n=1+(3*this._buffer.length>>1);n<e&&(n=e);var r=new Int32Array(n);r.set(this._buffer,0),this._buffer=r}},Eue.prototype.concat=function(){for(var t=this._length,e=0;e<arguments.length;e++)(r=arguments[e])._buffer instanceof Int32Array||assert(!1),t+=r._length;var i=new this.sec.Int32Vector(t),n=i._buffer;n.set(this._buffer);for(var r,o=this._length,e=0;e<arguments.length;e++)o+(r=arguments[e])._buffer.length<r._buffer.length?n.set(r._buffer,o):n.set(r._buffer.subarray(0,r._length),o),o+=r._length;return i},Eue.prototype.every=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!0;for(var i=0;i<this._length;i++)if(!t.call(e,this._buffer[this._offset+i],i,this))return!1;return!0},Eue.prototype.filter=function(t,e){var i=new this.sec.Int32Vector;if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)t.call(e,this._buffer[this._offset+n],n,this)&&i.push(this._buffer[this._offset+n]);return i},Eue.prototype.map=function(t,e){var i=this.axClass.axConstruct([this.length,!1]);if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)i[n]=t.call(e,this._buffer[this._offset+n],n,this);return i},Eue.prototype.some=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!1;for(var i=0;i<this._length;i++)if(t.call(e,this._buffer[this._offset+i],i,this))return!0;return!1},Eue.prototype.forEach=function(t,e){if(this.checkVectorMethodArgs(t,e))for(var i=0;i<this._length;i++)t.call(e,this._buffer[this._offset+i],i,this)},Eue.prototype.join=function(t){void 0===t&&(t=",");for(var e=this.length,i=this._buffer,n=this._offset,r="",o=0;o<e-1;o++)r+=i[n+o]+t;return 0<e&&(r+=i[n+e-1]),r},Eue.prototype.indexOf=function(t,e){void 0===e&&(e=0);var i=this._length,n=0|e;if(n<0)(n+=i)<0&&(n=0);else if(i<=n)return-1;for(var r=this._buffer,o=(i=this._length,this._offset),s=o+i,a=n+=o;a<s;a++)if(r[a]===t)return a-o;return-1},Eue.prototype.lastIndexOf=function(t,e){void 0===e&&(e=2147483647);var i=this._length,n=0|e;if(n<0){if((n+=i)<0)return-1}else i<=n&&(n=i);for(var r=this._buffer,o=this._offset,s=o,a=n+=o;a-- >s;)if(r[a]===t)return a-o;return-1},Eue.prototype.push=function(t,e,i,n,r,o,s,a){this._checkFixed(),this._ensureCapacity(this._length+arguments.length);for(var l=0;l<arguments.length;l++)this._buffer[this._offset+this._length++]=arguments[l]},Eue.prototype.pop=function(){return this._checkFixed(),0===this._length?Eue.DEFAULT_VALUE:(this._length--,this._buffer[this._offset+this._length])},Eue.prototype.reverse=function(){for(var t=this._offset,e=this._offset+this._length-1,i=this._buffer;t<e;){var n=i[t];i[t]=i[e],i[e]=n,t++,e--}return this},Eue.prototype.sort=function(t){return 0===arguments.length?Array.prototype.sort.call(this._view()):this.sec.AXFunction.axIsType(t)?Array.prototype.sort.call(this._view(),t.value):(0|t)&Eue.DESCENDING?Array.prototype.sort.call(this._view(),function(t,e){return e-t}):Array.prototype.sort.call(this._view(),function(t,e){return t-e}),this},Eue.prototype.shift=function(){return this._checkFixed(),0===this._length?0:(this._length--,this._buffer[this._offset++])},Eue.prototype.unshift=function(){if(this._checkFixed(),arguments.length){this._ensureCapacity(this._length+arguments.length),this._slide(arguments.length),this._offset-=arguments.length,this._length+=arguments.length;for(var t=0;t<arguments.length;t++)this._buffer[this._offset+t]=arguments[t]}},Eue.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=2147483647);var i=this._buffer,n=this._length,r=Math.min(Math.max(t,0),n),o=Math.min(Math.max(e,r),n),s=new this.sec.Int32Vector(o-r,this.fixed);return s._buffer.set(i.subarray(this._offset+r,this._offset+o),s._offset),s},Eue.prototype.splice=function(t,e){var i,n=this._buffer,r=this._length,o=Math.min(Math.max(t,0),r),s=this._offset+o,a=Math.min(Math.max(e,0),r-o),l=arguments.length-2,c=new this.sec.Int32Vector(a,this.fixed);0<a&&(i=n.subarray(s,s+a),c._buffer.set(i,c._offset)),this._ensureCapacity(r-a+l);var h=s+a,u=n.subarray(h,r);n.set(u,s+l),this._length+=l-a;for(var p=0;p<l;p++)n[s+p]=arguments[p+2];return c},Eue.prototype._slide=function(t){this._buffer.set(this._view(),this._offset+t),this._offset+=t},Object.defineProperty(Eue.prototype,"length",{get:function(){return this._length},set:function(t){if((t>>>=0)>this._length){this._ensureCapacity(t);for(var e=this._offset+this._length,i=this._offset+t;e<i;e++)this._buffer[e]=Eue.DEFAULT_VALUE}this._length=t},enumerable:!0,configurable:!0}),Object.defineProperty(Eue.prototype,"fixed",{get:function(){return this._fixed},set:function(t){this._fixed=!!t},enumerable:!0,configurable:!0}),Eue.prototype._checkFixed=function(){this._fixed&&this.sec.throwError("RangeError",Errors$1.VectorFixedError)},Eue.prototype.axGetNumericProperty=function(t){var e=this._length,i=0|t;return(i<0||e<=i||i!=t)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,e),this._buffer[this._offset+i]},Eue.prototype.axSetNumericProperty=function(t,e){var i=this._length,n=0|t;(n<0||i<n||n!=t||n===i&&this._fixed)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,i),n===this._length&&(this._ensureCapacity(this._length+1),this._length++),this._buffer[this._offset+n]=e},Eue.prototype.axHasPropertyInternal=function(t){if((0|t.name)===t.name)return 0<=t.name&&t.name<this._length;var e=axCoerceName(t.name);if(t.isRuntimeName()&&isIndex(e)){var i=e>>>0;return 0<=i&&i<this._length}return this.axResolveMultiname(t)in this},Eue.prototype.axNextValue=function(t){return this._buffer[this._offset+t-1]},Eue.prototype.axNextNameIndex=function(t){var e=t+1;return e<=this._length?e:0},Eue.EXTRA_CAPACITY=4,Eue.INITIAL_CAPACITY=10,Eue.DEFAULT_VALUE=0,Eue.DESCENDING=2,Eue.UNIQUESORT=4,Eue.RETURNINDEXEDARRAY=8,Eue),Uint32Vector=(Zwe=BaseVector,__extends($we,Zwe),$we.classInitializer=function(){var t=this.dPrototype,e=this.tPrototype;e.axGetProperty=t.axGetProperty,e.axGetNumericProperty=t.axGetNumericProperty,e.axSetProperty=t.axSetProperty,e.axSetNumericProperty=t.axSetNumericProperty,e.axHasPropertyInternal=t.axHasPropertyInternal,e.axNextName=t.axNextName,e.axNextNameIndex=t.axNextNameIndex,e.axNextValue=t.axNextValue,t.axGetProperty=ASObject.prototype.axGetProperty,t.axGetNumericProperty=ASObject.prototype.axGetNumericProperty,t.axSetProperty=ASObject.prototype.axSetProperty,t.axSetNumericProperty=ASObject.prototype.axSetNumericProperty,t.axHasPropertyInternal=ASObject.prototype.axHasPropertyInternal,t.axNextName=ASObject.prototype.axNextName,t.axNextNameIndex=ASObject.prototype.axNextNameIndex,t.axNextValue=ASObject.prototype.axNextValue;var i=$we.prototype;defineNonEnumerableProperty(t,"$Bgjoin",i.join),defineNonEnumerableProperty(t,"$BgtoString",i.join),defineNonEnumerableProperty(t,"$BgtoLocaleString",i.toLocaleString),defineNonEnumerableProperty(t,"$Bgpop",i.pop),defineNonEnumerableProperty(t,"$Bgpush",i.push),defineNonEnumerableProperty(t,"$Bgreverse",i.reverse),defineNonEnumerableProperty(t,"$Bgconcat",i.concat),defineNonEnumerableProperty(t,"$Bgsplice",i.splice),defineNonEnumerableProperty(t,"$Bgslice",i.slice),defineNonEnumerableProperty(t,"$Bgshift",i.shift),defineNonEnumerableProperty(t,"$Bgunshift",i.unshift),defineNonEnumerableProperty(t,"$BgindexOf",i.indexOf),defineNonEnumerableProperty(t,"$BglastIndexOf",i.lastIndexOf),defineNonEnumerableProperty(t,"$BgforEach",i.forEach),defineNonEnumerableProperty(t,"$Bgmap",i.map),defineNonEnumerableProperty(t,"$Bgfilter",i.filter),defineNonEnumerableProperty(t,"$Bgsome",i.some),defineNonEnumerableProperty(t,"$Bgevery",i.every),defineNonEnumerableProperty(t,"$Bgsort",i.sort),defineNonEnumerableProperty(t,"checkVectorMethodArgs",i.checkVectorMethodArgs)},$we.axApply=function(t,e){var i=e[0];if(this.axIsType(i))return i;var n=i.axGetPublicProperty("length");if(void 0!==n){for(var r=this.axConstruct([n,!1]),o=0;o<n;o++)r.axSetNumericProperty(o,i.axGetPublicProperty(o));return r}unexpected()},$we.prototype.internalToString=function(){for(var t="",e=this._offset,i=e+this._length,n=0;n<this._buffer.length;n++)n===e&&(t+="["),n===i&&(t+="]"),t+=this._buffer[n],n<this._buffer.length-1&&(t+=",");return this._offset+this._length===this._buffer.length&&(t+="]"),t+": offset: "+this._offset+", length: "+this._length+", capacity: "+this._buffer.length},$we.prototype.toString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},$we.prototype.toLocaleString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},$we.prototype._view=function(){return this._buffer.subarray(this._offset,this._offset+this._length)},$we.prototype._ensureCapacity=function(t){var e=this._offset+t;if(!(e<this._buffer.length)){if(t<=this._buffer.length){var i=this._buffer.length-t>>2;return this._buffer.set(this._view(),i),void(this._offset=i)}var n=1+(3*this._buffer.length>>1);n<e&&(n=e);var r=new Uint32Array(n);r.set(this._buffer,0),this._buffer=r}},$we.prototype.concat=function(){for(var t=this._length,e=0;e<arguments.length;e++)(r=arguments[e])._buffer instanceof Uint32Array||assert(!1),t+=r._length;var i=new this.sec.Uint32Vector(t),n=i._buffer;n.set(this._buffer);for(var r,o=this._length,e=0;e<arguments.length;e++)o+(r=arguments[e])._buffer.length<r._buffer.length?n.set(r._buffer,o):n.set(r._buffer.subarray(0,r._length),o),o+=r._length;return i},$we.prototype.every=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!0;for(var i=0;i<this._length;i++)if(!t.call(e,this._buffer[this._offset+i],i,this))return!1;return!0},$we.prototype.filter=function(t,e){var i=new this.sec.Uint32Vector;if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)t.call(e,this._buffer[this._offset+n],n,this)&&i.push(this._buffer[this._offset+n]);return i},$we.prototype.map=function(t,e){var i=this.axClass.axConstruct([this.length,!1]);if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)i[n]=t.call(e,this._buffer[this._offset+n],n,this);return i},$we.prototype.some=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!1;for(var i=0;i<this._length;i++)if(t.call(e,this._buffer[this._offset+i],i,this))return!0;return!1},$we.prototype.forEach=function(t,e){if(this.checkVectorMethodArgs(t,e))for(var i=0;i<this._length;i++)t.call(e,this._buffer[this._offset+i],i,this)},$we.prototype.join=function(t){void 0===t&&(t=",");for(var e=this.length,i=this._buffer,n=this._offset,r="",o=0;o<e-1;o++)r+=i[n+o]+t;return 0<e&&(r+=i[n+e-1]),r},$we.prototype.indexOf=function(t,e){void 0===e&&(e=0);var i=this._length,n=0|e;if(n<0)(n+=i)<0&&(n=0);else if(i<=n)return-1;for(var r=this._buffer,o=(i=this._length,this._offset),s=o+i,a=n+=o;a<s;a++)if(r[a]===t)return a-o;return-1},$we.prototype.lastIndexOf=function(t,e){void 0===e&&(e=2147483647);var i=this._length,n=0|e;if(n<0){if((n+=i)<0)return-1}else i<=n&&(n=i);for(var r=this._buffer,o=this._offset,s=o,a=n+=o;a-- >s;)if(r[a]===t)return a-o;return-1},$we.prototype.push=function(t,e,i,n,r,o,s,a){this._checkFixed(),this._ensureCapacity(this._length+arguments.length);for(var l=0;l<arguments.length;l++)this._buffer[this._offset+this._length++]=arguments[l]},$we.prototype.pop=function(){return this._checkFixed(),0===this._length?$we.DEFAULT_VALUE:(this._length--,this._buffer[this._offset+this._length])},$we.prototype.reverse=function(){for(var t=this._offset,e=this._offset+this._length-1,i=this._buffer;t<e;){var n=i[t];i[t]=i[e],i[e]=n,t++,e--}return this},$we.prototype.sort=function(t){return 0===arguments.length?Array.prototype.sort.call(this._view()):this.sec.AXFunction.axIsType(t)?Array.prototype.sort.call(this._view(),t.value):(0|t)&$we.DESCENDING?Array.prototype.sort.call(this._view(),function(t,e){return e-t}):Array.prototype.sort.call(this._view(),function(t,e){return t-e}),this},$we.prototype.shift=function(){return this._checkFixed(),0===this._length?0:(this._length--,this._buffer[this._offset++])},$we.prototype.unshift=function(){if(this._checkFixed(),arguments.length){this._ensureCapacity(this._length+arguments.length),this._slide(arguments.length),this._offset-=arguments.length,this._length+=arguments.length;for(var t=0;t<arguments.length;t++)this._buffer[this._offset+t]=arguments[t]}},$we.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=2147483647);var i=this._buffer,n=this._length,r=Math.min(Math.max(t,0),n),o=Math.min(Math.max(e,r),n),s=new this.sec.Uint32Vector(o-r,this.fixed);return s._buffer.set(i.subarray(this._offset+r,this._offset+o),s._offset),s},$we.prototype.splice=function(t,e){var i,n=this._buffer,r=this._length,o=Math.min(Math.max(t,0),r),s=this._offset+o,a=Math.min(Math.max(e,0),r-o),l=arguments.length-2,c=new this.sec.Uint32Vector(a,this.fixed);0<a&&(i=n.subarray(s,s+a),c._buffer.set(i,c._offset)),this._ensureCapacity(r-a+l);var h=s+a,u=n.subarray(h,r);n.set(u,s+l),this._length+=l-a;for(var p=0;p<l;p++)n[s+p]=arguments[p+2];return c},$we.prototype._slide=function(t){this._buffer.set(this._view(),this._offset+t),this._offset+=t},Object.defineProperty($we.prototype,"length",{get:function(){return this._length},set:function(t){if((t>>>=0)>this._length){this._ensureCapacity(t);for(var e=this._offset+this._length,i=this._offset+t;e<i;e++)this._buffer[e]=$we.DEFAULT_VALUE}this._length=t},enumerable:!0,configurable:!0}),Object.defineProperty($we.prototype,"fixed",{get:function(){return this._fixed},set:function(t){this._fixed=!!t},enumerable:!0,configurable:!0}),$we.prototype._checkFixed=function(){this._fixed&&this.sec.throwError("RangeError",Errors$1.VectorFixedError)},$we.prototype.axGetNumericProperty=function(t){var e=this._length,i=0|t;return(i<0||e<=i||i!=t)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,e),this._buffer[this._offset+i]},$we.prototype.axSetNumericProperty=function(t,e){var i=this._length,n=0|t;(n<0||i<n||n!=t||n===i&&this._fixed)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,i),n===this._length&&(this._ensureCapacity(this._length+1),this._length++),this._buffer[this._offset+n]=e},$we.prototype.axHasPropertyInternal=function(t){if((0|t.name)===t.name)return 0<=t.name&&t.name<this._length;var e=axCoerceName(t.name);if(t.isRuntimeName()&&isIndex(e)){var i=e>>>0;return 0<=i&&i<this._length}return this.axResolveMultiname(t)in this},$we.prototype.axNextValue=function(t){return this._buffer[this._offset+t-1]},$we.prototype.axNextNameIndex=function(t){var e=t+1;return e<=this._length?e:0},$we.EXTRA_CAPACITY=4,$we.INITIAL_CAPACITY=10,$we.DEFAULT_VALUE=0,$we.DESCENDING=2,$we.UNIQUESORT=4,$we.RETURNINDEXEDARRAY=8,$we),Float64Vector=(tze=BaseVector,__extends(uze,tze),uze.classInitializer=function(){var t=this.dPrototype,e=this.tPrototype;e.axGetProperty=t.axGetProperty,e.axGetNumericProperty=t.axGetNumericProperty,e.axSetProperty=t.axSetProperty,e.axSetNumericProperty=t.axSetNumericProperty,e.axHasPropertyInternal=t.axHasPropertyInternal,e.axNextName=t.axNextName,e.axNextNameIndex=t.axNextNameIndex,e.axNextValue=t.axNextValue,t.axGetProperty=ASObject.prototype.axGetProperty,t.axGetNumericProperty=ASObject.prototype.axGetNumericProperty,t.axSetProperty=ASObject.prototype.axSetProperty,t.axSetNumericProperty=ASObject.prototype.axSetNumericProperty,t.axHasPropertyInternal=ASObject.prototype.axHasPropertyInternal,t.axNextName=ASObject.prototype.axNextName,t.axNextNameIndex=ASObject.prototype.axNextNameIndex,t.axNextValue=ASObject.prototype.axNextValue;var i=uze.prototype;defineNonEnumerableProperty(t,"$Bgjoin",i.join),defineNonEnumerableProperty(t,"$BgtoString",i.join),defineNonEnumerableProperty(t,"$BgtoLocaleString",i.toLocaleString),defineNonEnumerableProperty(t,"$Bgpop",i.pop),defineNonEnumerableProperty(t,"$Bgpush",i.push),defineNonEnumerableProperty(t,"$Bgreverse",i.reverse),defineNonEnumerableProperty(t,"$Bgconcat",i.concat),defineNonEnumerableProperty(t,"$Bgsplice",i.splice),defineNonEnumerableProperty(t,"$Bgslice",i.slice),defineNonEnumerableProperty(t,"$Bgshift",i.shift),defineNonEnumerableProperty(t,"$Bgunshift",i.unshift),defineNonEnumerableProperty(t,"$BgindexOf",i.indexOf),defineNonEnumerableProperty(t,"$BglastIndexOf",i.lastIndexOf),defineNonEnumerableProperty(t,"$BgforEach",i.forEach),defineNonEnumerableProperty(t,"$Bgmap",i.map),defineNonEnumerableProperty(t,"$Bgfilter",i.filter),defineNonEnumerableProperty(t,"$Bgsome",i.some),defineNonEnumerableProperty(t,"$Bgevery",i.every),defineNonEnumerableProperty(t,"$Bgsort",i.sort),defineNonEnumerableProperty(t,"checkVectorMethodArgs",i.checkVectorMethodArgs)},uze.axApply=function(t,e){var i=e[0];if(this.axIsType(i))return i;var n=i.axGetPublicProperty("length");if(void 0!==n){for(var r=this.axConstruct([n,!1]),o=0;o<n;o++)r.axSetNumericProperty(o,i.axGetPublicProperty(o));return r}unexpected()},uze.prototype.internalToString=function(){for(var t="",e=this._offset,i=e+this._length,n=0;n<this._buffer.length;n++)n===e&&(t+="["),n===i&&(t+="]"),t+=this._buffer[n],n<this._buffer.length-1&&(t+=",");return this._offset+this._length===this._buffer.length&&(t+="]"),t+": offset: "+this._offset+", length: "+this._length+", capacity: "+this._buffer.length},uze.prototype.toString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},uze.prototype.toLocaleString=function(){for(var t="",e=0;e<this._length;e++)t+=this._buffer[this._offset+e],e<this._length-1&&(t+=",");return t},uze.prototype._view=function(){return this._buffer.subarray(this._offset,this._offset+this._length)},uze.prototype._ensureCapacity=function(t){var e=this._offset+t;if(!(e<this._buffer.length)){if(t<=this._buffer.length){var i=this._buffer.length-t>>2;return this._buffer.set(this._view(),i),void(this._offset=i)}var n=1+(3*this._buffer.length>>1);n<e&&(n=e);var r=new Float64Array(n);r.set(this._buffer,0),this._buffer=r}},uze.prototype.concat=function(){for(var t=this._length,e=0;e<arguments.length;e++)(r=arguments[e])._buffer instanceof Float64Array||assert(!1),t+=r._length;var i=new this.sec.Float64Vector(t),n=i._buffer;n.set(this._buffer);for(var r,o=this._length,e=0;e<arguments.length;e++)o+(r=arguments[e])._buffer.length<r._buffer.length?n.set(r._buffer,o):n.set(r._buffer.subarray(0,r._length),o),o+=r._length;return i},uze.prototype.every=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!0;for(var i=0;i<this._length;i++)if(!t.call(e,this._buffer[this._offset+i],i,this))return!1;return!0},uze.prototype.filter=function(t,e){var i=new this.sec.Float64Vector;if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)t.call(e,this._buffer[this._offset+n],n,this)&&i.push(this._buffer[this._offset+n]);return i},uze.prototype.map=function(t,e){var i=this.axClass.axConstruct([this.length,!1]);if(!this.checkVectorMethodArgs(t,e))return i;for(var n=0;n<this._length;n++)i[n]=t.call(e,this._buffer[this._offset+n],n,this);return i},uze.prototype.some=function(t,e){if(!this.checkVectorMethodArgs(t,e))return!1;for(var i=0;i<this._length;i++)if(t.call(e,this._buffer[this._offset+i],i,this))return!0;return!1},uze.prototype.forEach=function(t,e){if(this.checkVectorMethodArgs(t,e))for(var i=0;i<this._length;i++)t.call(e,this._buffer[this._offset+i],i,this)},uze.prototype.join=function(t){void 0===t&&(t=",");for(var e=this.length,i=this._buffer,n=this._offset,r="",o=0;o<e-1;o++)r+=i[n+o]+t;return 0<e&&(r+=i[n+e-1]),r},uze.prototype.indexOf=function(t,e){void 0===e&&(e=0);var i=this._length,n=0|e;if(n<0)(n+=i)<0&&(n=0);else if(i<=n)return-1;for(var r=this._buffer,o=(i=this._length,this._offset),s=o+i,a=n+=o;a<s;a++)if(r[a]===t)return a-o;return-1},uze.prototype.lastIndexOf=function(t,e){void 0===e&&(e=2147483647);var i=this._length,n=0|e;if(n<0){if((n+=i)<0)return-1}else i<=n&&(n=i);for(var r=this._buffer,o=this._offset,s=o,a=n+=o;a-- >s;)if(r[a]===t)return a-o;return-1},uze.prototype.push=function(t,e,i,n,r,o,s,a){this._checkFixed(),this._ensureCapacity(this._length+arguments.length);for(var l=0;l<arguments.length;l++)this._buffer[this._offset+this._length++]=arguments[l]},uze.prototype.pop=function(){return this._checkFixed(),0===this._length?uze.DEFAULT_VALUE:(this._length--,this._buffer[this._offset+this._length])},uze.prototype.reverse=function(){for(var t=this._offset,e=this._offset+this._length-1,i=this._buffer;t<e;){var n=i[t];i[t]=i[e],i[e]=n,t++,e--}return this},uze.prototype.sort=function(t){return 0===arguments.length?Array.prototype.sort.call(this._view()):this.sec.AXFunction.axIsType(t)?Array.prototype.sort.call(this._view(),t.value):(0|t)&uze.DESCENDING?Array.prototype.sort.call(this._view(),function(t,e){return e-t}):Array.prototype.sort.call(this._view(),function(t,e){return t-e}),this},uze.prototype.shift=function(){return this._checkFixed(),0===this._length?0:(this._length--,this._buffer[this._offset++])},uze.prototype.unshift=function(){if(this._checkFixed(),arguments.length){this._ensureCapacity(this._length+arguments.length),this._slide(arguments.length),this._offset-=arguments.length,this._length+=arguments.length;for(var t=0;t<arguments.length;t++)this._buffer[this._offset+t]=arguments[t]}},uze.prototype.slice=function(t,e){void 0===t&&(t=0),void 0===e&&(e=2147483647);var i=this._buffer,n=this._length,r=Math.min(Math.max(t,0),n),o=Math.min(Math.max(e,r),n),s=new this.sec.Float64Vector(o-r,this.fixed);return s._buffer.set(i.subarray(this._offset+r,this._offset+o),s._offset),s},uze.prototype.splice=function(t,e){var i,n=this._buffer,r=this._length,o=Math.min(Math.max(t,0),r),s=this._offset+o,a=Math.min(Math.max(e,0),r-o),l=arguments.length-2,c=new this.sec.Float64Vector(a,this.fixed);0<a&&(i=n.subarray(s,s+a),c._buffer.set(i,c._offset)),this._ensureCapacity(r-a+l);var h=s+a,u=n.subarray(h,r);n.set(u,s+l),this._length+=l-a;for(var p=0;p<l;p++)n[s+p]=arguments[p+2];return c},uze.prototype._slide=function(t){this._buffer.set(this._view(),this._offset+t),this._offset+=t},Object.defineProperty(uze.prototype,"length",{get:function(){return this._length},set:function(t){if((t>>>=0)>this._length){this._ensureCapacity(t);for(var e=this._offset+this._length,i=this._offset+t;e<i;e++)this._buffer[e]=uze.DEFAULT_VALUE}this._length=t},enumerable:!0,configurable:!0}),Object.defineProperty(uze.prototype,"fixed",{get:function(){return this._fixed},set:function(t){this._fixed=!!t},enumerable:!0,configurable:!0}),uze.prototype._checkFixed=function(){this._fixed&&this.sec.throwError("RangeError",Errors$1.VectorFixedError)},uze.prototype.axGetNumericProperty=function(t){var e=this._length,i=0|t;return(i<0||e<=i||i!=t)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,e),this._buffer[this._offset+i]},uze.prototype.axSetNumericProperty=function(t,e){var i=this._length,n=0|t;(n<0||i<n||n!=t||n===i&&this._fixed)&&this.sec.throwError("RangeError",Errors$1.OutOfRangeError,t,i),n===this._length&&(this._ensureCapacity(this._length+1),this._length++),this._buffer[this._offset+n]=e},uze.prototype.axHasPropertyInternal=function(t){if((0|t.name)===t.name)return 0<=t.name&&t.name<this._length;var e=axCoerceName(t.name);if(t.isRuntimeName()&&isIndex(e)){var i=e>>>0;return 0<=i&&i<this._length}return this.axResolveMultiname(t)in this},uze.prototype.axNextValue=function(t){return this._buffer[this._offset+t-1]},uze.prototype.axNextNameIndex=function(t){var e=t+1;return e<=this._length?e:0},uze.EXTRA_CAPACITY=4,uze.INITIAL_CAPACITY=10,uze.DEFAULT_VALUE=0,uze.DESCENDING=2,uze.UNIQUESORT=4,uze.RETURNINDEXEDARRAY=8,uze),ASMath=(PBe=ASObject,__extends(QBe,PBe),QBe.classNatives=[Math],QBe.classInitializer=function(){defineNonEnumerableProperty(this,"$BgE",Math.E),defineNonEnumerableProperty(this,"$BgLN10",Math.LN10),defineNonEnumerableProperty(this,"$BgLN2",Math.LN2),defineNonEnumerableProperty(this,"$BgLOG10E",Math.LOG10E),defineNonEnumerableProperty(this,"$BgLOG2E",Math.LOG2E),defineNonEnumerableProperty(this,"$BgPI",Math.PI),defineNonEnumerableProperty(this,"$BgSQRT1_2",Math.SQRT2),defineNonEnumerableProperty(this,"$BgSQRT2",Math.SQRT2)},QBe),ASRegExp=(RBe=ASObject,__extends(SBe,RBe),SBe.classInitializer=function(){var t=this.dPrototype,e=SBe.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.ecmaToString),addPrototypeFunctionAlias(t,"$Bgexec",e.exec),addPrototypeFunctionAlias(t,"$Bgtest",e.test)},SBe.prototype._parse=function(t){for(var e="",i=this._captureNames,n=[],r=0,o=0;o<t.length;o++){var s=t[o];switch(s){case"(":if(e+=s,n.push(1<r?r-1:r),r=0,"?"===t[o+1])switch(t[o+2]){case":":case"=":case"!":e+="?"+t[o+2],o+=2;break;default:if(!/\(\?P<([\w$]+)>/.exec(t.substr(o)))return SBe.UNMATCHABLE_PATTERN;var a=RegExp.$1;"length"!==a&&i.push(a),i.indexOf(a),o+=RegExp.lastMatch.length-1}else i.push(null);if(406<i.length)return SBe.UNMATCHABLE_PATTERN;break;case")":if(!n.length)return SBe.UNMATCHABLE_PATTERN;e+=s,r=n.pop()+1;break;case"|":e+=s;break;case"\\":e+=s,/\\|c[A-Z]|x[0-9,a-z,A-Z]{2}|u[0-9,a-z,A-Z]{4}|./.exec(t.substr(o+1))&&(e+=RegExp.lastMatch,o+=RegExp.lastMatch.length),r<=1&&r++;break;case"[":if(!/\[[^\]]*\]/.exec(t.substr(o)))return SBe.UNMATCHABLE_PATTERN;e+=RegExp.lastMatch,o+=RegExp.lastMatch.length-1,r<=1&&r++;break;case"{":if(!/\{[^\{]*?(?:,[^\{]*?)?\}/.exec(t.substr(o)))return SBe.UNMATCHABLE_PATTERN;e+=RegExp.lastMatch,o+=RegExp.lastMatch.length-1;break;case".":this._dotall?e+="[\\s\\S]":e+=s,r<=1&&r++;break;case"?":case"*":case"+":if(!r)return SBe.UNMATCHABLE_PATTERN;e+=s,"?"===t[o+1]&&(o++,e+="?");break;case" ":if(this._extended)break;default:e+=s,r<=1&&r++}if(32767<e.length)return SBe.UNMATCHABLE_PATTERN}return n.length?SBe.UNMATCHABLE_PATTERN:e},SBe.prototype.ecmaToString=function(){var t="/"+this._source+"/";return this.value.global&&(t+="g"),this.value.ignoreCase&&(t+="i"),this.value.multiline&&(t+="m"),this._dotall&&(t+="s"),this._extended&&(t+="x"),t},SBe.prototype.axCall=function(t){return this.exec.apply(this,arguments)},SBe.prototype.axApply=function(t,e){return this.exec.apply(this,e)},Object.defineProperty(SBe.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"global",{get:function(){return this.value.global},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"ignoreCase",{get:function(){return this.value.ignoreCase},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"multiline",{get:function(){return this.value.multiline},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"lastIndex",{get:function(){return this.value.lastIndex},set:function(t){this.value.lastIndex=t},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"dotall",{get:function(){return this._dotall},enumerable:!0,configurable:!0}),Object.defineProperty(SBe.prototype,"extended",{get:function(){return this._extended},enumerable:!0,configurable:!0}),SBe.prototype.exec=function(t){void 0===t&&(t="");var e=this.value.exec(t);if(!e)return null;var i=transformJStoASRegExpMatchArray(this.sec,e),n=this._captureNames;if(n){for(var r=0;r<n.length;r++){var o,s=n[r];null!==s&&(o=e[r+1]||"",e[s]=o,i.axSetPublicProperty(s,o))}return i}},SBe.prototype.test=function(t){return void 0===t&&(t=""),null!==this.exec(t)},SBe.UNMATCHABLE_PATTERN="^(?!)$",SBe),RBe,PBe,tze,Zwe,Due,tse,qse,bse;function SBe(t,e){var i,n=RBe.call(this)||this;if(n._dotall=!1,n._extended=!1,n._captureNames=[],void 0===t)t=i="";else if(n.sec.AXRegExp.axIsType(t))e&&n.sec.throwError("TypeError",Errors$1.RegExpFlagsArgumentError),i=t.source,t=t.value;else{if(i=(t=String(t)).replace(/(^|^[\/]|(?:\\\\)+)\//g,"$1\\/"),e){var r=e;e="";for(var o=0;o<r.length;o++){var s=r[o];switch(s){case"s":n._dotall=!0;break;case"x":n._extended=!0;break;case"g":case"i":case"m":e+=s}}}t=n._parse(i)}try{n.value=new RegExp(t,e)}catch(t){n.value=new RegExp(SBe.UNMATCHABLE_PATTERN,e)}return n._source=i,n}function QBe(){return null!==PBe&&PBe.apply(this,arguments)||this}function uze(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=tze.call(this)||this;return t>>>=0,i._fixed=!!e,i._buffer=new Float64Array(Math.max(uze.INITIAL_CAPACITY,t+uze.EXTRA_CAPACITY)),i._offset=0,i._length=t,i}function $we(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=Zwe.call(this)||this;return t>>>=0,i._fixed=!!e,i._buffer=new Uint32Array(Math.max($we.INITIAL_CAPACITY,t+$we.EXTRA_CAPACITY)),i._offset=0,i._length=t,i}function Eue(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=Due.call(this)||this;return t>>>=0,i._fixed=!!e,i._buffer=new Int32Array(Math.max(Eue.INITIAL_CAPACITY,t+Eue.EXTRA_CAPACITY)),i._offset=0,i._length=t,i}function use(t,e){void 0===t&&(t=0),void 0===e&&(e=!1);var i=tse.call(this)||this;return t>>>=0,e=!!e,i._fixed=!!e,i._buffer=new Array(t),i._fill(0,t,i.axClass.defaultValue),i}function rse(){return null!==qse&&qse.apply(this,arguments)||this}function cse(){return null!==bse&&bse.apply(this,arguments)||this}function transformJSValueToAS(t,e,i){if("object"!=typeof e)return e;if(isNullOrUndefined(e))return e;if(Array.isArray(e)){for(var n=[],r=0;r<e.length;r++){var o=e[r],s=i?transformJSValueToAS(t,o,!0):o;n.push(s)}return t.createArray(n)}return t.createObjectFromJS(e,i)}function transformASValueToJS(t,e,i){if("object"!=typeof e)return e;if(isNullOrUndefined(e))return e;if(t.AXArray.axIsType(e)){for(var n=[],r=e.value,o=0;o<r.length;o++){var s=r[o],a=i?transformASValueToJS(t,s,!0):s;n.push(a)}return n}for(var l=Object.keys(e),c={},o=0;o<l.length;o++){var h=l[o],u=h;isNumeric(h)||(u=h.substr(3));var p=e[h];i&&(p=transformASValueToJS(t,p,!0)),c[u]=p}return c}function walk(t,e,i,n){var r,o=e[i];if(Array.isArray(o))for(var s=o,a=0,l=s.length;a<l;a++)void 0===(r=walk(t,s,axCoerceString$2(a),n))?delete s[a]:s[a]=r;else if(null!==o&&"boolean"!=typeof o&&"number"!=typeof o&&"string"!=typeof o)for(var c in o){if(!o.hasOwnProperty(c)||!Multiname.isPublicQualifiedName(c))break;void 0===(r=walk(t,o,c,n))?delete o[c]:o[c]=r}return n.call(e,i,o)}var ASJSON=($Ce=ASObject,__extends(_Ce,$Ce),_Ce.parse=function(t,e){void 0===e&&(e=null),t=axCoerceString$2(t),null===e||axIsCallable(e)||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,e,"Function"),null===t&&this.sec.throwError("SyntaxError",Errors$1.JSONInvalidParseInput);try{var i=transformJSValueToAS(this.sec,JSON.parse(t),!0)}catch(t){this.sec.throwError("SyntaxError",Errors$1.JSONInvalidParseInput)}return null===e?i:walk(this.sec,{"":i},"",e.value)},_Ce.stringify=function(t,e,i){var n,r;return void 0===e&&(e=null),void 0===i&&(i=null),null!==e&&((n="object"==typeof e?e.sec:null)&&(n.AXFunction.axIsType(e)||n.AXArray.axIsType(e))||this.sec.throwError("TypeError",Errors$1.JSONInvalidReplacer)),r="string"==typeof i?10<i.length?i.substring(0,10):i:"number"==typeof i?" ".substring(0,Math.min(10,0|i)):"",null===e?this.stringifySpecializedToString(t,null,null,r):n.AXArray.axIsType(e)?this.stringifySpecializedToString(t,this.computePropertyList(e.value),null,r):this.stringifySpecializedToString(t,null,e.value,r)},_Ce.computePropertyList=function(t){for(var e,i,n=[],r=Object.create(null),o=0,s=t.length;o<s;o++)t.hasOwnProperty(o)&&(i=null,"string"==typeof(e=t[o])?i=e:"number"==typeof e&&(i=axCoerceString$2(e)),null===i||r[i]||(r[i]=!0,n.push(i)));return n},_Ce.stringifySpecializedToString=function(t,e,i,n){try{return void 0===t?"null":JSON.stringify(transformASValueToJS(this.sec,t,!0),i,n)}catch(t){this.sec.throwError("TypeError",Errors$1.JSONCyclicStructure)}},_Ce),$Ce;function _Ce(){return null!==$Ce&&$Ce.apply(this,arguments)||this}function getCurrentABC(){return 0===scopeStacks.length?null:scopeStacks[scopeStacks.length-1].topScope().global.object.scriptInfo.abc}function FlashUtilScript_getDefinitionByName(t,e){var i=String(e).replace("::",".");return getCurrentABC().env.app.getClass(Multiname.FromFQNString(i,0))}function FlashUtilScript_getTimer(t){return Date.now()-AVMStage.runtimeStartTime}function FlashNetScript_navigateToURL(t,e,i){null==e&&t.throwError("TypeError",Errors$1.NullPointerError,"request"),t.flash.net.URLRequest.axClass.axIsType(e)||t.throwError("TypeError",Errors$1.CheckTypeFailedError,e,"flash.net.URLRequest");var n=e.url;isNullOrUndefined(n)&&t.throwError("TypeError",Errors$1.NullPointerError,"url"),0!==n.toLowerCase().indexOf("fscommand:")?window.open(e.url,"_blank"):(0,t.flash.system.fscommand.value)(t,n.substring("fscommand:".length),i)}function FlashNetScript_sendToURL(t,e){isNullOrUndefined(e)&&t.throwError("TypeError",Errors$1.NullPointerError,"request"),t.flash.net.URLRequest.axClass.axIsType(e)||t.throwError("TypeError",Errors$1.CheckTypeFailedError,e,"flash.net.URLRequest"),console.log("TODO: FlashNetScript_sendToURL: FileLoadingService")}function wrapJSGlobalFunction(n){return function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];return n.apply(jsGlobal,e)}}function Toplevel_registerClassAlias(t,e,i){(e=axCoerceString$2(e))||t.throwError("TypeError",Errors$1.NullPointerError,"aliasName"),i||t.throwError("TypeError",Errors$1.NullPointerError,"classObject"),t.classAliases.registerClassAlias(e,i)}function Toplevel_getClassByAlias(t,e){(e=axCoerceString$2(e))||t.throwError("TypeError",Errors$1.NullPointerError,"aliasName");var i=t.classAliases.getClassByAlias(e);return i||t.throwError("ReferenceError",Errors$1.ClassNotFoundError,e),i}var nativeFunctions=ObjectUtilities.createMap(),ASDate=(NDe=ASObject,__extends(ODe,NDe),ODe.classInitializer=function(){var t=this.dPrototype,e=ODe.prototype;addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toString),addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf),addPrototypeFunctionAlias(t,"$BgtoDateString",e.toDateString),addPrototypeFunctionAlias(t,"$BgtoTimeString",e.toTimeString),addPrototypeFunctionAlias(t,"$BgtoLocaleString",e.toLocaleString),addPrototypeFunctionAlias(t,"$BgtoLocaleDateString",e.toLocaleDateString),addPrototypeFunctionAlias(t,"$BgtoLocaleTimeString",e.toLocaleTimeString),addPrototypeFunctionAlias(t,"$BgtoUTCString",e.toUTCString),addPrototypeFunctionAlias(t,"$BgtoJSON",e.toJSON),addPrototypeFunctionAlias(t,"$BggetUTCFullYear",e.getUTCFullYear),addPrototypeFunctionAlias(t,"$BggetUTCMonth",e.getUTCMonth),addPrototypeFunctionAlias(t,"$BggetUTCDate",e.getUTCDate),addPrototypeFunctionAlias(t,"$BggetUTCDay",e.getUTCDay),addPrototypeFunctionAlias(t,"$BggetUTCHours",e.getUTCHours),addPrototypeFunctionAlias(t,"$BggetUTCMinutes",e.getUTCMinutes),addPrototypeFunctionAlias(t,"$BggetUTCSeconds",e.getUTCSeconds),addPrototypeFunctionAlias(t,"$BggetUTCMilliseconds",e.getUTCMilliseconds),addPrototypeFunctionAlias(t,"$BggetFullYear",e.getFullYear),addPrototypeFunctionAlias(t,"$BggetMonth",e.getMonth),addPrototypeFunctionAlias(t,"$BggetDate",e.getDate),addPrototypeFunctionAlias(t,"$BggetDay",e.getDay),addPrototypeFunctionAlias(t,"$BggetHours",e.getHours),addPrototypeFunctionAlias(t,"$BggetMinutes",e.getMinutes),addPrototypeFunctionAlias(t,"$BggetSeconds",e.getSeconds),addPrototypeFunctionAlias(t,"$BggetMilliseconds",e.getMilliseconds),addPrototypeFunctionAlias(t,"$BggetTimezoneOffset",e.getTimezoneOffset),addPrototypeFunctionAlias(t,"$BggetTime",e.getTime),addPrototypeFunctionAlias(t,"$BgsetFullYear",e.setFullYear),addPrototypeFunctionAlias(t,"$BgsetMonth",e.setMonth),addPrototypeFunctionAlias(t,"$BgsetDate",e.setDate),addPrototypeFunctionAlias(t,"$BgsetHours",t.setHours),addPrototypeFunctionAlias(t,"$BgsetMinutes",e.setMinutes),addPrototypeFunctionAlias(t,"$BgsetSeconds",e.setSeconds),addPrototypeFunctionAlias(t,"$BgsetMilliseconds",e.setMilliseconds),addPrototypeFunctionAlias(t,"$BgsetUTCFullYear",e.setUTCFullYear),addPrototypeFunctionAlias(t,"$BgsetUTCMonth",e.setUTCMonth),addPrototypeFunctionAlias(t,"$BgsetUTCDate",e.setUTCDate),addPrototypeFunctionAlias(t,"$BgsetUTCHours",e.setUTCHours),addPrototypeFunctionAlias(t,"$BgsetUTCMinutes",e.setUTCMinutes),addPrototypeFunctionAlias(t,"$BgsetUTCSeconds",e.setUTCSeconds),addPrototypeFunctionAlias(t,"$BgsetUTCMilliseconds",e.setUTCMilliseconds)},ODe.parse=function(t){return Date.parse(t)},ODe.UTC=function(t,e,i,n,r,o,s){return void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),Date.parse.apply(null,arguments)},ODe.axCoerce=function(t){return this.axConstruct([t])},ODe.prototype.toString=function(){if(!(this.value instanceof Date))return"Invalid Date";var t=this.value.toString().split(" ");return t.length<4?"Invalid Date":(t.length=6,t.push(t.splice(3,1)[0]),"0"===t[2][0]&&(t[2]=t[2][1]),t.join(" "))},ODe.prototype.toDateString=function(){if(!(this.value instanceof Date))return"Invalid Date";var t=this.value.toDateString().split(" ");return t.length<4?"Invalid Date":("0"===t[2][0]&&(t[2]=t[2][1]),t.join(" "))},ODe.prototype.toJSON=function(){return this.value instanceof Date?this.value.toString():"Invalid Date"},ODe.prototype.valueOf=function(){return this.value instanceof Date?this.value.valueOf():NaN},ODe.prototype.setTime=function(t){return void 0===t&&(t=0),this.value instanceof Date?this.value.setTime(t):NaN},ODe.prototype.toTimeString=function(){return this.value instanceof Date?this.value.toTimeString():"Invalid Date"},ODe.prototype.toLocaleString=function(){return this.value instanceof Date?this.value.toLocaleString():"Invalid Date"},ODe.prototype.toLocaleDateString=function(){return this.value instanceof Date?this.value.toLocaleDateString():"Invalid Date"},ODe.prototype.toLocaleTimeString=function(){return this.value instanceof Date?this.value.toLocaleTimeString():"Invalid Date"},ODe.prototype.toUTCString=function(){return this.value instanceof Date?this.value.toUTCString():"Invalid Date"},ODe.prototype.getUTCFullYear=function(){return this.value instanceof Date?this.value.getUTCFullYear():NaN},ODe.prototype.getUTCMonth=function(){return this.value instanceof Date?this.value.getUTCMonth():NaN},ODe.prototype.getUTCDate=function(){return this.value instanceof Date?this.value.getUTCDate():NaN},ODe.prototype.getUTCDay=function(){return this.value instanceof Date?this.value.getUTCDay():NaN},ODe.prototype.getUTCHours=function(){return this.value instanceof Date?this.value.getUTCHours():NaN},ODe.prototype.getUTCMinutes=function(){return this.value instanceof Date?this.value.getUTCMinutes():NaN},ODe.prototype.getUTCSeconds=function(){return this.value instanceof Date?this.value.getUTCSeconds():NaN},ODe.prototype.getUTCMilliseconds=function(){return this.value instanceof Date?this.value.getUTCMilliseconds():NaN},ODe.prototype.getFullYear=function(){return this.value instanceof Date?this.value.getFullYear():NaN},ODe.prototype.getMonth=function(){return this.value instanceof Date?this.value.getMonth():NaN},ODe.prototype.getDate=function(){return this.value instanceof Date?this.value.getDate():NaN},ODe.prototype.getDay=function(){return this.value instanceof Date?this.value.getDay():NaN},ODe.prototype.getHours=function(){return this.value instanceof Date?this.value.getHours():NaN},ODe.prototype.getMinutes=function(){return this.value instanceof Date?this.value.getMinutes():NaN},ODe.prototype.getSeconds=function(){return this.value instanceof Date?this.value.getSeconds():NaN},ODe.prototype.getMilliseconds=function(){return this.value instanceof Date?this.value.getMilliseconds():NaN},ODe.prototype.getTimezoneOffset=function(){return this.value instanceof Date?this.value.getTimezoneOffset():NaN},ODe.prototype.getTime=function(){return this.value instanceof Date?this.value.getTime():NaN},ODe.prototype.setFullYear=function(t,e,i){return this.value instanceof Date?this.value.setFullYear.apply(this.value,arguments):NaN},ODe.prototype.setMonth=function(t,e){return this.value instanceof Date?this.value.setMonth.apply(this.value,arguments):NaN},ODe.prototype.setDate=function(t){return this.value instanceof Date?this.value.setDate.apply(this.value,arguments):NaN},ODe.prototype.setHours=function(t,e,i,n){return this.value instanceof Date?this.value.setHours.apply(this.value,arguments):NaN},ODe.prototype.setMinutes=function(t,e,i){return this.value instanceof Date?this.value.setMinutes.apply(this.value,arguments):NaN},ODe.prototype.setSeconds=function(t,e){return this.value instanceof Date?this.value.setSeconds.apply(this.value,arguments):NaN},ODe.prototype.setMilliseconds=function(t){return this.value instanceof Date?this.value.setMilliseconds.apply(this.value,arguments):NaN},ODe.prototype.setUTCFullYear=function(t,e,i){return this.value instanceof Date?this.value.setUTCFullYear.apply(this.value,arguments):NaN},ODe.prototype.setUTCMonth=function(t,e){return this.value instanceof Date?this.value.setUTCMonth.apply(this.value,arguments):NaN},ODe.prototype.setUTCDate=function(t){return this.value instanceof Date?this.value.setUTCDate.apply(this.value,arguments):NaN},ODe.prototype.setUTCHours=function(t,e,i,n){return this.value instanceof Date?this.value.setUTCHours.apply(this.value,arguments):NaN},ODe.prototype.setUTCMinutes=function(t,e,i){return this.value instanceof Date?this.value.setUTCMinutes.apply(this.value,arguments):NaN},ODe.prototype.setUTCSeconds=function(t,e){return this.value instanceof Date?this.value.setUTCSeconds.apply(this.value,arguments):NaN},ODe.prototype.setUTCMilliseconds=function(t){return this.value instanceof Date?this.value.setUTCMilliseconds.apply(this.value,arguments):NaN},Object.defineProperty(ODe.prototype,"fullYear",{get:function(){return this.value.getFullYear()},set:function(t){this.value.setFullYear(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"month",{get:function(){return this.value.getMonth()},set:function(t){this.value.setMonth(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"date",{get:function(){return this.value.getDate()},set:function(t){this.value.setDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"hours",{get:function(){return this.value.getHours()},set:function(t){this.value.setHours(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"minutes",{get:function(){return this.value.getMinutes()},set:function(t){this.value.setMinutes(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"seconds",{get:function(){return this.value.getSeconds()},set:function(t){this.value.setSeconds(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"milliseconds",{get:function(){return this.value.getMilliseconds()},set:function(t){this.value.setMilliseconds(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"fullYearUTC",{get:function(){return this.value.getUTCFullYear()},set:function(t){this.value.setUTCFullYear(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"monthUTC",{get:function(){return this.value.getUTCMonth()},set:function(t){this.value.setUTCMonth(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"dateUTC",{get:function(){return this.value.getUTCDate()},set:function(t){this.value.setUTCDate(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"hoursUTC",{get:function(){return this.value.getUTCHours()},set:function(t){this.value.setUTCHours(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"minutesUTC",{get:function(){return this.value.getUTCMinutes()},set:function(t){this.value.setUTCMinutes(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"secondsUTC",{get:function(){return this.value.getUTCSeconds()},set:function(t){this.value.setUTCSeconds(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"millisecondsUTC",{get:function(){return this.value.getUTCMilliseconds()},set:function(t){this.value.setUTCMilliseconds(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"time",{get:function(){return this.value.getTime()},set:function(t){this.value.setTime(t)},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"timezoneOffset",{get:function(){return this.value.getTimezoneOffset()},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"day",{get:function(){return this.value.getDay()},enumerable:!0,configurable:!0}),Object.defineProperty(ODe.prototype,"dayUTC",{get:function(){return this.value.getUTCDay()},enumerable:!0,configurable:!0}),ODe),proxyNamespace=internNamespace(0,"http://www.adobe.com/2006/actionscript/flash/proxy"),proxyPrefix="$"+proxyNamespace.mangledName,ASProxy=(cFe=ASObject,__extends(dFe,cFe),dFe.classInitializer=function(){var t=this.dPrototype,e=dFe.prototype;defineNonEnumerableProperty(t,proxyPrefix+"getProperty",e.native_getProperty),defineNonEnumerableProperty(t,proxyPrefix+"setProperty",e.native_setProperty),defineNonEnumerableProperty(t,proxyPrefix+"callProperty",e.native_callProperty),defineNonEnumerableProperty(t,proxyPrefix+"hasProperty",e.native_hasProperty),defineNonEnumerableProperty(t,proxyPrefix+"deleteProperty",e.native_deleteProperty),defineNonEnumerableProperty(t,proxyPrefix+"getDescendants",e.native_getDescendants),defineNonEnumerableProperty(t,proxyPrefix+"nextNameIndex",e.native_nextNameIndex),defineNonEnumerableProperty(t,proxyPrefix+"nextName",e.native_nextName),defineNonEnumerableProperty(t,proxyPrefix+"nextValue",e.native_nextValue)},dFe.prototype.native_getProperty=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyGetPropertyError)},dFe.prototype.native_setProperty=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxySetPropertyError)},dFe.prototype.native_callProperty=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyCallPropertyError)},dFe.prototype.native_hasProperty=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyHasPropertyError)},dFe.prototype.native_deleteProperty=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyDeletePropertyError)},dFe.prototype.native_getDescendants=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyGetDescendantsError)},dFe.prototype.native_nextNameIndex=function(){this!==this.axClass.dPrototype&&this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyNextNameIndexError)},dFe.prototype.native_nextName=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyNextNameError)},dFe.prototype.native_nextValue=function(){this.sec.throwError("flash.errors.IllegalOperationError",Errors$1.ProxyNextValueError)},dFe.prototype.axGetProperty=function(t){var e,i="string"==typeof t.name?this.traits.getTrait(t.namespaces,t.name):null;if(i){var n=i.name.getMangledName();if("function"==typeof(e=this[n]))return this.axGetMethod(n)}else e=this[proxyPrefix+"getProperty"](this.sec.AXQName.FromMultiname(t));return e},dFe.prototype.axGetNumericProperty=function(t){return this[proxyPrefix+"getProperty"](+t+"")},dFe.prototype.axSetNumericProperty=function(t,e){this[proxyPrefix+"setProperty"](+t+"",e)},dFe.prototype.axSetProperty=function(t,e,i){"string"==typeof t.name&&this.traits.getTrait(t.namespaces,t.name)?cFe.prototype.axSetProperty.call(this,t,e,i):this[proxyPrefix+"setProperty"](this.sec.AXQName.FromMultiname(t),e)},dFe.prototype.axCallProperty=function(t,e,i){if("string"==typeof t.name&&this.traits.getTrait(t.namespaces,t.name))return cFe.prototype.axCallProperty.call(this,t,e,i);var n=[this.sec.AXQName.FromMultiname(t)].concat(e);return this[proxyPrefix+"callProperty"].apply(this,n)},dFe.prototype.axHasProperty=function(t){return this.axHasOwnProperty(t)},dFe.prototype.axHasPublicProperty=function(t){return rn$1.name=t,!!this.axHasPropertyInternal(rn$1)||this[proxyPrefix+"hasProperty"](t)},dFe.prototype.axHasOwnProperty=function(t){return!("string"!=typeof t.name||!this.traits.getTrait(t.namespaces,t.name))||this[proxyPrefix+"hasProperty"](this.sec.AXQName.FromMultiname(t))},dFe.prototype.axDeleteProperty=function(t){var e="string"==typeof t.name?this.traits.getTrait(t.namespaces,t.name):null;return e?delete this[e.name.getMangledName()]:this[proxyPrefix+"deleteProperty"](this.sec.AXQName.FromMultiname(t))},dFe.prototype.axNextName=function(t){return this[proxyPrefix+"nextName"](t)},dFe.prototype.axNextValue=function(t){return this[proxyPrefix+"nextValue"](t)},dFe.prototype.axNextNameIndex=function(t){return this[proxyPrefix+"nextNameIndex"](t)},dFe),rn$1=new Multiname(null,0,17,[],null,null,!0),Dictionary=(CFe=ASObject,__extends(DFe,CFe),DFe.makePrimitiveKey=function(t){if("string"==typeof t||"number"==typeof t)return t},DFe.prototype.toJSON=function(){return"Dictionary"},DFe.prototype.axGetProperty=function(t){if(this===this.axClass.dPrototype)return CFe.prototype.axGetProperty.call(this,t);var e=DFe.makePrimitiveKey(t.name);return void 0!==e?this.primitiveMap[e]:this.map.get(Object(t.name))},DFe.prototype.axSetProperty=function(t,e,i){var n;this!==this.axClass.dPrototype?void 0===(n=DFe.makePrimitiveKey(t.name))?(this.map.set(Object(t.name),e),!this.weakKeys&&this.keys.indexOf(t.name)<0&&this.keys.push(t.name)):this.primitiveMap[n]=e:CFe.prototype.axSetProperty.call(this,t,e,i)},DFe.prototype.axHasPropertyInternal=function(t){if(this===this.axClass.dPrototype)return CFe.prototype.axHasProperty.call(this,t);var e=DFe.makePrimitiveKey(t.name);return void 0!==e?e in this.primitiveMap:this.map.has(Object(t.name))},DFe.prototype.axDeleteProperty=function(t){if(this===this.axClass.dPrototype)return CFe.prototype.axDeleteProperty.call(this,t);var e,i=DFe.makePrimitiveKey(t.name);return void 0!==i&&delete this.primitiveMap[i],this.map.delete(Object(t.name)),!this.weakKeys&&0<=(e=this.keys.indexOf(t.name))&&this.keys.splice(e,1),!0},DFe.prototype.axGetPublicProperty=function(t){if(this===this.axClass.dPrototype)return CFe.prototype.axGetPublicProperty.call(this,t);var e=DFe.makePrimitiveKey(t);return void 0!==e?this.primitiveMap[e]:this.map.get(Object(t))},DFe.prototype.axGetEnumerableKeys=function(){if(this===this.axClass.dPrototype)return CFe.prototype.axGetEnumerableKeys.call(this);var t=[];for(var e in this.primitiveMap)t.push(e);return this.weakKeys?t:this.keys?t.concat(this.keys):t.slice()},DFe.classInitializer=function(){addPrototypeFunctionAlias(this.dPrototype,"$BgtoJSON",DFe.prototype.toJSON)},DFe),CFe,cFe,NDe;function DFe(t){void 0===t&&(t=!1);var e=CFe.call(this)||this;return e.map=new WeakMap,e.keys=null,e.weakKeys=!!t,t||(e.keys=[]),e.primitiveMap=Object.create(null),e}function dFe(){return null!==cFe&&cFe.apply(this,arguments)||this}function ODe(t,e,i,n,r,o,s){void 0===i&&(i=1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0);var a=NDe.call(this)||this;switch(arguments.length){case 0:a.value=new Date;break;case 1:a.value=new Date(t);break;case 2:a.value=new Date(t,e);break;case 3:a.value=new Date(t,e,i);break;case 4:a.value=new Date(t,e,i,n);break;case 5:a.value=new Date(t,e,i,n,r);break;case 6:a.value=new Date(t,e,i,n,r,o);break;default:a.value=new Date(t,e,i,n,r,o,s)}return a}function forEachPublicProperty(t,e,i){for(var n=t.axGetEnumerableKeys(),r=0;r<n.length;r++){var o=n[r],s=t.axGetPublicProperty(o);e.call(i,o,s)}}var AMF3ReferenceTables=function(){this.strings=[],this.objects=[],this.traits=[],this.traitNames=[]},ClassAliases=(bGe.prototype.getAliasByClass=function(t){return this._classMap.get(t)},bGe.prototype.getClassByAlias=function(t){return this._nameMap[t]},bGe.prototype.registerClassAlias=function(t,e){this._classMap.set(e,t),this._nameMap[t]=e},bGe);function bGe(){this._classMap=new WeakMap,this._nameMap=Object.create(null)}function writeString(t,e){if(65535<e.length)throw"AMF short string exceeded";if(!e.length)return t.writeByte(0),t.writeByte(0),0;var i=StringUtilities.utf8decode(e);t.writeByte(i.length>>8&255),t.writeByte(255&i.length);for(var n=0;n<i.length;n++)t.writeByte(i[n])}function readString(t){var e=t.readByte()<<8|t.readByte();if(!e)return"";for(var i=new Uint8Array(e),n=0;n<e;n++)i[n]=t.readByte();return StringUtilities.utf8encode(i)}function writeDouble(t,e){var i=new ArrayBuffer(8),n=new DataView(i);n.setFloat64(0,e,!1);for(var r=0;r<i.byteLength;r++)t.writeByte(n.getUint8(r))}function readDouble(t){for(var e=new ArrayBuffer(8),i=new DataView(e),n=0;n<e.byteLength;n++)i.setUint8(n,t.readByte());return i.getFloat64(0,!1)}var AMF0=(xGe.write=function(i,t){switch(typeof t){case"boolean":i.writeByte(1),i.writeByte(t?1:0);break;case"number":i.writeByte(0),writeDouble(i,t);break;case"undefined":i.writeByte(6);break;case"string":i.writeByte(2),writeString(i,t);break;case"object":var e,n=t;return void(null===n?i.writeByte(5):(i.sec.AXArray.axIsType(n)?(e=n.value,i.writeByte(8),i.writeByte(e.length>>>24&255),i.writeByte(e.length>>16&255),i.writeByte(e.length>>8&255),i.writeByte(255&e.length),forEachPublicProperty(n,function(t,e){writeString(i,t),this.write(i,e)},this)):(i.writeByte(3),forEachPublicProperty(n,function(t,e){writeString(i,t),this.write(i,e)},this)),i.writeByte(0),i.writeByte(0),i.writeByte(9)))}},xGe.read=function(t){var e,i=t.readByte();switch(i){case 0:return readDouble(t);case 1:return!!t.readByte();case 2:return readString(t);case 3:for(var n=t.sec.createObject();(e=readString(t)).length;)n.axSetPublicProperty(e,this.read(t));if(9!==t.readByte())throw"AMF0 End marker is not found";return n;case 5:return null;case 6:return;case 8:for((r=t.sec.createArray([])).length=t.readByte()<<24|t.readByte()<<16|t.readByte()<<8|t.readByte();(e=readString(t)).length;)r.axSetPublicProperty(e,this.read(t));if(9!==t.readByte())throw"AMF0 End marker is not found";return r;case 10:for(var r,o=(r=t.sec.createArray([])).length=t.readByte()<<24|t.readByte()<<16|t.readByte()<<8|t.readByte(),s=0;s<o;s++)r.axSetPublicProperty(s,this.read(t));return r;case 17:return readAMF3Value(t,new AMF3ReferenceTables);default:throw"AMF0 Unknown marker "+i}},xGe);function xGe(){}function readU29(t){var e=t.readByte();if(0==(128&e))return e;var i=t.readByte();if(0==(128&i))return(127&e)<<7|i;var n=t.readByte();if(0==(128&n))return(127&e)<<14|(127&i)<<7|n;var r=(127&e)<<22|(127&i)<<15|(127&n)<<8|t.readByte();return 0!=(268435456&r)&&(r|=3758096384),r}function writeU29(t,e){if(e<-268435456||268435456<=e)throw"AMF3 U29 range";0==(4294967168&e)?t.writeByte(127&e):0==(4294950912&e)?(t.writeByte(128|e>>7&127),t.writeByte(127&e)):0==(4292870144&e)?(t.writeByte(128|e>>14&127),t.writeByte(128|e>>7&127),t.writeByte(127&e)):(t.writeByte(128|e>>22&127),t.writeByte(128|e>>15&127),t.writeByte(128|e>>8&127),t.writeByte(255&e))}function readUTF8(t,e){var i=readU29(t);if(1===i)return"";var n=e.strings;if(0==(1&i))return n[i>>1];for(var r=i>>1,o=new Uint8Array(r),s=0;s<r;s++)o[s]=t.readByte();var a=StringUtilities.utf8encode(o);return n.push(a),a}function writeUTF8(t,e,i){if(""!==e){var n=i.strings,r=n.indexOf(e);if(0<=r)writeU29(t,r<<1);else{n.push(e);var o=StringUtilities.utf8decode(e);writeU29(t,1|o.length<<1);for(var s=0;s<o.length;s++)t.writeByte(o[s])}}else t.writeByte(1)}function readAMF3Value(t,e){var i,n,r=t.readByte();switch(r){case 1:return null;case 0:return;case 2:return!1;case 3:return!0;case 4:return readU29(t);case 5:return readDouble(t);case 6:return readUTF8(t,e);case 8:var o=readU29(t);return t.sec.AXDate.axConstruct([readDouble(t)]);case 10:if(0==(1&(o=readU29(t))))return e.objects[o>>1];if(0!=(4&o))throw"AMF3 Traits-Ext is not supported";var s,a=!0;if(0==(2&o))n=e.traits[o>>2],s=e.traitNames[o>>2];else{var l=readUTF8(t,e);l&&(n=i=t.sec.classAliases.getClassByAlias(l)),a=0!=(8&o),s=[];for(var c=0,h=o>>4;c<h;c++)s.push(readUTF8(t,e));e.traits.push(n),e.traitNames.push(s)}var u=i?i.axConstruct([]):t.sec.createObject();for(e.objects.push(u),c=0;c<s.length;c++){var p=readAMF3Value(t,e);u.axSetPublicProperty(s[c],p)}if(a)for(;""!==(_=readUTF8(t,e));)p=readAMF3Value(t,e),u.axSetPublicProperty(_,p);return u;case 9:if(0==(1&(o=readU29(t))))return e.objects[o>>1];var d=t.sec.createArray([]);e.objects.push(d);for(var _,f=o>>1;;){if(!(_=readUTF8(t,e)).length)break;p=readAMF3Value(t,e),d.axSetPublicProperty(_,p)}for(c=0;c<f;c++)p=readAMF3Value(t,e),d.axSetPublicProperty(c,p);return d;default:throw"AMF3 Unknown marker "+r}}function tryWriteAndStartTrackingReference(t,e,i){var n=i.objects,r=n.indexOf(e);return r<0?(n.push(e),0):(writeU29(t,r<<1),1)}var MAX_INT=268435455,MIN_INT=-268435456;function writeAMF3Value(i,t,n){switch(typeof t){case"boolean":i.writeByte(t?3:2);break;case"number":var e=t===(0|t);e&&(MAX_INT<t||t<MIN_INT)&&(e=!1),e?(i.writeByte(4),writeU29(i,t)):(i.writeByte(5),writeDouble(i,t));break;case"undefined":i.writeByte(0);break;case"string":i.writeByte(6),writeUTF8(i,t,n);break;case"object":if(null===t)i.writeByte(1);else if(i.sec.AXArray.axIsType(t)){var r=t;if(i.writeByte(9),tryWriteAndStartTrackingReference(i,r,n))break;for(var o=0;r.axHasPublicProperty(o);)++o;writeU29(i,o<<1|1),forEachPublicProperty(r,function(t,e){isNumeric(t)&&0<=t&&t<o||(writeUTF8(i,t,n),writeAMF3Value(i,e,n))}),writeUTF8(i,"",n);for(var s=0;s<o;s++)writeAMF3Value(i,r.axGetPublicProperty(s),n)}else if(i.sec.AXDate.axIsType(t)){if(i.writeByte(8),tryWriteAndStartTrackingReference(i,t,n))break;writeU29(i,1),writeDouble(i,t.valueOf())}else{var a=t;if(i.writeByte(10),tryWriteAndStartTrackingReference(i,a,n))break;var l=!0,c=a.axClass;if(c){var h=c.classInfo,l=!h.instanceInfo.isSealed(),u=i.sec.classAliases.getAliasByClass(c)||"",p=n.traits.indexOf(c),d=null;if(p<0){d=h.instanceInfo.runtimeTraits.getSlotPublicTraitNames(),n.traits.push(c),n.traitNames.push(d),writeU29(i,(l?11:3)+(d.length<<4)),writeUTF8(i,u,n);for(var _=0;_<d.length;_++)writeUTF8(i,d[_],n)}else d=n.traitNames[p],writeU29(i,1+(p<<2));for(_=0;_<d.length;_++)writeAMF3Value(i,a.axGetPublicProperty(d[_]),n)}else writeU29(i,11),writeUTF8(i,"",n);l&&(forEachPublicProperty(a,function(t,e){writeUTF8(i,t,n),writeAMF3Value(i,e,n)}),writeUTF8(i,"",n))}return}}var AMF3=(VHe.write=function(t,e){writeAMF3Value(t,e,new AMF3ReferenceTables)},VHe.read=function(t){return readAMF3Value(t,new AMF3ReferenceTables)},VHe),AMFEncoding,ZHe;function VHe(){}ZHe=AMFEncoding=AMFEncoding||{},ZHe[ZHe.AMF0=0]="AMF0",ZHe[ZHe.AMF3=3]="AMF3",ZHe[ZHe.DEFAULT=3]="DEFAULT";var ObjectEncoding=($He=ASObject,__extends(_He,$He),Object.defineProperty(_He,"dynamicPropertyWriter",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),_He.AMF0=AMFEncoding.AMF0,_He.AMF3=AMFEncoding.AMF3,_He.DEFAULT=AMFEncoding.DEFAULT,_He),ByteArrayDataProvider=function(){},ByteArray$1=(bIe=ASObject,__extends(cIe,bIe),cIe.classInitializer=function(){var t=DataBuffer.prototype;ObjectUtilities.defineNonEnumerableProperty(t,"$BgtoJSON",t.toJSON)},Object.defineProperty(cIe,"defaultObjectEncoding",{get:function(){return this._defaultObjectEncoding},set:function(t){t>>>=0,this._defaultObjectEncoding=t},enumerable:!0,configurable:!0}),cIe.prototype.toJSON=function(){return"ByteArray"},cIe.prototype.readObject=function(){switch(this._objectEncoding){case ObjectEncoding.AMF0:return AMF0.read(this);case ObjectEncoding.AMF3:return AMF3.read(this);default:unexpected("Object Encoding")}},cIe.prototype.writeObject=function(t){switch(this._objectEncoding){case ObjectEncoding.AMF0:return AMF0.write(this,t);case ObjectEncoding.AMF3:return AMF3.write(this,t);default:unexpected("Object Encoding")}},cIe.prototype.axGetPublicProperty=function(t){return"number"==typeof t||isNumeric(t=axCoerceName(t))?this.axGetNumericProperty(t):this["$Bg"+t]},cIe.prototype.axGetNumericProperty=function(t){return this.getValue(t)},cIe.prototype.axSetPublicProperty=function(t,e){"number"==typeof t||isNumeric(t=axCoerceName(t))?this.axSetNumericProperty(t,e):this["$Bg"+t]=e},cIe.prototype.axSetNumericProperty=function(t,e){this.setValue(t,e)},cIe.prototype.axGetProperty=function(t){var e=t.name;return"number"==typeof e||isNumeric(e=axCoerceName(e))?this.getValue(+e):bIe.prototype.axGetProperty.call(this,t)},cIe.prototype.axSetProperty=function(t,e,i){var n=t.name;"number"==typeof n||isNumeric(n=axCoerceName(n))?this.setValue(+n,e):bIe.prototype.axSetProperty.call(this,t,e,i)},cIe.classNatives=[DataBuffer],cIe.instanceNatives=[DataBuffer.prototype],cIe.INITIAL_SIZE=128,cIe._defaultObjectEncoding=ObjectEncoding.DEFAULT,cIe),IME=(xIe=ASObject,__extends(yIe,xIe),Object.defineProperty(yIe,"enabled",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(yIe,"conversionMode",{get:function(){return"UNKNOWN"},set:function(t){},enumerable:!0,configurable:!0}),yIe.setCompositionString=function(t){},yIe.doConversion=function(){},yIe.compositionSelectionChanged=function(t,e){},yIe.compositionAbandoned=function(){},Object.defineProperty(yIe,"isSupported",{get:function(){return!1},enumerable:!0,configurable:!0}),yIe),System=(EIe=ASObject,__extends(FIe,EIe),FIe.classInitializer=function(){defineNonEnumerableProperty(this,"$Bgargv",this.sec.createArray([]))},Object.defineProperty(FIe,"ime",{get:function(){return null},enumerable:!0,configurable:!0}),FIe.setClipboard=function(t){t=axCoerceString$2(t),null!==ClipboardService&&ClipboardService.setClipboard(t)},Object.defineProperty(FIe,"totalMemoryNumber",{get:function(){return 2097152},enumerable:!0,configurable:!0}),Object.defineProperty(FIe,"freeMemory",{get:function(){return 1048576},enumerable:!0,configurable:!0}),Object.defineProperty(FIe,"privateMemory",{get:function(){return 1048576},enumerable:!0,configurable:!0}),Object.defineProperty(FIe,"useCodePage",{get:function(){return this._useCodePage},set:function(t){this._useCodePage=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(FIe,"vmVersion",{get:function(){return"1.0 Shumway - Mozilla Research"},enumerable:!0,configurable:!0}),FIe.pause=function(){},FIe.resume=function(){},FIe.exit=function(t){},FIe.gc=function(){},FIe.pauseForGCIfCollectionImminent=function(t){},FIe.disposeXML=function(t){},Object.defineProperty(FIe,"swfVersion",{get:function(){return 19},enumerable:!0,configurable:!0}),Object.defineProperty(FIe,"apiVersion",{get:function(){return 26},enumerable:!0,configurable:!0}),FIe.getArgv=function(){return[]},FIe.getRunmode=function(){return"mixed"},FIe._useCodePage=!1,FIe),OriginalSystem=System,EIe,xIe,bIe,$He;function FIe(){return null!==EIe&&EIe.apply(this,arguments)||this}function yIe(){return xIe.call(this)||this}function cIe(t){var e=bIe.call(this)||this;ByteArrayDataProvider.symbolForConstructor&&(t=ByteArrayDataProvider.symbolForConstructor,ByteArrayDataProvider.symbolForConstructor=null);var i,n,r=0;return t?(t instanceof ArrayBuffer?n=t.slice(0):Array.isArray(t)?n=new Uint8Array(t).buffer:"buffer"in t?n=t.buffer instanceof ArrayBuffer?new Uint8Array(t.buffer).buffer:t.buffer instanceof Uint8Array?(i=t.buffer.byteOffset,t.buffer.buffer.slice(i,i+t.buffer.length)):t.buffer.slice():unexpected("Source type."),r=n.byteLength):n=new ArrayBuffer(cIe.INITIAL_SIZE),e._buffer=n,e._length=r,e._position=0,e._resetViews(),e._objectEncoding=cIe.defaultObjectEncoding,e._littleEndian=!1,e._bitBuffer=0,e._bitLength=0,e}function _He(){return null!==$He&&$He.apply(this,arguments)||this}function initSystem(){initializeBuiltins()}var builtinNativeClasses=ObjectUtilities.createMap(),nativeClasses=ObjectUtilities.createMap(),nativeClassLoaderNames=[];function getCurrentScope(){return 0===scopeStacks.length?null:scopeStacks[scopeStacks.length-1].topScope()}function isXMLType(t,e){return"object"==typeof t&&t&&(t.axClass===e.AXXML||t.axClass===e.AXXMLList||t.axClass===e.AXQName||t.axClass===e.AXNamespace)}function isXMLCollection(t,e){return"object"==typeof e&&e&&(e.axClass===t.AXXML||e.axClass===t.AXXMLList)}function toString(t,e){if(!t||t.axClass!==e.AXXML)return axCoerceString$2(t);switch(t._kind){case 3:case 2:return t._value;default:if(t.hasSimpleContent()){for(var i="",n=0;n<t._children.length;n++){var r=t._children[n];4!==r._kind&&5!==r._kind&&(i+=toString(r,e))}return i}return toXMLString(e,t)}}function escapeElementValue(t,e){if(isXMLCollection(t,e))return e.toXMLString();e=axCoerceString$2(e);for(var i,n=0;n<e.length&&"&"!==(i=e[n])&&"<"!==i&&">"!==i;)n++;if(n>=e.length)return e;for(var r=e.substring(0,n);n<e.length;)switch(i=e[n++]){case"&":r+="&amp;";break;case"<":r+="&lt;";break;case">":r+="&gt;";break;default:r+=i}return r}function escapeAttributeValue(t){t=String(t);for(var e,i=0;i<t.length&&"&"!==(e=t[i])&&"<"!==e&&'"'!==e&&"\n"!==e&&"\r"!==e&&"\t"!==e;)i++;if(i>=t.length)return t;for(var n=t.substring(0,i);i<t.length;)switch(e=t[i++]){case"&":n+="&amp;";break;case"<":n+="&lt;";break;case'"':n+="&quot;";break;case"\n":n+="&#xA;";break;case"\r":n+="&#xD;";break;case"\t":n+="&#x9;";break;default:n+=e}return n}function isWhitespace(t,e){var i=t[e];return" "===i||"\n"===i||"\r"===i||"\t"===i}function isWhitespaceString(t){for(var e=0;e<t.length;e++){var i=t[e];if(" "!==i&&"\n"!==i&&"\r"!==i&&"\t"!==i)return}return 1}function trimWhitespaces(t){for(var e=0;e<t.length&&isWhitespace(t,e);)e++;if(e>=t.length)return"";for(var i=t.length-1;isWhitespace(t,i);)i--;return 0===e&&i===t.length-1?t:t.substring(e,i+1)}var indentStringCache=[];function getIndentString(t){if(0<t){if(void 0!==indentStringCache[t])return indentStringCache[t];for(var e="",i=0;i<t;i++)e+=" ";return indentStringCache[t]=e}return""}function generateUniquePrefix(t){for(var e,i=1;;){if(e="_ns"+i,!t.some(function(t){return t.prefix===e}))return e;i++}}function toXMLString(t,e){if(null==e)throw new TypeError;return escapeElementValue(t,e)}function toXML(t,e){if(null===t&&e.throwError("TypeError",Errors$1.ConvertNullToObjectError),void 0===t&&e.throwError("TypeError",Errors$1.ConvertUndefinedToObjectError),t.axClass===e.AXXML)return t;if(t.axClass===e.AXXMLList)return 1!==t._children.length&&e.throwError("TypeError",Errors$1.XMLMarkupMustBeWellFormed),t._children[0];var i=e.xmlParser.parseFromString(axCoerceString$2(t)),n=i._children.length;return 0===n?createXML(e,3):1===n?(i._children[0]._parent=null,i._children[0]):2===n?(i._children[1]._parent=null,i._children[1]):void e.throwError("TypeError",Errors$1.XMLMarkupMustBeWellFormed)}function toXMLList(t,e){if(null===t&&e.sec.throwError("TypeError",Errors$1.ConvertNullToObjectError),void 0===t&&e.sec.throwError("TypeError",Errors$1.ConvertUndefinedToObjectError),t.axClass!==e.sec.AXXML){var i=toXML('<parent xmlns="'+escapeAttributeValue(getDefaultNamespace(e.sec).uri)+'">'+t+"</parent>",e.sec)._children;if(i)for(var n=0;n<i.length;n++){var r=i[n];r._parent=null,e.append(r)}}else e.append(t)}function toXMLName(t,e){if(void 0===t)return anyMultiname;var i;if("object"==typeof t&&null!==t){if(t instanceof Multiname)return t;if(t.axClass===e.AXQName)return t.name;i=String(t)}else"number"==typeof t?i=t+"":"string"==typeof t?i="*"===t?null:t:e.throwError("TypeError",Errors$1.XMLInvalidName,t);return i&&"@"===i[0]?("*"===(i=i.substr(1))&&(i=null),new Multiname(null,0,13,[Namespace.PUBLIC],i)):new Multiname(null,0,7,[Namespace.PUBLIC],i)}function coerceE4XMultiname(t,e){var i=tmpMultiname;if(i.kind=t.kind,t.name&&t.name.axClass===e.AXQName&&(t=t.name.name),t.isQName())i.name=t.name,i.namespaces=t.namespaces;else if(t.isAnyNamespace())i.namespaces=t.namespaces;else{for(var n=getDefaultNamespace(e),r=t.namespaces,o=!1,s=0;s<r.length;s++){var a=r[s];if(a.uri===n.uri&&a.prefix===n.prefix&&a.type===n.type){o=!0;break}}i.namespaces=o?t.namespaces:t.namespaces.concat(n)}var l=t.name;return t.isAnyName()||"*"===l||null===l?i.name=null:!(1<l.length&&"@"===l[0])||i.isAttribute()?i.name=l:(i.name="@*"===l?null:l.substr(1),i.kind=1===i.namespaces.length?13:14),i}function getDefaultNamespace(t){for(var e=getCurrentScope();e;){if(e.defaultNamespace)return e.defaultNamespace;e=e.parent}return t.AXNamespace.defaultNamespace||(t.AXNamespace.defaultNamespace=new Namespace(0,"default","")),t.AXNamespace.defaultNamespace}function GetNamespace(t,e){for(var i=t.uri,n=0;e&&n<e.length;n++)if(i===e[n].uri)return e[n];return t.namespaces[0]}function isXMLName(t,e){try{e.AXQName.Create(t)}catch(t){return!1}return!0}var tmpMultiname=new Multiname(null,0,7,[],null,null,!0),anyMultiname=new Multiname(null,0,7,[],null,null,!0),XMLParserBase=(WJe.prototype.resolveEntities=function(t){return t.replace(/&([^;]+);/g,function(t,e){if("#x"===e.substring(0,2))return String.fromCharCode(parseInt(e.substring(2),16));if("#"===e.substring(0,1))return String.fromCharCode(parseInt(e.substring(1),10));switch(e){case"lt":return"<";case"gt":return">";case"amp":return"&";case"quot":return'"'}return t})},WJe.prototype.parseContent=function(t,e){var i,n=e,r=[];function o(){for(;n<t.length&&isWhitespace(t,n);)++n}for(;n<t.length&&!isWhitespace(t,n)&&">"!==t[n]&&"/"!==t[n];)++n;for(i=t.substring(e,n),o();n<t.length&&">"!==t[n]&&"/"!==t[n]&&"?"!==t[n];){o();for(var s,a="";n<t.length&&!isWhitespace(t,n)&&"="!==t[n];)a+=t[n],++n;if(o(),"="!==t[n])return null;++n,o();var l=t[n];if('"'!==l&&"'"!==l)return null;var c=t.indexOf(l,++n);if(c<0)return null;s=t.substring(n,c),r.push({name:a,value:this.resolveEntities(s)}),n=c+1,o()}return{name:i,attributes:r,parsed:n-e}},WJe.prototype.parseProcessingInstruction=function(t,e){for(var i,n=e;n<t.length&&!isWhitespace(t,n)&&">"!==t[n]&&"/"!==t[n];)++n;i=t.substring(e,n),function(){for(;n<t.length&&isWhitespace(t,n);)++n}();for(var r=n;n<t.length&&("?"!==t[n]||">"!=t[n+1]);)++n;return{name:i,value:t.substring(r,n),parsed:n-e}},WJe.prototype.parseXml=function(t){for(var e=0;e<t.length;){var i,n=e;if("<"===t[e])switch(t[++n]){case"/":if(++n,(i=t.indexOf(">",n))<0)return void this.onError(-9);this.onEndElement(t.substring(n,i)),n=i+1;break;case"?":++n;var r=this.parseProcessingInstruction(t,n);if("?>"!=t.substring(n+r.parsed,n+r.parsed+2))return void this.onError(-3);this.onPi(r.name,r.value),n+=r.parsed+2;break;case"!":if("--"===t.substring(n+1,n+3)){if((i=t.indexOf("--\x3e",n+3))<0)return void this.onError(-5);this.onComment(t.substring(n+3,i)),n=i+3}else if("[CDATA["===t.substring(n+1,n+8)){if((i=t.indexOf("]]>",n+8))<0)return void this.onError(-2);this.onCdata(t.substring(n+8,i)),n=i+3}else{if("DOCTYPE"!==t.substring(n+1,n+8))return void this.onError(-6);var o=t.indexOf("[",n+8),s=!1;if((i=t.indexOf(">",n+8))<0)return void this.onError(-4);if(0<o&&o<i){if((i=t.indexOf("]>",n+8))<0)return void this.onError(-4);s=!0}var a=t.substring(n+8,i+(s?1:0));this.onDoctype(a),n=i+(s?2:1)}break;default:var l=this.parseContent(t,n);if(null===l)return void this.onError(-6);var c=!1;if("/>"===t.substring(n+l.parsed,n+l.parsed+2))c=!0;else if(">"!==t.substring(n+l.parsed,n+l.parsed+1))return void this.onError(-9);this.onBeginElement(l.name,l.attributes,c),n+=l.parsed+(c?2:1)}else{do{}while(n++<t.length&&"<"!==t[n]);var h=t.substring(e,n);this.onText(this.resolveEntities(h))}e=n}},WJe.prototype.onPi=function(t,e){},WJe.prototype.onComment=function(t){},WJe.prototype.onCdata=function(t){},WJe.prototype.onDoctype=function(t){},WJe.prototype.onText=function(t){},WJe.prototype.onBeginElement=function(t,e,i){},WJe.prototype.onEndElement=function(t){},WJe.prototype.onError=function(t){},WJe),XMLParser=(JKe=XMLParserBase,__extends(KKe,JKe),KKe.prototype.isWhitespacePreserved=function(){for(var t=this.scopes,e=t.length-1;0<=e;--e)if("preserve"===t[e].space)return!0;return!1},KKe.prototype.lookupDefaultNs=function(){for(var t=this.scopes,e=t.length-1;0<=e;--e)if("xmlns"in t[e])return t[e].xmlns;return""},KKe.prototype.lookupNs=function(t){for(var e=this.scopes,i=e.length-1;0<=i;--i)if(t in e[i].lookup)return e[i].lookup[t]},KKe.prototype.getName=function(t,e){var i=t.indexOf(":");if(0<=i){var n=t.substring(0,i),r=t.substring(i+1),o=this.lookupNs(n);return void 0===o&&this.sec.throwError("TypeError",Errors$1.XMLPrefixNotBound,n,r),{name:o+"::"+r,localName:r,prefix:n,namespace:o}}return e?{name:t,localName:t,prefix:"",namespace:this.lookupDefaultNs()}:{name:t,localName:t,prefix:"",namespace:""}},KKe.prototype.onError=function(t){switch(t){case-6:return void this.sec.throwError("TypeError",Errors$1.XMLMalformedElement);case-9:return void this.sec.throwError("TypeError",Errors$1.XMLUnterminatedElement);case-4:return void this.sec.throwError("TypeError",Errors$1.XMLUnterminatedDocTypeDecl);case-2:return void this.sec.throwError("TypeError",Errors$1.XMLUnterminatedCData);case-5:return void this.sec.throwError("TypeError",Errors$1.XMLUnterminatedComment);case-3:return void this.sec.throwError("TypeError",Errors$1.XMLUnterminatedXMLDecl)}},KKe.prototype.onPi=function(t,e){this.pi(t,e)},KKe.prototype.onComment=function(t){this.comment(t)},KKe.prototype.onCdata=function(t){this.cdata(t)},KKe.prototype.onDoctype=function(t){this.doctype(t)},KKe.prototype.onText=function(t){this.text(t,this.isWhitespacePreserved())},KKe.prototype.onBeginElement=function(t,e,i){for(var n=this.scopes,r={namespaces:[],lookup:Object.create(null),inScopes:null},o=0;o<e.length;++o){var s,a,l,c,h=e[o],u=h.name;"xmlns:"===u.substring(0,6)?(s=u.substring(6),a=h.value,this.lookupNs(s)!==a&&(r.lookup[s]=trimWhitespaces(a),l=internPrefixedNamespace(0,a,s),r.namespaces.push(l)),e[o]=null):"xmlns"===u?(a=h.value,this.lookupDefaultNs()!==a&&(r.xmlns=trimWhitespaces(a),l=internNamespace(0,a),r.namespaces.push(l)),e[o]=null):"xml:"===u.substring(0,4)&&(c=u.substring(4),r[c]=trimWhitespaces(h.value))}var p=[];r.namespaces.forEach(function(t){t.prefix&&r.lookup[t.prefix]!==t.uri||p.push(t)}),n[n.length-1].inScopes.forEach(function(t){(!t.prefix||t.prefix in r.lookup)&&(t.prefix||"xmlns"in r)||p.push(t)}),r.inScopes=p,n.push(r);for(var d=[],o=0;o<e.length;++o)(h=e[o])&&d.push({name:this.getName(h.name,!1),value:h.value});this.beginElement(this.getName(t,!0),d,p,i),i&&n.pop()},KKe.prototype.onEndElement=function(t){this.endElement(this.getName(t,!0)),this.scopes.pop()},KKe.prototype.beginElement=function(t,e,i,n){var r=this.currentElement;this.elementsStack.push(r),this.currentElement=createXML(this.sec,1,t.namespace,t.localName,t.prefix);for(var o=0;o<e.length;++o){var s=e[o],a=createXML(this.sec,2,s.name.namespace,s.name.localName,s.name.prefix);a._value=s.value,a._parent=this.currentElement,this.currentElement._attributes.push(a)}for(o=0;o<i.length;++o)this.currentElement._inScopeNamespaces.push(i[o]);r.insert(r._children.length,this.currentElement),n&&(this.currentElement=this.elementsStack.pop())},KKe.prototype.endElement=function(t){this.currentElement=this.elementsStack.pop()},KKe.prototype.text=function(t,e){var i;this.sec.AXXML.ignoreWhitespace&&(t=trimWhitespaces(t)),0===t.length||e&&this.sec.AXXML.ignoreWhitespace||((i=createXML(this.sec))._value=t,this.currentElement.insert(this.currentElement._children.length,i))},KKe.prototype.cdata=function(t){var e=createXML(this.sec);e._value=t,this.currentElement.insert(this.currentElement._children.length,e)},KKe.prototype.comment=function(t){var e;this.sec.AXXML.ignoreComments||((e=createXML(this.sec,4,"",""))._value=t,this.currentElement.insert(this.currentElement._children.length,e))},KKe.prototype.pi=function(t,e){var i;this.sec.AXXML.ignoreProcessingInstructions||((i=createXML(this.sec,5,"",t))._value=e,this.currentElement.insert(this.currentElement._children.length,i))},KKe.prototype.doctype=function(t){},KKe.prototype.parseFromString=function(t,e){var i=this.currentElement=createXML(this.sec,1,"","","");this.elementsStack=[];var n,r=getDefaultNamespace(this.sec),o=[{namespaces:[],lookup:{xmlns:"http://www.w3.org/2000/xmlns/",xml:"http://www.w3.org/XML/1998/namespace"},inScopes:[r],space:"default",xmlns:r.uri}];return this.scopes=o,this.parseXml(t),this.currentElement=null,0<this.elementsStack.length&&(n=this.elementsStack.pop()._name.name,this.sec.throwError("TypeError",Errors$1.XMLUnterminatedElementTag,n,n)),this.elementsStack=null,i},KKe),ASNamespace=(WLe=ASObject,__extends(XLe,WLe),XLe.classInitializer=function(){defineNonEnumerableProperty(this,"$Bglength",2),defineNonEnumerableProperty(this.dPrototype,"$BgtoString",XLe.prototype.toString)},XLe.axApply=function(t,e){var i=e[0],n=e[1];if(1===e.length&&isObject(i)&&i.axClass===this.sec.AXNamespace)return i;switch(e.length){case 0:return this.sec.AXNamespace.Create();case 1:return this.sec.AXNamespace.Create(i);default:return this.sec.AXNamespace.Create(i,n)}},XLe.Create=function(t,e){var i=Object.create(this.sec.AXNamespace.tPrototype);return i.axInitializer.apply(i,arguments),i},XLe.FromNamespace=function(t){var e=Object.create(this.sec.AXNamespace.tPrototype);return e._ns=t,e},XLe.prototype.equals=function(t){return t&&t.axClass===this.axClass&&t._ns.uri===this._ns.uri||"string"==typeof t&&this._ns.uri===t},Object.defineProperty(XLe.prototype,"prefix",{get:function(){return this._ns.prefix},enumerable:!0,configurable:!0}),Object.defineProperty(XLe.prototype,"uri",{get:function(){return this._ns.uri},enumerable:!0,configurable:!0}),XLe.prototype.toString=function(){return this===this.axClass.dPrototype?"":this._ns.uri},XLe.prototype.valueOf=function(){return this===this.axClass.dPrototype?"":this._ns.uri},(XLe.instanceConstructor=XLe).defaultNamespace=Namespace.PUBLIC,XLe),ASQName=(oMe=ASObject,__extends(pMe,oMe),pMe.classInitializer=function(){defineNonEnumerableProperty(this,"$Bglength",2),defineNonEnumerableProperty(this.dPrototype,"$BgtoString",pMe.prototype.ecmaToString)},pMe.Create=function(t,e,i){var n=Object.create(this.sec.AXQName.tPrototype);return n.axInitializer.apply(n,arguments),n},pMe.FromMultiname=function(t){var e=Object.create(this.sec.AXQName.tPrototype);return e.name=t,e},pMe.axApply=function(t,e){var i=e[0],n=e[1];if(1===e.length&&i&&i.axClass===this.sec.AXQName)return i;switch(e.length){case 0:return this.sec.AXQName.Create();case 1:return this.sec.AXQName.Create(i);default:return this.sec.AXQName.Create(i,n)}},pMe.prototype.equals=function(t){return t&&t.axClass===this.sec.AXQName&&t.uri===this.uri&&t.name.name===this.name.name||"string"==typeof t&&this.toString()===t},Object.defineProperty(pMe.prototype,"localName",{get:function(){return this.name.name},enumerable:!0,configurable:!0}),Object.defineProperty(pMe.prototype,"uri",{get:function(){var t=this.name.namespaces;return 1<t.length?"":t[0]?t[0].uri:null},enumerable:!0,configurable:!0}),pMe.prototype.ecmaToString=function(){return this&&this===this.sec.AXQName.dPrototype?"":(this&&this.axClass===this.sec.AXQName||this.sec.throwError("TypeError",Errors$1.InvokeOnIncompatibleObjectError,"QName.prototype.toString"),this.toString())},pMe.prototype.toString=function(){var t=this.uri;if(""===t)return this.name.name;if(null===t)return"*::"+this.name.name;var e=(t+="").charCodeAt(t.length-1);return 57344<=e&&e<=63743&&t.substr(0,t.length-1),this.name.name},pMe.prototype.valueOf=function(){return this},Object.defineProperty(pMe.prototype,"prefix",{get:function(){return this.name.namespaces[0]?this.name.namespaces[0].prefix:null},enumerable:!0,configurable:!0}),pMe),ASXML_FLAGS,oMe,WLe,JKe,LMe;function pMe(t,e){var i,n=oMe.call(this)||this,r=0===arguments.length?"":1===arguments.length?t:(i=t,e);if(r&&r.axClass===n.sec.AXQName){if(arguments.length<2)return n.name=r.name,n;r=r.localName}r=void 0===r?"":toString(r,n.sec),void 0===i&&(i="*"===r?null:getDefaultNamespace(n.sec));var o=r,s=null;return null!==i&&(i.axClass!==n.sec.AXNamespace&&(i=n.sec.AXNamespace.Create(i)),s=i._ns),n.name=new Multiname(null,0,7,[s],o),n}function XLe(t,e){var i=WLe.call(this)||this,n="",r="";if(0!==arguments.length)if(1===arguments.length){if((o=t)instanceof Namespace)return i._ns=o,i;o&&"object"==typeof o?o.axClass===i.sec.AXNamespace?(r=o.prefix,n=o.uri):o.axClass===i.sec.AXQName&&null!==o.uri&&(n=o.uri):r=""===(n=toString(o,i.sec))?"":void 0}else{var o,s=t;""===(n=isObject(o=e)&&o.axClass===i.sec.AXQName&&null!==o.uri?o.uri:toString(o,i.sec))?void 0===s||""===toString(s,i.sec)?r="":i.sec.throwError("TypeError",Errors$1.XMLNamespaceWithPrefixAndNoURI,s):r=void 0===s||!1===isXMLName(s,i.sec)?void 0:toString(s,i.sec)}return i._ns=internPrefixedNamespace(0,n,r),i}function KKe(t){var e=JKe.call(this)||this;return e.sec=t,e.scopes=[],e}function WJe(){}LMe=ASXML_FLAGS=ASXML_FLAGS||{},LMe[LMe.FLAG_IGNORE_COMMENTS=1]="FLAG_IGNORE_COMMENTS",LMe[LMe.FLAG_IGNORE_PROCESSING_INSTRUCTIONS=2]="FLAG_IGNORE_PROCESSING_INSTRUCTIONS",LMe[LMe.FLAG_IGNORE_WHITESPACE=4]="FLAG_IGNORE_WHITESPACE",LMe[LMe.FLAG_PRETTY_PRINTING=8]="FLAG_PRETTY_PRINTING",LMe[LMe.ALL=15]="ALL";var ASXMLKindNames=[null,"element","attribute","text","comment","processing-instruction"],ASXML=(MMe=ASObject,__extends(NMe,MMe),NMe.classInitializer=function(){defineNonEnumerableProperty(this,"$Bglength",1);var t=this.dPrototype,e=NMe.prototype;addPrototypeFunctionAlias(t,"$BgvalueOf",e.valueOf),defineNonEnumerableProperty(t,"$BghasOwnProperty",e.native_hasOwnProperty),defineNonEnumerableProperty(t,"$BgpropertyIsEnumerable",e.native_propertyIsEnumerable),addPrototypeFunctionAlias(this,"$Bgsettings",NMe.native_settings),addPrototypeFunctionAlias(this,"$BgsetSettings",NMe.native_setSettings),addPrototypeFunctionAlias(this,"$BgdefaultSettings",NMe.native_defaultSettings),addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgaddNamespace",e.addNamespace),addPrototypeFunctionAlias(t,"$BgappendChild",e.appendChild),addPrototypeFunctionAlias(t,"$Bgattribute",e.attribute),addPrototypeFunctionAlias(t,"$Bgattributes",e.attributes),addPrototypeFunctionAlias(t,"$Bgchild",e.child),addPrototypeFunctionAlias(t,"$BgchildIndex",e.childIndex),addPrototypeFunctionAlias(t,"$Bgchildren",e.children),addPrototypeFunctionAlias(t,"$Bgcomments",e.comments),addPrototypeFunctionAlias(t,"$Bgcontains",e.contains),addPrototypeFunctionAlias(t,"$Bgcopy",e.copy),addPrototypeFunctionAlias(t,"$Bgdescendants",e.descendants),addPrototypeFunctionAlias(t,"$Bgelements",e.elements),addPrototypeFunctionAlias(t,"$BghasComplexContent",e.hasComplexContent),addPrototypeFunctionAlias(t,"$BghasSimpleContent",e.hasSimpleContent),addPrototypeFunctionAlias(t,"$BginScopeNamespaces",e.inScopeNamespaces),addPrototypeFunctionAlias(t,"$BginsertChildAfter",e.insertChildAfter),addPrototypeFunctionAlias(t,"$BginsertChildBefore",e.insertChildBefore),addPrototypeFunctionAlias(t,"$Bglength",e.length),addPrototypeFunctionAlias(t,"$BglocalName",e.localName),addPrototypeFunctionAlias(t,"$Bgname",e.name),addPrototypeFunctionAlias(t,"$Bgnamespace",e.namespace),addPrototypeFunctionAlias(t,"$BgnamespaceDeclarations",e.namespaceDeclarations),addPrototypeFunctionAlias(t,"$BgnodeKind",e.nodeKind),addPrototypeFunctionAlias(t,"$Bgnormalize",e.normalize),addPrototypeFunctionAlias(t,"$Bgparent",e.parent),addPrototypeFunctionAlias(t,"$BgprocessingInstructions",e.processingInstructions),addPrototypeFunctionAlias(t,"$BgprependChild",e.prependChild),addPrototypeFunctionAlias(t,"$BgremoveNamespace",e.removeNamespace),addPrototypeFunctionAlias(t,"$Bgreplace",e.replace),addPrototypeFunctionAlias(t,"$BgsetChildren",e.setChildren),addPrototypeFunctionAlias(t,"$BgsetLocalName",e.setLocalName),addPrototypeFunctionAlias(t,"$BgsetName",e.setName),addPrototypeFunctionAlias(t,"$BgsetNamespace",e.setNamespace),addPrototypeFunctionAlias(t,"$Bgtext",e.text),addPrototypeFunctionAlias(t,"$BgtoXMLString",e.toXMLString),addPrototypeFunctionAlias(t,"$BgtoJSON",e.toJSON)},NMe.Create=function(t){var e=Object.create(this.sec.AXXML.tPrototype);return e.axInitializer(t),e},NMe.resetSettings=function(){this._flags=ASXML_FLAGS.ALL},NMe.native_settings=function(){var t=Object.create(this.sec.AXObject.tPrototype);return t.$BgignoreComments=this.ignoreComments,t.$BgignoreProcessingInstructions=this.ignoreProcessingInstructions,t.$BgignoreWhitespace=this.ignoreWhitespace,t.$BgprettyPrinting=this.prettyPrinting,t.$BgprettyIndent=this.prettyIndent,t},NMe.native_setSettings=function(t){if(isNullOrUndefined$1(t))return this.ignoreComments=!0,this.ignoreProcessingInstructions=!0,this.ignoreWhitespace=!0,this.prettyPrinting=!0,void(this.prettyIndent=2);"boolean"==typeof t.$BgignoreComments&&(this.ignoreComments=t.$BgignoreComments),"boolean"==typeof t.$BgignoreProcessingInstructions&&(this.ignoreProcessingInstructions=t.$BgignoreProcessingInstructions),"boolean"==typeof t.$BgignoreWhitespace&&(this.ignoreWhitespace=t.$BgignoreWhitespace),"boolean"===t.$BgprettyPrinting&&(this.prettyPrinting=t.$BgprettyPrinting),"number"===t.$BgprettyIndent&&(this.prettyIndent=t.$BgprettyIndent)},NMe.native_defaultSettings=function(){return{__proto__:this.sec.AXObject.tPrototype,$BgignoreComments:!0,$BgignoreProcessingInstructions:!0,$BgignoreWhitespace:!0,$BgprettyPrinting:!0,$BgprettyIndent:2}},NMe.axApply=function(t,e){var i=e[0];return isNullOrUndefined$1(i)&&(i=""),toXML(i,this.sec)},NMe.prototype.valueOf=function(){return this},NMe.prototype.equals=function(t){if(t&&t.axClass===this.sec.AXXMLList)return t.equals(this);if(t&&t.axClass===this.sec.AXXML){var e=t;return(3===this._kind||2===this._kind)&&e.hasSimpleContent()||(3===e._kind||2===e._kind)&&this.hasSimpleContent()?this.toString()===t.toString():this._deepEquals(t)}return this.hasSimpleContent()&&this.toString()===axCoerceString$2(t)},NMe.prototype.init=function(t,e){switch(this._name=e,this._kind=t,this._parent=null,t){case 1:this._inScopeNamespaces=[],this._attributes=[],this._children=[];break;case 4:case 5:case 2:case 3:this._value=""}return this},NMe.prototype._deepEquals=function(t){if(!t||t.axClass!==this.sec.AXXML)return!1;var e=t;if(this._kind!==e._kind)return!1;if(!!this._name!=!!e._name||this._name&&!this._name.equalsQName(e._name))return!1;if(1!==this._kind)return this._value===e._value;var i=this._attributes,n=e._attributes;if(i.length!==n.length)return!1;var r=this._children,o=e._children;if(r.length!==o.length)return!1;t:for(var s=0;s<i.length;s++){for(var a=i[s],l=0;l<n.length;l++){var c=n[l];if(c._name.equalsQName(a._name)&&c._value===a._value)continue t}return!1}for(s=0;s<r.length;s++)if(!r[s].equals(o[s]))return!1;return!0},NMe.prototype._deepCopy=function(){var t=this._kind,e=this.sec.AXXML.Create();switch(e._kind=t,e._name=this._name,t){case 1:e._inScopeNamespaces=this._inScopeNamespaces.slice(),e._attributes=this._attributes.map(function(t){return(t=t._deepCopy())._parent=e,t}),e._children=this._children.map(function(t){return(t=t._deepCopy())._parent=e,t});break;case 4:case 5:case 2:case 3:e._value=this._value}return e},NMe.prototype.resolveValue=function(){return this},NMe.prototype._addInScopeNamespace=function(e){this._inScopeNamespaces.some(function(t){return t.uri===e.uri&&t.prefix===e.prefix})||this._inScopeNamespaces.push(e)},Object.defineProperty(NMe,"ignoreComments",{get:function(){return!!(this._flags&ASXML_FLAGS.FLAG_IGNORE_COMMENTS)},set:function(t){(t=!!t)?this._flags|=ASXML_FLAGS.FLAG_IGNORE_COMMENTS:this._flags&=~ASXML_FLAGS.FLAG_IGNORE_COMMENTS},enumerable:!0,configurable:!0}),Object.defineProperty(NMe,"ignoreProcessingInstructions",{get:function(){return!!(this._flags&ASXML_FLAGS.FLAG_IGNORE_PROCESSING_INSTRUCTIONS)},set:function(t){(t=!!t)?this._flags|=ASXML_FLAGS.FLAG_IGNORE_PROCESSING_INSTRUCTIONS:this._flags&=~ASXML_FLAGS.FLAG_IGNORE_PROCESSING_INSTRUCTIONS},enumerable:!0,configurable:!0}),Object.defineProperty(NMe,"ignoreWhitespace",{get:function(){return!!(this._flags&ASXML_FLAGS.FLAG_IGNORE_WHITESPACE)},set:function(t){(t=!!t)?this._flags|=ASXML_FLAGS.FLAG_IGNORE_WHITESPACE:this._flags&=~ASXML_FLAGS.FLAG_IGNORE_WHITESPACE},enumerable:!0,configurable:!0}),Object.defineProperty(NMe,"prettyPrinting",{get:function(){return!!(this._flags&ASXML_FLAGS.FLAG_PRETTY_PRINTING)},set:function(t){(t=!!t)?this._flags|=ASXML_FLAGS.FLAG_PRETTY_PRINTING:this._flags&=~ASXML_FLAGS.FLAG_PRETTY_PRINTING},enumerable:!0,configurable:!0}),Object.defineProperty(NMe,"prettyIndent",{get:function(){return this._prettyIndent},set:function(t){t|=0,this._prettyIndent=t},enumerable:!0,configurable:!0}),NMe.prototype.toString=function(){return this===this.axClass.dPrototype?"":this.hasComplexContent()?this.toXMLString():toString(this,this.sec)},NMe.prototype.native_hasOwnProperty=function(t){if(this===this.axClass.dPrototype)return ASObject.prototype.native_hasOwnProperty.call(this,t);var e=toXMLName(t,this.sec);return!!this.hasProperty(e)||this.axHasOwnProperty(e)},NMe.prototype.native_propertyIsEnumerable=function(t){return void 0===t&&(t=void 0),"0"===String(t)},NMe.prototype.addNamespace=function(t){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this._addInScopeNamespace(t),this},NMe.prototype.appendChild=function(t){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this.insert(this._children.length,t),this},NMe.prototype.attribute=function(t){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),isNullOrUndefined$1(t)&&0<arguments.length&&this.sec.throwError("TypeError",Errors$1.ConvertUndefinedToObjectError),t&&t.axClass===this.sec.AXQName?this.getProperty(t.name):("*"!==(t=axCoerceString$2(t))&&0!==arguments.length||(t=null),tmpMultiname.name=t,tmpMultiname.namespaces=[Namespace.PUBLIC],tmpMultiname.kind=13,this.getProperty(tmpMultiname))},NMe.prototype.attributes=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");var t=this.sec.AXXMLList.CreateList(this,this._name);return Array.prototype.push.apply(t._children,this._attributes),t},NMe.prototype.child=function(t){if(this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),isIndex(t)){var e=this.sec.AXXMLList.CreateList(null,null);return this._children&&t<this._children.length&&e.append(this._children[0|t]),e}var i;return t&&t.axClass===this.sec.AXQName?i=t.name:((i=tmpMultiname).kind=7,i.name=toString(t,this.sec)),this.getProperty(i)},NMe.prototype.childIndex=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this._parent&&2!==this._kind?this._parent._children.indexOf(this):-1},NMe.prototype.children=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");var t=this.sec.AXXMLList.CreateList(this,this._name);return t._children=this._children.concat(),t},NMe.prototype.comments=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");var i=this.sec.AXXMLList.CreateList(this,this._name);return this._children&&this._children.forEach(function(t,e){4===t._kind&&i.append(t)}),i},NMe.prototype.contains=function(t){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this===t},NMe.prototype.copy=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this._deepCopy()},NMe.prototype.descendants=function(t){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");var e=this.sec.AXXMLList.CreateList(this,this._name);return this.descendantsInto(toXMLName(t,this.sec),e)},NMe.prototype.elements=function(t){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this.getProperty(toXMLName(t,this.sec))},NMe.prototype.hasComplexContent=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),2!==this._kind&&4!==this._kind&&5!==this._kind&&3!==this._kind&&this._children.some(function(t){return 1===t._kind})},NMe.prototype.hasSimpleContent=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),4!==this._kind&&5!==this._kind&&(1!==this._kind||!this._children&&0===this._children.length||this._children.every(function(t){return 1!==t._kind}))},NMe.prototype.inScopeNamespaces=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");for(var t=this._inScopeNamespacesImpl(),e=[],i=0;i<t.length;i++){var n=this.sec.AXNamespace;e[i]=n.FromNamespace(t[i])}return this.sec.AXArray.axBox(e)},NMe.prototype._inScopeNamespacesImpl=function(){for(var t=this,e=[],i=e;null!==t;){for(var n=t._inScopeNamespaces,r=0;n&&r<n.length;r++){var o=n[r];i[o.prefix]||(i[o.prefix]=o,e.push(o))}t=t._parent}return e},NMe.prototype.insertChildAfter=function(t,e){if(this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),!(1<this._kind)){if(null==t)return this.insert(0,e),this;if(t.axClass===this.sec.AXXMLList&&1===t._children.length&&(t=t._children[0]),t.axClass===this.sec.AXXML)for(var i=0;i<this._children.length;i++)if(this._children[i]===t)return this.insert(i+1,e),this}},NMe.prototype.insertChildBefore=function(t,e){if(this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),!(1<this._kind)){if(null==t)return this.insert(this._children.length,e),this;if(t.axClass===this.sec.AXXMLList&&1===t._children.length&&(t=t._children[0]),t.axClass===this.sec.AXXML)for(var i=0;i<this._children.length;i++)if(this._children[i]===t)return this.insert(i,e),this}},NMe.prototype.length=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this._children?this._children.length:0},NMe.prototype.localName=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this._name.name},NMe.prototype.name=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),this.sec.AXQName.FromMultiname(this._name)},NMe.prototype.namespace=function(t){if(this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),0===arguments.length&&3<=this._kind)return null;var e=this._inScopeNamespacesImpl();if(0===arguments.length)return this.sec.AXNamespace.FromNamespace(GetNamespace(this._name,e));t=axCoerceString$2(t);for(var i=0;i<e.length;i++){var n=e[i];if(n.prefix===t)return this.sec.AXNamespace.FromNamespace(n)}},NMe.prototype.namespaceDeclarations=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML")},NMe.prototype.nodeKind=function(){return this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML"),ASXMLKindNames[this._kind]},NMe.prototype.normalize=function(){this&&this.axClass===this.sec.AXXML||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,this,"XML");for(var t=0;t<this._children.length;){var e=this._children[t];if(1===e._kind)e.normalize(),t++;else if(3===e._kind){for(;t+1<this._children.length;){var i=this._children[t+1];if(3!==i._kind)break;e._value+=i._value,this.removeByIndex(t+1)}0===e._value.length||isWhitespaceString(e._value)?this.removeByIndex(t):t++}else t++}return this},NMe.prototype.removeByIndex=function(t){this._children[t]._parent=null,this._children.splice(t,1)},NMe.prototype.parent=function(){return this._parent||void 0},NMe.prototype.processingInstructions=function(t){var e=this.sec.AXXMLList.CreateList(this,this._name);return e._targetObject=this,e._targetProperty=null,this.processingInstructionsInto(toXMLName(t,this.sec),e)},NMe.prototype.processingInstructionsInto=function(t,e){var i=t||"*",n=this._children;if(!n)return e;for(var r=0;r<n.length;r++){var o=n[r];5!==o._kind||"*"!==i&&o._name.name!==i||e._children.push(o)}return e},NMe.prototype.prependChild=function(t){return this.insert(0,t),this},NMe.prototype.removeNamespace=function(t){},NMe.prototype.replace=function(t,e){if(1===this._kind){var i=!e||e.axClass!==this.axClass&&e.axClass!==this.sec.AXXMLList?axCoerceString$2(e):e._deepCopy(),n=toXMLName(t,this.sec);if(isIndex(n.name))return this._replaceByIndex(0|n.name,i),this;for(var r=n.isAnyName(),o=-1,s=this._children,a=s.length;a--;){var l=s[a];(r||1===l._kind&&l._name.matches(n))&&(-1!==o&&this.deleteByIndex(o),o=a)}return-1===o||this._replaceByIndex(o,i),this}},NMe.prototype._replaceByIndex=function(t,e){if(1<this._kind)return this;var i=this._children;if(t>i.length&&(t=i.length),e&&e.axClass===this.axClass&&2!==e._kind){if(1===e._kind)for(var n=this;n;)n===e&&this.sec.throwError("Error",Errors$1.XMLIllegalCyclicalLoop),n=n._parent;e._parent=this,i[t]&&(i[t]._parent=null),i[t]=e}else if(e&&e.axClass===this.sec.AXXMLList)if(0===e._children.length)this.deleteByIndex(t);else{var r=e._children.length;if(t<i.length){i[t]._parent=null;for(var o=i.length-1;t<o;o--)i[o+r]=i[o]}for(o=0;o<r;o++){var s=e._children[o];s._parent=this,i[o+t]=s}}else{var a=axCoerceString$2(e),l=this.axClass.Create();l._kind=3,l._value=a,l._parent=this,i[t]&&(i[t]._parent=null),i[t]=l}},NMe.prototype.setChildren=function(t){return this.setProperty(anyMultiname,t),this},NMe.prototype.setLocalName=function(t){var e;3!==this._kind&&4!==this._kind&&(e=t&&t.axClass===this.sec.AXQName?t.localName:axCoerceString$2(t),this._name.name=e)},NMe.prototype.setName=function(t){if(3!==this._kind&&4!==this._kind){t&&t.axClass===this.sec.AXQName&&null===t.uri&&(t=t.localName);var e=this.sec.AXQName.Create(t).name;5===this._kind&&(e.namespaces[0]=Namespace.PUBLIC),this._name=e;var i=this;if(2===this._kind){if(null===this._parent)return;i=this._parent}i.addInScopeNamespace(e.namespaces[0])}},NMe.prototype.setNamespace=function(t){var e;3!==this._kind&&4!==this._kind&&5!==this._kind&&(e=this.sec.AXNamespace.Create(t)._ns,this._name.namespaces=[e],2===this._kind?this._parent&&this._parent.addInScopeNamespace(e):1===this._kind&&this.addInScopeNamespace(e))},NMe.prototype.text=function(){var i=this.sec.AXXMLList.CreateList(this,this._name);return this._children&&this._children.forEach(function(t,e){3===t._kind&&i.append(t)}),i},NMe.prototype.toXMLString=function(){return this.toXMLStringImpl()},NMe.prototype.toXMLStringImpl=function(r,t){var e=this.sec,i=e.AXXML.prettyPrinting;t|=0;var o=i?getIndentString(t):"";switch(this._kind){case 3:return i?o+escapeElementValue(e,trimWhitespaces(this._value)):escapeElementValue(e,this._value);case 2:return o+escapeAttributeValue(this._value);case 4:return o+"\x3c!--"+this._value+"--\x3e";case 5:return o+"<?"+this._name.name+" "+this._value+"?>"}r=r||[];for(var s=[],n=0;this._inScopeNamespaces&&n<this._inScopeNamespaces.length;n++){var a=this._inScopeNamespaces[n];r.every(function(t){return t.uri!==a.uri||t.prefix!==a.prefix})&&s.push(a)}var l,c,h=r.concat(s);void 0===(u=GetNamespace(this._name,h)).prefix&&(l=generateUniquePrefix(h),c=internPrefixedNamespace(0,u.uri,l),s.push(c),h.push(c));var u,p,d=(u.prefix?u.prefix+":":"")+this._name.name;for(o+="<"+d,this._attributes&&this._attributes.forEach(function(t){var e,i,n=GetNamespace(t._name,h);void 0===n.prefix&&(e=generateUniquePrefix(h),i=internPrefixedNamespace(0,n.uri,e),s.push(i),h.push(i))}),n=0;n<s.length;n++)""!==(u=s[n]).uri&&(p=u.prefix?"xmlns:"+u.prefix:"xmlns",o+=" "+p+'="'+escapeAttributeValue(u.uri)+'"');if(this._attributes&&this._attributes.forEach(function(t){var e=t._name,i=GetNamespace(e,r),n=i.prefix?i.prefix+":"+e.name:e.name;o+=" "+n+'="'+escapeAttributeValue(t._value)+'"'}),0===this._children.length)return o+="/>";o+=">";var _=1<this._children.length||1===this._children.length&&3!==this._children[0]._kind,f=i&&_?t+e.AXXML._prettyIndent:0;return this._children.forEach(function(t,e){i&&_&&(o+="\n"),o+=t.toXMLStringImpl(h,f)}),i&&_&&(o+="\n"+getIndentString(t)),o+="</"+d+">"},NMe.prototype.toJSON=function(t){return"XML"},NMe.prototype.axGetEnumerableKeys=function(){if(this===this.axClass.dPrototype)return MMe.prototype.axGetEnumerableKeys.call(this);for(var t=[],e=0;e<this._children.length;e++)t.push(this._children[e]._name.name);return t},NMe.prototype.setProperty=function(t,e){var i,n=this.sec;if(t.isAnyName()||t.isAttribute()||t.name!==t.name>>>0||n.throwError("TypeError",Errors$1.XMLAssignmentToIndexedXMLNotAllowed),3!==this._kind&&4!==this._kind&&5!==this._kind&&2!==this._kind)if(i=isXMLType(e,n)&&3!==e._kind&&2!==e._kind?e._deepCopy():toString(e,n),t.isAttribute()){if(i&&i.axClass===n.AXXMLList)if(0===i._children.length)i="";else{for(var r=toString(i._children[0],n),o=1;o<i._children.length;o++)r+=" "+toString(i._children[o],n);i=r}else i=axCoerceString$2(i);for(var s=null,a=this._attributes,l=this._attributes=[],o=0;a&&o<a.length;o++){var c=a[o];if(c._name.matches(t)){if(s){c._parent=null;continue}s=c}l.push(c)}if(!s){if(t.isAnyName())return;var h="";1===t.namespaces.length&&(h=t.namespaces[0].uri),(s=createXML(n,2,h,t.name))._parent=this,l.push(s)}s._value=i}else{for(var u,p,d,_,f,m=t.isAnyName(),g=!isXMLType(i,n)&&!m&&"*"!==t.name,y=t.isAnyNamespace(),b=this._children.length-1;0<=b;b--)(m||1===this._children[b]._kind&&this._children[b]._name.name===t.name)&&(y||1===this._children[b]._kind&&this._children[b]._name.matches(t))&&(void 0!==u&&this.deleteByIndex(u),u=b);if(void 0===u&&(u=this._children.length,g)&&((h=null)!==(f=t.namespaces[0]).uri&&(h=f.uri,d=f.prefix),null===h&&(h=(p=getDefaultNamespace(n)).uri,d=p.prefix),((_=createXML(n,1,h,t.name,d))._parent=this)._replaceByIndex(u,_),f=_._name.namespace,_.addInScopeNamespace(f)),g){var v=this._children[u]._children;for(o=v.length;o--;)v[o]._parent=null;v.length=0,""!==(r=toString(i,n))&&this._children[u]._replaceByIndex(0,r)}else this._replaceByIndex(u,i)}},NMe.prototype.axSetProperty=function(t,e,i){this!==this.axClass.dPrototype?this.setProperty(coerceE4XMultiname(t,this.sec),e):this[this.axResolveMultiname(t)]=e},NMe.prototype.getProperty=function(t){var e=t.name;if(isIndex(e))return 0==(0|e)?this:null;var i=this.sec.AXXMLList.CreateList(this,t),n=0,r=t.isAnyName(),o=t.isAnyNamespace();if(t.isAttribute()){for(var s=0;this._attributes&&s<this._attributes.length;s++){var a=this._attributes[s];!r&&a._name.name!==e||!o&&!a._name.matches(t)||(i._children[n++]=a,assert(i._children[0]))}return i}for(s=0;this._children&&s<this._children.length;s++)a=this._children[s],(r||1===a._kind&&a._name.name===e)&&(o||a._name.matches(t))&&(i._children[n++]=a,assert(i._children[0]));return i},NMe.prototype.axGetProperty=function(t){return this===this.axClass.dPrototype?this[this.axResolveMultiname(t)]:this.getProperty(coerceE4XMultiname(t,this.sec))},NMe.prototype.hasProperty=function(t){if(isIndex(t.name))return 0==(0|t.name);var e=toXMLName(t,this.sec),i=e.isAnyName(),n=e.isAnyNamespace();if(t.isAttribute()){for(var r=0;this._attributes&&r<this._attributes.length;r++){var o=this._attributes[r];if(i||o._name.matches(e))return!0}return!1}for(r=0;this._children&&r<this._children.length;r++)if(o=this._children[r],(i||1===o._kind&&o._name.name===e.name)&&(n||1===o._kind&&o._name.matches(e)))return!0;return!1},NMe.prototype.deleteProperty=function(t){if(isIndex(t.name))return!0;var i=toXMLName(t,this.sec),e=i.name,n=t.isAnyName(),r=t.isAnyNamespace();if(t.isAttribute()){var o=this._attributes;if(o)for(var s=this._attributes=[],a=0;a<o.length;a++){var l=o[a],c=l._name;!n&&c.name!==e||!r&&!c.matches(i)?s.push(l):l._parent=null}}else if(this._children.some(function(t,e){return(n||1===t._kind&&t._name.name===i.name)&&(r||1===t._kind&&t._name.matches(i))}))return!0},NMe.prototype.axHasProperty=function(t){return this===this.axClass.dPrototype?MMe.prototype.axHasPropertyInternal.call(this,t):this.axHasPropertyInternal(t)},NMe.prototype.axHasPropertyInternal=function(t){return!!this.hasProperty(t)||!!this[this.axResolveMultiname(t)]},NMe.prototype.axDeleteProperty=function(t){return!!this.deleteProperty(t)||delete this[this.axResolveMultiname(t)]},NMe.prototype.axCallProperty=function(t,e){var i=this[this.axResolveMultiname(t)];return(i=i||this["$Bg"+t.name])?(validateCall(this.sec,i,e.length),i.axApply(this,e)):this.hasSimpleContent()?this.sec.box(toString(this,this.sec)).axCallProperty(t,e):void this.sec.throwError("TypeError",Errors$1.CallOfNonFunctionError,"value")},NMe.prototype._delete=function(t,e){},NMe.prototype.deleteByIndex=function(t){if(String(t>>>0)!==String(t))throw"TypeError in XML.prototype.deleteByIndex(): invalid index "+t;var e=this._children;t<e.length&&e[t]&&(e[t]._parent=null,e.splice(t,1))},NMe.prototype.insert=function(t,e){if(!(1<this._kind)){var i=t;if(e&&e.axClass===this.axClass)for(var n=this;n;)n===e&&this.sec.throwError("TypeError",Errors$1.XMLIllegalCyclicalLoop),n=n._parent;var r=1;if(!e||e.axClass!==this.sec.AXXMLList||0!==(r=e._children.length)){for(var o=this._children,s=o.length-1;i<=s;s--)o[s+r]=o[s],assert(o[0]);if(e&&e.axClass===this.sec.AXXMLList)for(r=e._children.length,s=0;s<r;s++)e._children[s]._parent=this,o[i+s]=e._children[s];else e&&e.axClass===this.axClass||(e=this.sec.AXXML.Create(e)),e._parent=this,o||(this._children=o=[]),o[i]=e,assert(o[0])}}},NMe.prototype.addInScopeNamespace=function(i){if(3!==this._kind&&4!==this._kind&&5!==this._kind&&2!==this._kind){var n=i.prefix;if(void 0!==n){if(""===n&&""===this._name.uri)return;var r=null;this._inScopeNamespaces.forEach(function(t,e){t.prefix===n&&(r=t)}),null!==r&&r.uri!==i.uri&&this._inScopeNamespaces.forEach(function(t,e){t.prefix===r.prefix&&(this._inScopeNamespaces[e]=i)}),this._name.prefix===n&&(this._name.prefix=void 0),this._attributes.forEach(function(t,e){t._name.prefix===n&&(t._name.prefix=void 0)})}}},NMe.prototype.descendantsInto=function(i,n){if(1!==this._kind)return n;var r=n._children.length,o=i.isAnyName();return i.isAttribute()?this._attributes.forEach(function(t,e){(o||t._name.matches(i))&&(n._children[r++]=t,assert(n._children[0]))}):this._children.forEach(function(t,e){(o||t._name.matches(i))&&(n._children[r++]=t,assert(n._children[0]))}),this._children.forEach(function(t,e){t.descendantsInto(i,n)}),n},(NMe.instanceConstructor=NMe)._flags=ASXML_FLAGS.ALL,NMe._prettyIndent=2,NMe),MMe;function NMe(t){var e=MMe.call(this)||this;if(e._parent=null,isNullOrUndefined$1(t)&&(t=""),"string"==typeof t&&0===t.length)return e._kind=3,e._value="",e;var i=toXML(t,e.sec);isXMLType(t,e.sec)&&(i=i._deepCopy()),e._kind=i._kind,e._name=i._name,e._value=i._value,e._attributes=i._attributes,e._inScopeNamespaces=i._inScopeNamespaces;var n=i._children;if(e._children=n)for(var r=0;r<n.length;r++)n[r]._parent=e;return e}function createXML(t,e,i,n,r){void 0===e&&(e=3),void 0===i&&(i=""),void 0===n&&(n="");var o=t.AXXML.Create(),s=internPrefixedNamespace(0,i,r||""),a=new Multiname(null,0,2===e?13:7,[s],n,null);return o.init(e,a),o}var ASXMLList=(rRe=ASObject,__extends(sRe,rRe),sRe.classInitializer=function(){defineNonEnumerableProperty(this,"$Bglength",1);var t=this.dPrototype,e=sRe.prototype;defineNonEnumerableProperty(t,"$BgvalueOf",Object.prototype.$BgvalueOf),defineNonEnumerableProperty(t,"$BghasOwnProperty",e.native_hasOwnProperty),defineNonEnumerableProperty(t,"$BgpropertyIsEnumerable",e.native_propertyIsEnumerable),addPrototypeFunctionAlias(t,"$BgtoString",e.toString),addPrototypeFunctionAlias(t,"$BgaddNamespace",e.addNamespace),addPrototypeFunctionAlias(t,"$BgappendChild",e.appendChild),addPrototypeFunctionAlias(t,"$Bgattribute",e.attribute),addPrototypeFunctionAlias(t,"$Bgattributes",e.attributes),addPrototypeFunctionAlias(t,"$Bgchild",e.child),addPrototypeFunctionAlias(t,"$BgchildIndex",e.childIndex),addPrototypeFunctionAlias(t,"$Bgchildren",e.children),addPrototypeFunctionAlias(t,"$Bgcomments",e.comments),addPrototypeFunctionAlias(t,"$Bgcontains",e.contains),addPrototypeFunctionAlias(t,"$Bgcopy",e.copy),addPrototypeFunctionAlias(t,"$Bgdescendants",e.descendants),addPrototypeFunctionAlias(t,"$Bgelements",e.elements),addPrototypeFunctionAlias(t,"$BghasComplexContent",e.hasComplexContent),addPrototypeFunctionAlias(t,"$BghasSimpleContent",e.hasSimpleContent),addPrototypeFunctionAlias(t,"$BginScopeNamespaces",e.inScopeNamespaces),addPrototypeFunctionAlias(t,"$BginsertChildAfter",e.insertChildAfter),addPrototypeFunctionAlias(t,"$BginsertChildBefore",e.insertChildBefore),addPrototypeFunctionAlias(t,"$Bglength",e.length),addPrototypeFunctionAlias(t,"$BglocalName",e.localName),addPrototypeFunctionAlias(t,"$Bgname",e.name),addPrototypeFunctionAlias(t,"$Bgnamespace",e.namespace),addPrototypeFunctionAlias(t,"$BgnamespaceDeclarations",e.namespaceDeclarations),addPrototypeFunctionAlias(t,"$BgnodeKind",e.nodeKind),addPrototypeFunctionAlias(t,"$Bgnormalize",e.normalize),addPrototypeFunctionAlias(t,"$Bgparent",e.parent),addPrototypeFunctionAlias(t,"$BgprocessingInstructions",e.processingInstructions),addPrototypeFunctionAlias(t,"$BgprependChild",e.prependChild),addPrototypeFunctionAlias(t,"$BgremoveNamespace",e.removeNamespace),addPrototypeFunctionAlias(t,"$Bgreplace",e.replace),addPrototypeFunctionAlias(t,"$BgsetChildren",e.setChildren),addPrototypeFunctionAlias(t,"$BgsetLocalName",e.setLocalName),addPrototypeFunctionAlias(t,"$BgsetName",e.setName),addPrototypeFunctionAlias(t,"$BgsetNamespace",e.setNamespace),addPrototypeFunctionAlias(t,"$Bgtext",e.text),addPrototypeFunctionAlias(t,"$BgtoXMLString",e.toXMLString),addPrototypeFunctionAlias(t,"$BgtoJSON",e.toJSON)},sRe.axApply=function(t,e){var i=e[0];if(isNullOrUndefined$1(i)&&(i=""),i&&i.axClass===this.sec.AXXMLList)return i;var n=this.sec.AXXMLList.Create();return toXMLList(i,n),n},sRe.addXML=function(t,e){var i;return t.axClass===t.sec.AXXML?(i=t.sec.AXXMLList.Create()).append(t):i=t,i.append(e),i},sRe.Create=function(t){var e=Object.create(this.sec.AXXMLList.tPrototype);return e.axInitializer(t),e},sRe.CreateList=function(t,e){var i=this.Create();return i._targetObject=t,i._targetProperty=e,i},sRe.prototype.valueOf=function(){return this},sRe.prototype.equals=function(t){var e=this._children;if(void 0===t&&0===e.length)return!0;if(t&&t.axClass===this.sec.AXXMLList){var i=t._children;if(i.length!==e.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].equals(i[n]))return!1;return!0}return 1===e.length&&e[0].equals(t)},sRe.prototype.toString=function(){if(this.hasComplexContent())return this.toXMLString();for(var t="",e=0;e<this._children.length;e++)t+=toString(this._children[e],this.sec);return t},sRe.prototype._deepCopy=function(){for(var t=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty),e=this._children.length,i=0;i<e;i++)t._children[i]=this._children[i]._deepCopy(),assert(t._children[0]);return t},sRe.prototype._shallowCopy=function(){for(var t=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty),e=this._children.length,i=0;i<e;i++)t._children[i]=this._children[i],assert(t._children[0]);return t},sRe.prototype.native_hasOwnProperty=function(t){if(t=axCoerceString$2(t),this===this.sec.AXXMLList.dPrototype)return ASObject.prototype.native_hasOwnProperty.call(this,t);if(isIndex(t))return(0|t)<this._children.length;for(var e=toXMLName(t,this.sec),i=this._children,n=0;n<i.length;n++){var r=i[n];if(1===r._kind&&r.hasProperty(e))return!0}return!1},sRe.prototype.native_propertyIsEnumerable=function(t){return isIndex(t)&&(0|t)<this._children.length},sRe.prototype.attribute=function(t){return isNullOrUndefined$1(t)&&0<arguments.length&&this.sec.throwError("TypeError",Errors$1.ConvertUndefinedToObjectError),t&&t.axClass===this.sec.AXQName?this.getProperty(t.name):("*"!==(t=axCoerceString$2(t))&&0!==arguments.length||(t=null),tmpMultiname.name=t,tmpMultiname.namespaces=[Namespace.PUBLIC],tmpMultiname.kind=13,this.getProperty(tmpMultiname))},sRe.prototype.attributes=function(){return tmpMultiname.name=null,tmpMultiname.namespaces=[],tmpMultiname.kind=13,this.getProperty(tmpMultiname)},sRe.prototype.child=function(t){if(isIndex(t)){var e=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty);return(0|t)<this._children.length&&(e._children[0]=this._children[0|t]._deepCopy(),assert(e._children[0])),e}return this.getProperty(toXMLName(t,this.sec))},sRe.prototype.children=function(){return this.getProperty(anyMultiname)},sRe.prototype.descendants=function(t){for(var e=toXMLName(t,this.sec),i=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty),n=0;n<this._children.length;n++){var r=this._children[n];1===r._kind&&r.descendantsInto(e,i)}return i},sRe.prototype.comments=function(){var i=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty);return this._children.forEach(function(t){var e;1===t._kind&&(e=t.comments(),Array.prototype.push.apply(i._children,e._children))}),i},sRe.prototype.contains=function(t){for(var e=this._children,i=0;i<e.length;i++)if(e[i].equals(t))return!0;return!1},sRe.prototype.copy=function(){return this._deepCopy()},sRe.prototype.elements=function(t){var i=toXMLName(t,this.sec),n=this.sec.AXXMLList.CreateList(this._targetObject,i);return this._children.forEach(function(t){var e;1===t._kind&&(e=t.elements(i),Array.prototype.push.apply(n._children,e._children))}),n},sRe.prototype.hasComplexContent=function(){switch(this._children.length){case 0:return!1;case 1:return this._children[0].hasComplexContent();default:return this._children.some(function(t){return 1===t._kind})}},sRe.prototype.hasSimpleContent=function(){switch(this._children.length){case 0:return!0;case 1:return this._children[0].hasSimpleContent();default:return this._children.every(function(t){return 1!==t._kind})}},sRe.prototype.length=function(){return this._children.length},sRe.prototype.name=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"name"),this._children[0].name()},sRe.prototype.normalize=function(){for(var t=0;t<this._children.length;){var e=this._children[t];if(1===e._kind)e.normalize(),t++;else if(3===e._kind){for(t++;t<this._children.length;){var i=this._children[t];if(3!==i._kind)break;e._value+=i._value,this.removeByIndex(t)}0===e._value.length?this.removeByIndex(t):t++}else t++}return this},sRe.prototype.parent=function(){var t=this._children;if(0!==t.length){for(var e=t[0]._parent,i=1;i<t.length;i++)if(t[i]._parent!==e)return;return e}},sRe.prototype.processingInstructions=function(t){var e=toXMLName(t,this.sec),i=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty);i._targetObject=this,i._targetProperty=null;for(var n=this._children,r=0;r<n.length;r++)n[r].processingInstructionsInto(e,i);return i},sRe.prototype.text=function(){var n=this.sec.AXXMLList.CreateList(this._targetObject,this._targetProperty);return this._children.forEach(function(t,e){var i;1!==t._kind||0<(i=t.text())._children.length&&n._children.push(i)}),n},sRe.prototype.toXMLString=function(){var e=this.sec;return this._children.map(function(t){return toXMLString(e,t)}).join(e.AXXML.prettyPrinting?"\n":"")},sRe.prototype.toJSON=function(t){return"XMLList"},sRe.prototype.addNamespace=function(t){1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"addNamespace");var e=this._children[0];return e.addNamespace(t),e},sRe.prototype.appendChild=function(t){1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"appendChild");var e=this._children[0];return e.appendChild(t),e},sRe.prototype.append=function(t){var e=this._children,i=e.length;if(t&&t.axClass===this.sec.AXXMLList){this._targetObject=t._targetObject,this._targetProperty=t._targetProperty;var n=t._children;if(0===n.length)return;for(var r=0;r<n.length;r++)e[i+r]=n[r]}else e[i]=t},sRe.prototype.childIndex=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"childIndex"),this._children[0].childIndex()},sRe.prototype.inScopeNamespaces=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"inScopeNamespaces"),this._children[0].inScopeNamespaces()},sRe.prototype.insertChildAfter=function(t,e){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"insertChildAfter"),this._children[0].insertChildAfter(t,e)},sRe.prototype.insertChildBefore=function(t,e){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"insertChildBefore"),this._children[0].insertChildBefore(t,e)},sRe.prototype.nodeKind=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"nodeKind"),this._children[0].nodeKind()},sRe.prototype.namespace=function(t){1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"namespace");var e=this._children[0];return arguments.length?e.namespace(t):e.namespace()},sRe.prototype.localName=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"localName"),this._children[0].localName()},sRe.prototype.namespaceDeclarations=function(){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"namespaceDeclarations"),this._children[0].namespaceDeclarations()},sRe.prototype.prependChild=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"prependChild"),this._children[0].prependChild(t)},sRe.prototype.removeNamespace=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"removeNamespace"),this._children[0].removeNamespace(t)},sRe.prototype.replace=function(t,e){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"replace"),this._children[0].replace(t,e)},sRe.prototype.setChildren=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"setChildren"),this._children[0].setChildren(t)},sRe.prototype.setLocalName=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"setLocalName"),this._children[0].setLocalName(t)},sRe.prototype.setName=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"setName"),this._children[0].setName(t)},sRe.prototype.setNamespace=function(t){return 1!==this._children.length&&this.sec.throwError("TypeError",Errors$1.XMLOnlyWorksWithOneItemLists,"setNamespace"),this._children[0].setNamespace(t)},sRe.prototype.axGetEnumerableKeys=function(){return this===this.axClass.dPrototype?rRe.prototype.axGetEnumerableKeys.call(this):Object.keys(this._children)},sRe.prototype.getProperty=function(t){var e=t.name;if(isIndex(e))return this._children[0|e];for(var i=null===e||"*"===e,n=t.isAnyNamespace(),r=t.isAttribute(),o=this.sec.AXXMLList.CreateList(this._targetObject,t),s=this._children,a=0;a<s.length;a++)if(1===(h=s[a])._kind)if(r)for(var l=h._attributes,c=0;l&&c<l.length;c++){var h=l[c];!i&&h._name.name!==e||!n&&!h._name.matches(t)||o._children.push(h)}else for(var u=h._children,c=0;u&&c<u.length;c++)h=u[c],(i||1===h._kind&&h._name.name===e)&&(n||h._name.matches(t))&&o._children.push(h);return o},sRe.prototype.axGetProperty=function(t){return this===this.axClass.dPrototype?this[this.axResolveMultiname(t)]:this.getProperty(coerceE4XMultiname(t,this.sec))},sRe.prototype.axGetPublicProperty=function(t){return this===this.axClass.dPrototype?this[Multiname.getPublicMangledName(t)]:isIndex(t)?this._children[0|t]:(tmpMultiname.name=t,tmpMultiname.namespaces=[Namespace.PUBLIC],tmpMultiname.kind=7,this.getProperty(tmpMultiname))},sRe.prototype.hasProperty=function(t){return!isIndex(t.name)||Number(t.name)<this._children.length},sRe.prototype.axHasProperty=function(t){return this.hasProperty(t)},sRe.prototype.axHasPropertyInternal=function(t){return this.hasProperty(t)},sRe.prototype.resolveValue=function(){return this},sRe.prototype.setProperty=function(t,e){if(isIndex(t.name)){var i=0|t.name,n=null;if(this._targetObject&&null===(n=this._targetObject.resolveValue()))return;var r=this._children.length;if(r<=i){if(n&&n.axClass===this.sec.AXXMLList){if(1!==n._children.length)return;n=n._children[0]}if(n&&1!==n._kind)return;var o=this.sec.AXXML.Create();o._parent=n;var s=this._targetProperty,a=3;if(this._targetProperty&&this._targetProperty.isAttribute()){if(n.hasProperty(this._targetProperty))return;a=2}else a=this._targetProperty&&null!==this._targetProperty.name?1:(s=null,3);if(o.init(a,s),i=r,2!==o._kind){if(null!==n){if(0<i)for(var l=this._children[i-1],c=n._children.length-1,h=0;h<c&&n._children[h]!==l;h++);else h=n._children.length-1;n._children[h+1]=o,assert(n._children[0]),o._parent=n}e&&e.axClass===this.sec.AXXML?o._name=e._name:e&&e.axClass===this.sec.AXXMLList&&(o._name=e._targetProperty),this.append(o)}}isXMLType(e,this.sec)&&3!==e._kind&&2!==e._kind||(e+="");var u,p=this._children[i],d=p._kind,_=p._parent;if(2===d){var f=_._children.indexOf(p);return _.setProperty(p._name,!1),this._children[i]=_._children[f],void assert(this._children[0])}if(e&&e.axClass===this.sec.AXXMLList){var m=e._shallowCopy(),g=m._children.length;if(null!==_){var y=_._children.indexOf(p);_._replaceByIndex(y,m);for(var h=0;h<g;h++)m._children[h]=_._children[y+h]}if(0===g){for(h=i+1;h<r;h++)this._children[h-1]=this._children[h],assert(this._children[0]);this._children.length--}else for(h=r-1;i<h;h--)this._children[h+g-1]=this._children[h],assert(this._children[0]);for(h=0;h<g;h++)this._children[i+h]=m._children[h],assert(this._children[0]);return}if(3<=d||e&&e.axClass===this.sec.AXXML)return null!==_&&(y=_._children.indexOf(p),_._replaceByIndex(y,e),e=_._children[y]),"string"==typeof e?(u=this.sec.AXXML.Create(e),this._children[i]=u):this._children[i]=e,void assert(this._children[0]);p.setProperty(anyMultiname,e)}else{if(0===this._children.length){if(null===(n=this.resolveValue())||1!==n._children.length)return;this.append(n._children[0])}1!==this._children.length?this.sec.throwError("TypeError",Errors$1.XMLAssigmentOneItemLists):this._children[0].setProperty(t,e)}},sRe.prototype.axSetProperty=function(t,e,i){this!==this.axClass.dPrototype?this.setProperty(coerceE4XMultiname(t,this.sec),e):this[this.axResolveMultiname(t)]=e},sRe.prototype.axDeleteProperty=function(t){var e=t.name;if(isIndex(e))return(i=0|e)>=this._children.length||this.removeByIndex(i),!0;for(var i=0;i<this._children.length;i++){var n=this._children[i];1===n._kind&&n.deleteProperty(t)}return!0},sRe.prototype.removeByIndex=function(t){var e=this._children[t],i=e._parent;i&&(e._parent=null,i._children.splice(i._children.indexOf(e),1)),this._children.splice(t,1)},sRe.prototype.axCallProperty=function(t,e){var i=this[this.axResolveMultiname(t)];return i?(validateCall(this.sec,i,e.length),i.axApply(this,e)):1===this._children.length?this._children[0].axCallProperty(t,e):void this.sec.throwError("TypeError",Errors$1.CallOfNonFunctionError,"value")},sRe.instanceConstructor=sRe),XMLSpecialChars,rRe,fUe;function sRe(t){var e=rRe.call(this)||this;if(e._children=[],isNullOrUndefined$1(t)&&(t=""),!t)return e;if(t&&t.axClass===e.sec.AXXMLList)for(var i=t._children,n=0;n<i.length;n++){var r=i[n];e._children[n]=r,assert(e._children[0])}else toXMLList(t,e);return e}fUe=XMLSpecialChars=XMLSpecialChars||{},fUe[fUe.APOS=39]="APOS",fUe[fUe.AMP=38]="AMP",fUe[fUe.QUOT=34]="QUOT",fUe[fUe.LT=60]="LT",fUe[fUe.GT=62]="GT";var XMLNode$1=(gUe=ASObject,__extends(hUe,gUe),hUe.escapeXML=function(t){for(var e,i=0,n=(t=axCoerceString$2(t)).length;i<n&&(e=t.charCodeAt(i))!==XMLSpecialChars.APOS&&e!==XMLSpecialChars.AMP&&e!==XMLSpecialChars.QUOT&&e!==XMLSpecialChars.LT&&e!==XMLSpecialChars.GT;)i++;if(n<=i)return t;for(var r=[t.substring(0,i)];i<n;){switch(e){case XMLSpecialChars.APOS:r.push("&apos;");break;case XMLSpecialChars.AMP:r.push("&amp;");break;case XMLSpecialChars.QUOT:r.push("&quot;");break;case XMLSpecialChars.LT:r.push("&lt;");break;case XMLSpecialChars.GT:r.push("&gt;")}for(var o=++i;i<n&&(e=t.charCodeAt(i))!==XMLSpecialChars.APOS&&e!==XMLSpecialChars.AMP&&e!==XMLSpecialChars.QUOT&&e!==XMLSpecialChars.LT&&e!==XMLSpecialChars.GT;)i++;o<i&&r.push(t.substring(o,i))}return r.join("")},hUe),XMLDocument$1=(qUe=XMLNode$1,__extends(rUe,qUe),rUe),XMLTag=(tUe=ASObject,__extends(uUe,tUe),Object.defineProperty(uUe.prototype,"type",{get:function(){return this._type},set:function(t){t>>>=0,this._type=t},enumerable:!0,configurable:!0}),Object.defineProperty(uUe.prototype,"empty",{get:function(){return this._empty},set:function(t){t=!!t,this._empty=t},enumerable:!0,configurable:!0}),Object.defineProperty(uUe.prototype,"value",{get:function(){return this._value},set:function(t){t=axCoerceString$2(t),this._value=t},enumerable:!0,configurable:!0}),Object.defineProperty(uUe.prototype,"attrs",{get:function(){return this._attrs},set:function(t){this._attrs=t},enumerable:!0,configurable:!0}),uUe),XMLNodeType$1=(AUe=ASObject,__extends(BUe,AUe),BUe),AUe,tUe,qUe,gUe;function BUe(){return AUe.call(this)||this}function uUe(){var t=tUe.call(this)||this;return t._type=0,t._value=null,t._empty=!1,t._attrs=null,t}function rUe(t){return qUe.call(this,1,"")||this}function hUe(t,e){return gUe.call(this)||this}function isWhitespace$1(t){for(var e=0;e<t.length;e++){var i=t[e];if(" "!==i&&"\n"!==i&&"\r"!==i&&"\t"!==i)return}return 1}var XMLParserForXMLDocument=(FUe=XMLParserBase,__extends(GUe,FUe),GUe.prototype.onError=function(t){this.queue.push(t)},GUe.prototype.onPi=function(t,e){},GUe.prototype.onComment=function(t){},GUe.prototype.onCdata=function(t){this.queue.push({type:4,value:t})},GUe.prototype.onDoctype=function(t){},GUe.prototype.onBeginElement=function(t,e,i){var n=this.sec.createObject();e.forEach(function(t){n.axSetPublicProperty(t.name,t.value)}),this.queue.push({type:1,value:t,empty:i,attrs:n})},GUe.prototype.onEndElement=function(t){this.queue.push({type:1,value:"/"+t})},GUe.prototype.onText=function(t){this.ignoreWhitespace&&isWhitespace$1(t)||this.queue.push({type:3,value:t})},GUe),XMLParser$1=(WUe=ASObject,__extends(XUe,WUe),XUe.prototype.startParse=function(t,e){t=axCoerceString$2(t),e=!!e;var i=new XMLParserForXMLDocument(this.sec);i.ignoreWhitespace=e,i.parseXml(t),this.queue=i.queue},XUe.prototype.getNext=function(t){if(0===this.queue.length)return-1;var e=this.queue.shift();if("number"==typeof e)return e;var i=e;return t.type=i.type,t.value=i.value,t.empty=i.empty||!1,t.attrs=i.attrs||null,0},XUe),AVMPlusFile=(cVe=ASObject,__extends(dVe,cVe),dVe.exists=function(){},dVe.read=function(){},dVe.write=function(){},dVe.readByteArray=function(){},dVe.writeByteArray=function(){},dVe),cVe,WUe,FUe;function dVe(){return null!==cVe&&cVe.apply(this,arguments)||this}function XUe(){return WUe.call(this)||this}function GUe(t){var e=FUe.call(this)||this;return e.sec=t,e.queue=[],e.ignoreWhitespace=!1,e}function initializeBuiltins(){builtinNativeClasses.Object=ASObject,builtinNativeClasses.Class=ASClass,builtinNativeClasses.Function=ASFunction,builtinNativeClasses.Boolean=ASBoolean,builtinNativeClasses["builtin.as$0.MethodClosure"]=ASMethodClosure,builtinNativeClasses.Number=ASNumber,builtinNativeClasses.int=ASInt,builtinNativeClasses.uint=ASUint,builtinNativeClasses.String=ASString,builtinNativeClasses.Array=ASArray,builtinNativeClasses["__AS3__.vec.Vector"]=Vector,builtinNativeClasses["__AS3__.vec.Vector$object"]=GenericVector,builtinNativeClasses["__AS3__.vec.Vector$int"]=Int32Vector,builtinNativeClasses["__AS3__.vec.Vector$uint"]=Uint32Vector,builtinNativeClasses["__AS3__.vec.Vector$double"]=Float64Vector,builtinNativeClasses.Namespace=ASNamespace,builtinNativeClasses.QName=ASQName,builtinNativeClasses.XML=ASXML,builtinNativeClasses.XMLList=ASXMLList,builtinNativeClasses["flash.xml.XMLNode"]=XMLNode$1,builtinNativeClasses["flash.xml.XMLDocument"]=XMLDocument$1,builtinNativeClasses["flash.xml.XMLParser"]=XMLParser$1,builtinNativeClasses["flash.xml.XMLTag"]=XMLTag,builtinNativeClasses["flash.xml.XMLNodeType"]=XMLNodeType$1,builtinNativeClasses.Math=ASMath,builtinNativeClasses.Date=ASDate,builtinNativeClasses.RegExp=ASRegExp,builtinNativeClasses.JSON=ASJSON,builtinNativeClasses["flash.utils.Proxy"]=ASProxy,builtinNativeClasses["flash.utils.Dictionary"]=Dictionary,builtinNativeClasses["flash.utils.ByteArray"]=ByteArray$1,builtinNativeClasses["avmplus.System"]=OriginalSystem,builtinNativeClasses["avmplus.File"]=AVMPlusFile,builtinNativeClasses.Error=ASError,builtinNativeClasses.DefinitionError=ASDefinitionError,builtinNativeClasses.EvalError=ASEvalError,builtinNativeClasses.RangeError=ASRangeError,builtinNativeClasses.ReferenceError=ASReferenceError,builtinNativeClasses.SecurityError=ASSecurityError,builtinNativeClasses.SyntaxError=ASSyntaxError,builtinNativeClasses.TypeError=ASTypeError,builtinNativeClasses.URIError=ASURIError,builtinNativeClasses.VerifyError=ASVerifyError,builtinNativeClasses.UninitializedError=ASUninitializedError,builtinNativeClasses.ArgumentError=ASArgumentError,builtinNativeClasses["flash.errors.IOError"]=ASIOError,builtinNativeClasses["flash.errors.EOFError"]=ASEOFError,builtinNativeClasses["flash.errors.MemoryError"]=ASMemoryError,builtinNativeClasses["flash.errors.IllegalOperationError"]=ASIllegalOperationError}function registerNativeClass(t,e,i,n){void 0===i&&(i=t),void 0===n&&(n=0),nativeClasses[t]=e,nativeClassLoaderNames.push({name:t,alias:i,nsType:n})}function registerNativeFunction(t,e){nativeFunctions[t]=e}function axIsTypeString(t){return"string"==typeof t}function constructClassFromSymbol(t,e){var i=Object.create(e.tPrototype);return i._symbol||(i._symbol=t),i.applySmybol&&i.applySymbol(),i[IS_AX_CLASS]=!0,i}registerNativeClass("__AS3__.vec.Vector$object",GenericVector,"ObjectVector",2),registerNativeClass("__AS3__.vec.Vector$int",Int32Vector,"Int32Vector",2),registerNativeClass("__AS3__.vec.Vector$uint",Uint32Vector,"Uint32Vector",2),registerNativeClass("__AS3__.vec.Vector$double",Float64Vector,"Float64Vector",2),registerNativeFunction("FlashUtilScript::getDefinitionByName",FlashUtilScript_getDefinitionByName),registerNativeFunction("FlashUtilScript::getTimer",FlashUtilScript_getTimer),registerNativeFunction("FlashUtilScript::navigateToURL",FlashNetScript_navigateToURL),registerNativeFunction("FlashNetScript::navigateToURL",FlashNetScript_navigateToURL),registerNativeFunction("FlashNetScript::sendToURL",FlashNetScript_sendToURL),registerNativeFunction("FlashUtilScript::escapeMultiByte",wrapJSGlobalFunction(jsGlobal.escape)),registerNativeFunction("FlashUtilScript::unescapeMultiByte",wrapJSGlobalFunction(jsGlobal.unescape)),registerNativeFunction("Toplevel::registerClassAlias",Toplevel_registerClassAlias),registerNativeFunction("Toplevel::getClassByAlias",Toplevel_getClassByAlias);var Scope=(oVe.prototype.toString=function(){return this.parent+" => "+this.object+" "+this.isWith},oVe.prototype.init=function(t,e,i){void 0===i&&(i=!1),this.parent=t,this.object=e,this.global=t?t.global:this,this.isWith=i,this.cache=[],this.defaultNamespace=null,e.__scope__=this},Object.defineProperty(oVe.prototype,"superConstructor",{get:function(){var t=this.object.superClass;if(!t)return null;var e=t[IS_AX_CLASS]?t.tPrototype.axInitializer:t;return Object.defineProperty(this,"superConstructor",{value:e}),e},enumerable:!0,configurable:!0}),oVe.prototype.extend=function(t){if(t===this.object)return this;var e=t.__scope__;return e&&e.parent==this?e:new oVe(this,t,!1)},oVe.prototype.findDepth=function(t){for(var e=this,i=0;e;){if(e.object===t)return i;i++,e=e.parent}return-1},oVe.prototype.getScopeObjects=function(){for(var t=[],e=this;e;)t.unshift(e.object),e=e.parent;return t},oVe.prototype.getScopeProperty=function(t,e,i){return this.findScopeProperty(t,e,i).axGetProperty(t)},oVe.prototype.findScopeProperty=function(t,e,i){if(t.mutable||i)return this._findScopeProperty(t,e,i);if(t.scope===this.object)return t.value;var n=this._findScopeProperty(t,e,i);return t.value=n,t.scope=this.object,n},oVe.prototype._findScopeProperty=function(t,e,i){if(null===t.name&&this.global.object.sec.throwError("ReferenceError",Errors$1.UndefinedVarError,"*"),n=this.cache[t.id])return n;if(this.object&&this.object[IS_AX_CLASS]&&(this.isWith?this.object.axHasPropertyInternal(t):this.object.traits.getTrait(t.namespaces,t.name)))return this.isWith||t.isRuntime()?this.object:this.cache[t.id]=this.object;if(this.parent){var n=this.parent.findScopeProperty(t,e,i);return 7===t.kind&&(this.cache[t.id]=n),n}if(i)return null;t.isAttribute()&&this.object.sec.throwError("ReferenceError",Errors$1.UndefinedVarError,t.name);var r=this.global.object;return(n=r.applicationDomain.findProperty(t,e,!0))?n:(e&&(t.getPublicMangledName()in r||this.global.object.sec.throwError("ReferenceError",Errors$1.UndefinedVarError,t.name)),r)},oVe.ID=0,oVe);function oVe(t,e,i){void 0===i&&(i=!1),oVe.ID++,this[IS_AX_CLASS]=!0,this.init(t,e,i)}function safeGetPrototypeOf(t){var e=t.axClass;if(!e||e===e.sec.AXObject)return null;var i=e.dPrototype;return i===t&&(i=e.superClass.dPrototype),i}var HasNext2Info=(TVe.prototype.next=function(t,e){if(isNullOrUndefined$1(t))return this.index=0,void(this.object=null);this.object=t,this.index=e;var i=t.axNextNameIndex(this.index);if(0<i)this.index=i;else for(;;){if(!(t=safeGetPrototypeOf(t)))return this.index=0,void(this.object=null);if(0<(i=t.axNextNameIndex(0)))return this.index=i,void(this.object=t)}},TVe);function TVe(t,e){this.object=t,this.index=e}function axEquals(t,e,i){return isXMLType(t,i)?t.equals(e):isXMLType(e,i)?e.equals(t):t==e}function axIsXMLCollection(t,e){return e.AXXML.dPrototype.isPrototypeOf(t)||e.AXXMLList.dPrototype.isPrototypeOf(t)}function axGetDescendants(t,e,i){return axIsXMLCollection(t,i)||i.throwError("TypeError",Errors$1.DescendentsError,t),t.descendants(e)}function axCheckFilter(t,e){var i;return e&&isXMLCollection(t,e)||(i=e&&e.axClass?e.axClass.name.toFQNString(!1):"[unknown]",t.throwError("TypeError",Errors$1.FilterError,i)),e}function axConvertString(t){return"string"==typeof t?t:t+""}function axAdd(t,e,i){return"string"==typeof t||"string"==typeof e?String(t)+String(e):isXMLCollection(i,t)&&isXMLCollection(i,e)?ASXMLList.addXML(t,e):t+e}function axTypeOf(t,e){if(t){if(t.value)return typeof t.value;if(axIsXMLCollection(t,e))return"xml"}return typeof t}function getBytecodeName(t){return"Bytecode: "+t}var BytecodeFlags=new Uint32Array(256),BytecodeFormat=new Array(256);function define(t,e,i){void 0===i&&(i=0),e.length,BytecodeFlags[t]=i,BytecodeFormat[t]=e}function defineBytecodes(){define(1,""),define(2,""),define(3,""),define(4,"e"),define(5,"e"),define(6,"e"),define(7,""),define(8,"e"),define(9,""),define(10,""),define(11,""),define(12,"d"),define(13,"d"),define(14,"d"),define(15,"d"),define(16,"d"),define(17,"d"),define(18,"d"),define(19,"d"),define(20,"d"),define(21,"d"),define(22,"d"),define(23,"d"),define(24,"d"),define(25,"d"),define(26,"d"),define(27,""),define(28,""),define(29,""),define(30,""),define(31,""),define(32,""),define(33,""),define(35,""),define(36,"b"),define(37,"c"),define(38,""),define(39,""),define(40,""),define(41,""),define(42,""),define(43,""),define(44,"e"),define(45,"e"),define(46,"e"),define(47,"e"),define(48,""),define(49,"e"),define(50,"ee"),define(53,""),define(54,""),define(55,""),define(56,""),define(57,""),define(58,""),define(59,""),define(60,""),define(61,""),define(62,""),define(64,"e"),define(65,"e"),define(66,"e"),define(67,"ee"),define(68,"ee"),define(69,"ee"),define(70,"ee"),define(71,""),define(72,""),define(73,"e"),define(74,"ee"),define(75,""),define(76,"ee"),define(77,""),define(78,"ee"),define(79,"ee"),define(80,""),define(81,""),define(82,""),define(83,"e"),define(84,""),define(85,"e"),define(86,"e"),define(87,""),define(88,"e"),define(89,"e"),define(90,"e"),define(93,"e"),define(94,"e"),define(95,""),define(96,"e"),define(97,"e"),define(98,"e"),define(99,"e"),define(100,""),define(101,"e"),define(102,"e"),define(103,""),define(104,"e"),define(106,"e"),define(108,"e"),define(109,"e"),define(110,"e"),define(111,"e"),define(112,""),define(113,""),define(114,""),define(115,""),define(116,""),define(117,""),define(118,""),define(119,""),define(120,""),define(121,""),define(122,""),define(123,""),define(128,"e"),define(129,""),define(130,""),define(131,""),define(132,""),define(133,""),define(134,"e"),define(135,""),define(136,""),define(137,""),define(144,""),define(145,""),define(146,"e"),define(147,""),define(148,"e"),define(149,""),define(150,""),define(151,""),define(160,""),define(161,""),define(162,""),define(163,""),define(164,""),define(165,""),define(166,""),define(167,""),define(168,""),define(169,""),define(170,""),define(171,""),define(172,""),define(173,""),define(174,""),define(175,""),define(176,""),define(177,""),define(178,"e"),define(179,""),define(180,""),define(192,""),define(193,""),define(194,"e"),define(195,"e"),define(196,""),define(197,""),define(198,""),define(199,""),define(208,""),define(209,""),define(210,""),define(211,""),define(212,""),define(213,""),define(214,""),define(215,""),define(237,""),define(239,"aeae"),define(240,"e"),define(241,"e"),define(242,"e"),define(243,"")}defineBytecodes();var Bytes=(sWe.u8=function(t,e){return t[e]},sWe.s32=function(t,e){var i=t[e];return 128&i&&16384&(i=127&i|t[e+1]<<7)&&2097152&(i=16383&i|t[e+2]<<14)&&268435456&(i=2097151&i|t[e+3]<<21)&&(i=268435455&i|t[e+4]<<28,i&=4294967295),i},sWe.u32=function(t,e){return sWe.s32(t,e)>>>0},sWe.u30=function(t,e){return sWe.u32(t,e)},sWe.s32Length=function(t,e){var i=t[e];return 128&i?16384&(i=127&i|t[e+1]<<7)?2097152&(i=16383&i|t[e+2]<<14)?268435456&(i=2097151&i|t[e+3]<<21)?5:4:3:2:1},sWe);function sWe(){}function lengthAt(t,e){var i=1,n=t[e];if(27===n){i+=3;var r=Bytes.u30(t,e+i)+1;return(i+=Bytes.s32Length(t,e+i))+3*r}var o=BytecodeFormat[n];if(""===o)return i;assert(o,"OP: "+getBytecodeName(n));for(var s=0;s<o.length;s++)switch(o[s].charCodeAt(0)-97){case 0:case 1:i+=1;continue;case 3:i+=3;continue;case 2:case 4:case 5:i+=Bytes.s32Length(t,e+i);continue}return i}var BytecodeStream=(MWe.prototype.next=function(){this.setBCI(this._nextBCI)},MWe.prototype.endBCI=function(){return this._code.length},Object.defineProperty(MWe.prototype,"nextBCI",{get:function(){return this._nextBCI},enumerable:!0,configurable:!0}),Object.defineProperty(MWe.prototype,"currentBCI",{get:function(){return this._currentBCI},enumerable:!0,configurable:!0}),MWe.prototype.currentBytecode=function(){return this._bytecode},MWe.prototype.nextBC=function(){return Bytes.u8(this._code,this._nextBCI)},MWe.prototype.setBCI=function(t){var e;this._currentBCI=t,this._currentBCI<this._code.length?(this._bytecode=Bytes.u8(this._code,t),e=lengthAt(this._code,t),this._nextBCI=t+e):(this._bytecode=255,this._nextBCI=this._currentBCI)},MWe),Bytecode,QWe;function MWe(t){this._code=t,this.setBCI(0)}QWe=Bytecode=Bytecode||{},QWe[QWe.BKPT=1]="BKPT",QWe[QWe.NOP=2]="NOP",QWe[QWe.THROW=3]="THROW",QWe[QWe.GETSUPER=4]="GETSUPER",QWe[QWe.GETSUPER_DYN=260]="GETSUPER_DYN",QWe[QWe.SETSUPER=5]="SETSUPER",QWe[QWe.SETSUPER_DYN=261]="SETSUPER_DYN",QWe[QWe.DXNS=6]="DXNS",QWe[QWe.DXNSLATE=7]="DXNSLATE",QWe[QWe.KILL=8]="KILL",QWe[QWe.LABEL=9]="LABEL",QWe[QWe.LF32X4=10]="LF32X4",QWe[QWe.SF32X4=11]="SF32X4",QWe[QWe.IFNLT=12]="IFNLT",QWe[QWe.IFNLE=13]="IFNLE",QWe[QWe.IFNGT=14]="IFNGT",QWe[QWe.IFNGE=15]="IFNGE",QWe[QWe.JUMP=16]="JUMP",QWe[QWe.IFTRUE=17]="IFTRUE",QWe[QWe.IFFALSE=18]="IFFALSE",QWe[QWe.IFEQ=19]="IFEQ",QWe[QWe.IFNE=20]="IFNE",QWe[QWe.IFLT=21]="IFLT",QWe[QWe.IFLE=22]="IFLE",QWe[QWe.IFGT=23]="IFGT",QWe[QWe.IFGE=24]="IFGE",QWe[QWe.IFSTRICTEQ=25]="IFSTRICTEQ",QWe[QWe.IFSTRICTNE=26]="IFSTRICTNE",QWe[QWe.LOOKUPSWITCH=27]="LOOKUPSWITCH",QWe[QWe.PUSHWITH=28]="PUSHWITH",QWe[QWe.POPSCOPE=29]="POPSCOPE",QWe[QWe.NEXTNAME=30]="NEXTNAME",QWe[QWe.HASNEXT=31]="HASNEXT",QWe[QWe.PUSHNULL=32]="PUSHNULL",QWe[QWe.PUSHUNDEFINED=33]="PUSHUNDEFINED",QWe[QWe.PUSHFLOAT=34]="PUSHFLOAT",QWe[QWe.NEXTVALUE=35]="NEXTVALUE",QWe[QWe.PUSHBYTE=36]="PUSHBYTE",QWe[QWe.PUSHSHORT=37]="PUSHSHORT",QWe[QWe.PUSHTRUE=38]="PUSHTRUE",QWe[QWe.PUSHFALSE=39]="PUSHFALSE",QWe[QWe.PUSHNAN=40]="PUSHNAN",QWe[QWe.POP=41]="POP",QWe[QWe.DUP=42]="DUP",QWe[QWe.SWAP=43]="SWAP",QWe[QWe.PUSHSTRING=44]="PUSHSTRING",QWe[QWe.PUSHINT=45]="PUSHINT",QWe[QWe.PUSHUINT=46]="PUSHUINT",QWe[QWe.PUSHDOUBLE=47]="PUSHDOUBLE",QWe[QWe.PUSHSCOPE=48]="PUSHSCOPE",QWe[QWe.PUSHNAMESPACE=49]="PUSHNAMESPACE",QWe[QWe.HASNEXT2=50]="HASNEXT2",QWe[QWe.LI8=53]="LI8",QWe[QWe.LI16=54]="LI16",QWe[QWe.LI32=55]="LI32",QWe[QWe.LF32=56]="LF32",QWe[QWe.LF64=57]="LF64",QWe[QWe.SI8=58]="SI8",QWe[QWe.SI16=59]="SI16",QWe[QWe.SI32=60]="SI32",QWe[QWe.SF32=61]="SF32",QWe[QWe.SF64=62]="SF64",QWe[QWe.NEWFUNCTION=64]="NEWFUNCTION",QWe[QWe.CALL=65]="CALL",QWe[QWe.CONSTRUCT=66]="CONSTRUCT",QWe[QWe.CALLMETHOD=67]="CALLMETHOD",QWe[QWe.CALLSTATIC=68]="CALLSTATIC",QWe[QWe.CALLSUPER=69]="CALLSUPER",QWe[QWe.CALLSUPER_DYN=325]="CALLSUPER_DYN",QWe[QWe.CALLPROPERTY=70]="CALLPROPERTY",QWe[QWe.CALLPROPERTY_DYN=326]="CALLPROPERTY_DYN",QWe[QWe.RETURNVOID=71]="RETURNVOID",QWe[QWe.RETURNVALUE=72]="RETURNVALUE",QWe[QWe.CONSTRUCTSUPER=73]="CONSTRUCTSUPER",QWe[QWe.CONSTRUCTSUPER_DYN=329]="CONSTRUCTSUPER_DYN",QWe[QWe.CONSTRUCTPROP=74]="CONSTRUCTPROP",QWe[QWe.CONSTRUCTPROP_DYN=330]="CONSTRUCTPROP_DYN",QWe[QWe.CALLSUPERID=75]="CALLSUPERID",QWe[QWe.CALLPROPLEX=76]="CALLPROPLEX",QWe[QWe.CALLPROPLEX_DYN=332]="CALLPROPLEX_DYN",QWe[QWe.CALLINTERFACE=77]="CALLINTERFACE",QWe[QWe.CALLSUPERVOID=78]="CALLSUPERVOID",QWe[QWe.CALLSUPERVOID_DYN=334]="CALLSUPERVOID_DYN",QWe[QWe.CALLPROPVOID=79]="CALLPROPVOID",QWe[QWe.SXI1=80]="SXI1",QWe[QWe.SXI8=81]="SXI8",QWe[QWe.SXI16=82]="SXI16",QWe[QWe.APPLYTYPE=83]="APPLYTYPE",QWe[QWe.PUSHFLOAT4=84]="PUSHFLOAT4",QWe[QWe.NEWOBJECT=85]="NEWOBJECT",QWe[QWe.NEWARRAY=86]="NEWARRAY",QWe[QWe.NEWACTIVATION=87]="NEWACTIVATION",QWe[QWe.NEWCLASS=88]="NEWCLASS",QWe[QWe.GETDESCENDANTS=89]="GETDESCENDANTS",QWe[QWe.NEWCATCH=90]="NEWCATCH",QWe[QWe.FINDPROPSTRICT=93]="FINDPROPSTRICT",QWe[QWe.FINDPROPSTRICT_DYN=349]="FINDPROPSTRICT_DYN",QWe[QWe.FINDPROPERTY=94]="FINDPROPERTY",QWe[QWe.FINDPROPERTY_DYN=350]="FINDPROPERTY_DYN",QWe[QWe.FINDDEF=95]="FINDDEF",QWe[QWe.GETLEX=96]="GETLEX",QWe[QWe.GETLEX_DYN=352]="GETLEX_DYN",QWe[QWe.SETPROPERTY=97]="SETPROPERTY",QWe[QWe.SETPROPERTY_DYN=353]="SETPROPERTY_DYN",QWe[QWe.GETLOCAL=98]="GETLOCAL",QWe[QWe.SETLOCAL=99]="SETLOCAL",QWe[QWe.GETGLOBALSCOPE=100]="GETGLOBALSCOPE",QWe[QWe.GETSCOPEOBJECT=101]="GETSCOPEOBJECT",QWe[QWe.GETPROPERTY=102]="GETPROPERTY",QWe[QWe.GETPROPERTY_DYN=358]="GETPROPERTY_DYN",QWe[QWe.GETOUTERSCOPE=103]="GETOUTERSCOPE",QWe[QWe.INITPROPERTY=104]="INITPROPERTY",QWe[QWe.UNUSED_69=105]="UNUSED_69",QWe[QWe.DELETEPROPERTY=106]="DELETEPROPERTY",QWe[QWe.DELETEPROPERTY_DYN=362]="DELETEPROPERTY_DYN",QWe[QWe.UNUSED_6B=107]="UNUSED_6B",QWe[QWe.GETSLOT=108]="GETSLOT",QWe[QWe.SETSLOT=109]="SETSLOT",QWe[QWe.GETGLOBALSLOT=110]="GETGLOBALSLOT",QWe[QWe.SETGLOBALSLOT=111]="SETGLOBALSLOT",QWe[QWe.CONVERT_S=112]="CONVERT_S",QWe[QWe.ESC_XELEM=113]="ESC_XELEM",QWe[QWe.ESC_XATTR=114]="ESC_XATTR",QWe[QWe.CONVERT_I=115]="CONVERT_I",QWe[QWe.CONVERT_U=116]="CONVERT_U",QWe[QWe.CONVERT_D=117]="CONVERT_D",QWe[QWe.CONVERT_B=118]="CONVERT_B",QWe[QWe.CONVERT_O=119]="CONVERT_O",QWe[QWe.CHECKFILTER=120]="CHECKFILTER",QWe[QWe.CONVERT_F=121]="CONVERT_F",QWe[QWe.UNPLUS=122]="UNPLUS",QWe[QWe.CONVERT_F4=123]="CONVERT_F4",QWe[QWe.BC_7C=124]="BC_7C",QWe[QWe.BC_7D=125]="BC_7D",QWe[QWe.BC_7E=126]="BC_7E",QWe[QWe.BC_7F=127]="BC_7F",QWe[QWe.COERCE=128]="COERCE",QWe[QWe.COERCE_DYN=384]="COERCE_DYN",QWe[QWe.COERCE_B=129]="COERCE_B",QWe[QWe.COERCE_A=130]="COERCE_A",QWe[QWe.COERCE_I=131]="COERCE_I",QWe[QWe.COERCE_D=132]="COERCE_D",QWe[QWe.COERCE_S=133]="COERCE_S",QWe[QWe.ASTYPE=134]="ASTYPE",QWe[QWe.ASTYPELATE=135]="ASTYPELATE",QWe[QWe.COERCE_U=136]="COERCE_U",QWe[QWe.COERCE_O=137]="COERCE_O",QWe[QWe.NEGATE=144]="NEGATE",QWe[QWe.INCREMENT=145]="INCREMENT",QWe[QWe.INCLOCAL=146]="INCLOCAL",QWe[QWe.DECREMENT=147]="DECREMENT",QWe[QWe.DECLOCAL=148]="DECLOCAL",QWe[QWe.TYPEOF=149]="TYPEOF",QWe[QWe.NOT=150]="NOT",QWe[QWe.BITNOT=151]="BITNOT",QWe[QWe.UNUSED_98=152]="UNUSED_98",QWe[QWe.UNUSED_99=153]="UNUSED_99",QWe[QWe.UNUSED_9A=154]="UNUSED_9A",QWe[QWe.UNUSED_9B=155]="UNUSED_9B",QWe[QWe.UNUSED_9C=156]="UNUSED_9C",QWe[QWe.UNUSED_9D=157]="UNUSED_9D",QWe[QWe.UNUSED_9E=158]="UNUSED_9E",QWe[QWe.UNUSED_9F=159]="UNUSED_9F",QWe[QWe.ADD=160]="ADD",QWe[QWe.SUBTRACT=161]="SUBTRACT",QWe[QWe.MULTIPLY=162]="MULTIPLY",QWe[QWe.DIVIDE=163]="DIVIDE",QWe[QWe.MODULO=164]="MODULO",QWe[QWe.LSHIFT=165]="LSHIFT",QWe[QWe.RSHIFT=166]="RSHIFT",QWe[QWe.URSHIFT=167]="URSHIFT",QWe[QWe.BITAND=168]="BITAND",QWe[QWe.BITOR=169]="BITOR",QWe[QWe.BITXOR=170]="BITXOR",QWe[QWe.EQUALS=171]="EQUALS",QWe[QWe.STRICTEQUALS=172]="STRICTEQUALS",QWe[QWe.LESSTHAN=173]="LESSTHAN",QWe[QWe.LESSEQUALS=174]="LESSEQUALS",QWe[QWe.GREATERTHAN=175]="GREATERTHAN",QWe[QWe.GREATEREQUALS=176]="GREATEREQUALS",QWe[QWe.INSTANCEOF=177]="INSTANCEOF",QWe[QWe.ISTYPE=178]="ISTYPE",QWe[QWe.ISTYPELATE=179]="ISTYPELATE",QWe[QWe.IN=180]="IN",QWe[QWe.UNUSED_B5=181]="UNUSED_B5",QWe[QWe.UNUSED_B6=182]="UNUSED_B6",QWe[QWe.UNUSED_B7=183]="UNUSED_B7",QWe[QWe.UNUSED_B8=184]="UNUSED_B8",QWe[QWe.UNUSED_B9=185]="UNUSED_B9",QWe[QWe.UNUSED_BA=186]="UNUSED_BA",QWe[QWe.UNUSED_BB=187]="UNUSED_BB",QWe[QWe.UNUSED_BC=188]="UNUSED_BC",QWe[QWe.UNUSED_BD=189]="UNUSED_BD",QWe[QWe.UNUSED_BE=190]="UNUSED_BE",QWe[QWe.UNUSED_BF=191]="UNUSED_BF",QWe[QWe.INCREMENT_I=192]="INCREMENT_I",QWe[QWe.DECREMENT_I=193]="DECREMENT_I",QWe[QWe.INCLOCAL_I=194]="INCLOCAL_I",QWe[QWe.DECLOCAL_I=195]="DECLOCAL_I",QWe[QWe.NEGATE_I=196]="NEGATE_I",QWe[QWe.ADD_I=197]="ADD_I",QWe[QWe.SUBTRACT_I=198]="SUBTRACT_I",QWe[QWe.MULTIPLY_I=199]="MULTIPLY_I",QWe[QWe.UNUSED_C8=200]="UNUSED_C8",QWe[QWe.UNUSED_C9=201]="UNUSED_C9",QWe[QWe.UNUSED_CA=202]="UNUSED_CA",QWe[QWe.UNUSED_CB=203]="UNUSED_CB",QWe[QWe.UNUSED_CC=204]="UNUSED_CC",QWe[QWe.UNUSED_CD=205]="UNUSED_CD",QWe[QWe.UNUSED_CE=206]="UNUSED_CE",QWe[QWe.UNUSED_CF=207]="UNUSED_CF",QWe[QWe.GETLOCAL0=208]="GETLOCAL0",QWe[QWe.GETLOCAL1=209]="GETLOCAL1",QWe[QWe.GETLOCAL2=210]="GETLOCAL2",QWe[QWe.GETLOCAL3=211]="GETLOCAL3",QWe[QWe.SETLOCAL0=212]="SETLOCAL0",QWe[QWe.SETLOCAL1=213]="SETLOCAL1",QWe[QWe.SETLOCAL2=214]="SETLOCAL2",QWe[QWe.SETLOCAL3=215]="SETLOCAL3",QWe[QWe.UNUSED_D8=216]="UNUSED_D8",QWe[QWe.UNUSED_D9=217]="UNUSED_D9",QWe[QWe.UNUSED_DA=218]="UNUSED_DA",QWe[QWe.UNUSED_DB=219]="UNUSED_DB",QWe[QWe.UNUSED_DC=220]="UNUSED_DC",QWe[QWe.UNUSED_DD=221]="UNUSED_DD",QWe[QWe.UNUSED_DE=222]="UNUSED_DE",QWe[QWe.UNUSED_DF=223]="UNUSED_DF",QWe[QWe.UNUSED_E0=224]="UNUSED_E0",QWe[QWe.UNUSED_E1=225]="UNUSED_E1",QWe[QWe.UNUSED_E2=226]="UNUSED_E2",QWe[QWe.UNUSED_E3=227]="UNUSED_E3",QWe[QWe.UNUSED_E4=228]="UNUSED_E4",QWe[QWe.UNUSED_E5=229]="UNUSED_E5",QWe[QWe.UNUSED_E6=230]="UNUSED_E6",QWe[QWe.UNUSED_E7=231]="UNUSED_E7",QWe[QWe.UNUSED_E8=232]="UNUSED_E8",QWe[QWe.UNUSED_E9=233]="UNUSED_E9",QWe[QWe.UNUSED_EA=234]="UNUSED_EA",QWe[QWe.UNUSED_EB=235]="UNUSED_EB",QWe[QWe.UNUSED_EC=236]="UNUSED_EC",QWe[QWe.UNUSED_ED=237]="UNUSED_ED",QWe[QWe.UNUSED_EE=238]="UNUSED_EE",QWe[QWe.INVALID=237]="INVALID",QWe[QWe.DEBUG=239]="DEBUG",QWe[QWe.DEBUGLINE=240]="DEBUGLINE",QWe[QWe.DEBUGFILE=241]="DEBUGFILE",QWe[QWe.BKPTLINE=242]="BKPTLINE",QWe[QWe.TIMESTAMP=243]="TIMESTAMP",QWe[QWe.RESTARGC=244]="RESTARGC",QWe[QWe.RESTARG=245]="RESTARG",QWe[QWe.UNUSED_F6=246]="UNUSED_F6",QWe[QWe.UNUSED_F7=247]="UNUSED_F7",QWe[QWe.UNUSED_F8=248]="UNUSED_F8",QWe[QWe.UNUSED_F9=249]="UNUSED_F9",QWe[QWe.UNUSED_FA=250]="UNUSED_FA",QWe[QWe.UNUSED_FB=251]="UNUSED_FB",QWe[QWe.UNUSED_FC=252]="UNUSED_FC",QWe[QWe.UNUSED_FD=253]="UNUSED_FD",QWe[QWe.UNUSED_FE=254]="UNUSED_FE",QWe[QWe.END=255]="END";var Info=function(){},InstanceInfo=(RWe=Info,__extends(SWe,RWe),SWe.prototype.getInitializer=function(){return"number"==typeof this.initializer&&(this.initializer=this.abc.getMethodInfo(this.initializer),(this.initializer.instanceInfo=this).initializer.isConstructor=!0),this.initializer},SWe.prototype.getName=function(){return"number"==typeof this.name&&(this.name=this.abc.getMultiname(this.name)),this.name},SWe.prototype.getClassName=function(){var t=this.getName();return t.namespaces[0].uri?t.namespaces[0].uri+"."+t.name:t.name},SWe.prototype.getSuperName=function(){return"number"==typeof this.superName&&(this.superName=this.abc.getMultiname(this.superName)),this.superName},SWe.prototype.getInterfaces=function(t){if(this._interfaces)return this._interfaces;var e,i=t.superClass;i&&(e=i.classInfo.instanceInfo.getInterfaces(i));for(var n=Set,r=this._interfaces=new n(e),o=0;o<this.interfaceNameIndices.length;o++){var s=this.abc.getMultiname(this.interfaceNameIndices[o]),a=this.abc.applicationDomain.getClass(s);r.add(a),a.classInfo.instanceInfo.getInterfaces(a).forEach(function(t){return r.add(t)})}return r},SWe.prototype.toString=function(){return"InstanceInfo "+this.getName().name},SWe.prototype.toFlashlogString=function(){return this.getName().toFlashlogString()},SWe.prototype.trace=function(t){t.enter("InstanceInfo: "+this.getName()),this.superName&&t.writeLn("Super: "+this.getSuperName()),this.traits.trace(t),t.outdent()},SWe.prototype.isInterface=function(){return!!(4&this.flags)},SWe.prototype.isSealed=function(){return!!(1&this.flags)},SWe.prototype.isFinal=function(){return!!(2&this.flags)},SWe),ClassInfo=(lXe=Info,__extends(mXe,lXe),mXe.prototype.getNativeMetadata=function(){if(!this.trait)return null;var t=this.trait.getMetadata();if(!t)return null;for(var e=0;e<t.length;e++)if("native"===t[e].getName())return t[e];return null},mXe.prototype.getInitializer=function(){return"number"==typeof this.initializer&&(this.initializer=this.abc.getMethodInfo(this.initializer),this.initializer.classInfo=this),this.initializer},mXe.prototype.toString=function(){return"ClassInfo "+this.instanceInfo.getName()},mXe.prototype.trace=function(t){t.enter("ClassInfo"),this.traits.trace(t),t.outdent()},mXe),lXe,RWe;function mXe(t,e,i,n){var r=lXe.call(this)||this;return r.abc=t,r.instanceInfo=e,r.initializer=i,r.traits=n,r.trait=null,r.runtimeTraits=null,r}function SWe(t,e,i,n,r,o,s,a){var l=RWe.call(this)||this;return l.abc=t,l.name=e,l.superName=i,l.flags=n,l.protectedNs=r,l.interfaceNameIndices=o,l.initializer=s,l.traits=a,l.classInfo=null,l.runtimeTraits=null,l._interfaces=null,l}function getTRAITName(t){return String(t)}var TraitInfo=(wXe.prototype.getMetadata=function(){if(!this.metadata)return null;if(this.metadata instanceof Uint32Array){for(var t=new Array(this.metadata.length),e=0;e<this.metadata.length;e++)t[e]=this.abc.getMetadataInfo(this.metadata[e]);this.metadata=t}return this.metadata},wXe.prototype.getName=function(){return this.name},wXe.prototype.resolve=function(){"number"==typeof this.name&&(this.name=this.abc.getMultiname(this.name))},wXe.prototype.toString=function(){return getTRAITName(this.kind)+" "+this.name},wXe.prototype.toFlashlogString=function(){return this.resolve(),this.getName().toFlashlogString()},wXe.prototype.isConst=function(){return 6===this.kind},wXe.prototype.isSlot=function(){return 0===this.kind},wXe.prototype.isMethod=function(){return 1===this.kind},wXe.prototype.isGetter=function(){return 2===this.kind},wXe.prototype.isSetter=function(){return 3===this.kind},wXe.prototype.isAccessor=function(){return 2===this.kind||3===this.kind},wXe.prototype.isMethodOrAccessor=function(){return this.isAccessor()||1===this.kind},wXe),MethodTraitInfo=(CXe=TraitInfo,__extends(DXe,CXe),DXe.prototype.getMethodInfo=function(){return this.methodInfo},DXe.prototype.resolve=function(){CXe.prototype.resolve.call(this),"number"==typeof this.methodInfo&&(this.methodInfo=this.abc.getMethodInfo(this.methodInfo))},DXe),BytecodeName=Bytecode,DEFAULT_STACK_INDEX=-1024,Instruction=(JXe.prototype.toString=function(){return"Instruction("+this.position+", "+BytecodeName[this.name]+" ("+this.name+"), ["+this.params+"], "+this.stack+" -> "+(this.stack+this.delta)+", "+this.scope+" -> "+(this.scope+this.deltaScope)+", "+this.terminal+", ["+this.refs+"])"},JXe),CXe;function JXe(t,e,i,n,r,o,s){void 0===i&&(i=[]),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=!1),void 0===s&&(s=[]),this.position=t,this.name=e,this.params=i,this.delta=n,this.deltaScope=r,this.terminal=o,this.refs=s,this.stack=DEFAULT_STACK_INDEX,this.scope=DEFAULT_STACK_INDEX,this.catchStart=!1,this.catchEnd=!1,this.returnTypeId=-1,this.childs=[]}function DXe(t,e,i,n){var r=CXe.call(this,t,e,i)||this;return r.methodInfo=n,r.method=null,r}function wXe(t,e,i){this.abc=t,this.kind=e,this.name=i,this.metadata=null,this.holder=null}function propagateStack(t,e,i){for(var n=e,r=i.length,o=0;o<r;o++)if(i[o].position>=t){if(0<=i[o].stack)return;i[o].stack=n,n+=i[o].delta;for(var s=0;s<i[o].refs.length;s++)propagateStack(i[o].refs[s],n,i);if(i[o].terminal)return}}function propagateScope(t,e,i){for(var n=e,r=i.length,o=0;o<r;o++)if(i[o].position>=t){if(0<=i[o].scope)return;i[o].scope=n,n+=i[o].deltaScope;for(var s=0;s<i[o].refs.length;s++)propagateScope(i[o].refs[s],n,i);if(i[o].terminal)return}}function propogateTree(t,e){var i={},n=[];i[0]=0;for(var r=t.length,o=1;o<r;o++){var s=t[o];-1<e.indexOf(s.position)&&(i[s.position]=o),s.name>=Bytecode.IFNLT&&s.name<=Bytecode.LOOKUPSWITCH&&n.push(s)}for(var a=0,l=n;a<l.length;a++){var c=l[a];if(c.name!==Bytecode.LOOKUPSWITCH)c.name!==Bytecode.JUMP?c.childs.push(i[c.params[0]]):c.childs=[i[c.params[0]]];else{var h=c.params;for(c.childs=[],o=0;o<h.length-1;o++)c.childs.push(i[o])}}}function affilate(t){for(var P,E,T,M,D,I,O,L,F,B=t.abc,e=t.getBody(),N=e.code,R=[],V=0,k=0,i=0;i<N.length;){var n=function(e){function i(){var t=N[e++];return 128&t&&16384&(t=127&t|N[e++]<<7)&&2097152&(t=16383&t|N[e++]<<14)&&268435456&(t=2097151&t|N[e++]<<21)&&(t=268435455&t|N[e++]<<28,t&=4294967295),t>>>0}function t(){var t=i(),e=B.getMultiname(t);return e.isRuntimeName()||e.isRuntimeNamespace()?[t,256,e.isRuntimeName()&&e.isRuntimeNamespace()?-2:-1]:[t,0,0]}function n(){return(N[e++]|N[e++]<<8|N[e++]<<16)<<8>>8}function r(){return N[e++]<<24>>24}var o,s,a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A=e,S=N[e++],w=void 0;switch(S){case Bytecode.LABEL:w=new Instruction(A,S);break;case Bytecode.DXNSLATE:w=new Instruction(A,S,[0],-1);break;case Bytecode.DEBUGFILE:case Bytecode.DEBUGLINE:w=new Instruction(A,S,[i()]);break;case Bytecode.DEBUG:w=new Instruction(A,S,[r(),i(),r(),i()]);break;case Bytecode.THROW:w=new Instruction(A,S,[],-1,0,!0);break;case Bytecode.PUSHSCOPE:(w=new Instruction(A,S,[],-1,1)).returnTypeId=k=++V;break;case Bytecode.PUSHWITH:w=new Instruction(A,S,[],-1,1);break;case Bytecode.POPSCOPE:w=new Instruction(A,S,[],0,-1);break;case Bytecode.GETSCOPEOBJECT:(w=new Instruction(A,S,[r()],1,0)).returnTypeId=k=++V;break;case Bytecode.GETGLOBALSCOPE:(w=new Instruction(A,S,[],1)).returnTypeId=k=++V;break;case Bytecode.GETSLOT:(w=new Instruction(A,S,[i()],0)).returnTypeId=k=++V;break;case Bytecode.SETSLOT:w=new Instruction(A,S,[i()],-2);break;case Bytecode.NEXTNAME:case Bytecode.NEXTVALUE:(w=new Instruction(A,S,[],-1)).returnTypeId=k=++V;break;case Bytecode.HASNEXT:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-2;break;case Bytecode.HASNEXT2:(w=new Instruction(A,S,[i(),i()],1)).returnTypeId=k=-2;break;case Bytecode.IN:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-2;break;case Bytecode.DUP:(w=new Instruction(A,S,[],1)).returnTypeId=k=V;break;case Bytecode.POP:(w=new Instruction(A,S,[],-1)).returnTypeId=k=V;break;case Bytecode.SWAP:w=new Instruction(A,S,[],0);break;case Bytecode.PUSHTRUE:case Bytecode.PUSHFALSE:(w=new Instruction(A,S,[],1)).returnTypeId=k=-2;break;case Bytecode.PUSHBYTE:(w=new Instruction(A,S,[r()],1)).returnTypeId=k=-3;break;case Bytecode.PUSHSHORT:(w=new Instruction(A,S,[i()<<16>>16],1)).returnTypeId=k=-3;break;case Bytecode.PUSHINT:case Bytecode.PUSHUINT:case Bytecode.PUSHDOUBLE:(w=new Instruction(A,S,[i()],1)).returnTypeId=k=-3;break;case Bytecode.PUSHNAN:(w=new Instruction(A,S,[],1)).returnTypeId=k=-3;break;case Bytecode.PUSHNULL:(w=new Instruction(A,S,[],1)).returnTypeId=k=-6;break;case Bytecode.PUSHUNDEFINED:(w=new Instruction(A,S,[],1)).returnTypeId=k=-5;break;case Bytecode.PUSHSTRING:(w=new Instruction(A,S,[i()],1)).returnTypeId=k=-4;break;case Bytecode.IFEQ:case Bytecode.IFNE:case Bytecode.IFSTRICTEQ:case Bytecode.IFSTRICTNE:M=n(),w=new Instruction(A,S,[e+M],-2,0,!1,[e+M]);break;case Bytecode.IFGT:case Bytecode.IFNLE:M=n(),w=new Instruction(A,Bytecode.IFGT,[e+M],-2,0,!1,[e+M]);break;case Bytecode.IFGE:case Bytecode.IFNLT:M=n(),w=new Instruction(A,Bytecode.IFGE,[e+M],-2,0,!1,[e+M]);break;case Bytecode.IFLT:case Bytecode.IFNGE:M=n(),w=new Instruction(A,Bytecode.IFLT,[e+M],-2,0,!1,[e+M]);break;case Bytecode.IFLE:case Bytecode.IFNGT:M=n(),w=new Instruction(A,Bytecode.IFLE,[e+M],-2,0,!1,[e+M]);break;case Bytecode.IFTRUE:case Bytecode.IFFALSE:M=n(),w=new Instruction(A,S,[e+M],-1,0,!1,[e+M]);break;case Bytecode.LOOKUPSWITCH:P=A+n(),E=i(),T=[P];for(var C=0;C<=E;C++)T.push(A+n());w=new Instruction(A,S,T,-1,0,!0,T);break;case Bytecode.JUMP:M=n(),w=new Instruction(A,S,[e+M],0,0,!0,[e+M]);break;case Bytecode.RETURNVALUE:w=new Instruction(A,S,[],-1,0,!0);break;case Bytecode.RETURNVOID:w=new Instruction(A,S,[],0,0,!0);break;case Bytecode.NOT:(w=new Instruction(A,S,[],0)).returnTypeId=k=-2;break;case Bytecode.BITNOT:case Bytecode.NEGATE:case Bytecode.INCREMENT:case Bytecode.DECREMENT:(w=new Instruction(A,S,[],0)).returnTypeId=k=-3;break;case Bytecode.INCLOCAL:case Bytecode.DECLOCAL:(w=new Instruction(A,S,[i()],0)).returnTypeId=k=-3;break;case Bytecode.INCREMENT_I:case Bytecode.DECREMENT_I:(w=new Instruction(A,S,[],0)).returnTypeId=k=-3;break;case Bytecode.INCLOCAL_I:case Bytecode.DECLOCAL_I:(w=new Instruction(A,S,[i()],0)).returnTypeId=k=-3;break;case Bytecode.NEGATE_I:(w=new Instruction(A,S,[],0)).returnTypeId=k=-3;break;case Bytecode.ADD_I:case Bytecode.SUBTRACT_I:case Bytecode.MULTIPLY_I:case Bytecode.ADD:case Bytecode.SUBTRACT:case Bytecode.MULTIPLY:case Bytecode.DIVIDE:case Bytecode.MODULO:case Bytecode.LSHIFT:case Bytecode.RSHIFT:case Bytecode.URSHIFT:case Bytecode.BITAND:case Bytecode.BITOR:case Bytecode.BITXOR:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-3;break;case Bytecode.EQUALS:case Bytecode.STRICTEQUALS:case Bytecode.GREATERTHAN:case Bytecode.GREATEREQUALS:case Bytecode.LESSTHAN:case Bytecode.LESSEQUALS:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-2;break;case Bytecode.TYPEOF:(w=new Instruction(A,S,[],0)).returnTypeId=k=++V;break;case Bytecode.INSTANCEOF:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-2;break;case Bytecode.ISTYPE:o=t(),I=o[0],O=o[1],L=o[2],(w=new Instruction(A,S,[I],0+L)).returnTypeId=k=-2;break;case Bytecode.ISTYPELATE:(w=new Instruction(A,S,[],-1)).returnTypeId=k=-2;break;case Bytecode.ASTYPELATE:w=new Instruction(A,S,[],-1);break;case Bytecode.ASTYPE:s=t(),I=s[0],O=s[1],L=s[2],w=new Instruction(A,S,[I],0+L);break;case Bytecode.CALL:D=i(),w=new Instruction(A,S,[D],-D-1);break;case Bytecode.CONSTRUCT:D=i(),(w=new Instruction(A,S,[D,I],-D)).returnTypeId=k=++V;break;case Bytecode.CALLPROPERTY:a=t(),I=a[0],O=a[1],L=a[2],D=i(),(w=new Instruction(A,S+O,[D,I],-D+L)).returnTypeId=k=++V;break;case Bytecode.CALLPROPLEX:l=t(),I=l[0],O=l[1],L=l[2],D=i(),(w=new Instruction(A,S+O,[D,I],-D+L)).returnTypeId=k=++V;break;case Bytecode.CALLPROPVOID:c=t(),I=c[0],O=c[1],L=c[2],D=i(),w=new Instruction(A,S+O,[D,I],-(D+1)+L);break;case Bytecode.APPLYTYPE:D=i(),(w=new Instruction(A,S,[D],-D)).returnTypeId=k=V;break;case Bytecode.FINDPROPSTRICT:h=t(),I=h[0],O=h[1],L=h[2],(w=new Instruction(A,S+O,[I],1+L)).returnTypeId=k=++V;break;case Bytecode.FINDPROPERTY:u=t(),I=u[0],O=u[1],L=u[2],(w=new Instruction(A,S+O,[I],1+L)).returnTypeId=k=++V;break;case Bytecode.NEWFUNCTION:(w=new Instruction(A,S,[i()],1)).returnTypeId=k=++V;break;case Bytecode.NEWCLASS:(w=new Instruction(A,S,[i()],0)).returnTypeId=k=++V;break;case Bytecode.NEWARRAY:D=i(),(w=new Instruction(A,S,[D],1-D)).returnTypeId=k=++V;break;case Bytecode.NEWOBJECT:D=i(),(w=new Instruction(A,S,[D],-2*D+1)).returnTypeId=k=++V;break;case Bytecode.NEWACTIVATION:(w=new Instruction(A,S,[],1)).returnTypeId=k=++V;break;case Bytecode.NEWCATCH:w=new Instruction(A,S,[i()],1);break;case Bytecode.CONSTRUCTSUPER:D=i(),w=new Instruction(A,S,[D],-(D+1));break;case Bytecode.CALLSUPER:p=t(),I=p[0],O=p[1],L=p[2],D=i(),w=new Instruction(A,S+O,[D,I],-D+L);break;case Bytecode.CALLSUPERVOID:d=t(),I=d[0],O=d[1],L=d[2],D=i(),w=new Instruction(A,S+O,[D,I],-(D+1)+L);break;case Bytecode.CONSTRUCTPROP:_=t(),I=_[0],O=_[1],L=_[2],D=i(),(w=new Instruction(A,S+O,[D,I],-D+L)).returnTypeId=k=++V;break;case Bytecode.GETPROPERTY:f=t(),I=f[0],O=f[1],L=f[2],(w=new Instruction(A,Bytecode.GETPROPERTY+O,[I],0+L)).returnTypeId=k=++V;break;case Bytecode.INITPROPERTY:case Bytecode.SETPROPERTY:m=t(),I=m[0],O=m[1],L=m[2],w=new Instruction(A,Bytecode.SETPROPERTY+O,[I],-2+L);break;case Bytecode.DELETEPROPERTY:g=t(),I=g[0],O=g[1],L=g[2],w=new Instruction(A,S+O,[I],0+L);break;case Bytecode.GETSUPER:y=t(),I=y[0],O=y[1],L=y[2],(w=new Instruction(A,S+O,[I],0+L)).returnTypeId=k=++V;break;case Bytecode.SETSUPER:b=t(),I=b[0],O=b[1],L=b[2],w=new Instruction(A,S+O,[I],-2+L);break;case Bytecode.COERCE:v=t(),I=v[0],O=v[1],L=v[2],(w=new Instruction(A,S+O,[I],0+L)).returnTypeId=k;break;case Bytecode.COERCE_A:(w=new Instruction(A,S,[],0)).returnTypeId=k;break;case Bytecode.COERCE_S:(w=new Instruction(A,S,[],0)).returnTypeId=-4;break;case Bytecode.CONVERT_I:case Bytecode.CONVERT_D:case Bytecode.CONVERT_B:case Bytecode.CONVERT_U:case Bytecode.CONVERT_S:case Bytecode.CONVERT_O:case Bytecode.CHECKFILTER:w=new Instruction(A,S,[],0);break;case Bytecode.GETLOCAL:(w=new Instruction(A,Bytecode.GETLOCAL,[i()],1)).returnTypeId=k;break;case Bytecode.GETLOCAL0:(w=new Instruction(A,Bytecode.GETLOCAL,[0],1)).returnTypeId=k;break;case Bytecode.GETLOCAL1:(w=new Instruction(A,Bytecode.GETLOCAL,[1],1)).returnTypeId=k;break;case Bytecode.GETLOCAL2:(w=new Instruction(A,Bytecode.GETLOCAL,[2],1)).returnTypeId=k;break;case Bytecode.GETLOCAL3:(w=new Instruction(A,Bytecode.GETLOCAL,[3],1)).returnTypeId=k;break;case Bytecode.SETLOCAL:(w=new Instruction(A,Bytecode.SETLOCAL,[i()],-1)).returnTypeId=k;break;case Bytecode.SETLOCAL0:(w=new Instruction(A,Bytecode.SETLOCAL,[0],-1)).returnTypeId=k;break;case Bytecode.SETLOCAL1:(w=new Instruction(A,Bytecode.SETLOCAL,[1],-1)).returnTypeId=k;break;case Bytecode.SETLOCAL2:(w=new Instruction(A,Bytecode.SETLOCAL,[2],-1)).returnTypeId=k;break;case Bytecode.SETLOCAL3:(w=new Instruction(A,Bytecode.SETLOCAL,[3],-1)).returnTypeId=k;break;case Bytecode.KILL:w=new Instruction(A,S,[i()],0);break;case Bytecode.GETLEX:x=t(),I=x[0],O=x[1],L=x[2],(w=new Instruction(A,S+O,[I],1+L)).returnTypeId=k=++V;break;case Bytecode.SI8:case Bytecode.SI16:case Bytecode.SI32:case Bytecode.SF32:case Bytecode.SF64:w=new Instruction(A,S,[],-2);break;case Bytecode.LI8:case Bytecode.LI16:case Bytecode.LI32:case Bytecode.LF32:case Bytecode.LF64:(w=new Instruction(A,S,[],0)).returnTypeId=k=-3;break;default:return{value:{error:"UNKNOWN BYTECODE "+N[e-1].toString(16)+" "+BytecodeName[N[e-1]]+" at "+A}}}R.push(w),F=e}(i),i=F;if("object"==typeof n)return n.value}propagateStack(0,0,R),propagateScope(0,0,R);var r,o,s=[0];for(i=0;i<R.length;i++)for(var a=0;a<R[i].refs.length;a++)s.push(R[i].refs[a]);if(e.catchBlocks.length)for(r={},o={},i=0;i<e.catchBlocks.length;i++){for(var l,c=e.catchBlocks[i],h=0,u=-1,p=-1,d=0,_=0;_<R.length;_++){if((l=R[_].position)>c.start){u=l;break}h=R[_].stack,d=R[_].scope}for(_=R.length-1;0<=_;_--){if((l=R[_].position)<=c.end){p=l;break}}r[u]||(r[u]=[]),r[u].push(c),o[p]||(o[p]=[]),o[p].push(c),propagateStack(c.target,h+1,R),propagateScope(c.target,d,R),s.push(c.target)}return propogateTree(R,s),{set:R,jumps:s,catchStart:r,catchEnd:o,error:void 0}}var TinyConstructor=(tZe.prototype.test=function(t){if(!t.isConstructor)return!1;if(0<t.parameters.length)return!1;var e=t.getBody();return!(1<e.maxStack||1<e.localCount||1<e.maxScopeDepth-e.initScopeDepth||6<e.code.length)},tZe.prototype.getBody=function(t){return this.test(t)?function(t){return function(){t.savedScope.superConstructor.call(this)}}:null},tZe),CallBlockSaver=(yZe.prototype.test=function(t){return!1},yZe.prototype.markToSafe=function(t){return this._needSafe=this.test(t)},yZe.prototype.drop=function(){this._used||(this._needSafe=!1,this._block=void 0)},yZe.prototype.safe=function(t){return this._block={alias:t},!(this._used=!1)},yZe.prototype.needSafe=function(t){return this._needSafe&&this._block&&this._block.alias===t},yZe.prototype.beginSafeBlock=function(t){return this.needSafe(t)?(this._used=!0,"if("+this._block.alias+" != undefined) {"):""},yZe.prototype.endSafeBlock=function(t){if(!this._used)return"";var e=t?"} else { "+this._block.alias+" = "+t+"; }":"}";return this._used=!1,this._block=void 0,e},yZe.prototype.reset=function(){this._block=null,this._needSafe=!1,this._used=!1},yZe),TweenCallSaver=(GZe=CallBlockSaver,__extends(HZe,GZe),HZe.prototype.test=function(t){var e;return t.namespaces&&(null===(e=t.namespace)||void 0===e?void 0:e.uri)&&t.namespace.uri.includes("TweenLite")},HZe),Stat=(KZe.begin=function(t){var e=performance.now();this._currentTask={name:t,start:e,droped:!1},this._firstCompilerRun<0&&(this._firstCompilerRun=e)},KZe.drop=function(){this._currentTask&&(this._currentTask.droped=!0,this.end())},KZe.end=function(){var t,e,i;this._currentTask&&(e=(t=performance.now())-this._currentTask.start,i=this.statRecords,t-this._lastCompilerStop<this.TASK_DELAY?this._taskBathTime+=e:this._taskBathTime=0,i.runs++,i.drops+=+this._currentTask.droped,i.totalCompileTime+=e,i.minCompileTime=i.minCompileTime>e?e:i.minCompileTime,i.maxCompileTime=i.minCompileTime<e?e:i.minCompileTime,i.overhead=100*i.totalCompileTime/(this._lastCompilerStop-this._firstCompilerRun),i.maxCompilerBatchTime=this._taskBathTime>i.maxCompilerBatchTime?this._taskBathTime:i.maxCompilerBatchTime,this._lastCompilerStop=t,this._currentTask=null)},KZe.reset=function(){Object.assign(this.statRecords,{compiled:0,droped:0,minCompileTime:Number.MAX_VALUE,maxCompileTime:-Number.MAX_VALUE,totalCompileTime:-0,maxCompilerTaskTime:-Number.MAX_VALUE,overhead:0}),this._currentTask=null,this._taskBathTime=0},KZe.TASK_DELAY=10,KZe.statRecords={runs:0,drops:0,minCompileTime:Number.MAX_VALUE,maxCompileTime:-Number.MAX_VALUE,totalCompileTime:-0,maxCompilerBatchTime:-Number.MAX_VALUE,overhead:0},KZe._firstCompilerRun=-1,KZe._lastCompilerStop=-1,KZe._taskBathTime=0,KZe),GZe;function KZe(){}function HZe(){return null!==GZe&&GZe.apply(this,arguments)||this}function yZe(){this._block=null,this._used=!1,this._needSafe=!1}function tZe(){}window.AWAY_COMPILER_STAT=Stat;var b2Mat22=(QZe.prototype.Set=function(t){var e=Math.cos(t),i=Math.sin(t);this.col1.x=e,this.col2.x=-i,this.col1.y=i,this.col2.y=e},QZe.prototype.SetVV=function(t,e){this.col1.SetV(t),this.col2.SetV(e)},QZe.prototype.Copy=function(){return new QZe(0,this.col1,this.col2)},QZe.prototype.SetM=function(t){this.col1.SetV(t.col1),this.col2.SetV(t.col2)},QZe.prototype.AddM=function(t){this.col1.x+=t.col1.x,this.col1.y+=t.col1.y,this.col2.x+=t.col2.x,this.col2.y+=t.col2.y},QZe.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col1.y=0,this.col2.y=1},QZe.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col1.y=0,this.col2.y=0},QZe.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)},QZe.prototype.Invert=function(t){var e=this.col1.x,i=this.col2.x,n=this.col1.y,r=this.col2.y,o=1/(e*r-i*n);return t.col1.x=o*r,t.col2.x=-o*i,t.col1.y=-o*n,t.col2.y=o*e,t},QZe.prototype.Solve=function(t,e,i){var n=this.col1.x,r=this.col2.x,o=this.col1.y,s=this.col2.y,a=1/(n*s-r*o);return t.x=a*(s*e-r*i),t.y=a*(n*i-o*e),t},QZe.prototype.Abs=function(){this.col1.Abs(),this.col2.Abs()},QZe),b2Sweep=(p$e.prototype.GetXForm=function(t,e){var i,n;1-this.t0>Number.MIN_VALUE?(i=(e-this.t0)/(1-this.t0),t.position.x=(1-i)*this.c0.x+i*this.c.x,t.position.y=(1-i)*this.c0.y+i*this.c.y,n=(1-i)*this.a0+i*this.a,t.R.Set(n)):(t.position.SetV(this.c),t.R.Set(this.a));var r=t.R;t.position.x-=r.col1.x*this.localCenter.x+r.col2.x*this.localCenter.y,t.position.y-=r.col1.y*this.localCenter.x+r.col2.y*this.localCenter.y},p$e.prototype.Advance=function(t){var e;this.t0<t&&1-this.t0>Number.MIN_VALUE&&(e=(t-this.t0)/(1-this.t0),this.c0.x=(1-e)*this.c0.x+e*this.c.x,this.c0.y=(1-e)*this.c0.y+e*this.c.y,this.a0=(1-e)*this.a0+e*this.a,this.t0=t)},p$e),b2Vec2=(x$e.prototype.SetZero=function(){this.x=0,this.y=0},x$e.prototype.Set=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e},x$e.prototype.SetV=function(t){this.x=t.x,this.y=t.y},x$e.prototype.Negative=function(){return new x$e(-this.x,-this.y)},x$e.Make=function(t,e){return new x$e(t,e)},x$e.prototype.Copy=function(){return new x$e(this.x,this.y)},x$e.prototype.Add=function(t){this.x+=t.x,this.y+=t.y},x$e.prototype.Subtract=function(t){this.x-=t.x,this.y-=t.y},x$e.prototype.Multiply=function(t){this.x*=t,this.y*=t},x$e.prototype.MulM=function(t){var e=this.x;this.x=t.col1.x*e+t.col2.x*this.y,this.y=t.col1.y*e+t.col2.y*this.y},x$e.prototype.MulTM=function(t){var e=b2Math.b2Dot(this,t.col1);this.y=b2Math.b2Dot(this,t.col2),this.x=e},x$e.prototype.CrossVF=function(t){var e=this.x;this.x=t*this.y,this.y=-t*e},x$e.prototype.CrossFV=function(t){var e=this.x;this.x=-t*this.y,this.y=t*e},x$e.prototype.MinV=function(t){this.x=this.x<t.x?this.x:t.x,this.y=this.y<t.y?this.y:t.y},x$e.prototype.MaxV=function(t){this.x=this.x>t.x?this.x:t.x,this.y=this.y>t.y?this.y:t.y},x$e.prototype.Abs=function(){this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y)},x$e.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},x$e.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y},x$e.prototype.Normalize=function(){var t=Math.sqrt(this.x*this.x+this.y*this.y);if(t<Number.MIN_VALUE)return 0;var e=1/t;return this.x*=e,this.y*=e,t},x$e.prototype.IsValid=function(){return b2Math.b2IsValid(this.x)&&b2Math.b2IsValid(this.y)},x$e),b2XForm=(U$e.prototype.Initialize=function(t,e){this.position.SetV(t),this.R.SetM(e)},U$e.prototype.SetIdentity=function(){this.position.SetZero(),this.R.SetIdentity()},U$e.prototype.Set=function(t){this.position.SetV(t.position),this.R.SetM(t.R)},U$e),b2Math=($$e.b2IsValid=function(t){return isFinite(t)},$$e.b2Dot=function(t,e){return t.x*e.x+t.y*e.y},$$e.b2CrossVV=function(t,e){return t.x*e.y-t.y*e.x},$$e.b2CrossVF=function(t,e){return new b2Vec2(e*t.y,-e*t.x)},$$e.b2CrossFV=function(t,e){return new b2Vec2(-t*e.y,t*e.x)},$$e.b2MulMV=function(t,e){return new b2Vec2(t.col1.x*e.x+t.col2.x*e.y,t.col1.y*e.x+t.col2.y*e.y)},$$e.b2MulTMV=function(t,e){return new b2Vec2(this.b2Dot(e,t.col1),this.b2Dot(e,t.col2))},$$e.b2MulX=function(t,e){var i=this.b2MulMV(t.R,e);return i.x+=t.position.x,i.y+=t.position.y,i},$$e.b2MulXT=function(t,e){var i=this.SubtractVV(e,t.position),n=i.x*t.R.col1.x+i.y*t.R.col1.y;return i.y=i.x*t.R.col2.x+i.y*t.R.col2.y,i.x=n,i},$$e.AddVV=function(t,e){return new b2Vec2(t.x+e.x,t.y+e.y)},$$e.SubtractVV=function(t,e){return new b2Vec2(t.x-e.x,t.y-e.y)},$$e.b2Distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},$$e.b2DistanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},$$e.MulFV=function(t,e){return new b2Vec2(t*e.x,t*e.y)},$$e.AddMM=function(t,e){return new b2Mat22(0,this.AddVV(t.col1,e.col1),this.AddVV(t.col2,e.col2))},$$e.b2MulMM=function(t,e){return new b2Mat22(0,this.b2MulMV(t,e.col1),this.b2MulMV(t,e.col2))},$$e.b2MulTMM=function(t,e){var i=new b2Vec2(this.b2Dot(t.col1,e.col1),this.b2Dot(t.col2,e.col1)),n=new b2Vec2(this.b2Dot(t.col1,e.col2),this.b2Dot(t.col2,e.col2));return new b2Mat22(0,i,n)},$$e.b2Abs=function(t){return 0<t?t:-t},$$e.b2AbsV=function(t){return new b2Vec2(this.b2Abs(t.x),this.b2Abs(t.y))},$$e.b2AbsM=function(t){return new b2Mat22(0,this.b2AbsV(t.col1),this.b2AbsV(t.col2))},$$e.b2Min=function(t,e){return t<e?t:e},$$e.b2MinV=function(t,e){return new b2Vec2(this.b2Min(t.x,e.x),this.b2Min(t.y,e.y))},$$e.b2Max=function(t,e){return e<t?t:e},$$e.b2MaxV=function(t,e){return new b2Vec2(this.b2Max(t.x,e.x),this.b2Max(t.y,e.y))},$$e.b2Clamp=function(t,e,i){return this.b2Max(e,this.b2Min(t,i))},$$e.b2ClampV=function(t,e,i){return this.b2MaxV(e,this.b2MinV(t,i))},$$e.b2Swap=function(t,e){var i=t[0];t[0]=e[0],e[0]=i},$$e.b2Random=function(){return 2*Math.random()-1},$$e.b2RandomRange=function(t,e){var i=Math.random();return(e-t)*i+t},$$e.b2NextPowerOfTwo=function(t){return t|=t>>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,t|=t>>8&16777215,1+(t|=t>>16&65535)},$$e.b2IsPowerOfTwo=function(t){return 0<t&&0==(t&t-1)},$$e.b2Vec2_zero=new b2Vec2(0,0),$$e.b2Mat22_identity=new b2Mat22(0,new b2Vec2(1,0),new b2Vec2(0,1)),$$e.b2XForm_identity=new b2XForm($$e.b2Vec2_zero,$$e.b2Mat22_identity),$$e),b2Settings=(m0e.b2Assert=function(t){t||(void 0).x++},m0e.USHRT_MAX=65535,m0e.b2_pi=Math.PI,m0e.b2_maxManifoldPoints=2,m0e.b2_maxPolygonVertices=8,m0e.b2_maxPairs=8*(m0e.b2_maxProxies=512),m0e.b2_linearSlop=.005,m0e.b2_angularSlop=2/180*m0e.b2_pi,m0e.b2_toiSlop=8*m0e.b2_linearSlop,m0e.b2_maxTOIContactsPerIsland=32,m0e.b2_velocityThreshold=1,m0e.b2_maxLinearCorrection=.2,m0e.b2_maxAngularCorrection=8/180*m0e.b2_pi,m0e.b2_maxLinearVelocitySquared=(m0e.b2_maxLinearVelocity=200)*m0e.b2_maxLinearVelocity,m0e.b2_maxAngularVelocitySquared=(m0e.b2_maxAngularVelocity=250)*m0e.b2_maxAngularVelocity,m0e.b2_contactBaumgarte=.2,m0e.b2_timeToSleep=.5,m0e.b2_linearSleepTolerance=.01,m0e.b2_angularSleepTolerance=2/180,m0e),b2Pair=(o0e.prototype.SetBuffered=function(){this.status|=o0e.e_pairBuffered},o0e.prototype.ClearBuffered=function(){this.status&=~o0e.e_pairBuffered},o0e.prototype.IsBuffered=function(){return(this.status&o0e.e_pairBuffered)==o0e.e_pairBuffered},o0e.prototype.SetRemoved=function(){this.status|=o0e.e_pairRemoved},o0e.prototype.ClearRemoved=function(){this.status&=~o0e.e_pairRemoved},o0e.prototype.IsRemoved=function(){return(this.status&o0e.e_pairRemoved)==o0e.e_pairRemoved},o0e.prototype.SetFinal=function(){this.status|=o0e.e_pairFinal},o0e.prototype.IsFinal=function(){return(this.status&o0e.e_pairFinal)==o0e.e_pairFinal},o0e.b2_nullPair=b2Settings.USHRT_MAX,o0e.b2_nullProxy=b2Settings.USHRT_MAX,o0e.b2_tableCapacity=b2Settings.b2_maxPairs,o0e.b2_tableMask=o0e.b2_tableCapacity-1,o0e.e_pairBuffered=1,o0e.e_pairRemoved=2,o0e.e_pairFinal=4,o0e),b2AABB=(p0e.prototype.IsValid=function(){var t=this.upperBound.x-this.lowerBound.x,e=this.upperBound.y-this.lowerBound.y,i=0<=t&&0<=e;return i&&this.lowerBound.IsValid()&&this.upperBound.IsValid()},p0e),b2Shape=(t0e.prototype.GetType=function(){return this.m_type},t0e.prototype.IsSensor=function(){return this.m_isSensor},t0e.prototype.SetFilterData=function(t){this.m_filter=t.Copy()},t0e.prototype.GetFilterData=function(){return this.m_filter.Copy()},t0e.prototype.GetBody=function(){return this.m_body},t0e.prototype.GetNext=function(){return this.m_next},t0e.prototype.GetUserData=function(){return this.m_userData},t0e.prototype.SetUserData=function(t){this.m_userData=t},t0e.prototype.TestPoint=function(t,e){return!1},t0e.prototype.TestSegment=function(t,e,i,n,r){return!1},t0e.prototype.ComputeAABB=function(t,e){},t0e.prototype.ComputeSweptAABB=function(t,e,i){},t0e.prototype.ComputeMass=function(t){},t0e.prototype.GetSweepRadius=function(){return this.m_sweepRadius},t0e.prototype.GetFriction=function(){return this.m_friction},t0e.prototype.GetRestitution=function(){return this.m_restitution},t0e.Destroy=function(t,e){},t0e.prototype.CreateProxy=function(t,e){var i=t0e.s_proxyAABB;this.ComputeAABB(i,e);var n=t.InRange(i);this.m_proxyId=n?t.CreateProxy(i,this):b2Pair.b2_nullProxy},t0e.prototype.DestroyProxy=function(t){this.m_proxyId!=b2Pair.b2_nullProxy&&(t.DestroyProxy(this.m_proxyId),this.m_proxyId=b2Pair.b2_nullProxy)},t0e.prototype.Synchronize=function(t,e,i){if(this.m_proxyId==b2Pair.b2_nullProxy)return!1;var n=t0e.s_syncAABB;return this.ComputeSweptAABB(n,e,i),!!t.InRange(n)&&(t.MoveProxy(this.m_proxyId,n),!0)},t0e.prototype.RefilterProxy=function(t,e){var i,n;this.m_proxyId!=b2Pair.b2_nullProxy&&(t.DestroyProxy(this.m_proxyId),i=t0e.s_resetAABB,this.ComputeAABB(i,e),n=t.InRange(i),this.m_proxyId=n?t.CreateProxy(i,this):b2Pair.b2_nullProxy)},t0e.prototype.UpdateSweepRadius=function(t){},t0e.s_proxyAABB=new b2AABB,t0e.s_syncAABB=new b2AABB,t0e.s_resetAABB=new b2AABB,t0e.e_unknownShape=-1,t0e.e_circleShape=0,t0e.e_polygonShape=1,t0e.e_shapeTypeCount=2,t0e),b2FilterData=($0e.prototype.Copy=function(){var t=new $0e;return t.categoryBits=this.categoryBits,t.maskBits=this.maskBits,t.groupIndex=this.groupIndex,t},$0e),b2ShapeDef=function(){this.type=b2Shape.e_unknownShape,this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.isSensor=!1,this.filter=new b2FilterData},b2CircleDef=(a1e=b2ShapeDef,__extends(b1e,a1e),b1e),b2CircleShape=(d1e=b2Shape,__extends(e1e,d1e),e1e.prototype.TestPoint=function(t,e){var i=t.R,n=t.position.x+(i.col1.x*this.m_localPosition.x+i.col2.x*this.m_localPosition.y),r=t.position.y+(i.col1.y*this.m_localPosition.x+i.col2.y*this.m_localPosition.y);return(n=e.x-n)*n+(r=e.y-r)*r<=this.m_radius*this.m_radius},e1e.prototype.TestSegment=function(t,e,i,n,r){var o=t.R,s=t.position.x+(o.col1.x*this.m_localPosition.x+o.col2.x*this.m_localPosition.y),a=t.position.x+(o.col1.y*this.m_localPosition.x+o.col2.y*this.m_localPosition.y),l=n.p1.x-s,c=n.p1.y-a,h=l*l+c*c-this.m_radius*this.m_radius;if(h<0)return!1;var u=n.p2.x-n.p1.x,p=n.p2.y-n.p1.y,d=l*u+c*p,_=u*u+p*p,f=d*d-_*h;if(f<0||_<Number.MIN_VALUE)return!1;var m=-(d+Math.sqrt(f));return 0<=m&&m<=r*_&&(m/=_,e[0]=m,i.x=l+m*u,i.y=c+m*p,i.Normalize(),!0)},e1e.prototype.ComputeAABB=function(t,e){var i=e.R,n=e.position.x+(i.col1.x*this.m_localPosition.x+i.col2.x*this.m_localPosition.y),r=e.position.y+(i.col1.y*this.m_localPosition.x+i.col2.y*this.m_localPosition.y);t.lowerBound.Set(n-this.m_radius,r-this.m_radius),t.upperBound.Set(n+this.m_radius,r+this.m_radius)},e1e.prototype.ComputeSweptAABB=function(t,e,i){var n=e.R,r=e.position.x+(n.col1.x*this.m_localPosition.x+n.col2.x*this.m_localPosition.y),o=e.position.y+(n.col1.y*this.m_localPosition.x+n.col2.y*this.m_localPosition.y);n=i.R;var s=i.position.x+(n.col1.x*this.m_localPosition.x+n.col2.x*this.m_localPosition.y),a=i.position.y+(n.col1.y*this.m_localPosition.x+n.col2.y*this.m_localPosition.y);t.lowerBound.Set((r<s?r:s)-this.m_radius,(o<a?o:a)-this.m_radius),t.upperBound.Set((s<r?r:s)+this.m_radius,(a<o?o:a)+this.m_radius)},e1e.prototype.ComputeMass=function(t){t.mass=this.m_density*b2Settings.b2_pi*this.m_radius*this.m_radius,t.center.SetV(this.m_localPosition),t.I=t.mass*(.5*this.m_radius*this.m_radius+(this.m_localPosition.x*this.m_localPosition.x+this.m_localPosition.y*this.m_localPosition.y))},e1e.prototype.GetLocalPosition=function(){return this.m_localPosition},e1e.prototype.GetRadius=function(){return this.m_radius},e1e.prototype.UpdateSweepRadius=function(t){var e=this.m_localPosition.x-t.x,i=this.m_localPosition.y-t.y,e=Math.sqrt(e*e+i*i);this.m_sweepRadius=e+this.m_radius-b2Settings.b2_toiSlop},e1e),b2MassData=function(){this.mass=0,this.center=new b2Vec2(0,0),this.I=0},b2PolygonDef=(V1e=b2ShapeDef,__extends(W1e,V1e),W1e.prototype.SetAsBox=function(t,e){this.vertexCount=4,this.vertices[0].Set(-t,-e),this.vertices[1].Set(t,-e),this.vertices[2].Set(t,e),this.vertices[3].Set(-t,e)},W1e.prototype.SetAsOrientedBox=function(t,e,i,n){if(void 0===i&&(i=null),void 0===n&&(n=0),this.vertexCount=4,this.vertices[0].Set(-t,-e),this.vertices[1].Set(t,-e),this.vertices[2].Set(t,e),this.vertices[3].Set(-t,e),i){var r=i,o=W1e.s_mat;o.Set(n);for(var s=0;s<this.vertexCount;++s)i=this.vertices[s],t=r.x+(o.col1.x*i.x+o.col2.x*i.y),i.y=r.y+(o.col1.y*i.x+o.col2.y*i.y),i.x=t}},W1e.s_mat=new b2Mat22,W1e),b2OBB=function(){this.R=new b2Mat22,this.center=new b2Vec2,this.extents=new b2Vec2},b2PolygonShape=(g2e=b2Shape,__extends(h2e,g2e),h2e.prototype.TestPoint=function(t,e){for(var i,n=t.R,r=e.x-t.position.x,o=e.y-t.position.y,s=r*n.col1.x+o*n.col1.y,a=r*n.col2.x+o*n.col2.y,l=0;l<this.m_vertexCount;++l)if(r=s-(i=this.m_vertices[l]).x,o=a-i.y,0<(i=this.m_normals[l]).x*r+i.y*o)return!1;return!0},h2e.prototype.TestSegment=function(t,e,i,n,r){var o,s,a=0,l=r,c=n.p1.x-t.position.x,h=n.p1.y-t.position.y,u=c*(o=t.R).col1.x+h*o.col1.y,p=c*o.col2.x+h*o.col2.y;c=n.p2.x-t.position.x,h=n.p2.y-t.position.y;for(var d=c*(o=t.R).col1.x+h*o.col1.y-u,_=c*o.col2.x+h*o.col2.y-p,f=-1,m=0;m<this.m_vertexCount;++m){c=(s=this.m_vertices[m]).x-u,h=s.y-p;var g=(s=this.m_normals[m]).x*c+s.y*h,y=s.x*d+s.y*_;if(y<0&&g<a*y?(a=g/y,f=m):0<y&&g<l*y&&(l=g/y),l<a)return!1}return 0<=f&&(e[0]=a,o=t.R,s=this.m_normals[f],i.x=o.col1.x*s.x+o.col2.x*s.y,i.y=o.col1.y*s.x+o.col2.y*s.y,!0)},h2e.prototype.ComputeAABB=function(t,e){var i=h2e.s_computeMat,n=e.R,r=this.m_obb.R.col1;i.col1.x=n.col1.x*r.x+n.col2.x*r.y,i.col1.y=n.col1.y*r.x+n.col2.y*r.y,r=this.m_obb.R.col2,i.col2.x=n.col1.x*r.x+n.col2.x*r.y,i.col2.y=n.col1.y*r.x+n.col2.y*r.y,i.Abs(),r=this.m_obb.extents;var o=i.col1.x*r.x+i.col2.x*r.y,s=i.col1.y*r.x+i.col2.y*r.y;n=e.R,r=this.m_obb.center;var a=e.position.x+(n.col1.x*r.x+n.col2.x*r.y),l=e.position.y+(n.col1.y*r.x+n.col2.y*r.y);t.lowerBound.Set(a-o,l-s),t.upperBound.Set(a+o,l+s)},h2e.prototype.ComputeSweptAABB=function(t,e,i){var n=h2e.s_sweptAABB1,r=h2e.s_sweptAABB2;this.ComputeAABB(n,e),this.ComputeAABB(r,i),t.lowerBound.Set(n.lowerBound.x<r.lowerBound.x?n.lowerBound.x:r.lowerBound.x,n.lowerBound.y<r.lowerBound.y?n.lowerBound.y:r.lowerBound.y),t.upperBound.Set(n.upperBound.x>r.upperBound.x?n.upperBound.x:r.upperBound.x,n.upperBound.y>r.upperBound.y?n.upperBound.y:r.upperBound.y)},h2e.prototype.ComputeMass=function(t){for(var e=0,i=0,n=0,r=0,o=0;o<this.m_vertexCount;++o){var s=this.m_vertices[o],a=o+1<this.m_vertexCount?this.m_vertices[o+1]:this.m_vertices[0],l=+s.x,c=+s.y,h=+a.x,u=+a.y,p=l*u-c*h,d=.5*p;n+=d,e+=1/3*d*(0+s.x+a.x),i+=1/3*d*(0+s.y+a.y),r+=p*(1/3*(.25*(l*l+h*l+h*h)+(0*l+0*h))+0+(1/3*(.25*(c*c+u*c+u*u)+(0*c+0*u))+0))}t.mass=this.m_density*n,e*=1/n,i*=1/n,t.center.Set(e,i),t.I=this.m_density*r},h2e.prototype.GetOBB=function(){return this.m_obb},h2e.prototype.GetCentroid=function(){return this.m_centroid},h2e.prototype.GetVertexCount=function(){return this.m_vertexCount},h2e.prototype.GetVertices=function(){return this.m_vertices},h2e.prototype.GetCoreVertices=function(){return this.m_coreVertices},h2e.prototype.GetNormals=function(){return this.m_normals},h2e.prototype.GetFirstVertex=function(t){return b2Math.b2MulX(t,this.m_coreVertices[0])},h2e.prototype.Centroid=function(t){return b2Math.b2MulX(t,this.m_centroid)},h2e.prototype.Support=function(t,e,i){for(var n,r,o=e*(r=t.R).col1.x+i*r.col1.y,s=e*r.col2.x+i*r.col2.y,a=0,l=(n=this.m_coreVertices[0]).x*o+n.y*s,c=1;c<this.m_vertexCount;++c){var h=(n=this.m_coreVertices[c]).x*o+n.y*s;l<h&&(a=c,l=h)}return r=t.R,n=this.m_coreVertices[a],this.s_supportVec.x=t.position.x+(r.col1.x*n.x+r.col2.x*n.y),this.s_supportVec.y=t.position.y+(r.col1.y*n.x+r.col2.y*n.y),this.s_supportVec},h2e.prototype.UpdateSweepRadius=function(t){for(var e,i=this.m_sweepRadius=0;i<this.m_vertexCount;++i){var n=(e=this.m_coreVertices[i]).x-t.x,r=e.y-t.y;(n=Math.sqrt(n*n+r*r))>this.m_sweepRadius&&(this.m_sweepRadius=n)}},h2e.ComputeCentroid=function(t,e){for(var i=new b2Vec2,n=0,r=0;r<e;++r){var o=t[r],s=r+1<e?t[r+1]:t[0],a=+o.x,l=+o.y,c=+s.x,h=.5*(a*s.y-l*c);n+=h,i.x+=1/3*h*(0+o.x+s.x),i.y+=1/3*h*(0+o.y+s.y)}return i.x*=1/n,i.y*=1/n,i},h2e.ComputeOBB=function(t,e,i){for(var n=new Array(b2Settings.b2_maxPolygonVertices+1),r=0;r<i;++r)n[r]=e[r];n[i]=n[0];var o=Number.MAX_VALUE;for(r=1;r<=i;++r){for(var s=n[r-1],a=n[r].x-s.x,l=n[r].y-s.y,c=Math.sqrt(a*a+l*l),h=-(l/=c),u=a/=c,p=Number.MAX_VALUE,d=Number.MAX_VALUE,_=-Number.MAX_VALUE,f=-Number.MAX_VALUE,m=0;m<i;++m){var g=n[m].x-s.x,y=n[m].y-s.y,b=a*g+l*y,v=h*g+u*y;b<p&&(p=b),v<d&&(d=v),_<b&&(_=b),f<v&&(f=v)}var x,A,S,w=(_-p)*(f-d);w<.95*o&&(o=w,t.R.col1.x=a,t.R.col1.y=l,t.R.col2.x=h,t.R.col2.y=u,x=.5*(p+_),A=.5*(d+f),S=t.R,t.center.x=s.x+(S.col1.x*x+S.col2.x*A),t.center.y=s.y+(S.col1.y*x+S.col2.y*A),t.extents.x=.5*(_-p),t.extents.y=.5*(f-d))}},h2e.s_computeMat=new b2Mat22,h2e.s_sweptAABB1=new b2AABB,h2e.s_sweptAABB2=new b2AABB,h2e),b2Bound=(E4e.prototype.IsLower=function(){return 0==(1&this.value)},E4e.prototype.IsUpper=function(){return 1==(1&this.value)},E4e.prototype.Swap=function(t){var e=this.value,i=this.proxyId,n=this.stabbingCount;this.value=t.value,this.proxyId=t.proxyId,this.stabbingCount=t.stabbingCount,t.value=e,t.proxyId=i,t.stabbingCount=n},E4e),b2BoundValues=function(){this.lowerValues=[0,0],this.upperValues=[0,0]},b2Proxy=(J4e.prototype.GetNext=function(){return this.lowerBounds[0]},J4e.prototype.SetNext=function(t){this.lowerBounds[0]=65535&t},J4e.prototype.IsValid=function(){return this.overlapCount!=b2BroadPhase.b2_invalid},J4e),b2BufferedPair=function(){},b2PairManager=(L4e.prototype.Initialize=function(t,e){this.m_broadPhase=t,this.m_callback=e},L4e.prototype.AddBufferedPair=function(t,e){var i,n=this.AddPair(t,e);0==n.IsBuffered()&&(n.SetBuffered(),(i=this.m_pairBuffer[this.m_pairBufferCount]).proxyId1=n.proxyId1,i.proxyId2=n.proxyId2,++this.m_pairBufferCount),n.ClearRemoved(),b2BroadPhase.s_validate&&this.ValidateBuffer()},L4e.prototype.RemoveBufferedPair=function(t,e){var i,n=this.Find(t,e);null!=n&&(0==n.IsBuffered()&&(n.SetBuffered(),(i=this.m_pairBuffer[this.m_pairBufferCount]).proxyId1=n.proxyId1,i.proxyId2=n.proxyId2,++this.m_pairBufferCount),n.SetRemoved(),b2BroadPhase.s_validate&&this.ValidateBuffer())},L4e.prototype.Commit=function(){for(var t,e=0,i=this.m_broadPhase.m_proxyPool,n=0;n<this.m_pairBufferCount;++n){t=this.m_pairBuffer[n];var r=this.Find(t.proxyId1,t.proxyId2);r.ClearBuffered();var o=i[r.proxyId1],s=i[r.proxyId2];r.IsRemoved()?(1==r.IsFinal()&&this.m_callback.PairRemoved(o.userData,s.userData,r.userData),(t=this.m_pairBuffer[e]).proxyId1=r.proxyId1,t.proxyId2=r.proxyId2,++e):0==r.IsFinal()&&(r.userData=this.m_callback.PairAdded(o.userData,s.userData),r.SetFinal())}for(n=0;n<e;++n)t=this.m_pairBuffer[n],this.RemovePair(t.proxyId1,t.proxyId2);this.m_pairBufferCount=0,b2BroadPhase.s_validate&&this.ValidateTable()},L4e.prototype.AddPair=function(t,e){var i;e<t&&(i=t,t=e,e=i);var n=L4e.Hash(t,e)&b2Pair.b2_tableMask;if(null!=(o=this.FindHash(t,e,n)))return o;var r=this.m_freePair,o=this.m_pairs[r];return this.m_freePair=o.next,o.proxyId1=t,o.proxyId2=e,o.status=0,o.userData=null,o.next=this.m_hashTable[n],this.m_hashTable[n]=r,++this.m_pairCount,o},L4e.prototype.RemovePair=function(t,e){var i;e<t&&(i=t,t=e,e=i);for(var n=L4e.Hash(t,e)&b2Pair.b2_tableMask,r=this.m_hashTable[n],o=null;r!=b2Pair.b2_nullPair;){if(L4e.Equals(this.m_pairs[r],t,e)){var s=r,a=this.m_pairs[r];o?o.next=a.next:this.m_hashTable[n]=a.next;var l=(a=this.m_pairs[s]).userData;return a.next=this.m_freePair,a.proxyId1=b2Pair.b2_nullProxy,a.proxyId2=b2Pair.b2_nullProxy,a.userData=null,a.status=0,this.m_freePair=s,--this.m_pairCount,l}r=(o=this.m_pairs[r]).next}return null},L4e.prototype.Find=function(t,e){var i;e<t&&(i=t,t=e,e=i);var n=L4e.Hash(t,e)&b2Pair.b2_tableMask;return this.FindHash(t,e,n)},L4e.prototype.FindHash=function(t,e,i){for(var n=this.m_hashTable[i],r=this.m_pairs[n];n!=b2Pair.b2_nullPair&&0==L4e.Equals(r,t,e);)n=r.next,r=this.m_pairs[n];return n==b2Pair.b2_nullPair?null:r},L4e.prototype.ValidateBuffer=function(){},L4e.prototype.ValidateTable=function(){},L4e.Hash=function(t,e){var i=~(i=e<<16&4294901760|t)+(i<<15&4294934528);return i^=i>>12&1048575,i+=i<<2&4294967292,i^=i>>4&268435455,(i*=2057)^i>>16&65535},L4e.Equals=function(t,e,i){return t.proxyId1==e&&t.proxyId2==i},L4e.EqualsPair=function(t,e){return t.proxyId1==e.proxyId1&&t.proxyId2==e.proxyId2},L4e),b2BroadPhase=(I5e.prototype.InRange=function(t){var e,i,n=t.lowerBound.x,r=t.lowerBound.y;return n-=this.m_worldAABB.upperBound.x,r-=this.m_worldAABB.upperBound.y,e=this.m_worldAABB.lowerBound.x,i=this.m_worldAABB.lowerBound.y,e-=t.upperBound.x,i-=t.upperBound.y,n=b2Math.b2Max(n,e),r=b2Math.b2Max(r,i),b2Math.b2Max(n,r)<0},I5e.prototype.GetProxy=function(t){var e=this.m_proxyPool[t];return t==b2Pair.b2_nullProxy||0==e.IsValid()?null:e},I5e.prototype.CreateProxy=function(t,e){var i,n=this.m_freeProxy,r=this.m_proxyPool[n];this.m_freeProxy=r.GetNext(),r.overlapCount=0,r.userData=e;var o=2*this.m_proxyCount,s=[],a=[];this.ComputeBounds(s,a,t);for(var l=0;l<2;++l){var c=this.m_bounds[l],h=0,u=0,p=[h],d=[u];this.Query(p,d,s[l],a[l],c,o,l),h=p[0];for(var _,f,m,g=[],y=o-(u=d[0]),b=0;b<y;b++)g[b]=new b2Bound,_=g[b],f=c[u+b],_.value=f.value,_.proxyId=f.proxyId,_.stabbingCount=f.stabbingCount;y=g.length;var v=u+2;for(b=0;b<y;b++)f=g[b],(_=c[v+b]).value=f.value,_.proxyId=f.proxyId,_.stabbingCount=f.stabbingCount;for(g=new Array,y=u-h,b=0;b<y;b++)g[b]=new b2Bound,_=g[b],f=c[h+b],_.value=f.value,_.proxyId=f.proxyId,_.stabbingCount=f.stabbingCount;for(y=g.length,v=h+1,b=0;b<y;b++)f=g[b],(_=c[v+b]).value=f.value,_.proxyId=f.proxyId,_.stabbingCount=f.stabbingCount;for(++u,_=c[h],f=c[u],_.value=s[l],_.proxyId=n,f.value=a[l],f.proxyId=n,m=c[h-1],_.stabbingCount=0==h?0:m.stabbingCount,m=c[u-1],f.stabbingCount=m.stabbingCount,i=h;i<u;++i)(m=c[i]).stabbingCount++;for(i=h;i<2+o;++i){_=c[i];var x=this.m_proxyPool[_.proxyId];_.IsLower()?x.lowerBounds[l]=i:x.upperBounds[l]=i}}++this.m_proxyCount;for(var A=0;A<this.m_queryResultCount;++A)this.m_pairManager.AddBufferedPair(n,this.m_queryResults[A]);return this.m_pairManager.Commit(),this.m_queryResultCount=0,this.IncrementTimeStamp(),n},I5e.prototype.DestroyProxy=function(t){for(var e,i,n=this.m_proxyPool[t],r=2*this.m_proxyCount,o=0;o<2;++o){for(var s=this.m_bounds[o],a=n.lowerBounds[o],l=n.upperBounds[o],c=(e=s[a]).value,h=(i=s[l]).value,u=new Array,p=l-a-1,d=0;d<p;d++)u[d]=new b2Bound,e=u[d],i=s[a+1+d],e.value=i.value,e.proxyId=i.proxyId,e.stabbingCount=i.stabbingCount;p=u.length;var _=a;for(d=0;d<p;d++)i=u[d],(e=s[_+d]).value=i.value,e.proxyId=i.proxyId,e.stabbingCount=i.stabbingCount;for(u=new Array,p=r-l-1,d=0;d<p;d++)u[d]=new b2Bound,e=u[d],i=s[l+1+d],e.value=i.value,e.proxyId=i.proxyId,e.stabbingCount=i.stabbingCount;for(p=u.length,_=l-1,d=0;d<p;d++)i=u[d],(e=s[_+d]).value=i.value,e.proxyId=i.proxyId,e.stabbingCount=i.stabbingCount;p=r-2;for(var f=a;f<p;++f){e=s[f];var m=this.m_proxyPool[e.proxyId];e.IsLower()?m.lowerBounds[o]=f:m.upperBounds[o]=f}p=l-1;for(var g=a;g<p;++g)(e=s[g]).stabbingCount--;this.Query([0],[0],c,h,s,r-2,o)}for(var y=0;y<this.m_queryResultCount;++y)this.m_pairManager.RemoveBufferedPair(t,this.m_queryResults[y]);this.m_pairManager.Commit(),this.m_queryResultCount=0,this.IncrementTimeStamp(),n.userData=null,n.overlapCount=I5e.b2_invalid,n.lowerBounds[0]=I5e.b2_invalid,n.lowerBounds[1]=I5e.b2_invalid,n.upperBounds[0]=I5e.b2_invalid,n.upperBounds[1]=I5e.b2_invalid,n.SetNext(this.m_freeProxy),this.m_freeProxy=t,--this.m_proxyCount},I5e.prototype.MoveProxy=function(t,e){var i,n,r,o,s,a,l,c;if(!(t==b2Pair.b2_nullProxy||b2Settings.b2_maxProxies<=t)&&0!=e.IsValid()){var h=2*this.m_proxyCount,u=this.m_proxyPool[t],p=new b2BoundValues;this.ComputeBounds(p.lowerValues,p.upperValues,e);for(var d=new b2BoundValues,_=0;_<2;++_)o=this.m_bounds[_][u.lowerBounds[_]],d.lowerValues[_]=o.value,o=this.m_bounds[_][u.upperBounds[_]],d.upperValues[_]=o.value;for(_=0;_<2;++_){var f=this.m_bounds[_],m=u.lowerBounds[_],g=u.upperBounds[_],y=p.lowerValues[_],b=p.upperValues[_],v=y-(o=f[m]).value;o.value=y;var x=b-(o=f[g]).value;if(o.value=b,v<0)for(r=m;0<r&&y<f[r-1].value;){o=f[r];var A=(s=f[r-1]).proxyId,S=this.m_proxyPool[s.proxyId];s.stabbingCount++,1==s.IsUpper()?(this.TestOverlap(p,S)&&this.m_pairManager.AddBufferedPair(t,A),n=(i=S.upperBounds)[_],n++,i[_]=n,o.stabbingCount++):(n=(i=S.lowerBounds)[_],n++,i[_]=n,o.stabbingCount--),n=(i=u.lowerBounds)[_],n--,i[_]=n,o.Swap(s),--r}if(0<x)for(r=g;r<h-1&&f[r+1].value<=b;)o=f[r],l=(a=f[r+1]).proxyId,c=this.m_proxyPool[l],a.stabbingCount++,1==a.IsLower()?(this.TestOverlap(p,c)&&this.m_pairManager.AddBufferedPair(t,l),n=(i=c.lowerBounds)[_],n--,i[_]=n,o.stabbingCount++):(n=(i=c.upperBounds)[_],n--,i[_]=n,o.stabbingCount--),n=(i=u.upperBounds)[_],n++,i[_]=n,o.Swap(a),r++;if(0<v)for(r=m;r<h-1&&f[r+1].value<=y;)o=f[r],l=(a=f[r+1]).proxyId,c=this.m_proxyPool[l],a.stabbingCount--,a.IsUpper()?(this.TestOverlap(d,c)&&this.m_pairManager.RemoveBufferedPair(t,l),n=(i=c.upperBounds)[_],n--,i[_]=n,o.stabbingCount--):(n=(i=c.lowerBounds)[_],n--,i[_]=n,o.stabbingCount++),n=(i=u.lowerBounds)[_],n++,i[_]=n,o.Swap(a),r++;if(x<0)for(r=g;0<r&&b<f[r-1].value;)o=f[r],A=(s=f[r-1]).proxyId,S=this.m_proxyPool[A],s.stabbingCount--,1==s.IsLower()?(this.TestOverlap(d,S)&&this.m_pairManager.RemoveBufferedPair(t,A),n=(i=S.lowerBounds)[_],n++,i[_]=n,o.stabbingCount--):(n=(i=S.upperBounds)[_],n++,i[_]=n,o.stabbingCount++),n=(i=u.upperBounds)[_],n--,i[_]=n,o.Swap(s),r--}}},I5e.prototype.Commit=function(){this.m_pairManager.Commit()},I5e.prototype.QueryAABB=function(t,e,i){var n=new Array,r=new Array;this.ComputeBounds(n,r,t);var o=[0],s=[0];this.Query(o,s,n[0],r[0],this.m_bounds[0],2*this.m_proxyCount,0),this.Query(o,s,n[1],r[1],this.m_bounds[1],2*this.m_proxyCount,1);for(var a=0,l=0;l<this.m_queryResultCount&&a<i;++l,++a){var c=this.m_proxyPool[this.m_queryResults[l]];e[l]=c.userData}return this.m_queryResultCount=0,this.IncrementTimeStamp(),a},I5e.prototype.Validate=function(){for(var t=0;t<2;++t)for(var e=this.m_bounds[t],i=2*this.m_proxyCount,n=0;n<i;++n)e[n].IsLower()},I5e.prototype.ComputeBounds=function(t,e,i){var n=i.lowerBound.x,r=i.lowerBound.y,n=b2Math.b2Min(n,this.m_worldAABB.upperBound.x),r=b2Math.b2Min(r,this.m_worldAABB.upperBound.y);n=b2Math.b2Max(n,this.m_worldAABB.lowerBound.x),r=b2Math.b2Max(r,this.m_worldAABB.lowerBound.y);var o=i.upperBound.x,s=i.upperBound.y,o=b2Math.b2Min(o,this.m_worldAABB.upperBound.x),s=b2Math.b2Min(s,this.m_worldAABB.upperBound.y);o=b2Math.b2Max(o,this.m_worldAABB.lowerBound.x),s=b2Math.b2Max(s,this.m_worldAABB.lowerBound.y),t[0]=this.m_quantizationFactor.x*(n-this.m_worldAABB.lowerBound.x)>>>0&b2Settings.USHRT_MAX-1,e[0]=this.m_quantizationFactor.x*(o-this.m_worldAABB.lowerBound.x)>>>0&65535|1,t[1]=this.m_quantizationFactor.y*(r-this.m_worldAABB.lowerBound.y)>>>0&b2Settings.USHRT_MAX-1,e[1]=this.m_quantizationFactor.y*(s-this.m_worldAABB.lowerBound.y)>>>0&65535|1},I5e.prototype.TestOverlapValidate=function(t,e){for(var i=0;i<2;++i){var n=this.m_bounds[i],r=n[t.lowerBounds[i]],o=n[e.upperBounds[i]];if(r.value>o.value)return!1;if(r=n[t.upperBounds[i]],o=n[e.lowerBounds[i]],r.value<o.value)return!1}return!0},I5e.prototype.TestOverlap=function(t,e){for(var i=0;i<2;++i){var n=this.m_bounds[i],r=n[e.upperBounds[i]];if(t.lowerValues[i]>r.value)return!1;if(r=n[e.lowerBounds[i]],t.upperValues[i]<r.value)return!1}return!0},I5e.prototype.Query=function(t,e,i,n,r,o,s){for(var a,l=I5e.BinarySearch(r,o,i),c=I5e.BinarySearch(r,o,n),h=l;h<c;++h)(a=r[h]).IsLower()&&this.IncrementOverlapCount(a.proxyId);if(0<l)for(var u=l-1,p=(a=r[u]).stabbingCount;p;)(a=r[u]).IsLower()&&l<=this.m_proxyPool[a.proxyId].upperBounds[s]&&(this.IncrementOverlapCount(a.proxyId),--p),--u;t[0]=l,e[0]=c},I5e.prototype.IncrementOverlapCount=function(t){var e=this.m_proxyPool[t];e.timeStamp<this.m_timeStamp?(e.timeStamp=this.m_timeStamp,e.overlapCount=1):(e.overlapCount=2,this.m_queryResults[this.m_queryResultCount]=t,++this.m_queryResultCount)},I5e.prototype.IncrementTimeStamp=function(){if(this.m_timeStamp==b2Settings.USHRT_MAX){for(var t=0;t<b2Settings.b2_maxProxies;++t)this.m_proxyPool[t].timeStamp=0;this.m_timeStamp=1}else++this.m_timeStamp},I5e.BinarySearch=function(t,e,i){for(var n=0,r=e-1;n<=r;){var o=(n+r)/2|0,s=t[o];if(s.value>i)r=o-1;else{if(!(s.value<i))return o>>>0;n=1+o}}return n>>>0},I5e.s_validate=!1,I5e.b2_invalid=b2Settings.USHRT_MAX,I5e.b2_nullEdge=b2Settings.USHRT_MAX,I5e),Features=(Object.defineProperty(i8e.prototype,"referenceEdge",{get:function(){return this._referenceEdge},set:function(t){this._referenceEdge=t,this._m_id._key=4294967040&this._m_id._key|255&this._referenceEdge},enumerable:!0,configurable:!0}),Object.defineProperty(i8e.prototype,"incidentEdge",{get:function(){return this._incidentEdge},set:function(t){this._incidentEdge=t,this._m_id._key=4294902015&this._m_id._key|this._incidentEdge<<8&65280},enumerable:!0,configurable:!0}),Object.defineProperty(i8e.prototype,"incidentVertex",{get:function(){return this._incidentVertex},set:function(t){this._incidentVertex=t,this._m_id._key=4278255615&this._m_id._key|this._incidentVertex<<16&16711680},enumerable:!0,configurable:!0}),Object.defineProperty(i8e.prototype,"flip",{get:function(){return this._flip},set:function(t){this._flip=t,this._m_id._key=16777215&this._m_id._key|this._flip<<24&4278190080},enumerable:!0,configurable:!0}),i8e),b2ContactID=(n8e.prototype.Set=function(t){this.key=t._key},n8e.prototype.Copy=function(){var t=new n8e;return t.key=this.key,t},Object.defineProperty(n8e.prototype,"key",{get:function(){return this._key},set:function(t){this._key=t,this.features._referenceEdge=255&this._key,this.features._incidentEdge=(65280&this._key)>>8&255,this.features._incidentVertex=(16711680&this._key)>>16&255,this.features._flip=(4278190080&this._key)>>24&255},enumerable:!0,configurable:!0}),n8e),ClipVertex=function(){this.v=new b2Vec2,this.id=new b2ContactID},b2Collision=(r8e.ClipSegmentToLine=function(t,e,i,n){var r,o,s,a,l=0,c=(r=e[0]).v,h=(r=e[1]).v,u=b2Math.b2Dot(i,c)-n,p=b2Math.b2Dot(i,h)-n;return u<=0&&(t[l++]=e[0]),p<=0&&(t[l++]=e[1]),u*p<0&&(s=u/(u-p),(a=(r=t[l]).v).x=c.x+s*(h.x-c.x),a.y=c.y+s*(h.y-c.y),r=t[l],o=0<u?e[0]:e[1],r.id=o.id,++l),l},r8e.EdgeSeparation=function(t,e,i,n,r){t.m_vertexCount;for(var o=t.m_vertices,s=t.m_normals,a=n.m_vertexCount,l=n.m_vertices,c=e.R,h=s[i],u=c.col1.x*h.x+c.col2.x*h.y,p=c.col1.y*h.x+c.col2.y*h.y,d=(c=r.R).col1.x*u+c.col1.y*p,_=c.col2.x*u+c.col2.y*p,f=0,m=Number.MAX_VALUE,g=0;g<a;++g){var y=(h=l[g]).x*d+h.y*_;y<m&&(m=y,f=g)}h=o[i],c=e.R;var b=e.position.x+(c.col1.x*h.x+c.col2.x*h.y),v=e.position.y+(c.col1.y*h.x+c.col2.y*h.y);h=l[f],c=r.R;var x=r.position.x+(c.col1.x*h.x+c.col2.x*h.y),A=r.position.y+(c.col1.y*h.x+c.col2.y*h.y);return(x-=b)*u+(A-=v)*p},r8e.FindMaxSeparation=function(t,e,i,n,r){var o=e.m_vertexCount,s=e.m_normals,a=r.R,l=n.m_centroid,c=r.position.x+(a.col1.x*l.x+a.col2.x*l.y),h=r.position.y+(a.col1.y*l.x+a.col2.y*l.y);a=i.R,l=e.m_centroid,c-=i.position.x+(a.col1.x*l.x+a.col2.x*l.y),h-=i.position.y+(a.col1.y*l.x+a.col2.y*l.y);for(var u=c*i.R.col1.x+h*i.R.col1.y,p=c*i.R.col2.x+h*i.R.col2.y,d=0,_=-Number.MAX_VALUE,f=0;f<o;++f){var m=(l=s[f]).x*u+l.y*p;_<m&&(_=m,d=f)}var g=this.EdgeSeparation(e,i,d,n,r);if(0<g)return g;var y=0<=d-1?d-1:o-1,b=this.EdgeSeparation(e,i,y,n,r);if(0<b)return b;var v,x,A,S=d+1<o?d+1:0,w=this.EdgeSeparation(e,i,S,n,r);if(0<w)return w;if(g<b&&w<b)A=-1,v=y,x=b;else{if(!(g<w))return t[0]=d,g;A=1,v=S,x=w}for(;;){if(d=-1==A?0<=v-1?v-1:o-1:v+1<o?v+1:0,0<(g=this.EdgeSeparation(e,i,d,n,r)))return g;if(!(x<g))break;v=d,x=g}return t[0]=v,x},r8e.FindIncidentEdge=function(t,e,i,n,r,o){e.m_vertexCount;for(var s=e.m_normals,a=r.m_vertexCount,l=r.m_vertices,c=r.m_normals,h=i.R,u=s[n],p=h.col1.x*u.x+h.col2.x*u.y,d=h.col1.y*u.x+h.col2.y*u.y,_=(h=o.R).col1.x*p+h.col1.y*d,d=h.col2.x*p+h.col2.y*d,p=_,f=0,m=Number.MAX_VALUE,g=0;g<a;++g){var y=p*(u=c[g]).x+d*u.y;y<m&&(m=y,f=g)}var b=f,v=b+1<a?b+1:0,x=t[0];u=l[b],h=o.R,x.v.x=o.position.x+(h.col1.x*u.x+h.col2.x*u.y),x.v.y=o.position.y+(h.col1.y*u.x+h.col2.y*u.y),x.id.features.referenceEdge=n,x.id.features.incidentEdge=b,x.id.features.incidentVertex=0,x=t[1],u=l[v],h=o.R,x.v.x=o.position.x+(h.col1.x*u.x+h.col2.x*u.y),x.v.y=o.position.y+(h.col1.y*u.x+h.col2.y*u.y),x.id.features.referenceEdge=n,x.id.features.incidentEdge=v,x.id.features.incidentVertex=1},r8e.b2CollidePolygons=function(t,e,i,n,r){var o,s=[l=t.pointCount=0],a=this.FindMaxSeparation(s,e,i,n,r),l=s[0];if(!(0<a)){var c=[u=0],h=this.FindMaxSeparation(c,n,r,e,i),u=c[0];if(!(0<h)){var p,d,_,f=new b2XForm,m=new b2XForm,g=.98*a+.001<h?(p=n,d=e,f.Set(r),m.Set(i),_=u,1):(p=e,d=n,f.Set(i),m.Set(r),_=l,0),y=[new ClipVertex,new ClipVertex];this.FindIncidentEdge(y,p,f,_,d,m);var b=p.m_vertexCount,v=p.m_vertices,x=v[_].Copy(),A=_+1<b?v[_+1].Copy():v[0].Copy();b2Math.SubtractVV(A,x);var S=b2Math.b2MulMV(f.R,b2Math.SubtractVV(A,x));S.Normalize();var w=b2Math.b2CrossVF(S,1),x=b2Math.b2MulX(f,x);A=b2Math.b2MulX(f,A);var C=b2Math.b2Dot(w,x),P=-b2Math.b2Dot(S,x),E=b2Math.b2Dot(S,A),T=[new ClipVertex,new ClipVertex],M=[new ClipVertex,new ClipVertex];if(!(this.ClipSegmentToLine(T,y,S.Negative(),P)<2||this.ClipSegmentToLine(M,T,S,E)<2)){t.normal=g?w.Negative():w.Copy();for(var D=0,I=0;I<b2Settings.b2_maxManifoldPoints;++I){o=M[I];var O,L=b2Math.b2Dot(w,o.v)-C;L<=0&&((O=t.points[D]).separation=L,O.localPoint1=b2Math.b2MulXT(i,o.v),O.localPoint2=b2Math.b2MulXT(r,o.v),O.id.key=o.id._key,O.id.features.flip=g,++D)}t.pointCount=D}}}},r8e.b2CollideCircles=function(t,e,i,n,r){t.pointCount=0,g=i.R,y=e.m_localPosition;var o,s,a,l,c,h,u,p,d,_,f=i.position.x+(g.col1.x*y.x+g.col2.x*y.y),m=i.position.y+(g.col1.y*y.x+g.col2.y*y.y),g=r.R,y=n.m_localPosition,b=(o=r.position.x+(g.col1.x*y.x+g.col2.x*y.y))-f,v=(s=r.position.y+(g.col1.y*y.x+g.col2.y*y.y))-m,x=b*b+v*v,A=e.m_radius,S=n.m_radius,w=A+S;w*w<x||(x<Number.MIN_VALUE?(l=-w,t.normal.Set(0,1)):(l=(a=Math.sqrt(x))-w,c=1/a,t.normal.x=c*b,t.normal.y=c*v),t.pointCount=1,(h=t.points[0]).id.key=0,h.separation=l,f+=A*t.normal.x,m+=A*t.normal.y,u=.5*(f+(o-=S*t.normal.x)),p=.5*(m+(s-=S*t.normal.y)),d=u-i.position.x,_=p-i.position.y,h.localPoint1.x=d*i.R.col1.x+_*i.R.col1.y,h.localPoint1.y=d*i.R.col2.x+_*i.R.col2.y,d=u-r.position.x,_=p-r.position.y,h.localPoint2.x=d*r.R.col1.x+_*r.R.col1.y,h.localPoint2.y=d*r.R.col2.x+_*r.R.col2.y)},r8e.b2CollidePolygonAndCircle=function(t,e,i,n,r){var o,s,a;t.pointCount=0,a=r.R,C=n.m_localPosition;for(var l,c=r.position.x+(a.col1.x*C.x+a.col2.x*C.y),h=r.position.y+(a.col1.y*C.x+a.col2.y*C.y),u=c-i.position.x,p=h-i.position.y,d=u*(a=i.R).col1.x+p*a.col1.y,_=u*a.col2.x+p*a.col2.y,f=0,m=-Number.MAX_VALUE,g=n.m_radius,y=e.m_vertexCount,b=e.m_vertices,v=e.m_normals,x=0;x<y;++x){u=d-(C=b[x]).x,p=_-C.y;var A=(C=v[x]).x*u+C.y*p;if(g<A)return;m<A&&(m=A,f=x)}if(m<Number.MIN_VALUE)return t.pointCount=1,C=v[f],a=i.R,t.normal.x=a.col1.x*C.x+a.col2.x*C.y,t.normal.y=a.col1.y*C.x+a.col2.y*C.y,(L=t.points[0]).id.features.incidentEdge=f,L.id.features.incidentVertex=r8e.b2_nullFeature,L.id.features.referenceEdge=0,L.id.features.flip=0,o=c-g*t.normal.x,s=h-g*t.normal.y,u=o-i.position.x,p=s-i.position.y,a=i.R,L.localPoint1.x=u*a.col1.x+p*a.col1.y,L.localPoint1.y=u*a.col2.x+p*a.col2.y,u=o-r.position.x,p=s-r.position.y,a=r.R,L.localPoint2.x=u*a.col1.x+p*a.col1.y,L.localPoint2.y=u*a.col2.x+p*a.col2.y,void(L.separation=m-g);var S=f,w=S+1<y?S+1:0,C=b[S],P=b[w],E=P.x-C.x,T=P.y-C.y,M=Math.sqrt(E*E+T*T);E/=M,T/=M;var D,I,O=(u=d-C.x)*E+(p=_-C.y)*T,L=t.points[0];O<=0?(D=C.x,I=C.y,L.id.features.incidentEdge=r8e.b2_nullFeature,L.id.features.incidentVertex=S):M<=O?(D=P.x,I=P.y,L.id.features.incidentEdge=r8e.b2_nullFeature,L.id.features.incidentVertex=w):(D=E*O+C.x,I=T*O+C.y,L.id.features.incidentEdge=f,L.id.features.incidentVertex=0),u=d-D,p=_-I,u/=l=Math.sqrt(u*u+p*p),p/=l,g<l||(t.pointCount=1,a=i.R,t.normal.x=a.col1.x*u+a.col2.x*p,t.normal.y=a.col1.y*u+a.col2.y*p,o=c-g*t.normal.x,s=h-g*t.normal.y,u=o-i.position.x,p=s-i.position.y,a=i.R,L.localPoint1.x=u*a.col1.x+p*a.col1.y,L.localPoint1.y=u*a.col2.x+p*a.col2.y,u=o-r.position.x,p=s-r.position.y,a=r.R,L.localPoint2.x=u*a.col1.x+p*a.col1.y,L.localPoint2.y=u*a.col2.x+p*a.col2.y,L.separation=l-g,L.id.features.referenceEdge=0,L.id.features.flip=0)},r8e.b2TestOverlap=function(t,e){var i=e.lowerBound,n=t.upperBound,r=i.x-n.x,o=i.y-n.y,i=t.lowerBound,n=e.upperBound,s=i.x-n.x,a=i.y-n.y;return!(0<r||0<o||0<s||0<a)},r8e.b2_nullFeature=255,r8e.b2CollidePolyTempVec=new b2Vec2,r8e),b2ContactPoint=function(){this.__fast__=!0,this.position=new b2Vec2,this.velocity=new b2Vec2,this.normal=new b2Vec2,this.id=new b2ContactID},b2Point=(Pbf.prototype.Support=function(t,e,i){return this.p},Pbf.prototype.GetFirstVertex=function(t){return this.p},Pbf),b2Distance=(Ubf.ProcessTwo=function(t,e,i,n,r){var o=r[0],s=r[1],a=i[0],l=i[1],c=n[0],h=n[1],u=-s.x,p=-s.y,d=o.x-s.x,_=o.y-s.y,f=Math.sqrt(d*d+_*_),m=u*(d/=f)+p*(_/=f);return m<=0||f<Number.MIN_VALUE?(t.SetV(l),e.SetV(h),a.SetV(l),c.SetV(h),o.SetV(s),1):(m/=f,t.x=l.x+m*(a.x-l.x),t.y=l.y+m*(a.y-l.y),e.x=h.x+m*(c.x-h.x),e.y=h.y+m*(c.y-h.y),2)},Ubf.ProcessThree=function(t,e,i,n,r){var o=r[0],s=r[1],a=r[2],l=i[0],c=i[1],h=i[2],u=n[0],p=n[1],d=n[2],_=o.x,f=o.y,m=s.x,g=s.y,y=a.x,b=a.y,v=m-_,x=g-f,A=y-_,S=b-f,w=y-m,C=b-g,P=-(_*A+f*S),E=y*A+b*S,T=-(m*w+g*C),M=y*w+b*C;if(E<=0&&M<=0)return t.SetV(h),e.SetV(d),l.SetV(h),u.SetV(d),o.SetV(a),1;var D,I=v*S-x*A,O=I*(_*g-f*m),L=I*(m*b-g*y);if(L<=0&&0<=T&&0<=M&&0<T+M)return D=T/(T+M),t.x=c.x+D*(h.x-c.x),t.y=c.y+D*(h.y-c.y),e.x=p.x+D*(d.x-p.x),e.y=p.y+D*(d.y-p.y),l.SetV(h),u.SetV(d),o.SetV(a),2;var F=I*(y*f-b*_);if(F<=0&&0<=P&&0<=E&&0<P+E)return D=P/(P+E),t.x=l.x+D*(h.x-l.x),t.y=l.y+D*(h.y-l.y),e.x=u.x+D*(d.x-u.x),e.y=u.y+D*(d.y-u.y),c.SetV(h),p.SetV(d),s.SetV(a),2;var B=L+F+O,N=L*(B=1/B),R=F*B,V=1-N-R;return t.x=N*l.x+R*c.x+V*h.x,t.y=N*l.y+R*c.y+V*h.y,e.x=N*u.x+R*p.x+V*d.x,e.y=N*u.y+R*p.y+V*d.y,3},Ubf.InPoints=function(t,e,i){for(var n=100*Number.MIN_VALUE,r=0;r<i;++r){var o=e[r],s=Math.abs(t.x-o.x),a=Math.abs(t.y-o.y),l=Math.max(Math.abs(t.x),Math.abs(o.x)),c=Math.max(Math.abs(t.y),Math.abs(o.y));if(s<n*(l+1)&&a<n*(c+1))return!0}return!1},Ubf.DistanceGeneric=function(t,e,i,n,r,o){var s,a=this.s_p1s,l=this.s_p2s,c=this.s_points,h=0;t.SetV(i.GetFirstVertex(n)),e.SetV(r.GetFirstVertex(o));for(var u=0,p=0;p<20;++p){var d=e.x-t.x,_=e.y-t.y,f=i.Support(n,d,_),m=r.Support(o,-d,-_),u=d*d+_*_,g=m.x-f.x,y=m.y-f.y;if(u-(d*g+_*y)<=.01*u)return 0==h&&(t.SetV(f),e.SetV(m)),this.g_GJK_Iterations=p,Math.sqrt(u);switch(h){case 0:(s=a[0]).SetV(f),(s=l[0]).SetV(m),(s=c[0]).x=g,s.y=y,t.SetV(a[0]),e.SetV(l[0]),++h;break;case 1:(s=a[1]).SetV(f),(s=l[1]).SetV(m),(s=c[1]).x=g,s.y=y,h=this.ProcessTwo(t,e,a,l,c);break;case 2:(s=a[2]).SetV(f),(s=l[2]).SetV(m),(s=c[2]).x=g,s.y=y,h=this.ProcessThree(t,e,a,l,c)}if(3==h)return this.g_GJK_Iterations=p,0;for(var b=-Number.MAX_VALUE,v=0;v<h;++v)s=c[v],b=b2Math.b2Max(b,s.x*s.x+s.y*s.y);if(3==h||u<=100*Number.MIN_VALUE*b)return this.g_GJK_Iterations=p,u=(d=e.x-t.x)*d+(_=e.y-t.y)*_,Math.sqrt(u)}return this.g_GJK_Iterations=20,Math.sqrt(u)},Ubf.DistanceCC=function(t,e,i,n,r,o){var s=n.R,a=i.m_localPosition,l=n.position.x+(s.col1.x*a.x+s.col2.x*a.y),c=n.position.y+(s.col1.y*a.x+s.col2.y*a.y);s=o.R,a=r.m_localPosition;var h=o.position.x+(s.col1.x*a.x+s.col2.x*a.y),u=o.position.y+(s.col1.y*a.x+s.col2.y*a.y),p=h-l,d=u-c,_=p*p+d*d,f=i.m_radius-b2Settings.b2_toiSlop,m=r.m_radius-b2Settings.b2_toiSlop,g=f+m;if(g*g<_){var y=Math.sqrt(p*p+d*d);p/=y,d/=y;var b=y-g;return t.x=l+f*p,t.y=c+f*d,e.x=h-m*p,e.y=u-m*d,b}return _>Number.MIN_VALUE*Number.MIN_VALUE?(p/=y=Math.sqrt(p*p+d*d),d/=y,t.x=l+f*p,t.y=c+f*d):(t.x=l,t.y=c),e.x=t.x,e.y=t.y,0},Ubf.DistancePC=function(t,e,i,n,r,o){var s=this.gPoint,a=r.m_localPosition,l=o.R;s.p.x=o.position.x+(l.col1.x*a.x+l.col2.x*a.y),s.p.y=o.position.y+(l.col1.y*a.x+l.col2.y*a.y);var c,h,u,p=this.DistanceGeneric(t,e,i,n,s,b2Math.b2XForm_identity),d=r.m_radius-b2Settings.b2_toiSlop;return d<p?(p-=d,c=e.x-t.x,h=e.y-t.y,c/=u=Math.sqrt(c*c+h*h),h/=u,e.x-=d*c,e.y-=d*h):(p=0,e.x=t.x,e.y=t.y),p},Ubf.Distance=function(t,e,i,n,r,o){var s=i.m_type,a=r.m_type;return s==b2Shape.e_circleShape&&a==b2Shape.e_circleShape?this.DistanceCC(t,e,i,n,r,o):s==b2Shape.e_polygonShape&&a==b2Shape.e_circleShape?this.DistancePC(t,e,i,n,r,o):s==b2Shape.e_circleShape&&a==b2Shape.e_polygonShape?this.DistancePC(e,t,r,o,i,n):s==b2Shape.e_polygonShape&&a==b2Shape.e_polygonShape?this.DistanceGeneric(t,e,i,n,r,o):0},Ubf.s_p1s=[new b2Vec2,new b2Vec2,new b2Vec2],Ubf.s_p2s=[new b2Vec2,new b2Vec2,new b2Vec2],Ubf.s_points=[new b2Vec2,new b2Vec2,new b2Vec2],Ubf.gPoint=new b2Point,Ubf.g_GJK_Iterations=0,Ubf),b2ManifoldPoint=(oef.prototype.Reset=function(){this.localPoint1.SetZero(),this.localPoint2.SetZero(),this.separation=0,this.normalImpulse=0,this.tangentImpulse=0,this.id.key=0},oef.prototype.Set=function(t){this.localPoint1.SetV(t.localPoint1),this.localPoint2.SetV(t.localPoint2),this.separation=t.separation,this.normalImpulse=t.normalImpulse,this.tangentImpulse=t.tangentImpulse,this.id.key=t.id.key},oef),b2Manifold=(qef.prototype.Reset=function(){for(var t=0;t<b2Settings.b2_maxManifoldPoints;t++)this.points[t].Reset();this.normal.SetZero(),this.pointCount=0},qef.prototype.Set=function(t){this.pointCount=t.pointCount;for(var e=0;e<b2Settings.b2_maxManifoldPoints;e++)this.points[e].Set(t.points[e]);this.normal.SetV(t.normal)},qef),b2PairCallback=(vef.prototype.PairAdded=function(t,e){return null},vef.prototype.PairRemoved=function(t,e,i){},vef),b2Segment=(Bef.prototype.TestSegment=function(t,e,i,n){var r=i.p1,o=i.p2.x-r.x,s=i.p2.y-r.y,a=this.p2.x-this.p1.x,l=this.p2.y-this.p1.y,c=-a,h=100*Number.MIN_VALUE,u=-(o*l+s*c);if(h<u){var p=r.x-this.p1.x,d=r.y-this.p1.y,_=p*l+d*c;if(0<=_&&_<=n*u){var f=-s*d+s*p;if(-h*u<=f&&f<=u*(1+h)){_/=u;var m=Math.sqrt(l*l+c*c);return l/=m,c/=m,t[0]=_,e.Set(l,c),!0}}}return!1},Bef),b2TimeOfImpact=(Tef.TimeOfImpact=function(t,e,i,n){for(var r,o,s=t.m_sweepRadius,a=i.m_sweepRadius,l=e.t0,c=e.c.x-e.c0.x,h=e.c.y-e.c0.y,u=n.c.x-n.c0.x,p=n.c.y-n.c0.y,d=e.a-e.a0,_=n.a-n.a0,f=0,m=this.s_p1,g=this.s_p2,y=0,b=0,v=0,x=0,A=0;;){var S=(1-f)*l+f,w=this.s_xf1,C=this.s_xf2;if(e.GetXForm(w,S),n.GetXForm(C,S),x=b2Distance.Distance(m,g,t,w,i,C),0==y&&(A=x>2*b2Settings.b2_toiSlop?1.5*b2Settings.b2_toiSlop:(r=.05*b2Settings.b2_toiSlop)>(o=x-.5*b2Settings.b2_toiSlop)?r:o),x-A<.05*b2Settings.b2_toiSlop||20==y)break;b=g.x-m.x,v=g.y-m.y;var P=Math.sqrt(b*b+v*v),E=(b/=P)*(c-u)+(v/=P)*(h-p)+(d<0?-d:d)*s+(_<0?-_:_)*a;if(0==E){f=1;break}var T=f+(x-A)/E;if(T<0||1<T){f=1;break}if(T<(1+100*Number.MIN_VALUE)*f)break;f=T,++y}return f},Tef.s_p1=new b2Vec2,Tef.s_p2=new b2Vec2,Tef.s_xf1=new b2XForm,Tef.s_xf2=new b2XForm,Tef),b2Color=(vff.prototype.Set=function(t,e,i){this._r=255*b2Math.b2Clamp(t,0,1)>>>0,this._g=255*b2Math.b2Clamp(e,0,1)>>>0,this._b=255*b2Math.b2Clamp(i,0,1)>>>0},Object.defineProperty(vff.prototype,"r",{set:function(t){this._r=255*b2Math.b2Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(vff.prototype,"g",{set:function(t){this._g=255*b2Math.b2Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(vff.prototype,"b",{set:function(t){this._b=255*b2Math.b2Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(vff.prototype,"color",{get:function(){return this._r|this._g<<8|this._b<<16},enumerable:!0,configurable:!0}),vff),b2ContactEdge=function(){},b2Contact=(Fff.prototype.GetManifolds=function(){return null},Fff.prototype.GetManifoldCount=function(){return this.m_manifoldCount},Fff.prototype.IsSolid=function(){return 0==(this.m_flags&Fff.e_nonSolidFlag)},Fff.prototype.GetNext=function(){return this.m_next},Fff.prototype.GetShape1=function(){return this.m_shape1},Fff.prototype.GetShape2=function(){return this.m_shape2},Fff.AddType=function(t,e,i,n){Fff.s_registers[i][n].createFcn=t,Fff.s_registers[i][n].destroyFcn=e,Fff.s_registers[i][n].primary=!0,i!=n&&(Fff.s_registers[n][i].createFcn=t,Fff.s_registers[n][i].destroyFcn=e,Fff.s_registers[n][i].primary=!1)},Fff.prototype.Update=function(t){var e=this.m_manifoldCount;this.Evaluate(t);var i=this.m_manifoldCount,n=this.m_shape1.m_body,r=this.m_shape2.m_body;0==i&&0<e&&(n.WakeUp(),r.WakeUp()),n.IsStatic()||n.IsBullet()||r.IsStatic()||r.IsBullet()?this.m_flags&=~Fff.e_slowFlag:this.m_flags|=Fff.e_slowFlag},Fff.prototype.Evaluate=function(t){},Fff.e_nonSolidFlag=1,Fff.e_slowFlag=2,Fff.e_islandFlag=4,Fff.e_toiFlag=8,Fff.s_initialized=!1,Fff),b2CircleContact=(Sff=b2Contact,__extends(Tff,Sff),Tff.Create=function(t,e,i){return new Tff(t,e)},Tff.Destroy=function(t,e){},Tff.prototype.Evaluate=function(t){var e,i,n,r=this.m_shape1.m_body,o=this.m_shape2.m_body;this.m0.Set(this.m_manifold),b2Collision.b2CollideCircles(this.m_manifold,this.m_shape1,r.m_xf,this.m_shape2,o.m_xf);var s,a=Tff.s_evalCP;a.shape1=this.m_shape1,a.shape2=this.m_shape2,a.friction=this.m_friction,a.restitution=this.m_restitution,0<this.m_manifold.pointCount?(this.m_manifoldCount=1,s=this.m_manifold.points[0],0==this.m0.pointCount?(s.normalImpulse=0,s.tangentImpulse=0,t&&(a.position=r.GetWorldPoint(s.localPoint1),e=r.GetLinearVelocityFromLocalPoint(s.localPoint1),i=o.GetLinearVelocityFromLocalPoint(s.localPoint2),a.velocity.Set(i.x-e.x,i.y-e.y),a.normal.SetV(this.m_manifold.normal),a.separation=s.separation,a.id.key=s.id._key,t.Add(a))):(n=this.m0.points[0],s.normalImpulse=n.normalImpulse,s.tangentImpulse=n.tangentImpulse,t&&(a.position=r.GetWorldPoint(s.localPoint1),e=r.GetLinearVelocityFromLocalPoint(s.localPoint1),i=o.GetLinearVelocityFromLocalPoint(s.localPoint2),a.velocity.Set(i.x-e.x,i.y-e.y),a.normal.SetV(this.m_manifold.normal),a.separation=s.separation,a.id.key=s.id._key,t.Persist(a)))):(this.m_manifoldCount=0)<this.m0.pointCount&&t&&(n=this.m0.points[0],a.position=r.GetWorldPoint(n.localPoint1),e=r.GetLinearVelocityFromLocalPoint(n.localPoint1),i=o.GetLinearVelocityFromLocalPoint(n.localPoint2),a.velocity.Set(i.x-e.x,i.y-e.y),a.normal.SetV(this.m0.normal),a.separation=n.separation,a.id.key=n.id._key,t.Remove(a))},Tff.prototype.GetManifolds=function(){return this.m_manifolds},Tff.s_evalCP=new b2ContactPoint,Tff),b2ContactConstraintPoint=function(){this.localAnchor1=new b2Vec2,this.localAnchor2=new b2Vec2,this.r1=new b2Vec2,this.r2=new b2Vec2},b2ContactConstraint=function(){this.normal=new b2Vec2,this.points=new Array(b2Settings.b2_maxManifoldPoints);for(var t=0;t<b2Settings.b2_maxManifoldPoints;t++)this.points[t]=new b2ContactConstraintPoint},b2ContactRegister=function(){},b2ContactResult=function(){this.position=new b2Vec2,this.normal=new b2Vec2,this.id=new b2ContactID},b2TimeStep=function(){},b2ContactSolver=(kgf.prototype.InitVelocityConstraints=function(t){for(var e=0;e<this.m_constraintCount;++e){var i,n,r=this.m_constraints[e],o=r.body1,s=r.body2,a=o.m_invMass,l=o.m_invI,c=s.m_invMass,h=s.m_invI,u=r.normal.x,p=r.normal.y,d=p,_=-u;if(t.warmStarting)for(n=r.pointCount,i=0;i<n;++i){var f=r.points[i];f.normalImpulse*=t.dtRatio,f.tangentImpulse*=t.dtRatio;var m=f.normalImpulse*u+f.tangentImpulse*d,g=f.normalImpulse*p+f.tangentImpulse*_;o.m_angularVelocity-=l*(f.r1.x*g-f.r1.y*m),o.m_linearVelocity.x-=a*m,o.m_linearVelocity.y-=a*g,s.m_angularVelocity+=h*(f.r2.x*g-f.r2.y*m),s.m_linearVelocity.x+=c*m,s.m_linearVelocity.y+=c*g}else for(n=r.pointCount,i=0;i<n;++i){var y=r.points[i];y.normalImpulse=0,y.tangentImpulse=0}}},kgf.prototype.SolveVelocityConstraints=function(){for(var t,e,i,n,r,o,s,a,l,c=0;c<this.m_constraintCount;++c){for(var h=this.m_constraints[c],u=h.body1,p=h.body2,d=u.m_angularVelocity,_=p.m_angularVelocity,f=u.m_linearVelocity,m=p.m_linearVelocity,g=u.m_invMass,y=u.m_invI,b=p.m_invMass,v=p.m_invI,x=h.normal.x,A=h.normal.y,S=A,w=-x,C=h.friction,P=h.pointCount,E=0;E<P;++E){t=h.points[E],n=(e=m.x+-_*t.r2.y-f.x- -d*t.r1.y)*x+(i=m.y+_*t.r2.x-f.y-d*t.r1.x)*A,o=-t.normalMass*(n-t.velocityBias),r=e*S+i*w,s=t.tangentMass*-r,o=(a=b2Math.b2Max(t.normalImpulse+o,0))-t.normalImpulse;var T=C*t.normalImpulse,M=o*x+(s=(l=b2Math.b2Clamp(t.tangentImpulse+s,-T,T))-t.tangentImpulse)*S,D=o*A+s*w;f.x-=g*M,f.y-=g*D,d-=y*(t.r1.x*D-t.r1.y*M),m.x+=b*M,m.y+=b*D,_+=v*(t.r2.x*D-t.r2.y*M),t.normalImpulse=a,t.tangentImpulse=l}u.m_angularVelocity=d,p.m_angularVelocity=_}},kgf.prototype.FinalizeVelocityConstraints=function(){for(var t=0;t<this.m_constraintCount;++t)for(var e=this.m_constraints[t],i=e.manifold,n=0;n<e.pointCount;++n){var r=i.points[n],o=e.points[n];r.normalImpulse=o.normalImpulse,r.tangentImpulse=o.tangentImpulse}},kgf.prototype.SolvePositionConstraints=function(t){for(var e=0,i=0;i<this.m_constraintCount;++i)for(var n=this.m_constraints[i],r=n.body1,o=n.body2,s=r.m_sweep.c,a=r.m_sweep.a,l=o.m_sweep.c,c=o.m_sweep.a,h=r.m_mass*r.m_invMass,u=r.m_mass*r.m_invI,p=o.m_mass*o.m_invMass,d=o.m_mass*o.m_invI,_=n.normal.x,f=n.normal.y,m=n.pointCount,g=0;g<m;++g){var y=n.points[g],b=r.m_xf.R,v=r.m_sweep.localCenter,x=y.localAnchor1.x-v.x,A=y.localAnchor1.y-v.y,S=b.col1.x*x+b.col2.x*A,A=b.col1.y*x+b.col2.y*A,x=S;b=o.m_xf.R,v=o.m_sweep.localCenter;var w=y.localAnchor2.x-v.x,C=y.localAnchor2.y-v.y,S=b.col1.x*w+b.col2.x*C,C=b.col1.y*w+b.col2.y*C,w=S,P=s.x+x,E=s.y+A,T=(l.x+w-P)*_+(l.y+C-E)*f+y.separation,e=b2Math.b2Min(e,T),M=t*b2Math.b2Clamp(T+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0),D=-y.equalizedMass*M,I=y.positionImpulse;y.positionImpulse=b2Math.b2Max(I+D,0);var O=(D=y.positionImpulse-I)*_,L=D*f;s.x-=h*O,s.y-=h*L,a-=u*(x*L-A*O),r.m_sweep.a=a,r.SynchronizeTransform(),l.x+=p*O,l.y+=p*L,c+=d*(w*L-C*O),o.m_sweep.a=c,o.SynchronizeTransform()}return e>=-1.5*b2Settings.b2_linearSlop},kgf),b2NullContact=(Mif=b2Contact,__extends(Nif,Mif),Nif.prototype.b2NullContact=function(){},Nif.prototype.Evaluate=function(t){},Nif.prototype.GetManifolds=function(){return null},Nif),b2PolyAndCircleContact=(Pif=b2Contact,__extends(Qif,Pif),Qif.Create=function(t,e,i){return new Qif(t,e)},Qif.Destroy=function(t,e){},Qif.prototype.Evaluate=function(t){var e,i,n,r,o=this.m_shape1.m_body,s=this.m_shape2.m_body;this.m0.Set(this.m_manifold),b2Collision.b2CollidePolygonAndCircle(this.m_manifold,this.m_shape1,o.m_xf,this.m_shape2,s.m_xf);var a=[!1,!1],l=Qif.s_evalCP;if(l.shape1=this.m_shape1,l.shape2=this.m_shape2,l.friction=this.m_friction,l.restitution=this.m_restitution,0<this.m_manifold.pointCount){for(e=0;e<this.m_manifold.pointCount;++e){var c=this.m_manifold.points[e];c.normalImpulse=0,c.tangentImpulse=0;for(var h=!1,u=c.id._key,p=0;p<this.m0.pointCount;++p)if(1!=a[p]&&(r=this.m0.points[p]).id._key==u){a[p]=!0,c.normalImpulse=r.normalImpulse,c.tangentImpulse=r.tangentImpulse,h=!0,null!=t&&(l.position=o.GetWorldPoint(c.localPoint1),i=o.GetLinearVelocityFromLocalPoint(c.localPoint1),n=s.GetLinearVelocityFromLocalPoint(c.localPoint2),l.velocity.Set(n.x-i.x,n.y-i.y),l.normal.SetV(this.m_manifold.normal),l.separation=c.separation,l.id.key=u,t.Persist(l));break}0==h&&null!=t&&(l.position=o.GetWorldPoint(c.localPoint1),i=o.GetLinearVelocityFromLocalPoint(c.localPoint1),n=s.GetLinearVelocityFromLocalPoint(c.localPoint2),l.velocity.Set(n.x-i.x,n.y-i.y),l.normal.SetV(this.m_manifold.normal),l.separation=c.separation,l.id.key=u,t.Add(l))}this.m_manifoldCount=1}else this.m_manifoldCount=0;if(null!=t)for(e=0;e<this.m0.pointCount;++e)a[e]||(r=this.m0.points[e],l.position=o.GetWorldPoint(r.localPoint1),i=o.GetLinearVelocityFromLocalPoint(r.localPoint1),n=s.GetLinearVelocityFromLocalPoint(r.localPoint2),l.velocity.Set(n.x-i.x,n.y-i.y),l.normal.SetV(this.m0.normal),l.separation=r.separation,l.id.key=r.id._key,t.Remove(l))},Qif.prototype.GetManifolds=function(){return this.m_manifolds},Qif.s_evalCP=new b2ContactPoint,Qif),b2PolygonContact=(ljf=b2Contact,__extends(mjf,ljf),mjf.Create=function(t,e,i){return new mjf(t,e)},mjf.Destroy=function(t,e){},mjf.prototype.Evaluate=function(t){var e,i,n,r,o,s=this.m_shape1.m_body,a=this.m_shape2.m_body;this.m0.Set(this.m_manifold),b2Collision.b2CollidePolygons(this.m_manifold,this.m_shape1,s.m_xf,this.m_shape2,a.m_xf);var l=[!1,!1];if((r=mjf.s_evalCP).shape1=this.m_shape1,r.shape2=this.m_shape2,r.friction=this.m_friction,r.restitution=this.m_restitution,0<this.m_manifold.pointCount){for(o=0;o<this.m_manifold.pointCount;++o){var c=this.m_manifold.points[o];c.normalImpulse=0,c.tangentImpulse=0;for(var h=!1,u=c.id._key,p=0;p<this.m0.pointCount;++p)if(1!=l[p]&&(n=this.m0.points[p]).id._key==u){l[p]=!0,c.normalImpulse=n.normalImpulse,c.tangentImpulse=n.tangentImpulse,h=!0,null!=t&&(r.position=s.GetWorldPoint(c.localPoint1),e=s.GetLinearVelocityFromLocalPoint(c.localPoint1),i=a.GetLinearVelocityFromLocalPoint(c.localPoint2),r.velocity.Set(i.x-e.x,i.y-e.y),r.normal.SetV(this.m_manifold.normal),r.separation=c.separation,r.id.key=u,t.Persist(r));break}0==h&&null!=t&&(r.position=s.GetWorldPoint(c.localPoint1),e=s.GetLinearVelocityFromLocalPoint(c.localPoint1),i=a.GetLinearVelocityFromLocalPoint(c.localPoint2),r.velocity.Set(i.x-e.x,i.y-e.y),r.normal.SetV(this.m_manifold.normal),r.separation=c.separation,r.id.key=u,t.Add(r))}this.m_manifoldCount=1}else this.m_manifoldCount=0;if(null!=t)for(o=0;o<this.m0.pointCount;++o)l[o]||(n=this.m0.points[o],r.position=s.GetWorldPoint(n.localPoint1),e=s.GetLinearVelocityFromLocalPoint(n.localPoint1),i=a.GetLinearVelocityFromLocalPoint(n.localPoint2),r.velocity.Set(i.x-e.x,i.y-e.y),r.normal.SetV(this.m0.normal),r.separation=n.separation,r.id.key=n.id._key,t.Remove(r))},mjf.prototype.GetManifolds=function(){return this.m_manifolds},mjf.s_evalCP=new b2ContactPoint,mjf),b2Joint=(Ijf.prototype.GetType=function(){return this.m_type},Ijf.prototype.GetAnchor1=function(){return null},Ijf.prototype.GetAnchor2=function(){return null},Ijf.prototype.GetReactionForce=function(){return null},Ijf.prototype.GetReactionTorque=function(){return 0},Ijf.prototype.GetBody1=function(){return this.m_body1},Ijf.prototype.GetBody2=function(){return this.m_body2},Ijf.prototype.GetNext=function(){return this.m_next},Ijf.prototype.GetUserData=function(){return this.m_userData},Ijf.prototype.SetUserData=function(t){this.m_userData=t},Ijf.Create=function(t,e){var i=null;switch(t.type){case Ijf.e_distanceJoint:i=new b2DistanceJoint(t);break;case Ijf.e_mouseJoint:i=new b2MouseJoint(t);break;case Ijf.e_prismaticJoint:i=new b2PrismaticJoint(t);break;case Ijf.e_revoluteJoint:i=new b2RevoluteJoint(t);break;case Ijf.e_pulleyJoint:i=new b2PulleyJoint(t);break;case Ijf.e_gearJoint:i=new b2GearJoint(t)}return i},Ijf.Destroy=function(t,e){},Ijf.prototype.InitVelocityConstraints=function(t){},Ijf.prototype.SolveVelocityConstraints=function(t){},Ijf.prototype.InitPositionConstraints=function(){},Ijf.prototype.SolvePositionConstraints=function(){return!1},Ijf.e_unknownJoint=0,Ijf.e_revoluteJoint=1,Ijf.e_prismaticJoint=2,Ijf.e_distanceJoint=3,Ijf.e_pulleyJoint=4,Ijf.e_mouseJoint=5,Ijf.e_gearJoint=6,Ijf.e_inactiveLimit=0,Ijf.e_atLowerLimit=1,Ijf.e_atUpperLimit=2,Ijf.e_equalLimits=3,Ijf),b2JointDef=function(){this.type=b2Joint.e_unknownJoint,this.userData=null,this.body1=null,this.body2=null,this.collideConnected=!1},b2DistanceJointDef=(Sjf=b2JointDef,__extends(Tjf,Sjf),Tjf.prototype.Initialize=function(t,e,i,n){this.body1=t,this.body2=e,this.localAnchor1.SetV(this.body1.GetLocalPoint(i)),this.localAnchor2.SetV(this.body2.GetLocalPoint(n));var r=n.x-i.x,o=n.y-i.y;this.length=Math.sqrt(r*r+o*o),this.frequencyHz=0,this.dampingRatio=0},Tjf),b2Jacobian=(_jf.prototype.SetZero=function(){this.linear1.SetZero(),this.angular1=0,this.linear2.SetZero(),this.angular2=0},_jf.prototype.Set=function(t,e,i,n){this.linear1.SetV(t),this.angular1=e,this.linear2.SetV(i),this.angular2=n},_jf.prototype.Compute=function(t,e,i,n){return this.linear1.x*t.x+this.linear1.y*t.y+this.angular1*e+(this.linear2.x*i.x+this.linear2.y*i.y)+this.angular2*n},_jf),b2GearJoint=(ikf=b2Joint,__extends(jkf,ikf),jkf.prototype.GetAnchor1=function(){return this.m_body1.GetWorldPoint(this.m_localAnchor1)},jkf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor2)},jkf.prototype.GetReactionForce=function(){return new b2Vec2(this.m_force*this.m_J.linear2.x,this.m_force*this.m_J.linear2.y)},jkf.prototype.GetReactionTorque=function(){var t=this.m_body2.m_xf.R,e=this.m_localAnchor1.x-this.m_body2.m_sweep.localCenter.x,i=this.m_localAnchor1.y-this.m_body2.m_sweep.localCenter.y,n=t.col1.x*e+t.col2.x*i,i=t.col1.y*e+t.col2.y*i,e=n;return this.m_force*this.m_J.angular2-(e*(this.m_force*this.m_J.linear2.y)-i*(this.m_force*this.m_J.linear2.x))},jkf.prototype.GetRatio=function(){return this.m_ratio},jkf.prototype.InitVelocityConstraints=function(t){var e,i,n,r,o,s,a,l,c,h=this.m_ground1,u=this.m_ground2,p=this.m_body1,d=this.m_body2,_=0;this.m_J.SetZero(),this.m_revolute1?(this.m_J.angular1=-1,_+=p.m_invI):(o=h.m_xf.R,s=this.m_prismatic1.m_localXAxis1,e=o.col1.x*s.x+o.col2.x*s.y,i=o.col1.y*s.x+o.col2.y*s.y,o=p.m_xf.R,n=this.m_localAnchor1.x-p.m_sweep.localCenter.x,r=this.m_localAnchor1.y-p.m_sweep.localCenter.y,l=o.col1.x*n+o.col2.x*r,r=o.col1.y*n+o.col2.y*r,a=(n=l)*i-r*e,this.m_J.linear1.Set(-e,-i),this.m_J.angular1=-a,_+=p.m_invMass+p.m_invI*a*a),this.m_revolute2?(this.m_J.angular2=-this.m_ratio,_+=this.m_ratio*this.m_ratio*d.m_invI):(o=u.m_xf.R,s=this.m_prismatic2.m_localXAxis1,e=o.col1.x*s.x+o.col2.x*s.y,i=o.col1.y*s.x+o.col2.y*s.y,o=d.m_xf.R,n=this.m_localAnchor2.x-d.m_sweep.localCenter.x,r=this.m_localAnchor2.y-d.m_sweep.localCenter.y,l=o.col1.x*n+o.col2.x*r,r=o.col1.y*n+o.col2.y*r,a=(n=l)*i-r*e,this.m_J.linear2.Set(-this.m_ratio*e,-this.m_ratio*i),this.m_J.angular2=-this.m_ratio*a,_+=this.m_ratio*this.m_ratio*(d.m_invMass+d.m_invI*a*a)),this.m_mass=1/_,t.warmStarting?(c=t.dt*this.m_force,p.m_linearVelocity.x+=p.m_invMass*c*this.m_J.linear1.x,p.m_linearVelocity.y+=p.m_invMass*c*this.m_J.linear1.y,p.m_angularVelocity+=p.m_invI*c*this.m_J.angular1,d.m_linearVelocity.x+=d.m_invMass*c*this.m_J.linear2.x,d.m_linearVelocity.y+=d.m_invMass*c*this.m_J.linear2.y,d.m_angularVelocity+=d.m_invI*c*this.m_J.angular2):this.m_force=0},jkf.prototype.SolveVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=this.m_J.Compute(e.m_linearVelocity,e.m_angularVelocity,i.m_linearVelocity,i.m_angularVelocity),r=-t.inv_dt*this.m_mass*n;this.m_force+=r;var o=t.dt*r;e.m_linearVelocity.x+=e.m_invMass*o*this.m_J.linear1.x,e.m_linearVelocity.y+=e.m_invMass*o*this.m_J.linear1.y,e.m_angularVelocity+=e.m_invI*o*this.m_J.angular1,i.m_linearVelocity.x+=i.m_invMass*o*this.m_J.linear2.x,i.m_linearVelocity.y+=i.m_invMass*o*this.m_J.linear2.y,i.m_angularVelocity+=i.m_invI*o*this.m_J.angular2},jkf.prototype.SolvePositionConstraints=function(){var t=this.m_body1,e=this.m_body2,i=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation(),n=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation(),r=this.m_constant-(i+this.m_ratio*n),o=-this.m_mass*r;return t.m_sweep.c.x+=t.m_invMass*o*this.m_J.linear1.x,t.m_sweep.c.y+=t.m_invMass*o*this.m_J.linear1.y,t.m_sweep.a+=t.m_invI*o*this.m_J.angular1,e.m_sweep.c.x+=e.m_invMass*o*this.m_J.linear2.x,e.m_sweep.c.y+=e.m_invMass*o*this.m_J.linear2.y,e.m_sweep.a+=e.m_invI*o*this.m_J.angular2,t.SynchronizeTransform(),e.SynchronizeTransform(),0<b2Settings.b2_linearSlop},jkf),b2GearJointDef=(Vkf=b2JointDef,__extends(Wkf,Vkf),Wkf),b2JointEdge=function(){},b2MouseJoint=(Ykf=b2Joint,__extends(Zkf,Ykf),Zkf.prototype.GetAnchor1=function(){return this.m_target},Zkf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor)},Zkf.prototype.GetReactionForce=function(){return this.m_impulse},Zkf.prototype.GetReactionTorque=function(){return 0},Zkf.prototype.SetTarget=function(t){this.m_body2.IsSleeping()&&this.m_body2.WakeUp(),this.m_target=t},Zkf.prototype.InitVelocityConstraints=function(t){var e=this.m_body2,i=e.m_xf.R,n=this.m_localAnchor.x-e.m_sweep.localCenter.x,r=this.m_localAnchor.y-e.m_sweep.localCenter.y,o=i.col1.x*n+i.col2.x*r,r=i.col1.y*n+i.col2.y*r,n=o,s=e.m_invMass,a=e.m_invI;this.K1.col1.x=s,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=s,this.K2.col1.x=a*r*r,this.K2.col2.x=-a*n*r,this.K2.col1.y=-a*n*r,this.K2.col2.y=a*n*n,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.col1.x+=this.m_gamma,this.K.col2.y+=this.m_gamma,this.K.Invert(this.m_mass),this.m_C.x=e.m_sweep.c.x+n-this.m_target.x,this.m_C.y=e.m_sweep.c.y+r-this.m_target.y,e.m_angularVelocity*=.98;var l=t.dt*this.m_impulse.x,c=t.dt*this.m_impulse.y;e.m_linearVelocity.x+=s*l,e.m_linearVelocity.y+=s*c,e.m_angularVelocity+=a*(n*c-r*l)},Zkf.prototype.SolveVelocityConstraints=function(t){var e,i=this.m_body2,n=i.m_xf.R,r=this.m_localAnchor.x-i.m_sweep.localCenter.x,o=this.m_localAnchor.y-i.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s,a=i.m_linearVelocity.x+-i.m_angularVelocity*o,l=i.m_linearVelocity.y+i.m_angularVelocity*r;n=this.m_mass,s=a+this.m_beta*t.inv_dt*this.m_C.x+this.m_gamma*t.dt*this.m_impulse.x,e=l+this.m_beta*t.inv_dt*this.m_C.y+this.m_gamma*t.dt*this.m_impulse.y;var c=-t.inv_dt*(n.col1.x*s+n.col2.x*e),h=-t.inv_dt*(n.col1.y*s+n.col2.y*e),u=this.m_impulse.x,p=this.m_impulse.y;this.m_impulse.x+=c,this.m_impulse.y+=h;var d=this.m_impulse.Length();d>this.m_maxForce&&this.m_impulse.Multiply(this.m_maxForce/d),c=this.m_impulse.x-u,h=this.m_impulse.y-p;var _=t.dt*c,f=t.dt*h;i.m_linearVelocity.x+=i.m_invMass*_,i.m_linearVelocity.y+=i.m_invMass*f,i.m_angularVelocity+=i.m_invI*(r*f-o*_)},Zkf.prototype.SolvePositionConstraints=function(){return!0},Zkf),b2MouseJointDef=(Ilf=b2JointDef,__extends(Jlf,Ilf),Jlf),b2PrismaticJoint=(Llf=b2Joint,__extends(Mlf,Llf),Mlf.prototype.GetAnchor1=function(){return this.m_body1.GetWorldPoint(this.m_localAnchor1)},Mlf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor2)},Mlf.prototype.GetReactionForce=function(){var t=this.m_body1.m_xf.R,e=this.m_limitForce*(t.col1.x*this.m_localXAxis1.x+t.col2.x*this.m_localXAxis1.y),i=this.m_limitForce*(t.col1.y*this.m_localXAxis1.x+t.col2.y*this.m_localXAxis1.y),n=this.m_force*(t.col1.x*this.m_localYAxis1.x+t.col2.x*this.m_localYAxis1.y),r=this.m_force*(t.col1.y*this.m_localYAxis1.x+t.col2.y*this.m_localYAxis1.y);return new b2Vec2(this.m_limitForce*e+this.m_force*n,this.m_limitForce*i+this.m_force*r)},Mlf.prototype.GetReactionTorque=function(){return this.m_torque},Mlf.prototype.GetJointTranslation=function(){var t=this.m_body1,e=this.m_body2,i=t.GetWorldPoint(this.m_localAnchor1),n=e.GetWorldPoint(this.m_localAnchor2),r=n.x-i.x,o=n.y-i.y,s=t.GetWorldVector(this.m_localXAxis1);return s.x*r+s.y*o},Mlf.prototype.GetJointSpeed=function(){var t=this.m_body1,e=this.m_body2,i=t.m_xf.R,n=this.m_localAnchor1.x-t.m_sweep.localCenter.x,r=this.m_localAnchor1.y-t.m_sweep.localCenter.y,o=i.col1.x*n+i.col2.x*r,r=i.col1.y*n+i.col2.y*r,n=o;i=e.m_xf.R;var s=this.m_localAnchor2.x-e.m_sweep.localCenter.x,a=this.m_localAnchor2.y-e.m_sweep.localCenter.y,o=i.col1.x*s+i.col2.x*a,a=i.col1.y*s+i.col2.y*a,s=o,l=t.m_sweep.c.x+n,c=t.m_sweep.c.y+r,h=e.m_sweep.c.x+s-l,u=e.m_sweep.c.y+a-c,p=t.GetWorldVector(this.m_localXAxis1),d=t.m_linearVelocity,_=e.m_linearVelocity,f=t.m_angularVelocity,m=e.m_angularVelocity;return h*(-f*p.y)+u*(f*p.x)+(p.x*(_.x+-m*a-d.x- -f*r)+p.y*(_.y+m*s-d.y-f*n))},Mlf.prototype.IsLimitEnabled=function(){return this.m_enableLimit},Mlf.prototype.EnableLimit=function(t){this.m_enableLimit=t},Mlf.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},Mlf.prototype.GetUpperLimit=function(){return this.m_upperTranslation},Mlf.prototype.SetLimits=function(t,e){this.m_lowerTranslation=t,this.m_upperTranslation=e},Mlf.prototype.IsMotorEnabled=function(){return this.m_enableMotor},Mlf.prototype.EnableMotor=function(t){this.m_enableMotor=t},Mlf.prototype.SetMotorSpeed=function(t){this.m_motorSpeed=t},Mlf.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},Mlf.prototype.SetMaxMotorForce=function(t){this.m_maxMotorForce=t},Mlf.prototype.GetMotorForce=function(){return this.m_motorForce},Mlf.prototype.InitVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s;var c,h,u,p,d,_,f,m,g,y=e.m_invMass,b=i.m_invMass,v=e.m_invI,x=i.m_invI,A=(n=e.m_xf.R).col1.x*this.m_localYAxis1.x+n.col2.x*this.m_localYAxis1.y,S=n.col1.y*this.m_localYAxis1.x+n.col2.y*this.m_localYAxis1.y,w=i.m_sweep.c.x+a-e.m_sweep.c.x,C=i.m_sweep.c.y+l-e.m_sweep.c.y;this.m_linearJacobian.linear1.x=-A,this.m_linearJacobian.linear1.y=-S,this.m_linearJacobian.linear2.x=A,this.m_linearJacobian.linear2.y=S,this.m_linearJacobian.angular1=-(w*S-C*A),this.m_linearJacobian.angular2=a*S-l*A,this.m_linearMass=y+v*this.m_linearJacobian.angular1*this.m_linearJacobian.angular1+b+x*this.m_linearJacobian.angular2*this.m_linearJacobian.angular2,this.m_linearMass=1/this.m_linearMass,this.m_angularMass=v+x,this.m_angularMass>Number.MIN_VALUE&&(this.m_angularMass=1/this.m_angularMass),(this.m_enableLimit||this.m_enableMotor)&&(c=(n=e.m_xf.R).col1.x*this.m_localXAxis1.x+n.col2.x*this.m_localXAxis1.y,h=n.col1.y*this.m_localXAxis1.x+n.col2.y*this.m_localXAxis1.y,this.m_motorJacobian.linear1.x=-c,this.m_motorJacobian.linear1.y=-h,this.m_motorJacobian.linear2.x=c,this.m_motorJacobian.linear2.y=h,this.m_motorJacobian.angular1=-(w*h-C*c),this.m_motorJacobian.angular2=a*h-l*c,this.m_motorMass=y+v*this.m_motorJacobian.angular1*this.m_motorJacobian.angular1+b+x*this.m_motorJacobian.angular2*this.m_motorJacobian.angular2,this.m_motorMass=1/this.m_motorMass,this.m_enableLimit&&(u=c*(w-r)+h*(C-o),b2Math.b2Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings.b2_linearSlop?this.m_limitState=Mlf.e_equalLimits:u<=this.m_lowerTranslation?(this.m_limitState!=Mlf.e_atLowerLimit&&(this.m_limitForce=0),this.m_limitState=Mlf.e_atLowerLimit):u>=this.m_upperTranslation?(this.m_limitState!=Mlf.e_atUpperLimit&&(this.m_limitForce=0),this.m_limitState=Mlf.e_atUpperLimit):(this.m_limitState=Mlf.e_inactiveLimit,this.m_limitForce=0))),0==this.m_enableMotor&&(this.m_motorForce=0),0==this.m_enableLimit&&(this.m_limitForce=0),t.warmStarting?(p=t.dt*(this.m_force*this.m_linearJacobian.linear1.x+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.linear1.x),d=t.dt*(this.m_force*this.m_linearJacobian.linear1.y+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.linear1.y),_=t.dt*(this.m_force*this.m_linearJacobian.linear2.x+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.linear2.x),f=t.dt*(this.m_force*this.m_linearJacobian.linear2.y+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.linear2.y),m=t.dt*(this.m_force*this.m_linearJacobian.angular1-this.m_torque+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.angular1),g=t.dt*(this.m_force*this.m_linearJacobian.angular2+this.m_torque+(this.m_motorForce+this.m_limitForce)*this.m_motorJacobian.angular2),e.m_linearVelocity.x+=y*p,e.m_linearVelocity.y+=y*d,e.m_angularVelocity+=v*m,i.m_linearVelocity.x+=b*_,i.m_linearVelocity.y+=b*f,i.m_angularVelocity+=x*g):(this.m_force=0,this.m_torque=0,this.m_limitForce=0,this.m_motorForce=0),this.m_limitPositionImpulse=0},Mlf.prototype.SolveVelocityConstraints=function(t){var e,i=this.m_body1,n=this.m_body2,r=i.m_invMass,o=n.m_invMass,s=i.m_invI,a=n.m_invI,l=this.m_linearJacobian.Compute(i.m_linearVelocity,i.m_angularVelocity,n.m_linearVelocity,n.m_angularVelocity),c=-t.inv_dt*this.m_linearMass*l;this.m_force+=c;var h=t.dt*c;i.m_linearVelocity.x+=r*h*this.m_linearJacobian.linear1.x,i.m_linearVelocity.y+=r*h*this.m_linearJacobian.linear1.y,i.m_angularVelocity+=s*h*this.m_linearJacobian.angular1,n.m_linearVelocity.x+=o*h*this.m_linearJacobian.linear2.x,n.m_linearVelocity.y+=o*h*this.m_linearJacobian.linear2.y,n.m_angularVelocity+=a*h*this.m_linearJacobian.angular2;var u=n.m_angularVelocity-i.m_angularVelocity,p=-t.inv_dt*this.m_angularMass*u;this.m_torque+=p;var d,_,f,m,g,y=t.dt*p;i.m_angularVelocity-=s*y,n.m_angularVelocity+=a*y,this.m_enableMotor&&this.m_limitState!=Mlf.e_equalLimits&&(d=this.m_motorJacobian.Compute(i.m_linearVelocity,i.m_angularVelocity,n.m_linearVelocity,n.m_angularVelocity)-this.m_motorSpeed,_=-t.inv_dt*this.m_motorMass*d,f=this.m_motorForce,this.m_motorForce=b2Math.b2Clamp(this.m_motorForce+_,-this.m_maxMotorForce,this.m_maxMotorForce),_=this.m_motorForce-f,h=t.dt*_,i.m_linearVelocity.x+=r*h*this.m_motorJacobian.linear1.x,i.m_linearVelocity.y+=r*h*this.m_motorJacobian.linear1.y,i.m_angularVelocity+=s*h*this.m_motorJacobian.angular1,n.m_linearVelocity.x+=o*h*this.m_motorJacobian.linear2.x,n.m_linearVelocity.y+=o*h*this.m_motorJacobian.linear2.y,n.m_angularVelocity+=a*h*this.m_motorJacobian.angular2),this.m_enableLimit&&this.m_limitState!=Mlf.e_inactiveLimit&&(m=this.m_motorJacobian.Compute(i.m_linearVelocity,i.m_angularVelocity,n.m_linearVelocity,n.m_angularVelocity),g=-t.inv_dt*this.m_motorMass*m,this.m_limitState==Mlf.e_equalLimits?this.m_limitForce+=g:this.m_limitState==Mlf.e_atLowerLimit?(e=this.m_limitForce,this.m_limitForce=b2Math.b2Max(this.m_limitForce+g,0),g=this.m_limitForce-e):this.m_limitState==Mlf.e_atUpperLimit&&(e=this.m_limitForce,this.m_limitForce=b2Math.b2Min(this.m_limitForce+g,0),g=this.m_limitForce-e),h=t.dt*g,i.m_linearVelocity.x+=r*h*this.m_motorJacobian.linear1.x,i.m_linearVelocity.y+=r*h*this.m_motorJacobian.linear1.y,i.m_angularVelocity+=s*h*this.m_motorJacobian.angular1,n.m_linearVelocity.x+=o*h*this.m_motorJacobian.linear2.x,n.m_linearVelocity.y+=o*h*this.m_motorJacobian.linear2.y,n.m_angularVelocity+=a*h*this.m_motorJacobian.angular2)},Mlf.prototype.SolvePositionConstraints=function(){var t,e,i=this.m_body1,n=this.m_body2,r=i.m_invMass,o=n.m_invMass,s=i.m_invI,a=n.m_invI,l=i.m_xf.R,c=this.m_localAnchor1.x-i.m_sweep.localCenter.x,h=this.m_localAnchor1.y-i.m_sweep.localCenter.y,u=l.col1.x*c+l.col2.x*h,h=l.col1.y*c+l.col2.y*h,c=u;l=n.m_xf.R;var p=this.m_localAnchor2.x-n.m_sweep.localCenter.x,d=this.m_localAnchor2.y-n.m_sweep.localCenter.y;u=l.col1.x*p+l.col2.x*d,d=l.col1.y*p+l.col2.y*d,p=u;var _=i.m_sweep.c.x+c,f=i.m_sweep.c.y+h,m=n.m_sweep.c.x+p-_,g=n.m_sweep.c.y+d-f,y=((l=i.m_xf.R).col1.x*this.m_localYAxis1.x+l.col2.x*this.m_localYAxis1.y)*m+(l.col1.y*this.m_localYAxis1.x+l.col2.y*this.m_localYAxis1.y)*g,y=b2Math.b2Clamp(y,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection),b=-this.m_linearMass*y;i.m_sweep.c.x+=r*b*this.m_linearJacobian.linear1.x,i.m_sweep.c.y+=r*b*this.m_linearJacobian.linear1.y,i.m_sweep.a+=s*b*this.m_linearJacobian.angular1,n.m_sweep.c.x+=o*b*this.m_linearJacobian.linear2.x,n.m_sweep.c.y+=o*b*this.m_linearJacobian.linear2.y,n.m_sweep.a+=a*b*this.m_linearJacobian.angular2;var v=b2Math.b2Abs(y),x=n.m_sweep.a-i.m_sweep.a-this.m_refAngle,x=b2Math.b2Clamp(x,-b2Settings.b2_maxAngularCorrection,b2Settings.b2_maxAngularCorrection),A=-this.m_angularMass*x;i.m_sweep.a-=i.m_invI*A,n.m_sweep.a+=n.m_invI*A,i.SynchronizeTransform(),n.SynchronizeTransform();var S,w,C=b2Math.b2Abs(x);return this.m_enableLimit&&this.m_limitState!=Mlf.e_inactiveLimit&&(l=i.m_xf.R,c=this.m_localAnchor1.x-i.m_sweep.localCenter.x,h=this.m_localAnchor1.y-i.m_sweep.localCenter.y,u=l.col1.x*c+l.col2.x*h,h=l.col1.y*c+l.col2.y*h,c=u,l=n.m_xf.R,p=this.m_localAnchor2.x-n.m_sweep.localCenter.x,d=this.m_localAnchor2.y-n.m_sweep.localCenter.y,u=l.col1.x*p+l.col2.x*d,d=l.col1.y*p+l.col2.y*d,p=u,_=i.m_sweep.c.x+c,f=i.m_sweep.c.y+h,m=n.m_sweep.c.x+p-_,g=n.m_sweep.c.y+d-f,S=((l=i.m_xf.R).col1.x*this.m_localXAxis1.x+l.col2.x*this.m_localXAxis1.y)*m+(l.col1.y*this.m_localXAxis1.x+l.col2.y*this.m_localXAxis1.y)*g,w=0,this.m_limitState==Mlf.e_equalLimits?(t=b2Math.b2Clamp(S,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection),w=-this.m_motorMass*t,v=b2Math.b2Max(v,b2Math.b2Abs(x))):this.m_limitState==Mlf.e_atLowerLimit?(t=S-this.m_lowerTranslation,v=b2Math.b2Max(v,-t),t=b2Math.b2Clamp(t+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0),w=-this.m_motorMass*t,e=this.m_limitPositionImpulse,this.m_limitPositionImpulse=b2Math.b2Max(this.m_limitPositionImpulse+w,0),w=this.m_limitPositionImpulse-e):this.m_limitState==Mlf.e_atUpperLimit&&(t=S-this.m_upperTranslation,v=b2Math.b2Max(v,t),t=b2Math.b2Clamp(t-b2Settings.b2_linearSlop,0,b2Settings.b2_maxLinearCorrection),w=-this.m_motorMass*t,e=this.m_limitPositionImpulse,this.m_limitPositionImpulse=b2Math.b2Min(this.m_limitPositionImpulse+w,0),w=this.m_limitPositionImpulse-e),i.m_sweep.c.x+=r*w*this.m_motorJacobian.linear1.x,i.m_sweep.c.y+=r*w*this.m_motorJacobian.linear1.y,i.m_sweep.a+=s*w*this.m_motorJacobian.angular1,n.m_sweep.c.x+=o*w*this.m_motorJacobian.linear2.x,n.m_sweep.c.y+=o*w*this.m_motorJacobian.linear2.y,n.m_sweep.a+=a*w*this.m_motorJacobian.angular2,i.SynchronizeTransform(),n.SynchronizeTransform()),v<=b2Settings.b2_linearSlop&&C<=b2Settings.b2_angularSlop},Mlf),b2PrismaticJointDef=(Pnf=b2JointDef,__extends(Qnf,Pnf),Qnf.prototype.Initialize=function(t,e,i,n){this.body1=t,this.body2=e,this.localAnchor1=this.body1.GetLocalPoint(i),this.localAnchor2=this.body2.GetLocalPoint(i),this.localAxis1=this.body1.GetLocalVector(n),this.referenceAngle=this.body2.GetAngle()-this.body1.GetAngle()},Qnf),b2PulleyJoint=(Wnf=b2Joint,__extends(Xnf,Wnf),Xnf.prototype.GetAnchor1=function(){return this.m_body1.GetWorldPoint(this.m_localAnchor1)},Xnf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor2)},Xnf.prototype.GetReactionForce=function(){var t=this.m_u2.Copy();return t.Multiply(this.m_force),t},Xnf.prototype.GetReactionTorque=function(){return 0},Xnf.prototype.GetGroundAnchor1=function(){var t=this.m_ground.m_xf.position.Copy();return t.Add(this.m_groundAnchor1),t},Xnf.prototype.GetGroundAnchor2=function(){var t=this.m_ground.m_xf.position.Copy();return t.Add(this.m_groundAnchor2),t},Xnf.prototype.GetLength1=function(){var t=this.m_body1.GetWorldPoint(this.m_localAnchor1),e=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,i=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,n=t.x-e,r=t.y-i;return Math.sqrt(n*n+r*r)},Xnf.prototype.GetLength2=function(){var t=this.m_body2.GetWorldPoint(this.m_localAnchor2),e=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,i=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,n=t.x-e,r=t.y-i;return Math.sqrt(n*n+r*r)},Xnf.prototype.GetRatio=function(){return this.m_ratio},Xnf.prototype.InitVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,c=e.m_sweep.c.x+r,h=e.m_sweep.c.y+o,u=i.m_sweep.c.x+a,p=i.m_sweep.c.y+l,d=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,_=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,f=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,m=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(c-d,h-_),this.m_u2.Set(u-f,p-m);var g=this.m_u1.Length(),y=this.m_u2.Length();g>b2Settings.b2_linearSlop?this.m_u1.Multiply(1/g):this.m_u1.SetZero(),y>b2Settings.b2_linearSlop?this.m_u2.Multiply(1/y):this.m_u2.SetZero(),0<this.m_constant-g-this.m_ratio*y?(this.m_state=Xnf.e_inactiveLimit,this.m_force=0):(this.m_state=Xnf.e_atUpperLimit,this.m_positionImpulse=0),g<this.m_maxLength1?(this.m_limitState1=Xnf.e_inactiveLimit,this.m_limitForce1=0):(this.m_limitState1=Xnf.e_atUpperLimit,this.m_limitPositionImpulse1=0),y<this.m_maxLength2?(this.m_limitState2=Xnf.e_inactiveLimit,this.m_limitForce2=0):(this.m_limitState2=Xnf.e_atUpperLimit,this.m_limitPositionImpulse2=0);var b,v,x,A,S=r*this.m_u1.y-o*this.m_u1.x,w=a*this.m_u2.y-l*this.m_u2.x;this.m_limitMass1=e.m_invMass+e.m_invI*S*S,this.m_limitMass2=i.m_invMass+i.m_invI*w*w,this.m_pulleyMass=this.m_limitMass1+this.m_ratio*this.m_ratio*this.m_limitMass2,this.m_limitMass1=1/this.m_limitMass1,this.m_limitMass2=1/this.m_limitMass2,this.m_pulleyMass=1/this.m_pulleyMass,t.warmStarting?(b=t.dt*(-this.m_force-this.m_limitForce1)*this.m_u1.x,v=t.dt*(-this.m_force-this.m_limitForce1)*this.m_u1.y,x=t.dt*(-this.m_ratio*this.m_force-this.m_limitForce2)*this.m_u2.x,A=t.dt*(-this.m_ratio*this.m_force-this.m_limitForce2)*this.m_u2.y,e.m_linearVelocity.x+=e.m_invMass*b,e.m_linearVelocity.y+=e.m_invMass*v,e.m_angularVelocity+=e.m_invI*(r*v-o*b),i.m_linearVelocity.x+=i.m_invMass*x,i.m_linearVelocity.y+=i.m_invMass*A,i.m_angularVelocity+=i.m_invI*(a*A-l*x)):(this.m_force=0,this.m_limitForce1=0,this.m_limitForce2=0)},Xnf.prototype.SolveVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a,l,c,h,u,p,d,_,f,m,g,y=this.m_localAnchor2.x-i.m_sweep.localCenter.x,b=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*y+n.col2.x*b,b=n.col1.y*y+n.col2.y*b,y=s;this.m_state==Xnf.e_atUpperLimit&&(a=e.m_linearVelocity.x+-e.m_angularVelocity*o,l=e.m_linearVelocity.y+e.m_angularVelocity*r,c=i.m_linearVelocity.x+-i.m_angularVelocity*b,h=i.m_linearVelocity.y+i.m_angularVelocity*y,f=-(this.m_u1.x*a+this.m_u1.y*l)-this.m_ratio*(this.m_u2.x*c+this.m_u2.y*h),m=-t.inv_dt*this.m_pulleyMass*f,g=this.m_force,this.m_force=b2Math.b2Max(0,this.m_force+m),m=this.m_force-g,u=-t.dt*m*this.m_u1.x,p=-t.dt*m*this.m_u1.y,d=-t.dt*this.m_ratio*m*this.m_u2.x,_=-t.dt*this.m_ratio*m*this.m_u2.y,e.m_linearVelocity.x+=e.m_invMass*u,e.m_linearVelocity.y+=e.m_invMass*p,e.m_angularVelocity+=e.m_invI*(r*p-o*u),i.m_linearVelocity.x+=i.m_invMass*d,i.m_linearVelocity.y+=i.m_invMass*_,i.m_angularVelocity+=i.m_invI*(y*_-b*d)),this.m_limitState1==Xnf.e_atUpperLimit&&(a=e.m_linearVelocity.x+-e.m_angularVelocity*o,l=e.m_linearVelocity.y+e.m_angularVelocity*r,f=-(this.m_u1.x*a+this.m_u1.y*l),m=-t.inv_dt*this.m_limitMass1*f,g=this.m_limitForce1,this.m_limitForce1=b2Math.b2Max(0,this.m_limitForce1+m),m=this.m_limitForce1-g,u=-t.dt*m*this.m_u1.x,p=-t.dt*m*this.m_u1.y,e.m_linearVelocity.x+=e.m_invMass*u,e.m_linearVelocity.y+=e.m_invMass*p,e.m_angularVelocity+=e.m_invI*(r*p-o*u)),this.m_limitState2==Xnf.e_atUpperLimit&&(c=i.m_linearVelocity.x+-i.m_angularVelocity*b,h=i.m_linearVelocity.y+i.m_angularVelocity*y,f=-(this.m_u2.x*c+this.m_u2.y*h),m=-t.inv_dt*this.m_limitMass2*f,g=this.m_limitForce2,this.m_limitForce2=b2Math.b2Max(0,this.m_limitForce2+m),m=this.m_limitForce2-g,d=-t.dt*m*this.m_u2.x,_=-t.dt*m*this.m_u2.y,i.m_linearVelocity.x+=i.m_invMass*d,i.m_linearVelocity.y+=i.m_invMass*_,i.m_angularVelocity+=i.m_invI*(y*_-b*d))},Xnf.prototype.SolvePositionConstraints=function(){var t,e,i,n,r,o,s,a,l,c,h,u,p,d,_,f,m=this.m_body1,g=this.m_body2,y=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,b=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,v=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,x=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,A=0;return this.m_state==Xnf.e_atUpperLimit&&(t=m.m_xf.R,e=this.m_localAnchor1.x-m.m_sweep.localCenter.x,i=this.m_localAnchor1.y-m.m_sweep.localCenter.y,f=t.col1.x*e+t.col2.x*i,i=t.col1.y*e+t.col2.y*i,e=f,t=g.m_xf.R,n=this.m_localAnchor2.x-g.m_sweep.localCenter.x,r=this.m_localAnchor2.y-g.m_sweep.localCenter.y,f=t.col1.x*n+t.col2.x*r,r=t.col1.y*n+t.col2.y*r,n=f,o=m.m_sweep.c.x+e,s=m.m_sweep.c.y+i,a=g.m_sweep.c.x+n,l=g.m_sweep.c.y+r,this.m_u1.Set(o-y,s-b),this.m_u2.Set(a-v,l-x),c=this.m_u1.Length(),h=this.m_u2.Length(),c>b2Settings.b2_linearSlop?this.m_u1.Multiply(1/c):this.m_u1.SetZero(),h>b2Settings.b2_linearSlop?this.m_u2.Multiply(1/h):this.m_u2.SetZero(),u=this.m_constant-c-this.m_ratio*h,A=b2Math.b2Max(A,-u),u=b2Math.b2Clamp(u+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0),p=-this.m_pulleyMass*u,d=this.m_positionImpulse,this.m_positionImpulse=b2Math.b2Max(0,this.m_positionImpulse+p),o=-(p=this.m_positionImpulse-d)*this.m_u1.x,s=-p*this.m_u1.y,a=-this.m_ratio*p*this.m_u2.x,l=-this.m_ratio*p*this.m_u2.y,m.m_sweep.c.x+=m.m_invMass*o,m.m_sweep.c.y+=m.m_invMass*s,m.m_sweep.a+=m.m_invI*(e*s-i*o),g.m_sweep.c.x+=g.m_invMass*a,g.m_sweep.c.y+=g.m_invMass*l,g.m_sweep.a+=g.m_invI*(n*l-r*a),m.SynchronizeTransform(),g.SynchronizeTransform()),this.m_limitState1==Xnf.e_atUpperLimit&&(t=m.m_xf.R,e=this.m_localAnchor1.x-m.m_sweep.localCenter.x,i=this.m_localAnchor1.y-m.m_sweep.localCenter.y,f=t.col1.x*e+t.col2.x*i,i=t.col1.y*e+t.col2.y*i,e=f,o=m.m_sweep.c.x+e,s=m.m_sweep.c.y+i,this.m_u1.Set(o-y,s-b),(c=this.m_u1.Length())>b2Settings.b2_linearSlop?(this.m_u1.x*=1/c,this.m_u1.y*=1/c):this.m_u1.SetZero(),u=this.m_maxLength1-c,A=b2Math.b2Max(A,-u),u=b2Math.b2Clamp(u+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0),p=-this.m_limitMass1*u,_=this.m_limitPositionImpulse1,this.m_limitPositionImpulse1=b2Math.b2Max(0,this.m_limitPositionImpulse1+p),o=-(p=this.m_limitPositionImpulse1-_)*this.m_u1.x,s=-p*this.m_u1.y,m.m_sweep.c.x+=m.m_invMass*o,m.m_sweep.c.y+=m.m_invMass*s,m.m_sweep.a+=m.m_invI*(e*s-i*o),m.SynchronizeTransform()),this.m_limitState2==Xnf.e_atUpperLimit&&(t=g.m_xf.R,n=this.m_localAnchor2.x-g.m_sweep.localCenter.x,r=this.m_localAnchor2.y-g.m_sweep.localCenter.y,f=t.col1.x*n+t.col2.x*r,r=t.col1.y*n+t.col2.y*r,n=f,a=g.m_sweep.c.x+n,l=g.m_sweep.c.y+r,this.m_u2.Set(a-v,l-x),(h=this.m_u2.Length())>b2Settings.b2_linearSlop?(this.m_u2.x*=1/h,this.m_u2.y*=1/h):this.m_u2.SetZero(),u=this.m_maxLength2-h,A=b2Math.b2Max(A,-u),u=b2Math.b2Clamp(u+b2Settings.b2_linearSlop,-b2Settings.b2_maxLinearCorrection,0),p=-this.m_limitMass2*u,_=this.m_limitPositionImpulse2,this.m_limitPositionImpulse2=b2Math.b2Max(0,this.m_limitPositionImpulse2+p),a=-(p=this.m_limitPositionImpulse2-_)*this.m_u2.x,l=-p*this.m_u2.y,g.m_sweep.c.x+=g.m_invMass*a,g.m_sweep.c.y+=g.m_invMass*l,g.m_sweep.a+=g.m_invI*(n*l-r*a),g.SynchronizeTransform()),A<b2Settings.b2_linearSlop},Xnf.b2_minPulleyLength=2,Xnf),b2PulleyJointDef=(zpf=b2JointDef,__extends(Apf,zpf),Apf.prototype.Initialize=function(t,e,i,n,r,o,s){this.body1=t,this.body2=e,this.groundAnchor1.SetV(i),this.groundAnchor2.SetV(n),this.localAnchor1=this.body1.GetLocalPoint(r),this.localAnchor2=this.body2.GetLocalPoint(o);var a=r.x-i.x,l=r.y-i.y;this.length1=Math.sqrt(a*a+l*l);var c=o.x-n.x,h=o.y-n.y;this.length2=Math.sqrt(c*c+h*h),this.ratio=s;var u=this.length1+this.ratio*this.length2;this.maxLength1=u-this.ratio*b2PulleyJoint.b2_minPulleyLength,this.maxLength2=(u-b2PulleyJoint.b2_minPulleyLength)/this.ratio},Apf),b2RevoluteJoint=(Opf=b2Joint,__extends(Ppf,Opf),Ppf.prototype.GetAnchor1=function(){return this.m_body1.GetWorldPoint(this.m_localAnchor1)},Ppf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor2)},Ppf.prototype.GetReactionForce=function(){return this.m_pivotForce},Ppf.prototype.GetReactionTorque=function(){return this.m_limitForce},Ppf.prototype.GetJointAngle=function(){return this.m_body2.m_sweep.a-this.m_body1.m_sweep.a-this.m_referenceAngle},Ppf.prototype.GetJointSpeed=function(){return this.m_body2.m_angularVelocity-this.m_body1.m_angularVelocity},Ppf.prototype.IsLimitEnabled=function(){return this.m_enableLimit},Ppf.prototype.EnableLimit=function(t){this.m_enableLimit=t},Ppf.prototype.GetLowerLimit=function(){return this.m_lowerAngle},Ppf.prototype.GetUpperLimit=function(){return this.m_upperAngle},Ppf.prototype.SetLimits=function(t,e){this.m_lowerAngle=t,this.m_upperAngle=e},Ppf.prototype.IsMotorEnabled=function(){return this.m_enableMotor},Ppf.prototype.EnableMotor=function(t){this.m_enableMotor=t},Ppf.prototype.SetMotorSpeed=function(t){this.m_motorSpeed=t},Ppf.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},Ppf.prototype.SetMaxMotorTorque=function(t){this.m_maxMotorTorque=t},Ppf.prototype.GetMotorTorque=function(){return this.m_motorForce},Ppf.prototype.InitVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s;var c,h=e.m_invMass,u=i.m_invMass,p=e.m_invI,d=i.m_invI;this.K1.col1.x=h+u,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=h+u,this.K2.col1.x=p*o*o,this.K2.col2.x=-p*r*o,this.K2.col1.y=-p*r*o,this.K2.col2.y=p*r*r,this.K3.col1.x=d*l*l,this.K3.col2.x=-d*a*l,this.K3.col1.y=-d*a*l,this.K3.col2.y=d*a*a,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.AddM(this.K3),this.K.Invert(this.m_pivotMass),this.m_motorMass=1/(p+d),0==this.m_enableMotor&&(this.m_motorForce=0),this.m_enableLimit?(c=i.m_sweep.a-e.m_sweep.a-this.m_referenceAngle,b2Math.b2Abs(this.m_upperAngle-this.m_lowerAngle)<2*b2Settings.b2_angularSlop?this.m_limitState=Ppf.e_equalLimits:c<=this.m_lowerAngle?(this.m_limitState!=Ppf.e_atLowerLimit&&(this.m_limitForce=0),this.m_limitState=Ppf.e_atLowerLimit):c>=this.m_upperAngle?(this.m_limitState!=Ppf.e_atUpperLimit&&(this.m_limitForce=0),this.m_limitState=Ppf.e_atUpperLimit):(this.m_limitState=Ppf.e_inactiveLimit,this.m_limitForce=0)):this.m_limitForce=0,t.warmStarting?(e.m_linearVelocity.x-=t.dt*h*this.m_pivotForce.x,e.m_linearVelocity.y-=t.dt*h*this.m_pivotForce.y,e.m_angularVelocity-=t.dt*p*(r*this.m_pivotForce.y-o*this.m_pivotForce.x+this.m_motorForce+this.m_limitForce),i.m_linearVelocity.x+=t.dt*u*this.m_pivotForce.x,i.m_linearVelocity.y+=t.dt*u*this.m_pivotForce.y,i.m_angularVelocity+=t.dt*d*(a*this.m_pivotForce.y-l*this.m_pivotForce.x+this.m_motorForce+this.m_limitForce)):(this.m_pivotForce.SetZero(),this.m_motorForce=0,this.m_limitForce=0),this.m_limitPositionImpulse=0},Ppf.prototype.SolveVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a,l=this.m_localAnchor2.x-i.m_sweep.localCenter.x,c=this.m_localAnchor2.y-i.m_sweep.localCenter.y;s=n.col1.x*l+n.col2.x*c,c=n.col1.y*l+n.col2.y*c,l=s;var h=i.m_linearVelocity.x+-i.m_angularVelocity*c-e.m_linearVelocity.x- -e.m_angularVelocity*o,u=i.m_linearVelocity.y+i.m_angularVelocity*l-e.m_linearVelocity.y-e.m_angularVelocity*r,p=-t.inv_dt*(this.m_pivotMass.col1.x*h+this.m_pivotMass.col2.x*u),d=-t.inv_dt*(this.m_pivotMass.col1.y*h+this.m_pivotMass.col2.y*u);this.m_pivotForce.x+=p,this.m_pivotForce.y+=d;var _,f,m,g,y,b=t.dt*p,v=t.dt*d;e.m_linearVelocity.x-=e.m_invMass*b,e.m_linearVelocity.y-=e.m_invMass*v,e.m_angularVelocity-=e.m_invI*(r*v-o*b),i.m_linearVelocity.x+=i.m_invMass*b,i.m_linearVelocity.y+=i.m_invMass*v,i.m_angularVelocity+=i.m_invI*(l*v-c*b),this.m_enableMotor&&this.m_limitState!=Ppf.e_equalLimits&&(_=i.m_angularVelocity-e.m_angularVelocity-this.m_motorSpeed,f=-t.inv_dt*this.m_motorMass*_,m=this.m_motorForce,this.m_motorForce=b2Math.b2Clamp(this.m_motorForce+f,-this.m_maxMotorTorque,this.m_maxMotorTorque),f=this.m_motorForce-m,e.m_angularVelocity-=e.m_invI*t.dt*f,i.m_angularVelocity+=i.m_invI*t.dt*f),this.m_enableLimit&&this.m_limitState!=Ppf.e_inactiveLimit&&(g=i.m_angularVelocity-e.m_angularVelocity,y=-t.inv_dt*this.m_motorMass*g,this.m_limitState==Ppf.e_equalLimits?this.m_limitForce+=y:this.m_limitState==Ppf.e_atLowerLimit?(a=this.m_limitForce,this.m_limitForce=b2Math.b2Max(this.m_limitForce+y,0),y=this.m_limitForce-a):this.m_limitState==Ppf.e_atUpperLimit&&(a=this.m_limitForce,this.m_limitForce=b2Math.b2Min(this.m_limitForce+y,0),y=this.m_limitForce-a),e.m_angularVelocity-=e.m_invI*t.dt*y,i.m_angularVelocity+=i.m_invI*t.dt*y)},Ppf.prototype.SolvePositionConstraints=function(){var t,e,i=this.m_body1,n=this.m_body2,r=i.m_xf.R,o=this.m_localAnchor1.x-i.m_sweep.localCenter.x,s=this.m_localAnchor1.y-i.m_sweep.localCenter.y,a=r.col1.x*o+r.col2.x*s,s=r.col1.y*o+r.col2.y*s,o=a;r=n.m_xf.R;var l=this.m_localAnchor2.x-n.m_sweep.localCenter.x,c=this.m_localAnchor2.y-n.m_sweep.localCenter.y,a=r.col1.x*l+r.col2.x*c,c=r.col1.y*l+r.col2.y*c,l=a,h=i.m_sweep.c.x+o,u=i.m_sweep.c.y+s,p=n.m_sweep.c.x+l-h,d=n.m_sweep.c.y+c-u,_=Math.sqrt(p*p+d*d),f=i.m_invMass,m=n.m_invMass,g=i.m_invI,y=n.m_invI;this.K1.col1.x=f+m,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=f+m,this.K2.col1.x=g*s*s,this.K2.col2.x=-g*o*s,this.K2.col1.y=-g*o*s,this.K2.col2.y=g*o*o,this.K3.col1.x=y*c*c,this.K3.col2.x=-y*l*c,this.K3.col1.y=-y*l*c,this.K3.col2.y=y*l*l,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.AddM(this.K3),this.K.Solve(Ppf.tImpulse,-p,-d);var b=Ppf.tImpulse.x,v=Ppf.tImpulse.y;i.m_sweep.c.x-=i.m_invMass*b,i.m_sweep.c.y-=i.m_invMass*v,i.m_sweep.a-=i.m_invI*(o*v-s*b),n.m_sweep.c.x+=n.m_invMass*b,n.m_sweep.c.y+=n.m_invMass*v,n.m_sweep.a+=n.m_invI*(l*v-c*b),i.SynchronizeTransform(),n.SynchronizeTransform();var x,A,S=0;return this.m_enableLimit&&this.m_limitState!=Ppf.e_inactiveLimit&&(x=n.m_sweep.a-i.m_sweep.a-this.m_referenceAngle,A=0,this.m_limitState==Ppf.e_equalLimits?(e=b2Math.b2Clamp(x,-b2Settings.b2_maxAngularCorrection,b2Settings.b2_maxAngularCorrection),A=-this.m_motorMass*e,S=b2Math.b2Abs(e)):this.m_limitState==Ppf.e_atLowerLimit?(e=x-this.m_lowerAngle,S=b2Math.b2Max(0,-e),e=b2Math.b2Clamp(e+b2Settings.b2_angularSlop,-b2Settings.b2_maxAngularCorrection,0),A=-this.m_motorMass*e,t=this.m_limitPositionImpulse,this.m_limitPositionImpulse=b2Math.b2Max(this.m_limitPositionImpulse+A,0),A=this.m_limitPositionImpulse-t):this.m_limitState==Ppf.e_atUpperLimit&&(e=x-this.m_upperAngle,S=b2Math.b2Max(0,e),e=b2Math.b2Clamp(e-b2Settings.b2_angularSlop,0,b2Settings.b2_maxAngularCorrection),A=-this.m_motorMass*e,t=this.m_limitPositionImpulse,this.m_limitPositionImpulse=b2Math.b2Min(this.m_limitPositionImpulse+A,0),A=this.m_limitPositionImpulse-t),i.m_sweep.a-=i.m_invI*A,n.m_sweep.a+=n.m_invI*A,i.SynchronizeTransform(),n.SynchronizeTransform()),_<=b2Settings.b2_linearSlop&&S<=b2Settings.b2_angularSlop},Ppf.tImpulse=new b2Vec2,Ppf),b2RevoluteJointDef=(brf=b2JointDef,__extends(crf,brf),crf.prototype.Initialize=function(t,e,i){this.body1=t,this.body2=e,this.localAnchor1=this.body1.GetLocalPoint(i),this.localAnchor2=this.body2.GetLocalPoint(i),this.referenceAngle=this.body2.GetAngle()-this.body1.GetAngle()},crf),b2DistanceJoint=(hrf=b2Joint,__extends(irf,hrf),irf.prototype.InitVelocityConstraints=function(t){this.m_inv_dt=t.inv_dt;var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,this.m_u.x=i.m_sweep.c.x+a-e.m_sweep.c.x-r,this.m_u.y=i.m_sweep.c.y+l-e.m_sweep.c.y-o;var c=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);c>b2Settings.b2_linearSlop?this.m_u.Multiply(1/c):this.m_u.SetZero();var h,u,p,d,_,f,m=r*this.m_u.y-o*this.m_u.x,g=a*this.m_u.y-l*this.m_u.x,y=e.m_invMass+e.m_invI*m*m+i.m_invMass+i.m_invI*g*g;this.m_mass=1/y,0<this.m_frequencyHz&&(h=c-this.m_length,u=2*Math.PI*this.m_frequencyHz,p=2*this.m_mass*this.m_dampingRatio*u,d=this.m_mass*u*u,this.m_gamma=1/(t.dt*(p+t.dt*d)),this.m_bias=h*t.dt*d*this.m_gamma,this.m_mass=1/(y+this.m_gamma)),t.warmStarting?(this.m_impulse*=t.dtRatio,_=this.m_impulse*this.m_u.x,f=this.m_impulse*this.m_u.y,e.m_linearVelocity.x-=e.m_invMass*_,e.m_linearVelocity.y-=e.m_invMass*f,e.m_angularVelocity-=e.m_invI*(r*f-o*_),i.m_linearVelocity.x+=i.m_invMass*_,i.m_linearVelocity.y+=i.m_invMass*f,i.m_angularVelocity+=i.m_invI*(a*f-l*_)):this.m_impulse=0},irf.prototype.SolveVelocityConstraints=function(t){var e=this.m_body1,i=this.m_body2,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,c=e.m_linearVelocity.x+-e.m_angularVelocity*o,h=e.m_linearVelocity.y+e.m_angularVelocity*r,u=i.m_linearVelocity.x+-i.m_angularVelocity*l,p=i.m_linearVelocity.y+i.m_angularVelocity*a,d=this.m_u.x*(u-c)+this.m_u.y*(p-h),_=-this.m_mass*(d+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=_;var f=_*this.m_u.x,m=_*this.m_u.y;e.m_linearVelocity.x-=e.m_invMass*f,e.m_linearVelocity.y-=e.m_invMass*m,e.m_angularVelocity-=e.m_invI*(r*m-o*f),i.m_linearVelocity.x+=i.m_invMass*f,i.m_linearVelocity.y+=i.m_invMass*m,i.m_angularVelocity+=i.m_invI*(a*m-l*f)},irf.prototype.SolvePositionConstraints=function(){if(0<this.m_frequencyHz)return!0;var t=this.m_body1,e=this.m_body2,i=t.m_xf.R,n=this.m_localAnchor1.x-t.m_sweep.localCenter.x,r=this.m_localAnchor1.y-t.m_sweep.localCenter.y,o=i.col1.x*n+i.col2.x*r,r=i.col1.y*n+i.col2.y*r,n=o;i=e.m_xf.R;var s=this.m_localAnchor2.x-e.m_sweep.localCenter.x,a=this.m_localAnchor2.y-e.m_sweep.localCenter.y,o=i.col1.x*s+i.col2.x*a,a=i.col1.y*s+i.col2.y*a,s=o,l=e.m_sweep.c.x+s-t.m_sweep.c.x-n,c=e.m_sweep.c.y+a-t.m_sweep.c.y-r,h=Math.sqrt(l*l+c*c);l/=h,c/=h;var u=h-this.m_length,u=b2Math.b2Clamp(u,-b2Settings.b2_maxLinearCorrection,b2Settings.b2_maxLinearCorrection),p=-this.m_mass*u;this.m_u.Set(l,c);var d=p*this.m_u.x,_=p*this.m_u.y;return t.m_sweep.c.x-=t.m_invMass*d,t.m_sweep.c.y-=t.m_invMass*_,t.m_sweep.a-=t.m_invI*(n*_-r*d),e.m_sweep.c.x+=e.m_invMass*d,e.m_sweep.c.y+=e.m_invMass*_,e.m_sweep.a+=e.m_invI*(s*_-a*d),t.SynchronizeTransform(),e.SynchronizeTransform(),b2Math.b2Abs(u)<b2Settings.b2_linearSlop},irf.prototype.GetAnchor1=function(){return this.m_body1.GetWorldPoint(this.m_localAnchor1)},irf.prototype.GetAnchor2=function(){return this.m_body2.GetWorldPoint(this.m_localAnchor2)},irf.prototype.GetReactionForce=function(){var t=new b2Vec2;return t.SetV(this.m_u),t.Multiply(this.m_inv_dt*this.m_impulse),t},irf.prototype.GetReactionTorque=function(){return 0},irf),b2Body=(jsf.prototype.CreateShape=function(t){if(1==this.m_world.m_lock)return null;var e;switch(t.type){case b2Shape.e_circleShape:e=new b2CircleShape(t);break;case b2Shape.e_polygonShape:e=new b2PolygonShape(t)}return e.m_next=this.m_shapeList,this.m_shapeList=e,++this.m_shapeCount,e.m_body=this,e.CreateProxy(this.m_world.m_broadPhase,this.m_xf),e.UpdateSweepRadius(this.m_sweep.localCenter),e},jsf.prototype.DestroyShape=function(t){if(1!=this.m_world.m_lock){t.DestroyProxy(this.m_world.m_broadPhase);for(var e=this.m_shapeList,i=null;null!=e;){if(e==t){i?i.m_next=t.m_next:this.m_shapeList=t.m_next;break}e=(i=e).m_next}t.m_body=null,t.m_next=null,--this.m_shapeCount,b2Shape.Destroy(t,this.m_world.m_blockAllocator)}},jsf.prototype.SetMass=function(t){var e;if(1!=this.m_world.m_lock){this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=t.mass,0<this.m_mass&&(this.m_invMass=1/this.m_mass),0==(this.m_flags&jsf.e_fixedRotationFlag)&&(this.m_I=t.I),0<this.m_I&&(this.m_invI=1/this.m_I),this.m_sweep.localCenter.SetV(t.center);var i=this.m_xf.R,n=this.m_sweep.localCenter;for(this.m_sweep.c.x=i.col1.x*n.x+i.col2.x*n.y,this.m_sweep.c.y=i.col1.y*n.x+i.col2.y*n.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),e=this.m_shapeList;e;e=e.m_next)e.UpdateSweepRadius(this.m_sweep.localCenter);var r=this.m_type;if(0==this.m_invMass&&0==this.m_invI?this.m_type=jsf.e_staticType:this.m_type=jsf.e_dynamicType,r!=this.m_type)for(e=this.m_shapeList;e;e=e.m_next)e.RefilterProxy(this.m_world.m_broadPhase,this.m_xf)}},jsf.prototype.SetMassFromShapes=function(){if(1!=this.m_world.m_lock){this.m_mass=0,this.m_invMass=0,this.m_I=0;for(var t=this.m_invI=0,e=0,i=jsf.s_massData,n=this.m_shapeList;n;n=n.m_next)n.ComputeMass(i),this.m_mass+=i.mass,t+=i.mass*i.center.x,e+=i.mass*i.center.y,this.m_I+=i.I;0<this.m_mass&&(this.m_invMass=1/this.m_mass,t*=this.m_invMass,e*=this.m_invMass),0<this.m_I&&0==(this.m_flags&jsf.e_fixedRotationFlag)?(this.m_I-=this.m_mass*(t*t+e*e),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0),this.m_sweep.localCenter.Set(t,e);var r=this.m_xf.R,o=this.m_sweep.localCenter;for(this.m_sweep.c.x=r.col1.x*o.x+r.col2.x*o.y,this.m_sweep.c.y=r.col1.y*o.x+r.col2.y*o.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),n=this.m_shapeList;n;n=n.m_next)n.UpdateSweepRadius(this.m_sweep.localCenter);var s=this.m_type;if(0==this.m_invMass&&0==this.m_invI?this.m_type=jsf.e_staticType:this.m_type=jsf.e_dynamicType,s!=this.m_type)for(n=this.m_shapeList;n;n=n.m_next)n.RefilterProxy(this.m_world.m_broadPhase,this.m_xf)}},jsf.prototype.SetXForm=function(t,e){if(1==this.m_world.m_lock)return!0;if(this.IsFrozen())return!1;this.m_xf.R.Set(e),this.m_xf.position.SetV(t);var i=this.m_xf.R,n=this.m_sweep.localCenter;this.m_sweep.c.x=i.col1.x*n.x+i.col2.x*n.y,this.m_sweep.c.y=i.col1.y*n.x+i.col2.y*n.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_sweep.a0=this.m_sweep.a=e;for(var r=!1,o=this.m_shapeList;o;o=o.m_next)if(0==o.Synchronize(this.m_world.m_broadPhase,this.m_xf,this.m_xf)){r=!0;break}if(1!=r)return this.m_world.m_broadPhase.Commit(),!0;for(this.m_flags|=jsf.e_frozenFlag,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,o=this.m_shapeList;o;o=o.m_next)o.DestroyProxy(this.m_world.m_broadPhase);return!1},jsf.prototype.GetXForm=function(){return this.m_xf},jsf.prototype.GetPosition=function(){return this.m_xf.position},jsf.prototype.GetAngle=function(){return this.m_sweep.a},jsf.prototype.GetWorldCenter=function(){return this.m_sweep.c},jsf.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter},jsf.prototype.SetLinearVelocity=function(t){this.m_linearVelocity.SetV(t)},jsf.prototype.GetLinearVelocity=function(){return this.m_linearVelocity},jsf.prototype.SetAngularVelocity=function(t){this.m_angularVelocity=t},jsf.prototype.GetAngularVelocity=function(){return this.m_angularVelocity},jsf.prototype.ApplyForce=function(t,e){this.IsSleeping()&&this.WakeUp(),this.m_force.x+=t.x,this.m_force.y+=t.y,this.m_torque+=(e.x-this.m_sweep.c.x)*t.y-(e.y-this.m_sweep.c.y)*t.x},jsf.prototype.ApplyTorque=function(t){this.IsSleeping()&&this.WakeUp(),this.m_torque+=t},jsf.prototype.ApplyImpulse=function(t,e){this.IsSleeping()&&this.WakeUp(),this.m_linearVelocity.x+=this.m_invMass*t.x,this.m_linearVelocity.y+=this.m_invMass*t.y,this.m_angularVelocity+=this.m_invI*((e.x-this.m_sweep.c.x)*t.y-(e.y-this.m_sweep.c.y)*t.x)},jsf.prototype.GetMass=function(){return this.m_mass},jsf.prototype.GetInertia=function(){return this.m_I},jsf.prototype.GetWorldPoint=function(t){var e=this.m_xf.R,i=new b2Vec2(e.col1.x*t.x+e.col2.x*t.y,e.col1.y*t.x+e.col2.y*t.y);return i.x+=this.m_xf.position.x,i.y+=this.m_xf.position.y,i},jsf.prototype.GetWorldVector=function(t){return b2Math.b2MulMV(this.m_xf.R,t)},jsf.prototype.GetLocalPoint=function(t){return b2Math.b2MulXT(this.m_xf,t)},jsf.prototype.GetLocalVector=function(t){return b2Math.b2MulTMV(this.m_xf.R,t)},jsf.prototype.GetLinearVelocityFromWorldPoint=function(t){return new b2Vec2(this.m_linearVelocity.x+this.m_angularVelocity*(t.y-this.m_sweep.c.y),this.m_linearVelocity.x-this.m_angularVelocity*(t.x-this.m_sweep.c.x))},jsf.prototype.GetLinearVelocityFromLocalPoint=function(t){var e=this.m_xf.R,i=new b2Vec2(e.col1.x*t.x+e.col2.x*t.y,e.col1.y*t.x+e.col2.y*t.y);return i.x+=this.m_xf.position.x,i.y+=this.m_xf.position.y,new b2Vec2(this.m_linearVelocity.x+this.m_angularVelocity*(i.y-this.m_sweep.c.y),this.m_linearVelocity.x-this.m_angularVelocity*(i.x-this.m_sweep.c.x))},jsf.prototype.IsBullet=function(){return(this.m_flags&jsf.e_bulletFlag)==jsf.e_bulletFlag},jsf.prototype.SetBullet=function(t){t?this.m_flags|=jsf.e_bulletFlag:this.m_flags&=~jsf.e_bulletFlag},jsf.prototype.IsStatic=function(){return this.m_type==jsf.e_staticType},jsf.prototype.IsDynamic=function(){return this.m_type==jsf.e_dynamicType},jsf.prototype.IsFrozen=function(){return(this.m_flags&jsf.e_frozenFlag)==jsf.e_frozenFlag},jsf.prototype.IsSleeping=function(){return(this.m_flags&jsf.e_sleepFlag)==jsf.e_sleepFlag},jsf.prototype.AllowSleeping=function(t){t?this.m_flags|=jsf.e_allowSleepFlag:(this.m_flags&=~jsf.e_allowSleepFlag,this.WakeUp())},jsf.prototype.WakeUp=function(){this.m_flags&=~jsf.e_sleepFlag,this.m_sleepTime=0},jsf.prototype.PutToSleep=function(){this.m_flags|=jsf.e_sleepFlag,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0},jsf.prototype.GetShapeList=function(){return this.m_shapeList},jsf.prototype.GetJointList=function(){return this.m_jointList},jsf.prototype.GetNext=function(){return this.m_next},jsf.prototype.GetUserData=function(){return this.m_userData},jsf.prototype.SetUserData=function(t){this.m_userData=t},jsf.prototype.GetWorld=function(){return this.m_world},jsf.prototype.SynchronizeShapes=function(){var t=jsf.s_xf1;t.R.Set(this.m_sweep.a0);var e=t.R,i=this.m_sweep.localCenter;t.position.x=this.m_sweep.c0.x-(e.col1.x*i.x+e.col2.x*i.y),t.position.y=this.m_sweep.c0.y-(e.col1.y*i.x+e.col2.y*i.y);for(var n=!0,r=this.m_shapeList;r&&0!=(n=r.Synchronize(this.m_world.m_broadPhase,t,this.m_xf));r=r.m_next);if(0!=n)return!0;for(this.m_flags|=jsf.e_frozenFlag,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,r=this.m_shapeList;r;r=r.m_next)r.DestroyProxy(this.m_world.m_broadPhase);return!1},jsf.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var t=this.m_xf.R,e=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(t.col1.x*e.x+t.col2.x*e.y),this.m_xf.position.y=this.m_sweep.c.y-(t.col1.y*e.x+t.col2.y*e.y)},jsf.prototype.IsConnected=function(t){for(var e=this.m_jointList;e;e=e.next)if(e.other==t)return 0==e.joint.m_collideConnected;return!1},jsf.prototype.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.SynchronizeTransform()},jsf.s_massData=new b2MassData,jsf.s_xf1=new b2XForm,jsf.e_frozenFlag=2,jsf.e_islandFlag=4,jsf.e_sleepFlag=8,jsf.e_allowSleepFlag=16,jsf.e_bulletFlag=32,jsf.e_fixedRotationFlag=64,jsf.e_staticType=1,jsf.e_dynamicType=2,jsf.e_maxTypes=3,jsf),b2BodyDef=function(){this.__fast__=!0,this.massData=new b2MassData,this.position=new b2Vec2,this.massData.center.SetZero(),this.massData.mass=0,this.massData.I=0,this.userData=null,this.position.Set(0,0),this.angle=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.isSleeping=!1,this.fixedRotation=!1,this.isBullet=!1},b2BoundaryListener=(ntf.prototype.Violation=function(t){},ntf),b2ContactFilter=(ptf.prototype.ShouldCollide=function(t,e){var i=t.GetFilterData(),n=e.GetFilterData();return i.groupIndex==n.groupIndex&&0!=i.groupIndex?0<i.groupIndex:0!=(i.maskBits&n.categoryBits)&&0!=(i.categoryBits&n.maskBits)},ptf.b2_defaultFilter=new ptf,ptf),b2ContactListener=(utf.prototype.Add=function(t){},utf.prototype.Persist=function(t){},utf.prototype.Remove=function(t){},utf.prototype.Result=function(t){},utf),b2ContactManager=(ztf=b2PairCallback,__extends(Atf,ztf),Atf.prototype.PairAdded=function(t,e){var i,n=t,r=e,o=n.m_body,s=r.m_body;if(o.IsStatic()&&s.IsStatic())return this.m_nullContact;if(n.m_body==r.m_body)return this.m_nullContact;if(s.IsConnected(o))return this.m_nullContact;if(null!=this.m_world.m_contactFilter&&0==this.m_world.m_contactFilter.ShouldCollide(n,r))return this.m_nullContact;0==b2Contact.s_initialized&&(Atf.InitializeRegisters(),b2Contact.s_initialized=!0);var a=n.m_type,l=r.m_type,c=b2Contact.s_registers[a][l],h=c.createFcn;if(null!=h)if(c.primary)i=h(n,r,this.m_world.m_blockAllocator);else{i=h(r,n,this.m_world.m_blockAllocator);for(var u=0;u<i.m_manifoldCount;++u){var p=i.GetManifolds()[u];p.normal=p.normal.Negative()}}return null==i&&(i=this.m_nullContact),n=i.m_shape1,r=i.m_shape2,o=n.m_body,s=r.m_body,i.m_prev=null,i.m_next=this.m_world.m_contactList,null!=this.m_world.m_contactList&&(this.m_world.m_contactList.m_prev=i),((this.m_world.m_contactList=i).m_node1.contact=i).m_node1.other=s,i.m_node1.prev=null,i.m_node1.next=o.m_contactList,null!=o.m_contactList&&(o.m_contactList.prev=i.m_node1),o.m_contactList=i.m_node1,(i.m_node2.contact=i).m_node2.other=o,i.m_node2.prev=null,i.m_node2.next=s.m_contactList,null!=s.m_contactList&&(s.m_contactList.prev=i.m_node2),s.m_contactList=i.m_node2,++this.m_world.m_contactCount,i},Atf.prototype.PairRemoved=function(t,e,i){null!=i&&i!=this.m_nullContact&&this.Destroy(i)},Atf.prototype.Destroy=function(t){var e=t.m_shape1,i=t.m_shape2,n=t.m_manifoldCount;if(0<n&&this.m_world.m_contactListener){var r=e.m_body,o=i.m_body,s=t.GetManifolds(),a=Atf.s_evalCP;a.shape1=t.m_shape1,a.shape2=t.m_shape1,a.friction=t.m_friction,a.restitution=t.m_restitution;for(var l=0;l<n;++l){var c=s[l];a.normal.SetV(c.normal);for(var h=0;h<c.pointCount;++h){var u=c.points[h];a.position=r.GetWorldPoint(u.localPoint1);var p=r.GetLinearVelocityFromLocalPoint(u.localPoint1),d=o.GetLinearVelocityFromLocalPoint(u.localPoint2);a.velocity.Set(d.x-p.x,d.y-p.y),a.separation=u.separation,a.id.key=u.id._key,this.m_world.m_contactListener.Remove(a)}}}t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_world.m_contactList&&(this.m_world.m_contactList=t.m_next);var _=e.m_body,f=i.m_body;t.m_node1.prev&&(t.m_node1.prev.next=t.m_node1.next),t.m_node1.next&&(t.m_node1.next.prev=t.m_node1.prev),t.m_node1==_.m_contactList&&(_.m_contactList=t.m_node1.next),t.m_node2.prev&&(t.m_node2.prev.next=t.m_node2.next),t.m_node2.next&&(t.m_node2.next.prev=t.m_node2.prev),t.m_node2==f.m_contactList&&(f.m_contactList=t.m_node2.next),0<t.m_manifoldCount&&(t.m_shape1.m_body.WakeUp(),t.m_shape2.m_body.WakeUp());var m=t.m_shape1.m_type,g=t.m_shape2.m_type;(0,b2Contact.s_registers[m][g].destroyFcn)(t,this.m_world.m_blockAllocator),--this.m_world.m_contactCount},Atf.prototype.Collide=function(){for(var t=this.m_world.m_contactList;t;t=t.m_next){var e=t.m_shape1.m_body,i=t.m_shape2.m_body;e.IsSleeping()&&i.IsSleeping()||t.Update(this.m_world.m_contactListener)}},Atf.InitializeRegisters=function(){b2Contact.s_registers=new Array(b2Shape.e_shapeTypeCount);for(var t=0;t<b2Shape.e_shapeTypeCount;t++){b2Contact.s_registers[t]=new Array(b2Shape.e_shapeTypeCount);for(var e=0;e<b2Shape.e_shapeTypeCount;e++)b2Contact.s_registers[t][e]=new b2ContactRegister}b2Contact.AddType(b2CircleContact.Create,b2CircleContact.Destroy,b2Shape.e_circleShape,b2Shape.e_circleShape),b2Contact.AddType(b2PolyAndCircleContact.Create,b2PolyAndCircleContact.Destroy,b2Shape.e_polygonShape,b2Shape.e_circleShape),b2Contact.AddType(b2PolygonContact.Create,b2PolygonContact.Destroy,b2Shape.e_polygonShape,b2Shape.e_polygonShape)},Atf.s_evalCP=new b2ContactPoint,Atf),b2DebugDraw=(ouf.prototype.SetFlags=function(t){this.m_drawFlags=t},ouf.prototype.GetFlags=function(){return this.m_drawFlags},ouf.prototype.AppendFlags=function(t){this.m_drawFlags|=t},ouf.prototype.ClearFlags=function(t){this.m_drawFlags&=~t},ouf.prototype.DrawPolygon=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale);for(var n=1;n<e;n++)this.m_sprite.graphics.lineTo(t[n].x*this.m_drawScale,t[n].y*this.m_drawScale);this.m_sprite.graphics.lineTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale)},ouf.prototype.DrawSolidPolygon=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale),this.m_sprite.graphics.beginFill(i.color,this.m_fillAlpha);for(var n=1;n<e;n++)this.m_sprite.graphics.lineTo(t[n].x*this.m_drawScale,t[n].y*this.m_drawScale);this.m_sprite.graphics.lineTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale),this.m_sprite.graphics.endFill()},ouf.prototype.DrawCircle=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.drawCircle(t.x*this.m_drawScale,t.y*this.m_drawScale,e*this.m_drawScale)},ouf.prototype.DrawSolidCircle=function(t,e,i,n){this.m_sprite.graphics.lineStyle(this.m_lineThickness,n.color,this.m_alpha),this.m_sprite.graphics.moveTo(0,0),this.m_sprite.graphics.beginFill(n.color,this.m_fillAlpha),this.m_sprite.graphics.drawCircle(t.x*this.m_drawScale,t.y*this.m_drawScale,e*this.m_drawScale),this.m_sprite.graphics.endFill(),this.m_sprite.graphics.moveTo(t.x*this.m_drawScale,t.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.x+i.x*e)*this.m_drawScale,(t.y+i.y*e)*this.m_drawScale)},ouf.prototype.DrawSegment=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t.x*this.m_drawScale,t.y*this.m_drawScale),this.m_sprite.graphics.lineTo(e.x*this.m_drawScale,e.y*this.m_drawScale)},ouf.prototype.DrawXForm=function(t){this.m_sprite.graphics.lineStyle(this.m_lineThickness,16711680,this.m_alpha),this.m_sprite.graphics.moveTo(t.position.x*this.m_drawScale,t.position.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.position.x+this.m_xformScale*t.R.col1.x)*this.m_drawScale,(t.position.y+this.m_xformScale*t.R.col1.y)*this.m_drawScale),this.m_sprite.graphics.lineStyle(this.m_lineThickness,65280,this.m_alpha),this.m_sprite.graphics.moveTo(t.position.x*this.m_drawScale,t.position.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.position.x+this.m_xformScale*t.R.col2.x)*this.m_drawScale,(t.position.y+this.m_xformScale*t.R.col2.y)*this.m_drawScale)},ouf.e_shapeBit=1,ouf.e_jointBit=2,ouf.e_coreShapeBit=4,ouf.e_aabbBit=8,ouf.e_obbBit=16,ouf.e_pairBit=32,ouf.e_centerOfMassBit=64,ouf),b2DestructionListener=(Luf.prototype.SayGoodbyeJoint=function(t){},Luf.prototype.SayGoodbyeShape=function(t){},Luf),b2Island=(Ouf.prototype.Clear=function(){this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0},Ouf.prototype.Solve=function(t,e,i,n){var r;for(c=0;c<this.m_bodyCount;++c)(r=this.m_bodies[c]).IsStatic()||(r.m_linearVelocity.x+=t.dt*(e.x+r.m_invMass*r.m_force.x),r.m_linearVelocity.y+=t.dt*(e.y+r.m_invMass*r.m_force.y),r.m_angularVelocity+=t.dt*r.m_invI*r.m_torque,r.m_force.SetZero(),r.m_torque=0,r.m_linearVelocity.Multiply(b2Math.b2Clamp(1-t.dt*r.m_linearDamping,0,1)),r.m_angularVelocity*=b2Math.b2Clamp(1-t.dt*r.m_angularDamping,0,1),r.m_linearVelocity.LengthSquared()>b2Settings.b2_maxLinearVelocitySquared&&(r.m_linearVelocity.Normalize(),r.m_linearVelocity.x*=b2Settings.b2_maxLinearVelocity,r.m_linearVelocity.y*=b2Settings.b2_maxLinearVelocity),r.m_angularVelocity*r.m_angularVelocity>b2Settings.b2_maxAngularVelocitySquared&&(r.m_angularVelocity<0?r.m_angularVelocity=-b2Settings.b2_maxAngularVelocity:r.m_angularVelocity=b2Settings.b2_maxAngularVelocity));var o=new b2ContactSolver(t,this.m_contacts,this.m_contactCount,this.m_allocator);for(o.InitVelocityConstraints(t),c=0;c<this.m_jointCount;++c)this.m_joints[c].InitVelocityConstraints(t);for(c=0;c<t.maxIterations;++c){o.SolveVelocityConstraints();for(var s=0;s<this.m_jointCount;++s)this.m_joints[s].SolveVelocityConstraints(t)}for(o.FinalizeVelocityConstraints(),c=0;c<this.m_bodyCount;++c)(r=this.m_bodies[c]).IsStatic()||(r.m_sweep.c0.SetV(r.m_sweep.c),r.m_sweep.a0=r.m_sweep.a,r.m_sweep.c.x+=t.dt*r.m_linearVelocity.x,r.m_sweep.c.y+=t.dt*r.m_linearVelocity.y,r.m_sweep.a+=t.dt*r.m_angularVelocity,r.SynchronizeTransform());if(i){for(c=0;c<this.m_jointCount;++c)this.m_joints[c].InitPositionConstraints();for(this.m_positionIterationCount=0;this.m_positionIterationCount<t.maxIterations;++this.m_positionIterationCount){for(var a=o.SolvePositionConstraints(b2Settings.b2_contactBaumgarte),l=!0,c=0;c<this.m_jointCount;++c)var h=this.m_joints[c].SolvePositionConstraints(),l=l&&h;if(a&&l)break}}if(this.Report(o.m_constraints),n){var u=Number.MAX_VALUE,p=b2Settings.b2_linearSleepTolerance*b2Settings.b2_linearSleepTolerance,d=b2Settings.b2_angularSleepTolerance*b2Settings.b2_angularSleepTolerance;for(c=0;c<this.m_bodyCount;++c)0!=(r=this.m_bodies[c]).m_invMass&&(0==(r.m_flags&b2Body.e_allowSleepFlag)&&(u=r.m_sleepTime=0),u=0==(r.m_flags&b2Body.e_allowSleepFlag)||r.m_angularVelocity*r.m_angularVelocity>d||b2Math.b2Dot(r.m_linearVelocity,r.m_linearVelocity)>p?r.m_sleepTime=0:(r.m_sleepTime+=t.dt,b2Math.b2Min(u,r.m_sleepTime)));if(u>=b2Settings.b2_timeToSleep)for(c=0;c<this.m_bodyCount;++c)(r=this.m_bodies[c]).m_flags|=b2Body.e_sleepFlag,r.m_linearVelocity.SetZero(),r.m_angularVelocity=0}},Ouf.prototype.SolveTOI=function(t){for(var e=new b2ContactSolver(t,this.m_contacts,this.m_contactCount,this.m_allocator),i=0;i<t.maxIterations;++i)e.SolveVelocityConstraints();for(i=0;i<this.m_bodyCount;++i){var n=this.m_bodies[i];n.IsStatic()||(n.m_sweep.c0.SetV(n.m_sweep.c),n.m_sweep.a0=n.m_sweep.a,n.m_sweep.c.x+=t.dt*n.m_linearVelocity.x,n.m_sweep.c.y+=t.dt*n.m_linearVelocity.y,n.m_sweep.a+=t.dt*n.m_angularVelocity,n.SynchronizeTransform())}for(i=0;i<t.maxIterations&&!e.SolvePositionConstraints(.75);++i);this.Report(e.m_constraints)},Ouf.prototype.Report=function(t){if(null!=this.m_listener)for(var e=0;e<this.m_contactCount;++e){var i=this.m_contacts[e],n=t[e],r=Ouf.s_reportCR;r.shape1=i.m_shape1,r.shape2=i.m_shape2;for(var o=r.shape1.m_body,s=i.m_manifoldCount,a=i.GetManifolds(),l=0;l<s;++l){var c=a[l];r.normal.SetV(c.normal);for(var h=0;h<c.pointCount;++h){var u=c.points[h],p=n.points[h];r.position=o.GetWorldPoint(u.localPoint1),r.normalImpulse=p.normalImpulse,r.tangentImpulse=p.tangentImpulse,r.id.key=u.id.key,this.m_listener.Result(r)}}}},Ouf.prototype.AddBody=function(t){this.m_bodies[this.m_bodyCount++]=t},Ouf.prototype.AddContact=function(t){this.m_contacts[this.m_contactCount++]=t},Ouf.prototype.AddJoint=function(t){this.m_joints[this.m_jointCount++]=t},Ouf.s_reportCR=new b2ContactResult,Ouf),b2World=(Bvf.prototype.SetDestructionListener=function(t){this.m_destructionListener=t},Bvf.prototype.SetBoundaryListener=function(t){this.m_boundaryListener=t},Bvf.prototype.SetContactFilter=function(t){this.m_contactFilter=t},Bvf.prototype.SetContactListener=function(t){if(t){var e=t;if(void 0!==t.traits&&this.__fast__)for(var i=0,n=Object.getOwnPropertyNames(b2ContactListener.prototype);i<n.length;i++){var r=n[i];!e[r]&&e["$Bg"+r]&&(e[r]=e["$Bg"+r])}this.m_contactListener=e}else this.m_contactListener=null},Bvf.prototype.SetDebugDraw=function(t){this.m_debugDraw=t},Bvf.prototype.Validate=function(){this.m_broadPhase.Validate()},Bvf.prototype.GetProxyCount=function(){return this.m_broadPhase.m_proxyCount},Bvf.prototype.GetPairCount=function(){return this.m_broadPhase.m_pairManager.m_pairCount},Bvf.prototype.CreateBody=function(t){if(1==this.m_lock)return null;var e=new b2Body(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},Bvf.prototype.DestroyBody=function(t){if(1!=this.m_lock){for(var e=t.m_jointList;e;){var i=e,e=e.next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint)}for(var n=t.m_shapeList;n;){var r=n,n=n.m_next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeShape(r),r.DestroyProxy(this.m_broadPhase),b2Shape.Destroy(r,this.m_blockAllocator)}t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount}},Bvf.prototype.CreateJoint=function(t){var e=b2Joint.Create(t,this.m_blockAllocator);if(e.m_prev=null,e.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=e),this.m_jointList=e,++this.m_jointCount,(e.m_node1.joint=e).m_node1.other=e.m_body2,e.m_node1.prev=null,e.m_node1.next=e.m_body1.m_jointList,e.m_body1.m_jointList&&(e.m_body1.m_jointList.prev=e.m_node1),e.m_body1.m_jointList=e.m_node1,(e.m_node2.joint=e).m_node2.other=e.m_body1,e.m_node2.prev=null,e.m_node2.next=e.m_body2.m_jointList,e.m_body2.m_jointList&&(e.m_body2.m_jointList.prev=e.m_node2),e.m_body2.m_jointList=e.m_node2,0==t.collideConnected)for(var i=t.body1.m_shapeCount<t.body2.m_shapeCount?t.body1:t.body2,n=i.m_shapeList;n;n=n.m_next)n.RefilterProxy(this.m_broadPhase,i.m_xf);return e},Bvf.prototype.DestroyJoint=function(t){var e=t.m_collideConnected;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_body1,n=t.m_body2;if(i.WakeUp(),n.WakeUp(),t.m_node1.prev&&(t.m_node1.prev.next=t.m_node1.next),t.m_node1.next&&(t.m_node1.next.prev=t.m_node1.prev),t.m_node1==i.m_jointList&&(i.m_jointList=t.m_node1.next),t.m_node1.prev=null,t.m_node1.next=null,t.m_node2.prev&&(t.m_node2.prev.next=t.m_node2.next),t.m_node2.next&&(t.m_node2.next.prev=t.m_node2.prev),t.m_node2==n.m_jointList&&(n.m_jointList=t.m_node2.next),t.m_node2.prev=null,t.m_node2.next=null,b2Joint.Destroy(t,this.m_blockAllocator),--this.m_jointCount,0==e)for(var r=i.m_shapeCount<n.m_shapeCount?i:n,o=r.m_shapeList;o;o=o.m_next)o.RefilterProxy(this.m_broadPhase,r.m_xf)},Bvf.prototype.Refilter=function(t){t.RefilterProxy(this.m_broadPhase,t.m_body.m_xf)},Bvf.prototype.SetWarmStarting=function(t){Bvf.m_warmStarting=t},Bvf.prototype.SetPositionCorrection=function(t){Bvf.m_positionCorrection=t},Bvf.prototype.SetContinuousPhysics=function(t){Bvf.m_continuousPhysics=t},Bvf.prototype.GetBodyCount=function(){return this.m_bodyCount},Bvf.prototype.GetJointCount=function(){return this.m_jointCount},Bvf.prototype.GetContactCount=function(){return this.m_contactCount},Bvf.prototype.SetGravity=function(t){this.m_gravity=t},Bvf.prototype.GetGroundBody=function(){return this.m_groundBody},Bvf.prototype.Step=function(t,e){this.m_lock=!0;var i=new b2TimeStep;i.dt=t,i.maxIterations=e,i.inv_dt=0<t?1/t:0,i.dtRatio=this.m_inv_dt0*t,i.positionCorrection=Bvf.m_positionCorrection,i.warmStarting=Bvf.m_warmStarting,this.m_contactManager.Collide(),0<i.dt&&this.Solve(i),Bvf.m_continuousPhysics&&0<i.dt&&this.SolveTOI(i),this.DrawDebugData(),this.m_inv_dt0=i.inv_dt,this.m_lock=!1},Bvf.prototype.Query=function(t,e,i){var n=new Array(i),r=this.m_broadPhase.QueryAABB(t,n,i),o=e;void 0!==o.traits&&(o=o.value);for(var s=0;s<r;++s)o[s]=n[s];return r},Bvf.prototype.GetBodyList=function(){return this.m_bodyList},Bvf.prototype.GetJointList=function(){return this.m_jointList},Bvf.prototype.Solve=function(t){this.m_positionIterationCount=0;for(var e=new b2Island(this.m_bodyCount,this.m_contactCount,this.m_jointCount,this.m_stackAllocator,this.m_contactListener),i=this.m_bodyList;i;i=i.m_next)i.m_flags&=~b2Body.e_islandFlag;for(var n=this.m_contactList;n;n=n.m_next)n.m_flags&=~b2Contact.e_islandFlag;for(var r=this.m_jointList;r;r=r.m_next)r.m_islandFlag=!1;for(var o=this.m_bodyCount,s=new Array(o),a=this.m_bodyList;a;a=a.m_next)if(!(a.m_flags&(b2Body.e_islandFlag|b2Body.e_sleepFlag|b2Body.e_frozenFlag)||a.IsStatic())){e.Clear();var l=0;for((s[l++]=a).m_flags|=b2Body.e_islandFlag;0<l;)if(i=s[--l],e.AddBody(i),i.m_flags&=~b2Body.e_sleepFlag,!i.IsStatic()){for(var c,h=i.m_contactList;h;h=h.next)h.contact.m_flags&(b2Contact.e_islandFlag|b2Contact.e_nonSolidFlag)||0!=h.contact.m_manifoldCount&&(e.AddContact(h.contact),h.contact.m_flags|=b2Contact.e_islandFlag,(c=h.other).m_flags&b2Body.e_islandFlag||((s[l++]=c).m_flags|=b2Body.e_islandFlag));for(var u=i.m_jointList;u;u=u.next)1!=u.joint.m_islandFlag&&(e.AddJoint(u.joint),u.joint.m_islandFlag=!0,(c=u.other).m_flags&b2Body.e_islandFlag||((s[l++]=c).m_flags|=b2Body.e_islandFlag))}e.Solve(t,this.m_gravity,Bvf.m_positionCorrection,this.m_allowSleep),e.m_positionIterationCount>this.m_positionIterationCount&&(this.m_positionIterationCount=e.m_positionIterationCount);for(var p=0;p<e.m_bodyCount;++p)(i=e.m_bodies[p]).IsStatic()&&(i.m_flags&=~b2Body.e_islandFlag)}for(i=this.m_bodyList;i;i=i.m_next)i.m_flags&(b2Body.e_sleepFlag|b2Body.e_frozenFlag)||i.IsStatic()||0==i.SynchronizeShapes()&&null!=this.m_boundaryListener&&this.m_boundaryListener.Violation(i);this.m_broadPhase.Commit()},Bvf.prototype.SolveTOI=function(t){for(var e,i,n,r,o,s=new b2Island(this.m_bodyCount,b2Settings.b2_maxTOIContactsPerIsland,0,this.m_stackAllocator,this.m_contactListener),a=this.m_bodyCount,l=new Array(a),c=this.m_bodyList;c;c=c.m_next)c.m_flags&=~b2Body.e_islandFlag,c.m_sweep.t0=0;for(p=this.m_contactList;p;p=p.m_next)p.m_flags&=~(b2Contact.e_toiFlag|b2Contact.e_islandFlag);for(;;){for(var h=null,u=1,p=this.m_contactList;p;p=p.m_next)if(!(p.m_flags&(b2Contact.e_slowFlag|b2Contact.e_nonSolidFlag))){var d=1;if(p.m_flags&b2Contact.e_toiFlag)d=p.m_toi;else{if(e=p.m_shape1,i=p.m_shape2,n=e.m_body,r=i.m_body,(n.IsStatic()||n.IsSleeping())&&(r.IsStatic()||r.IsSleeping()))continue;var _=n.m_sweep.t0;n.m_sweep.t0<r.m_sweep.t0?(_=r.m_sweep.t0,n.m_sweep.Advance(_)):r.m_sweep.t0<n.m_sweep.t0&&(_=n.m_sweep.t0,r.m_sweep.Advance(_)),0<(d=b2TimeOfImpact.TimeOfImpact(p.m_shape1,n.m_sweep,p.m_shape2,r.m_sweep))&&d<1&&1<(d=(1-d)*_+d)&&(d=1),p.m_toi=d,p.m_flags|=b2Contact.e_toiFlag}Number.MIN_VALUE<d&&d<u&&(h=p,u=d)}if(null==h||1-100*Number.MIN_VALUE<u)break;if(e=h.m_shape1,i=h.m_shape2,n=e.m_body,r=i.m_body,n.Advance(u),r.Advance(u),h.Update(this.m_contactListener),h.m_flags&=~b2Contact.e_toiFlag,0!=h.m_manifoldCount){var f=n;f.IsStatic()&&(f=r),s.Clear();var m,g=0;for((l[g++]=f).m_flags|=b2Body.e_islandFlag;0<g;)if(c=l[--g],s.AddBody(c),c.m_flags&=~b2Body.e_sleepFlag,!c.IsStatic())for(o=c.m_contactList;o;o=o.next)s.m_contactCount==s.m_contactCapacity||o.contact.m_flags&(b2Contact.e_islandFlag|b2Contact.e_slowFlag|b2Contact.e_nonSolidFlag)||0==o.contact.m_manifoldCount||(s.AddContact(o.contact),o.contact.m_flags|=b2Contact.e_islandFlag,(m=o.other).m_flags&b2Body.e_islandFlag||(0==m.IsStatic()&&(m.Advance(u),m.WakeUp()),(l[g++]=m).m_flags|=b2Body.e_islandFlag));var y,b=new b2TimeStep;for(b.dt=(1-u)*t.dt,b.inv_dt=1/b.dt,b.maxIterations=t.maxIterations,s.SolveTOI(b),y=0;y<s.m_bodyCount;++y)if((c=s.m_bodies[y]).m_flags&=~b2Body.e_islandFlag,!(c.m_flags&(b2Body.e_sleepFlag|b2Body.e_frozenFlag)||c.IsStatic()))for(0==c.SynchronizeShapes()&&null!=this.m_boundaryListener&&this.m_boundaryListener.Violation(c),o=c.m_contactList;o;o=o.next)o.contact.m_flags&=~b2Contact.e_toiFlag;for(y=0;y<s.m_contactCount;++y)(p=s.m_contacts[y]).m_flags&=~(b2Contact.e_toiFlag|b2Contact.e_islandFlag);this.m_broadPhase.Commit()}}},Bvf.prototype.DrawJoint=function(t){var e=t.m_body1,i=t.m_body2,n=e.m_xf,r=i.m_xf,o=n.position,s=r.position,a=t.GetAnchor1(),l=t.GetAnchor2(),c=Bvf.s_jointColor;switch(t.m_type){case b2Joint.e_distanceJoint:this.m_debugDraw.DrawSegment(a,l,c);break;case b2Joint.e_pulleyJoint:var h=t,u=h.GetGroundAnchor1(),p=h.GetGroundAnchor2();this.m_debugDraw.DrawSegment(u,a,c),this.m_debugDraw.DrawSegment(p,l,c),this.m_debugDraw.DrawSegment(u,p,c);break;case b2Joint.e_mouseJoint:this.m_debugDraw.DrawSegment(a,l,c);break;default:e!=this.m_groundBody&&this.m_debugDraw.DrawSegment(o,a,c),this.m_debugDraw.DrawSegment(a,l,c),i!=this.m_groundBody&&this.m_debugDraw.DrawSegment(s,l,c)}},Bvf.prototype.DrawShape=function(t,e,i,n){var r=Bvf.s_coreColor;switch(t.m_type){case b2Shape.e_circleShape:var o=t,s=b2Math.b2MulX(e,o.m_localPosition),a=o.m_radius,l=e.R.col1;this.m_debugDraw.DrawSolidCircle(s,a,l,i),n&&this.m_debugDraw.DrawCircle(s,a-b2Settings.b2_toiSlop,r);break;case b2Shape.e_polygonShape:var c=t,h=c.GetVertexCount(),u=c.GetVertices(),p=new Array(b2Settings.b2_maxPolygonVertices);for(_=0;_<h;++_)p[_]=b2Math.b2MulX(e,u[_]);if(this.m_debugDraw.DrawSolidPolygon(p,h,i),n){for(var d=c.GetCoreVertices(),_=0;_<h;++_)p[_]=b2Math.b2MulX(e,d[_]);this.m_debugDraw.DrawPolygon(p,h,r)}}},Bvf.prototype.DrawDebugData=function(){if(null!=this.m_debugDraw){this.m_debugDraw.m_sprite.graphics.clear();var t,e,i,n,r,o=this.m_debugDraw.GetFlags(),s=new b2Vec2,a=new b2Vec2,l=new b2Vec2,c=new b2Color(0,0,0),h=new b2AABB,u=new b2AABB,p=[new b2Vec2,new b2Vec2,new b2Vec2,new b2Vec2];if(o&b2DebugDraw.e_shapeBit)for(var d=(o&b2DebugDraw.e_coreShapeBit)==b2DebugDraw.e_coreShapeBit,_=this.m_bodyList;_;_=_.m_next)for(r=_.m_xf,e=_.GetShapeList();e;e=e.m_next)_.IsStatic()?this.DrawShape(e,r,new b2Color(.5,.9,.5),d):_.IsSleeping()?this.DrawShape(e,r,new b2Color(.5,.5,.9),d):this.DrawShape(e,r,new b2Color(.9,.9,.9),d);if(o&b2DebugDraw.e_jointBit)for(i=this.m_jointList;i;i=i.m_next)this.DrawJoint(i);if(o&b2DebugDraw.e_pairBit)for(n=this.m_broadPhase,s.Set(1/n.m_quantizationFactor.x,1/n.m_quantizationFactor.y),c.Set(.9,.9,.3),t=0;t<b2Pair.b2_tableCapacity;++t)for(var f=n.m_pairManager.m_hashTable[t];f!=b2Pair.b2_nullPair;){var m=n.m_pairManager.m_pairs[f],g=n.m_proxyPool[m.proxyId1],y=n.m_proxyPool[m.proxyId2];h.lowerBound.x=n.m_worldAABB.lowerBound.x+s.x*n.m_bounds[0][g.lowerBounds[0]].value,h.lowerBound.y=n.m_worldAABB.lowerBound.y+s.y*n.m_bounds[1][g.lowerBounds[1]].value,h.upperBound.x=n.m_worldAABB.lowerBound.x+s.x*n.m_bounds[0][g.upperBounds[0]].value,h.upperBound.y=n.m_worldAABB.lowerBound.y+s.y*n.m_bounds[1][g.upperBounds[1]].value,u.lowerBound.x=n.m_worldAABB.lowerBound.x+s.x*n.m_bounds[0][y.lowerBounds[0]].value,u.lowerBound.y=n.m_worldAABB.lowerBound.y+s.y*n.m_bounds[1][y.lowerBounds[1]].value,u.upperBound.x=n.m_worldAABB.lowerBound.x+s.x*n.m_bounds[0][y.upperBounds[0]].value,u.upperBound.y=n.m_worldAABB.lowerBound.y+s.y*n.m_bounds[1][y.upperBounds[1]].value,a.x=.5*(h.lowerBound.x+h.upperBound.x),a.y=.5*(h.lowerBound.y+h.upperBound.y),l.x=.5*(u.lowerBound.x+u.upperBound.x),l.y=.5*(u.lowerBound.y+u.upperBound.y),this.m_debugDraw.DrawSegment(a,l,c),f=m.next}if(o&b2DebugDraw.e_aabbBit){var b=(n=this.m_broadPhase).m_worldAABB.lowerBound,v=n.m_worldAABB.upperBound;for(s.Set(1/n.m_quantizationFactor.x,1/n.m_quantizationFactor.y),c.Set(.9,.3,.9),t=0;t<b2Settings.b2_maxProxies;++t){var x=n.m_proxyPool[t];0!=x.IsValid()&&(h.lowerBound.x=b.x+s.x*n.m_bounds[0][x.lowerBounds[0]].value,h.lowerBound.y=b.y+s.y*n.m_bounds[1][x.lowerBounds[1]].value,h.upperBound.x=b.x+s.x*n.m_bounds[0][x.upperBounds[0]].value,h.upperBound.y=b.y+s.y*n.m_bounds[1][x.upperBounds[1]].value,p[0].Set(h.lowerBound.x,h.lowerBound.y),p[1].Set(h.upperBound.x,h.lowerBound.y),p[2].Set(h.upperBound.x,h.upperBound.y),p[3].Set(h.lowerBound.x,h.upperBound.y),this.m_debugDraw.DrawPolygon(p,4,c))}p[0].Set(b.x,b.y),p[1].Set(v.x,b.y),p[2].Set(v.x,v.y),p[3].Set(b.x,v.y),this.m_debugDraw.DrawPolygon(p,4,new b2Color(.3,.9,.9))}if(o&b2DebugDraw.e_obbBit)for(c.Set(.5,.3,.5),_=this.m_bodyList;_;_=_.m_next)for(r=_.m_xf,e=_.GetShapeList();e;e=e.m_next)if(e.m_type==b2Shape.e_polygonShape){var A=e.GetOBB(),S=A.extents;for(p[0].Set(-S.x,-S.y),p[1].Set(S.x,-S.y),p[2].Set(S.x,S.y),p[3].Set(-S.x,S.y),t=0;t<4;++t){var w=A.R,C=p[t],P=A.center.x+(w.col1.x*C.x+w.col2.x*C.y);p[t].y=A.center.y+(w.col1.y*C.x+w.col2.y*C.y),p[t].x=P,w=r.R,P=r.position.x+(w.col1.x*C.x+w.col2.x*C.y),p[t].y=r.position.y+(w.col1.y*C.x+w.col2.y*C.y),p[t].x=P}this.m_debugDraw.DrawPolygon(p,4,c)}if(o&b2DebugDraw.e_centerOfMassBit)for(_=this.m_bodyList;_;_=_.m_next)(r=Bvf.s_xf).R=_.m_xf.R,r.position=_.GetWorldCenter(),this.m_debugDraw.DrawXForm(r)}},Bvf.s_jointColor=new b2Color(.5,.8,.8),Bvf.s_coreColor=new b2Color(.9,.6,.6),Bvf.s_xf=new b2XForm,Bvf),B2D_LEGACY={b2CircleDef:b2CircleDef,b2CircleShape:b2CircleShape,b2FilterData:b2FilterData,b2MassData:b2MassData,b2PolygonDef:b2PolygonDef,b2PolygonShape:b2PolygonShape,b2Shape:b2Shape,b2ShapeDef:b2ShapeDef,b2AABB:b2AABB,b2Bound:b2Bound,b2BoundValues:b2BoundValues,b2BroadPhase:b2BroadPhase,b2BufferedPair:b2BufferedPair,b2Collision:b2Collision,b2ContactID:b2ContactID,b2ContactPoint:b2ContactPoint,b2Distance:b2Distance,b2Manifold:b2Manifold,b2ManifoldPoint:b2ManifoldPoint,b2OBB:b2OBB,b2Pair:b2Pair,b2PairCallback:b2PairCallback,b2Point:b2Point,b2Proxy:b2Proxy,b2Segment:b2Segment,b2TimeOfImpact:b2TimeOfImpact,ClipVertex:ClipVertex,Features:Features,b2Mat22:b2Mat22,b2Math:b2Math,b2Sweep:b2Sweep,b2Vec2:b2Vec2,b2XForm:b2XForm,b2Color:b2Color,b2Settings:b2Settings,b2CircleContact:b2CircleContact,b2Contact:b2Contact,b2ContactConstraint:b2ContactConstraint,b2ContactConstraintPoint:b2ContactConstraintPoint,b2ContactEdge:b2ContactEdge,b2ContactRegister:b2ContactRegister,b2ContactResult:b2ContactResult,b2ContactSolver:b2ContactSolver,b2NullContact:b2NullContact,b2PolyAndCircleContact:b2PolyAndCircleContact,b2PolygonContact:b2PolygonContact,b2DistanceJoint:b2DistanceJoint,b2DistanceJointDef:b2DistanceJointDef,b2GearJoint:b2GearJoint,b2GearJointDef:b2GearJointDef,b2Jacobian:b2Jacobian,b2Joint:b2Joint,b2JointDef:b2JointDef,b2JointEdge:b2JointEdge,b2MouseJoint:b2MouseJoint,b2MouseJointDef:b2MouseJointDef,b2PrismaticJoint:b2PrismaticJoint,b2PrismaticJointDef:b2PrismaticJointDef,b2PulleyJoint:b2PulleyJoint,b2PulleyJointDef:b2PulleyJointDef,b2RevoluteJoint:b2RevoluteJoint,b2RevoluteJointDef:b2RevoluteJointDef,b2Body:b2Body,b2BodyDef:b2BodyDef,b2BoundaryListener:b2BoundaryListener,b2ContactFilter:b2ContactFilter,b2ContactListener:b2ContactListener,b2ContactManager:b2ContactManager,b2DebugDraw:b2DebugDraw,b2DestructionListener:b2DestructionListener,b2Island:b2Island,b2TimeStep:b2TimeStep,b2World:b2World},b2DistanceInput=function(){this.__fast__=!0},b2Settings$1=(_xf.b2MixFriction=function(t,e){return Math.sqrt(t*e)},_xf.b2MixRestitution=function(t,e){return e<t?t:e},_xf.b2Assert=function(t){if(!t)throw"Assertion Failed"},_xf.VERSION="2.1alpha",_xf.USHRT_MAX=65535,_xf.b2_pi=Math.PI,_xf.b2_maxManifoldPoints=2,_xf.b2_aabbExtension=.1,_xf.b2_aabbMultiplier=2,_xf.b2_polygonRadius=2*(_xf.b2_linearSlop=.005),_xf.b2_angularSlop=2/180*_xf.b2_pi,_xf.b2_toiSlop=8*_xf.b2_linearSlop,_xf.b2_maxTOIContactsPerIsland=32,_xf.b2_maxTOIJointsPerIsland=32,_xf.b2_velocityThreshold=1,_xf.b2_maxLinearCorrection=.2,_xf.b2_maxAngularCorrection=8/180*_xf.b2_pi,_xf.b2_maxTranslationSquared=(_xf.b2_maxTranslation=2)*_xf.b2_maxTranslation,_xf.b2_maxRotationSquared=(_xf.b2_maxRotation=.5*_xf.b2_pi)*_xf.b2_maxRotation,_xf.b2_contactBaumgarte=.2,_xf.b2_timeToSleep=.5,_xf.b2_linearSleepTolerance=.01,_xf.b2_angularSleepTolerance=2/180*_xf.b2_pi,_xf),b2DistanceProxy=(fyf.prototype.Set=function(t){switch(t.GetType()){case b2Shape$1.e_circleShape:var e=t;this.m_vertices=new Array(1),this.m_vertices[0]=e.m_p,this.m_count=1,this.m_radius=e.m_radius;break;case b2Shape$1.e_polygonShape:var i=t;this.m_vertices=i.m_vertices,this.m_count=i.m_vertexCount,this.m_radius=i.m_radius;break;default:b2Settings$1.b2Assert(!1)}},fyf.prototype.GetSupport=function(t){for(var e=0,i=this.m_vertices[0].x*t.x+this.m_vertices[0].y*t.y,n=1;n<this.m_count;++n){var r=this.m_vertices[n].x*t.x+this.m_vertices[n].y*t.y;i<r&&(e=n,i=r)}return e},fyf.prototype.GetSupportVertex=function(t){for(var e=0,i=this.m_vertices[0].x*t.x+this.m_vertices[0].y*t.y,n=1;n<this.m_count;++n){var r=this.m_vertices[n].x*t.x+this.m_vertices[n].y*t.y;i<r&&(e=n,i=r)}return this.m_vertices[e]},fyf.prototype.GetVertexCount=function(){return this.m_count},fyf.prototype.GetVertex=function(t){return b2Settings$1.b2Assert(0<=t&&t<this.m_count),this.m_vertices[t]},fyf),b2SimplexCache=function(){this.__fast__=!0,this.indexA=new Array(3),this.indexB=new Array(3)},b2Mat22$1=(uyf.FromAngle=function(t){var e=new uyf;return e.Set(t),e},uyf.FromVV=function(t,e){var i=new uyf;return i.SetVV(t,e),i},uyf.prototype.Set=function(t){var e=Math.cos(t),i=Math.sin(t);this.col1.x=e,this.col2.x=-i,this.col1.y=i,this.col2.y=e},uyf.prototype.SetVV=function(t,e){this.col1.SetV(t),this.col2.SetV(e)},uyf.prototype.Copy=function(){var t=new uyf;return t.SetM(this),t},uyf.prototype.SetM=function(t){this.col1.SetV(t.col1||t.$Bgcol1),this.col2.SetV(t.col2||t.$Bgcol2)},uyf.prototype.AddM=function(t){this.col1.x+=t.col1.x,this.col1.y+=t.col1.y,this.col2.x+=t.col2.x,this.col2.y+=t.col2.y},uyf.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col1.y=0,this.col2.y=1},uyf.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col1.y=0,this.col2.y=0},uyf.prototype.GetAngle=function(){return Math.atan2(this.col1.y,this.col1.x)},uyf.prototype.GetInverse=function(t){var e=this.col1.x,i=this.col2.x,n=this.col1.y,r=this.col2.y,o=e*r-i*n;return 0!=o&&(o=1/o),t.col1.x=o*r,t.col2.x=-o*i,t.col1.y=-o*n,t.col2.y=o*e,t},uyf.prototype.Solve=function(t,e,i){var n=this.col1.x,r=this.col2.x,o=this.col1.y,s=this.col2.y,a=n*s-r*o;return 0!=a&&(a=1/a),t.x=a*(s*e-r*i),t.y=a*(n*i-o*e),t},uyf.prototype.Abs=function(){this.col1.Abs(),this.col2.Abs()},uyf),b2Mat33=(Wyf.prototype.SetVVV=function(t,e,i){this.col1.SetV(t),this.col2.SetV(e),this.col3.SetV(i)},Wyf.prototype.Copy=function(){return new Wyf(this.col1,this.col2,this.col3)},Wyf.prototype.SetM=function(t){this.col1.SetV(t.col1),this.col2.SetV(t.col2),this.col3.SetV(t.col3)},Wyf.prototype.AddM=function(t){this.col1.x+=t.col1.x,this.col1.y+=t.col1.y,this.col1.z+=t.col1.z,this.col2.x+=t.col2.x,this.col2.y+=t.col2.y,this.col2.z+=t.col2.z,this.col3.x+=t.col3.x,this.col3.y+=t.col3.y,this.col3.z+=t.col3.z},Wyf.prototype.SetIdentity=function(){this.col1.x=1,this.col2.x=0,this.col3.x=0,this.col1.y=0,this.col2.y=1,this.col3.y=0,this.col1.z=0,this.col2.z=0,this.col3.z=1},Wyf.prototype.SetZero=function(){this.col1.x=0,this.col2.x=0,this.col3.x=0,this.col1.y=0,this.col2.y=0,this.col3.y=0,this.col1.z=0,this.col2.z=0,this.col3.z=0},Wyf.prototype.Solve22=function(t,e,i){var n=this.col1.x,r=this.col2.x,o=this.col1.y,s=this.col2.y,a=n*s-r*o;return 0!=a&&(a=1/a),t.x=a*(s*e-r*i),t.y=a*(n*i-o*e),t},Wyf.prototype.Solve33=function(t,e,i,n){var r=this.col1.x,o=this.col1.y,s=this.col1.z,a=this.col2.x,l=this.col2.y,c=this.col2.z,h=this.col3.x,u=this.col3.y,p=this.col3.z,d=r*(l*p-c*u)+o*(c*h-a*p)+s*(a*u-l*h);return 0!=d&&(d=1/d),t.x=d*(e*(l*p-c*u)+i*(c*h-a*p)+n*(a*u-l*h)),t.y=d*(r*(i*p-n*u)+o*(n*h-e*p)+s*(e*u-i*h)),t.z=d*(r*(l*n-c*i)+o*(c*e-a*n)+s*(a*i-l*e)),t},Wyf),b2Sweep$1=(zzf.prototype.Set=function(t){this.localCenter.SetV(t.localCenter),this.c0.SetV(t.c0),this.c.SetV(t.c),this.a0=t.a0,this.a=t.a,this.t0=t.t0},zzf.prototype.Copy=function(){var t=new zzf;return t.localCenter.SetV(this.localCenter),t.c0.SetV(this.c0),t.c.SetV(this.c),t.a0=this.a0,t.a=this.a,t.t0=this.t0,t},zzf.prototype.GetTransform=function(t,e){t.position.x=(1-e)*this.c0.x+e*this.c.x,t.position.y=(1-e)*this.c0.y+e*this.c.y;var i=(1-e)*this.a0+e*this.a;t.R.Set(i);var n=t.R;t.position.x-=n.col1.x*this.localCenter.x+n.col2.x*this.localCenter.y,t.position.y-=n.col1.y*this.localCenter.x+n.col2.y*this.localCenter.y},zzf.prototype.Advance=function(t){var e;this.t0<t&&1-this.t0>Number.MIN_VALUE&&(e=(t-this.t0)/(1-this.t0),this.c0.x=(1-e)*this.c0.x+e*this.c.x,this.c0.y=(1-e)*this.c0.y+e*this.c.y,this.a0=(1-e)*this.a0+e*this.a,this.t0=t)},zzf),b2Transform=(Izf.prototype.Initialize=function(t,e){this.position.SetV(t),this.R.SetM(e)},Izf.prototype.SetIdentity=function(){this.position.SetZero(),this.R.SetIdentity()},Izf.prototype.Set=function(t){this.position.SetV(t.position),this.R.SetM(t.R)},Izf.prototype.GetAngle=function(){return Math.atan2(this.R.col1.y,this.R.col1.x)},Izf),b2Vec2$1=(Ozf.prototype.SetZero=function(){this.x=0,this.y=0},Ozf.prototype.Set=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.x=t,this.y=e},Ozf.prototype.SetV=function(t){this.x=t.x,this.y=t.y},Ozf.prototype.GetNegative=function(){return new Ozf(-this.x,-this.y)},Ozf.prototype.NegativeSelf=function(){this.x=-this.x,this.y=-this.y},Ozf.Make=function(t,e){return new Ozf(t,e)},Ozf.prototype.Copy=function(){return new Ozf(this.x,this.y)},Ozf.prototype.Add=function(t){this.x+=t.x,this.y+=t.y},Ozf.prototype.Subtract=function(t){this.x-=t.x,this.y-=t.y},Ozf.prototype.Multiply=function(t){this.x*=t,this.y*=t},Ozf.prototype.MulM=function(t){var e=this.x;this.x=t.col1.x*e+t.col2.x*this.y,this.y=t.col1.y*e+t.col2.y*this.y},Ozf.prototype.MulTM=function(t){var e=b2Math$1.Dot(this,t.col1);this.y=b2Math$1.Dot(this,t.col2),this.x=e},Ozf.prototype.CrossVF=function(t){var e=this.x;this.x=t*this.y,this.y=-t*e},Ozf.prototype.CrossFV=function(t){var e=this.x;this.x=-t*this.y,this.y=t*e},Ozf.prototype.MinV=function(t){this.x=this.x<t.x?this.x:t.x,this.y=this.y<t.y?this.y:t.y},Ozf.prototype.MaxV=function(t){this.x=this.x>t.x?this.x:t.x,this.y=this.y>t.y?this.y:t.y},Ozf.prototype.Abs=function(){this.x<0&&(this.x=-this.x),this.y<0&&(this.y=-this.y)},Ozf.prototype.Length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},Ozf.prototype.LengthSquared=function(){return this.x*this.x+this.y*this.y},Ozf.prototype.Normalize=function(){var t=Math.sqrt(this.x*this.x+this.y*this.y);if(t<Number.MIN_VALUE)return 0;var e=1/t;return this.x*=e,this.y*=e,t},Ozf.prototype.IsValid=function(){return b2Math$1.IsValid(this.x)&&b2Math$1.IsValid(this.y)},Ozf),b2Vec3=(jAf.prototype.SetZero=function(){this.x=this.y=this.z=0},jAf.prototype.Set=function(t,e,i){this.x=t,this.y=e,this.z=i},jAf.prototype.SetV=function(t){this.x=t.x,this.y=t.y,this.z=t.z},jAf.prototype.GetNegative=function(){return new jAf(-this.x,-this.y,-this.z)},jAf.prototype.NegativeSelf=function(){this.x=-this.x,this.y=-this.y,this.z=-this.z},jAf.prototype.Copy=function(){return new jAf(this.x,this.y,this.z)},jAf.prototype.Add=function(t){this.x+=t.x,this.y+=t.y,this.z+=t.z},jAf.prototype.Subtract=function(t){this.x-=t.x,this.y-=t.y,this.z-=t.z},jAf.prototype.Multiply=function(t){this.x*=t,this.y*=t,this.z*=t},jAf),b2Math$1=(uAf.IsValid=function(t){return isFinite(t)},uAf.Dot=function(t,e){return t.x*e.x+t.y*e.y},uAf.CrossVV=function(t,e){return t.x*e.y-t.y*e.x},uAf.CrossVF=function(t,e){return new b2Vec2$1(e*t.y,-e*t.x)},uAf.CrossFV=function(t,e){return new b2Vec2$1(-t*e.y,t*e.x)},uAf.MulMV=function(t,e){return new b2Vec2$1(t.col1.x*e.x+t.col2.x*e.y,t.col1.y*e.x+t.col2.y*e.y)},uAf.MulTMV=function(t,e){return new b2Vec2$1(this.Dot(e,t.col1),this.Dot(e,t.col2))},uAf.MulX=function(t,e){var i=this.MulMV(t.R,e);return i.x+=t.position.x,i.y+=t.position.y,i},uAf.MulXT=function(t,e){var i=this.SubtractVV(e,t.position),n=i.x*t.R.col1.x+i.y*t.R.col1.y;return i.y=i.x*t.R.col2.x+i.y*t.R.col2.y,i.x=n,i},uAf.AddVV=function(t,e){return new b2Vec2$1(t.x+e.x,t.y+e.y)},uAf.SubtractVV=function(t,e){return new b2Vec2$1(t.x-e.x,t.y-e.y)},uAf.Distance=function(t,e){var i=t.x-e.x,n=t.y-e.y;return Math.sqrt(i*i+n*n)},uAf.DistanceSquared=function(t,e){var i=t.x-e.x,n=t.y-e.y;return i*i+n*n},uAf.MulFV=function(t,e){return new b2Vec2$1(t*e.x,t*e.y)},uAf.AddMM=function(t,e){return b2Mat22$1.FromVV(this.AddVV(t.col1,e.col1),this.AddVV(t.col2,e.col2))},uAf.MulMM=function(t,e){return b2Mat22$1.FromVV(this.MulMV(t,e.col1),this.MulMV(t,e.col2))},uAf.MulTMM=function(t,e){var i=new b2Vec2$1(this.Dot(t.col1,e.col1),this.Dot(t.col2,e.col1)),n=new b2Vec2$1(this.Dot(t.col1,e.col2),this.Dot(t.col2,e.col2));return b2Mat22$1.FromVV(i,n)},uAf.Abs=function(t){return 0<t?t:-t},uAf.AbsV=function(t){return new b2Vec2$1(this.Abs(t.x),this.Abs(t.y))},uAf.AbsM=function(t){return b2Mat22$1.FromVV(this.AbsV(t.col1),this.AbsV(t.col2))},uAf.Min=function(t,e){return t<e?t:e},uAf.MinV=function(t,e){return new b2Vec2$1(this.Min(t.x,e.x),this.Min(t.y,e.y))},uAf.Max=function(t,e){return e<t?t:e},uAf.MaxV=function(t,e){return new b2Vec2$1(this.Max(t.x,e.x),this.Max(t.y,e.y))},uAf.Clamp=function(t,e,i){return t<e?e:i<t?i:t},uAf.ClampV=function(t,e,i){return this.MaxV(e,this.MinV(t,i))},uAf.Swap=function(t,e){var i=t[0];t[0]=e[0],e[0]=i},uAf.Random=function(){return 2*Math.random()-1},uAf.RandomRange=function(t,e){var i=Math.random();return(e-t)*i+t},uAf.NextPowerOfTwo=function(t){return t|=t>>1&2147483647,t|=t>>2&1073741823,t|=t>>4&268435455,t|=t>>8&16777215,1+(t|=t>>16&65535)},uAf.IsPowerOfTwo=function(t){return 0<t&&0==(t&t-1)},uAf.b2Vec2_zero=new b2Vec2$1(0,0),uAf.b2Mat22_identity=b2Mat22$1.FromVV(new b2Vec2$1(1,0),new b2Vec2$1(0,1)),uAf.b2Transform_identity=new b2Transform(uAf.b2Vec2_zero,uAf.b2Mat22_identity),uAf),b2DistanceOutput=function(){this.__fast__=!0,this.pointA=new b2Vec2$1,this.pointB=new b2Vec2$1},b2SimplexVertex=(IBf.prototype.Set=function(t){this.wA.SetV(t.wA),this.wB.SetV(t.wB),this.w.SetV(t.w),this.a=t.a,this.indexA=t.indexA,this.indexB=t.indexB},IBf),b2Simplex=(KBf.prototype.ReadCache=function(t,e,i,n,r){var o,s;b2Settings$1.b2Assert(0<=t.count&&t.count<=3),this.m_count=t.count;for(var a,l,c=this.m_vertices,h=0;h<this.m_count;h++){var u=c[h];u.indexA=t.indexA[h],u.indexB=t.indexB[h],o=e.GetVertex(u.indexA),s=n.GetVertex(u.indexB),u.wA=b2Math$1.MulX(i,o),u.wB=b2Math$1.MulX(r,s),u.w=b2Math$1.SubtractVV(u.wB,u.wA),u.a=0}1<this.m_count&&(a=t.metric,((l=this.GetMetric())<.5*a||2*a<l||l<Number.MIN_VALUE)&&(this.m_count=0)),0==this.m_count&&((u=c[0]).indexA=0,u.indexB=0,o=e.GetVertex(0),s=n.GetVertex(0),u.wA=b2Math$1.MulX(i,o),u.wB=b2Math$1.MulX(r,s),u.w=b2Math$1.SubtractVV(u.wB,u.wA),this.m_count=1)},KBf.prototype.WriteCache=function(t){t.metric=this.GetMetric(),t.count=this.m_count>>>0;for(var e=this.m_vertices,i=0;i<this.m_count;i++)t.indexA[i]=e[i].indexA,t.indexB[i]=e[i].indexB},KBf.prototype.GetSearchDirection=function(){switch(this.m_count){case 1:return this.m_v1.w.GetNegative();case 2:var t=b2Math$1.SubtractVV(this.m_v2.w,this.m_v1.w);return 0<b2Math$1.CrossVV(t,this.m_v1.w.GetNegative())?b2Math$1.CrossFV(1,t):b2Math$1.CrossVF(t,1);default:return b2Settings$1.b2Assert(!1),new b2Vec2$1}},KBf.prototype.GetClosestPoint=function(){switch(this.m_count){case 0:return b2Settings$1.b2Assert(!1),new b2Vec2$1;case 1:return this.m_v1.w;case 2:return new b2Vec2$1(this.m_v1.a*this.m_v1.w.x+this.m_v2.a*this.m_v2.w.x,this.m_v1.a*this.m_v1.w.y+this.m_v2.a*this.m_v2.w.y);default:return b2Settings$1.b2Assert(!1),new b2Vec2$1}},KBf.prototype.GetWitnessPoints=function(t,e){switch(this.m_count){case 0:b2Settings$1.b2Assert(!1);break;case 1:t.SetV(this.m_v1.wA),e.SetV(this.m_v1.wB);break;case 2:t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x,t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y,e.x=this.m_v1.a*this.m_v1.wB.x+this.m_v2.a*this.m_v2.wB.x,e.y=this.m_v1.a*this.m_v1.wB.y+this.m_v2.a*this.m_v2.wB.y;break;case 3:e.x=t.x=this.m_v1.a*this.m_v1.wA.x+this.m_v2.a*this.m_v2.wA.x+this.m_v3.a*this.m_v3.wA.x,e.y=t.y=this.m_v1.a*this.m_v1.wA.y+this.m_v2.a*this.m_v2.wA.y+this.m_v3.a*this.m_v3.wA.y;break;default:b2Settings$1.b2Assert(!1)}},KBf.prototype.GetMetric=function(){switch(this.m_count){case 0:return b2Settings$1.b2Assert(!1),0;case 1:return 0;case 2:return b2Math$1.SubtractVV(this.m_v1.w,this.m_v2.w).Length();case 3:return b2Math$1.CrossVV(b2Math$1.SubtractVV(this.m_v2.w,this.m_v1.w),b2Math$1.SubtractVV(this.m_v3.w,this.m_v1.w));default:return b2Settings$1.b2Assert(!1),0}},KBf.prototype.Solve2=function(){var t=this.m_v1.w,e=this.m_v2.w,i=b2Math$1.SubtractVV(e,t),n=-(t.x*i.x+t.y*i.y);if(n<=0)return this.m_v1.a=1,void(this.m_count=1);var r=e.x*i.x+e.y*i.y;if(r<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Set(this.m_v2);var o=1/(r+n);this.m_v1.a=r*o,this.m_v2.a=n*o,this.m_count=2},KBf.prototype.Solve3=function(){var t=this.m_v1.w,e=this.m_v2.w,i=this.m_v3.w,n=b2Math$1.SubtractVV(e,t),r=b2Math$1.Dot(t,n),o=b2Math$1.Dot(e,n),s=-r,a=b2Math$1.SubtractVV(i,t),l=b2Math$1.Dot(t,a),c=b2Math$1.Dot(i,a),h=-l,u=b2Math$1.SubtractVV(i,e),p=b2Math$1.Dot(e,u),d=b2Math$1.Dot(i,u),_=-p,f=b2Math$1.CrossVV(n,a),m=f*b2Math$1.CrossVV(e,i),g=f*b2Math$1.CrossVV(i,t),y=f*b2Math$1.CrossVV(t,e);if(s<=0&&h<=0)return this.m_v1.a=1,void(this.m_count=1);if(0<o&&0<s&&y<=0){var b=1/(o+s);return this.m_v1.a=o*b,this.m_v2.a=s*b,void(this.m_count=2)}if(0<c&&0<h&&g<=0){var v=1/(c+h);return this.m_v1.a=c*v,this.m_v3.a=h*v,this.m_count=2,void this.m_v2.Set(this.m_v3)}if(o<=0&&_<=0)return this.m_v2.a=1,this.m_count=1,void this.m_v1.Set(this.m_v2);if(c<=0&&d<=0)return this.m_v3.a=1,this.m_count=1,void this.m_v1.Set(this.m_v3);if(0<d&&0<_&&m<=0){var x=1/(d+_);return this.m_v2.a=d*x,this.m_v3.a=_*x,this.m_count=2,void this.m_v1.Set(this.m_v3)}var A=1/(m+g+y);this.m_v1.a=m*A,this.m_v2.a=g*A,this.m_v3.a=y*A,this.m_count=3},KBf),b2Distance$1=(ECf.Distance=function(t,e,i){++this.b2_gjkCalls;var n=i.proxyA,r=i.proxyB,o=i.transformA,s=i.transformB,a=this.s_simplex;a.ReadCache(e,n,o,r,s);for(var l,c,h,u,p=a.m_vertices,d=this.s_saveA,_=this.s_saveB,f=0,m=(a.GetClosestPoint().LengthSquared(),0);m<20;){for(f=a.m_count,v=0;v<f;v++)d[v]=p[v].indexA,_[v]=p[v].indexB;switch(a.m_count){case 1:break;case 2:a.Solve2();break;case 3:a.Solve3();break;default:b2Settings$1.b2Assert(!1)}if(3==a.m_count)break;(l=a.GetClosestPoint()).LengthSquared();var g=a.GetSearchDirection();if(g.LengthSquared()<Number.MIN_VALUE*Number.MIN_VALUE)break;var y=p[a.m_count];y.indexA=n.GetSupport(b2Math$1.MulTMV(o.R,g.GetNegative())),y.wA=b2Math$1.MulX(o,n.GetVertex(y.indexA)),y.indexB=r.GetSupport(b2Math$1.MulTMV(s.R,g)),y.wB=b2Math$1.MulX(s,r.GetVertex(y.indexB)),y.w=b2Math$1.SubtractVV(y.wB,y.wA),++m,++this.b2_gjkIters;for(var b=!1,v=0;v<f;v++)if(y.indexA==d[v]&&y.indexB==_[v]){b=!0;break}if(b)break;++a.m_count}this.b2_gjkMaxIters=b2Math$1.Max(this.b2_gjkMaxIters,m),a.GetWitnessPoints(t.pointA,t.pointB),t.distance=b2Math$1.SubtractVV(t.pointA,t.pointB).Length(),t.iterations=m,a.WriteCache(e),i.useRadii&&(c=n.m_radius,h=r.m_radius,t.distance>c+h&&t.distance>Number.MIN_VALUE?(t.distance-=c+h,(u=b2Math$1.SubtractVV(t.pointB,t.pointA)).Normalize(),t.pointA.x+=c*u.x,t.pointA.y+=c*u.y,t.pointB.x-=h*u.x,t.pointB.y-=h*u.y):((l=new b2Vec2$1).x=.5*(t.pointA.x+t.pointB.x),l.y=.5*(t.pointA.y+t.pointB.y),t.pointA.x=t.pointB.x=l.x,t.pointA.y=t.pointB.y=l.y,t.distance=0))},ECf.s_simplex=new b2Simplex,ECf.s_saveA=new Array(3),ECf.s_saveB=new Array(3),ECf),b2Shape$1=($Cf.prototype.Copy=function(){return null},$Cf.prototype.Set=function(t){this.m_radius=t.m_radius},$Cf.prototype.GetType=function(){return this.m_type},$Cf.prototype.TestPoint=function(t,e){return!1},$Cf.prototype.RayCast=function(t,e,i){return!1},$Cf.prototype.ComputeAABB=function(t,e){},$Cf.prototype.ComputeMass=function(t,e){},$Cf.prototype.ComputeSubmergedArea=function(t,e,i,n){return 0},$Cf.TestOverlap=function(t,e,i,n){var r=new b2DistanceInput;r.proxyA=new b2DistanceProxy,r.proxyA.Set(t),r.proxyB=new b2DistanceProxy,r.proxyB.Set(i),r.transformA=e,r.transformB=n,r.useRadii=!0;var o=new b2SimplexCache;o.count=0;var s=new b2DistanceOutput;return b2Distance$1.Distance(s,o,r),s.distance<10*Number.MIN_VALUE},$Cf.e_unknownShape=-1,$Cf.e_circleShape=0,$Cf.e_polygonShape=1,$Cf.e_edgeShape=2,$Cf.e_shapeTypeCount=3,$Cf.e_hitCollide=1,$Cf.e_missCollide=0,$Cf.e_startsInsideCollide=-1,$Cf),b2CircleShape$1=(uDf=b2Shape$1,__extends(vDf,uDf),vDf.prototype.Copy=function(){var t=new vDf;return t.Set(this),t},vDf.prototype.Set=function(t){uDf.prototype.Set.call(this,t),t instanceof vDf&&this.m_p.SetV(t.m_p)},vDf.prototype.TestPoint=function(t,e){var i=t.R,n=t.position.x+(i.col1.x*this.m_p.x+i.col2.x*this.m_p.y),r=t.position.y+(i.col1.y*this.m_p.x+i.col2.y*this.m_p.y);return(n=e.x-n)*n+(r=e.y-r)*r<=this.m_radius*this.m_radius},vDf.prototype.RayCast=function(t,e,i){var n=i.R,r=i.position.x+(n.col1.x*this.m_p.x+n.col2.x*this.m_p.y),o=i.position.y+(n.col1.y*this.m_p.x+n.col2.y*this.m_p.y),s=e.p1.x-r,a=e.p1.y-o,l=s*s+a*a-this.m_radius*this.m_radius,c=e.p2.x-e.p1.x,h=e.p2.y-e.p1.y,u=s*c+a*h,p=c*c+h*h,d=u*u-p*l;if(d<0||p<Number.MIN_VALUE)return!1;var _=-(u+Math.sqrt(d));return 0<=_&&_<=e.maxFraction*p&&(_/=p,t.fraction=_,t.normal.x=s+_*c,t.normal.y=a+_*h,t.normal.Normalize(),!0)},vDf.prototype.ComputeAABB=function(t,e){var i=e.R,n=e.position.x+(i.col1.x*this.m_p.x+i.col2.x*this.m_p.y),r=e.position.y+(i.col1.y*this.m_p.x+i.col2.y*this.m_p.y);t.lowerBound.Set(n-this.m_radius,r-this.m_radius),t.upperBound.Set(n+this.m_radius,r+this.m_radius)},vDf.prototype.ComputeMass=function(t,e){t.mass=e*b2Settings$1.b2_pi*this.m_radius*this.m_radius,t.center.SetV(this.m_p),t.I=t.mass*(.5*this.m_radius*this.m_radius+(this.m_p.x*this.m_p.x+this.m_p.y*this.m_p.y))},vDf.prototype.ComputeSubmergedArea=function(t,e,i,n){var r=b2Math$1.MulX(i,this.m_p),o=-(b2Math$1.Dot(t,r)-e);if(o<-this.m_radius+Number.MIN_VALUE)return 0;if(o>this.m_radius)return n.SetV(r),Math.PI*this.m_radius*this.m_radius;var s=this.m_radius*this.m_radius,a=o*o,l=s*(Math.asin(o/this.m_radius)+Math.PI/2)+o*Math.sqrt(s-a),c=-2/3*Math.pow(s-a,1.5)/l;return n.x=r.x+t.x*c,n.y=r.y+t.y*c,l},vDf.prototype.GetLocalPosition=function(){return this.m_p},vDf.prototype.SetLocalPosition=function(t){this.m_p.SetV(t)},vDf.prototype.GetRadius=function(){return this.m_radius},vDf.prototype.SetRadius=function(t){this.m_radius=t},vDf),b2EdgeShape=(mEf=b2Shape$1,__extends(nEf,mEf),nEf.prototype.TestPoint=function(t,e){return!1},nEf.prototype.RayCast=function(t,e,i){var n=e.p2.x-e.p1.x,r=e.p2.y-e.p1.y,o=i.R,s=i.position.x+(o.col1.x*this.m_v1.x+o.col2.x*this.m_v1.y),a=i.position.y+(o.col1.y*this.m_v1.x+o.col2.y*this.m_v1.y),l=i.position.y+(o.col1.y*this.m_v2.x+o.col2.y*this.m_v2.y)-a,c=-(i.position.x+(o.col1.x*this.m_v2.x+o.col2.x*this.m_v2.y)-s),h=100*Number.MIN_VALUE,u=-(n*l+r*c);if(h<u){var p=e.p1.x-s,d=e.p1.y-a,_=p*l+d*c;if(0<=_&&_<=e.maxFraction*u){var f=-n*d+r*p;if(-h*u<=f&&f<=u*(1+h)){_/=u,t.fraction=_;var m=Math.sqrt(l*l+c*c);return t.normal.x=l/m,t.normal.y=c/m,!0}}}return!1},nEf.prototype.ComputeAABB=function(t,e){var i=e.R,n=e.position.x+(i.col1.x*this.m_v1.x+i.col2.x*this.m_v1.y),r=e.position.y+(i.col1.y*this.m_v1.x+i.col2.y*this.m_v1.y),o=e.position.x+(i.col1.x*this.m_v2.x+i.col2.x*this.m_v2.y),s=e.position.y+(i.col1.y*this.m_v2.x+i.col2.y*this.m_v2.y);n<o?(t.lowerBound.x=n,t.upperBound.x=o):(t.lowerBound.x=o,t.upperBound.x=n),r<s?(t.lowerBound.y=r,t.upperBound.y=s):(t.lowerBound.y=s,t.upperBound.y=r)},nEf.prototype.ComputeMass=function(t,e){t.mass=0,t.center.SetV(this.m_v1),t.I=0},nEf.prototype.ComputeSubmergedArea=function(t,e,i,n){var r=new b2Vec2$1(t.x*e,t.y*e),o=b2Math$1.MulX(i,this.m_v1),s=b2Math$1.MulX(i,this.m_v2),a=b2Math$1.Dot(t,o)-e,l=b2Math$1.Dot(t,s)-e;if(0<a){if(0<l)return 0;o.x=-l/(a-l)*o.x+a/(a-l)*s.x,o.y=-l/(a-l)*o.y+a/(a-l)*s.y}else 0<l&&(s.x=-l/(a-l)*o.x+a/(a-l)*s.x,s.y=-l/(a-l)*o.y+a/(a-l)*s.y);return n.x=(r.x+o.x+s.x)/3,n.y=(r.y+o.y+s.y)/3,.5*((o.x-r.x)*(s.y-r.y)-(o.y-r.y)*(s.x-r.x))},nEf.prototype.GetLength=function(){return this.m_length},nEf.prototype.GetVertex1=function(){return this.m_v1},nEf.prototype.GetVertex2=function(){return this.m_v2},nEf.prototype.GetCoreVertex1=function(){return this.m_coreV1},nEf.prototype.GetCoreVertex2=function(){return this.m_coreV2},nEf.prototype.GetNormalVector=function(){return this.m_normal},nEf.prototype.GetDirectionVector=function(){return this.m_direction},nEf.prototype.GetCorner1Vector=function(){return this.m_cornerDir1},nEf.prototype.GetCorner2Vector=function(){return this.m_cornerDir2},nEf.prototype.Corner1IsConvex=function(){return this.m_cornerConvex1},nEf.prototype.Corner2IsConvex=function(){return this.m_cornerConvex2},nEf.prototype.GetFirstVertex=function(t){var e=t.R;return new b2Vec2$1(t.position.x+(e.col1.x*this.m_coreV1.x+e.col2.x*this.m_coreV1.y),t.position.y+(e.col1.y*this.m_coreV1.x+e.col2.y*this.m_coreV1.y))},nEf.prototype.GetNextEdge=function(){return this.m_nextEdge},nEf.prototype.GetPrevEdge=function(){return this.m_prevEdge},nEf.prototype.Support=function(t,e,i){var n=t.R,r=t.position.x+(n.col1.x*this.m_coreV1.x+n.col2.x*this.m_coreV1.y),o=t.position.y+(n.col1.y*this.m_coreV1.x+n.col2.y*this.m_coreV1.y),s=t.position.x+(n.col1.x*this.m_coreV2.x+n.col2.x*this.m_coreV2.y),a=t.position.y+(n.col1.y*this.m_coreV2.x+n.col2.y*this.m_coreV2.y);return s*e+a*i<r*e+o*i?(this.s_supportVec.x=r,this.s_supportVec.y=o):(this.s_supportVec.x=s,this.s_supportVec.y=a),this.s_supportVec},nEf.prototype.SetPrevEdge=function(t,e,i,n){this.m_prevEdge=t,this.m_coreV1=e,this.m_cornerDir1=i,this.m_cornerConvex1=n},nEf.prototype.SetNextEdge=function(t,e,i,n){this.m_nextEdge=t,this.m_coreV2=e,this.m_cornerDir2=i,this.m_cornerConvex2=n},nEf),b2MassData$1=function(){this.mass=0,this.center=new b2Vec2$1(0,0),this.I=0},b2PolygonShape$1=(sFf=b2Shape$1,__extends(tFf,sFf),tFf.prototype.Copy=function(){var t=new tFf;return t.Set(this),t},tFf.prototype.Set=function(t){if(sFf.prototype.Set.call(this,t),t instanceof tFf){var e=t;this.m_centroid.SetV(e.m_centroid),this.m_vertexCount=e.m_vertexCount,this.Reserve(this.m_vertexCount);for(var i=0;i<this.m_vertexCount;i++)this.m_vertices[i].SetV(e.m_vertices[i]),this.m_normals[i].SetV(e.m_normals[i])}},tFf.prototype.SetAsArray=function(t,e){void 0===e&&(e=0);var i=t;"function"==typeof i.axInitializer&&(i=t.value);var n=i.slice();this.SetAsVector(n,e)},tFf.AsArray=function(t,e){var i=new tFf;return i.SetAsArray(t,e),i},tFf.prototype.SetAsVector=function(t,e){var i;for(void 0===e&&(e=0),0==e&&(e=t.length),b2Settings$1.b2Assert(2<=e),this.m_vertexCount=e,this.Reserve(e),i=0;i<this.m_vertexCount;i++)this.m_vertices[i].SetV(t[i]);for(i=0;i<this.m_vertexCount;++i){var n=i+1<this.m_vertexCount?i+1:0,r=b2Math$1.SubtractVV(this.m_vertices[n],this.m_vertices[i]);b2Settings$1.b2Assert(r.LengthSquared()>Number.MIN_VALUE),this.m_normals[i].SetV(b2Math$1.CrossVF(r,1)),this.m_normals[i].Normalize()}this.m_centroid=tFf.ComputeCentroid(this.m_vertices,this.m_vertexCount)},tFf.AsVector=function(t,e){var i=new tFf;return i.SetAsVector(t,e),i},tFf.prototype.SetAsBox=function(t,e){this.m_vertexCount=4,this.Reserve(4),this.m_vertices[0].Set(-t,-e),this.m_vertices[1].Set(t,-e),this.m_vertices[2].Set(t,e),this.m_vertices[3].Set(-t,e),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid.SetZero()},tFf.AsBox=function(t,e){var i=new tFf;return i.SetAsBox(t,e),i},tFf.prototype.SetAsOrientedBox=function(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=0),this.m_vertexCount=4,this.Reserve(4),this.m_vertices[0].Set(-t,-e),this.m_vertices[1].Set(t,-e),this.m_vertices[2].Set(t,e),this.m_vertices[3].Set(-t,e),this.m_normals[0].Set(0,-1),this.m_normals[1].Set(1,0),this.m_normals[2].Set(0,1),this.m_normals[3].Set(-1,0),this.m_centroid=i;var r=new b2Transform;r.position=i,r.R.Set(n);for(var o=0;o<this.m_vertexCount;++o)this.m_vertices[o]=b2Math$1.MulX(r,this.m_vertices[o]),this.m_normals[o]=b2Math$1.MulMV(r.R,this.m_normals[o])},tFf.AsOrientedBox=function(t,e,i,n){void 0===i&&(i=null),void 0===n&&(n=0);var r=new tFf;return r.SetAsOrientedBox(t,e,i,n),r},tFf.prototype.SetAsEdge=function(t,e){this.m_vertexCount=2,this.Reserve(2),this.m_vertices[0].SetV(t),this.m_vertices[1].SetV(e),this.m_centroid.x=.5*(t.x+e.x),this.m_centroid.y=.5*(t.y+e.y),this.m_normals[0]=b2Math$1.CrossVF(b2Math$1.SubtractVV(e,t),1),this.m_normals[0].Normalize(),this.m_normals[1].x=-this.m_normals[0].x,this.m_normals[1].y=-this.m_normals[0].y},tFf.AsEdge=function(t,e){var i=new tFf;return i.SetAsEdge(t,e),i},tFf.prototype.TestPoint=function(t,e){for(var i,n=t.R,r=e.x-t.position.x,o=e.y-t.position.y,s=r*n.col1.x+o*n.col1.y,a=r*n.col2.x+o*n.col2.y,l=0;l<this.m_vertexCount;++l)if(r=s-(i=this.m_vertices[l]).x,o=a-i.y,0<(i=this.m_normals[l]).x*r+i.y*o)return!1;return!0},tFf.prototype.RayCast=function(t,e,i){var n,r,o=0,s=e.maxFraction,a=e.p1.x-i.position.x,l=e.p1.y-i.position.y,c=a*(n=i.R).col1.x+l*n.col1.y,h=a*n.col2.x+l*n.col2.y;a=e.p2.x-i.position.x,l=e.p2.y-i.position.y;for(var u=a*(n=i.R).col1.x+l*n.col1.y-c,p=a*n.col2.x+l*n.col2.y-h,d=-1,_=0;_<this.m_vertexCount;++_){a=(r=this.m_vertices[_]).x-c,l=r.y-h;var f=(r=this.m_normals[_]).x*a+r.y*l,m=r.x*u+r.y*p;if(0==m){if(f<0)return!1}else m<0&&f<o*m?(o=f/m,d=_):0<m&&f<s*m&&(s=f/m);if(s<o-Number.MIN_VALUE)return!1}return 0<=d&&(t.fraction=o,n=i.R,r=this.m_normals[d],t.normal.x=n.col1.x*r.x+n.col2.x*r.y,t.normal.y=n.col1.y*r.x+n.col2.y*r.y,!0)},tFf.prototype.ComputeAABB=function(t,e){for(var i=e.R,n=this.m_vertices[0],r=c=e.position.x+(i.col1.x*n.x+i.col2.x*n.y),o=h=e.position.y+(i.col1.y*n.x+i.col2.y*n.y),s=1;s<this.m_vertexCount;++s){n=this.m_vertices[s];var a=e.position.x+(i.col1.x*n.x+i.col2.x*n.y),l=e.position.y+(i.col1.y*n.x+i.col2.y*n.y),c=c<a?c:a,h=h<l?h:l,r=a<r?r:a,o=l<o?o:l}t.lowerBound.x=c-this.m_radius,t.lowerBound.y=h-this.m_radius,t.upperBound.x=r+this.m_radius,t.upperBound.y=o+this.m_radius},tFf.prototype.ComputeMass=function(t,e){if(2==this.m_vertexCount)return t.center.x=.5*(this.m_vertices[0].x+this.m_vertices[1].x),t.center.y=.5*(this.m_vertices[0].y+this.m_vertices[1].y),t.mass=0,void(t.I=0);for(var i=0,n=0,r=0,o=0,s=0;s<this.m_vertexCount;++s){var a=this.m_vertices[s],l=s+1<this.m_vertexCount?this.m_vertices[s+1]:this.m_vertices[0],c=+a.x,h=+a.y,u=+l.x,p=+l.y,d=c*p-h*u,_=.5*d;r+=_,i+=1/3*_*(0+a.x+l.x),n+=1/3*_*(0+a.y+l.y),o+=d*(1/3*(.25*(c*c+u*c+u*u)+(0*c+0*u))+0+(1/3*(.25*(h*h+p*h+p*p)+(0*h+0*p))+0))}t.mass=e*r,i*=1/r,n*=1/r,t.center.Set(i,n),t.I=e*o},tFf.prototype.ComputeSubmergedArea=function(t,e,i,n){for(var r=b2Math$1.MulTMV(i.R,t),o=e-b2Math$1.Dot(t,i.position),s=new Array,a=0,l=-1,c=-1,h=!1,u=0;u<this.m_vertexCount;++u){s[u]=b2Math$1.Dot(r,this.m_vertices[u])-o;var p=s[u]<-Number.MIN_VALUE;0<u&&(p?h||(l=u-1,a++):h&&(c=u-1,a++)),h=p}switch(a){case 0:if(h){var d=new b2MassData$1;return this.ComputeMass(d,1),n.SetV(b2Math$1.MulX(i,d.center)),d.mass}return 0;case 1:-1==l?l=this.m_vertexCount-1:c=this.m_vertexCount-1}var _,f=(l+1)%this.m_vertexCount,m=(c+1)%this.m_vertexCount,g=(0-s[l])/(s[f]-s[l]),y=(0-s[c])/(s[m]-s[c]),b=new b2Vec2$1(this.m_vertices[l].x*(1-g)+this.m_vertices[f].x*g,this.m_vertices[l].y*(1-g)+this.m_vertices[f].y*g),v=new b2Vec2$1(this.m_vertices[c].x*(1-y)+this.m_vertices[m].x*y,this.m_vertices[c].y*(1-y)+this.m_vertices[m].y*y),x=0,A=new b2Vec2$1,S=this.m_vertices[f];for(u=f;u!=m;){_=(u=(u+1)%this.m_vertexCount)==m?v:this.m_vertices[u];var w=.5*((S.x-b.x)*(_.y-b.y)-(S.y-b.y)*(_.x-b.x));x+=w,A.x+=w*(b.x+S.x+_.x)/3,A.y+=w*(b.y+S.y+_.y)/3,S=_}return A.Multiply(1/x),n.SetV(b2Math$1.MulX(i,A)),x},tFf.prototype.GetVertexCount=function(){return this.m_vertexCount},tFf.prototype.GetVertices=function(){return this.m_vertices},tFf.prototype.GetNormals=function(){return this.m_normals},tFf.prototype.GetSupport=function(t){for(var e=0,i=this.m_vertices[0].x*t.x+this.m_vertices[0].y*t.y,n=1;n<this.m_vertexCount;++n){var r=this.m_vertices[n].x*t.x+this.m_vertices[n].y*t.y;i<r&&(e=n,i=r)}return e},tFf.prototype.GetSupportVertex=function(t){for(var e=0,i=this.m_vertices[0].x*t.x+this.m_vertices[0].y*t.y,n=1;n<this.m_vertexCount;++n){var r=this.m_vertices[n].x*t.x+this.m_vertices[n].y*t.y;i<r&&(e=n,i=r)}return this.m_vertices[e]},tFf.prototype.Validate=function(){return!1},tFf.prototype.Reserve=function(t){for(var e=this.m_vertices.length;e<t;e++)this.m_vertices[e]=new b2Vec2$1,this.m_normals[e]=new b2Vec2$1},tFf.ComputeCentroid=function(t,e){for(var i=new b2Vec2$1,n=0,r=0;r<e;++r){var o=t[r],s=r+1<e?t[r+1]:t[0],a=+o.x,l=+o.y,c=+s.x,h=.5*(a*s.y-l*c);n+=h,i.x+=1/3*h*(0+o.x+s.x),i.y+=1/3*h*(0+o.y+s.y)}return i.x*=1/n,i.y*=1/n,i},tFf.ComputeOBB=function(t,e,i){for(var n=new Array(i+1),r=0;r<i;++r)n[r]=e[r];n[i]=n[0];var o=Number.MAX_VALUE;for(r=1;r<=i;++r){for(var s=n[r-1],a=n[r].x-s.x,l=n[r].y-s.y,c=Math.sqrt(a*a+l*l),h=-(l/=c),u=a/=c,p=Number.MAX_VALUE,d=Number.MAX_VALUE,_=-Number.MAX_VALUE,f=-Number.MAX_VALUE,m=0;m<i;++m){var g=n[m].x-s.x,y=n[m].y-s.y,b=a*g+l*y,v=h*g+u*y;b<p&&(p=b),v<d&&(d=v),_<b&&(_=b),f<v&&(f=v)}var x,A,S,w=(_-p)*(f-d);w<.95*o&&(o=w,t.R.col1.x=a,t.R.col1.y=l,t.R.col2.x=h,t.R.col2.y=u,x=.5*(p+_),A=.5*(d+f),S=t.R,t.center.x=s.x+(S.col1.x*x+S.col2.x*A),t.center.y=s.y+(S.col1.y*x+S.col2.y*A),t.extents.x=.5*(_-p),t.extents.y=.5*(f-d))}},tFf.s_mat=new b2Mat22$1,tFf),b2AABB$1=(zIf.prototype.IsValid=function(){var t=this.upperBound.x-this.lowerBound.x,e=this.upperBound.y-this.lowerBound.y,i=0<=t&&0<=e;return i&&this.lowerBound.IsValid()&&this.upperBound.IsValid()},zIf.prototype.GetCenter=function(){return new b2Vec2$1((this.lowerBound.x+this.upperBound.x)/2,(this.lowerBound.y+this.upperBound.y)/2)},zIf.prototype.GetExtents=function(){return new b2Vec2$1((this.upperBound.x-this.lowerBound.x)/2,(this.upperBound.y-this.lowerBound.y)/2)},zIf.prototype.Contains=function(t){var e=!0;return(e=(e=(e=e&&this.lowerBound.x<=t.lowerBound.x)&&this.lowerBound.y<=t.lowerBound.y)&&t.upperBound.x<=this.upperBound.x)&&t.upperBound.y<=this.upperBound.y},zIf.prototype.RayCast=function(t,e){var i,n,r,o,s,a=-Number.MAX_VALUE,l=Number.MAX_VALUE,c=e.p1.x,h=e.p1.y,u=e.p2.x-e.p1.x,p=e.p2.y-e.p1.y,d=Math.abs(u),_=Math.abs(p),f=t.normal;if(d<Number.MIN_VALUE){if(c<this.lowerBound.x||this.upperBound.x<c)return!1}else if(i=1/u,s=-1,(n=(this.lowerBound.x-c)*i)>(r=(this.upperBound.x-c)*i)&&(o=n,n=r,r=o,s=1),a<n&&(f.x=s,f.y=0,a=n),a>(l=Math.min(l,r)))return!1;if(_<Number.MIN_VALUE){if(h<this.lowerBound.y||this.upperBound.y<h)return!1}else if(i=1/p,s=-1,(n=(this.lowerBound.y-h)*i)>(r=(this.upperBound.y-h)*i)&&(o=n,n=r,r=o,s=1),a<n&&(f.y=s,f.x=0,a=n),a>(l=Math.min(l,r)))return!1;return t.fraction=a,!0},zIf.prototype.TestOverlap=function(t){var e=t.lowerBound.x-this.upperBound.x,i=t.lowerBound.y-this.upperBound.y,n=this.lowerBound.x-t.upperBound.x,r=this.lowerBound.y-t.upperBound.y;return!(0<e||0<i||0<n||0<r)},zIf.Combine=function(t,e){var i=new zIf;return i.Combine(t,e),i},zIf.prototype.Combine=function(t,e){this.lowerBound.x=Math.min(t.lowerBound.x,e.lowerBound.x),this.lowerBound.y=Math.min(t.lowerBound.y,e.lowerBound.y),this.upperBound.x=Math.max(t.upperBound.x,e.upperBound.x),this.upperBound.y=Math.max(t.upperBound.y,e.upperBound.y)},zIf),Features$1=(Object.defineProperty(dJf.prototype,"referenceEdge",{get:function(){return this._referenceEdge},set:function(t){this._referenceEdge=t,this._m_id._key=4294967040&this._m_id._key|255&this._referenceEdge},enumerable:!0,configurable:!0}),Object.defineProperty(dJf.prototype,"incidentEdge",{get:function(){return this._incidentEdge},set:function(t){this._incidentEdge=t,this._m_id._key=4294902015&this._m_id._key|this._incidentEdge<<8&65280},enumerable:!0,configurable:!0}),Object.defineProperty(dJf.prototype,"incidentVertex",{get:function(){return this._incidentVertex},set:function(t){this._incidentVertex=t,this._m_id._key=4278255615&this._m_id._key|this._incidentVertex<<16&16711680},enumerable:!0,configurable:!0}),Object.defineProperty(dJf.prototype,"flip",{get:function(){return this._flip},set:function(t){this._flip=t,this._m_id._key=16777215&this._m_id._key|this._flip<<24&4278190080},enumerable:!0,configurable:!0}),dJf),b2ContactID$1=(iJf.prototype.Set=function(t){this.key=t._key},iJf.prototype.Copy=function(){var t=new iJf;return t.key=this.key,t},Object.defineProperty(iJf.prototype,"key",{get:function(){return this._key},set:function(t){this._key=t,this.features._referenceEdge=255&this._key,this.features._incidentEdge=(65280&this._key)>>8&255,this.features._incidentVertex=(16711680&this._key)>>16&255,this.features._flip=(4278190080&this._key)>>24&255},enumerable:!0,configurable:!0}),iJf),ClipVertex$1=(mJf.prototype.Set=function(t){this.v.SetV(t.v),this.id.Set(t.id)},mJf),b2ManifoldPoint$1=(oJf.prototype.Reset=function(){this.m_localPoint.SetZero(),this.m_normalImpulse=0,this.m_tangentImpulse=0,this.m_id.key=0},oJf.prototype.Set=function(t){this.m_localPoint.SetV(t.m_localPoint),this.m_normalImpulse=t.m_normalImpulse,this.m_tangentImpulse=t.m_tangentImpulse,this.m_id.Set(t.m_id)},oJf),b2Manifold$1=(qJf.prototype.Reset=function(){for(var t=0;t<b2Settings$1.b2_maxManifoldPoints;t++)this.m_points[t].Reset();this.m_localPlaneNormal.SetZero(),this.m_localPoint.SetZero(),this.m_type=0,this.m_pointCount=0},qJf.prototype.Set=function(t){this.m_pointCount=t.m_pointCount;for(var e=0;e<b2Settings$1.b2_maxManifoldPoints;e++)this.m_points[e].Set(t.m_points[e]);this.m_localPlaneNormal.SetV(t.m_localPlaneNormal),this.m_localPoint.SetV(t.m_localPoint),this.m_type=t.m_type},qJf.prototype.Copy=function(){var t=new qJf;return t.Set(this),t},qJf.e_circles=1,qJf.e_faceA=2,qJf.e_faceB=4,qJf),b2Collision$1=(wJf.ClipSegmentToLine=function(t,e,i,n){var r,o,s,a,l=0,c=(r=e[0]).v,h=(r=e[1]).v,u=i.x*c.x+i.y*c.y-n,p=i.x*h.x+i.y*h.y-n;return u<=0&&t[l++].Set(e[0]),p<=0&&t[l++].Set(e[1]),u*p<0&&(s=u/(u-p),(a=(r=t[l]).v).x=c.x+s*(h.x-c.x),a.y=c.y+s*(h.y-c.y),r=t[l],o=0<u?e[0]:e[1],r.id=o.id,++l),l},wJf.EdgeSeparation=function(t,e,i,n,r){t.m_vertexCount;for(var o=t.m_vertices,s=t.m_normals,a=n.m_vertexCount,l=n.m_vertices,c=e.R,h=s[i],u=c.col1.x*h.x+c.col2.x*h.y,p=c.col1.y*h.x+c.col2.y*h.y,d=(c=r.R).col1.x*u+c.col1.y*p,_=c.col2.x*u+c.col2.y*p,f=0,m=Number.MAX_VALUE,g=0;g<a;++g){var y=(h=l[g]).x*d+h.y*_;y<m&&(m=y,f=g)}h=o[i],c=e.R;var b=e.position.x+(c.col1.x*h.x+c.col2.x*h.y),v=e.position.y+(c.col1.y*h.x+c.col2.y*h.y);h=l[f],c=r.R;var x=r.position.x+(c.col1.x*h.x+c.col2.x*h.y),A=r.position.y+(c.col1.y*h.x+c.col2.y*h.y);return(x-=b)*u+(A-=v)*p},wJf.FindMaxSeparation=function(t,e,i,n,r){var o=e.m_vertexCount,s=e.m_normals,a=r.R,l=n.m_centroid,c=r.position.x+(a.col1.x*l.x+a.col2.x*l.y),h=r.position.y+(a.col1.y*l.x+a.col2.y*l.y);a=i.R,l=e.m_centroid,c-=i.position.x+(a.col1.x*l.x+a.col2.x*l.y),h-=i.position.y+(a.col1.y*l.x+a.col2.y*l.y);for(var u=c*i.R.col1.x+h*i.R.col1.y,p=c*i.R.col2.x+h*i.R.col2.y,d=0,_=-Number.MAX_VALUE,f=0;f<o;++f){var m=(l=s[f]).x*u+l.y*p;_<m&&(_=m,d=f)}var g,y,b,v=this.EdgeSeparation(e,i,d,n,r),x=0<=d-1?d-1:o-1,A=this.EdgeSeparation(e,i,x,n,r),S=d+1<o?d+1:0,w=this.EdgeSeparation(e,i,S,n,r);if(v<A&&w<A)b=-1,g=x,y=A;else{if(!(v<w))return t[0]=d,v;b=1,g=S,y=w}for(;d=-1==b?0<=g-1?g-1:o-1:g+1<o?g+1:0,(v=this.EdgeSeparation(e,i,d,n,r))>y;)g=d,y=v;return t[0]=g,y},wJf.FindIncidentEdge=function(t,e,i,n,r,o){e.m_vertexCount;for(var s=e.m_normals,a=r.m_vertexCount,l=r.m_vertices,c=r.m_normals,h=i.R,u=s[n],p=h.col1.x*u.x+h.col2.x*u.y,d=h.col1.y*u.x+h.col2.y*u.y,_=(h=o.R).col1.x*p+h.col1.y*d,d=h.col2.x*p+h.col2.y*d,p=_,f=0,m=Number.MAX_VALUE,g=0;g<a;++g){var y=p*(u=c[g]).x+d*u.y;y<m&&(m=y,f=g)}var b=f,v=b+1<a?b+1:0,x=t[0];u=l[b],h=o.R,x.v.x=o.position.x+(h.col1.x*u.x+h.col2.x*u.y),x.v.y=o.position.y+(h.col1.y*u.x+h.col2.y*u.y),x.id.features.referenceEdge=n,x.id.features.incidentEdge=b,x.id.features.incidentVertex=0,x=t[1],u=l[v],h=o.R,x.v.x=o.position.x+(h.col1.x*u.x+h.col2.x*u.y),x.v.y=o.position.y+(h.col1.y*u.x+h.col2.y*u.y),x.id.features.referenceEdge=n,x.id.features.incidentEdge=v,x.id.features.incidentVertex=1},wJf.MakeClipPointVector=function(){var t=new Array(2);return t[0]=new ClipVertex$1,t[1]=new ClipVertex$1,t},wJf.CollidePolygons=function(t,e,i,n,r){t.m_pointCount=0;var o=e.m_radius+n.m_radius,s=0;wJf.s_edgeAO[0]=s;var a=this.FindMaxSeparation(wJf.s_edgeAO,e,i,n,r),s=wJf.s_edgeAO[0];if(!(o<a)){var l=0;wJf.s_edgeBO[0]=l;var c=this.FindMaxSeparation(wJf.s_edgeBO,n,r,e,i),l=wJf.s_edgeBO[0];if(!(o<c)){var h,u,p,d,_,f=.98*a+.001<c?(h=n,u=e,p=r,d=i,_=l,t.m_type=b2Manifold$1.e_faceB,1):(h=e,u=n,p=i,d=r,_=s,t.m_type=b2Manifold$1.e_faceA,0),m=wJf.s_incidentEdge;this.FindIncidentEdge(m,h,p,_,u,d);var g=h.m_vertexCount,y=h.m_vertices,b=y[_],v=_+1<g?y[_+1]:y[0],x=wJf.s_localTangent;x.Set(v.x-b.x,v.y-b.y),x.Normalize();var A=wJf.s_localNormal;A.x=x.y,A.y=-x.x;var S=wJf.s_planePoint;S.Set(.5*(b.x+v.x),.5*(b.y+v.y));var w=wJf.s_tangent;R=p.R,w.x=R.col1.x*x.x+R.col2.x*x.y,w.y=R.col1.y*x.x+R.col2.y*x.y;var C=wJf.s_tangent2;C.x=-w.x,C.y=-w.y;var P=wJf.s_normal;P.x=w.y,P.y=-w.x;var E=wJf.s_v11,T=wJf.s_v12;E.x=p.position.x+(R.col1.x*b.x+R.col2.x*b.y),E.y=p.position.y+(R.col1.y*b.x+R.col2.y*b.y),T.x=p.position.x+(R.col1.x*v.x+R.col2.x*v.y),T.y=p.position.y+(R.col1.y*v.x+R.col2.y*v.y);var M=P.x*E.x+P.y*E.y,D=-w.x*E.x-w.y*E.y+o,I=w.x*T.x+w.y*T.y+o,O=wJf.s_clipPoints1,L=wJf.s_clipPoints2;if(!(this.ClipSegmentToLine(O,m,C,D)<2||this.ClipSegmentToLine(L,O,w,I)<2)){t.m_localPlaneNormal.SetV(A),t.m_localPoint.SetV(S);for(var F=0,B=0;B<b2Settings$1.b2_maxManifoldPoints;++B){var N,R,V,k,U=L[B];P.x*U.v.x+P.y*U.v.y-M<=o&&(N=t.m_points[F],R=d.R,V=U.v.x-d.position.x,k=U.v.y-d.position.y,N.m_localPoint.x=V*R.col1.x+k*R.col1.y,N.m_localPoint.y=V*R.col2.x+k*R.col2.y,N.m_id.Set(U.id),N.m_id.features.flip=f,++F)}t.m_pointCount=F}}}},wJf.CollideCircles=function(t,e,i,n,r){t.m_pointCount=0,a=i.R,l=e.m_p;var o=i.position.x+(a.col1.x*l.x+a.col2.x*l.y),s=i.position.y+(a.col1.y*l.x+a.col2.y*l.y),a=r.R,l=n.m_p,c=r.position.x+(a.col1.x*l.x+a.col2.x*l.y)-o,h=r.position.y+(a.col1.y*l.x+a.col2.y*l.y)-s,u=c*c+h*h,p=e.m_radius+n.m_radius;p*p<u||(t.m_type=b2Manifold$1.e_circles,t.m_localPoint.SetV(e.m_p),t.m_localPlaneNormal.SetZero(),t.m_pointCount=1,t.m_points[0].m_localPoint.SetV(n.m_p),t.m_points[0].m_id.key=0)},wJf.CollidePolygonAndCircle=function(t,e,i,n,r){var o,s;t.m_pointCount=0,s=r.R,o=n.m_p;for(var a=r.position.x+(s.col1.x*o.x+s.col2.x*o.y),l=r.position.y+(s.col1.y*o.x+s.col2.y*o.y),c=a-i.position.x,h=l-i.position.y,u=c*(s=i.R).col1.x+h*s.col1.y,p=c*s.col2.x+h*s.col2.y,d=0,_=-Number.MAX_VALUE,f=e.m_radius+n.m_radius,m=e.m_vertexCount,g=e.m_vertices,y=e.m_normals,b=0;b<m;++b){c=u-(o=g[b]).x,h=p-o.y;var v=(o=y[b]).x*c+o.y*h;if(f<v)return;_<v&&(_=v,d=b)}var x=d,A=x+1<m?x+1:0,S=g[x],w=g[A];if(_<Number.MIN_VALUE)return t.m_pointCount=1,t.m_type=b2Manifold$1.e_faceA,t.m_localPlaneNormal.SetV(y[d]),t.m_localPoint.x=.5*(S.x+w.x),t.m_localPoint.y=.5*(S.y+w.y),t.m_points[0].m_localPoint.SetV(n.m_p),void(t.m_points[0].m_id.key=0);var C=(u-S.x)*(w.x-S.x)+(p-S.y)*(w.y-S.y),P=(u-w.x)*(S.x-w.x)+(p-w.y)*(S.y-w.y);if(C<=0){if((u-S.x)*(u-S.x)+(p-S.y)*(p-S.y)>f*f)return;t.m_pointCount=1,t.m_type=b2Manifold$1.e_faceA,t.m_localPlaneNormal.x=u-S.x,t.m_localPlaneNormal.y=p-S.y,t.m_localPlaneNormal.Normalize(),t.m_localPoint.SetV(S),t.m_points[0].m_localPoint.SetV(n.m_p),t.m_points[0].m_id.key=0}else if(P<=0){if((u-w.x)*(u-w.x)+(p-w.y)*(p-w.y)>f*f)return;t.m_pointCount=1,t.m_type=b2Manifold$1.e_faceA,t.m_localPlaneNormal.x=u-w.x,t.m_localPlaneNormal.y=p-w.y,t.m_localPlaneNormal.Normalize(),t.m_localPoint.SetV(w),t.m_points[0].m_localPoint.SetV(n.m_p),t.m_points[0].m_id.key=0}else{var E=.5*(S.x+w.x),T=.5*(S.y+w.y);if((_=(u-E)*y[x].x+(p-T)*y[x].y)>f)return;t.m_pointCount=1,t.m_type=b2Manifold$1.e_faceA,t.m_localPlaneNormal.x=y[x].x,t.m_localPlaneNormal.y=y[x].y,t.m_localPlaneNormal.Normalize(),t.m_localPoint.Set(E,T),t.m_points[0].m_localPoint.SetV(n.m_p),t.m_points[0].m_id.key=0}},wJf.TestOverlap=function(t,e){var i=e.lowerBound,n=t.upperBound,r=i.x-n.x,o=i.y-n.y,i=t.lowerBound,n=e.upperBound,s=i.x-n.x,a=i.y-n.y;return!(0<r||0<o||0<s||0<a)},wJf.b2_nullFeature=255,wJf.s_incidentEdge=wJf.MakeClipPointVector(),wJf.s_clipPoints1=wJf.MakeClipPointVector(),wJf.s_clipPoints2=wJf.MakeClipPointVector(),wJf.s_edgeAO=new Array(1),wJf.s_edgeBO=new Array(1),wJf.s_localTangent=new b2Vec2$1,wJf.s_localNormal=new b2Vec2$1,wJf.s_planePoint=new b2Vec2$1,wJf.s_normal=new b2Vec2$1,wJf.s_tangent=new b2Vec2$1,wJf.s_tangent2=new b2Vec2$1,wJf.s_v11=new b2Vec2$1,wJf.s_v12=new b2Vec2$1,wJf.b2CollidePolyTempVec=new b2Vec2$1,wJf),b2ContactPoint$1=function(){this.__fast__=!0,this.position=new b2Vec2$1,this.velocity=new b2Vec2$1,this.normal=new b2Vec2$1,this.id=new b2ContactID$1},b2DynamicTreeNode=(KMf.prototype.IsLeaf=function(){return null==this.child1},KMf),b2RayCastInput=function(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=1),this.__fast__=!0,this.p1=new b2Vec2$1,this.p2=new b2Vec2$1,t&&this.p1.SetV(t),e&&this.p2.SetV(e),this.maxFraction=i},b2DynamicTree=(OMf.prototype.CreateProxy=function(t,e){var i=this.AllocateNode(),n=b2Settings$1.b2_aabbExtension,r=b2Settings$1.b2_aabbExtension;return i.aabb.lowerBound.x=t.lowerBound.x-n,i.aabb.lowerBound.y=t.lowerBound.y-r,i.aabb.upperBound.x=t.upperBound.x+n,i.aabb.upperBound.y=t.upperBound.y+r,i.userData=e,this.InsertLeaf(i),i},OMf.prototype.DestroyProxy=function(t){this.RemoveLeaf(t),this.FreeNode(t)},OMf.prototype.MoveProxy=function(t,e,i){if(b2Settings$1.b2Assert(t.IsLeaf()),t.aabb.Contains(e))return!1;this.RemoveLeaf(t);var n=b2Settings$1.b2_aabbExtension+b2Settings$1.b2_aabbMultiplier*(0<i.x?i.x:-i.x),r=b2Settings$1.b2_aabbExtension+b2Settings$1.b2_aabbMultiplier*(0<i.y?i.y:-i.y);return t.aabb.lowerBound.x=e.lowerBound.x-n,t.aabb.lowerBound.y=e.lowerBound.y-r,t.aabb.upperBound.x=e.upperBound.x+n,t.aabb.upperBound.y=e.upperBound.y+r,this.InsertLeaf(t),!0},OMf.prototype.Rebalance=function(t){if(null!=this.m_root)for(var e=0;e<t;e++){for(var i=this.m_root,n=0;0==i.IsLeaf();)i=this.m_path>>n&1?i.child2:i.child1,n=n+1&31;++this.m_path,this.RemoveLeaf(i),this.InsertLeaf(i)}},OMf.prototype.GetFatAABB=function(t){return t.aabb},OMf.prototype.GetUserData=function(t){return t.userData},OMf.prototype.Query=function(t,e){if(null!=this.m_root){var i=new Array,n=0;for(i[n++]=this.m_root;0<n;){var r=i[--n];if(r.aabb.TestOverlap(e))if(r.IsLeaf()){if(!t(r))return}else i[n++]=r.child1,i[n++]=r.child2}}},OMf.prototype.RayCast=function(t,e){if(null!=this.m_root){var i=e.p1,n=e.p2,r=b2Math$1.SubtractVV(i,n);r.Normalize();var o=b2Math$1.CrossFV(1,r),s=b2Math$1.AbsV(o),a=e.maxFraction,l=new b2AABB$1,c=i.x+a*(n.x-i.x),h=i.y+a*(n.y-i.y);l.lowerBound.x=Math.min(i.x,c),l.lowerBound.y=Math.min(i.y,h),l.upperBound.x=Math.max(i.x,c),l.upperBound.y=Math.max(i.y,h);var u=new Array,p=0;for(u[p++]=this.m_root;0<p;){var d=u[--p];if(0!=d.aabb.TestOverlap(l)){var _=d.aabb.GetCenter(),f=d.aabb.GetExtents();if(!(0<Math.abs(o.x*(i.x-_.x)+o.y*(i.y-_.y))-s.x*f.x-s.y*f.y))if(d.IsLeaf()){var m=new b2RayCastInput;if(m.p1=e.p1,m.p2=e.p2,m.maxFraction=e.maxFraction,0==(a=t(m,d)))return;c=i.x+a*(n.x-i.x),h=i.y+a*(n.y-i.y),l.lowerBound.x=Math.min(i.x,c),l.lowerBound.y=Math.min(i.y,h),l.upperBound.x=Math.max(i.x,c),l.upperBound.y=Math.max(i.y,h)}else u[p++]=d.child1,u[p++]=d.child2}}}},OMf.prototype.AllocateNode=function(){if(this.m_freeList){var t=this.m_freeList;return this.m_freeList=t.parent,t.parent=null,t.child1=null,t.child2=null,t}return new b2DynamicTreeNode},OMf.prototype.FreeNode=function(t){t.parent=this.m_freeList,this.m_freeList=t},OMf.prototype.InsertLeaf=function(t){if(++this.m_insertionCount,null==this.m_root)return this.m_root=t,void(this.m_root.parent=null);var e=t.aabb.GetCenter();if(0==(r=this.m_root).IsLeaf())do{var i=r.child1,n=r.child2,r=Math.abs((i.aabb.lowerBound.x+i.aabb.upperBound.x)/2-e.x)+Math.abs((i.aabb.lowerBound.y+i.aabb.upperBound.y)/2-e.y)<Math.abs((n.aabb.lowerBound.x+n.aabb.upperBound.x)/2-e.x)+Math.abs((n.aabb.lowerBound.y+n.aabb.upperBound.y)/2-e.y)?i:n}while(0==r.IsLeaf());var o=r.parent,s=this.AllocateNode();if(s.parent=o,s.userData=null,s.aabb.Combine(t.aabb,r.aabb),o){r.parent.child1==r?o.child1=s:o.child2=s,s.child1=r,s.child2=t,r.parent=s,t.parent=s;do{if(o.aabb.Contains(s.aabb))break;o.aabb.Combine(o.child1.aabb,o.child2.aabb),o=(s=o).parent}while(o)}else s.child1=r,s.child2=t,r.parent=s,t.parent=s,this.m_root=s},OMf.prototype.RemoveLeaf=function(t){if(t!=this.m_root){var e=t.parent,i=e.parent,n=e.child1==t?e.child2:e.child1;if(i)for(i.child1==e?i.child1=n:i.child2=n,n.parent=i,this.FreeNode(e);i;){var r=i.aabb;if(i.aabb=b2AABB$1.Combine(i.child1.aabb,i.child2.aabb),r.Contains(i.aabb))break;i=i.parent}else(this.m_root=n).parent=null,this.FreeNode(e)}else this.m_root=null},OMf),b2DynamicTreePair=function(){},b2DynamicTreeBroadPhase=(ONf.prototype.CreateProxy=function(t,e){var i=this.m_tree.CreateProxy(t,e);return++this.m_proxyCount,this.BufferMove(i),i},ONf.prototype.DestroyProxy=function(t){this.UnBufferMove(t),--this.m_proxyCount,this.m_tree.DestroyProxy(t)},ONf.prototype.MoveProxy=function(t,e,i){this.m_tree.MoveProxy(t,e,i)&&this.BufferMove(t)},ONf.prototype.TestOverlap=function(t,e){var i=this.m_tree.GetFatAABB(t),n=this.m_tree.GetFatAABB(e);return i.TestOverlap(n)},ONf.prototype.GetUserData=function(t){return this.m_tree.GetUserData(t)},ONf.prototype.GetFatAABB=function(t){return this.m_tree.GetFatAABB(t)},ONf.prototype.GetProxyCount=function(){return this.m_proxyCount},ONf.prototype.UpdatePairs=function(t){for(var i=this,e=this.m_pairCount=0,n=this.m_moveBuffer;e<n.length;e++){var r=n[e],o=this.m_tree.GetFatAABB(r);this.m_tree.Query(function(t){if(t==r)return!0;i.m_pairCount==i.m_pairBuffer.length&&(i.m_pairBuffer[i.m_pairCount]=new b2DynamicTreePair);var e=i.m_pairBuffer[i.m_pairCount];return e.proxyA=t<r?t:r,e.proxyB=r<=t?t:r,++i.m_pairCount,!0},o)}for(var s=this.m_moveBuffer.length=0;s<this.m_pairCount;){var a=this.m_pairBuffer[s];for(t(this.m_tree.GetUserData(a.proxyA),this.m_tree.GetUserData(a.proxyB)),++s;s<this.m_pairCount;){var l=this.m_pairBuffer[s];if(l.proxyA!=a.proxyA||l.proxyB!=a.proxyB)break;++s}}},ONf.prototype.Query=function(t,e){this.m_tree.Query(t,e)},ONf.prototype.RayCast=function(t,e){this.m_tree.RayCast(t,e)},ONf.prototype.Validate=function(){},ONf.prototype.Rebalance=function(t){this.m_tree.Rebalance(t)},ONf.prototype.BufferMove=function(t){this.m_moveBuffer[this.m_moveBuffer.length]=t},ONf.prototype.UnBufferMove=function(t){var e=this.m_moveBuffer.indexOf(t);this.m_moveBuffer.splice(e,1)},ONf.prototype.ComparePairs=function(t,e){return 0},ONf),b2OBB$1=function(){this.__fast__=!0,this.R=new b2Mat22$1,this.center=new b2Vec2$1,this.extents=new b2Vec2$1},b2RayCastOutput=function(){this.__fast__=!0,this.normal=new b2Vec2$1},b2SeparationFunction=(vOf.prototype.Initialize=function(t,e,i,n,r){this.m_proxyA=e,this.m_proxyB=n;var o,s,a,l,c,h,u,p,d,_,f,m,g,y,b,v,x,A,S,w,C,P,E,T,M=t.count;b2Settings$1.b2Assert(0<M&&M<3),1==M?(this.m_type=vOf.e_points,o=this.m_proxyA.GetVertex(t.indexA[0]),l=this.m_proxyB.GetVertex(t.indexB[0]),y=o,g=i.R,u=i.position.x+(g.col1.x*y.x+g.col2.x*y.y),p=i.position.y+(g.col1.y*y.x+g.col2.y*y.y),y=l,g=r.R,d=r.position.x+(g.col1.x*y.x+g.col2.x*y.y),_=r.position.y+(g.col1.y*y.x+g.col2.y*y.y),this.m_axis.x=d-u,this.m_axis.y=_-p,this.m_axis.Normalize()):t.indexB[0]==t.indexB[1]?(this.m_type=vOf.e_faceA,s=this.m_proxyA.GetVertex(t.indexA[0]),a=this.m_proxyA.GetVertex(t.indexA[1]),l=this.m_proxyB.GetVertex(t.indexB[0]),this.m_localPoint.x=.5*(s.x+a.x),this.m_localPoint.y=.5*(s.y+a.y),this.m_axis=b2Math$1.CrossVF(b2Math$1.SubtractVV(a,s),1),this.m_axis.Normalize(),y=this.m_axis,f=(g=i.R).col1.x*y.x+g.col2.x*y.y,m=g.col1.y*y.x+g.col2.y*y.y,y=this.m_localPoint,g=i.R,u=i.position.x+(g.col1.x*y.x+g.col2.x*y.y),p=i.position.y+(g.col1.y*y.x+g.col2.y*y.y),y=l,g=r.R,(T=((d=r.position.x+(g.col1.x*y.x+g.col2.x*y.y))-u)*f+((_=r.position.y+(g.col1.y*y.x+g.col2.y*y.y))-p)*m)<0&&this.m_axis.NegativeSelf()):t.indexA[0]==t.indexA[0]?(this.m_type=vOf.e_faceB,c=this.m_proxyB.GetVertex(t.indexB[0]),h=this.m_proxyB.GetVertex(t.indexB[1]),o=this.m_proxyA.GetVertex(t.indexA[0]),this.m_localPoint.x=.5*(c.x+h.x),this.m_localPoint.y=.5*(c.y+h.y),this.m_axis=b2Math$1.CrossVF(b2Math$1.SubtractVV(h,c),1),this.m_axis.Normalize(),y=this.m_axis,f=(g=r.R).col1.x*y.x+g.col2.x*y.y,m=g.col1.y*y.x+g.col2.y*y.y,y=this.m_localPoint,g=r.R,d=r.position.x+(g.col1.x*y.x+g.col2.x*y.y),_=r.position.y+(g.col1.y*y.x+g.col2.y*y.y),y=o,g=i.R,(T=((u=i.position.x+(g.col1.x*y.x+g.col2.x*y.y))-d)*f+((p=i.position.y+(g.col1.y*y.x+g.col2.y*y.y))-_)*m)<0&&this.m_axis.NegativeSelf()):(s=this.m_proxyA.GetVertex(t.indexA[0]),a=this.m_proxyA.GetVertex(t.indexA[1]),c=this.m_proxyB.GetVertex(t.indexB[0]),h=this.m_proxyB.GetVertex(t.indexB[1]),b2Math$1.MulX(i,o),b=b2Math$1.MulMV(i.R,b2Math$1.SubtractVV(a,s)),b2Math$1.MulX(r,l),v=b2Math$1.MulMV(r.R,b2Math$1.SubtractVV(h,c)),x=b.x*b.x+b.y*b.y,A=v.x*v.x+v.y*v.y,S=b2Math$1.SubtractVV(v,b),w=b.x*S.x+b.y*S.y,C=v.x*S.x+v.y*S.y,(T=0)!=(E=x*A-(P=b.x*v.x+b.y*v.y)*P)&&(T=b2Math$1.Clamp((P*C-w*A)/E,0,1)),(P*T+C)/A<0&&(T=b2Math$1.Clamp((P-w)/x,0,1)),(o=new b2Vec2$1).x=s.x+T*(a.x-s.x),o.y=s.y+T*(a.y-s.y),(l=new b2Vec2$1).x=c.x+T*(h.x-c.x),l.y=c.y+T*(h.y-c.y),0==T||1==T?(this.m_type=vOf.e_faceB,this.m_axis=b2Math$1.CrossVF(b2Math$1.SubtractVV(h,c),1),this.m_axis.Normalize(),this.m_localPoint=l,y=this.m_axis,f=(g=r.R).col1.x*y.x+g.col2.x*y.y,m=g.col1.y*y.x+g.col2.y*y.y,y=this.m_localPoint,g=r.R,d=r.position.x+(g.col1.x*y.x+g.col2.x*y.y),_=r.position.y+(g.col1.y*y.x+g.col2.y*y.y),y=o,g=i.R,u=i.position.x+(g.col1.x*y.x+g.col2.x*y.y),p=i.position.y+(g.col1.y*y.x+g.col2.y*y.y)):(this.m_type=vOf.e_faceA,this.m_axis=b2Math$1.CrossVF(b2Math$1.SubtractVV(a,s),1),this.m_localPoint=o,y=this.m_axis,f=(g=i.R).col1.x*y.x+g.col2.x*y.y,m=g.col1.y*y.x+g.col2.y*y.y,y=this.m_localPoint,g=i.R,u=i.position.x+(g.col1.x*y.x+g.col2.x*y.y),p=i.position.y+(g.col1.y*y.x+g.col2.y*y.y),y=l,g=r.R,d=r.position.x+(g.col1.x*y.x+g.col2.x*y.y),_=r.position.y+(g.col1.y*y.x+g.col2.y*y.y)),T<0&&this.m_axis.NegativeSelf())},vOf.prototype.Evaluate=function(t,e){var i,n,r,o,s,a,l;switch(this.m_type){case vOf.e_points:return i=b2Math$1.MulTMV(t.R,this.m_axis),n=b2Math$1.MulTMV(e.R,this.m_axis.GetNegative()),r=this.m_proxyA.GetSupportVertex(i),o=this.m_proxyB.GetSupportVertex(n),s=b2Math$1.MulX(t,r),((a=b2Math$1.MulX(e,o)).x-s.x)*this.m_axis.x+(a.y-s.y)*this.m_axis.y;case vOf.e_faceA:return l=b2Math$1.MulMV(t.R,this.m_axis),s=b2Math$1.MulX(t,this.m_localPoint),n=b2Math$1.MulTMV(e.R,l.GetNegative()),o=this.m_proxyB.GetSupportVertex(n),((a=b2Math$1.MulX(e,o)).x-s.x)*l.x+(a.y-s.y)*l.y;case vOf.e_faceB:return l=b2Math$1.MulMV(e.R,this.m_axis),a=b2Math$1.MulX(e,this.m_localPoint),i=b2Math$1.MulTMV(t.R,l.GetNegative()),r=this.m_proxyA.GetSupportVertex(i),((s=b2Math$1.MulX(t,r)).x-a.x)*l.x+(s.y-a.y)*l.y;default:return b2Settings$1.b2Assert(!1),0}},vOf.e_points=1,vOf.e_faceA=2,vOf.e_faceB=4,vOf),b2TimeOfImpact$1=(iPf.TimeOfImpact=function(t){++this.b2_toiCalls;var e=t.proxyA,i=t.proxyB,n=t.sweepA,r=t.sweepB;b2Settings$1.b2Assert(n.t0==r.t0),b2Settings$1.b2Assert(1-n.t0>Number.MIN_VALUE);var o=e.m_radius+i.m_radius,s=t.tolerance,a=0,l=0,c=0;for(this.s_cache.count=0,this.s_distanceInput.useRadii=!1;;){if(n.GetTransform(this.s_xfA,a),r.GetTransform(this.s_xfB,a),this.s_distanceInput.proxyA=e,this.s_distanceInput.proxyB=i,this.s_distanceInput.transformA=this.s_xfA,this.s_distanceInput.transformB=this.s_xfB,b2Distance$1.Distance(this.s_distanceOutput,this.s_cache,this.s_distanceInput),this.s_distanceOutput.distance<=0){a=1;break}this.s_fcn.Initialize(this.s_cache,e,this.s_xfA,i,this.s_xfB);var h=this.s_fcn.Evaluate(this.s_xfA,this.s_xfB);if(h<=0){a=1;break}if(0==l&&(c=o<h?b2Math$1.Max(o-s,.75*o):b2Math$1.Max(h-s,.02*o)),h-c<.5*s){if(0!=l)break;a=1;break}var u=a,p=a,d=1,_=h;n.GetTransform(this.s_xfA,d),r.GetTransform(this.s_xfB,d);var f=this.s_fcn.Evaluate(this.s_xfA,this.s_xfB);if(c<=f){a=1;break}for(var m=0;;){var g=1&m?p+(c-_)*(d-p)/(f-_):.5*(p+d);n.GetTransform(this.s_xfA,g),r.GetTransform(this.s_xfB,g);var y=this.s_fcn.Evaluate(this.s_xfA,this.s_xfB);if(b2Math$1.Abs(y-c)<.025*s){u=g;break}if(c<y?(p=g,_=y):(d=g,f=y),++m,++this.b2_toiRootIters,50==m)break}if(this.b2_toiMaxRootIters=b2Math$1.Max(this.b2_toiMaxRootIters,m),u<(1+100*Number.MIN_VALUE)*a)break;if(a=u,l++,++this.b2_toiIters,1e3==l)break}return this.b2_toiMaxIters=b2Math$1.Max(this.b2_toiMaxIters,l),a},iPf.b2_toiCalls=0,iPf.b2_toiIters=0,iPf.b2_toiMaxIters=0,iPf.b2_toiRootIters=0,iPf.b2_toiMaxRootIters=0,iPf.s_cache=new b2SimplexCache,iPf.s_distanceInput=new b2DistanceInput,iPf.s_xfA=new b2Transform,iPf.s_xfB=new b2Transform,iPf.s_fcn=new b2SeparationFunction,iPf.s_distanceOutput=new b2DistanceOutput,iPf),b2TOIInput=function(){this.proxyA=new b2DistanceProxy,this.proxyB=new b2DistanceProxy,this.sweepA=new b2Sweep$1,this.sweepB=new b2Sweep$1},b2WorldManifold=(CPf.prototype.Initialize=function(t,e,i,n,r){var o,s,a,l,c,h,u;if(0!=t.m_pointCount)switch(t.m_type){case b2Manifold$1.e_circles:f=e.R,m=t.m_localPoint;var p,d=e.position.x+f.col1.x*m.x+f.col2.x*m.y,_=e.position.y+f.col1.y*m.x+f.col2.y*m.y,f=n.R,m=t.m_points[0].m_localPoint,g=n.position.x+f.col1.x*m.x+f.col2.x*m.y,y=n.position.y+f.col1.y*m.x+f.col2.y*m.y,b=g-d,v=y-_,x=b*b+v*v;x>Number.MIN_VALUE*Number.MIN_VALUE?(p=Math.sqrt(x),this.m_normal.x=b/p,this.m_normal.y=v/p):(this.m_normal.x=1,this.m_normal.y=0);var A=d+i*this.m_normal.x,S=_+i*this.m_normal.y,w=g-r*this.m_normal.x,C=y-r*this.m_normal.y;this.m_points[0].x=.5*(A+w),this.m_points[0].y=.5*(S+C);break;case b2Manifold$1.e_faceA:for(f=e.R,m=t.m_localPlaneNormal,s=f.col1.x*m.x+f.col2.x*m.y,a=f.col1.y*m.x+f.col2.y*m.y,f=e.R,m=t.m_localPoint,l=e.position.x+f.col1.x*m.x+f.col2.x*m.y,c=e.position.y+f.col1.y*m.x+f.col2.y*m.y,this.m_normal.x=s,this.m_normal.y=a,o=0;o<t.m_pointCount;o++)f=n.R,m=t.m_points[o].m_localPoint,h=n.position.x+f.col1.x*m.x+f.col2.x*m.y,u=n.position.y+f.col1.y*m.x+f.col2.y*m.y,this.m_points[o].x=h+.5*(i-(h-l)*s-(u-c)*a-r)*s,this.m_points[o].y=u+.5*(i-(h-l)*s-(u-c)*a-r)*a;break;case b2Manifold$1.e_faceB:for(f=n.R,m=t.m_localPlaneNormal,s=f.col1.x*m.x+f.col2.x*m.y,a=f.col1.y*m.x+f.col2.y*m.y,f=n.R,m=t.m_localPoint,l=n.position.x+f.col1.x*m.x+f.col2.x*m.y,c=n.position.y+f.col1.y*m.x+f.col2.y*m.y,this.m_normal.x=-s,this.m_normal.y=-a,o=0;o<t.m_pointCount;o++)f=e.R,m=t.m_points[o].m_localPoint,h=e.position.x+f.col1.x*m.x+f.col2.x*m.y,u=e.position.y+f.col1.y*m.x+f.col2.y*m.y,this.m_points[o].x=h+.5*(r-(h-l)*s-(u-c)*a-i)*s,this.m_points[o].y=u+.5*(r-(h-l)*s-(u-c)*a-i)*a}},CPf),b2Color$1=(cQf.prototype.Set=function(t,e,i){this._r=255*b2Math$1.Clamp(t,0,1)>>>0,this._g=255*b2Math$1.Clamp(e,0,1)>>>0,this._b=255*b2Math$1.Clamp(i,0,1)>>>0},Object.defineProperty(cQf.prototype,"r",{set:function(t){this._r=255*b2Math$1.Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(cQf.prototype,"g",{set:function(t){this._g=255*b2Math$1.Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(cQf.prototype,"b",{set:function(t){this._b=255*b2Math$1.Clamp(t,0,1)>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(cQf.prototype,"color",{get:function(){return this._r<<16|this._g<<8|this._b},enumerable:!0,configurable:!0}),cQf),b2PositionSolverManifold=(mQf.prototype.Initialize=function(t){var e,i,n,r,o;switch(b2Settings$1.b2Assert(0<t.pointCount),t.type){case b2Manifold$1.e_circles:c=t.bodyA.m_xf.R,h=t.localPoint;var s,a=t.bodyA.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),l=t.bodyA.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),c=t.bodyB.m_xf.R,h=t.points[0].localPoint,u=t.bodyB.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),p=t.bodyB.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),d=u-a,_=p-l,f=d*d+_*_;f>Number.MIN_VALUE*Number.MIN_VALUE?(s=Math.sqrt(f),this.m_normal.x=d/s,this.m_normal.y=_/s):(this.m_normal.x=1,this.m_normal.y=0),this.m_points[0].x=.5*(a+u),this.m_points[0].y=.5*(l+p),this.m_separations[0]=d*this.m_normal.x+_*this.m_normal.y-t.radius;break;case b2Manifold$1.e_faceA:for(c=t.bodyA.m_xf.R,h=t.localPlaneNormal,this.m_normal.x=c.col1.x*h.x+c.col2.x*h.y,this.m_normal.y=c.col1.y*h.x+c.col2.y*h.y,c=t.bodyA.m_xf.R,h=t.localPoint,r=t.bodyA.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),o=t.bodyA.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),c=t.bodyB.m_xf.R,e=0;e<t.pointCount;++e)h=t.points[e].localPoint,i=t.bodyB.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),n=t.bodyB.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),this.m_separations[e]=(i-r)*this.m_normal.x+(n-o)*this.m_normal.y-t.radius,this.m_points[e].x=i,this.m_points[e].y=n;break;case b2Manifold$1.e_faceB:for(c=t.bodyB.m_xf.R,h=t.localPlaneNormal,this.m_normal.x=c.col1.x*h.x+c.col2.x*h.y,this.m_normal.y=c.col1.y*h.x+c.col2.y*h.y,c=t.bodyB.m_xf.R,h=t.localPoint,r=t.bodyB.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),o=t.bodyB.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),c=t.bodyA.m_xf.R,e=0;e<t.pointCount;++e)h=t.points[e].localPoint,i=t.bodyA.m_xf.position.x+(c.col1.x*h.x+c.col2.x*h.y),n=t.bodyA.m_xf.position.y+(c.col1.y*h.x+c.col2.y*h.y),this.m_separations[e]=(i-r)*this.m_normal.x+(n-o)*this.m_normal.y-t.radius,this.m_points[e].Set(i,n);this.m_normal.x*=-1,this.m_normal.y*=-1}},mQf.circlePointA=new b2Vec2$1,mQf.circlePointB=new b2Vec2$1,mQf),b2BodyDef$1=function(){this.__fast__=!0,this.position=new b2Vec2$1,this.linearVelocity=new b2Vec2$1,this.userData=null,this.position.Set(0,0),this.angle=0,this.linearVelocity.Set(0,0),this.angularVelocity=0,this.linearDamping=0,this.angularDamping=0,this.allowSleep=!0,this.awake=!0,this.fixedRotation=!1,this.bullet=!1,this.type=b2Body$1.b2_staticBody,this.active=!0,this.inertiaScale=1},b2FilterData$1=(EQf.prototype.Copy=function(){var t=new EQf;return t.categoryBits=this.categoryBits,t.maskBits=this.maskBits,t.groupIndex=this.groupIndex,t},EQf),b2Fixture=(GQf.prototype.GetType=function(){return this.m_shape.GetType()},GQf.prototype.GetShape=function(){return this.m_shape},GQf.prototype.SetSensor=function(t){if(this.m_isSensor!=t&&(this.m_isSensor=t,null!=this.m_body))for(var e=this.m_body.GetContactList();e;){var i=e.contact,n=i.GetFixtureA(),r=i.GetFixtureB();n!=this&&r!=this||i.SetSensor(n.IsSensor()||r.IsSensor()),e=e.next}},GQf.prototype.IsSensor=function(){return this.m_isSensor},GQf.prototype.SetFilterData=function(t){if(this.m_filter=t.Copy(),!this.m_body)for(var e=this.m_body.GetContactList();e;){var i=e.contact,n=i.GetFixtureA(),r=i.GetFixtureB();n!=this&&r!=this||i.FlagForFiltering(),e=e.next}},GQf.prototype.GetFilterData=function(){return this.m_filter.Copy()},GQf.prototype.GetBody=function(){return this.m_body},GQf.prototype.GetNext=function(){return this.m_next},GQf.prototype.GetUserData=function(){return this.m_userData},GQf.prototype.SetUserData=function(t){this.m_userData=t},GQf.prototype.TestPoint=function(t){return this.m_shape.TestPoint(this.m_body.GetTransform(),t)},GQf.prototype.RayCast=function(t,e){return this.m_shape.RayCast(t,e,this.m_body.GetTransform())},GQf.prototype.GetMassData=function(t){return void 0===t&&(t=null),null==t&&(t=new b2MassData$1),this.m_shape.ComputeMass(t,this.m_density),t},GQf.prototype.SetDensity=function(t){this.m_density=t},GQf.prototype.GetDensity=function(){return this.m_density},GQf.prototype.GetFriction=function(){return this.m_friction},GQf.prototype.SetFriction=function(t){this.m_friction=t},GQf.prototype.GetRestitution=function(){return this.m_restitution},GQf.prototype.SetRestitution=function(t){this.m_restitution=t},GQf.prototype.GetAABB=function(){return this.m_aabb},GQf.prototype.Create=function(t,e,i){this.m_userData=i.userData,this.m_friction=i.friction,this.m_restitution=i.restitution,this.m_body=t,this.m_next=null,this.m_filter=i.filter.Copy(),this.m_isSensor=i.isSensor,this.m_shape=i.shape.Copy(),this.m_density=i.density},GQf.prototype.Destroy=function(){this.m_shape=null},GQf.prototype.CreateProxy=function(t,e){this.m_shape.ComputeAABB(this.m_aabb,e),this.m_proxy=t.CreateProxy(this.m_aabb,this)},GQf.prototype.DestroyProxy=function(t){null!=this.m_proxy&&(t.DestroyProxy(this.m_proxy),this.m_proxy=null)},GQf.prototype.Synchronize=function(t,e,i){var n,r,o;this.m_proxy&&(n=new b2AABB$1,r=new b2AABB$1,this.m_shape.ComputeAABB(n,e),this.m_shape.ComputeAABB(r,i),this.m_aabb.Combine(n,r),o=b2Math$1.SubtractVV(i.position,e.position),t.MoveProxy(this.m_proxy,this.m_aabb,o))},GQf),b2FixtureDef=function(){this.__fast__=!0,this.filter=new b2FilterData$1,this.shape=null,this.userData=null,this.friction=.2,this.restitution=0,this.density=0,this.filter.categoryBits=1,this.filter.maskBits=65535,this.filter.groupIndex=0,this.isSensor=!1},b2ContactImpulse=function(){this.__fast__=!0,this.normalImpulses=new Array(b2Settings$1.b2_maxManifoldPoints),this.tangentImpulses=new Array(b2Settings$1.b2_maxManifoldPoints)},b2Island$1=(jRf.prototype.Initialize=function(t,e,i,n,r,o){var s;for(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_allocator=n,this.m_listener=r,this.m_contactSolver=o,s=this.m_bodies.length;s<t;s++)this.m_bodies[s]=null;for(s=this.m_contacts.length;s<e;s++)this.m_contacts[s]=null;for(s=this.m_joints.length;s<i;s++)this.m_joints[s]=null},jRf.prototype.Clear=function(){this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0},jRf.prototype.Solve=function(t,e,i){var n;for(f=0;f<this.m_bodyCount;++f)(n=this.m_bodies[f]).GetType()==b2Body$1.b2_dynamicBody&&(n.m_linearVelocity.x+=t.dt*(e.x+n.m_invMass*n.m_force.x),n.m_linearVelocity.y+=t.dt*(e.y+n.m_invMass*n.m_force.y),n.m_angularVelocity+=t.dt*n.m_invI*n.m_torque,n.m_linearVelocity.Multiply(b2Math$1.Clamp(1-t.dt*n.m_linearDamping,0,1)),n.m_angularVelocity*=b2Math$1.Clamp(1-t.dt*n.m_angularDamping,0,1));this.m_contactSolver.Initialize(t,this.m_contacts,this.m_contactCount,this.m_allocator);var r,o,s,a=this.m_contactSolver;for(a.InitVelocityConstraints(t),f=0;f<this.m_jointCount;++f)this.m_joints[f].InitVelocityConstraints(t);for(f=0;f<t.velocityIterations;++f){for(h=0;h<this.m_jointCount;++h)this.m_joints[h].SolveVelocityConstraints(t);a.SolveVelocityConstraints()}for(f=0;f<this.m_jointCount;++f)this.m_joints[f].FinalizeVelocityConstraints();for(a.FinalizeVelocityConstraints(),f=0;f<this.m_bodyCount;++f)(n=this.m_bodies[f]).GetType()!=b2Body$1.b2_staticBody&&((r=t.dt*n.m_linearVelocity.x)*r+(o=t.dt*n.m_linearVelocity.y)*o>b2Settings$1.b2_maxTranslationSquared&&(n.m_linearVelocity.Normalize(),n.m_linearVelocity.x*=b2Settings$1.b2_maxTranslation*t.inv_dt,n.m_linearVelocity.y*=b2Settings$1.b2_maxTranslation*t.inv_dt),(s=t.dt*n.m_angularVelocity)*s>b2Settings$1.b2_maxRotationSquared&&(n.m_angularVelocity<0?n.m_angularVelocity=-b2Settings$1.b2_maxRotation*t.inv_dt:n.m_angularVelocity=b2Settings$1.b2_maxRotation*t.inv_dt),n.m_sweep.c0.SetV(n.m_sweep.c),n.m_sweep.a0=n.m_sweep.a,n.m_sweep.c.x+=t.dt*n.m_linearVelocity.x,n.m_sweep.c.y+=t.dt*n.m_linearVelocity.y,n.m_sweep.a+=t.dt*n.m_angularVelocity,n.SynchronizeTransform());for(f=0;f<t.positionIterations;++f){for(var l=a.SolvePositionConstraints(b2Settings$1.b2_contactBaumgarte),c=!0,h=0;h<this.m_jointCount;++h)var u=this.m_joints[h].SolvePositionConstraints(b2Settings$1.b2_contactBaumgarte),c=c&&u;if(l&&c)break}if(this.Report(a.m_constraints),i){for(var p=Number.MAX_VALUE,d=b2Settings$1.b2_linearSleepTolerance*b2Settings$1.b2_linearSleepTolerance,_=b2Settings$1.b2_angularSleepTolerance*b2Settings$1.b2_angularSleepTolerance,f=0;f<this.m_bodyCount;++f)(n=this.m_bodies[f]).GetType()!=b2Body$1.b2_staticBody&&(0==(n.m_flags&b2Body$1.e_allowSleepFlag)&&(p=n.m_sleepTime=0),p=0==(n.m_flags&b2Body$1.e_allowSleepFlag)||n.m_angularVelocity*n.m_angularVelocity>_||b2Math$1.Dot(n.m_linearVelocity,n.m_linearVelocity)>d?n.m_sleepTime=0:(n.m_sleepTime+=t.dt,b2Math$1.Min(p,n.m_sleepTime)));if(p>=b2Settings$1.b2_timeToSleep)for(f=0;f<this.m_bodyCount;++f)(n=this.m_bodies[f]).SetAwake(!1)}},jRf.prototype.SolveTOI=function(t){this.m_contactSolver.Initialize(t,this.m_contacts,this.m_contactCount,this.m_allocator);for(var e=this.m_contactSolver,i=0;i<this.m_jointCount;++i)this.m_joints[i].InitVelocityConstraints(t);for(i=0;i<t.velocityIterations;++i)for(e.SolveVelocityConstraints(),c=0;c<this.m_jointCount;++c)this.m_joints[c].SolveVelocityConstraints(t);for(i=0;i<this.m_bodyCount;++i){var n,r,o,s=this.m_bodies[i];s.GetType()!=b2Body$1.b2_staticBody&&((n=t.dt*s.m_linearVelocity.x)*n+(r=t.dt*s.m_linearVelocity.y)*r>b2Settings$1.b2_maxTranslationSquared&&(s.m_linearVelocity.Normalize(),s.m_linearVelocity.x*=b2Settings$1.b2_maxTranslation*t.inv_dt,s.m_linearVelocity.y*=b2Settings$1.b2_maxTranslation*t.inv_dt),(o=t.dt*s.m_angularVelocity)*o>b2Settings$1.b2_maxRotationSquared&&(s.m_angularVelocity<0?s.m_angularVelocity=-b2Settings$1.b2_maxRotation*t.inv_dt:s.m_angularVelocity=b2Settings$1.b2_maxRotation*t.inv_dt),s.m_sweep.c0.SetV(s.m_sweep.c),s.m_sweep.a0=s.m_sweep.a,s.m_sweep.c.x+=t.dt*s.m_linearVelocity.x,s.m_sweep.c.y+=t.dt*s.m_linearVelocity.y,s.m_sweep.a+=t.dt*s.m_angularVelocity,s.SynchronizeTransform())}for(i=0;i<t.positionIterations;++i){for(var a=e.SolvePositionConstraints(.75),l=!0,c=0;c<this.m_jointCount;++c)var h=this.m_joints[c].SolvePositionConstraints(b2Settings$1.b2_contactBaumgarte),l=l&&h;if(a&&l)break}this.Report(e.m_constraints)},jRf.prototype.Report=function(t){if(null!=this.m_listener)for(var e=0;e<this.m_contactCount;++e){for(var i=this.m_contacts[e],n=t[e],r=0;r<n.pointCount;++r)jRf.s_impulse.normalImpulses[r]=n.points[r].normalImpulse,jRf.s_impulse.tangentImpulses[r]=n.points[r].tangentImpulse;this.m_listener.PostSolve(i,jRf.s_impulse)}},jRf.prototype.AddBody=function(t){t.m_islandIndex=this.m_bodyCount,this.m_bodies[this.m_bodyCount++]=t},jRf.prototype.AddContact=function(t){this.m_contacts[this.m_contactCount++]=t},jRf.prototype.AddJoint=function(t){this.m_joints[this.m_jointCount++]=t},jRf.s_impulse=new b2ContactImpulse,jRf),b2Joint$1=($Rf.prototype.GetType=function(){return this.m_type},$Rf.prototype.GetAnchorA=function(){return null},$Rf.prototype.GetAnchorB=function(){return null},$Rf.prototype.GetReactionForce=function(t){return null},$Rf.prototype.GetReactionTorque=function(t){return 0},$Rf.prototype.GetBodyA=function(){return this.m_bodyA},$Rf.prototype.GetBodyB=function(){return this.m_bodyB},$Rf.prototype.GetNext=function(){return this.m_next},$Rf.prototype.GetUserData=function(){return this.m_userData},$Rf.prototype.SetUserData=function(t){this.m_userData=t},$Rf.prototype.IsActive=function(){return this.m_bodyA.IsActive()&&this.m_bodyB.IsActive()},$Rf.Create=function(t,e){var i=null;switch(t.type){case $Rf.e_distanceJoint:i=new b2DistanceJoint$1(t);break;case $Rf.e_mouseJoint:i=new b2MouseJoint$1(t);break;case $Rf.e_prismaticJoint:i=new b2PrismaticJoint$1(t);break;case $Rf.e_revoluteJoint:i=new b2RevoluteJoint$1(t);break;case $Rf.e_pulleyJoint:i=new b2PulleyJoint$1(t);break;case $Rf.e_gearJoint:i=new b2GearJoint$1(t);break;case $Rf.e_lineJoint:i=new b2LineJoint(t);break;case $Rf.e_weldJoint:i=new b2WeldJoint(t);break;case $Rf.e_frictionJoint:i=new b2FrictionJoint(t)}return i},$Rf.Destroy=function(t,e){},$Rf.prototype.InitVelocityConstraints=function(t){},$Rf.prototype.SolveVelocityConstraints=function(t){},$Rf.prototype.FinalizeVelocityConstraints=function(){},$Rf.prototype.SolvePositionConstraints=function(t){return!1},$Rf.e_unknownJoint=0,$Rf.e_revoluteJoint=1,$Rf.e_prismaticJoint=2,$Rf.e_distanceJoint=3,$Rf.e_pulleyJoint=4,$Rf.e_mouseJoint=5,$Rf.e_gearJoint=6,$Rf.e_lineJoint=7,$Rf.e_weldJoint=8,$Rf.e_frictionJoint=9,$Rf.e_inactiveLimit=0,$Rf.e_atLowerLimit=1,$Rf.e_atUpperLimit=2,$Rf.e_equalLimits=3,$Rf),b2JointDef$1=function(){this.type=b2Joint$1.e_unknownJoint,this.userData=null,this.bodyA=null,this.bodyB=null,this.collideConnected=!1},b2DistanceJoint$1=(lSf=b2Joint$1,__extends(mSf,lSf),mSf.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},mSf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},mSf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse*this.m_u.x,t*this.m_impulse*this.m_u.y)},mSf.prototype.GetReactionTorque=function(t){return 0},mSf.prototype.GetLength=function(){return this.m_length},mSf.prototype.SetLength=function(t){this.m_length=t},mSf.prototype.GetFrequency=function(){return this.m_frequencyHz},mSf.prototype.SetFrequency=function(t){this.m_frequencyHz=t},mSf.prototype.GetDampingRatio=function(){return this.m_dampingRatio},mSf.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},mSf.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,this.m_u.x=i.m_sweep.c.x+a-e.m_sweep.c.x-r,this.m_u.y=i.m_sweep.c.y+l-e.m_sweep.c.y-o;var c=Math.sqrt(this.m_u.x*this.m_u.x+this.m_u.y*this.m_u.y);c>b2Settings$1.b2_linearSlop?this.m_u.Multiply(1/c):this.m_u.SetZero();var h,u,p,d,_,f,m=r*this.m_u.y-o*this.m_u.x,g=a*this.m_u.y-l*this.m_u.x,y=e.m_invMass+e.m_invI*m*m+i.m_invMass+i.m_invI*g*g;this.m_mass=0!=y?1/y:0,0<this.m_frequencyHz&&(h=c-this.m_length,u=2*Math.PI*this.m_frequencyHz,p=2*this.m_mass*this.m_dampingRatio*u,d=this.m_mass*u*u,this.m_gamma=t.dt*(p+t.dt*d),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_bias=h*t.dt*d*this.m_gamma,this.m_mass=y+this.m_gamma,this.m_mass=0!=this.m_mass?1/this.m_mass:0),t.warmStarting?(this.m_impulse*=t.dtRatio,_=this.m_impulse*this.m_u.x,f=this.m_impulse*this.m_u.y,e.m_linearVelocity.x-=e.m_invMass*_,e.m_linearVelocity.y-=e.m_invMass*f,e.m_angularVelocity-=e.m_invI*(r*f-o*_),i.m_linearVelocity.x+=i.m_invMass*_,i.m_linearVelocity.y+=i.m_invMass*f,i.m_angularVelocity+=i.m_invI*(a*f-l*_)):this.m_impulse=0},mSf.prototype.SolveVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,c=e.m_linearVelocity.x+-e.m_angularVelocity*o,h=e.m_linearVelocity.y+e.m_angularVelocity*r,u=i.m_linearVelocity.x+-i.m_angularVelocity*l,p=i.m_linearVelocity.y+i.m_angularVelocity*a,d=this.m_u.x*(u-c)+this.m_u.y*(p-h),_=-this.m_mass*(d+this.m_bias+this.m_gamma*this.m_impulse);this.m_impulse+=_;var f=_*this.m_u.x,m=_*this.m_u.y;e.m_linearVelocity.x-=e.m_invMass*f,e.m_linearVelocity.y-=e.m_invMass*m,e.m_angularVelocity-=e.m_invI*(r*m-o*f),i.m_linearVelocity.x+=i.m_invMass*f,i.m_linearVelocity.y+=i.m_invMass*m,i.m_angularVelocity+=i.m_invI*(a*m-l*f)},mSf.prototype.SolvePositionConstraints=function(t){if(0<this.m_frequencyHz)return!0;var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,c=i.m_sweep.c.x+a-e.m_sweep.c.x-r,h=i.m_sweep.c.y+l-e.m_sweep.c.y-o,u=Math.sqrt(c*c+h*h);c/=u,h/=u;var p=u-this.m_length,p=b2Math$1.Clamp(p,-b2Settings$1.b2_maxLinearCorrection,b2Settings$1.b2_maxLinearCorrection),d=-this.m_mass*p;this.m_u.Set(c,h);var _=d*this.m_u.x,f=d*this.m_u.y;return e.m_sweep.c.x-=e.m_invMass*_,e.m_sweep.c.y-=e.m_invMass*f,e.m_sweep.a-=e.m_invI*(r*f-o*_),i.m_sweep.c.x+=i.m_invMass*_,i.m_sweep.c.y+=i.m_invMass*f,i.m_sweep.a+=i.m_invI*(a*f-l*_),e.SynchronizeTransform(),i.SynchronizeTransform(),b2Math$1.Abs(p)<b2Settings$1.b2_linearSlop},mSf),b2DistanceJointDef$1=(sTf=b2JointDef$1,__extends(tTf,sTf),tTf.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.localAnchorA.SetV(this.bodyA.GetLocalPoint(i)),this.localAnchorB.SetV(this.bodyB.GetLocalPoint(n));var r=n.x-i.x,o=n.y-i.y;length=Math.sqrt(r*r+o*o),this.frequencyHz=0,this.dampingRatio=0},tTf),b2FrictionJoint=(BTf=b2Joint$1,__extends(CTf,BTf),CTf.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)},CTf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)},CTf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_linearImpulse.x,t*this.m_linearImpulse.y)},CTf.prototype.GetReactionTorque=function(t){return t*this.m_angularImpulse},CTf.prototype.SetMaxForce=function(t){this.m_maxForce=t},CTf.prototype.GetMaxForce=function(){return this.m_maxForce},CTf.prototype.SetMaxTorque=function(t){this.m_maxTorque=t},CTf.prototype.GetMaxTorque=function(){return this.m_maxTorque},CTf.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchorA.x-e.m_sweep.localCenter.x,o=this.m_localAnchorA.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchorB.x-i.m_sweep.localCenter.x,l=this.m_localAnchorB.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s;var c,h=e.m_invMass,u=i.m_invMass,p=e.m_invI,d=i.m_invI,_=new b2Mat22$1;_.col1.x=h+u,_.col2.x=0,_.col1.y=0,_.col2.y=h+u,_.col1.x+=p*o*o,_.col2.x+=-p*r*o,_.col1.y+=-p*r*o,_.col2.y+=p*r*r,_.col1.x+=d*l*l,_.col2.x+=-d*a*l,_.col1.y+=-d*a*l,_.col2.y+=d*a*a,_.GetInverse(this.m_linearMass),this.m_angularMass=p+d,0<this.m_angularMass&&(this.m_angularMass=1/this.m_angularMass),t.warmStarting?(this.m_linearImpulse.x*=t.dtRatio,this.m_linearImpulse.y*=t.dtRatio,this.m_angularImpulse*=t.dtRatio,c=this.m_linearImpulse,e.m_linearVelocity.x-=h*c.x,e.m_linearVelocity.y-=h*c.y,e.m_angularVelocity-=p*(r*c.y-o*c.x+this.m_angularImpulse),i.m_linearVelocity.x+=u*c.x,i.m_linearVelocity.y+=u*c.y,i.m_angularVelocity+=d*(a*c.y-l*c.x+this.m_angularImpulse)):(this.m_linearImpulse.SetZero(),this.m_angularImpulse=0)},CTf.prototype.SolveVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_linearVelocity,r=e.m_angularVelocity,o=i.m_linearVelocity,s=i.m_angularVelocity,a=e.m_invMass,l=i.m_invMass,c=e.m_invI,h=i.m_invI,u=e.m_xf.R,p=this.m_localAnchorA.x-e.m_sweep.localCenter.x,d=this.m_localAnchorA.y-e.m_sweep.localCenter.y,_=u.col1.x*p+u.col2.x*d,d=u.col1.y*p+u.col2.y*d,p=_;u=i.m_xf.R;var f=this.m_localAnchorB.x-i.m_sweep.localCenter.x,m=this.m_localAnchorB.y-i.m_sweep.localCenter.y;_=u.col1.x*f+u.col2.x*m,m=u.col1.y*f+u.col2.y*m,f=_;var g=s-r,y=-this.m_angularMass*g,b=this.m_angularImpulse,v=t.dt*this.m_maxTorque;this.m_angularImpulse=b2Math$1.Clamp(this.m_angularImpulse+y,-v,v),r-=c*(y=this.m_angularImpulse-b),s+=h*y;var x=o.x-s*m-n.x+r*d,A=o.y+s*f-n.y-r*p,S=b2Math$1.MulMV(this.m_linearMass,new b2Vec2$1(-x,-A)),w=this.m_linearImpulse.Copy();this.m_linearImpulse.Add(S),v=t.dt*this.m_maxForce,this.m_linearImpulse.LengthSquared()>v*v&&(this.m_linearImpulse.Normalize(),this.m_linearImpulse.Multiply(v)),S=b2Math$1.SubtractVV(this.m_linearImpulse,w),n.x-=a*S.x,n.y-=a*S.y,r-=c*(p*S.y-d*S.x),o.x+=l*S.x,o.y+=l*S.y,s+=h*(f*S.y-m*S.x),e.m_angularVelocity=r,i.m_angularVelocity=s},CTf.prototype.SolvePositionConstraints=function(t){return!0},CTf),b2FrictionJointDef=(wUf=b2JointDef$1,__extends(xUf,wUf),xUf.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.localAnchorA.SetV(this.bodyA.GetLocalPoint(i)),this.localAnchorB.SetV(this.bodyB.GetLocalPoint(i))},xUf),b2GearJoint$1=(CUf=b2Joint$1,__extends(DUf,CUf),DUf.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},DUf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},DUf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse*this.m_J.linearB.x,t*this.m_impulse*this.m_J.linearB.y)},DUf.prototype.GetReactionTorque=function(t){var e=this.m_bodyB.m_xf.R,i=this.m_localAnchor1.x-this.m_bodyB.m_sweep.localCenter.x,n=this.m_localAnchor1.y-this.m_bodyB.m_sweep.localCenter.y,r=e.col1.x*i+e.col2.x*n,n=e.col1.y*i+e.col2.y*n,i=r,o=this.m_impulse*this.m_J.linearB.x,s=this.m_impulse*this.m_J.linearB.y;return t*(this.m_impulse*this.m_J.angularB-i*s+n*o)},DUf.prototype.GetRatio=function(){return this.m_ratio},DUf.prototype.SetRatio=function(t){this.m_ratio=t},DUf.prototype.InitVelocityConstraints=function(t){var e,i,n,r,o,s,a,l,c=this.m_ground1,h=this.m_ground2,u=this.m_bodyA,p=this.m_bodyB,d=0;this.m_J.SetZero(),this.m_revolute1?(this.m_J.angularA=-1,d+=u.m_invI):(o=c.m_xf.R,s=this.m_prismatic1.m_localXAxis1,e=o.col1.x*s.x+o.col2.x*s.y,i=o.col1.y*s.x+o.col2.y*s.y,o=u.m_xf.R,n=this.m_localAnchor1.x-u.m_sweep.localCenter.x,r=this.m_localAnchor1.y-u.m_sweep.localCenter.y,l=o.col1.x*n+o.col2.x*r,r=o.col1.y*n+o.col2.y*r,a=(n=l)*i-r*e,this.m_J.linearA.Set(-e,-i),this.m_J.angularA=-a,d+=u.m_invMass+u.m_invI*a*a),this.m_revolute2?(this.m_J.angularB=-this.m_ratio,d+=this.m_ratio*this.m_ratio*p.m_invI):(o=h.m_xf.R,s=this.m_prismatic2.m_localXAxis1,e=o.col1.x*s.x+o.col2.x*s.y,i=o.col1.y*s.x+o.col2.y*s.y,o=p.m_xf.R,n=this.m_localAnchor2.x-p.m_sweep.localCenter.x,r=this.m_localAnchor2.y-p.m_sweep.localCenter.y,l=o.col1.x*n+o.col2.x*r,r=o.col1.y*n+o.col2.y*r,a=(n=l)*i-r*e,this.m_J.linearB.Set(-this.m_ratio*e,-this.m_ratio*i),this.m_J.angularB=-this.m_ratio*a,d+=this.m_ratio*this.m_ratio*(p.m_invMass+p.m_invI*a*a)),this.m_mass=0<d?1/d:0,t.warmStarting?(u.m_linearVelocity.x+=u.m_invMass*this.m_impulse*this.m_J.linearA.x,u.m_linearVelocity.y+=u.m_invMass*this.m_impulse*this.m_J.linearA.y,u.m_angularVelocity+=u.m_invI*this.m_impulse*this.m_J.angularA,p.m_linearVelocity.x+=p.m_invMass*this.m_impulse*this.m_J.linearB.x,p.m_linearVelocity.y+=p.m_invMass*this.m_impulse*this.m_J.linearB.y,p.m_angularVelocity+=p.m_invI*this.m_impulse*this.m_J.angularB):this.m_impulse=0},DUf.prototype.SolveVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=this.m_J.Compute(e.m_linearVelocity,e.m_angularVelocity,i.m_linearVelocity,i.m_angularVelocity),r=-this.m_mass*n;this.m_impulse+=r,e.m_linearVelocity.x+=e.m_invMass*r*this.m_J.linearA.x,e.m_linearVelocity.y+=e.m_invMass*r*this.m_J.linearA.y,e.m_angularVelocity+=e.m_invI*r*this.m_J.angularA,i.m_linearVelocity.x+=i.m_invMass*r*this.m_J.linearB.x,i.m_linearVelocity.y+=i.m_invMass*r*this.m_J.linearB.y,i.m_angularVelocity+=i.m_invI*r*this.m_J.angularB},DUf.prototype.SolvePositionConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=this.m_revolute1?this.m_revolute1.GetJointAngle():this.m_prismatic1.GetJointTranslation(),r=this.m_revolute2?this.m_revolute2.GetJointAngle():this.m_prismatic2.GetJointTranslation(),o=this.m_constant-(n+this.m_ratio*r),s=-this.m_mass*o;return e.m_sweep.c.x+=e.m_invMass*s*this.m_J.linearA.x,e.m_sweep.c.y+=e.m_invMass*s*this.m_J.linearA.y,e.m_sweep.a+=e.m_invI*s*this.m_J.angularA,i.m_sweep.c.x+=i.m_invMass*s*this.m_J.linearB.x,i.m_sweep.c.y+=i.m_invMass*s*this.m_J.linearB.y,i.m_sweep.a+=i.m_invI*s*this.m_J.angularB,e.SynchronizeTransform(),i.SynchronizeTransform(),0<b2Settings$1.b2_linearSlop},DUf),b2GearJointDef$1=(rVf=b2JointDef$1,__extends(sVf,rVf),sVf),b2Jacobian$1=(uVf.prototype.SetZero=function(){this.linearA.SetZero(),this.angularA=0,this.linearB.SetZero(),this.angularB=0},uVf.prototype.Set=function(t,e,i,n){this.linearA.SetV(t),this.angularA=e,this.linearB.SetV(i),this.angularB=n},uVf.prototype.Compute=function(t,e,i,n){return this.linearA.x*t.x+this.linearA.y*t.y+this.angularA*e+(this.linearB.x*i.x+this.linearB.y*i.y)+this.angularB*n},uVf),b2JointEdge$1=function(){},b2LineJoint=(DVf=b2Joint$1,__extends(EVf,DVf),EVf.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},EVf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},EVf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x),t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y))},EVf.prototype.GetReactionTorque=function(t){return t*this.m_impulse.y},EVf.prototype.GetJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchor1),n=e.GetWorldPoint(this.m_localAnchor2),r=n.x-i.x,o=n.y-i.y,s=t.GetWorldVector(this.m_localXAxis1);return s.x*r+s.y*o},EVf.prototype.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.m_xf.R,n=this.m_localAnchor1.x-t.m_sweep.localCenter.x,r=this.m_localAnchor1.y-t.m_sweep.localCenter.y,o=i.col1.x*n+i.col2.x*r,r=i.col1.y*n+i.col2.y*r,n=o;i=e.m_xf.R;var s=this.m_localAnchor2.x-e.m_sweep.localCenter.x,a=this.m_localAnchor2.y-e.m_sweep.localCenter.y,o=i.col1.x*s+i.col2.x*a,a=i.col1.y*s+i.col2.y*a,s=o,l=t.m_sweep.c.x+n,c=t.m_sweep.c.y+r,h=e.m_sweep.c.x+s-l,u=e.m_sweep.c.y+a-c,p=t.GetWorldVector(this.m_localXAxis1),d=t.m_linearVelocity,_=e.m_linearVelocity,f=t.m_angularVelocity,m=e.m_angularVelocity;return h*(-f*p.y)+u*(f*p.x)+(p.x*(_.x+-m*a-d.x- -f*r)+p.y*(_.y+m*s-d.y-f*n))},EVf.prototype.IsLimitEnabled=function(){return this.m_enableLimit},EVf.prototype.EnableLimit=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t},EVf.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},EVf.prototype.GetUpperLimit=function(){return this.m_upperTranslation},EVf.prototype.SetLimits=function(t,e){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e},EVf.prototype.IsMotorEnabled=function(){return this.m_enableMotor},EVf.prototype.EnableMotor=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t},EVf.prototype.SetMotorSpeed=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t},EVf.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},EVf.prototype.SetMaxMotorForce=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t},EVf.prototype.GetMaxMotorForce=function(){return this.m_maxMotorForce},EVf.prototype.GetMotorForce=function(){return this.m_motorImpulse},EVf.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB;this.m_localCenterA.SetV(e.GetLocalCenter()),this.m_localCenterB.SetV(i.GetLocalCenter());var n=e.GetTransform();i.GetTransform(),a=e.m_xf.R;var r=this.m_localAnchor1.x-this.m_localCenterA.x,o=this.m_localAnchor1.y-this.m_localCenterA.y,s=a.col1.x*r+a.col2.x*o,o=a.col1.y*r+a.col2.y*o,r=s,a=i.m_xf.R,l=this.m_localAnchor2.x-this.m_localCenterB.x,c=this.m_localAnchor2.y-this.m_localCenterB.y;s=a.col1.x*l+a.col2.x*c,c=a.col1.y*l+a.col2.y*c,l=s;var h=i.m_sweep.c.x+l-e.m_sweep.c.x-r,u=i.m_sweep.c.y+c-e.m_sweep.c.y-o;this.m_invMassA=e.m_invMass,this.m_invMassB=i.m_invMass,this.m_invIA=e.m_invI,this.m_invIB=i.m_invI,this.m_axis.SetV(b2Math$1.MulMV(n.R,this.m_localXAxis1)),this.m_a1=(h+r)*this.m_axis.y-(u+o)*this.m_axis.x,this.m_a2=l*this.m_axis.y-c*this.m_axis.x,this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2,this.m_motorMass=this.m_motorMass>Number.MIN_VALUE?1/this.m_motorMass:0,this.m_perp.SetV(b2Math$1.MulMV(n.R,this.m_localYAxis1)),this.m_s1=(h+r)*this.m_perp.y-(u+o)*this.m_perp.x,this.m_s2=l*this.m_perp.y-c*this.m_perp.x;var p,d,_,f,m,g=this.m_invMassA,y=this.m_invMassB,b=this.m_invIA,v=this.m_invIB;this.m_K.col1.x=g+y+b*this.m_s1*this.m_s1+v*this.m_s2*this.m_s2,this.m_K.col1.y=b*this.m_s1*this.m_a1+v*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=g+y+b*this.m_a1*this.m_a1+v*this.m_a2*this.m_a2,this.m_enableLimit?(p=this.m_axis.x*h+this.m_axis.y*u,b2Math$1.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings$1.b2_linearSlop?this.m_limitState=b2Joint$1.e_equalLimits:p<=this.m_lowerTranslation?this.m_limitState!=b2Joint$1.e_atLowerLimit&&(this.m_limitState=b2Joint$1.e_atLowerLimit,this.m_impulse.y=0):p>=this.m_upperTranslation?this.m_limitState!=b2Joint$1.e_atUpperLimit&&(this.m_limitState=b2Joint$1.e_atUpperLimit,this.m_impulse.y=0):(this.m_limitState=b2Joint$1.e_inactiveLimit,this.m_impulse.y=0)):this.m_limitState=b2Joint$1.e_inactiveLimit,0==this.m_enableMotor&&(this.m_motorImpulse=0),t.warmStarting?(this.m_impulse.x*=t.dtRatio,this.m_impulse.y*=t.dtRatio,this.m_motorImpulse*=t.dtRatio,d=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.x,_=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.y)*this.m_axis.y,f=this.m_impulse.x*this.m_s1+(this.m_motorImpulse+this.m_impulse.y)*this.m_a1,m=this.m_impulse.x*this.m_s2+(this.m_motorImpulse+this.m_impulse.y)*this.m_a2,e.m_linearVelocity.x-=this.m_invMassA*d,e.m_linearVelocity.y-=this.m_invMassA*_,e.m_angularVelocity-=this.m_invIA*f,i.m_linearVelocity.x+=this.m_invMassB*d,i.m_linearVelocity.y+=this.m_invMassB*_,i.m_angularVelocity+=this.m_invIB*m):(this.m_impulse.SetZero(),this.m_motorImpulse=0)},EVf.prototype.SolveVelocityConstraints=function(t){var e,i,n,r,o,s,a,l,c=this.m_bodyA,h=this.m_bodyB,u=c.m_linearVelocity,p=c.m_angularVelocity,d=h.m_linearVelocity,_=h.m_angularVelocity;this.m_enableMotor&&this.m_limitState!=b2Joint$1.e_equalLimits&&(o=this.m_axis.x*(d.x-u.x)+this.m_axis.y*(d.y-u.y)+this.m_a2*_-this.m_a1*p,s=this.m_motorMass*(this.m_motorSpeed-o),a=this.m_motorImpulse,l=t.dt*this.m_maxMotorForce,this.m_motorImpulse=b2Math$1.Clamp(this.m_motorImpulse+s,-l,l),e=(s=this.m_motorImpulse-a)*this.m_axis.x,i=s*this.m_axis.y,n=s*this.m_a1,r=s*this.m_a2,u.x-=this.m_invMassA*e,u.y-=this.m_invMassA*i,p-=this.m_invIA*n,d.x+=this.m_invMassB*e,d.y+=this.m_invMassB*i,_+=this.m_invIB*r);var f,m,g,y,b,v,x=this.m_perp.x*(d.x-u.x)+this.m_perp.y*(d.y-u.y)+this.m_s2*_-this.m_s1*p;r=this.m_enableLimit&&this.m_limitState!=b2Joint$1.e_inactiveLimit?(f=this.m_axis.x*(d.x-u.x)+this.m_axis.y*(d.y-u.y)+this.m_a2*_-this.m_a1*p,m=this.m_impulse.Copy(),g=this.m_K.Solve(new b2Vec2$1,-x,-f),this.m_impulse.Add(g),this.m_limitState==b2Joint$1.e_atLowerLimit?this.m_impulse.y=b2Math$1.Max(this.m_impulse.y,0):this.m_limitState==b2Joint$1.e_atUpperLimit&&(this.m_impulse.y=b2Math$1.Min(this.m_impulse.y,0)),y=-x-(this.m_impulse.y-m.y)*this.m_K.col2.x,b=0!=this.m_K.col1.x?y/this.m_K.col1.x+m.x:m.x,this.m_impulse.x=b,g.x=this.m_impulse.x-m.x,g.y=this.m_impulse.y-m.y,e=g.x*this.m_perp.x+g.y*this.m_axis.x,i=g.x*this.m_perp.y+g.y*this.m_axis.y,n=g.x*this.m_s1+g.y*this.m_a1,g.x*this.m_s2+g.y*this.m_a2):(v=0!=this.m_K.col1.x?-x/this.m_K.col1.x:0,this.m_impulse.x+=v,e=v*this.m_perp.x,i=v*this.m_perp.y,n=v*this.m_s1,v*this.m_s2),u.x-=this.m_invMassA*e,u.y-=this.m_invMassA*i,p-=this.m_invIA*n,d.x+=this.m_invMassB*e,d.y+=this.m_invMassB*i,_+=this.m_invIB*r,c.m_linearVelocity.SetV(u),c.m_angularVelocity=p,h.m_linearVelocity.SetV(d),h.m_angularVelocity=_},EVf.prototype.SolvePositionConstraints=function(t){var e,i,n,r,o=this.m_bodyA,s=this.m_bodyB,a=o.m_sweep.c,l=o.m_sweep.a,c=s.m_sweep.c,h=s.m_sweep.a,u=0,p=!1,d=0,_=b2Mat22$1.FromAngle(l),f=b2Mat22$1.FromAngle(h),m=_,g=this.m_localAnchor1.x-this.m_localCenterA.x,y=this.m_localAnchor1.y-this.m_localCenterA.y,b=m.col1.x*g+m.col2.x*y,y=m.col1.y*g+m.col2.y*y,g=b;m=f;var v=this.m_localAnchor2.x-this.m_localCenterB.x,x=this.m_localAnchor2.y-this.m_localCenterB.y;b=m.col1.x*v+m.col2.x*x,x=m.col1.y*v+m.col2.y*x,v=b;var A,S=c.x+v-a.x-g,w=c.y+x-a.y-y;this.m_enableLimit&&(this.m_axis=b2Math$1.MulMV(_,this.m_localXAxis1),this.m_a1=(S+g)*this.m_axis.y-(w+y)*this.m_axis.x,this.m_a2=v*this.m_axis.y-x*this.m_axis.x,A=this.m_axis.x*S+this.m_axis.y*w,b2Math$1.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings$1.b2_linearSlop?(d=b2Math$1.Clamp(A,-b2Settings$1.b2_maxLinearCorrection,b2Settings$1.b2_maxLinearCorrection),u=b2Math$1.Abs(A),p=!0):A<=this.m_lowerTranslation?(d=b2Math$1.Clamp(A-this.m_lowerTranslation+b2Settings$1.b2_linearSlop,-b2Settings$1.b2_maxLinearCorrection,0),u=this.m_lowerTranslation-A,p=!0):A>=this.m_upperTranslation&&(d=b2Math$1.Clamp(A-this.m_upperTranslation+b2Settings$1.b2_linearSlop,0,b2Settings$1.b2_maxLinearCorrection),u=A-this.m_upperTranslation,p=!0)),this.m_perp=b2Math$1.MulMV(_,this.m_localYAxis1),this.m_s1=(S+g)*this.m_perp.y-(w+y)*this.m_perp.x,this.m_s2=v*this.m_perp.y-x*this.m_perp.x;var C,P,E=new b2Vec2$1,T=this.m_perp.x*S+this.m_perp.y*w,u=b2Math$1.Max(u,b2Math$1.Abs(T));p?(e=this.m_invMassA,i=this.m_invMassB,n=this.m_invIA,r=this.m_invIB,this.m_K.col1.x=e+i+n*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,this.m_K.col1.y=n*this.m_s1*this.m_a1+r*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=e+i+n*this.m_a1*this.m_a1+r*this.m_a2*this.m_a2,this.m_K.Solve(E,-T,-d)):(e=this.m_invMassA,i=this.m_invMassB,n=this.m_invIA,r=this.m_invIB,P=0!=(C=e+i+n*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2)?-T/C:0,E.x=P,E.y=0);var M=E.x*this.m_perp.x+E.y*this.m_axis.x,D=E.x*this.m_perp.y+E.y*this.m_axis.y,I=E.x*this.m_s1+E.y*this.m_a1,O=E.x*this.m_s2+E.y*this.m_a2;return a.x-=this.m_invMassA*M,a.y-=this.m_invMassA*D,l-=this.m_invIA*I,c.x+=this.m_invMassB*M,c.y+=this.m_invMassB*D,h+=this.m_invIB*O,o.m_sweep.a=l,s.m_sweep.a=h,o.SynchronizeTransform(),s.SynchronizeTransform(),u<=b2Settings$1.b2_linearSlop&&0<=b2Settings$1.b2_angularSlop},EVf),b2LineJointDef=(HXf=b2JointDef$1,__extends(IXf,HXf),IXf.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.localAnchorA=this.bodyA.GetLocalPoint(i),this.localAnchorB=this.bodyB.GetLocalPoint(i),this.localAxisA=this.bodyA.GetLocalVector(n)},IXf),b2MouseJoint$1=(OXf=b2Joint$1,__extends(PXf,OXf),PXf.prototype.GetAnchorA=function(){return this.m_target},PXf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor)},PXf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse.x,t*this.m_impulse.y)},PXf.prototype.GetReactionTorque=function(t){return 0},PXf.prototype.GetTarget=function(){return this.m_target},PXf.prototype.SetTarget=function(t){0==this.m_bodyB.IsAwake()&&this.m_bodyB.SetAwake(!0),this.m_target=t},PXf.prototype.GetMaxForce=function(){return this.m_maxForce},PXf.prototype.SetMaxForce=function(t){this.m_maxForce=t},PXf.prototype.GetFrequency=function(){return this.m_frequencyHz},PXf.prototype.SetFrequency=function(t){this.m_frequencyHz=t},PXf.prototype.GetDampingRatio=function(){return this.m_dampingRatio},PXf.prototype.SetDampingRatio=function(t){this.m_dampingRatio=t},PXf.prototype.InitVelocityConstraints=function(t){var e,i=this.m_bodyB,n=i.GetMass(),r=2*Math.PI*this.m_frequencyHz,o=2*n*this.m_dampingRatio*r,s=n*r*r;this.m_gamma=t.dt*(o+t.dt*s),this.m_gamma=0!=this.m_gamma?1/this.m_gamma:0,this.m_beta=t.dt*s*this.m_gamma,e=i.m_xf.R;var a=this.m_localAnchor.x-i.m_sweep.localCenter.x,l=this.m_localAnchor.y-i.m_sweep.localCenter.y,c=e.col1.x*a+e.col2.x*l,l=e.col1.y*a+e.col2.y*l,a=c,h=i.m_invMass,u=i.m_invI;this.K1.col1.x=h,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=h,this.K2.col1.x=u*l*l,this.K2.col2.x=-u*a*l,this.K2.col1.y=-u*a*l,this.K2.col2.y=u*a*a,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.col1.x+=this.m_gamma,this.K.col2.y+=this.m_gamma,this.K.GetInverse(this.m_mass),this.m_C.x=i.m_sweep.c.x+a-this.m_target.x,this.m_C.y=i.m_sweep.c.y+l-this.m_target.y,i.m_angularVelocity*=.98,this.m_impulse.x*=t.dtRatio,this.m_impulse.y*=t.dtRatio,i.m_linearVelocity.x+=h*this.m_impulse.x,i.m_linearVelocity.y+=h*this.m_impulse.y,i.m_angularVelocity+=u*(a*this.m_impulse.y-l*this.m_impulse.x)},PXf.prototype.SolveVelocityConstraints=function(t){var e,i=this.m_bodyB,n=i.m_xf.R,r=this.m_localAnchor.x-i.m_sweep.localCenter.x,o=this.m_localAnchor.y-i.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s,a=i.m_linearVelocity.x+-i.m_angularVelocity*o,l=i.m_linearVelocity.y+i.m_angularVelocity*r;n=this.m_mass,s=a+this.m_beta*this.m_C.x+this.m_gamma*this.m_impulse.x,e=l+this.m_beta*this.m_C.y+this.m_gamma*this.m_impulse.y;var c=-(n.col1.x*s+n.col2.x*e),h=-(n.col1.y*s+n.col2.y*e),u=this.m_impulse.x,p=this.m_impulse.y;this.m_impulse.x+=c,this.m_impulse.y+=h;var d=t.dt*this.m_maxForce;this.m_impulse.LengthSquared()>d*d&&this.m_impulse.Multiply(d/this.m_impulse.Length()),c=this.m_impulse.x-u,h=this.m_impulse.y-p,i.m_linearVelocity.x+=i.m_invMass*c,i.m_linearVelocity.y+=i.m_invMass*h,i.m_angularVelocity+=i.m_invI*(r*h-o*c)},PXf.prototype.SolvePositionConstraints=function(t){return!0},PXf),b2MouseJointDef$1=(AYf=b2JointDef$1,__extends(BYf,AYf),BYf),b2PrismaticJoint$1=(DYf=b2Joint$1,__extends(EYf,DYf),EYf.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},EYf.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},EYf.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*(this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x),t*(this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y))},EYf.prototype.GetReactionTorque=function(t){return t*this.m_impulse.y},EYf.prototype.GetJointTranslation=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.GetWorldPoint(this.m_localAnchor1),n=e.GetWorldPoint(this.m_localAnchor2),r=n.x-i.x,o=n.y-i.y,s=t.GetWorldVector(this.m_localXAxis1);return s.x*r+s.y*o},EYf.prototype.GetJointSpeed=function(){var t=this.m_bodyA,e=this.m_bodyB,i=t.m_xf.R,n=this.m_localAnchor1.x-t.m_sweep.localCenter.x,r=this.m_localAnchor1.y-t.m_sweep.localCenter.y,o=i.col1.x*n+i.col2.x*r,r=i.col1.y*n+i.col2.y*r,n=o;i=e.m_xf.R;var s=this.m_localAnchor2.x-e.m_sweep.localCenter.x,a=this.m_localAnchor2.y-e.m_sweep.localCenter.y,o=i.col1.x*s+i.col2.x*a,a=i.col1.y*s+i.col2.y*a,s=o,l=t.m_sweep.c.x+n,c=t.m_sweep.c.y+r,h=e.m_sweep.c.x+s-l,u=e.m_sweep.c.y+a-c,p=t.GetWorldVector(this.m_localXAxis1),d=t.m_linearVelocity,_=e.m_linearVelocity,f=t.m_angularVelocity,m=e.m_angularVelocity;return h*(-f*p.y)+u*(f*p.x)+(p.x*(_.x+-m*a-d.x- -f*r)+p.y*(_.y+m*s-d.y-f*n))},EYf.prototype.IsLimitEnabled=function(){return this.m_enableLimit},EYf.prototype.EnableLimit=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableLimit=t},EYf.prototype.GetLowerLimit=function(){return this.m_lowerTranslation},EYf.prototype.GetUpperLimit=function(){return this.m_upperTranslation},EYf.prototype.SetLimits=function(t,e){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_lowerTranslation=t,this.m_upperTranslation=e},EYf.prototype.IsMotorEnabled=function(){return this.m_enableMotor},EYf.prototype.EnableMotor=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor=t},EYf.prototype.SetMotorSpeed=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t},EYf.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},EYf.prototype.SetMaxMotorForce=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_maxMotorForce=t},EYf.prototype.GetMotorForce=function(){return this.m_motorImpulse},EYf.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB;this.m_localCenterA.SetV(e.GetLocalCenter()),this.m_localCenterB.SetV(i.GetLocalCenter());var n=e.GetTransform();i.GetTransform(),a=e.m_xf.R;var r=this.m_localAnchor1.x-this.m_localCenterA.x,o=this.m_localAnchor1.y-this.m_localCenterA.y,s=a.col1.x*r+a.col2.x*o,o=a.col1.y*r+a.col2.y*o,r=s,a=i.m_xf.R,l=this.m_localAnchor2.x-this.m_localCenterB.x,c=this.m_localAnchor2.y-this.m_localCenterB.y;s=a.col1.x*l+a.col2.x*c,c=a.col1.y*l+a.col2.y*c,l=s;var h=i.m_sweep.c.x+l-e.m_sweep.c.x-r,u=i.m_sweep.c.y+c-e.m_sweep.c.y-o;this.m_invMassA=e.m_invMass,this.m_invMassB=i.m_invMass,this.m_invIA=e.m_invI,this.m_invIB=i.m_invI,this.m_axis.SetV(b2Math$1.MulMV(n.R,this.m_localXAxis1)),this.m_a1=(h+r)*this.m_axis.y-(u+o)*this.m_axis.x,this.m_a2=l*this.m_axis.y-c*this.m_axis.x,this.m_motorMass=this.m_invMassA+this.m_invMassB+this.m_invIA*this.m_a1*this.m_a1+this.m_invIB*this.m_a2*this.m_a2,this.m_motorMass>Number.MIN_VALUE&&(this.m_motorMass=1/this.m_motorMass),this.m_perp.SetV(b2Math$1.MulMV(n.R,this.m_localYAxis1)),this.m_s1=(h+r)*this.m_perp.y-(u+o)*this.m_perp.x,this.m_s2=l*this.m_perp.y-c*this.m_perp.x;var p,d,_,f,m,g=this.m_invMassA,y=this.m_invMassB,b=this.m_invIA,v=this.m_invIB;this.m_K.col1.x=g+y+b*this.m_s1*this.m_s1+v*this.m_s2*this.m_s2,this.m_K.col1.y=b*this.m_s1+v*this.m_s2,this.m_K.col1.z=b*this.m_s1*this.m_a1+v*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=b+v,this.m_K.col2.z=b*this.m_a1+v*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=g+y+b*this.m_a1*this.m_a1+v*this.m_a2*this.m_a2,this.m_enableLimit?(p=this.m_axis.x*h+this.m_axis.y*u,b2Math$1.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings$1.b2_linearSlop?this.m_limitState=b2Joint$1.e_equalLimits:p<=this.m_lowerTranslation?this.m_limitState!=b2Joint$1.e_atLowerLimit&&(this.m_limitState=b2Joint$1.e_atLowerLimit,this.m_impulse.z=0):p>=this.m_upperTranslation?this.m_limitState!=b2Joint$1.e_atUpperLimit&&(this.m_limitState=b2Joint$1.e_atUpperLimit,this.m_impulse.z=0):(this.m_limitState=b2Joint$1.e_inactiveLimit,this.m_impulse.z=0)):this.m_limitState=b2Joint$1.e_inactiveLimit,0==this.m_enableMotor&&(this.m_motorImpulse=0),t.warmStarting?(this.m_impulse.x*=t.dtRatio,this.m_impulse.y*=t.dtRatio,this.m_motorImpulse*=t.dtRatio,d=this.m_impulse.x*this.m_perp.x+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.x,_=this.m_impulse.x*this.m_perp.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_axis.y,f=this.m_impulse.x*this.m_s1+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a1,m=this.m_impulse.x*this.m_s2+this.m_impulse.y+(this.m_motorImpulse+this.m_impulse.z)*this.m_a2,e.m_linearVelocity.x-=this.m_invMassA*d,e.m_linearVelocity.y-=this.m_invMassA*_,e.m_angularVelocity-=this.m_invIA*f,i.m_linearVelocity.x+=this.m_invMassB*d,i.m_linearVelocity.y+=this.m_invMassB*_,i.m_angularVelocity+=this.m_invIB*m):(this.m_impulse.SetZero(),this.m_motorImpulse=0)},EYf.prototype.SolveVelocityConstraints=function(t){var e,i,n,r,o,s,a,l,c=this.m_bodyA,h=this.m_bodyB,u=c.m_linearVelocity,p=c.m_angularVelocity,d=h.m_linearVelocity,_=h.m_angularVelocity;this.m_enableMotor&&this.m_limitState!=b2Joint$1.e_equalLimits&&(o=this.m_axis.x*(d.x-u.x)+this.m_axis.y*(d.y-u.y)+this.m_a2*_-this.m_a1*p,s=this.m_motorMass*(this.m_motorSpeed-o),a=this.m_motorImpulse,l=t.dt*this.m_maxMotorForce,this.m_motorImpulse=b2Math$1.Clamp(this.m_motorImpulse+s,-l,l),e=(s=this.m_motorImpulse-a)*this.m_axis.x,i=s*this.m_axis.y,n=s*this.m_a1,r=s*this.m_a2,u.x-=this.m_invMassA*e,u.y-=this.m_invMassA*i,p-=this.m_invIA*n,d.x+=this.m_invMassB*e,d.y+=this.m_invMassB*i,_+=this.m_invIB*r);var f,m,g,y,b,v,x,A=this.m_perp.x*(d.x-u.x)+this.m_perp.y*(d.y-u.y)+this.m_s2*_-this.m_s1*p,S=_-p;r=this.m_enableLimit&&this.m_limitState!=b2Joint$1.e_inactiveLimit?(f=this.m_axis.x*(d.x-u.x)+this.m_axis.y*(d.y-u.y)+this.m_a2*_-this.m_a1*p,m=this.m_impulse.Copy(),g=this.m_K.Solve33(new b2Vec3,-A,-S,-f),this.m_impulse.Add(g),this.m_limitState==b2Joint$1.e_atLowerLimit?this.m_impulse.z=b2Math$1.Max(this.m_impulse.z,0):this.m_limitState==b2Joint$1.e_atUpperLimit&&(this.m_impulse.z=b2Math$1.Min(this.m_impulse.z,0)),y=-A-(this.m_impulse.z-m.z)*this.m_K.col3.x,b=-S-(this.m_impulse.z-m.z)*this.m_K.col3.y,(v=this.m_K.Solve22(new b2Vec2$1,y,b)).x+=m.x,v.y+=m.y,this.m_impulse.x=v.x,this.m_impulse.y=v.y,g.x=this.m_impulse.x-m.x,g.y=this.m_impulse.y-m.y,g.z=this.m_impulse.z-m.z,e=g.x*this.m_perp.x+g.z*this.m_axis.x,i=g.x*this.m_perp.y+g.z*this.m_axis.y,n=g.x*this.m_s1+g.y+g.z*this.m_a1,g.x*this.m_s2+g.y+g.z*this.m_a2):(x=this.m_K.Solve22(new b2Vec2$1,-A,-S),this.m_impulse.x+=x.x,this.m_impulse.y+=x.y,e=x.x*this.m_perp.x,i=x.x*this.m_perp.y,n=x.x*this.m_s1+x.y,x.x*this.m_s2+x.y),u.x-=this.m_invMassA*e,u.y-=this.m_invMassA*i,p-=this.m_invIA*n,d.x+=this.m_invMassB*e,d.y+=this.m_invMassB*i,_+=this.m_invIB*r,c.m_linearVelocity.SetV(u),c.m_angularVelocity=p,h.m_linearVelocity.SetV(d),h.m_angularVelocity=_},EYf.prototype.SolvePositionConstraints=function(t){var e,i,n,r,o=this.m_bodyA,s=this.m_bodyB,a=o.m_sweep.c,l=o.m_sweep.a,c=s.m_sweep.c,h=s.m_sweep.a,u=0,p=!1,d=0,_=b2Mat22$1.FromAngle(l),f=b2Mat22$1.FromAngle(h),m=_,g=this.m_localAnchor1.x-this.m_localCenterA.x,y=this.m_localAnchor1.y-this.m_localCenterA.y,b=m.col1.x*g+m.col2.x*y,y=m.col1.y*g+m.col2.y*y,g=b;m=f;var v=this.m_localAnchor2.x-this.m_localCenterB.x,x=this.m_localAnchor2.y-this.m_localCenterB.y;b=m.col1.x*v+m.col2.x*x,x=m.col1.y*v+m.col2.y*x,v=b;var A,S=c.x+v-a.x-g,w=c.y+x-a.y-y;this.m_enableLimit&&(this.m_axis=b2Math$1.MulMV(_,this.m_localXAxis1),this.m_a1=(S+g)*this.m_axis.y-(w+y)*this.m_axis.x,this.m_a2=v*this.m_axis.y-x*this.m_axis.x,A=this.m_axis.x*S+this.m_axis.y*w,b2Math$1.Abs(this.m_upperTranslation-this.m_lowerTranslation)<2*b2Settings$1.b2_linearSlop?(d=b2Math$1.Clamp(A,-b2Settings$1.b2_maxLinearCorrection,b2Settings$1.b2_maxLinearCorrection),u=b2Math$1.Abs(A),p=!0):A<=this.m_lowerTranslation?(d=b2Math$1.Clamp(A-this.m_lowerTranslation+b2Settings$1.b2_linearSlop,-b2Settings$1.b2_maxLinearCorrection,0),u=this.m_lowerTranslation-A,p=!0):A>=this.m_upperTranslation&&(d=b2Math$1.Clamp(A-this.m_upperTranslation+b2Settings$1.b2_linearSlop,0,b2Settings$1.b2_maxLinearCorrection),u=A-this.m_upperTranslation,p=!0)),this.m_perp=b2Math$1.MulMV(_,this.m_localYAxis1),this.m_s1=(S+g)*this.m_perp.y-(w+y)*this.m_perp.x,this.m_s2=v*this.m_perp.y-x*this.m_perp.x;var C,P,E,T,M=new b2Vec3,D=this.m_perp.x*S+this.m_perp.y*w,I=h-l-this.m_refAngle,u=b2Math$1.Max(u,b2Math$1.Abs(D)),O=b2Math$1.Abs(I);p?(e=this.m_invMassA,i=this.m_invMassB,n=this.m_invIA,r=this.m_invIB,this.m_K.col1.x=e+i+n*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,this.m_K.col1.y=n*this.m_s1+r*this.m_s2,this.m_K.col1.z=n*this.m_s1*this.m_a1+r*this.m_s2*this.m_a2,this.m_K.col2.x=this.m_K.col1.y,this.m_K.col2.y=n+r,this.m_K.col2.z=n*this.m_a1+r*this.m_a2,this.m_K.col3.x=this.m_K.col1.z,this.m_K.col3.y=this.m_K.col2.z,this.m_K.col3.z=e+i+n*this.m_a1*this.m_a1+r*this.m_a2*this.m_a2,this.m_K.Solve33(M,-D,-I,-d)):(e=this.m_invMassA,i=this.m_invMassB,n=this.m_invIA,r=this.m_invIB,C=e+i+n*this.m_s1*this.m_s1+r*this.m_s2*this.m_s2,P=n*this.m_s1+r*this.m_s2,E=n+r,this.m_K.col1.Set(C,P,0),this.m_K.col2.Set(P,E,0),T=this.m_K.Solve22(new b2Vec2$1,-D,-I),M.x=T.x,M.y=T.y,M.z=0);var L=M.x*this.m_perp.x+M.z*this.m_axis.x,F=M.x*this.m_perp.y+M.z*this.m_axis.y,B=M.x*this.m_s1+M.y+M.z*this.m_a1,N=M.x*this.m_s2+M.y+M.z*this.m_a2;return a.x-=this.m_invMassA*L,a.y-=this.m_invMassA*F,l-=this.m_invIA*B,c.x+=this.m_invMassB*L,c.y+=this.m_invMassB*F,h+=this.m_invIB*N,o.m_sweep.a=l,s.m_sweep.a=h,o.SynchronizeTransform(),s.SynchronizeTransform(),u<=b2Settings$1.b2_linearSlop&&O<=b2Settings$1.b2_angularSlop},EYf),b2PrismaticJointDef$1=(N$f=b2JointDef$1,__extends(O$f,N$f),O$f.prototype.Initialize=function(t,e,i,n){this.bodyA=t,this.bodyB=e,this.localAnchorA=this.bodyA.GetLocalPoint(i),this.localAnchorB=this.bodyB.GetLocalPoint(i),this.localAxisA=this.bodyA.GetLocalVector(n),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},O$f),b2PulleyJoint$1=(U$f=b2Joint$1,__extends(V$f,U$f),V$f.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},V$f.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},V$f.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse*this.m_u2.x,t*this.m_impulse*this.m_u2.y)},V$f.prototype.GetReactionTorque=function(t){return 0},V$f.prototype.GetGroundAnchorA=function(){var t=this.m_ground.m_xf.position.Copy();return t.Add(this.m_groundAnchor1),t},V$f.prototype.GetGroundAnchorB=function(){var t=this.m_ground.m_xf.position.Copy();return t.Add(this.m_groundAnchor2),t},V$f.prototype.GetLength1=function(){var t=this.m_bodyA.GetWorldPoint(this.m_localAnchor1),e=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,i=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,n=t.x-e,r=t.y-i;return Math.sqrt(n*n+r*r)},V$f.prototype.GetLength2=function(){var t=this.m_bodyB.GetWorldPoint(this.m_localAnchor2),e=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,i=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,n=t.x-e,r=t.y-i;return Math.sqrt(n*n+r*r)},V$f.prototype.GetRatio=function(){return this.m_ratio},V$f.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s,c=e.m_sweep.c.x+r,h=e.m_sweep.c.y+o,u=i.m_sweep.c.x+a,p=i.m_sweep.c.y+l,d=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,_=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,f=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,m=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y;this.m_u1.Set(c-d,h-_),this.m_u2.Set(u-f,p-m);var g=this.m_u1.Length(),y=this.m_u2.Length();g>b2Settings$1.b2_linearSlop?this.m_u1.Multiply(1/g):this.m_u1.SetZero(),y>b2Settings$1.b2_linearSlop?this.m_u2.Multiply(1/y):this.m_u2.SetZero(),0<this.m_constant-g-this.m_ratio*y?(this.m_state=b2Joint$1.e_inactiveLimit,this.m_impulse=0):this.m_state=b2Joint$1.e_atUpperLimit,g<this.m_maxLength1?(this.m_limitState1=b2Joint$1.e_inactiveLimit,this.m_limitImpulse1=0):this.m_limitState1=b2Joint$1.e_atUpperLimit,y<this.m_maxLength2?(this.m_limitState2=b2Joint$1.e_inactiveLimit,this.m_limitImpulse2=0):this.m_limitState2=b2Joint$1.e_atUpperLimit;var b,v,x,A,S=r*this.m_u1.y-o*this.m_u1.x,w=a*this.m_u2.y-l*this.m_u2.x;this.m_limitMass1=e.m_invMass+e.m_invI*S*S,this.m_limitMass2=i.m_invMass+i.m_invI*w*w,this.m_pulleyMass=this.m_limitMass1+this.m_ratio*this.m_ratio*this.m_limitMass2,this.m_limitMass1=1/this.m_limitMass1,this.m_limitMass2=1/this.m_limitMass2,this.m_pulleyMass=1/this.m_pulleyMass,t.warmStarting?(this.m_impulse*=t.dtRatio,this.m_limitImpulse1*=t.dtRatio,this.m_limitImpulse2*=t.dtRatio,b=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.x,v=(-this.m_impulse-this.m_limitImpulse1)*this.m_u1.y,x=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.x,A=(-this.m_ratio*this.m_impulse-this.m_limitImpulse2)*this.m_u2.y,e.m_linearVelocity.x+=e.m_invMass*b,e.m_linearVelocity.y+=e.m_invMass*v,e.m_angularVelocity+=e.m_invI*(r*v-o*b),i.m_linearVelocity.x+=i.m_invMass*x,i.m_linearVelocity.y+=i.m_invMass*A,i.m_angularVelocity+=i.m_invI*(a*A-l*x)):(this.m_impulse=0,this.m_limitImpulse1=0,this.m_limitImpulse2=0)},V$f.prototype.SolveVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchor1.x-e.m_sweep.localCenter.x,o=this.m_localAnchor1.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a,l,c,h,u,p,d,_,f,m,g,y=this.m_localAnchor2.x-i.m_sweep.localCenter.x,b=this.m_localAnchor2.y-i.m_sweep.localCenter.y,s=n.col1.x*y+n.col2.x*b,b=n.col1.y*y+n.col2.y*b,y=s;this.m_state==b2Joint$1.e_atUpperLimit&&(a=e.m_linearVelocity.x+-e.m_angularVelocity*o,l=e.m_linearVelocity.y+e.m_angularVelocity*r,c=i.m_linearVelocity.x+-i.m_angularVelocity*b,h=i.m_linearVelocity.y+i.m_angularVelocity*y,f=-(this.m_u1.x*a+this.m_u1.y*l)-this.m_ratio*(this.m_u2.x*c+this.m_u2.y*h),m=this.m_pulleyMass*-f,g=this.m_impulse,this.m_impulse=b2Math$1.Max(0,this.m_impulse+m),u=-(m=this.m_impulse-g)*this.m_u1.x,p=-m*this.m_u1.y,d=-this.m_ratio*m*this.m_u2.x,_=-this.m_ratio*m*this.m_u2.y,e.m_linearVelocity.x+=e.m_invMass*u,e.m_linearVelocity.y+=e.m_invMass*p,e.m_angularVelocity+=e.m_invI*(r*p-o*u),i.m_linearVelocity.x+=i.m_invMass*d,i.m_linearVelocity.y+=i.m_invMass*_,i.m_angularVelocity+=i.m_invI*(y*_-b*d)),this.m_limitState1==b2Joint$1.e_atUpperLimit&&(a=e.m_linearVelocity.x+-e.m_angularVelocity*o,l=e.m_linearVelocity.y+e.m_angularVelocity*r,f=-(this.m_u1.x*a+this.m_u1.y*l),m=-this.m_limitMass1*f,g=this.m_limitImpulse1,this.m_limitImpulse1=b2Math$1.Max(0,this.m_limitImpulse1+m),u=-(m=this.m_limitImpulse1-g)*this.m_u1.x,p=-m*this.m_u1.y,e.m_linearVelocity.x+=e.m_invMass*u,e.m_linearVelocity.y+=e.m_invMass*p,e.m_angularVelocity+=e.m_invI*(r*p-o*u)),this.m_limitState2==b2Joint$1.e_atUpperLimit&&(c=i.m_linearVelocity.x+-i.m_angularVelocity*b,h=i.m_linearVelocity.y+i.m_angularVelocity*y,f=-(this.m_u2.x*c+this.m_u2.y*h),m=-this.m_limitMass2*f,g=this.m_limitImpulse2,this.m_limitImpulse2=b2Math$1.Max(0,this.m_limitImpulse2+m),d=-(m=this.m_limitImpulse2-g)*this.m_u2.x,_=-m*this.m_u2.y,i.m_linearVelocity.x+=i.m_invMass*d,i.m_linearVelocity.y+=i.m_invMass*_,i.m_angularVelocity+=i.m_invI*(y*_-b*d))},V$f.prototype.SolvePositionConstraints=function(t){var e,i,n,r,o,s,a,l,c,h,u,p,d,_,f=this.m_bodyA,m=this.m_bodyB,g=this.m_ground.m_xf.position.x+this.m_groundAnchor1.x,y=this.m_ground.m_xf.position.y+this.m_groundAnchor1.y,b=this.m_ground.m_xf.position.x+this.m_groundAnchor2.x,v=this.m_ground.m_xf.position.y+this.m_groundAnchor2.y,x=0;return this.m_state==b2Joint$1.e_atUpperLimit&&(e=f.m_xf.R,i=this.m_localAnchor1.x-f.m_sweep.localCenter.x,n=this.m_localAnchor1.y-f.m_sweep.localCenter.y,_=e.col1.x*i+e.col2.x*n,n=e.col1.y*i+e.col2.y*n,i=_,e=m.m_xf.R,r=this.m_localAnchor2.x-m.m_sweep.localCenter.x,o=this.m_localAnchor2.y-m.m_sweep.localCenter.y,_=e.col1.x*r+e.col2.x*o,o=e.col1.y*r+e.col2.y*o,r=_,s=f.m_sweep.c.x+i,a=f.m_sweep.c.y+n,l=m.m_sweep.c.x+r,c=m.m_sweep.c.y+o,this.m_u1.Set(s-g,a-y),this.m_u2.Set(l-b,c-v),h=this.m_u1.Length(),u=this.m_u2.Length(),h>b2Settings$1.b2_linearSlop?this.m_u1.Multiply(1/h):this.m_u1.SetZero(),u>b2Settings$1.b2_linearSlop?this.m_u2.Multiply(1/u):this.m_u2.SetZero(),p=this.m_constant-h-this.m_ratio*u,x=b2Math$1.Max(x,-p),p=b2Math$1.Clamp(p+b2Settings$1.b2_linearSlop,-b2Settings$1.b2_maxLinearCorrection,0),s=-(d=-this.m_pulleyMass*p)*this.m_u1.x,a=-d*this.m_u1.y,l=-this.m_ratio*d*this.m_u2.x,c=-this.m_ratio*d*this.m_u2.y,f.m_sweep.c.x+=f.m_invMass*s,f.m_sweep.c.y+=f.m_invMass*a,f.m_sweep.a+=f.m_invI*(i*a-n*s),m.m_sweep.c.x+=m.m_invMass*l,m.m_sweep.c.y+=m.m_invMass*c,m.m_sweep.a+=m.m_invI*(r*c-o*l),f.SynchronizeTransform(),m.SynchronizeTransform()),this.m_limitState1==b2Joint$1.e_atUpperLimit&&(e=f.m_xf.R,i=this.m_localAnchor1.x-f.m_sweep.localCenter.x,n=this.m_localAnchor1.y-f.m_sweep.localCenter.y,_=e.col1.x*i+e.col2.x*n,n=e.col1.y*i+e.col2.y*n,i=_,s=f.m_sweep.c.x+i,a=f.m_sweep.c.y+n,this.m_u1.Set(s-g,a-y),(h=this.m_u1.Length())>b2Settings$1.b2_linearSlop?(this.m_u1.x*=1/h,this.m_u1.y*=1/h):this.m_u1.SetZero(),p=this.m_maxLength1-h,x=b2Math$1.Max(x,-p),p=b2Math$1.Clamp(p+b2Settings$1.b2_linearSlop,-b2Settings$1.b2_maxLinearCorrection,0),s=-(d=-this.m_limitMass1*p)*this.m_u1.x,a=-d*this.m_u1.y,f.m_sweep.c.x+=f.m_invMass*s,f.m_sweep.c.y+=f.m_invMass*a,f.m_sweep.a+=f.m_invI*(i*a-n*s),f.SynchronizeTransform()),this.m_limitState2==b2Joint$1.e_atUpperLimit&&(e=m.m_xf.R,r=this.m_localAnchor2.x-m.m_sweep.localCenter.x,o=this.m_localAnchor2.y-m.m_sweep.localCenter.y,_=e.col1.x*r+e.col2.x*o,o=e.col1.y*r+e.col2.y*o,r=_,l=m.m_sweep.c.x+r,c=m.m_sweep.c.y+o,this.m_u2.Set(l-b,c-v),(u=this.m_u2.Length())>b2Settings$1.b2_linearSlop?(this.m_u2.x*=1/u,this.m_u2.y*=1/u):this.m_u2.SetZero(),p=this.m_maxLength2-u,x=b2Math$1.Max(x,-p),p=b2Math$1.Clamp(p+b2Settings$1.b2_linearSlop,-b2Settings$1.b2_maxLinearCorrection,0),l=-(d=-this.m_limitMass2*p)*this.m_u2.x,c=-d*this.m_u2.y,m.m_sweep.c.x+=m.m_invMass*l,m.m_sweep.c.y+=m.m_invMass*c,m.m_sweep.a+=m.m_invI*(r*c-o*l),m.SynchronizeTransform()),x<b2Settings$1.b2_linearSlop},V$f.b2_minPulleyLength=2,V$f),b2PulleyJointDef$1=(x0f=b2JointDef$1,__extends(y0f,x0f),y0f.prototype.Initialize=function(t,e,i,n,r,o,s){this.bodyA=t,this.bodyB=e,this.groundAnchorA.SetV(i),this.groundAnchorB.SetV(n),this.localAnchorA=this.bodyA.GetLocalPoint(r),this.localAnchorB=this.bodyB.GetLocalPoint(o);var a=r.x-i.x,l=r.y-i.y;this.lengthA=Math.sqrt(a*a+l*l);var c=o.x-n.x,h=o.y-n.y;this.lengthB=Math.sqrt(c*c+h*h),this.ratio=s;var u=this.lengthA+this.ratio*this.lengthB;this.maxLengthA=u-this.ratio*b2PulleyJoint$1.b2_minPulleyLength,this.maxLengthB=(u-b2PulleyJoint$1.b2_minPulleyLength)/this.ratio},y0f),b2RevoluteJoint$1=(M0f=b2Joint$1,__extends(N0f,M0f),N0f.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchor1)},N0f.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchor2)},N0f.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse.x,t*this.m_impulse.y)},N0f.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},N0f.prototype.GetJointAngle=function(){return this.m_bodyB.m_sweep.a-this.m_bodyA.m_sweep.a-this.m_referenceAngle},N0f.prototype.GetJointSpeed=function(){return this.m_bodyB.m_angularVelocity-this.m_bodyA.m_angularVelocity},N0f.prototype.IsLimitEnabled=function(){return this.m_enableLimit},N0f.prototype.EnableLimit=function(t){this.m_enableLimit=t},N0f.prototype.GetLowerLimit=function(){return this.m_lowerAngle},N0f.prototype.GetUpperLimit=function(){return this.m_upperAngle},N0f.prototype.SetLimits=function(t,e){this.m_lowerAngle=t,this.m_upperAngle=e},N0f.prototype.IsMotorEnabled=function(){return this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_enableMotor},N0f.prototype.EnableMotor=function(t){this.m_enableMotor=t},N0f.prototype.SetMotorSpeed=function(t){this.m_bodyA.SetAwake(!0),this.m_bodyB.SetAwake(!0),this.m_motorSpeed=t},N0f.prototype.GetMotorSpeed=function(){return this.m_motorSpeed},N0f.prototype.SetMaxMotorTorque=function(t){this.m_maxMotorTorque=t},N0f.prototype.GetMotorTorque=function(){return this.m_maxMotorTorque},N0f.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB;this.m_enableMotor||this.m_enableLimit,s=e.m_xf.R;var n=this.m_localAnchor1.x-e.m_sweep.localCenter.x,r=this.m_localAnchor1.y-e.m_sweep.localCenter.y,o=s.col1.x*n+s.col2.x*r,r=s.col1.y*n+s.col2.y*r,n=o,s=i.m_xf.R,a=this.m_localAnchor2.x-i.m_sweep.localCenter.x,l=this.m_localAnchor2.y-i.m_sweep.localCenter.y;o=s.col1.x*a+s.col2.x*l,l=s.col1.y*a+s.col2.y*l,a=o;var c,h,u,p=e.m_invMass,d=i.m_invMass,_=e.m_invI,f=i.m_invI;this.m_mass.col1.x=p+d+r*r*_+l*l*f,this.m_mass.col2.x=-r*n*_-l*a*f,this.m_mass.col3.x=-r*_-l*f,this.m_mass.col1.y=this.m_mass.col2.x,this.m_mass.col2.y=p+d+n*n*_+a*a*f,this.m_mass.col3.y=n*_+a*f,this.m_mass.col1.z=this.m_mass.col3.x,this.m_mass.col2.z=this.m_mass.col3.y,this.m_mass.col3.z=_+f,this.m_motorMass=1/(_+f),0==this.m_enableMotor&&(this.m_motorImpulse=0),this.m_enableLimit?(c=i.m_sweep.a-e.m_sweep.a-this.m_referenceAngle,b2Math$1.Abs(this.m_upperAngle-this.m_lowerAngle)<2*b2Settings$1.b2_angularSlop?this.m_limitState=b2Joint$1.e_equalLimits:c<=this.m_lowerAngle?(this.m_limitState!=b2Joint$1.e_atLowerLimit&&(this.m_impulse.z=0),this.m_limitState=b2Joint$1.e_atLowerLimit):c>=this.m_upperAngle?(this.m_limitState!=b2Joint$1.e_atUpperLimit&&(this.m_impulse.z=0),this.m_limitState=b2Joint$1.e_atUpperLimit):(this.m_limitState=b2Joint$1.e_inactiveLimit,this.m_impulse.z=0)):this.m_limitState=b2Joint$1.e_inactiveLimit,t.warmStarting?(this.m_impulse.x*=t.dtRatio,this.m_impulse.y*=t.dtRatio,this.m_motorImpulse*=t.dtRatio,h=this.m_impulse.x,u=this.m_impulse.y,e.m_linearVelocity.x-=p*h,e.m_linearVelocity.y-=p*u,e.m_angularVelocity-=_*(n*u-r*h+this.m_motorImpulse+this.m_impulse.z),i.m_linearVelocity.x+=d*h,i.m_linearVelocity.y+=d*u,i.m_angularVelocity+=f*(a*u-l*h+this.m_motorImpulse+this.m_impulse.z)):(this.m_impulse.SetZero(),this.m_motorImpulse=0)},N0f.prototype.SolveVelocityConstraints=function(t){var e,i,n,r,o,s,a,l,c,h,u,p,d,_,f,m=this.m_bodyA,g=this.m_bodyB,y=m.m_linearVelocity,b=m.m_angularVelocity,v=g.m_linearVelocity,x=g.m_angularVelocity,A=m.m_invMass,S=g.m_invMass,w=m.m_invI,C=g.m_invI;this.m_enableMotor&&this.m_limitState!=b2Joint$1.e_equalLimits&&(a=x-b-this.m_motorSpeed,l=this.m_motorMass*-a,c=this.m_motorImpulse,h=t.dt*this.m_maxMotorTorque,this.m_motorImpulse=b2Math$1.Clamp(this.m_motorImpulse+l,-h,h),b-=w*(l=this.m_motorImpulse-c),x+=C*l),this.m_enableLimit&&this.m_limitState!=b2Joint$1.e_inactiveLimit?(e=m.m_xf.R,n=this.m_localAnchor1.x-m.m_sweep.localCenter.x,r=this.m_localAnchor1.y-m.m_sweep.localCenter.y,i=e.col1.x*n+e.col2.x*r,r=e.col1.y*n+e.col2.y*r,n=i,e=g.m_xf.R,o=this.m_localAnchor2.x-g.m_sweep.localCenter.x,s=this.m_localAnchor2.y-g.m_sweep.localCenter.y,i=e.col1.x*o+e.col2.x*s,s=e.col1.y*o+e.col2.y*s,o=i,u=v.x+-x*s-y.x- -b*r,p=v.y+x*o-y.y-b*n,d=x-b,this.m_mass.Solve33(this.impulse3,-u,-p,-d),this.m_limitState==b2Joint$1.e_equalLimits?this.m_impulse.Add(this.impulse3):this.m_limitState==b2Joint$1.e_atLowerLimit?this.m_impulse.z+this.impulse3.z<0&&(this.m_mass.Solve22(this.reduced,-u,-p),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0):this.m_limitState==b2Joint$1.e_atUpperLimit&&0<this.m_impulse.z+this.impulse3.z&&(this.m_mass.Solve22(this.reduced,-u,-p),this.impulse3.x=this.reduced.x,this.impulse3.y=this.reduced.y,this.impulse3.z=-this.m_impulse.z,this.m_impulse.x+=this.reduced.x,this.m_impulse.y+=this.reduced.y,this.m_impulse.z=0),y.x-=A*this.impulse3.x,y.y-=A*this.impulse3.y,b-=w*(n*this.impulse3.y-r*this.impulse3.x+this.impulse3.z),v.x+=S*this.impulse3.x,v.y+=S*this.impulse3.y,x+=C*(o*this.impulse3.y-s*this.impulse3.x+this.impulse3.z)):(e=m.m_xf.R,n=this.m_localAnchor1.x-m.m_sweep.localCenter.x,r=this.m_localAnchor1.y-m.m_sweep.localCenter.y,i=e.col1.x*n+e.col2.x*r,r=e.col1.y*n+e.col2.y*r,n=i,e=g.m_xf.R,o=this.m_localAnchor2.x-g.m_sweep.localCenter.x,s=this.m_localAnchor2.y-g.m_sweep.localCenter.y,i=e.col1.x*o+e.col2.x*s,s=e.col1.y*o+e.col2.y*s,o=i,_=v.x+-x*s-y.x- -b*r,f=v.y+x*o-y.y-b*n,this.m_mass.Solve22(this.impulse2,-_,-f),this.m_impulse.x+=this.impulse2.x,this.m_impulse.y+=this.impulse2.y,y.x-=A*this.impulse2.x,y.y-=A*this.impulse2.y,b-=w*(n*this.impulse2.y-r*this.impulse2.x),v.x+=S*this.impulse2.x,v.y+=S*this.impulse2.y,x+=C*(o*this.impulse2.y-s*this.impulse2.x)),m.m_linearVelocity.SetV(y),m.m_angularVelocity=b,g.m_linearVelocity.SetV(v),g.m_angularVelocity=x},N0f.prototype.SolvePositionConstraints=function(t){var e,i,n,r=this.m_bodyA,o=this.m_bodyB,s=0;this.m_enableLimit&&this.m_limitState!=b2Joint$1.e_inactiveLimit&&(i=o.m_sweep.a-r.m_sweep.a-this.m_referenceAngle,n=0,this.m_limitState==b2Joint$1.e_equalLimits?(e=b2Math$1.Clamp(i-this.m_lowerAngle,-b2Settings$1.b2_maxAngularCorrection,b2Settings$1.b2_maxAngularCorrection),n=-this.m_motorMass*e,s=b2Math$1.Abs(e)):this.m_limitState==b2Joint$1.e_atLowerLimit?(s=-(e=i-this.m_lowerAngle),e=b2Math$1.Clamp(e+b2Settings$1.b2_angularSlop,-b2Settings$1.b2_maxAngularCorrection,0),n=-this.m_motorMass*e):this.m_limitState==b2Joint$1.e_atUpperLimit&&(s=e=i-this.m_upperAngle,e=b2Math$1.Clamp(e-b2Settings$1.b2_angularSlop,0,b2Settings$1.b2_maxAngularCorrection),n=-this.m_motorMass*e),r.m_sweep.a-=r.m_invI*n,o.m_sweep.a+=o.m_invI*n,r.SynchronizeTransform(),o.SynchronizeTransform()),h=r.m_xf.R;var a=this.m_localAnchor1.x-r.m_sweep.localCenter.x,l=this.m_localAnchor1.y-r.m_sweep.localCenter.y,c=h.col1.x*a+h.col2.x*l,l=h.col1.y*a+h.col2.y*l,a=c,h=o.m_xf.R,u=this.m_localAnchor2.x-o.m_sweep.localCenter.x,p=this.m_localAnchor2.y-o.m_sweep.localCenter.y;c=h.col1.x*u+h.col2.x*p,p=h.col1.y*u+h.col2.y*p,u=c;var d,_,f,m=o.m_sweep.c.x+u-r.m_sweep.c.x-a,g=o.m_sweep.c.y+p-r.m_sweep.c.y-l,y=m*m+g*g,b=Math.sqrt(y),v=r.m_invMass,x=o.m_invMass,A=r.m_invI,S=o.m_invI,w=10*b2Settings$1.b2_linearSlop;return w*w<y&&(_=(d=1/(v+x))*-m,f=d*-g,r.m_sweep.c.x-=.5*v*_,r.m_sweep.c.y-=.5*v*f,o.m_sweep.c.x+=.5*x*_,o.m_sweep.c.y+=.5*x*f,m=o.m_sweep.c.x+u-r.m_sweep.c.x-a,g=o.m_sweep.c.y+p-r.m_sweep.c.y-l),this.K1.col1.x=v+x,this.K1.col2.x=0,this.K1.col1.y=0,this.K1.col2.y=v+x,this.K2.col1.x=A*l*l,this.K2.col2.x=-A*a*l,this.K2.col1.y=-A*a*l,this.K2.col2.y=A*a*a,this.K3.col1.x=S*p*p,this.K3.col2.x=-S*u*p,this.K3.col1.y=-S*u*p,this.K3.col2.y=S*u*u,this.K.SetM(this.K1),this.K.AddM(this.K2),this.K.AddM(this.K3),this.K.Solve(N0f.tImpulse,-m,-g),_=N0f.tImpulse.x,f=N0f.tImpulse.y,r.m_sweep.c.x-=r.m_invMass*_,r.m_sweep.c.y-=r.m_invMass*f,r.m_sweep.a-=r.m_invI*(a*f-l*_),o.m_sweep.c.x+=o.m_invMass*_,o.m_sweep.c.y+=o.m_invMass*f,o.m_sweep.a+=o.m_invI*(u*f-p*_),r.SynchronizeTransform(),o.SynchronizeTransform(),b<=b2Settings$1.b2_linearSlop&&s<=b2Settings$1.b2_angularSlop},N0f.tImpulse=new b2Vec2$1,N0f),b2RevoluteJointDef$1=(j2f=b2JointDef$1,__extends(k2f,j2f),k2f.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.localAnchorA=this.bodyA.GetLocalPoint(i),this.localAnchorB=this.bodyB.GetLocalPoint(i),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},k2f),b2WeldJoint=(p2f=b2Joint$1,__extends(q2f,p2f),q2f.prototype.GetAnchorA=function(){return this.m_bodyA.GetWorldPoint(this.m_localAnchorA)},q2f.prototype.GetAnchorB=function(){return this.m_bodyB.GetWorldPoint(this.m_localAnchorB)},q2f.prototype.GetReactionForce=function(t){return new b2Vec2$1(t*this.m_impulse.x,t*this.m_impulse.y)},q2f.prototype.GetReactionTorque=function(t){return t*this.m_impulse.z},q2f.prototype.InitVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchorA.x-e.m_sweep.localCenter.x,o=this.m_localAnchorA.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchorB.x-i.m_sweep.localCenter.x,l=this.m_localAnchorB.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s;var c=e.m_invMass,h=i.m_invMass,u=e.m_invI,p=i.m_invI;this.m_mass.col1.x=c+h+o*o*u+l*l*p,this.m_mass.col2.x=-o*r*u-l*a*p,this.m_mass.col3.x=-o*u-l*p,this.m_mass.col1.y=this.m_mass.col2.x,this.m_mass.col2.y=c+h+r*r*u+a*a*p,this.m_mass.col3.y=r*u+a*p,this.m_mass.col1.z=this.m_mass.col3.x,this.m_mass.col2.z=this.m_mass.col3.y,this.m_mass.col3.z=u+p,t.warmStarting?(this.m_impulse.x*=t.dtRatio,this.m_impulse.y*=t.dtRatio,this.m_impulse.z*=t.dtRatio,e.m_linearVelocity.x-=c*this.m_impulse.x,e.m_linearVelocity.y-=c*this.m_impulse.y,e.m_angularVelocity-=u*(r*this.m_impulse.y-o*this.m_impulse.x+this.m_impulse.z),i.m_linearVelocity.x+=h*this.m_impulse.x,i.m_linearVelocity.y+=h*this.m_impulse.y,i.m_angularVelocity+=p*(a*this.m_impulse.y-l*this.m_impulse.x+this.m_impulse.z)):this.m_impulse.SetZero()},q2f.prototype.SolveVelocityConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_linearVelocity,r=e.m_angularVelocity,o=i.m_linearVelocity,s=i.m_angularVelocity,a=e.m_invMass,l=i.m_invMass,c=e.m_invI,h=i.m_invI,u=e.m_xf.R,p=this.m_localAnchorA.x-e.m_sweep.localCenter.x,d=this.m_localAnchorA.y-e.m_sweep.localCenter.y,_=u.col1.x*p+u.col2.x*d,d=u.col1.y*p+u.col2.y*d,p=_;u=i.m_xf.R;var f=this.m_localAnchorB.x-i.m_sweep.localCenter.x,m=this.m_localAnchorB.y-i.m_sweep.localCenter.y;_=u.col1.x*f+u.col2.x*m,m=u.col1.y*f+u.col2.y*m,f=_;var g=o.x-s*m-n.x+r*d,y=o.y+s*f-n.y-r*p,b=s-r,v=new b2Vec3;this.m_mass.Solve33(v,-g,-y,-b),this.m_impulse.Add(v),n.x-=a*v.x,n.y-=a*v.y,r-=c*(p*v.y-d*v.x+v.z),o.x+=l*v.x,o.y+=l*v.y,s+=h*(f*v.y-m*v.x+v.z),e.m_angularVelocity=r,i.m_angularVelocity=s},q2f.prototype.SolvePositionConstraints=function(t){var e=this.m_bodyA,i=this.m_bodyB,n=e.m_xf.R,r=this.m_localAnchorA.x-e.m_sweep.localCenter.x,o=this.m_localAnchorA.y-e.m_sweep.localCenter.y,s=n.col1.x*r+n.col2.x*o,o=n.col1.y*r+n.col2.y*o,r=s;n=i.m_xf.R;var a=this.m_localAnchorB.x-i.m_sweep.localCenter.x,l=this.m_localAnchorB.y-i.m_sweep.localCenter.y;s=n.col1.x*a+n.col2.x*l,l=n.col1.y*a+n.col2.y*l,a=s;var c=e.m_invMass,h=i.m_invMass,u=e.m_invI,p=i.m_invI,d=i.m_sweep.c.x+a-e.m_sweep.c.x-r,_=i.m_sweep.c.y+l-e.m_sweep.c.y-o,f=i.m_sweep.a-e.m_sweep.a-this.m_referenceAngle,m=10*b2Settings$1.b2_linearSlop,g=Math.sqrt(d*d+_*_),y=b2Math$1.Abs(f);m<g&&(u*=1,p*=1),this.m_mass.col1.x=c+h+o*o*u+l*l*p,this.m_mass.col2.x=-o*r*u-l*a*p,this.m_mass.col3.x=-o*u-l*p,this.m_mass.col1.y=this.m_mass.col2.x,this.m_mass.col2.y=c+h+r*r*u+a*a*p,this.m_mass.col3.y=r*u+a*p,this.m_mass.col1.z=this.m_mass.col3.x,this.m_mass.col2.z=this.m_mass.col3.y,this.m_mass.col3.z=u+p;var b=new b2Vec3;return this.m_mass.Solve33(b,-d,-_,-f),e.m_sweep.c.x-=c*b.x,e.m_sweep.c.y-=c*b.y,e.m_sweep.a-=u*(r*b.y-o*b.x+b.z),i.m_sweep.c.x+=h*b.x,i.m_sweep.c.y+=h*b.y,i.m_sweep.a+=p*(a*b.y-l*b.x+b.z),e.SynchronizeTransform(),i.SynchronizeTransform(),g<=b2Settings$1.b2_linearSlop&&y<=b2Settings$1.b2_angularSlop},q2f),b2WeldJointDef=(v3f=b2JointDef$1,__extends(w3f,v3f),w3f.prototype.Initialize=function(t,e,i){this.bodyA=t,this.bodyB=e,this.localAnchorA.SetV(this.bodyA.GetLocalPoint(i)),this.localAnchorB.SetV(this.bodyB.GetLocalPoint(i)),this.referenceAngle=this.bodyB.GetAngle()-this.bodyA.GetAngle()},w3f),b2TimeStep$1=(B3f.prototype.Set=function(t){this.dt=t.dt,this.inv_dt=t.inv_dt,this.positionIterations=t.positionIterations,this.velocityIterations=t.velocityIterations,this.warmStarting=t.warmStarting},B3f),b2DebugDraw$1=(D3f.prototype.SetFlags=function(t){this.m_drawFlags=t},D3f.prototype.GetFlags=function(){return this.m_drawFlags},D3f.prototype.AppendFlags=function(t){this.m_drawFlags|=t},D3f.prototype.ClearFlags=function(t){this.m_drawFlags&=~t},D3f.prototype.SetSprite=function(t){this.m_sprite=t},D3f.prototype.GetSprite=function(){return this.m_sprite},D3f.prototype.SetDrawScale=function(t){this.m_drawScale=t},D3f.prototype.GetDrawScale=function(){return this.m_drawScale},D3f.prototype.SetLineThickness=function(t){this.m_lineThickness=t},D3f.prototype.GetLineThickness=function(){return this.m_lineThickness},D3f.prototype.SetAlpha=function(t){this.m_alpha=t},D3f.prototype.GetAlpha=function(){return this.m_alpha},D3f.prototype.SetFillAlpha=function(t){this.m_fillAlpha=t},D3f.prototype.GetFillAlpha=function(){return this.m_fillAlpha},D3f.prototype.SetXFormScale=function(t){this.m_xformScale=t},D3f.prototype.GetXFormScale=function(){return this.m_xformScale},D3f.prototype.DrawPolygon=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale);for(var n=1;n<e;n++)this.m_sprite.graphics.lineTo(t[n].x*this.m_drawScale,t[n].y*this.m_drawScale);this.m_sprite.graphics.lineTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale)},D3f.prototype.DrawSolidPolygon=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale),this.m_sprite.graphics.beginFill(i.color,this.m_fillAlpha);for(var n=1;n<e;n++)this.m_sprite.graphics.lineTo(t[n].x*this.m_drawScale,t[n].y*this.m_drawScale);this.m_sprite.graphics.lineTo(t[0].x*this.m_drawScale,t[0].y*this.m_drawScale),this.m_sprite.graphics.endFill()},D3f.prototype.DrawCircle=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.drawCircle(t.x*this.m_drawScale,t.y*this.m_drawScale,e*this.m_drawScale)},D3f.prototype.DrawSolidCircle=function(t,e,i,n){this.m_sprite.graphics.lineStyle(this.m_lineThickness,n.color,this.m_alpha),this.m_sprite.graphics.moveTo(0,0),this.m_sprite.graphics.beginFill(n.color,this.m_fillAlpha),this.m_sprite.graphics.drawCircle(t.x*this.m_drawScale,t.y*this.m_drawScale,e*this.m_drawScale),this.m_sprite.graphics.endFill(),this.m_sprite.graphics.moveTo(t.x*this.m_drawScale,t.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.x+i.x*e)*this.m_drawScale,(t.y+i.y*e)*this.m_drawScale)},D3f.prototype.DrawSegment=function(t,e,i){this.m_sprite.graphics.lineStyle(this.m_lineThickness,i.color,this.m_alpha),this.m_sprite.graphics.moveTo(t.x*this.m_drawScale,t.y*this.m_drawScale),this.m_sprite.graphics.lineTo(e.x*this.m_drawScale,e.y*this.m_drawScale)},D3f.prototype.DrawTransform=function(t){this.m_sprite.graphics.lineStyle(this.m_lineThickness,16711680,this.m_alpha),this.m_sprite.graphics.moveTo(t.position.x*this.m_drawScale,t.position.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.position.x+this.m_xformScale*t.R.col1.x)*this.m_drawScale,(t.position.y+this.m_xformScale*t.R.col1.y)*this.m_drawScale),this.m_sprite.graphics.lineStyle(this.m_lineThickness,65280,this.m_alpha),this.m_sprite.graphics.moveTo(t.position.x*this.m_drawScale,t.position.y*this.m_drawScale),this.m_sprite.graphics.lineTo((t.position.x+this.m_xformScale*t.R.col2.x)*this.m_drawScale,(t.position.y+this.m_xformScale*t.R.col2.y)*this.m_drawScale)},D3f.e_shapeBit=1,D3f.e_jointBit=2,D3f.e_aabbBit=4,D3f.e_pairBit=8,D3f.e_centerOfMassBit=16,D3f.e_controllerBit=32,D3f),b2DestructionListener$1=(e4f.prototype.SayGoodbyeJoint=function(t){},e4f.prototype.SayGoodbyeFixture=function(t){},e4f),b2ContactListener$1=(h4f.prototype.BeginContact=function(t){},h4f.prototype.EndContact=function(t){},h4f.prototype.PreSolve=function(t,e){},h4f.prototype.PostSolve=function(t,e){},h4f.b2_defaultListener=new h4f,h4f),b2ContactFilter$1=(o4f.prototype.ShouldCollide=function(t,e){var i=t.GetFilterData(),n=e.GetFilterData();return i.groupIndex==n.groupIndex&&0!=i.groupIndex?0<i.groupIndex:0!=(i.maskBits&n.categoryBits)&&0!=(i.categoryBits&n.maskBits)},o4f.prototype.RayCollide=function(t,e){return!t||this.ShouldCollide(t,e)},o4f.b2_defaultFilter=new o4f,o4f),b2ContactManager$1=(v4f.prototype.AddPair=function(t,e){var i=e;if((o=(r=t).GetBody())!=(s=i.GetBody())){for(var n,r,o,s,a=s.GetContactList();a;){if(a.other==o){var l=a.contact.GetFixtureA(),c=a.contact.GetFixtureB();if(l==r&&c==i)return;if(l==i&&c==r)return}a=a.next}0!=s.ShouldCollide(o)&&0!=this.m_contactFilter.ShouldCollide(r,i)&&(r=(n=this.m_contactFactory.Create(r,i)).GetFixtureA(),i=n.GetFixtureB(),o=r.m_body,s=i.m_body,n.m_prev=null,n.m_next=this.m_world.m_contactList,null!=this.m_world.m_contactList&&(this.m_world.m_contactList.m_prev=n),((this.m_world.m_contactList=n).m_nodeA.contact=n).m_nodeA.other=s,n.m_nodeA.prev=null,n.m_nodeA.next=o.m_contactList,null!=o.m_contactList&&(o.m_contactList.prev=n.m_nodeA),o.m_contactList=n.m_nodeA,(n.m_nodeB.contact=n).m_nodeB.other=o,n.m_nodeB.prev=null,n.m_nodeB.next=s.m_contactList,null!=s.m_contactList&&(s.m_contactList.prev=n.m_nodeB),s.m_contactList=n.m_nodeB,++this.m_world.m_contactCount)}},v4f.prototype.FindNewContacts=function(){this.m_broadPhase.UpdatePairs(this.AddPairDelegate)},v4f.prototype.Destroy=function(t){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();t.IsTouching()&&this.m_contactListener.EndContact(t),t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_world.m_contactList&&(this.m_world.m_contactList=t.m_next),t.m_nodeA.prev&&(t.m_nodeA.prev.next=t.m_nodeA.next),t.m_nodeA.next&&(t.m_nodeA.next.prev=t.m_nodeA.prev),t.m_nodeA==n.m_contactList&&(n.m_contactList=t.m_nodeA.next),t.m_nodeB.prev&&(t.m_nodeB.prev.next=t.m_nodeB.next),t.m_nodeB.next&&(t.m_nodeB.next.prev=t.m_nodeB.prev),t.m_nodeB==r.m_contactList&&(r.m_contactList=t.m_nodeB.next),this.m_contactFactory.Destroy(t),--this.m_contactCount},v4f.prototype.Collide=function(){for(var t=this.m_world.m_contactList;t;){var e=t.GetFixtureA(),i=t.GetFixtureB(),n=e.GetBody(),r=i.GetBody();if(0!=n.IsAwake()||0!=r.IsAwake()){if(t.m_flags&b2Contact$1.e_filterFlag){if(0==r.ShouldCollide(n)){var o=t,t=o.GetNext();this.Destroy(o);continue}if(0==this.m_contactFilter.ShouldCollide(e,i)){t=(o=t).GetNext(),this.Destroy(o);continue}t.m_flags&=~b2Contact$1.e_filterFlag}var s=e.m_proxy,a=i.m_proxy;0!=this.m_broadPhase.TestOverlap(s,a)?(t.Update(this.m_contactListener),t=t.GetNext()):(t=(o=t).GetNext(),this.Destroy(o))}else t=t.GetNext()}},v4f.s_evalCP=new b2ContactPoint$1,v4f),v3f,p2f,j2f,M0f,x0f,U$f,N$f,DYf,AYf,OXf,HXf,DVf,rVf,CUf,wUf,BTf,sTf,lSf,sFf,mEf,uDf,ztf,hrf,brf,Opf,zpf,Wnf,Pnf,Llf,Ilf,Ykf,Vkf,ikf,Sjf,ljf,Pif,Mif,Sff,g2e,V1e,d1e,a1e;function v4f(){var i=this;this.__fast__=!0,this.m_world=null,this.m_contactCount=0,this.m_contactFilter=b2ContactFilter$1.b2_defaultFilter,this.m_contactListener=b2ContactListener$1.b2_defaultListener,this.m_contactFactory=new b2ContactFactory(this.m_allocator),this.m_broadPhase=new b2DynamicTreeBroadPhase,this.AddPairDelegate=function(t,e){return i.AddPair(t,e)}}function o4f(){this.__fast__=!0}function h4f(){this.__fast__=!0}function e4f(){this.__fast__=!0}function D3f(){this.__fast__=!0,this.m_drawScale=1,this.m_lineThickness=1,this.m_alpha=1,this.m_fillAlpha=1,this.m_xformScale=1,this.m_drawFlags=0}function B3f(){this.__fast__=!0}function w3f(){var t=v3f.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.type=b2Joint$1.e_weldJoint,t.referenceAngle=0,t}function q2f(t){var e=p2f.call(this,t)||this;return e.m_localAnchorA=new b2Vec2$1,e.m_localAnchorB=new b2Vec2$1,e.m_impulse=new b2Vec3,e.m_mass=new b2Mat33,e.m_localAnchorA.SetV(t.localAnchorA),e.m_localAnchorB.SetV(t.localAnchorB),e.m_referenceAngle=t.referenceAngle,e.m_impulse.SetZero(),e.m_mass=new b2Mat33,e}function k2f(){var t=j2f.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.type=b2Joint$1.e_revoluteJoint,t.localAnchorA.Set(0,0),t.localAnchorB.Set(0,0),t.referenceAngle=0,t.lowerAngle=0,t.upperAngle=0,t.maxMotorTorque=0,t.motorSpeed=0,t.enableLimit=!1,t.enableMotor=!1,t}function N0f(t){var e=M0f.call(this,t)||this;return e.K=new b2Mat22$1,e.K1=new b2Mat22$1,e.K2=new b2Mat22$1,e.K3=new b2Mat22$1,e.impulse3=new b2Vec3,e.impulse2=new b2Vec2$1,e.reduced=new b2Vec2$1,e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_impulse=new b2Vec3,e.m_mass=new b2Mat33,e.m_localAnchor1.SetV(t.localAnchorA),e.m_localAnchor2.SetV(t.localAnchorB),e.m_referenceAngle=t.referenceAngle,e.m_impulse.SetZero(),e.m_motorImpulse=0,e.m_lowerAngle=t.lowerAngle,e.m_upperAngle=t.upperAngle,e.m_maxMotorTorque=t.maxMotorTorque,e.m_motorSpeed=t.motorSpeed,e.m_enableLimit=t.enableLimit,e.m_enableMotor=t.enableMotor,e.m_limitState=b2Joint$1.e_inactiveLimit,e}function y0f(){var t=x0f.call(this)||this;return t.groundAnchorA=new b2Vec2$1,t.groundAnchorB=new b2Vec2$1,t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.type=b2Joint$1.e_pulleyJoint,t.groundAnchorA.Set(-1,1),t.groundAnchorB.Set(1,1),t.localAnchorA.Set(-1,0),t.localAnchorB.Set(1,0),t.lengthA=0,t.maxLengthA=0,t.lengthB=0,t.maxLengthB=0,t.ratio=1,t.collideConnected=!0,t}function V$f(t){var e=U$f.call(this,t)||this;return e.m_groundAnchor1=new b2Vec2$1,e.m_groundAnchor2=new b2Vec2$1,e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_u1=new b2Vec2$1,e.m_u2=new b2Vec2$1,e.m_ground=e.m_bodyA.m_world.m_groundBody,e.m_groundAnchor1.x=t.groundAnchorA.x-e.m_ground.m_xf.position.x,e.m_groundAnchor1.y=t.groundAnchorA.y-e.m_ground.m_xf.position.y,e.m_groundAnchor2.x=t.groundAnchorB.x-e.m_ground.m_xf.position.x,e.m_groundAnchor2.y=t.groundAnchorB.y-e.m_ground.m_xf.position.y,e.m_localAnchor1.SetV(t.localAnchorA),e.m_localAnchor2.SetV(t.localAnchorB),e.m_ratio=t.ratio,e.m_constant=t.lengthA+e.m_ratio*t.lengthB,e.m_maxLength1=b2Math$1.Min(t.maxLengthA,e.m_constant-e.m_ratio*V$f.b2_minPulleyLength),e.m_maxLength2=b2Math$1.Min(t.maxLengthB,(e.m_constant-V$f.b2_minPulleyLength)/e.m_ratio),e.m_impulse=0,e.m_limitImpulse1=0,e.m_limitImpulse2=0,e}function O$f(){var t=N$f.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.localAxisA=new b2Vec2$1,t.type=b2Joint$1.e_prismaticJoint,t.localAxisA.Set(1,0),t.referenceAngle=0,t.enableLimit=!1,t.lowerTranslation=0,t.upperTranslation=0,t.enableMotor=!1,t.maxMotorForce=0,t.motorSpeed=0,t}function EYf(t){var e=DYf.call(this,t)||this;return e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_localXAxis1=new b2Vec2$1,e.m_localYAxis1=new b2Vec2$1,e.m_axis=new b2Vec2$1,e.m_perp=new b2Vec2$1,e.m_K=new b2Mat33,e.m_impulse=new b2Vec3,e.m_localAnchor1.SetV(t.localAnchorA),e.m_localAnchor2.SetV(t.localAnchorB),e.m_localXAxis1.SetV(t.localAxisA),e.m_localYAxis1.x=-e.m_localXAxis1.y,e.m_localYAxis1.y=e.m_localXAxis1.x,e.m_refAngle=t.referenceAngle,e.m_impulse.SetZero(),e.m_motorMass=0,e.m_motorImpulse=0,e.m_lowerTranslation=t.lowerTranslation,e.m_upperTranslation=t.upperTranslation,e.m_maxMotorForce=t.maxMotorForce,e.m_motorSpeed=t.motorSpeed,e.m_enableLimit=t.enableLimit,e.m_enableMotor=t.enableMotor,e.m_limitState=b2Joint$1.e_inactiveLimit,e.m_axis.SetZero(),e.m_perp.SetZero(),e}function BYf(){var t=AYf.call(this)||this;return t.target=new b2Vec2$1,t.type=b2Joint$1.e_mouseJoint,t.maxForce=0,t.frequencyHz=5,t.dampingRatio=.7,t}function PXf(t){var e=OXf.call(this,t)||this;e.K=new b2Mat22$1,e.K1=new b2Mat22$1,e.K2=new b2Mat22$1,e.m_localAnchor=new b2Vec2$1,e.m_target=new b2Vec2$1,e.m_impulse=new b2Vec2$1,e.m_mass=new b2Mat22$1,e.m_C=new b2Vec2$1,e.m_target.SetV(t.target);var i=e.m_target.x-e.m_bodyB.m_xf.position.x,n=e.m_target.y-e.m_bodyB.m_xf.position.y,r=e.m_bodyB.m_xf.R;return e.m_localAnchor.x=i*r.col1.x+n*r.col1.y,e.m_localAnchor.y=i*r.col2.x+n*r.col2.y,e.m_maxForce=t.maxForce,e.m_impulse.SetZero(),e.m_frequencyHz=t.frequencyHz,e.m_dampingRatio=t.dampingRatio,e.m_beta=0,e.m_gamma=0,e}function IXf(){var t=HXf.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.localAxisA=new b2Vec2$1,t.type=b2Joint$1.e_lineJoint,t.localAxisA.Set(1,0),t.enableLimit=!1,t.lowerTranslation=0,t.upperTranslation=0,t.enableMotor=!1,t.maxMotorForce=0,t.motorSpeed=0,t}function EVf(t){var e=DVf.call(this,t)||this;return e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_localXAxis1=new b2Vec2$1,e.m_localYAxis1=new b2Vec2$1,e.m_axis=new b2Vec2$1,e.m_perp=new b2Vec2$1,e.m_K=new b2Mat22$1,e.m_impulse=new b2Vec2$1,e.m_localAnchor1.SetV(t.localAnchorA),e.m_localAnchor2.SetV(t.localAnchorB),e.m_localXAxis1.SetV(t.localAxisA),e.m_localYAxis1.x=-e.m_localXAxis1.y,e.m_localYAxis1.y=e.m_localXAxis1.x,e.m_impulse.SetZero(),e.m_motorMass=0,e.m_motorImpulse=0,e.m_lowerTranslation=t.lowerTranslation,e.m_upperTranslation=t.upperTranslation,e.m_maxMotorForce=t.maxMotorForce,e.m_motorSpeed=t.motorSpeed,e.m_enableLimit=t.enableLimit,e.m_enableMotor=t.enableMotor,e.m_limitState=b2Joint$1.e_inactiveLimit,e.m_axis.SetZero(),e.m_perp.SetZero(),e}function uVf(){this.linearA=new b2Vec2$1,this.linearB=new b2Vec2$1}function sVf(){var t=rVf.call(this)||this;return t.type=b2Joint$1.e_gearJoint,t.joint1=null,t.joint2=null,t.ratio=1,t}function DUf(t){var e=CUf.call(this,t)||this;e.m_groundAnchor1=new b2Vec2$1,e.m_groundAnchor2=new b2Vec2$1,e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_J=new b2Jacobian$1;var i,n,r=t.joint1.m_type,o=t.joint2.m_type;return e.m_revolute1=null,e.m_prismatic1=null,e.m_revolute2=null,e.m_prismatic2=null,e.m_ground1=t.joint1.GetBodyA(),e.m_bodyA=t.joint1.GetBodyB(),i=r==b2Joint$1.e_revoluteJoint?(e.m_revolute1=t.joint1,e.m_groundAnchor1.SetV(e.m_revolute1.m_localAnchor1),e.m_localAnchor1.SetV(e.m_revolute1.m_localAnchor2),e.m_revolute1.GetJointAngle()):(e.m_prismatic1=t.joint1,e.m_groundAnchor1.SetV(e.m_prismatic1.m_localAnchor1),e.m_localAnchor1.SetV(e.m_prismatic1.m_localAnchor2),e.m_prismatic1.GetJointTranslation()),e.m_ground2=t.joint2.GetBodyA(),e.m_bodyB=t.joint2.GetBodyB(),n=o==b2Joint$1.e_revoluteJoint?(e.m_revolute2=t.joint2,e.m_groundAnchor2.SetV(e.m_revolute2.m_localAnchor1),e.m_localAnchor2.SetV(e.m_revolute2.m_localAnchor2),e.m_revolute2.GetJointAngle()):(e.m_prismatic2=t.joint2,e.m_groundAnchor2.SetV(e.m_prismatic2.m_localAnchor1),e.m_localAnchor2.SetV(e.m_prismatic2.m_localAnchor2),e.m_prismatic2.GetJointTranslation()),e.m_ratio=t.ratio,e.m_constant=i+e.m_ratio*n,e.m_impulse=0,e}function xUf(){var t=wUf.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.type=b2Joint$1.e_frictionJoint,t.maxForce=0,t.maxTorque=0,t}function CTf(t){var e=BTf.call(this,t)||this;return e.m_localAnchorA=new b2Vec2$1,e.m_localAnchorB=new b2Vec2$1,e.m_linearMass=new b2Mat22$1,e.m_linearImpulse=new b2Vec2$1,e.m_localAnchorA.SetV(t.localAnchorA),e.m_localAnchorB.SetV(t.localAnchorB),e.m_linearMass.SetZero(),e.m_angularMass=0,e.m_linearImpulse.SetZero(),e.m_angularImpulse=0,e.m_maxForce=t.maxForce,e.m_maxTorque=t.maxTorque,e}function tTf(){var t=sTf.call(this)||this;return t.localAnchorA=new b2Vec2$1,t.localAnchorB=new b2Vec2$1,t.type=b2Joint$1.e_distanceJoint,t.length=1,t.frequencyHz=0,t.dampingRatio=0,t}function mSf(t){var e=lSf.call(this,t)||this;return e.m_localAnchor1=new b2Vec2$1,e.m_localAnchor2=new b2Vec2$1,e.m_u=new b2Vec2$1,e.m_localAnchor1.SetV(t.localAnchorA),e.m_localAnchor2.SetV(t.localAnchorB),e.m_length=t.length,e.m_frequencyHz=t.frequencyHz,e.m_dampingRatio=t.dampingRatio,e.m_impulse=0,e.m_gamma=0,e.m_bias=0,e}function $Rf(t){this.m_edgeA=new b2JointEdge$1,this.m_edgeB=new b2JointEdge$1,this.m_localCenterA=new b2Vec2$1,this.m_localCenterB=new b2Vec2$1,b2Settings$1.b2Assert(t.bodyA!=t.bodyB),this.m_type=t.type,this.m_prev=null,this.m_next=null,this.m_bodyA=t.bodyA,this.m_bodyB=t.bodyB,this.m_collideConnected=t.collideConnected,this.m_islandFlag=!1,this.m_userData=t.userData}function jRf(){this.__fast__=!0,this.m_bodies=Array(),this.m_contacts=Array(),this.m_joints=Array()}function GQf(){this.__fast__=!0,this.m_filter=new b2FilterData$1,this.m_aabb=new b2AABB$1,this.m_userData=null,this.m_body=null,this.m_next=null,this.m_shape=null,this.m_density=0,this.m_friction=0,this.m_restitution=0}function EQf(){this.__fast__=!0,this.categoryBits=1,this.maskBits=65535,this.groupIndex=0}function mQf(){this.m_normal=new b2Vec2$1,this.m_separations=new Array(b2Settings$1.b2_maxManifoldPoints),this.m_points=new Array(b2Settings$1.b2_maxManifoldPoints);for(var t=0;t<b2Settings$1.b2_maxManifoldPoints;t++)this.m_points[t]=new b2Vec2$1}function cQf(t,e,i){this._r=0,this._g=0,this._b=0,this._r=255*b2Math$1.Clamp(t,0,1)>>>0,this._g=255*b2Math$1.Clamp(e,0,1)>>>0,this._b=255*b2Math$1.Clamp(i,0,1)>>>0}function CPf(){this.m_normal=new b2Vec2$1,this.m_points=new Array(b2Settings$1.b2_maxManifoldPoints);for(var t=0;t<b2Settings$1.b2_maxManifoldPoints;t++)this.m_points[t]=new b2Vec2$1}function iPf(){}function vOf(){this.m_localPoint=new b2Vec2$1,this.m_axis=new b2Vec2$1}function ONf(){this.m_tree=new b2DynamicTree,this.m_moveBuffer=new Array,this.m_pairBuffer=new Array,this.m_pairCount=0}function OMf(){this.m_root=null,this.m_freeList=null,this.m_path=0,this.m_insertionCount=0}function KMf(){this.aabb=new b2AABB$1}function wJf(){}function qJf(){this.__fast__=!0,this.m_pointCount=0,this.m_points=new Array(b2Settings$1.b2_maxManifoldPoints);for(var t=0;t<b2Settings$1.b2_maxManifoldPoints;t++)this.m_points[t]=new b2ManifoldPoint$1;this.m_localPlaneNormal=new b2Vec2$1,this.m_localPoint=new b2Vec2$1}function oJf(){this.__fast__=!0,this.m_localPoint=new b2Vec2$1,this.m_id=new b2ContactID$1,this.Reset()}function mJf(){this.v=new b2Vec2$1,this.id=new b2ContactID$1}function iJf(){this.__fast__=!0,this.features=new Features$1,this.features._m_id=this}function dJf(){this.__fast__=!0}function zIf(){this.__fast__=!0,this.lowerBound=new b2Vec2$1,this.upperBound=new b2Vec2$1}function tFf(){var t=sFf.call(this)||this;return t.__fast__=!0,t.m_type=b2Shape$1.e_polygonShape,t.m_centroid=new b2Vec2$1,t.m_vertices=new Array,t.m_normals=new Array,t}function nEf(t,e){var i=mEf.call(this)||this;return i.__fast__=!0,i.s_supportVec=new b2Vec2$1,i.m_v1=new b2Vec2$1,i.m_v2=new b2Vec2$1,i.m_coreV1=new b2Vec2$1,i.m_coreV2=new b2Vec2$1,i.m_normal=new b2Vec2$1,i.m_direction=new b2Vec2$1,i.m_cornerDir1=new b2Vec2$1,i.m_cornerDir2=new b2Vec2$1,i.m_type=b2Shape$1.e_edgeShape,i.m_prevEdge=null,i.m_nextEdge=null,i.m_v1=t,i.m_v2=e,i.m_direction.Set(i.m_v2.x-i.m_v1.x,i.m_v2.y-i.m_v1.y),i.m_length=i.m_direction.Normalize(),i.m_normal.Set(i.m_direction.y,-i.m_direction.x),i.m_coreV1.Set(-b2Settings$1.b2_toiSlop*(i.m_normal.x-i.m_direction.x)+i.m_v1.x,-b2Settings$1.b2_toiSlop*(i.m_normal.y-i.m_direction.y)+i.m_v1.y),i.m_coreV2.Set(-b2Settings$1.b2_toiSlop*(i.m_normal.x+i.m_direction.x)+i.m_v2.x,-b2Settings$1.b2_toiSlop*(i.m_normal.y+i.m_direction.y)+i.m_v2.y),i.m_cornerDir1=i.m_normal,i.m_cornerDir2.Set(-i.m_normal.x,-i.m_normal.y),i}function vDf(t){void 0===t&&(t=0);var e=uDf.call(this)||this;return e.__fast__=!0,e.m_p=new b2Vec2$1,e.m_type=b2Shape$1.e_circleShape,e.m_radius=t,e}function $Cf(){this.__fast__=!0,this.m_type=$Cf.e_unknownShape,this.m_radius=b2Settings$1.b2_linearSlop}function ECf(){this.__fast__=!0}function KBf(){this.__fast__=!0,this.m_v1=new b2SimplexVertex,this.m_v2=new b2SimplexVertex,this.m_v3=new b2SimplexVertex,this.m_vertices=new Array(3),this.m_vertices[0]=this.m_v1,this.m_vertices[1]=this.m_v2,this.m_vertices[2]=this.m_v3}function IBf(){this.__fast__=!0}function uAf(){}function jAf(t,e,i){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),this.__fast__=!0,this.x=t,this.y=e,this.z=i}function Ozf(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.__fast__=!0,this.x=t,this.y=e}function Izf(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.__fast__=!0,this.position=new b2Vec2$1,this.R=new b2Mat22$1,t&&(this.position.SetV(t),this.R.SetM(e))}function zzf(){this.localCenter=new b2Vec2$1,this.c0=new b2Vec2$1,this.c=new b2Vec2$1}function Wyf(t,e,i){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),this.col1=new b2Vec3,this.col2=new b2Vec3,this.col3=new b2Vec3,t||e||i?(this.col1.SetV(t),this.col2.SetV(e),this.col3.SetV(i)):(this.col1.SetZero(),this.col2.SetZero(),this.col3.SetZero())}function uyf(){this.__fast__=!0,this.col1=new b2Vec2$1,this.col2=new b2Vec2$1,this.col1.x=this.col2.y=1}function fyf(){this.__fast__=!0}function _xf(){}function Bvf(t,e,i){this.__fast__=!0,this.m_contactManager=new b2ContactManager,this.m_destructionListener=null,this.m_boundaryListener=null,this.m_contactFilter=b2ContactFilter.b2_defaultFilter,this.m_contactListener=null,this.m_debugDraw=null,this.m_bodyList=null,this.m_contactList=null,this.m_jointList=null,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,Bvf.m_positionCorrection=!0,Bvf.m_warmStarting=!0,Bvf.m_continuousPhysics=!0,this.m_allowSleep=i,this.m_gravity=e,this.m_lock=!1,this.m_inv_dt0=0,(this.m_contactManager.m_world=this).m_broadPhase=new b2BroadPhase(t,this.m_contactManager);var n=new b2BodyDef;this.m_groundBody=this.CreateBody(n)}function Ouf(t,e,i,n,r){var o;for(this.m_bodyCapacity=t,this.m_contactCapacity=e,this.m_jointCapacity=i,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_allocator=n,this.m_listener=r,this.m_bodies=new Array(t),o=0;o<t;o++)this.m_bodies[o]=null;for(this.m_contacts=new Array(e),o=0;o<e;o++)this.m_contacts[o]=null;for(this.m_joints=new Array(i),o=0;o<i;o++)this.m_joints[o]=null;this.m_positionIterationCount=0}function Luf(){}function ouf(){this.m_drawScale=1,this.m_lineThickness=1,this.m_alpha=1,this.m_fillAlpha=1,this.m_xformScale=1,this.m_drawFlags=0}function Atf(){var t=ztf.call(this)||this;return t.m_nullContact=new b2NullContact,t.m_world=null,t.m_destroyImmediate=!1,t}function utf(){this.__fast__=!0}function ptf(){}function ntf(){}function jsf(t,e){this.__fast__=!0,this.m_xf=new b2XForm,this.m_sweep=new b2Sweep,this.m_linearVelocity=new b2Vec2,this.m_force=new b2Vec2,this.m_flags=0,t.isBullet&&(this.m_flags|=jsf.e_bulletFlag),t.fixedRotation&&(this.m_flags|=jsf.e_fixedRotationFlag),t.allowSleep&&(this.m_flags|=jsf.e_allowSleepFlag),t.isSleeping&&(this.m_flags|=jsf.e_sleepFlag),this.m_world=e,this.m_xf.position.SetV(t.position),this.m_xf.R.Set(t.angle),this.m_sweep.localCenter.SetV(t.massData.center),this.m_sweep.t0=1,this.m_sweep.a0=this.m_sweep.a=t.angle;var i=this.m_xf.R,n=this.m_sweep.localCenter;this.m_sweep.c.x=i.col1.x*n.x+i.col2.x*n.y,this.m_sweep.c.y=i.col1.y*n.x+i.col2.y*n.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_jointList=null,this.m_contactList=null,this.m_prev=null,this.m_next=null,this.m_linearDamping=t.linearDamping,this.m_angularDamping=t.angularDamping,this.m_force.Set(0,0),this.m_torque=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_sleepTime=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=t.massData.mass,0<this.m_mass&&(this.m_invMass=1/this.m_mass),0==(this.m_flags&jsf.e_fixedRotationFlag)&&(this.m_I=t.massData.I),0<this.m_I&&(this.m_invI=1/this.m_I),0==this.m_invMass&&0==this.m_invI?this.m_type=jsf.e_staticType:this.m_type=jsf.e_dynamicType,this.m_userData=t.userData,this.m_shapeList=null,this.m_shapeCount=0}function irf(t){var e=hrf.call(this,t)||this;return e.m_localAnchor1=new b2Vec2,e.m_localAnchor2=new b2Vec2,e.m_u=new b2Vec2,e.m_localAnchor1.SetV(t.localAnchor1),e.m_localAnchor2.SetV(t.localAnchor2),e.m_length=t.length,e.m_frequencyHz=t.frequencyHz,e.m_dampingRatio=t.dampingRatio,e.m_impulse=0,e.m_gamma=0,e.m_bias=0,e.m_inv_dt=0,e}function crf(){var t=brf.call(this)||this;return t.localAnchor1=new b2Vec2,t.localAnchor2=new b2Vec2,t.type=b2Joint.e_revoluteJoint,t.localAnchor1.Set(0,0),t.localAnchor2.Set(0,0),t.referenceAngle=0,t.lowerAngle=0,t.upperAngle=0,t.maxMotorTorque=0,t.motorSpeed=0,t.enableLimit=!1,t.enableMotor=!1,t}function Ppf(t){var e=Opf.call(this,t)||this;return e.K=new b2Mat22,e.K1=new b2Mat22,e.K2=new b2Mat22,e.K3=new b2Mat22,e.m_localAnchor1=new b2Vec2,e.m_localAnchor2=new b2Vec2,e.m_pivotForce=new b2Vec2,e.m_pivotMass=new b2Mat22,e.m_localAnchor1.SetV(t.localAnchor1),e.m_localAnchor2.SetV(t.localAnchor2),e.m_referenceAngle=t.referenceAngle,e.m_pivotForce.Set(0,0),e.m_motorForce=0,e.m_limitForce=0,e.m_limitPositionImpulse=0,e.m_lowerAngle=t.lowerAngle,e.m_upperAngle=t.upperAngle,e.m_maxMotorTorque=t.maxMotorTorque,e.m_motorSpeed=t.motorSpeed,e.m_enableLimit=t.enableLimit,e.m_enableMotor=t.enableMotor,e}function Apf(){var t=zpf.call(this)||this;return t.groundAnchor1=new b2Vec2,t.groundAnchor2=new b2Vec2,t.localAnchor1=new b2Vec2,t.localAnchor2=new b2Vec2,t.type=b2Joint.e_pulleyJoint,t.groundAnchor1.Set(-1,1),t.groundAnchor2.Set(1,1),t.localAnchor1.Set(-1,0),t.localAnchor2.Set(1,0),t.length1=0,t.maxLength1=0,t.length2=0,t.maxLength2=0,t.ratio=1,t.collideConnected=!0,t}function Xnf(t){var e=Wnf.call(this,t)||this;return e.m_groundAnchor1=new b2Vec2,e.m_groundAnchor2=new b2Vec2,e.m_localAnchor1=new b2Vec2,e.m_localAnchor2=new b2Vec2,e.m_u1=new b2Vec2,e.m_u2=new b2Vec2,e.m_ground=e.m_body1.m_world.m_groundBody,e.m_groundAnchor1.x=t.groundAnchor1.x-e.m_ground.m_xf.position.x,e.m_groundAnchor1.y=t.groundAnchor1.y-e.m_ground.m_xf.position.y,e.m_groundAnchor2.x=t.groundAnchor2.x-e.m_ground.m_xf.position.x,e.m_groundAnchor2.y=t.groundAnchor2.y-e.m_ground.m_xf.position.y,e.m_localAnchor1.SetV(t.localAnchor1),e.m_localAnchor2.SetV(t.localAnchor2),e.m_ratio=t.ratio,e.m_constant=t.length1+e.m_ratio*t.length2,e.m_maxLength1=b2Math.b2Min(t.maxLength1,e.m_constant-e.m_ratio*Xnf.b2_minPulleyLength),e.m_maxLength2=b2Math.b2Min(t.maxLength2,(e.m_constant-Xnf.b2_minPulleyLength)/e.m_ratio),e.m_force=0,e.m_limitForce1=0,e.m_limitForce2=0,e}function Qnf(){var t=Pnf.call(this)||this;return t.localAnchor1=new b2Vec2,t.localAnchor2=new b2Vec2,t.localAxis1=new b2Vec2,t.type=b2Joint.e_prismaticJoint,t.localAxis1.Set(1,0),t.referenceAngle=0,t.enableLimit=!1,t.lowerTranslation=0,t.upperTranslation=0,t.enableMotor=!1,t.maxMotorForce=0,t.motorSpeed=0,t}function Mlf(t){var e=Llf.call(this,t)||this;return e.m_localAnchor1=new b2Vec2,e.m_localAnchor2=new b2Vec2,e.m_localXAxis1=new b2Vec2,e.m_localYAxis1=new b2Vec2,e.m_linearJacobian=new b2Jacobian,e.m_motorJacobian=new b2Jacobian,e.m_localAnchor1.SetV(t.localAnchor1),e.m_localAnchor2.SetV(t.localAnchor2),e.m_localXAxis1.SetV(t.localAxis1),e.m_localYAxis1.x=-e.m_localXAxis1.y,e.m_localYAxis1.y=e.m_localXAxis1.x,e.m_refAngle=t.referenceAngle,e.m_linearJacobian.SetZero(),e.m_linearMass=0,e.m_force=0,e.m_angularMass=0,e.m_torque=0,e.m_motorJacobian.SetZero(),e.m_motorMass=0,e.m_motorForce=0,e.m_limitForce=0,e.m_limitPositionImpulse=0,e.m_lowerTranslation=t.lowerTranslation,e.m_upperTranslation=t.upperTranslation,e.m_maxMotorForce=t.maxMotorForce,e.m_motorSpeed=t.motorSpeed,e.m_enableLimit=t.enableLimit,e.m_enableMotor=t.enableMotor,e}function Jlf(){var t=Ilf.call(this)||this;return t.target=new b2Vec2,t.type=b2Joint.e_mouseJoint,t.maxForce=0,t.frequencyHz=5,t.dampingRatio=.7,t.timeStep=1/60,t}function Zkf(t){var e=Ykf.call(this,t)||this;e.K=new b2Mat22,e.K1=new b2Mat22,e.K2=new b2Mat22,e.m_localAnchor=new b2Vec2,e.m_target=new b2Vec2,e.m_impulse=new b2Vec2,e.m_mass=new b2Mat22,e.m_C=new b2Vec2,e.m_target.SetV(t.target);var i=e.m_target.x-e.m_body2.m_xf.position.x,n=e.m_target.y-e.m_body2.m_xf.position.y,r=e.m_body2.m_xf.R;e.m_localAnchor.x=i*r.col1.x+n*r.col1.y,e.m_localAnchor.y=i*r.col2.x+n*r.col2.y,e.m_maxForce=t.maxForce,e.m_impulse.SetZero();var o=e.m_body2.m_mass,s=2*b2Settings.b2_pi*t.frequencyHz,a=2*o*t.dampingRatio*s,l=t.timeStep*o*(s*s);return e.m_gamma=1/(a+l),e.m_beta=l/(a+l),e}function Wkf(){var t=Vkf.call(this)||this;return t.type=b2Joint.e_gearJoint,t.joint1=null,t.joint2=null,t.ratio=1,t}function jkf(t){var e=ikf.call(this,t)||this;e.m_groundAnchor1=new b2Vec2,e.m_groundAnchor2=new b2Vec2,e.m_localAnchor1=new b2Vec2,e.m_localAnchor2=new b2Vec2,e.m_J=new b2Jacobian;var i,n,r=t.joint1.m_type,o=t.joint2.m_type;return e.m_revolute1=null,e.m_prismatic1=null,e.m_revolute2=null,e.m_prismatic2=null,e.m_ground1=t.joint1.m_body1,e.m_body1=t.joint1.m_body2,i=r==b2Joint.e_revoluteJoint?(e.m_revolute1=t.joint1,e.m_groundAnchor1.SetV(e.m_revolute1.m_localAnchor1),e.m_localAnchor1.SetV(e.m_revolute1.m_localAnchor2),e.m_revolute1.GetJointAngle()):(e.m_prismatic1=t.joint1,e.m_groundAnchor1.SetV(e.m_prismatic1.m_localAnchor1),e.m_localAnchor1.SetV(e.m_prismatic1.m_localAnchor2),e.m_prismatic1.GetJointTranslation()),e.m_ground2=t.joint2.m_body1,e.m_body2=t.joint2.m_body2,n=o==b2Joint.e_revoluteJoint?(e.m_revolute2=t.joint2,e.m_groundAnchor2.SetV(e.m_revolute2.m_localAnchor1),e.m_localAnchor2.SetV(e.m_revolute2.m_localAnchor2),e.m_revolute2.GetJointAngle()):(e.m_prismatic2=t.joint2,e.m_groundAnchor2.SetV(e.m_prismatic2.m_localAnchor1),e.m_localAnchor2.SetV(e.m_prismatic2.m_localAnchor2),e.m_prismatic2.GetJointTranslation()),e.m_ratio=t.ratio,e.m_constant=i+e.m_ratio*n,e.m_force=0,e}function _jf(){this.linear1=new b2Vec2,this.linear2=new b2Vec2}function Tjf(){var t=Sjf.call(this)||this;return t.localAnchor1=new b2Vec2,t.localAnchor2=new b2Vec2,t.type=b2Joint.e_distanceJoint,t.length=1,t.frequencyHz=0,t.dampingRatio=0,t}function Ijf(t){this.__fast__=!0,this.m_node1=new b2JointEdge,this.m_node2=new b2JointEdge,this.m_type=t.type,this.m_prev=null,this.m_next=null,this.m_body1=t.body1,this.m_body2=t.body2,this.m_collideConnected=t.collideConnected,this.m_islandFlag=!1,this.m_userData=t.userData}function mjf(t,e){var i=ljf.call(this,t,e)||this;return i.m0=new b2Manifold,i.m_manifolds=[new b2Manifold],i.m_manifold=i.m_manifolds[0],i.m_manifold.pointCount=0,i}function Qif(t,e){var i=Pif.call(this,t,e)||this;i.m_manifolds=[new b2Manifold],i.m0=new b2Manifold,i.m_manifold=i.m_manifolds[0],b2Settings.b2Assert(i.m_shape1.m_type==b2Shape.e_polygonShape),b2Settings.b2Assert(i.m_shape2.m_type==b2Shape.e_circleShape),i.m_manifold.pointCount=0;var n=i.m_manifold.points[0];return n.normalImpulse=0,n.tangentImpulse=0,i}function Nif(){return null!==Mif&&Mif.apply(this,arguments)||this}function kgf(t,e,i,n){var r,o;for(this.m_step=new b2TimeStep,this.m_constraints=[],this.m_step.dt=t.dt,this.m_step.inv_dt=t.inv_dt,this.m_step.maxIterations=t.maxIterations,this.m_allocator=n,a=this.m_constraintCount=0;a<i;++a)r=e[a],this.m_constraintCount+=r.m_manifoldCount;for(a=0;a<this.m_constraintCount;a++)this.m_constraints[a]=new b2ContactConstraint;for(var s=0,a=0;a<i;++a)for(var l=(r=e[a]).m_shape1.m_body,c=r.m_shape2.m_body,h=r.m_manifoldCount,u=r.GetManifolds(),p=r.m_friction,d=r.m_restitution,_=l.m_linearVelocity.x,f=l.m_linearVelocity.y,m=c.m_linearVelocity.x,g=c.m_linearVelocity.y,y=l.m_angularVelocity,b=c.m_angularVelocity,v=0;v<h;++v){var x=u[v],A=x.normal.x,S=x.normal.y,w=this.m_constraints[s];w.body1=l,w.body2=c,w.manifold=x,w.normal.x=A,w.normal.y=S,w.pointCount=x.pointCount,w.friction=p,w.restitution=d;for(var C=0;C<w.pointCount;++C){var P,E=x.points[C],T=w.points[C];T.normalImpulse=E.normalImpulse,T.tangentImpulse=E.tangentImpulse,T.separation=E.separation,T.positionImpulse=0,T.localAnchor1.SetV(E.localPoint1),T.localAnchor2.SetV(E.localPoint2),o=l.m_xf.R;var M=E.localPoint1.x-l.m_sweep.localCenter.x,D=E.localPoint1.y-l.m_sweep.localCenter.y,I=o.col1.x*M+o.col2.x*D,D=o.col1.y*M+o.col2.y*D,M=I;T.r1.Set(M,D),o=c.m_xf.R;var O=E.localPoint2.x-c.m_sweep.localCenter.x,L=E.localPoint2.y-c.m_sweep.localCenter.y;I=o.col1.x*O+o.col2.x*L,L=o.col1.y*O+o.col2.y*L,O=I,T.r2.Set(O,L);var F=M*M+D*D,B=O*O+L*L,N=M*A+D*S,R=O*A+L*S,V=l.m_invMass+c.m_invMass;V+=l.m_invI*(F-N*N)+c.m_invI*(B-R*R),T.normalMass=1/V;var k=l.m_mass*l.m_invMass+c.m_mass*c.m_invMass;k+=l.m_mass*l.m_invI*(F-N*N)+c.m_mass*c.m_invI*(B-R*R),T.equalizedMass=1/k;var U=-A,j=M*S+D*U,G=O*S+L*U,z=l.m_invMass+c.m_invMass;z+=l.m_invI*(F-j*j)+c.m_invI*(B-G*G),T.tangentMass=1/z,(T.velocityBias=0)<T.separation&&(T.velocityBias=-60*T.separation),I=m+-b*L-_- -y*D,P=g+b*O-f-y*M;var $=w.normal.x*I+w.normal.y*P;$<-b2Settings.b2_velocityThreshold&&(T.velocityBias+=-w.restitution*$)}++s}}function Tff(t,e){var i=Sff.call(this,t,e)||this;i.m_manifolds=[new b2Manifold],i.m0=new b2Manifold,i.m_manifold=i.m_manifolds[0],i.m_manifold.pointCount=0;var n=i.m_manifold.points[0];return n.normalImpulse=0,n.tangentImpulse=0,i}function Fff(t,e){if(void 0===t&&(t=null),void 0===e&&(e=null),this.__fast__=!0,this.m_node1=new b2ContactEdge,this.m_node2=new b2ContactEdge,this.m_flags=0,!t||!e)return this.m_shape1=null,void(this.m_shape2=null);(t.IsSensor()||e.IsSensor())&&(this.m_flags|=Fff.e_nonSolidFlag),this.m_shape1=t,this.m_shape2=e,this.m_manifoldCount=0,this.m_friction=Math.sqrt(this.m_shape1.m_friction*this.m_shape2.m_friction),this.m_restitution=b2Math.b2Max(this.m_shape1.m_restitution,this.m_shape2.m_restitution),this.m_prev=null,this.m_next=null,this.m_node1.contact=null,this.m_node1.prev=null,this.m_node1.next=null,this.m_node1.other=null,this.m_node2.contact=null,this.m_node2.prev=null,this.m_node2.next=null,this.m_node2.other=null}function vff(t,e,i){this._r=0,this._g=0,this._b=0,this._r=255*b2Math.b2Clamp(t,0,1)>>>0,this._g=255*b2Math.b2Clamp(e,0,1)>>>0,this._b=255*b2Math.b2Clamp(i,0,1)>>>0}function Tef(){}function Bef(){this.p1=new b2Vec2,this.p2=new b2Vec2}function vef(){}function qef(){this.__fast__=!0,this.pointCount=0,this.points=new Array(b2Settings.b2_maxManifoldPoints);for(var t=0;t<b2Settings.b2_maxManifoldPoints;t++)this.points[t]=new b2ManifoldPoint;this.normal=new b2Vec2}function oef(){this.localPoint1=new b2Vec2,this.localPoint2=new b2Vec2,this.id=new b2ContactID}function Ubf(){}function Pbf(){this.p=new b2Vec2}function r8e(){}function n8e(){this.features=new Features,this.features._m_id=this}function i8e(){}function I5e(t,e){var i;for(this.m_pairManager=new b2PairManager,this.m_proxyPool=new Array(b2Settings.b2_maxPairs),this.m_bounds=new Array(2*b2Settings.b2_maxProxies),this.m_queryResults=new Array(b2Settings.b2_maxProxies),this.m_quantizationFactor=new b2Vec2,this.m_pairManager.Initialize(this,e),this.m_worldAABB=t,i=this.m_proxyCount=0;i<b2Settings.b2_maxProxies;i++)this.m_queryResults[i]=0;for(this.m_bounds=new Array(2),i=0;i<2;i++){this.m_bounds[i]=new Array(2*b2Settings.b2_maxProxies);for(var n=0;n<2*b2Settings.b2_maxProxies;n++)this.m_bounds[i][n]=new b2Bound}var r,o=t.upperBound.x-t.lowerBound.x,s=t.upperBound.y-t.lowerBound.y;for(this.m_quantizationFactor.x=b2Settings.USHRT_MAX/o,this.m_quantizationFactor.y=b2Settings.USHRT_MAX/s,i=0;i<b2Settings.b2_maxProxies-1;++i)r=new b2Proxy,(this.m_proxyPool[i]=r).SetNext(i+1),r.timeStamp=0,r.overlapCount=I5e.b2_invalid,r.userData=null;r=new b2Proxy,(this.m_proxyPool[b2Settings.b2_maxProxies-1]=r).SetNext(b2Pair.b2_nullProxy),r.timeStamp=0,r.overlapCount=I5e.b2_invalid,r.userData=null,this.m_freeProxy=0,this.m_timeStamp=1,this.m_queryResultCount=0}function L4e(){var t;for(this.m_freePair=0,this.m_hashTable=new Array(b2Pair.b2_tableCapacity),t=0;t<b2Pair.b2_tableCapacity;++t)this.m_hashTable[t]=b2Pair.b2_nullPair;for(this.m_pairs=new Array(b2Settings.b2_maxPairs),t=0;t<b2Settings.b2_maxPairs;++t)this.m_pairs[t]=new b2Pair;for(this.m_pairBuffer=new Array(b2Settings.b2_maxPairs),t=0;t<b2Settings.b2_maxPairs;++t)this.m_pairBuffer[t]=new b2BufferedPair;for(t=0;t<b2Settings.b2_maxPairs;++t)this.m_pairs[t].proxyId1=b2Pair.b2_nullProxy,this.m_pairs[t].proxyId2=b2Pair.b2_nullProxy,this.m_pairs[t].userData=null,this.m_pairs[t].status=0,this.m_pairs[t].next=t+1;this.m_pairs[b2Settings.b2_maxPairs-1].next=b2Pair.b2_nullPair,this.m_pairCount=0,this.m_pairBufferCount=0}function J4e(){this.lowerBounds=[0,0],this.upperBounds=[0,0],this.userData=null}function E4e(){}function h2e(t){var e=g2e.call(this,t)||this;e.s_supportVec=new b2Vec2,e.m_obb=new b2OBB,e.m_vertices=new Array(b2Settings.b2_maxPolygonVertices),e.m_normals=new Array(b2Settings.b2_maxPolygonVertices),e.m_coreVertices=new Array(b2Settings.b2_maxPolygonVertices),e.m_type=h2e.e_polygonShape;var i=t;e.m_vertexCount=i.vertexCount;var n=0,r=n,o=n,s=i.vertices;if(!s)return console.error("[B2D] Try create polygon shape from def",t),e;for(void 0!==s.traits&&(s=s.value),n=0;n<e.m_vertexCount;++n)e.m_vertices[n]=s[n].Copy();for(n=0;n<e.m_vertexCount;++n){o=(r=n)+1<e.m_vertexCount?n+1:0;var a=e.m_vertices[o].x-e.m_vertices[r].x,l=e.m_vertices[o].y-e.m_vertices[r].y,c=Math.sqrt(a*a+l*l);e.m_normals[n]=new b2Vec2(l/c,-a/c)}for(e.m_centroid=h2e.ComputeCentroid(s,i.vertexCount),h2e.ComputeOBB(e.m_obb,e.m_vertices,e.m_vertexCount),n=0;n<e.m_vertexCount;++n){r=0<=n-1?n-1:e.m_vertexCount-1,o=n;var h=e.m_normals[r].x,u=e.m_normals[r].y,p=e.m_normals[o].x,d=e.m_normals[o].y,_=e.m_vertices[n].x-e.m_centroid.x,f=e.m_vertices[n].y-e.m_centroid.y,m=h*_+u*f-b2Settings.b2_toiSlop,g=p*_+d*f-b2Settings.b2_toiSlop,y=1/(h*d-u*p);e.m_coreVertices[n]=new b2Vec2(y*(d*m-u*g)+e.m_centroid.x,y*(h*g-p*m)+e.m_centroid.y)}return e}function W1e(){var t=V1e.call(this)||this;t.vertices=new Array(b2Settings.b2_maxPolygonVertices),t.type=b2Shape.e_polygonShape;for(var e=t.vertexCount=0;e<b2Settings.b2_maxPolygonVertices;e++)t.vertices[e]=new b2Vec2;return t}function e1e(t){var e=d1e.call(this,t)||this;e.m_localPosition=new b2Vec2;var i=t;return e.m_type=e1e.e_circleShape,e.m_localPosition.SetV(i.localPosition),e.m_radius=i.radius,e}function b1e(){var t=a1e.call(this)||this;return t.localPosition=new b2Vec2(0,0),t.type=b2Shape.e_circleShape,t.radius=1,t}function $0e(){this.__fast__=!0,this.categoryBits=1,this.maskBits=65535,this.groupIndex=0}function t0e(t){this.__fast__=!0,this.m_userData=t.userData,this.m_friction=t.friction,this.m_restitution=t.restitution,this.m_density=t.density,this.m_body=null,this.m_sweepRadius=0,this.m_next=null,this.m_proxyId=b2Pair.b2_nullProxy,this.m_filter=t.filter.Copy(),this.m_isSensor=t.isSensor}function p0e(){this.lowerBound=new b2Vec2,this.upperBound=new b2Vec2}function o0e(){this.userData=null}function m0e(){}function $$e(){}function U$e(t,e){void 0===t&&(t=null),void 0===e&&(e=null),this.position=new b2Vec2,this.R=new b2Mat22,t&&(this.position.SetV(t),this.R.SetM(e))}function x$e(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.__fast__=!0,this.x=t,this.y=e}function p$e(){this.__fast__=!0,this.localCenter=new b2Vec2,this.c0=new b2Vec2,this.c=new b2Vec2}function QZe(t,e,i){var n,r;void 0===t&&(t=0),void 0===e&&(e=null),void 0===i&&(i=null),this.col1=new b2Vec2,this.col2=new b2Vec2,null!=e&&null!=i?(this.col1.SetV(e),this.col2.SetV(i)):(n=Math.cos(t),r=Math.sin(t),this.col1.x=n,this.col2.x=-r,this.col1.y=r,this.col2.y=n)}function unBoxMethods(t,e){if(!t||void 0===t.traits)return t;for(var i=0,n=Object.getOwnPropertyNames(e);i<n.length;i++){var r=n[i];!t[r]&&t["$Bg"+r]&&(t[r]=t["$Bg"+r])}return t}var b2World$1=(_4f.prototype.SetDestructionListener=function(t){this.m_destructionListener=unBoxMethods(t,b2DestructionListener$1.prototype)},_4f.prototype.SetContactFilter=function(t){this.m_contactManager.m_contactFilter=unBoxMethods(t,b2ContactFilter$1.prototype)},_4f.prototype.SetContactListener=function(t){this.m_contactManager.m_contactListener=unBoxMethods(t,b2ContactListener$1.prototype)},_4f.prototype.SetDebugDraw=function(t){this.m_debugDraw=t},_4f.prototype.SetBroadPhase=function(t){var e=this.m_contactManager.m_broadPhase;this.m_contactManager.m_broadPhase=t;for(var i=this.m_bodyList;i;i=i.m_next)for(var n=i.m_fixtureList;n;n=n.m_next)n.m_proxy=t.CreateProxy(e.GetFatAABB(n.m_proxy),n)},_4f.prototype.Validate=function(){this.m_contactManager.m_broadPhase.Validate()},_4f.prototype.GetProxyCount=function(){return this.m_contactManager.m_broadPhase.GetProxyCount()},_4f.prototype.CreateBody=function(t){if(1==this.IsLocked())return null;var e=new b2Body$1(t,this);return e.m_prev=null,e.m_next=this.m_bodyList,this.m_bodyList&&(this.m_bodyList.m_prev=e),this.m_bodyList=e,++this.m_bodyCount,e},_4f.prototype.DestroyBody=function(t){if(1!=this.IsLocked()){for(var e=t.m_jointList;e;){var i=e,e=e.next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeJoint(i.joint),this.DestroyJoint(i.joint)}for(var n=t.m_controllerList;n;){var r=n,n=n.nextController;r.controller.RemoveBody(t)}for(var o=t.m_contactList;o;){var s=o,o=o.next;this.m_contactManager.Destroy(s.contact)}t.m_contactList=null;for(var a=t.m_fixtureList;a;){var l=a,a=a.m_next;this.m_destructionListener&&this.m_destructionListener.SayGoodbyeFixture(l),l.DestroyProxy(this.m_contactManager.m_broadPhase),l.Destroy()}t.m_fixtureList=null,t.m_fixtureCount=0,t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_bodyList&&(this.m_bodyList=t.m_next),--this.m_bodyCount}},_4f.prototype.CreateJoint=function(t){var e=b2Joint$1.Create(t,null);e.m_prev=null,e.m_next=this.m_jointList,this.m_jointList&&(this.m_jointList.m_prev=e),this.m_jointList=e,++this.m_jointCount,(e.m_edgeA.joint=e).m_edgeA.other=e.m_bodyB,e.m_edgeA.prev=null,e.m_edgeA.next=e.m_bodyA.m_jointList,e.m_bodyA.m_jointList&&(e.m_bodyA.m_jointList.prev=e.m_edgeA),e.m_bodyA.m_jointList=e.m_edgeA,(e.m_edgeB.joint=e).m_edgeB.other=e.m_bodyA,e.m_edgeB.prev=null,e.m_edgeB.next=e.m_bodyB.m_jointList,e.m_bodyB.m_jointList&&(e.m_bodyB.m_jointList.prev=e.m_edgeB),e.m_bodyB.m_jointList=e.m_edgeB;var i=t.bodyA,n=t.bodyB;if(0==t.collideConnected)for(var r=n.GetContactList();r;)r.other==i&&r.contact.FlagForFiltering(),r=r.next;return e},_4f.prototype.DestroyJoint=function(t){var e=t.m_collideConnected;t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),t==this.m_jointList&&(this.m_jointList=t.m_next);var i=t.m_bodyA,n=t.m_bodyB;if(i.SetAwake(!0),n.SetAwake(!0),t.m_edgeA.prev&&(t.m_edgeA.prev.next=t.m_edgeA.next),t.m_edgeA.next&&(t.m_edgeA.next.prev=t.m_edgeA.prev),t.m_edgeA==i.m_jointList&&(i.m_jointList=t.m_edgeA.next),t.m_edgeA.prev=null,t.m_edgeA.next=null,t.m_edgeB.prev&&(t.m_edgeB.prev.next=t.m_edgeB.next),t.m_edgeB.next&&(t.m_edgeB.next.prev=t.m_edgeB.prev),t.m_edgeB==n.m_jointList&&(n.m_jointList=t.m_edgeB.next),t.m_edgeB.prev=null,t.m_edgeB.next=null,b2Joint$1.Destroy(t,null),--this.m_jointCount,0==e)for(var r=n.GetContactList();r;)r.other==i&&r.contact.FlagForFiltering(),r=r.next},_4f.prototype.AddController=function(t){return t.m_next=this.m_controllerList,t.m_prev=null,((this.m_controllerList=t).m_world=this).m_controllerCount++,t},_4f.prototype.RemoveController=function(t){t.m_prev&&(t.m_prev.m_next=t.m_next),t.m_next&&(t.m_next.m_prev=t.m_prev),this.m_controllerList==t&&(this.m_controllerList=t.m_next),this.m_controllerCount--},_4f.prototype.CreateController=function(t){if(t.m_world!=this)throw new Error("Controller can only be a member of one world");return t.m_next=this.m_controllerList,t.m_prev=null,this.m_controllerList&&(this.m_controllerList.m_prev=t),this.m_controllerList=t,++this.m_controllerCount,t.m_world=this,t},_4f.prototype.DestroyController=function(t){t.Clear(),t.m_next&&(t.m_next.m_prev=t.m_prev),t.m_prev&&(t.m_prev.m_next=t.m_next),t==this.m_controllerList&&(this.m_controllerList=t.m_next),--this.m_controllerCount},_4f.prototype.SetWarmStarting=function(t){_4f.m_warmStarting=t},_4f.prototype.SetContinuousPhysics=function(t){_4f.m_continuousPhysics=t},_4f.prototype.GetBodyCount=function(){return this.m_bodyCount},_4f.prototype.GetJointCount=function(){return this.m_jointCount},_4f.prototype.GetContactCount=function(){return this.m_contactCount},_4f.prototype.SetGravity=function(t){this.m_gravity=t},_4f.prototype.GetGravity=function(){return this.m_gravity},_4f.prototype.GetGroundBody=function(){return this.m_groundBody},_4f.prototype.Step=function(t,e,i){this.m_flags&_4f.e_newFixture&&(this.m_contactManager.FindNewContacts(),this.m_flags&=~_4f.e_newFixture),this.m_flags|=_4f.e_locked;var n=_4f.s_timestep2;n.dt=t,n.velocityIterations=e,n.positionIterations=i,n.inv_dt=0<t?1/t:0,n.dtRatio=this.m_inv_dt0*t,n.warmStarting=_4f.m_warmStarting,this.m_contactManager.Collide(),0<n.dt&&this.Solve(n),_4f.m_continuousPhysics&&0<n.dt&&this.SolveTOI(n),0<n.dt&&(this.m_inv_dt0=n.inv_dt),this.m_flags&=~_4f.e_locked},_4f.prototype.ClearForces=function(){for(var t=this.m_bodyList;t;t=t.m_next)t.m_force.SetZero(),t.m_torque=0},_4f.prototype.DrawDebugData=function(){if(null!=this.m_debugDraw){this.m_debugDraw.m_sprite.graphics.clear();var t,e,i,n,r,o,s=this.m_debugDraw.GetFlags(),a=(new b2Vec2$1,new b2Vec2$1,new b2Vec2$1,new b2AABB$1,new b2AABB$1,[new b2Vec2$1,new b2Vec2$1,new b2Vec2$1,new b2Vec2$1]),l=new b2Color$1(0,0,0);if(s&b2DebugDraw$1.e_shapeBit)for(t=this.m_bodyList;t;t=t.m_next)for(o=t.m_xf,e=t.GetFixtureList();e;e=e.m_next)i=e.GetShape(),0==t.IsActive()?l.Set(.5,.5,.3):t.GetType()==b2Body$1.b2_staticBody?l.Set(.5,.9,.5):t.GetType()==b2Body$1.b2_kinematicBody?l.Set(.5,.5,.9):0==t.IsAwake()?l.Set(.6,.6,.6):l.Set(.9,.7,.7),this.DrawShape(i,o,l);if(s&b2DebugDraw$1.e_jointBit)for(n=this.m_jointList;n;n=n.m_next)this.DrawJoint(n);if(s&b2DebugDraw$1.e_controllerBit)for(var c=this.m_controllerList;c;c=c.m_next)c.Draw(this.m_debugDraw);if(s&b2DebugDraw$1.e_pairBit){l.Set(.3,.9,.9);for(var h=this.m_contactManager.m_contactList;h;h=h.GetNext()){var u=h.GetFixtureA(),p=h.GetFixtureB(),d=u.GetAABB().GetCenter(),_=p.GetAABB().GetCenter();this.m_debugDraw.DrawSegment(d,_,l)}}if(s&b2DebugDraw$1.e_aabbBit)for(r=this.m_contactManager.m_broadPhase,a=[new b2Vec2$1,new b2Vec2$1,new b2Vec2$1,new b2Vec2$1],t=this.m_bodyList;t;t=t.GetNext())if(0!=t.IsActive())for(e=t.GetFixtureList();e;e=e.GetNext()){var f=r.GetFatAABB(e.m_proxy);a[0].Set(f.lowerBound.x,f.lowerBound.y),a[1].Set(f.upperBound.x,f.lowerBound.y),a[2].Set(f.upperBound.x,f.upperBound.y),a[3].Set(f.lowerBound.x,f.upperBound.y),this.m_debugDraw.DrawPolygon(a,4,l)}if(s&b2DebugDraw$1.e_centerOfMassBit)for(t=this.m_bodyList;t;t=t.m_next)(o=_4f.s_xf).R=t.m_xf.R,o.position=t.GetWorldCenter(),this.m_debugDraw.DrawTransform(o)}},_4f.prototype.QueryAABB=function(e,t){var i=this.m_contactManager.m_broadPhase;i.Query(function(t){return"function"==typeof e?e(i.GetUserData(t)):e.axApply(null,[i.GetUserData(t)])},t)},_4f.prototype.QueryShape=function(i,n,r){void 0===r&&(r=null),null==r&&(r=new b2Transform).SetIdentity();var o=this.m_contactManager.m_broadPhase,t=new b2AABB$1;n.ComputeAABB(t,r),o.Query(function(t){var e=o.GetUserData(t);return!b2Shape$1.TestOverlap(n,r,e.GetShape(),e.GetBody().GetTransform())||i(e)},t)},_4f.prototype.QueryPoint=function(i,n){var r=this.m_contactManager.m_broadPhase,t=new b2AABB$1;t.lowerBound.Set(n.x-b2Settings$1.b2_linearSlop,n.y-b2Settings$1.b2_linearSlop),t.upperBound.Set(n.x+b2Settings$1.b2_linearSlop,n.y+b2Settings$1.b2_linearSlop),r.Query(function(t){var e=r.GetUserData(t);return!e.TestPoint(n)||i(e)},t)},_4f.prototype.RayCast=function(o,s,a){var l=this.m_contactManager.m_broadPhase,c=new b2RayCastOutput,t=new b2RayCastInput(s,a);l.RayCast(function(t,e){var i=l.GetUserData(e);if(i.RayCast(c,t)){var n=c.fraction,r=new b2Vec2$1((1-n)*s.x+n*a.x,(1-n)*s.y+n*a.y);return o(i,r,c.normal,n)}return t.maxFraction},t)},_4f.prototype.RayCastOne=function(t,e){var r;return this.RayCast(function(t,e,i,n){return r=t,n},t,e),r},_4f.prototype.RayCastAll=function(t,e){var r=new Array;return this.RayCast(function(t,e,i,n){return r[r.length]=t,1},t,e),r},_4f.prototype.GetBodyList=function(){return this.m_bodyList},_4f.prototype.GetJointList=function(){return this.m_jointList},_4f.prototype.GetContactList=function(){return this.m_contactList},_4f.prototype.IsLocked=function(){return 0<(this.m_flags&_4f.e_locked)},_4f.prototype.Solve=function(t){for(var e,i=this.m_controllerList;i;i=i.m_next)i.Step(t);var n=this.m_island;for(n.Initialize(this.m_bodyCount,this.m_contactCount,this.m_jointCount,null,this.m_contactManager.m_contactListener,this.m_contactSolver),e=this.m_bodyList;e;e=e.m_next)e.m_flags&=~b2Body$1.e_islandFlag;for(var r=this.m_contactList;r;r=r.m_next)r.m_flags&=~b2Contact$1.e_islandFlag;for(var o=this.m_jointList;o;o=o.m_next)o.m_islandFlag=!1;this.m_bodyCount;for(var s=this.s_stack,a=this.m_bodyList;a;a=a.m_next)if(!(a.m_flags&b2Body$1.e_islandFlag)&&0!=a.IsAwake()&&0!=a.IsActive()&&a.GetType()!=b2Body$1.b2_staticBody){n.Clear();var l=0;for((s[l++]=a).m_flags|=b2Body$1.e_islandFlag;0<l;)if(e=s[--l],n.AddBody(e),0==e.IsAwake()&&e.SetAwake(!0),e.GetType()!=b2Body$1.b2_staticBody){for(var c,h=e.m_contactList;h;h=h.next)h.contact.m_flags&b2Contact$1.e_islandFlag||1!=h.contact.IsSensor()&&0!=h.contact.IsEnabled()&&0!=h.contact.IsTouching()&&(n.AddContact(h.contact),h.contact.m_flags|=b2Contact$1.e_islandFlag,(c=h.other).m_flags&b2Body$1.e_islandFlag||((s[l++]=c).m_flags|=b2Body$1.e_islandFlag));for(var u=e.m_jointList;u;u=u.next)1!=u.joint.m_islandFlag&&0!=(c=u.other).IsActive()&&(n.AddJoint(u.joint),u.joint.m_islandFlag=!0,c.m_flags&b2Body$1.e_islandFlag||((s[l++]=c).m_flags|=b2Body$1.e_islandFlag))}n.Solve(t,this.m_gravity,this.m_allowSleep);for(var p=0;p<n.m_bodyCount;++p)(e=n.m_bodies[p]).GetType()==b2Body$1.b2_staticBody&&(e.m_flags&=~b2Body$1.e_islandFlag)}for(p=0;p<s.length&&s[p];++p)s[p]=null;for(e=this.m_bodyList;e;e=e.m_next)0!=e.IsAwake()&&0!=e.IsActive()&&e.GetType()!=b2Body$1.b2_staticBody&&e.SynchronizeFixtures();this.m_contactManager.FindNewContacts()},_4f.prototype.SolveTOI=function(t){var e,i,n,r,o,s,a=this.m_island;a.Initialize(this.m_bodyCount,b2Settings$1.b2_maxTOIContactsPerIsland,b2Settings$1.b2_maxTOIJointsPerIsland,null,this.m_contactManager.m_contactListener,this.m_contactSolver);for(var l=_4f.s_queue,c=this.m_bodyList;c;c=c.m_next)c.m_flags&=~b2Body$1.e_islandFlag,c.m_sweep.t0=0;for(p=this.m_contactList;p;p=p.m_next)p.m_flags&=~(b2Contact$1.e_toiFlag|b2Contact$1.e_islandFlag);for(s=this.m_jointList;s;s=s.m_next)s.m_islandFlag=!1;for(;;){for(var h=null,u=1,p=this.m_contactList;p;p=p.m_next)if(1!=p.IsSensor()&&0!=p.IsEnabled()&&0!=p.IsContinuous()){var d=1;if(p.m_flags&b2Contact$1.e_toiFlag)d=p.m_toi;else{if(e=p.m_fixtureA,i=p.m_fixtureB,n=e.m_body,r=i.m_body,!(n.GetType()==b2Body$1.b2_dynamicBody&&0!=n.IsAwake()||r.GetType()==b2Body$1.b2_dynamicBody&&0!=r.IsAwake()))continue;var _=n.m_sweep.t0;n.m_sweep.t0<r.m_sweep.t0?(_=r.m_sweep.t0,n.m_sweep.Advance(_)):r.m_sweep.t0<n.m_sweep.t0&&(_=n.m_sweep.t0,r.m_sweep.Advance(_)),d=p.ComputeTOI(n.m_sweep,r.m_sweep),b2Settings$1.b2Assert(0<=d&&d<=1),0<d&&d<1&&1<(d=(1-d)*_+d)&&(d=1),p.m_toi=d,p.m_flags|=b2Contact$1.e_toiFlag}Number.MIN_VALUE<d&&d<u&&(h=p,u=d)}if(null==h||1-100*Number.MIN_VALUE<u)break;if(e=h.m_fixtureA,i=h.m_fixtureB,n=e.m_body,r=i.m_body,_4f.s_backupA.Set(n.m_sweep),_4f.s_backupB.Set(r.m_sweep),n.Advance(u),r.Advance(u),h.Update(this.m_contactManager.m_contactListener),h.m_flags&=~b2Contact$1.e_toiFlag,1!=h.IsSensor()&&0!=h.IsEnabled()){if(0!=h.IsTouching()){var f=n;f.GetType()!=b2Body$1.b2_dynamicBody&&(f=r),a.Clear();var m,g=0,y=0;for((l[g+y++]=f).m_flags|=b2Body$1.e_islandFlag;0<y;)if(c=l[g++],--y,a.AddBody(c),0==c.IsAwake()&&c.SetAwake(!0),c.GetType()==b2Body$1.b2_dynamicBody){for(o=c.m_contactList;o&&a.m_contactCount!=a.m_contactCapacity;o=o.next)o.contact.m_flags&b2Contact$1.e_islandFlag||1==o.contact.IsSensor()||0==o.contact.IsEnabled()||0==o.contact.IsTouching()||(a.AddContact(o.contact),o.contact.m_flags|=b2Contact$1.e_islandFlag,(m=o.other).m_flags&b2Body$1.e_islandFlag||(m.GetType()!=b2Body$1.b2_staticBody&&(m.Advance(u),m.SetAwake(!0)),l[g+y]=m,++y,m.m_flags|=b2Body$1.e_islandFlag));for(var b=c.m_jointList;b;b=b.next)a.m_jointCount!=a.m_jointCapacity&&1!=b.joint.m_islandFlag&&0!=(m=b.other).IsActive()&&(a.AddJoint(b.joint),b.joint.m_islandFlag=!0,m.m_flags&b2Body$1.e_islandFlag||(m.GetType()!=b2Body$1.b2_staticBody&&(m.Advance(u),m.SetAwake(!0)),l[g+y]=m,++y,m.m_flags|=b2Body$1.e_islandFlag))}var v,x=_4f.s_timestep;for(x.warmStarting=!1,x.dt=(1-u)*t.dt,x.inv_dt=1/x.dt,x.dtRatio=0,x.velocityIterations=t.velocityIterations,x.positionIterations=t.positionIterations,a.SolveTOI(x),v=0;v<a.m_bodyCount;++v)if((c=a.m_bodies[v]).m_flags&=~b2Body$1.e_islandFlag,0!=c.IsAwake()&&c.GetType()==b2Body$1.b2_dynamicBody)for(c.SynchronizeFixtures(),o=c.m_contactList;o;o=o.next)o.contact.m_flags&=~b2Contact$1.e_toiFlag;for(v=0;v<a.m_contactCount;++v)(p=a.m_contacts[v]).m_flags&=~(b2Contact$1.e_toiFlag|b2Contact$1.e_islandFlag);for(v=0;v<a.m_jointCount;++v)(s=a.m_joints[v]).m_islandFlag=!1;this.m_contactManager.FindNewContacts()}}else n.m_sweep.Set(_4f.s_backupA),r.m_sweep.Set(_4f.s_backupB),n.SynchronizeTransform(),r.SynchronizeTransform()}},_4f.prototype.DrawJoint=function(t){var e=t.GetBodyA(),i=t.GetBodyB(),n=e.m_xf,r=i.m_xf,o=n.position,s=r.position,a=t.GetAnchorA(),l=t.GetAnchorB(),c=_4f.s_jointColor;switch(t.m_type){case b2Joint$1.e_distanceJoint:this.m_debugDraw.DrawSegment(a,l,c);break;case b2Joint$1.e_pulleyJoint:var h=t,u=h.GetGroundAnchorA(),p=h.GetGroundAnchorB();this.m_debugDraw.DrawSegment(u,a,c),this.m_debugDraw.DrawSegment(p,l,c),this.m_debugDraw.DrawSegment(u,p,c);break;case b2Joint$1.e_mouseJoint:this.m_debugDraw.DrawSegment(a,l,c);break;default:e!=this.m_groundBody&&this.m_debugDraw.DrawSegment(o,a,c),this.m_debugDraw.DrawSegment(a,l,c),i!=this.m_groundBody&&this.m_debugDraw.DrawSegment(s,l,c)}},_4f.prototype.DrawShape=function(t,e,i){switch(t.m_type){case b2Shape$1.e_circleShape:var n=t,r=b2Math$1.MulX(e,n.m_p),o=n.m_radius,s=e.R.col1;this.m_debugDraw.DrawSolidCircle(r,o,s,i);break;case b2Shape$1.e_polygonShape:for(var a=t,l=a.GetVertexCount(),c=a.GetVertices(),h=new Array(l),u=0;u<l;++u)h[u]=b2Math$1.MulX(e,c[u]);this.m_debugDraw.DrawSolidPolygon(h,l,i);break;case b2Shape$1.e_edgeShape:var p=t;this.m_debugDraw.DrawSegment(b2Math$1.MulX(e,p.GetVertex1()),b2Math$1.MulX(e,p.GetVertex2()),i)}},_4f.s_timestep2=new b2TimeStep$1,_4f.s_xf=new b2Transform,_4f.s_backupA=new b2Sweep$1,_4f.s_backupB=new b2Sweep$1,_4f.s_timestep=new b2TimeStep$1,_4f.s_queue=new Array,_4f.s_jointColor=new b2Color$1(.5,.8,.8),_4f.e_newFixture=1,_4f.e_locked=2,_4f),b2Body$1=(b8f.prototype.connectEdges=function(t,e,i){var n=Math.atan2(e.GetDirectionVector().y,e.GetDirectionVector().x),r=Math.tan(.5*(n-i)),o=b2Math$1.MulFV(r,e.GetDirectionVector()),o=b2Math$1.SubtractVV(o,e.GetNormalVector());o=b2Math$1.MulFV(b2Settings$1.b2_toiSlop,o),o=b2Math$1.AddVV(o,e.GetVertex1());var s=b2Math$1.AddVV(t.GetDirectionVector(),e.GetDirectionVector());s.Normalize();var a=0<b2Math$1.Dot(t.GetDirectionVector(),e.GetNormalVector());return t.SetNextEdge(e,o,s,a),e.SetPrevEdge(t,o,s,a),n},b8f.prototype.CreateFixture=function(t){if(1==this.m_world.IsLocked())return null;var e,i=new b2Fixture;return i.Create(this,this.m_xf,t),this.m_flags&b8f.e_activeFlag&&(e=this.m_world.m_contactManager.m_broadPhase,i.CreateProxy(e,this.m_xf)),i.m_next=this.m_fixtureList,this.m_fixtureList=i,++this.m_fixtureCount,i.m_body=this,0<i.m_density&&this.ResetMassData(),this.m_world.m_flags|=b2World$1.e_newFixture,i},b8f.prototype.CreateFixture2=function(t,e){void 0===e&&(e=0);var i=new b2FixtureDef;return i.shape=t,i.density=e,this.CreateFixture(i)},b8f.prototype.DestroyFixture=function(t){if(1!=this.m_world.IsLocked()){for(var e=this.m_fixtureList,i=null;null!=e;){if(e==t){i?i.m_next=t.m_next:this.m_fixtureList=t.m_next;break}e=(i=e).m_next}for(var n,r=this.m_contactList;r;){var o=r.contact,r=r.next,s=o.GetFixtureA(),a=o.GetFixtureB();t!=s&&t!=a||this.m_world.m_contactManager.Destroy(o)}this.m_flags&b8f.e_activeFlag&&(n=this.m_world.m_contactManager.m_broadPhase,t.DestroyProxy(n)),t.Destroy(),t.m_body=null,t.m_next=null,--this.m_fixtureCount,this.ResetMassData()}},b8f.prototype.SetPositionAndAngle=function(t,e){if(1!=this.m_world.IsLocked()){this.m_xf.R.Set(e),this.m_xf.position.SetV(t);var i=this.m_xf.R,n=this.m_sweep.localCenter;this.m_sweep.c.x=i.col1.x*n.x+i.col2.x*n.y,this.m_sweep.c.y=i.col1.y*n.x+i.col2.y*n.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_sweep.a0=this.m_sweep.a=e;for(var r=this.m_world.m_contactManager.m_broadPhase,o=this.m_fixtureList;o;o=o.m_next)o.Synchronize(r,this.m_xf,this.m_xf);this.m_world.m_contactManager.FindNewContacts()}},b8f.prototype.SetTransform=function(t){this.SetPositionAndAngle(t.position,t.GetAngle())},b8f.prototype.GetTransform=function(){return this.m_xf},b8f.prototype.GetPosition=function(){return this.m_xf.position},b8f.prototype.SetPosition=function(t){this.SetPositionAndAngle(t,this.GetAngle())},b8f.prototype.GetAngle=function(){return this.m_sweep.a},b8f.prototype.SetAngle=function(t){this.SetPositionAndAngle(this.GetPosition(),t)},b8f.prototype.GetWorldCenter=function(){return this.m_sweep.c},b8f.prototype.GetLocalCenter=function(){return this.m_sweep.localCenter},b8f.prototype.SetLinearVelocity=function(t){this.m_type!=b8f.b2_staticBody&&this.m_linearVelocity.SetV(t)},b8f.prototype.GetLinearVelocity=function(){return this.m_linearVelocity},b8f.prototype.SetAngularVelocity=function(t){this.m_type!=b8f.b2_staticBody&&(this.m_angularVelocity=t)},b8f.prototype.GetAngularVelocity=function(){return this.m_angularVelocity},b8f.prototype.GetDefinition=function(){var t=new b2BodyDef$1;return t.type=this.GetType(),t.allowSleep=(this.m_flags&b8f.e_allowSleepFlag)==b8f.e_allowSleepFlag,t.angle=this.GetAngle(),t.angularDamping=this.m_angularDamping,t.angularVelocity=this.m_angularVelocity,t.fixedRotation=(this.m_flags&b8f.e_fixedRotationFlag)==b8f.e_fixedRotationFlag,t.bullet=(this.m_flags&b8f.e_bulletFlag)==b8f.e_bulletFlag,t.awake=(this.m_flags&b8f.e_awakeFlag)==b8f.e_awakeFlag,t.linearDamping=this.m_linearDamping,t.linearVelocity.SetV(this.GetLinearVelocity()),t.position=this.GetPosition(),t.userData=this.GetUserData(),t},b8f.prototype.ApplyForce=function(t,e){this.m_type==b8f.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_force.x+=t.x,this.m_force.y+=t.y,this.m_torque+=(e.x-this.m_sweep.c.x)*t.y-(e.y-this.m_sweep.c.y)*t.x)},b8f.prototype.ApplyTorque=function(t){this.m_type==b8f.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_torque+=t)},b8f.prototype.ApplyImpulse=function(t,e){this.m_type==b8f.b2_dynamicBody&&(0==this.IsAwake()&&this.SetAwake(!0),this.m_linearVelocity.x+=this.m_invMass*t.x,this.m_linearVelocity.y+=this.m_invMass*t.y,this.m_angularVelocity+=this.m_invI*((e.x-this.m_sweep.c.x)*t.y-(e.y-this.m_sweep.c.y)*t.x))},b8f.prototype.Split=function(t){for(var e,i,n=this.GetLinearVelocity().Copy(),r=this.GetAngularVelocity(),o=this.GetWorldCenter(),s=this.m_world.CreateBody(this.GetDefinition()),a=this.m_fixtureList;a;)a=t(a)?(i=a.m_next,e?e.m_next=i:this.m_fixtureList=i,this.m_fixtureCount--,a.m_next=s.m_fixtureList,s.m_fixtureList=a,s.m_fixtureCount++,a.m_body=s,i):(e=a).m_next;this.ResetMassData(),s.ResetMassData();var l=this.GetWorldCenter(),c=s.GetWorldCenter(),h=b2Math$1.AddVV(n,b2Math$1.CrossFV(r,b2Math$1.SubtractVV(l,o))),u=b2Math$1.AddVV(n,b2Math$1.CrossFV(r,b2Math$1.SubtractVV(c,o)));return this.SetLinearVelocity(h),s.SetLinearVelocity(u),this.SetAngularVelocity(r),s.SetAngularVelocity(r),this.SynchronizeFixtures(),s.SynchronizeFixtures(),s},b8f.prototype.Merge=function(t){for(var e=t.m_fixtureList;e;){var i=e.m_next;t.m_fixtureCount--,e.m_next=this.m_fixtureList,this.m_fixtureList=e,this.m_fixtureCount++,e.m_body=r,e=i}n.m_fixtureCount=0;var n=this,r=t;n.GetWorldCenter(),r.GetWorldCenter(),n.GetLinearVelocity().Copy(),r.GetLinearVelocity().Copy(),n.GetAngularVelocity(),r.GetAngularVelocity(),n.ResetMassData(),this.SynchronizeFixtures()},b8f.prototype.GetMass=function(){return this.m_mass},b8f.prototype.GetInertia=function(){return this.m_I},b8f.prototype.GetMassData=function(t){t.mass=this.m_mass,t.I=this.m_I,t.center.SetV(this.m_sweep.localCenter)},b8f.prototype.SetMassData=function(t){var e;b2Settings$1.b2Assert(0==this.m_world.IsLocked()),1!=this.m_world.IsLocked()&&this.m_type==b8f.b2_dynamicBody&&(this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_mass=t.mass,this.m_mass<=0&&(this.m_mass=1),this.m_invMass=1/this.m_mass,0<t.I&&0==(this.m_flags&b8f.e_fixedRotationFlag)&&(this.m_I=t.I-this.m_mass*(t.center.x*t.center.x+t.center.y*t.center.y),this.m_invI=1/this.m_I),e=this.m_sweep.c.Copy(),this.m_sweep.localCenter.SetV(t.center),this.m_sweep.c0.SetV(b2Math$1.MulX(this.m_xf,this.m_sweep.localCenter)),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-e.y),this.m_linearVelocity.y+=this.m_angularVelocity*(this.m_sweep.c.x-e.x))},b8f.prototype.ResetMassData=function(){if(this.m_mass=0,this.m_invMass=0,this.m_I=0,this.m_invI=0,this.m_sweep.localCenter.SetZero(),this.m_type!=b8f.b2_staticBody&&this.m_type!=b8f.b2_kinematicBody){for(var t,e=b2Vec2$1.Make(0,0),i=this.m_fixtureList;i;i=i.m_next)0!=i.m_density&&(t=i.GetMassData(),this.m_mass+=t.mass,e.x+=t.center.x*t.mass,e.y+=t.center.y*t.mass,this.m_I+=t.I);0<this.m_mass?(this.m_invMass=1/this.m_mass,e.x*=this.m_invMass,e.y*=this.m_invMass):(this.m_mass=1,this.m_invMass=1),0<this.m_I&&0==(this.m_flags&b8f.e_fixedRotationFlag)?(this.m_I-=this.m_mass*(e.x*e.x+e.y*e.y),this.m_I*=this.m_inertiaScale,b2Settings$1.b2Assert(0<this.m_I),this.m_invI=1/this.m_I):(this.m_I=0,this.m_invI=0);var n=this.m_sweep.c.Copy();this.m_sweep.localCenter.SetV(e),this.m_sweep.c0.SetV(b2Math$1.MulX(this.m_xf,this.m_sweep.localCenter)),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_linearVelocity.x+=this.m_angularVelocity*-(this.m_sweep.c.y-n.y),this.m_linearVelocity.y+=this.m_angularVelocity*(this.m_sweep.c.x-n.x)}},b8f.prototype.GetWorldPoint=function(t){var e=this.m_xf.R,i=new b2Vec2$1(e.col1.x*t.x+e.col2.x*t.y,e.col1.y*t.x+e.col2.y*t.y);return i.x+=this.m_xf.position.x,i.y+=this.m_xf.position.y,i},b8f.prototype.GetWorldVector=function(t){return b2Math$1.MulMV(this.m_xf.R,t)},b8f.prototype.GetLocalPoint=function(t){return b2Math$1.MulXT(this.m_xf,t)},b8f.prototype.GetLocalVector=function(t){return b2Math$1.MulTMV(this.m_xf.R,t)},b8f.prototype.GetLinearVelocityFromWorldPoint=function(t){return new b2Vec2$1(this.m_linearVelocity.x-this.m_angularVelocity*(t.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(t.x-this.m_sweep.c.x))},b8f.prototype.GetLinearVelocityFromLocalPoint=function(t){var e=this.m_xf.R,i=new b2Vec2$1(e.col1.x*t.x+e.col2.x*t.y,e.col1.y*t.x+e.col2.y*t.y);return i.x+=this.m_xf.position.x,i.y+=this.m_xf.position.y,new b2Vec2$1(this.m_linearVelocity.x-this.m_angularVelocity*(i.y-this.m_sweep.c.y),this.m_linearVelocity.y+this.m_angularVelocity*(i.x-this.m_sweep.c.x))},b8f.prototype.GetLinearDamping=function(){return this.m_linearDamping},b8f.prototype.SetLinearDamping=function(t){this.m_linearDamping=t},b8f.prototype.GetAngularDamping=function(){return this.m_angularDamping},b8f.prototype.SetAngularDamping=function(t){this.m_angularDamping=t},b8f.prototype.SetType=function(t){if(this.m_type!=t){this.m_type=t,this.ResetMassData(),this.m_type==b8f.b2_staticBody&&(this.m_linearVelocity.SetZero(),this.m_angularVelocity=0),this.SetAwake(!0),this.m_force.SetZero(),this.m_torque=0;for(var e=this.m_contactList;e;e=e.next)e.contact.FlagForFiltering()}},b8f.prototype.GetType=function(){return this.m_type},b8f.prototype.SetBullet=function(t){t?this.m_flags|=b8f.e_bulletFlag:this.m_flags&=~b8f.e_bulletFlag},b8f.prototype.IsBullet=function(){return(this.m_flags&b8f.e_bulletFlag)==b8f.e_bulletFlag},b8f.prototype.SetSleepingAllowed=function(t){t?this.m_flags|=b8f.e_allowSleepFlag:(this.m_flags&=~b8f.e_allowSleepFlag,this.SetAwake(!0))},b8f.prototype.SetAwake=function(t){t?(this.m_flags|=b8f.e_awakeFlag,this.m_sleepTime=0):(this.m_flags&=~b8f.e_awakeFlag,this.m_sleepTime=0,this.m_linearVelocity.SetZero(),this.m_angularVelocity=0,this.m_force.SetZero(),this.m_torque=0)},b8f.prototype.IsAwake=function(){return(this.m_flags&b8f.e_awakeFlag)==b8f.e_awakeFlag},b8f.prototype.SetFixedRotation=function(t){t?this.m_flags|=b8f.e_fixedRotationFlag:this.m_flags&=~b8f.e_fixedRotationFlag,this.ResetMassData()},b8f.prototype.IsFixedRotation=function(){return(this.m_flags&b8f.e_fixedRotationFlag)==b8f.e_fixedRotationFlag},b8f.prototype.SetActive=function(t){var e,i;if(t!=this.IsActive())if(t)for(this.m_flags|=b8f.e_activeFlag,e=this.m_world.m_contactManager.m_broadPhase,i=this.m_fixtureList;i;i=i.m_next)i.CreateProxy(e,this.m_xf);else{for(this.m_flags&=~b8f.e_activeFlag,e=this.m_world.m_contactManager.m_broadPhase,i=this.m_fixtureList;i;i=i.m_next)i.DestroyProxy(e);for(var n=this.m_contactList;n;){var r=n,n=n.next;this.m_world.m_contactManager.Destroy(r.contact)}this.m_contactList=null}},b8f.prototype.IsActive=function(){return(this.m_flags&b8f.e_activeFlag)==b8f.e_activeFlag},b8f.prototype.IsSleepingAllowed=function(){return(this.m_flags&b8f.e_allowSleepFlag)==b8f.e_allowSleepFlag},b8f.prototype.GetFixtureList=function(){return this.m_fixtureList},b8f.prototype.GetJointList=function(){return this.m_jointList},b8f.prototype.GetControllerList=function(){return this.m_controllerList},b8f.prototype.GetContactList=function(){return this.m_contactList},b8f.prototype.GetNext=function(){return this.m_next},b8f.prototype.GetUserData=function(){return this.m_userData},b8f.prototype.SetUserData=function(t){this.m_userData=t},b8f.prototype.GetWorld=function(){return this.m_world},b8f.prototype.SynchronizeFixtures=function(){var t=b8f.s_xf1;t.R.Set(this.m_sweep.a0);var e=t.R,i=this.m_sweep.localCenter;t.position.x=this.m_sweep.c0.x-(e.col1.x*i.x+e.col2.x*i.y),t.position.y=this.m_sweep.c0.y-(e.col1.y*i.x+e.col2.y*i.y);for(var n=this.m_world.m_contactManager.m_broadPhase,r=this.m_fixtureList;r;r=r.m_next)r.Synchronize(n,t,this.m_xf)},b8f.prototype.SynchronizeTransform=function(){this.m_xf.R.Set(this.m_sweep.a);var t=this.m_xf.R,e=this.m_sweep.localCenter;this.m_xf.position.x=this.m_sweep.c.x-(t.col1.x*e.x+t.col2.x*e.y),this.m_xf.position.y=this.m_sweep.c.y-(t.col1.y*e.x+t.col2.y*e.y)},b8f.prototype.ShouldCollide=function(t){if(this.m_type!=b8f.b2_dynamicBody&&t.m_type!=b8f.b2_dynamicBody)return!1;for(var e=this.m_jointList;e;e=e.next)if(e.other==t&&0==e.joint.m_collideConnected)return!1;return!0},b8f.prototype.Advance=function(t){this.m_sweep.Advance(t),this.m_sweep.c.SetV(this.m_sweep.c0),this.m_sweep.a=this.m_sweep.a0,this.SynchronizeTransform()},b8f.s_xf1=new b2Transform,b8f.e_islandFlag=1,b8f.e_awakeFlag=2,b8f.e_allowSleepFlag=4,b8f.e_bulletFlag=8,b8f.e_fixedRotationFlag=16,b8f.e_activeFlag=32,b8f.b2_staticBody=0,b8f.b2_kinematicBody=1,b8f.b2_dynamicBody=2,b8f),b2ContactEdge$1=function(){},b2Contact$1=(X9f.prototype.GetManifold=function(){return this.m_manifold},X9f.prototype.GetWorldManifold=function(t){var e=this.m_fixtureA.GetBody(),i=this.m_fixtureB.GetBody(),n=this.m_fixtureA.GetShape(),r=this.m_fixtureB.GetShape();t.Initialize(this.m_manifold,e.GetTransform(),n.m_radius,i.GetTransform(),r.m_radius)},X9f.prototype.IsTouching=function(){return(this.m_flags&X9f.e_touchingFlag)==X9f.e_touchingFlag},X9f.prototype.IsContinuous=function(){return(this.m_flags&X9f.e_continuousFlag)==X9f.e_continuousFlag},X9f.prototype.SetSensor=function(t){t?this.m_flags|=X9f.e_sensorFlag:this.m_flags&=~X9f.e_sensorFlag},X9f.prototype.IsSensor=function(){return(this.m_flags&X9f.e_sensorFlag)==X9f.e_sensorFlag},X9f.prototype.SetEnabled=function(t){t?this.m_flags|=X9f.e_enabledFlag:this.m_flags&=~X9f.e_enabledFlag},X9f.prototype.IsEnabled=function(){return(this.m_flags&X9f.e_enabledFlag)==X9f.e_enabledFlag},X9f.prototype.GetNext=function(){return this.m_next},X9f.prototype.GetFixtureA=function(){return this.m_fixtureA},X9f.prototype.GetFixtureB=function(){return this.m_fixtureB},X9f.prototype.FlagForFiltering=function(){this.m_flags|=X9f.e_filterFlag},X9f.prototype.Reset=function(t,e){if(this.m_flags=X9f.e_enabledFlag,!t||!e)return this.m_fixtureA=null,void(this.m_fixtureB=null);(t.IsSensor()||e.IsSensor())&&(this.m_flags|=X9f.e_sensorFlag);var i=t.GetBody(),n=e.GetBody();(i.GetType()!=b2Body$1.b2_dynamicBody||i.IsBullet()||n.GetType()!=b2Body$1.b2_dynamicBody||n.IsBullet())&&(this.m_flags|=X9f.e_continuousFlag),this.m_fixtureA=t,this.m_fixtureB=e,this.m_manifold.m_pointCount=0,this.m_prev=null,this.m_next=null,this.m_nodeA.contact=null,this.m_nodeA.prev=null,this.m_nodeA.next=null,this.m_nodeA.other=null,this.m_nodeB.contact=null,this.m_nodeB.prev=null,this.m_nodeB.next=null,this.m_nodeB.other=null},X9f.prototype.Update=function(t){var e=this.m_oldManifold;this.m_oldManifold=this.m_manifold,this.m_manifold=e,this.m_flags|=X9f.e_enabledFlag;var i,n,r,o,s=!1,a=(this.m_flags&X9f.e_touchingFlag)==X9f.e_touchingFlag,l=this.m_fixtureA.m_body,c=this.m_fixtureB.m_body,h=this.m_fixtureA.m_aabb.TestOverlap(this.m_fixtureB.m_aabb);if(this.m_flags&X9f.e_sensorFlag)h&&(i=this.m_fixtureA.GetShape(),n=this.m_fixtureB.GetShape(),r=l.GetTransform(),o=c.GetTransform(),s=b2Shape$1.TestOverlap(i,r,n,o)),this.m_manifold.m_pointCount=0;else{if(l.GetType()!=b2Body$1.b2_dynamicBody||l.IsBullet()||c.GetType()!=b2Body$1.b2_dynamicBody||c.IsBullet()?this.m_flags|=X9f.e_continuousFlag:this.m_flags&=~X9f.e_continuousFlag,h){this.Evaluate(),s=0<this.m_manifold.m_pointCount;for(var u=0;u<this.m_manifold.m_pointCount;++u){var p=this.m_manifold.m_points[u];p.m_normalImpulse=0,p.m_tangentImpulse=0;for(var d=p.m_id,_=0;_<this.m_oldManifold.m_pointCount;++_){var f=this.m_oldManifold.m_points[_];if(f.m_id.key==d.key){p.m_normalImpulse=f.m_normalImpulse,p.m_tangentImpulse=f.m_tangentImpulse;break}}}}else this.m_manifold.m_pointCount=0;s!=a&&(l.SetAwake(!0),c.SetAwake(!0))}s?this.m_flags|=X9f.e_touchingFlag:this.m_flags&=~X9f.e_touchingFlag,0==a&&1==s&&t.BeginContact(this),1==a&&0==s&&t.EndContact(this),0==(this.m_flags&X9f.e_sensorFlag)&&t.PreSolve(this,this.m_oldManifold)},X9f.prototype.Evaluate=function(){},X9f.prototype.ComputeTOI=function(t,e){return X9f.s_input.proxyA.Set(this.m_fixtureA.GetShape()),X9f.s_input.proxyB.Set(this.m_fixtureB.GetShape()),X9f.s_input.sweepA=t,X9f.s_input.sweepB=e,X9f.s_input.tolerance=b2Settings$1.b2_linearSlop,b2TimeOfImpact$1.TimeOfImpact(X9f.s_input)},X9f.e_sensorFlag=1,X9f.e_continuousFlag=2,X9f.e_islandFlag=4,X9f.e_toiFlag=8,X9f.e_touchingFlag=16,X9f.e_enabledFlag=32,X9f.e_filterFlag=64,X9f.s_input=new b2TOIInput,X9f),b2ContactConstraint$1=function(){this.localPlaneNormal=new b2Vec2$1,this.localPoint=new b2Vec2$1,this.normal=new b2Vec2$1,this.normalMass=new b2Mat22$1,this.K=new b2Mat22$1,this.points=new Array(b2Settings$1.b2_maxManifoldPoints);for(var t=0;t<b2Settings$1.b2_maxManifoldPoints;t++)this.points[t]=new b2ContactConstraintPoint$1},b2ContactConstraintPoint$1=function(){this.localPoint=new b2Vec2$1,this.rA=new b2Vec2$1,this.rB=new b2Vec2$1},b2ContactFactory=(Aag.prototype.AddType=function(t,e,i,n){this.m_registers[i][n].createFcn=t,this.m_registers[i][n].destroyFcn=e,this.m_registers[i][n].primary=!0,i!=n&&(this.m_registers[n][i].createFcn=t,this.m_registers[n][i].destroyFcn=e,this.m_registers[n][i].primary=!1)},Aag.prototype.InitializeRegisters=function(){this.m_registers=new Array(b2Shape$1.e_shapeTypeCount);for(var t=0;t<b2Shape$1.e_shapeTypeCount;t++){this.m_registers[t]=new Array(b2Shape$1.e_shapeTypeCount);for(var e=0;e<b2Shape$1.e_shapeTypeCount;e++)this.m_registers[t][e]=new b2ContactRegister$1}this.AddType(b2CircleContact$1.Create,b2CircleContact$1.Destroy,b2Shape$1.e_circleShape,b2Shape$1.e_circleShape),this.AddType(b2PolyAndCircleContact$1.Create,b2PolyAndCircleContact$1.Destroy,b2Shape$1.e_polygonShape,b2Shape$1.e_circleShape),this.AddType(b2PolygonContact$1.Create,b2PolygonContact$1.Destroy,b2Shape$1.e_polygonShape,b2Shape$1.e_polygonShape),this.AddType(b2EdgeAndCircleContact.Create,b2EdgeAndCircleContact.Destroy,b2Shape$1.e_edgeShape,b2Shape$1.e_circleShape),this.AddType(b2PolyAndEdgeContact.Create,b2PolyAndEdgeContact.Destroy,b2Shape$1.e_polygonShape,b2Shape$1.e_edgeShape)},Aag.prototype.Create=function(t,e){var i,n=t.GetType(),r=e.GetType(),o=this.m_registers[n][r];if(o.pool)return i=o.pool,o.pool=i.m_next,o.poolCount--,i.Reset(t,e),i;var s=o.createFcn;return null!=s?(o.primary?(i=s(this.m_allocator)).Reset(t,e):(i=s(this.m_allocator)).Reset(e,t),i):null},Aag.prototype.Destroy=function(t){0<t.m_manifold.m_pointCount&&(t.m_fixtureA.m_body.SetAwake(!0),t.m_fixtureB.m_body.SetAwake(!0));var e=t.m_fixtureA.GetType(),i=t.m_fixtureB.GetType(),n=this.m_registers[e][i];n.poolCount++,t.m_next=n.pool,n.pool=t,(0,n.destroyFcn)(t,this.m_allocator)},Aag),b2ContactRegister$1=function(){},b2ContactSolver$1=(Tag.prototype.Initialize=function(t,e,i,n){var r,o;for(this.m_step.Set(t),this.m_allocator=n,this.m_constraintCount=i;this.m_constraints.length<this.m_constraintCount;)this.m_constraints[this.m_constraints.length]=new b2ContactConstraint$1;for(o=0;o<i;++o){var s=(r=e[o]).m_fixtureA,a=r.m_fixtureB,l=s.m_shape,c=a.m_shape,h=l.m_radius,u=c.m_radius,p=s.m_body,d=a.m_body,_=r.GetManifold(),f=b2Settings$1.b2MixFriction(s.GetFriction(),a.GetFriction()),m=b2Settings$1.b2MixRestitution(s.GetRestitution(),a.GetRestitution()),g=p.m_linearVelocity.x,y=p.m_linearVelocity.y,b=d.m_linearVelocity.x,v=d.m_linearVelocity.y,x=p.m_angularVelocity,A=d.m_angularVelocity;b2Settings$1.b2Assert(0<_.m_pointCount),Tag.s_worldManifold.Initialize(_,p.m_xf,h,d.m_xf,u);var S=Tag.s_worldManifold.m_normal.x,w=Tag.s_worldManifold.m_normal.y,C=this.m_constraints[o];C.bodyA=p,C.bodyB=d,C.manifold=_,C.normal.x=S,C.normal.y=w,C.pointCount=_.m_pointCount,C.friction=f,C.restitution=m,C.localPlaneNormal.x=_.m_localPlaneNormal.x,C.localPlaneNormal.y=_.m_localPlaneNormal.y,C.localPoint.x=_.m_localPoint.x,C.localPoint.y=_.m_localPoint.y,C.radius=h+u,C.type=_.m_type;for(var P,E,T,M,D,I,O,L,F,B,N,R,V,k=0;k<C.pointCount;++k){var U=_.m_points[k],j=C.points[k];j.normalImpulse=U.m_normalImpulse,j.tangentImpulse=U.m_tangentImpulse,j.localPoint.SetV(U.m_localPoint);var G=j.rA.x=Tag.s_worldManifold.m_points[k].x-p.m_sweep.c.x,z=j.rA.y=Tag.s_worldManifold.m_points[k].y-p.m_sweep.c.y,$=j.rB.x=Tag.s_worldManifold.m_points[k].x-d.m_sweep.c.x,X=j.rB.y=Tag.s_worldManifold.m_points[k].y-d.m_sweep.c.y,W=G*w-z*S,H=$*w-X*S;W*=W,H*=H;var q=p.m_invMass+d.m_invMass+p.m_invI*W+d.m_invI*H;j.normalMass=1/q;var J=p.m_mass*p.m_invMass+d.m_mass*d.m_invMass;J+=p.m_mass*p.m_invI*W+d.m_mass*d.m_invI*H,j.equalizedMass=1/J;var Q=-S,K=G*Q-z*w,Y=$*Q-X*w;K*=K,Y*=Y;var Z=p.m_invMass+d.m_invMass+p.m_invI*K+d.m_invI*Y;j.tangentMass=1/Z,j.velocityBias=0;var tt=b+-A*X-g- -x*z,et=v+A*$-y-x*G,it=C.normal.x*tt+C.normal.y*et;it<-b2Settings$1.b2_velocityThreshold&&(j.velocityBias+=-C.restitution*it)}2==C.pointCount&&(P=C.points[0],E=C.points[1],T=p.m_invMass,M=p.m_invI,D=d.m_invMass,I=d.m_invI,(N=T+D+M*(O=P.rA.x*w-P.rA.y*S)*O+I*(L=P.rB.x*w-P.rB.y*S)*L)*N<100*(N*(R=T+D+M*(F=E.rA.x*w-E.rA.y*S)*F+I*(B=E.rB.x*w-E.rB.y*S)*B)-(V=T+D+M*O*F+I*L*B)*V)?(C.K.col1.Set(N,V),C.K.col2.Set(V,R),C.K.GetInverse(C.normalMass)):C.pointCount=1)}},Tag.prototype.InitVelocityConstraints=function(t){for(var e=0;e<this.m_constraintCount;++e){var i,n,r=this.m_constraints[e],o=r.bodyA,s=r.bodyB,a=o.m_invMass,l=o.m_invI,c=s.m_invMass,h=s.m_invI,u=r.normal.x,p=r.normal.y,d=p,_=-u;if(t.warmStarting)for(n=r.pointCount,i=0;i<n;++i){var f=r.points[i];f.normalImpulse*=t.dtRatio,f.tangentImpulse*=t.dtRatio;var m=f.normalImpulse*u+f.tangentImpulse*d,g=f.normalImpulse*p+f.tangentImpulse*_;o.m_angularVelocity-=l*(f.rA.x*g-f.rA.y*m),o.m_linearVelocity.x-=a*m,o.m_linearVelocity.y-=a*g,s.m_angularVelocity+=h*(f.rB.x*g-f.rB.y*m),s.m_linearVelocity.x+=c*m,s.m_linearVelocity.y+=c*g}else for(n=r.pointCount,i=0;i<n;++i){var y=r.points[i];y.normalImpulse=0,y.tangentImpulse=0}}},Tag.prototype.SolveVelocityConstraints=function(){for(var t,e,i,n,r,o,s,a,l,c,h,u,p,d,_,f=0;f<this.m_constraintCount;++f){for(var m=this.m_constraints[f],g=m.bodyA,y=m.bodyB,b=g.m_angularVelocity,v=y.m_angularVelocity,x=g.m_linearVelocity,A=y.m_linearVelocity,S=g.m_invMass,w=g.m_invI,C=y.m_invMass,P=y.m_invI,E=m.normal.x,T=m.normal.y,M=T,D=-E,I=m.friction,O=0;O<m.pointCount;O++)t=m.points[O],i=(A.x-v*t.rB.y-x.x+b*t.rA.y)*M+(A.y+v*t.rB.x-x.y-b*t.rA.x)*D,n=t.tangentMass*-i,r=I*t.normalImpulse,s=(n=(o=b2Math$1.Clamp(t.tangentImpulse+n,-r,r))-t.tangentImpulse)*M,a=n*D,x.x-=S*s,x.y-=S*a,b-=w*(t.rA.x*a-t.rA.y*s),A.x+=C*s,A.y+=C*a,v+=P*(t.rB.x*a-t.rB.y*s),t.tangentImpulse=o;if(m.pointCount,1==m.pointCount)t=m.points[0],e=(A.x+-v*t.rB.y-x.x- -b*t.rA.y)*E+(A.y+v*t.rB.x-x.y-b*t.rA.x)*T,n=-t.normalMass*(e-t.velocityBias),s=(n=(o=0<(o=t.normalImpulse+n)?o:0)-t.normalImpulse)*E,a=n*T,x.x-=S*s,x.y-=S*a,b-=w*(t.rA.x*a-t.rA.y*s),A.x+=C*s,A.y+=C*a,v+=P*(t.rB.x*a-t.rB.y*s),t.normalImpulse=o;else{var L=m.points[0],F=m.points[1],B=L.normalImpulse,N=F.normalImpulse,R=(A.x-v*L.rB.y-x.x+b*L.rA.y)*E+(A.y+v*L.rB.x-x.y-b*L.rA.x)*T,V=(A.x-v*F.rB.y-x.x+b*F.rA.y)*E+(A.y+v*F.rB.x-x.y-b*F.rA.x)*T,k=R-L.velocityBias,U=V-F.velocityBias;for(k-=(_=m.K).col1.x*B+_.col2.x*N,U-=_.col1.y*B+_.col2.y*N;;){var j=-((_=m.normalMass).col1.x*k+_.col2.x*U),G=-(_.col1.y*k+_.col2.y*U);if(0<=j&&0<=G){h=(l=j-B)*E,u=l*T,p=(c=G-N)*E,d=c*T,x.x-=S*(h+p),x.y-=S*(u+d),b-=w*(L.rA.x*u-L.rA.y*h+F.rA.x*d-F.rA.y*p),A.x+=C*(h+p),A.y+=C*(u+d),v+=P*(L.rB.x*u-L.rB.y*h+F.rB.x*d-F.rB.y*p),L.normalImpulse=j,F.normalImpulse=G;break}if(j=-L.normalMass*k,R=G=0,V=m.K.col1.y*j+U,0<=j&&0<=V){h=(l=j-B)*E,u=l*T,p=(c=G-N)*E,d=c*T,x.x-=S*(h+p),x.y-=S*(u+d),b-=w*(L.rA.x*u-L.rA.y*h+F.rA.x*d-F.rA.y*p),A.x+=C*(h+p),A.y+=C*(u+d),v+=P*(L.rB.x*u-L.rB.y*h+F.rB.x*d-F.rB.y*p),L.normalImpulse=j,F.normalImpulse=G;break}if(j=0,G=-F.normalMass*U,R=m.K.col2.x*G+k,(V=0)<=G&&0<=R){h=(l=j-B)*E,u=l*T,p=(c=G-N)*E,d=c*T,x.x-=S*(h+p),x.y-=S*(u+d),b-=w*(L.rA.x*u-L.rA.y*h+F.rA.x*d-F.rA.y*p),A.x+=C*(h+p),A.y+=C*(u+d),v+=P*(L.rB.x*u-L.rB.y*h+F.rB.x*d-F.rB.y*p),L.normalImpulse=j,F.normalImpulse=G;break}if(V=U,(G=j=0)<=(R=k)&&0<=V){h=(l=j-B)*E,u=l*T,p=(c=G-N)*E,d=c*T,x.x-=S*(h+p),x.y-=S*(u+d),b-=w*(L.rA.x*u-L.rA.y*h+F.rA.x*d-F.rA.y*p),A.x+=C*(h+p),A.y+=C*(u+d),v+=P*(L.rB.x*u-L.rB.y*h+F.rB.x*d-F.rB.y*p),L.normalImpulse=j,F.normalImpulse=G;break}break}}g.m_angularVelocity=b,y.m_angularVelocity=v}},Tag.prototype.FinalizeVelocityConstraints=function(){for(var t=0;t<this.m_constraintCount;++t)for(var e=this.m_constraints[t],i=e.manifold,n=0;n<e.pointCount;++n){var r=i.m_points[n],o=e.points[n];r.m_normalImpulse=o.normalImpulse,r.m_tangentImpulse=o.tangentImpulse}},Tag.prototype.SolvePositionConstraints=function(t){for(var e=0,i=0;i<this.m_constraintCount;i++){var n=this.m_constraints[i],r=n.bodyA,o=n.bodyB,s=r.m_mass*r.m_invMass,a=r.m_mass*r.m_invI,l=o.m_mass*o.m_invMass,c=o.m_mass*o.m_invI;Tag.s_psm.Initialize(n);for(var h=Tag.s_psm.m_normal,u=0;u<n.pointCount;u++){var p=n.points[u],d=Tag.s_psm.m_points[u],_=Tag.s_psm.m_separations[u],f=d.x-r.m_sweep.c.x,m=d.y-r.m_sweep.c.y,g=d.x-o.m_sweep.c.x,y=d.y-o.m_sweep.c.y,e=e<_?e:_,b=b2Math$1.Clamp(t*(_+b2Settings$1.b2_linearSlop),-b2Settings$1.b2_maxLinearCorrection,0),v=-p.equalizedMass*b,x=v*h.x,A=v*h.y;r.m_sweep.c.x-=s*x,r.m_sweep.c.y-=s*A,r.m_sweep.a-=a*(f*A-m*x),r.SynchronizeTransform(),o.m_sweep.c.x+=l*x,o.m_sweep.c.y+=l*A,o.m_sweep.a+=c*(g*A-y*x),o.SynchronizeTransform()}}return e>-1.5*b2Settings$1.b2_linearSlop},Tag.s_worldManifold=new b2WorldManifold,Tag.s_psm=new b2PositionSolverManifold,Tag),b2EdgeAndCircleContact=(Gdg=b2Contact$1,__extends(Hdg,Gdg),Hdg.Create=function(t){return new Hdg},Hdg.Destroy=function(t,e){},Hdg.prototype.Reset=function(t,e){Gdg.prototype.Reset.call(this,t,e)},Hdg.prototype.Evaluate=function(){var t=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();this.b2CollideEdgeAndCircle(this.m_manifold,this.m_fixtureA.GetShape(),t.m_xf,this.m_fixtureB.GetShape(),e.m_xf)},Hdg.prototype.b2CollideEdgeAndCircle=function(t,e,i,n,r){},Hdg),b2PolyAndCircleContact$1=(Udg=b2Contact$1,__extends(Vdg,Udg),Vdg.Create=function(t){return new Vdg},Vdg.Destroy=function(t,e){},Vdg.prototype.Reset=function(t,e){Udg.prototype.Reset.call(this,t,e),b2Settings$1.b2Assert(t.GetType()==b2Shape$1.e_polygonShape),b2Settings$1.b2Assert(e.GetType()==b2Shape$1.e_circleShape)},Vdg.prototype.Evaluate=function(){var t=this.m_fixtureA.m_body,e=this.m_fixtureB.m_body;b2Collision$1.CollidePolygonAndCircle(this.m_manifold,this.m_fixtureA.GetShape(),t.m_xf,this.m_fixtureB.GetShape(),e.m_xf)},Vdg),b2PolyAndEdgeContact=(beg=b2Contact$1,__extends(ceg,beg),ceg.Create=function(t){return new ceg},ceg.Destroy=function(t,e){},ceg.prototype.Reset=function(t,e){beg.prototype.Reset.call(this,t,e),b2Settings$1.b2Assert(t.GetType()==b2Shape$1.e_polygonShape),b2Settings$1.b2Assert(e.GetType()==b2Shape$1.e_edgeShape)},ceg.prototype.Evaluate=function(){var t=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();this.b2CollidePolyAndEdge(this.m_manifold,this.m_fixtureA.GetShape(),t.m_xf,this.m_fixtureB.GetShape(),e.m_xf)},ceg.prototype.b2CollidePolyAndEdge=function(t,e,i,n,r){},ceg),b2PolygonContact$1=(peg=b2Contact$1,__extends(qeg,peg),qeg.Create=function(t){return new qeg},qeg.Destroy=function(t,e){},qeg.prototype.Reset=function(t,e){peg.prototype.Reset.call(this,t,e)},qeg.prototype.Evaluate=function(){var t=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();b2Collision$1.CollidePolygons(this.m_manifold,this.m_fixtureA.GetShape(),t.m_xf,this.m_fixtureB.GetShape(),e.m_xf)},qeg),b2CircleContact$1=(yeg=b2Contact$1,__extends(zeg,yeg),zeg.Create=function(t){return new zeg},zeg.Destroy=function(t,e){},zeg.prototype.Reset=function(t,e){yeg.prototype.Reset.call(this,t,e)},zeg.prototype.Evaluate=function(){var t=this.m_fixtureA.GetBody(),e=this.m_fixtureB.GetBody();b2Collision$1.CollideCircles(this.m_manifold,this.m_fixtureA.GetShape(),t.m_xf,this.m_fixtureB.GetShape(),e.m_xf)},zeg),b2ControllerEdge=function(){},b2Controller=(Heg.prototype.Step=function(t){},Heg.prototype.Draw=function(t){},Heg.prototype.AddBody=function(t){var e=new b2ControllerEdge;e.controller=this,e.body=t,e.nextBody=this.m_bodyList,e.prevBody=null,(this.m_bodyList=e).nextBody&&(e.nextBody.prevBody=e),this.m_bodyCount++,e.nextController=t.m_controllerList,e.prevController=null,(t.m_controllerList=e).nextController&&(e.nextController.prevController=e),t.m_controllerCount++},Heg.prototype.RemoveBody=function(t){for(var e=t.m_controllerList;e&&e.controller!=this;)e=e.nextController;e.prevBody&&(e.prevBody.nextBody=e.nextBody),e.nextBody&&(e.nextBody.prevBody=e.prevBody),e.nextController&&(e.nextController.prevController=e.prevController),e.prevController&&(e.prevController.nextController=e.nextController),this.m_bodyList==e&&(this.m_bodyList=e.nextBody),t.m_controllerList==e&&(t.m_controllerList=e.nextController),t.m_controllerCount--,this.m_bodyCount--},Heg.prototype.Clear=function(){for(;this.m_bodyList;)this.RemoveBody(this.m_bodyList.body)},Heg.prototype.GetNext=function(){return this.m_next},Heg.prototype.GetWorld=function(){return this.m_world},Heg.prototype.GetBodyList=function(){return this.m_bodyList},Heg),B2D={b2CircleShape:b2CircleShape$1,b2EdgeShape:b2EdgeShape,b2MassData:b2MassData$1,b2PolygonShape:b2PolygonShape$1,b2Shape:b2Shape$1,b2AABB:b2AABB$1,b2Collision:b2Collision$1,b2ContactID:b2ContactID$1,b2ContactPoint:b2ContactPoint$1,b2Distance:b2Distance$1,b2DistanceInput:b2DistanceInput,b2DistanceOutput:b2DistanceOutput,b2DistanceProxy:b2DistanceProxy,b2DynamicTree:b2DynamicTree,b2DynamicTreeBroadPhase:b2DynamicTreeBroadPhase,b2DynamicTreeNode:b2DynamicTreeNode,b2DynamicTreePair:b2DynamicTreePair,b2Manifold:b2Manifold$1,b2ManifoldPoint:b2ManifoldPoint$1,b2OBB:b2OBB$1,b2RayCastInput:b2RayCastInput,b2RayCastOutput:b2RayCastOutput,b2SeparationFunction:b2SeparationFunction,b2Simplex:b2Simplex,b2SimplexCache:b2SimplexCache,b2SimplexVertex:b2SimplexVertex,b2TimeOfImpact:b2TimeOfImpact$1,b2TOIInput:b2TOIInput,b2WorldManifold:b2WorldManifold,ClipVertex:ClipVertex$1,Features:Features$1,b2Mat22:b2Mat22$1,b2Mat33:b2Mat33,b2Math:b2Math$1,b2Sweep:b2Sweep$1,b2Transform:b2Transform,b2Vec2:b2Vec2$1,b2Vec3:b2Vec3,b2Color:b2Color$1,b2Settings:b2Settings$1,b2CircleContact:b2CircleContact$1,b2Contact:b2Contact$1,b2ContactConstraint:b2ContactConstraint$1,b2ContactConstraintPoint:b2ContactConstraintPoint$1,b2ContactEdge:b2ContactEdge$1,b2ContactFactory:b2ContactFactory,b2ContactRegister:b2ContactRegister$1,b2ContactSolver:b2ContactSolver$1,b2EdgeAndCircleContact:b2EdgeAndCircleContact,b2PolyAndCircleContact:b2PolyAndCircleContact$1,b2PolyAndEdgeContact:b2PolyAndEdgeContact,b2PolygonContact:b2PolygonContact$1,b2PositionSolverManifold:b2PositionSolverManifold,b2Controller:b2Controller,b2ControllerEdge:b2ControllerEdge,b2DistanceJoint:b2DistanceJoint$1,b2DistanceJointDef:b2DistanceJointDef$1,b2FrictionJoint:b2FrictionJoint,b2FrictionJointDef:b2FrictionJointDef,b2GearJoint:b2GearJoint$1,b2GearJointDef:b2GearJointDef$1,b2Jacobian:b2Jacobian$1,b2Joint:b2Joint$1,b2JointDef:b2JointDef$1,b2JointEdge:b2JointEdge$1,b2LineJoint:b2LineJoint,b2LineJointDef:b2LineJointDef,b2MouseJoint:b2MouseJoint$1,b2MouseJointDef:b2MouseJointDef$1,b2PrismaticJoint:b2PrismaticJoint$1,b2PrismaticJointDef:b2PrismaticJointDef$1,b2PulleyJoint:b2PulleyJoint$1,b2PulleyJointDef:b2PulleyJointDef$1,b2RevoluteJoint:b2RevoluteJoint$1,b2RevoluteJointDef:b2RevoluteJointDef$1,b2WeldJoint:b2WeldJoint,b2WeldJointDef:b2WeldJointDef,b2Body:b2Body$1,b2BodyDef:b2BodyDef$1,b2ContactFilter:b2ContactFilter$1,b2ContactImpulse:b2ContactImpulse,b2ContactListener:b2ContactListener$1,b2ContactManager:b2ContactManager$1,b2DebugDraw:b2DebugDraw$1,b2DestructionListener:b2DestructionListener$1,b2FilterData:b2FilterData$1,b2Fixture:b2Fixture,b2FixtureDef:b2FixtureDef,b2Island:b2Island$1,b2TimeStep:b2TimeStep$1,b2World:b2World$1},_a$2,sayHello=!0,B2D_MAPPING=(_a$2={},_a$2.new=B2D,_a$2.legacy=B2D_LEGACY,_a$2.none=null,_a$2),BOX2D_PREFERENCE={version:"none",custom:void 0,get prefer(){if(sayHello&&(console.debug("B2D Version - ",this.version),sayHello=!1),"custom"!==this.version)return B2D_MAPPING[this.version]?B2D_MAPPING[this.version]:B2D_MAPPING.none;if(!this.custom)throw new Error("Custom Box2D should be assigned to `custom` field");return this.custom}},IS_EXTERNAL_CLASS=Symbol("External class marker"),LONG_NAMES=/nape./,extClassLib=void 0,yeg,peg,beg,Udg,Gdg;function Heg(){}function zeg(){return null!==yeg&&yeg.apply(this,arguments)||this}function qeg(){return null!==peg&&peg.apply(this,arguments)||this}function ceg(){return null!==beg&&beg.apply(this,arguments)||this}function Vdg(){return null!==Udg&&Udg.apply(this,arguments)||this}function Hdg(){return null!==Gdg&&Gdg.apply(this,arguments)||this}function Tag(){this.m_step=new b2TimeStep$1,this.m_constraints=new Array}function Aag(t){this.m_allocator=t,this.InitializeRegisters()}function X9f(){this.__fast__=!0,this.m_nodeA=new b2ContactEdge$1,this.m_nodeB=new b2ContactEdge$1,this.m_manifold=new b2Manifold$1,this.m_oldManifold=new b2Manifold$1}function b8f(t,e){this.__fast__=!0,this.m_xf=new b2Transform,this.m_sweep=new b2Sweep$1,this.m_linearVelocity=new b2Vec2$1,this.m_force=new b2Vec2$1,this.m_flags=0,t.bullet&&(this.m_flags|=b8f.e_bulletFlag),t.fixedRotation&&(this.m_flags|=b8f.e_fixedRotationFlag),t.allowSleep&&(this.m_flags|=b8f.e_allowSleepFlag),t.awake&&(this.m_flags|=b8f.e_awakeFlag),t.active&&(this.m_flags|=b8f.e_activeFlag),this.m_world=e,this.m_xf.position.SetV(t.position),this.m_xf.R.Set(t.angle),this.m_sweep.localCenter.SetZero(),this.m_sweep.t0=1,this.m_sweep.a0=this.m_sweep.a=t.angle;var i=this.m_xf.R,n=this.m_sweep.localCenter;this.m_sweep.c.x=i.col1.x*n.x+i.col2.x*n.y,this.m_sweep.c.y=i.col1.y*n.x+i.col2.y*n.y,this.m_sweep.c.x+=this.m_xf.position.x,this.m_sweep.c.y+=this.m_xf.position.y,this.m_sweep.c0.SetV(this.m_sweep.c),this.m_jointList=null,this.m_controllerList=null,this.m_contactList=null,this.m_controllerCount=0,this.m_prev=null,this.m_next=null,this.m_linearVelocity.SetV(t.linearVelocity),this.m_angularVelocity=t.angularVelocity,this.m_linearDamping=t.linearDamping,this.m_angularDamping=t.angularDamping,this.m_force.Set(0,0),this.m_torque=0,this.m_sleepTime=0,this.m_type=t.type,this.m_type==b8f.b2_dynamicBody?(this.m_mass=1,this.m_invMass=1):(this.m_mass=0,this.m_invMass=0),this.m_I=0,this.m_invI=0,this.m_inertiaScale=t.inertiaScale,this.m_userData=t.userData,this.m_fixtureList=null,this.m_fixtureCount=0}function _4f(t,e){this.__fast__=!0,this.s_stack=new Array,this.m_contactManager=new b2ContactManager$1,this.m_contactSolver=new b2ContactSolver$1,this.m_island=new b2Island$1,this.m_destructionListener=null,this.m_debugDraw=null,this.m_bodyList=null,this.m_contactList=null,this.m_jointList=null,this.m_controllerList=null,this.m_bodyCount=0,this.m_contactCount=0,this.m_jointCount=0,this.m_controllerCount=0,_4f.m_warmStarting=!0,_4f.m_continuousPhysics=!0,this.m_allowSleep=e,this.m_gravity=t,this.m_inv_dt0=0,this.m_contactManager.m_world=this;var i=new b2BodyDef$1;this.m_groundBody=this.CreateBody(i)}function getExtClassField(t,e){void 0===e&&(e=void 0);var i=extClassLib=extClassLib||BOX2D_PREFERENCE.prefer;if(!i||!t)return null;if(!e||void 0!==i[t])return i[t];if(!e)return null;for(var n=i,r=0,o=e.split(".");r<o.length;r++)if(!(n=n[o[r]]))return null;return n[t]}function extClassContructor(t,e){var i;if(!(extClassLib=extClassLib||BOX2D_PREFERENCE.prefer))return null;var n=null===(i=t.namespace)||void 0===i?void 0:i.uri,r=getExtClassField(t.name,n&&LONG_NAMES.test(n)?n:void 0);if("function"!=typeof r)return null;Object.defineProperty(r.prototype,IS_EXTERNAL_CLASS,{value:!0});var o=Object.create(r.prototype);return r.apply(o,e),o.__fast__=!0,o}function emitIsAX(t){return BOX2D_PREFERENCE.prefer?"("+t+" != undefined && "+t+"[AX_CLASS_SYMBOL])":"true"}function needFastCheck(){return BOX2D_PREFERENCE.prefer}function emitIsAXOrPrimitive(t,e){return void 0===e&&(e=!1),BOX2D_PREFERENCE.prefer?"(_a = typeof "+t+", ((_a !== 'object' && _a !== 'function' ) "+(e?"":"|| "+t+" == null")+" || "+t+"[AX_CLASS_SYMBOL]))":"true"}var LexImportsGenerator=(cfg.prototype.test=function(t){return!1},cfg.prototype._genEntry=function(t){return"//"+t.name},cfg.prototype._genAlias=function(t,e){return t.namespace.uri.replace(/\./g,"_")+"__"+t.name},cfg.prototype.getLexAlias=function(t,e){return this.getPropStrictAlias(t,Object.assign({findProp:!0},e||{}))},cfg.prototype.getPropStrictAlias=function(e,i){var t;if(void 0===i&&(i={findProp:!1}),!this.test(e))throw"Can't generate static alias for "+e.name+" of "+(null===(t=e.namespace)||void 0===t?void 0:t.uri);var n=this.imports.find(function(t){return t.name===e&&i.findProp===t.options.findProp});if(n)return n.alias;var r=this._genAlias(e,i);return this.imports.find(function(t){return t.alias===r})||this.imports.push({name:e,alias:r,options:i}),r},cfg.prototype.genHeader=function(){if(!this.imports.length)return"";for(var t=["\n/* "+this.constructor.name+" */"],e=0,i=this.imports;e<i.length;e++){var n=i[e];t.push(this._genEntry(n))}return t.push("\n"),t.join("\n")},cfg.prototype.genBody=function(){return""},cfg.prototype.reset=function(){this.imports.length=0},cfg),ComplexGenerator=(ufg.prototype.getGenerator=function(t){for(var e=0,i=this.generators;e<i.length;e++){var n=i[e];if(n.test(t))return n}return null},ufg.prototype.test=function(t){return!!this.generators.length&&!!this.getGenerator(t)},ufg.prototype.getLexAlias=function(t,e){var i,n=this.getGenerator(t);if(!n)throw"Can't generate static alias for "+t.name+" of "+(null===(i=t.namespace)||void 0===i?void 0:i.uri);return n.getLexAlias(t,e)},ufg.prototype.getPropStrictAlias=function(t,e){var i,n=this.getGenerator(t);if(!n)throw"Can't generate static alias for "+t.name+" of "+(null===(i=t.namespace)||void 0===i?void 0:i.uri);return n.getPropStrictAlias(t,e)},ufg.prototype.genHeader=function(){for(var t="",e=0,i=this.generators;e<i.length;e++)t+=i[e].genHeader();return t},ufg.prototype.genBody=function(){for(var t="",e=0,i=this.generators;e<i.length;e++)t+=i[e].genHeader();return t},ufg.prototype.reset=function(){this.generators.forEach(function(t){return t.reset()})},ufg),PhysicsLex=(Qfg=LexImportsGenerator,__extends(Rfg,Qfg),Rfg.prototype._genEntry=function(t){var e=t.name.namespace.uri,i=t.name.name;return"const "+t.alias+" = context.getStaticImportExt('"+e+"', '"+i+"');"},Rfg.prototype._genAlias=function(t,e){return t.namespace.uri.replace(/\./g,"_")+"__"+t.name},Rfg.prototype.test=function(t){var e,i=null===(e=t.namespace)||void 0===e?void 0:e.uri;return!(!i||(i.startsWith("Box2D")&&this.allows.box2D?!getExtClassField(t.name):!i.startsWith("nape.")||!this.allows.nape||t.name.includes("Debug")))},Rfg),ALLOWED_TOP_LEVEL_NAMES=["flash.geom","flash.utils","Math","trace"],NOT_ALLOWED=["getDefinitionByName","SetIntervalTimer","setTimeout"],TopLevelLex=(agg=LexImportsGenerator,__extends(bgg,agg),bgg.prototype.test=function(t){var e,i=null===(e=t.namespace)||void 0===e?void 0:e.uri,n=t.name;return void 0!==i&&(-1<NOT_ALLOWED.indexOf(n)||-1<NOT_ALLOWED.indexOf(i)?null:-1<ALLOWED_TOP_LEVEL_NAMES.indexOf(n)||-1<ALLOWED_TOP_LEVEL_NAMES.indexOf(i))},bgg.prototype._genEntry=function(t){var e=t.name.namespace.uri,i=t.name.name,n=t.options||{},r=n.nameAlias,o=n.findProp;if(!r)throw"Name alias required for generatin Toplevel exports!";var s=Number(r.replace("name","")),a="['"+Multiname.getPublicMangledName(i)+"']";return"const "+t.alias+" = context.getTopLevel("+s+")"+(o?a:"")+"; // "+e+":"+i},bgg.prototype._genAlias=function(t,e){return t.namespace.uri.split(/\./g).join("_")+"__"+t.name+(e.findProp?"":"_def")},bgg),METHOD_HOOKS={},BytecodeName$1=Bytecode,agg,Qfg;function bgg(){return null!==agg&&agg.apply(this,arguments)||this}function Rfg(t){var e=Qfg.call(this)||this;return e.allows=t,e.allows=Object.assign({box2D:!0,nape:!0},t),e}function ufg(t){if(this.generators=t,this.allowColissions=!1,!t)throw"Generators array can't be null"}function cfg(){this.imports=[]}function generateFunc(body,path,useEval){return void 0===useEval&&(useEval=!1),body+="\n//# sourceURL=http://jit/"+path+".js",useEval?(body="(function(context) {\n"+body+"\n})",eval(body)):new Function("context",body)}var DEFAULT_OPT=31,lexGen=new ComplexGenerator([new PhysicsLex({box2D:!1}),new TopLevelLex]),blockSaver=new TweenCallSaver,tinyCtr=new TinyConstructor,CLASS_NAME_METHOD_NAME={},SCRIPT_ID=0;function compile(t,e){var i,n;void 0===e&&(e={optimise:DEFAULT_OPT});var r=e.optimise,o=void 0===r?DEFAULT_OPT:r;e.scope,Stat.begin("");function s(t){return 16&o&&!!t}if(s(tinyCtr)&&"function"==typeof(S=tinyCtr.getBody(t)))return Stat.drop(),{names:[],compiled:S};var a=(""+SCRIPT_ID++).padLeft("0",4),l=t.getName().replace(/([^a-z0-9]+)/gi,"_"),c="__root__/"+a+"_"+(l||"unknown"),h=c,u=l,p=!0,d="Public",_=void 0;t.trait&&(t.trait.holder instanceof ClassInfo?(h=t.trait.holder.instanceInfo.getClassName().replace(/\./g,"/"),p=!1):t.trait.holder instanceof InstanceInfo&&(h=t.trait.holder.getClassName().replace(/\./g,"/"),_=null===(i=t.trait.holder.getSuperName())||void 0===i?void 0:i.toFQNString(!1).replace(/\./g,"/")),t.trait instanceof MethodTraitInfo&&(u=t.trait.name.name,d=namespaceTypeNames[t.trait.name.namespace.type]),u=t.isConstructor?"constructor":p?"m_"+u:u,void 0!==CLASS_NAME_METHOD_NAME[c=h+"/"+u]?c+="$"+(CLASS_NAME_METHOD_NAME[c]=CLASS_NAME_METHOD_NAME[c]+1):CLASS_NAME_METHOD_NAME[c]=0),t.instanceInfo&&(h=t.instanceInfo.getClassName().replace(/\./g,"/"),u=t.isConstructor?"constructor":l,_=null===(n=t.instanceInfo.getSuperName())||void 0===n?void 0:n.toFQNString(!1).replace(/\./g,"/"),c=h+"/"+u);var f=h+(p?"::":".")+u,m="/*\n\tIndex: "+t.index()+"\n\tPath: "+f+"\n\tType: "+d+"\n\tSuper: "+(_||"-")+"\n*/\n\n",g=affilate(t),y=g.error,b=g.jumps,v=g.catchStart,x=g.catchEnd,A=g.set;if(y)return Stat.drop(),{error:y};for(var S,w=t.abc,C=t.getBody(),P=C.maxStack,E=C.localCount-1,T=C.maxScopeDepth-C.initScopeDepth,M=[],D=[],I="",O=0,L=function(t){return(O+=4*t)<0&&(O=0),I=" ".repeat(O?O-1:0)},F=[],B=function(t){D.push(I+" catch(e){"),L(1),D.push(I+" // in case this is a error coming from stack0.__fast when stack0 is undefined,"),D.push(I+" // we convert it to a ASError, so that avm2 can still catch it"),D.push(I+" if (e instanceof TypeError)"),D.push(I+' e=context.sec.createError("TypeError", {code:1065, message:e.message})'),D.push(I+" stack0 = e;");for(var e=0;e<t.length;e++){var i,n=t[e].getType();n?((i=Q.indexOf(n))<0&&(i=Q.length,Q.push(n),M.push(" let name"+i+" = context.names["+i+"];")),D.push(I+" const errorClass$"+e+" = context.sec.application.getClass(name"+i+");"),D.push(I+" if(errorClass$"+e+" && errorClass$"+e+".axIsType(e))"),D.push(I+" { p = "+t[e].target+"; continue; };")):D.push(I+" { p = "+t[e].target+"; continue; };")}D.push(I+" throw e;"),L(-1),D.push(I+" }")},N=!1,R=!1,V=0,k=A;V<k.length;V++){(S=k[V].name)!=Bytecode.NEWOBJECT&&S!=Bytecode.SWAP&&S!=Bytecode.HASNEXT2||(N=!0),R=R||S>=Bytecode.LI8&&S<=Bytecode.SF64}var U=t.parameters,j="[stack underrun]",G=0;if(L(1),1&o){for(var z=[],$=0;$<U.length;$++){var X="local"+($+1);if((W=U[$]).hasOptionalValue())switch(W.optionalValueKind){case 1:X+=" = "+JSON.stringify(w.getString(W.optionalValueIndex));break;default:X+=" = "+W.getOptionalValue()}z.push(X)}t.needsRest()&&z.push("...args"),M.push(I+" return function compiled_"+u+"("+z.join(", ")+") {"),L(1),M.push(I+" let local0 = this === context.jsGlobal ? context.savedScope.global.object : this;"),t.needsRest()&&(M.push(I+" let local"+(U.length+1)+" = context.sec.createArrayUnsafe(args);"),G+=1),t.needsArguments()&&(M.push(I+" let local"+(U.length+1)+" = context.sec.createArrayUnsafe(Array.from(arguments));"),G+=1)}else{for(M.push(I+" return function compiled_"+u+"() {"),$=0;$<U.length;$++)if(U[$].hasOptionalValue()){M.push(I+" let argnum = arguments.length;");break}for(M.push(I+" let local0 = this === context.jsGlobal ? context.savedScope.global.object : this;"),$=0;$<U.length;$++){var W=U[$];if(M.push(I+" let local"+($+1)+" = arguments["+$+"];"),U[$].hasOptionalValue())switch(W.optionalValueKind){case 1:M.push(I+" if (argnum <= "+$+") local"+($+1)+" = context.abc.getString("+W.optionalValueIndex+");");break;default:M.push(I+" if (argnum <= "+$+") local"+($+1)+" = "+W.getOptionalValue()+";")}}}var H=M.length;M.push("__PLACE__FOR__OPTIONAL__LOCALS__");for(var q=[],$=U.length+1+G;$<=E;$++)q[$]={index:$,isArgumentList:$===U.length+1,read:0,write:0,die:!1};for($=0;$<P;$++)M.push(I+" let stack"+$+" = undefined;");for($=0;$<T;$++)M.push(I+" let scope"+$+" = undefined;");N&&M.push(I+" let temp = undefined;"),R&&M.push(I+" let domainMemory; // domainMemory"),M.push(I+" let tr = undefined;");function J(t){var e=w.getMultiname(t),i=Q.indexOf(e);return i<0&&(i=Q.length,Q.push(e),M.push(K+" let name"+i+" = context.names["+i+"];")),"name"+i}var Q=[],K=I;M.push(I+" let sec = context.sec;");var Y,Z,tt,et=1<b.length||v;for(METHOD_HOOKS&&METHOD_HOOKS[f+"__begin"]&&(D.push(I+" /* ATTACH METHOD HOOK */"),D.push(I+" context.executeHook(local0, '"+f+"__begin')")),D.push(I+" "),et&&(D.push(I+" let p = 0;"),D.push(I+" while (true) {"),D.push(L(1)+" switch (p) {")),et&&L(2),$=0;$<A.length;$++){tt&&(Z=tt),tt=A[$],0<=b.indexOf(tt.position)&&(F&&function(){for(var t=0;t<F.length;t++)L(-1),D.push(I+" }"),B(F[t])}(),s(blockSaver)&&blockSaver.drop(),et&&(L(-1),D.push(I+" case "+tt.position+":"),L(1)),F&&function(){for(var t=0;t<F.length;t++)D.push(I+" try {"),L(1)}()),(Y=v?v[tt.position]:null)&&(F.push(Y),D.push(I+" try {"),L(1)),D.push(I+" //"+BytecodeName$1[tt.name]+" "+tt.params.join(" / ")+" -> "+tt.returnTypeId);var it,nt=function(t){return 0<=tt.stack-1-t?"stack"+(tt.stack-1-t):"/*"+j+" "+(tt.stack-1-t)+"*/ stack0"},rt=nt(0),ot=nt(1),st=nt(2),at=nt(3),lt=nt(-1),ct=0<tt.scope?"scope"+(tt.scope-1):"context.savedScope",ht="scope"+tt.scope,ut=function(t){return"local"+t},pt=function(t){return tt.params[t]};if(tt.stack<0)D.push(I+" // unreachable");else{var dt=0;switch(tt.name){case Bytecode.LABEL:break;case Bytecode.DXNSLATE:D.push(I+" "+ct+".defaultNamespace = context.internNamespace(0, "+rt+");");break;case Bytecode.DEBUGFILE:case Bytecode.DEBUGLINE:case Bytecode.DEBUG:case Bytecode.THROW:break;case Bytecode.GETLOCAL:q[dt=pt(0)]&&q[dt].read++,D.push(I+" "+lt+" = "+ut(dt)+";");break;case Bytecode.SETLOCAL:q[dt=pt(0)]&&(q[dt].write++,q[dt].read||(q[dt].die=!0)),D.push(I+" "+ut(dt)+" = "+rt+";");break;case Bytecode.GETSLOT:D.push(I+" "+rt+" = "+rt+".axGetSlot("+pt(0)+");");break;case Bytecode.SETSLOT:D.push(I+" "+ot+".axSetSlot("+pt(0)+", "+rt+");");break;case Bytecode.GETGLOBALSCOPE:D.push(I+" "+lt+" = context.savedScope.global.object;");break;case Bytecode.PUSHSCOPE:D.push(I+" "+ht+" = "+ct+".extend("+rt+");");break;case Bytecode.PUSHWITH:D.push(I+" "+ht+" = context.pushwith("+ct+", "+rt+");");break;case Bytecode.POPSCOPE:D.push(I+" "+ct+" = undefined;");break;case Bytecode.GETSCOPEOBJECT:D.push(I+" "+lt+" = scope"+pt(0)+".object;");break;case Bytecode.NEXTNAME:D.push(I+" "+ot+" = sec.box("+ot+").axNextName("+rt+");");break;case Bytecode.NEXTVALUE:D.push(I+" "+ot+" = sec.box("+ot+").axNextValue("+rt+");");break;case Bytecode.HASNEXT:D.push(I+" "+ot+" = sec.box("+ot+").axNextNameIndex("+rt+");");break;case Bytecode.HASNEXT2:D.push(I+" temp = context.hasnext2("+ut(pt(0))+", "+ut(pt(1))+");"),D.push(I+" "+ut(pt(0))+" = temp[0];"),D.push(I+" "+ut(pt(1))+" = temp[1];"),D.push(I+" "+lt+" = "+ut(pt(1))+" > 0;");break;case Bytecode.IN:D.push(I+" "+ot+" = ("+ot+" && "+ot+".axClass === sec.AXQName) ? obj.axHasProperty("+ot+".name) : "+rt+".axHasPublicProperty("+ot+");");break;case Bytecode.DUP:D.push(I+" "+lt+" = "+rt+";");break;case Bytecode.POP:break;case Bytecode.SWAP:D.push(I+" temp = "+rt+";"),D.push(I+" "+rt+" = "+ot+";"),D.push(I+" "+ot+" = temp;"),D.push(I+" temp = undefined;");break;case Bytecode.PUSHTRUE:D.push(I+" "+lt+" = true;");break;case Bytecode.PUSHFALSE:D.push(I+" "+lt+" = false;");break;case Bytecode.PUSHBYTE:case Bytecode.PUSHSHORT:D.push(I+" "+lt+" = "+pt(0)+";");break;case Bytecode.PUSHINT:D.push(I+" "+lt+" = "+w.ints[pt(0)]+";");break;case Bytecode.PUSHUINT:D.push(I+" "+lt+" = "+w.uints[pt(0)]+";");break;case Bytecode.PUSHDOUBLE:D.push(I+" "+lt+" = "+w.doubles[pt(0)]+";");break;case Bytecode.PUSHSTRING:D.push(I+" "+lt+" = "+JSON.stringify(w.getString(pt(0)))+";");break;case Bytecode.PUSHNAN:D.push(I+" "+lt+" = NaN;");break;case Bytecode.PUSHNULL:D.push(I+" "+lt+" = null;");break;case Bytecode.PUSHUNDEFINED:D.push(I+" "+lt+" = undefined;");break;case Bytecode.IFEQ:D.push(I+" if ("+rt+" == "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFNE:D.push(I+" if ("+rt+" != "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFSTRICTEQ:D.push(I+" if ("+rt+" === "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFSTRICTNE:D.push(I+" if ("+rt+" !== "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFGT:D.push(I+" if ("+rt+" < "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFGE:D.push(I+" if ("+rt+" <= "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFLT:D.push(I+" if ("+rt+" > "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFLE:D.push(I+" if ("+rt+" >= "+ot+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFFALSE:D.push(I+" if (!"+rt+") { p = "+pt(0)+"; continue; };");break;case Bytecode.IFTRUE:D.push(I+" if ("+rt+") { p = "+pt(0)+"; continue; };");break;case Bytecode.LOOKUPSWITCH:var _t=tt.params.concat(),ft=_t.shift();D.push(I+" if ("+rt+" >= 0 && "+rt+" < "+_t.length+") { p = ["+_t.join(", ")+"]["+rt+"]; continue; } else { p = "+ft+"; continue; };");break;case Bytecode.JUMP:D.push(I+" { p = "+pt(0)+"; continue; };");break;case Bytecode.INCREMENT:D.push(I+" "+rt+"++;");break;case Bytecode.DECREMENT:D.push(I+" "+rt+"--;");break;case Bytecode.INCLOCAL:D.push(I+" "+ut(pt(0))+"++;");break;case Bytecode.DECLOCAL:D.push(I+" "+ut(pt(0))+"--;");break;case Bytecode.INCREMENT_I:D.push(I+" "+rt+" |= 0;"),D.push(I+" "+rt+"++;");break;case Bytecode.DECREMENT_I:D.push(I+" "+rt+" |= 0;"),D.push(I+" "+rt+"--;");break;case Bytecode.INCLOCAL_I:D.push(I+" "+ut(pt(0))+" |= 0;"),D.push(I+" "+ut(pt(0))+"++;");break;case Bytecode.DECLOCAL_I:D.push(I+" "+ut(pt(0))+" |= 0;"),D.push(I+" "+ut(pt(0))+"--;");break;case Bytecode.NEGATE_I:D.push(I+" "+rt+" = -("+rt+" | 0);");break;case Bytecode.ADD_I:D.push(I+" "+ot+" = ("+ot+" | 0) + ("+rt+" | 0);");break;case Bytecode.SUBTRACT_I:D.push(I+" "+ot+" = ("+ot+" | 0) - ("+rt+" | 0);");break;case Bytecode.MULTIPLY_I:D.push(I+" "+ot+" = ("+ot+" | 0) * ("+rt+" | 0);");break;case Bytecode.ADD:D.push(I+" "+ot+" += "+rt+";");break;case Bytecode.SUBTRACT:D.push(I+" "+ot+" -= "+rt+";");break;case Bytecode.MULTIPLY:D.push(I+" "+ot+" *= "+rt+";");break;case Bytecode.DIVIDE:D.push(I+" "+ot+" /= "+rt+";");break;case Bytecode.MODULO:D.push(I+" "+ot+" %= "+rt+";");break;case Bytecode.LSHIFT:D.push(I+" "+ot+" <<= "+rt+";");break;case Bytecode.RSHIFT:D.push(I+" "+ot+" >>= "+rt+";");break;case Bytecode.URSHIFT:D.push(I+" "+ot+" >>>= "+rt+";");break;case Bytecode.BITAND:D.push(I+" "+ot+" &= "+rt+";");break;case Bytecode.BITOR:D.push(I+" "+ot+" |= "+rt+";");break;case Bytecode.BITXOR:D.push(I+" "+ot+" ^= "+rt+";");break;case Bytecode.EQUALS:D.push(I+" "+ot+" = "+ot+" == "+rt+";");break;case Bytecode.STRICTEQUALS:D.push(I+" "+ot+" = "+ot+" === "+rt+";");break;case Bytecode.GREATERTHAN:D.push(I+" "+ot+" = "+ot+" > "+rt+";");break;case Bytecode.GREATEREQUALS:D.push(I+" "+ot+" = "+ot+" >= "+rt+";");break;case Bytecode.LESSTHAN:D.push(I+" "+ot+" = "+ot+" < "+rt+";");break;case Bytecode.LESSEQUALS:D.push(I+" "+ot+" = "+ot+" <= "+rt+";");break;case Bytecode.NOT:D.push(I+" "+rt+" = !"+rt+";");break;case Bytecode.BITNOT:D.push(I+" "+rt+" = ~"+rt+";");break;case Bytecode.NEGATE:D.push(I+" "+rt+" = -"+rt+";");break;case Bytecode.TYPEOF:D.push(I+" "+rt+" = typeof "+rt+" === 'undefined' ? 'undefined' : context.typeof("+rt+");");break;case Bytecode.INSTANCEOF:D.push(I+" "+ot+" = "+rt+".axIsInstanceOf("+ot+");");break;case Bytecode.ISTYPE:D.push(I+" "+rt+" = "+ct+".getScopeProperty("+J(pt(0))+", true, false).axIsType("+rt+");");break;case Bytecode.ISTYPELATE:D.push(I+" "+ot+" = "+rt+".axIsType("+ot+");");break;case Bytecode.ASTYPE:D.push(I+" "+rt+" = "+ct+".getScopeProperty("+J(pt(0))+", true, false).axAsType("+rt+");");break;case Bytecode.ASTYPELATE:D.push(I+" "+ot+" = "+emitIsAXOrPrimitive(ot)+" ? "+rt+".axAsType("+ot+") : "+ot+";");break;case Bytecode.CALL:for(var mt=[],gt=nt(pt(0)+1),yt=1;yt<=pt(0);yt++)mt.push(nt(pt(0)-yt));s(blockSaver)&&blockSaver.safe(gt)&&D.push(I+" /* This call maybe a safe, "+blockSaver.constructor.name+" */"),D.push(I+" "+gt+" = context.call("+nt(pt(0)+1)+", "+nt(pt(0))+", ["+mt.join(", ")+"]);");break;case Bytecode.CONSTRUCT:for(var bt=[],yt=1;yt<=pt(0);yt++)bt.push(nt(pt(0)-yt));D.push(I+" "+nt(pt(0))+" = context.construct("+nt(pt(0))+", ["+bt.join(", ")+"]);");break;case Bytecode.CALLPROPERTY:var vt=w.getMultiname(pt(1)),xt=[];for(yt=0;yt<=pt(0);yt++)xt.push(nt(pt(0)-yt));var At=xt.shift();"getDefinitionByName"==w.getMultiname(pt(1)).name?D.push(I+" "+nt(pt(0))+" = context.getdefinitionbyname("+ct+", "+At+", ["+xt.join(", ")+"]);"):(needFastCheck()&&(D.push(I+" if (!"+emitIsAXOrPrimitive(At)+") {"),D.push(I+" "+nt(pt(0))+" = "+At+"['"+vt.name+"']("+xt.join(", ")+");"),D.push(I+" } else {"),L(1)),D.push(I+" // "+vt),D.push(I+" temp = "+At+"[AX_CLASS_SYMBOL] ? "+At+" : sec.box("+At+");"),D.push(I+" "+nt(pt(0))+" = (typeof temp['$Bg"+vt.name+"'] === 'function')? temp['$Bg"+vt.name+"']("+xt.join(", ")+") : temp.axCallProperty("+J(pt(1))+", ["+xt.join(", ")+"], false);"),needFastCheck()&&(L(-1),D.push(I+" }")));break;case Bytecode.CALLPROPLEX:vt=w.getMultiname(pt(1));var St=[];for(yt=0;yt<=pt(0);yt++)St.push(nt(pt(0)-yt));D.push(I+" temp = sec.box("+St.shift()+");"),D.push(I+" "+nt(pt(0))+" = (typeof temp['$Bg"+vt.name+"'] === 'function')? temp['$Bg"+vt.name+"']("+St.join(", ")+") : temp.axCallProperty("+J(pt(1))+", ["+St.join(", ")+"], true);");break;case Bytecode.CALLPROPVOID:vt=w.getMultiname(pt(1));var wt=[];for(yt=0;yt<=pt(0);yt++)wt.push(nt(pt(0)-yt));var Ct=wt.shift();0,needFastCheck()&&(D.push(I+" if (!"+emitIsAXOrPrimitive(Ct)+") {"),D.push(I+" "+Ct+"['"+vt.name+"']("+wt.join(", ")+");"),D.push(I+" } else {"),L(1)),D.push(I+" temp = "+Ct+"[AX_CLASS_SYMBOL] ? "+Ct+" : sec.box("+Ct+");"),D.push(I+" (typeof temp['$Bg"+vt.name+"'] === 'function')? temp['$Bg"+vt.name+"']("+wt.join(", ")+") : temp.axCallProperty("+J(pt(1))+", ["+wt.join(", ")+"], false);"),needFastCheck()&&(L(-1),D.push(I+" }"));break;case Bytecode.APPLYTYPE:var Pt=[];for(yt=1;yt<=pt(0);yt++)Pt.push(nt(pt(0)-yt));D.push(I+" "+nt(pt(0))+" = sec.applyType("+nt(pt(0))+", ["+Pt.join(", ")+"]);");break;case Bytecode.FINDPROPSTRICT:if(vt=w.getMultiname(pt(0)),D.push(I+" // "+vt),s(lexGen)&&lexGen.test(vt)){D.push(I+" /* GenerateLexImports */"),D.push(I+" "+lt+" = "+lexGen.getPropStrictAlias(vt,{nameAlias:J(pt(0))})+";");break}D.push(I+" "+lt+" = "+ct+".findScopeProperty("+J(pt(0))+", true, false);");break;case Bytecode.FINDPROPERTY:D.push(I+" // "+w.getMultiname(pt(0))),D.push(I+" "+lt+" = "+ct+".findScopeProperty("+J(pt(0))+", false, false);");break;case Bytecode.NEWFUNCTION:D.push(I+" // "+w.getMethodInfo(pt(0))),D.push(I+" "+lt+" = sec.createFunction(context.abc.getMethodInfo("+pt(0)+"), "+ct+", true);");break;case Bytecode.NEWCLASS:D.push(I+" // "+w.classes[pt(0)]),D.push(I+" "+rt+" = sec.createClass(context.abc.classes["+pt(0)+"], "+rt+", "+ct+");");break;case Bytecode.NEWARRAY:var Et=[];for(yt=1;yt<=pt(0);yt++)Et.push(nt(pt(0)-yt));D.push(I+" "+nt(pt(0)-1)+" = sec.AXArray.axBox(["+Et.join(", ")+"]);");break;case Bytecode.NEWOBJECT:for(D.push(I+" temp = Object.create(sec.AXObject.tPrototype);"),yt=1;yt<=pt(0);yt++)D.push(I+" temp.axSetPublicProperty("+nt(2*pt(0)-2*yt+1)+", "+nt(2*pt(0)-2*yt)+");");D.push(I+" "+nt(2*pt(0)-1)+" = temp;"),D.push(I+" temp = undefined;");break;case Bytecode.NEWACTIVATION:D.push(I+" "+lt+" = sec.createActivation(context.mi, "+ct+");");break;case Bytecode.NEWCATCH:D.push(I+" "+lt+" = sec.createCatch(context.mi.getBody().catchBlocks["+pt(0)+"], "+ct+");");break;case Bytecode.CONSTRUCTSUPER:var Tt=[];for(yt=1;yt<=pt(0);yt++)Tt.push(nt(pt(0)-yt));D.push(I+" context.savedScope.superConstructor.call("+nt(pt(0))+", "+Tt.join(", ")+");");break;case Bytecode.CALLSUPER:var Mt=[];for(yt=1;yt<=pt(0);yt++)Mt.push(nt(pt(0)-yt));D.push(I+" "+nt(pt(0))+" = sec.box("+nt(pt(0))+").axCallSuper("+J(pt(1))+", context.savedScope, ["+Mt.join(", ")+"]);");break;case Bytecode.CALLSUPER_DYN:var Dt=[];for(yt=1;yt<=pt(0);yt++)Dt.push(nt(pt(0)-yt));(vt=w.getMultiname(pt(1))).isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" "+nt(pt(0)+2)+" = sec.box("+nt(pt(0)+2)+").axGetSuper(context.runtimename("+J(pt(1))+", "+nt(pt(0))+", "+nt(pt(0)+1)+"), context.savedScope, ["+Dt.join(", ")+"]);"):D.push(I+" "+nt(pt(0)+1)+" = sec.box("+nt(pt(0)+1)+").axGetSuper(context.runtimename("+J(pt(1))+", "+nt(pt(0))+"), context.savedScope, ["+Dt.join(", ")+"]);");break;case Bytecode.CALLSUPERVOID:var It=[];for(yt=1;yt<=pt(0);yt++)It.push(nt(pt(0)-yt));D.push(I+" sec.box("+nt(pt(0))+").axCallSuper("+J(pt(1))+", context.savedScope, ["+It.join(", ")+"]);");break;case Bytecode.CONSTRUCTPROP:var Ot=[];for(yt=1;yt<=pt(0);yt++)Ot.push(nt(pt(0)-yt));D.push(I+" "+nt(pt(0))+" = context.constructprop("+J(pt(1))+", "+nt(pt(0))+", ["+Ot.join(", ")+"]);");break;case Bytecode.GETPROPERTY:vt=w.getMultiname(pt(0));var Lt=!1;s(blockSaver)&&blockSaver.needSafe(rt)&&(Lt=!0,D.push(I+" "+blockSaver.beginSafeBlock(rt)),L(1)),0,D.push(I+" // "+vt),needFastCheck()&&(D.push(I+" if (!"+emitIsAX(rt)+") {"),D.push(I+" "+rt+" = "+rt+"['"+vt.name+"'];"),D.push(I+" } else {"),L(1)),D.push(I+" temp = "+rt+"[AX_CLASS_SYMBOL] ? "+rt+" : sec.box("+rt+");"),D.push(I+" "+rt+" = temp['$Bg"+vt.name+"'];"),D.push(I+" if ("+rt+" === undefined || typeof "+rt+" === 'function') {"),D.push(I+" "+rt+" = temp.axGetProperty("+J(pt(0))+");"),D.push(I+" }"),needFastCheck()&&(L(-1),D.push(I+" }")),Lt&&(L(-1),D.push(I+" "+blockSaver.endSafeBlock("undefined")));break;case Bytecode.GETPROPERTY_DYN:vt=w.getMultiname(pt(0)),s(blockSaver)&&blockSaver.markToSafe(vt)&&D.push(I+" /* Mark lookup to safe call, "+blockSaver.constructor.name+" */"),D.push(I+" // "+vt),vt.isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" "+st+" = context.getpropertydyn(context.runtimename("+J(pt(0))+", "+rt+", "+ot+"), "+st+");"):D.push(I+" "+ot+" = context.getpropertydyn(context.runtimename("+J(pt(0))+", "+rt+"), "+ot+");");break;case Bytecode.SETPROPERTY:vt=w.getMultiname(pt(0)),D.push(I+" // "+vt),needFastCheck()&&(D.push(I+" if (!"+emitIsAX(ot)+"){"),D.push(I+" "+ot+"['"+vt.name+"'] = "+rt+";"),D.push(I+" } else {"),L(1)),D.push(I+" context.setproperty("+J(pt(0))+", "+rt+", "+ot+");"),needFastCheck()&&(L(-1),D.push(I+" }"));break;case Bytecode.SETPROPERTY_DYN:(vt=w.getMultiname(pt(0))).isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" context.setproperty(context.runtimename("+J(pt(0))+", "+ot+", "+st+"), "+rt+", "+at+");"):D.push(I+" context.setproperty(context.runtimename("+J(pt(0))+", "+ot+"), "+rt+", "+st+");");break;case Bytecode.DELETEPROPERTY:D.push(I+" // "+w.getMultiname(pt(0))),D.push(I+" "+rt+" = context.deleteproperty("+J(pt(0))+", "+rt+");");break;case Bytecode.DELETEPROPERTY_DYN:(vt=w.getMultiname(pt(0))).isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" "+st+" = context.deleteproperty(context.runtimename("+J(pt(0))+", "+rt+", "+ot+"), "+st+");"):D.push(I+" "+ot+" = context.deleteproperty(context.runtimename("+J(pt(0))+", "+rt+"), "+ot+");");break;case Bytecode.GETSUPER:D.push(I+" "+rt+" = sec.box("+rt+").axGetSuper("+J(pt(0))+", context.savedScope);");break;case Bytecode.GETSUPER_DYN:(vt=w.getMultiname(pt(0))).isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" "+st+" = sec.box("+st+").axGetSuper(context.runtimename("+J(pt(0))+", "+rt+", "+ot+"), context.savedScope);"):D.push(I+" "+ot+" = sec.box("+ot+").axGetSuper(context.runtimename("+J(pt(0))+", "+rt+"), context.savedScope);");break;case Bytecode.SETSUPER:D.push(I+" sec.box("+ot+").axSetSuper("+J(pt(0))+", context.savedScope, "+rt+");");break;case Bytecode.SETSUPER_DYN:(vt=w.getMultiname(pt(0))).isRuntimeName()&&vt.isRuntimeNamespace()?D.push(I+" sec.box("+at+").axSetSuper(context.runtimename("+J(pt(0))+", "+ot+", "+st+"), context.savedScope, "+rt+");"):D.push(I+" sec.box("+st+").axSetSuper(context.runtimename("+J(pt(0))+", "+ot+"), context.savedScope, "+rt+");");break;case Bytecode.GETLEX:vt=w.getMultiname(pt(0)),s(lexGen)&&lexGen.test(vt)?(D.push(I+" // "+vt),D.push(I+" /* GenerateLexImports */"),D.push(I+" "+lt+" = "+lexGen.getLexAlias(vt,{nameAlias:J(pt(0))})+";")):(D.push(I+" // "+vt),D.push(I+" temp = "+ct+".findScopeProperty("+J(pt(0))+", true, false);"),D.push(I+" "+lt+" = temp['$Bg"+vt.name+"'];"),D.push(I+" if ("+lt+" === undefined || typeof "+lt+" === 'function') {"),D.push(I+" "+lt+" = temp.axGetProperty("+J(pt(0))+");"),D.push(I+" }"));break;case Bytecode.RETURNVALUE:METHOD_HOOKS&&METHOD_HOOKS[f+"__return"]&&(D.push(I+" /* ATTACH METHOD HOOK */"),D.push(I+" context.executeHook(local0, '"+f+"__return')")),D.push(I+" return "+rt+";");break;case Bytecode.RETURNVOID:METHOD_HOOKS&&METHOD_HOOKS[f+"__return"]&&(D.push(I+" /* ATTACH METHOD HOOK */"),D.push(I+" context.executeHook(local0, '"+f+"__return')")),D.push(I+" return;");break;case Bytecode.COERCE:if(4&o&&(Z.name===Bytecode.PUSHNULL||Z.name===Bytecode.PUSHUNDEFINED)){D.push(I+" // SKIP_NULL_COERCE");break}D.push(I+" "+rt+" = "+emitIsAX(rt)+" ? "+ct+".getScopeProperty("+J(pt(0))+", true, false).axCoerce("+rt+"): "+rt+";");break;case Bytecode.COERCE_A:D.push(I+" ;");break;case Bytecode.COERCE_S:if(4&o&&(Z.name===Bytecode.PUSHNULL||Z.name===Bytecode.PUSHUNDEFINED)){D.push(I+" // SKIP_NULL_COERCE");break}D.push(I+" "+rt+" = context.axCoerceString("+rt+");");break;case Bytecode.CONVERT_I:D.push(I+" "+rt+" |= 0;");break;case Bytecode.CONVERT_D:D.push(I+" "+rt+" = +"+rt+";");break;case Bytecode.CONVERT_B:D.push(I+" "+rt+" = !!"+rt+";");break;case Bytecode.CONVERT_U:D.push(I+" "+rt+" >>>= 0;");break;case Bytecode.CONVERT_S:D.push(I+" if (typeof "+rt+" !== 'string') "+rt+" = "+rt+" + '';");break;case Bytecode.CONVERT_O:D.push(I+" ;");break;case Bytecode.CHECKFILTER:D.push(I+" "+rt+" = context.axCheckFilter(sec, "+rt+");");break;case Bytecode.KILL:D.push(I+" "+ut(pt(0))+" = undefined;");break;default:if(!(8&o))switch(tt.name){case Bytecode.SI8:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" domainMemory.setInt8("+rt+", "+ot+")");break;case Bytecode.SI16:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" domainMemory.setInt16("+rt+", "+ot+", true);");break;case Bytecode.SI32:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" domainMemory.setInt32("+rt+", "+ot+", true);");break;case Bytecode.SF32:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" domainMemory.setFloat32("+rt+", "+ot+", true);");break;case Bytecode.SF64:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" domainMemory.setFloat64("+rt+", "+ot+", true);");break;case Bytecode.LI8:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" "+rt+" = domainMemory.getInt8("+rt+")");break;case Bytecode.LI16:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" "+rt+" = getInt16("+rt+", true);");break;case Bytecode.LI32:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" "+rt+" = domainMemory.getInt32("+rt+", true);");break;case Bytecode.LF32:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" "+rt+" = domainMemory.getFloat32("+rt+", true);");break;case Bytecode.LF64:D.push(I+" domainMemory = domainMemory || context.domainMemory;"),D.push(I+" "+rt+" = domainMemory.getFloat64("+rt+", true);")}if(tt.name<=Bytecode.LI8&&tt.name>=Bytecode.SF64)return D.push(I+" //unknown instruction "+BytecodeName$1[A[$].name]),{error:"unhandled instruction "+tt}}}(Y=x?x[tt.position]:null)&&(it=F.pop())&&(L(-1),D.push(I+"}"),B(it))}0<F.length&&(it=F.pop())&&(L(-1),D.push(I+"}"),B(it)),et&&(D.push(L(-1)+" }"),D.push(L(-1)+" }")),D.push(L(-1)+" }");for(var Ft=[],Bt=0,Nt=q;Bt<Nt.length;Bt++){var Rt=Nt[Bt];Rt&&(Rt.die&&Ft.push(" // local"+Rt.index+" is assigned before read, skip init"),Ft.push(" let local"+Rt.index+" = undefined"),1&o||Rt.index!=U.length+1||Rt.die||(Ft.push(" if(arguments && arguments.length) { local"+Rt.index+" = context.sec.createArrayUnsafe(Array.from(arguments).slice("+U.length+")); }"),Ft.push(" else { local"+Rt.index+" = context.emptyArray; }")))}M[H]=Ft.join("\n");var Vt=["const AX_CLASS_SYMBOL = context.AX_CLASS_SYMBOL;"];s(lexGen)&&Vt.push(lexGen.genHeader());var kt=m+Vt.join("\n")+M.join("\n")+"\n"+D.join("\n"),Ut=-1<kt.indexOf(j),jt=generateFunc(kt,c,!(2&o)),Gt=-1;return Ut&&(Gt=kt.split("\n").findIndex(function(t){return 0<=t.indexOf(j)})+3),s(lexGen)&&lexGen.reset(),s(blockSaver)&&blockSaver.reset(),Stat.end(),{names:Q,compiled:jt,error:Ut?"STACK UNDERRUN at http://jit/"+a+"_"+(l||"unknown")+".js:"+Gt:void 0}}var Context=(Object.defineProperty(Aig.prototype,"domainMemory",{get:function(){return this.domain||(this.domain=this.sec.flash.system.ApplicationDomain.axClass.currentDomain,this.domain)?this.domain.internal_memoryView:(console.warn("[JIT] Try access to domainMemory on unresolved ApplicationDomain!"),null)},enumerable:!0,configurable:!0}),Aig.prototype.executeHook=function(t,e){var i=METHOD_HOOKS[e];i&&i.hook(t)},Aig.prototype.getTopLevel=function(t,e){var i=this.savedScope.findScopeProperty(this.names[t],!0,!1);return e?i[e]:i},Aig.prototype.getStaticImportExt=function(t,e){return void 0===e&&(e=void 0),getExtClassField(e,t)},Aig.prototype.typeof=function(t){var e=typeof t,i=this.sec;switch(e){case"boolean":return"Boolean";case"object":if(null===t)return"object";if(i.AXXMLList.dPrototype.isPrototypeOf(t)||i.AXXML.dPrototype.isPrototypeOf(t))return"xml";if(i.AXNumber.dPrototype.isPrototypeOf(t))return"number";if(i.AXBoolean.dPrototype.isPrototypeOf(t))return"Boolean";if(i.AXString.dPrototype.isPrototypeOf(t))return"string"}return e},Aig.prototype.call=function(t,e,i){return validateCall(this.sec,t,i.length),t.axApply(e,i)},Aig.prototype.getdefinitionbyname=function(t,e,i){return t.global.object.scriptInfo.abc.env.app.getClass(Multiname.FromSimpleName(i[0]))},Aig.prototype.getpropertydyn=function(t,e){var i=this.sec.box(e);if("number"==typeof t)return i.axGetNumericProperty(t);var n=i["$Bg"+t.name];return null!=n&&"function"!=typeof n?n:i.axGetProperty(t)},Aig.prototype.setproperty=function(t,e,i){if(i[IS_AX_CLASS])return"number"==typeof t?i.axSetNumericProperty(t,e):i[IS_EXTERNAL_CLASS]?(ASObject.prototype.axSetProperty.call(i,t,e,Bytecode.INITPROPERTY),void Object.defineProperty(i,t.name,{value:e})):void i.axSetProperty(t,e,Bytecode.INITPROPERTY);i[t.name]=e},Aig.prototype.deleteproperty=function(t,e){var i=this.sec.box(e);return"number"==typeof t||"string"==typeof t?delete i[t]:i.axDeleteProperty(t)},Aig.prototype.construct=function(t,e){var i=extClassContructor(t.classInfo.instanceInfo.getName().name,e);return null!=i?i:(validateConstruct(this.sec,t,e.length),t.axConstruct(e))},Aig.prototype.constructprop=function(t,e,i){var n=extClassContructor(t,i);if(null!=n)return n;var r=this.sec.box(e),o=r.axResolveMultiname(t),s=r[o];return validateConstruct(r.sec,s,i.length),s.axConstruct(i)},Aig.prototype.pushwith=function(t,e){var i=this.sec.box(e);return t.object===i&&1==t.isWith?t:new Scope(t,i,!0)},Aig.prototype.hasnext2=function(t,e){var i=new HasNext2Info(null,0);return i.next(this.sec.box(t),e),[i.object,i.index]},Aig.prototype.runtimename=function(t,e,i){if(this.rn.resolved={},this.rn.script=null,this.rn.numeric=!1,this.rn.id=t.id,this.rn.kind=t.kind,t.isRuntimeName()){var n,r=e;if(r&&r.axClass&&r.axClass===r.sec.AXQName)return r=r.name,this.rn.kind=t.isAttribute()?18:17,this.rn.id=r.id,this.rn.name=r.name,this.rn.namespaces=r.namespaces,this.rn;"number"==typeof r?(this.rn.numeric=!0,this.rn.numericValue=r):isNumeric(n=axCoerceName(r))&&(this.rn.numeric=!0,this.rn.numericValue=+n),this.rn.name=r,this.rn.id=-1}else this.rn.name=t.name,i=e;var o;return t.isRuntimeNamespace()?((o=i)._ns&&(o=o._ns),this.rn.namespaces=[o],this.rn.id=-1):this.rn.namespaces=t.namespaces,this.rn},Aig),ScopeStack=(zjg.prototype.push=function(t,e){this.stack.push(t),this.isWith.push(!!e)},zjg.prototype.get=function(t){return this.stack[t]},zjg.prototype.clear=function(){this.stack.length=0,this.isWith.length=0},zjg.prototype.pop=function(){this.isWith.pop(),this.stack.pop(),this.scopes&&this.scopes.length>this.stack.length&&this.scopes.length--},zjg.prototype.topScope=function(){if(!this.scopes){if(0===this.stack.length)return this.parent;this.scopes=[]}for(var t=this.parent,e=0;e<this.stack.length;e++){var i=this.stack[e],n=this.isWith[e],r=this.scopes[e];r&&r.parent===t&&r.object===i&&r.isWith===n||(r=this.scopes[e]=new Scope(t,i,n)),t=r}return t},zjg);function zjg(t){this.parent=t,this.stack=[],this.isWith=[]}function Aig(t,e,i){this.jsGlobal=jsGlobal,this.axCoerceString=axCoerceString$2,this.axCheckFilter=axCheckFilter,this.internNamespace=internNamespace,this.AX_CLASS_SYMBOL=IS_AX_CLASS,this.mi=t,this.savedScope=e,this.rn=new Multiname(t.abc,0,null,null,null,null,!0),this.abc=t.abc,this.sec=t.abc.applicationDomain.sec,this.names=i,this.emptyArray=Object.create(this.sec.AXArray.tPrototype),this.emptyArray.value=[]}function popNameInto(t,e,i){if(i.resolved={},i.script=null,i.numeric=!1,i.id=e.id,i.kind=e.kind,e.isRuntimeName()){var n=t.pop();if(n&&n.axClass&&n.axClass===n.sec.AXQName)return n=n.name,i.kind=e.isAttribute()?18:17,i.id=n.id,i.name=n.name,i.namespaces=n.namespaces,0;"number"!=typeof n&&!isNumeric(axCoerceName(n))||(i.numeric=!0,i.numericValue=+axCoerceName(n)),i.name=n,i.id=-1}else i.name=e.name;var r;e.isRuntimeNamespace()?((r=t.pop())._ns&&(r=r._ns),i.namespaces=[r],i.id=-1):i.namespaces=e.namespaces}function interpret(t,e,i){if(AVMStage.forceINT)try{var n=_interpret(t,e,i);return executionWriter&&executionWriter.leave("< "+t.trait),n}catch(t){throw t}var r;return null==t.compiled&&null==t.error&&null!=t.getBody()&&((r=compile(t,{scope:e})).error?t.error=r.error:(t.compiled=r.compiled,t.names=r.names)),t.compiled?t.compiled(new Context(t,e,t.names)):_interpret(t,e,i)}var InterpreterFrame=(Tjg.prototype.bc=function(){return this.code[this.pc++]},Tjg.prototype.u30=function(){var t=this.code,e=this.pc,i=t[e++];return 128&i&&16384&(i=127&i|t[e++]<<7)&&2097152&(i=16383&i|t[e++]<<14)&&268435456&(i=2097151&i|t[e++]<<21)&&(i=268435455&i|t[e++]<<28,i&=4294967295),this.pc=e,i>>>0},Tjg.prototype.s24=function(){var t=this.code,e=this.pc,i=t[e]|t[e+1]<<8|t[e+2]<<16;return this.pc=e+3,i<<8>>8},Tjg.prototype.getHasNext2Info=function(){var t=this.pc,e=this.hasNext2Infos;return(e=e||(this.hasNext2Infos=[]))[t]||(e[t]=new HasNext2Info(null,0)),e[t]},Tjg);function Tjg(t,e,i,n,r){this.pc=0,this.stack=[],this.hasNext2Infos=null;var o=this.body=e.getBody();this.code=o.code,this.scopes=new ScopeStack(i);for(var s,a,l=this.locals=[t],c=this.app=e.abc.applicationDomain,h=this.sec=c.sec,u=n.length,p=0,d=e.parameters.length;p<d;p++){var _=e.parameters[p],f=p<u?n[p]:_.hasOptionalValue()?_.getOptionalValue():void 0,m=_.getType();if(m&&!m.isAnyName()){var g=i.getScopeProperty(m,!0,!1);if(!g){if(!("axClass"in t&&t.axClass.name.matches(m)))continue;g=t.axClass}f=g.axCoerce(f)}l.push(f)}e.needsRest()?l.push(h.createArrayUnsafe(sliceArguments(n,e.parameters.length))):e.needsArguments()&&(s=sliceArguments(n,0),(a=Object.create(h.argumentsPrototype)).value=s,a.callee=r,a.receiver=t,a.methodInfo=e,l.push(a))}function _interpret(M,D,I){return null!=M.error&&console.error("interpret: ("+M.error+")"),function(){var e,t,i,n,r,o,s,a=new InterpreterFrame(this,M,D,arguments,I),l=a.stack,c=a.locals,h=a.scopes,u=a.sec,p=M.abc,d=new Multiname(p,0,null,null,null,null,!0),_=[],f=0,m=scopeStacks.length;scopeStacks.push(a.scopes);t:for(;;)try{var g=a.bc();switch(g){case 9:continue;case 3:throw l.pop();case 8:c[a.u30()]=void 0;break;case 12:case 24:b=a.s24(),l.pop()<=l.pop()&&(a.pc+=b);continue;case 13:case 23:b=a.s24(),l.pop()<l.pop()&&(a.pc+=b);continue;case 14:case 22:b=a.s24(),l.pop()>=l.pop()&&(a.pc+=b);continue;case 15:case 21:b=a.s24(),l.pop()>l.pop()&&(a.pc+=b);continue;case 16:a.pc=a.s24()+a.pc;continue;case 17:b=a.s24(),l.pop()&&(a.pc+=b);continue;case 18:b=a.s24(),l.pop()||(a.pc+=b);continue;case 19:b=a.s24(),axEquals(l.pop(),l.pop(),u)&&(a.pc+=b);continue;case 20:b=a.s24(),axEquals(l.pop(),l.pop(),u)||(a.pc+=b);continue;case 25:b=a.s24(),l.pop()==l.pop()&&(a.pc+=b);continue;case 26:b=a.s24(),l.pop()!=l.pop()&&(a.pc+=b);continue;case 27:var y=a.pc-1,b=a.s24(),v=a.u30();(o=l.pop())<=v&&(a.pc+=3*o,b=a.s24()),a.pc=y+b;continue;case 29:h.pop();break;case 30:l[l.length-2]=u.box(l[l.length-2]).axNextName(l.pop());break;case 35:l[l.length-2]=u.box(l[l.length-2]).axNextValue(l.pop());break;case 50:var x=a.getHasNext2Info(),A=a.u30(),S=a.u30();x.next(u.box(c[A]),c[S]),c[A]=x.object,c[S]=x.index,l.push(!!x.index);break;case 32:l.push(null);break;case 33:l.push(void 0);break;case 36:l.push(a.code[a.pc++]<<24>>24);break;case 37:l.push(a.u30()<<16>>16);break;case 44:l.push(p.getString(a.u30()));break;case 45:l.push(p.ints[a.u30()]);break;case 46:l.push(p.uints[a.u30()]);break;case 47:l.push(p.doubles[a.u30()]);break;case 38:l.push(!0);break;case 39:l.push(!1);break;case 40:l.push(NaN);break;case 41:l.pop();break;case 42:l.push(l[l.length-1]);break;case 43:e=l[l.length-1],l[l.length-1]=l[l.length-2],l[l.length-2]=e;break;case 48:h.push(u.box(l.pop()),!1);break;case 28:h.push(u.box(l.pop()),!0);break;case 49:l.push(u.AXNamespace.FromNamespace(p.getNamespace(a.u30())));break;case 64:l.push(u.createFunction(p.getMethodInfo(a.u30()),h.topScope(),!0));break;case 65:popManyInto(l,a.u30(),_),t=l.pop(),validateCall(u,e=l[l.length-1],_.length),l[l.length-1]=e.axApply(t,_);break;case 66:popManyInto(l,a.u30(),_),i=u.box(l[l.length-1]),validateConstruct(u,i,_.length),l[l.length-1]=i.axConstruct(_);break;case 71:return release||assert(scopeStacks.length===m+1),void scopeStacks.length--;case 72:return e=l.pop(),M.returnTypeNameIndex&&(i=M.getType())&&(e=i.axCoerce(e)),release||assert(scopeStacks.length===m+1),scopeStacks.length--,e;case 73:popManyInto(l,a.u30(),_),D.object.superClass.tPrototype.axInitializer.apply(l.pop(),_);break;case 74:o=a.u30(),popManyInto(l,a.u30(),_),popNameInto(l,p.getMultiname(o),d),l[l.length-1]=u.box(l[l.length-1]).axConstructProperty(d,_);break;case 76:case 70:case 79:o=a.u30(),popManyInto(l,a.u30(),_),popNameInto(l,p.getMultiname(o),d),s=u.box(l[l.length-1]).axCallProperty(d,_,76===g),79===g?l.length--:l[l.length-1]=s;break;case 69:case 78:o=a.u30(),popManyInto(l,a.u30(),_),popNameInto(l,p.getMultiname(o),d),s=u.box(l[l.length-1]).axCallSuper(d,D,_),78===g?l.length--:l[l.length-1]=s;break;case 83:popManyInto(l,a.u30(),_),l[l.length-1]=u.applyType(l[l.length-1],_);break;case 85:t=Object.create(u.AXObject.tPrototype),f=a.u30();for(var w=l.length-2*f;w<l.length;w+=2)e=l[w+1],t.axSetPublicProperty(l[w],e);l.length-=2*f,l.push(t);break;case 86:for(t=[],f=a.u30(),w=l.length-f;w<l.length;w++)t.push(l[w]);l.length-=f,l.push(u.AXArray.axBox(t));break;case 87:l.push(u.createActivation(M,h.topScope()));break;case 88:e=l[l.length-1],l[l.length-1]=u.createClass(p.classes[a.u30()],e,h.topScope());break;case 89:popNameInto(l,p.getMultiname(a.u30()),d),void 0===d.name&&(d.name="*"),l[l.length-1]=axGetDescendants(l[l.length-1],d,u);break;case 90:l.push(u.createCatch(a.body.catchBlocks[a.u30()],h.topScope()));break;case 94:case 93:popNameInto(l,p.getMultiname(a.u30()),d),l.push(h.topScope().findScopeProperty(d,93===g,!1));break;case 96:popNameInto(l,p.getMultiname(a.u30()),d),l.push(h.topScope().findScopeProperty(d,!0,!1).axGetProperty(d));break;case 104:case 97:e=l.pop(),popNameInto(l,p.getMultiname(a.u30()),d),u.box(l.pop()).axSetProperty(d,e,104,M);break;case 102:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=u.box(l[l.length-1]).axGetProperty(d);break;case 106:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=u.box(l[l.length-1]).axDeleteProperty(d);break;case 4:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=u.box(l[l.length-1]).axGetSuper(d,D);break;case 5:e=l.pop(),popNameInto(l,p.getMultiname(a.u30()),d),u.box(l.pop()).axSetSuper(d,D,e);break;case 98:l.push(c[a.u30()]);break;case 99:c[a.u30()]=l.pop();break;case 100:l.push(D.global.object);break;case 101:l.push(h.get(a.code[a.pc++]));break;case 108:l[l.length-1]=u.box(l[l.length-1]).axGetSlot(a.u30());break;case 109:e=l.pop(),u.box(l.pop()).axSetSlot(a.u30(),e);break;case 110:l[l.length-1]=D.global.object.axGetSlot(a.u30());break;case 111:e=l.pop(),D.global.object.axSetSlot(a.u30(),e);break;case 114:l[l.length-1]=escapeAttributeValue(l[l.length-1]);break;case 113:l[l.length-1]=escapeElementValue(u,l[l.length-1]);break;case 131:case 115:l[l.length-1]|=0;break;case 136:case 116:l[l.length-1]>>>=0;break;case 132:case 117:l[l.length-1]=+l[l.length-1];break;case 129:case 118:l[l.length-1]=!!l[l.length-1];break;case 133:l[l.length-1]=axCoerceString$2(l[l.length-1]);break;case 112:l[l.length-1]=axConvertString(l[l.length-1]);break;case 120:l[l.length-1]=axCheckFilter(u,l[l.length-1]);break;case 128:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=h.topScope().getScopeProperty(d,!0,!1).axCoerce(l[l.length-1]);break;case 130:break;case 134:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=h.topScope().getScopeProperty(d,!0,!1).axAsType(l[l.length-1]);break;case 135:l[l.length-2]=l.pop().axAsType(l[l.length-1]);break;case 137:t=l[l.length-1],l[l.length-1]=null==t?null:t;break;case 144:l[l.length-1]=-l[l.length-1];break;case 145:++l[l.length-1];break;case 146:++c[a.u30()];break;case 147:--l[l.length-1];break;case 148:--c[a.u30()];break;case 149:l[l.length-1]=axTypeOf(l[l.length-1],u);break;case 150:l[l.length-1]=!l[l.length-1];break;case 151:l[l.length-1]=~l[l.length-1];break;case 160:r=l.pop(),n=l[l.length-1],l[l.length-1]="number"==typeof n&&"number"==typeof r?n+r:axAdd(n,r,u);break;case 161:l[l.length-2]-=l.pop();break;case 162:l[l.length-2]*=l.pop();break;case 163:l[l.length-2]/=l.pop();break;case 164:l[l.length-2]%=l.pop();break;case 165:l[l.length-2]<<=l.pop();break;case 166:l[l.length-2]>>=l.pop();break;case 167:l[l.length-2]>>>=l.pop();break;case 168:l[l.length-2]&=l.pop();break;case 169:l[l.length-2]|=l.pop();break;case 170:l[l.length-2]^=l.pop();break;case 171:l[l.length-2]=axEquals(l[l.length-2],l.pop(),u);break;case 172:l[l.length-2]=l[l.length-2]===l.pop();break;case 173:l[l.length-2]=l[l.length-2]<l.pop();break;case 174:l[l.length-2]=l[l.length-2]<=l.pop();break;case 175:l[l.length-2]=l[l.length-2]>l.pop();break;case 176:l[l.length-2]=l[l.length-2]>=l.pop();break;case 177:l[l.length-2]=l.pop().axIsInstanceOf(l[l.length-1]);break;case 178:popNameInto(l,p.getMultiname(a.u30()),d),l[l.length-1]=h.topScope().findScopeProperty(d,!0,!1).axIsType(l[l.length-1]);break;case 179:l[l.length-2]=l.pop().axIsType(l[l.length-1]);break;case 180:i=u.box(l.pop());var C=l[l.length-1];l[l.length-1]=C&&C.axClass===u.AXQName?i.axHasProperty(C.name):i.axHasPublicProperty(C);break;case 192:l[l.length-1]=1+(0|l[l.length-1]);break;case 193:l[l.length-1]=(0|l[l.length-1])-1;break;case 194:c[o=a.u30()]=1+(0|c[o]);break;case 195:c[o=a.u30()]=(0|c[o])-1;break;case 196:l[l.length-1]=-(0|l[l.length-1]);break;case 197:l[l.length-2]=(0|l[l.length-2])+(0|l.pop())|0;break;case 198:l[l.length-2]=(0|l[l.length-2])-(0|l.pop())|0;break;case 199:l[l.length-2]=(0|l[l.length-2])*(0|l.pop())|0;break;case 208:l.push(c[0]);break;case 209:l.push(c[1]);break;case 210:l.push(c[2]);break;case 211:l.push(c[3]);break;case 212:c[0]=l.pop();break;case 213:c[1]=l.pop();break;case 214:c[2]=l.pop();break;case 215:c[3]=l.pop();break;case 6:h.topScope().defaultNamespace=internNamespace(0,p.getString(a.u30()));break;case 7:h.topScope().defaultNamespace=internNamespace(0,l.pop());break;case 239:a.pc++,a.u30(),a.pc++,a.u30();break;case 240:case 241:a.u30();break;case 2:case 1:break;default:notImplemented(getBytecodeName(g))}}catch(t){isValidASValue(t)||(t=createValidException(u,t,g,e,i,n,r,d,m+1));var P=a.body.catchBlocks;for(w=0;w<P.length;w++){var E=P[w];if(a.pc>=E.start&&a.pc<=E.end){var T=E.getType();if(!T||a.app.getClass(T).axIsType(t)){l.length=0,l.push(t),h.clear(),a.pc=E.target;continue t}}}throw scopeStacks.length--,t}}}function createValidException(t,e,i,n,r,o,s,a,l){var c,h=e instanceof Error&&"string"==typeof e.name&&"string"==typeof e.message;if(h)if(e instanceof RangeError||"InternalError"===e.name){var u=Object.create(t.AXError.tPrototype);if(u._errorID=1023,"allocation size overflow"===e.message)return u.$Bgmessage="allocation size overflow",u;if(-1<e.message.indexOf("recursion")||-1<e.message.indexOf("call stack size exceeded"))return u.$Bgmessage="Stack overflow occurred",scopeStacks.length=l,u}else if(e instanceof TypeError){if(-1<e.message.indexOf("convert")&&(-1<e.message.indexOf("to primitive")||-1<e.message.indexOf("to string")))return t.createError("TypeError",Errors$1.ConvertToPrimitiveError,"value");if("Conversion to Array failed"===e.message)return t.createError("TypeError",Errors$1.CheckTypeFailedError,"value","Array")}var p=!1;switch(i){case 65:if(!n||!n.axApply)return t.createError("TypeError",Errors$1.CallOfNonFunctionError,"value");break;case 66:if(!r||!r.axConstruct)return t.createError("TypeError",Errors$1.ConstructOfNonFunctionError);break;case 88:if(!n||!t.AXClass.axIsType(n))return t.createError("VerifyError",Errors$1.InvalidBaseClassError);break;case 78:case 73:p=!0;case 70:case 79:case 76:case 74:case 69:if(null===r)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);if(void 0===r)return t.createError("TypeError",Errors$1.ConvertUndefinedToObjectError);if(!(r.axResolveMultiname(a)in r)){var d=p?r.axClass.superClass:r.axClass;return d.classInfo.instanceInfo.isSealed()?t.createError("ReferenceError",Errors$1.ReadSealedError,a.name,d.name.toFQNString(!1)):t.createError("TypeError",p?Errors$1.ConstructOfNonFunctionError:Errors$1.CallOfNonFunctionError,a.name)}if(h&&"RangeError"===e.name&&(-1<e.message.indexOf("arguments array passed")||-1<e.message.indexOf("call stack size")))return t.createError("RangeError",Errors$1.StackOverflowError);break;case 4:p=!0;case 102:if(null===r)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);if(void 0===r)return t.createError("TypeError",Errors$1.ConvertUndefinedToObjectError);break;case 104:case 97:if(null===r)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);if(void 0===r)return t.createError("TypeError",Errors$1.ConvertUndefinedToObjectError);var _=r.axResolveMultiname(a);if(_ in r&&!1===getPropertyDescriptor(r,_).writable)return t.createError("ReferenceError",Errors$1.ConstWriteError,_,r.axClass.name.name);break;case 177:if(!r||!r.axIsInstanceOf)return t.createError("TypeError",Errors$1.CantUseInstanceofOnNonObjectError);break;case 134:case 135:if(r&&!r.axAsType)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);case 178:case 179:if(null===r)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);if(void 0===r)return t.createError("TypeError",Errors$1.ConvertUndefinedToObjectError);if(!r.axIsType)return t.createError("TypeError",Errors$1.IsTypeMustBeClassError);break;case 128:if(!r)return t.createError("ReferenceError",Errors$1.ClassNotFoundError,a.toFQNString(!1));break;case 180:if(null===r)return t.createError("TypeError",Errors$1.ConvertNullToObjectError);if(void 0===r)return t.createError("TypeError",Errors$1.ConvertUndefinedToObjectError);break;case 19:case 20:case 171:if(typeof o!=typeof s&&("object"==typeof o&&o&&"object"!=typeof s||"object"==typeof s&&s&&"object"!=typeof o))return t.createError("TypeError",Errors$1.ConvertToPrimitiveError,"Object");break;default:if(!e||"string"!=typeof e.message||"string"!=typeof e.stack||"string"!=typeof e.name)break;c=e.message;var f,m=0===(f=e.stack.split("\n"))[0].indexOf("at ")?f[0].substr(3):f[0];switch(e.name){case"TypeError":if(0===m.indexOf("AXBasePrototype_valueOf")||0===m.indexOf("AXBasePrototype_toString"))return t.createError("TypeError",Errors$1.CallOfNonFunctionError,"value")}}c="Uncaught VM-internal exception during op "+getBytecodeName(i)+": ";try{c+=e.toString(),f=e.stack}catch(t){c+="[Failed to stringify exception]"}return t.player,console.error(c,"\n",f),t.createError("Error",Errors$1.InternalErrorIV)}var AXApplicationDomain=(olg.prototype.addBinarySymbol=function(t){this._binarySymbols[t.className]=t},olg.prototype.getBinarySymbol=function(t){return this._binarySymbols[t]},olg.prototype.loadABC=function(t){assert(this._abcs.indexOf(t)<0),this._abcs.push(t)},olg.prototype.loadAndExecuteABC=function(t){this.loadABC(t),this.executeABC(t)},olg.prototype.executeABC=function(t){var e=t.scripts[t.scripts.length-1];this.executeScript(e)},olg.prototype.findClassInfo=function(t){for(var e=0;e<this._abcs.length;e++)for(var i=this._abcs[e],n=0;n<i.instances.length;n++){var r=i.classes[n];if(r.instanceInfo.getName().name===t)return r}return null},olg.prototype.executeScript=function(t){assert(0===t.state);var e=this.sec.createAXGlobal(this,t);t.global=e,t.state=1,interpret(t.getInitializer(),e.scope,null).apply(e,[]),t.state=2},olg.prototype.findProperty=function(t,e,i){var n=this.findDefiningScript(t,i);return n?n.global:null},olg.prototype.getClass=function(t){return this.getProperty(t,!0,!0)},olg.prototype.getProperty=function(t,e,i){var n=this.findProperty(t,e,i);if(n)return n.axGetProperty(t);this.sec.throwError("ReferenceError",Errors$1.DefinitionNotFoundError,t.name)},olg.prototype.findDefiningScript=function(t,e){if(t.script)return t.script;var i;if(this.parent&&(i=this.parent.findDefiningScript(t,e)))return i;for(var n=0;n<this._abcs.length;n++){var r=this._abcs[n];if(i=this._findDefiningScriptInABC(r,t,e))return t.mutable||(t.script=i),i}return(r=this.system.sec.findDefiningABC(t))?(this.loadABC(r),i=this._findDefiningScriptInABC(r,t,e),t.mutable||(t.script=i),i):null},olg.prototype._findDefiningScriptInABC=function(t,e,i){for(var n=t.scripts,r=0;r<n.length;r++){var o=n[r],s=o.traits;if(s.resolve(),s.getTrait(e))return i&&0===o.state&&this.executeScript(o),o}return null},olg);function olg(t,e){this.sec=t,this.parent=e,this.system=e?e.system:this,this._abcs=[],this._binarySymbols={}}function containsSymbol(t,e){for(var i=0;i<t.length;i++){var n=t[i];if(0<=n.indexOf(e)){var r="!"===n[n.length-1];if(r&&(n=n.slice(0,n.length-1)),e!==n)continue;return r}}}function linkSymbols(t,e,i){for(var n=0;n<e.traits.length;n++){var r=e.traits[n];if(containsSymbol(t,r.getName().name)){if(r.isConst())return;var o=r.getName().name,s=r.getName().getMangledName();r.isSlot()?Object.defineProperty(i,o,{get:new Function("","return this."+s+"//# sourceURL=get-"+s+".as"),set:new Function("v","this."+s+" = v;//# sourceURL=set-"+s+".as")}):r.isGetter()?Object.defineProperty(i,o,{get:new Function("","return this."+s+"//# sourceURL=get-"+s+".as")}):notImplemented(r.toString())}}}function filter(t){return 0!==t.indexOf("native_")}var axTrapNames=["axResolveMultiname","axHasProperty","axDeleteProperty","axCallProperty","axCallSuper","axConstructProperty","axHasPropertyInternal","axHasOwnProperty","axSetProperty","axGetProperty","axGetSuper","axSetSuper","axNextNameIndex","axNextName","axNextValue","axGetEnumerableKeys","axHasPublicProperty","axSetPublicProperty","axGetPublicProperty","axCallPublicProperty","axDeletePublicProperty","axSetNumericProperty","axGetNumericProperty","axGetSlot","axSetSlot"];function linkClass(t,e){if((t.asClass=e).classSymbols&&linkSymbols(e.classSymbols,t.classInfo.traits,t),e.instanceSymbols&&linkSymbols(e.instanceSymbols,t.classInfo.instanceInfo.traits,t.tPrototype),e.classNatives)for(var i=0;i<e.classNatives.length;i++)copyOwnPropertyDescriptors(t,e.classNatives[i],filter);if(copyOwnPropertyDescriptors(t,e,filter,!0,!0),t.superClass,e.instanceNatives)for(i=0;i<e.instanceNatives.length;i++)copyOwnPropertyDescriptors(t.dPrototype,e.instanceNatives[i],filter);copyOwnPropertyDescriptors(t.dPrototype,e.prototype,filter),copyPropertiesByList(t.dPrototype,e.prototype,axTrapNames),e.classInitializer&&e.classInitializer.call(t,e)}function tryLinkNativeClass(t){var e=t.classInfo.instanceInfo.getClassName(),i=builtinNativeClasses[e]||nativeClasses[e];i&&linkClass(t,i)}function getNativeInitializer(t){var e=t.instanceInfo.getInitializer(),i=t.instanceInfo.getClassName(),n=builtinNativeClasses[i]||nativeClasses[i];return e.isNative()?n:null}var createContainersFromPath=function(t,e){for(var i=0,n=t.length;i<n;i++)e[t[i]]||(e[t[i]]=Object.create(null)),e=e[t[i]];return e};function defineClassLoader(i,n,r,o){Object.defineProperty(n,o,{get:function(){function t(){return e.axConstruct(arguments)}var e=i.getClass(r);return t.axIsType=function(t){return e.axIsType(t)},t.axClass=e,Object.defineProperty(n,o,{value:t,writable:!1}),t},configurable:!0})}function makeClassLoader(t,e,i,n,r){var o=n.split("."),s=o.pop();defineClassLoader(t,e=createContainersFromPath(o,e),Multiname.FromFQNString(i,r),s)}function installClassLoaders(t,e){for(var i=0;i<nativeClassLoaderNames.length;i++)makeClassLoader(t,e,nativeClassLoaderNames[i].name,nativeClassLoaderNames[i].alias,nativeClassLoaderNames[i].nsType)}function installNativeFunctions(t){for(var e in nativeFunctions){var i=e.split("."),n=i.pop();createContainersFromPath(i,t)[n]=t.boxFunction(nativeFunctions[e])}}function axInterfaceInitializer(){this.sec.throwError("VerifierError",Errors$1.NotImplementedError,this.name.name)}function axIsInstanceOfInterface(t){return!1}function axIsTypeInterface(t){return!(!t||"object"!=typeof t)&&t.axImplementsInterface(this)}function applyTraits(t,e){defineReadOnlyProperty(t,"traits",e);for(var i=e.getTraitsList(),n=0;n<i.length;n++){var r=i[n],o=r;o.value instanceof Namespace&&(o={value:ASNamespace.FromNamespace.call(t.sec.AXNamespace,o.value)}),Object.defineProperty(t,r.name.getMangledName(),o)}}function axCoerce(t){return isNullOrUndefined$1(t)?null:(!t[IS_AX_CLASS]||t.__fast__||Array.isArray(t)&&(t.length&&t[0].__fast__||!t.length)||this.axIsType(t)||this.sec.throwError("TypeError",Errors$1.CheckTypeFailedError,t,this.classInfo.instanceInfo.getClassName()),t)}function axIsInstanceOfObject(t){return this.dPrototype.isPrototypeOf(this.sec.box(t))}var ActiveLoaderContext=function(){},OrphanManager=(bng.addOrphan=function(t){0<=bng.orphans.indexOf(t)||bng.orphans.push(t)},bng.removeOrphan=function(t){if(!(bng.orphans.indexOf(t)<0)){for(var e=[],i=0;i<bng.orphans.length;i++)bng.orphans[i]!=t&&e.push(bng.orphans[i]);bng.orphans=e}},bng.updateOrphans=function(){for(var t=0;t<bng.orphans.length;t++)bng.orphans[t].adaptee.update?bng.orphans[t].adaptee.update():bng.orphans[t].adaptee.advanceFrame&&bng.orphans[t].adaptee.advanceFrame()},bng.orphans=[],bng),ASSET_LOOKUP={Sound:{allowType:[WaveAudio],lookupMethod:"getAwayJSAudio"},BitmapData:{allowType:[SceneImage2D,BitmapImage2D],lookupMethod:"getDefinition"},BitmapAsset:{allowType:[SceneImage2D,BitmapImage2D],lookupMethod:"getDefinition",passToConstructor:!0},Bitmap:{allowType:[SceneImage2D,BitmapImage2D],lookupMethod:"getDefinition"}};function bng(){}function axConstruct(t){for(var e,i,n,r,o,s,a,l,c,h=Object.create(this.tPrototype),u=null,p=null,d=this;d&&!p;)(u=d._symbol)&&u.timeline&&(p=u.timeline),d=d.superClass;if(p){FrameScriptManager._constructor_queueLevel++;var _=new MovieClip(p);h.adaptee=_;for(var f=!1,m=this._symbol.symbolClass;m&&!f;)"UIComponent"==(null===(e=m.name)||void 0===e?void 0:e.name)?f=!0:"MovieClip"==(null===(i=m.name)||void 0===i?void 0:i.name)?m=null:"Sprite"==(null===(n=m.name)||void 0===n?void 0:n.name)?f=!0:m=m.superClass?m.superClass:null;var g,y,b=this._symbol.className;(f||b&&b.includes("Font"))&&((y=g=_.timeline).frame_command_indices=[g.frame_command_indices[0]],y.frame_recipe=[g.frame_recipe[0]],y.keyframe_constructframes=[g.keyframe_constructframes[0]],y.keyframe_durations=[g.keyframe_durations[0]],y.keyframe_firstframes=[g.keyframe_firstframes[0]],y.keyframe_indices=[g.keyframe_indices[0]]),_.reset(),FrameScriptManager.execute_as3_constructors()}var v=null===(a=null===(s=null===(o=null===(r=this.superClass)||void 0===r?void 0:r.classInfo)||void 0===o?void 0:o.instanceInfo)||void 0===s?void 0:s.name)||void 0===a?void 0:a.name,x=null===(l=ActiveLoaderContext.loaderContext)||void 0===l?void 0:l.applicationDomain,A=v?ASSET_LOOKUP[v]:null;if(A){var S=null,w=this.classInfo.instanceInfo.name.name,C=[w,this.classInfo.instanceInfo.name.uri+"."+w],P=x?x[null!=(c=A.lookupMethod)?c:"getDefinition"]:null;if(P){for(var E=0;E<C.length&&!S;E++)try{S=P.call(x,C[E])}catch(t){}S?S.isAsset&&A.allowType.some(function(t){return S.isAsset(t)})||(console.warn("error: invalid asset type for class "+w+" of type "+v+",\n\t\t\t\t\t\trecieved: "+(null!=S?S:S.assetType)+", expected ["+A.allowType.map(function(t){return t.assetType}).join()+"]"),S=null):console.warn("error: could not get asset "+v+" for class "+w+", no ActiveLoaderContext.loaderContext")}else console.warn("error: could not get asset "+v+" for class "+w+", no ActiveLoaderContext.loaderContext");S&&(h.adaptee=S)}return h[IS_AX_CLASS]=!0,h.adaptee&&h.adaptee.timeline&&h.adaptee.timeline.resetScripts(),h.axInitializer.apply(h,t),(h.adaptee instanceof MovieClip||h.adaptee instanceof Sprite)&&OrphanManager.addOrphan(h),h}function axDefaultApply(t,e){return this.axCoerce(e?e[0]:void 0)}function axDefaultInitializer(){}function axGetArgumentsCallee(){var t=this.callee;if(t)return t;if(null===this.methodInfo.trait)return console.error("arguments.callee used on trait-less methodInfo function. Probably a constructor"),null;var e=this.methodInfo.trait.name;return this.receiver.axGetProperty(e)}function axCoerceBoolean(t){return!!t}function axIsTypeBoolean(t){return"boolean"==typeof t}function axIsTypeNumber(t){return"number"==typeof t}function axCoerceInt(t){return 0|t}function axFalse(){return!1}function axIsTypeInt(t){return"number"==typeof t&&(0|t)===t}function axCoerceUint(t){return t>>>0}function axIsTypeUint(t){return"number"==typeof t&&t>>>0===t}function axBoxIdentity(t){return t[0]}function axIsTypeObject(t){return this.dPrototype.isPrototypeOf(this.sec.box(t))||t===this.dPrototype}function axAsType(t){return t&&t.__fast__||this.axIsType(t)?t:null}function axBoxPrimitive(t){var e=Object.create(this.tPrototype);return e.value=t,e}function axApplyObject(t,e){var i=e[0];return null==i?Object.create(this.tPrototype):i}function axConstructObject(t){var e=t[0];return null==e?Object.create(this.tPrototype):e}function axCoerceObject(t){return null==t?null:t}var AXSecurityDomain=(Object.defineProperty(fog.prototype,"xmlParser",{get:function(){return this._xmlParser||(this._xmlParser=new XMLParser(this))},enumerable:!0,configurable:!0}),Object.defineProperty(fog.prototype,"AXFunctionUndefinedPrototype",{get:function(){return this._AXFunctionUndefinedPrototype||(this._AXFunctionUndefinedPrototype=this.createObject())},enumerable:!0,configurable:!0}),fog.prototype.addCatalog=function(t){this._catalogs.push(t)},fog.prototype.findDefiningABC=function(t){for(var e=null,i=0;i<this._catalogs.length;i++)if(e=this._catalogs[i].getABCByMultiname(t))return e;return null},fog.prototype.throwError=function(t,e,i,n,r,o){throw this.createError.apply(this,arguments)},fog.prototype.createError=function(t,e,i,n,r,o){var s=formatErrorMessage.apply(null,sliceArguments(arguments,1)),a=Multiname.FromFQNString(t,0);return this.system.getProperty(a,!0,!0).axConstruct([s,e.code])},fog.prototype.applyType=function(t,e){this.ObjectVector.axClass.superClass.dPrototype.isPrototypeOf(t.dPrototype)||this.throwError("TypeError",Errors$1.TypeAppOfNonParamType),1!==e.length&&this.throwError("TypeError",Errors$1.WrongTypeArgCountError,"__AS3__.vec::Vector",1,e.length);var i=e[0]||this.AXObject;return this.getVectorClass(i)},fog.prototype.getVectorClass=function(t){var e=this.vectorClasses.get(t);if(e)return e;switch(t&&t.classInfo?t.classInfo.instanceInfo.getName().getMangledName():"$BgObject"){case"$BgNumber":case"$Bgdouble":e=this.Float64Vector.axClass;break;case"$Bgint":e=this.Int32Vector.axClass;break;case"$Bguint":e=this.Uint32Vector.axClass;break;default:e=this.createVectorClass(t)}return this.vectorClasses.set(t,e),e},fog.prototype.createVectorClass=function(t){var e=this.ObjectVector.axClass,i=Object.create(e);return i.tPrototype=Object.create(e.tPrototype),(i.tPrototype.axClass=i).tPrototype.axClassName=i.classInfo.instanceInfo.getClassName(),i.dPrototype=e.dPrototype,i.superClass=e,i.type=t,i},fog.prototype.createObject=function(){return Object.create(this.AXObject.tPrototype)},fog.prototype.createObjectFromJS=function(t,e){void 0===e&&(e=!1);for(var i=Object.keys(t),n=this.createObject(),r=0;r<i.length;r++){var o=t[i[r]];e&&(o=transformJSValueToAS(this,o,!0)),n.axSetPublicProperty(i[r],o)}return n},fog.prototype.createArrayUnsafe=function(t){var e=Object.create(this.AXArray.tPrototype);return e.value=t,e},fog.prototype.createArray=function(t){var e=this.createArrayUnsafe([]);for(var i in t)e.axSetPublicProperty(i,t[i]);return e.length=t.length,e},fog.prototype.boxFunction=function(t){var e=Object.create(this.AXFunction.tPrototype);return e.value=t,e},fog.prototype.createClass=function(t,e,i){var n=t.instanceInfo,r=n.getName().toFQNString(!1),o=this.nativeClasses[r]||Object.create(this.AXClass.tPrototype),s=new Scope(i,o);this.nativeClasses[r]?o.tPrototype.axInitializer=this.createInitializerFunction(t,s):n.isInterface()?(o.dPrototype=Object.create(this.objectPrototype),o.tPrototype=Object.create(o.dPrototype),o.tPrototype.axInitializer=axInterfaceInitializer,o.axIsInstanceOf=axIsInstanceOfInterface,o.axIsType=axIsTypeInterface):(e===this.AXObject?o.dPrototype=Object.create(this.objectPrototype):e.dPrototype?o.dPrototype=Object.create(e.dPrototype):(o.dPrototype=Object.create(e.prototype),Object.defineProperty(o.dPrototype,IS_EXTERNAL_CLASS,{value:!0})),o.tPrototype=Object.create(o.dPrototype),o.tPrototype.axInitializer=this.createInitializerFunction(t,s)),o.classInfo=o.dPrototype.classInfo=t,(o.dPrototype.axClass=o).dPrototype.axClassName=t.instanceInfo.getClassName(),o.superClass=e,o.scope=i,"Object"!==r&&"Class"!==r&&this.initializeRuntimeTraits(o,e,s),defineNonEnumerableProperty(o.dPrototype,"$Bgconstructor",o),tryLinkNativeClass(o);var a=t.getInitializer(),l=a.getBody().code;return 208===l[0]&&48===l[1]&&71===l[2]||interpret(a,s,null).apply(o,[o]),o},fog.prototype.initializeRuntimeTraits=function(t,e,i){var n,r,o=t.classInfo,s=o.instanceInfo;r=t===this.AXClass?s.traits.resolveRuntimeTraits(null,null,i):(n=this.AXClass.classInfo.instanceInfo.runtimeTraits,o.traits.resolveRuntimeTraits(n,null,i.parent)),applyTraits(t,o.runtimeTraits=r);var a=e&&e[IS_AX_CLASS]?e.classInfo.instanceInfo.runtimeTraits:null,l=o.abc.getNamespace(s.protectedNs),c=s.traits.resolveRuntimeTraits(a,l,i);s.runtimeTraits=c,applyTraits(t.tPrototype,c)},fog.prototype.createFunction=function(t,e,i){var n=this.boxFunction(interpret(t,e,n));return n.receiver={scope:e},n},fog.prototype.createInitializerFunction=function(t,e){var i,n=t.instanceInfo.getInitializer(),r=getNativeInitializer(t);return r||((r=(i=this.application.getBinarySymbol(t.instanceInfo.getClassName()))?(i.buffer=i.data,function(){return ByteArrayDataProvider.symbolForConstructor=i,interpret(n,e,null).apply(this,arguments)}):interpret(n,e,null)).methodInfo=n),r},fog.prototype.createActivation=function(t,e){var i=t.getBody();return i.activationPrototype||(i.traits.resolve(),i.activationPrototype=Object.create(this.AXActivationPrototype),defineReadOnlyProperty(i.activationPrototype,"traits",i.traits.resolveRuntimeTraits(null,null,e))),Object.create(i.activationPrototype)},fog.prototype.createCatch=function(t,e){var i;return t.catchPrototype||(i=t.getTraits(),t.catchPrototype=Object.create(this.AXCatchPrototype),defineReadOnlyProperty(t.catchPrototype,"traits",i.resolveRuntimeTraits(null,null,e))),Object.create(t.catchPrototype)},fog.prototype.box=function(t){if(null==t)return t;if(t.constructor===Array)return this.AXArray.axBox(t);switch(typeof t){case"number":return this.AXNumber.axBox(t);case"boolean":return this.AXBoolean.axBox(t);case"string":return this.AXString.axBox(t)}return t},fog.prototype.isPrimitive=function(t){return isPrimitiveJSValue(t)||this.AXPrimitiveBox.dPrototype.isPrototypeOf(t)},fog.prototype.createAXGlobal=function(t,e){var i=Object.create(this.AXGlobalPrototype);i.applicationDomain=t,i.scriptInfo=e;var n=i.scope=new Scope(null,i,!1),r=this.AXObject.classInfo.instanceInfo.runtimeTraits;return applyTraits(i,e.traits.resolveRuntimeTraits(r,null,n)),i[IS_AX_CLASS]=!0,i},fog.prototype.prepareRootClassPrototype=function(){var t=Object.create(this.objectPrototype),e=Object.create(t);e.$BgtoString=function(){return"[class "+this.classInfo.instanceInfo.getName().name+"]"};var i=defineNonEnumerableProperty;i(e,"axBox",axBoxIdentity),i(e,"axCoerce",axCoerce),i(e,"axIsType",axIsTypeObject),i(e,"axAsType",axAsType),i(e,"axIsInstanceOf",axIsInstanceOfObject),i(e,"axConstruct",axConstruct),i(e,"axApply",axDefaultApply),Object.defineProperty(e,"name",{get:function(){return this.classInfo.instanceInfo.name}}),e[IS_AX_CLASS]=!0,this.rootClassPrototype=e},fog.prototype.initializeCoreNatives=function(){this.prepareRootClassPrototype();var t=this.prepareNativeClass("AXClass","Class",!1);t.classInfo=this.system.findClassInfo("Class"),t.defaultValue=null,(e=this.prepareNativeClass("AXObject","Object",!1)).classInfo=this.system.findClassInfo("Object");var e=this.AXObject;defineNonEnumerableProperty(this.prepareNativeClass("AXFunction","Function",!1),"axBox",axBoxPrimitive);var i=new Scope(null,t,!1),n=this.AXObject.classInfo,r=n.instanceInfo,o=r.runtimeTraits=r.traits.resolveRuntimeTraits(null,null,i);applyTraits(this.AXObject.tPrototype,o);var s=this.AXClass.classInfo,a=s.instanceInfo;return a.runtimeTraits=a.traits.resolveRuntimeTraits(o,null,i),applyTraits(this.AXClass.tPrototype,a.runtimeTraits),s.runtimeTraits=s.traits.resolveRuntimeTraits(o,null,i),applyTraits(this.AXClass,s.runtimeTraits),n.runtimeTraits=n.traits.resolveRuntimeTraits(a.runtimeTraits,null,i),applyTraits(this.AXObject,n.runtimeTraits),e[IS_AX_CLASS]=!0,e},fog.prototype.prepareNativeClass=function(t,e,i){var n,r=Object.create(this.rootClassPrototype);return"Object"===e?(r.dPrototype=Object.getPrototypeOf(this.objectPrototype),r.tPrototype=this.objectPrototype):"Class"===e?(r.dPrototype=Object.getPrototypeOf(this.rootClassPrototype),r.tPrototype=this.rootClassPrototype):(n=i?this.AXPrimitiveBox.dPrototype:"AXMethodClosure"===t?this.AXFunction.dPrototype:this.objectPrototype,r.dPrototype=Object.create(n),r.tPrototype=Object.create(r.dPrototype)),(this[t]=this.nativeClasses[e]=r)[IS_AX_CLASS]=!0,r},fog.prototype.preparePrimitiveClass=function(t,e,i,n,r,o,s){var a=this.prepareNativeClass(t,e,!0),l=defineNonEnumerableProperty;return l(a,"axBox",axBoxPrimitive),l(a,"axApply",function(t,e){return i(e&&e.length?e[0]:n)}),l(a,"axConstruct",function(t){return i(t&&t.length?t[0]:n)}),l(a,"axCoerce",r),l(a,"axIsType",o),l(a,"axIsInstanceOf",s),l(a.dPrototype,"value",n),a[IS_AX_CLASS]=!0,a},fog.prototype.initialize=function(){var t=defineNonEnumerableProperty,e=Object.create(AXBasePrototype);e.sec=this,Object.defineProperty(this,"objectPrototype",{value:Object.create(e)}),this.initializeCoreNatives(),this.AXGlobalPrototype=Object.create(this.objectPrototype),this.AXGlobalPrototype.$BgtoString=function(){return"[object global]"},this.AXActivationPrototype=Object.create(this.objectPrototype),this.AXActivationPrototype.$BgtoString=function(){return"[Activation]"},this.AXCatchPrototype=Object.create(this.objectPrototype),this.AXCatchPrototype.$BgtoString=function(){return"[Catch]"};var i=this.AXObject,n=this.AXFunction;t(i,"axApply",axApplyObject),t(i,"axConstruct",axConstructObject),t(i.tPrototype,"axInitializer",axDefaultInitializer),t(i,"axCoerce",axCoerceObject),this.prepareNativeClass("AXMethodClosure","builtin.as$0.MethodClosure",!1),this.prepareNativeClass("AXError","Error",!1),this.prepareNativeClass("AXMath","Math",!1),this.prepareNativeClass("AXDate","Date",!1),this.prepareNativeClass("AXXML","XML",!1),this.prepareNativeClass("AXXMLList","XMLList",!1),this.prepareNativeClass("AXQName","QName",!1),this.prepareNativeClass("AXNamespace","Namespace",!1);var r=this.prepareNativeClass("AXArray","Array",!1);t(r,"axBox",axBoxPrimitive),r.tPrototype.$BgtoString=n.axBox(function(){return this.value.toString()}),r.dPrototype.value=[],this.argumentsPrototype=Object.create(this.AXArray.tPrototype),Object.defineProperty(this.argumentsPrototype,"$Bgcallee",{get:axGetArgumentsCallee}),this.prepareNativeClass("AXRegExp","RegExp",!1).dPrototype.value=/(?:)/,t(this.prepareNativeClass("AXPrimitiveBox","PrimitiveBox",!1).dPrototype,"$BgtoString",n.axBox(function(){return this.value.toString()})),this.preparePrimitiveClass("AXBoolean","Boolean",axCoerceBoolean,!1,axCoerceBoolean,axIsTypeBoolean,axIsTypeBoolean),this.preparePrimitiveClass("AXString","String",axConvertString,"",axCoerceString$2,axIsTypeString,axIsTypeString),this.preparePrimitiveClass("AXNumber","Number",axCoerceNumber,0,axCoerceNumber,axIsTypeNumber,axIsTypeNumber),this.preparePrimitiveClass("AXInt","int",axCoerceInt,0,axCoerceInt,axIsTypeInt,axFalse),this.preparePrimitiveClass("AXUint","uint",axCoerceUint,0,axCoerceUint,axIsTypeUint,axFalse),installClassLoaders(this.application,this),installNativeFunctions(this)},fog);function fog(){initializeAXBasePrototype(),this.system=new AXApplicationDomain(this,null),this.application=new AXApplicationDomain(this,this.system),this.classAliases=new ClassAliases,this.nativeClasses=Object.create(null),this.vectorClasses=new Map,this._catalogs=[]}function checkNullParameter(t,e,i){null==t&&i.throwError("TypeError",Errors$1.NullPointerError,e)}var MetadataInfo=(pqg.prototype.getName=function(){return"number"==typeof this.name&&(this.name=this.abc.getString(this.name)),this.name},pqg.prototype.getKeyAt=function(t){return this.abc.getString(this.keys[t])},pqg.prototype.getValueAt=function(t){return this.abc.getString(this.values[t])},pqg.prototype.getValue=function(t){for(var e=0;e<this.keys.length;e++)if(this.abc.getString(this.keys[e])===t)return this.abc.getString(this.values[e]);return null},pqg),MethodInfo=(yqg.prototype.getNativeMetadata=function(){if(!this.trait)return null;var t=this.trait.getMetadata();if(!t)return null;for(var e=0;e<t.length;e++)if("native"===t[e].getName())return t[e];return null},yqg.prototype.getBody=function(){return this._body||(this._body=this.abc.getMethodBodyInfo(this._index))},yqg.prototype.index=function(){return this._index},yqg.prototype.getType=function(){return void 0!==this._returnType||(0===this.returnTypeNameIndex?this._returnType=null:(t=this.abc.getMultiname(this.returnTypeNameIndex),this._returnType=this.abc.applicationDomain.getClass(t))),this._returnType;var t},yqg.prototype.getName=function(){return"number"==typeof this.name?this.abc.getString(this.name)||"anonymous":this.trait?this.trait.getName().name:"anonymous"},yqg.prototype.toString=function(){var t="anonymous";return this.name&&(t=this.abc.getString(this.name)),t+=" ("+this.parameters.join(", ")+")",this.returnTypeNameIndex&&(t+=": "+this.abc.getMultiname(this.returnTypeNameIndex).name),t},yqg.prototype.toFlashlogString=function(){var t,e,i=this.trait,n=2===i.kind?"get ":3===i.kind?"set ":"",r=i.toFlashlogString(),o=i.holder;return o&&o instanceof InstanceInfo&&(n=(t=o.toFlashlogString())+"/"+n),o&&o instanceof ClassInfo&&o.trait&&(n=(t=o.trait.toFlashlogString())+"$/"+n),t&&0<(e=r.indexOf("::"))&&0===t.indexOf(r.substring(0,e+2))&&(r=r.substring(e+2)),"MTHD "+n+r+" ()"},yqg.prototype.isNative=function(){return!!(32&this.flags)},yqg.prototype.needsRest=function(){return!!(4&this.flags)},yqg.prototype.needsArguments=function(){return!!(1&this.flags)},yqg),MethodBodyInfo=(Qqg=Info,__extends(Rqg,Qqg),Rqg.prototype.trace=function(t){t.writeLn("Code: "+this.code.length);for(var e=new BytecodeStream(this.code);255!==e.currentBytecode();)t.writeLn(e.currentBCI+": "+getBytecodeName(e.currentBytecode())),e.next()},Rqg),ScriptInfo=(arg=Info,__extends(brg,arg),brg.prototype.getInitializer=function(){return this.initialiser||(this.initialiser=this.abc.getMethodInfo(this.initializer),this.initialiser.scriptInfo=this),this.initialiser},brg.prototype.trace=function(t){t.enter("ScriptInfo"),this.traits.trace(t),t.outdent()},brg),ParameterInfo=(hrg.prototype.getName=function(){return"number"==typeof this.name&&(this.name=this.abc.getString(this.name)),this.name},hrg.prototype.getType=function(){return"number"==typeof this.type&&(this.type=this.abc.getMultiname(this.type)),this.type},hrg.prototype.hasOptionalValue=function(){return 0<=this.optionalValueKind},hrg.prototype.getOptionalValue=function(){return this.abc.getConstant(this.optionalValueKind,this.optionalValueIndex)},hrg.prototype.toString=function(){var t="";return this.name?t+=this.getName():t+="?",this.type&&(t+=": "+this.getType().name),0<=this.optionalValueKind&&(t+=" = "+this.abc.getConstant(this.optionalValueKind,this.optionalValueIndex)),t},hrg),RuntimeTraitInfo=(org.prototype.getType=function(){if(void 0!==this._type)return this._type;if(null===this.typeName)return this._type=null;var t=this.abc.applicationDomain.getClass(this.typeName);return this._type=t&&t.axCoerce?t:null},org),arg,Qqg;function org(t,e,i){this.name=t,this.kind=e,this.abc=i,this.configurable=!0,this._type=void 0,this.typeName=null}function hrg(t,e,i,n,r){this.abc=t,this.type=e,this.name=i,this.optionalValueKind=n,this.optionalValueIndex=r}function brg(t,e,i){var n=arg.call(this)||this;return n.abc=t,n.initializer=e,n.traits=i,n.global=null,n.state=0,n}function Rqg(t,e,i,n,r,o,s){var a=Qqg.call(this)||this;return a.maxStack=t,a.localCount=e,a.initScopeDepth=i,a.maxScopeDepth=n,a.code=r,a.catchBlocks=o,a.traits=s,a.activationPrototype=null,a}function yqg(t,e,i,n,r,o,s){this.abc=t,this._index=e,this.name=i,this.returnTypeNameIndex=n,this.parameters=r,this.optionalCount=o,this.flags=s,this.trait=null,this.scriptInfo=null,this.classInfo=null,this.instanceInfo=null,this.isConstructor=!1,this.compiled=null,this.error=null,this._body=null,this.minArgs=r.length-o}function pqg(t,e,i,n){this.abc=t,this.name=e,this.keys=i,this.values=n}function createGlobalNative(i,n){return function(){switch(arguments.length){case 0:return i(n);case 1:return i(n,arguments[0]);case 2:return i(n,arguments[0],arguments[1]);case 3:return i(n,arguments[0],arguments[1],arguments[2]);default:for(var t=[n],e=0;e<arguments.length;e++)t.push(arguments[e]);return i.apply(this,t)}}}function createNullOrUndefinedDescription(t,e){return{__proto__:t.objectPrototype,$Bgname:void 0===e?"void":"null",$BgisDynamic:!1,$BgisFinal:!0,$BgisStatic:!1,$Bgtraits:{__proto__:t.objectPrototype,$Bgvariables:null,$Bgaccessors:null,$Bgmetadata:t.createArray([]),$Bgconstructor:null,$Bginterfaces:t.createArray([]),$Bgmethods:null,$Bgbases:t.createArray([])}}}function describeTypeJSON(t,e,i){var n=(0|e)===e,r=isNullOrUndefined$1(e);if(512&i&&(r||n))return null;if(r)return createNullOrUndefinedDescription(t,e);if(e.sec&&(t=e.sec),e=t.box(e),t.AXFunction.axIsType(e))if(t.AXMethodClosure.axIsType(e)){if(512&i)return null}else if("receiver"in e)return null;var o=e.hasOwnProperty("classInfo")?e:e.axClass,s=o===e&&!(512&i),a=o.classInfo,l=t.createObject();return l.$Bgname=n?"int":a.instanceInfo.getName().toFQNString(!0),l.$BgisDynamic=s||!(1&a.instanceInfo.flags),l.$BgisFinal=s||!!(2&a.instanceInfo.flags),l.$BgisStatic=s,256&i&&(l.$Bgtraits=addTraits(o,a,s,i)),l}var tmpName=new Multiname(null,0,7,[Namespace.PUBLIC],null,null,!0),tmpAttr=new Multiname(null,0,13,[Namespace.PUBLIC],null,null,!0);function describeType(t,e,i){tmpName.name="XML";var n=t.application.getClass(tmpName),r=describeTypeJSON(t,e,i),o=n.Create("<type/>");tmpAttr.name="name",o.setProperty(tmpAttr,r.$Bgname);var s=r.$Bgtraits.$Bgbases.value;s.length&&(tmpAttr.name="base",o.setProperty(tmpAttr,s[0])),tmpAttr.name="isDynamic",o.setProperty(tmpAttr,r.$BgisDynamic.toString()),tmpAttr.name="isFinal",o.setProperty(tmpAttr,r.$BgisFinal.toString()),tmpAttr.name="isStatic",o.setProperty(tmpAttr,r.$BgisStatic.toString()),describeTraits(o,r.$Bgtraits);var a,l=describeTypeJSON(t,e,512|i);return l&&(a=n.Create("<factory/>"),tmpAttr.name="type",a.setProperty(tmpAttr,l.$Bgname),describeTraits(a,l.$Bgtraits)&&o.appendChild(a)),o}function describeTraits(t,e){for(var i=0,n=e.$Bgbases&&e.$Bgbases.value,r=0;n&&r<n.length;r++){var o=n[r],s=t.sec.AXXML.Create('<extendsClass type="'+escapeAttributeValue(o)+'"/>');t.appendChild(s),i++}for(var a=e.$Bginterfaces&&e.$Bginterfaces.value,r=0;a&&r<a.length;r++){s=t.sec.AXXML.Create('<implementsInterface type="'+escapeAttributeValue(a[r])+'"/>');t.appendChild(s),i++}null!==e.$Bgconstructor&&(describeParams(s=t.sec.AXXML.Create("<constructor/>"),e.$Bgconstructor),t.appendChild(s),i++);var l=e.$Bgvariables&&e.$Bgvariables.value;for(r=0;l&&r<l.length;r++){var c=l[r],h="readonly"===c.$Bgaccess?"constant":"variable";finishTraitDescription(c,s=t.sec.AXXML.Create("<"+h+' name="'+escapeAttributeValue(c.$Bgname)+'" type="'+c.$Bgtype+'"/>'),t),i++}var u=e.$Bgaccessors&&e.$Bgaccessors.value;for(r=0;u&&r<u.length;r++){var p=u[r];finishTraitDescription(p,s=t.sec.AXXML.Create('<accessor name="'+escapeAttributeValue(p.$Bgname)+'" access="'+p.$Bgaccess+'" type="'+escapeAttributeValue(p.$Bgtype)+'" declaredBy="'+escapeAttributeValue(p.$BgdeclaredBy)+'"/>'),t),i++}var d=e.$Bgmethods&&e.$Bgmethods.value;for(r=0;d&&r<d.length;r++){var _=d[r];describeParams(s=t.sec.AXXML.Create('<method name="'+escapeAttributeValue(_.$Bgname)+'" declaredBy="'+escapeAttributeValue(_.$BgdeclaredBy)+'" returnType="'+escapeAttributeValue(_.$BgreturnType)+'"/>'),_.$Bgparameters.value),finishTraitDescription(_,s,t),i++}return describeMetadataXML(t,e.$Bgmetadata),0<i}function finishTraitDescription(t,e,i){null!==t.$Bguri&&(tmpAttr.name="uri",e.setProperty(tmpAttr,t.$Bguri)),null!==t.$Bgmetadata&&describeMetadataXML(e,t.$Bgmetadata),i.appendChild(e)}function describeParams(t,e){if(e)for(var i=0;i<e.length;i++){var n=e[i],r=t.sec.AXXML.Create('<parameter index="'+(i+1)+'" type="'+escapeAttributeValue(n.$Bgtype)+'" optional="'+n.$Bgoptional+'"/>');t.appendChild(r)}}function describeMetadataXML(t,e){if(e)for(var i=e.value,n=0;n<i.length;n++){for(var r=i[n],o=t.sec.AXXML.Create('<metadata name="'+escapeAttributeValue(r.$Bgname)+'"/>'),s=r.$Bgvalue.value,a=0;a<s.length;a++){var l=s[a],c=t.sec.AXXML.Create('<arg key="'+escapeAttributeValue(l.$Bgkey)+'" value="'+escapeAttributeValue(l.$Bgvalue)+'"/>');o.appendChild(c)}t.appendChild(o)}}function describeMetadataList(t,e){if(!e)return null;for(var i=t.createArray([]),n=0;n<e.length;n++){var r=e[n];"native"!==r.getName()&&i.push(describeMetadata(t,r))}return i}function describeMetadata(t,e){var i=t.createObject();i.$Bgname=e.name;var n=[];i.$Bgvalue=t.createArray(n);for(var r=0;r<e.keys.length;r++){var o=t.createObject();o.$Bgvalue=e.getValueAt(r),o.$Bgkey=e.getKeyAt(r),n.push(o)}return i}function addTraits(t,e,b,v){var i,n,r=t.sec,o=2&v,x=32&v&&!b,s=r.createObject(),A=s.$Bgvariables=8&v?r.createArray([]):null,S=s.$Bgaccessors=16&v?r.createArray([]):null,a=null;64&v&&!b&&((i=e.trait.getMetadata())&&(a=describeMetadataList(r,i))),s.$Bgmetadata=a||r.createArray([]),s.$Bgconstructor=null,4&v?(s.$Bginterfaces=r.createArray([]),b||(n=s.$Bginterfaces.value,t.classInfo.instanceInfo.getInterfaces(t).forEach(function(t){return n.push(t.name.toFQNString(!0))}))):s.$Bginterfaces=null;for(var l,w=s.$Bgmethods=x?r.createArray([]):null,c=s.$Bgbases=o?r.createArray([]):null,C=Object.create(null),P=Object.create(null),E=Object.create(null),h=!1,u=e.instanceInfo.isInterface();t;){var T=t.classInfo.instanceInfo.getName().toFQNString(!0);if(o&&h&&!b?c.push(T):h=!0,1024&v&&t===r.AXObject)break;(function(t,e,i){for(var n=0;n<e.length;n++){var r=e[n],o=r.getName(),s=o.namespace;if(i||!(!s.isPublic()&&!s.uri||1&v&&s.uri)){var a,l=i?o.name:o.toFQNString(!0);if(P[l]===E[l]){if(!C[l]){var c=t.createObject();C[l]=c;var h,u=r.getMetadata();switch(r.kind){case 6:case 0:if(!(8&v))continue;c.$Bgname=l,c.$Bguri=s.reflectedURI;var p=r.getTypeName();c.$Bgtype=p?p.toFQNString(!0):"*",c.$Bgaccess="readwrite",c.$Bgmetadata=64&v?describeMetadataList(t,u):null,A.push(c);break;case 1:if(!x)continue;var d=r.getMethodInfo().getType();c.$BgreturnType=d?d.name.toFQNString(!0):"*",c.$Bgmetadata=64&v?describeMetadataList(t,u):null,c.$Bgname=l,c.$Bguri=s.reflectedURI;for(var _=c.$Bgparameters=t.createArray([]),f=r.getMethodInfo().parameters,m=0;m<f.length;m++){var g=f[m],y=t.createObject();y.$Bgtype=g.type?g.getType().toFQNString(!0):"*",y.$Bgoptional="value"in g,_.push(y)}c.$BgdeclaredBy=T,w.push(c);break;case 2:case 3:if(!(16&v)||b)continue;c.$Bgname=l,2===r.kind?(d=r.getMethodInfo().getType(),c.$Bgtype=d?d.name.toFQNString(!0):"*",P[l]=c):(h=r.getMethodInfo().parameters[0].getType(),c.$Bgtype=h?h.toFQNString(!0):"*",E[l]=c),c.$Bgaccess=2===r.kind?"readonly":"writeonly",c.$Bgmetadata=64&v?describeMetadataList(t,u):null,c.$Bguri=s.reflectedURI,c.$BgdeclaredBy=T,S.push(c)}}}else(c=C[l]).$Bgaccess="readwrite",2===r.kind&&(a=r.getMethodInfo().getType(),c.$Bgtype=a?a.name.toFQNString(!0):"*")}}})(r,b?t.classInfo.traits.traits:t.classInfo.instanceInfo.traits.traits,u),t=t.superClass}return b&&(16&v&&((l=r.createObject()).$Bgname="prototype",l.$Bgtype="*",l.$Bgaccess="readonly",l.$Bgmetadata=null,l.$Bguri=null,l.$BgdeclaredBy="Class",S.push(l)),o&&(c.pop(),c.push("Class","Object"),t=r.AXClass)),w&&0!==w.value.length||(s.$Bgmethods=null),A&&0!==A.value.length||(s.$Bgvariables=null),s}var Natives={print:function(t,e,i,n,r,o){var s;if(2==arguments.length)s=e;else{s="";for(var a=1;a<arguments.length;a++)s+=arguments[a],a!=arguments.length-1&&(s+=" ")}console.log("%c Trace from SWF:","color: DodgerBlue",s)},debugBreak:function(t){},bugzilla:function(t,e){switch(e){case 574600:return!0}return!1},decodeURI:function(t,e){try{return jsGlobal.decodeURI(e)}catch(e){t.throwError("URIError",Errors$1.InvalidURIError,"decodeURI")}},decodeURIComponent:function(t,e){try{return jsGlobal.decodeURIComponent(e)}catch(e){t.throwError("URIError",Errors$1.InvalidURIError,"decodeURIComponent")}},encodeURI:function(t,e){try{return jsGlobal.encodeURI(e)}catch(e){t.throwError("URIError",Errors$1.InvalidURIError,"encodeURI")}},encodeURIComponent:function(t,e){try{return jsGlobal.encodeURIComponent(e)}catch(e){t.throwError("URIError",Errors$1.InvalidURIError,"encodeURIComponent")}},isNaN:wrapJSGlobalFunction(jsGlobal.isNaN),isFinite:wrapJSGlobalFunction(jsGlobal.isFinite),parseInt:wrapJSGlobalFunction(jsGlobal.parseInt),parseFloat:wrapJSGlobalFunction(jsGlobal.parseFloat),escape:wrapJSGlobalFunction(jsGlobal.escape),unescape:wrapJSGlobalFunction(jsGlobal.unescape),isXMLName:function(){return!1},notImplemented:wrapJSGlobalFunction(notImplemented),getQualifiedClassName:function(t,e){switch(typeof e){case"undefined":return"void";case"object":return null===e?"null":e.classInfo.instanceInfo.name.toFQNString(!1);case"number":return(0|e)===e?"int":"Number";case"string":return"String";case"boolean":return"Boolean"}},getQualifiedSuperclassName:function(t,e){if(isNullOrUndefined(e))return"null";var i=(e=t.box(e)).sec.AXClass.axIsType(e)?e.superClass:e.axClass.superClass;return this.getQualifiedClassName(t,i)},getDefinitionByName:function(t,e){e=axCoerceString$2(e).replace("::",".");var i=Multiname.FromFQNString(e,0);return getCurrentABC().env.app.getClass(i)},describeType:function(t,e,i){return console.log("describeType not implemented"),describeType(t,e,i)},describeTypeJSON:function(t,e,i){return console.log("describeTypeJSON not implemented"),null},getArgv:function(){return null}};function getNative(t){for(var e=t.split("."),i=Natives,n=0,r=e.length;n<r;n++)i=i&&i[e[n]];return i=i||nativeFunctions[t]}function getNativesForTrait(t){var e,i,n=null;return t.holder instanceof InstanceInfo?(n=t.holder.getClassName(),i=[(e=builtinNativeClasses[n]||nativeClasses[n]).prototype],e.instanceNatives&&pushMany(i,e.instanceNatives)):t.holder instanceof ClassInfo&&(n=t.holder.instanceInfo.getClassName(),i=[e=builtinNativeClasses[n]||nativeClasses[n]],e.classNatives&&pushMany(i,e.classNatives)),i}function getMethodOrAccessorNative(t){for(var e=getNativesForTrait(t),i=t.getName().name,n=0;n<e.length;n++){var r,o=e[n],s=i;if(!hasOwnProperty(o,i)&&hasOwnProperty(o,"native_"+i)&&(s="native_"+i),hasOwnProperty(o,s))return t.isAccessor()?(r=Object.getOwnPropertyDescriptor(o,s),t.isGetter()?r.get:r.set):o[s]}return warning("No native method for: "+t.holder+" "+t+", make sure you've got the static keyword for static methods."),null}function createMethodForTrait(t,e){if(t.method)return t.method;var i,n,r,o=t.getMethodInfo();return r=32&o.flags?(i=o.getNativeMetadata())||t.holder instanceof ScriptInfo?createGlobalNative(r=getNative(i?i.getValueAt(0):(n=t.getName()).uri+"."+n.name),e.object.sec):getMethodOrAccessorNative(t):interpret(o,e,null),(t.method=r).methodInfo=o,r.methodInfo=o,r}var Traits=(yug.prototype.resolve=function(){if(!this._resolved){for(var t=0;t<this.traits.length;t++)this.traits[t].resolve();this._resolved=!0}},yug.prototype.attachHolder=function(t){for(var e=0;e<this.traits.length;e++)this.traits[e].holder=t},yug.prototype.trace=function(e){void 0===e&&(e=new IndentingWriter),this.resolve(),this.traits.forEach(function(t){return e.writeLn(t.toString())})},yug.prototype.indexOf=function(t){for(var e=t.name,i=t.namespaces,n=this.traits,r=0;r<n.length;r++){var o=n[r].name;if(o.name===e)for(var s=o.namespaces[0],a=0;a<i.length;a++)if(s===i[a])return r}return-1},yug.prototype.getTrait=function(t){var e,i=this.multinames[t.id];return void 0===i&&(i=0<=(e=this.indexOf(t))?this.traits[e]:this,this.multinames[t.id]=i),i===this?null:i},yug.prototype.resolveRuntimeTraits=function(t,e,i){this.resolve();for(var n=Object.create(t?t.protectedNsMappings:null),r=new RuntimeTraits(t,e,n),o=0;o<this.traits.length;o++){var s=this.traits[o],a=s.name,l=new RuntimeTraitInfo(a,s.kind,s.abc);1===a.namespaces[0].type&&(r.protectedNsMappings[a.name]&&(l.name=r.protectedNsMappings[a.name].name),r.protectedNsMappings[a.name]=l);var c=r.addTrait(l);switch(s.kind){case 1:var h=createMethodForTrait(s,i);l.value=h;break;case 2:l.get=createMethodForTrait(s,i),c&&c.set&&(l.set=c.set,l.kind=7);break;case 3:l.set=createMethodForTrait(s,i),c&&c.get&&(l.get=c.get,l.kind=7);break;case 0:case 6:case 4:l.writable=!0;var u=s;l.slot=u.slot,l.value=u.getDefaultValue(),l.typeName=u.typeName,r.addSlotTrait(l)}}return r},yug),typeDefaultValues={__proto__:null,$BgNumber:NaN,$Bgint:0,$Bguint:0,$BgBoolean:!1},SlotTraitInfo=(avg=TraitInfo,__extends(bvg,avg),bvg.prototype.resolve=function(){avg.prototype.resolve.call(this),"number"==typeof this.typeName&&(this.typeName=this.abc.getMultiname(this.typeName))},bvg.prototype.getTypeName=function(){return this.resolve(),this.typeName},bvg.prototype.getDefaultValue=function(){if(-1!==this.defaultValueKind)return this.abc.getConstant(this.defaultValueKind,this.defaultValueIndex);if(null!==this.typeName){var t=typeDefaultValues[this.typeName.getMangledName()];return void 0===t?null:t}},bvg),ClassTraitInfo=(lvg=SlotTraitInfo,__extends(mvg,lvg),mvg),ExceptionInfo=(tvg.prototype.getType=function(){return"number"==typeof this.type&&(this.type=this.abc.getMultiname(this.type)),this.type},tvg.prototype.getTraits=function(){var t;return this._traits||(t=[],this.varName&&t.push(new SlotTraitInfo(this.abc,0,this.varName,1,this.type,0,0)),this._traits=new Traits(t),this._traits.resolve()),this._traits},tvg),textDecoder=null,lvg,avg;function tvg(t,e,i,n,r,o){this.abc=t,this.start=e,this.end=i,this.target=n,this.type=r,this.varName=o,this.catchPrototype=null,this._traits=null}function mvg(t,e,i,n,r){var o=lvg.call(this,t,e,i,n,0,0,-1)||this;return o.classInfo=r,o}function bvg(t,e,i,n,r,o,s){var a=avg.call(this,t,e,i)||this;return a.slot=n,a.typeName=r,a.defaultValueKind=o,a.defaultValueIndex=s,a}function yug(t){this.traits=t,this._resolved=!1,this.multinames={}}"undefined"!=typeof TextDecoder&&(textDecoder=new TextDecoder);var AbcStream=(Bvg._getResultBuffer=function(t){return(!Bvg._resultBuffer||Bvg._resultBuffer.length<t)&&(Bvg._resultBuffer=new Uint32Array(2*t)),Bvg._resultBuffer},Object.defineProperty(Bvg.prototype,"position",{get:function(){return this._position},enumerable:!0,configurable:!0}),Bvg.prototype.remaining=function(){return this._bytes.length-this._position},Bvg.prototype.seek=function(t){this._position=t},Bvg.prototype.advance=function(t){this._position+=t},Bvg.prototype.readU8=function(){return this._bytes[this._position++]},Bvg.prototype.readU8s=function(t){var e=new Uint8Array(t);return e.set(this._bytes.subarray(this._position,this._position+t),0),this._position+=t,e},Bvg.prototype.viewU8s=function(t){var e=this._bytes.subarray(this._position,this._position+t);return this._position+=t,e},Bvg.prototype.readS8=function(){return this._bytes[this._position++]<<24>>24},Bvg.prototype.readU32=function(){return this.readS32()>>>0},Bvg.prototype.readU30=function(){return this.readU32()},Bvg.prototype.readU30Unsafe=function(){return this.readU32()},Bvg.prototype.readS16=function(){return this.readU30Unsafe()<<16>>16},Bvg.prototype.readS32=function(){var t=this.readU8();return 128&t&&16384&(t=127&t|this.readU8()<<7)&&2097152&(t=16383&t|this.readU8()<<14)&&268435456&(t=2097151&t|this.readU8()<<21)&&(t=268435455&t|this.readU8()<<28,t&=4294967295),t},Bvg.prototype.readWord=function(){var t=this._view.getUint32(this._position,!0);return this._position+=4,t},Bvg.prototype.readS24=function(){return(this.readU8()|this.readU8()<<8|this.readU8()<<16)<<8>>8},Bvg.prototype.readDouble=function(){var t=this._view.getFloat64(this._position,!0);return this._position+=8,t},Bvg.prototype.readUTFString=function(t){if(textDecoder){var e=this._position;return this._position+=t,textDecoder.decode(this._bytes.subarray(e,e+t))}for(var i=this._position,n=i+t,r=this._bytes,o=0,s=Bvg._getResultBuffer(2*t);i<n;){var a,l=r[i++];l<=127?s[o++]=l:192<=l&&(a=0,a=l<224?(31&l)<<6|63&r[i++]:l<240?(15&l)<<12|(63&r[i++])<<6|63&r[i++]:(a=((7&l)<<18|(63&r[i++])<<12|(63&r[i++])<<6|63&r[i++])-65536,s[o++]=55296+((1047552&a)>>>10),56320+(1023&a)),s[o++]=a)}return this._position=i,StringUtilities.fromCharCodeArray(s.subarray(0,o))},Bvg._resultBuffer=new Uint32Array(256),Bvg),ABCFile=(Object.defineProperty(Xvg.prototype,"applicationDomain",{get:function(){return this.env.app},enumerable:!0,configurable:!0}),Xvg.prototype._parseConstantPool=function(){this._parseNumericConstants(),this._parseStringConstants()},Xvg.prototype._parseNumericConstants=function(){var t=0,e=this._stream,t=e.readU30(),i=new Int32Array(t);i[0]=0;for(var n=1;n<t;n++)i[n]=e.readS32();this.ints=i,t=e.readU30();var r=new Uint32Array(t);for(r[0]=0,n=1;n<t;n++)r[n]=e.readS32();this.uints=r,t=e.readU30();var o=new Float64Array(t);for(o[0]=NaN,n=1;n<t;n++)o[n]=e.readDouble();this.doubles=o},Xvg.prototype._parseStringConstants=function(){var t=this._stream,e=t.readU30();this._strings=new Array(e),this._strings[0]=null;var i=this._stringOffsets=new Uint32Array(e);i[0]=-1;for(var n=1;n<e;n++)i[n]=t.position,t.advance(t.readU30())},Xvg.prototype._parseNamespaces=function(){var t=this._stream,e=t.readU30();this._namespaces=new Array(e);var i=this._namespaceOffsets=new Uint32Array(e);i[0]=-1;for(var n=1;n<e;n++)i[n]=t.position,t.readU8(),t.readU30()},Xvg.prototype._parseNamespaceSets=function(){var t=this._stream,e=t.readU30();this._namespaceSets=new Array(e);var i=this._namespaceSetOffsets=new Uint32Array(e);i[0]=-1;for(var n=1;n<e;n++){i[n]=t.position;for(var r=t.readU30(),o=0;o<r;o++)t.readU30()}},Xvg.prototype._consumeMultiname=function(){var t=this._stream,e=t.readU8();switch(e){case 7:case 13:t.readU30(),t.readU30();break;case 15:case 16:t.readU30();break;case 17:case 18:break;case 9:case 14:t.readU30(),t.readU30();break;case 27:case 28:t.readU30();break;case 29:t.readU32(),t.readU32(),t.readU32();break;default:unexpected(e)}},Xvg.prototype._parseMultinames=function(){var t=this._stream,e=t.readU30();this._multinames=new Array(e);var i=this._multinameOffsets=new Uint32Array(e);i[0]=-1;for(var n=1;n<e;n++)i[n]=t.position,this._consumeMultiname()},Xvg.prototype._parseMultiname=function(t){var e,i=this._stream,n=!1,r=!0,o=0,s=i.readU8();switch(s){case 7:case 13:e=i.readU30(),r=!1,o=i.readU30();break;case 15:case 16:n=!0,o=i.readU30();break;case 17:case 18:n=!0;break;case 9:case 14:o=i.readU30(),e=i.readU30();break;case 27:case 28:e=i.readU30();break;case 29:var a=i.readU32(),l=(i.readU32(),this.getMultiname(i.readU32())),c=this.getMultiname(a);return new Multiname(this,t,s,c.namespaces,c.name,l);default:unexpected()}var h=0===o?null:this.getString(o),u=n?null:r?this.getNamespaceSet(e):[this.getNamespace(e)];return new Multiname(this,t,s,u,h)},Xvg.prototype._checkMagic=function(){var t=this._stream.readWord();t<3014671&&this.env.app.sec.throwError("VerifierError",Errors$1.InvalidMagicError,t>>16,65535&t)},Xvg.prototype._checkForDuplicateStrings=function(){for(var t=[],e=0;e<this._strings.length;e++)t.push(this.getString(e));for(t.sort(),e=0;e<t.length-1;e++)if(t[e]===t[e+1])return!0;return!1},Xvg.prototype.getString=function(t){var e,i,n=this._strings[t];return void 0===n&&((e=this._stream).seek(this._stringOffsets[t]),i=e.readU30(),n=this._strings[t]=e.readUTFString(i)),n},Xvg.prototype.getMultiname=function(t){if((t<0||t>=this._multinameOffsets.length)&&this.applicationDomain.sec.throwError("VerifierError",Errors$1.CpoolIndexRangeError,t,this._multinameOffsets.length),0===t)return null;var e=this._multinames[t];return void 0===e&&(this._stream.seek(this._multinameOffsets[t]),e=this._multinames[t]=this._parseMultiname(t)),e},Xvg.prototype.getNamespace=function(t){if((t<0||t>=this._namespaceOffsets.length)&&this.applicationDomain.sec.throwError("VerifierError",Errors$1.CpoolIndexRangeError,t,this._namespaceOffsets.length),0===t)return Namespace.PUBLIC;var e=this._namespaces[t];if(void 0!==e)return e;var i=this._stream;i.seek(this._namespaceOffsets[t]);var n,r=i.readU8(),o=i.readU30(),s=o?this.getString(o):void 0;switch(r){case 8:case 22:n=0;break;case 23:n=2;break;case 24:n=1;break;case 25:n=4;break;case 26:n=5;break;case 5:n=3;break;default:this.applicationDomain.sec.throwError("VerifierError",Errors$1.CpoolEntryWrongTypeError,t)}return s&&3!==n||void 0===s&&(s=""),this._namespaces[t]=internNamespace(n,s)},Xvg.prototype.getNamespaceSet=function(t){if((t<0||t>=this._namespaceSets.length)&&this.applicationDomain.sec.throwError("VerifierError",Errors$1.CpoolIndexRangeError,t,this._namespaceSets.length),0===t)return null;if(void 0===(r=this._namespaceSets[t])){var e=this._stream,i=this._namespaceSetOffsets[t];e.seek(i);var n=e.readU30(),r=this._namespaceSets[t]=new Array(n);i=e.position;for(var o=0;o<n;o++){e.seek(i);var s=e.readU30(),i=e.position;r[o]=this.getNamespace(s)}}return r},Xvg.prototype._parseMethodInfos=function(){var t=this._stream,e=t.readU30();this._methods=new Array(e),this._methodInfoOffsets=new Uint32Array(e);for(var i=0;i<e;++i)this._methodInfoOffsets[i]=t.position,this._consumeMethodInfo()},Xvg.prototype._consumeMethodInfo=function(){var t=this._stream,e=t.readU30();t.readU30(),t.position;for(var i=0;i<e;i++)t.readU30();t.readU30();var n=t.readU8();if(8&n)for(i=e-t.readU30();i<e;i++)t.readU30(),t.readU8();if(128&n)for(i=0;i<e;i++)t.readU30()},Xvg.prototype._parseMethodInfo=function(t){for(var e=this._stream,i=e.readU30(),n=e.readU30(),r=(e.position,new Array(i)),o=0;o<i;o++)r[o]=new ParameterInfo(this,e.readU30(),0,-1,-1);var s=e.readU30(),a=e.readU8(),l=0;if(8&a)for(o=i-(l=e.readU30());o<i;o++)r[o].optionalValueIndex=e.readU30(),r[o].optionalValueKind=e.readU8();if(128&a)for(o=0;o<i;o++)r[o].name=e.readU30();return new MethodInfo(this,t,s,n,r,l,a)},Xvg.prototype.getMethodInfo=function(t){var e=this._methods[t];return void 0===e&&(this._stream.seek(this._methodInfoOffsets[t]),e=this._methods[t]=this._parseMethodInfo(t)),e},Xvg.prototype.getMethodBodyInfo=function(t){return this._methodBodies[t]},Xvg.prototype._parseMetaData=function(){var t=this._stream,e=t.readU30();this._metadata=new Array(e);for(var i=this._metadataInfoOffsets=new Uint32Array(e),n=0;n<e;n++){i[n]=t.position,t.readU30();for(var r=t.readU30(),o=0;o<r;o++)t.readU30(),t.readU30()}},Xvg.prototype.getMetadataInfo=function(t){var e=this._metadata[t];if(void 0===e){var i=this._stream;i.seek(this._metadataInfoOffsets[t]);for(var n=i.readU30(),r=i.readU30(),o=new Uint32Array(r),s=0;s<r;s++)o[s]=i.readU30();for(var a=new Uint32Array(r),s=0;s<r;s++)a[s]=i.readU30();e=this._metadata[t]=new MetadataInfo(this,n,o,a)}return e},Xvg.prototype._parseInstanceAndClassInfos=function(){for(var t=this._stream,e=t.readU30(),i=this.instances=new Array(e),n=0;n<e;n++)i[n]=this._parseInstanceInfo();this._parseClassInfos(e);for(var r=t.position,n=0;n<e;n++)i[n].classInfo=this.classes[n];t.seek(r)},Xvg.prototype._parseInstanceInfo=function(){var t=this._stream,e=t.readU30(),i=t.readU30(),n=t.readU8(),r=0;8&n&&(r=t.readU30());for(var o=t.readU30(),s=[],a=0;a<o;a++)s[a]=t.readU30();var l=t.readU30(),c=this._parseTraits(),h=new InstanceInfo(this,e,i,n,r,s,l,c);return c.attachHolder(h),h},Xvg.prototype._parseTraits=function(){for(var t=this._stream.readU30(),e=[],i=0;i<t;i++)e.push(this._parseTrait());return new Traits(e)},Xvg.prototype._parseTrait=function(){var t=this._stream,e=t.readU30(),i=t.readU8(),n=15&i,r=i>>4&15;switch(n){case 0:case 6:var o=t.readU30(),s=t.readU30(),a=t.readU30(),l=-1;0!==a&&(l=t.readU8()),p=new SlotTraitInfo(this,n,e,o,s,l,a);break;case 1:case 2:case 3:t.readU30();var c=t.readU30(),h=t.position,u=this.getMethodInfo(c),p=u.trait=new MethodTraitInfo(this,n,e,u);t.seek(h);break;case 4:o=t.readU30();var d=this.classes[t.readU30()];p=d.trait=new ClassTraitInfo(this,n,e,o,d);break;default:this.applicationDomain.sec.throwError("VerifierError",Errors$1.UnsupportedTraitsKindError,n)}if(4&r){for(var _=t.readU30(),f=new Uint32Array(_),m=0;m<_;m++)f[m]=t.readU30();p.metadata=f}return p},Xvg.prototype._parseClassInfos=function(t){this._stream;for(var e=this.classes=new Array(t),i=0;i<t;i++)e[i]=this._parseClassInfo(i)},Xvg.prototype._parseClassInfo=function(t){var e=this._stream.readU30(),i=this._parseTraits(),n=new ClassInfo(this,this.instances[t],e,i);return i.attachHolder(n),n},Xvg.prototype._parseScriptInfos=function(){for(var t=this._stream.readU30(),e=this.scripts=new Array(t),i=0;i<t;i++)e[i]=this._parseScriptInfo()},Xvg.prototype._parseScriptInfo=function(){var t=this._stream.readU30(),e=this._parseTraits(),i=new ScriptInfo(this,t,e);return e.attachHolder(i),i},Xvg.prototype._parseMethodBodyInfos=function(){for(var t=this._stream,e=this._methodBodies=new Array(this._methods.length),i=t.readU30(),n=(t.position,0);n<i;n++){for(var r=t.readU30(),o=t.readU30(),s=t.readU30(),a=t.readU30(),l=t.readU30(),c=t.viewU8s(t.readU30()),h=t.readU30(),u=new Array(h),p=0;p<h;++p)u[p]=this._parseException();var d=this._parseTraits();e[r]=new MethodBodyInfo(o,s,a,l,c,u,d),d.attachHolder(e[r])}},Xvg.prototype._parseException=function(){var t=this._stream,e=t.readU30(),i=t.readU30(),n=t.readU30(),r=t.readU30(),o=t.readU30();return new ExceptionInfo(this,e,i,n,r,o)},Xvg.prototype.getConstant=function(t,e){switch(t){case 3:return this.ints[e];case 4:return this.uints[e];case 6:return this.doubles[e];case 1:return this.getString(e);case 11:return!0;case 10:return!1;case 12:return null;case 0:return;case 8:case 23:return this.getNamespace(e);case 7:case 14:case 15:case 16:case 17:case 18:case 19:case 20:return this.getMultiname(e)}},Xvg.prototype.stress=function(){for(var t=0;t<this._multinames.length;t++)this.getMultiname(t);for(t=0;t<this._namespaceSets.length;t++)this.getNamespaceSet(t);for(t=0;t<this._namespaces.length;t++)this.getNamespace(t);for(t=0;t<this._strings.length;t++)this.getString(t)},Xvg.prototype.trace=function(t){t.writeLn("Multinames: "+this._multinames.length),t.indent();for(var e=0;e<this._multinames.length;e++)t.writeLn(e+" "+this.getMultiname(e));for(t.outdent(),t.writeLn("Namespace Sets: "+this._namespaceSets.length),t.indent(),e=0;e<this._namespaceSets.length;e++)t.writeLn(e+" "+this.getNamespaceSet(e));for(t.outdent(),t.writeLn("Namespaces: "+this._namespaces.length),t.indent(),e=0;e<this._namespaces.length;e++)t.writeLn(e+" "+this.getNamespace(e));for(t.outdent(),t.writeLn("Strings: "+this._strings.length),t.indent(),e=0;e<this._strings.length;e++)t.writeLn(e+" "+this.getString(e));for(t.outdent(),t.writeLn("MethodInfos: "+this._methods.length),t.indent(),e=0;e<this._methods.length;e++)t.writeLn(e+" "+this.getMethodInfo(e)),this._methodBodies[e]&&this._methodBodies[e].trace(t);for(t.outdent(),t.writeLn("InstanceInfos: "+this.instances.length),t.indent(),e=0;e<this.instances.length;e++)t.writeLn(e+" "+this.instances[e]),this.instances[e].trace(t);for(t.outdent(),t.writeLn("ClassInfos: "+this.classes.length),t.indent(),e=0;e<this.classes.length;e++)this.classes[e].trace(t);for(t.outdent(),t.writeLn("ScriptInfos: "+this.scripts.length),t.indent(),e=0;e<this.scripts.length;e++)this.scripts[e].trace(t);t.outdent()},Xvg);function Xvg(t,e){this._buffer=e,this.env=t,this._stream=new AbcStream(e),this._checkMagic(),this._parseConstantPool(),this._parseNamespaces(),this._parseNamespaceSets(),this._parseMultinames(),this._parseMethodInfos(),this._parseMetaData(),this._parseInstanceAndClassInfos(),this._parseScriptInfos(),this._parseMethodBodyInfos()}function Bvg(t){this._bytes=t,this._view=new DataView(t.buffer,t.byteOffset),this._position=0}function initlazy(){Namespace.PUBLIC=internNamespace(0,"")}var ABCCatalog=(ezg.prototype.getABCByScriptName=function(t){var e=this.scripts[t];if(!e)return null;var i={url:t,app:this.app};return new ABCFile(i,this.abcs.subarray(e.offset,e.offset+e.length))},ezg.prototype.getABCByMultiname=function(t){var e=this.map[t.name];if(!e)return null;for(var i=t.namespaces,n=0;n<i.length;n++){var r=e[i[n].uri];if(r)return this.getABCByScriptName(r)}return null},ezg),AVM2LoadLibrariesFlags,vzg;function ezg(t,e,i){this.app=t,this.map=ObjectUtilities.createMap(),this.abcs=e,this.scripts=ObjectUtilities.createMap();for(var n=0;n<i.length;n++){var r=i[n];this.scripts[r.name]=r;for(var o=0;o<r.defs.length;o++){var s=r.defs[o].split(":");(this.map[s[1]]||(this.map[s[1]]=Object.create(null)))[s[0]]=r.name}}}vzg=AVM2LoadLibrariesFlags=AVM2LoadLibrariesFlags||{},vzg[vzg.Builtin=1]="Builtin",vzg[vzg.Playerglobal=2]="Playerglobal",vzg[vzg.Shell=4]="Shell";var AVM2Handler=(wzg.prototype.init=function(t,e,i){var n=this;this._avmStage&&i(!1),this._avmStage=t,this._avmStage.scene.mouseManager._stage=this._avmStage,initSystem(),initializeAXBasePrototype(),initlazy(),Function.prototype.axApply=Function.prototype.apply,Function.prototype.axCall=Function.prototype.call,this._playerglobal.createSecurityDomain(t,e,AVM2LoadLibrariesFlags.Builtin|AVM2LoadLibrariesFlags.Playerglobal).then(function(t){n._factory=t,i(!0)})},wzg.prototype.enterFrame=function(t){this._playerglobal.enterFrame()},wzg.prototype.resizeStage=function(){this._playerglobal.resizeStage()},Object.defineProperty(wzg.prototype,"factory",{get:function(){if(!this._factory)throw"AVM2Handler - no Factory get factory";return this._factory},enumerable:!0,configurable:!0}),wzg.prototype.addAsset=function(t,e){this._playerglobal.addAsset(t,e)},wzg);function wzg(t){if(this.avmVersion="AVM2",!t)throw"AVM2Handler must be init with a valid PlayerGlobal-class";this._playerglobal=t}console.debug("AwayFL - AVM2 - 0.2.91");var Event$1=(Gzg=ASObject,__extends(Hzg,Gzg),Hzg.getInstance=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this._instances[t];return n||(n=new Hzg(t,e,i),this._instances[t]=n),n._bubbles=e,n._cancelable=i,n},Hzg.getBroadcastInstance=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this._instances[t];return n||(n=new Hzg(t,e,i),this._instances[t]=n),n._isBroadcastEvent=!0,n._bubbles=e,n._cancelable=i,n},Hzg.isBroadcastEventType=function(t){switch(t){case Hzg.ENTER_FRAME:case Hzg.EXIT_FRAME:case Hzg.FRAME_CONSTRUCTED:case Hzg.RENDER:case Hzg.ACTIVATE:case Hzg.DEACTIVATE:return!0}return!1},Object.defineProperty(Hzg.prototype,"type",{get:function(){return this._type},enumerable:!0,configurable:!0}),Object.defineProperty(Hzg.prototype,"bubbles",{get:function(){return this._bubbles},enumerable:!0,configurable:!0}),Object.defineProperty(Hzg.prototype,"cancelable",{get:function(){return this._cancelable},enumerable:!0,configurable:!0}),Object.defineProperty(Hzg.prototype,"target",{get:function(){return this._target},set:function(t){this._target=t},enumerable:!0,configurable:!0}),Object.defineProperty(Hzg.prototype,"currentTarget",{get:function(){return this._currentTarget},set:function(t){this._currentTarget=t},enumerable:!0,configurable:!0}),Object.defineProperty(Hzg.prototype,"eventPhase",{get:function(){return this._eventPhase},enumerable:!0,configurable:!0}),Hzg.prototype.stopPropagation=function(){this._stopPropagation=!0,this.adaptee&&this.adaptee.stopPropagation()},Hzg.prototype.stopImmediatePropagation=function(){this._stopImmediatePropagation=this._stopPropagation=!0,this.adaptee&&this.adaptee.stopImmediatePropagation()},Hzg.prototype.preventDefault=function(){this._cancelable&&(this._isDefaultPrevented=!0)},Hzg.prototype.isDefaultPrevented=function(){return this._isDefaultPrevented},Hzg.prototype.isBroadcastEvent=function(){return!!this._isBroadcastEvent},Hzg.prototype.clone=function(){return new Hzg(this._type,this._bubbles,this._cancelable)},Hzg.prototype.toString=function(){return this.formatToString("Event","type","bubbles","cancelable","eventPhase")},Hzg.prototype.formatToString=function(t){for(var e=[],i=1;i<arguments.length;i++)e[i-1]=arguments[i];for(var n="["+t,r=0;r<e.length;r++){var o=e[r],s=this.axGetPublicProperty(o);"string"==typeof s&&(s='"'+s+'"'),n+=" "+o+"="+s}return n+"]"},Hzg.classInitializer=function(){this._instances=ObjectUtilities.createMap()},Hzg.ACTIVATE="activate",Hzg.ADDED="added",Hzg.ADDED_TO_STAGE="addedToStage",Hzg.CANCEL="cancel",Hzg.CHANGE="change",Hzg.CLEAR="clear",Hzg.CLOSE="close",Hzg.COMPLETE="complete",Hzg.CONNECT="connect",Hzg.COPY="copy",Hzg.CUT="cut",Hzg.DEACTIVATE="deactivate",Hzg.ENTER_FRAME="enterFrame",Hzg.FRAME_CONSTRUCTED="frameConstructed",Hzg.EXIT_FRAME="exitFrame",Hzg.FRAME_LABEL="frameLabel",Hzg.ID3="id3",Hzg.INIT="init",Hzg.MOUSE_LEAVE="mouseLeave",Hzg.OPEN="open",Hzg.PASTE="paste",Hzg.REMOVED="removed",Hzg.REMOVED_FROM_STAGE="removedFromStage",Hzg.RENDER="render",Hzg.RESIZE="resize",Hzg.SCROLL="scroll",Hzg.TEXT_INTERACTION_MODE_CHANGE="textInteractionModeChange",Hzg.SELECT="select",Hzg.SELECT_ALL="selectAll",Hzg.SOUND_COMPLETE="soundComplete",Hzg.TAB_CHILDREN_CHANGE="tabChildrenChange",Hzg.TAB_ENABLED_CHANGE="tabEnabledChange",Hzg.TAB_INDEX_CHANGE="tabIndexChange",Hzg.UNLOAD="unload",Hzg.FULLSCREEN="fullScreen",Hzg.CONTEXT3D_CREATE="context3DCreate",Hzg.TEXTURE_READY="textureReady",Hzg.VIDEO_FRAME="videoFrame",Hzg.SUSPEND="suspend",Hzg.AVM1_INIT="initialize",Hzg.AVM1_CONSTRUCT="construct",Hzg.AVM1_LOAD="load",Hzg),EventDispatcherBase=(cAg=ASObject,__extends(dAg,cAg),dAg.prototype.toString=function(){return""},dAg.prototype.addEventListener=function(t,e){var i;this._listenerObjects&&(void 0===(i=this._listenerObjects[t])&&(i=this._listenerObjects[t]=new ListenerObject$1),i.addEventListener(e))},dAg.prototype.removeEventListener=function(t,e){var i;!this._listenerObjects||(i=this._listenerObjects[t])&&(i.removeEventListener(e),0==i.numListeners&&delete this._listenerObjects[t])},dAg.prototype.dispatchEvent=function(t){var e;!this._listenerObjects||(e=this._listenerObjects[t.type])&&(t.target||(t.target=this._t),e.dispatchEvent(t))},dAg.prototype.hasEventListener=function(t,e){return void 0!==this._listenerObjects[t]&&(null!=e?-1!==this._listenerObjects[t].getEventListenerIndex(e):0<this._listenerObjects[t].numListeners)},dAg),ListenerObject$1=(qAg.prototype.addEventListener=function(t){-1===this._listeners.indexOf(t)&&(this._listeners.push(t),this.numListeners++)},qAg.prototype.removeEventListener=function(t){var e=this._listeners.indexOf(t);-1!==e&&(this._listeners.splice(e,1),e<=this._index&&this._index--,this.numListeners--)},qAg.prototype.dispatchEvent=function(t){var e=this.numListeners;for(this._index=0;this._index<e&&this._index<this.numListeners;this._index++)this._listeners[this._index].call(this._listeners[this._index],t)},qAg.prototype.getEventListenerIndex=function(t){return this._listeners.indexOf(t)},qAg),MouseEvent$2=(xAg=Event$1,__extends(yAg,xAg),yAg.typeFromDOMType=function(t){switch(t){case"click":return yAg.CLICK;case"dblclick":return yAg.DOUBLE_CLICK;case"mousedown":return yAg.MOUSE_DOWN;case"mouseout":case"mouseover":case"mousemove":return yAg.MOUSE_MOVE;case"mouseup":return yAg.MOUSE_UP}},yAg.prototype.fillFromAway=function(t){this.adaptee=t,this.target=t.target,this.delta=t.delta,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey},Object.defineProperty(yAg.prototype,"localX",{get:function(){return this._localX/20|0},set:function(t){this._localX=20*t|0},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"localY",{get:function(){return this._localY/20|0},set:function(t){this._localY=20*t|0},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"stageX",{get:function(){return isNaN(this.localX+this.localY)?Number.NaN:this.target.stage.mouseX},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"stageY",{get:function(){return isNaN(this.localX+this.localY)?Number.NaN:this.target.stage.mouseY},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"movementX",{get:function(){return this._movementX||0},set:function(t){this._movementX=+t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"movementY",{get:function(){return this._movementY||0},set:function(t){this._movementY=+t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"delta",{get:function(){return this._delta},set:function(t){this._delta=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"ctrlKey",{get:function(){return this._ctrlKey},set:function(t){this._ctrlKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"altKey",{get:function(){return this._altKey},set:function(t){this._altKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"shiftKey",{get:function(){return this._shiftKey},set:function(t){this._shiftKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"buttonDown",{get:function(){return this._buttonDown},set:function(t){this._buttonDown=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"relatedObject",{get:function(){return this._relatedObject},set:function(t){this._relatedObject=t},enumerable:!0,configurable:!0}),Object.defineProperty(yAg.prototype,"isRelatedObjectInaccessible",{get:function(){return this._isRelatedObjectInaccessible},set:function(t){this._isRelatedObjectInaccessible=t},enumerable:!0,configurable:!0}),yAg.prototype.updateAfterEvent=function(){this.sec.player.requestRender()},yAg.prototype.clone=function(){return new yAg(this.type,this.bubbles,this.cancelable,this.localX,this.localY,this.relatedObject,this.ctrlKey,this.altKey,this.shiftKey,this.buttonDown,this.delta)},yAg.prototype.toString=function(){return this.formatToString("MouseEvent","type","bubbles","cancelable","eventPhase","localX","localY","relatedObject","ctrlKey","altKey","shiftKey","buttonDown","delta")},yAg.classInitializer=null,yAg.classSymbols=null,yAg.instanceSymbols=null,yAg.CLICK="click",yAg.DOUBLE_CLICK="doubleClick",yAg.MOUSE_DOWN="mouseDown",yAg.MOUSE_MOVE="mouseMove",yAg.MOUSE_OUT="mouseOut",yAg.MOUSE_OVER="mouseOver",yAg.MOUSE_UP="mouseUp",yAg.RELEASE_OUTSIDE="releaseOutside",yAg.MOUSE_WHEEL="mouseWheel",yAg.ROLL_OUT="rollOut",yAg.ROLL_OVER="rollOver",yAg.MIDDLE_CLICK="middleClick",yAg.MIDDLE_MOUSE_DOWN="middleMouseDown",yAg.MIDDLE_MOUSE_UP="middleMouseUp",yAg.RIGHT_CLICK="rightClick",yAg.RIGHT_MOUSE_DOWN="rightMouseDown",yAg.RIGHT_MOUSE_UP="rightMouseUp",yAg.CONTEXT_MENU="contextMenu",yAg),KeyboardEvent$2=(YAg=Event$1,__extends(ZAg,YAg),Object.defineProperty(ZAg.prototype,"charCode",{get:function(){return this._charCode},set:function(t){this._charCode=t},enumerable:!0,configurable:!0}),Object.defineProperty(ZAg.prototype,"keyCode",{get:function(){return this._keyCode},set:function(t){this._keyCode=t},enumerable:!0,configurable:!0}),Object.defineProperty(ZAg.prototype,"keyLocation",{get:function(){return this._keyLocation},set:function(t){this._keyLocation=t},enumerable:!0,configurable:!0}),Object.defineProperty(ZAg.prototype,"ctrlKey",{get:function(){return this._ctrlKey},set:function(t){this._ctrlKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(ZAg.prototype,"altKey",{get:function(){return this._altKey},set:function(t){this._altKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(ZAg.prototype,"shiftKey",{get:function(){return this._shiftKey},set:function(t){this._shiftKey=t},enumerable:!0,configurable:!0}),ZAg.prototype.clone=function(){return new ZAg(this.type,this.bubbles,this.cancelable,this.charCode,this.keyCode,this.keyLocation,this.ctrlKey,this.altKey,this.shiftKey)},ZAg.prototype.toString=function(){return this.formatToString("KeyboardEvent","type","bubbles","cancelable","eventPhase","charCode","keyCode","keyLocation","ctrlKey","altKey","shiftKey")},ZAg.prototype.updateAfterEvent=function(){this.sec.player.requestRender()},ZAg.classInitializer=null,ZAg.classSymbols=null,ZAg.instanceSymbols=null,ZAg.KEY_DOWN="keyDown",ZAg.KEY_UP="keyUp",ZAg),EventDispatcher$1=(oBg=EventDispatcherBase,__extends(pBg,oBg),pBg.prototype.toString=function(){return""},pBg.prototype.hasEventListener=function(t,e){return oBg.prototype.hasEventListener.call(this,t,e)},pBg.prototype.willTrigger=function(){},pBg.prototype.dispatchEvent=function(t){t.currentTarget=this,oBg.prototype.dispatchEvent.call(this,t),-1==pBg.eventsThatBubbleInAwayJS.indexOf(t.type)&&this.adaptee&&this.adaptee.parent&&this.adaptee.parent.adapter.dispatchEvent(t)},pBg.prototype.initActivateListener=function(t,e){window.onfocus=e},pBg.prototype.removeActivateListener=function(t,e){window.onfocus=null},pBg.prototype.activateCallback=function(t){this.dispatchEvent(new this.sec.flash.events.Event(Event$1.ACTIVATE))},pBg.prototype.initDeactivateListener=function(t,e){window.onblur=e},pBg.prototype.removeDeactivateListener=function(t,e){window.onblur=null},pBg.prototype.deactivateCallback=function(t){this.dispatchEvent(new this.sec.flash.events.Event(Event$1.DEACTIVATE))},pBg.prototype.addEventListener=function(t,e,i,n,r){if(void 0===i&&(i=!1),!i&&Event$1.isBroadcastEventType(t)&&BroadcastEventDispatchQueue.getInstance().add(t,this),this.eventMappingDummys)return this.eventMappingDummys.hasOwnProperty(t)?void 0:this.eventMapping.hasOwnProperty(t)?(oBg.prototype.addEventListener.call(this,t,e),void this.eventMapping[t].addListener.call(this,this.eventMapping[t].adaptedType,this.eventMapping[t].callback)):void oBg.prototype.addEventListener.call(this,t,e)},pBg.prototype.removeEventListener=function(t,e){this.eventMappingDummys?(oBg.prototype.removeEventListener.call(this,t,e),this.eventMapping.hasOwnProperty(t)&&(this.eventMapping[t].removeListener.call(this,this.eventMapping[t].adaptedType,this.eventMapping[t].callback),this.hasEventListener(t)||Event$1.isBroadcastEventType(t)&&BroadcastEventDispatchQueue.getInstance().remove(t,this))):console.log("todo: remove queued addEventListener")},pBg.eventsThatBubbleInAwayJS=[MouseEvent$2.MOUSE_WHEEL,MouseEvent$2.MOUSE_UP,MouseEvent$2.MOUSE_OVER,MouseEvent$2.MOUSE_OUT,MouseEvent$2.ROLL_OVER,MouseEvent$2.ROLL_OUT,MouseEvent$2.MOUSE_MOVE,MouseEvent$2.MOUSE_DOWN,MouseEvent$2.DOUBLE_CLICK,MouseEvent$2.CLICK,Event$1.ENTER_FRAME,Event$1.EXIT_FRAME,Event$1.FRAME_CONSTRUCTED,Event$1.ADDED_TO_STAGE,Event$1.RESIZE,Event$1.REMOVED_FROM_STAGE,KeyboardEvent$2.KEY_DOWN,KeyboardEvent$2.KEY_UP],pBg),BroadcastEventDispatchQueue=(OBg.getInstance=function(){return OBg._instance||(OBg._instance=new OBg),OBg._instance},OBg.prototype.reset=function(){this._queues={}},OBg.prototype.add=function(t,e){var i=this._queues[t]||(this._queues[t]=[]);0<=i.indexOf(e)||i.push(e)},OBg.prototype.remove=function(t,e){var i=this._queues[t],n=i.indexOf(e);i[n]=null},OBg.prototype.dispatchEvent=function(t){var e=this._queues[t._type];if(e){for(var i=0,n=0;n<e.length;n++){var r=e[n];null===r?i++:r.dispatchEvent(t)}if(16<i&&i>e.length>>1){for(var o=[],n=0;n<e.length;n++)e[n]&&o.push(e[n]);this._queues[t.type]=o}}},OBg.prototype.getQueueLength=function(t){return this._queues[t]?this._queues[t].length:0},OBg),StaticEvents=(bCg.events={},bCg),DisplayObject$1=(cCg=EventDispatcher$1,__extends(dCg,cCg),dCg.prototype.toString=function(){return"[object "+this.classInfo.instanceInfo.name.name+"]"},dCg.prototype.applySymbol=function(){},dCg.prototype.dispatchStaticEvent=function(t,e){void 0===e&&(e=null),StaticEvents.events[t]||(StaticEvents.events[t]=new this.sec.flash.events.Event(t)),StaticEvents.events[t].target=e,this.dispatchEvent(StaticEvents.events[t])},dCg.prototype.dispatch_ADDED_TO_STAGE=function(t){void 0===t&&(t=!1),t&&(StaticEvents.events[Event$1.ADDED_TO_STAGE]||(StaticEvents.events[Event$1.ADDED_TO_STAGE]=new this.sec.flash.events.Event(Event$1.ADDED_TO_STAGE)),(StaticEvents.events[Event$1.ADDED_TO_STAGE].target=this).dispatchEvent(StaticEvents.events[Event$1.ADDED_TO_STAGE]))},dCg.prototype.dispatch_REMOVED_FROM_STAGE=function(t){void 0===t&&(t=!1),t&&(StaticEvents.events[Event$1.REMOVED_FROM_STAGE]||(StaticEvents.events[Event$1.REMOVED_FROM_STAGE]=new this.sec.flash.events.Event(Event$1.REMOVED_FROM_STAGE)),(StaticEvents.events[Event$1.REMOVED_FROM_STAGE].target=this).dispatchEvent(StaticEvents.events[Event$1.REMOVED_FROM_STAGE]))},dCg.prototype.dispatchStaticBroadCastEvent=function(t){StaticEvents.events[t]||(StaticEvents.events[t]=new this.sec.flash.events.Event(t)),BroadcastEventDispatchQueue.getInstance().dispatchEvent(StaticEvents.events[t])},dCg.prototype.updateFilters=function(t){if(t&&0!=t.length){var e,i=[];i.length=t.length;for(var n=0;n<t.length;n++)switch((e=t[n]).type){case FilterType.DROPSHADOW:i[n]=new this.sec.flash.filters.DropShadowFilter(e.distance,e.angle,e.color,1,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout,e.compositeSource);break;case FilterType.GLOW:i[n]=new this.sec.flash.filters.GlowFilter(e.color,1,e.blurX,e.blurY,e.strength,e.quality,e.inner,e.knockout);break;case FilterType.BEVEL:i[n]=new this.sec.flash.filters.BevelFiler(e.distance,e.angle,e.colors[0],1,e.colors[1],1,e.blurX,e.blurY,e.strength,e.quality,"",e.knockout);break;case FilterType.GRADIENTGLOW:var r=[];e.colors.forEach(function(t){return r.push(1)}),i[n]=new this.sec.flash.filters.GradientGlowFilter(e.distance,e.angle,this.sec.createArrayUnsafe(e.colors),this.sec.createArrayUnsafe(r),this.sec.createArrayUnsafe(e.ratios),e.blurX,e.blurY,e.strength,e.quality,"",e.knockout);break;case FilterType.GRADIENTBEVEL:i[n]=new this.sec.flash.filters.GradientBevelFilter(e.distance,e.angle,this.sec.createArrayUnsafe(e.colors),this.sec.createArrayUnsafe(r),this.sec.createArrayUnsafe(e.ratios),e.blurX,e.blurY,e.strength,e.quality,"",e.knockout);break;case FilterType.BLUR:i[n]=new this.sec.flash.filters.BlurFilter(e.blurX,e.blurY,e.quality);break;case FilterType.CONVOLUTION:i[n]=new this.sec.flash.filters.ConvolutionFilter(e.matrixX,e.matrixY,this.sec.createArrayUnsafe(e.matrix),e.divisor,e.bias,e.preserveAlpha,e.clamp,e.color,1);break;case FilterType.COLORMATRIX:i[n]=new this.sec.flash.filters.ColorMatrixFilter(this.sec.createArrayUnsafe(e.matrix))}this.filters=i}else this.filters=this.sec.createArrayUnsafe([])},dCg.prototype.createAdaptee=function(){return new DisplayObject},dCg.prototype.mapAdaptee=function(t){return t&&(t.partition||(t.partition=new SceneGraphPartition(t)),t.adapter=this),t},Object.defineProperty(dCg.prototype,"activeStage",{get:function(){return this.sec.flash.display.DisplayObject.axClass._activeStage},enumerable:!0,configurable:!0}),dCg.prototype.dispatchEventRecursive=function(t){this.dispatchEvent(t)},Object.defineProperty(dCg.prototype,"adaptee",{get:function(){return this._adaptee},set:function(t){this._adaptee!=t&&(this._adaptee&&(this._adaptee.adapter=null),this._adaptee=this.mapAdaptee(t))},enumerable:!0,configurable:!0}),dCg.prototype.initAdapter=function(){},dCg.prototype.isBlockedByScript=function(){return this._blockedByScript},dCg.prototype.isVisibilityByScript=function(){return this._visibilityByScript},dCg.prototype.isColorTransformByScript=function(){return this._ctBlockedByScript},dCg.prototype.freeFromScript=function(){this._blockedByScript=!1,this._ctBlockedByScript=!1,this._visibilityByScript=!1},dCg.prototype.clone=function(){if(!this._symbol)throw"_symbol not defined when cloning movieclip";var t=constructClassFromSymbol(this._symbol,this._symbol.symbolClass);return t.axInitializer(),this.adaptee.copyTo(t.adaptee),t},dCg.prototype.dispose=function(){throw new AbstractMethodError},dCg.prototype.disposeValues=function(){this.adaptee=null},Object.defineProperty(dCg.prototype,"accessibilityProperties",{get:function(){return console.log("accessibilityProperties not implemented yet in flash/DisplayObject"),null},set:function(t){console.log("accessibilityProperties not implemented yet in flash/DisplayObject")},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"alpha",{get:function(){return this.adaptee.alpha},set:function(t){this._ctBlockedByScript=!0,this.adaptee.alpha=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"blendMode",{get:function(){return""},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"blendShader",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"cacheAsBitmap",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"filters",{get:function(){return this._filters},set:function(t){this._filters!=t&&(this._filters=t)},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"height",{get:function(){if(this.adaptee.isAsset(TextField))return this.adaptee.height;if(!this._adaptee.partition)return console.warn("Trying to get Display.height on orphan child!"),100;var t=this.getBoundsInternal();return null==t?0:t.height},set:function(t){isNaN(t)||(this._blockedByScript=!0,this.adaptee.isAsset(TextField)?this.adaptee.height=t:this._adaptee.partition?PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition).height=t:console.warn("Trying to set Display.height on orphan child!"))},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"loaderInfo",{get:function(){return this._loaderInfo},set:function(t){this._loaderInfo=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"mask",{get:function(){return null==this.adaptee.masks||0==this.adaptee.masks.length?null:this.adaptee.masks[0].adapter},set:function(t){if(null==t)return null!=this.adaptee.masks&&(this.adaptee.masks[0].maskMode=!1),void(this.adaptee.masks=null);t.adaptee.maskMode=!0,this.adaptee.masks=[t.adaptee]},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"metaData",{get:function(){return console.log("mask not implemented yet in flash/DisplayObject"),null},set:function(t){console.log("mask not implemented yet in flash/DisplayObject")},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"mouseX",{get:function(){return this.adaptee.transform.globalToLocal(new Point(this.stage.mouseX,0)).x},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"mouseY",{get:function(){return this.adaptee.transform.globalToLocal(new Point(0,this.stage.mouseY)).y},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"name",{get:function(){return this.adaptee.name},set:function(t){this.adaptee.name=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"opaqueBackground",{get:function(){return console.log("opaqueBackground not implemented yet in flash/DisplayObject"),null},set:function(t){console.log("opaqueBackground not implemented yet in flash/DisplayObject")},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"parent",{get:function(){return null==this.adaptee.parent||null==this.adaptee.parent.adapter||this.adaptee.parent.adapter==this.adaptee.parent?null:this.adaptee.parent.adapter},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"root",{get:function(){return this.stage.getChildAt(0)||(console.log("DisplayObject: could not get root"),null)},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"rotation",{get:function(){return this.adaptee.rotationZ},set:function(t){this._blockedByScript=!0,this.adaptee.rotationZ=isNaN(t)?0:isFinite(t)?t:-8},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"rotationX",{get:function(){return this.adaptee.rotationX},set:function(t){this._blockedByScript=!0,this.adaptee.rotationX=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"rotationY",{get:function(){return this.adaptee.rotationY},set:function(t){this._blockedByScript=!0,this.adaptee.rotationY=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"rotationZ",{get:function(){return this.adaptee.rotationZ},set:function(t){this._blockedByScript=!0,this.adaptee.rotationZ=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"scale9Grid",{get:function(){return new this.sec.flash.geom.Rectangle(this.adaptee.scale9Grid)},set:function(t){this.adaptee.scale9Grid=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"scaleX",{get:function(){return this.adaptee.scaleX},set:function(t){this._blockedByScript=!0,this.adaptee.scaleX=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"scaleY",{get:function(){return this.adaptee.scaleY},set:function(t){this._blockedByScript=!0,this.adaptee.scaleY=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"scaleZ",{get:function(){return this.adaptee.scaleZ},set:function(t){this._blockedByScript=!0,this.adaptee.scaleZ=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"scrollRect",{get:function(){return new this.sec.flash.geom.Rectangle(this.adaptee.scrollRect)},set:function(t){this.adaptee.scrollRect=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"stage",{get:function(){return this._stage},set:function(t){this._stage=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"transform",{get:function(){return this._ctBlockedByScript=!0,this._transform=new this.sec.flash.geom.Transform(this.adaptee.transform)},set:function(t){console.log("DisplayObject:setter for transform not yet implemented")},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"visible",{get:function(){return this._adaptee._explicitVisibility},set:function(t){this._visibilityByScript=!0,this._adaptee.visible=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"width",{get:function(){if(this.adaptee.isAsset(TextField))return this.adaptee.width;if(!this.adaptee.partition)return console.warn("Trying to get Display.width on orphan child!"),100;var t=this.getBoundsInternal();return null==t?0:t.width},set:function(t){this.adaptee.partition?(this._blockedByScript=!0,isNaN(t)||(this.adaptee.isAsset(TextField)?this.adaptee.width=t:PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition).width=t)):console.warn("Trying to set Display.width on orphan child!")},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"x",{get:function(){return this._adaptee._transform._matrix3D._rawData[12]},set:function(t){this._blockedByScript=!0,this._adaptee.x=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"y",{get:function(){return this._adaptee._transform._matrix3D._rawData[13]},set:function(t){this._blockedByScript=!0,this._adaptee.y=t},enumerable:!0,configurable:!0}),Object.defineProperty(dCg.prototype,"z",{get:function(){return this._adaptee._transform._matrix3D._rawData[14]},set:function(t){this._blockedByScript=!0,this._adaptee.z=t},enumerable:!0,configurable:!0}),dCg.prototype.getBounds=function(t){var e=this.getBoundsInternal(),i=this.sec;return e?new i.flash.geom.Rectangle(e.x-this.x,e.y-this.y,e.width,e.height):new i.flash.geom.Rectangle(6710886.4,6710886.4,0,0)},dCg.prototype.getBoundsInternal=function(){return this._boundsPicker=PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition),this._boundsPicker.getBoxBounds(this.adaptee)},dCg.prototype.getRect=function(t){var e=PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition).getBoxBounds(this.adaptee);return e?new this.sec.flash.geom.Rectangle(e.x-this.x,e.y-this.y,e.width,e.height):new this.sec.flash.geom.Rectangle},dCg.prototype.globalToLocal=function(t){return new this.sec.flash.geom.Point(this.adaptee.transform.globalToLocal(t.adaptee))},dCg.prototype.globalToLocal3D=function(t){return console.log("DisplayObject:globalToLocal3D not yet implemented"),new this.sec.flash.geom.Vector3D},dCg.prototype.hitTestObject=function(t){return PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition).hitTestObject(PickGroup.getInstance(this._stage.view).getBoundsPicker(t.adaptee.partition))},dCg.prototype.hitTestPoint=function(t,e,i){return void 0===i&&(i=!1),PickGroup.getInstance(this._stage.view).getBoundsPicker(this.adaptee.partition).hitTestPoint(t,e,i)},dCg.prototype._getObjectsUnderPointInternal=function(t,e){},dCg.prototype.local3DToGlobal=function(t){return console.log("DisplayObject:local3DToGlobal not yet implemented"),new this.sec.flash.geom.Point},dCg.prototype.localToGlobal=function(t){return new this.sec.flash.geom.Point(this.adaptee.transform.localToGlobal(t.adaptee))},dCg._activeStage=null,dCg),InteractiveObject=(mDg=DisplayObject$1,__extends(nDg,mDg),nDg.prototype.initKeyUpListener=function(t,e){0==this._keyUpListenersCnt&&(document.addEventListener("keyup",e),document.addEventListener("keypress",e)),this._keyUpListenersCnt++},nDg.prototype.removeKeyUpListener=function(t,e){this._keyUpListenersCnt--,0==this._keyUpListenersCnt&&document.removeEventListener("keyup",e)},nDg.prototype.keyUpCallback=function(t){if(void 0===t&&(t=null),!AVMStage.instance().isPaused){window.event&&(window.event.returnValue=!1),t.preventDefault?t.preventDefault():t.returnValue=!1;var e=new this.sec.flash.events.KeyboardEvent(KeyboardEvent$2.KEY_UP,!0,!1,t.charCode,t.keyCode,t.location,t.ctrlKey,t.altKey,t.shiftKey);return this.dispatchEvent(e),!1}},nDg.prototype.initKeyDownListener=function(t,e){0==this._keyDownListenersCnt&&(document.addEventListener("keydown",e),document.addEventListener("keypress",e)),this._keyDownListenersCnt++},nDg.prototype.removeKeyDownListener=function(t,e){this._keyDownListenersCnt--,0==this._keyDownListenersCnt&&(document.removeEventListener("keydown",e),document.removeEventListener("keypress",e))},nDg.prototype.keyDownCallback=function(t){if(void 0===t&&(t=null),!AVMStage.instance().isPaused){window.event&&(window.event.returnValue=!1),t.preventDefault?t.preventDefault():t.returnValue=!1;var e=new this.sec.flash.events.KeyboardEvent(KeyboardEvent$2.KEY_DOWN);return e.axInitializer(KeyboardEvent$2.KEY_DOWN),e.keyCode=t.keyCode,e.charCode=t.charCode,e.shiftKey=t.shiftKey,e.ctrlKey=t.ctrlKey,e.altKey=t.altKey,this.dispatchEvent(e),!1}},nDg.prototype.initMouseListener=function(t,e){this.adaptee.addEventListener(t,e)},nDg.prototype.removeMouseListener=function(t,e){this.adaptee.removeEventListener(t,e)},nDg.prototype.mouseCallback=function(t){var e=new this.sec.flash.events.MouseEvent(this.eventMappingInvert[t.type]);e.fillFromAway(t),(e.target=this).dispatchEvent(e)},Object.defineProperty(nDg.prototype,"accessibilityImplementation",{get:function(){return console.log("accessibilityImplementation not implemented yet in flash/InteractiveObject"),null},set:function(t){console.log("accessibilityImplementation not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"contextMenu",{get:function(){return console.log("contextMenu not implemented yet in flash/InteractiveObject"),null},set:function(t){console.log("contextMenu not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"doubleClickEnabled",{get:function(){return console.log("doubleClickEnabled not implemented yet in flash/InteractiveObject"),!1},set:function(t){console.log("doubleClickEnabled not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"focusRect",{get:function(){return console.log("focusRect not implemented yet in flash/InteractiveObject"),null},set:function(t){console.log("focusRect not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"mouseEnabled",{get:function(){return this.adaptee.mouseEnabled},set:function(t){this.adaptee.mouseEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"needsSoftKeyboard",{get:function(){return console.log("needsSoftKeyboard not implemented yet in flash/InteractiveObject"),!1},set:function(t){console.log("needsSoftKeyboard not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"softKeyboardInputAreaOfInterest",{get:function(){return console.log("softKeyboardInputAreaOfInterest not implemented yet in flash/InteractiveObject"),null},set:function(t){console.log("softKeyboardInputAreaOfInterest not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"tabEnabled",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(nDg.prototype,"tabIndex",{get:function(){return console.log("tabIndex not implemented yet in flash/InteractiveObject"),0},set:function(t){console.log("tabIndex not implemented yet in flash/InteractiveObject")},enumerable:!0,configurable:!0}),nDg.prototype.requestSoftKeyboard=function(){return console.log("requestSoftKeyboard not implemented yet in flash/InteractiveObject"),!1},nDg),DisplayObjectContainer$1=(TDg=InteractiveObject,__extends(UDg,TDg),UDg.prototype.addTimelineObjectAtDepth=function(t,e){},UDg.prototype.getTimelineObjectAtDepth=function(t){return null},UDg.prototype._lookupChildByName=function(t,e){},UDg.prototype._lookupChildByIndex=function(t,e){},UDg.prototype.createAdaptee=function(){return new DisplayObjectContainer},UDg.prototype.clone=function(){if(!this._symbol)throw"_symbol not defined when cloning movieclip";var t=constructClassFromSymbol(this._symbol,this._symbol.symbolClass);return t.axInitializer(),this.adaptee.copyTo(t.adaptee),t},UDg.prototype.advanceFrame=function(){for(var t=this._adaptee._children.length;0<t;){t--;var e=this._adaptee._children[t];e&&(e.isAsset(DisplayObjectContainer)?e.adapter&&e.adapter.advanceFrame():e.isAsset(Sprite)?e.adapter&&e.adapter.advanceFrame&&e.adapter.advanceFrame():e.isAsset(MovieClip)&&e.update())}},UDg.prototype.debugDisplayGraph=function(t){t.object=this,t.rectangle="x:"+this.x+", y:"+this.y+", width:"+this.width+", height:"+this.height,t.children={};for(var e=0,e=0;e<this._adaptee.numChildren;e++){var i,n=this._adaptee.getChildAt(e),r="child_"+e+" "+n.adapter.constructor.name;n.isAsset(Sprite)||n.isAsset(DisplayObjectContainer)?n.adapter&&(t.children[r]={},n.adapter.debugDisplayGraph(t.children[r])):n.isAsset(Billboard)||n.isAsset(MovieClip)?(t.children[r]={},t.children[r].object=n.adapter,t.children[r].name=n.name,t.children[r].rectangle="x:"+n.x+", y:"+n.y):n.isAsset(TextField)&&(t.children[r]={},t.children[r].object=n.adapter,t.children[r].text=n.text,t.children[r].rectangle="x:"+n.x+", y:"+n.y,i=PickGroup.getInstance(this._stage.view).getBoundsPicker(n.partition).getBoxBounds(n),t.children[r].width=null==i?0:i.width,t.children[r].height=null==i?0:i.height)}},UDg.prototype.dispatch_ADDED_TO_STAGE=function(t){if(void 0===t&&(t=!1),t&&(StaticEvents.events[Event$1.ADDED_TO_STAGE]||(StaticEvents.events[Event$1.ADDED_TO_STAGE]=new this.sec.flash.events.Event(Event$1.ADDED_TO_STAGE)),(StaticEvents.events[Event$1.ADDED_TO_STAGE].target=this).dispatchEvent(StaticEvents.events[Event$1.ADDED_TO_STAGE])),this._adaptee)for(var e=this._adaptee._children,i=e.length,n=0;n<i;n++){var r=e[n];r.adapter&&r.adapter.dispatchEventRecursive&&!r.hasDispatchedAddedToStage&&(r.hasDispatchedAddedToStage=!0,r.adapter.dispatch_ADDED_TO_STAGE(!0))}},UDg.prototype.dispatch_REMOVED_FROM_STAGE=function(t){if(void 0===t&&(t=!1),t&&(StaticEvents.events[Event$1.REMOVED_FROM_STAGE]||(StaticEvents.events[Event$1.REMOVED_FROM_STAGE]=new this.sec.flash.events.Event(Event$1.REMOVED_FROM_STAGE)),(StaticEvents.events[Event$1.REMOVED_FROM_STAGE].target=this).dispatchEvent(StaticEvents.events[Event$1.REMOVED_FROM_STAGE])),this._adaptee)for(var e=this._adaptee._children,i=e.length,n=0;n<i;n++){var r=e[n];r.adapter&&r.adapter.dispatchEventRecursive&&r.hasDispatchedAddedToStage&&(r.hasDispatchedAddedToStage=!1,r.adapter.dispatch_REMOVED_FROM_STAGE(!0))}},Object.defineProperty(UDg.prototype,"mouseChildren",{get:function(){return this._adaptee.mouseChildren},set:function(t){this._adaptee.mouseChildren=t},enumerable:!0,configurable:!0}),Object.defineProperty(UDg.prototype,"numChildren",{get:function(){return this._adaptee.numChildren},enumerable:!0,configurable:!0}),Object.defineProperty(UDg.prototype,"tabChildren",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(UDg.prototype,"textSnapshot",{get:function(){throw"textSnapshot not implemented yet in flash/DisplayObjectContainer"},enumerable:!0,configurable:!0}),UDg.prototype.addChild=function(t){var e=!(t.adaptee.parent==this.adaptee);return this._adaptee.addChild(t.adaptee),e&&(t.dispatchStaticEvent(Event$1.ADDED,t),this.adaptee.isOnDisplayList()&&t.dispatch_ADDED_TO_STAGE(!0)),OrphanManager.removeOrphan(t),t},UDg.prototype.addChildAt=function(t,e){for(var i=!(t.adaptee.parent==this.adaptee),n=[],r=0;r<this._adaptee.numChildren;r++)t.adaptee.id!=this._adaptee._children[r].id&&(n[n.length]=this._adaptee._children[r]);for(r=0;r<n.length;r++)this._adaptee.removeChild(n[r]);for(var o=0,r=0;r<n.length+1;r++)r==e?this._adaptee.addChild(t.adaptee):this._adaptee.addChild(n[o++]);return i&&(t.dispatchStaticEvent(Event$1.ADDED),this.adaptee.isOnDisplayList()&&t.dispatch_ADDED_TO_STAGE(!0)),t},UDg.prototype.areInaccessibleObjectsUnderPoint=function(t){throw"areInaccessibleObjectsUnderPoint not implemented yet in flash/DisplayObjectContainer"},UDg.prototype.contains=function(t){return this._adaptee.contains(t.adaptee)},UDg.prototype.getChildAt=function(t){var e=this._adaptee.getChildAt(t);return e.adapter&&e.adapter!=e||((e.adapter=new this.sec.flash.display.Sprite).adaptee=e),e.adapter},UDg.prototype.getChildByName=function(t){return this._adaptee.getChildByName(t)?this._adaptee.getChildByName(t).adapter:null},UDg.prototype.getChildIndex=function(t){return this._adaptee.getChildIndex(t.adaptee)},UDg.prototype.getObjectsUnderPoint=function(t){var e=[];return this._getObjectsUnderPointInternal(t,e),e},UDg.prototype._getObjectsUnderPointInternal=function(t,e){for(var i,n,r=this._adaptee.numChildren,o=0;o<r;o++)(i=this._adaptee._children[o]).visible&&(PickGroup.getInstance(this._stage.view).getBoundsPicker(i.adaptee.partition).hitTestPoint(t.x,t.y,!0)&&e.push(i.adapter),"function"!=typeof(n=i.adapter)._getObjectsUnderPointInternal||n._getObjectsUnderPointInternal(t,e))},UDg.prototype.removeChild=function(t){return this._adaptee.removeChild(t.adaptee),t},UDg.prototype.removeChildAt=function(t){return this._adaptee.removeChildAt(t).adapter},UDg.prototype.removeChildren=function(t,e){void 0===t&&(t=0),void 0===e&&(e=2147483647),e>=this._adaptee.numChildren&&(e=this._adaptee.numChildren-1),this._adaptee.removeChildren(t,e+1)},UDg.prototype.setChildIndex=function(t,e){for(var i=[],n=0;n<this._adaptee.numChildren;n++)i[i.length]=this._adaptee._children[n];for(n=0;n<i.length;n++)this._adaptee.removeChild(i[n]);for(var r,o=0,n=0;n<i.length;n++)n==e?this._adaptee.addChild(t.adaptee):((r=i[o++]).id!=t.adaptee.id||(r=i[o++]),this._adaptee.addChild(r))},UDg.prototype.stopAllMovieClips=function(){throw"stopAllMovieClips not implemented yet in flash/DisplayObjectContainer"},UDg.prototype.swapChildren=function(t,e){this._adaptee.swapChildren(t.adaptee,e.adaptee)},UDg.prototype.swapChildrenAt=function(t,e){throw"swapChildrenAt not implemented yet in flash/DisplayObjectContainer"},UDg),Sprite$1=(cFg=DisplayObjectContainer$1,__extends(dFg,cFg),dFg.getNewSprite=function(t){if(dFg._sprites.length){var e=dFg._sprites.pop();return e.adaptee=t,e}return new dFg},dFg.prototype.initAdapter=function(){},dFg.prototype.createAdaptee=function(){var t=Sprite.getNewSprite();return t.reset(),t},dFg.prototype.registerScriptObject=function(t){t.adapter!=t&&t.name&&(this[t.name]=t._adapter?t.adapter:t,this.axSetPublicProperty(t.name,t.adapter))},dFg.prototype.unregisterScriptObject=function(t){delete this[t.name],t.isAsset(MovieClip)&&t.removeButtonListeners()},dFg.prototype.clearPropsDic=function(){this.$Bg__setPropDict.map=new WeakMap},dFg.prototype.clone=function(){if(!this._symbol)throw"_symbol not defined when cloning movieclip";var t=constructClassFromSymbol(this._symbol,this._symbol.symbolClass),e=new Sprite;this.adaptee.copyTo(e),t.adaptee=e,t._stage=this.activeStage,t.executeConstructor=function(){t.axInitializer()},t.adaptee.graphics=this.graphics;var i=e.timeline,n=i;return n.frame_command_indices=[i.frame_command_indices[0]],n.frame_recipe=[i.frame_recipe[0]],n.keyframe_constructframes=[i.keyframe_constructframes[0]],n.keyframe_durations=[i.keyframe_durations[0]],n.keyframe_firstframes=[i.keyframe_firstframes[0]],n.keyframe_indices=[i.keyframe_indices[0]],t},dFg.prototype.dispose=function(){this.disposeValues()},Object.defineProperty(dFg.prototype,"buttonMode",{get:function(){return this.adaptee.buttonMode},set:function(t){this.adaptee.buttonMode=t},enumerable:!0,configurable:!0}),dFg.prototype.setDropTarget=function(t){this._dropTarget=t?t.adapter:null},Object.defineProperty(dFg.prototype,"dropTarget",{get:function(){return this._dropTarget},enumerable:!0,configurable:!0}),Object.defineProperty(dFg.prototype,"graphics",{get:function(){return this._graphics},enumerable:!0,configurable:!0}),Object.defineProperty(dFg.prototype,"hitArea",{get:function(){return this.adaptee.pickObject.adapter},set:function(t){this.adaptee.pickObject=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(dFg.prototype,"soundTransform",{get:function(){return console.log("soundTransform not implemented yet in flash/Sprite"),null},set:function(t){console.log("soundTransform not implemented yet in flash/Sprite")},enumerable:!0,configurable:!0}),Object.defineProperty(dFg.prototype,"useHandCursor",{get:function(){return this.adaptee._useHandCursor},set:function(t){this.adaptee._useHandCursor=t},enumerable:!0,configurable:!0}),dFg.prototype.startDrag=function(t,e){void 0===t&&(t=!1),void 0===e&&(e=null),dFg.currentDraggedMC&&dFg.currentDraggedMC!=this&&dFg.currentDraggedMC.stopDrag(),(dFg.currentDraggedMC=this)._dragBounds=e,this.isDragging||(this.isDragging=!0,this.startDragPoint=this.adaptee.parent.transform.globalToLocal(new Point(this.stage.mouseX,this.stage.mouseY)),t&&(this.adaptee.x=this.startDragPoint.x,this.adaptee.y=this.startDragPoint.y),this._dragBounds&&this.checkBounds(),this.startDragMCPosition.x=this.adaptee.x,this.startDragMCPosition.y=this.adaptee.y,this.stage.adaptee.addEventListener("mouseMove3d",this.dragListenerDelegate),this.stage.adaptee.scene.mousePicker.dragEntity=this.adaptee,MouseManager.getInstance(this.stage.adaptee.scene.renderer.renderGroup.pickGroup).startDragObject(this.adaptee))},dFg.prototype.checkBounds=function(){this.adaptee.x<this._dragBounds.left&&(this.adaptee.x=this._dragBounds.left),this.adaptee.x>this._dragBounds.right&&(this.adaptee.x=this._dragBounds.right),this.adaptee.y<this._dragBounds.top&&(this.adaptee.y=this._dragBounds.top),this.adaptee.y>this._dragBounds.bottom&&(this.adaptee.y=this._dragBounds.bottom)},dFg.prototype.dragListener=function(t){var e;this.adaptee.parent&&(e=this.adaptee.parent.transform.globalToLocal(new Point(this.stage.mouseX,this.stage.mouseY)),this.adaptee.x=this.startDragMCPosition.x+(e.x-this.startDragPoint.x),this.adaptee.y=this.startDragMCPosition.y+(e.y-this.startDragPoint.y),this._dragBounds&&this.checkBounds())},dFg.prototype.startTouchDrag=function(t,e,i){console.log("startTouchDrag not implemented yet in flash/Sprite")},dFg.prototype.stopDrag=function(t){dFg.currentDraggedMC&&dFg.currentDraggedMC!=this&&dFg.currentDraggedMC.stopDrag(),this.isDragging=!1,dFg.currentDraggedMC=null,this.stage.adaptee.scene.mousePicker.dragEntity=null,MouseManager.getInstance(this.stage.adaptee.scene.renderer.renderGroup.pickGroup).stopDragObject(),this.stage.adaptee.removeEventListener("mouseMove3d",this.dragListenerDelegate)},dFg.prototype.stopTouchDrag=function(t){console.log("startTouchDrag not implemented yet in flash/Sprite")},dFg._sprites=new Array,dFg.currentDraggedMC=null,dFg),Bitmap=(EFg=DisplayObject$1,__extends(FFg,EFg),FFg.getNewBitmap=function(t,e,i){if(void 0===t&&(t=null),void 0===e&&(e="auto"),void 0===i&&(i=!1),FFg._bitmaps.length){var n=new MethodMaterial(t?t.adaptee:0);n.alphaBlending=!0,n.useColorTransform=!0;var r=FFg._bitmaps.pop();return r.adaptee=Billboard.getNewBillboard(n,e,i),r}return new FFg(t,e,i)},FFg.prototype.mapAdaptee=function(t){var e,i=t;return(t instanceof BitmapImage2D||t instanceof SceneImage2D)&&(this._adaptee=i=Billboard.getNewBillboard(new MethodMaterial(t),"auto",!1),e=new this.sec.flash.display.BitmapData(t),this.bitmapData=e,this._bitmapMappedFromAsset=!0),EFg.prototype.mapAdaptee.call(this,i)},FFg.prototype.createAdaptee=function(){var t=Billboard.getNewBillboard(FFg.argBitmapMaterial,FFg.argPixelSnapping,FFg.argSmoothing);return FFg.argBitmapMaterial=null,FFg.argPixelSnapping=null,FFg.argSmoothing=null,t},FFg.prototype.clone=function(){var t=FFg.getNewBitmap(this._bitmapData);return this._adaptee.copyTo(t.adaptee),t},FFg.prototype.dispose=function(){this.disposeValues(),FFg._bitmaps.push(this)},FFg.prototype.disposeValues=function(){this.bitmapData=null,EFg.prototype.disposeValues.call(this)},Object.defineProperty(FFg.prototype,"bitmapData",{get:function(){return this._bitmapData},set:function(t){var e;this._bitmapData!=t&&(this._bitmapData&&this._bitmapData._removeOwner(this),this._bitmapData=t,this._bitmapData&&this._bitmapData._addOwner(this),e=this._adaptee.material,this._bitmapData?(e.ambientMethod.texture||(e.ambientMethod.texture=new ImageTexture2D),e.style.image=this._bitmapData.adaptee):(e.ambientMethod.texture&&(e.ambientMethod.texture=null),e.style.image=null,e.style.color=0),e.invalidateTextures())},enumerable:!0,configurable:!0}),Object.defineProperty(FFg.prototype,"pixelSnapping",{get:function(){return""},set:function(t){console.log("pixelSnapping not implemented yet in flash/Bitmap")},enumerable:!0,configurable:!0}),Object.defineProperty(FFg.prototype,"smoothing",{get:function(){return console.log("smoothing not implemented yet in flash/Bitmap"),!1},set:function(t){console.log("smoothing not implemented yet in flash/Bitmap")},enumerable:!0,configurable:!0}),FFg._bitmaps=new Array,FFg),BitmapData=(ZFg=ASObject,__extends($Fg,ZFg),$Fg.prototype.compare=function(t){return!0},Object.defineProperty($Fg.prototype,"adaptee",{get:function(){return this._adaptee},set:function(t){this._adaptee=t},enumerable:!0,configurable:!0}),$Fg.loadBitmap=function(t){return console.log("loadBitmap not implemented yet in flash/BitmapData"),null},$Fg.prototype.setPixels=function(t,e){console.log("todo: BitmapData.setPixels")},$Fg.prototype.getPixels=function(t){return console.log("getPixels not implemented yet in flash/BitmapData"),null},$Fg.prototype.copyPixelsToByteArray=function(t,e){console.log("copyPixelsToByteArray not implemented yet in flash/BitmapData")},$Fg.prototype.getVector=function(t){return null},$Fg.prototype.setVector=function(t,e){},$Fg.prototype.histogram=function(t){},$Fg.prototype.encode=function(t,e,i){},$Fg.prototype.drawWithQuality=function(t,e,i,n,r,o,s){},Object.defineProperty($Fg.prototype,"transparent",{get:function(){return this._adaptee.transparent},set:function(t){this._adaptee.transparent=t},enumerable:!0,configurable:!0}),Object.defineProperty($Fg.prototype,"width",{get:function(){return this._adaptee.width},set:function(t){this._adaptee.width=t},enumerable:!0,configurable:!0}),Object.defineProperty($Fg.prototype,"height",{get:function(){return this._adaptee.height},set:function(t){this._adaptee.height=t},enumerable:!0,configurable:!0}),$Fg.prototype.clone=function(){var t=new this.sec.flash.display.BitmapData(this._adaptee.width,this._adaptee.height,this._adaptee.transparent,0);return t.copyPixels(this,this.rect,new this.sec.flash.geom.Point),t},Object.defineProperty($Fg.prototype,"rect",{get:function(){return new this.sec.flash.geom.Rectangle(this._adaptee.rect.clone())},enumerable:!0,configurable:!0}),$Fg.prototype.getPixel=function(t,e){return this._adaptee.getPixel(t,e)},$Fg.prototype.getPixel32=function(t,e){return this._adaptee.getPixel32(t,e)},$Fg.prototype.setPixel=function(t,e,i){this._adaptee.setPixel(t,e,i)},$Fg.prototype.setPixel32=function(t,e,i){this._adaptee.setPixel32(t,e,i)},$Fg.prototype.applyFilter=function(t,e,i,n){return console.log("applyFilter not implemented yet in flash/BitmapData"),0},$Fg.prototype.colorTransform=function(t,e){this._adaptee.colorTransform(t.adaptee,e.adaptee)},$Fg.prototype.copyChannel=function(t,e,i,n,r){this._adaptee.copyChannel(t.adaptee,e.adaptee,i.adaptee,n,r)},$Fg.prototype.copyPixels=function(t,e,i,n,r,o){void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=!1),this._adaptee.copyPixels(t.adaptee,e.adaptee,i.adaptee,n?n.adaptee:null,r?r.adaptee:null,o)},$Fg.prototype.dispose=function(){this._adaptee&&(this._adaptee.dispose(),this._adaptee=null)},$Fg.prototype.draw=function(t,e,i,n,r,o){void 0===i&&(i=null),void 0===n&&(n=""),void 0===r&&(r=null),void 0===o&&(o=!1),this._adaptee.draw(t.adaptee,e?e.adaptee:null,i?i.adaptee:null,n,r?r.adaptee:null,o)},$Fg.prototype.fillRect=function(t,e){this._adaptee.fillRect(t.adaptee,e)},$Fg.prototype.floodFill=function(t,e,i){console.warn("Unsage implementation `floodFill`"),this._adaptee.floodFill(t,e,i)},$Fg.prototype.generateFilterRect=function(t,e){return console.log("generateFilterRect not implemented yet in flash/BitmapData"),null},$Fg.prototype.getColorBoundsRect=function(t,e,i){return console.warn("Unsage implementation `getColorBoundsRect`!"),new this.sec.flash.geom.Rectangle(this._adaptee.getColorBoundsRect(t,e,i))},$Fg.prototype.hitTest=function(t,e,i,n,r){return void 0===n&&(n=new this.sec.flash.geom.Point(0,0)),console.log("hitTest not implemented yet in flash/BitmapData"),!1},$Fg.prototype.lock=function(){this._adaptee.lock()},$Fg.prototype.merge=function(t,e,i,n,r,o,s){this._adaptee.merge(t.adaptee,t.rect.adaptee,i.adaptee,n,r,o,s)},$Fg.prototype.noise=function(t,e,i,n,r){console.log("noise not implemented yet in flash/BitmapData")},$Fg.prototype.paletteMap=function(t,e,i,n,r,o,s){console.log("paletteMap not implemented yet in flash/BitmapData")},$Fg.prototype.perlinNoise=function(t,e,i,n,r,o,s,a,l){console.log("perlinNoise not implemented yet in flash/BitmapData")},$Fg.prototype.pixelDissolve=function(t,e,i,n,r,o){return console.log("pixelDissolve not implemented yet in flash/BitmapData"),0},$Fg.prototype.scroll=function(t,e){console.log("scroll not implemented yet in flash/BitmapData")},$Fg.prototype.threshold=function(t,e,i,n,r,o,s,a){return this._adaptee.threshold(t.adaptee,e.adaptee,i.adaptee,n,r,o,s,a),0},$Fg.prototype.unlock=function(){this._adaptee.unlock()},$Fg.prototype._addOwner=function(t){-1==this._owners.indexOf(t)&&this._owners.push(t)},$Fg.prototype._removeOwner=function(t){var e=this._owners.indexOf(t);-1!=e&&this._owners.splice(e,1),!this._owners.length&&this._adaptee&&this._adaptee.clear()},$Fg),FlashSceneGraphFactory=(rIg=DefaultSceneGraphFactory,__extends(sIg,rIg),sIg.prototype.executeABCBytes=function(t){for(var e=0;e<t.length;e++){var i=t[e],n=new ABCFile({app:this._sec.application,url:""},i.data);i.flags?this._sec.application.loadABC(n):this._sec.application.loadAndExecuteABC(n)}return null},sIg.prototype.createSprite=function(t,e,i){if(void 0===e&&(e=null),void 0===i&&(i=null),!i||!this._sec)throw"no symbol provided";var n=i.className?this._sec.application.getClass(Multiname.FromFQNString(i.className,0)):this._sec.flash.display.Sprite.axClass;i.symbolClass=n;var r=constructClassFromSymbol(i,n);return r.adaptee=new Sprite(e),r.adaptee},sIg.prototype.createDisplayObjectContainer=function(t){return(new this._sec.flash.display.DisplayObjectContainer).adaptee},sIg.prototype.createBinarySymbol=function(t){void 0===t&&(t=null),this._sec.application.addBinarySymbol(t)},sIg.prototype.createMovieClip=function(t,e){if(void 0===e&&(e=null),!e||!this._sec)throw"no symbol provided";var i=null;e.className?(i=this._sec.application.getClass(Multiname.FromFQNString(e.className,0)))._symbol=e:i=this._sec.flash.display.MovieClip.axClass,e.symbolClass=i;var n=constructClassFromSymbol(e,this._sec.flash.display.MovieClip.axClass);return n.adaptee=new MovieClip,e.timeline=n.adaptee.timeline,n.adaptee},sIg.prototype.createTextField=function(t){void 0===t&&(t=null);var e=t.className?this._sec.application.getClass(Multiname.FromFQNString(t.className,0)):this._sec.flash.text.TextField.axClass;t.symbolClass=e;var i=constructClassFromSymbol(t,e);return i.axInitializer(),i.adaptee},sIg.prototype.createBillboard=function(t,e){return new Bitmap(t.style.image.adapter).adaptee},sIg.prototype.createImage2D=function(t,e,i,n,r,o){return void 0===i&&(i=!0),void 0===n&&(n=null),new BitmapData(t,e,i,n).adaptee},sIg),UncaughtErrorEvents=(VIg=EventDispatcher$1,__extends(WIg,VIg),WIg.classInitializer=null,WIg.classSymbols=null,WIg.instanceSymbols=null,WIg),LoaderContext$1=(XIg=ASObject,__extends(YIg,XIg),YIg),Sound=(bJg=EventDispatcher$1,__extends(cJg,bJg),Object.defineProperty(cJg.prototype,"adaptee",{get:function(){return this._adaptee},set:function(t){this._adaptee=t},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"bytesLoaded",{get:function(){return console.log("bytesLoaded not implemented yet in flash/Sound"),0},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"bytesTotal",{get:function(){return console.log("bytesTotal not implemented yet in flash/Sound"),0},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"id3",{get:function(){return console.log("id3 not implemented yet in flash/Sound"),null},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"isBuffering",{get:function(){return console.log("isBuffering not implemented yet in flash/Sound"),!1},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"isURLInaccessible",{get:function(){return console.log("isURLInaccessible not implemented yet in flash/Sound"),!1},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"length",{get:function(){return this._adaptee.duration},enumerable:!0,configurable:!0}),Object.defineProperty(cJg.prototype,"url",{get:function(){return console.log("url not implemented yet in flash/Sound"),""},enumerable:!0,configurable:!0}),cJg.prototype.close=function(){console.log("close not implemented yet in flash/Sound")},cJg.prototype.extract=function(t,e,i){return console.log("extract not implemented yet in flash/Sound"),0},cJg.prototype.load=function(t,e){console.log("load not implemented yet in flash/Sound")},cJg.prototype.loadCompressedDataFromByteArray=function(t,e){console.log("loadCompressedDataFromByteArray not implemented yet in flash/Sound")},cJg.prototype.loadPCMFromByteArray=function(t,e,i,n,r){console.log("loadPCMFromByteArray not implemented yet in flash/Sound")},cJg.prototype.soundCompleteInternal=function(){this.loopsToPlay--,0<this.loopsToPlay?(this.stop(),this.adaptee.play(0,!1)):this._onCompleteCallback&&this._onCompleteCallback()},cJg.prototype.play=function(t,e,i){var n=this;if(void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=null),this.adaptee){i&&(this.adaptee.volume=i.volume,this.adaptee.pan=i.pan),e=isNaN(e)||e<1?1:Math.floor(e),this.loopsToPlay=e,this._adaptee.onSoundComplete=function(){return n.soundCompleteInternal()},this._adaptee.play(t,!1);var r=new this.sec.flash.media.SoundChannel;return r._sound=this,i=i||new this.sec.flash.media.SoundTransform,r.soundTransform=i,r}console.log("Sound.play : no adaptee exists!")},cJg.prototype.stop=function(){this._adaptee.stop()},cJg),ApplicationDomain=(yJg=ASObject,__extends(zJg,yJg),zJg.getSystemDomain=function(){return null==zJg._systemDomain&&(zJg._systemDomain=new zJg(null,!0)),zJg._systemDomain},Object.defineProperty(zJg,"currentDomain",{get:function(){return zJg._currentDomain},enumerable:!0,configurable:!0}),Object.defineProperty(zJg.prototype,"domainMemory",{get:function(){return console.log("[UNSAFE IMPLEMENTATION!] domainMemory:flash/ApplicationDomain"),this._memory},set:function(t){console.log("[UNSAFE IMPLEMENTATION!] domainMemory:flash/ApplicationDomain"),!t&&this._memory.buffer===t.buffer||(this._memoryView=new DataView(t.buffer)),this._memory=t},enumerable:!0,configurable:!0}),Object.defineProperty(zJg.prototype,"internal_memoryView",{get:function(){return this._memoryView},enumerable:!0,configurable:!0}),Object.defineProperty(zJg,"MIN_DOMAIN_MEMORY_LENGTH",{get:function(){return console.log("MIN_DOMAIN_MEMORY_LENGTH not implemented yet in flash/ApplicationDomain"),0},enumerable:!0,configurable:!0}),Object.defineProperty(zJg.prototype,"parentDomain",{get:function(){return this._parentDomain},enumerable:!0,configurable:!0}),zJg.prototype.addDefinition=function(t,e){this._definitions[t]=e},zJg.prototype.addAudioDefinition=function(t,e){this._audio_definitions[t]=e},zJg.prototype.addFontDefinition=function(t,e){this._font_definitions[t]=e},zJg.prototype.getDefinition=function(t){if(this._definitions[t]){if(this._definitions[t].isAsset&&this._definitions[t].isAsset(SceneImage2D))return this._definitions[t];var e=this._definitions[t].adapter.clone();return e.adaptee.isAsset(MovieClip)&&(e.adaptee.currentFrameIndex=0),e}if(this._font_definitions[t])return this._font_definitions[t];if(this._audio_definitions[t]){var i=new Sound;return i.adaptee=this._audio_definitions[t],i}return this.sec.application.getClass(Multiname.FromSimpleName(t))},zJg.prototype.getFontDefinition=function(t){return this._font_definitions[t]},zJg.prototype.getAwayJSAudio=function(t){return this._audio_definitions[t]},zJg.prototype.getAudioDefinition=function(t){var e=new Sound;return e.adaptee=this._audio_definitions[t],e},zJg.prototype.getQualifiedDefinitionNames=function(){var t=[];for(var e in this._definitions)this._definitions.hasOwnProperty(e)&&(t[t.length]=e);return t},zJg.prototype.hasDefinition=function(t){return this._definitions.hasOwnProperty(t)},zJg.prototype.hasFontDefinition=function(t){return this._font_definitions.hasOwnProperty(t)},zJg.prototype.hasAudioDefinition=function(t){return this._audio_definitions.hasOwnProperty(t)},zJg),Loader$1=(WJg=DisplayObjectContainer$1,__extends(XJg,WJg),Object.defineProperty(XJg.prototype,"contentLoaderInfo",{get:function(){return this._contentLoaderInfo},enumerable:!0,configurable:!0}),Object.defineProperty(XJg.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0}),Object.defineProperty(XJg.prototype,"uncaughtErrorEvents",{get:function(){return this._uncaughtErrorEvents||(this._uncaughtErrorEvents=new UncaughtErrorEvents),this._uncaughtErrorEvents},enumerable:!0,configurable:!0}),XJg.prototype.createAdaptee=function(){var e=this;this._onAssetCompleteDelegate=function(t){return e._onAssetComplete(t)};var t=new LoaderContainer;return t.addEventListener(AssetEvent.ASSET_COMPLETE,this._onAssetCompleteDelegate),t},XJg.prototype._onAssetComplete=function(t){var e=t.asset;e.isAsset(TextField)?this._contentLoaderInfo.applicationDomain.addDefinition(e.name,e):e.isAsset(SceneImage2D)||e.isAsset(BitmapImage2D)?(this._contentLoaderInfo.applicationDomain.addDefinition(e.name,e),this._isImage&&(this._content=new Bitmap(e.adapter),this._adaptee.addChild(this._content.adaptee))):e.isAsset(WaveAudio)?this._contentLoaderInfo.applicationDomain.addAudioDefinition(e.name,e):e.isAsset(Font)?this._contentLoaderInfo.applicationDomain.addFontDefinition(e.name,e):e.isAsset(Sprite)?this._contentLoaderInfo.applicationDomain.addDefinition(e.name,e):e.isAsset(MovieClip)?(this._contentLoaderInfo.applicationDomain.addDefinition(e.name,e),"Scene 1"!=e.name&&!e.isAVMScene||(this._content=e.adapter.clone(),this._content.loaderInfo=this._contentLoaderInfo,this._content.adaptee.reset(),WJg.prototype.addChild.call(this,this._content))):e.isAsset(Graphics)||console.log("loaded unhandled asset-type")},XJg.prototype.addChild=function(t){return this.sec.throwError("IllegalOperationError",Errors$1.InvalidLoaderMethodError),null},XJg.prototype.addChildAt=function(t,e){return this.sec.throwError("IllegalOperationError",Errors$1.InvalidLoaderMethodError),null},XJg.prototype.removeChild=function(t){return this.sec.throwError("IllegalOperationError",Errors$1.InvalidLoaderMethodError),null},XJg.prototype.removeChildAt=function(t){return this.sec.throwError("IllegalOperationError",Errors$1.InvalidLoaderMethodError),null},XJg.prototype.setChildIndex=function(t,e){this.sec.throwError("IllegalOperationError",Errors$1.InvalidLoaderMethodError)},XJg.prototype.close=function(){this.adaptee.close()},XJg.prototype.load=function(t,e){var i=this;void 0===e&&(e=null);var n=t.url||"",r=n.replace(/\?.*$/,""),o=matchRedirect(n,XJg.redirectRules);if(o){if(o.supressLoad)return void console.log("[LOADER] Load surpressed ",o.url);console.log("[LOADER] Override loading url:",o.url),t.adaptee.url=o.url}else console.log("[LOADER] start loading the url:",r);var s=t.url.substr(-3).toLocaleLowerCase();this._isImage="jpg"==s||"png"==s,this._loaderContext=e||new LoaderContext$1(!1,ApplicationDomain.currentDomain),this._contentLoaderInfo._setApplicationDomain(this._loaderContext.applicationDomain),this._adaptee.load(t.adaptee,null,null,new(this._isImage?Image2DParser:SWFParser)(this._factory)),o&&o.supressErrors&&this.adaptee.addEventListener(URLLoaderEvent.LOAD_ERROR,function(t){console.log("[LOADER] Error supressed by redirect rule as empty complete events!",t),i._contentLoaderInfo._onLoaderCompleteDelegate(new LoaderEvent(LoaderEvent.LOADER_COMPLETE,t.urlLoader.url,null))})},XJg.prototype.loadBytes=function(t,e){void 0===e&&(e=null),this._loaderContext=e||new LoaderContext$1(!1,ApplicationDomain.currentDomain),this._contentLoaderInfo._setApplicationDomain(this._loaderContext.applicationDomain),this._adaptee.loadData(t.bytes)},XJg.prototype.unload=function(){this._unload(!1,!1)},XJg.prototype.unloadAndStop=function(t){this._unload(!0,!!t)},XJg.prototype._unload=function(t,e){console.log("80pro todo: loader._unload")},XJg.redirectRules=[],XJg),TextEvent=(wKg=Event$1,__extends(xKg,wKg),Object.defineProperty(xKg.prototype,"text",{get:function(){return this._text},set:function(t){this._text=t},enumerable:!0,configurable:!0}),xKg.prototype.clone=function(){return new xKg(this.type,this.bubbles,this.cancelable,this.text)},xKg.prototype.toString=function(){return this.formatToString("TextEvent","type","bubbles","cancelable","text")},xKg.prototype.copyNativeData=function(t){},xKg.classInitializer=null,xKg.classSymbols=null,xKg.instanceSymbols=null,xKg.LINK="link",xKg.TEXT_INPUT="textInput",xKg),ErrorEvent=(FKg=TextEvent,__extends(GKg,FKg),GKg.prototype.setID=function(t){this._id=t},Object.defineProperty(GKg.prototype,"errorID",{get:function(){return this._id},enumerable:!0,configurable:!0}),GKg.prototype.clone=function(){return new GKg(this.type,this.bubbles,this.cancelable,this.text,this.errorID)},GKg.prototype.toString=function(){return this.formatToString("ErrorEvent","type","bubbles","cancelable","text","errorID")},GKg.classInitializer=null,GKg.classSymbols=null,GKg.instanceSymbols=null,GKg.ERROR="error",GKg),IOErrorEvent=(OKg=ErrorEvent,__extends(PKg,OKg),PKg.prototype.clone=function(){return new PKg(this.type,this.bubbles,this.cancelable,this.text,this.errorID)},PKg.prototype.toString=function(){return this.formatToString("IOErrorEvent","type","bubbles","cancelable","text","errorID")},PKg.classInitializer=null,PKg.classSymbols=null,PKg.instanceSymbols=null,PKg.IO_ERROR="ioError",PKg.NETWORK_ERROR="networkError",PKg.DISK_ERROR="diskError",PKg.VERIFY_ERROR="verifyError",PKg),ProgressEvent$1=(VKg=Event$1,__extends(WKg,VKg),Object.defineProperty(WKg.prototype,"bytesLoaded",{get:function(){return this._bytesLoaded},set:function(t){this._bytesLoaded=t},enumerable:!0,configurable:!0}),Object.defineProperty(WKg.prototype,"bytesTotal",{get:function(){return this._bytesTotal},set:function(t){this._bytesTotal=t},enumerable:!0,configurable:!0}),WKg.prototype.clone=function(){return new WKg(this._type,this._bubbles,this._cancelable,this._bytesLoaded,this._bytesTotal)},WKg.prototype.toString=function(){return this.formatToString("ProgressEvent","bubbles","cancelable","eventPhase","bytesLoaded","bytesTotal")},WKg.classInitializer=null,WKg.classSymbols=null,WKg.instanceSymbols=null,WKg.PROGRESS="progress",WKg.SOCKET_DATA="socketData",WKg),LoaderInfo=(dLg=EventDispatcher$1,__extends(eLg,dLg),Object.defineProperty(eLg.prototype,"actionScriptVersion",{get:function(){return 0},enumerable:!0,configurable:!0}),eLg.prototype.getSymbolById=function(t){},eLg.prototype._onLoaderStart=function(t){this._bytesLoaded=0,this._bytesTotal=0,this._url=t.url},eLg.prototype._onLoadProgress=function(t){this._bytesLoaded=t.urlLoader.bytesLoaded,this._bytesTotal=t.urlLoader.bytesTotal;var e=new this.sec.flash.events.ProgressEvent(ProgressEvent$1.PROGRESS,null,null,t.urlLoader.bytesLoaded,t.urlLoader.bytesTotal);(e.currentTarget=this).dispatchEvent(e)},eLg.prototype._onLoaderComplete=function(t){t.assets&&t.assets.length?(this._bytesLoaded=t.assets.length,this._bytesTotal=t.assets.length):this._bytesTotal=this._bytesLoaded=this._bytesTotal||1,this._url=t.url;var e=new this.sec.flash.events.Event(Event$1.COMPLETE);(e.currentTarget=this).dispatchEvent(e)},Object.defineProperty(eLg.prototype,"applicationDomain",{get:function(){return this._applicationDomain},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"bytes",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"bytesLoaded",{get:function(){return this._bytesLoaded},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"bytesTotal",{get:function(){return this._bytesTotal},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"childAllowsParent",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"childSandboxBridge",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"content",{get:function(){return this._loader.content},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"contentType",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"frameRate",{get:function(){return this._loader.stage.adaptee.frameRate},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"height",{get:function(){var t=PickGroup.getInstance(this._loader.stage.view).getBoundsPicker(this._container.partition).getBoxBounds(this._container);return null==t?0:t.height},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"isURLInaccessible",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"loader",{get:function(){return this._loader instanceof Loader$1?this._loader:null},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"loaderURL",{get:function(){return eLg.DefaultLocation},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"parameters",{get:function(){return this.sec.createArrayUnsafe([])},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"parentAllowsChild",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"parentSandboxBridge",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"sameDomain",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"sharedEvents",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"swfVersion",{get:function(){return this._swfVersion},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"uncaughtErrorEvents",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"url",{get:function(){return null!=eLg.DefaultLocation&&void 0!==eLg.DefaultLocation?eLg.DefaultLocation:this._url},set:function(t){this._url=t},enumerable:!0,configurable:!0}),Object.defineProperty(eLg.prototype,"width",{get:function(){var t=PickGroup.getInstance(this._loader.stage.view).getBoundsPicker(this._container.partition).getBoxBounds(this._container);return null==t?0:t.width},enumerable:!0,configurable:!0}),eLg.getLoaderInfoByDefinition=function(t){return null},eLg.prototype._setApplicationDomain=function(t){this._applicationDomain=t||new this.sec.flash.system.ApplicationDomain(ApplicationDomain.currentDomain)},eLg.DefaultLocation=null,eLg),Stage$1=(yLg=DisplayObjectContainer$1,__extends(zLg,yLg),Object.defineProperty(zLg.prototype,"view",{get:function(){return this.adaptee.scene.renderer.view},enumerable:!0,configurable:!0}),zLg.prototype.initResizeListener=function(t,e){},zLg.prototype.removeResizeListener=function(t,e){},zLg.prototype.resizeCallback=function(t){this.dispatchEvent(new this.sec.flash.events.Event(Event$1.RESIZE))},zLg.prototype.show=function(){},zLg.prototype.initMouseLeaveListener=function(t,e){window.addEventListener("mouseleave",e)},zLg.prototype.removeMouseLeaveListener=function(t,e){window.removeEventListener("mouseleave",e)},zLg.prototype.mouseLeaveCallback=function(t){this.dispatchEvent(new Event$1(Event$1.MOUSE_LEAVE))},zLg.prototype.enterFrame=function(){0!=this._stage.adaptee.numChildren&&(this._stage.adaptee._children[0].firstFrameOnSWFStart?this._stage.adaptee._children[0].firstFrameOnSWFStart=!1:(this._stage.dispatchStaticBroadCastEvent(Event$1.ENTER_FRAME),FrameScriptManager.execute_as3_constructors(),FrameScriptManager.execute_queue()),this._stage.advanceFrame(),OrphanManager.updateOrphans(),FrameScriptManager.execute_as3_constructors(),this._stage.dispatchStaticBroadCastEvent(Event$1.FRAME_CONSTRUCTED),FrameScriptManager.execute_queue(),this._stage.dispatchStaticBroadCastEvent(Event$1.EXIT_FRAME),FrameScriptManager.execute_queue(),this._sendEventRender&&(this._stage.dispatchStaticBroadCastEvent(Event$1.RENDER),FrameScriptManager.execute_queue(),this._sendEventRender=!1))},Object.defineProperty(zLg.prototype,"mouseX",{get:function(){return 0|this.adaptee.scene.getLocalMouseX(this.adaptee)},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"mouseY",{get:function(){return 0|this.adaptee.scene.getLocalMouseY(this.adaptee)},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"accessibilityImplementation",{set:function(t){console.log("textSnapshot not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"align",{get:function(){return this.adaptee.align},set:function(t){this.adaptee.align=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"allowsFullScreen",{get:function(){return console.log("allowsFullScreen not implemented yet in flash/Stage"),!1},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"allowsFullScreenInteractive",{get:function(){return console.log("allowsFullScreen not implemented yet in flash/Stage"),null},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"browserZoomFactor",{get:function(){return console.log("browserZoomFactor not implemented yet in flash/Stage"),0},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"color",{get:function(){return this.adaptee.color},set:function(t){this.adaptee.color=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"colorCorrection",{get:function(){return console.log("colorCorrection not implemented yet in flash/Stage"),""},set:function(t){console.log("colorCorrection not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"colorCorrectionSupport",{get:function(){return console.log("colorCorrectionSupport not implemented yet in flash/Stage"),""},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"contentsScaleFactor",{get:function(){return console.log("contentsScaleFactor not implemented yet in flash/Stage"),0},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"displayContextInfo",{get:function(){return console.log("displayContextInfo not implemented yet in flash/Stage"),""},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"displayState",{get:function(){return console.log("displayState not implemented yet in flash/Stage"),""},set:function(t){console.log("displayState not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"focus",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"frameRate",{get:function(){return this.adaptee.frameRate},set:function(t){this.adaptee.frameRate=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"fullScreenHeight",{get:function(){return console.log("fullScreenHeight not implemented yet in flash/Stage"),0},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"fullScreenSourceRect",{get:function(){return console.log("fullScreenSourceRect not implemented yet in flash/Stage"),null},set:function(t){console.log("fullScreenSourceRect not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"fullScreenWidth",{get:function(){return console.log("fullScreenWidth not implemented yet in flash/Stage"),0},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"mouseLock",{get:function(){return console.log("mouseLock not implemented yet in flash/Stage"),!1},set:function(t){console.log("mouseLock not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"quality",{get:function(){return""},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scaleMode",{get:function(){return this.adaptee.scaleMode},set:function(t){this.adaptee.scaleMode=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"showDefaultContextMenu",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"softKeyboardRect",{get:function(){return console.log("softKeyboardRect not implemented yet in flash/Stage"),null},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"stage3Ds",{get:function(){return console.log("stage3Ds not implemented yet in flash/Stage"),this._stage3Ds},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"stageFocusRect",{get:function(){return console.log("stageFocusRect not implemented yet in flash/Stage"),!1},set:function(t){console.log("stageFocusRect not implemented yet in flash/Stage")},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"stageHeight",{get:function(){return this.adaptee.stageHeight},set:function(t){this.adaptee.stageHeight=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"stageVideos",{get:function(){return console.log("stageVideos not implemented yet in flash/Stage"),[]},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"stageWidth",{get:function(){return this.adaptee.stageWidth},set:function(t){this.adaptee.stageWidth=t},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"tabChildren",{get:function(){return console.log("tabChildren not implemented yet in flash/Stage"),!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"textSnapshot",{get:function(){return console.log("textSnapshot not implemented yet in flash/Stage"),null},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"wmodeGPU",{get:function(){return console.log("wmodeGPU not implemented yet in flash/Stage"),!1},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"accessibilityProperties",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"alpha",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"blendMode",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"cacheAsBitmap",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"contextMenu",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"filters",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"focusRect",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"mask",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"mouseChildren",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"mouseEnabled",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"numChildren",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"width",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"height",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"opaqueBackground",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"name",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"rotation",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"rotationX",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"rotationY",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"rotationZ",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scale9Grid",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scaleX",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scaleY",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scaleZ",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"scrollRect",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"tabEnabled",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"tabIndex",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"transform",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"visible",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"x",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"y",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(zLg.prototype,"z",{set:function(t){},enumerable:!0,configurable:!0}),zLg.prototype.addChild=function(t){t.dispatch_ADDED_TO_STAGE();var e=yLg.prototype.addChild.call(this,t);return t.adaptee.hasDispatchedAddedToStage=!0,t.dispatchStaticEvent(Event$1.ADDED_TO_STAGE,t),e},zLg.prototype.addChildAt=function(t,e){t.dispatch_ADDED_TO_STAGE();var i=yLg.prototype.addChildAt.call(this,t,e);return t.adaptee.hasDispatchedAddedToStage=!0,t.dispatchStaticEvent(Event$1.ADDED_TO_STAGE,t),i},zLg.prototype.removeChildAt=function(t){return yLg.prototype.removeChildAt.call(this,t)},zLg.prototype.swapChildrenAt=function(t,e){return yLg.prototype.swapChildrenAt.call(this,t,e)},zLg.prototype.setChildIndex=function(t,e){return null},zLg.prototype.addEventListener=function(t,e,i,n,r){void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=!1),yLg.prototype.addEventListener.call(this,t,e,i=!1,n,r)},zLg.prototype.hasEventListener=function(t){return yLg.prototype.hasEventListener.call(this,t)},zLg.prototype.willTrigger=function(){return yLg.prototype.willTrigger.call(this)},zLg.prototype.dispatchEvent=function(t){return yLg.prototype.dispatchEvent.call(this,t)},Object.defineProperty(zLg.prototype,"loaderInfo",{get:function(){return this.getChildAt(0).loaderInfo},enumerable:!0,configurable:!0}),zLg.prototype.invalidate=function(){this._sendEventRender=!0},zLg.prototype.isFocusInaccessible=function(){return console.log("isFocusInaccessible not implemented yet in flash/Stage"),!1},zLg),URLRequest$1=(XMg=ASObject,__extends(YMg,XMg),Object.defineProperty(YMg.prototype,"adaptee",{get:function(){return this._adaptee},set:function(t){this._adaptee=t},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"url",{get:function(){return this._adaptee.url},set:function(t){t=axCoerceString$2(t),this._adaptee.url=t},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"data",{get:function(){return this._adaptee.data},set:function(t){this._adaptee.data=t},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"method",{get:function(){return this._adaptee.method},set:function(t){this._adaptee.method=t},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"contentType",{get:function(){return console.log("TODO: URLRequest.contentType"),""},set:function(t){console.log("TODO: URLRequest.contentType")},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"requestHeaders",{get:function(){return console.log("TODO: URLRequest.requestHeaders"),null},set:function(t){console.log("TODO: URLRequest.requestHeaders")},enumerable:!0,configurable:!0}),Object.defineProperty(YMg.prototype,"digest",{get:function(){return console.log("TODO: URLRequest.digest"),null},set:function(t){console.log("TODO: URLRequest.digest")},enumerable:!0,configurable:!0}),YMg),includeString="",MovieClip$1=(gNg=Sprite$1,__extends(hNg,gNg),hNg.prototype.applySymbol=function(){},hNg.getNewMovieClip=function(t){if(hNg._movieClips.length){var e=hNg._movieClips.pop();return e.adaptee=t,e}return new hNg},hNg.prototype._getAbsFrameNumber=function(t,e){return 0},hNg.prototype.callFrame=function(t){},hNg.prototype._callFrame=function(t){},hNg.prototype.addScript=function(t){return t},hNg.prototype.executeScript=function(t){if((this.allowScript||!(9<this.sec.swfVersion))&&(t=this.adaptee.timeline.get_script_for_frame(this.adaptee,this.adaptee.currentFrameIndex))){this.allowScript=!1;var e=hNg.current_script_scope;hNg.current_script_scope=this;for(var i,n=0;n<t.length;n++)t[n].setReceiver(this),t[n].axCall(this);hNg.current_script_scope=e,this.queuedNavigationAction&&(i=this.queuedNavigationAction,this.queuedNavigationAction=null,i(),FrameScriptManager.execute_as3_constructors())}},hNg.prototype.initAdapter=function(){},hNg.prototype.createAdaptee=function(){var t=MovieClip.getNewMovieClip();return t.reset(),t},hNg.prototype.clearPropsDic=function(){this.$Bg__setPropDict.map=new WeakMap},hNg.prototype.evalScript=function(t){var e=document.createElement("script");e.text="var __framescript__ = function() {\n"+includeString+t+"\n}";var i=document.scripts[0];i.parentNode.insertBefore(e,i).parentNode.removeChild(e);var n=__framescript__;return window.__framescript__=null,n},hNg.prototype.freeFromScript=function(){gNg.prototype.freeFromScript.call(this)},hNg.prototype.clone=function(){var t,e,i;if(!this._symbol)throw"_symbol not defined when cloning movieclip";var n=constructClassFromSymbol(this._symbol,this._symbol.symbolClass),r=new MovieClip(this.adaptee.timeline);if(this.adaptee.copyTo(r),n.adaptee=r,n._stage=this.activeStage,n.executeConstructor=function(){r.timeline.resetScripts(),n.axInitializer()},this._symbol.className&&(n.adaptee.cloneForEveryInstance=!0),r.timeline){for(var o=!1,s=this._symbol.symbolClass;s&&!o;)"UIComponent"==(null===(t=s.name)||void 0===t?void 0:t.name)?o=!0:"MovieClip"==(null===(e=s.name)||void 0===e?void 0:e.name)?s=null:"Sprite"==(null===(i=s.name)||void 0===i?void 0:i.name)?o=!0:s=s.superClass?s.superClass:null;var a,l,c=this._symbol.className;(o||c&&c.includes("Font"))&&((l=a=r.timeline).frame_command_indices=[a.frame_command_indices[0]],l.frame_recipe=[a.frame_recipe[0]],l.keyframe_constructframes=[a.keyframe_constructframes[0]],l.keyframe_durations=[a.keyframe_durations[0]],l.keyframe_firstframes=[a.keyframe_firstframes[0]],l.keyframe_indices=[a.keyframe_indices[0]])}return n},hNg.prototype.dispose=function(){this.disposeValues()},Object.defineProperty(hNg.prototype,"currentFrame",{get:function(){return this._adaptee.currentFrameIndex+1},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"currentFrameLabel",{get:function(){return this.adaptee.timeline.getCurrentFrameLabel(this.adaptee)},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"currentLabel",{get:function(){return this.adaptee.timeline.getCurrentLabel(this.adaptee)},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"currentLabels",{get:function(){if(this._currentLabels)return this._currentLabels;var t=this.adaptee.timeline._labels,e=this.adaptee.timeline.keyframe_firstframes;for(var i in this._currentLabels=[],t)this._currentLabels.push(new this.sec.flash.display.FrameLabel(t[i].name,e[t[i].keyFrameIndex]+1));return this._currentLabels},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"currentScene",{get:function(){return console.log("currentScene not implemented yet in flash/MovieClip"),null},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"enabled",{get:function(){return this.adaptee.buttonEnabled},set:function(t){this.adaptee.buttonEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"framesLoaded",{get:function(){return console.log("framesLoaded not implemented yet in flash/MovieClip"),this.totalFrames},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"isPlaying",{get:function(){return this.adaptee.isPlaying},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"scenes",{get:function(){return console.log("scenes not implemented yet in flash/MovieClip"),[]},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"totalFrames",{get:function(){return this._adaptee.numFrames},enumerable:!0,configurable:!0}),Object.defineProperty(hNg.prototype,"trackAsMenu",{get:function(){return console.log("trackAsMenu not implemented yet in flash/MovieClip"),!1},set:function(t){console.log("trackAsMenu not implemented yet in flash/MovieClip")},enumerable:!0,configurable:!0}),hNg.prototype.addFrameScript=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i=arguments.length;1&i&&this.sec.throwError("ArgumentError TooFewArgumentsError",i,i+1);for(var n=0;n<i;n+=2){var r=0|arguments[n],o=arguments[n+1];this.adaptee.timeline.add_framescript(o,r)}},hNg.prototype.gotoAndPlay=function(t,e,i){var n=this;if(void 0===e&&(e=null),void 0===i&&(i=!1),i||hNg.current_script_scope!=this){if(null!=t)return"string"==typeof t&&(this.sec.swfVersion<=9&&(t=t.toLowerCase()),null==this.adaptee.timeline._labels[t])?(t=parseInt(t),void(isNaN(t)||(this.adaptee.currentFrameIndex=t-1,this.adaptee.play()))):void("number"==typeof t&&t<=0||(this.play(),this._gotoFrame(t)))}else this.queuedNavigationAction=function(){return n.gotoAndPlay(t,e,!0)}},hNg.prototype.gotoAndStop=function(t,e,i){var n=this;if(void 0===e&&(e=null),void 0===i&&(i=!1),i||hNg.current_script_scope!=this){if(null!=t)return"string"==typeof t&&(this.sec.swfVersion<=9&&(t=t.toLowerCase()),null==this.adaptee.timeline._labels[t])?(t=parseInt(t),isNaN(t)||(this.adaptee.currentFrameIndex=t-1,this.adaptee.stop()),10<this.sec.swfVersion&&(this.adaptee.currentFrameIndex=0),void this.stop()):void("number"==typeof t&&t<=0?this.stop():(this.stop(),this._gotoFrame(t)));this.stop()}else this.queuedNavigationAction=function(){return n.gotoAndStop(t,e,!0)}},hNg.prototype._gotoFrame=function(t){9<this.sec.swfVersion&&FrameScriptManager.queueLevel++,"string"==typeof t?this._adaptee.jumpToLabel(t):"number"==typeof t&&t<=0||(this._adaptee.currentFrameIndex=t-1),FrameScriptManager.execute_as3_constructors(),9<this.sec.swfVersion&&(this.dispatchStaticBroadCastEvent(Event$1.FRAME_CONSTRUCTED),FrameScriptManager.execute_queue(),FrameScriptManager.queueLevel--,this.dispatchStaticBroadCastEvent(Event$1.EXIT_FRAME))},hNg.prototype.nextFrame=function(t){var e=this;void 0===t&&(t=!1),t||hNg.current_script_scope!=this?(9<this.sec.swfVersion&&FrameScriptManager.add_queue(),this._adaptee.stop(),++this._adaptee.currentFrameIndex,FrameScriptManager.execute_as3_constructors(),9<this.sec.swfVersion&&FrameScriptManager.execute_queue()):this.queuedNavigationAction=function(){return e.nextFrame(!0)}},hNg.prototype.nextScene=function(t){var e=this;void 0===t&&(t=!1),t||hNg.current_script_scope!=this?console.log("nextScene not implemented yet in flash/MovieClip"):this.queuedNavigationAction=function(){return e.nextScene(!0)}},hNg.prototype.play=function(){return this._adaptee.play()},hNg.prototype.prevFrame=function(t){var e=this;void 0===t&&(t=!1),t||hNg.current_script_scope!=this?(9<this.sec.swfVersion&&FrameScriptManager.add_queue(),0<this._adaptee.currentFrameIndex&&(this._adaptee.currentFrameIndex=this._adaptee.currentFrameIndex-1),FrameScriptManager.execute_as3_constructors(),9<this.sec.swfVersion&&FrameScriptManager.execute_queue()):this.queuedNavigationAction=function(){return e.prevFrame(!0)}},hNg.prototype.prevScene=function(t){var e=this;void 0===t&&(t=!1),t||hNg.current_script_scope!=this?console.log("prevScene not implemented yet in flash/MovieClip"):this.queuedNavigationAction=function(){return e.prevScene(!0)}},hNg.prototype.stop=function(){return this._adaptee.stop()},hNg._movieClips=new Array,hNg.current_script_scope=null,hNg),SimpleButton$1=(jOg=MovieClip$1,__extends(kOg,jOg),kOg.prototype.initAdapter=function(){},kOg.prototype.registerScriptObject=function(t){},kOg.prototype.unregisterScriptObject=function(t){},Object.defineProperty(kOg.prototype,"downState",{get:function(){return console.log("downState not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("downState not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"enabled",{get:function(){return console.log("enabled not implemented yet in flash/SimpleButton"),!1},set:function(t){console.log("enabled not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"hitTestState",{get:function(){return console.log("hitTestState not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("hitTestState not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"overState",{get:function(){return console.log("overState not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("overState not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"soundTransform",{get:function(){return console.log("soundTransform not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("soundTransform not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"trackAsMenu",{get:function(){return console.log("trackAsMenu not implemented yet in flash/SimpleButton"),!1},set:function(t){console.log("trackAsMenu not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"upState",{get:function(){return console.log("upState not implemented yet in flash/SimpleButton"),null},set:function(t){console.log("upState not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),Object.defineProperty(kOg.prototype,"useHandCursor",{get:function(){return console.log("useHandCursor not implemented yet in flash/SimpleButton"),!1},set:function(t){console.log("useHandCursor not implemented yet in flash/SimpleButton")},enumerable:!0,configurable:!0}),kOg),ColorTransform$1=(AOg=ASObject,__extends(BOg,AOg),BOg.classInitializer=function(){this.FROZEN_IDENTITY_COLOR_TRANSFORM=Object.freeze(this.axConstruct([])),this.TEMP_COLOR_TRANSFORM=this.axConstruct([])},Object.defineProperty(BOg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"alphaMultiplier",{get:function(){return this._adaptee._rawData[3]},set:function(t){this._adaptee._rawData[3]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"alphaOffset",{get:function(){return this._adaptee._rawData[7]},set:function(t){this._adaptee._rawData[7]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"blueMultiplier",{get:function(){return this._adaptee._rawData[2]},set:function(t){this._adaptee._rawData[2]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"blueOffset",{get:function(){return this._adaptee._rawData[6]},set:function(t){this._adaptee._rawData[6]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"greenMultiplier",{get:function(){return this._adaptee._rawData[1]},set:function(t){this._adaptee._rawData[1]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"greenOffset",{get:function(){return this._adaptee._rawData[5]},set:function(t){this._adaptee._rawData[5]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"redMultiplier",{get:function(){return this._adaptee._rawData[0]},set:function(t){this._adaptee._rawData[0]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"redOffset",{get:function(){return this._adaptee._rawData[4]},set:function(t){this._adaptee._rawData[4]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(BOg.prototype,"color",{get:function(){return this._adaptee.color},set:function(t){this._adaptee.color=+t},enumerable:!0,configurable:!0}),BOg.prototype.concat=function(t){this._adaptee.concat(t.adaptee)},BOg.prototype.preMultiply=function(t){this._adaptee._rawData[4]+=t.adaptee._rawData[4]*this._adaptee._rawData[0],this._adaptee._rawData[5]+=t.adaptee._rawData[5]*this._adaptee._rawData[1],this._adaptee._rawData[6]+=t.adaptee._rawData[6]*this._adaptee._rawData[2],this._adaptee._rawData[7]+=t.adaptee._rawData[7]*this._adaptee._rawData[3],this._adaptee._rawData[0]*=t.adaptee._rawData[0],this._adaptee._rawData[1]*=t.adaptee._rawData[1],this._adaptee._rawData[2]*=t.adaptee._rawData[2],this._adaptee._rawData[3]*=t.adaptee._rawData[3]},BOg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},BOg.prototype.setTo=function(t,e,i,n,r,o,s,a){this._adaptee._rawData[0]=t,this._adaptee._rawData[1]=e,this._adaptee._rawData[2]=i,this._adaptee._rawData[3]=n,this._adaptee._rawData[4]=r,this._adaptee._rawData[5]=o,this._adaptee._rawData[6]=s,this._adaptee._rawData[7]=a},BOg.prototype.clone=function(){return new this.sec.flash.geom.ColorTransform(this._adaptee._rawData[0],this._adaptee._rawData[1],this._adaptee._rawData[2],this._adaptee._rawData[3],this._adaptee._rawData[4],this._adaptee._rawData[5],this._adaptee._rawData[6],this._adaptee._rawData[7])},BOg.prototype.convertToFixedPoint=function(){return this._adaptee._rawData[0]=clampS8U8(this._adaptee._rawData[0]),this._adaptee._rawData[1]=clampS8U8(this._adaptee._rawData[1]),this._adaptee._rawData[2]=clampS8U8(this._adaptee._rawData[2]),this._adaptee._rawData[3]=clampS8U8(this._adaptee._rawData[3]),this._adaptee._rawData[4]=toS16(this._adaptee._rawData[4]),this._adaptee._rawData[5]=toS16(this._adaptee._rawData[5]),this._adaptee._rawData[6]=toS16(this._adaptee._rawData[6]),this._adaptee._rawData[7]=toS16(this._adaptee._rawData[7]),this},BOg.prototype.dispose=function(){throw new AbstractMethodError},BOg.prototype.equals=function(t){return this===t||this._adaptee._rawData[0]===t._adaptee._rawData[0]&&this._adaptee._rawData[1]===t._adaptee._rawData[1]&&this._adaptee._rawData[2]===t._adaptee._rawData[2]&&this._adaptee._rawData[3]===t._adaptee._rawData[3]&&this._adaptee._rawData[4]===t._adaptee._rawData[4]&&this._adaptee._rawData[5]===t._adaptee._rawData[5]&&this._adaptee._rawData[6]===t._adaptee._rawData[6]&&this._adaptee._rawData[7]===t._adaptee._rawData[7]},BOg.prototype.toString=function(){return"(redMultiplier="+this._adaptee._rawData[0]+", greenMultiplier="+this._adaptee._rawData[1]+", blueMultiplier="+this._adaptee._rawData[2]+", alphaMultiplier="+this._adaptee._rawData[3]+", redOffset="+this._adaptee._rawData[4]+", greenOffset="+this._adaptee._rawData[5]+", blueOffset="+this._adaptee._rawData[6]+", alphaOffset="+this._adaptee._rawData[7]+")"},BOg.classSymbols=null,BOg.instanceSymbols=null,BOg),Matrix$1=(ePg=ASObject,__extends(fPg,ePg),fPg.classInitializer=function(){this.FROZEN_IDENTITY_MATRIX=Object.freeze(this.axConstruct([])),this.TEMP_MATRIX=this.axConstruct([])},Object.defineProperty(fPg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"a",{get:function(){return this._adaptee.rawData[0]},set:function(t){this._adaptee.rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"b",{get:function(){return this._adaptee.rawData[2]},set:function(t){this._adaptee.rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"c",{get:function(){return this._adaptee.rawData[1]},set:function(t){this._adaptee.rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"d",{get:function(){return this._adaptee.rawData[3]},set:function(t){this._adaptee.rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"tx",{get:function(){return this._adaptee.rawData[4]},set:function(t){this._adaptee.rawData[4]=t},enumerable:!0,configurable:!0}),Object.defineProperty(fPg.prototype,"ty",{get:function(){return this._adaptee.rawData[5]},set:function(t){this._adaptee.rawData[5]=t},enumerable:!0,configurable:!0}),fPg.FromUntyped=function(t){return new this.sec.flash.geom.Matrix(t.a,t.b,t.c,t.d,t.tx,t.ty)},fPg.FromDataBuffer=function(t){return new this.sec.flash.geom.Matrix(t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat(),t.readFloat())},fPg.prototype.concat=function(t){this._adaptee.concat(t.adaptee)},fPg.prototype.invert=function(){this._adaptee.invert()},fPg.prototype.identity=function(){this._adaptee.identity()},fPg.prototype.createBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this._adaptee.createBox(t,e,i,n,r)},fPg.prototype.createGradientBox=function(t,e,i,n,r){void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),this._adaptee.createGradientBox(t,e,i,n,r)},fPg.prototype.rotate=function(t){this._adaptee.rotate(t)},fPg.prototype.translate=function(t,e){this._adaptee.translate(t,e)},fPg.prototype.scale=function(t,e){this._adaptee.scale(t,e)},fPg.prototype.deltaTransformPoint=function(t){return new this.sec.flash.geom.Point(this._adaptee.deltaTransformPoint(t.adaptee))},fPg.prototype.transformPoint=function(t){return new this.sec.flash.geom.Point(this._adaptee.transformPoint(t.adaptee))},fPg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},fPg.prototype.setTo=function(t,e,i,n,r,o){this._adaptee.setTo(t,e,i,n,r,o)},fPg.prototype.copyRowTo=function(t,e){this._adaptee.copyRowTo(t,e.adaptee)},fPg.prototype.copyColumnTo=function(t,e){this._adaptee.copyColumnTo(t,e.adaptee)},fPg.prototype.copyRowFrom=function(t,e){this._adaptee.copyRowFrom(t,e.adaptee)},fPg.prototype.copyColumnFrom=function(t,e){this._adaptee.copyColumnFrom(t,e.adaptee)},fPg.prototype.clone=function(){return new this.sec.flash.geom.Matrix(this._adaptee.clone())},fPg.prototype.toString=function(){var t=this._adaptee.rawData;return"(a="+t[0]+", b="+t[1]+", c="+t[2]+", d="+t[3]+", tx="+t[4]+", ty="+t[5]+")"},fPg.prototype.writeExternal=function(t){var e=this._adaptee.rawData;t.writeFloat(e[0]),t.writeFloat(e[1]),t.writeFloat(e[2]),t.writeFloat(e[3]),t.writeFloat(e[4]),t.writeFloat(e[5])},fPg.classSymbols=null,fPg.instanceSymbols=null,fPg),transposeTransform=new Uint32Array([0,4,8,12,1,5,9,13,2,6,10,14,3,7,11,15]),Matrix3D$1=(dQg=ASObject,__extends(eQg,dQg),Object.defineProperty(eQg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),eQg.interpolate=function(t,e,i){},Object.defineProperty(eQg.prototype,"rawData",{get:function(){var t=new this.sec.Float64Vector;return this.copyRawDataTo(t,0,!1),t},set:function(t){this.copyRawDataFrom(t,0,!1)},enumerable:!0,configurable:!0}),Object.defineProperty(eQg.prototype,"position",{get:function(){return new this.sec.flash.geom.Vector3D(this._adaptee.position)},set:function(t){this.copyColumnFrom(3,t)},enumerable:!0,configurable:!0}),Object.defineProperty(eQg.prototype,"determinant",{get:function(){return this._adaptee.determinant},enumerable:!0,configurable:!0}),eQg.prototype.clone=function(){return new this.sec.flash.geom.Matrix3D(this._adaptee.clone())},eQg.prototype.copyToMatrix3D=function(t){this._adaptee.copyTo(t.adaptee)},eQg.prototype.append=function(t){this._adaptee.append(t.adaptee)},eQg.prototype.prepend=function(t){this._adaptee.prepend(t.adaptee)},eQg.prototype.invert=function(){return this._adaptee.invert()},eQg.prototype.identity=function(){this._adaptee.identity()},eQg.prototype.decompose=function(t){void 0===t&&(t="eulerAngles"),this._adaptee.decompose(t),t=axCoerceString(t)},eQg.prototype.recompose=function(t,e){},eQg.prototype.appendTranslation=function(t,e,i){this._adaptee.appendTranslation(+t,+e,+i)},eQg.prototype.appendRotation=function(t,e,i){this._adaptee.appendRotation(+t,e.adaptee)},eQg.prototype.appendScale=function(t,e,i){this._adaptee.appendScale(+t,+e,+i)},eQg.prototype.prependTranslation=function(t,e,i){this._adaptee.prependTranslation(+t,+e,+i)},eQg.prototype.prependRotation=function(t,e,i){this._adaptee.prependRotation(+t,e.adaptee)},eQg.prototype.prependScale=function(t,e,i){this._adaptee.prependScale(+t,+e,+i)},eQg.prototype.transformVector=function(t){return new this.sec.flash.geom.Vector3D(this._adaptee.transformVector(t.adaptee))},eQg.prototype.deltaTransformVector=function(t){return new this.sec.flash.geom.Vector3D(this._adaptee.deltaTransformVector(t.adaptee))},eQg.prototype.transformVectors=function(t,e){for(var i=this._adaptee._rawData,n=i[0],r=i[4],o=i[8],s=i[12],a=i[1],l=i[5],c=i[9],h=i[13],u=i[2],p=i[6],d=i[10],_=i[14],f=0;f<t.length-2;f+=3){var m=t.axGetNumericProperty(f),g=t.axGetNumericProperty(f+1),y=t.axGetNumericProperty(f+2);e.push(n*m+r*g+o*y+s),e.push(a*m+l*g+c*y+h),e.push(u*m+p*g+d*y+_)}},eQg.prototype.transpose=function(){this._adaptee.transpose()},eQg.prototype.pointAt=function(t,e,i){},eQg.prototype.interpolateTo=function(t,e){},eQg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},eQg.prototype.copyRawDataTo=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1),e>>>=0,i=!!i;var n=this._adaptee._rawData;if(i)for(var r=0,o=0|e;r<16;r++,o++)t.axSetNumericProperty(o,n[transposeTransform[r]]);else for(o=(r=0)|e;r<16;r++,o++)t.axSetNumericProperty(o,n[r])},eQg.prototype.copyRawDataFrom=function(t,e,i){void 0===e&&(e=0),void 0===i&&(i=!1),e>>>=0,i=!!i;var n=this._adaptee._rawData;if(i)for(var r=0,o=0|e;r<16;r++,o++)n[transposeTransform[r]]=t.axGetNumericProperty(o)||0;else for(o=(r=0)|e;r<16;r++,o++)n[r]=t.axGetNumericProperty(o)||0},eQg.prototype.copyRowTo=function(t,e){this._adaptee.copyRowTo(t>>>0,e.adaptee)},eQg.prototype.copyColumnTo=function(t,e){this._adaptee.copyColumnTo(t>>>0,e.adaptee)},eQg.prototype.copyRowFrom=function(t,e){this._adaptee.copyRowFrom(t>>>0,e.adaptee)},eQg.prototype.copyColumnFrom=function(t,e){this._adaptee.copyColumnFrom(t>>>0,e.adaptee)},eQg.classInitializer=null,eQg),Point$1=(ERg=ASObject,__extends(FRg,ERg),Object.defineProperty(FRg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(FRg.prototype,"x",{get:function(){return this._adaptee._rawData[0]},set:function(t){this._adaptee._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty(FRg.prototype,"y",{get:function(){return this._adaptee._rawData[1]},set:function(t){this._adaptee._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty(FRg.prototype,"length",{get:function(){return this._adaptee.length},enumerable:!0,configurable:!0}),FRg.interpolate=function(t,e,i){return new this.sec.flash.geom.Point(Point.interpolate(t.adaptee,e.adaptee,i))},FRg.distance=function(t,e){return Point.distance(t.adaptee,e.adaptee)},FRg.polar=function(t,e){return new this.sec.flash.geom.Point(Point.polar(+t,+e))},FRg.prototype.clone=function(){return new this.sec.flash.geom.Point(this._adaptee.clone())},FRg.prototype.offset=function(t,e){this._adaptee.offset(t,e)},FRg.prototype.equals=function(t){return this._adaptee.equals(t.adaptee)},FRg.prototype.subtract=function(t){return new this.sec.flash.geom.Point(this._adaptee.subtract(t.adaptee))},FRg.prototype.add=function(t){return new this.sec.flash.geom.Point(this._adaptee.add(t.adaptee))},FRg.prototype.normalize=function(t){void 0===t&&(t=1),this._adaptee.normalize(+t)},FRg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},FRg.prototype.setTo=function(t,e){this._adaptee.setTo(t,e)},FRg.prototype.toString=function(){return"(x="+this.x+", y="+this.y+")"},FRg.classInitializer=null,FRg.classSymbols=null,FRg.instanceSymbols=null,FRg),Rectangle$1=(_Rg=ASObject,__extends(aSg,_Rg),Object.defineProperty(aSg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"height",{get:function(){return this._adaptee._rawData[3]},set:function(t){this._adaptee._rawData[3]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"width",{get:function(){return this._adaptee._rawData[2]},set:function(t){this._adaptee._rawData[2]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"x",{get:function(){return this._adaptee._rawData[0]},set:function(t){this._adaptee._rawData[0]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"y",{get:function(){return this._adaptee._rawData[1]},set:function(t){this._adaptee._rawData[1]=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"bottom",{get:function(){return this._adaptee.bottom},set:function(t){this._adaptee.bottom=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"bottomRight",{get:function(){return new this.sec.flash.geom.Point(this._adaptee.bottomRight)},set:function(t){this.bottom=t.y,this.right=t.x},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"left",{get:function(){return this._adaptee.left},set:function(t){this._adaptee.left=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"right",{get:function(){return this._adaptee.right},set:function(t){this._adaptee.right=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"size",{get:function(){return new this.sec.flash.geom.Point(this._adaptee.size)},set:function(t){this.width=t.x,this.height=t.y},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"top",{get:function(){return this._adaptee.top},set:function(t){this._adaptee.top=+t},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"topLeft",{get:function(){return new this.sec.flash.geom.Point(this._adaptee.topLeft)},set:function(t){this.top=t.y,this.left=t.x},enumerable:!0,configurable:!0}),Object.defineProperty(aSg.prototype,"area",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),aSg.FromBounds=function(t){var e=t.xMin,i=t.yMin;return new this.sec.flash.geom.Rectangle(e/20,i/20,(t.xMax-e)/20,(t.yMax-i)/20)},aSg.prototype.clone=function(){return new this.sec.flash.geom.Rectangle(this._adaptee.clone())},aSg.prototype.isEmpty=function(){return this._adaptee.isEmpty()},aSg.prototype.setEmpty=function(){return this._adaptee.setEmpty()},aSg.prototype.inflate=function(t,e){this._adaptee.inflate(+t,+e)},aSg.prototype.inflatePoint=function(t){this._adaptee.inflatePoint(t.adaptee)},aSg.prototype.offset=function(t,e){this._adaptee.offset(+t,+e)},aSg.prototype.offsetPoint=function(t){this._adaptee.offsetPoint(t.adaptee)},aSg.prototype.contains=function(t,e){return this._adaptee.contains(+t,+e)},aSg.prototype.containsPoint=function(t){return this._adaptee.containsPoint(t.adaptee)},aSg.prototype.containsRect=function(t){return this._adaptee.containsRect(t.adaptee)},aSg.prototype.intersection=function(t){return new this.sec.flash.geom.Rectangle(this._adaptee.intersection(t.adaptee))},aSg.prototype.intersects=function(t){return this._adaptee.intersects(t.adaptee)},aSg.prototype.union=function(t){return new this.sec.flash.geom.Rectangle(this._adaptee.union(t.adaptee))},aSg.prototype.equals=function(t){return this._adaptee.equals(t.adaptee)},aSg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},aSg.prototype.setTo=function(t,e,i,n){this._adaptee.setTo(+t,+e,+i,+n)},aSg.prototype.toString=function(){return"(x="+this.x+", y="+this.y+", w="+this.width+", h="+this.height+")"},aSg.prototype.hashCode=function(){var t=0;return t+=20*this.x|0,t*=37,t+=20*this.y|0,t*=37,t+=20*this.width|0,(t*=37)+(20*this.height|0)},aSg.prototype.writeExternal=function(t){t.writeFloat(this.x),t.writeFloat(this.y),t.writeFloat(this.width),t.writeFloat(this.height)},aSg.prototype.readExternal=function(t){this.x=t.readFloat(),this.y=t.readFloat(),this.width=t.readFloat(),this.height=t.readFloat()},aSg.classInitializer=null,aSg.classSymbols=null,aSg.instanceSymbols=null,aSg),Transform$1=(QSg=ASObject,__extends(RSg,QSg),Object.defineProperty(RSg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"matrix",{get:function(){return new this.sec.flash.geom.Matrix(this._adaptee.matrix)},set:function(t){this._adaptee.matrix=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"colorTransform",{get:function(){return new this.sec.flash.geom.ColorTransform(this._adaptee.colorTransform)},set:function(t){this._adaptee.colorTransform=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"concatenatedMatrix",{get:function(){return new this.sec.flash.geom.Matrix(this._adaptee.matrix)},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"concatenatedColorTransform",{get:function(){return new this.sec.flash.geom.ColorTransform(this._adaptee.colorTransform)},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"pixelBounds",{get:function(){return new this.sec.flash.geom.Rectangle(this._adaptee.pixelBounds)},enumerable:!0,configurable:!0}),Object.defineProperty(RSg.prototype,"matrix3D",{get:function(){return new this.sec.flash.geom.Matrix3D(this._adaptee.matrix3D)},set:function(t){},enumerable:!0,configurable:!0}),RSg.prototype.getRelativeMatrix3D=function(t){return checkNullParameter(t,"relativeTo",this.sec),new this.sec.flash.geom.Matrix3D(this._adaptee.matrix3D)},Object.defineProperty(RSg.prototype,"perspectiveProjection",{get:function(){return new PerspectiveProjection},set:function(t){},enumerable:!0,configurable:!0}),RSg.classInitializer=null,RSg),Vector3D$1=(ZSg=ASObject,__extends($Sg,ZSg),$Sg.classInitializer=function(){this.X_AXIS=Object.freeze(this.Create(1,0,0,0)),this.Y_AXIS=Object.freeze(this.Create(1,0,0,0)),this.Z_AXIS=Object.freeze(this.Create(1,0,0,0))},$Sg.Create=function(t,e,i,n){var r=Object.create(this.tPrototype);return r._adaptee=new Vector3D(t,e,i,n),r},Object.defineProperty($Sg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"x",{get:function(){return this._adaptee._rawData[0]},set:function(t){this._adaptee._rawData[0]=t},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"y",{get:function(){return this._adaptee._rawData[1]},set:function(t){this._adaptee._rawData[1]=t},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"z",{get:function(){return this._adaptee._rawData[2]},set:function(t){this._adaptee._rawData[2]=t},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"w",{get:function(){return this._adaptee._rawData[3]},set:function(t){this._adaptee._rawData[3]=t},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"length",{get:function(){return this._adaptee.length},enumerable:!0,configurable:!0}),Object.defineProperty($Sg.prototype,"lengthSquared",{get:function(){return this._adaptee.lengthSquared},enumerable:!0,configurable:!0}),$Sg.angleBetween=function(t,e){return Vector3D.angleBetween(t.adaptee,e.adaptee)},$Sg.distance=function(t,e){return Vector3D.distance(t.adaptee,e.adaptee)},$Sg.prototype.dotProduct=function(t){return this._adaptee.dotProduct(t.adaptee)},$Sg.prototype.crossProduct=function(t){return new this.sec.flash.geom.Vector3D(this._adaptee.crossProduct(t.adaptee))},$Sg.prototype.normalize=function(){return this._adaptee.normalize()},$Sg.prototype.scaleBy=function(t){this._adaptee.scaleBy(+t)},$Sg.prototype.incrementBy=function(t){this._adaptee.incrementBy(t.adaptee)},$Sg.prototype.decrementBy=function(t){this._adaptee.decrementBy(t.adaptee)},$Sg.prototype.add=function(t){return new this.sec.flash.geom.Vector3D(this._adaptee.add(t.adaptee))},$Sg.prototype.subtract=function(t){return new this.sec.flash.geom.Vector3D(this._adaptee.subtract(t.adaptee))},$Sg.prototype.negate=function(){this._adaptee.negate()},$Sg.prototype.equals=function(t,e){return this._adaptee.equals(t.adaptee,e)},$Sg.prototype.nearEquals=function(t,e,i){return this._adaptee.nearEquals(t.adaptee,e,i)},$Sg.prototype.project=function(){this._adaptee.project()},$Sg.prototype.copyFrom=function(t){this._adaptee.copyFrom(t.adaptee)},$Sg.prototype.setTo=function(t,e,i){this._adaptee.setTo(t,e,i)},$Sg.prototype.clone=function(){return new this.sec.flash.geom.Vector3D(this._adaptee.clone())},$Sg.prototype.toString=function(){return"Vector3D("+this.x+", "+this.y+", "+this.z+")"},$Sg),System$1=(HTg=ASObject,__extends(ITg,HTg),Object.defineProperty(ITg,"freeMemory",{get:function(){return console.log("freeMemory not implemented yet in flash/System"),0},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"ime",{get:function(){return console.log("ime not implemented yet in flash/System"),null},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"privateMemory",{get:function(){return console.log("privateMemory not implemented yet in flash/System"),0},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"processCPUUsage",{get:function(){return console.log("processCPUUsage not implemented yet in flash/System"),0},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"totalMemory",{get:function(){return console.log("totalMemory not implemented yet in flash/System"),0},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"totalMemoryNumber",{get:function(){return console.log("totalMemoryNumber not implemented yet in flash/System"),0},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"useCodePage",{get:function(){return console.log("useCodePage not implemented yet in flash/System"),!1},set:function(t){console.log("useCodePage not implemented yet in flash/System")},enumerable:!0,configurable:!0}),Object.defineProperty(ITg,"vmVersion",{get:function(){return console.log("vmVersion not implemented yet in flash/System"),""},enumerable:!0,configurable:!0}),ITg.disposeXML=function(t){console.log("disposeXML not implemented yet in flash/System")},ITg.exit=function(t){console.log("exit not implemented yet in flash/System")},ITg.gc=function(){console.log("gc not implemented yet in flash/System")},ITg.pause=function(){console.log("pause not implemented yet in flash/System")},ITg.pauseForGCIfCollectionImminent=function(t){console.log("pauseForGCIfCollectionImminent not implemented yet in flash/System")},ITg.resume=function(){console.log("resume not implemented yet in flash/System")},ITg.setClipboard=function(t){console.log("setClipboard not implemented yet in flash/System")},ITg),Graphics$1=(OTg=ASObject,__extends(PTg,OTg),PTg.prototype.dispose=function(){},Object.defineProperty(PTg.prototype,"adaptee",{get:function(){return this._adaptee},enumerable:!0,configurable:!0}),PTg.FromData=function(t,e){return new this.sec.flash.display.Graphics},PTg.prototype.clear=function(){this.adaptee.clear()},PTg.prototype.beginFill=function(t,e){void 0===e&&(e=1),this.adaptee.beginFill(t,e)},PTg.prototype.beginGradientFill=function(t,e,i,n,r,o,s,a){void 0===r&&(r=null),void 0===o&&(o="pad"),void 0===s&&(s="rgb"),void 0===a&&(a=0),this.adaptee.beginGradientFill(t,e.value,i.value,n.value,null==r?void 0:r.adaptee,o,s,a)},PTg.prototype.beginBitmapFill=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=!1),this.adaptee.beginBitmapFill(t.adaptee,null==e?void 0:e.adaptee,i,n)},PTg.prototype.endFill=function(){this.adaptee.endFill()},PTg.prototype.lineStyle=function(t,e,i,n,r,o,s,a){void 0===e&&(e=0),void 0===i&&(i=1),void 0===n&&(n=!1),void 0===r&&(r="normal"),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=3),this.adaptee.lineStyle(t,e,i,n,r,o,s,a)},PTg.prototype.lineGradientStyle=function(t,e,i,n,r,o,s,a){void 0===r&&(r=null),void 0===o&&(o="pad"),void 0===s&&(s="rgb"),void 0===a&&(a=0),this.adaptee.lineGradientStyle(t,e.value,i.value,n.value,null==r?void 0:r.adaptee,o,s,a)},PTg.prototype.lineBitmapStyle=function(t,e,i,n){void 0===e&&(e=null),void 0===i&&(i=!0),void 0===n&&(n=!1),this.adaptee.lineBitmapStyle(t.adaptee,null==e?void 0:e.adaptee,i,n)},PTg.prototype.drawRect=function(t,e,i,n){this.adaptee.drawRect(t,e,i,n)},PTg.prototype.drawRoundRect=function(t,e,i,n,r,o){this.adaptee.drawRoundRect(t,e,i,n,r,o)},PTg.prototype.drawRoundRectComplex=function(t,e,i,n,r,o,s,a){this.adaptee.drawRoundRectComplex(t,e,i,n,r,o,s,a)},PTg.prototype.drawCircle=function(t,e,i){this.adaptee.drawCircle(t,e,i)},PTg.prototype.drawEllipse=function(t,e,i,n){this.adaptee.drawEllipse(t,e,i,n)},PTg.prototype.moveTo=function(t,e){this.adaptee.moveTo(t,e)},PTg.prototype.lineTo=function(t,e){this.adaptee.lineTo(t,e)},PTg.prototype.curveTo=function(t,e,i,n){this.adaptee.curveTo(t,e,i,n)},PTg.prototype.cubicCurveTo=function(t,e,i,n,r,o){this.adaptee.cubicCurveTo(t,e,i,n,r,o)},PTg.prototype.copyFrom=function(t){this.adaptee.copyFrom(t.adaptee)},PTg.prototype.drawPath=function(t,e,i){},PTg.prototype.drawTriangles=function(t,e,i,n){},PTg.prototype.drawGraphicsData=function(t){},PTg.classInitializer=null,PTg),URLLoader$1=(uVg=EventDispatcher$1,__extends(vVg,uVg),vVg.prototype.close=function(){console.log("not mimplemented: URLoader.close")},Object.defineProperty(vVg.prototype,"data",{get:function(){return this._adaptee.data},enumerable:!0,configurable:!0}),vVg.prototype.initListener=function(t,e){this._adaptee.addEventListener(t,e)},vVg.prototype.removeListener=function(t,e){this._adaptee.removeEventListener(t,e)},vVg.prototype.addEventListener=function(t,e){uVg.prototype.addEventListener.call(this,t,e)},vVg.prototype.loadErrorDelegate=function(t){var e=new this.sec.flash.events.IOErrorEvent(IOErrorEvent.IO_ERROR);(e.currentTarget=this).dispatchEvent(e)},vVg.prototype.progressCallback=function(t){void 0===t&&(t=null);var e=new this.sec.flash.events.ProgressEvent(ProgressEvent$1.PROGRESS,null,null,t.urlLoader.bytesLoaded,t.urlLoader.bytesTotal);(e.currentTarget=this).dispatchEvent(e)},vVg.prototype.completeCallback=function(t){var e=new this.sec.flash.events.Event(Event$1.COMPLETE);e.currentTarget=this,(e.target=this).dispatchEvent(e)},vVg.prototype.load=function(t){var e=t.url||"",i=matchRedirect(e,vVg.redirectRules);i?(console.log("[URL LOADER] Override loading url:",i.url),t.adaptee.url=i.url):console.log("[URL LOADER] start loading the url:",e),this._adaptee.load(t.adaptee)},vVg.redirectRules=[],vVg),TextField$1=(PVg=InteractiveObject,__extends(QVg,PVg),QVg.getNewTextField=function(t){if(void 0===t&&(t=null),QVg._textFields.length){var e=QVg._textFields.pop();return e.adaptee=t||TextField.getNewTextField(),e}return new QVg},QVg.prototype.createAdaptee=function(){var t=TextField.getNewTextField();return t.reset(),t},QVg.prototype.initAdapter=function(){},QVg.prototype.dispatchKeyEvent=function(t,e,i,n){},QVg.prototype.selectTextField=function(){},QVg.prototype.clone=function(){var t=constructClassFromSymbol(this._symbol,this._symbol.symbolClass),e=new TextField;return this.adaptee.copyTo(e),t.adaptee=e,t._stage=this.activeStage,t.executeConstructor=function(){t.axInitializer()},t},QVg.prototype.dispose=function(){this.disposeValues(),QVg._textFields.push(this)},Object.defineProperty(QVg.prototype,"alwaysShowSelection",{get:function(){return this._adaptee.alwaysShowSelection},set:function(t){this._adaptee.alwaysShowSelection=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"antiAliasType",{get:function(){return""},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"autoSize",{get:function(){return this._adaptee.autoSize},set:function(t){this._adaptee.autoSize=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"background",{get:function(){return this._adaptee.background},set:function(t){this._adaptee.background=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"backgroundColor",{get:function(){return this._adaptee.backgroundColor},set:function(t){this._adaptee.backgroundColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"border",{get:function(){return this._adaptee.border},set:function(t){this._adaptee.border=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"borderColor",{get:function(){return this._adaptee.borderColor},set:function(t){this._adaptee.borderColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"bottomScrollV",{get:function(){throw"bottomScrollV not implemented yet in flash/TextField"},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"caretIndex",{get:function(){throw"caretIndex not implemented yet in flash/TextField"},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"condenseWhite",{get:function(){throw"condenseWhite not implemented yet in flash/TextField"},set:function(t){throw"condenseWhite not implemented yet in flash/TextField"},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"defaultTextFormat",{get:function(){var t=this._adaptee.textFormat;return!t.adapter&&t.adapter!==t.adaptee||(t.adapter=new this.sec.flash.text.TextFormat,t.adapter.adaptee=t),t.adapter},set:function(t){this._adaptee.textFormat=t.adaptee},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"displayAsPassword",{get:function(){return this._adaptee.displayAsPassword},set:function(t){this._adaptee.displayAsPassword=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"embedFonts",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"gridFitType",{get:function(){return""},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"htmlText",{get:function(){return this.adaptee.htmlText},set:function(t){this.adaptee.htmlText=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"length",{get:function(){return this._adaptee.length},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"maxChars",{get:function(){return this.adaptee.maxChars},set:function(t){this.adaptee.maxChars=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"maxScrollH",{get:function(){return this.adaptee.maxScrollH},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"maxScrollV",{get:function(){return this.adaptee.maxScrollV},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"mouseWheelEnabled",{get:function(){return this.adaptee.mouseWheelEnabled},set:function(t){this.adaptee.mouseWheelEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"multiline",{get:function(){return this._adaptee.multiline},set:function(t){this._adaptee.multiline=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"numLines",{get:function(){return this._adaptee.numLines},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"restrict",{get:function(){return this.adaptee.restrict},set:function(t){this.adaptee.restrict=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"scrollH",{get:function(){return this.adaptee.scrollH},set:function(t){this.adaptee.scrollH=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"scrollV",{get:function(){return this.adaptee.scrollV},set:function(t){this.adaptee.scrollV=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"selectable",{get:function(){return this.adaptee.selectable},set:function(t){this._adaptee.selectable=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"selectedText",{get:function(){return console.log("selectedText not implemented yet in flash/TextField"),""},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"selectionBeginIndex",{get:function(){return this.adaptee.selectionBeginIndex},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"selectionEndIndex",{get:function(){return this.adaptee.selectionEndIndex},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"sharpness",{get:function(){return console.log("sharpness not implemented yet in flash/TextField"),0},set:function(t){console.log("sharpness not implemented yet in flash/TextField")},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"styleSheet",{get:function(){return console.log("styleSheet not implemented yet in flash/TextField"),null},set:function(t){console.log("styleSheet not implemented yet in flash/TextField")},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"text",{get:function(){return this._adaptee.text},set:function(t){this._adaptee.text=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"textColor",{get:function(){return this._adaptee.textColor},set:function(t){this._adaptee.textColor=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"textHeight",{get:function(){return this._adaptee.textHeight},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"textInteractionMode",{get:function(){return console.log("textInteractionMode not implemented yet in flash/TextField"),""},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"textWidth",{get:function(){return this._adaptee.textWidth},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"thickness",{get:function(){return console.log("thickness not implemented yet in flash/TextField"),0},set:function(t){console.log("thickness not implemented yet in flash/TextField")},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"type",{get:function(){return this._adaptee.type},set:function(t){this._adaptee.type=t},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"useRichTextClipboard",{get:function(){return console.log("useRichTextClipboard not implemented yet in flash/TextField"),!1},set:function(t){console.log("useRichTextClipboard not implemented yet in flash/TextField")},enumerable:!0,configurable:!0}),Object.defineProperty(QVg.prototype,"wordWrap",{get:function(){return this._adaptee.wordWrap},set:function(t){this._adaptee.wordWrap=t},enumerable:!0,configurable:!0}),QVg.prototype.appendText=function(t){this._adaptee.appendText(t)},QVg.prototype.copyRichText=function(){return console.log("copyRichText not implemented yet in flash/TextField"),""},QVg.prototype.getCharBoundaries=function(t){return console.log("getCharBoundaries not implemented yet in flash/TextField"),null},QVg.prototype.getCharIndexAtPoint=function(t,e){return this._adaptee.getCharIndexAtPoint(t,e)},QVg.prototype.getFirstCharInParagraph=function(t){return this._adaptee.getFirstCharInParagraph(t)},QVg.prototype.getImageReference=function(t){return console.log("getImageReference not implemented yet in flash/TextField"),null},QVg.prototype.getLineIndexAtPoint=function(t,e){return this._adaptee.getLineIndexAtPoint(t,e)},QVg.prototype.getLineIndexOfChar=function(t){return this._adaptee.getLineIndexOfChar(t)},QVg.prototype.getLineLength=function(t){return this._adaptee.getLineLength(t)},QVg.prototype.getLineMetrics=function(t){var e=this._adaptee.getLineMetrics(t),i=e.x,n=e.width,r=e.height,o=e.ascent,s=e.descent,a=e.leading;return new this.sec.flash.text.TextLineMetrics(i,n,r,o,s,a)},QVg.prototype.getLineOffset=function(t){return this._adaptee.getLineOffset(t)},QVg.prototype.getLineText=function(t){return this._adaptee.getLineText(t)},QVg.prototype.getParagraphLength=function(t){return this._adaptee.getParagraphLength(t)},QVg.prototype.getRawText=function(){return console.log("getRawText not implemented yet in flash/TextField"),""},QVg.prototype.getTextFormat=function(t,e){return void 0===t&&(t=-1),void 0===e&&(e=-1),console.log("todo: textformats"),this._adaptee.getTextFormat(t,e).adapter},QVg.prototype.getTextRuns=function(t,e){return console.log("getTextRuns not implemented yet in flash/TextField"),[]},QVg.prototype.getXMLText=function(t,e){return console.log("getXMLText not implemented yet in flash/TextField"),""},QVg.prototype.insertXMLText=function(t,e,i,n){console.log("insertXMLText not implemented yet in flash/TextField")},QVg.isFontCompatible=function(t,e){return console.log("isFontCompatible not implemented yet in flash/TextField"),!1},QVg.prototype.pasteRichText=function(t){return console.log("pasteRichText not implemented yet in flash/TextField"),!1},QVg.prototype.replaceSelectedText=function(t){return this._adaptee.replaceSelectedText(t)},QVg.prototype.replaceText=function(t,e,i){return this._adaptee.replaceText(t,e,i)},QVg.prototype.setSelection=function(t,e){return this._adaptee.setSelection(t,e)},QVg.prototype.setTextFormat=function(t,e,i){void 0===e&&(e=-1),void 0===i&&(i=-1),this._adaptee.setTextFormat(t.adaptee,e,i)},QVg._textFields=new Array,QVg),TextFormat$1=(rXg=ASObject,__extends(sXg,rXg),Object.defineProperty(sXg.prototype,"target",{get:function(){return console.log("not implemented: TextFormat target"),null},set:function(t){console.log("not implemented: TextFormat target")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"tabStops",{get:function(){return console.log("not implemented: TextFormat tabStops"),null},set:function(t){console.log("not implemented: TextFormat tabStops")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"display",{get:function(){return console.log("not implemented: TextFormat display"),null},set:function(t){console.log("not implemented: TextFormat display")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"bullet",{get:function(){return console.log("not implemented: TextFormat bullet"),null},set:function(t){console.log("not implemented: TextFormat bullet")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"url",{get:function(){return console.log("not implemented: TextFormat url"),null},set:function(t){console.log("not implemented: TextFormat url")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"link_target",{get:function(){return console.log("not implemented: TextFormat link_target"),null},set:function(t){console.log("not implemented: TextFormat link_target")},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"align",{get:function(){return this.adaptee.align},set:function(t){this.adaptee.align=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"blockIndent",{get:function(){return this.adaptee.blockIndent},set:function(t){this.adaptee.blockIndent=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"leftMargin",{get:function(){return this.adaptee.leftMargin},set:function(t){this.adaptee.leftMargin=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"rightMargin",{get:function(){return this.adaptee.rightMargin},set:function(t){this.adaptee.rightMargin=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"indent",{get:function(){return this.adaptee.indent},set:function(t){this.adaptee.indent=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"color",{get:function(){return this.adaptee.color},set:function(t){this.adaptee.color=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"kerning",{get:function(){return this.adaptee.kerning},set:function(t){this.adaptee.kerning=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"leading",{get:function(){return this.adaptee.leading},set:function(t){this.adaptee.leading=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"letterSpacing",{get:function(){return this.adaptee.letterSpacing},set:function(t){this.adaptee.letterSpacing=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"size",{get:function(){return this.adaptee.size},set:function(t){this.adaptee.size=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"bold",{get:function(){return this.adaptee.bold},set:function(t){this.adaptee.bold=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"italic",{get:function(){return this.adaptee.italic},set:function(t){this.adaptee.italic=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"underline",{get:function(){return this.adaptee.underline},set:function(t){this.adaptee.underline=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"font_name",{get:function(){return this.adaptee.font_name},set:function(t){this.adaptee.font_name=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"style_name",{get:function(){return this.adaptee.style_name},set:function(t){this.adaptee.style_name=t},enumerable:!0,configurable:!0}),Object.defineProperty(sXg.prototype,"font",{get:function(){return this.adaptee.font},set:function(t){this.adaptee.font=t},enumerable:!0,configurable:!0}),sXg.prototype.clone=function(){var t=new this.sec.flash.text.TextFormat;return t.adaptee=this.adaptee.clone(),t},sXg),SoundChannel$1=(cYg=EventDispatcher$1,__extends(dYg,cYg),dYg.prototype.axCallPublicProperty=function(t,e){return null},dYg.prototype.axGetPublicProperty=function(t){return null},dYg.prototype.axSetPublicProperty=function(t,e){return null},dYg.prototype.axHasPublicProperty=function(t){return null},dYg.prototype.axDeletePublicProperty=function(t){return null},dYg.prototype.axGetEnumerableKeys=function(){return[]},Object.defineProperty(dYg.prototype,"leftPeak",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(dYg.prototype,"position",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(dYg.prototype,"rightPeak",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(dYg.prototype,"soundTransform",{get:function(){return this._soundTransform||(this._soundTransform=new this.sec.flash.media.SoundTransform),this._soundTransform},set:function(t){this._sound&&(this._sound.adaptee.volume=t.volume,this._sound.adaptee.pan=t.pan),this._soundTransform=t},enumerable:!0,configurable:!0}),dYg.prototype.stop=function(){this._sound&&this._sound.stop()},dYg),SoundTransform$1=(mYg=ASObject,__extends(nYg,mYg),nYg.prototype.axCallPublicProperty=function(t,e){return console.log("axCallPublicProperty not implemented yet in flash/SoundTransform"),null},nYg.prototype.axGetPublicProperty=function(t){return console.log("axGetPublicProperty not implemented yet in flash/SoundTransform"),null},nYg.prototype.axSetPublicProperty=function(t,e){return console.log("axSetPublicProperty not implemented yet in flash/SoundTransform"),null},nYg.prototype.axHasPublicProperty=function(t){return console.log("axHasPublicProperty not implemented yet in flash/SoundTransform"),null},nYg.prototype.axDeletePublicProperty=function(t){return console.log("axDeletePublicProperty not implemented yet in flash/SoundTransform"),null},nYg.prototype.axGetEnumerableKeys=function(){return console.log("axGetEnumerableKeys not implemented yet in flash/SoundTransform"),[]},Object.defineProperty(nYg.prototype,"leftToLeft",{get:function(){return console.log("leftToLeft not implemented yet in flash/SoundTransform"),0},set:function(t){console.log("leftToLeft not implemented yet in flash/SoundTransform")},enumerable:!0,configurable:!0}),Object.defineProperty(nYg.prototype,"leftToRight",{get:function(){return console.log("leftToRight not implemented yet in flash/SoundTransform"),0},set:function(t){console.log("leftToRight not implemented yet in flash/SoundTransform")},enumerable:!0,configurable:!0}),Object.defineProperty(nYg.prototype,"pan",{get:function(){return this._pan},set:function(t){this._pan=t},enumerable:!0,configurable:!0}),Object.defineProperty(nYg.prototype,"rightToLeft",{get:function(){return console.log("rightToLeft not implemented yet in flash/SoundTransform"),0},set:function(t){console.log("rightToLeft not implemented yet in flash/SoundTransform")},enumerable:!0,configurable:!0}),Object.defineProperty(nYg.prototype,"rightToRight",{get:function(){return console.log("rightToRight not implemented yet in flash/SoundTransform"),0},set:function(t){console.log("rightToRight not implemented yet in flash/SoundTransform")},enumerable:!0,configurable:!0}),Object.defineProperty(nYg.prototype,"volume",{get:function(){return this._vol},set:function(t){this._vol=t},enumerable:!0,configurable:!0}),nYg),_sharedObjectStorage,VirtualStorage=(EYg.prototype.getItem=function(t){return this._values[t]},EYg.prototype.setItem=function(t,e){this._values[t]=e},EYg.prototype.removeItem=function(t){delete this._values[t]},EYg),mYg,cYg,rXg,PVg,uVg,OTg,HTg,ZSg,QSg,_Rg,ERg,dQg,ePg,AOg,jOg,gNg,XMg,yLg,dLg,VKg,OKg,FKg,wKg,WJg,yJg,bJg,XIg,VIg,rIg,ZFg,EFg,cFg,TDg,mDg,cCg,oBg,YAg,xAg,cAg,Gzg;function EYg(){this._values={}}function nYg(t,e){var i=mYg.call(this)||this;return i._vol=1,i._pan=.5,i}function dYg(){return cYg.call(this)||this}function sXg(t,e,i,n,r,o,s,a,l,c,h,u,p){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=null),void 0===h&&(h=null),void 0===u&&(u=null),void 0===p&&(p=null);var d=rXg.call(this)||this;return d.adaptee=new TextFormat(t,e,i,n,r,o,s,a,l,c,h,u,p),d}function QVg(){var t=PVg.call(this)||this;return t.adaptee.autoSize=TextFieldAutoSize.NONE,t.eventMappingDummys[TextEvent.TEXT_INPUT]="TextField:TextEvent.TEXT_INPUT",t.eventMappingDummys[TextEvent.LINK]="TextField:TextEvent.LINK",t.eventMappingDummys[Event$1.SCROLL]="TextField:Event.SCROLL",t.eventMappingDummys[Event$1.CHANGE]="TextField:Event.CHANGE",t.eventMappingDummys[Event$1.TEXT_INTERACTION_MODE_CHANGE]="TextField:Event.TEXT_INTERACTION_MODE_CHANGE",t}function vVg(){var e=uVg.call(this)||this;return e._adaptee=new URLLoader,e._completeCallbackDelegate=function(t){return e.completeCallback(t)},e._progressCallbackDelegate=function(t){return e.progressCallback(t)},e._loadErrorDelegate=function(t){return e.loadErrorDelegate(t)},e.eventMapping[Event$1.COMPLETE]={adaptedType:URLLoaderEvent.LOAD_COMPLETE,addListener:e.initListener,removeListener:e.removeListener,callback:e._completeCallbackDelegate},e.eventMapping[ProgressEvent$1.PROGRESS]={adaptedType:URLLoaderEvent.LOAD_PROGRESS,addListener:e.initListener,removeListener:e.removeListener,callback:e._progressCallbackDelegate},e.eventMapping[IOErrorEvent.IO_ERROR]={adaptedType:URLLoaderEvent.LOAD_ERROR,addListener:e.initListener,removeListener:e.removeListener,callback:e._loadErrorDelegate},e}function PTg(t){void 0===t&&(t=null);var e=OTg.call(this)||this;return e._adaptee=t||new Graphics,e._adaptee.adapter=e}function ITg(){return HTg.call(this)||this}function $Sg(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=ZSg.call(this)||this;return r._adaptee=t instanceof Vector3D?t:new Vector3D(+t,+e,+i,+n),r}function RSg(t){var e=QSg.call(this)||this;return t||e.sec.throwError("ArgumentError",Errors$1.NullPointerError,"displayObject"),e._adaptee=t instanceof Transform?t:new Transform,e}function aSg(t,e,i,n){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=0);var r=_Rg.call(this)||this;return r._adaptee=t instanceof Rectangle?t:new Rectangle(+t,+e,+i,+n),r}function FRg(t,e){void 0===t&&(t=0),void 0===e&&(e=0);var i=ERg.call(this)||this;return i._adaptee=t instanceof Point?t:new Point(+t,+e),i}function eQg(t){void 0===t&&(t=null);var e=dQg.call(this)||this;return t instanceof Matrix3D?e._adaptee=t:(e._adaptee=new Matrix3D,t&&16<=t.length?e.copyRawDataFrom(t,0,!1):e.identity()),e}function fPg(t,e,i,n,r,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=0);var s=ePg.call(this)||this;return s._adaptee=t instanceof Matrix?t:new Matrix(+t,+e,+i,+n,+r,+o),s}function BOg(t,e,i,n,r,o,s,a){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0);var l=AOg.call(this)||this;return l._adaptee=t instanceof ColorTransform?t:new ColorTransform(+t,+e,+i,+n,+r,+o,+s,+a),l}function kOg(t,e,i,n){var r=jOg.call(this)||this;return r._adaptee.addButtonListeners(),r}function hNg(){var t=gNg.call(this)||this;return t.queuedNavigationAction=null,t}function YMg(t){void 0===t&&(t=null);var e=XMg.call(this)||this;return e._adaptee=new URLRequest(t),e}function zLg(){var e=yLg.call(this)||this;return e._stage3Ds=[],e._resizeCallbackDelegate=function(t){return e.resizeCallback(t)},window.addEventListener("resize",e._resizeCallbackDelegate),e.eventMapping[Event$1.RESIZE]={adaptedType:"",addListener:e.initResizeListener,removeListener:e.removeResizeListener,callback:e._resizeCallbackDelegate},e._mouseLeaveCallbackDelegate=function(t){return e.mouseLeaveCallback(t)},e.eventMapping[Event$1.MOUSE_LEAVE]={adaptedType:"",addListener:e.initMouseLeaveListener,removeListener:e.removeMouseLeaveListener,callback:e._mouseLeaveCallbackDelegate},((e.sec.flash.display.DisplayObject.axClass._activeStage=e)._stage=e)._resizeCallbackDelegate(null),e}function eLg(t,e){var i=dLg.call(this)||this;return i._bytesLoaded=0,i._bytesTotal=0,i.eventMappingExtern[Event$1.COMPLETE]="LoaderInfo:Event.COMPLETE",i.eventMappingExtern[ProgressEvent$1.PROGRESS]="LoaderInfo:ProgressEvent.PROGRESS",i.eventMappingDummys[Event$1.UNLOAD]="LoaderInfo:Event.UNLOAD",i.eventMappingDummys[IOErrorEvent.IO_ERROR]="LoaderInfo:IOErrorEvent.IO_ERROR",i.eventMappingDummys[Event$1.OPEN]="LoaderInfo:Event.OPEN",i.eventMappingDummys[Event$1.INIT]="LoaderInfo:Event.INIT",i._onLoaderStartDelegate=function(t){return i._onLoaderStart(t)},i._onLoadProgressDelegate=function(t){return i._onLoadProgress(t)},i._onLoaderCompleteDelegate=function(t){return i._onLoaderComplete(t)},i._loader=t,i._container=e,i._container.addEventListener(LoaderEvent.LOADER_START,i._onLoaderStartDelegate),i._container.addEventListener(URLLoaderEvent.LOAD_PROGRESS,i._onLoadProgressDelegate),i._container.addEventListener(LoaderEvent.LOADER_COMPLETE,i._onLoaderCompleteDelegate),i}function WKg(t,e,i,n,r){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=0);var o=VKg.call(this,t,e,i)||this;return o._bytesLoaded=n,o._bytesTotal=r,o}function PKg(t,e,i,n,r){return void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=""),void 0===r&&(r=0),OKg.call(this,t,e,i,n,r)||this}function GKg(t,e,i,n,r){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=""),void 0===r&&(r=0);var o=FKg.call(this,t,e,i,n)||this;return o.setID(r),o}function xKg(t,e,i,n){var r=wKg.call(this,t,e,i)||this;return r._text=n,r}function XJg(){var t=WJg.call(this)||this;return t._contentLoaderInfo=new t.sec.flash.display.LoaderInfo(t,t.adaptee),t._factory=new FlashSceneGraphFactory(t.sec),t}function zJg(t,e){void 0===t&&(t=null),void 0===e&&(e=!1);var i=yJg.call(this)||this;return e||null!=t||null==zJg._currentDomain||(t=zJg.getSystemDomain()),(zJg._currentDomain=i)._parentDomain=t,i._definitions={},i._font_definitions={},i._audio_definitions={},i}function cJg(t,e){var i=bJg.call(this)||this;return i.loopsToPlay=0,i}function YIg(t,e,i){void 0===t&&(t=!1),void 0===e&&(e=null),void 0===i&&(i=null);var n=XIg.call(this)||this;return n.checkPolicyFile=t,n.applicationDomain=e,n.securityDomain=i,n}function WIg(){return VIg.call(this)||this}function sIg(t){var e=rIg.call(this)||this;return e.imageStore={},e._sec=t,e}function $Fg(t,e,i,n){void 0===i&&(i=!0),void 0===n&&(n=4294967295);var r=ZFg.call(this)||this;return r._owners=new Array,r._adaptee="number"==typeof t?r._adaptee||new SceneImage2D(t,e,i,n,!1,StageManager.getInstance().getStageAt(0)):t,r._adaptee.adapter=r}function FFg(t,e,i){void 0===t&&(t=null),void 0===e&&(e="auto"),void 0===i&&(i=!1);var n=this,r=new MethodMaterial(t?t.adaptee:0);return r.alphaBlending=!0,r.useColorTransform=!0,FFg.argBitmapMaterial=r,FFg.argPixelSnapping=e,FFg.argSmoothing=i,n=EFg.call(this)||this,t&&!n._bitmapMappedFromAsset&&(n._bitmapData=t,n._bitmapData&&n._bitmapData._addOwner(n)),n}function dFg(){var e=cFg.call(this)||this;return e.isDragging=!1,e.startDragPoint=new Point,e.startDragMCPosition=new Point,e.dragListenerDelegate=function(t){return e.dragListener(t)},e.stopDragDelegate=function(t){return e.stopDrag(t)},e._graphics=new e.sec.flash.display.Graphics(e._adaptee.graphics),e}function UDg(){return TDg.call(this)||this}function nDg(){var e=mDg.call(this)||this;return e._keyDownListenersCnt=0,e._keyUpListenersCnt=0,e.eventMappingDummys[MouseEvent$2.RIGHT_MOUSE_UP]="InteractiveObject:MouseEvent.RIGHT_MOUSE_UP",e.eventMappingDummys[MouseEvent$2.RIGHT_MOUSE_DOWN]="InteractiveObject:MouseEvent.RIGHT_MOUSE_DOWN",e.eventMappingDummys[MouseEvent$2.RIGHT_MOUSE_DOWN]="InteractiveObject:MouseEvent.RIGHT_MOUSE_DOWN",e.eventMappingDummys[MouseEvent$2.RIGHT_CLICK]="InteractiveObject:MouseEvent.RIGHT_CLICK",e.eventMappingDummys[MouseEvent$2.MIDDLE_MOUSE_UP]="InteractiveObject:MouseEvent.MIDDLE_MOUSE_UP",e.eventMappingDummys[MouseEvent$2.MIDDLE_MOUSE_DOWN]="InteractiveObject:MouseEvent.MIDDLE_MOUSE_DOWN",e.eventMappingDummys[MouseEvent$2.MIDDLE_CLICK]="InteractiveObject:MouseEvent.MIDDLE_CLICK",e._keyDownListenersCnt=0,e._keyUpListenersCnt=0,e._keyUpCallbackDelegate=function(t){return e.keyUpCallback(t)},e.eventMapping[KeyboardEvent$2.KEY_UP]={adaptedType:"",addListener:e.initKeyUpListener,removeListener:e.removeKeyUpListener,callback:e._keyUpCallbackDelegate},e._keyDownCallbackDelegate=function(t){return e.keyDownCallback(t)},e.eventMapping[KeyboardEvent$2.KEY_DOWN]={adaptedType:"",addListener:e.initKeyDownListener,removeListener:e.removeKeyDownListener,callback:e._keyDownCallbackDelegate},e._mouseCallbackDelegate=function(t){return e.mouseCallback(t)},e.eventMappingInvert[MouseEvent$1.MOUSE_WHEEL]=MouseEvent$2.MOUSE_WHEEL,e.eventMapping[MouseEvent$2.MOUSE_WHEEL]={adaptedType:MouseEvent$1.MOUSE_WHEEL,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.MOUSE_UP]=MouseEvent$2.MOUSE_UP,e.eventMapping[MouseEvent$2.MOUSE_UP]={adaptedType:MouseEvent$1.MOUSE_UP,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.MOUSE_OVER]=MouseEvent$2.MOUSE_OVER,e.eventMapping[MouseEvent$2.MOUSE_OVER]={adaptedType:MouseEvent$1.MOUSE_OVER,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.MOUSE_OUT]=MouseEvent$2.MOUSE_OUT,e.eventMapping[MouseEvent$2.MOUSE_OUT]={adaptedType:MouseEvent$1.MOUSE_OUT,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.MOUSE_MOVE]=MouseEvent$2.MOUSE_MOVE,e.eventMapping[MouseEvent$2.MOUSE_MOVE]={adaptedType:MouseEvent$1.MOUSE_MOVE,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.MOUSE_DOWN]=MouseEvent$2.MOUSE_DOWN,e.eventMapping[MouseEvent$2.MOUSE_DOWN]={adaptedType:MouseEvent$1.MOUSE_DOWN,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.DOUBLE_CLICK]=MouseEvent$2.DOUBLE_CLICK,e.eventMapping[MouseEvent$2.DOUBLE_CLICK]={adaptedType:MouseEvent$1.DOUBLE_CLICK,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.CLICK]=MouseEvent$2.CLICK,e.eventMapping[MouseEvent$2.CLICK]={adaptedType:MouseEvent$1.CLICK,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.ROLL_OUT]=MouseEvent$2.ROLL_OUT,e.eventMapping[MouseEvent$2.ROLL_OUT]={adaptedType:MouseEvent$1.ROLL_OUT,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e.eventMappingInvert[MouseEvent$1.ROLL_OVER]=MouseEvent$2.ROLL_OVER,e.eventMapping[MouseEvent$2.ROLL_OVER]={adaptedType:MouseEvent$1.ROLL_OVER,addListener:e.initMouseListener,removeListener:e.removeMouseListener,callback:e._mouseCallbackDelegate},e}function dCg(){var t=cCg.call(this)||this;return t._filters=t._filters||[],t._blockedByScript=!1,t._ctBlockedByScript=!1,t._visibilityByScript=!1,t.adaptee=t.adaptee||t.createAdaptee(),t.adaptee.mouseEnabled=!0,t._stage=t.activeStage,t.eventMappingExtern[Event$1.ENTER_FRAME]="",t.eventMappingExtern[Event$1.FRAME_CONSTRUCTED]="",t.eventMappingExtern[Event$1.EXIT_FRAME]="",t.eventMappingExtern[Event$1.RENDER]="",t.eventMappingExtern[Event$1.REMOVED_FROM_STAGE]="",t.eventMappingExtern[Event$1.REMOVED]="",t.eventMappingExtern[Event$1.ADDED_TO_STAGE]="",t.eventMappingExtern[Event$1.ADDED]="",t._transform=new t.sec.flash.geom.Transform(t.adaptee.transform),t}function bCg(){}function OBg(){this.reset()}function pBg(t){void 0===t&&(t=null);var e=oBg.call(this,t)||this;return e.eventMapping={},e.eventMappingDummys={},e.eventMappingExtern={},e.eventMappingInvert={},e._activateCallbackDelegate=function(t){return e.activateCallback(t)},e.eventMapping[Event$1.ACTIVATE]={adaptedType:"",addListener:e.initActivateListener,removeListener:e.removeActivateListener,callback:e._activateCallbackDelegate},e._deactivateCallbackDelegate=function(t){return e.deactivateCallback(t)},e.eventMapping[Event$1.DEACTIVATE]={adaptedType:"",addListener:e.initDeactivateListener,removeListener:e.removeDeactivateListener,callback:e._deactivateCallbackDelegate},e}function ZAg(t,e,i,n,r,o,s,a,l){void 0===e&&(e=!0),void 0===i&&(i=!1),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===l&&(l=!1);var c=YAg.call(this,t,e,i)||this;return c._charCode=n>>>0,c._keyCode=r>>>0,c._keyLocation=o>>>0,c._ctrlKey=!!s,c._altKey=!!a,c._shiftKey=!!l,c}function yAg(t,e,i,n,r,o,s,a,l,c,h){void 0===e&&(e=!0),void 0===i&&(i=!1),void 0===n&&(n=void 0),void 0===r&&(r=void 0),void 0===o&&(o=null),void 0===s&&(s=!1),void 0===a&&(a=!1),void 0===l&&(l=!1),void 0===c&&(c=!1),void 0===h&&(h=0);var u=xAg.call(this,t,e,i)||this;return u._localX=n,u._localY=r,u._relatedObject=o,u._ctrlKey=s,u._altKey=a,u._shiftKey=l,u._buttonDown=c,u._delta=h,u}function qAg(){this._index=0,this._listeners=new Array,this.numListeners=0}function dAg(t){void 0===t&&(t=null);var e=cAg.call(this)||this;return e._listenerObjects=new Array,e._t=t||e,e}function Hzg(t,e,i){void 0===e&&(e=!0),void 0===i&&(i=!0);var n=Gzg.call(this)||this;return n._iAllowedToPropagate=!0,n._iAllowedToImmediatlyPropagate=!0,n._type=axCoerceString(t),n._bubbles=!!e,n._cancelable=!!i,n._target=null,n._currentTarget=null,n._eventPhase=null,n._stopPropagation=!1,n._stopImmediatePropagation=!1,n._isDefaultPrevented=!1,n}function getSharedObjectStorage(){if("undefined"!=typeof Storage&&!_sharedObjectStorage)try{_sharedObjectStorage=window.localStorage}catch(t){console.warn("[Shared Storage] ",t),_sharedObjectStorage=new VirtualStorage}return _sharedObjectStorage}var SharedObject=(KYg=ASObject,__extends(LYg,KYg),Object.defineProperty(LYg,"defaultObjectEncoding",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),LYg.deleteAll=function(t){},LYg.getDiskUsage=function(t){return 0},LYg.getLocal=function(t,e,i){t=axCoerceString$2(t);var n,r=((e=axCoerceString$2(e))||"")+"/"+t,o=getSharedObjectStorage().getItem(r),s=this._defaultObjectEncoding;if(o){try{var a=StringUtilities.decodeRestrictedBase64ToBytes(o),l=new ByteArray(a.length);l.sec=this.sec,l.setArrayBuffer(a.buffer),n=AMF3.read(l)}catch(t){}n&&"object"==typeof n||(n=this.sec.createObject())}else n=this.sec.createObject();var c=new this.sec.flash.net.SharedObject;return c._path=r,c._objectEncoding=s,c._data=n,c},LYg.getRemote=function(t,e,i,n){return new this.sec.flash.net.SharedObject},LYg.prototype.flush=function(t){var e,i,n,r=!0;for(var o in this._data)if(this._data.hasOwnProperty(o)){r=!1;break}r&&!getSharedObjectStorage().getItem(this._path)||((e=new ByteArray).sec=this.sec,AMF3.write(e,this._data),i=new Uint8Array(e.arraybytes),n=StringUtilities.base64EncodeBytes(i),getSharedObjectStorage().setItem(this._path,n))},Object.defineProperty(LYg.prototype,"data",{get:function(){return this._data},set:function(t){this._data=t},enumerable:!0,configurable:!0}),Object.defineProperty(LYg.prototype,"objectEncoding",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(LYg.prototype,"client",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),LYg.prototype.setDirty=function(t){},LYg.prototype.connect=function(t,e){},LYg.prototype.send=function(){},LYg.prototype.close=function(){},LYg.prototype.clear=function(){},Object.defineProperty(LYg.prototype,"size",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(LYg.prototype,"fps",{set:function(t){},enumerable:!0,configurable:!0}),LYg.prototype.setProperty=function(t,e){},LYg._defaultObjectEncoding=ObjectEncoding.DEFAULT,LYg),SecurityDomain$1=(qZg=ASObject,__extends(rZg,qZg),Object.defineProperty(rZg,"currentDomain",{get:function(){return null},enumerable:!0,configurable:!0}),rZg),qZg,KYg;function rZg(){return null!==qZg&&qZg.apply(this,arguments)||this}function LYg(){return KYg.call(this)||this}function fscommand$1(t,e,i){e=axCoerceString$2(e),i=axCoerceString$2(i),console.log("FSCommand: "+e+"; "+i),"debugger"!==(e=e.toLowerCase())&&t.player.executeFSCommand(e,i)}var Security$1=(vZg=ASObject,__extends(wZg,vZg),Object.defineProperty(wZg,"exactSettings",{get:function(){return wZg._exactSettings},set:function(t){wZg._exactSettings=t=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(wZg,"disableAVM1Loading",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(wZg,"sandboxType",{get:function(){return wZg._sandboxType},enumerable:!0,configurable:!0}),Object.defineProperty(wZg,"pageDomain",{get:function(){var t=FileLoadingService.resolveUrl("/").split("/");return t.pop(),t.pop()},enumerable:!0,configurable:!0}),wZg.allowDomain=function(){},wZg.allowInsecureDomain=function(){},wZg.loadPolicyFile=function(t){},wZg.showSettings=function(t){},wZg.duplicateSandboxBridgeInputArguments=function(t,e){},wZg.duplicateSandboxBridgeOutputArgument=function(t,e){},wZg.classInitializer=null,wZg.classSymbols=null,wZg.instanceSymbols=null,wZg.REMOTE="remote",wZg.LOCAL_WITH_FILE="localWithFile",wZg.LOCAL_WITH_NETWORK="localWithNetwork",wZg.LOCAL_TRUSTED="localTrusted",wZg.APPLICATION="application",wZg._exactSettings=!1,wZg._sandboxType="remote",wZg),Scene$1=(GZg=ASObject,__extends(HZg,GZg),Object.defineProperty(HZg.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(HZg.prototype,"labels",{get:function(){return this._labels},enumerable:!0,configurable:!0}),Object.defineProperty(HZg.prototype,"numFrames",{get:function(){return this._numFrames},enumerable:!0,configurable:!0}),HZg.prototype.clone=function(){var t=this._labels.value.map(function(t){return t.clone()});return new HZg(this._name,this.sec.createArrayUnsafe(t),this.offset,this._numFrames)},HZg.prototype.getLabelByName=function(t,e){e&&(t=t.toLowerCase());for(var i=this._labels.value,n=0;n<i.length;n++){var r=i[n];if(e?r.name.toLowerCase()===t:r.name===t)return r}return null},HZg.prototype.getLabelByFrame=function(t){for(var e=this._labels.value,i=0;i<e.length;i++){var n=e[i];if(n.frame===t)return n}return null},HZg.classInitializer=null,HZg.classSymbols=null,HZg.instanceSymbols=null,HZg),Keyboard=(YZg=ASObject,__extends(ZZg,YZg),Object.defineProperty(ZZg,"capsLock",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(ZZg,"numLock",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(ZZg,"hasVirtualKeyboard",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(ZZg,"physicalKeyboardType",{get:function(){},enumerable:!0,configurable:!0}),ZZg.isAccessible=function(){},ZZg.classInitializer=null,ZZg.classSymbols=null,ZZg.instanceSymbols=null,ZZg),BitmapFilter=($Zg=ASObject,__extends(_Zg,$Zg),_Zg._updateBlurBounds=function(t,e,i,n,r){void 0===r&&(r=!1);var o,s=_Zg.blurFilterStepWidths[n-1];r&&(e-=o=s/4,i-=o);var a=Math.ceil((e<1?1:e)*s),l=Math.ceil((i<1?1:i)*s);t.inflate(a,l)},_Zg.prototype._updateFilterBounds=function(t){},_Zg.prototype._serialize=function(t){t.writeInt(-1)},_Zg.prototype.clone=function(){return null},_Zg.classInitializer=null,_Zg.EPS=1e-9,_Zg.blurFilterStepWidths=[.5,1.05,1.35,1.55,1.75,1.9,2,2.1,2.2,2.3,2.5,3,3,3.5,3.5],_Zg),GradientArrays=(l$g.sanitize=function(t,e,i){var n;isNullOrUndefined$1(t)||0===t.length?(this.colors=[],this.alphas=[],this.ratios=[]):isNullOrUndefined$1(i)?(this.colors=this.sanitizeColors(t),n=this.colors.length,this.ratios=this.initArray(n),isNullOrUndefined$1(e)?this.alphas=this.initArray(n):this.alphas=this.sanitizeAlphas(e,n,n,1)):0===i.length?(this.colors=[],this.alphas=[],this.ratios=[]):(n=Math.min(t.length,i.length,16),this.colors=this.sanitizeColors(t,n),this.ratios=this.sanitizeRatios(i,n),isNullOrUndefined$1(e)?this.alphas=this.initArray(n):this.alphas=this.sanitizeAlphas(e,n,n,1))},l$g.sanitizeColors=function(t,e){void 0===e&&(e=16);for(var i=[],n=0,r=Math.min(t.length,e);n<r;n++)i[n]=t[n]>>>0&16777215;return i},l$g.sanitizeAlphas=function(t,e,i,n){void 0===e&&(e=16),void 0===i&&(i=0),void 0===n&&(n=0);for(var r=[],o=0,s=Math.min(t.length,e);o<s;o++)r[o]=NumberUtilities.clamp(+t[o],0,1);for(;o<i;)r[o++]=n;return r},l$g.sanitizeRatios=function(t,e,i,n){void 0===e&&(e=16),void 0===i&&(i=0),void 0===n&&(n=0);for(var r=[],o=0,s=Math.min(t.length,e);o<s;o++)r[o]=NumberUtilities.clamp(+t[o],0,255);for(;o<i;)r[o++]=n;return r},l$g.initArray=function(t,e){void 0===e&&(e=0);for(var i=Array(t),n=0;n<t;n++)i[n]=e;return i},l$g),BitmapFilterType=(N$g=ASObject,__extends(O$g,N$g),O$g.classInitializer=null,O$g.classSymbols=null,O$g.instanceSymbols=null,O$g.INNER="inner",O$g.OUTER="outer",O$g.FULL="full",O$g),BevelFilter=(P$g=BitmapFilter,__extends(Q$g,P$g),Q$g.FromUntyped=function(t){var e=t.colors[0]>>>8,i=(255&t.colors[0])/255,n=t.colors[1]>>>8,r=(255&t.colors[1])/255,o=BitmapFilterType.OUTER;t.onTop?o=BitmapFilterType.FULL:t.inner&&(o=BitmapFilterType.INNER);var s=180*t.angle/Math.PI;return new Q$g(t.distance,s,e,i,n,r,t.blurX,t.blurY,t.strength,t.quality,o,t.knockout)},Q$g.prototype._updateFilterBounds=function(t){var e;this.type!==BitmapFilterType.INNER&&(BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality),0!==this._distance)&&(e=this._angle*Math.PI/180,t.x+=Math.floor(Math.cos(e)*this._distance),t.y+=Math.floor(Math.sin(e)*this._distance),0<t.left&&(t.left=0),0<t.top&&(t.top=0))},Object.defineProperty(Q$g.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=+t},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=+t%360},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"highlightColor",{get:function(){return this._highlightColor},set:function(t){this._highlightColor=t>>>0&16777215},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"highlightAlpha",{get:function(){return this._highlightAlpha},set:function(t){this._highlightAlpha=NumberUtilities.clamp(+t,0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"shadowColor",{get:function(){return this._shadowColor},set:function(t){this._shadowColor=t>>>0&16777215},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"shadowAlpha",{get:function(){return this._shadowAlpha},set:function(t){this._shadowAlpha=NumberUtilities.clamp(+t,0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"knockout",{get:function(){return this._knockout},set:function(t){this._knockout=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Q$g.prototype,"type",{get:function(){return this._type},set:function(t){null===(t=axCoerceString$2(t))?this.sec.throwError("TypeError",Errors$1.NullPointerError,"type"):t===BitmapFilterType.INNER||t===BitmapFilterType.OUTER?this._type=t:this._type=BitmapFilterType.FULL},enumerable:!0,configurable:!0}),Q$g.prototype.clone=function(){return new Q$g(this._distance,this._angle,this._highlightColor,this._highlightAlpha,this._shadowColor,this._shadowAlpha,this._blurX,this._blurY,this._strength,this._quality,this._type,this._knockout)},Q$g.classInitializer=null,Q$g.classSymbols=null,Q$g.instanceSymbols=null,Q$g),BlurFilter=(x_g=BitmapFilter,__extends(y_g,x_g),y_g.FromUntyped=function(t){return new y_g(t.blurX,t.blurY,t.quality)},y_g.prototype._updateFilterBounds=function(t){BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality,!0)},y_g.prototype._serialize=function(t){t.ensureAdditionalCapacity(16),t.writeIntUnsafe(1),t.writeFloatUnsafe(this._blurX),t.writeFloatUnsafe(this._blurY),t.writeIntUnsafe(this._quality)},Object.defineProperty(y_g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(y_g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(y_g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),y_g.prototype.clone=function(){return new y_g(this._blurX,this._blurY,this._quality)},y_g.classInitializer=null,y_g.classSymbols=null,y_g.instanceSymbols=null,y_g),ColorMatrixFilter=(J_g=BitmapFilter,__extends(K_g,J_g),K_g.FromUntyped=function(t){var e=Object.create(K_g.axClass.tPrototype);return e._matrix=t.matrix,e},K_g.prototype._serialize=function(t){var e=this._matrix;t.ensureAdditionalCapacity(4*(e.length+1)),t.writeIntUnsafe(6);for(var i=0;i<e.length;i++)t.writeFloatUnsafe(e[i])},Object.defineProperty(K_g.prototype,"matrix",{get:function(){return this.sec.createArrayUnsafe(this._matrix.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"matrix");for(var e=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=t.value,n=0,r=Math.min(i.length,20);n<r;n++)e[n]=toNumber(i[n]);this._matrix=e},enumerable:!0,configurable:!0}),K_g.prototype.clone=function(){return new K_g(this.matrix)},K_g.classInitializer=null,K_g),ConvolutionFilter=(X_g=BitmapFilter,__extends(Y_g,X_g),Y_g.FromUntyped=function(t){return new Y_g(t.matrixX,t.matrixY,t.matrix,t.divisor,t.bias,t.preserveAlpha,t.clamp,t.color>>>8,(255&t.color)/255)},Y_g.prototype._expandArray=function(t,e,i){if(t)for(var n=t.length;n<e;)t[n++]=0;return t},Object.defineProperty(Y_g.prototype,"matrix",{get:function(){return this.sec.createArrayUnsafe(this._matrix.slice(0,this._matrixX*this._matrixY))},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"matrix");for(var e=t.value,i=this._matrixX*this._matrixY,n=Math.min(e.length,i),r=Array(n),o=0;o<n;o++)r[o]=toNumber(e[o]);this._expandArray(r,i),this._matrix=r},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"matrixX",{get:function(){return this._matrixX},set:function(t){var e=0|NumberUtilities.clamp(+t,0,15);this._matrixX!==e&&(this._matrixX=e,this._expandArray(this._matrix,e*this._matrixY))},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"matrixY",{get:function(){return this._matrixY},set:function(t){var e=0|NumberUtilities.clamp(+t,0,15);this._matrixY!==e&&(this._matrixY=e,this._expandArray(this._matrix,e*this._matrixX))},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"divisor",{get:function(){return this._divisor},set:function(t){this._divisor=+t},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"bias",{get:function(){return this._bias},set:function(t){this._bias=+t},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"preserveAlpha",{get:function(){return this._preserveAlpha},set:function(t){this._preserveAlpha=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"clamp",{get:function(){return this._clamp},set:function(t){this._clamp=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(Y_g.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=NumberUtilities.clamp(+t,0,1)},enumerable:!0,configurable:!0}),Y_g.prototype.clone=function(){return new Y_g(this._matrixX,this._matrixY,this.matrix,this._divisor,this._bias,this._preserveAlpha,this._clamp,this._color,this._alpha)},Y_g.classInitializer=null,Y_g),DisplacementMapFilter=(C0g=BitmapFilter,__extends(D0g,C0g),D0g.FromUntyped=function(t){return new D0g(t.mapBitmap,t.mapPoint,t.componentX,t.componentY,t.scaleX,t.scaleY,t.mode,t.color,t.alpha)},Object.defineProperty(D0g.prototype,"mapBitmap",{get:function(){return this._mapBitmap},set:function(t){this._mapBitmap=t},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"mapPoint",{get:function(){return this._mapPoint},set:function(t){this._mapPoint=t},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"componentX",{get:function(){return this._componentX},set:function(t){this._componentX=t>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"componentY",{get:function(){return this._componentY},set:function(t){this._componentY=t>>>0},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX=+t},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY=+t},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"mode",{get:function(){return this._mode},set:function(t){this._mode=axCoerceString$2(t)},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t>>>0&16777215},enumerable:!0,configurable:!0}),Object.defineProperty(D0g.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=+t},enumerable:!0,configurable:!0}),D0g.prototype.clone=function(){return new D0g(this._mapBitmap,this._mapPoint,this._componentX,this._componentY,this._scaleX,this._scaleY,this._mode,this._color,this._alpha)},D0g.classInitializer=null,D0g.classSymbols=null,D0g.instanceSymbols=null,D0g),DropShadowFilter=(Y0g=BitmapFilter,__extends(Z0g,Y0g),Z0g.FromUntyped=function(t){var e=t.colors[0]>>>8,i=(255&t.colors[0])/255,n=180*t.angle/Math.PI,r=!t.compositeSource;return new Z0g(t.distance,n,e,i,t.blurX,t.blurY,t.strength,t.quality,t.inner,t.knockout,r)},Z0g.prototype._updateFilterBounds=function(t){var e;this.inner||(BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality),0===this._distance)||(e=this._angle*Math.PI/180,t.x+=Math.floor(Math.cos(e)*this._distance),t.y+=Math.floor(Math.sin(e)*this._distance),0<t.left&&(t.left=0),0<t.top&&(t.top=0))},Object.defineProperty(Z0g.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=+t},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=+t%360},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t>>>0&16777215},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=NumberUtilities.clamp(+t,0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"hideObject",{get:function(){return this._hideObject},set:function(t){this._hideObject=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"inner",{get:function(){return this._inner},set:function(t){this._inner=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"knockout",{get:function(){return this._knockout},set:function(t){this._knockout=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),Object.defineProperty(Z0g.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Z0g.prototype.clone=function(){return new Z0g(this._distance,this._angle,this._color,this._alpha,this._blurX,this._blurY,this._strength,this._quality,this._inner,this._knockout,this._hideObject)},Z0g.classInitializer=null,Z0g.classSymbols=null,Z0g.instanceSymbols=null,Z0g),GlowFilter=(C1g=BitmapFilter,__extends(D1g,C1g),D1g.FromUntyped=function(t){return new D1g(t.colors[0]>>>8,(255&t.colors[0])/255,t.blurX,t.blurY,t.strength,t.quality,t.inner,t.knockout)},D1g.prototype._updateFilterBounds=function(t){BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality)},Object.defineProperty(D1g.prototype,"color",{get:function(){return this._color},set:function(t){this._color=t>>>0&16777215},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha=NumberUtilities.clamp(+t,0,1)},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"inner",{get:function(){return this._inner},set:function(t){this._inner=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"knockout",{get:function(){return this._knockout},set:function(t){this._knockout=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),Object.defineProperty(D1g.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),D1g.prototype.clone=function(){return new D1g(this._color,this._alpha,this._blurX,this._blurY,this._strength,this._quality,this._inner,this._knockout)},D1g.classInitializer=null,D1g.classSymbols=null,D1g.instanceSymbols=null,D1g),GradientBevelFilter=(X1g=BitmapFilter,__extends(Y1g,X1g),Y1g.FromUntyped=function(t){for(var e=[],i=[],n=0;n<t.colors.length;n++){var r=t.colors[n];e.push(r>>>8),i.push(255&r)}var o=BitmapFilterType.OUTER;t.onTop?o=BitmapFilterType.FULL:t.inner&&(o=BitmapFilterType.INNER);var s=180*t.angle/Math.PI;return new Y1g(t.distance,s,this.sec.createArrayUnsafe(e),this.sec.createArrayUnsafe(i),this.sec.createArrayUnsafe(t.ratios),t.blurX,t.blurY,t.strength,t.quality,o,t.knockout)},Y1g.prototype._updateFilterBounds=function(t){var e;this.type!==BitmapFilterType.INNER&&(BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality),0!==this._distance)&&(e=this._angle*Math.PI/180,t.x+=Math.floor(Math.cos(e)*this._distance),t.y+=Math.floor(Math.sin(e)*this._distance),0<t.left&&(t.left=0),0<t.top&&(t.top=0))},Object.defineProperty(Y1g.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=+t},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=+t%360},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"colors",{get:function(){return this.sec.createArrayUnsafe(this._colors.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"colors"),this._colors=GradientArrays.sanitizeColors(t.value);var e=this._colors.length;this._alphas=GradientArrays.sanitizeAlphas(this._alphas,e,e),this._ratios=GradientArrays.sanitizeRatios(this._ratios,e,e)},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"alphas",{get:function(){return this.sec.createArrayUnsafe(this._alphas.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"alphas"),GradientArrays.sanitize(this._colors,t.value,this._ratios),this._colors=GradientArrays.colors,this._alphas=GradientArrays.alphas,this._ratios=GradientArrays.ratios},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"ratios",{get:function(){return this.sec.createArrayUnsafe(this._ratios.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"ratios"),GradientArrays.sanitize(this._colors,this._alphas,t.value),this._colors=GradientArrays.colors,this._alphas=GradientArrays.alphas,this._ratios=GradientArrays.ratios},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"knockout",{get:function(){return this._knockout},set:function(t){this._knockout=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(Y1g.prototype,"type",{get:function(){return this._type},set:function(t){null===(t=axCoerceString$2(t))?this.sec.throwError("TypeError",Errors$1.NullPointerError,"type"):t===BitmapFilterType.INNER||t===BitmapFilterType.OUTER?this._type=t:this._type=BitmapFilterType.FULL},enumerable:!0,configurable:!0}),Y1g.prototype.clone=function(){return new Y1g(this._distance,this._angle,this.colors,this.alphas,this.ratios,this._blurX,this._blurY,this._strength,this._quality,this._type,this._knockout)},Y1g.classInitializer=null,Y1g.classSymbols=null,Y1g.instanceSymbols=null,Y1g),GradientGlowFilter=(E2g=BitmapFilter,__extends(F2g,E2g),F2g.FromUntyped=function(t){for(var e=[],i=[],n=0;n<t.colors.length;n++){var r=t.colors[n];e.push(r>>>8),i.push(255&r)}var o=BitmapFilterType.OUTER;t.onTop?o=BitmapFilterType.FULL:t.inner&&(o=BitmapFilterType.INNER);var s=180*t.angle/Math.PI;return new F2g(t.distance,s,this.sec.createArrayUnsafe(e),this.sec.createArrayUnsafe(i),this.sec.createArrayUnsafe(t.ratios),t.blurX,t.blurY,t.strength,t.quality,o,t.knockout)},F2g.prototype._updateFilterBounds=function(t){var e;this.type!==BitmapFilterType.INNER&&(BitmapFilter._updateBlurBounds(t,this._blurX,this._blurY,this._quality),0!==this._distance)&&(e=this._angle*Math.PI/180,t.x+=Math.floor(Math.cos(e)*this._distance),t.y+=Math.floor(Math.sin(e)*this._distance),0<t.left&&(t.left=0),0<t.top&&(t.top=0))},Object.defineProperty(F2g.prototype,"distance",{get:function(){return this._distance},set:function(t){this._distance=+t},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"angle",{get:function(){return this._angle},set:function(t){this._angle=+t%360},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"colors",{get:function(){return this.sec.createArrayUnsafe(this._colors.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"colors"),this._colors=GradientArrays.sanitizeColors(t.value);var e=this._colors.length;this._alphas=GradientArrays.sanitizeAlphas(this._alphas,e,e),this._ratios=GradientArrays.sanitizeRatios(this._ratios,e,e)},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"alphas",{get:function(){return this.sec.createArrayUnsafe(this._alphas.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"alphas"),GradientArrays.sanitize(this._colors,t.value,this._ratios),this._colors=GradientArrays.colors,this._alphas=GradientArrays.alphas,this._ratios=GradientArrays.ratios},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"ratios",{get:function(){return this.sec.createArrayUnsafe(this._ratios.concat())},set:function(t){isNullOrUndefined$1(t)&&this.sec.throwError("TypeError",Errors$1.NullPointerError,"ratios"),GradientArrays.sanitize(this._colors,this._alphas,t.value),this._colors=GradientArrays.colors,this._alphas=GradientArrays.alphas,this._ratios=GradientArrays.ratios},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"blurX",{get:function(){return this._blurX},set:function(t){this._blurX=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"blurY",{get:function(){return this._blurY},set:function(t){this._blurY=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"knockout",{get:function(){return this._knockout},set:function(t){this._knockout=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=NumberUtilities.clamp(0|t,0,15)},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"strength",{get:function(){return this._strength},set:function(t){this._strength=NumberUtilities.clamp(+t,0,255)},enumerable:!0,configurable:!0}),Object.defineProperty(F2g.prototype,"type",{get:function(){return this._type},set:function(t){null===(t=axCoerceString$2(t))?this.sec.throwError("TypeError",Errors$1.NullPointerError,"type"):t===BitmapFilterType.INNER||t===BitmapFilterType.OUTER?this._type=t:this._type=BitmapFilterType.FULL},enumerable:!0,configurable:!0}),F2g.prototype.clone=function(){return new F2g(this._distance,this._angle,this.colors,this.alphas,this.ratios,this._blurX,this._blurY,this._strength,this._quality,this._type,this._knockout)},F2g.classInitializer=null,F2g),TouchscreenType=(l3g=ASObject,__extends(m3g,l3g),m3g.classInitializer=null,m3g.classSymbols=null,m3g.instanceSymbols=null,m3g.FINGER="finger",m3g.STYLUS="stylus",m3g.NONE="none",m3g),Capabilities$1=(n3g=ASObject,__extends(o3g,n3g),Object.defineProperty(o3g,"isEmbeddedInAcrobat",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasEmbeddedVideo",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasAudio",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"avHardwareDisable",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasAccessibility",{get:function(){return o3g._hasAccessibility},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasAudioEncoder",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasMP3",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasPrinting",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasScreenBroadcast",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasScreenPlayback",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasStreamingAudio",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasStreamingVideo",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasVideoEncoder",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"isDebugger",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"localFileReadDisable",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"language",{get:function(){return o3g._language},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"manufacturer",{get:function(){return o3g._manufacturer},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"os",{get:function(){var t,e,i;return null===o3g._os&&(i=0<(t=window.navigator.userAgent).indexOf("Macintosh")?-1===t.indexOf("Mac OS X ")?"Mac OS 10.6":(e=t.split("Mac OS X ")[1]).substr(0,e.indexOf(";")):0<t.indexOf("Windows")?"Windows XP":0<t.indexOf("Linux")?"Linux":/(iPad|iPhone|iPod|Android)/.test(t)?"iPhone3,1":"Generic OS",o3g._os=i),o3g._os},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"cpuArchitecture",{get:function(){return"x86"},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"playerType",{get:function(){return o3g._playerType},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"serverString",{get:function(){return toKeyValueArray({OS:o3g.os}).map(function(t){return t[0]+"="+encodeURIComponent(t[1])}).join("&")},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"version",{get:function(){return o3g._version},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"screenColor",{get:function(){return"color"},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"pixelAspectRatio",{get:function(){return 1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"screenDPI",{get:function(){return o3g._screenDPI},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"screenResolutionX",{get:function(){return window.screen.width},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"screenResolutionY",{get:function(){return window.screen.height},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"touchscreenType",{get:function(){return TouchscreenType.NONE},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasIME",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"hasTLS",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"maxLevelIDC",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"supports32BitProcesses",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"supports64BitProcesses",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(o3g,"_internal",{get:function(){},enumerable:!0,configurable:!0}),o3g.hasMultiChannelAudio=function(t){return!1},o3g.classInitializer=null,o3g._hasAccessibility=!1,o3g._language="en",o3g._manufacturer="Mozilla Research",o3g._os=null,o3g._playerType="PlugIn",o3g._version="SHUMWAY 10,0,0,0",o3g._screenDPI=96,o3g),ExternalInterface$1=(u3g=ASObject,__extends(v3g,u3g),v3g.ensureInitialized=function(){this.available||this.sec.throwError("Error",Errors$1.ExternalInterfaceNotAvailableError),this.initialized||(this.initialized=!0,ExternalInterfaceService.initJS(this._callIn))},v3g.call=function(t){this.ensureInitialized();var e="";if(1<arguments.length){for(var i=[],n=1;n<arguments.length;n++)i.push(this.convertToJSString(arguments[n]));e=i.join(",")}var r="try {__flash__toXML("+t+"("+e+"));} catch (e) {"+(this.$BgmarshallExceptions?'"<exception>" + e + "</exception>";':'"<undefined/>";')+"}",o=this._evalJS(r);return null==o?null:this.convertFromXML(this.convertToXML(o))},v3g.addCallback=function(t,h){var u,p=this;this.ensureInitialized(),h?(u=this)._addCallback(t,function(t,e){var i,n=!0;if(void 0!==e)if(Array.isArray(e)){for(var r=[],o=0;o<e.length;o++){var s=e[o];"object"==typeof s&&s?r.push(u.sec.createObjectFromJS(s,!0)):r.push(s)}e=r}else e=[e];else{var a=p.convertToXML(t),l=a.attribute("returntype"),n=l&&"javascript"==l._value;if(e=[],a._children)for(o=0;o<a._children.length;o++){var c=a._children[o];e.push(p.convertFromXML(c))}}try{i=h.axApply(null,e)}catch(t){if(!p.$BgmarshallExceptions)throw t;i=t}return n?u.convertToJSString(i):u.convertToXMLString(i)}):this._removeCallback(t)},Object.defineProperty(v3g,"available",{get:function(){return ExternalInterfaceService.enabled},enumerable:!0,configurable:!0}),Object.defineProperty(v3g,"objectID",{get:function(){return ExternalInterfaceService.getId()},enumerable:!0,configurable:!0}),v3g._addCallback=function(t,e){ExternalInterfaceService.registerCallback(t),v3g.registeredCallbacks[t]=e},v3g._removeCallback=function(t){ExternalInterfaceService.unregisterCallback(t),delete v3g.registeredCallbacks[t]},v3g._evalJS=function(t){return t=axCoerceString$2(t),ExternalInterfaceService.eval(t)},v3g._callIn=function(t,e){var i=v3g.registeredCallbacks[t];if(i)return i(t,e)},v3g._callOut=function(t){return t=axCoerceString$2(t),ExternalInterfaceService.call(t)},v3g.convertToXML=function(t){var e=this.sec.system.getClass(Multiname.FromSimpleName("XML")),i=e.ignoreWhitespace;e.ignoreWhitespace=!1;var n=e.Create(t);return e.ignoreWhitespace=i,n},v3g.convertToXMLString=function(t){switch(typeof t){case"boolean":return t?"<true/>":"<false/>";case"number":return"<number>"+t+"</number>";case"string":return"<string>"+t.split("&").join("&amp;").split("<").join("&lt;").split(">").join("&gt;")+"</string>";case"object":if(null===t)return"<null/>";if(this.sec.AXDate.axIsInstanceOf(t))return"<date>"+t.time+"</date>";if(this.sec.AXError.axIsInstanceOf(t))return this.$BgmarshallExceptions?"<exception>"+t+"</exception>":"<null/>";var e=[];if(t.hasOwnProperty("$Bglength")){for(var i=t.$Bglength,n=0;n<i;n++){var r=this.convertToXMLString(t.axGetNumericProperty(n));e.push('<property id="'+n+'">'+r+"</property>")}return"<array>"+e.join("")+"</array>"}for(var o=t.axGetEnumerableKeys(),n=0;n<o.length;n++){var s=o[n],r=this.convertToXMLString(t.axGetPublicProperty(s));e.push('<property id="'+s+'">'+r+"</property>")}return"<object>"+e.join("")+"</object>";default:return"<undefined/>"}},v3g.convertFromXML=function(t){switch(t._name.name){case"true":return!0;case"false":return!1;case"number":return Number(String(t.children()));case"string":return String(t.children());case"null":return null;case"date":return this.sec.AXDate.axConstruct([Number(String(t.children()))]);case"exception":if(this.$BgmarshallExceptions)throw this.sec.AXError.axConstruct([String(t.children())]);return;case"array":case"object":for(var e="object"===t._name.name?this.sec.createObject():this.sec.createArrayUnsafe([]),i=0;i<t._children.length;i++){var n=t._children[i];e.axSetPublicProperty(extractId(n),this.convertFromXML(n._children[0]))}return e;case"class":var r=Multiname.FromFQNString(String(t.children()),0);return this.sec.application.getClass(r);default:return}},v3g.convertToJSString=function(t){if("string"==typeof t)return'"'+t.split("\r").join("\\r").split("\n").join("\\n").split('"').join('\\"')+'"';if(this.sec.AXArray.axIsInstanceOf(t)){for(var e=[],i=t.value,n=0;n<i.length;n++)e.push(this.convertToJSString(i[n]));return"["+e.join(",")+"]"}if(this.sec.AXDate.axIsInstanceOf(t))return"new Date("+t.value+")";if(this.$BgmarshallExceptions&&this.sec.AXError.axIsInstanceOf(t))return'throw "'+t+'"';if("object"!=typeof t||null===t)return String(t);e=[];for(var r=t.axGetEnumerableKeys(),n=0;n<r.length;n++){var o=r[n];e.push(o+":"+this.convertToJSString(t.axGetPublicProperty(o)))}return"({"+e.join(",")+"})"},v3g.classInitializer=null,v3g.initialized=!1,v3g.registeredCallbacks=Object.create(null),v3g),u3g,n3g,l3g,E2g,X1g,C1g,Y0g,C0g,X_g,J_g,x_g,P$g,N$g,$Zg,YZg,GZg,vZg;function v3g(){return u3g.call(this)||this}function o3g(){return n3g.call(this)||this}function m3g(){return l3g.call(this)||this}function F2g(t,e,i,n,r,o,s,a,l,c,h){void 0===t&&(t=4),void 0===e&&(e=45),void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=4),void 0===s&&(s=4),void 0===a&&(a=1),void 0===l&&(l=1),void 0===c&&(c="inner"),void 0===h&&(h=!1);var u=E2g.call(this)||this;return u.distance=t,u.angle=e,GradientArrays.sanitize(i?i.value:null,n?n.value:null,r?r.value:null),u._colors=GradientArrays.colors,u._alphas=GradientArrays.alphas,u._ratios=GradientArrays.ratios,u.blurX=o,u.blurY=s,u.strength=a,u.quality=l,u.type=c,u.knockout=h,u}function Y1g(t,e,i,n,r,o,s,a,l,c,h){void 0===t&&(t=4),void 0===e&&(e=45),void 0===i&&(i=null),void 0===n&&(n=null),void 0===r&&(r=null),void 0===o&&(o=4),void 0===s&&(s=4),void 0===a&&(a=1),void 0===l&&(l=1),void 0===c&&(c="inner"),void 0===h&&(h=!1);var u=X1g.call(this)||this;return u.distance=t,u.angle=e,GradientArrays.sanitize(i?i.value:null,n?n.value:null,r?r.value:null),u._colors=GradientArrays.colors,u._alphas=GradientArrays.alphas,u._ratios=GradientArrays.ratios,u.blurX=o,u.blurY=s,u.strength=a,u.quality=l,u.type=c,u.knockout=h,u}function D1g(t,e,i,n,r,o,s,a){void 0===t&&(t=16711680),void 0===e&&(e=1),void 0===i&&(i=6),void 0===n&&(n=6),void 0===r&&(r=2),void 0===o&&(o=1),void 0===s&&(s=!1),void 0===a&&(a=!1);var l=C1g.call(this)||this;return l.color=t,l.alpha=e,l.blurX=i,l.blurY=n,l.strength=r,l.quality=o,l.inner=s,l.knockout=a,l}function Z0g(t,e,i,n,r,o,s,a,l,c,h){void 0===t&&(t=4),void 0===e&&(e=45),void 0===i&&(i=0),void 0===n&&(n=1),void 0===r&&(r=4),void 0===o&&(o=4),void 0===s&&(s=1),void 0===a&&(a=1),void 0===l&&(l=!1),void 0===c&&(c=!1),void 0===h&&(h=!1);var u=Y0g.call(this)||this;return u.distance=t,u.angle=e,u.color=i,u.alpha=n,u.blurX=r,u.blurY=o,u.strength=s,u.quality=a,u.inner=l,u.knockout=c,u.hideObject=h,u}function D0g(t,e,i,n,r,o,s,a,l){void 0===t&&(t=null),void 0===e&&(e=null),void 0===i&&(i=0),void 0===n&&(n=0),void 0===r&&(r=0),void 0===o&&(o=0),void 0===s&&(s="wrap"),void 0===a&&(a=0),void 0===l&&(l=0);var c=C0g.call(this)||this;return c.mapBitmap=t,c.mapPoint=e,c.componentX=i,c.componentY=n,c.scaleX=r,c.scaleY=o,c.mode=s,c.color=a,c.alpha=l,c}function Y_g(t,e,i,n,r,o,s,a,l){void 0===t&&(t=0),void 0===e&&(e=0),void 0===i&&(i=null),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=!0),void 0===s&&(s=!0),void 0===a&&(a=0),void 0===l&&(l=0);var c=X_g.call(this)||this;return c.matrixX=t,c.matrixY=e,i?c.matrix=i:c._matrix=c._expandArray([],c._matrixX*c._matrixY),c.divisor=n,c.bias=r,c.preserveAlpha=o,c.clamp=s,c.color=a,c.alpha=l,c}function K_g(t){void 0===t&&(t=null);var e=J_g.call(this)||this;return t?e.matrix=t:e._matrix=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],e}function y_g(t,e,i){void 0===t&&(t=4),void 0===e&&(e=4),void 0===i&&(i=1);var n=x_g.call(this)||this;return n.blurX=t,n.blurY=e,n.quality=i,n}function Q$g(t,e,i,n,r,o,s,a,l,c,h,u){void 0===t&&(t=4),void 0===e&&(e=45),void 0===i&&(i=16777215),void 0===n&&(n=1),void 0===r&&(r=0),void 0===o&&(o=1),void 0===s&&(s=4),void 0===a&&(a=4),void 0===l&&(l=1),void 0===c&&(c=1),void 0===h&&(h="inner"),void 0===u&&(u=!1);var p=P$g.call(this)||this;return p.distance=t,p.angle=e,p.highlightColor=i,p.highlightAlpha=n,p.shadowColor=r,p.shadowAlpha=o,p.blurX=s,p.blurY=a,p.strength=l,p.quality=c,p.type=h,p.knockout=u,p}function O$g(){return N$g.call(this)||this}function l$g(){}function _Zg(){return $Zg.call(this)||this}function ZZg(){return YZg.call(this)||this}function HZg(t,e,i,n){var r=GZg.call(this)||this;return r._name=axCoerceString$2(t),r._labels=e,r.offset=i,r._numFrames=0|n,r}function wZg(){return vZg.call(this)||this}function extractId(t){for(var e=0;e<t._attributes.length;e++){var i=t._attributes[e];if("id"===i._name.name)return i._value}}var TimerEvent$1=(w4g=Event$1,__extends(x4g,w4g),x4g.prototype.clone=function(){return new this.sec.flash.events.TimerEvent(this.type,this.bubbles,this.cancelable)},x4g.prototype.toString=function(){return this.formatToString("TimerEvent","type","bubbles","cancelable","eventPhase")},x4g.prototype.updateAfterEvent=function(){this.sec.player.requestRender()},x4g.classInitializer=null,x4g.classSymbols=null,x4g.instanceSymbols=null,x4g.TIMER="timer",x4g.TIMER_COMPLETE="timerComplete",x4g),Timer$1=(B4g=EventDispatcher$1,__extends(C4g,B4g),Object.defineProperty(C4g.prototype,"running",{get:function(){return this._running},enumerable:!0,configurable:!0}),Object.defineProperty(C4g.prototype,"delay",{get:function(){return this._delay},set:function(t){((t=+t)<0||!isFinite(t))&&this.sec.throwError("RangeError",Errors$1.DelayRangeError),this._delay=t,this._running&&(this.stop(),this.start())},enumerable:!0,configurable:!0}),Object.defineProperty(C4g.prototype,"repeatCount",{get:function(){return this._repeatCount},set:function(t){this._repeatCount=0|t,this._repeatCount&&this._running&&this._iteration>=this._repeatCount&&this.stop()},enumerable:!0,configurable:!0}),Object.defineProperty(C4g.prototype,"currentCount",{get:function(){return this._iteration},enumerable:!0,configurable:!0}),C4g.prototype.reset=function(){this._running&&this.stop(),this._iteration=0},C4g.prototype.stop=function(){this._running=!1,window.clearInterval(this._interval)},C4g.prototype.start=function(){this._running||(this._running=!0,this._interval=window.setInterval(this._tick.bind(this),this._delay))},C4g.prototype._tick=function(){if(this._iteration++,this._running){if(C4g.dispatchingEnabled)try{this.dispatchEvent(new this.sec.flash.events.TimerEvent("timer",!0,!1))}catch(t){}if(0!==this._repeatCount&&this._iteration>=this._repeatCount){this.stop();try{this.dispatchEvent(new this.sec.flash.events.TimerEvent(TimerEvent$1.TIMER_COMPLETE,!1,!1))}catch(t){}}}},C4g.classInitializer=null,C4g.classSymbols=null,C4g.instanceSymbols=null,C4g.dispatchingEnabled=!0,C4g),SoundMixer$1=(K4g=ASObject,__extends(L4g,K4g),Object.defineProperty(L4g,"bufferTime",{get:function(){return L4g._bufferTime},set:function(t){L4g._bufferTime=0|t},enumerable:!0,configurable:!0}),Object.defineProperty(L4g,"soundTransform",{get:function(){return isNullOrUndefined$1(L4g._soundTransform)?new SoundTransform$1:new SoundTransform$1(L4g._soundTransform.volume,L4g._soundTransform.pan)},set:function(t){L4g._soundTransform=isNullOrUndefined$1(t)?new SoundTransform$1:t,L4g._updateAllSoundSources()},enumerable:!0,configurable:!0}),Object.defineProperty(L4g,"audioPlaybackMode",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(L4g,"useSpeakerphoneForVoice",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),L4g.stopAll=function(){L4g._registeredSoundSources.forEach(function(t){t.stopSound()}),L4g._registeredSoundSources=[]},L4g.computeSpectrum=function(t,e,i){for(var n=new Float32Array(1024),r=0;r<1024;r++)n[r]=Math.random();t.writeRawBytes(n),t.position=0},L4g.areSoundsInaccessible=function(){},L4g._getMasterVolume=function(){return L4g._masterVolume},L4g._setMasterVolume=function(t){L4g._masterVolume=t=+t,L4g._updateAllSoundSources()},L4g._registerSoundSource=function(t){L4g._registeredSoundSources.push(t)},L4g._unregisterSoundSource=function(t){var e=L4g._registeredSoundSources.indexOf(t);0<=e&&L4g._registeredSoundSources.splice(e,1)},L4g._updateSoundSource=function(t){var e=t.soundTransform.volume;L4g._soundTransform&&(e*=L4g._soundTransform.volume),e*=L4g._getMasterVolume(),t.updateSoundLevels(e)},L4g._updateAllSoundSources=function(){L4g._registeredSoundSources.forEach(L4g._updateSoundSource)},L4g.classInitializer=null,L4g.classSymbols=null,L4g.instanceSymbols=null,L4g._masterVolume=1,L4g._registeredSoundSources=[],L4g._bufferTime=0,L4g),TextSnapshot=(a5g=ASObject,__extends(b5g,a5g),Object.defineProperty(b5g.prototype,"charCount",{get:function(){},enumerable:!0,configurable:!0}),b5g.prototype.findText=function(t,e,i){},b5g.prototype.getSelected=function(t,e){},b5g.prototype.getSelectedText=function(t){},b5g.prototype.getText=function(t,e,i){},b5g.prototype.getTextRunInfo=function(t,e){},b5g.prototype.hitTestTextNearPos=function(t,e,i){},b5g.prototype.setSelectColor=function(t){},b5g.prototype.setSelected=function(t,e,i){},b5g.classInitializer=null,b5g),URLVariables$1=(u5g=ASObject,__extends(v5g,u5g),v5g.prototype.decode=function(t){for(var e=(t=axCoerceString$2(t)).split("&"),i=0;i<e.length;i++){var n=e[i],r=n.indexOf("=");r<0&&(this._ignoreDecodingErrors?r=n.length:this.sec.throwError("Error",Errors$1.DecodeParamError));var o=unescape(n.substring(0,r).split("+").join(" ")),s=unescape(n.substring(r+1).split("+").join(" ")),a=this.axGetPublicProperty(o);void 0===a?this.axSetPublicProperty(o,s):Array.isArray(a)?a.push(s):this.axSetPublicProperty(o,[a,s])}},v5g.prototype.toString=function(){for(var t=[],e=this.axGetEnumerableKeys(),i=0;i<e.length;i++){var n=e[i].split(" ").join("+"),r=this.axGetPublicProperty(n),n=escape(n).split(" ").join("+");if(Array.isArray(r))for(var o=0;o<r.length;o++)t.push(n+"="+escape(r[o]));else t.push(n+"="+escape(r))}return t.join("&")},v5g.classInitializer=null,v5g.classSymbols=null,v5g.instanceSymbols=null,v5g),NativeMenuItem=(M5g=EventDispatcher$1,__extends(N5g,M5g),Object.defineProperty(N5g.prototype,"enabled",{get:function(){return this._enabled},set:function(t){t=!!t,this._enabled=t},enumerable:!0,configurable:!0}),N5g.classInitializer=null,N5g.classSymbols=null,N5g.instanceSymbols=null,N5g),NativeMenu=(Q5g=EventDispatcher$1,__extends(R5g,Q5g),R5g.classInitializer=null,R5g.classSymbols=null,R5g.instanceSymbols=null,R5g),partialImp=function(t,e){return warning("[Builtins] Partial implemented "+t.constructor.name+"::"+e)},ContextMenu$1=(U5g=NativeMenu,__extends(V5g,U5g),Object.defineProperty(V5g,"isSupported",{get:function(){return partialImp(V5g,"get isSupported"),!1},enumerable:!0,configurable:!0}),Object.defineProperty(V5g.prototype,"builtInItems",{get:function(){return this._builtInItems},set:function(t){this._builtInItems=t},enumerable:!0,configurable:!0}),Object.defineProperty(V5g.prototype,"customItems",{get:function(){return this.sec.createArrayUnsafe(this._customItems)},set:function(t){this._customItems=t.value},enumerable:!0,configurable:!0}),Object.defineProperty(V5g.prototype,"link",{get:function(){return this._link},set:function(t){this._link=t},enumerable:!0,configurable:!0}),Object.defineProperty(V5g.prototype,"clipboardMenu",{get:function(){return this._clipboardMenu},set:function(t){t=!!t,this._clipboardMenu=t},enumerable:!0,configurable:!0}),Object.defineProperty(V5g.prototype,"clipboardItems",{get:function(){return this._clipboardItems},set:function(t){this._clipboardItems=t},enumerable:!0,configurable:!0}),V5g.prototype.hideBuiltInItems=function(){var t=this.builtInItems;t&&(t.save=!1,t.zoom=!1,t.quality=!1,t.play=!1,t.loop=!1,t.rewind=!1,t.forwardAndBack=!1,t.print=!1)},V5g.prototype.clone=function(){var t=new this.sec.flash.ui.ContextMenu;t._builtInItems=this._builtInItems.clone(),this.cloneLinkAndClipboardProperties(t);for(var e=this._customItems,i=0;i<e.length;i++)t._customItems.push(e[i].clone());return t},V5g.prototype.cloneLinkAndClipboardProperties=function(t){},V5g.classInitializer=null,V5g),ContextMenuItem$1=(f6g=NativeMenuItem,__extends(g6g,f6g),Object.defineProperty(g6g.prototype,"caption",{get:function(){return this._caption},set:function(t){t=axCoerceString$2(t),this._caption=t},enumerable:!0,configurable:!0}),Object.defineProperty(g6g.prototype,"separatorBefore",{get:function(){return this._separatorBefore},set:function(t){t=!!t,this._separatorBefore=t},enumerable:!0,configurable:!0}),Object.defineProperty(g6g.prototype,"visible",{get:function(){return this._visible},set:function(t){t=!!t,this._visible=t},enumerable:!0,configurable:!0}),g6g.classInitializer=null,g6g.classSymbols=null,g6g.instanceSymbols=null,g6g),ContextMenuBuiltInItems=(p6g=ASObject,__extends(q6g,p6g),Object.defineProperty(q6g.prototype,"save",{get:function(){return this._save},set:function(t){this._save=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"zoom",{get:function(){return this._zoom},set:function(t){this._zoom=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"quality",{get:function(){return this._quality},set:function(t){this._quality=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"play",{get:function(){return this._play},set:function(t){this._play=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"loop",{get:function(){return this._loop},set:function(t){this._loop=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"rewind",{get:function(){return this._rewind},set:function(t){this._rewind=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"forwardAndBack",{get:function(){return this._forwardAndBack},set:function(t){this._forwardAndBack=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(q6g.prototype,"print",{get:function(){return this._print},set:function(t){this._print=!!t},enumerable:!0,configurable:!0}),q6g.prototype.clone=function(){var t=new q6g;return t._save=this._save,t._zoom=this._zoom,t._quality=this._quality,t._play=this._play,t._loop=this._loop,t._rewind=this._rewind,t._forwardAndBack=this._forwardAndBack,t._print=this._print,t},q6g.classInitializer=null,q6g),ContextMenuClipboardItems=(B6g=ASObject,__extends(C6g,B6g),Object.defineProperty(C6g.prototype,"cut",{get:function(){return this._cut},set:function(t){this._cut=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(C6g.prototype,"copy",{get:function(){return this._copy},set:function(t){this._copy=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(C6g.prototype,"paste",{get:function(){return this._paste},set:function(t){this._paste=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(C6g.prototype,"clear",{get:function(){return this._clear},set:function(t){this._clear=!!t},enumerable:!0,configurable:!0}),Object.defineProperty(C6g.prototype,"selectAll",{get:function(){return this._selectAll},set:function(t){this._selectAll=!!t},enumerable:!0,configurable:!0}),C6g.prototype.clone=function(){var t=new C6g;return t._cut=this._cut,t._copy=this._copy,t._paste=this._paste,t._clear=this._clear,t._selectAll=this._selectAll,t},C6g.classInitializer=null,C6g.classSymbols=null,C6g.instanceSymbols=null,C6g),FrameLabel=(K6g=EventDispatcher$1,__extends(L6g,K6g),Object.defineProperty(L6g.prototype,"name",{get:function(){return this._name},enumerable:!0,configurable:!0}),Object.defineProperty(L6g.prototype,"frame",{get:function(){return this._frame},enumerable:!0,configurable:!0}),L6g.prototype.clone=function(){return new L6g(this._name,this._frame)},L6g.classInitializer=null,L6g),Mouse$1=(P6g=ASObject,__extends(Q6g,P6g),Object.defineProperty(Q6g,"cursor",{get:function(){return Q6g._cursor},set:function(t){Q6g._cursor=t},enumerable:!0,configurable:!0}),Object.defineProperty(Q6g,"supportsCursor",{get:function(){return!0},enumerable:!0,configurable:!0}),Object.defineProperty(Q6g,"supportsNativeCursor",{get:function(){return!0},enumerable:!0,configurable:!0}),Q6g.hide=function(){},Q6g.show=function(){},Q6g.registerCursor=function(t,e){},Q6g.unregisterCursor=function(t){},Q6g),GameInput=(V6g=EventDispatcher$1,__extends(W6g,V6g),Object.defineProperty(W6g,"numDevices",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(W6g,"isSupported",{get:function(){return!1},enumerable:!0,configurable:!0}),W6g.getDeviceAt=function(t){return this.sec.throwError("RangeError",Errors$1.ParamRangeError,"index"),null},W6g.classInitializer=null,W6g.classSymbols=null,W6g.instanceSymbols=null,W6g),GameInputControl=(Y6g=EventDispatcher$1,__extends(Z6g,Y6g),Object.defineProperty(Z6g.prototype,"numValues",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"index",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"relative",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"type",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"hand",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"finger",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(Z6g.prototype,"device",{get:function(){},enumerable:!0,configurable:!0}),Z6g.prototype.getValueAt=function(t){},Z6g.classInitializer=null,Z6g.classSymbols=null,Z6g.instanceSymbols=null,Z6g),GameInputControlType=(_6g=ASObject,__extends(a7g,_6g),a7g.classInitializer=null,a7g.classSymbols=null,a7g.instanceSymbols=null,a7g.MOVEMENT="movement",a7g.ROTATION="rotation",a7g.DIRECTION="direction",a7g.ACCELERATION="acceleration",a7g.BUTTON="button",a7g.TRIGGER="trigger",a7g),GameInputDevice=(b7g=EventDispatcher$1,__extends(c7g,b7g),Object.defineProperty(c7g.prototype,"numControls",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(c7g.prototype,"sampleInterval",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(c7g.prototype,"enabled",{get:function(){},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(c7g.prototype,"id",{get:function(){},enumerable:!0,configurable:!0}),Object.defineProperty(c7g.prototype,"name",{get:function(){},enumerable:!0,configurable:!0}),c7g.prototype.getControlAt=function(t){},c7g.prototype.startCachingSamples=function(t,e){},c7g.prototype.stopCachingSamples=function(){},c7g.prototype.getCachedSamples=function(t,e){},c7g.classInitializer=null,c7g.classSymbols=null,c7g.instanceSymbols=null,c7g.MAX_BUFFER_SIZE=4800,c7g),GameInputFinger=(k7g=ASObject,__extends(l7g,k7g),l7g.classInitializer=null,l7g.classSymbols=null,l7g.instanceSymbols=null,l7g.THUMB="thumb",l7g.INDEX="index",l7g.MIDDLE="middle",l7g.UNKNOWN="unknown",l7g),GameInputHand=(m7g=ASObject,__extends(n7g,m7g),n7g.classInitializer=null,n7g.classSymbols=null,n7g.instanceSymbols=null,n7g.RIGHT="right",n7g.LEFT="left",n7g.UNKNOWN="unknown",n7g),Font$1=(o7g=ASObject,__extends(p7g,o7g),Object.defineProperty(p7g.prototype,"fontName",{get:function(){return this._adaptee?this._adaptee.fontName:""},enumerable:!0,configurable:!0}),Object.defineProperty(p7g.prototype,"fontStyle",{get:function(){return console.warn("`Font#get:fontStyle` not implement yet"),"regular"},enumerable:!0,configurable:!0}),Object.defineProperty(p7g.prototype,"fontType",{get:function(){return console.warn("`Font#get:fontType` not implement yet"),"embedded"},enumerable:!0,configurable:!0}),p7g.enumerateFonts=function(t){return console.warn("`Font.enumerateFonts` not implement yet"),[]},p7g.registerFont=function(t){console.warn("`Font.registerFont` not implement yet")},p7g.prototype.hasGlyphs=function(t){return console.warn("`Font#hasGlyphs` not implement yet"),!1},p7g.classInitializer=null,p7g.classSymbols=null,p7g.instanceSymbols=null,p7g),TextLineMetrics$1=(u7g=ASObject,__extends(v7g,u7g),v7g),TouchEvent=(C7g=Event$1,__extends(D7g,C7g),Object.defineProperty(D7g.prototype,"altKey",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"ctrlKey",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"isPrimaryTouchPoint",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"isRelatedObjectInaccessible",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"localX",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"localY",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"pressure",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"relatedObject",{get:function(){return null},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"shiftKey",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"sizeX",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"sizeY",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"stageX",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"stageY",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(D7g.prototype,"touchPointID",{get:function(){return 0},set:function(t){},enumerable:!0,configurable:!0}),D7g.prototype.clone=function(){return null},D7g.prototype.toString=function(){return""},D7g.prototype.updateAfterEvent=function(){},D7g.TOUCH_BEGIN="touchBegin",D7g.TOUCH_END="touchEnd",D7g.TOUCH_MOVE="touchMove",D7g.TOUCH_OUT="touchOut",D7g.TOUCH_OVER="touchOver",D7g.TOUCH_ROLL_OUT="touchRollOut",D7g.TOUCH_ROLL_OVER="touchRollOver",D7g.TOUCH_TAP="touchTap",D7g),MultitouchInputMode=(c8g.GESTURE="gesture",c8g.NONE="none",c8g.TOUCH_POINT="touchPoint",c8g),Multitouch=(Object.defineProperty(d8g,"inputMode",{get:function(){return""},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(d8g,"mapTouchToMouse",{get:function(){return!1},set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(d8g,"maxTouchPoints",{get:function(){return 0},enumerable:!0,configurable:!0}),Object.defineProperty(d8g,"supportedGestures",{get:function(){return[]},enumerable:!0,configurable:!0}),Object.defineProperty(d8g,"supportsGestureEvents",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(d8g,"supportsTouchEvents",{get:function(){return!1},enumerable:!0,configurable:!0}),d8g),GameInputEvent=(g8g=Event$1,__extends(h8g,g8g),h8g.classInitializer=null,h8g.classSymbols=null,h8g.instanceSymbols=null,h8g.DEVICE_ADDED="deviceAdded",h8g.DEVICE_REMOVED="deviceRemoved",h8g),forbiddenNames=["send","connect","close","allowDomain","allowInsecureDomain","client","domain"],g8g,C7g,u7g,o7g,m7g,k7g,b7g,_6g,Y6g,V6g,P6g,K6g,B6g,p6g,f6g,U5g,Q5g,M5g,u5g,a5g,K4g,B4g,w4g;function h8g(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!1),void 0===n&&(n=null);var r=g8g.call(this,t,e,i)||this;return r.device=n,r}function d8g(){}function c8g(){}function D7g(t,e,i,n,r,o,s,a,l,c,h,u,p,d){return void 0===e&&(e=!0),void 0===i&&(i=!1),C7g.call(this,t,e,i)||this}function v7g(t,e,i,n,r,o){return u7g.call(this)||this}function p7g(){var t=o7g.call(this)||this;return t._adaptee=new Font,t}function n7g(){return m7g.call(this)||this}function l7g(){return k7g.call(this)||this}function c7g(){return b7g.call(this)||this}function a7g(){return _6g.call(this)||this}function Z6g(){return Y6g.call(this)||this}function W6g(){return V6g.call(this,void 0)||this}function Q6g(){return null!==P6g&&P6g.apply(this,arguments)||this}function L6g(t,e){var i=K6g.call(this)||this;return i._name=axCoerceString(t),i._frame=0|e,i}function C6g(){var t=B6g.call(this)||this;return t._cut=!0,t._copy=!0,t._paste=!0,t._clear=!0,t._selectAll=!0,t}function q6g(){var t=p6g.call(this)||this;return t._save=!0,t._zoom=!0,t._quality=!0,t._play=!0,t._loop=!0,t._rewind=!0,t._forwardAndBack=!0,t._print=!0,t}function g6g(t,e,i,n){void 0===e&&(e=!1),void 0===i&&(i=!0),void 0===n&&(n=!0);var r=f6g.call(this)||this;return t=axCoerceString$2(t),e=!!e,i=!!i,n=!!n,r._caption=t||"",r._separatorBefore=e,r._enabled=i,r._visible=n,r}function V5g(){var t=U5g.call(this)||this;return t._builtInItems=new t.sec.flash.ui.ContextMenuBuiltInItems,t._customItems=[],t}function R5g(){return Q5g.call(this)||this}function N5g(){var t=M5g.call(this)||this;return t._enabled=!0,t}function v5g(t){void 0===t&&(t=null);var e=u5g.call(this)||this;return e._ignoreDecodingErrors=!1,t&&e.decode(t),e}function b5g(){return a5g.call(this)||this}function L4g(){return K4g.call(this)||this}function C4g(t,e){var i=B4g.call(this)||this;return i._delay=+t,i._repeatCount=0|e,i._iteration=0,i}function x4g(t,e,i){return w4g.call(this,t,e,i)||this}Object.freeze(forbiddenNames);var notImpl=function(t,e){return console.warn("[NOT IMPLEMENTED] "+t.constructor.name+"#"+e+" yet!")},LocalConnection=(p8g=EventDispatcher$1,__extends(q8g,p8g),Object.defineProperty(q8g,"isSupported",{get:function(){return!0},enumerable:!0,configurable:!0}),q8g.prototype.close=function(){this._connectionName||this.sec.throwError("ArgumentError",Errors$1.CloseNotConnectedError),this._connectionName=null,this._allowedInsecureDomains=[],this._allowedSecureDomains=[],notImpl(this,"close")},q8g.prototype.connect=function(t){notImpl(this,"connect")},q8g.prototype.send=function(t,e){for(var i=[],n=2;n<arguments.length;n++)i[n-2]=arguments[n];notImpl(this,"send")},Object.defineProperty(q8g.prototype,"client",{get:function(){return this._client},set:function(t){this.sec.AXObject.axIsType(t)||this.sec.throwError("ArgumentError",Errors$1.InvalidParamError),this._client=t},enumerable:!0,configurable:!0}),q8g.prototype.allowDomain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._allowDomains(t,!0)},q8g.prototype.allowInsecureDomain=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._allowDomains(t,!0),this._allowDomains(t,!1)},q8g.prototype._allowDomains=function(t,e){notImpl(this,"_allowDomains")},q8g.prototype.handleMessage=function(t,e){var i,n=this._client;if(!n.axHasPublicProperty(t)||-1<forbiddenNames.indexOf(t))i=this.sec.createError("ReferenceError",Errors$1.ReadSealedError,t,n.axClass.name.name);else{var r=n.axGetPublicProperty(t);if(!axIsCallable(r))return;var o=new ByteArray$1(e).readObject();if(this.sec.AXArray.axIsType(o))try{r.apply(n,o.value)}catch(t){i=t}else i=this.sec.createError("TypeError",Errors$1.CheckTypeFailedError,o,"Array")}if(i){var s=new ErrorEvent("asyncError",!1,!1,"Error #2095: flash.net.LocalConnection was unable to invoke callback "+t+".",i.errorID);if(this.hasEventListener("asyncError"))try{this.dispatchEvent(s)}catch(t){console.warn("Exception encountered during asyncErrorEvent handling in LocalConnection sender.")}else console.warn("No handler for asyncError on LocalConnection sender, not sending event",s)}},Object.defineProperty(q8g.prototype,"domain",{get:function(){return this._domain},enumerable:!0,configurable:!0}),Object.defineProperty(q8g.prototype,"isPerUser",{get:function(){return!0},set:function(t){},enumerable:!0,configurable:!0}),q8g.classInitializer=null,q8g),p8g;function q8g(){var t=p8g.call(this)||this;(t._client=t)._connectionName=null,t._allowedInsecureDomains=[],t._allowedSecureDomains=[];var e=new URL("http://localhost");return t._domain=e.hostname,t._secure="https:"===e.protocol,t}function M(t,e){registerNativeClass(t,e)}function initLink(){M("flash.display.Stage",Stage$1),M("flash.display.DisplayObject",DisplayObject$1),M("flash.display.InteractiveObject",InteractiveObject),M("flash.display.DisplayObjectContainer",DisplayObjectContainer$1),M("flash.display.Sprite",Sprite$1),M("flash.display.MovieClip",MovieClip$1),M("flash.display.Shape",Sprite$1),M("flash.display.Bitmap",Bitmap),M("flash.display.BitmapData",BitmapData),M("flash.display.Loader",Loader$1),M("flash.display.LoaderInfo",LoaderInfo),M("flash.display.Graphics",Graphics$1),M("flash.display.SimpleButton",SimpleButton$1),M("flash.display.Scene",Scene$1),M("flash.events.Event",Event$1),M("flash.ui.Keyboard",Keyboard),M("flash.events.KeyboardEvent",KeyboardEvent$2),M("flash.text.TextField",TextField$1),M("flash.display.NativeMenuItem",NativeMenuItem),M("flash.display.FrameLabel",FrameLabel),M("flash.filters.BevelFilter",BevelFilter),M("flash.filters.BitmapFilter",BitmapFilter),M("flash.filters.BlurFilter",BlurFilter),M("flash.filters.ColorMatrixFilter",ColorMatrixFilter),M("flash.filters.ConvolutionFilter",ConvolutionFilter),M("flash.filters.DisplacementMapFilter",DisplacementMapFilter),M("flash.filters.DropShadowFilter",DropShadowFilter),M("flash.filters.GlowFilter",GlowFilter),M("flash.filters.GradientBevelFilter",GradientBevelFilter),M("flash.filters.GradientGlowFilter",GradientGlowFilter),M("flash.geom.Point",Point$1),M("flash.geom.Rectangle",Rectangle$1),M("flash.geom.Matrix",Matrix$1),M("flash.geom.Matrix3D",Matrix3D$1),M("flash.geom.Vector3D",Vector3D$1),M("flash.geom.Transform",Transform$1),M("flash.geom.ColorTransform",ColorTransform$1),M("flash.events.EventDispatcher",EventDispatcher$1),M("flash.events.MouseEvent",MouseEvent$2),M("flash.events.ErrorEvent",ErrorEvent),M("flash.events.IOErrorEvent",IOErrorEvent),M("flash.events.TextEvent",TextEvent),M("flash.events.TimerEvent",TimerEvent$1),M("flash.events.ProgressEvent",ProgressEvent$1),M("flash.external.ExternalInterface",ExternalInterface$1),M("flash.ui.ContextMenu",ContextMenu$1),M("flash.ui.ContextMenuItem",ContextMenuItem$1),M("flash.ui.ContextMenuBuiltInItems",ContextMenuBuiltInItems),M("flash.ui.ContextMenuClipboardItems",ContextMenuClipboardItems),M("flash.ui.Mouse",Mouse$1),M("flash.ui.GameInput",GameInput),M("flash.events.GameInputEvent",GameInputEvent),M("flash.ui.GameInputControl",GameInputControl),M("flash.ui.GameInputControlType",GameInputControlType),M("flash.ui.GameInputDevice",GameInputDevice),M("flash.ui.GameInputFinger",GameInputFinger),M("flash.ui.GameInputHand",GameInputHand),M("flash.ui.Multitouch",Multitouch),M("flash.ui.MultitouchInputMode",MultitouchInputMode),M("flash.events.TouchEvent",TouchEvent),M("flash.text.Font",Font$1),M("flash.text.TextFormat",TextFormat$1),M("flash.text.TextSnapshot",TextSnapshot),M("flash.text.TextLineMetrics",TextLineMetrics$1),M("flash.media.Sound",Sound),M("flash.media.SoundChannel",SoundChannel$1),M("flash.media.SoundMixer",SoundMixer$1),M("flash.media.SoundTransform",SoundTransform$1),M("flash.net.URLRequest",URLRequest$1),M("flash.net.URLLoader",URLLoader$1),M("flash.net.SharedObject",SharedObject),M("flash.net.LocalConnection",LocalConnection),M("flash.net.URLVariables",URLVariables$1),M("flash.system.Capabilities",Capabilities$1),M("flash.system.Security",Security$1),M("flash.system.System",System$1),M("flash.system.SecurityDomain",SecurityDomain$1),M("flash.system.ApplicationDomain",ApplicationDomain),M("flash.system.LoaderContext",LoaderContext$1),M("flash.utils.Timer",Timer$1),M("flash.xml.XMLNode",XMLNode$1),M("flash.xml.XMLDocument",XMLDocument$1),registerNativeFunction("flash.system.fscommand",fscommand$1),window.__flash__toXML=function t(e){switch(typeof e){case"boolean":return e?"<true/>":"<false/>";case"number":return"<number>"+e+"</number>";case"object":if(null===e)return"<null/>";if("hasOwnProperty"in e&&e.hasOwnProperty("length")){for(var i="<array>",n=0;n<e.length;n++)i+='<property id="'+n+'">'+t(e[n])+"</property>";return i+"</array>"}for(var r in i="<object>",e)i+='<property id="'+r+'">'+t(e[r])+"</property>";return i+"</object>";case"string":return"<string>"+e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")+"</string>";case"undefined":return"<undefined/>"}}}var Mouse$2=function(){},SecurityDomain$2=(U8g=AXSecurityDomain,__extends(V8g,U8g),V8g),PlayerGlobal=(Object.defineProperty(X8g.prototype,"stage",{get:function(){return this._stage},enumerable:!0,configurable:!0}),Object.defineProperty(X8g.prototype,"content",{get:function(){return this._content},enumerable:!0,configurable:!0}),X8g.prototype.createSecurityDomain=function(a,r,o){var s=this;this._avmStage=a,this._avmStage.avmTestHandler&&(Natives.print=function(t,e,i,n,r,o){var s=2==arguments.length?e:Array.prototype.slice.call(arguments,1).join(" ");console.log("%c Test-Trace from SWF:","color: DodgerBlue",s),a.avmTestHandler.addMessage(s)}),initLink();var l=new PromiseWrapper;return BrowserSystemResourcesLoadingService.getInstance().load("./assets/builtins/builtin.abc","arraybuffer").then(function(t){var n=new SecurityDomain$2,e={url:"builtin.abc",app:n.system},i=new ABCFile(e,new Uint8Array(t));if(n.swfVersion=r.swfVersion,n.system.loadABC(i),n.initialize(),n.system.executeABC(i),n.player=a,o&AVM2LoadLibrariesFlags.Playerglobal)return Promise.all([BrowserSystemResourcesLoadingService.getInstance().load("./assets/builtins/playerglobal.abcs","arraybuffer"),BrowserSystemResourcesLoadingService.getInstance().load("./assets/builtins/playerglobal.json","json")]).then(function(t){var e=new ABCCatalog(n.system,new Uint8Array(t[0]),t[1]);n.addCatalog(e),BrowserSystemResourcesLoadingService.getInstance().load("./assets/builtins/avmplus.abc","arraybuffer").then(function(t){var e={url:"avmplus.File",app:n.system},i=new ABCFile(e,new Uint8Array(t));n.system.loadABC(i),n.system.executeABC(i)},l.reject).then(function(){s._contentLoaderInfo=new n.flash.display.LoaderInfo(s,s._avmStage),s._contentLoaderInfo.url=r.url,s._applicationDomain=new n.flash.system.ApplicationDomain;var t=new n.flash.system.LoaderContext(!1,s._applicationDomain);ActiveLoaderContext.loaderContext=t,s._stage=new n.flash.display.Stage,n.flash.display.DisplayObject.axClass._activeStage=s._stage,s._avmStage.adapter=s._stage,s._stage.adaptee=s._avmStage,l.resolve(new FlashSceneGraphFactory(n))},l.reject)},l.reject);l.resolve(null)},l.reject),l.promise},X8g.prototype.enterFrame=function(){this._stage&&this._stage.enterFrame()},X8g.prototype.resizeStage=function(){this._stage&&this._stage.resizeCallback()},X8g.prototype.addAsset=function(t,e){t.isAsset(TextField)||t.isAsset(SceneImage2D)||t.isAsset(BitmapImage2D)?this._applicationDomain.addDefinition(t.name,t):t.isAsset(WaveAudio)?this._applicationDomain.addAudioDefinition(t.name,t):t.isAsset(Font)?this._applicationDomain.addFontDefinition(t.name,t):t.isAsset(Sprite)?this._applicationDomain.addDefinition(t.name,t):t.isAsset(MovieClip)?(this._applicationDomain.addDefinition(t.name,t),e&&t.isAVMScene&&(this._content=t.adapter.clone(),this._content.loaderInfo=this._contentLoaderInfo,this._content.adaptee.reset(),this._content.adaptee.firstFrameOnSWFStart=!0,this._stage.adaptee.addChild(this._content.adaptee),FrameScriptManager.execute_as3_constructors(),this._content.dispatchStaticEvent("added",this._content),this._content.dispatch_ADDED_TO_STAGE(!0))):t.isAsset(Graphics)||t.isAsset(MorphSprite)||console.log("loaded unhandled asset-type")},X8g),BrowserSystemResourcesLoadingService=(u9g.getInstance=function(){return u9g._instance?u9g._instance:u9g._instance=new u9g},u9g.prototype.load=function(t,e){return this._promiseFile(t,e)},u9g.prototype._promiseFile=function(r,o){return new Promise(function(e,i){var n=new XMLHttpRequest;n.open("GET",r),n.responseType=o,n.onload=function(){var t=n.response;t?("json"===o&&"json"!==n.responseType&&(t=JSON.parse(t)),e(t)):i("Unable to load "+r+": "+n.statusText)},n.onerror=function(){i("Unable to load: xhr error")},n.send()})},u9g),U8g;function u9g(){}function X8g(){}function V8g(){var t=null!==U8g&&U8g.apply(this,arguments)||this;return t.flash={display:{EventDispatcher:EventDispatcher$1,DisplayObject:DisplayObject$1,DisplayObjectContainer:DisplayObjectContainer$1,Stage:Stage$1,Loader:Loader$1,LoaderInfo:LoaderInfo,MovieClip:MovieClip$1,Graphics:Graphics$1,Bitmap:Bitmap,BitmapData:BitmapData,SimpleButton:SimpleButton$1,Sprite:Sprite$1,Shape:Sprite$1,FrameLabel:FrameLabel},events:{EventDispatcher:EventDispatcher$1,Event:Event$1,KeyboardEvent:KeyboardEvent$2,MouseEvent:MouseEvent$2,ProgressEvent:ProgressEvent$1,IOErrorEvent:IOErrorEvent,TimerEvent:TimerEvent$1},external:{ExternalInterface:ExternalInterface$1},filters:{BevelFiler:BevelFilter,BitmapFilter:BitmapFilter,BlurFilter:BlurFilter,ColorMatrixFilter:ColorMatrixFilter,ConvolutionFilter:ConvolutionFilter,DisplacementMapFilter:DisplacementMapFilter,DropShadowFilter:DropShadowFilter,GlowFilter:GlowFilter,GradientBevelFilter:GradientBevelFilter,GradientGlowFilter:GradientGlowFilter},text:{TextField:TextField$1,TextFormat:TextFormat$1,TextSnapshot:TextSnapshot,TextLineMetrics:TextLineMetrics$1},geom:{Point:Point$1,Rectangle:Rectangle$1,Matrix:Matrix$1,ColorTransform:ColorTransform$1,Transform:Transform$1,Vector3D:Vector3D$1,Matrix3D:Matrix3D$1},net:{URLRequest:URLRequest$1,URLLoader:URLLoader$1,URLVariables:URLVariables$1,SharedObject:SharedObject},system:{ApplicationDomain:ApplicationDomain,Capabilities:Capabilities$1,LoaderContext:LoaderContext$1,Security:Security$1,fscommand:fscommand$1},ui:{ContextMenu:ContextMenu$1,ContextMenuItem:ContextMenuItem$1,ContextMenuBuiltInItems:ContextMenuBuiltInItems,Mouse:Mouse$2},utils:{ByteArray:ByteArray$1},media:{Sound:Sound,SoundChannel:SoundChannel$1,SoundTransform:SoundTransform$1,SoundMixer:SoundMixer$1},xml:{XMLDocument:XMLDocument,XMLNode:XMLNode$1}},t}console.debug("AwayFL - PlayerGlobal - 0.2.96");var AVMPlayer=(D9g=AVMStage,__extends(E9g,D9g),E9g.prototype.onAVMAvailable=function(t){"AVM1"==t.avmVersion?console.log("AVM1 has init"):"AVM2"==t.avmVersion&&console.log("AVM2 has init")},E9g),AVM1Player=(J9g=AVMStage,__extends(K9g,J9g),K9g),AVM2Player=(N9g=AVMStage,__extends(O9g,N9g),O9g),N9g,J9g,D9g;function O9g(t){var e=N9g.call(this,t)||this;return e.registerAVMStageHandler(new AVM2Handler(new PlayerGlobal)),e}function K9g(t){var e=J9g.call(this,t)||this;return e.registerAVMStageHandler(new AVM1Handler),e}function E9g(t){var e=D9g.call(this,t)||this;return e.registerAVMStageHandler(new AVM1Handler),e.registerAVMStageHandler(new AVM2Handler(new PlayerGlobal)),e.addEventListener(AVMEvent.AVM_COMPLETE,function(t){return e.onAVMAvailable(t)}),new AVMDebug(e),e}console.debug("AwayFL - AwayFL-Player - 0.2.13");var AVM1ButtonCustom=(R9g=AVM1Button,__extends(S9g,R9g),S9g.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,S9g,[],["$version#","_alpha#","getAwayJSID","attachAudio","attachBitmap","attachMovie","beginFill","beginBitmapFill","beginGradientFill","blendMode#","cacheAsBitmap#","_callFrame","clear","createEmptyMovieClip","createTextField","_currentframe#","curveTo","_droptarget#","duplicateMovieClip","enabled#","endFill","filters#","_framesloaded#","_focusrect#","forceSmoothing#","getBounds","getBytesLoaded","getBytesTotal","getDepth","getInstanceAtDepth","getNextHighestDepth","getRect","getSWFVersion","getTextSnapshot","getURL","globalToLocal","gotoAndPlay","gotoAndStop","_height#","_highquality#","hitArea#","hitTest","lineGradientStyle","lineStyle","lineTo","loadMovie","loadVariables","localToGlobal","_lockroot#","menu#","moveTo","_name#","nextFrame","opaqueBackground#","_parent#","play","prevFrame","_quality#","removeMovieClip","_root#","_rotation#","scale9Grid#","scrollRect#","setMask","_soundbuftime#","startDrag","stop","stopDrag","swapDepths","tabChildren#","tabEnabled#","tabIndex#","_target#","_totalframes#","trackAsMenu#","toString","unloadMovie","_url#","useHandCursor#","_visible#","_width#","_x#","_xmouse#","_xscale#","_y#","_ymouse#","_yscale#"])},S9g.prototype._mouseEventHandler=function(t){for(var e=this,i=this._actions,n=i.length,r=0;r<n;r++){var o=i[r];if(o.stateTransitionFlags===t){if(S9g.retryButtonIDS&&S9g.retryButtonAction&&S9g.retryButtonIDS[this.adaptee.symbolID])return AudioManager.setVolume(0),void S9g.retryButtonAction(function(){AudioManager.setVolume(1),e._runAction(o)});S9g.buttonPokiSDKActions[this.adaptee.name]?(AudioManager.setVolume(0),S9g.buttonPokiSDKActions[this.adaptee.name](function(){AudioManager.setVolume(1),e._runAction(o)})):S9g.buttonPokiSDKActions.all?(AudioManager.setVolume(0),S9g.buttonPokiSDKActions.all(function(){AudioManager.setVolume(1),e._runAction(o)})):this._runAction(o)}}},S9g),AVM1MovieClipCustom=($9g=AVM1MovieClip,__extends(_9g,$9g),_9g.createAVM1Class=function(t){return wrapAVM1NativeClass(t,!0,_9g,[],["$version#","_alpha#","getAwayJSID","attachAudio","attachBitmap","attachMovie","beginFill","beginBitmapFill","beginGradientFill","blendMode#","cacheAsBitmap#","_callFrame","clear","createEmptyMovieClip","createTextField","_currentframe#","curveTo","_droptarget#","duplicateMovieClip","enabled#","endFill","filters#","_framesloaded#","_focusrect#","forceSmoothing#","getBounds","getBytesLoaded","getBytesTotal","getDepth","getInstanceAtDepth","getNextHighestDepth","getRect","getSWFVersion","getTextSnapshot","getURL","globalToLocal","gotoAndPlay","gotoAndStop","_height#","_highquality#","hitArea#","hitTest","lineGradientStyle","lineStyle","lineTo","loadMovie","loadVariables","localToGlobal","_lockroot#","menu#","moveTo","_name#","nextFrame","opaqueBackground#","_parent#","play","prevFrame","_quality#","removeMovieClip","_root#","_rotation#","scale9Grid#","scrollRect#","setMask","_soundbuftime#","startDrag","stop","stopDrag","swapDepths","tabChildren#","tabEnabled#","tabIndex#","_target#","_totalframes#","trackAsMenu#","toString","unloadMovie","_url#","useHandCursor#","_visible#","_width#","_x#","_xmouse#","_xscale#","_y#","_ymouse#","_yscale#"])},_9g.prototype.findChildWithSymbolIDs=function(t){for(var e=t._children.length,i=0;i<e;i++){var n=t._children[i];if(n&&n.symbolID&&_9g.retryButtonIDS[n.symbolID])return!0;if(n&&n._children&&this.findChildWithSymbolIDs(n))return!0}return!1},_9g.prototype.stop=function(){return _9g.actionWhenRetryButtonEncountered&&_9g.retryButtonIDS&&this.findChildWithSymbolIDs(this.adaptee)&&_9g.actionWhenRetryButtonEncountered(),_9g.pokiSDKonStopAction&&_9g.pokiSDKonStopAction.action&&_9g.pokiSDKonStopAction.childName&&this.adaptee.getChildByName(_9g.pokiSDKonStopAction.childName)||_9g.pokiSDKonStopAction&&_9g.pokiSDKonStopAction.action&&_9g.pokiSDKonStopAction.childName&&"all"==_9g.pokiSDKonStopAction.childName?_9g.pokiSDKonStopAction.action():_9g.pokiSDKonStopAction&&_9g.pokiSDKonStopAction.action&&_9g.pokiSDKonStopAction.mcName&&_9g.pokiSDKonStopAction.mcName==this.adaptee.name&&(_9g.pokiSDKonStopAction.ignoreFrames&&0<=_9g.pokiSDKonStopAction.ignoreFrames.indexOf(this.adaptee.currentFrameIndex)||_9g.pokiSDKonStopAction.action()),this.adaptee.stop()},_9g),$9g,R9g;function _9g(){return null!==$9g&&$9g.apply(this,arguments)||this}function S9g(){return null!==R9g&&R9g.apply(this,arguments)||this}globalRedirectRules.push({test:/x.mochiads.com/,supressErrors:!0},{test:/AGI.swf/,resolve:"./assets/ads/AGI.swf"},{test:"http://cdn.nitrome.com/components/NitromeAPI.pkg",resolve:"./assets/NitromeAPI.pkg"});var AVMPlayerPoki=(fah=AVMPlayer,__extends(gah,fah),gah.prototype.registerCustomBox2D=function(t){BOX2D_PREFERENCE.custom=t,BOX2D_PREFERENCE.version="custom"},gah.prototype.onAVMAvailable=function(t){"AVM2"==t.avmVersion?new AVM2PokiSDK(this._gameConfig.pokiSDK):"AVM1"==t.avmVersion&&(AVM1PokiSDK.usePokiSDK=this._gameConfig.pokiSDK,AVM1Globals.registerCustomClass("PokiSDK2",AVM1PokiSDK.createAVM1Class(this._avmHandler.factory.avm1Context)),this._gameConfig.retryButtonIDS&&(this._gameConfig.retryButtonIDS=this._gameConfig.retryButtonIDS.reduce(function(t,e){return t[e]=!0,t},{})),(this._gameConfig.buttonPokiSDKActions||this._gameConfig.retryButtonIDS||this._gameConfig.retryButtonAction)&&(AVM1Globals.instance.Button=AVM1ButtonCustom.createAVM1Class(AVM1Globals.instance.context),this._gameConfig.buttonPokiSDKActions&&(AVM1ButtonCustom.buttonPokiSDKActions=this._gameConfig.buttonPokiSDKActions),this._gameConfig.retryButtonIDS&&(AVM1ButtonCustom.retryButtonIDS=this._gameConfig.retryButtonIDS),this._gameConfig.retryButtonAction&&(AVM1ButtonCustom.retryButtonAction=this._gameConfig.retryButtonAction)),(this._gameConfig.actionOnStop||this._gameConfig.retryButtonIDS||this._gameConfig.actionWhenRetryButtonEncountered)&&(AVM1Globals.instance.MovieClip=AVM1MovieClipCustom.createAVM1Class(AVM1Globals.instance.context),this._gameConfig.actionOnStop&&(AVM1MovieClipCustom.pokiSDKonStopAction=this._gameConfig.actionOnStop),this._gameConfig.retryButtonIDS&&(AVM1MovieClipCustom.retryButtonIDS=this._gameConfig.retryButtonIDS),this._gameConfig.actionWhenRetryButtonEncountered&&(AVM1MovieClipCustom.actionWhenRetryButtonEncountered=this._gameConfig.actionWhenRetryButtonEncountered)))},gah),fah;function gah(e){var i=fah.call(this,e)||this;if(!e.files||!e.files.length)throw"AVMPlayerPoki: gameConfig.files must have positive length";return(window.AVMPlayerPoki=i)._gameConfig.showFPS&&(i.showFrameRate=!0),i._gameConfig.redirects&&globalRedirectRules.push.apply(globalRedirectRules,i._gameConfig.redirects),i._gameConfig.box2dVersion&&(BOX2D_PREFERENCE.version=e.box2dVersion),!1===i._gameConfig.multisample&&(ContextWebGLFlags.PREF_MULTISAMPLE=!1),i._gameConfig.useWebGL1&&(ContextWebGLFlags.PREF_VERSION=1),i.addEventListener(LoaderEvent.LOADER_COMPLETE,function(t){return i._gameConfig.start?void(window.pokiGameParseComplete&&window.pokiGameParseComplete(function(){return i.play(e.skipFramesOfScene)})):(window.pokiGameParseComplete&&window.pokiGameParseComplete(),void i.play(e.skipFramesOfScene))}),e.box2DCustom&&i.registerCustomBox2D(e.box2DCustom),e.preventLoad||i.load(),i}console.debug("Poki-Player - 0.0.4"),console.debug("BadIceCream - 0.0.23");var _0x2e92=["bG9jYWxob3N0","LnBva2kuY29t","LnBva2ktZ2RuLmNvbQ==","YXdheXN0dWRpb3MuY29t","hostname","location","length","indexOf","aHR0cHM6Ly9wb2tpLmNvbS9zaXRlbG9jaw==","href","top"],dd=document.createElement("script");dd.innerHTML=atob("KGZ1bmN0aW9uIGEoKXt0cnl7KGZ1bmN0aW9uIGIoKXtkZWJ1Z2dlcjtiKCl9KSgpfWNhdGNoKGUpe3NldFRpbWVvdXQoYSw1ZTMpfX0pKCk"),document.head.appendChild(dd),window.startPokiGame=function(t){return new AVMPlayerPoki(t)}}();