@awayjs/core
Version:
AwayJS core classes
15 lines (13 loc) • 177 kB
JavaScript
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).AwayjsCore={})}(this,(function(t){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation.
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */var e=function(t,i){return e=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])},e(t,i)};function i(t,i){function r(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}var r=function(t){function e(e,i,r){void 0===e&&(e=""),void 0===i&&(i=0),void 0===r&&(r="");var n=t.call(this,e)||this;return n._errorID=0,n._messsage="",n._name="",n._messsage=e,n._name=r,n._errorID=i,n}return i(e,t),Object.defineProperty(e.prototype,"message",{get:function(){return this._messsage},set:function(t){this._messsage=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(t){this._name=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"errorID",{get:function(){return this._errorID},enumerable:!1,configurable:!0}),e}(Error),n=function(t){function e(e,i){return void 0===e&&(e=null),void 0===i&&(i=0),t.call(this,e||"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.",i)||this}return i(e,t),e}(r),o=function(){function t(t){this._iAllowedToPropagate=!0,this._iAllowedToImmediatlyPropagate=!0,this.type=t}return t.prototype.clone=function(){return new t(this.type)},t}(),s=function(t){function e(e,i,r){void 0===r&&(r=null);var n=t.call(this,e)||this;return n._asset=i,n._prevName=r||n._asset.name,n}return i(e,t),Object.defineProperty(e.prototype,"asset",{get:function(){return this._asset},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"prevName",{get:function(){return this._prevName},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return new e(this.type,this._asset,this._prevName)},e.INVALIDATE="invalidate",e.CLEAR="clear",e.RENAME="rename",e.ENTER_FRAME="enterFrame",e.EXIT_FRAME="exitFrame",e.ASSET_CONFLICT_RESOLVED="assetConflictResolved",e.ASSET_COMPLETE="assetComplete",e.TEXTURE_SIZE_ERROR="textureSizeError",e}(o),a=function(){function t(t){void 0===t&&(t=null),this._listenerObjects={},this._t=t||this}return t.prototype.addEventListener=function(t,e){var i=this._listenerObjects[t];void 0===i&&(i=this._listenerObjects[t]=new h),i.addEventListener(e)},t.prototype.removeEventListener=function(t,e){var i=this._listenerObjects[t];i&&(i.removeEventListener(e),0==i.numListeners&&delete this._listenerObjects[t])},t.prototype.dispatchEvent=function(t,e){void 0===e&&(e=null);var i=this._listenerObjects[t.type];i&&(t.target=e||this._t,t.currentTarget=this._t,i.dispatchEvent(t))},t.prototype.hasEventListener=function(t,e){return void 0!==this._listenerObjects[t]&&(null!=e?-1!==this._listenerObjects[t].getEventListenerIndex(e):this._listenerObjects[t].numListeners>0)},t.prototype.removeAllEventListeners=function(){this._listenerObjects={}},t}(),h=function(){function t(){this._index=0,this._listeners=new Array,this.numListeners=0}return t.prototype.addEventListener=function(t){-1===this._listeners.indexOf(t)&&(this._listeners.push(t),this.numListeners++)},t.prototype.removeEventListener=function(t){var e=this._listeners.indexOf(t);-1!==e&&(this._listeners.splice(e,1),e<=this._index&&this._index--,this.numListeners--)},t.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++);},t.prototype.getEventListenerIndex=function(t){return this._listeners.indexOf(t)},t}(),u=function(){function t(){}return Object.defineProperty(t,"Current",{get:function(){return this.id},enumerable:!1,configurable:!0}),t.Next=function(){return this.id++},t.id=0,t}(),p=function(t){function e(){var e=t.call(this)||this;return e._abstractionPool={},e.id=u.Next(),e}return i(e,t),Object.defineProperty(e.prototype,"finalizer",{get:function(){var t=this;return this.__finalizer||(this.__finalizer=new FinalizationRegistry((function(e){var i=t._abstractionPool[e];i&&(console.debug("["+i.constructor.name+"] abstraction was deleted by GC:",e),i.onClear(null))})))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adaptee",{get:function(){return this},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"adapter",{get:function(){return this._adapter||this},set:function(t){this._adapter=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"assetType",{get:function(){throw new n},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"name",{get:function(){return this._name},set:function(t){var e=this._name;this._name=t,null==this._name&&(this._name="null"),this.dispatchEvent(new s(s.RENAME,this,e))},enumerable:!1,configurable:!0}),e.prototype.invalidate=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onInvalidate(null)},e.prototype.dispose=function(){throw new n},e.prototype.clone=function(){throw new n},e.prototype.clear=function(){for(var t in this._abstractionPool)this._abstractionPool[t].onClear(null)},Object.defineProperty(e.prototype,"assetNamespace",{get:function(){return this._namespace},set:function(t){this._namespace=t||e.DEFAULT_NAMESPACE},enumerable:!1,configurable:!0}),e.prototype.assetPathEquals=function(t,e){return this._name==t&&(!e||this._namespace==e)},e.prototype.isAsset=function(t){return this.assetType==t.assetType},e.prototype.resetAssetPath=function(t,i){void 0===i&&(i=null),this._name=t||"null",this._namespace=i||e.DEFAULT_NAMESPACE},e.prototype.getAbstraction=function(t){return this._abstractionPool[t.id]||(this._abstractionPool[t.id]=this.getNewAbstraction(t))},e.prototype.checkAbstraction=function(t){return this._abstractionPool[t.id]},e.prototype.clearAbstraction=function(t){"number"!=typeof t?(t.storeAbstraction(this._abstractionPool[t.id]),delete this._abstractionPool[t.id]):delete this._abstractionPool[t]},e.prototype.getNewAbstraction=function(t){var e=t.requestAbstraction(this);return e.init(this,t),e},e.DEFAULT_NAMESPACE="default",e}(a),c=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._stopped=!1,e._loops=0,e._id=-1,e._isLooping=!1,e._isPlaying=!1,e._isDecoding=!1,e}return i(e,t),Object.defineProperty(e.prototype,"stopped",{get:function(){return this._stopped},enumerable:!1,configurable:!0}),e.prototype.isLooping=function(){return this._isLooping},e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isDecoding=function(){return this._isDecoding},e.prototype.play=function(t,e,i,r,n){this._loops="number"==typeof i?i:i?1e3:0,this._id=r||-1},e.prototype.dispatchRestart=function(){this.dispatchEvent(e.RESTART_EVENT)},e.prototype.tryRestartLoop=function(){return this._loops--,!(this._loops<=0)&&(!!this.restart()||(this._loops=0,!1))},e.prototype.completeInternally=function(t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),i&&this.tryRestartLoop()||t&&this.dispatchEvent(e.COMPLETE_EVENT)},e.prototype.dispatchComplete=function(){this.dispatchEvent(e.COMPLETE_EVENT)},e.prototype.dispatchStop=function(t){void 0===t&&(t=!1),this.dispatchEvent(t?e.ERROR_EVENT:e.STOP_EVENT),this.owner=null,this._stopped=!0,this.removeAllEventListeners()},e.COMPLETE="complete",e.RESTART="restart",e.STOP="stop",e.ERROR="error",e.RESTART_EVENT=new o(e.RESTART),e.COMPLETE_EVENT=new o(e.COMPLETE),e.STOP_EVENT=new o(e.STOP),e.ERROR_EVENT=new o(e.ERROR),e}(a),l=function(t){function e(e,i,r){void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1);var n=t.call(this)||this;return n._groupID=0,n._groupVolume=1,n._groupPan=0,n._startTime=0,n._groupID=e,n._groupVolume=i,n._groupPan=r,n._sourceOpenDelegate=function(t){return n._sourceOpen(t)},n._updateEndDelegate=function(t){return n._updateEnd(t)},n._audio=new Audio,n._audio.ontimeupdate=function(t){return n._onTimeUpdate(t)},n._updateSource(),n}return i(e,t),e.stopAllSounds=function(t){void 0===t&&(t=-1);var i=e._channels.length;if(t<0){for(var r=0;r<i;r++)e._channels[r].stop();e._channels.length=0}else{var n=[];for(r=0;r<i;r++)e._channels[r].groupID==t?e._channels[r].stop():n[n.length]=e._channels[r];e._channels=n}},e.setChannelGroupVolume=function(t,i){void 0===i&&(i=-1);var r=e._channels.length;if(i<0)for(var n=0;n<r;n++)e._channels[n].groupVolume=t;else for(n=0;n<r;n++)e._channels[n].groupID==i&&(e._channels[n].groupVolume=t)},Object.defineProperty(e.prototype,"duration",{get:function(){return this._duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._audio.currentTime-this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupVolume",{get:function(){return this._groupVolume},set:function(t){this._groupVolume!=t&&(this._groupVolume=t,this._audio.volume=this._groupVolume*this._volume)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume!=t&&(this._volume=t,this._audio.volume=this._volume)},enumerable:!1,configurable:!0}),e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isLooping=function(){return this._isLooping},e.prototype.isDecoding=function(){return!1},Object.defineProperty(e.prototype,"pan",{get:function(){return 0},set:function(t){},enumerable:!1,configurable:!0}),e.prototype.restart=function(){return console.warn("[StreamingAudioChannel] Restart not implemented"),!1},e.prototype.play=function(e,i,r){void 0===i&&(i=0),void 0===r&&(r=!1),t.prototype.play.call(this,e,i,r,0),this._isPlaying=!0,(this._isLooping||this._isLooping!=this._loops>0)&&(this._isLooping=this._loops>0,this._sourceDirty=!0),this._sourceDirty&&this._updateSource(),this._buffer=e,this._offset=i,this._audio.volume=this._groupVolume*this._volume,this._isQueuing||this._isOpening||this._queueBuffer()},e.prototype.stopInternally=function(e){void 0===e&&(e=!1),this._audio.pause(),this._isPlaying=!1,this._isLooping=!1,t.prototype.completeInternally.call(this,e,e)},e.prototype.stop=function(){this.stopInternally(!1),this.dispatchStop(!1)},e.prototype._sourceOpen=function(t){if(this._isOpening=!1,this._mediaSource.activeSourceBuffers.length)return console.log("ERR: double sourceopen event called"),void this.dispatchStop(!0);this._sourceBuffer=this._mediaSource.addSourceBuffer("audio/mpeg"),this._sourceBuffer.addEventListener("updateend",this._updateEndDelegate),this._isPlaying&&this._queueBuffer()},e.prototype._queueBuffer=function(){this._isQueuing=!0,this._startTime=this._sourceBuffer.timestampOffset,this._sourceBuffer.appendBuffer(this._buffer)},e.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()},e.prototype._onTimeUpdate=function(t){!this._isLooping&&this._duration<this._audio.currentTime-this._startTime+.1&&this.stopInternally(!0)},e.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},e.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},e.maxChannels=4,e._channels=new Array,e}(c),_=function(t){function e(i,r,n){void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=1);var o=t.call(this)||this;return o._volume=1,o._pan=-1,o._groupID=0,o._groupVolume=1,o._groupPan=0,o._startTime=0,o._groupID=i,o._groupVolume=r,o._groupPan=n,o._audioCtx=e.getAudioContext(),o._usingNativePanner="function"==typeof o._audioCtx.createStereoPanner,o._gainNode=o._audioCtx.createGain(),o._gainNode.gain.value=o._groupVolume*o._volume,o._pannerNode=o._usingNativePanner?o._audioCtx.createStereoPanner():o._audioCtx.createPanner(),o.pan=0,o._gainNode.connect(o._pannerNode),o._pannerNode.connect(o._audioCtx.destination),o._onEndedDelegate=function(t){return o._onEnded(t)},o}return i(e,t),e.getOfflineContext=function(t,e,i){void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=44100);var r=self.OfflineAudioContext||self.webkitOfflineAudioContext;return r?new r(t,e,i):null},e.getAudioContext=function(){var t=self.AudioContext||self.webkitAudioContext;return!e._audioCtx&&t&&(e._audioCtx=new t),e._audioCtx&&"suspended"==e._audioCtx.state&&e._audioCtx.resume(),e._audioCtx},e.stopAllSounds=function(t){void 0===t&&(t=-1);var i=e._channels.length;if(t<0){for(var r=0;r<i;r++)e._channels[r].stop();e._channels.length=0}else{var n=[];for(r=0;r<i;r++)e._channels[r].groupID==t?e._channels[r].stop():n[n.length]=e._channels[r];e._channels=n}},e.setChannelGroupVolume=function(t,i){void 0===i&&(i=-1);var r=e._channels.length;if(i<0)for(var n=0;n<r;n++)e._channels[n].groupVolume=t;else for(n=0;n<r;n++)e._channels[n].groupID==i&&(e._channels[n].groupVolume=t)},Object.defineProperty(e.prototype,"duration",{get:function(){return this._duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._isDecoding?this._currentTime:this._audioCtx.currentTime-this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"pan",{get:function(){return this._pan},set:function(t){if(this._pan!=t)if(this._pan=t,this._usingNativePanner)this._pannerNode.pan.value=this._pan;else{var e=this._pan*(Math.PI/2);this._pannerNode.setPosition(Math.sin(e),0,Math.cos(e))}},enumerable:!1,configurable:!0}),e.prototype.restart=function(){if(this._isPlaying=!1,this._stopped)throw"You can't restart channel that was fully stopped";var t=e._decodeCache[this._id];return!!t&&(this._isPlaying=!0,this.executeBuffer(t),this.dispatchRestart(),!0)},e.prototype.play=function(i,r,n,o,s){void 0===r&&(r=0),void 0===n&&(n=!1),void 0===o&&(o=0),0!==i.byteLength?(t.prototype.play.call(this,i,r,n,o,s),this._isLooping=this._loops>0,this._isPlaying=!0,this._currentTime=r,this._isDecoding=!0,e._decodeCache[o]?this.executeBuffer(e._decodeCache[o]):e._errorCache[o]?(this.stopInternally(!1),this.dispatchStop(!0)):this._decodeAndExecute(i,s)):console.warn("[WabAudioChannel] Input buffer is empty")},e.prototype.stopInternally=function(e){void 0===e&&(e=!0),this._isPlaying&&(this._isPlaying=!1,this._isLooping=!1,this._isDecoding=!1,this._source&&this._disposeSource(),t.prototype.completeInternally.call(this,e,e))},e.prototype.stop=function(){this.stopInternally(!1),this.dispatchStop(!1)},e.prototype._decodeAndExecute=function(t,i){var r=this,n=this._audioCtx;try{i&&i.sampleRate&&i.sampleRate!==this._audioCtx.sampleRate&&i.samplesCount&&(n=e.getOfflineContext(2,i.samplesCount+i.startOffset,i.sampleRate))}catch(t){console.warn("[WebAudioChannel] Error when try create Offline Context:",t.message,i)}var o=n.decodeAudioData(t.slice(0),(function(t){return r._onDecodeComplete(t,i)}),(function(t){return r._onError(t)}));o instanceof self.Promise&&o.catch((function(t){return r._onError(t)}))},e.prototype._onDecodeComplete=function(t,i){e._decodeCache[this._id]||(i&&i.startOffset>0&&(t=this.removeSilent(t,i.startOffset,i.samplesCount,i.sampleRate)),e._decodeCache[this._id]=t),t=e._decodeCache[this._id],this._isPlaying&&this.executeBuffer(t)},e.prototype.executeBuffer=function(t){this._source&&this._disposeSource(),this._isDecoding=!1,this._source=this._audioCtx.createBufferSource(),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{var e=this._groupVolume,i=this._pan;this._groupVolume=-1,this._pan=-1,this.groupVolume=e,this.pan=i,this._source.start(this._audioCtx.currentTime,this._currentTime)}catch(t){console.warn("[WebAudioChannel] Error starting audio: "+t),this.dispatchStop(!0),this._disposeSource()}},e.prototype._onError=function(t){console.warn("[WebAudioChannel] Error with decoding audio data:",t),e._errorCache[this._id]=!0,this._isDecoding=!1,this.stopInternally(!1),this.dispatchStop(!0)},e.prototype._onEnded=function(t){this.stopInternally(!0)},e.prototype._disposeSource=function(){this._source.onended=null,this._source.stop(this._audioCtx.currentTime),this._source.disconnect(),this._source=null},e.prototype.removeSilent=function(t,e,i,r){void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=0),i=i||t.length,r=r||t.sampleRate,e=Math.ceil(t.sampleRate*e/r),i=t.sampleRate*i/r|0;for(var n=Math.min(t.length,i+e),o=this._audioCtx.createBuffer(t.numberOfChannels,i,t.sampleRate),s=0;s<t.numberOfChannels;s++)o.copyToChannel(t.getChannelData(s).subarray(e,n),s,0);return o},e.maxChannels=128,e._channels=new Array,e._decodeCache={},e._errorCache={},e}(c),f=_.getAudioContext();if(f&&"suspended"===f.state){var d=function(){f.resume();var t=f.createBuffer(1,1,22050),e=f.createBufferSource();e.buffer=t,e.connect(f.destination),e.start(),setTimeout((function(){"running"===f.state&&(document.removeEventListener("touchstart",d,!1),document.removeEventListener("touchend",d,!1))}),0)};document.addEventListener("touchstart",d,!1),document.addEventListener("touchend",d,!1)}var y=function(){function t(){this.position=0,this.length=0,this._mode=""}return t.prototype.writeByte=function(t){throw"Virtual method"},t.prototype.readByte=function(){throw"Virtual method"},t.prototype.writeUnsignedByte=function(t){throw"Virtual method"},t.prototype.readUnsignedByte=function(){throw"Virtual method"},t.prototype.writeUnsignedShort=function(t){throw"Virtual method"},t.prototype.readUnsignedShort=function(){throw"Virtual method"},t.prototype.writeUnsignedInt=function(t){throw"Virtual method"},t.prototype.readUnsignedInt=function(){throw"Virtual method"},t.prototype.writeFloat=function(t){throw"Virtual method"},t.prototype.toFloatBits=function(t){throw"Virtual method"},t.prototype.readFloat=function(t){throw"Virtual method"},t.prototype.fromFloatBits=function(t){throw"Virtual method"},t.prototype.getBytesAvailable=function(){throw new n("ByteArrayBase, getBytesAvailable() not implemented ")},t.prototype.toString=function(){return"[ByteArray] ( "+this._mode+" ) position="+this.position+" length="+this.length},t.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,r=!0;r&&e>=4;)e-=4,this.readUnsignedInt()!=t.readUnsignedInt()&&(r=!1);for(;r&&e>=1;)e--,this.readUnsignedByte()!=t.readUnsignedByte()&&(r=!1);return this.position-=i-e,t.position-=i-e,r},t.prototype.writeBase64String=function(t){},t.prototype.dumpToConsole=function(){var t=this.position;this.position=0;function e(t,e){for(var i=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"],r="",n=0;n<e;n++)r=i[t>>(n<<2)&15]+r;return r}for(var i=0;i<this.length;i+=8){for(var r=e(i,4)+":",n=0;n<8&&i+n<this.length;n++)r+=" "+e(this.readUnsignedByte(),2);console.log(r)}this.position=t},t.prototype.readBase64String=function(e){return(null==e||e>this.length-this.position)&&(e=this.length-this.position),e>0?t.internalGetBase64String(e,this.readUnsignedByte,this):""},t.internalGetBase64String=function(e,i,r){for(var n,o,s,a,h,u,p,c="",l=t.Base64Key;e>=3;)a=(n=i.apply(r))>>2,h=(3&n)<<4|(o=i.apply(r))>>4,u=(15&o)<<2|(s=i.apply(r))>>6,p=63&s,c+=l.charAt(a)+l.charAt(h)+l.charAt(u)+l.charAt(p),e-=3;return 2==e?(a=(n=i.apply(r))>>2,h=(3&n)<<4|(o=i.apply(r))>>4,u=(15&o)<<2,c+=l.charAt(a)+l.charAt(h)+l.charAt(u)+"="):1==e&&(a=(n=i.apply(r))>>2,h=(3&n)<<4,c+=l.charAt(a)+l.charAt(h)+"=="),c},t.Base64Key="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",t}(),g=function(t){function e(e){void 0===e&&(e=4);var i=t.call(this)||this;return i._mode="Typed array",i.maxlength=Math.max(e+255&-256,4),i.arraybytes=new ArrayBuffer(i.maxlength),i.unalignedarraybytestemp=new ArrayBuffer(16),i}return i(e,t),e.prototype.ensureWriteableSpace=function(t){this.ensureSpace(t+this.position)},e.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},e.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},e.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},e.prototype.getBytesAvailable=function(){return this.length-this.position},e.prototype.ensureSpace=function(t){if(t>this.maxlength){var e=t+255&-256,i=new ArrayBuffer(e),r=new Uint8Array(this.arraybytes,0,this.length);new Uint8Array(i,0,this.length).set(r),this.arraybytes=i,this.maxlength=e}},e.prototype.writeObject=function(t){console.log("writeObject not implemented yet in core/ByteArray")},e.prototype.readObject=function(){return console.log("readObject not implemented yet in core/ByteArray"),{}},e.prototype.writeByte=function(t){this.ensureWriteableSpace(1),new Int8Array(this.arraybytes)[this.position++]=~~t,this.position>this.length&&(this.length=this.position)},e.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++]},e.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 r=new Int8Array(t.arraybytes),n=new Int8Array(this.arraybytes);r.set(n.subarray(this.position,this.position+i),e),this.position+=i,i+e>t.length&&(t.length+=i+e-t.length)},e.prototype.writeUnsignedByte=function(t){this.ensureWriteableSpace(1),new Uint8Array(this.arraybytes)[this.position++]=255&~~t,this.position>this.length&&(this.length=this.position)},e.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++]},e.prototype.writeUnsignedShort=function(t){if(this.ensureWriteableSpace(2),0==(1&this.position)){new Uint16Array(this.arraybytes)[this.position>>1]=65535&~~t}else{new Uint16Array(this.unalignedarraybytestemp,0,1)[0]=65535&~~t;var 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)},e.prototype.readUTFBytes=function(t){for(var e="",i=this.position+t,r=new DataView(this.arraybytes);this.position<i;){var n=r.getUint8(this.position++);if(n<128){if(0==n)break;e+=String.fromCharCode(n)}else if(n<224)e+=String.fromCharCode((63&n)<<6|127&r.getUint8(this.position++));else if(n<240){var o=r.getUint8(this.position++);e+=String.fromCharCode((31&n)<<12|(127&o)<<6|127&r.getUint8(this.position++))}else{o=r.getUint8(this.position++);var s=r.getUint8(this.position++);e+=String.fromCharCode((15&n)<<18|(127&o)<<12|s<<6&127|127&r.getUint8(this.position++))}}return e},e.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){var r=e.length%4;for(i=0;i<r;i++)this.writeUnsignedByte(0)}return e.length},e.prototype.readInt=function(){var t=new DataView(this.arraybytes).getInt32(this.position,!0);return this.position+=4,t},e.prototype.readShort=function(){var t=new DataView(this.arraybytes).getInt16(this.position,!0);return this.position+=2,t},e.prototype.readDouble=function(){var t=new DataView(this.arraybytes).getFloat64(this.position,!0);return this.position+=8,t},e.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]},e.prototype.writeUnsignedInt=function(t){if(this.ensureWriteableSpace(4),0==(3&this.position)){new Uint32Array(this.arraybytes)[this.position>>2]=4294967295&~~t}else{new Uint32Array(this.unalignedarraybytestemp,0,1)[0]=4294967295&~~t;var 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)},e.prototype.writeInt=function(t){if(this.ensureWriteableSpace(4),0==(3&this.position)){new Int32Array(this.arraybytes)[this.position>>2]=~~t}else{new Int32Array(this.unalignedarraybytestemp,0,1)[0]=~~t;var 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)},e.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]},e.prototype.writeFloat=function(t){if(this.ensureWriteableSpace(4),0==(3&this.position)){new Float32Array(this.arraybytes)[this.position>>2]=t}else{new Float32Array(this.unalignedarraybytestemp,0,1)[0]=t;var 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)},e.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]},e}(y),m=function(){function t(){}return t.arrayBufferToBase64=function(t,e){for(var i="",r=new Uint8Array(t),n=r.byteLength,o=0;o<n;o++)i+=String.fromCharCode(r[o]);return"data:"+e+";base64,"+window.btoa(i)},t.arrayBufferToAudio=function(e,i){var r=t.arrayBufferToBase64(e,"audio/"+i),n=new Audio;return n.src=r,n},t.arrayBufferToImage=function(e){var i=t.arrayBufferToBase64(e,"image/png"),r=new Image;return r.src=i,r},t.byteArrayToImage=function(e){var i=t.arrayBufferToBase64(e.arraybytes,"image/png"),r=new Image;return r.src=i,r},t.byteArrayToAudio=function(e,i){var r=t.arrayBufferToBase64(e.arraybytes,"audio/"+i),n=new Audio;return n.src=r,n},t.blobToImage=function(t){var e=(window.URL||window.webkitURL).createObjectURL(t),i=new Image;return i.src=e,i},t.blobToAudio=function(t){var e=(window.URL||window.webkitURL).createObjectURL(t),i=new Audio;return i.src=e,i},t.toByteArray=function(t){var e=new g;return e.setArrayBuffer(t),e},t.toString=function(t,e){if(void 0===e&&(e=0),"string"==typeof t){var i=t;if(null!=i.substr)return i.substr(0,i.length)}if(t instanceof g){var r=t;return r.position=0,r.readUTFBytes(Math.min(r.getBytesAvailable(),e))}return null},t}(),w=function(t){function e(e,i,r){void 0===e&&(e=0),void 0===i&&(i=1),void 0===r&&(r=1);var n=t.call(this)||this;return n._groupID=0,n._groupVolume=1,n._groupPan=0,n._startTime=0,n._groupID=e,n._groupVolume=i,n._groupPan=r,n._audio=new Audio,n._audio.ontimeupdate=function(t){return n._onTimeUpdate(t)},n}return i(e,t),e.stopAllSounds=function(t){void 0===t&&(t=-1);var i=e._channels.length;if(t<0){for(var r=0;r<i;r++)e._channels[r].stop();e._channels.length=0}else{var n=[];for(r=0;r<i;r++)e._channels[r].groupID==t?e._channels[r].stop():n[n.length]=e._channels[r];e._channels=n}},e.setChannelGroupVolume=function(t,i){void 0===i&&(i=-1);var r=e._channels.length;if(i<0)for(var n=0;n<r;n++)e._channels[n].groupVolume=t;else for(n=0;n<r;n++)e._channels[n].groupID==i&&(e._channels[n].groupVolume=t)},Object.defineProperty(e.prototype,"duration",{get:function(){return this._duration},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._audio.currentTime-this._startTime},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pan",{get:function(){return 0},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupID",{get:function(){return this._groupID},set:function(t){this._groupID=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupVolume",{get:function(){return this._groupVolume},set:function(t){this._groupVolume!=t&&(this._groupVolume=t,this._audio.volume=this._groupVolume*this._volume)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"groupPan",{get:function(){return this._groupPan},set:function(t){},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(t){this._volume!=t&&(this._volume=t,this._audio.volume=this._volume)},enumerable:!1,configurable:!0}),e.prototype.isPlaying=function(){return this._isPlaying},e.prototype.isLooping=function(){return this._isLooping},e.prototype.isDecoding=function(){return!1},e.prototype.restart=function(){if(this._isPlaying=!1,this._stopped)throw"You can't restart channel that was fully stopped";return!!this._audio&&(this._isPlaying=!0,this._audio.play(),this.dispatchRestart(),!0)},e.prototype.play=function(i,r,n,o){var s=this;void 0===r&&(r=0),void 0===n&&(n=!1),void 0===o&&(o=0),t.prototype.play.call(this,i,r,n,o),this._isPlaying=!0,this._isLooping=this._loops>0,this._audio.src=e._base64Cache[o]||(e._base64Cache[o]=m.arrayBufferToBase64(i,"audio/mp3"));var a=this._audio;this._audio.addEventListener("loadedmetadata",(function(){a.currentTime=r,a.play()}),!1),this._audio.addEventListener("error",(function(t){console.log("error in audio",t),s.dispatchStop(!0)}),!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),s.dispatchStop(!0)}),!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)},e.prototype.stopInternally=function(e){void 0===e&&(e=!1),this._audio.pause(),this._isPlaying=!1,this._isLooping=!1,t.prototype.completeInternally.call(this,e,e)},e.prototype.stop=function(){this.stopInternally(!1),this.dispatchStop(!1)},e.prototype._onTimeUpdate=function(t){!this._isLooping&&this._audio.duration<this._audio.currentTime-this._startTime+.1&&this.stopInternally(!0)},e.maxChannels=4,e._channels=new Array,e._base64Cache={},e}(c),v=function(){function t(){}return t.setVolume=function(e,i){if(void 0===i&&(i=-1),i<0)for(var r=t._channelGroupVolumes.length,n=0;n<r;n++)t._channelGroupVolumes[n]=e;else t._channelGroupVolumes[i]=e;_.setChannelGroupVolume(e,i),l.setChannelGroupVolume(e,i),w.setChannelGroupVolume(e,i)},t.getVolume=function(e){return void 0===e&&(e=0),t._channelGroupVolumes[e]},t.setExternalSoundInterface=function(e){null!=e.startSound?null!=e.stopSound?t._externalSoundInterface=e: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")},t.getExternalSoundInterface=function(){return t._externalSoundInterface},t.stopAllSounds=function(){_.stopAllSounds(),l.stopAllSounds(),w.stopAllSounds()},t.getChannel=function(e,i){void 0===i&&(i=0);var r=e>5e7?l:_;t.isIE&&(r=w);for(var n=0;r._channels[n]&&r._channels[n].isPlaying();)n++;if(n==r.maxChannels){for(var o=void 0,s=r._channels.length,a=0;a<s;a++)if(!(o=r._channels[a]).isLooping()&&!o.isDecoding())return o.groupID=i,o.groupVolume=t._channelGroupVolumes[i],o.groupPan=t._channelGroupPanning[i],r._channels.push(r._channels.splice(a,1)[0]),o.stop(),o;return null}return r._channels[n]=new r(i,t._channelGroupVolumes[i],t._channelGroupPanning[i])},t.isIE=!!navigator.userAgent.match(/Trident/g)||!!navigator.userAgent.match(/MSIE/g),t._externalSoundInterface=null,t._channelGroupVolumes=[1],t._channelGroupPanning=[.5],t}(),b=function(t){function e(e,i){void 0===i&&(i=0);var r=t.call(this)||this;return r._volume=1,r._pan=0,r._audioChannels=[],r._channelsPlaying=0,r._data=e,r._channelGroup=i,r.onChannelCompleteStopError=r.onChannelCompleteStopError.bind(r),r}return i(e,t),Object.defineProperty(e.prototype,"isPlaying",{get:function(){return this._channelsPlaying>0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"assetType",{get:function(){return e.assetType},enumerable:!1,configurable:!0}),e.prototype.detachChannel=function(t){t&&(t.removeEventListener(c.COMPLETE,this.onChannelCompleteStopError),t.removeEventListener(c.STOP,this.onChannelCompleteStopError),t.removeEventListener(c.ERROR,this.onChannelCompleteStopError))},e.prototype.attachChannel=function(t){t&&(t.owner=this,t.addEventListener(c.COMPLETE,this.onChannelCompleteStopError),t.addEventListener(c.STOP,this.onChannelCompleteStopError),t.addEventListener(c.ERROR,this.onChannelCompleteStopError))},e.prototype.onChannelCompleteStopError=function(t){var e=t.target,i=this._audioChannels.indexOf(e);i>=0&&(this.detachChannel(e),this._audioChannels.splice(i,1),this._channelsPlaying--),0===this._channelsPlaying&&this.stopInternal(!1)},Object.defineProperty(e.prototype,"pan",{get:function(){return this._pan},set:function(t){this._pan!=t&&(this._pan=t,this._audioChannel&&(this._audioChannel.pan=this._pan))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"channelGroup",{get:function(){return this._channelGroup},set:function(t){if(this._channelGroup!=t){this._channelGroup=t;for(var e=v.getVolume(t),i=0;i<this._audioChannels.length;i++)this._audioChannels[i].groupVolume=e}},enumerable:!1,configurable:!0}),Object.defineProperty(e.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:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentTime",{get:function(){return this._audioChannel?this._audioChannel.currentTime:0},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"duration",{get:function(){return this._audioChannel?this._audioChannel.duration:0},enumerable:!1,configurable:!0}),e.prototype.dispose=function(){this.stop()},e.prototype.play=function(t,e){return void 0===e&&(e=!1),this._audioChannel=v.getChannel(this._data.size,this.channelGroup),this._audioChannel&&(this._channelsPlaying++,this._audioChannels.push(this._audioChannel),this._audioChannel.volume=this._volume,this.attachChannel(this._audioChannel),this._data.play(this._audioChannel,t,e,this.id)),this._audioChannel},e.prototype.stopInternal=function(t){void 0===t&&(t=!1);for(var e=0,i=this._audioChannels;e<i.length;e++){var r=i[e];(r.stopped||t)&&this.detachChannel(r),t&&r.stop()}this._channelsPlaying=0,this._audioChannels.length=0,this._audioChannel=null},e.prototype.stop=function(){this.stopInternal(!0)},e.prototype.clone=function(){var t=new e(this._data);return t.name=this.name,t},e.assetType="[asset WaveAudio]",e}(p),D=function(){function t(t,e){t instanceof Blob?this._blob=t:t instanceof g?this._buffer=t.arraybytes:ArrayBuffer.isView(t)?this._buffer=t.buffer:this._buffer=t,this.meta=e}return Object.defineProperty(t.prototype,"size",{get:function(){return this._buffer?this._buffer.byteLength:this._blob.size},enumerable:!1,configurable:!0}),t.prototype.play=function(t,e,i,r){var n=this;if(this._buffer)t.play(this._buffer,e,i,r,this.meta);else if(!this._loading){this._loading=!0;var o=new FileReader;o.onload=function(o){return n._blobConverted(o,t,e,i,r)},o.readAsArrayBuffer(this._blob)}},t.prototype._blobConverted=function(t,e,i,r,n){this._buffer=t.target.result,e.play(this._buffer,i,r,n,this.meta)},t}(),E=function(){function t(){}return t.float32ColorToARGB=function(t){return[(4278190080&t)>>>24,(16711680&t)>>>16,(65280&t)>>>8,255&t]},t.f32_RGBA_To_f32_ARGB=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},t.f32_RGB_To_f32_ARGB=function(t){return(255&t)<<24|(4278190080&t)>>>24<<16|(16711680&t)>>>16<<8|(65280&t)>>>8},t.prototype.getAlphaFromF32RGBA=function(t){return 255&t},t.ARGBtoFloat32=function(t,e,i,r){return t<<24|e<<16|i<<8|r},t.componentToHex=function(t){var e=t.toString(16);return 1==e.length?"0"+e:e},t.RGBToHexString=function(e){return"#"+t.componentToHex(e[1])+t.componentToHex(e[2])+t.componentToHex(e[3])},t.ARGBToHexString=function(e){return"#"+t.componentToHex(e[0])+t.componentToHex(e[1])+t.componentToHex(e[2])+t.componentToHex(e[3])},t.interpolateFloat32Color=function(t,e,i){var r=1-i;return((4278190080&t)>>>24)*r+((4278190080&e)>>>24)*i<<24|((16711680&t)>>>16)*r+((16711680&e)>>>16)*i<<16|((65280&t)>>>8)*r+((65280&e)>>>8)*i<<8|(255&t)*r+(255&e)*i},t}(),A=function(){function t(t,e,i,r,n,o,s,a){void 0===t&&(t=1),void 0===e&&(e=1),void 0===i&&(i=1),void 0===r&&(r=1),void 0===n&&(n=0),void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=0),this._isDirty=!1,t instanceof Float32Array?this._rawData=t:(this._rawData=new Float32Array(8),this.redMultiplier=Number(t),this.greenMultiplier=e,this.blueMultiplier=i,this.alphaMultiplier=r,this.redOffset=n,this.greenOffset=o,this.blueOffset=s,this.alphaOffset=a)}return Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"isIdentity",{get:function(){return!this._isDirty},enumerable:!1,configurable:!0}),t.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],this._isDirty=this._isDirty||t._isDirty},Object.defineProperty(t.prototype,"alphaMultiplier",{get:function(){return this._rawData[3]},set:function(t){this._rawData[3]=t,this._isDirty=this._isDirty||1!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"alphaOffset",{get:function(){return this._rawData[7]},set:function(t){this._rawData[7]=t,this._isDirty=this._isDirty||0!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blueMultiplier",{get:function(){return this._rawData[2]},set:function(t){this._rawData[2]=t,this._isDirty=this._isDirty||1!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"blueOffset",{get:function(){return this._rawData[6]},set:function(t){this._rawData[6]=t,this._isDirty=this._isDirty||0!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"greenMultiplier",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t,this._isDirty=this._isDirty||1!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"greenOffset",{get:function(){return this._rawData[5]},set:function(t){this._rawData[5]=t,this._isDirty=this._isDirty||0!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redMultiplier",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t,this._isDirty=this._isDirty||1!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"redOffset",{get:function(){return this._rawData[4]},set:function(t){this._rawData[4]=t,this._isDirty=this._isDirty||0!==t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._rawData[4]<<16|this._rawData[5]<<8|this._rawData[6]},set:function(t){var e=E.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,this._isDirty=!0},enumerable:!1,configurable:!0}),t.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],this._isDirty=!0},t.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,this._isDirty=!1},t.prototype.clone=function(){var e=new t;return e.copyFrom(this),e},t.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],this._isDirty=t._isDirty},t.prototype.copyTo=function(t){t.copyFrom(this)},t.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,this._isDirty=this._isDirty||t._isDirty},t.prototype._isRenderable=function(){return 0!=this._rawData[3]||this._rawData[7]>0},t}(),x=function(t){function e(e,i){var r=t.call(this,e)||this;return r._transform=i,r}return i(e,t),Object.defineProperty(e.prototype,"transform",{get:function(){return this._transform},enumerable:!1,configurable:!0}),e.prototype.clone=function(){return new e(this.type,this._transform)},e.INVALIDATE_MATRIX3D="invalidateMatrix3D",e.INVALIDATE_COLOR_TRANSFORM="invalidateColorTransform",e}(o),P=function(t){function e(e,i){return void 0===e&&(e=null),void 0===i&&(i=0),t.call(this,e||"ArgumentError",i)||this}return i(e,t),e}(r),R=function(){function t(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}return Object.defineProperty(t.prototype,"x",{get:function(){return this._rawData[0]},set:function(t){this._rawData[0]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._rawData[1]},set:function(t){this._rawData[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"length",{get:function(){return Math.sqrt(this._rawData[0]*this._rawData[0]+this._rawData[1]*this._rawData[1])},enumerable:!1,configurable:!0}),t.prototype.add=function(e){return new t(this._rawData[0]+e._rawData[0],this._rawData[1]+e._rawData[1])},t.prototype.clone=function(){return new t(this.x,this.y)},t.prototype.copyFrom=function(t){this._rawData[0]=t._rawData[0],this._rawData[1]=t._rawData[1]},t.prototype.equals=function(t){return this._rawData[0]===t._rawData[0]&&this._rawData[1]==t._rawData[1]},t.prototype.normalize=function(t){void 0===t&&(t=1);var e=this.length;if((0!==this.x||0!==this.y)&&e){var i=t/e;this._rawData[0]*=i,this._rawData[1]*=i}},t.prototype.offset=function(t,e){this._rawData[0]+=t,this._rawData[1]+=e},t.prototype.setTo=function(t,e){this._rawData[0]=t,this._rawData[1]=e},t.prototype.subtract=function(e){return new t(this.x-e.x,this.y-e.y)},t.prototype.toString=function(){return"[Point] (x="+this.x+", y="+this.y+")"},t.distance=function(t,e){var i=e.x-t.x,r=e.y-t.y;return 0===i?Math.abs(r):0===r?Math.abs(i):Math.sqrt(i*i+r*r)},t.interpolate=function(e,i,r){var n=1-r,o=e._rawData,s=i._rawData;return new t(o[0]*r+s[0]*n,o[1]*r+s[1]*n)},t.polar=function(e,i){return new t(e*Math.cos(i),e*Math.sin(i))},t}(),O=function(){function t(t,e,i,r,n,o){if(void 0===t&&(t=1),void 0===e&&(e=0),void 0===i&&(i=0),void 0===r&&(r=1),void 0===n&&(n=0),void 0===o&&(o=0),this.rawData=new Float32Array(6),t instanceof Float32Array)this.copyRawDataFrom(t);else{var s=this.rawData;s[0]=Number(t),s[1]=e,s[2]=i,s[3]=r,s[4]=n,s[5]=o}}return Object.defineProperty(t.prototype,"a",{get:function(){return this.rawData[0]},set:function(t){this.rawData[0]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"b",{get:function(){return this.rawData[1]},set:function(t){this.rawData[1]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"c",{get:function(){return this.rawData[2]},set:function(t){this.rawData[2]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"d",{get:function(){return this.rawData[3]},set:function(t){this.rawData[3]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"tx",{get:function(){return this.rawData[4]},set:function(t){this.rawData[4]=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"ty",{get:function(){return this.rawData[5]},set:function(t){this.rawData[5]=t},enumerable:!1,configurable:!0}),t.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]},t.prototype.clone=function(){var e=this.rawData;return new t(e[0],e[1],e[2],e[3],e[4],e[5])},t.prototype.concat=function(t){var e=this.rawData,i=t.rawData,r=e[0]*i[0],n=0,o=0,s=e[3]*i[3],a=e[4]*i[0]+i[4],h=e[5]*i[3]+i[5];0===e[1]&&0===e[2]&&0===i[1]&&0===i[2]||(r+=e[1]*i[2],s+=e[2]*i[1],n+=e[0]*i[1]+e[1]*i[3],o+=e[2]*i[0]+e[3]*i[2],a+=e[5]*i[2],h+=e[4]*i[1]),e[0]=r,e[1]=n,e[2]=o,e[3]=s,e[4]=a,e[5]=h},t.prototype.copyColumnFrom=function(t,e){var i=this.rawData,r=e._rawData;if(t>2)throw"Column "+t+" out of bounds (2)";0==t?(i[0]=r[0],i[1]=r[1]):1==t?(i[2]=r[0],i[3]=r[1]):(i[4]=r[0],i[5]=r[1])},t.prototype.copyColumnTo=function(t,e){var i=this.rawData,r=e._rawData;if(t>2)throw new P("ArgumentError, Column "+t+" out of bounds [0, ..., 2]");0==t?(r[0]=i[0],r[1]=i[1],r[2]=0):1==t?(r[0]=i[2],r[1]=i[3],r[2]=0):(r[0]=i[4],r[1]=i[5],r[2]=1)},t.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]},t.prototype.copyRowFrom=function(t,e){var i=this.rawData,r=e._rawData;if(t>2)throw new P("ArgumentError, Row "+t+" out of bounds [0, ..., 2]");0==t?(i[0]=r[0],i[2]=r[1],i[4]=r[2]):(i[1]=r[0],i[3]=r[1],i[5]=r[2])},t.prototype.copyRowTo=function(t,e){var i=this.rawData,r=e._rawData;if(t>2)throw new P("ArgumentError, Row "+t+" out of bounds [0, ..., 2]");0==t?(r[0]=i[0],r[1]=i[2],r[2]=i[4]):1==t?(r[0]=i[1],r[1]=i[3],r[2]=i[5]):(r[0]=0,r[1]=0,r[2]=1)},t.prototype.createBox=function(t,e,i,r,n){void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0);var o=this.rawData;if(0!==i){var s=Math.cos(i),a=Math.sin(i);o[0]=s*t,o[1]=a*e,o[2]=-a*t,o[3]=s*e}else o[0]=t,o[1]=0,o[2]=0,o[3]=e;o[4]=r,o[5]=n},t.prototype.createGradientBox=function(t,e,i,r,n){void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=0),this.createBox(t/1638.4,e/1638.4,i,r+t/2,n+e/2)},t.prototype.deltaTransformPoint=function(t){var e=this.rawData;return new R(t.x*e[0]+t.y*e[2],t.x*e[1]+t.y*e[3])},t.prototype.identity=function(){var t=this.rawData;t[0]=1,t[1]=0,t