-
Notifications
You must be signed in to change notification settings - Fork 4
/
akashic-engine-standalone-3.19.1.min.js
16 lines (14 loc) · 291 KB
/
akashic-engine-standalone-3.19.1.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
/*! akashic-engine-standalone@3.19.1 */
!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).AE={})}(this,(function(t){"use strict";var e="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function r(t){if(t.__esModule)return t;var e=t.default;if("function"==typeof e){var r=function t(){return this instanceof t?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach((function(e){var i=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(r,e,i.get?i:{enumerable:!0,get:function(){return t[e]}})})),r}var i={},n=function(t,e){return n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)e.hasOwnProperty(r)&&(t[r]=e[r])},n(t,e)};
/*! *****************************************************************************
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 o=function(){return o=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},o.apply(this,arguments)};function s(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],i=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function a(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var i,n,o=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(i=o.next()).done;)s.push(i.value)}catch(t){n={error:t}}finally{try{i&&!i.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return s}function u(t){return this instanceof u?(this.v=t,this):new u(t)}var c,h=Object.freeze({__proto__:null,get __assign(){return o},__asyncDelegator:function(t){var e,r;return e={},i("next"),i("throw",(function(t){throw t})),i("return"),e[Symbol.iterator]=function(){return this},e;function i(i,n){e[i]=t[i]?function(e){return(r=!r)?{value:u(t[i](e)),done:"return"===i}:n?n(e):e}:n}},__asyncGenerator:function(t,e,r){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(t,e||[]),o=[];return i={},s("next"),s("throw"),s("return"),i[Symbol.asyncIterator]=function(){return this},i;function s(t){n[t]&&(i[t]=function(e){return new Promise((function(r,i){o.push([t,e,r,i])>1||a(t,e)}))})}function a(t,e){try{(r=n[t](e)).value instanceof u?Promise.resolve(r.value.v).then(c,h):l(o[0][2],r)}catch(t){l(o[0][3],t)}var r}function c(t){a("next",t)}function h(t){a("throw",t)}function l(t,e){t(e),o.shift(),o.length&&a(o[0][0],o[0][1])}},__asyncValues:function(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e,r=t[Symbol.asyncIterator];return r?r.call(t):(t=s(t),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(r){e[r]=t[r]&&function(e){return new Promise((function(i,n){(function(t,e,r,i){Promise.resolve(i).then((function(e){t({value:e,done:r})}),e)})(i,n,(e=t[r](e)).done,e.value)}))}}},__await:u,__awaiter:function(t,e,r,i){return new(r||(r=Promise))((function(n,o){function s(t){try{u(i.next(t))}catch(t){o(t)}}function a(t){try{u(i.throw(t))}catch(t){o(t)}}function u(t){var e;t.done?n(t.value):(e=t.value,e instanceof r?e:new r((function(t){t(e)}))).then(s,a)}u((i=i.apply(t,e||[])).next())}))},__classPrivateFieldGet:function(t,e){if(!e.has(t))throw new TypeError("attempted to get private field on non-instance");return e.get(t)},__classPrivateFieldSet:function(t,e,r){if(!e.has(t))throw new TypeError("attempted to set private field on non-instance");return e.set(t,r),r},__createBinding:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]},__decorate:function(t,e,r,i){var n,o=arguments.length,s=o<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,r,i);else for(var a=t.length-1;a>=0;a--)(n=t[a])&&(s=(o<3?n(s):o>3?n(e,r,s):n(e,r))||s);return o>3&&s&&Object.defineProperty(e,r,s),s},__exportStar:function(t,e){for(var r in t)"default"===r||e.hasOwnProperty(r)||(e[r]=t[r])},__extends:function(t,e){function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)},__generator:function(t,e){var r,i,n,o,s={label:0,sent:function(){if(1&n[0])throw n[1];return n[1]},trys:[],ops:[]};return o={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function a(o){return function(a){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;s;)try{if(r=1,i&&(n=2&o[0]?i.return:o[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,o[1])).done)return n;switch(i=0,n&&(o=[2&o[0],n.value]),o[0]){case 0:case 1:n=o;break;case 4:return s.label++,{value:o[1],done:!1};case 5:s.label++,i=o[1],o=[0];continue;case 7:o=s.ops.pop(),s.trys.pop();continue;default:if(!(n=s.trys,(n=n.length>0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]<n[3])){s.label=o[1];break}if(6===o[0]&&s.label<n[1]){s.label=n[1],n=o;break}if(n&&s.label<n[2]){s.label=n[2],s.ops.push(o);break}n[2]&&s.ops.pop(),s.trys.pop();continue}o=e.call(t,s)}catch(t){o=[6,t],i=0}finally{r=n=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,a])}}},__importDefault:function(t){return t&&t.__esModule?t:{default:t}},__importStar:function(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var r in t)Object.hasOwnProperty.call(t,r)&&(e[r]=t[r]);return e.default=t,e},__makeTemplateObject:function(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t},__metadata:function(t,e){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(t,e)},__param:function(t,e){return function(r,i){e(r,i,t)}},__read:a,__rest:function(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(null!=t&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]])}return r},__spread:function(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(a(arguments[e]));return t},__spreadArrays:function(){for(var t=0,e=0,r=arguments.length;e<r;e++)t+=arguments[e].length;var i=Array(t),n=0;for(e=0;e<r;e++)for(var o=arguments[e],s=0,a=o.length;s<a;s++,n++)i[n]=o[s];return i},__values:s}),l=r(h),d={},p={},f={},_={};var y,v={};var g,m={};var A,w,x={};function S(){return w||(w=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=e&&e.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),i((c||(c=1,Object.defineProperty(_,"__esModule",{value:!0})),_),t),i((y||(y=1,Object.defineProperty(v,"__esModule",{value:!0})),v),t),i((g||(g=1,Object.defineProperty(m,"__esModule",{value:!0})),m),t),i((A||(A=1,Object.defineProperty(x,"__esModule",{value:!0})),x),t)}(f)),f}var b,P={},E={};var O,T={};var M,C,L={},R={};function I(){if(C)return L;C=1,Object.defineProperty(L,"__esModule",{value:!0}),L.Trigger=void 0;const t=(M||(M=1,Object.defineProperty(R,"__esModule",{value:!0}),R.isPromise=void 0,R.isPromise=function(t){return null!=t&&("object"==typeof t||"function"==typeof t)&&"function"==typeof t.then}),R);return L.Trigger=class{constructor(){this._handlers=[],this.length=0}add(t,e){if("function"==typeof t)this._addHandler({func:t,owner:e,once:!1,name:void 0,filter:void 0});else{const e=t,r="number"==typeof e.index?e.index:void 0;this._addHandler({func:e.func,owner:e.owner,once:!1,name:e.name,filter:e.filter},r)}this.length=this._handlers.length}addOnce(t,e){if("function"==typeof t)this._addHandler({func:t,owner:e,once:!0,name:void 0,filter:void 0});else{const e=t,r="number"==typeof e.index?e.index:void 0;this._addHandler({func:e.func,owner:e.owner,once:!0,name:e.name,filter:e.filter},r)}this.length=this._handlers.length}handle(t,e,r){this.add(e?{owner:t,func:e,name:r}:{func:t})}fire(e){if(!this._handlers||!this._handlers.length)return;const r=this._handlers.concat();for(let i=0;i<r.length;i++){const n=r[i];if(n.filter&&!n.filter(n))continue;const o=n.func.call(n.owner,e);if(!(0,t.isPromise)(o)&&!!o||n.once){if(!this._handlers)continue;const t=this._handlers.indexOf(n);-1!==t&&this._handlers.splice(t,1)}}null!=this._handlers&&(this.length=this._handlers.length)}contains(t,e){const r="function"==typeof t?{func:t,owner:e}:t;for(let t=0;t<this._handlers.length;t++)if(this._comparePartial(r,this._handlers[t]))return!0;return!1}remove(t,e){const r="function"==typeof t?{func:t,owner:e}:t;for(let t=0;t<this._handlers.length;t++){const e=this._handlers[t];if(r.func===e.func&&r.owner===e.owner&&r.name===e.name&&r.filter===e.filter)return this._handlers.splice(t,1),void--this.length}}removeAll(t){const e=[];if(t)for(let r=0;r<this._handlers.length;r++){const i=this._handlers[r];this._comparePartial(t,i)||e.push(i)}this._handlers=e,this.length=this._handlers.length}destroy(){this._handlers=null,this.length=null}destroyed(){return null===this._handlers}_addHandler(t,e){null==e?this._handlers.push({func:t.func,owner:t.owner,once:t.once,name:t.name,filter:t.filter}):this._handlers.splice(e,0,{func:t.func,owner:t.owner,once:t.once,name:t.name,filter:t.filter})}_comparePartial(t,e){return(void 0===t.func||t.func===e.func)&&((void 0===t.owner||t.owner===e.owner)&&((void 0===t.name||t.name===e.name)&&(void 0===t.filter||t.filter===e.filter)))}},L}var F,j,D={};function k(){return j||(j=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=e&&e.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),i((b||(b=1,Object.defineProperty(E,"__esModule",{value:!0})),E),t),i((O||(O=1,Object.defineProperty(T,"__esModule",{value:!0})),T),t),i(I(),t),i(function(){if(F)return D;F=1,Object.defineProperty(D,"__esModule",{value:!0}),D.ChainTrigger=void 0;const t=I();let e=class extends t.Trigger{constructor(t,e,r){super(),this.chain=t,this.filter=null!=e?e:null,this.filterOwner=r,this._isActivated=!1}add(t,e){super.add(t,e),this._isActivated||(this.chain.add(this._onChainTriggerFired,this),this._isActivated=!0)}addOnce(t,e){super.addOnce(t,e),this._isActivated||(this.chain.add(this._onChainTriggerFired,this),this._isActivated=!0)}remove(t,e){super.remove(t,e),0===this.length&&this._isActivated&&(this.chain.remove(this._onChainTriggerFired,this),this._isActivated=!1)}removeAll(t){super.removeAll(t),0===this.length&&this._isActivated&&(this.chain.remove(this._onChainTriggerFired,this),this._isActivated=!1)}destroy(){super.destroy(),this.chain.remove(this._onChainTriggerFired,this),this.filter=null,this.filterOwner=null,this._isActivated=!1}_onChainTriggerFired(t){this.filter&&!this.filter.call(this.filterOwner,t)||this.fire(t)}};return D.ChainTrigger=e,D}(),t)}(P)),P}var U,G={},H={};var B,V={};var W,N={};var X,z={};var q,Y={};var K,$={};var J,Z={};var Q,tt={};var et,rt={};var it,nt={};var ot,st={};var at,ut={};var ct,ht={};var lt,dt={};var pt,ft={};var _t,yt={};var vt,gt={};var mt,At={};var wt,xt={};var St,bt={};var Pt,Et={};var Ot,Tt={};var Mt,Ct={};var Lt,Rt={};var It,Ft={};var jt,Dt={};var kt,Ut={};var Gt,Ht={};var Bt,Vt={};var Wt,Nt={};var Xt,zt={};var qt,Yt={};var Kt,$t={};var Jt,Zt={};var Qt,te={};var ee,re={};var ie,ne={};var oe,se={};var ae,ue={};var ce,he={};var le,de,pe={};function fe(){return de||(de=1,function(t){var r,i,n,o,s=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),a=e&&e.__exportStar||function(t,e){for(var r in t)"default"===r||Object.prototype.hasOwnProperty.call(e,r)||s(e,t,r)};Object.defineProperty(t,"__esModule",{value:!0}),a((U||(U=1,Object.defineProperty(H,"__esModule",{value:!0})),H),t),a((B||(B=1,Object.defineProperty(V,"__esModule",{value:!0})),V),t),a((W||(W=1,Object.defineProperty(N,"__esModule",{value:!0}),N.CompositeOperation=void 0,function(t){t[t.SourceOver=0]="SourceOver",t[t.SourceAtop=1]="SourceAtop",t[t.Lighter=2]="Lighter",t[t.Copy=3]="Copy",t[t.ExperimentalSourceIn=4]="ExperimentalSourceIn",t[t.ExperimentalSourceOut=5]="ExperimentalSourceOut",t[t.ExperimentalDestinationAtop=6]="ExperimentalDestinationAtop",t[t.ExperimentalDestinationIn=7]="ExperimentalDestinationIn",t[t.DestinationOut=8]="DestinationOut",t[t.DestinationOver=9]="DestinationOver",t[t.Xor=10]="Xor",t[t.Difference=11]="Difference",t[t.Saturation=12]="Saturation"}(r||(N.CompositeOperation=r={}))),N),t),a((X||(X=1,Object.defineProperty(z,"__esModule",{value:!0})),z),t),a((q||(q=1,Object.defineProperty(Y,"__esModule",{value:!0})),Y),t),a((K||(K=1,Object.defineProperty($,"__esModule",{value:!0})),$),t),a((J||(J=1,Object.defineProperty(Z,"__esModule",{value:!0})),Z),t),a((Q||(Q=1,Object.defineProperty(tt,"__esModule",{value:!0})),tt),t),a((et||(et=1,Object.defineProperty(rt,"__esModule",{value:!0})),rt),t),a((it||(it=1,Object.defineProperty(nt,"__esModule",{value:!0})),nt),t),a((ot||(ot=1,Object.defineProperty(st,"__esModule",{value:!0})),st),t),a((at||(at=1,Object.defineProperty(ut,"__esModule",{value:!0})),ut),t),a((ct||(ct=1,Object.defineProperty(ht,"__esModule",{value:!0})),ht),t),a((lt||(lt=1,Object.defineProperty(dt,"__esModule",{value:!0})),dt),t),a((pt||(pt=1,Object.defineProperty(ft,"__esModule",{value:!0})),ft),t),a((_t||(_t=1,Object.defineProperty(yt,"__esModule",{value:!0})),yt),t),a((vt||(vt=1,Object.defineProperty(gt,"__esModule",{value:!0})),gt),t),a((mt||(mt=1,Object.defineProperty(At,"__esModule",{value:!0})),At),t),a((wt||(wt=1,Object.defineProperty(xt,"__esModule",{value:!0})),xt),t),a((St||(St=1,Object.defineProperty(bt,"__esModule",{value:!0})),bt),t),a((Pt||(Pt=1,Object.defineProperty(Et,"__esModule",{value:!0})),Et),t),a((Ot||(Ot=1,Object.defineProperty(Tt,"__esModule",{value:!0})),Tt),t),a((Mt||(Mt=1,Object.defineProperty(Ct,"__esModule",{value:!0})),Ct),t),a((Lt||(Lt=1,Object.defineProperty(Rt,"__esModule",{value:!0})),Rt),t),a((It||(It=1,Object.defineProperty(Ft,"__esModule",{value:!0})),Ft),t),a((jt||(jt=1,Object.defineProperty(Dt,"__esModule",{value:!0})),Dt),t),a((kt||(kt=1,Object.defineProperty(Ut,"__esModule",{value:!0}),Ut.AssetLoadErrorType=void 0,function(t){t[t.Unspecified=0]="Unspecified",t[t.RetryLimitExceeded=1]="RetryLimitExceeded",t[t.NetworkError=2]="NetworkError",t[t.ClientError=3]="ClientError",t[t.ServerError=4]="ServerError"}(i||(Ut.AssetLoadErrorType=i={}))),Ut),t),a((Gt||(Gt=1,Object.defineProperty(Ht,"__esModule",{value:!0})),Ht),t),a((Bt||(Bt=1,Object.defineProperty(Vt,"__esModule",{value:!0}),Vt.FontWeight=void 0,function(t){t[t.Normal=0]="Normal",t[t.Bold=1]="Bold"}(n||(Vt.FontWeight=n={}))),Vt),t),a((Wt||(Wt=1,Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.FontFamily=void 0,function(t){t[t.SansSerif=0]="SansSerif",t[t.Serif=1]="Serif",t[t.Monospace=2]="Monospace"}(o||(Nt.FontFamily=o={}))),Nt),t),a((Xt||(Xt=1,Object.defineProperty(zt,"__esModule",{value:!0})),zt),t),a((qt||(qt=1,Object.defineProperty(Yt,"__esModule",{value:!0})),Yt),t),a((Kt||(Kt=1,Object.defineProperty($t,"__esModule",{value:!0})),$t),t),a((Jt||(Jt=1,Object.defineProperty(Zt,"__esModule",{value:!0})),Zt),t),a((Qt||(Qt=1,Object.defineProperty(te,"__esModule",{value:!0})),te),t),a((ee||(ee=1,Object.defineProperty(re,"__esModule",{value:!0})),re),t),a((ie||(ie=1,Object.defineProperty(ne,"__esModule",{value:!0})),ne),t),a((oe||(oe=1,Object.defineProperty(se,"__esModule",{value:!0})),se),t),a((ae||(ae=1,Object.defineProperty(ue,"__esModule",{value:!0})),ue),t),a((ce||(ce=1,Object.defineProperty(he,"__esModule",{value:!0})),he),t),a((le||(le=1,Object.defineProperty(pe,"__esModule",{value:!0})),pe),t)}(G)),G}var _e,ye={},ve={};function ge(){if(_e)return ve;_e=1,Object.defineProperty(ve,"__esModule",{value:!0}),ve.AudioPlayContext=void 0;var t=k(),e=function(){function e(e){var r;this.onPlay=new t.Trigger,this.onStop=new t.Trigger,this.asset=e.asset,this._system=e.system,this._resourceFactory=e.resourceFactory,this._volume=null!==(r=e.volume)&&void 0!==r?r:1,this._id=e.id,this._systemId=e.systemId,this._player=this._createAudioPlayer(),this.asset.onDestroyed.addOnce(this.stop,this)}return Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},enumerable:!1,configurable:!0}),e.prototype.play=function(){this._player.play(this.asset)},e.prototype.stop=function(){this._player.stop()},e.prototype.changeVolume=function(t){this._volume=t,this._player.changeVolume(t)},e.prototype._startSuppress=function(){"music"!==this._systemId?this.stop():this._player.changeVolume(0)},e.prototype._endSuppress=function(){"music"!==this._systemId||this._player.changeVolume(this._volume)},e.prototype._createAudioPlayer=function(){var t=this._resourceFactory.createAudioPlayer(this._system);return t.changeVolume(this._volume),t.onPlay.add(this.onPlay.fire,this.onPlay),t.onStop.add(this.onStop.fire,this.onStop),t},e}();return ve.AudioPlayContext=e,ve}var me,Ae={};function we(){return me||(me=1,Object.defineProperty(Ae,"__esModule",{value:!0}),Ae.ExceptionFactory=void 0,function(t){t.createAssertionError=function(t,e){var r=new Error(t);return r.name="AssertionError",r.cause=e,r},t.createTypeMismatchError=function(t,e,r,i){var n="Type mismatch on "+t+", expected type is "+e;if(arguments.length>2)try{var o=void 0;n+=", actual type is "+((o=r&&r.constructor&&r.constructor.name?r.constructor.name:typeof r).length>40?o.substr(0,40):o)}catch(t){}n+=".";var s=new Error(n);return s.name="TypeMismatchError",s.cause=i,s.expected=e,s.actual=r,s},t.createAssetLoadError=function(t,e,r,i){void 0===e&&(e=!0);var n=new Error(t);return n.name="AssetLoadError",n.cause=i,n.retriable=e,n},t.createRequestAssetLoadError=function(t,e,r){var i=new Error(t);return i.name="RequestAssetLoadError",i.detail=e,i.cause=r,i}}(t||(Ae.ExceptionFactory=t={}))),Ae;var t}var xe,Se,be={};function Pe(){if(xe)return be;xe=1,Object.defineProperty(be,"__esModule",{value:!0}),be.WeakRefKVS=void 0;var t=function(){function t(t){this._target=t}return t.prototype.deref=function(){return this._target},t}(),e=function(){function e(){this._weakRefClass="undefined"!=typeof WeakRef?WeakRef:t,this._refMap=Object.create(null)}return e.prototype.set=function(t,e){this._refMap[t]&&this.delete(t),this._refMap[t]=new this._weakRefClass(e)},e.prototype.get=function(t){var e=this._refMap[t];if(e)return e.deref()},e.prototype.has=function(t){return t in this._refMap},e.prototype.delete=function(t){delete this._refMap[t]},e.prototype.keys=function(){return Object.keys(this._refMap)},e.prototype.clear=function(){this._refMap=Object.create(null)},e.prototype.clean=function(){for(var t=0,e=Object.entries(this._refMap);t<e.length;t++){var r=e[t],i=r[0];void 0===r[1].deref()&&this.delete(i)}},e}();return be.WeakRefKVS=e,be}function Ee(){if(Se)return ye;Se=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ye,"__esModule",{value:!0}),ye.SoundAudioSystem=ye.MusicAudioSystem=ye.AudioSystem=void 0;var r=ge(),i=we(),n=Pe(),o=function(){function t(t){this.id=t.id,this._volume=t.volume||1,this._destroyRequestedAssets={},this._explicitMuted=t.muted||!1,this._suppressed=!1,this._muted=!1,this._contextMap=new n.WeakRefKVS,this._contextCount=0,this._resourceFactory=t.resourceFactory,this._updateMuted()}return Object.defineProperty(t.prototype,"volume",{get:function(){return this._volume},set:function(t){if(t<0||t>1||isNaN(t)||"number"!=typeof t)throw i.ExceptionFactory.createAssertionError("AudioSystem#volume: expected: 0.0-1.0, actual: "+t);this._volume=t,this._onVolumeChanged()},enumerable:!1,configurable:!0}),t.prototype.play=function(t){var e=this.create(t);return e.play(),e},t.prototype.create=function(t){var e=new r.AudioPlayContext({id:this._generateAudioPlayContextId(),resourceFactory:this._resourceFactory,asset:t,system:this,systemId:this.id,volume:1});return this._contextCount%this._contentMapCleaningFrequency==0&&this._contextMap.clean(),this._contextMap.set(e._id,e),e},t.prototype.stopAll=function(){for(var t=0,e=this._contextMap.keys();t<e.length;t++){var r=e[t],i=this._contextMap.get(r);null==i||i.stop()}this._contextMap.clean()},t.prototype.requestDestroy=function(t){this._destroyRequestedAssets[t.id]=t},t.prototype.cancelRequestDestroy=function(t){delete this._destroyRequestedAssets[t.id]},t.prototype.getDestroyRequestedAsset=function(t){return this._destroyRequestedAssets.hasOwnProperty(t)?this._destroyRequestedAssets[t]:null},t.prototype._reset=function(){this.stopAll(),this._volume=1,this._destroyRequestedAssets={},this._muted=!1,this._suppressed=!1,this._explicitMuted=!1},t.prototype._setMuted=function(t){var e=this._explicitMuted;this._explicitMuted=!!t,this._explicitMuted!==e&&(this._updateMuted(),this._onMutedChanged())},t.prototype._setPlaybackRate=function(t){if(t<0||isNaN(t)||"number"!=typeof t)throw i.ExceptionFactory.createAssertionError("AudioSystem#playbackRate: expected: greater or equal to 0.0, actual: "+t);this._suppressed=1!==t,this._updateMuted(),this._onPlaybackRateChanged()},t.prototype._updateMuted=function(){this._muted=this._explicitMuted||this._suppressed},t.prototype._generateAudioPlayContextId=function(){return"".concat(this.id,"-").concat(this._contextCount++)},t.prototype._startSuppress=function(){this._setPlaybackRate(100);for(var t=0,e=this._contextMap.keys();t<e.length;t++){var r=e[t],i=this._contextMap.get(r);null==i||i._startSuppress()}},t.prototype._endSuppress=function(){this._setPlaybackRate(1);for(var t=0,e=this._contextMap.keys();t<e.length;t++){var r=e[t],i=this._contextMap.get(r);null==i||i._endSuppress()}},t}();ye.AudioSystem=o;var s=function(e){function r(t){var r=e.call(this,t)||this;return r._contentMapCleaningFrequency=5,r._player=void 0,r}return t(r,e),Object.defineProperty(r.prototype,"player",{get:function(){return this._player||(this._player=this._resourceFactory.createAudioPlayer(this),this._player.onPlay.add(this._handlePlay,this),this._player.onStop.add(this._handleStop,this)),this._player},set:function(t){this._player=t},enumerable:!1,configurable:!0}),r.prototype.findPlayers=function(t){return this.player.currentAudio&&this.player.currentAudio.id===t.id?[this.player]:[]},r.prototype.createPlayer=function(){return this.player},r.prototype.stopAll=function(){e.prototype.stopAll.call(this),this._player&&this._player.stop()},r.prototype._reset=function(){e.prototype._reset.call(this),this._player&&(this._player.onPlay.remove(this._handlePlay,this),this._player.onStop.remove(this._handleStop,this)),this._player=void 0},r.prototype._onVolumeChanged=function(){this.player._notifyVolumeChanged()},r.prototype._onMutedChanged=function(){this.player._changeMuted(this._muted)},r.prototype._onPlaybackRateChanged=function(){this.player._changeMuted(this._muted)},r.prototype._handlePlay=function(t){if(t.player!==this._player)throw i.ExceptionFactory.createAssertionError("MusicAudioSystem#_onPlayerPlayed: unexpected audio player")},r.prototype._handleStop=function(t){this._destroyRequestedAssets[t.audio.id]&&(delete this._destroyRequestedAssets[t.audio.id],t.audio.destroy())},r}(o);ye.MusicAudioSystem=s;var a=function(e){function r(t){var r=e.call(this,t)||this;return r._contentMapCleaningFrequency=50,r.players=[],r}return t(r,e),r.prototype.createPlayer=function(){var t=this._resourceFactory.createAudioPlayer(this);return t.canHandleStopped()&&this.players.push(t),t.onPlay.add(this._handlePlay,this),t.onStop.add(this._handleStop,this),t},r.prototype.findPlayers=function(t){for(var e=[],r=0;r<this.players.length;++r){var i=this.players[r].currentAudio;i&&i.id===t.id&&e.push(this.players[r])}return e},r.prototype.stopAll=function(){e.prototype.stopAll.call(this);for(var t=this.players.concat(),r=0;r<t.length;++r)t[r].stop()},r.prototype._reset=function(){e.prototype._reset.call(this);for(var t=0;t<this.players.length;++t){var r=this.players[t];r.onPlay.remove(this._handlePlay,this),r.onStop.remove(this._handleStop,this)}this.players=[]},r.prototype._onMutedChanged=function(){for(var t=this.players,e=0;e<t.length;++e)t[e]._changeMuted(this._muted)},r.prototype._onPlaybackRateChanged=function(){var t=this.players;if(this._suppressed)for(var e=0;e<t.length;++e)t[e]._changeMuted(!0)},r.prototype._handlePlay=function(t){},r.prototype._handleStop=function(t){var e=this.players.indexOf(t.player);e<0||(t.player.onStop.remove(this._handleStop,this),this.players.splice(e,1),this._destroyRequestedAssets[t.audio.id]&&(delete this._destroyRequestedAssets[t.audio.id],t.audio.destroy()))},r.prototype._onVolumeChanged=function(){for(var t=0;t<this.players.length;++t)this.players[t]._notifyVolumeChanged()},r}(o);return ye.SoundAudioSystem=a,ye}var Oe,Te,Me={},Ce={};function Le(){return Oe||(Oe=1,Object.defineProperty(Ce,"__esModule",{value:!0}),Ce.PathUtil=void 0,function(t){t.resolvePath=function(e,r){function i(t){var e=t.split("/");return""===e[e.length-1]&&e.pop(),e}if(""===r)return e;for(var n=t.splitPath(e),o=i(n.path).concat(i(r)),s=[],a=0;a<o.length;++a){var u=o[a];switch(u){case"..":var c=s.pop();if(void 0===c||""===c||"."===c)throw new Error("PathUtil.resolvePath: invalid arguments");break;case".":0===s.length&&s.push(".");break;case"":s=[""];break;default:s.push(u)}}return n.host+s.join("/")},t.resolveDirname=function(t){var e=t.lastIndexOf("/");return-1===e?t:t.substr(0,e)},t.resolveExtname=function(t){for(var e=t.length-1;e>=0;--e){var r=t.charAt(e);if("."===r)return t.substr(e);if("/"===r)return""}return""},t.makeNodeModulePaths=function(e){var r=t.splitPath(e),i=r.host;"/"===(e=r.path)[e.length-1]&&(e=e.slice(0,e.length-1));for(var n=e.split("/"),o=n.indexOf("node_modules"),s=o>0?o-1:0,a=[],u=n.length-1;u>=s;--u)if("node_modules"!==n[u]){var c=n.slice(0,u+1);c.push("node_modules");var h=c.join("/");a.push(i+h)}return a},t.splitPath=function(t){var e="",r=t.indexOf("//");if(r>=0){var i=t.indexOf("/",r+2);i>=0?(e=t.slice(0,i),t=t.slice(i)):(e=t,t="/")}else e="";return{host:e,path:t}}}(t||(Ce.PathUtil=t={}))),Ce;var t}function Re(){if(Te)return Me;Te=1,Object.defineProperty(Me,"__esModule",{value:!0}),Me.Module=void 0;var t=Le(),e=function(e){var r=this,i=e.path,n=t.PathUtil.resolveDirname(i),o=e.virtualPath,s=o?t.PathUtil.resolveDirname(o):void 0,a=e.requireFunc,u=e.resolveFunc;this._runtimeValue=Object.create(e.runtimeValueBase,{filename:{value:i,enumerable:!0},dirname:{value:n,enumerable:!0},module:{value:this,writable:!0,enumerable:!0,configurable:!0}}),this.id=e.id,this.filename=e.path,this.exports={},this.parent=null,this.loaded=!1,this.children=[],this.paths=s?t.PathUtil.makeNodeModulePaths(s):[],this._dirname=n,this._virtualDirname=s;var c=function(t){return a(t,r)};c.resolve=function(t){return u(t,r)},this.require=c};return Me.Module=e,Me}var Ie,Fe={};function je(){if(Ie)return Fe;Ie=1,Object.defineProperty(Fe,"__esModule",{value:!0}),Fe.ShaderProgram=void 0;var t=function(t){this.fragmentShader=t.fragmentShader,this.uniforms=t.uniforms};return Fe.ShaderProgram=t,Fe}var De,ke={};function Ue(){if(De)return ke;De=1,Object.defineProperty(ke,"__esModule",{value:!0}),ke.VideoSystem=void 0;var t=function(){};return ke.VideoSystem=t,ke}var Ge,He={},Be={},Ve={};function We(){if(Ge)return Ve;Ge=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ve,"__esModule",{value:!0}),Ve.SeedEvent=Ve.PlayerInfoEvent=Ve.TimestampEvent=Ve.LeaveEvent=Ve.JoinEvent=Ve.OperationEvent=Ve.MessageEvent=Ve.PointMoveEventBase=Ve.PointUpEventBase=Ve.PointDownEventBase=Ve.PointEventBase=void 0;var r=function(t,e,r,i,n,o,s){this.eventFlags=o,this.local=!!n,this.player=i,this.pointerId=t,this.target=e,this.point=r,this.button=null!=s?s:0};Ve.PointEventBase=r;var i=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t.type="point-down",t}return t(r,e),r}(r);Ve.PointDownEventBase=i;var n=function(e){function r(t,r,i,n,o,s,a,u,c){var h=e.call(this,t,r,i,s,a,u,c)||this;return h.type="point-up",h.prevDelta=n,h.startDelta=o,h}return t(r,e),r}(r);Ve.PointUpEventBase=n;var o=function(e){function r(t,r,i,n,o,s,a,u,c){var h=e.call(this,t,r,i,s,a,u,c)||this;return h.type="point-move",h.prevDelta=n,h.startDelta=o,h}return t(r,e),r}(r);Ve.PointMoveEventBase=o;var s=function(t,e,r,i){this.type="message",this.eventFlags=i,this.local=!!r,this.player=e,this.data=t};Ve.MessageEvent=s;var a=function(t,e,r,i,n){this.type="operation",this.eventFlags=n,this.local=!!i,this.player=r,this.code=t,this.data=e};Ve.OperationEvent=a;var u=function(t,e){this.type="join",this.eventFlags=e,this.player=t};Ve.JoinEvent=u;var c=function(t,e){this.type="leave",this.eventFlags=e,this.player=t};Ve.LeaveEvent=c;var h=function(t,e,r){this.type="timestamp",this.eventFlags=r,this.player=e,this.timestamp=t};Ve.TimestampEvent=h;var l=function(t,e){this.type="player-info",this.eventFlags=e,this.player=t};Ve.PlayerInfoEvent=l;var d=function(t,e){this.type="seed",this.eventFlags=e,this.generator=t};return Ve.SeedEvent=d,Ve}var Ne,Xe={};function ze(){if(Ne)return Xe;Ne=1,Object.defineProperty(Xe,"__esModule",{value:!0}),Xe.PlainMatrix=void 0;var t=function(){function t(t,e,r,i,n,o,s){void 0===t?(this._modified=!1,this._matrix=[1,0,0,1,0,0]):"number"==typeof t?(this._modified=!1,this._matrix=new Array(6),this.update(t,e,r,i,n,0,0,o,s)):(this._modified=t._modified,this._matrix=[t._matrix[0],t._matrix[1],t._matrix[2],t._matrix[3],t._matrix[4],t._matrix[5]])}return t.prototype.update=function(t,e,r,i,n,o,s,a,u){if(null!=a&&null!=u){var c=n*Math.PI/180,h=Math.cos(c),l=Math.sin(c),d=h*r,p=l*r,f=l*i,_=h*i,y=a*t,v=u*e;this._matrix[0]=d,this._matrix[1]=p,this._matrix[2]=-f,this._matrix[3]=_,this._matrix[4]=-d*y+f*v+o,this._matrix[5]=-p*y-_*v+s}else this._updateWithoutAnchor(t,e,r,i,n,o,s)},t.prototype._updateWithoutAnchor=function(t,e,r,i,n,o,s){var a=n*Math.PI/180,u=Math.cos(a),c=Math.sin(a),h=u*r,l=c*r,d=c*i,p=u*i,f=t/2,_=e/2;this._matrix[0]=h,this._matrix[1]=l,this._matrix[2]=-d,this._matrix[3]=p,this._matrix[4]=-h*f+d*_+f+o,this._matrix[5]=-l*f-p*_+_+s},t.prototype.updateByInverse=function(t,e,r,i,n,o,s,a,u){if(null!=a&&null!=u){var c=n*Math.PI/180,h=Math.cos(c),l=Math.sin(c),d=h/r,p=l/i,f=l/r,_=h/i,y=a*t,v=u*e;this._matrix[0]=d,this._matrix[1]=-p,this._matrix[2]=f,this._matrix[3]=_,this._matrix[4]=-d*o-f*s+y,this._matrix[5]=p*o-_*s+v}else this._updateByInverseWithoutAnchor(t,e,r,i,n,o,s)},t.prototype._updateByInverseWithoutAnchor=function(t,e,r,i,n,o,s){var a=n*Math.PI/180,u=Math.cos(a),c=Math.sin(a),h=u/r,l=c/i,d=c/r,p=u/i,f=t/2,_=e/2;this._matrix[0]=h,this._matrix[1]=-l,this._matrix[2]=d,this._matrix[3]=p,this._matrix[4]=-h*(f+o)-d*(_+s)+f,this._matrix[5]=l*(f+o)-p*(_+s)+_},t.prototype.multiply=function(t){var e=this._matrix,r=t._matrix,i=e[0],n=e[1],o=e[2],s=e[3];e[0]=i*r[0]+o*r[1],e[1]=n*r[0]+s*r[1],e[2]=i*r[2]+o*r[3],e[3]=n*r[2]+s*r[3],e[4]=i*r[4]+o*r[5]+e[4],e[5]=n*r[4]+s*r[5]+e[5]},t.prototype.multiplyLeft=function(t){var e=t._matrix,r=this._matrix,i=r[0],n=r[2],o=r[4];r[0]=e[0]*i+e[2]*r[1],r[1]=e[1]*i+e[3]*r[1],r[2]=e[0]*n+e[2]*r[3],r[3]=e[1]*n+e[3]*r[3],r[4]=e[0]*o+e[2]*r[5]+e[4],r[5]=e[1]*o+e[3]*r[5]+e[5]},t.prototype.multiplyNew=function(t){var e=this.clone();return e.multiply(t),e},t.prototype.reset=function(t,e){this._matrix[0]=1,this._matrix[1]=0,this._matrix[2]=0,this._matrix[3]=1,this._matrix[4]=t||0,this._matrix[5]=e||0},t.prototype.clone=function(){return new t(this)},t.prototype.multiplyInverseForPoint=function(t){var e=this._matrix,r=1/(e[0]*e[3]+e[2]*-e[1]);return{x:e[3]*r*t.x+-e[2]*r*t.y+(e[5]*e[2]-e[4]*e[3])*r,y:e[0]*r*t.y+-e[1]*r*t.x+(-e[5]*e[0]+e[4]*e[1])*r}},t.prototype.scale=function(t,e){var r=this._matrix;r[0]*=t,r[1]*=e,r[2]*=t,r[3]*=e,r[4]*=t,r[5]*=e},t.prototype.multiplyPoint=function(t){var e=this._matrix;return{x:e[0]*t.x+e[2]*t.y+e[4],y:e[1]*t.x+e[3]*t.y+e[5]}},t}();return Xe.PlainMatrix=t,Xe}var qe,Ye={};function Ke(){if(qe)return Ye;qe=1,Object.defineProperty(Ye,"__esModule",{value:!0}),Ye.Object2D=void 0;var t=we(),e=ze(),r=function(){function r(t){t?(this.x=t.x||0,this.y=t.y||0,this.width=t.width||0,this.height=t.height||0,this.opacity=null!=t.opacity?t.opacity:1,this.scaleX=null!=t.scaleX?t.scaleX:1,this.scaleY=null!=t.scaleY?t.scaleY:1,this.angle=t.angle||0,this.compositeOperation=t.compositeOperation,this.anchorX=void 0===t.anchorX?0:t.anchorX,this.anchorY=void 0===t.anchorY?0:t.anchorY,this._matrix=void 0):(this.x=0,this.y=0,this.width=0,this.height=0,this.opacity=1,this.scaleX=1,this.scaleY=1,this.angle=0,this.compositeOperation=void 0,this.anchorX=0,this.anchorY=0,this._matrix=void 0)}return r.prototype.moveTo=function(e,r){if("number"==typeof e&&"number"!=typeof r)throw t.ExceptionFactory.createAssertionError("Object2D#moveTo: arguments must be CommonOffset or pair of x and y as a number.");"number"==typeof e?(this.x=e,this.y=r):(this.x=e.x,this.y=e.y)},r.prototype.moveBy=function(t,e){this.x+=t,this.y+=e},r.prototype.resizeTo=function(e,r){if("number"==typeof e&&"number"!=typeof r)throw t.ExceptionFactory.createAssertionError("Object2D#resizeTo: arguments must be CommonSize or pair of width and height as a number.");"number"==typeof e?(this.width=e,this.height=r):(this.width=e.width,this.height=e.height)},r.prototype.resizeBy=function(t,e){this.width+=t,this.height+=e},r.prototype.scale=function(t){this.scaleX=t,this.scaleY=t},r.prototype.anchor=function(t,e){this.anchorX=t,this.anchorY=e},r.prototype.getMatrix=function(){if(this._matrix){if(!this._matrix._modified)return this._matrix}else this._matrix=new e.PlainMatrix;return this._updateMatrix(),this._matrix._modified=!1,this._matrix},r.prototype._updateMatrix=function(){this.angle||1!==this.scaleX||1!==this.scaleY||0!==this.anchorX||0!==this.anchorY?this._matrix.update(this.width,this.height,this.scaleX,this.scaleY,this.angle,this.x,this.y,this.anchorX,this.anchorY):this._matrix.reset(this.x,this.y)},r}();return Ye.Object2D=r,Ye}var $e,Je,Ze,Qe={};function tr(){if($e)return Qe;$e=1,Object.defineProperty(Qe,"__esModule",{value:!0}),Qe.Util=void 0;var t,e=fe();return function(t){var r;t.distance=function(t,e,r,i){return Math.sqrt(Math.pow(t-r,2)+Math.pow(e-i,2))},t.distanceBetweenOffsets=function(e,r){return t.distance(e.x,e.y,r.x,r.y)},t.distanceBetweenAreas=function(e,r){return t.distance(e.x+e.width/2,e.y+e.height/2,r.x+r.width/2,r.y+r.height/2)},t.charCodeAt=function(t,e){var r=t.charCodeAt(e);return 55296<=r&&r<=56319?r<<16|t.charCodeAt(e+1):56320<=r&&r<=57343?null:r},t.enumToSnakeCase=function(t,e){var r=t[e];return r[0].toLowerCase()+r.slice(1).replace(/[A-Z]/g,(function(t){return"-"+t.toLowerCase()}))},t.clamp=function(t,e,r){return Math.min(Math.max(t,e),r)},t.compositeOperationStringTable=((r={})[e.CompositeOperation.SourceOver]="source-over",r[e.CompositeOperation.SourceAtop]="source-atop",r[e.CompositeOperation.Lighter]="lighter",r[e.CompositeOperation.Copy]="copy",r[e.CompositeOperation.ExperimentalSourceIn]="experimental-source-in",r[e.CompositeOperation.ExperimentalSourceOut]="experimental-source-out",r[e.CompositeOperation.ExperimentalDestinationAtop]="experimental-destination-atop",r[e.CompositeOperation.ExperimentalDestinationIn]="experimental-destination-in",r[e.CompositeOperation.DestinationOut]="destination-out",r[e.CompositeOperation.DestinationOver]="destination-over",r[e.CompositeOperation.Xor]="xor",r[e.CompositeOperation.Difference]="difference",r[e.CompositeOperation.Saturation]="saturation",r)}(t||(Qe.Util=t={})),Qe}function er(){if(Je)return Be;Je=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Be,"__esModule",{value:!0}),Be.E=Be.PointMoveEvent=Be.PointUpEvent=Be.PointDownEvent=void 0;var r=k(),i=We(),n=we(),o=ze(),s=Ke(),a=tr(),u=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(i.PointDownEventBase);Be.PointDownEvent=u;var c=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(i.PointUpEventBase);Be.PointUpEvent=c;var h=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r}(i.PointMoveEventBase);Be.PointMoveEvent=h;var l=function(e){function s(t){var r=e.call(this,t)||this;if(r.children=void 0,r.parent=void 0,r._touchable=!1,r.state=0,r._hasTouchableChildren=!1,r._onUpdate=void 0,r._onMessage=void 0,r._onPointDown=void 0,r._onPointMove=void 0,r._onPointUp=void 0,r.tag=t.tag,r.shaderProgram=t.shaderProgram,r.local="non-local"!==t.scene.local||!!t.local,t.children)for(var i=0;i<t.children.length;++i)r.append(t.children[i]);return t.parent&&t.parent.append(r),null!=t.touchable&&(r.touchable=t.touchable),t.hidden&&r.hide(),r.id=t.id,t.scene.register(r),r}return t(s,e),Object.defineProperty(s.prototype,"onUpdate",{get:function(){return this._onUpdate||(this._onUpdate=new r.ChainTrigger(this.scene.onUpdate)),this._onUpdate},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onMessage",{get:function(){return this._onMessage||(this._onMessage=new r.ChainTrigger(this.scene.onMessage)),this._onMessage},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onPointDown",{get:function(){return this._onPointDown||(this._onPointDown=new r.ChainTrigger(this.scene.onPointDownCapture,this._isTargetOperation,this)),this._onPointDown},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onPointUp",{get:function(){return this._onPointUp||(this._onPointUp=new r.ChainTrigger(this.scene.onPointUpCapture,this._isTargetOperation,this)),this._onPointUp},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"onPointMove",{get:function(){return this._onPointMove||(this._onPointMove=new r.ChainTrigger(this.scene.onPointMoveCapture,this._isTargetOperation,this)),this._onPointMove},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"touchable",{get:function(){return this._touchable},set:function(t){this._touchable!==t&&(this._touchable=t,t?this._enableTouchPropagation():this._disableTouchPropagation())},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"update",{get:function(){return this.onUpdate},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"message",{get:function(){return this.onMessage},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pointDown",{get:function(){return this.onPointDown},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pointUp",{get:function(){return this.onPointUp},enumerable:!1,configurable:!0}),Object.defineProperty(s.prototype,"pointMove",{get:function(){return this.onPointMove},enumerable:!1,configurable:!0}),s.prototype.render=function(t,e){if(this.state&=-5,!(1&this.state))if(8&this.state){if(t.translate(this.x,this.y),this.renderSelf(t,e)&&this.children)for(var r=(o=this.children).length,i=0;i<r;++i)o[i].render(t,e);t.translate(-this.x,-this.y)}else{t.save(),this.angle||1!==this.scaleX||1!==this.scaleY||0!==this.anchorX||0!==this.anchorY?t.transform(this.getMatrix()._matrix):t.translate(this.x,this.y),1!==this.opacity&&t.opacity(this.opacity);var n=this.compositeOperation;if(void 0!==n&&t.setCompositeOperation("string"==typeof n?n:a.Util.compositeOperationStringTable[n]),void 0!==this.shaderProgram&&t.isSupportedShaderProgram()&&t.setShaderProgram(this.shaderProgram),this.renderSelf(t,e)&&this.children){var o=this.children;for(i=0;i<o.length;++i)o[i].render(t,e)}t.restore()}},s.prototype.renderSelf=function(t,e){return!0},s.prototype.game=function(){return this.scene.game},s.prototype.append=function(t){this.insertBefore(t,void 0)},s.prototype.insertBefore=function(t,e){t.parent&&t.remove(),this.children||(this.children=[]),t.parent=this;var r=-1;void 0!==e&&(r=this.children.indexOf(e))>-1?this.children.splice(r,0,t):this.children.push(t),(t._touchable||t._hasTouchableChildren)&&(this._hasTouchableChildren=!0,this._enableTouchPropagation()),this.modified(!0)},s.prototype.remove=function(t){if(void 0!==t){var e=this.children?this.children.indexOf(t):-1;if(e<0)throw n.ExceptionFactory.createAssertionError("E#remove: invalid child");this.children[e].parent=void 0,this.children.splice(e,1),(t._touchable||t._hasTouchableChildren)&&(this._findTouchableChildren(this)||(this._hasTouchableChildren=!1,this._disableTouchPropagation())),this.modified(!0)}else this.parent.remove(this)},s.prototype.destroy=function(){if(!this.destroyed()){if(this.parent&&this.remove(),this.children){for(var t=this.children.length-1;t>=0;--t)this.children[t].destroy();if(0!==this.children.length)throw n.ExceptionFactory.createAssertionError("E#destroy: can not destroy all children, "+this.children.length);this.children=void 0}this._onUpdate&&(this._onUpdate.destroy(),this._onUpdate=void 0),this._onMessage&&(this._onMessage.destroy(),this._onMessage=void 0),this._onPointDown&&(this._onPointDown.destroy(),this._onPointDown=void 0),this._onPointMove&&(this._onPointMove.destroy(),this._onPointMove=void 0),this._onPointUp&&(this._onPointUp.destroy(),this._onPointUp=void 0),this.scene.unregister(this)}},s.prototype.destroyed=function(){return void 0===this.scene},s.prototype.modified=function(t){this._matrix&&(this._matrix._modified=!0),this.angle||1!==this.scaleX||1!==this.scaleY||0!==this.anchorX||0!==this.anchorY||1!==this.opacity||void 0!==this.compositeOperation||void 0!==this.shaderProgram?this.state&=-9:this.state|=8,4&this.state||(this.state|=4,this.parent&&this.parent.modified(!0))},s.prototype.shouldFindChildrenByPoint=function(t){return!0},s.prototype.findPointSourceByPoint=function(t,e,r){if(!(1&this.state)){var i=(e=e?e.multiplyNew(this.getMatrix()):this.getMatrix().clone()).multiplyInverseForPoint(t);if(this._hasTouchableChildren||r&&this.children&&this.children.length){var n=this.children;if(this.shouldFindChildrenByPoint(i))for(var o=n.length-1;o>=0;--o){var s=n[o];if(r||s._touchable||s._hasTouchableChildren){var a=s.findPointSourceByPoint(t,e,r);if(a)return a}}}if(r||this._touchable)return 0<=i.x&&this.width>i.x&&0<=i.y&&this.height>i.y?{target:this,point:i}:void 0}},s.prototype.visible=function(){return 1!=(1&this.state)},s.prototype.show=function(){1&this.state&&(this.state&=-2,this.parent&&this.parent.modified(!0))},s.prototype.hide=function(){1&this.state||(this.state|=1,this.parent&&this.parent.modified(!0))},s.prototype.calculateBoundingRect=function(){return this._calculateBoundingRect(void 0)},s.prototype.localToGlobal=function(t){for(var e=t,r=this;r instanceof s;r=r.parent)e=r.getMatrix().multiplyPoint(e);return e},s.prototype.globalToLocal=function(t){for(var e=new o.PlainMatrix,r=this;r instanceof s;r=r.parent)e.multiplyLeft(r.getMatrix());return e.multiplyInverseForPoint(t)},s.prototype._calculateMatrixTo=function(t){for(var e=new o.PlainMatrix,r=this;r instanceof s&&r!==t;r=r.parent)e.multiplyLeft(r.getMatrix());return e},s.prototype._findLowestCommonAncestorWith=function(t){for(var e={},r=this;r instanceof s;r=r.parent)e[r.id]=!0;for(var i=t;i instanceof s&&!e.hasOwnProperty(i.id);i=i.parent);return i},s.prototype._calculateBoundingRect=function(t){var e=this.getMatrix();if(t&&(e=t.multiplyNew(e)),this.visible()){for(var r={left:0,right:this.width,top:0,bottom:this.height},i=[{x:r.left,y:r.top},{x:r.left,y:r.bottom},{x:r.right,y:r.top},{x:r.right,y:r.bottom}],n=e.multiplyPoint(i[0]),o={left:n.x,right:n.x,top:n.y,bottom:n.y},s=1;s<i.length;++s)n=e.multiplyPoint(i[s]),o.left>n.x&&(o.left=n.x),o.right<n.x&&(o.right=n.x),o.top>n.y&&(o.top=n.y),o.bottom<n.y&&(o.bottom=n.y);if(void 0!==this.children)for(s=0;s<this.children.length;++s){var a=this.children[s]._calculateBoundingRect(e);a&&(o.left>a.left&&(o.left=a.left),o.right<a.right&&(o.right=a.right),o.top>a.top&&(o.top=a.top),o.bottom<a.bottom&&(o.bottom=a.bottom))}return o}},s.prototype._enableTouchPropagation=function(){for(var t=this.parent;t instanceof s&&!t._hasTouchableChildren;)t._hasTouchableChildren=!0,t=t.parent},s.prototype._disableTouchPropagation=function(){for(var t=this.parent;t instanceof s&&t._hasTouchableChildren&&!this._findTouchableChildren(t);)t._hasTouchableChildren=!1,t=t.parent},s.prototype._isTargetOperation=function(t){return!(1&this.state)&&(t instanceof i.PointEventBase&&(this._touchable&&t.target===this))},s.prototype._findTouchableChildren=function(t){if(t.children)for(var e=0;e<t.children.length;++e){if(t.children[e].touchable)return t.children[e];var r=this._findTouchableChildren(t.children[e]);if(r)return r}},s}(s.Object2D);return Be.E=l,Be}function rr(){if(Ze)return He;Ze=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(He,"__esModule",{value:!0}),He.CacheableE=void 0;var r=function(e){function r(t){var r=e.call(this,t)||this;return r._shouldRenderChildren=!0,r._cache=void 0,r._renderer=void 0,r._renderedCamera=void 0,r}return t(r,e),r.prototype.invalidate=function(){this.state&=-3,this.modified()},r.prototype.renderSelf=function(t,e){var i=r.PADDING;if(this._renderedCamera!==e&&(this.state&=-3,this._renderedCamera=e),!(2&this.state)){this._cacheSize=this.calculateCacheSize();var n=Math.ceil(this._cacheSize.width)+2*i,o=Math.ceil(this._cacheSize.height)+2*i,s=!this._cache||this._cache.width<n||this._cache.height<o;s&&(this._cache&&!this._cache.destroyed()&&this._cache.destroy(),this._cache=this.scene.game.resourceFactory.createSurface(n,o),this._renderer=this._cache.renderer());var a=this._renderer;a.begin(),s||a.clear(),a.save(),a.translate(i,i),this.renderCache(a,e),a.restore(),this.state|=2,a.end()}return this._cache&&this._cacheSize.width>0&&this._cacheSize.height>0&&(t.translate(-i,-i),this.renderSelfFromCache(t),t.translate(i,i)),this._shouldRenderChildren},r.prototype.renderSelfFromCache=function(t){t.drawImage(this._cache,0,0,this._cacheSize.width+r.PADDING,this._cacheSize.height+r.PADDING,0,0)},r.prototype.destroy=function(){this._cache&&!this._cache.destroyed()&&this._cache.destroy(),this._cache=void 0,e.prototype.destroy.call(this)},r.prototype.calculateCacheSize=function(){return{width:this.width,height:this.height}},r.PADDING=1,r}(er().E);return He.CacheableE=r,He}var ir,nr={};function or(){if(ir)return nr;ir=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(nr,"__esModule",{value:!0}),nr.FilledRect=void 0;var r=we(),i=function(e){function i(t){var i=e.call(this,t)||this;if("string"!=typeof t.cssColor)throw r.ExceptionFactory.createTypeMismatchError("ColorBox#constructor(cssColor)","string",t.cssColor);return i.cssColor=t.cssColor,i}return t(i,e),i.prototype.renderSelf=function(t){return t.fillRect(0,0,this.width,this.height,this.cssColor),!0},i}(er().E);return nr.FilledRect=i,nr}var sr,ar,ur,cr={},hr={},lr={};function dr(){if(sr)return lr;sr=1,Object.defineProperty(lr,"__esModule",{value:!0}),lr.SurfaceUtil=void 0;var t,e=we();return function(t){function r(t,e,r,i,n){var o;void 0===n&&(n=4);for(var s=(o="number"==typeof n?{top:n,bottom:n,left:n,right:n}:n).left,a=i.width-o.right,u=o.top,c=i.height-o.bottom,h=o.left,l=e-o.right,d=o.top,p=r-o.bottom,f=[{x:0,y:0,width:o.left,height:o.top},{x:a,y:0,width:o.right,height:o.top},{x:0,y:c,width:o.left,height:o.bottom},{x:a,y:c,width:o.right,height:o.bottom}],_=[{x:0,y:0},{x:l,y:0},{x:0,y:p},{x:l,y:p}],y=0;y<f.length;++y){var v=f[y];t.save(),t.translate(_[y].x,_[y].y),t.drawImage(i,v.x,v.y,v.width,v.height,0,0),t.restore()}var g=[{x:s,y:0,width:a-s,height:o.top},{x:0,y:u,width:o.left,height:c-u},{x:a,y:u,width:o.right,height:c-u},{x:s,y:c,width:a-s,height:o.bottom}],m=[{x:h,y:0,width:l-h,height:o.top},{x:0,y:d,width:o.left,height:p-d},{x:l,y:d,width:o.right,height:p-d},{x:h,y:p,width:l-h,height:o.bottom}];for(y=0;y<g.length;++y){var A=g[y],w=m[y];t.save(),t.translate(w.x,w.y),t.transform([w.width/A.width,0,0,w.height/A.height,0,0]),t.drawImage(i,A.x,A.y,A.width,A.height,0,0),t.restore()}var x=a-s,S=c-u,b=l-h,P=p-d;t.save(),t.translate(h,d),t.transform([b/x,0,0,P/S,0,0]),t.drawImage(i,s,u,x,S,0,0),t.restore()}t.asSurface=function(t){if(t){if("type"in t&&"image"===t.type)return t.asSurface();if("_drawable"in t)return t;throw e.ExceptionFactory.createTypeMismatchError("SurfaceUtil#asSurface","ImageAsset|Surface",t)}},t.setupAnimatingHandler=function(t,e){e.isPlaying()&&t._handleAnimationStart()},t.migrateAnimatingHandler=function(t,e,r){t._handleAnimationStop(),r.isPlaying()&&t._handleAnimationStart()},t.drawNinePatch=function(t,e,i){void 0===i&&(i=4);var n=t.renderer();n.begin(),n.clear(),r(n,t.width,t.height,e,i),n.end()},t.renderNinePatch=r}(t||(lr.SurfaceUtil=t={})),lr}function pr(){if(ar)return hr;ar=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(hr,"__esModule",{value:!0}),hr.Sprite=void 0;var r=ze(),i=dr(),n=function(e){function n(t){var r=e.call(this,t)||this;return r.src=t.src,"_drawable"in t.src?r._surface=t.src:r._surface=i.SurfaceUtil.asSurface(t.src),null==t.width&&(r.width=r._surface.width),null==t.height&&(r.height=r._surface.height),r.srcWidth=null!=t.srcWidth?t.srcWidth:r.width,r.srcHeight=null!=t.srcHeight?t.srcHeight:r.height,r.srcX=t.srcX||0,r.srcY=t.srcY||0,r._stretchMatrix=void 0,r._beforeSrc=r.src,r._beforeSurface=r._surface,i.SurfaceUtil.setupAnimatingHandler(r,r._surface),r._invalidateSelf(),r}return t(n,e),n.prototype._handleUpdate=function(){this.modified()},n.prototype._handleAnimationStart=function(){this.onUpdate.contains(this._handleUpdate,this)||this.onUpdate.add(this._handleUpdate,this)},n.prototype._handleAnimationStop=function(){this.destroyed()||this.onUpdate.remove(this._handleUpdate,this)},n.prototype.renderSelf=function(t,e){return this.srcWidth<=0||this.srcHeight<=0||(this._stretchMatrix&&(t.save(),t.transform(this._stretchMatrix._matrix)),t.drawImage(this._surface,this.srcX,this.srcY,this.srcWidth,this.srcHeight,0,0),this._stretchMatrix&&t.restore()),!0},n.prototype.invalidate=function(){this._invalidateSelf(),this.modified()},n.prototype.destroy=function(t){this._surface&&!this._surface.destroyed()&&t&&this._surface.destroy(),this.src=void 0,this._beforeSrc=void 0,this._surface=void 0,e.prototype.destroy.call(this)},n.prototype._invalidateSelf=function(){this.width===this.srcWidth&&this.height===this.srcHeight?this._stretchMatrix=void 0:(this._stretchMatrix=new r.PlainMatrix,this._stretchMatrix.scale(this.width/this.srcWidth,this.height/this.srcHeight)),this.src!==this._beforeSrc&&(this._beforeSrc=this.src,"_drawable"in this.src?this._surface=this.src:this._surface=i.SurfaceUtil.asSurface(this.src)),this._surface!==this._beforeSurface&&(i.SurfaceUtil.migrateAnimatingHandler(this,this._beforeSurface,this._surface),this._beforeSurface=this._surface)},n}(er().E);return hr.Sprite=n,hr}var fr,_r,yr={},vr={};function gr(){return fr||(fr=1,Object.defineProperty(vr,"__esModule",{value:!0}),vr.TextAlign=void 0,function(t){t[t.Left=0]="Left",t[t.Center=1]="Center",t[t.Right=2]="Right"}(t||(vr.TextAlign=t={}))),vr;var t}var mr,Ar={};var wr,xr={};var Sr,br={};function Pr(){if(Sr)return br;Sr=1,Object.defineProperty(br,"__esModule",{value:!0}),br.AssetAccessor=void 0;var t=function(){function t(t){this._assetManager=t}return t.prototype.getImage=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"image")},t.prototype.getAudio=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"audio")},t.prototype.getScript=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"script")},t.prototype.getText=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"text")},t.prototype.getTextContent=function(t){return this.getText(t).data},t.prototype.getJSONContent=function(t){return JSON.parse(this.getTextContent(t))},t.prototype.getVectorImage=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"vector-image")},t.prototype.getBinary=function(t){return this._assetManager.peekLiveAssetByAccessorPath(t,"binary")},t.prototype.getBinaryData=function(t){return this.getBinary(t).data},t.prototype.getAllImages=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","image")},t.prototype.getAllAudios=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","audio")},t.prototype.getAllScripts=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","script")},t.prototype.getAllTexts=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","text")},t.prototype.getAllVectorImages=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","vector-image")},t.prototype.getAllBinaries=function(t){return this._assetManager.peekAllLiveAssetsByPattern(null!=t?t:"**/*","binary")},t.prototype.getImageById=function(t){return this._assetManager.peekLiveAssetById(t,"image")},t.prototype.getAudioById=function(t){return this._assetManager.peekLiveAssetById(t,"audio")},t.prototype.getScriptById=function(t){return this._assetManager.peekLiveAssetById(t,"script")},t.prototype.getTextById=function(t){return this._assetManager.peekLiveAssetById(t,"text")},t.prototype.getTextContentById=function(t){return this.getTextById(t).data},t.prototype.getJSONContentById=function(t){return JSON.parse(this.getTextById(t).data)},t.prototype.getVectorImageById=function(t){return this._assetManager.peekLiveAssetById(t,"vector-image")},t.prototype.getBinaryById=function(t){return this._assetManager.peekLiveAssetById(t,"binary")},t.prototype.getBinaryDataById=function(t){return this.getBinaryById(t).data},t.prototype.pathOf=function(t){return this._assetManager.resolveAccessorPath(t)},t}();return br.AssetAccessor=t,br}var Er,Or={};var Tr,Mr={};function Cr(){if(Tr)return Mr;Tr=1,Object.defineProperty(Mr,"__esModule",{value:!0}),Mr.AssetHolder=void 0;var t=we(),e=function(){function e(t){var e=t.assetManager,r=t.assetIds?t.assetIds.concat():[];r.push.apply(r,e.resolvePatternsToAssetIds(t.assetPaths||[])),this.waitingAssetsCount=r.length,this.userData=t.userData,this._assetManager=e,this._assetIds=r,this._assets=[],this._handlerSet=t.handlerSet,this._requested=!1,this._alwaysNotifyFinish=!!t.alwaysNotifyFinish,this._failureAssetIds=[]}return e.prototype.request=function(){return 0!==this.waitingAssetsCount&&(this._requested||(this._requested=!0,this._assetManager.requestAssets(this._assetIds,this)),!0)},e.prototype.destroy=function(){this._requested&&this._assetManager.unrefAssets(this._assets),this.waitingAssetsCount=0,this.userData=void 0,this._handlerSet=void 0,this._assetIds=void 0,this._failureAssetIds=void 0,this._requested=!1},e.prototype.destroyed=function(){return!this._handlerSet},e.prototype._onAssetError=function(t,e){var r=this._handlerSet;if(!this.destroyed()&&!r.owner.destroyed()){var i={asset:t,error:e,cancelRetry:!1};if(r.handleLoadFailure.call(r.owner,i),e.retriable&&!i.cancelRetry)this._assetManager.retryLoad(t);else if(this._assetManager.configuration[t.id])r.handleFinish.call(r.owner,this,!1);else if(this._alwaysNotifyFinish){var n=this._peekAssetConfFromAssetId(t.id);this._failureAssetIds.push(n),this._decrementWaitingAssetCount()}}},e.prototype._onAssetLoad=function(t){var e=this._handlerSet;this.destroyed()||e.owner.destroyed()||(e.handleLoad.call(e.owner,t),this._assets.push(t),this._decrementWaitingAssetCount())},e.prototype._decrementWaitingAssetCount=function(){if(--this.waitingAssetsCount,!(this.waitingAssetsCount>0)){if(this.waitingAssetsCount<0)throw t.ExceptionFactory.createAssertionError("AssetHolder#_onAssetLoad: broken waitingAssetsCount");var e=this._handlerSet;e.handleFinish.call(e.owner,this,!0)}},e.prototype._getFailureAssetIds=function(){return this._failureAssetIds},e.prototype._peekAssetConfFromAssetId=function(e){for(var r=0,i=this._assetIds;r<i.length;r++){var n=i[r];if(e===("string"==typeof n?n:n.id))return n}throw t.ExceptionFactory.createAssertionError("AssetHolder#_peekAssetConfFromAssetId: could not peek the asset: ".concat(e))},e}();return Mr.AssetHolder=e,Mr}var Lr,Rr={};var Ir,Fr={},jr={};var Dr,kr={};var Ur,Gr,Hr={},Br={};function Vr(){if(Ur)return Br;Ur=1,Object.defineProperty(Br,"__esModule",{value:!0}),Br.EmptyVectorImageAsset=void 0;var t=k(),e=function(){function e(e,r,i,n,o){this.type="vector-image",this.width=0,this.height=0,this.onDestroyed=new t.Trigger,this.id=e,this.path=r,this.originalPath=r,this.width=i,this.height=n,this.hint=o}return e.prototype.createSurface=function(t,e,r,i,n,o){return null},e.prototype.inUse=function(){return!1},e.prototype.destroy=function(){this.destroyed()||(this.onDestroyed.destroy(),this.onDestroyed=void 0)},e.prototype.destroyed=function(){return!this.onDestroyed},e.prototype._load=function(t){t._onAssetLoad(this)},e.prototype._assetPathFilter=function(t){return t},e}();return Br.EmptyVectorImageAsset=e,Br}var Wr,Nr,Xr={};function zr(){if(Nr)return Fr;Nr=1;var t=e&&e.__assign||function(){return t=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},t.apply(this,arguments)};Object.defineProperty(Fr,"__esModule",{value:!0}),Fr.AssetManager=void 0;var r=function(){if(Ir)return jr;Ir=1,Object.defineProperty(jr,"__esModule",{value:!0}),jr.BundledScriptAsset=void 0;var t=k(),e=function(){function e(e){this.type="script",this.id=e.id,this.script="",this.path=e.path,this.originalPath=e.path,this.onDestroyed=new t.Trigger,this.execute=e.execute.bind(this)}return e.prototype.inUse=function(){return!0},e.prototype.destroy=function(){this.onDestroyed.destroyed()||this.onDestroyed.destroy(),this.execute=void 0},e.prototype.destroyed=function(){return!this.execute},e.prototype._load=function(t){t._onAssetLoad(this)},e.prototype._assetPathFilter=function(t){return t},e}();return jr.BundledScriptAsset=e,jr}(),i=function(){if(Dr)return kr;Dr=1,Object.defineProperty(kr,"__esModule",{value:!0}),kr.EmptyBinaryAsset=void 0;var t=k(),e=function(){function e(e,r){this.type="binary",this.onDestroyed=new t.Trigger,this.id=e,this.path=r,this.originalPath=r,this.data=new ArrayBuffer(0)}return e.prototype.inUse=function(){return!1},e.prototype.destroy=function(){this.destroyed()||(this.onDestroyed.destroy(),this.onDestroyed=void 0)},e.prototype.destroyed=function(){return!this.onDestroyed},e.prototype._load=function(t){t._onAssetLoad(this)},e.prototype._assetPathFilter=function(t){return t},e}();return kr.EmptyBinaryAsset=e,kr}(),n=function(){if(Gr)return Hr;Gr=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Hr,"__esModule",{value:!0}),Hr.EmptyGeneratedVectorImageAsset=void 0;var r=function(e){function r(t,r,i){var n=e.call(this,t,r,0,0)||this;return n.data=i,n}return t(r,e),r}(Vr().EmptyVectorImageAsset);return Hr.EmptyGeneratedVectorImageAsset=r,Hr}(),o=Vr(),s=function(){if(Wr)return Xr;Wr=1,Object.defineProperty(Xr,"__esModule",{value:!0}),Xr.PartialImageAsset=void 0;var t=k(),e=function(){function e(e,r,i,n,o,s){this.type="image",this.hint=void 0,this.onDestroyed=new t.Trigger,this._surface=null,this._loadHandler=null,this.id=r,this.path=i,this.originalPath=i,this.width=s.width,this.height=s.height,this._slice=s,this._resourceFactory=e;var a="".concat(r,"/<internal>");this._src=e.createImageAsset(a,i,n,o)}return e.prototype.initialize=function(t){this.hint=t,this._src.initialize(t)},e.prototype.inUse=function(){return!1},e.prototype.destroy=function(){this.destroyed()||(this.onDestroyed.fire(this),this._src.destroy(),this._src=null,this._slice=null,this._resourceFactory=null,this._surface=null,this._loadHandler=null,this.onDestroyed.destroy(),this.onDestroyed=void 0)},e.prototype.destroyed=function(){return!this._src},e.prototype.asSurface=function(){if(this._surface)return this._surface;var t=this._slice,e=t.x,r=t.y,i=t.width,n=t.height,o=this._resourceFactory.createSurface(i,n),s=o.renderer();return s.begin(),s.drawImage(this._src.asSurface(),e,r,i,n,0,0),s.end(),this._surface=o,o},e.prototype._load=function(t){this._loadHandler=t,this._src._load(this)},e.prototype._onAssetLoad=function(t){this._loadHandler._onAssetLoad(this)},e.prototype._onAssetError=function(t,e){this._loadHandler._onAssetError(this,e)},e.prototype._assetPathFilter=function(t){return t},e}();return Xr.PartialImageAsset=e,Xr}(),a=we(),u=Ue(),c=function(t,e){this.asset=t,this.handlers=[e],this.errorCount=0,this.loading=!1};function h(t){var e=/([^\*\\\?]*)(\\\*|\\\?|\?|\*(?!\*)|\*\*\/|$)/g,r={"":"","\\*":"\\*","\\?":"\\?","*":"[^/]*","?":"[^/]","**/":"(?:^/)?(?:[^/]+/)*"},i=/[\\^$.*+?()[\]{}|]/g;for(var n="",o=e.exec(t);o&&""!==o[0];o=e.exec(t))n+=o[1].replace(i,"\\$&")+r[o[2]];var s=new RegExp("^"+n+"$");return function(t){return s.test(t)}}var l=function(){function e(t,e,r,i,n){this._resourceFactory=t.resourceFactory,this._audioSystemManager=t.audio,this._defaultAudioSystemId=t.defaultAudioSystemId,this._audioSystemConfMap=function(t){void 0===t&&(t={});var e={music:{loop:!0,hint:{streaming:!0}},sound:{loop:!1,hint:{streaming:!1}}};for(var r in e)r in t||(t[r]=e[r]);return t}(r),this.configuration=this._normalize(e||{}),this._assets={},this._virtualPathToIdTable={},this._liveAssetVirtualPathTable={},this._liveAssetPathTable={},this._moduleMainScripts=i||{},this._moduleMainPaths=null!=n?n:null,this._refCounts={},this._loadings={},this._generatedAssetCount=0,this._assetBundle=null;for(var o=Object.keys(this.configuration),s=0;s<o.length;++s){var a=o[s],u=this.configuration[a];this._virtualPathToIdTable[u.virtualPath]=a}}return e.prototype.destroy=function(){for(var t=Object.keys(this._refCounts),e=0;e<t.length;++e)this._releaseAsset(t[e]);this.configuration=void 0,this._assets=void 0,this._liveAssetVirtualPathTable=void 0,this._liveAssetPathTable=void 0,this._refCounts=void 0,this._loadings=void 0,this._assetBundle=void 0},e.prototype.destroyed=function(){return void 0===this._assets},e.prototype.retryLoad=function(t){if(!this._loadings.hasOwnProperty(t.id))throw a.ExceptionFactory.createAssertionError("AssetManager#retryLoad: invalid argument.");var r=this._loadings[t.id];if(r.errorCount>e.MAX_ERROR_COUNT){if(!this.configuration[t.id])return;throw a.ExceptionFactory.createAssertionError("AssetManager#retryLoad: too many retrying.")}r.loading||(r.loading=!0,t._load(this))},e.prototype.globalAssetIds=function(){var t=[],e=this.configuration;for(var r in e)e.hasOwnProperty(r)&&e[r].global&&t.push(r);return t},e.prototype.preloadScriptAssetPaths=function(){var t=[];return this._assetBundle&&t.push.apply(t,Object.values(this._assetBundle.assets).filter((function(t){return"script"===t.type&&t.preload})).map((function(t){return t.path}))),t.push.apply(t,Object.values(this.configuration).filter((function(t){return"script"===t.type&&t.global&&t.preload})).map((function(t){return t.virtualPath}))),t=t.map((function(t){return t.startsWith("./")?t:"./".concat(t)}))},e.prototype.resolvePatternsToAssetIds=function(t){if(0===t.length)return[];for(var e=Object.keys(this._virtualPathToIdTable),r=[],i=0;i<t.length;++i)for(var n=t[i],o="string"==typeof n?h(this._replaceModulePathToAbsolute(n)):n,s=0;s<e.length;++s){var a=e[s];o("/"+a)&&r.push(this._virtualPathToIdTable[a])}return r},e.prototype.requestAsset=function(t,e){var r;"string"==typeof t?r=t:"uri"in t?(r=t.id,t=this._normalizeAssetBaseDeclaration(r,Object.create(t))):r=t.id;var i,n=!1;if(this._assets.hasOwnProperty(r))++this._refCounts[r],e._onAssetLoad(this._assets[r]);else if(this._loadings.hasOwnProperty(r))(i=this._loadings[r]).handlers.push(e),++this._refCounts[r],n=!0;else{var o=this._getAudioSystem(t),s=null==o?void 0:o.getDestroyRequestedAsset(r);if(o&&s)o.cancelRequestDestroy(s),this._addAssetToTables(s),this._refCounts[r]=1,e._onAssetLoad(s);else{var a=this._createAssetFor(t);i=new c(a,e),this._loadings[r]=i,this._refCounts[r]=1,n=!0,i.loading=!0,a._load(this)}}return n},e.prototype.unrefAsset=function(t){var e="string"==typeof t?t:t.id;--this._refCounts[e]>0||this._releaseAsset(e)},e.prototype.requestAssets=function(t,e){for(var r=0,i=0,n=t.length;i<n;++i)this.requestAsset(t[i],e)&&++r;return r},e.prototype.unrefAssets=function(t){for(var e=0,r=t.length;e<r;++e)this.unrefAsset(t[e])},e.prototype.peekLiveAssetByAccessorPath=function(t,e){if("/"!==(t=this._replaceModulePathToAbsolute(t))[0])throw a.ExceptionFactory.createAssertionError("AssetManager#peekLiveAssetByAccessorPath(): accessorPath must start with '/'");var r=t.slice(1),i=this._liveAssetVirtualPathTable[r];if(!i||e!==i.type)throw a.ExceptionFactory.createAssertionError("AssetManager#peekLiveAssetByAccessorPath(): No ".concat(e," asset for ").concat(t));return i},e.prototype.peekLiveAssetById=function(t,e){var r=this._assets[t];if(!r||e!==r.type)throw a.ExceptionFactory.createAssertionError("AssetManager#peekLiveAssetById(): No ".concat(e," asset for id ").concat(t));return r},e.prototype.peekAllLiveAssetsByPattern=function(t,e){for(var r=Object.keys(this._liveAssetVirtualPathTable),i="string"==typeof t?h(this._replaceModulePathToAbsolute(t)):t,n=[],o=0;o<r.length;++o){var s=r[o],a=this._liveAssetVirtualPathTable[s];if(!e||a.type===e)i("/"+s)&&n.push(a)}return n},e.prototype.resolveAccessorPath=function(t){var e=this._assets[t];if(!e)return null;var r=this._liveAssetPathTable[e.path];return r?"/"+r:null},e.prototype.setAssetBundle=function(t){this._assetBundle=t},e.prototype._normalize=function(t){var e={};if(!(t instanceof Object))throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: invalid arguments.");for(var r in t)if(t.hasOwnProperty(r)){var i=this._normalizeAssetBaseDeclaration(r,Object.create(t[r]));if(!i.path)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: No path given for: "+r);if(!i.virtualPath)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: No virtualPath given for: "+r);i.global||(i.global=!1),e[r]=i}return e},e.prototype._normalizeAssetBaseDeclaration=function(t,e){if(!e.type)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: No type given for: "+t);if("image"===e.type){if("number"!=typeof e.width)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong width given for the image asset: "+t);if("number"!=typeof e.height)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong height given for the image asset: "+t);e.slice=e.slice?(r=e.slice,Array.isArray(r)?{x:r[0],y:r[1],width:r[2],height:r[3]}:r):void 0}var r;if("audio"===e.type){void 0===e.duration&&(e.duration=0);var i=this._audioSystemConfMap[e.systemId];if(void 0===e.loop&&(e.loop=!!i&&!!i.loop),void 0===e.hint&&(e.hint=i?i.hint:{}),"music"!==e.systemId&&"sound"!==e.systemId)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong systemId given for the audio asset: "+t)}if("video"===e.type&&!e.useRealSize){if("number"!=typeof e.width)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong width given for the video asset: "+t);if("number"!=typeof e.height)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong height given for the video asset: "+t);e.useRealSize=!1}if("vector-image"===e.type){if("number"!=typeof e.width)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong width given for the vector-image asset: "+t);if("number"!=typeof e.height)throw a.ExceptionFactory.createAssertionError("AssetManager#_normalize: wrong height given for the vector-image asset: "+t)}return e},e.prototype._createAssetFor=function(e){var n,c,h,l;if(this._assetBundle&&"string"==typeof e){var d=e,p=this._assetBundle.assets[d];if("script"===(null==p?void 0:p.type))return y=new r.BundledScriptAsset(t({id:d},p))}if("string"==typeof e)c=e,l=this.configuration[c],h=this.configuration[c].path;else{if(!("uri"in e))return this._createGeneratedAssetFor(e);c=e.id,l=e,h=e.uri}var f=this._resourceFactory;if(!l)throw a.ExceptionFactory.createAssertionError("AssetManager#_createAssetFor: unknown asset ID: "+c);var _=l.type;switch(_){case"image":if(Array.isArray(l.slice))throw new Error("AssetManager#_createAssetFor: array type of configuration.slice is not yet supported");var y;return(y=l.slice?new s.PartialImageAsset(f,c,h,l.width,l.height,l.slice):f.createImageAsset(c,h,l.width,l.height)).initialize(l.hint),y;case"audio":var v=l.systemId?this._audioSystemManager[l.systemId]:this._audioSystemManager[this._defaultAudioSystemId];return f.createAudioAsset(c,h,l.duration,v,!!l.loop,null!==(n=l.hint)&&void 0!==n?n:{},l.offset);case"text":return f.createTextAsset(c,h);case"script":return f.createScriptAsset(c,h,l.exports);case"video":var g=new u.VideoSystem;return f.createVideoAsset(c,h,l.width,l.height,g,!!l.loop,!!l.useRealSize);case"vector-image":return f.createVectorImageAsset?f.createVectorImageAsset(c,h,l.width,l.height,l.hint):new o.EmptyVectorImageAsset(c,h,l.width,l.height,l.hint);case"binary":return f.createBinaryAsset?f.createBinaryAsset(c,h):new i.EmptyBinaryAsset(c,h);default:throw a.ExceptionFactory.createAssertionError("AssertionError#_createAssetFor: unknown asset type "+_+" for asset ID: "+c)}},e.prototype._createGeneratedAssetFor=function(t){var e=this._resourceFactory,r="%akashic%/generated-asset-".concat(this._generatedAssetCount++);if("vector-image"===t.type)return e.createVectorImageAssetFromString?e.createVectorImageAssetFromString(t.id,r,t.data):new n.EmptyGeneratedVectorImageAsset(t.id,r,t.data);throw a.ExceptionFactory.createAssertionError("AssertionError#_createFromAssetGenerationFor: unsupported asset type ".concat(t.type," for asset ID: ").concat(t.id))},e.prototype._releaseAsset=function(t){var e=this._assets[t]||this._loadings[t]&&this._loadings[t].asset,r=null;if(e)if(r=e.path,e.inUse())if("audio"===e.type)e._system.requestDestroy(e);else{if("video"!==e.type)throw a.ExceptionFactory.createAssertionError("AssetManager#unrefAssets: Unsupported in-use "+e.id);e.destroy()}else e.destroy();if(delete this._refCounts[t],delete this._loadings[t],delete this._assets[t],this.configuration[t]){var i=this.configuration[t].virtualPath;i&&this._liveAssetVirtualPathTable.hasOwnProperty(i)&&delete this._liveAssetVirtualPathTable[i],r&&this._liveAssetPathTable.hasOwnProperty(r)&&delete this._liveAssetPathTable[r]}},e.prototype._countLoadingAsset=function(){return Object.keys(this._loadings).length},e.prototype._onAssetError=function(t,r){if(!this.destroyed()&&!t.destroyed()){var i=this._loadings[t.id],n=i.handlers;i.loading=!1,++i.errorCount,i.errorCount>e.MAX_ERROR_COUNT&&r.retriable&&(r=a.ExceptionFactory.createAssetLoadError("Retry limit exceeded",!1,null,r)),r.retriable||delete this._loadings[t.id];for(var o=0;o<n.length;++o)n[o]._onAssetError(t,r,this.retryLoad.bind(this))}},e.prototype._onAssetLoad=function(t){if(!this.destroyed()&&!t.destroyed()){var e=this._loadings[t.id];e.loading=!1,delete this._loadings[t.id],this._addAssetToTables(t);for(var r=e.handlers,i=0;i<r.length;++i)r[i]._onAssetLoad(t)}},e.prototype._replaceModulePathToAbsolute=function(t){if("/"===t[0]||"*"===t[0])return t;for(var e in this._moduleMainScripts)if(this._moduleMainScripts.hasOwnProperty(e)&&0===t.lastIndexOf(e,0))return"/node_modules/"+t;return t},e.prototype._getAudioSystem=function(t){var e=null;if("string"==typeof t)e=this.configuration[t];else if("uri"in t){e=t}return e?"audio"!==e.type?null:e.systemId?this._audioSystemManager[e.systemId]:this._audioSystemManager[this._defaultAudioSystemId]:null},e.prototype._addAssetToTables=function(t){var e;if(this._assets[t.id]=t,this.configuration[t.id]?e=this.configuration[t.id].virtualPath:this._assetBundle&&this._assetBundle.assets[t.id]&&(e=this._assetBundle.assets[t.id].path),e){if(this._liveAssetVirtualPathTable.hasOwnProperty(e)){if(this._liveAssetVirtualPathTable[e].path!==t.path)throw a.ExceptionFactory.createAssertionError("AssetManager#_onAssetLoad(): duplicated asset path")}else this._liveAssetVirtualPathTable[e]=t;this._liveAssetPathTable.hasOwnProperty(t.path)||(this._liveAssetPathTable[t.path]=e)}},e.MAX_ERROR_COUNT=3,e}();return Fr.AssetManager=l,Fr}var qr,Yr={};var Kr,$r={};function Jr(){if(Kr)return $r;Kr=1,Object.defineProperty($r,"__esModule",{value:!0}),$r.AudioSystemManager=void 0;var t=Ee(),e=we(),r=function(){function r(e){this._muted=!1,this._resourceFactory=e,this.music=new t.MusicAudioSystem({id:"music",muted:this._muted,resourceFactory:e}),this.sound=new t.SoundAudioSystem({id:"sound",muted:this._muted,resourceFactory:e})}return r.prototype.create=function(t){if("music"===t._system.id)return this.music.create(t);if("sound"===t._system.id)return this.sound.create(t);throw e.ExceptionFactory.createAssertionError('AudioSystemManager#create(): unknown systemId "'.concat(t._system.id,'" for asset ID "').concat(t.id,'"'))},r.prototype.play=function(t){if("music"===t._system.id)return this.music.play(t);if("sound"===t._system.id)return this.sound.play(t);throw e.ExceptionFactory.createAssertionError('AudioSystemManager#play(): unknown systemId "'.concat(t._system.id,'" for asset ID "').concat(t.id,'"'))},r.prototype._reset=function(){this._muted=!1,this.music._reset(),this.sound._reset()},r.prototype._setMuted=function(t){this._muted!==t&&(this._muted=t,this.music._setMuted(t),this.sound._setMuted(t))},r.prototype._setPlaybackRate=function(t){this.music._setPlaybackRate(t),this.sound._setPlaybackRate(t)},r.prototype._startSuppress=function(){this.music._startSuppress(),this.sound._startSuppress()},r.prototype._endSuppress=function(){this.music._endSuppress(),this.sound._endSuppress()},r.prototype.stopAll=function(){this.music.stopAll(),this.sound.stopAll()},r}();return $r.AudioSystemManager=r,$r}var Zr,Qr={};var ti,ei,ri={},ii={};function ni(){if(ti)return ii;ti=1,Object.defineProperty(ii,"__esModule",{value:!0}),ii.Font=void 0;var t=tr(),e=function(){function e(){}return e.prototype.measureText=function(e){for(var r=0,i=0,n=0,o=null,s=0;s<e.length;s++){var a=t.Util.charCodeAt(e,s);if(a){var u=this.glyphForCharacter(a);!u||u.x<0||u.y<0||u.width<0||u.height<0||(0===s&&(i=-u.offsetX),o=u,r+=u.advanceWidth)}}return o&&(n=r+o.offsetX+o.width-o.advanceWidth),{width:r,actualBoundingBoxLeft:i,actualBoundingBoxRight:n}},e}();return ii.Font=e,ii}function oi(){if(ei)return ri;ei=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ri,"__esModule",{value:!0}),ri.BitmapFont=void 0;var r=ni(),i=dr(),n=function(e){function r(t){var r=e.call(this)||this;return r.surface=i.SurfaceUtil.asSurface(t.src),t.glyphInfo?(r.map=t.glyphInfo.map,r.defaultGlyphWidth=t.glyphInfo.width,r.defaultGlyphHeight=t.glyphInfo.height,r.missingGlyph=t.glyphInfo.missingGlyph,r.size=t.glyphInfo.height):(r.map=t.map||{},r.defaultGlyphWidth=t.defaultGlyphWidth||0,r.defaultGlyphHeight=t.defaultGlyphHeight||0,r.missingGlyph=t.missingGlyph,r.size=t.defaultGlyphHeight||0),r}return t(r,e),r.prototype.glyphForCharacter=function(t){var e=this.map[t]||this.missingGlyph;if(!e)return null;var r=void 0===e.width?this.defaultGlyphWidth:e.width,i=void 0===e.height?this.defaultGlyphHeight:e.height,n=e.offsetX||0,o=e.offsetY||0,s=void 0===e.advanceWidth?r:e.advanceWidth,a=0===r||0===i?void 0:this.surface;return{code:t,x:e.x,y:e.y,width:r,height:i,surface:a,offsetX:n,offsetY:o,advanceWidth:s,isSurfaceValid:!0,_atlas:null}},r.prototype.destroy=function(){this.surface&&!this.surface.destroyed()&&this.surface.destroy(),this.map=void 0},r.prototype.destroyed=function(){return!this.map},r}(r.Font);return ri.BitmapFont=n,ri}var si,ai={};var ui,ci={};function hi(){if(ui)return ci;ui=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ci,"__esModule",{value:!0}),ci.Camera2D=void 0;var r=function(e){function r(t){var r=e.call(this,t)||this;return r.local=!!t.local,r.name=t.name,r._modifiedCount=0,r}return t(r,e),r.deserialize=function(t){return new r(t.param)},r.prototype.modified=function(){this._modifiedCount=(this._modifiedCount+1)%32768,this._matrix&&(this._matrix._modified=!0)},r.prototype.serialize=function(){return{param:{local:this.local,name:this.name,x:this.x,y:this.y,width:this.width,height:this.height,opacity:this.opacity,scaleX:this.scaleX,scaleY:this.scaleY,angle:this.angle,anchorX:this.anchorX,anchorY:this.anchorY,compositeOperation:this.compositeOperation}}},r.prototype._applyTransformToRenderer=function(t){this.angle||1!==this.scaleX||1!==this.scaleY||0!==this.anchorX||0!==this.anchorY?t.transform(this.getMatrix()._matrix):t.translate(-this.x,-this.y),1!==this.opacity&&t.opacity(this.opacity)},r.prototype._updateMatrix=function(){this._matrix&&(this.angle||1!==this.scaleX||1!==this.scaleY||0!==this.anchorX||0!==this.anchorY?this._matrix.updateByInverse(this.width,this.height,this.scaleX,this.scaleY,this.angle,this.x,this.y,this.anchorX,this.anchorY):this._matrix.reset(-this.x,-this.y))},r}(Ke().Object2D);return ci.Camera2D=r,ci}var li,di={};var pi,fi={},_i={};function yi(){if(pi)return _i;pi=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(_i,"__esModule",{value:!0}),_i.CameraCancellingE=void 0;var r=hi(),i=Ke(),n=function(e){function n(t){var r=e.call(this,t)||this;return r._canceller=new i.Object2D,r}return t(n,e),n.prototype.renderSelf=function(t,e){if(!this.children)return!1;if(e&&e instanceof r.Camera2D){var i=e,n=this._canceller;i.x===n.x&&i.y===n.y&&i.angle===n.angle&&i.scaleX===n.scaleX&&i.scaleY===n.scaleY||(n.x=i.x,n.y=i.y,n.angle=i.angle,n.scaleX=i.scaleX,n.scaleY=i.scaleY,n._matrix&&(n._matrix._modified=!0)),t.save(),t.transform(n.getMatrix()._matrix)}for(var o=this.children,s=0;s<o.length;++s)o[s].render(t,e);return e&&t.restore(),!1},n}(er().E);return _i.CameraCancellingE=n,_i}var vi,gi,mi,Ai,wi,xi={},Si={},bi={},Pi={};function Ei(){if(vi)return Pi;vi=1,Object.defineProperty(Pi,"__esModule",{value:!0}),Pi.Timer=void 0;var t=k(),e=function(){function e(e,r){this.interval=e,this._scaledInterval=Math.round(e*r),this.onElapse=new t.Trigger,this.elapsed=this.onElapse,this._scaledElapsed=0}return e.prototype.tick=function(){for(this._scaledElapsed+=1e3;this._scaledElapsed>=this._scaledInterval&&this.onElapse;)this.onElapse.fire(),this._scaledElapsed-=this._scaledInterval},e.prototype.canDelete=function(){return!this.onElapse||0===this.onElapse.length},e.prototype.destroy=function(){this.interval=void 0,this.onElapse.destroy(),this.onElapse=void 0,this.elapsed=void 0,this._scaledInterval=0,this._scaledElapsed=0},e.prototype.destroyed=function(){return void 0===this.onElapse},e}();return Pi.Timer=e,Pi}function Oi(){if(gi)return bi;gi=1,Object.defineProperty(bi,"__esModule",{value:!0}),bi.TimerManager=bi.TimerIdentifier=void 0;var t=we(),e=Ei(),r=function(){function t(t,e,r,i,n){this._timer=t,this._handler=e,this._handlerOwner=r,this._fired=i,this._firedOwner=n,this._timer.onElapse.add(this._handleElapse,this)}return t.prototype.destroy=function(){this._timer.onElapse.remove(this._handleElapse,this),this._timer=void 0,this._handler=void 0,this._handlerOwner=void 0,this._fired=void 0,this._firedOwner=void 0},t.prototype.destroyed=function(){return void 0===this._timer},t.prototype._handleElapse=function(){this.destroyed()||(this._handler.call(this._handlerOwner),this._fired&&this._fired.call(this._firedOwner,this))},t}();bi.TimerIdentifier=r;var i=function(){function i(t,e){this._timers=[],this._trigger=t,this._identifiers=[],this._fps=e,this._registered=!1}return i.prototype.destroy=function(){for(var t=0;t<this._identifiers.length;++t)this._identifiers[t].destroy();for(t=0;t<this._timers.length;++t)this._timers[t].destroy();this._timers=void 0,this._trigger=void 0,this._identifiers=void 0,this._fps=void 0},i.prototype.destroyed=function(){return void 0===this._timers},i.prototype.createTimer=function(r){if(this._registered||(this._trigger.add(this._tick,this),this._registered=!0),r<0)throw t.ExceptionFactory.createAssertionError("TimerManager#createTimer: invalid interval");r<1&&(r=1);for(var i=Math.min(1e3,r*this._fps),n=0;n<this._timers.length;++n)if(this._timers[n].interval===r&&this._timers[n]._scaledElapsed<i)return this._timers[n];var o=new e.Timer(r,this._fps);return this._timers.push(o),o},i.prototype.deleteTimer=function(e){if(e.canDelete()){var r=this._timers.indexOf(e);if(r<0)throw t.ExceptionFactory.createAssertionError("TimerManager#deleteTimer: can not find timer");if(this._timers.splice(r,1),e.destroy(),!this._timers.length){if(!this._registered)throw t.ExceptionFactory.createAssertionError("TimerManager#deleteTimer: handler is not handled");this._trigger.remove(this._tick,this),this._registered=!1}}},i.prototype.setTimeout=function(t,e,i){var n=this.createTimer(e),o=new r(n,t,i,this._onTimeoutFired,this);return this._identifiers.push(o),o},i.prototype.clearTimeout=function(t){this._clear(t)},i.prototype.setInterval=function(t,e,i){var n=this.createTimer(e),o=new r(n,t,i);return this._identifiers.push(o),o},i.prototype.clearInterval=function(t){this._clear(t)},i.prototype._tick=function(){for(var t=this._timers.concat(),e=0;e<t.length;++e)t[e].tick()},i.prototype._onTimeoutFired=function(e){var r=this._identifiers.indexOf(e);if(r<0)throw t.ExceptionFactory.createAssertionError("TimerManager#_onTimeoutFired: can not find identifier");this._identifiers.splice(r,1);var i=e._timer;e.destroy(),this.deleteTimer(i)},i.prototype._clear=function(e){var r=this._identifiers.indexOf(e);if(r<0)throw t.ExceptionFactory.createAssertionError("TimerManager#_clear: can not find identifier");if(e.destroyed())throw t.ExceptionFactory.createAssertionError("TimerManager#_clear: invalid identifier");this._identifiers.splice(r,1);var i=e._timer;e.destroy(),this.deleteTimer(i)},i}();return bi.TimerManager=i,bi}function Ti(){if(mi)return Si;mi=1,Object.defineProperty(Si,"__esModule",{value:!0}),Si.Scene=void 0;var t=k(),e=Cr(),r=hi(),i=we(),n=Oi(),o=function(){function o(r){var i=r.game,o=void 0===r.local||!1===r.local?"non-local":!0===r.local?"full-local":r.local,s=void 0!==r.tickGenerationMode?r.tickGenerationMode:"by-clock";this.name=r.name,this.game=i,this.local=o,this.tickGenerationMode=s,this.onLoad=new t.Trigger,this.loaded=this.onLoad,this._onReady=new t.Trigger,this._ready=this._onReady,this.assets={},this.asset=i.asset,this.vars={},this._loaded=!1,this._prefetchRequested=!1,this._loadingState="initial",this.onUpdate=new t.Trigger,this.update=this.onUpdate,this._timer=new n.TimerManager(this.onUpdate,this.game.fps),this.onAssetLoad=new t.Trigger,this.onAssetLoadFailure=new t.Trigger,this.onAssetLoadComplete=new t.Trigger,this.assetLoaded=this.onAssetLoad,this.assetLoadFailed=this.onAssetLoadFailure,this.assetLoadCompleted=this.onAssetLoadComplete,this.onMessage=new t.Trigger,this.onPointDownCapture=new t.Trigger,this.onPointMoveCapture=new t.Trigger,this.onPointUpCapture=new t.Trigger,this.onOperation=new t.Trigger,this.message=this.onMessage,this.pointDownCapture=this.onPointDownCapture,this.pointMoveCapture=this.onPointMoveCapture,this.pointUpCapture=this.onPointUpCapture,this.operation=this.onOperation,this.children=[],this.state="standby",this.onStateChange=new t.Trigger,this._assetHolders=[],this._sceneAssetHolder=new e.AssetHolder({assetManager:this.game._assetManager,assetIds:r.assetIds,assetPaths:r.assetPaths,handlerSet:{owner:this,handleLoad:this._handleSceneAssetLoad,handleLoadFailure:this._handleSceneAssetLoadFailure,handleFinish:this._handleSceneAssetLoadFinish},userData:null}),this.seethrough=null!=r.seethrough&&r.seethrough}return o.prototype.modified=function(t){this.game.modified()},o.prototype.destroy=function(){this.state="before-destroyed",this.onStateChange.fire(this.state);for(var t=0,e=[this.game.db,this.game._localDb];t<e.length;t++)for(var r=e[t],i=0,n=r.keys();i<n.length;i++){var o=n[i],s=r.get(o);(null==s?void 0:s.scene)===this&&s.destroy()}this._timer.destroy(),this.onUpdate.destroy(),this.onMessage.destroy(),this.onPointDownCapture.destroy(),this.onPointMoveCapture.destroy(),this.onPointUpCapture.destroy(),this.onOperation.destroy(),this.onLoad.destroy(),this.onAssetLoad.destroy(),this.onAssetLoadFailure.destroy(),this.onAssetLoadComplete.destroy(),this.assets={},this.vars={};for(var a=0;a<this._assetHolders.length;++a)this._assetHolders[a].destroy();this._sceneAssetHolder.destroy(),this.game=void 0,this._waitingPrepare=void 0,this.state="destroyed",this.onStateChange.fire(this.state),this.onStateChange.destroy()},o.prototype.destroyed=function(){return void 0===this.game},o.prototype.createTimer=function(t){return this._timer.createTimer(t)},o.prototype.deleteTimer=function(t){this._timer.deleteTimer(t)},o.prototype.setInterval=function(t,e,r){return this._timer.setInterval(t,e,r)},o.prototype.clearInterval=function(t){this._timer.clearInterval(t)},o.prototype.setTimeout=function(t,e,r){return this._timer.setTimeout(t,e,r)},o.prototype.clearTimeout=function(t){this._timer.clearTimeout(t)},o.prototype.isCurrentScene=function(){return this.game.scene()===this},o.prototype.gotoScene=function(t,e){if(!this.isCurrentScene())throw i.ExceptionFactory.createAssertionError("Scene#gotoScene: this scene is not the current scene");e?this.game.pushScene(t):this.game.replaceScene(t)},o.prototype.end=function(){if(!this.isCurrentScene())throw i.ExceptionFactory.createAssertionError("Scene#end: this scene is not the current scene");this.game.popScene()},o.prototype.register=function(t){this.game.register(t),t.scene=this},o.prototype.unregister=function(t){t.scene=void 0,this.game.unregister(t)},o.prototype.append=function(t){this.insertBefore(t,void 0)},o.prototype.insertBefore=function(t,e){t.parent&&t.remove(),t.parent=this;var r=-1;void 0!==e&&(r=this.children.indexOf(e))>-1?this.children.splice(r,0,t):this.children.push(t),this.modified(!0)},o.prototype.remove=function(t){var e=this.children.indexOf(t);-1!==e&&(this.children[e].parent=void 0,this.children.splice(e,1),this.modified(!0))},o.prototype.findPointSourceByPoint=function(t,e,i){for(var n="non-local"!==this.local,o=this.children,s=i&&i instanceof r.Camera2D?i.getMatrix():void 0,a=o.length-1;a>=0;--a){var u=o[a].findPointSourceByPoint(t,s,e);if(u)return u.local=u.target&&u.target.local||n,u}return{target:void 0,point:void 0,local:n}},o.prototype.prefetch=function(){this._loaded||this._prefetchRequested||(this._prefetchRequested=!0,this._sceneAssetHolder.request())},o.prototype.requestAssets=function(t,r){var n,o,s=this;if("ready-fired"!==this._loadingState&&"loaded-fired"!==this._loadingState)throw i.ExceptionFactory.createAssertionError("Scene#requestAssets(): can be called after loaded.");Array.isArray(t)?(n=t,o=!1):(n=t.assetIds,o=!!t.notifyErrorOnCallback);var a=new e.AssetHolder({assetManager:this.game._assetManager,assetIds:n,alwaysNotifyFinish:o,handlerSet:{owner:this,handleLoad:this._handleSceneAssetLoad,handleLoadFailure:this._handleSceneAssetLoadFailure,handleFinish:this._handleSceneAssetLoadFinish},userData:function(){if(!s.destroyed()){var t=a._getFailureAssetIds();if(t.length){var e=i.ExceptionFactory.createRequestAssetLoadError("Scene#requestAssets(): failed to load the asset. refer to the 'detail' property for more information.",{failureAssetIds:t});r(e)}else r()}}});this._assetHolders.push(a),a.request()},o.prototype._activate=function(){this.state="active",this.onStateChange.fire(this.state)},o.prototype._deactivate=function(){this.state="deactive",this.onStateChange.fire(this.state)},o.prototype._needsLoading=function(){return this._sceneAssetHolder.waitingAssetsCount>0||!!this._waitingPrepare},o.prototype._load=function(){this._loaded||(this._loaded=!0,this._sceneAssetHolder.request()||this._notifySceneReady())},o.prototype._handleSceneAssetLoad=function(t){this.assets[t.id]=t,this.onAssetLoad.fire(t),this.onAssetLoadComplete.fire(t)},o.prototype._handleSceneAssetLoadFailure=function(t){this.onAssetLoadFailure.fire(t),this.onAssetLoadComplete.fire(t.asset)},o.prototype._handleSceneAssetLoadFinish=function(t,e){e?t.userData?this.game._pushPostTickTask(t.userData,null):this._loaded&&this._notifySceneReady():this.game.terminateGame()},o.prototype._notifySceneReady=function(){this._loadingState="ready",this.game._pushPostTickTask(this._fireReady,this)},o.prototype._fireReady=function(){this.destroyed()||(this._onReady.fire(this),this._loadingState="ready-fired")},o.prototype._fireLoaded=function(){this.destroyed()||"loaded-fired"!==this._loadingState&&(this.onLoad.fire(this),this._loadingState="loaded-fired")},o}();return Si.Scene=o,Si}function Mi(){if(Ai)return xi;Ai=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(xi,"__esModule",{value:!0}),xi.LoadingScene=void 0;var r=k(),i=we(),n=function(e){function n(t){var i=this;return t.local=!0,(i=e.call(this,t)||this).onTargetReset=new r.Trigger,i.onTargetReady=new r.Trigger,i.onTargetAssetLoad=new r.Trigger,i.targetReset=i.onTargetReset,i.targetReady=i.onTargetReady,i.targetAssetLoaded=i.onTargetAssetLoad,i._explicitEnd=!!t.explicitEnd,i._targetScene=void 0,i}return t(n,e),n.prototype.destroy=function(){this._clearTargetScene(),e.prototype.destroy.call(this)},n.prototype.reset=function(t){this._clearTargetScene(),this._targetScene=t,"loaded-fired"!==this._loadingState?this.onLoad.addOnce(this._doReset,this):this._doReset()},n.prototype.getTargetWaitingAssetsCount=function(){return this._targetScene?this._targetScene._sceneAssetHolder.waitingAssetsCount:0},n.prototype.end=function(){if(!this._targetScene||"initial"===this._targetScene._loadingState){var t="LoadingScene#end(): the target scene is in invalid state: "+(this._targetScene?this._targetScene._loadingState:"(no scene)");throw i.ExceptionFactory.createAssertionError(t)}this.game._popSceneRaw(!0),this.game._pushPostTickTask(this._targetScene._fireLoaded,this._targetScene),this._clearTargetScene()},n.prototype._clearTargetScene=function(){this._targetScene&&(this.onLoad.removeAll({owner:this,func:this._doReset}),this._targetScene._onReady.removeAll({owner:this}),this._targetScene.onAssetLoad.removeAll({owner:this}),this._targetScene=void 0)},n.prototype._doReset=function(){this.onTargetReset.fire(this._targetScene),"initial"===this._targetScene._loadingState||"ready"===this._targetScene._loadingState?(this._targetScene._onReady.add(this._handleReady,this),this._targetScene.onAssetLoad.add(this._handleAssetLoad,this),this._targetScene._load()):this._handleReady(this._targetScene)},n.prototype._handleAssetLoad=function(t){this.onTargetAssetLoad.fire(t)},n.prototype._handleReady=function(t){this.onTargetReady.fire(t),this._explicitEnd||this.end()},n}(Ti().Scene);return xi.LoadingScene=n,xi}function Ci(){if(wi)return fi;wi=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(fi,"__esModule",{value:!0}),fi.DefaultLoadingScene=void 0;var r=yi(),i=or(),n=function(e){function n(t){var r=e.call(this,{game:t.game,name:"akashic:default-loading-scene"})||this;return"compact"===t.style?(r._barWidth=r.game.width/4,r._barHeight=5,r._style="compact"):(r._barWidth=Math.min(r.game.width,Math.max(100,r.game.width/2)),r._barHeight=5,r._style="default"),r._gauge=void 0,r._gaugeUpdateCount=0,r._totalWaitingAssetCount=0,r.onLoad.add(r._handleLoad,r),r.onTargetReset.add(r._handleTargetReset,r),r.onTargetAssetLoad.add(r._handleTargetAssetLoad,r),r}return t(n,e),n.prototype._handleLoad=function(){var t,e,n,o;if("compact"===this._style){var s=.05*Math.min(this.game.width,this.game.height);t=this.game.width-s-this._barWidth,e=this.game.height-s-this._barHeight,n="transparent"}else t=(this.game.width-this._barWidth)/2,e=(this.game.height-this._barHeight)/2,n="rgba(0, 0, 0, 0.8)";return this.append(new r.CameraCancellingE({scene:this,children:[new i.FilledRect({scene:this,width:this.game.width,height:this.game.height,cssColor:n,children:[new i.FilledRect({scene:this,x:t,y:e,width:this._barWidth,height:this._barHeight,cssColor:"gray",children:[o=new i.FilledRect({scene:this,width:0,height:this._barHeight,cssColor:"white"})]})]})]})),o.onUpdate.add(this._handleUpdate,this),this._gauge=o,!0},n.prototype._handleUpdate=function(){++this._gaugeUpdateCount;var t=Math.round(205+50*Math.sin(this._gaugeUpdateCount/this.game.fps*(2/3)*(2*Math.PI)));this._gauge.cssColor="rgb("+t+","+t+","+t+")",this._gauge.modified()},n.prototype._handleTargetReset=function(t){this._gauge&&(this._gauge.width=0,this._gauge.modified()),this._totalWaitingAssetCount=t._sceneAssetHolder.waitingAssetsCount},n.prototype._handleTargetAssetLoad=function(t){var e=this._targetScene._sceneAssetHolder.waitingAssetsCount;this._gauge.width=Math.ceil((1-e/this._totalWaitingAssetCount)*this._barWidth),this._gauge.modified()},n}(Mi().LoadingScene);return fi.DefaultLoadingScene=n,fi}var Li,Ri={};function Ii(){if(Li)return Ri;Li=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ri,"__esModule",{value:!0}),Ri.DefaultSkippingScene=void 0;var r=yi(),i=or(),n=Ti();function o(t,e,r,i){var n=.15*i;return 0<t&&t<n?function(t,e,r,i){return(t/=i/2)<1?r/2*t*t+e:-r/2*(--t*(t-2)-1)+e}(t,e,r,n):e+r}var s=function(e){function r(t){var r=e.call(this,t)||this;return r.age=0,r.offsetDurationFrame=t.offsetDurationFrame,r.easingDurationFrame=t.easingDurationFrame,r.valueFrom=t.valueFrom,r.valueTo=t.valueTo,r.easing=t.easing,r.onUpdate.add(r._incrementAge,r),r.onUpdate.add(r._updateColor,r),r}return t(r,e),r.prototype._incrementAge=function(){this.age++},r.prototype._updateColor=function(){var t=this._calculateCSSColor();this.cssColor!==t&&(this.cssColor=t,this.modified())},r.prototype._calculateCSSColor=function(){var t=this,e=t.age,r=t.offsetDurationFrame,i=t.easingDurationFrame,n=t.valueFrom,o=t.valueTo,s=(0,t.easing)(Math.max(e-r,0)%i,n,o-n,i);return"rgb(".concat(s,", ").concat(s,", ").concat(s,")")},r}(i.FilledRect),a=function(e){function i(t){var r=e.call(this,{game:t.game,local:"full-local",name:"akashic:default-skipping-scene"})||this;return"indicator"===t.style&&r.onLoad.addOnce(r._handleLoadForIndicator,r),r}return t(i,e),i.prototype._handleLoadForIndicator=function(){var t=this,e=this.game,i=.03*Math.min(e.width,e.height)|0,n=.03*Math.min(e.width,e.height)|0,a=.05*Math.min(e.width,e.height)|0,u=.05*Math.min(e.width,e.height)|0,c=400/(1e3/e.fps),h=2500/(1e3/e.fps),l=255,d=o;this.append(new r.CameraCancellingE({scene:this,children:[3,2,1,0].map((function(r,o){return new s({scene:t,cssColor:"rgb(".concat(l,", ").concat(l,", ").concat(l,")"),width:i,height:i,x:e.width-o*(i+n)-a,y:e.height-u,anchorX:1,anchorY:1,offsetDurationFrame:c*r,easingDurationFrame:h,valueFrom:205,valueTo:l,easing:d})}))}))},i}(n.Scene);return Ri.DefaultSkippingScene=a,Ri}var Fi,ji={};var Di,ki,Ui,Gi,Hi={},Bi={},Vi={},Wi={};function Ni(){if(Di)return Wi;Di=1,Object.defineProperty(Wi,"__esModule",{value:!0}),Wi.SurfaceAtlasSlot=void 0;var t=function(t,e,r,i){this.x=t,this.y=e,this.width=r,this.height=i,this.prev=null,this.next=null};return Wi.SurfaceAtlasSlot=t,Wi}function Xi(){if(ki)return Vi;ki=1,Object.defineProperty(Vi,"__esModule",{value:!0}),Vi.SurfaceAtlas=void 0;var t=Ni();var e=function(){function e(e){this._surface=e,this._emptySurfaceAtlasSlotHead=new t.SurfaceAtlasSlot(0,0,this._surface.width,this._surface.height),this._accessScore=0,this._usedRectangleAreaSize={width:0,height:0}}return e.prototype.reset=function(){var e=this._surface.renderer();e.begin(),e.clear(),e.end(),this._emptySurfaceAtlasSlotHead=new t.SurfaceAtlasSlot(0,0,this._surface.width,this._surface.height),this._accessScore=0,this._usedRectangleAreaSize.width=0,this._usedRectangleAreaSize.height=0},e.prototype._acquireSurfaceAtlasSlot=function(e,r){e+=1,r+=1;var i=function(t,e,r){for(;t;){if(t.width>=e&&t.height>=r)return t;t=t.next}return null}(this._emptySurfaceAtlasSlotHead,e,r);if(!i)return null;var n,o,s=i.width-e,a=i.height-r;s<=a?(n=new t.SurfaceAtlasSlot(i.x+e,i.y,s,r),o=new t.SurfaceAtlasSlot(i.x,i.y+r,i.width,a)):(n=new t.SurfaceAtlasSlot(i.x,i.y+r,e,a),o=new t.SurfaceAtlasSlot(i.x+e,i.y,s,i.height)),n.prev=i.prev,n.next=o,null===n.prev?this._emptySurfaceAtlasSlotHead=n:n.prev.next=n,o.prev=n,o.next=i.next,o.next&&(o.next.prev=o);var u=new t.SurfaceAtlasSlot(i.x,i.y,e,r);return this._updateUsedRectangleAreaSize(u),u},e.prototype._updateUsedRectangleAreaSize=function(t){var e=t.x+t.width,r=t.y+t.height;e>this._usedRectangleAreaSize.width&&(this._usedRectangleAreaSize.width=e),r>this._usedRectangleAreaSize.height&&(this._usedRectangleAreaSize.height=r)},e.prototype.addSurface=function(t,e,r,i,n){var o=this._acquireSurfaceAtlasSlot(i,n);if(!o)return null;var s=this._surface.renderer();return s.begin(),s.drawImage(t,e,r,i,n,o.x,o.y),s.end(),o},e.prototype.destroy=function(){this._surface.destroy()},e.prototype.destroyed=function(){return this._surface.destroyed()},e.prototype.getAtlasUsedSize=function(){return this._usedRectangleAreaSize},e.prototype.getAccessScore=function(){return this._accessScore},e}();return Vi.SurfaceAtlas=e,Vi}function zi(){if(Ui)return Bi;Ui=1,Object.defineProperty(Bi,"__esModule",{value:!0}),Bi.SurfaceAtlasSet=void 0;var t=Xi();var e=function(){function e(t){this._surfaceAtlases=[],this._atlasGlyphsTable=[],this._resourceFactory=t.resourceFactory,this._currentAtlasIndex=0;var r=t.hint?t.hint:{};this._maxAtlasNum=r.maxAtlasNum?r.maxAtlasNum:e.INITIAL_MAX_SURFACEATLAS_NUM,r.initialAtlasWidth=r.initialAtlasWidth?r.initialAtlasWidth:512,r.initialAtlasHeight=r.initialAtlasHeight?r.initialAtlasHeight:512,r.maxAtlasWidth=r.maxAtlasWidth?r.maxAtlasWidth:512,r.maxAtlasHeight=r.maxAtlasHeight?r.maxAtlasHeight:512,this._atlasSize=function(t){return{width:Math.ceil(Math.min(t.initialAtlasWidth,t.maxAtlasWidth)),height:Math.ceil(Math.min(t.initialAtlasHeight,t.maxAtlasHeight))}}(r)}return e.prototype._deleteAtlas=function(t){for(var e=0;e<t;++e){var r=this._spliceLeastFrequentlyUsedAtlas();if(!r)return;r.destroy()}},e.prototype._findLeastFrequentlyUsedAtlasIndex=function(){for(var t=Number.MAX_VALUE,e=-1,r=0;r<this._surfaceAtlases.length;++r)this._surfaceAtlases[r]._accessScore<=t&&(t=this._surfaceAtlases[r]._accessScore,e=r);return e},e.prototype._spliceLeastFrequentlyUsedAtlas=function(){var t=this._findLeastFrequentlyUsedAtlasIndex();if(-1===t)return null;this._currentAtlasIndex>=t&&--this._currentAtlasIndex;for(var e=this._surfaceAtlases.splice(t,1)[0],r=this._atlasGlyphsTable.splice(t,1)[0],i=0;i<r.length;i++){var n=r[i];n.surface=void 0,n.isSurfaceValid=!1,n._atlas=null}return e},e.prototype._moveGlyphSurface=function(t){for(var e=0;e<this._surfaceAtlases.length;++e){var r=(this._currentAtlasIndex+e)%this._surfaceAtlases.length,i=this._surfaceAtlases[r],n=i.addSurface(t.surface,t.x,t.y,t.width,t.height);if(n)return this._currentAtlasIndex=r,t.surface&&t.surface.destroy(),t.surface=i._surface,t.x=n.x,t.y=n.y,t._atlas=i,this._atlasGlyphsTable[r].push(t),!0}return!1},e.prototype._reallocateAtlas=function(){var e=null;this._surfaceAtlases.length>=this._maxAtlasNum?(e=this._spliceLeastFrequentlyUsedAtlas()).reset():e=new t.SurfaceAtlas(this._resourceFactory.createSurface(this._atlasSize.width,this._atlasSize.height)),this._surfaceAtlases.push(e),this._atlasGlyphsTable.push([]),this._currentAtlasIndex=this._surfaceAtlases.length-1},e.prototype.getAtlas=function(t){return this._surfaceAtlases[t]},e.prototype.getAtlasNum=function(){return this._surfaceAtlases.length},e.prototype.getMaxAtlasNum=function(){return this._maxAtlasNum},e.prototype.changeMaxAtlasNum=function(t){if(this._maxAtlasNum=t,this._surfaceAtlases.length>this._maxAtlasNum){var e=this._surfaceAtlases.length-this._maxAtlasNum;this._deleteAtlas(e)}},e.prototype.getAtlasUsedSize=function(){return this._atlasSize},e.prototype.addGlyph=function(t){return!(t.width>this._atlasSize.width||t.height>this._atlasSize.height)&&(!!this._moveGlyphSurface(t)||(this._reallocateAtlas(),this._moveGlyphSurface(t)))},e.prototype.touchGlyph=function(t){t._atlas&&(t._atlas._accessScore+=1);for(var e=0;e<this._surfaceAtlases.length;e++){this._surfaceAtlases[e]._accessScore/=2}},e.prototype.destroy=function(){for(var t=0;t<this._surfaceAtlases.length;++t)this._surfaceAtlases[t].destroy();this._surfaceAtlases=void 0,this._resourceFactory=void 0,this._atlasGlyphsTable=void 0},e.prototype.destroyed=function(){return void 0===this._surfaceAtlases},e.INITIAL_MAX_SURFACEATLAS_NUM=10,e}();return Bi.SurfaceAtlasSet=e,Bi}var qi,Yi={};var Ki,$i={};function Ji(){if(Ki)return $i;Ki=1,Object.defineProperty($i,"__esModule",{value:!0}),$i.EventConverter=void 0;var t=er(),e=We(),r=we(),i=function(){function i(t){var e;this._game=t.game,this._playerId=null!==(e=t.playerId)&&void 0!==e?e:null,this._playerTable={}}return i.prototype.toGameEvent=function(i){var n,o,s,a,u,c,h,l,d,p=i[0],f=i[1],_=i[2],y=this._playerTable[_]||{id:_};switch(p){case 0:return y={id:_,name:i[3]},this._playerTable[_]&&null!=this._playerTable[_].userData&&(y.userData=this._playerTable[_].userData),this._playerTable[_]=y,new e.JoinEvent(y,f);case 1:return delete this._playerTable[y.id],new e.LeaveEvent(y,f);case 2:return l=i[3],new e.TimestampEvent(l,y,f);case 3:return y={id:_,name:i[3],userData:i[4]},this._playerTable[_]=y,new e.PlayerInfoEvent(y,f);case 32:return h=i[4],new e.MessageEvent(i[3],y,h,f);case 33:return h=i[8],n=i[3],s=null==(o=i[6])?void 0:o>=0?this._game.db.get(o):this._game._localDb.get(o),a={x:i[4],y:i[5]},d=i[7],new t.PointDownEvent(n,s,a,y,h,f,d);case 34:return h=i[12],n=i[3],s=null==(o=i[10])?void 0:o>=0?this._game.db.get(o):this._game._localDb.get(o),a={x:i[4],y:i[5]},u={x:i[6],y:i[7]},c={x:i[8],y:i[9]},d=i[11],new t.PointMoveEvent(n,s,a,c,u,y,h,f,d);case 35:return h=i[12],n=i[3],s=null==(o=i[10])?void 0:o>=0?this._game.db.get(o):this._game._localDb.get(o),a={x:i[4],y:i[5]},u={x:i[6],y:i[7]},c={x:i[8],y:i[9]},d=i[11],new t.PointUpEvent(n,s,a,c,u,y,h,f,d);case 64:h=i[5];var v=i[3],g=i[4],m=this._game._decodeOperationPluginOperation(v,g);return new e.OperationEvent(v,m,y,h,f);default:throw r.ExceptionFactory.createAssertionError("EventConverter#toGameEvent")}},i.prototype.toPlaylogEvent=function(t,e){var i,n,o,s,a,u,c,h,l;switch(t.type){case"join":case"leave":throw r.ExceptionFactory.createAssertionError("EventConverter#toPlaylogEvent: Invalid type: "+t.type);case"timestamp":var d=t;return l=e?null!==(i=d.player.id)&&void 0!==i?i:null:this._playerId,[2,d.eventFlags,l,d.timestamp];case"player-info":var p=t;return l=e?null!==(n=p.player.id)&&void 0!==n?n:null:this._playerId,[3,p.eventFlags,l,p.player.name,p.player.userData];case"point-down":var f=t;return h=f.target?f.target.id:null,l=e&&f.player?null!==(o=f.player.id)&&void 0!==o?o:null:this._playerId,[33,f.eventFlags,l,f.pointerId,f.point.x,f.point.y,h,f.button,!!f.local];case"point-move":var _=t;return h=_.target?_.target.id:null,l=e&&_.player?null!==(s=_.player.id)&&void 0!==s?s:null:this._playerId,[34,_.eventFlags,l,_.pointerId,_.point.x,_.point.y,_.startDelta.x,_.startDelta.y,_.prevDelta.x,_.prevDelta.y,h,_.button,!!_.local];case"point-up":var y=t;return h=y.target?y.target.id:null,l=e&&y.player?null!==(a=y.player.id)&&void 0!==a?a:null:this._playerId,[35,y.eventFlags,l,y.pointerId,y.point.x,y.point.y,y.startDelta.x,y.startDelta.y,y.prevDelta.x,y.prevDelta.y,h,y.button,!!y.local];case"message":var v=t;return l=e&&v.player?null!==(u=v.player.id)&&void 0!==u?u:null:this._playerId,[32,v.eventFlags,l,v.data,!!v.local];case"operation":var g=t;return l=e&&g.player?null!==(c=g.player.id)&&void 0!==c?c:null:this._playerId,[64,g.eventFlags,l,g.code,g.data,!!g.local];default:throw r.ExceptionFactory.createAssertionError("Unknown type: "+t.type)}},i.prototype.makePlaylogOperationEvent=function(t){var e=this._playerId;return[64,null!=t.priority?3&t.priority:0,e,t._code,t.data,!!t.local]},i}();return $i.EventConverter=i,$i}var Zi,Qi={};var tn,en={};var rn,nn={};var on,sn={};var an,un={};var cn,hn={};function ln(){if(cn)return hn;cn=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(hn,"__esModule",{value:!0}),hn.InitialScene=void 0;var r=k(),i=function(e){function i(t){var i=e.call(this,t)||this;return i.onAllAssetsLoad=new r.Trigger,i.onLoad.add(i._handleLoad,i),i}return t(i,e),i.prototype.destroy=function(){e.prototype.destroy.call(this),this.onAllAssetsLoad.destroyed()||this.onAllAssetsLoad.destroy(),this.onAllAssetsLoad=void 0},i.prototype._handleLoad=function(){if(this.game._configuration.assetBundle){var t=this.game._moduleManager._internalRequire(this.game._configuration.assetBundle);this.game._assetManager.setAssetBundle(t);var e=Object.keys(t.assets);this.requestAssets(e,this._handleRequestAssets.bind(this))}else this.onAllAssetsLoad.fire()},i.prototype._handleRequestAssets=function(){this.onAllAssetsLoad.fire()},i}(Ti().Scene);return hn.InitialScene=i,hn}var dn,pn={};var fn,_n={};var yn,vn={},gn={};function mn(){if(yn)return gn;yn=1,Object.defineProperty(gn,"__esModule",{value:!0}),gn.RequireCachedValue=void 0;var t=function(){function t(t){this._value=t}return t.prototype._cachedValue=function(){return this._value},t}();return gn.RequireCachedValue=t,gn}var An,wn,xn={};function Sn(){if(An)return xn;An=1,Object.defineProperty(xn,"__esModule",{value:!0}),xn.ScriptAssetContext=void 0;var t=we(),e=function(){function e(t,e){this._asset=t,this._module=e,this._started=!1}return e.prototype._cachedValue=function(){if(!this._started)throw t.ExceptionFactory.createAssertionError("ScriptAssetContext#_cachedValue: not executed yet.");return this._module.exports},e.prototype._executeScript=function(t){return this._started||(t&&(this._module.parent=t,t.children.push(this._module)),this._started=!0,this._asset.execute(this._module._runtimeValue),this._module.loaded=!0),this._module.exports},e}();return xn.ScriptAssetContext=e,xn}function bn(){if(wn)return vn;wn=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.ModuleManager=void 0;var t=Le(),e=we(),r=Re(),i=mn(),n=Sn(),o=function(){function o(t,e){this._assetManager=e,this._runtimeValueBase=t,this._scriptCaches={}}return o.prototype._internalRequire=function(t,e){var r=this._require(t,e);return r.__esModule?r.default:r},o.prototype._require=function(o,s){var a,u,c=this,h=this._assetManager._liveAssetVirtualPathTable,l=this._assetManager._moduleMainScripts;if(-1===o.indexOf("/")&&this._assetManager._assets.hasOwnProperty(o)&&(a=this._assetManager._assets[o],u=this._assetManager._liveAssetPathTable[a.path]),u||(u=this._resolvePath(o,s),/^\//.test(u)&&(u=u.slice(1))),this._scriptCaches.hasOwnProperty(u))return this._scriptCaches[u]._cachedValue();if(a=l[o]?h[u]:this._findAssetByPathAsFile(u,h)){if(this._scriptCaches.hasOwnProperty(u))return this._scriptCaches[u]._cachedValue();if("script"===a.type){var d=new r.Module({runtimeValueBase:this._runtimeValueBase,id:a.id,path:a.path,virtualPath:this._assetManager._liveAssetPathTable[a.path],requireFunc:function(t,e){return c._require(t,e)},resolveFunc:function(t,e){return c._resolvePath(t,e)}}),p=new n.ScriptAssetContext(a,d);return this._scriptCaches[u]=p,p._executeScript(s)}if("text"===a.type&&a&&".json"===t.PathUtil.resolveExtname(o))return(this._scriptCaches[u]=new i.RequireCachedValue(JSON.parse(a.data)))._cachedValue()}throw e.ExceptionFactory.createAssertionError("g._require: can not find module: "+o)},o.prototype._resolvePath=function(r,i){var n=null,o=this._assetManager._liveAssetVirtualPathTable,s=this._assetManager._moduleMainScripts;if(/^\.\/|^\.\.\/|^\//.test(r)){if(i){if(!i._virtualDirname)throw e.ExceptionFactory.createAssertionError("g._require.resolve: couldn't resolve the module path without virtualPath");n=t.PathUtil.resolvePath(i._virtualDirname,r)}else if(/^\.\//.test(r))n=r.substring(2);else{if(!/^\//.test(r))throw e.ExceptionFactory.createAssertionError("g._require.resolve: entry point path must start with './'");n=r.substring(1)}if(h=this._resolveAbsolutePathAsFile(n,o))return h;if(h=this._resolveAbsolutePathAsDirectory(n,o))return h}else{if(s[r])return s[r];var a=i?i.paths.concat():[];a.push("node_modules");for(var u=0;u<a.length;++u){var c=a[u],h=t.PathUtil.resolvePath(c,r);if(n=this._resolveAbsolutePathAsFile(h,o))return n;if(n=this._resolveAbsolutePathAsDirectory(h,o))return n}}throw e.ExceptionFactory.createAssertionError("g._require.resolve: couldn't resolve the path: "+r)},o.prototype._findAssetByPathAsFile=function(t,e){return e.hasOwnProperty(t)?e[t]:e.hasOwnProperty(t+".js")?e[t+".js"]:void 0},o.prototype._resolveAbsolutePathAsFile=function(t,e){return e.hasOwnProperty(t)?"/"+t:e.hasOwnProperty(t+".js")?"/"+t+".js":null},o.prototype._resolveAbsolutePathAsDirectory=function(e,r){var i=e+"/package.json",n=r[i],o=this._assetManager._moduleMainPaths;if(o&&o[i])return o[i];if(r.hasOwnProperty(i)&&"text"===n.type){var s=JSON.parse(n.data);if(s&&"string"==typeof s.main){var a=this._resolveAbsolutePathAsFile(t.PathUtil.resolvePath(e,s.main),r);if(a)return a}}return i=e+"/index.js",r.hasOwnProperty(i)?"/"+i:null},o}();return vn.ModuleManager=o,vn}var Pn,En={};var On,Tn={};var Mn,Cn={};function Ln(){if(Mn)return Cn;Mn=1;var t=e&&e.__assign||function(){return t=Object.assign||function(t){for(var e,r=1,i=arguments.length;r<i;r++)for(var n in e=arguments[r])Object.prototype.hasOwnProperty.call(e,n)&&(t[n]=e[n]);return t},t.apply(this,arguments)};Object.defineProperty(Cn,"__esModule",{value:!0}),Cn.OperationPluginManager=void 0;var r=k(),i=function(){function e(t,e,r){this._code=t,this._handler=r,this._handlerOwner=e}return e.prototype.onOperation=function(e){var r;r=Array.isArray(e)?{_code:this._code,data:e}:t({_code:this._code},e),this._handler.call(this._handlerOwner,r)},e}(),n=function(){function t(t,e){this.onOperate=new r.Trigger,this.operated=this.onOperate,this.plugins={},this._game=t,this._viewInfo=e}return t.prototype.register=function(t,e,r){return this._instantiateOperationPlugin(t,e,r)},t.prototype.start=function(t){var e=this.plugins[t];e&&e.start()},t.prototype.stop=function(t){var e=this.plugins[t];e&&e.stop()},t.prototype.destroy=function(){this.stopAll(),this.onOperate.destroy(),this.onOperate=void 0,this.operated=void 0,this.plugins=void 0,this._game=void 0,this._viewInfo=void 0},t.prototype.reset=function(){this.stopAll(),this.onOperate.removeAll(),this.plugins={}},t.prototype.stopAll=function(){for(var t in this.plugins)if(this.plugins.hasOwnProperty(t)){var e=this.plugins[t];e&&e.stop()}},t.prototype._instantiateOperationPlugin=function(t,e,r){if(t.isSupported()){if(this.plugins[e])throw new Error("Plugin#code conflicted for code: ".concat(e));var n=new t(this._game,this._viewInfo,r);this.plugins[e]=n;var o=new i(e,this.onOperate,this.onOperate.fire);return n.operationTrigger.add(o.onOperation,o),n}},t}();return Cn.OperationPluginManager=n,Cn}var Rn,In={};var Fn,jn={};var Dn,kn={};var Un,Gn={};function Hn(){if(Un)return Gn;Un=1,Object.defineProperty(Gn,"__esModule",{value:!0}),Gn.PointEventResolver=void 0;var t=function(){function t(t){var e;this._currentPoints=0,this._pointEventMap={},this._sourceResolver=t.sourceResolver,this._playerId=t.playerId,this._maxPoints=null!==(e=t.maxPoints)&&void 0!==e?e:null}return t.prototype.pointDown=function(t){if(null!=this._maxPoints&&this._currentPoints>=this._maxPoints)return null;var e=this._sourceResolver.findPointSource(t.offset),r=e.point?e.point:t.offset,i=e.target?e.target.id:void 0,n=e.local;this._pointEventMap[t.identifier]={targetId:i,local:n,point:r,start:{x:t.offset.x,y:t.offset.y},prev:{x:t.offset.x,y:t.offset.y}},this._currentPoints++;var o=[33,2,this._playerId,t.identifier,r.x,r.y,i,t.button];return e&&e.local&&o.push(e.local),o},t.prototype.pointMove=function(t){var e=this._pointEventMap[t.identifier];if(!e)return null;var r={x:0,y:0},i={x:0,y:0};this._pointMoveAndUp(e,t.offset,r,i);var n=[34,2,this._playerId,t.identifier,e.point.x,e.point.y,i.x,i.y,r.x,r.y,e.targetId,t.button];return e.local&&n.push(e.local),n},t.prototype.pointUp=function(t){var e=this._pointEventMap[t.identifier];if(!e)return null;var r={x:0,y:0},i={x:0,y:0};this._pointMoveAndUp(e,t.offset,r,i),delete this._pointEventMap[t.identifier],this._currentPoints--;var n=[35,2,this._playerId,t.identifier,e.point.x,e.point.y,i.x,i.y,r.x,r.y,e.targetId,t.button];return e.local&&n.push(e.local),n},t.prototype._pointMoveAndUp=function(t,e,r,i){i.x=e.x-t.start.x,i.y=e.y-t.start.y,r.x=e.x-t.prev.x,r.y=e.y-t.prev.y,t.prev.x=e.x,t.prev.y=e.y},t}();return Gn.PointEventResolver=t,Gn}var Bn,Vn={};function Wn(){if(Bn)return Vn;Bn=1,Object.defineProperty(Vn,"__esModule",{value:!0}),Vn.RandomGenerator=void 0;var t=function(t){this.seed=t};return Vn.RandomGenerator=t,Vn}var Nn,Xn={};var zn,qn={};var Yn,Kn={};var $n,Jn={};var Zn,Qn={};var to,eo={};var ro,io={};var no,oo={};var so,ao={};function uo(){if(so)return ao;so=1,Object.defineProperty(ao,"__esModule",{value:!0}),ao.Xorshift=void 0;var t=function(){function t(t){var e=Array.isArray(t)?t:this.generateSeeds(t);this._state0U=0|e[0],this._state0L=0|e[1],this._state1U=0|e[2],this._state1L=0|e[3]}return t.deserialize=function(e){return new t([e._state0U,e._state0L,e._state1U,e._state1L])},t.prototype.initState=function(t){var e=this.generateSeeds(t);this._state0L=0|e[0],this._state0U=0|e[1],this._state1L=0|e[2],this._state1U=0|e[3]},t.prototype.randomInt=function(){var t=this._state0U,e=this._state0L,r=this._state1U,i=this._state1L,n=(i>>>0)+(e>>>0),o=r+t+(n/2>>>31)>>>0,s=n>>>0;this._state0U=r,this._state0L=i;var a=0,u=0;a=(t^=a=t<<23|(-512&e)>>>9)^r,u=(e^=u=e<<23)^i;a^=t>>>18,u^=e>>>18|(262143&t)<<14;return a^=r>>>5,u^=i>>>5|(31&r)<<27,this._state1U=a,this._state1L=u,[o,s]},t.prototype.random=function(){var t=this.randomInt();return 2.3283064365386963e-10*t[0]+2220446049250313e-31*(t[1]>>>12)},t.prototype.nextInt=function(t,e){return Math.floor(t+this.random()*(e-t))},t.prototype.serialize=function(){return{_state0U:this._state0U,_state0L:this._state0L,_state1U:this._state1U,_state1L:this._state1L}},t.prototype.generateSeeds=function(t){var e=1812433253;return[t=e*(t^t>>30)+1,t=e*(t^t>>30)+2,t=e*(t^t>>30)+3,t=e*(t^t>>30)+4]},t}();return ao.Xorshift=t,ao}var co,ho={};function lo(){if(co)return ho;co=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ho,"__esModule",{value:!0}),ho.XorshiftRandomGenerator=void 0;var r=we(),i=Wn(),n=uo(),o=function(e){function i(t,i){var o=this;if(void 0===t)throw r.ExceptionFactory.createAssertionError("XorshiftRandomGenerator#constructor: seed is undefined");return(o=e.call(this,t)||this)._xorshift=i?n.Xorshift.deserialize(i):new n.Xorshift(t),o}return t(i,e),i.deserialize=function(t){return new i(t._seed,t._xorshift)},i.prototype.get=function(t,e){return this._xorshift.nextInt(t,e+1)},i.prototype.generate=function(){return this._xorshift.random()},i.prototype.serialize=function(){return{_seed:this.seed,_xorshift:this._xorshift.serialize()}},i}(i.RandomGenerator);return ho.XorshiftRandomGenerator=o,ho}var po,fo,_o={};function yo(){return fo||(fo=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=e&&e.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),t.PathUtil=t.VideoSystem=t.ShaderProgram=t.Module=t.AudioSystem=void 0,i(S(),t),i(k(),t),i(fe(),t);var n=Ee();Object.defineProperty(t,"AudioSystem",{enumerable:!0,get:function(){return n.AudioSystem}});var o=Re();Object.defineProperty(t,"Module",{enumerable:!0,get:function(){return o.Module}});var s=je();Object.defineProperty(t,"ShaderProgram",{enumerable:!0,get:function(){return s.ShaderProgram}});var a=Ue();Object.defineProperty(t,"VideoSystem",{enumerable:!0,get:function(){return a.VideoSystem}});var u=Le();Object.defineProperty(t,"PathUtil",{enumerable:!0,get:function(){return u.PathUtil}}),i(rr(),t),i(er(),t),i(or(),t),i(function(){if(ur)return cr;ur=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(cr,"__esModule",{value:!0}),cr.FrameSprite=void 0;var r=k(),i=function(e){function i(t){var i=e.call(this,t)||this;return i._lastUsedIndex=0,i.frameNumber=t.frameNumber||0,i.frames=null!=t.frames?t.frames:[0],i.interval=t.interval,i._timer=void 0,i.loop=null==t.loop||t.loop,i.onFinish=new r.Trigger,i.finished=i.onFinish,i._modifiedSelf(),i}return t(i,e),i.createBySprite=function(t,e,r){var n=new i({scene:t.scene,src:t.src,width:void 0===e?t.width:e,height:void 0===r?t.height:r});return n.srcHeight=void 0===r?t.srcHeight:r,n.srcWidth=void 0===e?t.srcWidth:e,n},i.prototype.start=function(){void 0===this.interval&&(this.interval=1e3/this.game().fps),this._timer&&this._free(),this._timer=this.scene.createTimer(this.interval),this._timer.onElapse.add(this._handleElapse,this)},i.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t)},i.prototype.stop=function(){this._timer&&this._free()},i.prototype.modified=function(t){this._modifiedSelf(t),e.prototype.modified.call(this,t)},i.prototype._handleElapse=function(){this.frameNumber===this.frames.length-1?this.loop?this.frameNumber=0:(this.stop(),this.onFinish.fire()):this.frameNumber++,this.modified()},i.prototype._free=function(){this._timer&&(this._timer.onElapse.remove(this._handleElapse,this),this._timer.canDelete()&&this.scene.deleteTimer(this._timer),this._timer=void 0)},i.prototype._changeFrame=function(){var t=this.frames[this.frameNumber],e=Math.floor(this._surface.width/this.srcWidth);this.srcX=t%e*this.srcWidth,this.srcY=Math.floor(t/e)*this.srcHeight,this._lastUsedIndex=t},i.prototype._modifiedSelf=function(t){this._lastUsedIndex!==this.frames[this.frameNumber]&&this._changeFrame()},i}(pr().Sprite);return cr.FrameSprite=i,cr}(),t),i(function(){if(_r)return yr;_r=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(yr,"__esModule",{value:!0}),yr.Label=void 0;var r=gr(),i=tr(),n=rr(),o=function(e){function o(t){var i=e.call(this,t)||this;return i.text=t.text,i.font=t.font,i.textAlign=null!=t.textAlign?t.textAlign:r.TextAlign.Left,i.glyphs=new Array(t.text.length),i.fontSize=null!=t.fontSize?t.fontSize:t.font.size,i.maxWidth=t.maxWidth,i.widthAutoAdjust=null==t.widthAutoAdjust||t.widthAutoAdjust,i.textColor=t.textColor,i._realTextAlign="left",i._textWidth=0,i._overhangLeft=0,i._overhangRight=0,i._invalidateSelf(),i}return t(o,e),o.prototype.aligning=function(t,e){this.width=t,this.widthAutoAdjust=!1,this.textAlign=e},o.prototype.invalidate=function(){this._invalidateSelf(),e.prototype.invalidate.call(this)},o.prototype.renderSelfFromCache=function(t){var e;switch(this._realTextAlign){case"center":e=this.widthAutoAdjust?this._overhangLeft:0;break;case"right":e=this.widthAutoAdjust?this._overhangLeft:this._overhangRight;break;default:e=this._overhangLeft}t.drawImage(this._cache,0,0,this._cacheSize.width+n.CacheableE.PADDING,this._cacheSize.height+n.CacheableE.PADDING,e,0)},o.prototype.renderCache=function(t){if(!(!this.fontSize||this.height<=0||this._textWidth<=0)){var e=this.maxWidth&&this.maxWidth>0&&this.maxWidth<this._textWidth?this.maxWidth/this._textWidth:1,r=0;switch(this._realTextAlign){case"center":r=this.width/2-(this._textWidth+this._overhangLeft)/2*e;break;case"right":r=this.width-(this._textWidth+this._overhangLeft)*e;break;default:r-=this._overhangLeft*e}t.translate(Math.round(r),0),1!==e&&t.transform([e,0,0,1,0,0]),t.save();for(var i=this.fontSize/this.font.size,n=0,o=0;o<this.glyphs.length;++o){var s=this.glyphs[o],a=s.advanceWidth*i,u=s.code;s.isSurfaceValid||(s=this.font.glyphForCharacter(u))?(s.surface&&(t.save(),t.translate(Math.round(n),0),t.transform([i,0,0,i,0,0]),t.drawImage(s.surface,s.x,s.y,s.width,s.height,s.offsetX,s.offsetY),t.restore()),n+=a):this._outputOfWarnLogWithNoGlyph(u,"renderCache()")}t.restore(),t.save(),this.textColor&&(t.setCompositeOperation("source-atop"),t.fillRect(0,0,this._textWidth,this.height,this.textColor)),t.restore()}},o.prototype.destroy=function(){e.prototype.destroy.call(this)},o.prototype._invalidateSelf=function(){this.glyphs.length=0,this._textWidth=0;var t=this.textAlign;if(this._realTextAlign="string"==typeof t?t:i.Util.enumToSnakeCase(r.TextAlign,t),this.fontSize){for(var e=this.text.length-1,n=this.text.length-1;n>=0;--n)if((a=i.Util.charCodeAt(this.text,n))&&(u=this.font.glyphForCharacter(a))&&0!==u.width&&0!==u.advanceWidth){e=n;break}var o=0,s=this.font.size>0?this.fontSize/this.font.size:0;for(n=0;n<=e;++n){var a,u;if(a=i.Util.charCodeAt(this.text,n))if(u=this.font.glyphForCharacter(a)){if(!(u.width<0||u.height<0||u.x<0||u.y<0)){this.glyphs.push(u);var c=0;0===n&&(this._overhangLeft=Math.min(u.offsetX,0),c=-this._overhangLeft),n===e&&(this._overhangRight=Math.max(u.width+u.offsetX-u.advanceWidth,0),c+=this._overhangRight),this._textWidth+=(u.advanceWidth+c)*s;var h=u.offsetY+u.height;o<h&&(o=h)}}else this._outputOfWarnLogWithNoGlyph(a,"_invalidateSelf()")}this.widthAutoAdjust&&(this.width=this._textWidth),this.height=o*s}else this.height=0},o.prototype._outputOfWarnLogWithNoGlyph=function(t,e){var r=4294901760&t?String.fromCharCode((4294901760&t)>>>16,65535&t):String.fromCharCode(t);console.warn("Label#"+e+": failed to get a glyph for '"+r+"' (BitmapFont might not have the glyph or DynamicFont might create a glyph larger than its atlas).")},o}(n.CacheableE);return yr.Label=o,yr}(),t),i(function(){if(mr)return Ar;mr=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ar,"__esModule",{value:!0}),Ar.Pane=void 0;var r=dr(),i=function(e){function i(t){var i=e.call(this,t)||this;return i._oldWidth=t.width,i._oldHeight=t.height,i.backgroundImage=t.backgroundImage,i._beforeBackgroundImage=t.backgroundImage,i._backgroundImageSurface=r.SurfaceUtil.asSurface(t.backgroundImage),i.backgroundEffector=t.backgroundEffector,i._shouldRenderChildren=!1,i._padding=t.padding||0,i._initialize(),i._paddingChanged=!1,i}return t(i,e),Object.defineProperty(i.prototype,"padding",{get:function(){return this._padding},set:function(t){this._padding=t,this._paddingChanged=!0},enumerable:!1,configurable:!0}),i.prototype.modified=function(t){t&&(this.state&=-3),e.prototype.modified.call(this)},i.prototype.shouldFindChildrenByPoint=function(t){var e=this._normalizedPadding;return e.left<t.x&&this.width-e.right>t.x&&e.top<t.y&&this.height-e.bottom>t.y},i.prototype.renderCache=function(t,e){this.width<=0||this.height<=0||(this._renderBackground(),this._renderChildren(e),this._bgSurface?t.drawImage(this._bgSurface,0,0,this.width,this.height,0,0):this._backgroundImageSurface&&t.drawImage(this._backgroundImageSurface,0,0,this.width,this.height,0,0),this._childrenArea.width<=0||this._childrenArea.height<=0||(t.save(),0===this._childrenArea.x&&0===this._childrenArea.y||t.translate(this._childrenArea.x,this._childrenArea.y),t.drawImage(this._childrenSurface,0,0,this._childrenArea.width,this._childrenArea.height,0,0),t.restore()))},i.prototype.destroy=function(t){t&&this._backgroundImageSurface&&!this._backgroundImageSurface.destroyed()&&this._backgroundImageSurface.destroy(),this._bgSurface&&!this._bgSurface.destroyed()&&this._bgSurface.destroy(),this._childrenSurface&&!this._childrenSurface.destroyed()&&this._childrenSurface.destroy(),this.backgroundImage=void 0,this._backgroundImageSurface=void 0,this._beforeBackgroundImage=void 0,this._bgSurface=void 0,this._childrenSurface=void 0,e.prototype.destroy.call(this)},i.prototype._renderBackground=function(){if(this.backgroundImage!==this._beforeBackgroundImage&&(this._backgroundImageSurface=r.SurfaceUtil.asSurface(this.backgroundImage),this._beforeBackgroundImage=this.backgroundImage),this._backgroundImageSurface&&this.backgroundEffector){var t=this.backgroundEffector.render(this._backgroundImageSurface,this.width,this.height);this._bgSurface!==t&&(this._bgSurface&&!this._bgSurface.destroyed()&&this._bgSurface.destroy(),this._bgSurface=t)}else this._bgSurface=void 0},i.prototype._renderChildren=function(t){var e=this._oldWidth!==this.width||this._oldHeight!==this.height||this._paddingChanged;if(e&&(this._initialize(),this._paddingChanged=!1,this._oldWidth=this.width,this._oldHeight=this.height),this._childrenRenderer.begin(),e||this._childrenRenderer.clear(),this.children)for(var r=this.children,i=0;i<r.length;++i)r[i].render(this._childrenRenderer,t);this._childrenRenderer.end()},i.prototype._initialize=function(){var t,e=this._padding;t="number"==typeof e?{top:e,bottom:e,left:e,right:e}:e,this._childrenArea={x:t.left,y:t.top,width:this.width-t.left-t.right,height:this.height-t.top-t.bottom};var r=this.scene.game.resourceFactory;this._childrenSurface&&!this._childrenSurface.destroyed()&&this._childrenSurface.destroy(),this._childrenSurface=r.createSurface(Math.ceil(this._childrenArea.width),Math.ceil(this._childrenArea.height)),this._childrenRenderer=this._childrenSurface.renderer(),this._normalizedPadding=t},i.prototype._calculateBoundingRect=function(t){var e=this.getMatrix();if(t&&(e=t.multiplyNew(e)),this.visible()){for(var r={left:0,right:this.width,top:0,bottom:this.height},i=[{x:r.left,y:r.top},{x:r.left,y:r.bottom},{x:r.right,y:r.top},{x:r.right,y:r.bottom}],n=e.multiplyPoint(i[0]),o={left:n.x,right:n.x,top:n.y,bottom:n.y},s=1;s<i.length;++s)n=e.multiplyPoint(i[s]),o.left>n.x&&(o.left=n.x),o.right<n.x&&(o.right=n.x),o.top>n.y&&(o.top=n.y),o.bottom<n.y&&(o.bottom=n.y);return o}},i}(rr().CacheableE);return Ar.Pane=i,Ar}(),t),i(pr(),t),i((wr||(wr=1,Object.defineProperty(xr,"__esModule",{value:!0})),xr),t),i(Pr(),t),i((Er||(Er=1,Object.defineProperty(Or,"__esModule",{value:!0})),Or),t),i(Cr(),t),i((Lr||(Lr=1,Object.defineProperty(Rr,"__esModule",{value:!0})),Rr),t),i(zr(),t),i((qr||(qr=1,Object.defineProperty(Yr,"__esModule",{value:!0})),Yr),t),i(ge(),t),i(Ee(),t),i(Jr(),t),i(function(){if(Zr)return Qr;Zr=1,Object.defineProperty(Qr,"__esModule",{value:!0}),Qr.AudioUtil=void 0;var t,e=tr(),r=function(t,e,r,i){return r*t/i+e};return function(t){function i(t,e,i,n,s){void 0===n&&(n=1),void 0===s&&(s=r),e.changeVolume(0),e.play();var a=o(t,e,i,n,s),u=a.complete,c=a.cancel;return{complete:function(){u()},cancel:function(t){void 0===t&&(t=!1),c(t),t&&e.stop()}}}function n(t,e,i,n){void 0===n&&(n=r);var s=o(t,e,i,0,n),a=s.complete,u=s.cancel;return{complete:function(){a(),e.stop()},cancel:function(t){void 0===t&&(t=!1),u(t)}}}function o(t,i,n,o,s){void 0===s&&(s=r);var a=1e3/t.fps,u=i.volume,c=0;i.changeVolume(e.Util.clamp(u,0,1));var h=function(){if((c+=a)<=n){var t=s(c,u,o-u,n);return i.changeVolume(e.Util.clamp(t,0,1)),!1}return i.changeVolume(o),!0},l=function(){t.onUpdate.contains(h)&&t.onUpdate.remove(h)};return t.onUpdate.add(h),{complete:function(){l(),i.changeVolume(o)},cancel:function(t){l(),t&&i.changeVolume(u)}}}t.fadeIn=i,t.fadeOut=n,t.crossFade=function(t,e,o,s,a,u){void 0===a&&(a=1),void 0===u&&(u=r);var c=i(t,e,s,a,u),h=n(t,o,s,u);return{complete:function(){c.complete(),h.complete()},cancel:function(t){void 0===t&&(t=!1),c.cancel(t),h.cancel(t)}}},t.transitionVolume=o}(t||(Qr.AudioUtil=t={})),Qr}(),t),i(oi(),t),i((si||(si=1,Object.defineProperty(ai,"__esModule",{value:!0})),ai),t),i(hi(),t),i(function(){if(li)return di;li=1,Object.defineProperty(di,"__esModule",{value:!0}),di.Collision=void 0;var t,e=tr();function r(t,e){return t.x*e.y-t.y*e.x}function i(t,e){return{x:t.x-e.x,y:t.y-e.y}}return function(t){t.intersectEntities=function(e,n,o,s){var a=e._findLowestCommonAncestorWith(n);if(!a)return!1;var u=o?{left:o.x,top:o.y,right:o.x+o.width,bottom:o.y+o.height}:{left:0,top:0,right:e.width,bottom:e.height},c=s?{left:s.x,top:s.y,right:s.x+s.width,bottom:s.y+s.height}:{left:0,top:0,right:n.width,bottom:n.height},h=e._calculateMatrixTo(a),l=n._calculateMatrixTo(a),d=h.multiplyPoint({x:u.left,y:u.top}),p=h.multiplyPoint({x:u.right,y:u.top}),f=h.multiplyPoint({x:u.left,y:u.bottom}),_=h.multiplyPoint({x:u.right,y:u.bottom}),y=l.multiplyPoint({x:c.left,y:c.top}),v=l.multiplyPoint({x:c.right,y:c.top}),g=l.multiplyPoint({x:c.left,y:c.bottom}),m=l.multiplyPoint({x:c.right,y:c.bottom}),A=Math.min(d.x,p.x,f.x,_.x),w=Math.max(d.x,p.x,f.x,_.x),x=Math.min(y.x,v.x,g.x,m.x),S=Math.max(y.x,v.x,g.x,m.x);if(w<x||S<A)return!1;var b=Math.min(d.y,p.y,f.y,_.y),P=Math.max(d.y,p.y,f.y,_.y),E=Math.min(y.y,v.y,g.y,m.y),O=Math.max(y.y,v.y,g.y,m.y);if(P<E||O<b)return!1;if(t.intersectLineSegments(d,p,y,v)||t.intersectLineSegments(d,p,v,m)||t.intersectLineSegments(d,p,m,g)||t.intersectLineSegments(d,p,g,y)||t.intersectLineSegments(p,_,y,v)||t.intersectLineSegments(p,_,v,m)||t.intersectLineSegments(p,_,m,g)||t.intersectLineSegments(p,_,g,y)||t.intersectLineSegments(_,f,y,v)||t.intersectLineSegments(_,f,v,m)||t.intersectLineSegments(_,f,m,g)||t.intersectLineSegments(_,f,g,y)||t.intersectLineSegments(f,d,y,v)||t.intersectLineSegments(f,d,v,m)||t.intersectLineSegments(f,d,m,g)||t.intersectLineSegments(f,d,g,y))return!0;var T=r(i(d,p),i(y,p));if(T*r(i(f,d),i(y,d))>=0&&T*r(i(_,f),i(y,f))>=0&&T*r(i(p,_),i(y,_))>=0)return!0;var M=r(i(y,v),i(d,v));return M*r(i(g,y),i(d,y))>=0&&M*r(i(m,g),i(d,g))>=0&&M*r(i(v,m),i(d,m))>=0},t.intersectLineSegments=function(t,e,n,o){var s=i(e,t),a=i(o,n);return r(i(n,t),s)*r(i(o,t),s)<=0&&r(i(t,n),a)*r(i(e,n),a)<=0},t.intersect=function(t,e,r,i,n,o,s,a){return t<=n+s&&n<=t+r&&e<=o+a&&o<=e+i},t.intersectAreas=function(e,r){return t.intersect(e.x,e.y,e.width,e.height,r.x,r.y,r.width,r.height)},t.within=function(t,r,i,n,o){return void 0===o&&(o=1),o>=e.Util.distance(t,r,i,n)},t.withinAreas=function(t,r,i){return void 0===i&&(i=1),i>=e.Util.distanceBetweenAreas(t,r)}}(t||(di.Collision=t={})),di}(),t),i(Ci(),t),i(Ii(),t),i((Fi||(Fi=1,Object.defineProperty(ji,"__esModule",{value:!0})),ji),t),i(function(){if(Gi)return Hi;Gi=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Hi,"__esModule",{value:!0}),Hi.DynamicFont=void 0;var r=fe(),i=oi(),n=ni(),o=zi(),s=tr(),a=function(e){function n(t){var i=e.call(this)||this;i.fontFamily=t.fontFamily,i.size=t.size,i.hint=null!=t.hint?t.hint:{},i.fontColor=null!=t.fontColor?t.fontColor:"black",i.fontWeight=null!=t.fontWeight?t.fontWeight:r.FontWeight.Normal,i.strokeWidth=null!=t.strokeWidth?t.strokeWidth:0,i.strokeColor=null!=t.strokeColor?t.strokeColor:"black",i.strokeOnly=null!=t.strokeOnly&&t.strokeOnly;var n=t.game;i._resourceFactory=n.resourceFactory;var a,u=i.fontFamily;if("string"==typeof u)a=u;else if(Array.isArray(u)){for(var c=[],h=0;h<u.length;++h){var l=u[h];c.push("string"==typeof l?l:s.Util.enumToSnakeCase(r.FontFamily,l))}a=c}else(c=[]).push("string"==typeof u?u:s.Util.enumToSnakeCase(r.FontFamily,u)),a=c;var d=i.fontWeight,p="string"==typeof d?d:s.Util.enumToSnakeCase(r.FontWeight,d);if(i._glyphFactory=i._resourceFactory.createGlyphFactory(a,i.size,i.hint.baselineHeight,i.fontColor,i.strokeWidth,i.strokeColor,i.strokeOnly,p),i._glyphs={},i._destroyed=!1,i._isSurfaceAtlasSetOwner=!1,t.surfaceAtlasSet?i._atlasSet=t.surfaceAtlasSet:t.hint?(i._isSurfaceAtlasSetOwner=!0,i._atlasSet=new o.SurfaceAtlasSet({resourceFactory:n.resourceFactory,hint:i.hint})):i._atlasSet=n.surfaceAtlasSet,i.hint.presetChars){h=0;for(var f=i.hint.presetChars.length;h<f;h++){var _=s.Util.charCodeAt(i.hint.presetChars,h);_&&i.glyphForCharacter(_)}}return i}return t(n,e),n.prototype.glyphForCharacter=function(t){var e=this._glyphs[t];if(!e||!e.isSurfaceValid){if((e=this._glyphFactory.create(t)).surface&&!this._atlasSet.addGlyph(e))return null;this._glyphs[t]=e}return this._atlasSet.touchGlyph(e),e},n.prototype.asBitmapFont=function(t){var e=this;if(1!==this._atlasSet.getAtlasNum())return null;var r=null;t&&(r=s.Util.charCodeAt(t,0),this.glyphForCharacter(r));var n={};Object.keys(this._glyphs).forEach((function(t){var r=Number(t),i=e._glyphs[r],o={x:i.x,y:i.y,width:i.width,height:i.height,offsetX:i.offsetX,offsetY:i.offsetY,advanceWidth:i.advanceWidth};n[r]=o}));var o=n[r],a=this._atlasSet.getAtlas(0),u=a.getAtlasUsedSize(),c=this._resourceFactory.createSurface(u.width,u.height),h=c.renderer();return h.begin(),h.drawImage(a._surface,0,0,u.width,u.height,0,0),h.end(),new i.BitmapFont({src:c,map:n,defaultGlyphWidth:0,defaultGlyphHeight:this.size,missingGlyph:o})},n.prototype.destroy=function(){this._isSurfaceAtlasSetOwner&&this._atlasSet.destroy(),this._glyphs=void 0,this._glyphFactory=void 0,this._destroyed=!0},n.prototype.destroyed=function(){return this._destroyed},n}(n.Font);return Hi.DynamicFont=a,Hi}(),t),i((qi||(qi=1,Object.defineProperty(Yi,"__esModule",{value:!0})),Yi),t),i(We(),t),i(Ji(),t),i((Zi||(Zi=1,Object.defineProperty(Qi,"__esModule",{value:!0})),Qi),t),i((tn||(tn=1,Object.defineProperty(en,"__esModule",{value:!0})),en),t),i((rn||(rn=1,Object.defineProperty(nn,"__esModule",{value:!0})),nn),t),i((on||(on=1,Object.defineProperty(sn,"__esModule",{value:!0})),sn),t),i(we(),t),i(ni(),t),i((an||(an=1,Object.defineProperty(un,"__esModule",{value:!0})),un),t),i(ln(),t),i((dn||(dn=1,Object.defineProperty(pn,"__esModule",{value:!0})),pn),t),i(Mi(),t),i((fn||(fn=1,Object.defineProperty(_n,"__esModule",{value:!0})),_n),t),i(ze(),t),i(Re(),t),i(bn(),t),i(function(){if(Pn)return En;Pn=1,Object.defineProperty(En,"__esModule",{value:!0}),En.NinePatchSurfaceEffector=void 0;var t=dr(),e=function(){function e(t,e){void 0===e&&(e=4),this.game=t,this.borderWidth="number"==typeof e?{top:e,bottom:e,left:e,right:e}:e}return e.prototype.render=function(e,r,i){return this._surface&&this._surface.width===r&&this._surface.height===i&&this._beforeSrcSurface===e||(this._surface=this.game.resourceFactory.createSurface(Math.ceil(r),Math.ceil(i)),this._beforeSrcSurface=e),t.SurfaceUtil.drawNinePatch(this._surface,e,this.borderWidth),this._surface},e}();return En.NinePatchSurfaceEffector=e,En}(),t),i(Ke(),t),i((On||(On=1,Object.defineProperty(Tn,"__esModule",{value:!0})),Tn),t),i(Ln(),t),i((Rn||(Rn=1,Object.defineProperty(In,"__esModule",{value:!0})),In),t),i((Fn||(Fn=1,Object.defineProperty(jn,"__esModule",{value:!0})),jn),t),i((Dn||(Dn=1,Object.defineProperty(kn,"__esModule",{value:!0})),kn),t),i(Hn(),t),i(Wn(),t),i((Nn||(Nn=1,Object.defineProperty(Xn,"__esModule",{value:!0})),Xn),t),i((zn||(zn=1,Object.defineProperty(qn,"__esModule",{value:!0})),qn),t),i(mn(),t),i(Sn(),t),i(je(),t),i((Yn||(Yn=1,Object.defineProperty(Kn,"__esModule",{value:!0})),Kn),t),i(function(){if($n)return Jn;$n=1,Object.defineProperty(Jn,"__esModule",{value:!0}),Jn.SpriteFactory=void 0;var t=pr(),e=we(),r=function(){function r(){}return r.createSpriteFromE=function(r,i,n){var o=i.x,s=i.y,a=0,u=0,c=i.width,h=i.height,l=i.calculateBoundingRect();if(!l)throw e.ExceptionFactory.createAssertionError("SpriteFactory.createSpriteFromE: camera must look e");c=l.right-l.left,h=l.bottom-l.top,l.left<i.x&&(a=i.x-l.left),l.top<i.y&&(u=i.y-l.top),i.moveTo(a,u),i._matrix&&(i._matrix._modified=!0);var d=r.game.resourceFactory.createSurface(Math.ceil(c),Math.ceil(h)),p=d.renderer();p.begin(),i.render(p,n),p.end();var f=new t.Sprite({scene:r,src:d,width:c,height:h});return f.moveTo(l.left,l.top),i.moveTo(o,s),i._matrix&&(i._matrix._modified=!0),f},r.createSpriteFromScene=function(e,r,i){var n=e.game.resourceFactory.createSurface(Math.ceil(r.game.width),Math.ceil(r.game.height)),o=n.renderer();o.begin();for(var s=r.children,a=0;a<s.length;++a)s[a].render(o,i);return o.end(),new t.Sprite({scene:e,src:n,width:r.game.width,height:r.game.height})},r}();return Jn.SpriteFactory=r,Jn}(),t),i(Xi(),t),i(zi(),t),i(Ni(),t),i((Zn||(Zn=1,Object.defineProperty(Qn,"__esModule",{value:!0})),Qn),t),i(dr(),t),i(gr(),t),i((to||(to=1,Object.defineProperty(eo,"__esModule",{value:!0})),eo),t),i((ro||(ro=1,Object.defineProperty(io,"__esModule",{value:!0})),io),t),i((no||(no=1,Object.defineProperty(oo,"__esModule",{value:!0})),oo),t),i(Ei(),t),i(Oi(),t),i(tr(),t),i(Ue(),t),i(Pe(),t),i(uo(),t),i(lo(),t),i(Ti(),t),i(function(){if(po)return _o;po=1,Object.defineProperty(_o,"__esModule",{value:!0}),_o.Game=void 0;var t=k(),e=Pr(),r=zr(),i=Jr(),n=Ci(),o=Ii(),s=Ji(),a=we(),u=ln(),c=Mi(),h=bn(),l=Ln(),d=Hn(),p=zi(),f=Pe(),_=lo(),y=function(){function y(n){var o=this._normalizeConfiguration(n.configuration);if(this.fps=o.fps,this.width=o.width,this.height=o.height,this.renderers=[],this.scenes=[],this.age=0,this.assetBase=n.assetBase||"",this.resourceFactory=n.resourceFactory,this.handlerSet=n.handlerSet,this.selfId=n.selfId,this.db=void 0,this.loadingScene=void 0,this.operationPlugins=void 0,this.random=void 0,this.localRandom=void 0,this._defaultLoadingScene=void 0,this._defaultSkippingScene=void 0,this._eventConverter=void 0,this._pointEventResolver=void 0,this._idx=void 0,this._localDb=void 0,this._localIdx=void 0,this._cameraIdx=void 0,this._isTerminated=void 0,this._modified=void 0,this._postTickTasks=void 0,this._toBeDestroyedScenes=[],this.playId=void 0,this.isSkipping=!1,this.joinedPlayerIds=[],this.audio=new i.AudioSystemManager(this.resourceFactory),this.defaultAudioSystemId="sound",this.assets={},this.surfaceAtlasSet=new p.SurfaceAtlasSet({resourceFactory:this.resourceFactory}),this.onJoin=new t.Trigger,this.onLeave=new t.Trigger,this.onPlayerInfo=new t.Trigger,this.onSeed=new t.Trigger,this.join=this.onJoin,this.leave=this.onLeave,this.playerInfo=this.onPlayerInfo,this.seed=this.onSeed,this._eventTriggerMap={unknown:void 0,timestamp:void 0,join:this.onJoin,leave:this.onLeave,"player-info":this.onPlayerInfo,seed:this.onSeed,message:void 0,"point-down":void 0,"point-move":void 0,"point-up":void 0,operation:void 0},this.onResized=new t.Trigger,this.onSkipChange=new t.Trigger,this.resized=this.onResized,this.skippingChanged=this.onSkipChange,this.isLastTickLocal=!0,this.lastOmittedLocalTickCount=0,this.lastLocalTickMode=null,this.lastTickGenerationMode=null,this._onLoad=new t.Trigger,this._onStart=new t.Trigger,this._loaded=this._onLoad,this._started=this._onStart,this.isLoaded=!1,this.onSnapshotRequest=new t.Trigger,this.snapshotRequest=this.onSnapshotRequest,this.external={},this._runtimeValueBase=Object.create(n.engineModule,{game:{value:this,enumerable:!0}}),this._main=o.main,this._mainFunc=n.mainFunc,this._mainParameter=void 0,this._configuration=o,Array.isArray(o.assets))throw new Error("Game#constructor: array type of configuration.assets is not yet supported");this._assetManager=new r.AssetManager(this,o.assets,o.audio,o.moduleMainScripts,o.moduleMainPaths),this._moduleManager=void 0,this.asset=new e.AssetAccessor(this._assetManager),this.operationPluginManager=new l.OperationPluginManager(this,n.operationPluginViewInfo||null),this._onOperationPluginOperated=new t.Trigger,this._operationPluginOperated=this._onOperationPluginOperated,this._onOperationPluginOperated.add(this._handleOperationPluginOperated,this),this.onSceneChange=new t.Trigger,this._onSceneChange=new t.Trigger,this._onSceneChange.add(this._handleSceneChanged,this),this._sceneChanged=this._onSceneChange,this.onUpdate=new t.Trigger,this._initialScene=new u.InitialScene({game:this,assetIds:this._assetManager.globalAssetIds(),local:!0,name:"akashic:initial-scene"}),this._initialScene.onAllAssetsLoad.add(this._handleInitialSceneLoad,this),this._reset({age:0})}return Object.defineProperty(y.prototype,"focusingCamera",{get:function(){return this._focusingCamera},set:function(t){t!==this._focusingCamera&&(this._modified&&this.render(),this._focusingCamera=t)},enumerable:!1,configurable:!0}),Object.defineProperty(y.prototype,"skippingScene",{get:function(){return this._skippingScene},set:function(t){if(t!==this._skippingScene){if(t){if("full-local"!==t.local)throw a.ExceptionFactory.createAssertionError("Game#skippingScene: only 'full-local' scene is supported.");if(t._needsLoading())throw a.ExceptionFactory.createAssertionError("Game#skippingScene: must not depend on any assets.")}this._skippingScene=t}},enumerable:!1,configurable:!0}),y.prototype.pushScene=function(t,e){this._postTickTasks.push({type:0,scene:t,prepare:null==e?void 0:e.prepare})},y.prototype.replaceScene=function(t,e){var r,i;"object"==typeof e?(r=!!e.preserveCurrent,i=e.prepare):r=!!e,this._postTickTasks.push({type:1,scene:t,preserveCurrent:r,prepare:i})},y.prototype.popScene=function(t,e){void 0===e&&(e=1);for(var r=0;r<e;r++)this._postTickTasks.push({type:2,preserveCurrent:!!t})},y.prototype.scene=function(){if(this.scenes.length)return this.scenes[this.scenes.length-1]},y.prototype.tick=function(t,e,r){var i=null;if(this._isTerminated)return!1;if(this.isLastTickLocal=!t,this.lastOmittedLocalTickCount=e||0,this.scenes.length){if(i=this.scenes[this.scenes.length-1],r&&r.length)for(var n=0;n<r.length;++n){var o=this._eventConverter.toGameEvent(r[n]),s=this._eventTriggerMap[o.type];s&&s.fire(o)}i.onUpdate.fire(),t&&++this.age}return this.onUpdate.fire(),!!this._postTickTasks.length&&(this._flushPostTickTasks(),i!==this.scenes[this.scenes.length-1])},y.prototype.render=function(){var t,e,r=null!==(t=this._skippingScene)&&void 0!==t?t:this._defaultSkippingScene;if(r&&this.isSkipping?(e=r).onUpdate.fire():e=this.scene(),this._modified&&e){for(var i=this.focusingCamera,n=this.renderers,o=this.scenes.length-1;o>=0&&this.scenes[o].seethrough;)--o;for(var s=o,a=0;a<n.length;++a){var u=n[a];if(u.begin(),u.save(),u.clear(),i&&(u.save(),i._applyTransformToRenderer(u)),e===r)for(var c=0;c<e.children.length;++c)e.children[c].render(u,i);else for(var h=s;h<this.scenes.length;++h){var l=this.scenes[h].children;for(c=0;c<l.length;++c)l[c].render(u,i)}i&&u.restore(),u.restore(),u.end()}this._modified=!1}},y.prototype.resolvePointEvent=function(t){switch(t.type){case 0:return this._pointEventResolver.pointDown(t);case 1:return this._pointEventResolver.pointMove(t);case 2:return this._pointEventResolver.pointUp(t)}},y.prototype.findPointSource=function(t,e){e||(e=this.focusingCamera);var r=this.scene();if(r)return r.findPointSourceByPoint(t,!1,e)},y.prototype.register=function(t){if(t.local){if(void 0===t.id)t.id=--this._localIdx;else{if(t.id>0)throw a.ExceptionFactory.createAssertionError("Game#register: invalid local id: "+t.id);if(this._localDb.has(t.id))throw a.ExceptionFactory.createAssertionError("Game#register: conflicted id: "+t.id);this._localIdx>t.id&&(this._localIdx=t.id)}this._localDb.set(t.id,t)}else{if(void 0===t.id)t.id=++this._idx;else{if(t.id<0)throw a.ExceptionFactory.createAssertionError("Game#register: invalid non-local id: "+t.id);if(this.db.has(t.id))throw a.ExceptionFactory.createAssertionError("Game#register: conflicted id: "+t.id);this._idx<t.id&&(this._idx=t.id)}this.db.set(t.id,t)}},y.prototype.unregister=function(t){t.local?this._localDb.delete(t.id):this.db.delete(t.id)},y.prototype.terminateGame=function(){this._isTerminated=!0,this._terminateGame()},y.prototype.modified=function(){this._modified=!0},y.prototype.raiseEvent=function(t){this.handlerSet.raiseEvent(this._eventConverter.toPlaylogEvent(t))},y.prototype.raiseTick=function(t){if(null!=t&&t.length){for(var e=[],r=0;r<t.length;r++)e.push(this._eventConverter.toPlaylogEvent(t[r]));this.handlerSet.raiseTick(e)}else this.handlerSet.raiseTick()},y.prototype.addEventFilter=function(t,e){this.handlerSet.addEventFilter(t,e)},y.prototype.removeEventFilter=function(t){this.handlerSet.removeEventFilter(t)},y.prototype.shouldSaveSnapshot=function(){return this.handlerSet.shouldSaveSnapshot()},y.prototype.saveSnapshot=function(t,e){this.handlerSet.saveSnapshot(this.age,t,this.random.serialize(),this._idx,e)},y.prototype.requestSaveSnapshot=function(t,e){var r=this;this._postTickTasks.unshift({type:3,fun:function(){if(r.handlerSet.shouldSaveSnapshot()){var i=t.call(e);i&&r.handlerSet.saveSnapshot(r.age,i.snapshot,r.random.serialize(),r._idx,i.timestamp)}},owner:null})},y.prototype.getCurrentTime=function(){return this.handlerSet.getCurrentTime()},y.prototype.isActiveInstance=function(){return"active"===this.handlerSet.getInstanceType()},y.prototype._pushPostTickTask=function(t,e){this._postTickTasks.push({type:3,fun:t,owner:e})},y.prototype._popSceneRaw=function(t){this._postTickTasks.push({type:4,preserveCurrent:t})},y.prototype._normalizeConfiguration=function(t){if(!t)throw a.ExceptionFactory.createAssertionError("Game#_normalizeConfiguration: invalid arguments");if(null==t.assets&&(t.assets={}),null==t.fps&&(t.fps=30),"number"!=typeof t.fps)throw a.ExceptionFactory.createAssertionError("Game#_normalizeConfiguration: fps must be given as a number");if(!(0<=t.fps&&t.fps<=60))throw a.ExceptionFactory.createAssertionError("Game#_normalizeConfiguration: fps must be a number in (0, 60].");if("number"!=typeof t.width)throw a.ExceptionFactory.createAssertionError("Game#_normalizeConfiguration: width must be given as a number");if("number"!=typeof t.height)throw a.ExceptionFactory.createAssertionError("Game#_normalizeConfiguration: height must be given as a number");return t},y.prototype._setAudioPlaybackRate=function(t){this.audio._setPlaybackRate(t)},y.prototype._startSuppressAudio=function(){this.audio._startSuppress()},y.prototype._endSuppressAudio=function(){this.audio._endSuppress()},y.prototype._setMuted=function(t){this.audio._setMuted(t)},y.prototype._decodeOperationPluginOperation=function(t,e){var r=this.operationPluginManager.plugins[t];return r&&r.decode?r.decode(e):e},y.prototype._reset=function(t){var e;if(this.operationPluginManager.reset(),this.operationPluginManager.onOperate.add(this._onOperationPluginOperated.fire,this._onOperationPluginOperated),this.scene()){for(;this.scene()!==this._initialScene;)this._popSceneRaw(!1),this._flushPostTickTasks();this.isLoaded||this.scenes.pop()}switch(this._skippingScene&&!this._skippingScene.destroyed()&&this._skippingScene.destroy(),t&&(void 0!==t.age&&(this.age=t.age),void 0!==t.randGenSer?this.random=_.XorshiftRandomGenerator.deserialize(t.randGenSer):void 0!==t.randSeed&&(this.random=new _.XorshiftRandomGenerator(t.randSeed))),this.audio._reset(),this._onLoad.removeAll({func:this._handleLoad,owner:this}),this.onJoin.removeAll(),this.onLeave.removeAll(),this.onSeed.removeAll(),this.onResized.removeAll(),this.onSkipChange.removeAll(),this.onSceneChange.removeAll(),this.onUpdate.removeAll(),this.handlerSet.removeAllEventFilters(),this.isSkipping=!1,this.onSkipChange.add(this._handleSkipChange,this),this.joinedPlayerIds=[],this.onJoin.add(this._handleJoinEvent,this),this.onLeave.add(this._handleLeaveEvent,this),this._idx=null!==(e=null==t?void 0:t.nextEntityId)&&void 0!==e?e:0,this._localIdx=0,this._cameraIdx=0,this.db=new f.WeakRefKVS,this._localDb=new f.WeakRefKVS,this._modified=!0,this.loadingScene=void 0,this._skippingScene=void 0,this._focusingCamera=void 0,this.lastLocalTickMode=null,this.lastTickGenerationMode=null,this.onSnapshotRequest.removeAll(),this._postTickTasks=[],this._toBeDestroyedScenes=[],this._eventConverter=new s.EventConverter({game:this,playerId:this.selfId}),this._pointEventResolver=new d.PointEventResolver({sourceResolver:this,playerId:this.selfId,maxPoints:this._configuration.maxPoints}),this.localRandom=new _.XorshiftRandomGenerator(Math.floor(9007199254740991*Math.random())),this._isTerminated=!1,this.vars={},this._moduleManager=new h.ModuleManager(this._runtimeValueBase,this._assetManager),this.surfaceAtlasSet.destroy(),this.surfaceAtlasSet=new p.SurfaceAtlasSet({resourceFactory:this.resourceFactory}),this._configuration.defaultLoadingScene){case"none":this._defaultLoadingScene=new c.LoadingScene({game:this});break;case"compact":this._defaultLoadingScene=new n.DefaultLoadingScene({game:this,style:"compact"});break;default:this._defaultLoadingScene=new n.DefaultLoadingScene({game:this})}switch(this._configuration.defaultSkippingScene){case"none":this._defaultSkippingScene=new o.DefaultSkippingScene({game:this,style:"none"});break;case"indicator":this._defaultSkippingScene=new o.DefaultSkippingScene({game:this,style:"indicator"});break;default:this._defaultSkippingScene=void 0}},y.prototype._destroy=function(){if(this.operationPluginManager.destroy(),this.scene())for(;this.scene()!==this._initialScene;)this.popScene(),this._flushPostTickTasks();this._initialScene.destroy(),this.loadingScene&&!this.loadingScene.destroyed()&&this.loadingScene.destroy(),this._defaultLoadingScene.destroyed()||this._defaultLoadingScene.destroy(),this._defaultSkippingScene&&!this._defaultSkippingScene.destroyed()&&this._defaultSkippingScene.destroy(),this._skippingScene&&!this._skippingScene.destroyed()&&this._skippingScene.destroy(),this.db=void 0,this.renderers=void 0,this.scenes=void 0,this.random=void 0,this._modified=!1,this.age=0,this.assets=void 0,this.isLoaded=!1,this.loadingScene=void 0,this.assetBase="",this.selfId=void 0,this.audio.music.stopAll(),this.audio.sound.stopAll(),this.audio=void 0,this.defaultAudioSystemId=void 0,this.handlerSet=void 0,this.localRandom=void 0,this.onJoin.destroy(),this.onJoin=void 0,this.onLeave.destroy(),this.onLeave=void 0,this.onSeed.destroy(),this.onSeed=void 0,this.onPlayerInfo.destroy(),this.onPlayerInfo=void 0,this.onResized.destroy(),this.onResized=void 0,this.onSkipChange.destroy(),this.onSkipChange=void 0,this.onSceneChange.destroy(),this.onSceneChange=void 0,this.onUpdate.destroy(),this.onUpdate=void 0,this.onSnapshotRequest.destroy(),this.onSnapshotRequest=void 0,this.join=void 0,this.leave=void 0,this.seed=void 0,this.playerInfo=void 0,this.snapshotRequest=void 0,this.resized=void 0,this.skippingChanged=void 0,this._sceneChanged=void 0,this._loaded=void 0,this._started=void 0,this._operationPluginOperated=void 0,this._onSceneChange.destroy(),this._onSceneChange=void 0,this._onLoad.destroy(),this._onLoad=void 0,this._onStart.destroy(),this._onStart=void 0,this.resourceFactory=void 0,this.playId=void 0,this.operationPlugins=void 0,this._eventTriggerMap=void 0,this._initialScene=void 0,this._defaultLoadingScene=void 0,this._main=void 0,this._mainFunc=void 0,this._mainParameter=void 0,this._assetManager.destroy(),this._assetManager=void 0,this.asset=void 0,this._eventConverter=void 0,this._pointEventResolver=void 0,this.operationPluginManager=void 0,this._onOperationPluginOperated.destroy(),this._onOperationPluginOperated=void 0,this._idx=0,this._localDb=void 0,this._localIdx=0,this._cameraIdx=0,this._isTerminated=!0,this._focusingCamera=void 0,this._skippingScene=void 0,this._configuration=void 0,this._postTickTasks=void 0,this.surfaceAtlasSet.destroy(),this.surfaceAtlasSet=void 0,this._moduleManager=void 0},y.prototype._loadAndStart=function(t){this._mainParameter=t||{},this.isLoaded?this._handleLoad():(this._onLoad.add(this._handleLoad,this),this.pushScene(this._initialScene),this._flushPostTickTasks())},y.prototype._startLoadingGlobalAssets=function(){if(this.isLoaded)throw a.ExceptionFactory.createAssertionError("Game#_startLoadingGlobalAssets: already loaded.");this.pushScene(this._initialScene),this._flushPostTickTasks()},y.prototype._updateEventTriggers=function(t){if(this._modified=!0,!t)return this._eventTriggerMap.message=void 0,this._eventTriggerMap["point-down"]=void 0,this._eventTriggerMap["point-move"]=void 0,this._eventTriggerMap["point-up"]=void 0,void(this._eventTriggerMap.operation=void 0);this._eventTriggerMap.message=t.onMessage,this._eventTriggerMap["point-down"]=t.onPointDownCapture,this._eventTriggerMap["point-move"]=t.onPointMoveCapture,this._eventTriggerMap["point-up"]=t.onPointUpCapture,this._eventTriggerMap.operation=t.onOperation,t._activate()},y.prototype._handleInitialSceneLoad=function(){this._initialScene.onLoad.remove(this._handleInitialSceneLoad,this),this.assets=this._initialScene.assets,this.isLoaded=!0,this._onLoad.fire(this)},y.prototype._handleOperationPluginOperated=function(t){var e=this._eventConverter.makePlaylogOperationEvent(t);this.handlerSet.raiseEvent(e)},y.prototype._handleSceneChanged=function(t){this._updateEventTriggers(t);var e=t?t.local:"full-local",r=t?t.tickGenerationMode:"by-clock";this.lastLocalTickMode===e&&this.lastTickGenerationMode===r||(this.lastLocalTickMode=e,this.lastTickGenerationMode=r,this.handlerSet.changeSceneMode({local:e,tickGenerationMode:r}))},y.prototype._handleSkippingSceneReady=function(t){this._pushPostTickTask(t._fireLoaded,t)},y.prototype._terminateGame=function(){},y.prototype._flushPostTickTasks=function(){do{var t=this._postTickTasks;this._postTickTasks=[];for(var e=0;e<t.length;++e){var r=t[e];switch(r.type){case 0:var i=this.scene();i&&i._deactivate(),this._doPushScene(r.scene,!1,r.prepare?this._createPreparingLoadingScene(r.scene,r.prepare,"akashic:preparing-".concat(r.scene.name)):void 0);break;case 1:this._doPopScene(r.preserveCurrent,!1,!1),this._doPushScene(r.scene,!1,r.prepare?this._createPreparingLoadingScene(r.scene,r.prepare,"akashic:preparing-".concat(r.scene.name)):void 0);break;case 2:this._doPopScene(r.preserveCurrent,!1,!0);break;case 3:r.fun.call(r.owner);break;case 4:this._doPopScene(r.preserveCurrent,!0,!0);break;default:throw a.ExceptionFactory.createAssertionError("Game#_flushPostTickTasks: unknown post-tick task type.")}}}while(this._postTickTasks.length>0);if(this._toBeDestroyedScenes.length>0){for(var n=0,o=this._toBeDestroyedScenes;n<o.length;n++)o[n].destroy();this._toBeDestroyedScenes=[]}},y.prototype._handleSkipChange=function(t){var e;if(this.isSkipping=t,t){var r=null!==(e=this._skippingScene)&&void 0!==e?e:this._defaultSkippingScene;r&&!r._loaded&&(r._load(),r._onReady.addOnce(this._handleSkippingSceneReady,this))}this._cleanDB(),this._modified=!0},y.prototype._handleJoinEvent=function(t){t.player.id&&-1===this.joinedPlayerIds.indexOf(t.player.id)&&this.joinedPlayerIds.push(t.player.id)},y.prototype._handleLeaveEvent=function(t){this.joinedPlayerIds=this.joinedPlayerIds.filter((function(e){return e!==t.player.id}))},y.prototype._doPopScene=function(t,e,r){var i,n=this.scenes.pop();if(!e)for(;n&&n instanceof c.LoadingScene;)n._clearTargetScene(),n=this.scenes.pop();if(!n)throw a.ExceptionFactory.createAssertionError("Game#_doPopScene: invalid call; scene stack underflow");if(n===this._initialScene)throw a.ExceptionFactory.createAssertionError("Game#_doPopScene: invalid call; attempting to pop the initial scene");if(t||this._toBeDestroyedScenes.includes(n)||this._toBeDestroyedScenes.push(n),!e&&(s=this.scene())&&s._needsLoading()&&"loaded-fired"!==s._loadingState){var o=s._waitingPrepare?this._createPreparingLoadingScene(s,s._waitingPrepare,"akashic:preparing-".concat(s.name)):null!==(i=this.loadingScene)&&void 0!==i?i:this._defaultLoadingScene;this._doPushScene(o,!0,this._defaultLoadingScene),o.reset(s)}if(r){var s=this.scene();this.onSceneChange.fire(s),this._onSceneChange.fire(s)}},y.prototype._handleLoad=function(){for(var t=0,e=this._configuration.operationPlugins||[];t<e.length;t++){var r=e[t];if(r.script){var i=this._moduleManager._internalRequire(r.script),n=this.operationPluginManager.register(i,r.code,r.option);!r.manualStart&&n&&n.start()}}this.operationPlugins=this.operationPluginManager.plugins;for(var o=0,s=this._assetManager.preloadScriptAssetPaths();o<s.length;o++){var u=s[o],c=this._moduleManager._internalRequire(u);if(!c||"function"!=typeof c)throw a.ExceptionFactory.createAssertionError("Game#_handleLoad: ".concat(u," has no-exported function."));c()}if(this._mainFunc)this._mainFunc(this._runtimeValueBase,this._mainParameter||{});else{if(!this._main)throw a.ExceptionFactory.createAssertionError("Game#_handleLoad: does not have an entry point");var h=this._moduleManager._internalRequire(this._main);if(!h||"function"!=typeof h)throw a.ExceptionFactory.createAssertionError("Game#_handleLoad: Entry point ".concat(this._main," not found."));h(this._mainParameter)}this._flushPostTickTasks(),this._onStart.fire()},y.prototype._doPushScene=function(t,e,r){var i=this.scenes;if(!e)for(;i.length>0&&i[i.length-1]instanceof c.LoadingScene;)i.pop()._clearTargetScene();if(r||(r=this.loadingScene||this._defaultLoadingScene),i.push(t),t._needsLoading()&&"loaded-fired"!==t._loadingState){if(this._defaultLoadingScene._needsLoading())throw a.ExceptionFactory.createAssertionError("Game#_doPushScene: _defaultLoadingScene must not depend on any assets.");this._doPushScene(r,!0,this._defaultLoadingScene),r.reset(t)}else this.onSceneChange.fire(t),this._onSceneChange.fire(t),t._loaded||(t._load(),this._pushPostTickTask(t._fireLoaded,t));this._modified=!0},y.prototype._createPreparingLoadingScene=function(t,e,r){var i=this;t._waitingPrepare=e;var n=new c.LoadingScene({game:this,explicitEnd:!0,name:r});return n.onTargetReady.addOnce((function(){var e=t._waitingPrepare;t._waitingPrepare=void 0,e?e((function(){i._isTerminated||n.end()})):i._pushPostTickTask(n.end,n)})),n},y.prototype._cleanDB=function(){this.db.clean(),this._localDb.clean()},y}();return _o.Game=y,_o}(),t)}(p)),p}var vo,go,mo,Ao,wo={};function xo(){return go||(go=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=e&&e.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),i(yo(),t),i((vo||(vo=1,Object.defineProperty(wo,"__esModule",{value:!0})),wo),t)}(d)),d}function So(){return Ao?mo:(Ao=1,mo=xo())}var bo,Po={};var Eo={};var Oo,To,Mo=Object.freeze({__proto__:null,default:function(){return function(t){var e=[];if(0===t.length)return"";if("string"!=typeof t[0])throw new TypeError("Url must be a string. Received "+t[0]);if(t[0].match(/^[^/:]+:\/*$/)&&t.length>1){var r=t.shift();t[0]=r+t[0]}t[0].match(/^file:\/\/\//)?t[0]=t[0].replace(/^([^/:]+):\/*/,"$1:///"):t[0]=t[0].replace(/^([^/:]+):\/*/,"$1://");for(var i=0;i<t.length;i++){var n=t[i];if("string"!=typeof n)throw new TypeError("Url must be a string. Received "+n);""!==n&&(i>0&&(n=n.replace(/^[\/]+/,"")),n=i<t.length-1?n.replace(/[\/]+$/,""):n.replace(/[\/]+$/,"/"),e.push(n))}var o=e.join("/"),s=(o=o.replace(/\/(\?|&|#[^!])/g,"$1")).split("?");return s.shift()+(s.length>0?"?":"")+s.join("&")}("object"==typeof arguments[0]?arguments[0]:[].slice.call(arguments))}}),Co=r(Mo),Lo={},Ro={},Io={},Fo={};function jo(){return Oo||(Oo=1,Object.defineProperty(Fo,"__esModule",{value:!0}),Fo.ExceptionFactory=void 0,function(t){t.createAssetLoadError=function(t,e,r){return void 0===e&&(e=!0),{name:"AssetLoadError",message:t,retriable:e,cause:r}}}(t||(Fo.ExceptionFactory=t={}))),Fo;var t}function Do(){if(To)return Io;To=1,Object.defineProperty(Io,"__esModule",{value:!0}),Io.XHRLoader=void 0;var t=jo(),e=function(){function e(t){void 0===t&&(t={}),this.timeout=t.timeout||15e3}return e.prototype.get=function(t,e){this._getRequestObject({url:t,responseType:"text"},e)},e.prototype.getArrayBuffer=function(t,e){this._getRequestObject({url:t,responseType:"arraybuffer"},e)},e.prototype._getRequestObject=function(e,r){var i=new XMLHttpRequest;i.open("GET",e.url,!0),i.responseType=e.responseType,i.timeout=this.timeout,i.addEventListener("timeout",(function(){r(t.ExceptionFactory.createAssetLoadError("loading timeout"))}),!1),i.addEventListener("load",(function(){if(i.status>=200&&i.status<300){var n="text"===e.responseType?i.responseText:i.response;r(null,n)}else r(t.ExceptionFactory.createAssetLoadError("loading error. status: "+i.status))}),!1),i.addEventListener("error",(function(){r(t.ExceptionFactory.createAssetLoadError("loading error. status: "+i.status))}),!1),i.send()},e}();return Io.XHRLoader=e,Io}var ko,Uo,Go,Ho={};function Bo(){if(ko)return Ho;ko=1,Object.defineProperty(Ho,"__esModule",{value:!0}),Ho.Asset=void 0;var t=k(),e=function(){function e(e,r){this.onDestroyed=new t.Trigger,this.id=e,this.originalPath=r,this.path=this._assetPathFilter(r)}return e.prototype.destroy=function(){this.onDestroyed.fire(this),this.id=void 0,this.originalPath=void 0,this.path=void 0,this.onDestroyed.destroy(),this.onDestroyed=void 0},e.prototype.destroyed=function(){return void 0===this.id},e.prototype.inUse=function(){return!1},e.prototype._assetPathFilter=function(t){return t},e}();return Ho.Asset=e,Ho}function Vo(){if(Uo)return Ro;Uo=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ro,"__esModule",{value:!0}),Ro.BinaryAsset=void 0;var r=Do(),i=function(e){function i(t,r){var i=e.call(this,t,r)||this;return i.type="binary",i.data=void 0,i}return t(i,e),i.prototype.destroy=function(){this.data=void 0,e.prototype.destroy.call(this)},i.prototype._load=function(t){var e=this;(new r.XHRLoader).getArrayBuffer(this.path,(function(r,i){r?t._onAssetError(e,r):null!=i?(e.data=i,t._onAssetLoad(e)):t._onAssetError(e,{name:"AssetLoadError",retriable:!1,message:"BinaryAsset#_load(): no data received"})}))},i}(Bo().Asset);return Ro.BinaryAsset=i,Ro}var Wo,No,Xo={},zo={},qo={},Yo={},Ko={},$o={};function Jo(){if(Wo)return $o;Wo=1,Object.defineProperty($o,"__esModule",{value:!0}),$o.Surface=void 0;var t=function(){function t(t,e,r){this.width=Math.ceil(t),this.height=Math.ceil(e),this._drawable=r}return t.prototype.destroy=function(){this._destroyed=!0},t.prototype.destroyed=function(){return!!this._destroyed},t}();return $o.Surface=t,$o}function Zo(){if(No)return Ko;No=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ko,"__esModule",{value:!0}),Ko.CanvasSurface=void 0;var r=function(e){function r(t,r){var i=this,n=document.createElement("canvas");return i=e.call(this,t,r,n)||this,n.width=t,n.height=r,i.canvas=n,i}return t(r,e),r.prototype.destroy=function(){this.canvas.width=1,this.canvas.height=1,this.canvas=void 0,e.prototype.destroy.call(this)},r.prototype.getHTMLElement=function(){return this.canvas},r.prototype.changeVisualScale=function(t,e){var r=this.canvas.style;"transform"in r?(r.transformOrigin="0 0",r.transform="scale("+t+","+e+")"):"webkitTransform"in r?(r.webkitTransformOrigin="0 0",r.webkitTransform="scale("+t+","+e+")"):(r.width=Math.floor(t*this.width)+"px",r.height=Math.floor(e*this.width)+"px")},r}(Jo().Surface);return Ko.CanvasSurface=r,Ko}var Qo,ts,es,rs={},is={},ns={};function os(){if(Qo)return ns;Qo=1,Object.defineProperty(ns,"__esModule",{value:!0}),ns.AffineTransformer=void 0;var t=function(){function t(t){this.matrix=t?new Float32Array(t.matrix):new Float32Array([1,0,0,1,0,0])}return t.prototype.scale=function(t,e){var r=this.matrix;return r[0]*=t,r[1]*=t,r[2]*=e,r[3]*=e,this},t.prototype.translate=function(t,e){var r=this.matrix;return r[4]+=r[0]*t+r[2]*e,r[5]+=r[1]*t+r[3]*e,this},t.prototype.transform=function(t){var e=this.matrix,r=t[0]*e[0]+t[1]*e[2],i=t[0]*e[1]+t[1]*e[3],n=t[2]*e[0]+t[3]*e[2],o=t[2]*e[1]+t[3]*e[3],s=t[4]*e[0]+t[5]*e[2]+e[4],a=t[4]*e[1]+t[5]*e[3]+e[5];return e[0]=r,e[1]=i,e[2]=n,e[3]=o,e[4]=s,e[5]=a,this},t.prototype.setTransform=function(t){var e=this.matrix;e[0]=t[0],e[1]=t[1],e[2]=t[2],e[3]=t[3],e[4]=t[4],e[5]=t[5]},t.prototype.copyFrom=function(t){return this.matrix.set(t.matrix),this},t}();return ns.AffineTransformer=t,ns}function ss(){if(es)return rs;es=1,Object.defineProperty(rs,"__esModule",{value:!0}),rs.CanvasSurfaceContext=void 0;var t=function(){if(ts)return is;ts=1,Object.defineProperty(is,"__esModule",{value:!0}),is.CanvasRenderingState=void 0;var t=os(),e=function(e){e?(this.fillStyle=e.fillStyle,this.globalAlpha=e.globalAlpha,this.globalCompositeOperation=e.globalCompositeOperation,this.transformer=new t.AffineTransformer(e.transformer)):(this.fillStyle="#000000",this.globalAlpha=1,this.globalCompositeOperation="source-over",this.transformer=new t.AffineTransformer)};return is.CanvasRenderingState=e,is}(),e=function(){function e(e){this._stateStack=[],this._modifiedTransform=!1,this._context=e;var r=new t.CanvasRenderingState;this._contextFillStyle=r.fillStyle,this._contextGlobalAlpha=r.globalAlpha,this._contextGlobalCompositeOperation=r.globalCompositeOperation,this.pushState(r)}return Object.defineProperty(e.prototype,"fillStyle",{get:function(){return this.currentState().fillStyle},set:function(t){this.currentState().fillStyle=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalAlpha",{get:function(){return this.currentState().globalAlpha},set:function(t){this.currentState().globalAlpha=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"globalCompositeOperation",{get:function(){return this.currentState().globalCompositeOperation},set:function(t){this.currentState().globalCompositeOperation=t},enumerable:!1,configurable:!0}),e.prototype.getCanvasRenderingContext2D=function(){return this._context},e.prototype.clearRect=function(t,e,r,i){this.prerender(),this._context.clearRect(t,e,r,i)},e.prototype.save=function(){var e=new t.CanvasRenderingState(this.currentState());this.pushState(e)},e.prototype.restore=function(){this.popState()},e.prototype.scale=function(t,e){this.currentState().transformer.scale(t,e),this._modifiedTransform=!0},e.prototype.drawImage=function(t,e,r,i,n,o,s,a,u){this.prerender(),this._context.drawImage(t,e,r,i,n,o,s,a,u)},e.prototype.fillRect=function(t,e,r,i){this.prerender(),this._context.fillRect(t,e,r,i)},e.prototype.fillText=function(t,e,r,i){this.prerender(),this._context.fillText(t,e,r,i)},e.prototype.strokeText=function(t,e,r,i){this.prerender(),this._context.strokeText(t,e,r,i)},e.prototype.translate=function(t,e){this.currentState().transformer.translate(t,e),this._modifiedTransform=!0},e.prototype.transform=function(t,e,r,i,n,o){this.currentState().transformer.transform([t,e,r,i,n,o]),this._modifiedTransform=!0},e.prototype.setTransform=function(t,e,r,i,n,o){this.currentState().transformer.setTransform([t,e,r,i,n,o]),this._modifiedTransform=!0},e.prototype.setGlobalAlpha=function(t){this.currentState().globalAlpha=t},e.prototype.getImageData=function(t,e,r,i){return this._context.getImageData(t,e,r,i)},e.prototype.putImageData=function(t,e,r,i,n,o,s){this._context.putImageData(t,e,r,i,n,o,s)},e.prototype.prerender=function(){var t=this.currentState();if(t.fillStyle!==this._contextFillStyle&&(this._context.fillStyle=t.fillStyle,this._contextFillStyle=t.fillStyle),t.globalAlpha!==this._contextGlobalAlpha&&(this._context.globalAlpha=t.globalAlpha,this._contextGlobalAlpha=t.globalAlpha),t.globalCompositeOperation!==this._contextGlobalCompositeOperation&&(this._context.globalCompositeOperation=t.globalCompositeOperation,this._contextGlobalCompositeOperation=t.globalCompositeOperation),this._modifiedTransform){var e=t.transformer;this._context.setTransform(e.matrix[0],e.matrix[1],e.matrix[2],e.matrix[3],e.matrix[4],e.matrix[5]),this._modifiedTransform=!1}},e.prototype.pushState=function(t){this._stateStack.push(t)},e.prototype.popState=function(){this._stateStack.length<=1||(this._stateStack.pop(),this._modifiedTransform=!0,this._contextFillStyle=this._context.fillStyle,this._contextGlobalAlpha=this._context.globalAlpha,this._contextGlobalCompositeOperation=this._context.globalCompositeOperation)},e.prototype.currentState=function(){return this._stateStack[this._stateStack.length-1]},e}();return rs.CanvasSurfaceContext=e,rs}var as,us,cs,hs,ls,ds={};function ps(){if(as)return ds;as=1,Object.defineProperty(ds,"__esModule",{value:!0}),ds.Context2DRenderer=void 0;var t={"source-over":"source-over","source-atop":"source-atop",lighter:"lighter",copy:"copy","experimental-source-in":"source-in","experimental-source-out":"source-out","experimental-destination-atop":"destination-atop","experimental-destination-in":"destination-in","destination-out":"destination-out","destination-over":"destination-over",xor:"xor",difference:"difference",saturation:"saturation"},e=function(){function e(t){this.surface=t,this.context=t.context(),this.canvasRenderingContext2D=this.context.getCanvasRenderingContext2D()}return e.prototype.begin=function(){this.canvasRenderingContext2D.save(),this.context.save()},e.prototype.end=function(){this.canvasRenderingContext2D.restore(),this.context.restore()},e.prototype.clear=function(){this.context.clearRect(0,0,this.surface.width,this.surface.height)},e.prototype.drawImage=function(t,e,r,i,n,o,s){this.context.drawImage(t._drawable,e,r,i,n,o,s,i,n)},e.prototype.drawSprites=function(t,e,r,i,n,o,s,a){for(var u=0;u<a;++u)this.drawImage(t,e[u],r[u],i[u],n[u],o[u],s[u])},e.prototype.translate=function(t,e){this.context.translate(t,e)},e.prototype.transform=function(t){this.context.transform(t[0],t[1],t[2],t[3],t[4],t[5])},e.prototype.opacity=function(t){this.context.globalAlpha*=t},e.prototype.save=function(){this.context.save()},e.prototype.restore=function(){this.context.restore()},e.prototype.fillRect=function(t,e,r,i,n){this.context.fillStyle=n,this.context.fillRect(t,e,r,i)},e.prototype.setCompositeOperation=function(e){this.context.globalCompositeOperation=t[e]||"source-over"},e.prototype.setOpacity=function(t){this.context.globalAlpha=t},e.prototype.setTransform=function(t){this.context.setTransform(t[0],t[1],t[2],t[3],t[4],t[5])},e.prototype.setShaderProgram=function(t){throw new Error("Context2DRenderer#setShaderProgram() is not implemented")},e.prototype.isSupportedShaderProgram=function(){return!1},e.prototype.getContext=function(){return this.context.getCanvasRenderingContext2D()},e.prototype.flush=function(){},e.prototype._getImageData=function(t,e,r,i){return this.context.getImageData(t,e,r,i)},e.prototype._putImageData=function(t,e,r,i,n,o,s){void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=t.width),void 0===s&&(s=t.height),this.context.putImageData(t,e,r,i,n,o,s)},e}();return ds.Context2DRenderer=e,ds}function fs(){if(us)return Yo;us=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Yo,"__esModule",{value:!0}),Yo.Context2DSurface=void 0;var r=Zo(),i=ss(),n=ps(),o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype.context=function(){if(!this._context){var t=this.canvas.getContext("2d");if(!t)throw new Error("Context2DSurface#context(): could not initialize CanvasRenderingContext2D");this._context=new i.CanvasSurfaceContext(t)}return this._context},r.prototype.renderer=function(){return this._renderer||(this._renderer=new n.Context2DRenderer(this)),this._renderer},r.prototype.changePhysicalScale=function(t,e){if(!this._context)throw new Error("Context2DSurface#changePhysicalScale(): context has not been initialized");this.canvas.width=this.width*t,this.canvas.height=this.height*e,this._context.scale(t,e)},r.prototype.isPlaying=function(){return!1},r}(r.CanvasSurface);return Yo.Context2DSurface=o,Yo}function _s(){if(cs)return qo;cs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(qo,"__esModule",{value:!0}),qo.SVGImageAsset=qo.SVGImageAssetSurface=void 0;var r=fs(),i=Jo(),n=jo(),o=Bo(),s=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype.renderer=function(){throw new Error("SVGImageAssetSurface cannot be rendered.")},r.prototype.isPlaying=function(){return!1},r}(i.Surface);qo.SVGImageAssetSurface=s;var a=function(e){function i(t,r,i,n,o){var s=e.call(this,t,r)||this;return s.type="vector-image",s.width=i,s.height=n,s.hint=o,s.data=null,s._surface=null,s}return t(i,e),i.prototype.destroy=function(){this.data=null,this.hint=void 0,this._surface=null,e.prototype.destroy.call(this)},i.prototype._load=function(t){var e=this,r=new Image;this.hint&&this.hint.untainted&&(r.crossOrigin="anonymous"),r.onerror=function(){t._onAssetError(e,n.ExceptionFactory.createAssetLoadError("SVGImageAsset unknown loading error"))},r.onload=function(){e.data=r,t._onAssetLoad(e)},r.src=this.path},i.prototype.createSurface=function(t,e,i,n,o,a){void 0===i&&(i=0),void 0===n&&(n=0);var u=this,c=u.width,h=u.height,l=u.data;if(!l)throw new Error("SVGImageAsset#asSurface: not yet loaded.");this._surface||(this._surface=new s(c,h,l)),o||(o=c),a||(a=h);var d=new r.Context2DSurface(t,e),p=d.renderer();return p.save(),p.transform([t/o,0,0,e/a,0,0]),p.drawImage(this._surface,i,n,o,a,0,0),p.restore(),d},i}(o.Asset);return qo.SVGImageAsset=a,qo}function ys(){if(hs)return zo;hs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(zo,"__esModule",{value:!0}),zo.GeneratedSVGImageAsset=void 0;var r=jo(),i=function(e){function i(t,r,i){var n=e.call(this,t,r,0,0)||this;return n._svgString=i,n}return t(i,e),i.prototype.destroy=function(){this._svgString=null,e.prototype.destroy.call(this)},i.prototype._load=function(t){var e,i=this,o=this._svgString,s=new DOMParser;try{var a=s.parseFromString(o,"text/xml").getElementsByTagName("svg")[0],u=a.getAttribute("width"),c=a.getAttribute("height");if(null==u)throw new Error("must give width in the root element.");if(null==c)throw new Error("must give height in the root element.");if(!n(u))throw new Error('the width in the root element must be given in "px" units');if(!n(c))throw new Error('the height in the root element must be given in "px" units');e=window.btoa(o),this.width=parseFloat(u),this.height=parseFloat(c)}catch(e){return void t._onAssetError(this,r.ExceptionFactory.createAssetLoadError(e.message,!1,e))}var h=new Image;h.onerror=function(e){t._onAssetError(i,r.ExceptionFactory.createAssetLoadError("GeneratedSVGImageAsset: unknown loading error",void 0,e))},h.onload=function(){i.data=h,t._onAssetLoad(i)},h.src="data:image/svg+xml;base64,"+e},i}(_s().SVGImageAsset);function n(t){return/^[+-]?(?:(?:[0-9]+(?:\.[0-9]*)?)|(?:\.[0-9]+))(?:[eE][+-]?[0-9]+)?(?:px)?$/.test(t)}return zo.GeneratedSVGImageAsset=i,zo}var vs,gs,ms={},As={};function ws(){if(vs)return As;vs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(As,"__esModule",{value:!0}),As.HTMLImageAsset=As.ImageAssetSurface=void 0;var r=Jo(),i=jo(),n=Bo(),o=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype.renderer=function(){throw new Error("ImageAssetSurface cannot be rendered.")},r.prototype.isPlaying=function(){return!1},r}(r.Surface);As.ImageAssetSurface=o;var s=function(e){function r(t,r,i,n){var o=e.call(this,t,r)||this;return o.type="image",o.width=i,o.height=n,o.data=void 0,o._surface=void 0,o}return t(r,e),r.prototype.initialize=function(t){this.hint=t},r.prototype.destroy=function(){this._surface&&!this._surface.destroyed()&&this._surface.destroy(),this.data=void 0,this._surface=void 0,e.prototype.destroy.call(this)},r.prototype._load=function(t){var e=this,r=new Image;this.hint&&this.hint.untainted&&(r.crossOrigin="anonymous"),r.onerror=function(){t._onAssetError(e,i.ExceptionFactory.createAssetLoadError("HTMLImageAsset unknown loading error"))},r.onload=function(){e.data=r,t._onAssetLoad(e)},r.src=this.path},r.prototype.asSurface=function(){if(!this.data)throw new Error("ImageAssetImpl#asSurface: not yet loaded.");return this._surface||(this._surface=new o(this.width,this.height,this.data)),this._surface},r}(n.Asset);return As.HTMLImageAsset=s,As}var xs,Ss={},bs={};function Ps(){if(xs)return bs;xs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(bs,"__esModule",{value:!0}),bs.XHRScriptAsset=void 0;var r=Do(),i=function(e){function i(t,r,i){void 0===i&&(i=[]);var n=e.call(this,t,r)||this;return n.type="script",n.script="",n.exports=i,n}return t(i,e),i.prototype._load=function(t){var e=this;(new r.XHRLoader).get(this.path,(function(r,i){r?t._onAssetError(e,r):(e.script=i+"\n",t._onAssetLoad(e))}))},i.prototype.execute=function(t){return this._wrap()(t),t.module.exports},i.prototype.destroy=function(){this.script=void 0,e.prototype.destroy.call(this)},i.prototype._wrap=function(){for(var t="",e=0,r=this.exports;e<r.length;e++){var i=r[e];t+='exports["'.concat(i,'"] = typeof ').concat(i,' !== "undefined" ? ').concat(i," : undefined;\n")}return new Function("g","(function(exports, require, module, __filename, __dirname) {\n"+this.script+"\n"+t+"\n})(g.module.exports, g.module.require, g.module, g.filename, g.dirname);")},i}(Bo().Asset);return bs.XHRScriptAsset=i,bs}var Es,Os={},Ts={};function Ms(){if(Es)return Ts;Es=1,Object.defineProperty(Ts,"__esModule",{value:!0}),Ts.Asset=void 0;var t=k(),e=function(){function e(e,r){this.id=e,this.originalPath=r,this.path=this._assetPathFilter(r),this.onDestroyed=new t.Trigger}return e.prototype.destroy=function(){this.onDestroyed.fire(this),this.id=void 0,this.originalPath=void 0,this.path=void 0,this.onDestroyed.destroy(),this.onDestroyed=void 0},e.prototype.destroyed=function(){return void 0===this.id},e.prototype.inUse=function(){return!1},e.prototype._assetPathFilter=function(t){return t},e}();return Ts.Asset=e,Ts}var Cs,Ls={};var Rs,Is={};var Fs,js={};var Ds,ks={};function Us(){return Ds||(Ds=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ExceptionFactory=void 0,function(t){t.createAssertionError=function(t,e){var r=new Error(t);return r.name="AssertionError",r.cause=e,r},t.createTypeMismatchError=function(t,e,r,i){var n="Type mismatch on "+t+", expected type is "+e;if(arguments.length>2)try{var o=void 0;n+=", actual type is "+((o=r&&r.constructor&&r.constructor.name?r.constructor.name:typeof r).length>40?o.substr(0,40):o)}catch(t){}n+=".";var s=new Error(n);return s.name="TypeMismatchError",s.cause=i,s.expected=e,s.actual=r,s},t.createAssetLoadError=function(t,e,r,i){void 0===e&&(e=!0);var n=new Error(t);return n.name="AssetLoadError",n.cause=i,n.retriable=e,n}}(t.ExceptionFactory||(t.ExceptionFactory={}))}(ks)),ks}var Gs,Hs={};var Bs,Vs={};var Ws,Ns={};var Xs,zs={};var qs,Ys={};var Ks,$s={};var Js,Zs={};var Qs,ta={};var ea,ra={};var ia,na={};var oa,sa={};var aa,ua,ca,ha={};function la(){return ua||(ua=1,function(t){var r=e&&e.__createBinding||(Object.create?function(t,e,r,i){void 0===i&&(i=r);var n=Object.getOwnPropertyDescriptor(e,r);n&&!("get"in n?!e.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return e[r]}}),Object.defineProperty(t,i,n)}:function(t,e,r,i){void 0===i&&(i=r),t[i]=e[r]}),i=e&&e.__exportStar||function(t,e){for(var i in t)"default"===i||Object.prototype.hasOwnProperty.call(e,i)||r(e,t,i)};Object.defineProperty(t,"__esModule",{value:!0}),i(Ms(),t),i(function(){if(Cs)return Ls;Cs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ls,"__esModule",{value:!0}),Ls.AudioAsset=void 0;var r=function(e){function r(t,r,i,n,o,s,a){var u=e.call(this,t,r)||this;return u.type="audio",u.duration=i,u.loop=o,u.hint=s,u._system=n,u.data=void 0,u.offset=a,u}return t(r,e),r.prototype.play=function(){var t=this._system.createPlayer();return t.play(this),this._lastPlayedPlayer=t,t},r.prototype.stop=function(){for(var t=this._system.findPlayers(this),e=0;e<t.length;++e)t[e].stop()},r.prototype.inUse=function(){return this._system.findPlayers(this).length>0},r.prototype.destroy=function(){this._system&&this.stop(),this.data=void 0,this._system=void 0,this._lastPlayedPlayer=void 0,e.prototype.destroy.call(this)},r}(Ms().Asset);return Ls.AudioAsset=r,Ls}(),t),i(function(){if(Rs)return Is;Rs=1,Object.defineProperty(Is,"__esModule",{value:!0}),Is.AudioPlayer=void 0;var t=k(),e=function(){function e(e){this.onPlay=new t.Trigger,this.onStop=new t.Trigger,this.played=this.onPlay,this.stopped=this.onStop,this.currentAudio=void 0,this.volume=e.volume,this._muted=e._muted,this._system=e}return e.prototype.play=function(t){this.currentAudio=t,this.onPlay.fire({player:this,audio:t})},e.prototype.stop=function(){var t=this.currentAudio;t&&(this.currentAudio=void 0,this.onStop.fire({player:this,audio:t}))},e.prototype.canHandleStopped=function(){return!0},e.prototype.changeVolume=function(t){this.volume=t},e.prototype._changeMuted=function(t){this._muted=t},e.prototype._notifyVolumeChanged=function(){this.changeVolume(this.volume)},e}();return Is.AudioPlayer=e,Is}(),t),i(function(){if(Fs)return js;Fs=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(js,"__esModule",{value:!0}),js.BinaryAsset=void 0;var r=function(e){function r(t,r){var i=e.call(this,t,r)||this;return i.type="binary",i.data=void 0,i}return t(r,e),r.prototype.destroy=function(){this.data=void 0,e.prototype.destroy.call(this)},r}(Ms().Asset);return js.BinaryAsset=r,js}(),t),i(Us(),t),i(function(){if(Gs)return Hs;Gs=1,Object.defineProperty(Hs,"__esModule",{value:!0}),Hs.Glyph=void 0;var t=function(){function t(t,e,r,i,n,o,s,a,u,c){void 0===o&&(o=0),void 0===s&&(s=0),void 0===a&&(a=i),void 0===c&&(c=!!u),this.code=t,this.x=e,this.y=r,this.width=i,this.height=n,this.offsetX=o,this.offsetY=s,this.advanceWidth=a,this.surface=u,this.isSurfaceValid=c,this._atlas=null}return t.prototype.renderingWidth=function(t){return this.width&&this.height?t/this.height*this.width:0},t}();return Hs.Glyph=t,Hs}(),t),i(function(){if(Bs)return Vs;Bs=1,Object.defineProperty(Vs,"__esModule",{value:!0}),Vs.GlyphFactory=void 0;var t=function(t,e,r,i,n,o,s,a){void 0===r&&(r=e),void 0===i&&(i="black"),void 0===n&&(n=0),void 0===o&&(o="black"),void 0===s&&(s=!1),void 0===a&&(a="normal"),this.fontFamily=t,this.fontSize=e,this.fontWeight=a,this.baselineHeight=r,this.fontColor=i,this.strokeWidth=n,this.strokeColor=o,this.strokeOnly=s};return Vs.GlyphFactory=t,Vs}(),t),i(function(){if(Ws)return Ns;Ws=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ns,"__esModule",{value:!0}),Ns.ImageAsset=void 0;var r=function(e){function r(t,r,i,n){var o=e.call(this,t,r)||this;return o.type="image",o.width=i,o.height=n,o}return t(r,e),r.prototype.initialize=function(t){this.hint=t},r}(Ms().Asset);return Ns.ImageAsset=r,Ns}(),t),i((Xs||(Xs=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.PdiCommonUtil=void 0,function(t){t.addExtname=function(t,e){var r=t.indexOf("?");return-1===r?t+"."+e:t.substring(0,r)+"."+e+t.substring(r,t.length)}}(t.PdiCommonUtil||(t.PdiCommonUtil={}))}(zs)),zs),t),i(function(){if(qs)return Ys;qs=1,Object.defineProperty(Ys,"__esModule",{value:!0}),Ys.Renderer=void 0;var t=function(){function t(){}return t.prototype.begin=function(){},t.prototype.end=function(){},t}();return Ys.Renderer=t,Ys}(),t),i(function(){if(Ks)return $s;Ks=1,Object.defineProperty($s,"__esModule",{value:!0}),$s.ResourceFactory=void 0;var t=function(){};return $s.ResourceFactory=t,$s}(),t),i(function(){if(Js)return Zs;Js=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Zs,"__esModule",{value:!0}),Zs.ScriptAsset=void 0;var r=function(e){function r(t,r,i){void 0===i&&(i=[]);var n=e.call(this,t,r)||this;return n.type="script",n.exports=i,n.script=void 0,n}return t(r,e),r.prototype.destroy=function(){this.script=void 0,e.prototype.destroy.call(this)},r}(Ms().Asset);return Zs.ScriptAsset=r,Zs}(),t),i(function(){if(Qs)return ta;Qs=1,Object.defineProperty(ta,"__esModule",{value:!0}),ta.Surface=void 0;var t=Us(),e=function(){function e(e,r,i){if(e%1!=0||r%1!=0)throw t.ExceptionFactory.createAssertionError("Surface#constructor: width and height must be integers");this.width=e,this.height=r,this._drawable=i}return e.prototype.destroy=function(){this._destroyed=!0},e.prototype.destroyed=function(){return!!this._destroyed},e}();return ta.Surface=e,ta}(),t),i(function(){if(ea)return ra;ea=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ra,"__esModule",{value:!0}),ra.TextAsset=void 0;var r=function(e){function r(t,r){var i=e.call(this,t,r)||this;return i.type="text",i.data=void 0,i}return t(r,e),r.prototype.destroy=function(){this.data=void 0,e.prototype.destroy.call(this)},r}(Ms().Asset);return ra.TextAsset=r,ra}(),t),i(function(){if(ia)return na;ia=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(na,"__esModule",{value:!0}),na.VectorImageAsset=void 0;var r=function(e){function r(t,r,i,n,o){var s=e.call(this,t,r)||this;return s.type="vector-image",s.width=i,s.height=n,s.hint=o,s}return t(r,e),r}(Ms().Asset);return na.VectorImageAsset=r,na}(),t),i(function(){if(oa)return sa;oa=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(sa,"__esModule",{value:!0}),sa.VideoAsset=void 0;var r=function(e){function r(t,r,i,n,o,s,a){var u=e.call(this,t,r)||this;return u.type="video",u.width=i,u.height=n,u.realWidth=0,u.realHeight=0,u._system=o,u._loop=s,u._useRealSize=a,u}return t(r,e),r.prototype.play=function(t){return this.getPlayer().play(this),this.getPlayer()},r.prototype.stop=function(){this.getPlayer().stop()},r.prototype.destroy=function(){this._system=void 0,e.prototype.destroy.call(this)},r}(Ms().Asset);return sa.VideoAsset=r,sa}(),t),i(function(){if(aa)return ha;aa=1,Object.defineProperty(ha,"__esModule",{value:!0}),ha.VideoPlayer=void 0;var t=k(),e=function(){function e(e){this._loop=!!e,this.onPlay=new t.Trigger,this.onStop=new t.Trigger,this.played=this.onPlay,this.stopped=this.onStop,this.currentVideo=void 0,this.volume=1}return e.prototype.play=function(t){this.currentVideo=t,this.onPlay.fire({player:this,video:t})},e.prototype.stop=function(){var t=this.currentVideo;this.onStop.fire({player:this,video:t})},e.prototype.changeVolume=function(t){this.volume=t},e}();return ha.VideoPlayer=e,ha}(),t)}(Os)),Os}var da,pa={};var fa,_a,ya={},va={};function ga(){if(_a)return ya;_a=1,Object.defineProperty(ya,"__esModule",{value:!0}),ya.TextAsset=void 0;var t=l,e=t.__importStar(So()),r=Do(),i=la(),n=function(){if(fa)return va;fa=1,Object.defineProperty(va,"__esModule",{value:!0}),va.Asset=void 0;var t=l.__importStar(So()),e=function(){function e(e,r){this.type="",this.onDestroyed=new t.Trigger,this.id=e,this.path=r,this.originalPath=r}return e.prototype.inUse=function(){return!1},e.prototype.destroy=function(){this.onDestroyed.destroy(),this.onDestroyed=void 0},e.prototype.destroyed=function(){return void 0===this.onDestroyed},e.prototype._assetPathFilter=function(t){return t},e}();return va.Asset=e,va}(),o=function(n){function o(t,r){var i=n.call(this,t,r)||this;return i.type="text",i.data="",i.onDestroyed=new e.Trigger,i}return t.__extends(o,n),o.prototype._load=function(t){var e=this;(new r.XHRLoader).get(this.path,(function(r,i){r?t._onAssetError(e,r):(e.data=i+"\n",t._onAssetLoad(e))}))},o.prototype._overrideLoadFunc=function(t){var e=this;this._load=function(r){t(e.id,e.path,(function(t,n){t?r._onAssetError(e,i.ExceptionFactory.createAssetLoadError(t.message,!1)):n?(e.data=n,r._onAssetLoad(e)):r._onAssetError(e,i.ExceptionFactory.createAssetLoadError("no data received",!1))}))}},o}(n.Asset);return ya.TextAsset=o,ya}var ma,Aa,wa,xa={},Sa={},ba={};function Pa(){if(Aa)return Sa;Aa=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Sa,"__esModule",{value:!0}),Sa.HTMLVideoAsset=void 0;var r=Jo(),i=Bo(),n=function(){if(ma)return ba;ma=1,Object.defineProperty(ba,"__esModule",{value:!0}),ba.HTMLVideoPlayer=void 0;var t=k(),e=function(){function e(e){this._loop=!!e,this.onPlay=new t.Trigger,this.onStop=new t.Trigger,this.played=this.onPlay,this.stopped=this.onStop,this.currentVideo=void 0,this.volume=1,this.isDummy=!0}return e.prototype.play=function(t){},e.prototype.stop=function(){},e.prototype.changeVolume=function(t){},e}();return ba.HTMLVideoPlayer=e,ba}(),o=function(e){function r(t,r,i){return e.call(this,t,r,i)||this}return t(r,e),r.prototype.renderer=function(){throw new Error("VideoAssetSurface cannot be rendered.")},r.prototype.isPlaying=function(){return!1},r}(r.Surface),s=function(e){function r(t,r,i,s,a,u,c){var h=e.call(this,t,r)||this;return h.type="video",h.width=i,h.height=s,h.realWidth=0,h.realHeight=0,h._system=a,h._loop=u,h._useRealSize=c,h._player=new n.HTMLVideoPlayer,h._surface=new o(i,s),h}return t(r,e),r.prototype.play=function(t){return this.getPlayer().play(this),this.getPlayer()},r.prototype.stop=function(){this.getPlayer().stop()},r.prototype.inUse=function(){return!1},r.prototype._load=function(t){var e=this;setTimeout((function(){t._onAssetLoad(e)}),0)},r.prototype.getPlayer=function(){return this._player},r.prototype.asSurface=function(){return this._surface},r}(i.Asset);return Sa.HTMLVideoAsset=s,Sa}var Ea,Oa={},Ta={},Ma={},Ca={};function La(){if(Ea)return Ca;Ea=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ca,"__esModule",{value:!0}),Ca.XHRTextAsset=void 0;var r=Do(),i=function(e){function i(t,r){var i=e.call(this,t,r)||this;return i.type="text",i.data="",i}return t(i,e),i.prototype._load=function(t){var e=this;(new r.XHRLoader).get(this.path,(function(r,i){r?t._onAssetError(e,r):i?(e.data=i,t._onAssetLoad(e)):t._onAssetError(e,{name:"AssetLoadError",message:"XHRTextAsset#_load(): no data received",retriable:!1})}))},i.prototype.destroy=function(){this.data=void 0,e.prototype.destroy.call(this)},i}(Bo().Asset);return Ca.XHRTextAsset=i,Ca}var Ra,Ia={};function Fa(){if(Ra)return Ia;Ra=1,Object.defineProperty(Ia,"__esModule",{value:!0}),Ia.AudioManager=void 0;var t=function(){function t(){this.audioAssets=[],this._masterVolume=1}return t.prototype.registerAudioAsset=function(t){-1===this.audioAssets.indexOf(t)&&this.audioAssets.push(t)},t.prototype.removeAudioAsset=function(t){var e=this.audioAssets.indexOf(t);-1===e&&this.audioAssets.splice(e,1)},t.prototype.setMasterVolume=function(t){this._masterVolume=t;for(var e=0;e<this.audioAssets.length;e++)this.audioAssets[e]._lastPlayedPlayer&&this.audioAssets[e]._lastPlayedPlayer.notifyMasterVolumeChanged()},t.prototype.getMasterVolume=function(){return this._masterVolume},t}();return Ia.AudioManager=t,Ia}var ja,Da,ka={},Ua={},Ga={},Ha={};function Ba(){if(ja)return Ha;ja=1,Object.defineProperty(Ha,"__esModule",{value:!0}),Ha.preventEventDefault=Ha.InputEventHandler=void 0;var t=k(),e=function(){function e(e){this.inputView=e,this.pointerEventLock={},this._xScale=1,this._yScale=1,this.pointTrigger=new t.Trigger,e.style.touchAction="none",e.style.userSelect="none"}return e.isSupported=function(){return!1},e.prototype.setScale=function(t,e){void 0===e&&(e=t),this._xScale=t,this._yScale=e},e.prototype.pointDown=function(t,e,r){e.offsetX<0||e.offsetY<0||e.offsetX>this.inputView.offsetWidth||e.offsetY>this.inputView.offsetHeight||(this.pointTrigger.fire({type:0,identifier:t,offset:this.getOffsetFromEvent(e),button:r}),this.pointerEventLock[t]=!0)},e.prototype.pointMove=function(t,e,r){this.pointerEventLock.hasOwnProperty(t+"")&&this.pointTrigger.fire({type:1,identifier:t,offset:this.getOffsetFromEvent(e),button:r})},e.prototype.pointUp=function(t,e,r){this.pointerEventLock.hasOwnProperty(t+"")&&(this.pointTrigger.fire({type:2,identifier:t,offset:this.getOffsetFromEvent(e),button:r}),delete this.pointerEventLock[t])},e.prototype.getOffsetFromEvent=function(t){return{x:t.offsetX,y:t.offsetY}},e.prototype.getScale=function(){return{x:this._xScale,y:this._yScale}},e.prototype.getOffsetPositionFromInputView=function(t){var e=this.inputView.getBoundingClientRect(),r=this.getScale();return{offsetX:(t.pageX-Math.round(window.pageXOffset+e.left))/r.x,offsetY:(t.pageY-Math.round(window.pageYOffset+e.top))/r.y}},e}();return Ha.InputEventHandler=e,Ha.preventEventDefault=function(t){t.preventDefault()},Ha}var Va,Wa,Na,Xa={};function za(){if(Wa)return Ua;Wa=1,Object.defineProperty(Ua,"__esModule",{value:!0}),Ua.InputHandlerLayer=void 0;var t=k(),r=function(){if(Da)return Ga;Da=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ga,"__esModule",{value:!0}),Ga.MouseTouchEventHandler=void 0;var r=Ba(),i=function(e){function i(){var t=null!==e&&e.apply(this,arguments)||this;return t.pressingMouseButton=null,t.onMouseDown=function(e){null==t.pressingMouseButton&&(t.pressingMouseButton=e.button,t.pointDown(i.MOUSE_IDENTIFIER,t.getOffsetPositionFromInputView(e),t.getPlatformButtonType(e,0)),window.addEventListener("mousemove",t.onWindowMouseMove,!1),window.addEventListener("mouseup",t.onWindowMouseUp,!1))},t.onWindowMouseMove=function(e){t.pointMove(i.MOUSE_IDENTIFIER,t.getOffsetPositionFromInputView(e),-1)},t.onWindowMouseUp=function(e){t.pressingMouseButton===e.button&&(t.pressingMouseButton=null,t.pointUp(i.MOUSE_IDENTIFIER,t.getOffsetPositionFromInputView(e),t.getPlatformButtonType(e,0)),window.removeEventListener("mousemove",t.onWindowMouseMove,!1),window.removeEventListener("mouseup",t.onWindowMouseUp,!1))},t.onTouchStart=function(e){for(var r=e.changedTouches,i=0,n=r.length;i<n;i++){var o=r[i];t.pointDown(o.identifier,t.getOffsetPositionFromInputView(o),0)}e.preventDefault()},t.onTouchMove=function(e){for(var r=e.changedTouches,i=0,n=r.length;i<n;i++){var o=r[i];t.pointMove(o.identifier,t.getOffsetPositionFromInputView(o),0)}},t.onTouchEnd=function(e){for(var r=e.changedTouches,i=0,n=r.length;i<n;i++){var o=r[i];t.pointUp(o.identifier,t.getOffsetPositionFromInputView(o),0)}window.removeEventListener("touchmove",t.onTouchMove,!1),window.removeEventListener("touchend",t.onTouchEnd,!1)},t}return t(i,e),i.isSupported=function(){return!1},i.prototype.start=function(){this.inputView.addEventListener("mousedown",this.onMouseDown,!1),this.inputView.addEventListener("touchstart",this.onTouchStart),this.inputView.addEventListener("touchmove",this.onTouchMove),this.inputView.addEventListener("touchend",this.onTouchEnd),this.inputView.addEventListener("contextmenu",r.preventEventDefault)},i.prototype.stop=function(){this.inputView.removeEventListener("mousedown",this.onMouseDown,!1),this.inputView.removeEventListener("touchstart",this.onTouchStart),this.inputView.removeEventListener("touchmove",this.onTouchMove),this.inputView.removeEventListener("touchend",this.onTouchEnd),this.inputView.removeEventListener("contextmenu",r.preventEventDefault)},i.prototype.getPlatformButtonType=function(t,e){switch(t.button){case-1:return-1;case 0:return 0;case 1:return 1;case 2:return 2;default:return e}},i.MOUSE_IDENTIFIER=1,i}(r.InputEventHandler);return Ga.MouseTouchEventHandler=i,Ga}(),i=function(){if(Va)return Xa;Va=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Xa,"__esModule",{value:!0}),Xa.PointerEventHandler=void 0;var r=Ba(),i=function(e){function i(t){var r=e.call(this,t)||this;return r.onPointerDown=function(t){r.pointDown(t.pointerId,r.getOffsetPositionFromInputView(t),r.getPlatformButtonType(t,0));var e=function(t){r.pointMove(t.pointerId,r.getOffsetPositionFromInputView(t),r.getPlatformButtonType(t,-1))},i=function(e){if(r.pointUp(e.pointerId,r.getOffsetPositionFromInputView(e),r.getPlatformButtonType(e,0)),t.pointerId===e.pointerId){var i=r._eventHandlersMap[e.pointerId];if(!i)return;var n=i.onPointerMove,o=i.onPointerUp;window.removeEventListener("pointermove",n,!1),window.removeEventListener("pointerup",o,!1),delete r._eventHandlersMap[e.pointerId]}};window.addEventListener("pointermove",e,!1),window.addEventListener("pointerup",i,!1),r._eventHandlersMap[t.pointerId]={onPointerMove:e,onPointerUp:i}},r._eventHandlersMap=Object.create(null),r}return t(i,e),i.isSupported=function(){return!1},i.prototype.start=function(){this.inputView.addEventListener("pointerdown",this.onPointerDown,!1),this.inputView.addEventListener("contextmenu",r.preventEventDefault,!1)},i.prototype.stop=function(){this.inputView.removeEventListener("pointerdown",this.onPointerDown,!1),this.inputView.removeEventListener("contextmenu",r.preventEventDefault,!1)},i.prototype.getPlatformButtonType=function(t,e){switch(t.button){case-1:return-1;case 0:return 0;case 1:return 1;case 2:return 2;default:return e}},i}(r.InputEventHandler);return Xa.PointerEventHandler=i,Xa}(),n=function(){function e(e){this.view=this._createInputView(e.width,e.height),this._inputHandler=void 0,this.pointEventTrigger=new t.Trigger}return e.prototype.enablePointerEvent=function(){var t=this,e=!!window.PointerEvent;this._inputHandler=e?new i.PointerEventHandler(this.view):new r.MouseTouchEventHandler(this.view),this._inputHandler.pointTrigger.add((function(e){t.pointEventTrigger.fire(e)})),this._inputHandler.start()},e.prototype.disablePointerEvent=function(){var t;null===(t=this._inputHandler)||void 0===t||t.stop()},e.prototype.setOffset=function(t){var e="position:relative; left:".concat(t.x,"px; top:").concat(t.y,"px");this._inputHandler.inputView.setAttribute("style",e)},e.prototype.setViewSize=function(t){var e=this.view;e.style.width=t.width+"px",e.style.height=t.height+"px"},e.prototype.setViewTabIndex=function(t){this.view.setAttribute("tabindex",t)},e.prototype._createInputView=function(t,e){var r=document.createElement("div");return r.setAttribute("style","display:inline-block; outline:none; touch-action:none"),r.style.width=t+"px",r.style.height=e+"px",r.setAttribute("tabindex","0"),r},e}();return Ua.InputHandlerLayer=n,Ua}var qa,Ya={};function Ka(){if(qa)return Ya;qa=1,Object.defineProperty(Ya,"__esModule",{value:!0}),Ya.AudioPluginManager=void 0;var t=function(){function t(){this._activePlugin=null}return t.prototype.getActivePlugin=function(){return this._activePlugin},t.prototype.tryInstallPlugin=function(t){for(var e=0,r=t.length;e<r;e++){var i=t[e];if(!i.isSupported)return this._activePlugin=i,!0;var n=i;if(n.isSupported())return this._activePlugin=new n,!0}return!1},t}();return Ya.AudioPluginManager=t,Ya}var $a,Ja={};function Za(){if($a)return Ja;$a=1,Object.defineProperty(Ja,"__esModule",{value:!0}),Ja.AudioPluginRegistry=void 0;var t=[];return Ja.AudioPluginRegistry={addPlugin:function(e){-1===t.indexOf(e)&&t.push(e)},getRegisteredAudioPlugins:function(){return t},clear:function(){t=[]}},Ja}var Qa,tu={};var eu,ru={},iu={};function nu(){if(eu)return iu;eu=1,Object.defineProperty(iu,"__esModule",{value:!0}),iu.GlyphFactory=void 0;var t=fs();function e(e,r,i,n,s,a,u,c,h,l,d,p){var f=r<o._environmentMinimumFontSize?r/o._environmentMinimumFontSize:1,_=Math.ceil((r+2*s)*f),y=Math.ceil((r+2*a)*f),v=new t.Context2DSurface(_,y),g=v.canvas,m=g.getContext("2d");if(!m)throw new Error("createGlyphRenderedSurface(): could not initialize CanvasRenderingContext2D");var A=4294901760&e?String.fromCharCode((4294901760&e)>>>16,65535&e):String.fromCharCode(e);m.save(),m.font=p+" "+r+"px "+i,m.textAlign="left",m.textBaseline="alphabetic",m.lineJoin="bevel",1!==f&&m.scale(f,f),h>0&&(m.lineWidth=h,m.strokeStyle=l,m.strokeText(A,s,a+n)),d||(m.fillStyle=c,m.fillText(A,s,a+n));var w=m.measureText(A).width;return m.restore(),{surface:v,advanceWidth:w,imageData:u?m.getImageData(0,0,g.width,g.height):void 0}}var r=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function i(t){return-1!==r.indexOf(t)?t:'"'+t+'"'}function n(t,e,r,i,n,o,s,a,u,c){return{code:t,x:e,y:r,width:i,height:n,surface:u,offsetX:o,offsetY:s,advanceWidth:a,isSurfaceValid:c,_atlas:null}}var o=function(){function t(e,r,n,o,s,a,u,c){void 0===n&&(n=r),void 0===o&&(o="black"),void 0===s&&(s=0),void 0===a&&(a="black"),void 0===u&&(u=!1),void 0===c&&(c="normal"),this._glyphAreas=Object.create(null),this.fontFamily=e,this.fontSize=r,this.baselineHeight=n,this.fontColor=o,this.strokeWidth=s,this.strokeColor=a,this.strokeOnly=u,this.fontWeight=c,this._cssFontFamily="string"==typeof e?i(e):e.map(i).join(","),-1===this._cssFontFamily.indexOf("sans-serif")&&(this._cssFontFamily+=",sans-serif"),this._marginW=Math.ceil(.3*this.fontSize+this.strokeWidth/2),this._marginH=Math.ceil(.3*this.fontSize+this.strokeWidth/2),void 0===t._environmentMinimumFontSize&&(t._environmentMinimumFontSize=this.measureMinimumFontSize())}return t.prototype.create=function(t){var r=null,i=this._glyphAreas[t];return i||((i=function(t){for(var e=t.width,r=t.height,i=0,n=0,o=0,s=0,a=t.height;s<a;s=s+1|0)for(var u=0,c=t.width;u<c;u=u+1|0)0!==t.data[o+3]&&(u<e&&(e=u),u>i&&(i=u),s<r&&(r=s),s>n&&(n=s)),o+=4;return e===t.width?{x:0,y:0,width:0,height:0}:{x:e,y:r,width:i-e+1,height:n-r+1}}((r=e(t,this.fontSize,this._cssFontFamily,this.baselineHeight,this._marginW,this._marginH,!0,this.fontColor,this.strokeWidth,this.strokeColor,this.strokeOnly,this.fontWeight)).imageData)).advanceWidth=r.advanceWidth,this._glyphAreas[t]=i),function(t){return 0===t.width||0===t.height}(i)?(r&&r.surface.destroy(),n(t,0,0,0,0,0,0,i.advanceWidth,void 0,!0)):(r||(r=e(t,this.fontSize,this._cssFontFamily,this.baselineHeight,this._marginW,this._marginH,!1,this.fontColor,this.strokeWidth,this.strokeColor,this.strokeOnly,this.fontWeight)),n(t,i.x,i.y,i.width,i.height,i.x-this._marginW,i.y-this._marginH,i.advanceWidth,r.surface,!0))},t.prototype.measureMinimumFontSize=function(){var t,e=1,r=document.createElement("canvas").getContext("2d");if(!r)throw new Error("GlyphFactory#measureMinimumFontSize(): could not initialize CanvasRenderingContext2D");r.textAlign="left",r.textBaseline="alphabetic",r.lineJoin="bevel",r.font=e+"px sans-serif";var i=r.measureText("M").width;do{t=i,e+=1,r.font=e+"px sans-serif",i=r.measureText("M").width}while(t===i||e>50);return e},t}();return iu.GlyphFactory=o,iu}var ou,su={},au={};function uu(){return ou||(ou=1,Object.defineProperty(au,"__esModule",{value:!0}),au.RenderingHelper=void 0,function(t){t.toPowerOfTwo=function(t){if(0!=(t&t-1)){for(var e=1;e<t;)e*=2;return e}return t},t.clamp=function(t){return Math.min(Math.max(t,0),1)},t.usedWebGL=function(t){var e;if(!t||0===t.length)return!1;var r=t[0];if("string"==typeof r){if("webgl"===r)return{type:"webgl",options:{enableDepthBuffer:!1}}}else if("webgl"===r.type){return{type:"webgl",options:{enableDepthBuffer:!!(null===(e=r.options)||void 0===e?void 0:e.enableDepthBuffer)}}}return!1}}(t||(au.RenderingHelper=t={}))),au;var t}var cu,hu={},lu={},du={},pu={},fu={};var _u,yu,vu,gu={};function mu(){if(_u)return gu;_u=1,Object.defineProperty(gu,"__esModule",{value:!0}),gu.WebGLRenderingState=void 0;var t=os(),e=function(){function e(e){e?(this.globalAlpha=e.globalAlpha,this.globalCompositeOperation=e.globalCompositeOperation,this.transformer=new t.AffineTransformer(e.transformer),this.shaderProgram=e.shaderProgram):(this.globalAlpha=1,this.globalCompositeOperation="source-over",this.transformer=new t.AffineTransformer,this.shaderProgram=null)}return e.prototype.copyFrom=function(t){return this.globalAlpha=t.globalAlpha,this.globalCompositeOperation=t.globalCompositeOperation,this.transformer.copyFrom(t.transformer),this.shaderProgram=t.shaderProgram,this},e}();return gu.WebGLRenderingState=e,gu}function Au(){if(yu)return pu;yu=1,Object.defineProperty(pu,"__esModule",{value:!0}),pu.WebGLRenderer=void 0;var t=function(){if(cu)return fu;cu=1,Object.defineProperty(fu,"__esModule",{value:!0}),fu.WebGLColor=void 0;var t,e=uu();return function(t){t.colorMap={ALICEBLUE:[240/255,248/255,1,1],ANTIQUEWHITE:[250/255,235/255,215/255,1],AQUA:[0,1,1,1],AQUAMARINE:[127/255,1,212/255,1],AZURE:[240/255,1,1,1],BEIGE:[245/255,245/255,220/255,1],BISQUE:[1,228/255,196/255,1],BLACK:[0,0,0,1],BLANCHEDALMOND:[1,235/255,205/255,1],BLUE:[0,0,1,1],BLUEVIOLET:[138/255,43/255,226/255,1],BROWN:[165/255,42/255,42/255,1],BURLYWOOD:[222/255,184/255,135/255,1],CADETBLUE:[95/255,158/255,160/255,1],CHARTREUSE:[127/255,1,0,1],CHOCOLATE:[210/255,105/255,30/255,1],CORAL:[1,127/255,80/255,1],CORNFLOWERBLUE:[100/255,149/255,237/255,1],CORNSILK:[1,248/255,220/255,1],CRIMSON:[220/255,20/255,60/255,1],CYAN:[0,1,1,1],DARKBLUE:[0,0,139/255,1],DARKCYAN:[0,139/255,139/255,1],DARKGOLDENROD:[184/255,134/255,11/255,1],DARKGRAY:[169/255,169/255,169/255,1],DARKGREEN:[0,100/255,0,1],DARKGREY:[169/255,169/255,169/255,1],DARKKHAKI:[189/255,183/255,107/255,1],DARKMAGENTA:[139/255,0,139/255,1],DARKOLIVEGREEN:[85/255,107/255,47/255,1],DARKORANGE:[1,140/255,0,1],DARKORCHID:[.6,50/255,.8,1],DARKRED:[139/255,0,0,1],DARKSALMON:[233/255,150/255,122/255,1],DARKSEAGREEN:[143/255,188/255,143/255,1],DARKSLATEBLUE:[72/255,61/255,139/255,1],DARKSLATEGRAY:[47/255,79/255,79/255,1],DARKSLATEGREY:[47/255,79/255,79/255,1],DARKTURQUOISE:[0,206/255,209/255,1],DARKVIOLET:[148/255,0,211/255,1],DEEPPINK:[1,20/255,147/255,1],DEEPSKYBLUE:[0,191/255,1,1],DIMGRAY:[105/255,105/255,105/255,1],DIMGREY:[105/255,105/255,105/255,1],DODGERBLUE:[30/255,144/255,1,1],FIREBRICK:[178/255,34/255,34/255,1],FLORALWHITE:[1,250/255,240/255,1],FORESTGREEN:[34/255,139/255,34/255,1],FUCHSIA:[1,0,1,1],GAINSBORO:[220/255,220/255,220/255,1],GHOSTWHITE:[248/255,248/255,1,1],GOLD:[1,215/255,0,1],GOLDENROD:[218/255,165/255,32/255,1],GRAY:[128/255,128/255,128/255,1],GREEN:[0,128/255,0,1],GREENYELLOW:[173/255,1,47/255,1],GREY:[128/255,128/255,128/255,1],HONEYDEW:[240/255,1,240/255,1],HOTPINK:[1,105/255,180/255,1],INDIANRED:[205/255,92/255,92/255,1],INDIGO:[75/255,0,130/255,1],IVORY:[1,1,240/255,1],KHAKI:[240/255,230/255,140/255,1],LAVENDER:[230/255,230/255,250/255,1],LAVENDERBLUSH:[1,240/255,245/255,1],LAWNGREEN:[124/255,252/255,0,1],LEMONCHIFFON:[1,250/255,205/255,1],LIGHTBLUE:[173/255,216/255,230/255,1],LIGHTCORAL:[240/255,128/255,128/255,1],LIGHTCYAN:[224/255,1,1,1],LIGHTGOLDENRODYELLOW:[250/255,250/255,210/255,1],LIGHTGRAY:[211/255,211/255,211/255,1],LIGHTGREEN:[144/255,238/255,144/255,1],LIGHTGREY:[211/255,211/255,211/255,1],LIGHTPINK:[1,182/255,193/255,1],LIGHTSALMON:[1,160/255,122/255,1],LIGHTSEAGREEN:[32/255,178/255,170/255,1],LIGHTSKYBLUE:[135/255,206/255,250/255,1],LIGHTSLATEGRAY:[119/255,136/255,.6,1],LIGHTSLATEGREY:[119/255,136/255,.6,1],LIGHTSTEELBLUE:[176/255,196/255,222/255,1],LIGHTYELLOW:[1,1,224/255,1],LIME:[0,1,0,1],LIMEGREEN:[50/255,205/255,50/255,1],LINEN:[250/255,240/255,230/255,1],MAGENTA:[1,0,1,1],MAROON:[128/255,0,0,1],MEDIUMAQUAMARINE:[.4,205/255,170/255,1],MEDIUMBLUE:[0,0,205/255,1],MEDIUMORCHID:[186/255,85/255,211/255,1],MEDIUMPURPLE:[147/255,112/255,219/255,1],MEDIUMSEAGREEN:[60/255,179/255,113/255,1],MEDIUMSLATEBLUE:[123/255,104/255,238/255,1],MEDIUMSPRINGGREEN:[0,250/255,154/255,1],MEDIUMTURQUOISE:[72/255,209/255,.8,1],MEDIUMVIOLETRED:[199/255,21/255,133/255,1],MIDNIGHTBLUE:[25/255,25/255,112/255,1],MINTCREAM:[245/255,1,250/255,1],MISTYROSE:[1,228/255,225/255,1],MOCCASIN:[1,228/255,181/255,1],NAVAJOWHITE:[1,222/255,173/255,1],NAVY:[0,0,128/255,1],OLDLACE:[253/255,245/255,230/255,1],OLIVE:[128/255,128/255,0,1],OLIVEDRAB:[107/255,142/255,35/255,1],ORANGE:[1,165/255,0,1],ORANGERED:[1,69/255,0,1],ORCHID:[218/255,112/255,214/255,1],PALEGOLDENROD:[238/255,232/255,170/255,1],PALEGREEN:[152/255,251/255,152/255,1],PALETURQUOISE:[175/255,238/255,238/255,1],PALEVIOLETRED:[219/255,112/255,147/255,1],PAPAYAWHIP:[1,239/255,213/255,1],PEACHPUFF:[1,218/255,185/255,1],PERU:[205/255,133/255,63/255,1],PINK:[1,192/255,203/255,1],PLUM:[221/255,160/255,221/255,1],POWDERBLUE:[176/255,224/255,230/255,1],PURPLE:[128/255,0,128/255,1],RED:[1,0,0,1],ROSYBROWN:[188/255,143/255,143/255,1],ROYALBLUE:[65/255,105/255,225/255,1],SADDLEBROWN:[139/255,69/255,19/255,1],SALMON:[250/255,128/255,114/255,1],SANDYBROWN:[244/255,164/255,96/255,1],SEAGREEN:[46/255,139/255,87/255,1],SEASHELL:[1,245/255,238/255,1],SIENNA:[160/255,82/255,45/255,1],SILVER:[192/255,192/255,192/255,1],SKYBLUE:[135/255,206/255,235/255,1],SLATEBLUE:[106/255,90/255,205/255,1],SLATEGRAY:[112/255,128/255,144/255,1],SLATEGREY:[112/255,128/255,144/255,1],SNOW:[1,250/255,250/255,1],SPRINGGREEN:[0,1,127/255,1],STEELBLUE:[70/255,130/255,180/255,1],TAN:[210/255,180/255,140/255,1],TEAL:[0,128/255,128/255,1],THISTLE:[216/255,191/255,216/255,1],TOMATO:[1,99/255,71/255,1],TURQUOISE:[64/255,224/255,208/255,1],VIOLET:[238/255,130/255,238/255,1],WHEAT:[245/255,222/255,179/255,1],WHITE:[1,1,1,1],WHITESMOKE:[245/255,245/255,245/255,1],YELLOW:[1,1,0,1],YELLOWGREEN:[154/255,205/255,50/255,1]},t.get=function(r){var i="string"==typeof r?t._toColor(r):[r[0],r[1],r[2],r[3]];return i[3]=e.RenderingHelper.clamp(i[3]),i[0]=e.RenderingHelper.clamp(i[0])*i[3],i[1]=e.RenderingHelper.clamp(i[1])*i[3],i[2]=e.RenderingHelper.clamp(i[2])*i[3],i},t._hsl2rgb=function(t){var e=t[0]%360,r=t[1],i=t[2]>50?100-t[2]:t[2],n=t[3],o=i+i*r,s=i-i*r;return e<60?[o,e/60*(o-s)+s,s,n]:e<120?[(120-e)/60*(o-s)+s,o,s,n]:e<180?[s,o,(e-120)/60*(o-s)+s,n]:e<240?[s,(240-e)/60*(o-s)+s,o,n]:e<300?[(e-240)/60*(o-s)+s,s,o,n]:[o,s,(360-e)/60*(o-s)+s,n]},t._toColor=function(r){var i=r.toUpperCase().replace(/\s+/g,""),n=t.colorMap[i];if(n)return n;if(i.match(/^#([\dA-F])([\dA-F])([\dA-F])$/))return[parseInt(RegExp.$1,16)/15,parseInt(RegExp.$2,16)/15,parseInt(RegExp.$3,16)/15,1];if(i.match(/^#([\dA-F]{2})([\dA-F]{2})([\dA-F]{2})$/))return[parseInt(RegExp.$1,16)/255,parseInt(RegExp.$2,16)/255,parseInt(RegExp.$3,16)/255,1];if(i.match(/^RGB\((\d{1,3}),(\d{1,3}),(\d{1,3})\)$/))return[parseInt(RegExp.$1,10)/255,parseInt(RegExp.$2,10)/255,parseInt(RegExp.$3,10)/255,1];if(i.match(/^RGBA\((\d{1,3}),(\d{1,3}),(\d{1,3}),(\d(\.\d*)?)\)$/))return[parseInt(RegExp.$1,10)/255,parseInt(RegExp.$2,10)/255,parseInt(RegExp.$3,10)/255,parseFloat(RegExp.$4)];if(i.match(/^HSL\((\d{1,3}),(\d{1,3})%,(\d{1,3})%\)$/))return t._hsl2rgb([parseInt(RegExp.$1,10),e.RenderingHelper.clamp(parseInt(RegExp.$2,10)/100),e.RenderingHelper.clamp(parseInt(RegExp.$3,10)/100),1]);if(i.match(/^HSLA\((\d{1,3}),(\d{1,3})%,(\d{1,3})%,(\d(\.\d*)?)\)$/))return t._hsl2rgb([parseInt(RegExp.$1,10),e.RenderingHelper.clamp(parseInt(RegExp.$2,10)/100),e.RenderingHelper.clamp(parseInt(RegExp.$3,10)/100),parseFloat(RegExp.$4)]);throw Error("illigal cssColor format: "+i)}}(t||(fu.WebGLColor=t={})),fu}(),e=mu(),r=function(){function r(t,e){this._stateStack=[],this._stateStackPointer=0,this._capacity=0,this._reallocation(r.DEFAULT_CAPACITY),this._whiteColor=[1,1,1,1],this._shared=t,this._renderTarget=e}return r.prototype.clear=function(){this._shared.clear()},r.prototype.begin=function(){},r.prototype.end=function(){this._shared.end()},r.prototype.save=function(){this._pushState()},r.prototype.restore=function(){this._popState()},r.prototype.translate=function(t,e){this.currentState().transformer.translate(t,e)},r.prototype.transform=function(t){this.currentState().transformer.transform(t)},r.prototype.opacity=function(t){this.currentState().globalAlpha*=t},r.prototype.setCompositeOperation=function(t){this.currentState().globalCompositeOperation=t},r.prototype.currentState=function(){return this._stateStack[this._stateStackPointer]},r.prototype.fillRect=function(e,r,i,n,o){this._shared.draw(this.currentState(),this._shared.getFillRectSurfaceTexture(),0,0,i,n,e,r,t.WebGLColor.get(o))},r.prototype.drawSprites=function(t,e,r,i,n,o,s,a){for(var u=0;u<a;++u)this.drawImage(t,e[u],r[u],i[u],n[u],o[u],s[u])},r.prototype.drawImage=function(t,e,r,i,n,o,s){if(!t._drawable)throw new Error("WebGLRenderer#drawImage: no drawable surface.");if(t._drawable.texture instanceof WebGLTexture||this._shared.makeTextureForSurface(t),!t._drawable.texture)throw new Error("WebGLRenderer#drawImage: could not create a texture.");this._shared.draw(this.currentState(),t._drawable,e,r,i,n,o,s,this._whiteColor)},r.prototype.setTransform=function(t){this.currentState().transformer.setTransform(t)},r.prototype.setOpacity=function(t){this.currentState().globalAlpha=t},r.prototype.setShaderProgram=function(t){this.currentState().shaderProgram=this._shared.initializeShaderProgram(t)},r.prototype.isSupportedShaderProgram=function(){return!0},r.prototype.changeViewportSize=function(t,e){var r=this._renderTarget;this._renderTarget={width:r.width,height:r.height,viewportWidth:t,viewportHeight:e,texture:r.texture,framebuffer:r.framebuffer}},r.prototype.getContext=function(){return this._shared.getContext()},r.prototype.flush=function(){return this._shared.flush()},r.prototype.destroy=function(){this._shared.requestDeleteRenderTarget(this._renderTarget),this._shared=void 0,this._renderTarget=void 0,this._whiteColor=void 0},r.prototype._getImageData=function(){throw new Error("WebGLRenderer#_getImageData() is not implemented")},r.prototype._putImageData=function(t,e,r,i,n,o,s){throw new Error("WebGLRenderer#_putImageData() is not implemented")},r.prototype._pushState=function(){var t=this.currentState();++this._stateStackPointer,this._isOverCapacity()&&this._reallocation(this._stateStackPointer+1),this.currentState().copyFrom(t)},r.prototype._popState=function(){if(!(this._stateStackPointer>0))throw new Error("WebGLRenderer#restore: state stack under-flow.");this.currentState().shaderProgram=null,--this._stateStackPointer},r.prototype._isOverCapacity=function(){return this._capacity<=this._stateStackPointer},r.prototype._reallocation=function(t){var r=this._capacity;if(r<t){t<2*r?this._capacity*=2:this._capacity=t;for(var i=r;i<this._capacity;++i)this._stateStack.push(new e.WebGLRenderingState)}},r.DEFAULT_CAPACITY=16,r}();return pu.WebGLRenderer=r,pu}var wu,xu,Su,bu={},Pu={};function Eu(){if(xu)return bu;xu=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(bu,"__esModule",{value:!0}),bu.WebGLPrimarySurface=void 0;var r=Zo(),i=function(){if(wu)return Pu;wu=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Pu,"__esModule",{value:!0}),Pu.WebGLPrimarySurfaceRenderer=void 0;var r=function(e){function r(t,r){var i=e.call(this,t,r)||this;return i._shared.pushRenderTarget(i._renderTarget),i}return t(r,e),r.prototype.begin=function(){e.prototype.begin.call(this),this._shared.begin()},r}(Au().WebGLRenderer);return Pu.WebGLPrimarySurfaceRenderer=r,Pu}(),n=function(e){function r(t,r,i){var n=e.call(this,r,i)||this;return n.canvas.style.position="absolute",n._shared=t,n}return t(r,e),r.prototype.renderer=function(){return this._renderer||(this._renderer=new i.WebGLPrimarySurfaceRenderer(this._shared,this._shared.getPrimaryRenderTarget(this.width,this.height))),this._renderer},r.prototype.changePhysicalScale=function(t,e){var r=Math.ceil(this.width*t),i=Math.ceil(this.height*e);this.canvas.width=r,this.canvas.height=i,this.renderer().changeViewportSize(r,i)},r.prototype.isPlaying=function(){return!1},r}(r.CanvasSurface);return bu.WebGLPrimarySurface=n,bu}function Ou(){if(Su)return lu;Su=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(lu,"__esModule",{value:!0}),lu.WebGLBackSurface=void 0;var r=function(){if(vu)return du;vu=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(du,"__esModule",{value:!0}),du.WebGLBackSurfaceRenderer=void 0;var r=Au(),i=mu(),n=function(e){function r(t,r){var i=e.call(this,r,r.createRenderTarget(t.width,t.height))||this;return t._drawable={texture:i._renderTarget.texture,textureOffsetX:0,textureOffsetY:0,textureWidth:t.width,textureHeight:t.height},i}return t(r,e),r.prototype.begin=function(){e.prototype.begin.call(this),this.save();var t=new i.WebGLRenderingState(this.currentState()),r=t.transformer.matrix;r[1]*=-1,r[3]*=-1,r[5]=-r[5]+this._renderTarget.height,this.currentState().copyFrom(t),this._shared.pushRenderTarget(this._renderTarget)},r.prototype.end=function(){this.restore(),this._shared.popRenderTarget(),e.prototype.end.call(this)},r}(r.WebGLRenderer);return du.WebGLBackSurfaceRenderer=n,du}(),i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i.prototype.renderer=function(){return this._renderer||(this._renderer=new r.WebGLBackSurfaceRenderer(this,this._shared)),this._renderer},i.prototype.destroy=function(){this._renderer&&this._renderer.destroy(),this._renderer=void 0,this._drawable=void 0,e.prototype.destroy.call(this)},i}(Eu().WebGLPrimarySurface);return lu.WebGLBackSurface=i,lu}var Tu,Mu={};var Cu,Lu,Ru,Iu={},Fu={};function ju(){if(Lu)return Iu;Lu=1,Object.defineProperty(Iu,"__esModule",{value:!0}),Iu.WebGLTextureAtlas=void 0;var t=uu(),e=function(){if(Cu)return Fu;Cu=1,Object.defineProperty(Fu,"__esModule",{value:!0}),Fu.WebGLTextureMap=void 0;var t=function(){function t(t,e,r,i,n){this._left=null,this._right=null,this._surface=null,this.texture=t,this.offsetX=e,this.offsetY=r,this._width=i,this._height=n}return t.prototype.dispose=function(){this._left&&(this._left.dispose(),this._left=null),this._right&&(this._right.dispose(),this._right=null),this._surface&&(this._surface._drawable&&(this._surface._drawable.texture=null),this._surface=null)},t.prototype.capacity=function(){return this._width*this._height},t.prototype.area=function(){if(!this._surface)return 0;var t=this._surface._drawable,e=t.width*t.height;return this._left&&(e+=this._left.area()),this._right&&(e+=this._right.area()),e},t.prototype.occupancy=function(){return this.area()/this.capacity()},t.prototype.insert=function(e){var r=e._drawable,i=r.width+t.TEXTURE_MARGIN,n=r.height+t.TEXTURE_MARGIN;if(this._surface){if(this._left){var o=this._left.insert(e);if(o)return o}if(this._right){var s=this._right.insert(e);if(s)return s}return null}if(this._width<i||this._height<n)return null;var a=this._width-i,u=this._height-n;return a<=u?(this._left=new t(this.texture,this.offsetX+i,this.offsetY,a,n),this._right=new t(this.texture,this.offsetX,this.offsetY+n,this._width,u)):(this._left=new t(this.texture,this.offsetX,this.offsetY+n,i,u),this._right=new t(this.texture,this.offsetX+i,this.offsetY,a,this._height)),this._surface=e,this},t.TEXTURE_MARGIN=1,t}();return Fu.WebGLTextureMap=t,Fu}(),r=function(){function r(){this._maps=[],this._insertPos=0,this.emptyTexturePixels=new Uint8Array(r.TEXTURE_SIZE*r.TEXTURE_SIZE*4)}return r.prototype.clear=function(){for(var t=0;t<this._maps.length;++t)this._maps[t].dispose()},r.prototype.showOccupancy=function(){for(var t=0;t<this._maps.length;++t)console.log("occupancy["+t+"]: "+this._maps[t].occupancy())},r.prototype.makeTextureForSurface=function(e,i){var n=i._drawable;if(n&&!n.texture){var o=n.width,s=n.height;if(o>=r.TEXTURE_SIZE||s>=r.TEXTURE_SIZE){var a=t.RenderingHelper.toPowerOfTwo(n.width),u=t.RenderingHelper.toPowerOfTwo(n.height);if(a!==n.width||u!==n.height){var c=document.createElement("canvas");c.width=a,c.height=u;var h=c.getContext("2d");if(!h)throw new Error("WebGLTextureAtlas#makeTextureForSurface(): could not initialize CanvasRenderingContext2D");h.globalCompositeOperation="copy",h.drawImage(n,0,0),n=h.getImageData(0,0,a,u)}return i._drawable.texture=e.makeTexture(n),i._drawable.textureOffsetX=0,i._drawable.textureOffsetY=0,i._drawable.textureWidth=a,void(i._drawable.textureHeight=u)}this._assign(e,i,this._maps)}},r.prototype._assign=function(t,i,n){for(var o=null,s=0;s<n.length;++s)if(o=n[(s+this._insertPos)%n.length].insert(i))return this._register(t,o,i._drawable),void(this._insertPos=s);o=null,n.length>=r.TEXTURE_COUNT&&(o=n.shift(),t.disposeTexture(o.texture),o.dispose(),t.clearTexture(this.emptyTexturePixels,r.TEXTURE_SIZE,r.TEXTURE_SIZE,o.texture)),o||(o=new e.WebGLTextureMap(t.makeTextureRaw(r.TEXTURE_SIZE,r.TEXTURE_SIZE),0,0,r.TEXTURE_SIZE,r.TEXTURE_SIZE)),n.push(o),o=o.insert(i),this._register(t,o,i._drawable)},r.prototype._register=function(t,e,i){i.texture=e.texture,i.textureOffsetX=e.offsetX,i.textureOffsetY=e.offsetY,i.textureWidth=r.TEXTURE_SIZE,i.textureHeight=r.TEXTURE_SIZE,t.assignTexture(i,e.offsetX,e.offsetY,e.texture)},r.TEXTURE_SIZE=1024,r.TEXTURE_COUNT=16,r}();return Iu.WebGLTextureAtlas=r,Iu}function Du(){if(Ru)return hu;Ru=1,Object.defineProperty(hu,"__esModule",{value:!0}),hu.WebGLSharedObject=void 0;var t=Ou(),e=Eu(),r=function(){if(Tu)return Mu;Tu=1,Object.defineProperty(Mu,"__esModule",{value:!0}),Mu.WebGLShaderProgram=void 0;var t=function(){function t(e,r,i){void 0===i&&(i=Object.create(null));var n=t._DEFAULT_VERTEX_SHADER;r=r||t._DEFAULT_FRAGMENT_SHADER;var o=t._makeShaderProgram(e,n,r);this.program=o,this._context=e,this._aVertex=e.getAttribLocation(this.program,"aVertex");var s=e.getUniformLocation(this.program,"uColor");if(!s)throw new Error("WebGLShaderProgram#constructor: could not get UniformLocation of 'uColor'");var a=e.getUniformLocation(this.program,"uAlpha");if(!a)throw new Error("WebGLShaderProgram#constructor: could not get UniformLocation of 'uAlpha'");var u=e.getUniformLocation(this.program,"uSampler");if(!u)throw new Error("WebGLShaderProgram#constructor: could not get UniformLocation of 'uSampler'");this._uColor=s,this._uAlpha=a,this._uSampler=u,this._uniforms=i,this._uniformCaches=[],this._uniformSetterTable={float:this._uniform1f.bind(this),int:this._uniform1i.bind(this),float_v:this._uniform1fv.bind(this),int_v:this._uniform1iv.bind(this),vec2:this._uniform2fv.bind(this),vec3:this._uniform3fv.bind(this),vec4:this._uniform4fv.bind(this),ivec2:this._uniform2iv.bind(this),ivec3:this._uniform3iv.bind(this),ivec4:this._uniform4iv.bind(this),mat2:this._uniformMatrix2fv.bind(this),mat3:this._uniformMatrix3fv.bind(this),mat4:this._uniformMatrix4fv.bind(this)}}return t._makeShader=function(t,e,r){var i=t.createShader(e);if(!i)throw new Error("WebGLShaderProgram._makeShader(): WebGLShader could not initialize");if(t.shaderSource(i,r),t.compileShader(i),!t.getShaderParameter(i,t.COMPILE_STATUS)){var n=t.getShaderInfoLog(i);throw t.deleteShader(i),new Error(null!=n?n:"WebGLShaderProgram._makeShader(): unknown gl error")}return i},t._makeShaderProgram=function(e,r,i){var n=e.createProgram();if(!n)throw new Error("WebGLShaderProgram._makeShaderProgram(): WebGLProgram could not initialize");var o=t._makeShader(e,e.VERTEX_SHADER,r);e.attachShader(n,o),e.deleteShader(o);var s=t._makeShader(e,e.FRAGMENT_SHADER,i);if(e.attachShader(n,s),e.deleteShader(s),e.linkProgram(n),!e.getProgramParameter(n,e.LINK_STATUS)){var a=e.getProgramInfoLog(n);throw e.deleteProgram(n),new Error(null!=a?a:"WebGLShaderProgram._makeShaderProgram(): unknown gl error")}return n},t.prototype.set_aVertex=function(t){this._context.bindBuffer(this._context.ARRAY_BUFFER,t),this._context.enableVertexAttribArray(this._aVertex),this._context.vertexAttribPointer(this._aVertex,4,this._context.FLOAT,!1,0,0)},t.prototype.set_uColor=function(t){this._context.uniform4f(this._uColor,t[0],t[1],t[2],t[3])},t.prototype.set_uAlpha=function(t){this._context.uniform1f(this._uAlpha,t)},t.prototype.set_uSampler=function(t){this._context.uniform1i(this._uSampler,t)},t.prototype.updateUniforms=function(){for(var t=0;t<this._uniformCaches.length;++t){var e=this._uniformCaches[t],r=this._uniforms[e.name].value;(e.isArray||r!==e.beforeValue)&&(e.update(e.loc,r),e.beforeValue=r)}},t.prototype.initializeUniforms=function(){var t=this,e=[],r=this._uniforms;null!=r&&Object.keys(r).forEach((function(i){var n=r[i].type,o=!("number"==typeof r[i].value);!o||"int"!==n&&"float"!==n||(n+="_v");var s=t._uniformSetterTable[n];if(!s)throw new Error("WebGLShaderProgram#initializeUniforms: Uniform type '".concat(n,"' is not supported."));var a=t._context.getUniformLocation(t.program,i);if(!a)throw new Error("WebGLShaderProgram#initializeUniforms: could not get UniformLocation of '".concat(i,"'."));e.push({name:i,update:s,beforeValue:null,isArray:o,loc:a})})),this._uniformCaches=e},t.prototype.use=function(){this._context.useProgram(this.program)},t.prototype.unuse=function(){this._context.useProgram(null)},t.prototype.destroy=function(){this._context.deleteProgram(this.program)},t.prototype._uniform1f=function(t,e){this._context.uniform1f(t,e)},t.prototype._uniform1i=function(t,e){this._context.uniform1i(t,e)},t.prototype._uniform1fv=function(t,e){this._context.uniform1fv(t,e)},t.prototype._uniform1iv=function(t,e){this._context.uniform1iv(t,e)},t.prototype._uniform2fv=function(t,e){this._context.uniform2fv(t,e)},t.prototype._uniform3fv=function(t,e){this._context.uniform3fv(t,e)},t.prototype._uniform4fv=function(t,e){this._context.uniform4fv(t,e)},t.prototype._uniform2iv=function(t,e){this._context.uniform2iv(t,e)},t.prototype._uniform3iv=function(t,e){this._context.uniform3iv(t,e)},t.prototype._uniform4iv=function(t,e){this._context.uniform4iv(t,e)},t.prototype._uniformMatrix2fv=function(t,e){this._context.uniformMatrix2fv(t,!1,e)},t.prototype._uniformMatrix3fv=function(t,e){this._context.uniformMatrix3fv(t,!1,e)},t.prototype._uniformMatrix4fv=function(t,e){this._context.uniformMatrix4fv(t,!1,e)},t._DEFAULT_VERTEX_SHADER="#version 100\nprecision mediump float;\nattribute vec4 aVertex;\nvarying vec2 vTexCoord;\nvarying vec4 vColor;\nuniform vec4 uColor;\nuniform float uAlpha;\nvoid main() { gl_Position = vec4(aVertex.xy, 0.0, 1.0); vTexCoord = aVertex.zw; vColor = uColor * uAlpha;}",t._DEFAULT_FRAGMENT_SHADER="#version 100\nprecision mediump float;\nvarying vec2 vTexCoord;\nvarying vec4 vColor;\nuniform sampler2D uSampler;\nvoid main() { gl_FragColor = texture2D(uSampler, vTexCoord) * vColor;}",t}();return Mu.WebGLShaderProgram=t,Mu}(),i=ju(),n=function(){function n(t){this._renderTarget=void 0,this._defaultShaderProgram=void 0,this._textureAtlas=void 0,this._fillRectTexture=void 0,this._fillRectSurfaceTexture=void 0,this._maxSpriteCount=void 0,this._vertices=void 0,this._verticesCache=void 0,this._numSprites=void 0,this._renderTargetStack=void 0,this._currentTexture=void 0,this._currentColor=void 0,this._currentAlpha=void 0,this._currentCompositeOperation=void 0,this._currentShaderProgram=void 0,this._compositeOps=void 0,this._deleteRequestedTargets=void 0;var r=t.width,i=t.height,n=!!t.enableDepthBuffer,o=new e.WebGLPrimarySurface(this,r,i),s=o.canvas.getContext("webgl",{depth:n,preserveDrawingBuffer:!0});if(!s)throw new Error("WebGLSharedObject#constructor: could not initialize WebGLRenderingContext");this._enableDepthBuffer=n,this._surface=o,this._context=s,this._init()}return n.prototype.getFillRectSurfaceTexture=function(){return this._fillRectSurfaceTexture},n.prototype.getPrimarySurface=function(){return this._surface},n.prototype.createBackSurface=function(e,r){return new t.WebGLBackSurface(this,e,r)},n.prototype.pushRenderTarget=function(t){this._commit(),this._renderTargetStack.push(t),this._context.bindFramebuffer(this._context.FRAMEBUFFER,t.framebuffer),this._context.viewport(0,0,t.viewportWidth,t.viewportHeight)},n.prototype.popRenderTarget=function(){this._commit(),this._renderTargetStack.pop();var t=this.getCurrentRenderTarget();this._context.bindFramebuffer(this._context.FRAMEBUFFER,t.framebuffer),this._context.viewport(0,0,t.viewportWidth,t.viewportHeight)},n.prototype.getCurrentRenderTarget=function(){return this._renderTargetStack[this._renderTargetStack.length-1]},n.prototype.begin=function(){this.clear(),this._currentShaderProgram.use(),this._currentShaderProgram.set_aVertex(this._vertices),this._currentShaderProgram.set_uColor(this._currentColor),this._currentShaderProgram.set_uAlpha(this._currentAlpha),this._currentShaderProgram.set_uSampler(0),this._currentShaderProgram.updateUniforms()},n.prototype.clear=function(){if(this._enableDepthBuffer)return this._context.depthMask(!0),this._context.clear(this._context.COLOR_BUFFER_BIT|this._context.DEPTH_BUFFER_BIT),void this._context.depthMask(!1);this._context.clear(this._context.COLOR_BUFFER_BIT)},n.prototype.draw=function(t,e,r,i,n,o,s,a,u){var c;if(this._numSprites>=this._maxSpriteCount&&this._commit(),c=e===this._fillRectSurfaceTexture||null==t.shaderProgram||null==t.shaderProgram._program?this._defaultShaderProgram:t.shaderProgram._program,this._currentShaderProgram!==c&&(this._commit(),this._currentShaderProgram=c,this._currentShaderProgram.use(),this._currentShaderProgram.updateUniforms(),this._currentCompositeOperation=null,this._currentAlpha=null,this._currentColor=[],this._currentTexture=null),this._currentTexture!==e.texture&&(this._currentTexture=e.texture,this._commit(),this._context.bindTexture(this._context.TEXTURE_2D,e.texture)),this._currentColor[0]===u[0]&&this._currentColor[1]===u[1]&&this._currentColor[2]===u[2]&&this._currentColor[3]===u[3]||(this._currentColor=u,this._commit(),this._currentShaderProgram.set_uColor(u)),this._currentAlpha!==t.globalAlpha&&(this._currentAlpha=t.globalAlpha,this._commit(),this._currentShaderProgram.set_uAlpha(t.globalAlpha)),this._currentCompositeOperation!==t.globalCompositeOperation){this._currentCompositeOperation=t.globalCompositeOperation,this._commit();var h=this._compositeOps[this._currentCompositeOperation];this._context.blendFunc(h[0],h[1])}var l=1/e.textureWidth,d=1/e.textureHeight,p=e.textureOffsetX,f=e.textureOffsetY,_=l*(p+r+n),y=d*(f+i+o),v=l*(p+r),g=d*(f+i);this._register(this._transformVertex(s,a,n,o,t.transformer),[v,g,_,g,_,y,v,g,_,y,v,y])},n.prototype.end=function(){if(this._commit(),this._deleteRequestedTargets.length>0){for(var t=0;t<this._deleteRequestedTargets.length;++t)this.deleteRenderTarget(this._deleteRequestedTargets[t]);this._deleteRequestedTargets=[]}},n.prototype.makeTextureForSurface=function(t){this._textureAtlas.makeTextureForSurface(this,t)},n.prototype.disposeTexture=function(t){this._currentTexture===t&&this._commit()},n.prototype.assignTexture=function(t,e,r,i){if(this._context.bindTexture(this._context.TEXTURE_2D,i),t instanceof HTMLVideoElement)throw new Error("WebGLRenderer#assignTexture: HTMLVideoElement is not supported.");this._context.texSubImage2D(this._context.TEXTURE_2D,0,e,r,this._context.RGBA,this._context.UNSIGNED_BYTE,t),this._context.bindTexture(this._context.TEXTURE_2D,this._currentTexture)},n.prototype.clearTexture=function(t,e,r,i){this._context.bindTexture(this._context.TEXTURE_2D,i),this._context.texSubImage2D(this._context.TEXTURE_2D,0,0,0,e,r,this._context.RGBA,this._context.UNSIGNED_BYTE,t),this._context.bindTexture(this._context.TEXTURE_2D,this._currentTexture)},n.prototype.makeTextureRaw=function(t,e,r){void 0===r&&(r=null);var i=this._context.createTexture();if(!i)throw new Error("WebGLSharedObject#makeTextureRaw(): could not create WebGLTexture");return this._context.bindTexture(this._context.TEXTURE_2D,i),this._context.pixelStorei(this._context.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_WRAP_S,this._context.CLAMP_TO_EDGE),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_WRAP_T,this._context.CLAMP_TO_EDGE),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_MAG_FILTER,this._context.NEAREST),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_MIN_FILTER,this._context.NEAREST),this._context.texImage2D(this._context.TEXTURE_2D,0,this._context.RGBA,t,e,0,this._context.RGBA,this._context.UNSIGNED_BYTE,r),this._context.bindTexture(this._context.TEXTURE_2D,this._currentTexture),i},n.prototype.makeTexture=function(t){var e=this._context.createTexture();if(!e)throw new Error("WebGLSharedObject#makeTexture(): could not create WebGLTexture");return this._context.bindTexture(this._context.TEXTURE_2D,e),this._context.pixelStorei(this._context.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_WRAP_S,this._context.CLAMP_TO_EDGE),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_WRAP_T,this._context.CLAMP_TO_EDGE),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_MAG_FILTER,this._context.NEAREST),this._context.texParameteri(this._context.TEXTURE_2D,this._context.TEXTURE_MIN_FILTER,this._context.NEAREST),(t instanceof HTMLImageElement||t instanceof HTMLCanvasElement||t instanceof ImageData)&&this._context.texImage2D(this._context.TEXTURE_2D,0,this._context.RGBA,this._context.RGBA,this._context.UNSIGNED_BYTE,t),this._context.bindTexture(this._context.TEXTURE_2D,this._currentTexture),e},n.prototype.getPrimaryRenderTarget=function(t,e){return this._renderTarget},n.prototype.createRenderTarget=function(t,e){var r=this._context,i=r.createFramebuffer();r.bindFramebuffer(r.FRAMEBUFFER,i);var n=r.createTexture();r.bindTexture(r.TEXTURE_2D,n),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,r.RGBA,t,e,0,r.RGBA,r.UNSIGNED_BYTE,null),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n,0),r.bindTexture(r.TEXTURE_2D,this._currentTexture);var o=this.getCurrentRenderTarget();return r.bindFramebuffer(r.FRAMEBUFFER,o.framebuffer),{width:t,height:e,viewportWidth:t,viewportHeight:e,framebuffer:i,texture:n}},n.prototype.requestDeleteRenderTarget=function(t){this._deleteRequestedTargets.push(t)},n.prototype.deleteRenderTarget=function(t){var e=this._context;this.getCurrentRenderTarget()===t&&this._commit(),e.deleteFramebuffer(t.framebuffer),e.deleteTexture(t.texture)},n.prototype.getContext=function(){return this._context},n.prototype.getDefaultShaderProgram=function(){return this._defaultShaderProgram},n.prototype.initializeShaderProgram=function(t){if(t&&!t._program){var e=new r.WebGLShaderProgram(this._context,t.fragmentShader,t.uniforms);e.initializeUniforms(),t._program=e}return t},n.prototype.flush=function(){this._commit()},n.prototype._init=function(){var t=new r.WebGLShaderProgram(this._context);this._textureAtlas=new i.WebGLTextureAtlas,this._fillRectTexture=this.makeTextureRaw(1,1,new Uint8Array([255,255,255,255])),this._fillRectSurfaceTexture={texture:this._fillRectTexture,textureWidth:1,textureHeight:1,textureOffsetX:0,textureOffsetY:0},this._renderTarget={width:this._surface.width,height:this._surface.height,viewportWidth:this._surface.width,viewportHeight:this._surface.height,framebuffer:null,texture:null},this._maxSpriteCount=1024,this._vertices=this._makeBuffer(24*this._maxSpriteCount*4),this._verticesCache=new Float32Array(24*this._maxSpriteCount),this._numSprites=0,this._currentTexture=null,this._currentColor=[1,1,1,1],this._currentAlpha=1,this._currentCompositeOperation="source-over",this._currentShaderProgram=t,this._defaultShaderProgram=t,this._renderTargetStack=[],this._deleteRequestedTargets=[],this._currentShaderProgram.use();try{this._currentShaderProgram.set_aVertex(this._vertices),this._currentShaderProgram.set_uColor(this._currentColor),this._currentShaderProgram.set_uAlpha(this._currentAlpha),this._currentShaderProgram.set_uSampler(0)}finally{this._currentShaderProgram.unuse()}this._context.enable(this._context.BLEND),this._context.activeTexture(this._context.TEXTURE0),this._context.bindTexture(this._context.TEXTURE_2D,this._fillRectTexture),this._compositeOps={"source-atop":[this._context.DST_ALPHA,this._context.ONE_MINUS_SRC_ALPHA],"experimental-source-in":[this._context.DST_ALPHA,this._context.ZERO],"experimental-source-out":[this._context.ONE_MINUS_DST_ALPHA,this._context.ZERO],"source-over":[this._context.ONE,this._context.ONE_MINUS_SRC_ALPHA],"experimental-destination-atop":[this._context.ONE_MINUS_DST_ALPHA,this._context.SRC_ALPHA],"experimental-destination-in":[this._context.ZERO,this._context.SRC_ALPHA],"destination-out":[this._context.ZERO,this._context.ONE_MINUS_SRC_ALPHA],"destination-over":[this._context.ONE_MINUS_DST_ALPHA,this._context.ONE],lighter:[this._context.ONE,this._context.ONE],copy:[this._context.ONE,this._context.ZERO],xor:[this._context.ONE_MINUS_DST_ALPHA,this._context.ONE_MINUS_SRC_ALPHA],difference:[this._context.ONE,this._context.ONE_MINUS_SRC_ALPHA],saturation:[this._context.ONE,this._context.ONE_MINUS_SRC_ALPHA]};var e=this._compositeOps[this._currentCompositeOperation];this._context.blendFunc(e[0],e[1])},n.prototype._makeBuffer=function(t){var e=this._context.createBuffer();if(!e)throw new Error("WebGLSharedObject#_makeBuffer(): could not create WebGLBuffer");return this._context.bindBuffer(this._context.ARRAY_BUFFER,e),this._context.bufferData(this._context.ARRAY_BUFFER,t,this._context.DYNAMIC_DRAW),e},n.prototype._transformVertex=function(t,e,r,i,n){var o=this.getCurrentRenderTarget(),s=2/o.width,a=-2/o.height,u=n.matrix,c=s*r*u[0],h=a*r*u[1],l=s*i*u[2],d=a*i*u[3],p=s*(t*u[0]+e*u[2]+u[4])-1,f=a*(t*u[1]+e*u[3]+u[5])+1;return[p,f,c+p,h+f,c+l+p,h+d+f,p,f,c+l+p,h+d+f,l+p,d+f]},n.prototype._register=function(t,e){var r=6*this._numSprites;++this._numSprites;for(var i=0;i<6;++i)this._verticesCache[4*(i+r)+0]=t[2*i+0],this._verticesCache[4*(i+r)+1]=t[2*i+1],this._verticesCache[4*(i+r)+2]=e[2*i+0],this._verticesCache[4*(i+r)+3]=e[2*i+1]},n.prototype._commit=function(){this._numSprites>0&&(this._context.bindBuffer(this._context.ARRAY_BUFFER,this._vertices),this._context.bufferSubData(this._context.ARRAY_BUFFER,0,this._verticesCache.subarray(0,24*this._numSprites)),this._context.drawArrays(this._context.TRIANGLES,0,6*this._numSprites),this._numSprites=0)},n}();return hu.WebGLSharedObject=n,hu}var ku,Uu,Gu,Hu,Bu={};function Vu(){if(Uu)return su;Uu=1,Object.defineProperty(su,"__esModule",{value:!0}),su.SurfaceFactory=void 0;var t=fs(),e=uu(),r=Du(),i=function(){if(ku)return Bu;ku=1,Object.defineProperty(Bu,"__esModule",{value:!0}),Bu.CanvasDisposer=void 0;var t=function(){function t(){this._idCounter=0,this._canvasMap={},this._registry="undefined"!=typeof FinalizationRegistry?new FinalizationRegistry(this._dispose.bind(this)):null}return t.prototype.register=function(t,e){if(this._registry){var r="".concat(this._idCounter++);this._canvasMap[r]=e,this._registry.register(t,r)}},t.prototype._dispose=function(t){var e=this._canvasMap[t];e&&(e.width=1,e.height=1,delete this._canvasMap[t])},t}();return Bu.CanvasDisposer=t,Bu}(),n=function(){function n(){this._disposer=new i.CanvasDisposer}return n.prototype.createPrimarySurface=function(i,n,o){var s=e.RenderingHelper.usedWebGL(o);return s?(this._shared||(this._shared=new r.WebGLSharedObject({width:i,height:n,enableDepthBuffer:s.options.enableDepthBuffer})),this._shared.getPrimarySurface()):new t.Context2DSurface(i,n)},n.prototype.createBackSurface=function(r,i,n){var o=e.RenderingHelper.usedWebGL(n)?this._shared.createBackSurface(r,i):new t.Context2DSurface(r,i);return this._disposer.register(o,o.getHTMLElement()),o},n}();return su.SurfaceFactory=n,su}function Wu(){if(Gu)return ru;Gu=1,Object.defineProperty(ru,"__esModule",{value:!0}),ru.ResourceFactory=void 0;var t=Vo(),e=ys(),r=ws(),i=Pa(),n=_s(),o=Ps(),s=La(),a=nu(),u=Vu(),c=function(){function c(t){this._audioPluginManager=t.audioPluginManager,this._audioManager=t.audioManager,this._platform=t.platform,this._surfaceFactory=new u.SurfaceFactory}return c.prototype.createAudioAsset=function(t,e,r,i,n,o,s){var a=this._audioPluginManager.getActivePlugin();if(!a)throw new Error("ResourceFactory#createAudioAsset(): could not initialize ActivePlugin");var u=a.createAsset(t,e,r,i,n,o,s);return this._audioManager.registerAudioAsset(u),u.onDestroyed.addOnce(this._onAudioAssetDestroyed,this),u},c.prototype.createAudioPlayer=function(t){var e=this._audioPluginManager.getActivePlugin();if(!e)throw new Error("ResourceFactory#createAudioAsset(): could not initialize ActivePlugin");return e.createPlayer(t,this._audioManager)},c.prototype.createImageAsset=function(t,e,i,n){return new r.HTMLImageAsset(t,e,i,n)},c.prototype.createVideoAsset=function(t,e,r,n,o,s,a){return new i.HTMLVideoAsset(t,e,r,n,o,s,a)},c.prototype.createTextAsset=function(t,e){return new s.XHRTextAsset(t,e)},c.prototype.createScriptAsset=function(t,e,r){return new o.XHRScriptAsset(t,e,r)},c.prototype.createPrimarySurface=function(t,e){return this._surfaceFactory.createPrimarySurface(t,e,this._rendererCandidates)},c.prototype.createSurface=function(t,e){return this._surfaceFactory.createBackSurface(t,e,this._rendererCandidates)},c.prototype.createGlyphFactory=function(t,e,r,i,n,o,s,u){return new a.GlyphFactory(t,e,r,i,n,o,s,u)},c.prototype.createVectorImageAsset=function(t,e,r,i,o){return new n.SVGImageAsset(t,e,r,i,o)},c.prototype.createVectorImageAssetFromString=function(t,r,i){return new e.GeneratedSVGImageAsset(t,r,i)},c.prototype.createBinaryAsset=function(e,r){return new t.BinaryAsset(e,r)},c.prototype._onAudioAssetDestroyed=function(t){this._audioManager.removeAudioAsset(t)},c}();return ru.ResourceFactory=c,ru}function Nu(){if(Hu)return Ma;Hu=1,Object.defineProperty(Ma,"__esModule",{value:!0}),Ma.Platform=void 0;var t=La(),e=Fa(),r=function(){if(Na)return ka;Na=1,Object.defineProperty(ka,"__esModule",{value:!0}),ka.ContainerController=void 0;var t=k(),e=za(),r=function(){function r(e){this.container=void 0,this.surface=void 0,this.inputHandlerLayer=void 0,this.rootView=void 0,this.observer=void 0,this.useResizeForScaling=!1,this.pointEventTrigger=new t.Trigger,this._rendererReq=void 0,this.resourceFactory=e}return r.prototype.initialize=function(t){this._rendererReq=t.rendererRequirement,this._loadView()},r.prototype.setRootView=function(t){t!==this.rootView&&(this.rootView&&(this.unloadView(),this._loadView()),this.rootView=t,this._appendToRootView(t))},r.prototype.resetView=function(t){this.unloadView(),this._rendererReq=t,this._loadView(),this._appendToRootView(this.rootView)},r.prototype.getRenderer=function(){if(!this.surface)throw new Error("this container has no surface");return this.surface.renderer()},r.prototype.changeScale=function(t,e){this.useResizeForScaling?this.surface.changePhysicalScale(t,e):this.surface.changeVisualScale(t,e),this.inputHandlerLayer._inputHandler.setScale(t,e)},r.prototype.unloadView=function(){if(this.inputHandlerLayer.disablePointerEvent(),this.rootView)for(;this.rootView.firstChild;)this.rootView.removeChild(this.rootView.firstChild)},r.prototype.setTabIndex=function(t){this.inputHandlerLayer.setViewTabIndex(t)},r.prototype._loadView=function(){var t=this,r=this._rendererReq,i=r.primarySurfaceWidth,n=r.primarySurfaceHeight;this.container=document.createDocumentFragment(),this.inputHandlerLayer?(this.inputHandlerLayer.setViewSize({width:i,height:n}),this.inputHandlerLayer.pointEventTrigger.removeAll(),this.surface&&!this.surface.destroyed()&&(this.inputHandlerLayer.view.removeChild(this.surface.canvas),this.surface.destroy(),this.observer.disconnect())):this.inputHandlerLayer=new e.InputHandlerLayer({width:i,height:n}),this.surface=this.resourceFactory.createPrimarySurface(i,n);var o=this.surface.getHTMLElement();this.observer=new MutationObserver((function(){t.inputHandlerLayer.view.style.width=o.offsetWidth+"px",t.inputHandlerLayer.view.style.height=o.offsetHeight+"px"})),this.observer.observe(o,{attributeFilter:["width","height","style"]}),this.inputHandlerLayer.view.appendChild(o),this.container.appendChild(this.inputHandlerLayer.view)},r.prototype._appendToRootView=function(t){t.appendChild(this.container),this.inputHandlerLayer.enablePointerEvent(),this.inputHandlerLayer.pointEventTrigger.add(this.pointEventTrigger.fire,this.pointEventTrigger)},r}();return ka.ContainerController=r,ka}(),i=Ka(),n=Za(),o=function(){if(Qa)return tu;Qa=1,Object.defineProperty(tu,"__esModule",{value:!0}),tu.RafLooper=void 0;var t=function(){function t(t){this._timerId=null,this._fun=t,this._prev=0}return t.prototype.start=function(){var t=this,e=function(r){null!=t._timerId&&(t._timerId=requestAnimationFrame(e),t._fun(r-t._prev),t._prev=r)};this._timerId=requestAnimationFrame((function(r){t._timerId=requestAnimationFrame(e),t._fun(0),t._prev=r}))},t.prototype.stop=function(){null!=this._timerId&&cancelAnimationFrame(this._timerId),this._timerId=null,this._prev=0},t}();return tu.RafLooper=t,tu}(),s=Wu(),a=function(){function a(t){this.usingPointerEvents=!0,this.containerView=t.containerView,this.audioPluginManager=new i.AudioPluginManager,t.audioPlugins&&this.audioPluginManager.tryInstallPlugin(t.audioPlugins),this.audioPluginManager.tryInstallPlugin(n.AudioPluginRegistry.getRegisteredAudioPlugins()),this._audioManager=new e.AudioManager,this.amflow=t.amflow,this._platformEventHandler=null,this._resourceFactory=t.resourceFactory||new s.ResourceFactory({audioPluginManager:this.audioPluginManager,platform:this,audioManager:this._audioManager}),this.containerController=new r.ContainerController(this._resourceFactory),this._rendererReq=null,this._disablePreventDefault=!!t.disablePreventDefault}return a.prototype.setPlatformEventHandler=function(t){this.containerController&&(this.containerController.pointEventTrigger.removeAll({owner:this._platformEventHandler}),this.containerController.pointEventTrigger.add(t.onPointEvent,t)),this._platformEventHandler=t},a.prototype.loadGameConfiguration=function(e,r){var i=new t.XHRTextAsset("(game.json)",e);i._load({_onAssetLoad:function(t){r(null,JSON.parse(i.data))},_onAssetError:function(t,e){r(e,null)}})},a.prototype.getResourceFactory=function(){return this._resourceFactory},a.prototype.setRendererRequirement=function(t){var e;t?(this._rendererReq=t,this._resourceFactory._rendererCandidates=null!==(e=this._rendererReq.rendererCandidates)&&void 0!==e?e:[],this.containerController&&!this.containerController.inputHandlerLayer?(this.containerController.initialize({rendererRequirement:t,disablePreventDefault:this._disablePreventDefault}),this.containerController.setRootView(this.containerView),this._platformEventHandler&&this.containerController.pointEventTrigger.add(this._platformEventHandler.onPointEvent,this._platformEventHandler)):this.containerController.resetView(t)):this.containerController&&this.containerController.unloadView()},a.prototype.getPrimarySurface=function(){return this.containerController.surface},a.prototype.getOperationPluginViewInfo=function(){var t=this;return{type:"pdi-browser",view:this.containerController.inputHandlerLayer.view,getScale:function(){return t.containerController.inputHandlerLayer._inputHandler.getScale()}}},a.prototype.createLooper=function(t){return new o.RafLooper(t)},a.prototype.sendToExternal=function(t,e){},a.prototype.registerAudioPlugins=function(t){return this.audioPluginManager.tryInstallPlugin(t)},a.prototype.setScale=function(t,e){this.containerController.changeScale(t,e)},a.prototype.notifyViewMoved=function(){},a.prototype.setMasterVolume=function(t){this._audioManager.setMasterVolume(t)},a.prototype.getMasterVolume=function(){return this._audioManager.getMasterVolume()},a.prototype.setTabIndex=function(t){this.containerController.setTabIndex(t)},a.prototype.destroy=function(){this.setRendererRequirement(void 0),this.setMasterVolume(0)},a}();return Ma.Platform=a,Ma}var Xu,zu={},qu={};function Yu(){if(Xu)return qu;return Xu=1,Object.defineProperty(qu,"__esModule",{value:!0}),qu.addExtname=qu.resolveExtname=qu.detectSupportedFormats=void 0,qu.detectSupportedFormats=function(){var t;if(-1!==navigator.userAgent.indexOf("Edge/"))return["aac"];for(var e=document.createElement("audio"),r=["ogg","m4a","aac","mp4"],i={m4a:"audio/x-m4a"},n=[],o=0,s=r.length;o<s;o++){var a=r[o],u=null!==(t=i[a])&&void 0!==t?t:"audio/"+a;try{var c=e.canPlayType(u);"no"!==c&&""!==c&&n.push(a)}catch(t){}}return n},qu.resolveExtname=function(t,e){if(!t||!t.length)return null;for(var r=0,i=e;r<i.length;r++){var n="."+i[r];if(-1!==t.indexOf(n))return n}return null},qu.addExtname=function(t,e){var r=t.indexOf("?");return-1===r?t+e:t.substring(0,r)+e+t.substring(r,t.length)},qu}var Ku,$u,Ju={},Zu={};function Qu(){if(Ku)return Zu;Ku=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Zu,"__esModule",{value:!0}),Zu.AudioAsset=void 0;var r=function(e){function r(t,r,i,n,o,s,a){var u=e.call(this,t,r)||this;return u.type="audio",u.data=void 0,u.duration=i,u.loop=o,u.hint=s,u._system=n,u.offset=a,u.path=u._modifyPath(u.path),u}return t(r,e),r.prototype.play=function(){var t=this._system.createPlayer();return t.play(this),this._lastPlayedPlayer=t,t},r.prototype.stop=function(){for(var t=this._system.findPlayers(this),e=0;e<t.length;++e)t[e].stop()},r.prototype.inUse=function(){return this._system.findPlayers(this).length>0},r.prototype.destroy=function(){this._system&&this.stop(),this.data=void 0,this._system=void 0,this._lastPlayedPlayer=void 0,e.prototype.destroy.call(this)},r}(Bo().Asset);return Zu.AudioAsset=r,Zu}var tc,ec={},rc={};function ic(){if(tc)return rc;tc=1,Object.defineProperty(rc,"__esModule",{value:!0}),rc.AudioPlayer=void 0;var t=k(),e=function(){function e(e){this.onPlay=new t.Trigger,this.onStop=new t.Trigger,this.played=this.onPlay,this.stopped=this.onStop,this.volume=1,this._muted=!1,this._system=e}return e.prototype.play=function(t){this.currentAudio=t,this.onPlay.fire({player:this,audio:t})},e.prototype.stop=function(){var t=this.currentAudio;t&&(this.currentAudio=void 0,this.onStop.fire({player:this,audio:t}))},e.prototype.canHandleStopped=function(){return!0},e.prototype.changeVolume=function(t){this.volume=t},e.prototype._changeMuted=function(t){},e.prototype._notifyVolumeChanged=function(){this.changeVolume(this.volume)},e}();return rc.AudioPlayer=e,rc}var nc,oc,sc,ac={};function uc(){if(nc)return ac;nc=1,Object.defineProperty(ac,"__esModule",{value:!0}),ac.setupChromeMEIWorkaround=void 0;var t=0,e=[];function r(){i(),document.removeEventListener("keydown",r),document.removeEventListener("mousedown",r),document.removeEventListener("touchend",r)}function i(){t=2,e.forEach((function(t){return t.play()})),e=[]}return ac.setupChromeMEIWorkaround=function(n){var o=null;function s(){switch(t){case 0:case 1:i()}t=2,clearTimeout(o)}switch(t){case 0:n.addEventListener("play",s,!0),o=window.setTimeout((function(){switch(n.removeEventListener("play",s),t){case 0:e.push(n),t=1,document.addEventListener("keydown",r,!0),document.addEventListener("mousedown",r,!0),document.addEventListener("touchend",r,!0);break;case 1:e.push(n);break;case 2:n.play()}}),100);break;case 1:e.push(n)}},ac}function cc(){if(sc)return zu;sc=1,Object.defineProperty(zu,"__esModule",{value:!0}),zu.HTMLAudioPlugin=void 0;var t=Yu(),r=function(){if($u)return Ju;$u=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Ju,"__esModule",{value:!0}),Ju.HTMLAudioAsset=void 0;var r=Qu(),i=jo(),n=Yu(),o=function(e){function r(){var t=null!==e&&e.apply(this,arguments)||this;return t._intervalId=-1,t._intervalCount=0,t}return t(r,e),r.prototype._load=function(t){var e=this;if(null==this.path)return this.data=null,void setTimeout((function(){return t._onAssetLoad(e)}),0);var o=this.createAudioElement(),s=function(t,r){o.autoplay=!1,o.preload="none",o.src=t,e._attachAll(o,r),o.preload="auto",u(o,r),o.load()},a={success:function(){e._detachAll(o,a),e.data=o,t._onAssetLoad(e),window.clearInterval(e._intervalId)},error:function(){e._detachAll(o,a),e.data=o,t._onAssetError(e,i.ExceptionFactory.createAssetLoadError("HTMLAudioAsset loading error")),window.clearInterval(e._intervalId)}},u=function(t,r){e._intervalCount=0,e._intervalId=window.setInterval((function(){4===t.readyState?r.success():(++e._intervalCount,600===e._intervalCount&&r.error())}),100)},c=this.path.indexOf("?");if(".aac"!==(c>=0?this.path.substring(0,c):this.path).slice(-4)||-1===r.supportedFormats.indexOf("mp4"))s(this.path,a);else{var h={success:a.success,error:function(){e._detachAll(o,h),window.clearInterval(e._intervalId),e.path=(0,n.addExtname)(e.originalPath,".mp4"),s(e.path,a)}};s(this.path,h)}},r.prototype.cloneElement=function(){return this.data?this.createAudioElement(this.data.src):null},r.prototype._assetPathFilter=function(t){return-1!==r.supportedFormats.indexOf("ogg")?(0,n.addExtname)(t,".ogg"):-1!==r.supportedFormats.indexOf("aac")?(0,n.addExtname)(t,".aac"):null},r.prototype._modifyPath=function(t){var e,i=(0,n.resolveExtname)(null===(e=this.hint)||void 0===e?void 0:e.extensions,r.supportedFormats);return i?(0,n.addExtname)(this.originalPath,i):t},r.prototype.createAudioElement=function(t){return new Audio(t)},r.prototype._attachAll=function(t,e){e.success&&t.addEventListener("canplaythrough",e.success,!1),e.error&&(t.addEventListener("stalled",e.error,!1),t.addEventListener("error",e.error,!1),t.addEventListener("abort",e.error,!1))},r.prototype._detachAll=function(t,e){e.success&&t.removeEventListener("canplaythrough",e.success,!1),e.error&&(t.removeEventListener("stalled",e.error,!1),t.removeEventListener("error",e.error,!1),t.removeEventListener("abort",e.error,!1))},r}(r.AudioAsset);return Ju.HTMLAudioAsset=o,Ju}(),i=function(){if(oc)return ec;oc=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(ec,"__esModule",{value:!0}),ec.HTMLAudioPlayer=void 0;var r=ic(),i=uc(),n=function(e){function r(t,r){var i=e.call(this,t)||this;return i._audioInstance=null,i._isWaitingPlayEvent=!1,i._isStopRequested=!1,i._assetLoop=!1,i._manager=r,i._endedEventHandler=function(){i._onAudioEnded()},i._onPlayEventHandler=function(){i._onPlayEvent()},i._dummyDurationWaitTimer=null,i}return t(r,e),r.prototype.play=function(t){var r,n;if(this.currentAudio){if(t.id===this.currentAudio.id)return e.prototype.stop.call(this),this._audioInstance.currentTime=(null!==(r=t.offset)&&void 0!==r?r:0)/1e3,void e.prototype.play.call(this,t);this.stop()}var o=t.cloneElement();if(this._assetLoop=t.loop,o){if(t.offset){var s=(null!==(n=t.offset)&&void 0!==n?n:0)/1e3,a=t.duration/1e3+s;o.currentTime=s,o.ontimeupdate=function(){a<=o.currentTime&&(t.loop?o.currentTime=s:o.pause())},o.onended=function(){t.loop&&(o.currentTime=s,o.play())}}else o.loop=t.loop;(0,i.setupChromeMEIWorkaround)(o),o.volume=this._calculateVolume(),o.play().catch((function(t){})),o.addEventListener("ended",this._endedEventHandler,!1),o.addEventListener("play",this._onPlayEventHandler,!1),this._isWaitingPlayEvent=!0,this._audioInstance=o}else this._dummyDurationWaitTimer=setTimeout(this._endedEventHandler,t.duration);e.prototype.play.call(this,t)},r.prototype.stop=function(){this.currentAudio?(this._clearEndedEventHandler(),this._audioInstance&&(this._isWaitingPlayEvent?this._isStopRequested=!0:(this._audioInstance.pause(),this._audioInstance=null)),e.prototype.stop.call(this)):e.prototype.stop.call(this)},r.prototype.changeVolume=function(t){e.prototype.changeVolume.call(this,t),this._audioInstance&&(this._audioInstance.volume=this._calculateVolume())},r.prototype._changeMuted=function(t){e.prototype._changeMuted.call(this,t),this._audioInstance&&(this._audioInstance.volume=this._calculateVolume())},r.prototype.notifyMasterVolumeChanged=function(){this._audioInstance&&(this._audioInstance.volume=this._calculateVolume())},r.prototype._onAudioEnded=function(){this._assetLoop||(this._clearEndedEventHandler(),e.prototype.stop.call(this))},r.prototype._clearEndedEventHandler=function(){this._audioInstance&&this._audioInstance.removeEventListener("ended",this._endedEventHandler,!1),null!=this._dummyDurationWaitTimer&&(clearTimeout(this._dummyDurationWaitTimer),this._dummyDurationWaitTimer=null)},r.prototype._onPlayEvent=function(){var t;this._isWaitingPlayEvent&&(this._isWaitingPlayEvent=!1,this._isStopRequested&&(this._isStopRequested=!1,null===(t=this._audioInstance)||void 0===t||t.pause(),this._audioInstance=null))},r.prototype._calculateVolume=function(){return this._system._muted?0:this.volume*this._system.volume*this._manager.getMasterVolume()},r}(r.AudioPlayer);return ec.HTMLAudioPlayer=n,ec}(),n=function(){function e(){this._supportedFormats=[],this.supportedFormats=(0,t.detectSupportedFormats)()}return e.isSupported=function(){var t=document.createElement("audio"),e=!1;try{e=void 0!==t.canPlayType}catch(t){}return e},Object.defineProperty(e.prototype,"supportedFormats",{get:function(){return this._supportedFormats},set:function(t){this._supportedFormats=t,r.HTMLAudioAsset.supportedFormats=t},enumerable:!1,configurable:!0}),e.prototype.createAsset=function(t,e,i,n,o,s,a){return new r.HTMLAudioAsset(t,e,i,n,o,s,a)},e.prototype.createPlayer=function(t,e){return new i.HTMLAudioPlayer(t,e)},e}();return zu.HTMLAudioPlugin=n,zu}var hc,lc={},dc={};var pc,fc,_c={};function yc(){if(fc)return lc;fc=1,Object.defineProperty(lc,"__esModule",{value:!0}),lc.ProxyAudioPlugin=void 0;var t=function(){if(hc)return dc;hc=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(dc,"__esModule",{value:!0}),dc.ProxyAudioAsset=void 0;var r=Qu(),i=jo(),n=function(e){function r(t,r,i,n,o,s,a,u){var c=e.call(this,r,i,n,o,s,a,u)||this;return c._handlerSet=t,c}return t(r,e),r.prototype.destroy=function(){this._handlerSet.unloadAudioAsset(this.id),e.prototype.destroy.call(this)},r.prototype._load=function(t){var e=this;this._handlerSet.loadAudioAsset({id:this.id,assetPath:this.path,duration:this.duration,loop:this.loop,hint:this.hint,offset:this.offset},(function(r){r?t._onAssetError(e,i.ExceptionFactory.createAssetLoadError(r)):t._onAssetLoad(e)}))},r.prototype._assetPathFilter=function(t){return t},r.prototype._modifyPath=function(t){return t},r}(r.AudioAsset);return dc.ProxyAudioAsset=n,dc}(),r=function(){if(pc)return _c;pc=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(_c,"__esModule",{value:!0}),_c.ProxyAudioPlayer=void 0;var r=function(e){function r(t,r,i){var n=e.call(this,r)||this;return n._audioPlayerId=null,n._handlerSet=t,n._manager=i,n}return t(r,e),r.prototype.changeVolume=function(t){e.prototype.changeVolume.call(this,t),this._notifyVolumeToHandler()},r.prototype._changeMuted=function(t){e.prototype._changeMuted.call(this,t),this._notifyVolumeToHandler()},r.prototype.play=function(t){null!=this._audioPlayerId&&this.stop(),this._audioPlayerId="ap".concat(r._audioPlayerIdCounter++),this._handlerSet.createAudioPlayer({assetId:t.id,audioPlayerId:this._audioPlayerId,isPlaying:!0,volume:this._calculateVolume(),playbackRate:1}),e.prototype.play.call(this,t)},r.prototype.stop=function(){null!=this._audioPlayerId&&(this._handlerSet.stopAudioPlayer(this._audioPlayerId),this._handlerSet.destroyAudioPlayer(this._audioPlayerId),this._audioPlayerId=null),e.prototype.stop.call(this)},r.prototype.notifyMasterVolumeChanged=function(){this._notifyVolumeToHandler()},r.prototype._notifyVolumeToHandler=function(){null!=this._audioPlayerId&&this._handlerSet.changeAudioVolume(this._audioPlayerId,this._calculateVolume())},r.prototype._calculateVolume=function(){return this._system._muted?0:this.volume*this._system.volume*this._manager.getMasterVolume()},r._audioPlayerIdCounter=0,r}(ic().AudioPlayer);return _c.ProxyAudioPlayer=r,_c}(),i=function(){function e(t){this.supportedFormats=[],this._handlerSet=t}return e.isSupported=function(){return!0},e.prototype.createAsset=function(e,r,i,n,o,s,a){return new t.ProxyAudioAsset(this._handlerSet,e,r,i,n,o,s,a)},e.prototype.createPlayer=function(t,e){return new r.ProxyAudioPlayer(this._handlerSet,t,e)},e}();return lc.ProxyAudioPlugin=i,lc}var vc,gc,mc,Ac,wc,xc={},Sc={};function bc(){if(gc)return vc;gc=1;var t,e=window.AudioContext||window.webkitAudioContext;return function(t){t.getAudioContext=function(){window.__akashic__||Object.defineProperty(window,"__akashic__",{value:{},enumerable:!1,configurable:!1,writable:!1});var r=window.__akashic__.audioContext;return r instanceof e||(r=window.__akashic__.audioContext=new e,t._workAroundSafari()),r},t.createGainNode=function(t){return t.createGain?t.createGain():t.createGainNode()},t.createBufferNode=function(t){var e=t.createBufferSource();return e.start||(e.start=e.noteOn,e.stop=e.noteOff),e},t._workAroundSafari=function(){document.addEventListener("touchstart",(function e(){document.removeEventListener("touchstart",e),t.getAudioContext().createBufferSource().start(0)}),!0)}}(t||(t={})),vc=t}function Pc(){if(wc)return Ac;wc=1;var t,e=bc();function r(){e.getAudioContext().resume(),document.removeEventListener("keydown",r),document.removeEventListener("mousedown",r),document.removeEventListener("touchend",r)}return function(t){t.setupChromeMEIWorkaround=function(){var t=e.getAudioContext();if(!t||"function"==typeof t.resume){var i=e.createGainNode(t),n=t.createOscillator();n.type="sawtooth",n.frequency.value=440,n.connect(i),n.start(0);var o=t.state;n.disconnect(),"running"!==o&&(document.addEventListener("keydown",r,!0),document.addEventListener("mousedown",r,!0),document.addEventListener("touchend",r,!0))}}}(t||(t={})),Ac=t}var Ec,Oc,Tc,Mc,Cc,Lc,Rc={};function Ic(){if(Oc)return xc;Oc=1,Object.defineProperty(xc,"__esModule",{value:!0}),xc.WebAudioPlugin=void 0;var t=Yu(),r=function(){if(mc)return Sc;mc=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Sc,"__esModule",{value:!0}),Sc.WebAudioAsset=void 0;var r=Qu(),i=jo(),n=Do(),o=Yu(),s=bc(),a=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t(r,e),r.prototype._load=function(t){var e=this;if(null==this.path)return this.data=null,void setTimeout((function(){return t._onAssetLoad(e)}),0);var r=function(r){e.data=r,t._onAssetLoad(e)},a=function(){t._onAssetError(e,i.ExceptionFactory.createAssetLoadError("WebAudioAsset unknown loading error"))},u=function(t){s.getAudioContext().decodeAudioData(t,r,a)},c=new n.XHRLoader,h=function(t,e,r){c.getArrayBuffer(t,(function(t,i){t?r(t):e(i)}))},l=this.path.indexOf("?");".aac"!==(l>=0?this.path.substring(0,l):this.path).slice(-4)?h(this.path,u,a):h(this.path,u,(function(t){var r=(0,o.addExtname)(e.originalPath,".mp4");h(r,(function(t){e.path=r,u(t)}),a)}))},r.prototype._assetPathFilter=function(t){return-1!==r.supportedFormats.indexOf("ogg")?(0,o.addExtname)(t,".ogg"):-1!==r.supportedFormats.indexOf("aac")?(0,o.addExtname)(t,".aac"):null},r.prototype._modifyPath=function(t){var e,i=(0,o.resolveExtname)(null===(e=this.hint)||void 0===e?void 0:e.extensions,r.supportedFormats);return i?(0,o.addExtname)(this.originalPath,i):t},r.supportedFormats=[],r}(r.AudioAsset);return Sc.WebAudioAsset=a,Sc}(),i=Pc(),n=function(){if(Ec)return Rc;Ec=1;var t=e&&e.__extends||function(){var t=function(e,r){return t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])},t(e,r)};return function(e,r){if("function"!=typeof r&&null!==r)throw new TypeError("Class extends value "+String(r)+" is not a constructor or null");function i(){this.constructor=e}t(e,r),e.prototype=null===r?Object.create(r):(i.prototype=r.prototype,new i)}}();Object.defineProperty(Rc,"__esModule",{value:!0}),Rc.WebAudioPlayer=void 0;var r=ic(),i=bc(),n=function(e){function r(t,r){var n=e.call(this,t)||this;return n._audioContext=i.getAudioContext(),n._manager=r,n._gainNode=i.createGainNode(n._audioContext),n._gainNode.connect(n._audioContext.destination),n._dummyDurationWaitTimer=null,n._endedEventHandler=function(){n._onAudioEnded()},n}return t(r,e),r.prototype.changeVolume=function(t){e.prototype.changeVolume.call(this,t),this._gainNode.gain.value=this._calculateVolume()},r.prototype._changeMuted=function(t){e.prototype._changeMuted.call(this,t),this._gainNode.gain.value=this._calculateVolume()},r.prototype.play=function(t){var r;if(this.currentAudio&&this.stop(),t.data){var n=i.createBufferNode(this._audioContext);if(n.buffer=t.data,this._gainNode.gain.value=this._calculateVolume(),n.connect(this._gainNode),this._sourceNode=n,this._sourceNode.onended=this._endedEventHandler,t.loop)n.loop=t.loop,this._sourceNode.start(0);else{var o=(null!==(r=t.offset)&&void 0!==r?r:0)/1e3;t.duration>0?this._sourceNode.start(0,o,t.duration/1e3):this._sourceNode.start(0,o)}}else this._dummyDurationWaitTimer=setTimeout(this._endedEventHandler,t.duration);e.prototype.play.call(this,t)},r.prototype.stop=function(){this.currentAudio?(this._clearEndedEventHandler(),this._sourceNode&&this._sourceNode.stop(0),e.prototype.stop.call(this)):e.prototype.stop.call(this)},r.prototype.notifyMasterVolumeChanged=function(){this._gainNode.gain.value=this._calculateVolume()},r.prototype._onAudioEnded=function(){this._clearEndedEventHandler(),e.prototype.stop.call(this)},r.prototype._clearEndedEventHandler=function(){this._sourceNode&&(this._sourceNode.onended=null),null!=this._dummyDurationWaitTimer&&(clearTimeout(this._dummyDurationWaitTimer),this._dummyDurationWaitTimer=null)},r.prototype._calculateVolume=function(){return this._system._muted?0:this.volume*this._system.volume*this._manager.getMasterVolume()},r}(r.AudioPlayer);return Rc.WebAudioPlayer=n,Rc}(),o=function(){function e(){this._supportedFormats=[],this.supportedFormats=(0,t.detectSupportedFormats)(),i.setupChromeMEIWorkaround()}return e.isSupported=function(){return"AudioContext"in window||"webkitAudioContext"in window},Object.defineProperty(e.prototype,"supportedFormats",{get:function(){return this._supportedFormats},set:function(t){this._supportedFormats=t,r.WebAudioAsset.supportedFormats=t},enumerable:!1,configurable:!0}),e.prototype.createAsset=function(t,e,i,n,o,s,a){return new r.WebAudioAsset(t,e,i,n,o,s,a)},e.prototype.createPlayer=function(t,e){return new n.WebAudioPlayer(t,e)},e}();return xc.WebAudioPlugin=o,xc}function Fc(){return Cc?Mc:(Cc=1,Tc||(Tc=1,function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.ProxyAudioPlugin=t.WebAudioPlugin=t.HTMLAudioPlugin=t.AudioPluginManager=t.AudioPluginRegistry=t.ResourceFactory=t.Platform=void 0;var e=Nu();Object.defineProperty(t,"Platform",{enumerable:!0,get:function(){return e.Platform}});var r=Za();Object.defineProperty(t,"AudioPluginRegistry",{enumerable:!0,get:function(){return r.AudioPluginRegistry}});var i=Ka();Object.defineProperty(t,"AudioPluginManager",{enumerable:!0,get:function(){return i.AudioPluginManager}});var n=cc();Object.defineProperty(t,"HTMLAudioPlugin",{enumerable:!0,get:function(){return n.HTMLAudioPlugin}});var o=yc();Object.defineProperty(t,"ProxyAudioPlugin",{enumerable:!0,get:function(){return o.ProxyAudioPlugin}});var s=Ic();Object.defineProperty(t,"WebAudioPlugin",{enumerable:!0,get:function(){return s.WebAudioPlugin}});var a=Wu();Object.defineProperty(t,"ResourceFactory",{enumerable:!0,get:function(){return a.ResourceFactory}})}(Ta)),Mc=Ta)}var jc,Dc={};var kc,Uc={},Gc={};var Hc,Bc,Vc,Wc={};function Nc(){if(Bc)return Uc;Bc=1,Object.defineProperty(Uc,"__esModule",{value:!0}),Uc.SurfaceFactory=void 0;var t=function(){if(kc)return Gc;kc=1,Object.defineProperty(Gc,"__esModule",{value:!0}),Gc.Context2DSurface=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(t.__importStar(fs()).Context2DSurface);return Gc.Context2DSurface=e,Gc}(),e=function(){if(Hc)return Wc;Hc=1,Object.defineProperty(Wc,"__esModule",{value:!0}),Wc.PrimaryContext2DSurface=void 0;var t=l,e=ss(),r=ps(),i=function(i){function n(t,r,n){var o=i.call(this,t,r,n)||this,s=n.getContext("2d");if(null==s)throw new Error("PrimaryContext2DSurface#constructor: cannot get context");return o._context=new e.CanvasSurfaceContext(s),n.width=t,n.height=r,o.canvas=n,o._renderer=void 0,o}return t.__extends(n,i),n.prototype.context=function(){return this._context},n.prototype.renderer=function(){return this._renderer||(this._renderer=new r.Context2DRenderer(this)),this._renderer},n.prototype.changeVisualScale=function(t,e){var r=this.canvas.style;"transform"in r?(r.transformOrigin="0 0",r.transform="scale("+t+","+e+")"):"webkitTransform"in r?(r.webkitTransformOrigin="0 0",r.webkitTransform="scale("+t+","+e+")"):(r.width=Math.floor(t*this.width)+"px",r.height=Math.floor(e*this.width)+"px")},n.prototype.changePhysicalScale=function(t,e){this._context&&(this.canvas.width=this.width*t),this.canvas.height=this.height*e,this._context.scale(t,e)},n.prototype.isPlaying=function(){return!1},n.prototype.getHTMLElement=function(){return this.canvas},n.prototype.destroy=function(){this.canvas.width=1,this.canvas.height=1,this.canvas=void 0,this._renderer=void 0,i.prototype.destroy.call(this)},n}(Jo().Surface);return Wc.PrimaryContext2DSurface=i,Wc}(),r=function(){function r(t){this.canvas=t}return r.prototype.createPrimarySurface=function(t,r){return new e.PrimaryContext2DSurface(t,r,this.canvas)},r.prototype.createSurface=function(e,r){return new t.Context2DSurface(e,r)},r}();return Uc.SurfaceFactory=r,Uc}Object.defineProperty(i,"__esModule",{value:!0}),t.initialize=i.initialize=void 0;var Xc=l,zc=Xc.__importStar(So()),qc=function(){if(bo)return Po;bo=1,Object.defineProperty(Po,"__esModule",{value:!0}),Po.GameHandlerSet=void 0;var t=l.__importStar(So()),e=function(){function e(e){this.raiseEventTrigger=new t.Trigger,this.raiseTickTrigger=new t.Trigger,this.changeSceneModeTrigger=new t.Trigger,this.snapshotTrigger=new t.Trigger,this._eventFilterFuncs=null,this._getCurrentTimeFunc=null,this._local=null,this._tickGenerationMode=null,this.isSnapshotSaver=!!e.isSnapshotSaver}return e.prototype.setCurrentTimeFunc=function(t){this._getCurrentTimeFunc=t},e.prototype.setEventFilterFuncs=function(t){this._eventFilterFuncs=t},e.prototype.removeAllEventFilters=function(){this._eventFilterFuncs&&this._eventFilterFuncs.removeFilter()},e.prototype.changeSceneMode=function(t){this._local=t.local,this._tickGenerationMode=t.tickGenerationMode,this.changeSceneModeTrigger.fire(t)},e.prototype.getCurrentTime=function(){return null==this._getCurrentTimeFunc?0:Math.floor(this._getCurrentTimeFunc())},e.prototype.raiseEvent=function(t){this.raiseEventTrigger.fire(t)},e.prototype.raiseTick=function(t){t&&this.raiseTickTrigger.fire(t)},e.prototype.addEventFilter=function(t,e){this._eventFilterFuncs&&this._eventFilterFuncs.addFilter(t,e)},e.prototype.removeEventFilter=function(t){this._eventFilterFuncs&&this._eventFilterFuncs.removeFilter(t)},e.prototype.shouldSaveSnapshot=function(){return this.isSnapshotSaver},e.prototype.getInstanceType=function(){return this.shouldSaveSnapshot()?"active":"passive"},e.prototype.saveSnapshot=function(t,e,r,i){this.shouldSaveSnapshot()&&this.snapshotTrigger.fire({frame:t,timestamp:i,data:{randGenSer:r,gameSnapshot:e}})},e}();return Po.GameHandlerSet=e,Po}(),Yc=function(){if(Vc)return Eo;Vc=1,Object.defineProperty(Eo,"__esModule",{value:!0}),Eo.ResourceFactory=void 0;var t=l.__importDefault(Co),e=function(){if(Go)return Lo;Go=1,Object.defineProperty(Lo,"__esModule",{value:!0}),Lo.BinaryAsset=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(Vo().BinaryAsset);return Lo.BinaryAsset=e,Lo}(),r=function(){if(ls)return Xo;ls=1,Object.defineProperty(Xo,"__esModule",{value:!0}),Xo.GeneratedVectorImageAsset=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(ys().GeneratedSVGImageAsset);return Xo.GeneratedVectorImageAsset=e,Xo}(),i=function(){if(gs)return ms;gs=1,Object.defineProperty(ms,"__esModule",{value:!0}),ms.ImageAsset=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(ws().HTMLImageAsset);return ms.ImageAsset=e,ms}(),n=function(){if(ca)return Ss;ca=1,Object.defineProperty(Ss,"__esModule",{value:!0}),Ss.ScriptAsset=void 0;var t=l,e=Ps(),r=la(),i=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(i,e),i.prototype._overrideLoadFunc=function(t){var e=this;this._load=function(i){t(e.id,e.path,(function(t,n){t?i._onAssetError(e,r.ExceptionFactory.createAssetLoadError(t.message,!1)):n?(e.script=n+"\n",i._onAssetLoad(e)):i._onAssetError(e,r.ExceptionFactory.createAssetLoadError("no data received",!1))}))}},i}(e.XHRScriptAsset);return Ss.ScriptAsset=i,Ss}(),o=function(){if(da)return pa;da=1,Object.defineProperty(pa,"__esModule",{value:!0}),pa.VectorImageAsset=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(_s().SVGImageAsset);return pa.VectorImageAsset=e,pa}(),s=ga(),a=function(){if(wa)return xa;wa=1,Object.defineProperty(xa,"__esModule",{value:!0}),xa.VideoAsset=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(Pa().HTMLVideoAsset);return xa.VideoAsset=e,xa}(),u=function(){if(Lc)return Oa;Lc=1,Object.defineProperty(Oa,"__esModule",{value:!0}),Oa.AudioFactory=void 0;var t=Fc(),e=Fa(),r=function(){function r(){this.audioManager=new e.AudioManager,this.audioPluginManager=new t.AudioPluginManager,this.audioPluginManager.tryInstallPlugin([t.HTMLAudioPlugin,t.WebAudioPlugin])}return r.prototype.createAudioAsset=function(t,e,r,i,n,o,s){var a=this.audioPluginManager.getActivePlugin().createAsset(t,e,r,i,n,o,null!=s?s:0);return this.audioManager.registerAudioAsset(a),a.onDestroyed.addOnce(this.handleAudioAssetDestroyed,this),a},r.prototype.createAudioPlayer=function(t){return this.audioPluginManager.getActivePlugin().createPlayer(t,this.audioManager)},r.prototype.handleAudioAssetDestroyed=function(t){this.audioManager.removeAudioAsset(t)},r}();return Oa.AudioFactory=r,Oa}(),c=function(){if(jc)return Dc;jc=1,Object.defineProperty(Dc,"__esModule",{value:!0}),Dc.GlyphFactory=void 0;var t=l,e=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return t.__extends(r,e),r}(t.__importStar(nu()).GlyphFactory);return Dc.GlyphFactory=e,Dc}(),h=Nc(),d=function(){function l(t){this.surfaceFactory=new h.SurfaceFactory(t.canvas),this.audioFactory=new u.AudioFactory,this.assetLoaderFuncs=t.assetLoaderFuncs,this.assetBaseDir=t.assetBaseDir||""}return l.prototype.createAudioAsset=function(e,r,i,n,o,s){return this.audioFactory.createAudioAsset(e,(0,t.default)(this.assetBaseDir,r),i,n,o,s)},l.prototype.createAudioPlayer=function(t){return this.audioFactory.createAudioPlayer(t)},l.prototype.createImageAsset=function(e,r,n,o){return new i.ImageAsset(e,(0,t.default)(this.assetBaseDir,r),n,o)},l.prototype.createVectorImageAsset=function(e,r,i,n,s){return new o.VectorImageAsset(e,(0,t.default)(this.assetBaseDir,r),i,n,s)},l.prototype.createVideoAsset=function(e,r,i,n,o,s,u){return new a.VideoAsset(e,(0,t.default)(this.assetBaseDir,r),i,n,o,s,u)},l.prototype.createTextAsset=function(e,r){var i=new s.TextAsset(e,(0,t.default)(this.assetBaseDir,r));return this.assetLoaderFuncs&&this.assetLoaderFuncs.loadTextAsset&&i._overrideLoadFunc(this.assetLoaderFuncs.loadTextAsset),i},l.prototype.createScriptAsset=function(e,r,i){var o=new n.ScriptAsset(e,(0,t.default)(this.assetBaseDir,r),i);return this.assetLoaderFuncs&&this.assetLoaderFuncs.loadScriptAsset&&o._overrideLoadFunc(this.assetLoaderFuncs.loadScriptAsset),o},l.prototype.createBinaryAsset=function(r,i){return new e.BinaryAsset(r,(0,t.default)(this.assetBaseDir,i))},l.prototype.createPrimarySurface=function(t,e){return this.surfaceFactory.createPrimarySurface(t,e)},l.prototype.createSurface=function(t,e){return this.surfaceFactory.createSurface(t,e)},l.prototype.createGlyphFactory=function(t,e,r,i,n,o,s,a){return new c.GlyphFactory(t,e,r,i,n,o,s,a)},l.prototype.createVectorImageAssetFromString=function(t,e,i){return new r.GeneratedVectorImageAsset(t,e,i)},l}();return Eo.ResourceFactory=d,Eo}(),Kc=null;window.g=zc,t.initialize=i.initialize=function(t){var e,r,i,n=new Yc.ResourceFactory({canvas:t.canvas,assetLoaderFuncs:t.assetLoaderFuncs,assetBaseDir:t.assetBaseDir});null==t.configuration&&(t.configuration={}),null==t.configuration.assets&&(t.configuration.assets={});for(var o=t.configuration.assets,s=Object.keys(o),a=0;a<s.length;a++)o[s[a]].virtualPath=o[s[a]].path;var u=new zc.Game({engineModule:zc,handlerSet:new qc.GameHandlerSet({isSnapshotSaver:!0}),configuration:Xc.__assign(Xc.__assign({},t.configuration),{assets:t.configuration.assets,main:null!==(e=t.configuration.main)&&void 0!==e?e:"",width:null!==(r=t.configuration.width)&&void 0!==r?r:t.canvas.width,height:null!==(i=t.configuration.height)&&void 0!==i?i:t.canvas.height}),resourceFactory:n,operationPluginViewInfo:{view:t.canvas},mainFunc:t.mainFunc}),c=n.createPrimarySurface(u.width,u.height);u.renderers.push(c.renderer()),u._reset({randSeed:Date.now()}),u._loadAndStart({});var h=[],l=t.canvas,d=function(){return l.getBoundingClientRect().width/l.clientWidth},p=function(){return l.getBoundingClientRect().height/l.clientHeight},f=function(t){var e=l.getBoundingClientRect();h.push({type:0,identifier:t.pointerId,offset:{x:(t.clientX-e.left)/d(),y:(t.clientY-e.top)/p()},button:t.button}),window.addEventListener("pointermove",_,{passive:!1}),window.addEventListener("pointerup",y,{passive:!1})},_=function(t){var e=l.getBoundingClientRect();h.push({type:1,identifier:t.pointerId,offset:{x:(t.clientX-e.left)/d(),y:(t.clientY-e.top)/p()},button:t.button})},y=function(t){var e=l.getBoundingClientRect();h.push({type:2,identifier:t.pointerId,offset:{x:(t.clientX-e.left)/d(),y:(t.clientY-e.top)/p()},button:t.button}),window.removeEventListener("pointermove",_),window.removeEventListener("pointerup",y)},v=function(t){t.preventDefault()};l.addEventListener("pointerdown",f,{passive:!1}),l.addEventListener("contextmenu",v,{passive:!1});var g=Date.now(),m=1e3/u.fps,A=function(){if(null!==Kc){var t=Date.now();if(g+2*m<t&&(g=t-m-1),g+m<t){if(h.length){for(var e=[],r=0;r<h.length;r++){var i=u.resolvePointEvent(h[r]);null!=i&&e.push(i)}h.length=0,u.tick(!0,void 0,e)}else u.tick(!0);u.render(),g+=m}Kc=window.requestAnimationFrame(A)}};return Kc=window.requestAnimationFrame(A),function(){null!==Kc&&(window.cancelAnimationFrame(Kc),Kc=null),u._destroy(),l.removeEventListener("pointerdown",f),l.removeEventListener("contextmenu",v),c.renderer().clear()}},t.default=i,Object.defineProperty(t,"__esModule",{value:!0})}));