From c0765b46ce4153b7a32302f4b2fbb286a074fb86 Mon Sep 17 00:00:00 2001 From: nakasyou <79000684+nakasyou@users.noreply.github.com> Date: Fri, 30 Dec 2022 05:30:29 +0000 Subject: [PATCH] add a Howler.js --- CREDIT | 12 +++++++++++- dist/kagura.js | 44 ++++++++++++++++++++++++++++++++++++++----- dist/kagura.min.js | 2 +- src/api/howler.js | 9 +++++++++ src/api/isurl.js | 8 ++++++++ src/api/loader.js | 9 +++++++++ src/core.js | 5 ++++- src/lib/howler.min.js | 4 ++++ src/main.js | 12 ++++++++---- 9 files changed, 93 insertions(+), 12 deletions(-) create mode 100644 src/api/howler.js create mode 100644 src/api/isurl.js create mode 100644 src/lib/howler.min.js diff --git a/CREDIT b/CREDIT index 5872de7..69ea254 100644 --- a/CREDIT +++ b/CREDIT @@ -70,4 +70,14 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. \ No newline at end of file +SOFTWARE. + + +===howler.js=== https://github.com/goldfire/howler.js/ +Copyright (c) 2013-2020 James Simpson and GoldFire Studios, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/dist/kagura.js b/dist/kagura.js index 6efb59f..f5134f7 100644 --- a/dist/kagura.js +++ b/dist/kagura.js @@ -1,4 +1,9 @@ -function scaleToWindow(canvas, backgroundColor) { +const kagura=((function(){ + /*! howler.js v2.2.3 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o?t._loadQueue():t._emit("play",d._id)}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id)),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){s&&t.play(o,!0),t._emit("seek",o)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); +/*! Spatial Plugin */ +!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a0?1:-1}),Number.isInteger||(Number.isInteger=function(t){return"number"==typeof t&&isFinite(t)&&Math.floor(t)===t}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array),t.ENV=void 0,t.RENDERER_TYPE=void 0,t.BUFFER_BITS=void 0,t.BLEND_MODES=void 0,t.DRAW_MODES=void 0,t.FORMATS=void 0,t.TARGETS=void 0,t.TYPES=void 0,t.SAMPLER_TYPES=void 0,t.SCALE_MODES=void 0,t.WRAP_MODES=void 0,t.MIPMAP_MODES=void 0,t.ALPHA_MODES=void 0,t.CLEAR_MODES=void 0,t.GC_MODES=void 0,t.PRECISION=void 0,t.MASK_TYPES=void 0,t.COLOR_MASK_BITS=void 0,t.MSAA_QUALITY=void 0,t.BUFFER_TYPE=void 0,function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(t.ENV||(t.ENV={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(t.RENDERER_TYPE||(t.RENDERER_TYPE={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(t.BUFFER_BITS||(t.BUFFER_BITS={})),function(t){t[t.NORMAL=0]="NORMAL",t[t.ADD=1]="ADD",t[t.MULTIPLY=2]="MULTIPLY",t[t.SCREEN=3]="SCREEN",t[t.OVERLAY=4]="OVERLAY",t[t.DARKEN=5]="DARKEN",t[t.LIGHTEN=6]="LIGHTEN",t[t.COLOR_DODGE=7]="COLOR_DODGE",t[t.COLOR_BURN=8]="COLOR_BURN",t[t.HARD_LIGHT=9]="HARD_LIGHT",t[t.SOFT_LIGHT=10]="SOFT_LIGHT",t[t.DIFFERENCE=11]="DIFFERENCE",t[t.EXCLUSION=12]="EXCLUSION",t[t.HUE=13]="HUE",t[t.SATURATION=14]="SATURATION",t[t.COLOR=15]="COLOR",t[t.LUMINOSITY=16]="LUMINOSITY",t[t.NORMAL_NPM=17]="NORMAL_NPM",t[t.ADD_NPM=18]="ADD_NPM",t[t.SCREEN_NPM=19]="SCREEN_NPM",t[t.NONE=20]="NONE",t[t.SRC_OVER=0]="SRC_OVER",t[t.SRC_IN=21]="SRC_IN",t[t.SRC_OUT=22]="SRC_OUT",t[t.SRC_ATOP=23]="SRC_ATOP",t[t.DST_OVER=24]="DST_OVER",t[t.DST_IN=25]="DST_IN",t[t.DST_OUT=26]="DST_OUT",t[t.DST_ATOP=27]="DST_ATOP",t[t.ERASE=26]="ERASE",t[t.SUBTRACT=28]="SUBTRACT",t[t.XOR=29]="XOR"}(t.BLEND_MODES||(t.BLEND_MODES={})),function(t){t[t.POINTS=0]="POINTS",t[t.LINES=1]="LINES",t[t.LINE_LOOP=2]="LINE_LOOP",t[t.LINE_STRIP=3]="LINE_STRIP",t[t.TRIANGLES=4]="TRIANGLES",t[t.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",t[t.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(t.DRAW_MODES||(t.DRAW_MODES={})),function(t){t[t.RGBA=6408]="RGBA",t[t.RGB=6407]="RGB",t[t.RG=33319]="RG",t[t.RED=6403]="RED",t[t.RGBA_INTEGER=36249]="RGBA_INTEGER",t[t.RGB_INTEGER=36248]="RGB_INTEGER",t[t.RG_INTEGER=33320]="RG_INTEGER",t[t.RED_INTEGER=36244]="RED_INTEGER",t[t.ALPHA=6406]="ALPHA",t[t.LUMINANCE=6409]="LUMINANCE",t[t.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",t[t.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",t[t.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(t.FORMATS||(t.FORMATS={})),function(t){t[t.TEXTURE_2D=3553]="TEXTURE_2D",t[t.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",t[t.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",t[t.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",t[t.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",t[t.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",t[t.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",t[t.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(t.TARGETS||(t.TARGETS={})),function(t){t[t.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",t[t.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",t[t.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",t[t.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",t[t.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",t[t.UNSIGNED_INT=5125]="UNSIGNED_INT",t[t.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",t[t.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",t[t.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",t[t.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",t[t.BYTE=5120]="BYTE",t[t.SHORT=5122]="SHORT",t[t.INT=5124]="INT",t[t.FLOAT=5126]="FLOAT",t[t.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",t[t.HALF_FLOAT=36193]="HALF_FLOAT"}(t.TYPES||(t.TYPES={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(t.SAMPLER_TYPES||(t.SAMPLER_TYPES={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(t.SCALE_MODES||(t.SCALE_MODES={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(t.WRAP_MODES||(t.WRAP_MODES={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(t.MIPMAP_MODES||(t.MIPMAP_MODES={})),function(t){t[t.NPM=0]="NPM",t[t.UNPACK=1]="UNPACK",t[t.PMA=2]="PMA",t[t.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",t[t.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",t[t.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",t[t.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(t.ALPHA_MODES||(t.ALPHA_MODES={})),function(t){t[t.NO=0]="NO",t[t.YES=1]="YES",t[t.AUTO=2]="AUTO",t[t.BLEND=0]="BLEND",t[t.CLEAR=1]="CLEAR",t[t.BLIT=2]="BLIT"}(t.CLEAR_MODES||(t.CLEAR_MODES={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(t.GC_MODES||(t.GC_MODES={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(t.PRECISION||(t.PRECISION={})),function(t){t[t.NONE=0]="NONE",t[t.SCISSOR=1]="SCISSOR",t[t.STENCIL=2]="STENCIL",t[t.SPRITE=3]="SPRITE",t[t.COLOR=4]="COLOR"}(t.MASK_TYPES||(t.MASK_TYPES={})),function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"}(t.COLOR_MASK_BITS||(t.COLOR_MASK_BITS={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(t.MSAA_QUALITY||(t.MSAA_QUALITY={})),function(t){t[t.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",t[t.ARRAY_BUFFER=34962]="ARRAY_BUFFER",t[t.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(t.BUFFER_TYPE||(t.BUFFER_TYPE={}));var E={createCanvas:function(t,e){var r=document.createElement("canvas");return r.width=t,r.height=e,r},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var t;return null!==(t=document.baseURI)&&void 0!==t?t:window.location.href},fetch:function(t,e){return fetch(t,e)}},b=/iPhone/i,x=/iPod/i,A=/iPad/i,S=/\biOS-universal(?:.+)Mac\b/i,R=/\bAndroid(?:.+)Mobile\b/i,O=/Android/i,M=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,P=/Silk/i,I=/Windows Phone/i,D=/\bWindows(?:.+)ARM\b/i,w=/BlackBerry/i,C=/BB10/i,N=/Opera Mini/i,F=/\b(CriOS|Chrome)(?:.+)Mobile/i,L=/Mobile(?:.+)Firefox\b/i,B=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream},G=function(t){var e={userAgent:"",platform:"",maxTouchPoints:0};t||"undefined"==typeof navigator?"string"==typeof t?e.userAgent=t:t&&t.userAgent&&(e={userAgent:t.userAgent,platform:t.platform,maxTouchPoints:t.maxTouchPoints||0}):e={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0};var r=e.userAgent,i=r.split("[FBAN");void 0!==i[1]&&(r=i[0]),void 0!==(i=r.split("Twitter"))[1]&&(r=i[0]);var n=function(t){return function(e){return e.test(t)}}(r),o={apple:{phone:n(b)&&!n(I),ipod:n(x),tablet:!n(b)&&(n(A)||B(e))&&!n(I),universal:n(S),device:(n(b)||n(x)||n(A)||n(S)||B(e))&&!n(I)},amazon:{phone:n(M),tablet:!n(M)&&n(P),device:n(M)||n(P)},android:{phone:!n(I)&&n(M)||!n(I)&&n(R),tablet:!n(I)&&!n(M)&&!n(R)&&(n(P)||n(O)),device:!n(I)&&(n(M)||n(P)||n(R)||n(O))||n(/\bokhttp\b/i)},windows:{phone:n(I),tablet:n(D),device:n(I)||n(D)},other:{blackberry:n(w),blackberry10:n(C),opera:n(N),firefox:n(L),chrome:n(F),device:n(w)||n(C)||n(N)||n(L)||n(F)},any:!1,phone:!1,tablet:!1};return o.any=o.apple.device||o.android.device||o.windows.device||o.other.device,o.phone=o.apple.phone||o.android.phone||o.windows.phone,o.tablet=o.apple.tablet||o.android.tablet||o.windows.tablet,o}(globalThis.navigator),U={ADAPTER:E,MIPMAP_TEXTURES:t.MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:t.MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(t){var e,r=!0;(G.tablet||G.phone)&&(G.apple.device&&(e=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(e[1],10)<11&&(r=!1),G.android.device&&(e=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(e[1],10)<7&&(r=!1));return r?32:4}(),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:t.GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:t.WRAP_MODES.CLAMP,SCALE_MODE:t.SCALE_MODES.LINEAR,PRECISION_VERTEX:t.PRECISION.HIGH,PRECISION_FRAGMENT:G.apple.device?t.PRECISION.HIGH:t.PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!G.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},k="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function X(t,e,r){return t(r={path:e,exports:{},require:function(t,e){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==e&&r.path)}},r.exports),r.exports}var j=X((function(t){var e=Object.prototype.hasOwnProperty,r="~";function i(){}function n(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function o(t,e,i,o,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var a=new n(i,o||t,s),h=r?r+e:e;return t._events[h]?t._events[h].fn?t._events[h]=[t._events[h],a]:t._events[h].push(a):(t._events[h]=a,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new i:delete t._events[e]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),a.prototype.eventNames=function(){var t,i,n=[];if(0===this._eventsCount)return n;for(i in t=this._events)e.call(t,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(t)):n},a.prototype.listeners=function(t){var e=r?r+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,o=i.length,s=new Array(o);n80*r){i=o=t[0],n=s=t[1];for(var p=r;po&&(o=a),h>s&&(s=h);u=0!==(u=Math.max(o-i,s-n))?32767/u:0}return q(d,f,r,i,n,u,0),f}function z(t,e,r,i,n){var o,s;if(n===vt(t,e,r,i)>0)for(o=e;o=e;o-=i)s=ft(o,t[o],t[o+1],s);return s&&at(s,s.next)&&(pt(s),s=s.next),s}function W(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!at(i,i.next)&&0!==st(i.prev,i,i.next))i=i.next;else{if(pt(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function q(t,e,r,i,n,o,s){if(t){!s&&o&&function(t,e,r,i){var n=t;do{0===n.z&&(n.z=rt(n.x,n.y,e,r,i)),n.prevZ=n.prev,n.nextZ=n.next,n=n.next}while(n!==t);n.prevZ.nextZ=null,n.prevZ=null,function(t){var e,r,i,n,o,s,a,h,u=1;do{for(r=t,t=null,o=null,s=0;r;){for(s++,i=r,a=0,e=0;e0||h>0&&i;)0!==a&&(0===h||!i||r.z<=i.z)?(n=r,r=r.nextZ,a--):(n=i,i=i.nextZ,h--),o?o.nextZ=n:t=n,n.prevZ=o,o=n;r=i}o.nextZ=null,u*=2}while(s>1)}(n)}(t,i,n,o);for(var a,h,u=t;t.prev!==t.next;)if(a=t.prev,h=t.next,o?Z(t,i,n,o):K(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),pt(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?q(t=Q(W(t),e,r),e,r,i,n,o,2):2===s&&J(t,e,r,i,n,o):q(W(t),e,r,i,n,o,1);break}}}function K(t){var e=t.prev,r=t,i=t.next;if(st(e,r,i)>=0)return!1;for(var n=e.x,o=r.x,s=i.x,a=e.y,h=r.y,u=i.y,l=no?n>s?n:s:o>s?o:s,f=a>h?a>u?a:u:h>u?h:u,p=i.next;p!==e;){if(p.x>=l&&p.x<=d&&p.y>=c&&p.y<=f&&nt(n,a,o,h,s,u,p.x,p.y)&&st(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function Z(t,e,r,i){var n=t.prev,o=t,s=t.next;if(st(n,o,s)>=0)return!1;for(var a=n.x,h=o.x,u=s.x,l=n.y,c=o.y,d=s.y,f=ah?a>u?a:u:h>u?h:u,v=l>c?l>d?l:d:c>d?c:d,m=rt(f,p,e,r,i),y=rt(_,v,e,r,i),g=t.prevZ,T=t.nextZ;g&&g.z>=m&&T&&T.z<=y;){if(g.x>=f&&g.x<=_&&g.y>=p&&g.y<=v&&g!==n&&g!==s&&nt(a,l,h,c,u,d,g.x,g.y)&&st(g.prev,g,g.next)>=0)return!1;if(g=g.prevZ,T.x>=f&&T.x<=_&&T.y>=p&&T.y<=v&&T!==n&&T!==s&&nt(a,l,h,c,u,d,T.x,T.y)&&st(T.prev,T,T.next)>=0)return!1;T=T.nextZ}for(;g&&g.z>=m;){if(g.x>=f&&g.x<=_&&g.y>=p&&g.y<=v&&g!==n&&g!==s&&nt(a,l,h,c,u,d,g.x,g.y)&&st(g.prev,g,g.next)>=0)return!1;g=g.prevZ}for(;T&&T.z<=y;){if(T.x>=f&&T.x<=_&&T.y>=p&&T.y<=v&&T!==n&&T!==s&&nt(a,l,h,c,u,d,T.x,T.y)&&st(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function Q(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!at(n,o)&&ht(n,i,i.next,o)&&ct(n,o)&&ct(o,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),pt(i),pt(i.next),i=t=o),i=i.next}while(i!==t);return W(i)}function J(t,e,r,i,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&ot(s,a)){var h=dt(s,a);return s=W(s,s.next),h=W(h,h.next),q(s,e,r,i,n,o,0),void q(h,e,r,i,n,o,0)}a=a.next}s=s.next}while(s!==t)}function $(t,e){return t.x-e.x}function tt(t,e){var r=function(t,e){var r,i=e,n=t.x,o=t.y,s=-1/0;do{if(o<=i.y&&o>=i.next.y&&i.next.y!==i.y){var a=i.x+(o-i.y)*(i.next.x-i.x)/(i.next.y-i.y);if(a<=n&&a>s&&(s=a,r=i.x=i.x&&i.x>=l&&n!==i.x&&nt(or.x||i.x===r.x&&et(r,i)))&&(r=i,d=h)),i=i.next}while(i!==u);return r}(t,e);if(!r)return e;var i=dt(r,t);return W(i,i.next),W(r,r.next)}function et(t,e){return st(t.prev,t,e.prev)<0&&st(e.next,t,t.next)<0}function rt(t,e,r,i,n){return(t=1431655765&((t=858993459&((t=252645135&((t=16711935&((t=(t-r)*n|0)|t<<8))|t<<4))|t<<2))|t<<1))|(e=1431655765&((e=858993459&((e=252645135&((e=16711935&((e=(e-i)*n|0)|e<<8))|e<<4))|e<<2))|e<<1))<<1}function it(t){var e=t,r=t;do{(e.x=(t-s)*(o-a)&&(t-s)*(i-a)>=(r-s)*(e-a)&&(r-s)*(o-a)>=(n-s)*(i-a)}function ot(t,e){return t.next.i!==e.i&&t.prev.i!==e.i&&!function(t,e){var r=t;do{if(r.i!==t.i&&r.next.i!==t.i&&r.i!==e.i&&r.next.i!==e.i&&ht(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(ct(t,e)&&ct(e,t)&&function(t,e){var r=t,i=!1,n=(t.x+e.x)/2,o=(t.y+e.y)/2;do{r.y>o!=r.next.y>o&&r.next.y!==r.y&&n<(r.next.x-r.x)*(o-r.y)/(r.next.y-r.y)+r.x&&(i=!i),r=r.next}while(r!==t);return i}(t,e)&&(st(t.prev,t,e.prev)||st(t,e.prev,e))||at(t,e)&&st(t.prev,t,t.next)>0&&st(e.prev,e,e.next)>0)}function st(t,e,r){return(e.y-t.y)*(r.x-e.x)-(e.x-t.x)*(r.y-e.y)}function at(t,e){return t.x===e.x&&t.y===e.y}function ht(t,e,r,i){var n=lt(st(t,e,r)),o=lt(st(t,e,i)),s=lt(st(r,i,t)),a=lt(st(r,i,e));return n!==o&&s!==a||(!(0!==n||!ut(t,r,e))||(!(0!==o||!ut(t,i,e))||(!(0!==s||!ut(r,t,i))||!(0!==a||!ut(r,e,i)))))}function ut(t,e,r){return e.x<=Math.max(t.x,r.x)&&e.x>=Math.min(t.x,r.x)&&e.y<=Math.max(t.y,r.y)&&e.y>=Math.min(t.y,r.y)}function lt(t){return t>0?1:t<0?-1:0}function ct(t,e){return st(t.prev,t,t.next)<0?st(t,e,t.next)>=0&&st(t,t.prev,e)>=0:st(t,e,t.prev)<0||st(t,t.next,e)<0}function dt(t,e){var r=new _t(t.i,t.x,t.y),i=new _t(e.i,e.x,e.y),n=t.next,o=e.prev;return t.next=e,e.prev=t,r.next=n,n.prev=r,i.next=r,r.prev=i,o.next=i,i.prev=o,i}function ft(t,e,r,i){var n=new _t(t,e,r);return i?(n.next=i.next,n.prev=i,i.next.prev=n,i.next=n):(n.prev=n,n.next=n),n}function pt(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function _t(t,e,r){this.i=t,this.x=e,this.y=r,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function vt(t,e,r,i){for(var n=0,o=e,s=r-i;o0&&(i+=t[n-1].length,r.holes.push(i))}return r},H.default=Y;var mt=X((function(t,e){!function(r){var i=e&&!e.nodeType&&e,n=t&&!t.nodeType&&t,o="object"==typeof k&&k;o.global!==o&&o.window!==o&&o.self!==o||(r=o);var s,a,h=2147483647,u=36,l=/^xn--/,c=/[^\x20-\x7E]/,d=/[\x2E\u3002\uFF0E\uFF61]/g,f={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},p=Math.floor,_=String.fromCharCode;function v(t){throw RangeError(f[t])}function m(t,e){for(var r=t.length,i=[];r--;)i[r]=e(t[r]);return i}function y(t,e){var r=t.split("@"),i="";return r.length>1&&(i=r[0]+"@",t=r[1]),i+m((t=t.replace(d,".")).split("."),e).join(".")}function g(t){for(var e,r,i=[],n=0,o=t.length;n=55296&&e<=56319&&n65535&&(e+=_((t-=65536)>>>10&1023|55296),t=56320|1023&t),e+=_(t)})).join("")}function E(t,e){return t+22+75*(t<26)-((0!=e)<<5)}function b(t,e,r){var i=0;for(t=r?p(t/700):t>>1,t+=p(t/e);t>455;i+=u)t=p(t/35);return p(i+36*t/(t+38))}function x(t){var e,r,i,n,o,s,a,l,c,d,f,_=[],m=t.length,y=0,g=128,E=72;for((r=t.lastIndexOf("-"))<0&&(r=0),i=0;i=128&&v("not-basic"),_.push(t.charCodeAt(i));for(n=r>0?r+1:0;n=m&&v("invalid-input"),((l=(f=t.charCodeAt(n++))-48<10?f-22:f-65<26?f-65:f-97<26?f-97:u)>=u||l>p((h-y)/s))&&v("overflow"),y+=l*s,!(l<(c=a<=E?1:a>=E+26?26:a-E));a+=u)s>p(h/(d=u-c))&&v("overflow"),s*=d;E=b(y-o,e=_.length+1,0==o),p(y/e)>h-g&&v("overflow"),g+=p(y/e),y%=e,_.splice(y++,0,g)}return T(_)}function A(t){var e,r,i,n,o,s,a,l,c,d,f,m,y,T,x,A=[];for(m=(t=g(t)).length,e=128,r=0,o=72,s=0;s=e&&fp((h-r)/(y=i+1))&&v("overflow"),r+=(a-e)*y,e=a,s=0;sh&&v("overflow"),f==e){for(l=r,c=u;!(l<(d=c<=o?1:c>=o+26?26:c-o));c+=u)x=l-d,T=u-d,A.push(_(E(d+x%T,0))),l=p(x/T);A.push(_(E(l,0))),o=b(r,y,i==n),r=0,++i}++r,++e}return A.join("")}if(s={version:"1.3.2",ucs2:{decode:g,encode:T},decode:x,encode:A,toASCII:function(t){return y(t,(function(t){return c.test(t)?"xn--"+A(t):t}))},toUnicode:function(t){return y(t,(function(t){return l.test(t)?x(t.slice(4).toLowerCase()):t}))}},i&&n)if(t.exports==i)n.exports=s;else for(a in s)s.hasOwnProperty(a)&&(i[a]=s[a]);else r.punycode=s}(k)})),yt=function(t){return"string"==typeof t},gt=function(t){return"object"==typeof t&&null!==t},Tt=function(t){return null===t},Et=function(t){return null==t};function bt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var xt=function(t,e,r,i){e=e||"&",r=r||"=";var n={};if("string"!=typeof t||0===t.length)return n;var o=/\+/g;t=t.split(e);var s=1e3;i&&"number"==typeof i.maxKeys&&(s=i.maxKeys);var a=t.length;s>0&&a>s&&(a=s);for(var h=0;h=0?(u=f.substr(0,p),l=f.substr(p+1)):(u=f,l=""),c=decodeURIComponent(u),d=decodeURIComponent(l),bt(n,c)?Array.isArray(n[c])?n[c].push(d):n[c]=[n[c],d]:n[c]=d}return n},At=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},St=function(t,e,r,i){return e=e||"&",r=r||"=",null===t&&(t=void 0),"object"==typeof t?Object.keys(t).map((function(i){var n=encodeURIComponent(At(i))+r;return Array.isArray(t[i])?t[i].map((function(t){return n+encodeURIComponent(At(t))})).join(e):n+encodeURIComponent(At(t[i]))})).join(e):i?encodeURIComponent(At(i))+r+encodeURIComponent(At(t)):""},Rt=X((function(t,e){e.decode=e.parse=xt,e.encode=e.stringify=St})),Ot=Ht,Mt=function(t,e){return Ht(t,!1,!0).resolve(e)},Pt=function(t){yt(t)&&(t=Ht(t));if(!(t instanceof It))return It.prototype.format.call(t);return t.format()};function It(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}var Dt=/^([a-z0-9.+-]+:)/i,wt=/:[0-9]*$/,Ct=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,Nt=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),Ft=["'"].concat(Nt),Lt=["%","/","?",";","#"].concat(Ft),Bt=["/","?","#"],Gt=/^[+a-z0-9A-Z_-]{0,63}$/,Ut=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,kt={javascript:!0,"javascript:":!0},Xt={javascript:!0,"javascript:":!0},jt={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function Ht(t,e,r){if(t&>(t)&&t instanceof It)return t;var i=new It;return i.parse(t,e,r),i}It.prototype.parse=function(t,e,r){if(!yt(t))throw new TypeError("Parameter 'url' must be a string, not "+typeof t);var i=t.indexOf("?"),n=-1!==i&&i127?T+="x":T+=g[E];if(!T.match(Gt)){var x=m.slice(0,p),A=m.slice(p+1),S=g.match(Ut);S&&(x.push(S[1]),A.unshift(S[2])),A.length&&(s="/"+A.join(".")+s),this.hostname=x.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=mt.toASCII(this.hostname));var R=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+R,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!kt[u])for(p=0,y=Ft.length;p0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift());return r.search=t.search,r.query=t.query,Tt(r.pathname)&&Tt(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.href=r.format(),r}if(!g.length)return r.pathname=null,r.search?r.path="/"+r.search:r.path=null,r.href=r.format(),r;for(var E=g.slice(-1)[0],b=(r.host||t.host||g.length>1)&&("."===E||".."===E)||""===E,x=0,A=g.length;A>=0;A--)"."===(E=g[A])?g.splice(A,1):".."===E?(g.splice(A,1),x++):x&&(g.splice(A,1),x--);if(!m&&!y)for(;x--;x)g.unshift("..");!m||""===g[0]||g[0]&&"/"===g[0].charAt(0)||g.unshift(""),b&&"/"!==g.join("/").substr(-1)&&g.push("");var S,R=""===g[0]||g[0]&&"/"===g[0].charAt(0);T&&(r.hostname=r.host=R?"":g.length?g.shift():"",(S=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=S.shift(),r.host=r.hostname=S.shift()));return(m=m||r.host&&g.length)&&!R&&g.unshift(""),g.length?r.pathname=g.join("/"):(r.pathname=null,r.path=null),Tt(r.pathname)&&Tt(r.search)||(r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")),r.auth=t.auth||r.auth,r.slashes=r.slashes||t.slashes,r.href=r.format(),r},It.prototype.parseHost=function(){var t=this.host,e=wt.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};var Yt={parse:Ot,format:Pt,resolve:Mt};function Vt(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function zt(t){return t.split("?")[0].split("#")[0]}var Wt={toPosix:function(t){return"\\","/",t.replace(new RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")},isUrl:function(t){return/^https?:/.test(this.toPosix(t))},isDataUrl:function(t){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(t)},hasProtocol:function(t){return/^[^/:]+:\//.test(this.toPosix(t))},getProtocol:function(t){Vt(t),t=this.toPosix(t);var e="",r=/^file:\/\/\//.exec(t),i=/^[^/:]+:\/\//.exec(t),n=/^[^/:]+:\//.exec(t);if(r||i||n){var o=(null==r?void 0:r[0])||(null==i?void 0:i[0])||(null==n?void 0:n[0]);e=o,t=t.slice(o.length)}return e},toAbsolute:function(t,e,r){if(this.isDataUrl(t))return t;var i=zt(this.toPosix(null!=e?e:U.ADAPTER.getBaseUrl())),n=zt(this.toPosix(null!=r?r:this.rootname(i)));return Vt(t),(t=this.toPosix(t)).startsWith("/")?Wt.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize:function(t){if(Vt(t=this.toPosix(t)),0===t.length)return".";var e="",r=t.startsWith("/");this.hasProtocol(t)&&(e=this.rootname(t),t=t.slice(e.length));var i=t.endsWith("/");return(t=function(t,e){for(var r,i="",n=0,o=-1,s=0,a=0;a<=t.length;++a){if(a2){var h=i.lastIndexOf("/");if(h!==i.length-1){-1===h?(i="",n=0):n=(i=i.slice(0,h)).length-1-i.lastIndexOf("/"),o=a,s=0;continue}}else if(2===i.length||1===i.length){i="",n=0,o=a,s=0;continue}}else i.length>0?i+="/"+t.slice(o+1,a):i=t.slice(o+1,a),n=a-o-1;o=a,s=0}else 46===r&&-1!==s?++s:s=-1}return i}(t)).length>0&&i&&(t+="/"),r?"/"+t:e+t},isAbsolute:function(t){return Vt(t),t=this.toPosix(t),!!this.hasProtocol(t)||t.startsWith("/")},join:function(){for(var t,e,r=arguments,i=[],n=0;n0)if(void 0===e)e=s;else{var a=null!==(t=i[o-1])&&void 0!==t?t:"";this.extname(a)?e+="/../"+s:e+="/"+s}}return void 0===e?".":this.normalize(e)},dirname:function(t){if(Vt(t),0===t.length)return".";for(var e=(t=this.toPosix(t)).charCodeAt(0),r=47===e,i=-1,n=!0,o=this.getProtocol(t),s=t,a=(t=t.slice(o.length)).length-1;a>=1;--a)if(47===(e=t.charCodeAt(a))){if(!n){i=a;break}}else n=!1;return-1===i?r?"/":this.isUrl(s)?o+t:o:r&&1===i?"//":o+t.slice(0,i)},rootname:function(t){Vt(t);var e="";if(e=(t=this.toPosix(t)).startsWith("/")?"/":this.getProtocol(t),this.isUrl(t)){var r=t.indexOf("/",e.length);(e=-1!==r?t.slice(0,r):t).endsWith("/")||(e+="/")}return e},basename:function(t,e){Vt(t),e&&Vt(e),t=this.toPosix(t);var r,i=0,n=-1,o=!0;if(void 0!==e&&e.length>0&&e.length<=t.length){if(e.length===t.length&&e===t)return"";var s=e.length-1,a=-1;for(r=t.length-1;r>=0;--r){var h=t.charCodeAt(r);if(47===h){if(!o){i=r+1;break}}else-1===a&&(o=!1,a=r+1),s>=0&&(h===e.charCodeAt(s)?-1==--s&&(n=r):(s=-1,n=a))}return i===n?n=a:-1===n&&(n=t.length),t.slice(i,n)}for(r=t.length-1;r>=0;--r)if(47===t.charCodeAt(r)){if(!o){i=r+1;break}}else-1===n&&(o=!1,n=r+1);return-1===n?"":t.slice(i,n)},extname:function(t){Vt(t);for(var e=-1,r=0,i=-1,n=!0,o=0,s=(t=this.toPosix(t)).length-1;s>=0;--s){var a=t.charCodeAt(s);if(47!==a)-1===i&&(n=!1,i=s+1),46===a?-1===e?e=s:1!==o&&(o=1):-1!==e&&(o=-1);else if(!n){r=s+1;break}}return-1===e||-1===i||0===o||1===o&&e===i-1&&e===r+1?"":t.slice(e,i)},parse:function(t){Vt(t);var e={root:"",dir:"",base:"",ext:"",name:""};if(0===t.length)return e;var r,i=(t=this.toPosix(t)).charCodeAt(0),n=this.isAbsolute(t);e.root=this.rootname(t),r=n||this.hasProtocol(t)?1:0;for(var o=-1,s=0,a=-1,h=!0,u=t.length-1,l=0;u>=r;--u)if(47!==(i=t.charCodeAt(u)))-1===a&&(h=!1,a=u+1),46===i?-1===o?o=u:1!==l&&(l=1):-1!==o&&(l=-1);else if(!h){s=u+1;break}return-1===o||-1===a||0===l||1===l&&o===a-1&&o===s+1?-1!==a&&(e.base=e.name=0===s&&n?t.slice(1,a):t.slice(s,a)):(0===s&&n?(e.name=t.slice(1,o),e.base=t.slice(1,a)):(e.name=t.slice(s,o),e.base=t.slice(s,a)),e.ext=t.slice(o,a)),e.dir=this.dirname(t),e},sep:"/",delimiter:":"};U.RETINA_PREFIX=/@([0-9\.]+)x/,U.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var qt,Kt=!1;function Zt(t){var e;if(!Kt){if(U.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var r=["\n %c %c %c PixiJS 6.5.8 - ✰ "+t+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"];(e=globalThis.console).log.apply(e,r)}else globalThis.console&&globalThis.console.log("PixiJS 6.5.8 - "+t+" - http://www.pixijs.com/");Kt=!0}}function Qt(){return void 0===qt&&(qt=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:U.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!U.ADAPTER.getWebGLRenderingContext())return!1;var e=U.ADAPTER.createCanvas(),r=e.getContext("webgl",t)||e.getContext("experimental-webgl",t),i=!(!r||!r.getContextAttributes().stencil);if(r){var n=r.getExtension("WEBGL_lose_context");n&&n.loseContext()}return r=null,i}catch(t){return!1}}()),qt}var Jt={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function $t(t,e){return void 0===e&&(e=[]),e[0]=(t>>16&255)/255,e[1]=(t>>8&255)/255,e[2]=(255&t)/255,e}function te(t){var e=t.toString(16);return"#"+("000000".substring(0,6-e.length)+e)}function ee(t){return"string"==typeof t&&"#"===(t=Jt[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),parseInt(t,16)}var re=function(){for(var e=[],r=[],i=0;i<32;i++)e[i]=i,r[i]=i;e[t.BLEND_MODES.NORMAL_NPM]=t.BLEND_MODES.NORMAL,e[t.BLEND_MODES.ADD_NPM]=t.BLEND_MODES.ADD,e[t.BLEND_MODES.SCREEN_NPM]=t.BLEND_MODES.SCREEN,r[t.BLEND_MODES.NORMAL]=t.BLEND_MODES.NORMAL_NPM,r[t.BLEND_MODES.ADD]=t.BLEND_MODES.ADD_NPM,r[t.BLEND_MODES.SCREEN]=t.BLEND_MODES.SCREEN_NPM;var n=[];return n.push(r),n.push(e),n}();function ie(t,e){return re[e?1:0][t]}function ne(t,e,r,i){return r=r||new Float32Array(4),i||void 0===i?(r[0]=t[0]*e,r[1]=t[1]*e,r[2]=t[2]*e):(r[0]=t[0],r[1]=t[1],r[2]=t[2]),r[3]=e,r}function oe(t,e){if(1===e)return(255*e<<24)+t;if(0===e)return 0;var r=t>>16&255,i=t>>8&255,n=255&t;return(255*e<<24)+((r=r*e+.5|0)<<16)+((i=i*e+.5|0)<<8)+(n*e+.5|0)}function se(t,e,r,i){return(r=r||new Float32Array(4))[0]=(t>>16&255)/255,r[1]=(t>>8&255)/255,r[2]=(255&t)/255,(i||void 0===i)&&(r[0]*=e,r[1]*=e,r[2]*=e),r[3]=e,r}function ae(t,e){void 0===e&&(e=null);var r=6*t;if((e=e||new Uint16Array(r)).length!==r)throw new Error("Out buffer length is incorrect, got "+e.length+" and expected "+r);for(var i=0,n=0;i>>1,t|=t>>>2,t|=t>>>4,t|=t>>>8,1+(t|=t>>>16)}function ce(t){return!(t&t-1||!t)}function de(t){var e=(t>65535?1:0)<<4,r=((t>>>=e)>255?1:0)<<3;return e|=r,e|=r=((t>>>=r)>15?1:0)<<2,(e|=r=((t>>>=r)>3?1:0)<<1)|(t>>>=r)>>1}function fe(t,e,r){var i,n=t.length;if(!(e>=n||0===r)){var o=n-(r=e+r>n?n-e:r);for(i=e;i=this.x&&t=this.y&&et.right?t.right:this.right)<=r)return!1;var i=this.yt.bottom?t.bottom:this.bottom)>i}var n=this.left,o=this.right,s=this.top,a=this.bottom;if(o<=n||a<=s)return!1;var h=we[0].set(t.left,t.top),u=we[1].set(t.left,t.bottom),l=we[2].set(t.right,t.top),c=we[3].set(t.right,t.bottom);if(l.x<=h.x||u.y<=h.y)return!1;var d=Math.sign(e.a*e.d-e.b*e.c);if(0===d)return!1;if(e.apply(h,h),e.apply(u,u),e.apply(l,l),e.apply(c,c),Math.max(h.x,u.x,l.x,c.x)<=n||Math.min(h.x,u.x,l.x,c.x)>=o||Math.max(h.y,u.y,l.y,c.y)<=s||Math.min(h.y,u.y,l.y,c.y)>=a)return!1;var f=d*(u.y-h.y),p=d*(h.x-u.x),_=f*n+p*s,v=f*o+p*s,m=f*n+p*a,y=f*o+p*a;if(Math.max(_,v,m,y)<=f*h.x+p*h.y||Math.min(_,v,m,y)>=f*c.x+p*c.y)return!1;var g=d*(h.y-l.y),T=d*(l.x-h.x),E=g*n+T*s,b=g*o+T*s,x=g*n+T*a,A=g*o+T*a;return!(Math.max(E,b,x,A)<=g*h.x+T*h.y||Math.min(E,b,x,A)>=g*c.x+T*c.y)},e.prototype.pad=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this.x-=t,this.y-=e,this.width+=2*t,this.height+=2*e,this},e.prototype.fit=function(t){var e=Math.max(this.x,t.x),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(n-i,0),this},e.prototype.ceil=function(t,e){void 0===t&&(t=1),void 0===e&&(e=.001);var r=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=i-this.y,this},e.prototype.enlarge=function(t){var e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=i,this.height=n-i,this},e}(),Ne=function(){function e(e,r,i){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),this.x=e,this.y=r,this.radius=i,this.type=t.SHAPES.CIRC}return e.prototype.clone=function(){return new e(this.x,this.y,this.radius)},e.prototype.contains=function(t,e){if(this.radius<=0)return!1;var r=this.radius*this.radius,i=this.x-t,n=this.y-e;return(i*=i)+(n*=n)<=r},e.prototype.getBounds=function(){return new Ce(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e}(),Fe=function(){function e(e,r,i,n){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),this.x=e,this.y=r,this.width=i,this.height=n,this.type=t.SHAPES.ELIP}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height)},e.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;var r=(t-this.x)/this.width,i=(e-this.y)/this.height;return(r*=r)+(i*=i)<=1},e.prototype.getBounds=function(){return new Ce(this.x-this.width,this.y-this.height,this.width,this.height)},e}(),Le=function(){function e(){for(var e=arguments,r=[],i=0;ie!=u>e&&t<(e-a)/(u-a)*(h-s)+s&&(r=!r)}return r},e}(),Be=function(){function e(e,r,i,n,o){void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=0),void 0===n&&(n=0),void 0===o&&(o=20),this.x=e,this.y=r,this.width=i,this.height=n,this.radius=o,this.type=t.SHAPES.RREC}return e.prototype.clone=function(){return new e(this.x,this.y,this.width,this.height,this.radius)},e.prototype.contains=function(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){var r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;var i=t-(this.x+r),n=e-(this.y+r),o=r*r;if(i*i+n*n<=o)return!0;if((i=t-(this.x+this.width-r))*i+n*n<=o)return!0;if(i*i+(n=e-(this.y+this.height-r))*n<=o)return!0;if((i=t-(this.x+r))*i+n*n<=o)return!0}return!1},e}(),Ge=function(){function t(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0),this._x=r,this._y=i,this.cb=t,this.scope=e}return t.prototype.clone=function(e,r){return void 0===e&&(e=this.cb),void 0===r&&(r=this.scope),new t(e,r,this._x,this._y)},t.prototype.set=function(t,e){return void 0===t&&(t=0),void 0===e&&(e=t),this._x===t&&this._y===e||(this._x=t,this._y=e,this.cb.call(this.scope)),this},t.prototype.copyFrom=function(t){return this._x===t.x&&this._y===t.y||(this._x=t.x,this._y=t.y,this.cb.call(this.scope)),this},t.prototype.copyTo=function(t){return t.set(this._x,this._y),t},t.prototype.equals=function(t){return t.x===this._x&&t.y===this._y},Object.defineProperty(t.prototype,"x",{get:function(){return this._x},set:function(t){this._x!==t&&(this._x=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y},set:function(t){this._y!==t&&(this._y=t,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),t}(),Ue=function(){function t(t,e,r,i,n,o){void 0===t&&(t=1),void 0===e&&(e=0),void 0===r&&(r=0),void 0===i&&(i=1),void 0===n&&(n=0),void 0===o&&(o=0),this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o}return t.prototype.fromArray=function(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]},t.prototype.set=function(t,e,r,i,n,o){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=o,this},t.prototype.toArray=function(t,e){this.array||(this.array=new Float32Array(9));var r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r},t.prototype.apply=function(t,e){e=e||new De;var r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e},t.prototype.applyInverse=function(t,e){e=e||new De;var r=1/(this.a*this.d+this.c*-this.b),i=t.x,n=t.y;return e.x=this.d*r*i+-this.c*r*n+(this.ty*this.c-this.tx*this.d)*r,e.y=this.a*r*n+-this.b*r*i+(-this.ty*this.a+this.tx*this.b)*r,e},t.prototype.translate=function(t,e){return this.tx+=t,this.ty+=e,this},t.prototype.scale=function(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this},t.prototype.rotate=function(t){var e=Math.cos(t),r=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=o*e-this.ty*r,this.ty=o*r+this.ty*e,this},t.prototype.append=function(t){var e=this.a,r=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this},t.prototype.setTransform=function(t,e,r,i,n,o,s,a,h){return this.a=Math.cos(s+h)*n,this.b=Math.sin(s+h)*n,this.c=-Math.sin(s-a)*o,this.d=Math.cos(s-a)*o,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this},t.prototype.prepend=function(t){var e=this.tx;if(1!==t.a||0!==t.b||0!==t.c||1!==t.d){var r=this.a,i=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this},t.prototype.decompose=function(t){var e=this.a,r=this.b,i=this.c,n=this.d,o=t.pivot,s=-Math.atan2(-i,n),a=Math.atan2(r,e),h=Math.abs(s+a);return h<1e-5||Math.abs(Me-h)<1e-5?(t.rotation=a,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=s,t.skew.y=a),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*r+o.y*n),t},t.prototype.invert=function(){var t=this.a,e=this.b,r=this.c,i=this.d,n=this.tx,o=t*i-e*r;return this.a=i/o,this.b=-e/o,this.c=-r/o,this.d=t/o,this.tx=(r*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,this},t.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},t.prototype.clone=function(){var e=new t;return e.a=this.a,e.b=this.b,e.c=this.c,e.d=this.d,e.tx=this.tx,e.ty=this.ty,e},t.prototype.copyTo=function(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t},t.prototype.copyFrom=function(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this},Object.defineProperty(t,"IDENTITY",{get:function(){return new t},enumerable:!1,configurable:!0}),Object.defineProperty(t,"TEMP_MATRIX",{get:function(){return new t},enumerable:!1,configurable:!0}),t}(),ke=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Xe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],je=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],He=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],Ye=[],Ve=[],ze=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];Ye.push(e);for(var r=0;r<16;r++)for(var i=ze(ke[t]*ke[r]+je[t]*Xe[r]),n=ze(Xe[t]*ke[r]+He[t]*Xe[r]),o=ze(ke[t]*je[r]+je[t]*He[r]),s=ze(Xe[t]*je[r]+He[t]*He[r]),a=0;a<16;a++)if(ke[a]===i&&Xe[a]===n&&je[a]===o&&He[a]===s){e.push(a);break}}for(t=0;t<16;t++){var h=new Ue;h.set(ke[t],Xe[t],je[t],He[t],0,0),Ve.push(h)}}();var We={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(t){return ke[t]},uY:function(t){return Xe[t]},vX:function(t){return je[t]},vY:function(t){return He[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return Ye[t][e]},sub:function(t,e){return Ye[t][We.inv(e)]},rotate180:function(t){return 4^t},isVertical:function(t){return 2==(3&t)},byDirection:function(t,e){return 2*Math.abs(t)<=Math.abs(e)?e>=0?We.S:We.N:2*Math.abs(e)<=Math.abs(t)?t>0?We.E:We.W:e>0?t>0?We.SE:We.SW:t>0?We.NE:We.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=Ve[We.inv(e)];n.tx=r,n.ty=i,t.append(n)}},qe=function(){function t(){this.worldTransform=new Ue,this.localTransform=new Ue,this.position=new Ge(this.onChange,this,0,0),this.scale=new Ge(this.onChange,this,1,1),this.pivot=new Ge(this.onChange,this,0,0),this.skew=new Ge(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return t.prototype.onChange=function(){this._localID++},t.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},t.prototype.updateLocalTransform=function(){var t=this.localTransform;this._localID!==this._currentLocalID&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this._currentLocalID=this._localID,this._parentID=-1)},t.prototype.updateTransform=function(t){var e=this.localTransform;if(this._localID!==this._currentLocalID&&(e.a=this._cx*this.scale.x,e.b=this._sx*this.scale.x,e.c=this._cy*this.scale.y,e.d=this._sy*this.scale.y,e.tx=this.position.x-(this.pivot.x*e.a+this.pivot.y*e.c),e.ty=this.position.y-(this.pivot.x*e.b+this.pivot.y*e.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==t._worldID){var r=t.worldTransform,i=this.worldTransform;i.a=e.a*r.a+e.b*r.c,i.b=e.a*r.b+e.b*r.d,i.c=e.c*r.a+e.d*r.c,i.d=e.c*r.b+e.d*r.d,i.tx=e.tx*r.a+e.ty*r.c+r.tx,i.ty=e.tx*r.b+e.ty*r.d+r.ty,this._parentID=t._worldID,this._worldID++}},t.prototype.setFromMatrix=function(t){t.decompose(this),this._localID++},Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this.updateSkew())},enumerable:!1,configurable:!0}),t.IDENTITY=new t,t}();U.SORTABLE_CHILDREN=!1;var Ke=function(){function t(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return t.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},t.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},t.prototype.getRectangle=function(t){return this.minX>this.maxX||this.minY>this.maxY?Ce.EMPTY:((t=t||new Ce(0,0,1,1)).x=this.minX,t.y=this.minY,t.width=this.maxX-this.minX,t.height=this.maxY-this.minY,t)},t.prototype.addPoint=function(t){this.minX=Math.min(this.minX,t.x),this.maxX=Math.max(this.maxX,t.x),this.minY=Math.min(this.minY,t.y),this.maxY=Math.max(this.maxY,t.y)},t.prototype.addPointMatrix=function(t,e){var r=t.a,i=t.b,n=t.c,o=t.d,s=t.tx,a=t.ty,h=r*e.x+n*e.y+s,u=i*e.x+o*e.y+a;this.minX=Math.min(this.minX,h),this.maxX=Math.max(this.maxX,h),this.minY=Math.min(this.minY,u),this.maxY=Math.max(this.maxY,u)},t.prototype.addQuad=function(t){var e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,o=t[0],s=t[1];e=oi?o:i,n=s>n?s:n,e=(o=t[2])i?o:i,n=s>n?s:n,e=(o=t[4])i?o:i,n=s>n?s:n,e=(o=t[6])i?o:i,n=s>n?s:n,this.minX=e,this.minY=r,this.maxX=i,this.maxY=n},t.prototype.addFrame=function(t,e,r,i,n){this.addFrameMatrix(t.worldTransform,e,r,i,n)},t.prototype.addFrameMatrix=function(t,e,r,i,n){var o=t.a,s=t.b,a=t.c,h=t.d,u=t.tx,l=t.ty,c=this.minX,d=this.minY,f=this.maxX,p=this.maxY,_=o*e+a*r+u,v=s*e+h*r+l;c=_f?_:f,p=v>p?v:p,c=(_=o*i+a*r+u)f?_:f,p=v>p?v:p,c=(_=o*e+a*n+u)f?_:f,p=v>p?v:p,c=(_=o*i+a*n+u)f?_:f,p=v>p?v:p,this.minX=c,this.minY=d,this.maxX=f,this.maxY=p},t.prototype.addVertexData=function(t,e,r){for(var i=this.minX,n=this.minY,o=this.maxX,s=this.maxY,a=e;ao?h:o,s=u>s?u:s}this.minX=i,this.minY=n,this.maxX=o,this.maxY=s},t.prototype.addVertices=function(t,e,r,i){this.addVerticesMatrix(t.worldTransform,e,r,i)},t.prototype.addVerticesMatrix=function(t,e,r,i,n,o){void 0===n&&(n=0),void 0===o&&(o=n);for(var s=t.a,a=t.b,h=t.c,u=t.d,l=t.tx,c=t.ty,d=this.minX,f=this.minY,p=this.maxX,_=this.maxY,v=r;vi?t.maxX:i,this.maxY=t.maxY>n?t.maxY:n},t.prototype.addBoundsMask=function(t,e){var r=t.minX>e.minX?t.minX:e.minX,i=t.minY>e.minY?t.minY:e.minY,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.addBoundsMatrix=function(t,e){this.addFrameMatrix(e,t.minX,t.minY,t.maxX,t.maxY)},t.prototype.addBoundsArea=function(t,e){var r=t.minX>e.x?t.minX:e.x,i=t.minY>e.y?t.minY:e.y,n=t.maxXh?n:h,this.maxY=o>u?o:u}},t.prototype.pad=function(t,e){void 0===t&&(t=0),void 0===e&&(e=t),this.isEmpty()||(this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e)},t.prototype.addFramePad=function(t,e,r,i,n,o){t-=n,e-=o,r+=n,i+=o,this.minX=this.minXr?this.maxX:r,this.minY=this.minYi?this.maxY:i},t}(),Ze=function(t,e){return Ze=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])},Ze(t,e)};function Qe(t,e){function r(){this.constructor=t}Ze(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Je=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new qe,e.alpha=1,e.visible=!0,e.renderable=!0,e.cullable=!1,e.cullArea=null,e.parent=null,e.worldAlpha=1,e._lastSortedIndex=0,e._zIndex=0,e.filterArea=null,e.filters=null,e._enabledFilters=null,e._bounds=new Ke,e._localBounds=null,e._boundsID=0,e._boundsRect=null,e._localBoundsRect=null,e._mask=null,e._maskRefCount=0,e._destroyed=!1,e.isSprite=!1,e.isMask=!1,e}return Qe(e,t),e.mixin=function(t){for(var r=Object.keys(t),i=0;i1)for(var i=0;ithis.children.length)throw new Error(t+"addChildAt: The index "+e+" supplied is out of bounds "+this.children.length);return t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.splice(e,0,t),this._boundsID++,this.onChildrenChange(e),t.emit("added",this),this.emit("childAdded",t,this,e),t},r.prototype.swapChildren=function(t,e){if(t!==e){var r=this.getChildIndex(t),i=this.getChildIndex(e);this.children[r]=e,this.children[i]=t,this.onChildrenChange(r=this.children.length)throw new Error("The index "+e+" supplied is out of bounds "+this.children.length);var r=this.getChildIndex(t);fe(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},r.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},r.prototype.removeChild=function(){for(var t=arguments,e=[],r=0;r1)for(var i=0;i0&&n<=e){r=this.children.splice(i,n);for(var o=0;o1&&this.children.sort(tr),this.sortDirty=!1},r.prototype.updateTransform=function(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(var t=0,e=this.children.length;t0&&e.height>0){var i,n;if(this.cullArea?(i=this.cullArea,n=this.worldTransform):this._render!==r.prototype._render&&(i=this.getBounds(!0)),i&&e.intersects(i,n))this._render(t);else if(this.cullArea)return;for(var o=0,s=this.children.length;o8)throw new Error("max arguments reached");var h=this,u=h.name,l=h.items;this._aliasCount++;for(var c=0,d=l.length;c0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},t.prototype.add=function(t){return t[this._name]&&(this.ensureNonAliasedItems(),this.remove(t),this.items.push(t)),this},t.prototype.remove=function(t){var e=this.items.indexOf(t);return-1!==e&&(this.ensureNonAliasedItems(),this.items.splice(e,1)),this},t.prototype.contains=function(t){return-1!==this.items.indexOf(t)},t.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},t.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(t.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),t}();Object.defineProperties(or.prototype,{dispatch:{value:or.prototype.emit},run:{value:or.prototype.emit}}),t.UPDATE_PRIORITY=void 0,U.TARGET_FPMS=.06,function(t){t[t.INTERACTION=50]="INTERACTION",t[t.HIGH=25]="HIGH",t[t.NORMAL=0]="NORMAL",t[t.LOW=-25]="LOW",t[t.UTILITY=-50]="UTILITY"}(t.UPDATE_PRIORITY||(t.UPDATE_PRIORITY={}));var sr=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=0),void 0===i&&(i=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=t,this.context=e,this.priority=r,this.once=i}return t.prototype.match=function(t,e){return void 0===e&&(e=null),this.fn===t&&this.context===e},t.prototype.emit=function(t){this.fn&&(this.context?this.fn.call(this.context,t):this.fn(t));var e=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),e},t.prototype.connect=function(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this},t.prototype.destroy=function(t){void 0===t&&(t=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var e=this.next;return this.next=t?null:e,this.previous=null,e},t}(),ar=function(){function e(){var t=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new sr(null,null,1/0),this.deltaMS=1/U.TARGET_FPMS,this.elapsedMS=1/U.TARGET_FPMS,this._tick=function(e){t._requestId=null,t.started&&(t.update(e),t.started&&null===t._requestId&&t._head.next&&(t._requestId=requestAnimationFrame(t._tick)))}}return e.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},e.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},e.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},e.prototype.add=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new sr(e,r,i))},e.prototype.addOnce=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new sr(e,r,i,!0))},e.prototype._addListener=function(t){var e=this._head.next,r=this._head;if(e){for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}else t.connect(r);return this._startIfPossible(),this},e.prototype.remove=function(t,e){for(var r=this._head.next;r;)r=r.match(t,e)?r.destroy():r.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(e.prototype,"count",{get:function(){if(!this._head)return 0;for(var t=0,e=this._head;e=e.next;)t++;return t},enumerable:!1,configurable:!0}),e.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},e.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},e.prototype.destroy=function(){if(!this._protected){this.stop();for(var t=this._head.next;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}},e.prototype.update=function(t){var e;if(void 0===t&&(t=performance.now()),t>this.lastTime){if((e=this.elapsedMS=t-this.lastTime)>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){var r=t-this._lastFrame|0;if(r=0;--n){var o=ur[n];if(o.test&&o.test(t,r))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var cr=function(t,e){return cr=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])},cr(t,e)};function dr(t,e){function r(){this.constructor=t}cr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var fr=function(){return fr=Object.assign||function(t){for(var e,r=arguments,i=1,n=arguments.length;i0&&l>0,n.textureCacheIds=[],n.destroyed=!1,n.resource=null,n._batchEnabled=0,n._batchLocation=0,n.parentTextureArray=null,n.setResource(r),n}return dr(r,e),Object.defineProperty(r.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"mipmap",{get:function(){return this._mipmap},set:function(t){this._mipmap!==t&&(this._mipmap=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(t){this._scaleMode!==t&&(this._scaleMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(t){this._wrapMode!==t&&(this._wrapMode=t,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),r.prototype.setStyle=function(t,e){var r;return void 0!==t&&t!==this.scaleMode&&(this.scaleMode=t,r=!0),void 0!==e&&e!==this.mipmap&&(this.mipmap=e,r=!0),r&&this.dirtyStyleId++,this},r.prototype.setSize=function(t,e,r){return r=r||this.resolution,this.setRealSize(t*r,e*r,r)},r.prototype.setRealSize=function(t,e,r){return this.resolution=r||this.resolution,this.width=Math.round(t)/this.resolution,this.height=Math.round(e)/this.resolution,this._refreshPOT(),this.update(),this},r.prototype._refreshPOT=function(){this.isPowerOfTwo=ce(this.realWidth)&&ce(this.realHeight)},r.prototype.setResolution=function(t){var e=this.resolution;return e===t||(this.resolution=t,this.valid&&(this.width=Math.round(this.width*e)/t,this.height=Math.round(this.height*e)/t,this.emit("update",this)),this._refreshPOT()),this},r.prototype.setResource=function(t){if(this.resource===t)return this;if(this.resource)throw new Error("Resource can be set only once");return t.bind(this),this.resource=t,this},r.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},r.prototype.onError=function(t){this.emit("error",this,t)},r.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete Te[this.cacheId],delete ge[this.cacheId],this.cacheId=null),this.dispose(),r.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},r.prototype.dispose=function(){this.emit("dispose",this)},r.prototype.castToBaseTexture=function(){return this},r.from=function(t,e,i){void 0===i&&(i=U.STRICT_TEXTURE_CACHE);var n="string"==typeof t,o=null;if(n)o=t;else{if(!t._pixiId){var s=e&&e.pixiIdPrefix||"pixiid";t._pixiId=s+"_"+ve()}o=t._pixiId}var a=Te[o];if(n&&i&&!a)throw new Error('The cacheId "'+o+'" does not exist in BaseTextureCache.');return a||((a=new r(t,e)).cacheId=o,r.addToCache(a,o)),a},r.fromBuffer=function(e,i,n,o){e=e||new Float32Array(i*n*4);var s=new _r(e,{width:i,height:n}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new r(s,Object.assign({},vr,o||{width:i,height:n,type:a}))},r.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),Te[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),Te[e]=t)},r.removeFromCache=function(t){if("string"==typeof t){var e=Te[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete Te[t],e}}else if(t&&t.textureCacheIds){for(var i=0;i0){if(!e.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(e.resource,r)}else e.target=t.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+r,e.parentTextureArray=this.baseTexture,this.items[r]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[r]=e,this},r.prototype.upload=function(t,e,i){for(var n=this.itemDirtyIds,o=0;o)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,e}(Tr),Sr=function(t){function e(r,i){var n=this;if(i=i||{},!(r instanceof HTMLVideoElement)){var o=document.createElement("video");o.setAttribute("preload","auto"),o.setAttribute("webkit-playsinline",""),o.setAttribute("playsinline",""),"string"==typeof r&&(r=[r]);var s=r[0].src||r[0];Tr.crossOrigin(o,s,i.crossorigin);for(var a=0;a2},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(ar.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(ar.shared.remove(this.update,this),this._isConnectedToTicker=!1)},e.prototype._onCanPlay=function(){var t=this.source;t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlay);var e=this.valid;this.resize(t.videoWidth,t.videoHeight),!e&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&t.play()},e.prototype.dispose=function(){this._isConnectedToTicker&&(ar.shared.remove(this.update,this),this._isConnectedToTicker=!1);var e=this.source;e&&(e.removeEventListener("error",this._onError,!0),e.pause(),e.src="",e.load()),t.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ar.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(ar.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(t){t!==this._updateFPS&&(this._updateFPS=t)},enumerable:!1,configurable:!0}),e.test=function(t,r){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.indexOf(r)>-1},e.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],e.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},e}(Tr),Rr=function(t){function e(e){return t.call(this,e)||this}return dr(e,t),e.test=function(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap},e}(Tr);ur.push(xr,Rr,Er,Sr,Ar,_r,br,gr);var Or={__proto__:null,Resource:pr,BaseImageResource:Tr,INSTALLED:ur,autoDetectResource:lr,AbstractMultiResource:yr,ArrayResource:gr,BufferResource:_r,CanvasResource:Er,CubeResource:br,ImageResource:xr,SVGResource:Ar,VideoResource:Sr,ImageBitmapResource:Rr},Mr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return dr(r,e),r.prototype.upload=function(e,r,i){var n=e.gl;n.pixelStorei(n.UNPACK_PREMULTIPLY_ALPHA_WEBGL,r.alphaMode===t.ALPHA_MODES.UNPACK);var o=r.realWidth,s=r.realHeight;return i.width===o&&i.height===s?n.texSubImage2D(r.target,0,0,0,o,s,r.format,i.type,this.data):(i.width=o,i.height=s,n.texImage2D(r.target,0,i.internalFormat,o,s,0,r.format,i.type,this.data)),!0},r}(_r),Pr=function(){function e(e,r){this.width=Math.round(e||100),this.height=Math.round(r||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new or("disposeFramebuffer"),this.multisample=t.MSAA_QUALITY.NONE}return Object.defineProperty(e.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),e.prototype.addColorTexture=function(e,r){return void 0===e&&(e=0),this.colorTextures[e]=r||new mr(null,{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,mipmap:t.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.addDepthTexture=function(e){return this.depthTexture=e||new mr(new Mr(null,{width:this.width,height:this.height}),{scaleMode:t.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:t.MIPMAP_MODES.OFF,format:t.FORMATS.DEPTH_COMPONENT,type:t.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},e.prototype.resize=function(t,e){if(t=Math.round(t),e=Math.round(e),t!==this.width||e!==this.height){this.width=t,this.height=e,this.dirtyId++,this.dirtySize++;for(var r=0;r-1&&e.textureCacheIds.splice(r,1),delete ge[t],e}}else if(t&&t.textureCacheIds){for(var i=0;ithis.baseTexture.width,s=r+n>this.baseTexture.height;if(o||s){var a=o&&s?"and":"or",h="X: "+e+" + "+i+" = "+(e+i)+" > "+this.baseTexture.width,u="Y: "+r+" + "+n+" = "+(r+n)+" > "+this.baseTexture.height;throw new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+h+" "+a+" "+u)}this.valid=i&&n&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=t),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rotate",{get:function(){return this._rotate},set:function(t){this._rotate=t,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),e.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(e,"EMPTY",{get:function(){return e._EMPTY||(e._EMPTY=new e(new mr),Cr(e._EMPTY),Cr(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=U.ADAPTER.createCanvas(16,16),r=t.getContext("2d");t.width=16,t.height=16,r.fillStyle="white",r.fillRect(0,0,16,16),e._WHITE=new e(mr.from(t)),Cr(e._WHITE),Cr(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(j),Fr=function(t){function e(e,r){var i=t.call(this,e,r)||this;return i.valid=!0,i.filterFrame=null,i.filterPoolKey=null,i.updateUvs(),i}return dr(e,t),Object.defineProperty(e.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(t){this.framebuffer.multisample=t},enumerable:!1,configurable:!0}),e.prototype.resize=function(t,e,r){void 0===r&&(r=!0);var i=this.baseTexture.resolution,n=Math.round(t*i)/i,o=Math.round(e*i)/i;this.valid=n>0&&o>0,this._frame.width=this.orig.width=n,this._frame.height=this.orig.height=o,r&&this.baseTexture.resize(n,o),this.updateUvs()},e.prototype.setResolution=function(t){var e=this.baseTexture;e.resolution!==t&&(e.setResolution(t),this.resize(e.width,e.height,!1))},e.create=function(t){for(var r=arguments,i=[],n=1;n1?-n:-1:(o=((65535&(e=le(e)))<<16|65535&(r=le(r)))>>>0,n>1&&(o+=4294967296*n)),this.texturePool[o]||(this.texturePool[o]=[]);var s=this.texturePool[o].pop();return s||(s=this.createTexture(e,r,n)),s.filterPoolKey=o,s.setResolution(i),s},e.prototype.getFilterTexture=function(e,r,i){var n=this.getOptimalTexture(e.width,e.height,r||e.resolution,i||t.MSAA_QUALITY.NONE);return n.filterFrame=e.filterFrame,n},e.prototype.returnTexture=function(t){var e=t.filterPoolKey;t.filterFrame=null,this.texturePool[e].push(t)},e.prototype.returnFilterTexture=function(t){this.returnTexture(t)},e.prototype.clear=function(t){if(t=!1!==t)for(var e in this.texturePool){var r=this.texturePool[e];if(r)for(var i=0;i0&&t.height>0,this.texturePool)if(Number(e)<0){var r=this.texturePool[e];if(r)for(var i=0;i1){for(var u=0;u1&&((c=this.getOptimalFilterTexture(l.width,l.height,r.resolution)).filterFrame=l.filterFrame),i[d].apply(this,l,c,t.CLEAR_MODES.CLEAR,r);var f=l;l=c,c=f}i[d].apply(this,l,u.renderTexture,t.CLEAR_MODES.BLEND,r),d>1&&r.multisample>1&&this.returnFilterTexture(r.renderTexture),this.returnFilterTexture(l),this.returnFilterTexture(c)}r.clear(),this.statePool.push(r)},e.prototype.bindAndClear=function(e,r){void 0===r&&(r=t.CLEAR_MODES.CLEAR);var i=this.renderer,n=i.renderTexture,o=i.state;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e&&e.filterFrame){var s=this.tempRect;s.x=0,s.y=0,s.width=e.filterFrame.width,s.height=e.filterFrame.height,n.bind(e,e.filterFrame,s)}else e!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?n.bind(e):this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame);var a=1&o.stateId||this.forceClear;(r===t.CLEAR_MODES.CLEAR||r===t.CLEAR_MODES.BLIT&&a)&&this.renderer.framebuffer.clear(0,0,0,0)},e.prototype.applyFilter=function(e,r,i,n){var o=this.renderer;o.state.set(e.state),this.bindAndClear(i,n),e.uniforms.uSampler=r,e.uniforms.filterGlobals=this.globalUniforms,o.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(r._frame,r.filterFrame),o.geometry.bind(this.quadUv),o.geometry.draw(t.DRAW_MODES.TRIANGLES)):(o.geometry.bind(this.quad),o.geometry.draw(t.DRAW_MODES.TRIANGLE_STRIP))},e.prototype.calculateSpriteMatrix=function(t,e){var r=this.activeState,i=r.sourceFrame,n=r.destinationFrame,o=e._texture.orig,s=t.set(n.width,0,0,n.height,i.x,i.y),a=e.worldTransform.copyTo(Ue.TEMP_MATRIX);return a.invert(),s.prepend(a),s.scale(1/o.width,1/o.height),s.translate(e.anchor.x,e.anchor.y),s},e.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},e.prototype.getOptimalFilterTexture=function(e,r,i,n){return void 0===i&&(i=1),void 0===n&&(n=t.MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(e,r,i,n)},e.prototype.getFilterTexture=function(e,r,i){if("number"==typeof e){var n=e;e=r,r=n}e=e||this.activeState.renderTexture;var o=this.texturePool.getOptimalTexture(e.width,e.height,r||e.resolution,i||t.MSAA_QUALITY.NONE);return o.filterFrame=e.filterFrame,o},e.prototype.returnFilterTexture=function(t){this.texturePool.returnTexture(t)},e.prototype.emptyPool=function(){this.texturePool.clear(!0)},e.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},e.prototype.transformAABB=function(t,e){var r=Zr[0],i=Zr[1],n=Zr[2],o=Zr[3];r.set(e.left,e.top),i.set(e.left,e.bottom),n.set(e.right,e.top),o.set(e.right,e.bottom),t.apply(r,r),t.apply(i,i),t.apply(n,n),t.apply(o,o);var s=Math.min(r.x,i.x,n.x,o.x),a=Math.min(r.y,i.y,n.y,o.y),h=Math.max(r.x,i.x,n.x,o.x),u=Math.max(r.y,i.y,n.y,o.y);e.x=s,e.y=a,e.width=h-s,e.height=u-a},e.prototype.roundFrame=function(t,e,r,i,n){if(!(t.width<=0||t.height<=0||r.width<=0||r.height<=0)){if(n){var o=n.a,s=n.b,a=n.c,h=n.d;if((Math.abs(s)>1e-4||Math.abs(a)>1e-4)&&(Math.abs(o)>1e-4||Math.abs(h)>1e-4))return}(n=n?Qr.copyFrom(n):Qr.identity()).translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.transformAABB(n,t),t.ceil(e),this.transformAABB(n.invert(),t)}},e}(),$r=function(){function t(t){this.renderer=t}return t.prototype.flush=function(){},t.prototype.destroy=function(){this.renderer=null},t.prototype.start=function(){},t.prototype.stop=function(){this.flush()},t.prototype.render=function(t){},t}(),ti=function(){function t(t){this.renderer=t,this.emptyRenderer=new $r(t),this.currentRenderer=this.emptyRenderer}return t.prototype.setObjectRenderer=function(t){this.currentRenderer!==t&&(this.currentRenderer.stop(),this.currentRenderer=t,this.currentRenderer.start())},t.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},t.prototype.copyBoundTextures=function(t,e){for(var r=this.renderer.texture.boundTextures,i=e-1;i>=0;--i)t[i]=r[i]||null,t[i]&&(t[i]._batchLocation=i)},t.prototype.boundArray=function(t,e,r,i){for(var n=t.elements,o=t.ids,s=t.count,a=0,h=0;h=0&&l=t.ENV.WEBGL2&&(i=e.getContext("webgl2",r)),i)this.webGLVersion=2;else if(this.webGLVersion=1,!(i=e.getContext("webgl",r)||e.getContext("experimental-webgl",r)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=i,this.getExtensions(),this.gl},e.prototype.getExtensions=function(){var t=this.gl,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,e,{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),loseContext:t.getExtension("WEBGL_lose_context"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,e,{colorBufferFloat:t.getExtension("EXT_color_buffer_float")})},e.prototype.handleContextLost=function(t){t.preventDefault()},e.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},e.prototype.destroy=function(){var t=this.renderer.view;this.renderer=null,t.removeEventListener("webglcontextlost",this.handleContextLost),t.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},e.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},e.prototype.validateContext=function(t){var e=t.getContextAttributes(),r="WebGL2RenderingContext"in globalThis&&t instanceof globalThis.WebGL2RenderingContext;r&&(this.webGLVersion=2),e&&!e.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly");var i=r||!!t.getExtension("OES_element_index_uint");this.supports.uint32Indices=i,i||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},e}(),ii=function(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=t.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},ni=new Ce,oi=function(){function e(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new Pr(10,10),this.msaaSamples=null}return e.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Ce,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion){var r=this.renderer.context.extensions.drawBuffers,i=this.renderer.context.extensions.depthTexture;U.PREFER_ENV===t.ENV.WEBGL_LEGACY&&(r=null,i=null),r?e.drawBuffers=function(t){return r.drawBuffersWEBGL(t)}:(this.hasMRT=!1,e.drawBuffers=function(){}),i||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)},e.prototype.bind=function(t,e,r){void 0===r&&(r=0);var i=this.gl;if(t){var n=t.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(t);this.current!==t&&(this.current=t,i.bindFramebuffer(i.FRAMEBUFFER,n.framebuffer)),n.mipLevel!==r&&(t.dirtyId++,t.dirtyFormat++,n.mipLevel=r),n.dirtyId!==t.dirtyId&&(n.dirtyId=t.dirtyId,n.dirtyFormat!==t.dirtyFormat?(n.dirtyFormat=t.dirtyFormat,n.dirtySize=t.dirtySize,this.updateFramebuffer(t,r)):n.dirtySize!==t.dirtySize&&(n.dirtySize=t.dirtySize,this.resizeFramebuffer(t)));for(var o=0;o>r,h=e.height>>r,u=a/e.width;this.setViewport(e.x*u,e.y*u,a,h)}else a=t.width>>r,h=t.height>>r,this.setViewport(0,0,a,h)}else this.current&&(this.current=null,i.bindFramebuffer(i.FRAMEBUFFER,null)),e?this.setViewport(e.x,e.y,e.width,e.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},e.prototype.setViewport=function(t,e,r,i){var n=this.viewport;t=Math.round(t),e=Math.round(e),r=Math.round(r),i=Math.round(i),n.width===r&&n.height===i&&n.x===t&&n.y===e||(n.x=t,n.y=e,n.width=r,n.height=i,this.gl.viewport(t,e,r,i))},Object.defineProperty(e.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),e.prototype.clear=function(e,r,i,n,o){void 0===o&&(o=t.BUFFER_BITS.COLOR|t.BUFFER_BITS.DEPTH);var s=this.gl;s.clearColor(e,r,i,n),s.clear(o)},e.prototype.initFramebuffer=function(t){var e=this.gl,r=new ii(e.createFramebuffer());return r.multisample=this.detectSamples(t.multisample),t.glFramebuffers[this.CONTEXT_UID]=r,this.managedFramebuffers.push(t),t.disposeRunner.add(this),r},e.prototype.resizeFramebuffer=function(t){var e=this.gl,r=t.glFramebuffers[this.CONTEXT_UID];r.msaaBuffer&&(e.bindRenderbuffer(e.RENDERBUFFER,r.msaaBuffer),e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.RGBA8,t.width,t.height)),r.stencil&&(e.bindRenderbuffer(e.RENDERBUFFER,r.stencil),r.msaaBuffer?e.renderbufferStorageMultisample(e.RENDERBUFFER,r.multisample,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,e.DEPTH_STENCIL,t.width,t.height));var i=t.colorTextures,n=i.length;e.drawBuffers||(n=Math.min(n,1));for(var o=0;o1&&this.canMultisampleFramebuffer(t)?(i.msaaBuffer=i.msaaBuffer||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.msaaBuffer),r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.RGBA8,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.RENDERBUFFER,i.msaaBuffer)):i.msaaBuffer&&(r.deleteRenderbuffer(i.msaaBuffer),i.msaaBuffer=null,i.blitFramebuffer&&(i.blitFramebuffer.dispose(),i.blitFramebuffer=null));for(var s=[],a=0;a1&&r.drawBuffers(s),t.depthTexture&&this.writeDepthTexture){var l=t.depthTexture;this.renderer.texture.bind(l,0),r.framebufferTexture2D(r.FRAMEBUFFER,r.DEPTH_ATTACHMENT,r.TEXTURE_2D,l._glTextures[this.CONTEXT_UID].texture,e)}!t.stencil&&!t.depth||t.depthTexture&&this.writeDepthTexture?i.stencil&&(r.deleteRenderbuffer(i.stencil),i.stencil=null):(i.stencil=i.stencil||r.createRenderbuffer(),r.bindRenderbuffer(r.RENDERBUFFER,i.stencil),i.msaaBuffer?r.renderbufferStorageMultisample(r.RENDERBUFFER,i.multisample,r.DEPTH24_STENCIL8,t.width,t.height):r.renderbufferStorage(r.RENDERBUFFER,r.DEPTH_STENCIL,t.width,t.height),r.framebufferRenderbuffer(r.FRAMEBUFFER,r.DEPTH_STENCIL_ATTACHMENT,r.RENDERBUFFER,i.stencil))},e.prototype.canMultisampleFramebuffer=function(t){return 1!==this.renderer.context.webGLVersion&&t.colorTextures.length<=1&&!t.depthTexture},e.prototype.detectSamples=function(e){var r=this.msaaSamples,i=t.MSAA_QUALITY.NONE;if(e<=1||null===r)return i;for(var n=0;n=0&&this.managedFramebuffers.splice(n,1),t.disposeRunner.remove(this),e||(i.deleteFramebuffer(r.framebuffer),r.msaaBuffer&&i.deleteRenderbuffer(r.msaaBuffer),r.stencil&&i.deleteRenderbuffer(r.stencil)),r.blitFramebuffer&&r.blitFramebuffer.dispose()}},e.prototype.disposeAll=function(t){var e=this.managedFramebuffers;this.managedFramebuffers=[];for(var r=0;r=t.ENV.WEBGL2&&(r=e.getContext("webgl2",{})),r||((r=e.getContext("webgl",{})||e.getContext("experimental-webgl",{}))?r.getExtension("WEBGL_draw_buffers"):r=null),_i=r}return _i}function mi(e,r,i){if("precision"!==e.substring(0,9)){var n=r;return r===t.PRECISION.HIGH&&i!==t.PRECISION.HIGH&&(n=t.PRECISION.MEDIUM),"precision "+n+" float;\n"+e}return i!==t.PRECISION.HIGH&&"precision highp"===e.substring(0,15)?e.replace("precision highp","precision mediump"):e}var yi={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function gi(t){return yi[t]}var Ti=null,Ei={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function bi(t,e){if(!Ti){var r=Object.keys(Ei);Ti={};for(var i=0;i0&&(e+="\nelse "),r0?this.maskStack[this.maskStack.length-1]._colorMask:15;r!==e&&this.renderer.gl.colorMask(0!=(1&r),0!=(2&r),0!=(4&r),0!=(8&r))},e.prototype.destroy=function(){this.renderer=null},e}(),ki=function(){function t(t){this.renderer=t,this.maskStack=[],this.glConst=0}return t.prototype.getStackLength=function(){return this.maskStack.length},t.prototype.setMaskStack=function(t){var e=this.renderer.gl,r=this.getStackLength();this.maskStack=t;var i=this.getStackLength();i!==r&&(0===i?e.disable(this.glConst):(e.enable(this.glConst),this._useCurrent()))},t.prototype._useCurrent=function(){},t.prototype.destroy=function(){this.renderer=null,this.maskStack=null},t}(),Xi=new Ue,ji=[],Hi=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=U.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,r}return dr(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._scissorCounter:0},e.prototype.calcScissorRect=function(t){var e;if(!t._scissorRectLocal){var r=t._scissorRect,i=t.maskObject,n=this.renderer,o=n.renderTexture,s=i.getBounds(!0,null!==(e=ji.pop())&&void 0!==e?e:new Ce);this.roundFrameToPixels(s,o.current?o.current.resolution:n.resolution,o.sourceFrame,o.destinationFrame,n.projection.transform),r&&s.fit(r),t._scissorRectLocal=s}},e.isMatrixRotated=function(t){if(!t)return!1;var e=t.a,r=t.b,i=t.c,n=t.d;return(Math.abs(r)>1e-4||Math.abs(i)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(n)>1e-4)},e.prototype.testScissor=function(t){var r=t.maskObject;if(!r.isFastRect||!r.isFastRect())return!1;if(e.isMatrixRotated(r.worldTransform))return!1;if(e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);var i=t._scissorRectLocal;return i.width>0&&i.height>0},e.prototype.roundFrameToPixels=function(t,r,i,n,o){e.isMatrixRotated(o)||((o=o?Xi.copyFrom(o):Xi.identity()).translate(-i.x,-i.y).scale(n.width/i.width,n.height/i.height).translate(n.x,n.y),this.renderer.filter.transformAABB(o,t),t.fit(n),t.x=Math.round(t.x*r),t.y=Math.round(t.y*r),t.width=Math.round(t.width*r),t.height=Math.round(t.height*r))},e.prototype.push=function(t){t._scissorRectLocal||this.calcScissorRect(t);var e=this.renderer.gl;t._scissorRect||e.enable(e.SCISSOR_TEST),t._scissorCounter++,t._scissorRect=t._scissorRectLocal,this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;t&&ji.push(t._scissorRectLocal),this.getStackLength()>0?this._useCurrent():e.disable(e.SCISSOR_TEST)},e.prototype._useCurrent=function(){var t,e=this.maskStack[this.maskStack.length-1]._scissorRect;t=this.renderer.renderTexture.current?e.y:this.renderer.height-e.height-e.y,this.renderer.gl.scissor(e.x,t,e.width,e.height)},e}(ki),Yi=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=U.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,r}return dr(e,t),e.prototype.getStackLength=function(){var t=this.maskStack[this.maskStack.length-1];return t?t._stencilCounter:0},e.prototype.push=function(t){var e=t.maskObject,r=this.renderer.gl,i=t._stencilCounter;0===i&&(this.renderer.framebuffer.forceStencil(),r.clearStencil(0),r.clear(r.STENCIL_BUFFER_BIT),r.enable(r.STENCIL_TEST)),t._stencilCounter++;var n=t._colorMask;0!==n&&(t._colorMask=0,r.colorMask(!1,!1,!1,!1)),r.stencilFunc(r.EQUAL,i,4294967295),r.stencilOp(r.KEEP,r.KEEP,r.INCR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,0!==n&&(t._colorMask=n,r.colorMask(0!=(1&n),0!=(2&n),0!=(4&n),0!=(8&n))),this._useCurrent()},e.prototype.pop=function(t){var e=this.renderer.gl;if(0===this.getStackLength())e.disable(e.STENCIL_TEST);else{var r=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,i=r?r._colorMask:15;0!==i&&(r._colorMask=0,e.colorMask(!1,!1,!1,!1)),e.stencilOp(e.KEEP,e.KEEP,e.DECR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,0!==i&&(r._colorMask=i,e.colorMask(0!=(1&i),0!=(2&i),0!=(4&i),0!=(8&i))),this._useCurrent()}},e.prototype._useCurrent=function(){var t=this.renderer.gl;t.stencilFunc(t.EQUAL,this.getStackLength(),4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP)},e}(ki),Vi=function(){function t(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new Ue,this.transform=null}return t.prototype.update=function(t,e,r,i){this.destinationFrame=t||this.destinationFrame||this.defaultFrame,this.sourceFrame=e||this.sourceFrame||t,this.calculateProjection(this.destinationFrame,this.sourceFrame,r,i),this.transform&&this.projectionMatrix.append(this.transform);var n=this.renderer;n.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,n.globalUniforms.update(),n.shader.shader&&n.shader.syncUniformGroup(n.shader.shader.uniforms.globals)},t.prototype.calculateProjection=function(t,e,r,i){var n=this.projectionMatrix,o=i?-1:1;n.identity(),n.a=1/e.width*2,n.d=o*(1/e.height*2),n.tx=-1-e.x*n.a,n.ty=-o-e.y*n.d},t.prototype.setTransform=function(t){},t.prototype.destroy=function(){this.renderer=null},t}(),zi=new Ce,Wi=new Ce,qi=function(){function t(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Ce,this.destinationFrame=new Ce,this.viewportFrame=new Ce}return t.prototype.bind=function(t,e,r){void 0===t&&(t=null);var i,n,o,s=this.renderer;this.current=t,t?(o=(i=t.baseTexture).resolution,e||(zi.width=t.frame.width,zi.height=t.frame.height,e=zi),r||(Wi.x=t.frame.x,Wi.y=t.frame.y,Wi.width=e.width,Wi.height=e.height,r=Wi),n=i.framebuffer):(o=s.resolution,e||(zi.width=s.screen.width,zi.height=s.screen.height,e=zi),r||((r=zi).width=e.width,r.height=e.height));var a=this.viewportFrame;a.x=r.x*o,a.y=r.y*o,a.width=r.width*o,a.height=r.height*o,t||(a.y=s.view.height-(a.y+a.height)),a.ceil(),this.renderer.framebuffer.bind(n,a),this.renderer.projection.update(r,e,o,!n),t?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(e),this.destinationFrame.copyFrom(r)},t.prototype.clear=function(t,e){t=this.current?t||this.current.baseTexture.clearColor:t||this.clearColor;var r=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,n=r.width!==i.width||r.height!==i.height;if(n){var o=this.viewportFrame,s=o.x,a=o.y,h=o.width,u=o.height;s=Math.round(s),a=Math.round(a),h=Math.round(h),u=Math.round(u),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(s,a,h,u)}this.renderer.framebuffer.clear(t[0],t[1],t[2],t[3],e),n&&this.renderer.scissor.pop()},t.prototype.resize=function(){this.bind(null)},t.prototype.reset=function(){this.bind(null)},t.prototype.destroy=function(){this.renderer=null},t}();function Ki(t,e,r,i,n){r.buffer.update(n)}var Zi={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},Qi={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function Ji(t){for(var e=t.map((function(t){return{data:t,offset:0,dataLen:0,dirty:0}})),r=0,i=0,n=0,o=0;o1&&(r=Math.max(r,16)*s.data.size),s.dataLen=r,i%r!=0&&i<16){var a=i%r%16;i+=a,n+=a}i+r>16?(n=16*Math.ceil(n/16),s.offset=n,n+=r,i=r):(s.offset=n,i+=r,n+=r)}return{uboElements:e,size:n=16*Math.ceil(n/16)}}function $i(t,e){var r=[];for(var i in t)e[i]&&r.push(e[i]);return r.sort((function(t,e){return t.index-e.index})),r}function tn(t,e){if(!t.autoManage)return{size:0,syncFunc:Ki};for(var r=Ji($i(t.uniforms,e)),i=r.uboElements,n=r.size,o=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],s=0;s1){var f=gi(a.data.type),p=Math.max(Qi[a.data.type]/16,1),_=f/p,v=(4-_%4)%4;o.push("\n cv = ud."+u+".value;\n v = uv."+u+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*p+"; i++)\n {\n for(var j = 0; j < "+_+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+v+";\n }\n\n ")}else{var m=Zi[a.data.type];o.push("\n cv = ud."+u+".value;\n v = uv."+u+";\n offset = "+a.offset/4+";\n "+m+";\n ")}}return o.push("\n renderer.buffer.update(buffer);\n "),{size:n,syncFunc:new Function("ud","uv","renderer","syncData","buffer",o.join("\n"))}}var en=function(){function t(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return t.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},t}();function rn(t,e){var r=ui(t,t.VERTEX_SHADER,e.vertexSrc),i=ui(t,t.FRAGMENT_SHADER,e.fragmentSrc),n=t.createProgram();if(t.attachShader(n,r),t.attachShader(n,i),t.linkProgram(n),t.getProgramParameter(n,t.LINK_STATUS)||function(t,e,r,i){t.getProgramParameter(e,t.LINK_STATUS)||(t.getShaderParameter(r,t.COMPILE_STATUS)||li(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||li(t,i),console.error("PixiJS Error: Could not initialize shader."),""!==t.getProgramInfoLog(e)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",t.getProgramInfoLog(e)))}(t,n,r,i),e.attributeData=function(t,e){for(var r={},i=e.getProgramParameter(t,e.ACTIVE_ATTRIBUTES),n=0;ne?1:-1}));for(var s=0;s>=1,r++;this.stateId=t.data}for(r=0;rthis.checkCountMax&&(this.checkCount=0,this.run())))},e.prototype.run=function(){for(var t=this.renderer.texture,e=t.managedTextures,r=!1,i=0;ithis.maxIdle&&(t.destroyTexture(n,!0),e[i]=null,r=!0)}if(r){var o=0;for(i=0;i=0;i--)this.unload(t.children[i])},e.prototype.destroy=function(){this.renderer=null},e}(),un=function(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=t.TYPES.UNSIGNED_BYTE,this.internalFormat=t.FORMATS.RGBA,this.samplerType=0},ln=function(){function e(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new mr,this.hasIntegerTextures=!1}return e.prototype.contextChange=function(){var e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(e){var r,i,n,o,s,a,h,u,l,c,d,f,p,_,v,m,y,g,T,E,b,x,A;return"WebGL2RenderingContext"in globalThis&&e instanceof globalThis.WebGL2RenderingContext?((r={})[t.TYPES.UNSIGNED_BYTE]=((i={})[t.FORMATS.RGBA]=e.RGBA8,i[t.FORMATS.RGB]=e.RGB8,i[t.FORMATS.RG]=e.RG8,i[t.FORMATS.RED]=e.R8,i[t.FORMATS.RGBA_INTEGER]=e.RGBA8UI,i[t.FORMATS.RGB_INTEGER]=e.RGB8UI,i[t.FORMATS.RG_INTEGER]=e.RG8UI,i[t.FORMATS.RED_INTEGER]=e.R8UI,i[t.FORMATS.ALPHA]=e.ALPHA,i[t.FORMATS.LUMINANCE]=e.LUMINANCE,i[t.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,i),r[t.TYPES.BYTE]=((n={})[t.FORMATS.RGBA]=e.RGBA8_SNORM,n[t.FORMATS.RGB]=e.RGB8_SNORM,n[t.FORMATS.RG]=e.RG8_SNORM,n[t.FORMATS.RED]=e.R8_SNORM,n[t.FORMATS.RGBA_INTEGER]=e.RGBA8I,n[t.FORMATS.RGB_INTEGER]=e.RGB8I,n[t.FORMATS.RG_INTEGER]=e.RG8I,n[t.FORMATS.RED_INTEGER]=e.R8I,n),r[t.TYPES.UNSIGNED_SHORT]=((o={})[t.FORMATS.RGBA_INTEGER]=e.RGBA16UI,o[t.FORMATS.RGB_INTEGER]=e.RGB16UI,o[t.FORMATS.RG_INTEGER]=e.RG16UI,o[t.FORMATS.RED_INTEGER]=e.R16UI,o[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT16,o),r[t.TYPES.SHORT]=((s={})[t.FORMATS.RGBA_INTEGER]=e.RGBA16I,s[t.FORMATS.RGB_INTEGER]=e.RGB16I,s[t.FORMATS.RG_INTEGER]=e.RG16I,s[t.FORMATS.RED_INTEGER]=e.R16I,s),r[t.TYPES.UNSIGNED_INT]=((a={})[t.FORMATS.RGBA_INTEGER]=e.RGBA32UI,a[t.FORMATS.RGB_INTEGER]=e.RGB32UI,a[t.FORMATS.RG_INTEGER]=e.RG32UI,a[t.FORMATS.RED_INTEGER]=e.R32UI,a[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT24,a),r[t.TYPES.INT]=((h={})[t.FORMATS.RGBA_INTEGER]=e.RGBA32I,h[t.FORMATS.RGB_INTEGER]=e.RGB32I,h[t.FORMATS.RG_INTEGER]=e.RG32I,h[t.FORMATS.RED_INTEGER]=e.R32I,h),r[t.TYPES.FLOAT]=((u={})[t.FORMATS.RGBA]=e.RGBA32F,u[t.FORMATS.RGB]=e.RGB32F,u[t.FORMATS.RG]=e.RG32F,u[t.FORMATS.RED]=e.R32F,u[t.FORMATS.DEPTH_COMPONENT]=e.DEPTH_COMPONENT32F,u),r[t.TYPES.HALF_FLOAT]=((l={})[t.FORMATS.RGBA]=e.RGBA16F,l[t.FORMATS.RGB]=e.RGB16F,l[t.FORMATS.RG]=e.RG16F,l[t.FORMATS.RED]=e.R16F,l),r[t.TYPES.UNSIGNED_SHORT_5_6_5]=((c={})[t.FORMATS.RGB]=e.RGB565,c),r[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=((d={})[t.FORMATS.RGBA]=e.RGBA4,d),r[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=((f={})[t.FORMATS.RGBA]=e.RGB5_A1,f),r[t.TYPES.UNSIGNED_INT_2_10_10_10_REV]=((p={})[t.FORMATS.RGBA]=e.RGB10_A2,p[t.FORMATS.RGBA_INTEGER]=e.RGB10_A2UI,p),r[t.TYPES.UNSIGNED_INT_10F_11F_11F_REV]=((_={})[t.FORMATS.RGB]=e.R11F_G11F_B10F,_),r[t.TYPES.UNSIGNED_INT_5_9_9_9_REV]=((v={})[t.FORMATS.RGB]=e.RGB9_E5,v),r[t.TYPES.UNSIGNED_INT_24_8]=((m={})[t.FORMATS.DEPTH_STENCIL]=e.DEPTH24_STENCIL8,m),r[t.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=((y={})[t.FORMATS.DEPTH_STENCIL]=e.DEPTH32F_STENCIL8,y),A=r):((g={})[t.TYPES.UNSIGNED_BYTE]=((T={})[t.FORMATS.RGBA]=e.RGBA,T[t.FORMATS.RGB]=e.RGB,T[t.FORMATS.ALPHA]=e.ALPHA,T[t.FORMATS.LUMINANCE]=e.LUMINANCE,T[t.FORMATS.LUMINANCE_ALPHA]=e.LUMINANCE_ALPHA,T),g[t.TYPES.UNSIGNED_SHORT_5_6_5]=((E={})[t.FORMATS.RGB]=e.RGB,E),g[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=((b={})[t.FORMATS.RGBA]=e.RGBA,b),g[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=((x={})[t.FORMATS.RGBA]=e.RGBA,x),A=g),A}(e);var r=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=r;for(var i=0;i=0;--s){var a=i[s];a&&a._glTextures[o].samplerType!==t.SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(a)}},e.prototype.initTexture=function(t){var e=new un(this.gl.createTexture());return e.dirtyId=-1,t._glTextures[this.CONTEXT_UID]=e,this.managedTextures.push(t),t.on("dispose",this.destroyTexture,this),e},e.prototype.initTextureType=function(e,r){var i,n;r.internalFormat=null!==(n=null===(i=this.internalFormats[e.type])||void 0===i?void 0:i[e.format])&&void 0!==n?n:e.format,2===this.webGLVersion&&e.type===t.TYPES.HALF_FLOAT?r.type=this.gl.HALF_FLOAT:r.type=e.type},e.prototype.updateTexture=function(e){var r=e._glTextures[this.CONTEXT_UID];if(r){var i=this.renderer;if(this.initTextureType(e,r),e.resource&&e.resource.upload(i,e,r))r.samplerType!==t.SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0);else{var n=e.realWidth,o=e.realHeight,s=i.gl;(r.width!==n||r.height!==o||r.dirtyId<0)&&(r.width=n,r.height=o,s.texImage2D(e.target,0,r.internalFormat,n,o,0,e.format,r.type,null))}e.dirtyStyleId!==r.dirtyStyleId&&this.updateTextureStyle(e),r.dirtyId=e.dirtyId}},e.prototype.destroyTexture=function(t,e){var r=this.gl;if((t=t.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(t),r.deleteTexture(t._glTextures[this.CONTEXT_UID].texture),t.off("dispose",this.destroyTexture,this),delete t._glTextures[this.CONTEXT_UID],!e)){var i=this.managedTextures.indexOf(t);-1!==i&&fe(this.managedTextures,i,1)}},e.prototype.updateTextureStyle=function(e){var r=e._glTextures[this.CONTEXT_UID];r&&(e.mipmap!==t.MIPMAP_MODES.POW2&&2===this.webGLVersion||e.isPowerOfTwo?r.mipmap=e.mipmap>=1:r.mipmap=!1,2===this.webGLVersion||e.isPowerOfTwo?r.wrapMode=e.wrapMode:r.wrapMode=t.WRAP_MODES.CLAMP,e.resource&&e.resource.style(this.renderer,e,r)||this.setStyle(e,r),r.dirtyStyleId=e.dirtyStyleId)},e.prototype.setStyle=function(e,r){var i=this.gl;if(r.mipmap&&e.mipmap!==t.MIPMAP_MODES.ON_MANUAL&&i.generateMipmap(e.target),i.texParameteri(e.target,i.TEXTURE_WRAP_S,r.wrapMode),i.texParameteri(e.target,i.TEXTURE_WRAP_T,r.wrapMode),r.mipmap){i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR_MIPMAP_LINEAR:i.NEAREST_MIPMAP_NEAREST);var n=this.renderer.context.extensions.anisotropicFiltering;if(n&&e.anisotropicLevel>0&&e.scaleMode===t.SCALE_MODES.LINEAR){var o=Math.min(e.anisotropicLevel,i.getParameter(n.MAX_TEXTURE_MAX_ANISOTROPY_EXT));i.texParameterf(e.target,n.TEXTURE_MAX_ANISOTROPY_EXT,o)}}else i.texParameteri(e.target,i.TEXTURE_MIN_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST);i.texParameteri(e.target,i.TEXTURE_MAG_FILTER,e.scaleMode===t.SCALE_MODES.LINEAR?i.LINEAR:i.NEAREST)},e.prototype.destroy=function(){this.renderer=null},e}(),cn={__proto__:null,FilterSystem:Jr,BatchSystem:ti,ContextSystem:ri,FramebufferSystem:oi,GeometrySystem:ai,MaskSystem:Ui,ScissorSystem:Hi,StencilSystem:Yi,ProjectionSystem:Vi,RenderTextureSystem:qi,ShaderSystem:sn,StateSystem:an,TextureGCSystem:hn,TextureSystem:ln},dn=new Ue,fn=function(e){function r(r,i){void 0===r&&(r=t.RENDERER_TYPE.UNKNOWN);var n=e.call(this)||this;return i=Object.assign({},U.RENDER_OPTIONS,i),n.options=i,n.type=r,n.screen=new Ce(0,0,i.width,i.height),n.view=i.view||U.ADAPTER.createCanvas(),n.resolution=i.resolution||U.RESOLUTION,n.useContextAlpha=i.useContextAlpha,n.autoDensity=!!i.autoDensity,n.preserveDrawingBuffer=i.preserveDrawingBuffer,n.clearBeforeRender=i.clearBeforeRender,n._backgroundColor=0,n._backgroundColorRgba=[0,0,0,1],n._backgroundColorString="#000000",n.backgroundColor=i.backgroundColor||n._backgroundColor,n.backgroundAlpha=i.backgroundAlpha,void 0!==i.transparent&&(n.useContextAlpha=i.transparent,n.backgroundAlpha=i.transparent?0:1),n._lastObjectRendered=null,n.plugins={},n}return dr(r,e),r.prototype.initPlugins=function(t){for(var e in t)this.plugins[e]=new t[e](this)},Object.defineProperty(r.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),r.prototype.resize=function(t,e){this.view.width=Math.round(t*this.resolution),this.view.height=Math.round(e*this.resolution);var r=this.view.width/this.resolution,i=this.view.height/this.resolution;this.screen.width=r,this.screen.height=i,this.autoDensity&&(this.view.style.width=r+"px",this.view.style.height=i+"px"),this.emit("resize",r,i)},r.prototype.generateTexture=function(t,e,r,i){void 0===e&&(e={}),"number"==typeof e&&(e={scaleMode:e,resolution:r,region:i});var n=e.region,o=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=t.data.byteLength)e.bufferSubData(t.type,0,t.data);else{var n=t.static?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=t.data.byteLength,e.bufferData(t.type,t.data,n)}},t.prototype.dispose=function(t,e){if(this.managedBuffers[t.id]){delete this.managedBuffers[t.id];var r=t._glBuffers[this.CONTEXT_UID],i=this.gl;t.disposeRunner.remove(this),r&&(e||i.deleteBuffer(r.buffer),delete t._glBuffers[this.CONTEXT_UID])}},t.prototype.disposeAll=function(t){for(var e=Object.keys(this.managedBuffers),r=0;r=t.MSAA_QUALITY.HIGH?this.multisample=t.MSAA_QUALITY.HIGH:e>=t.MSAA_QUALITY.MEDIUM?this.multisample=t.MSAA_QUALITY.MEDIUM:e>=t.MSAA_QUALITY.LOW?this.multisample=t.MSAA_QUALITY.LOW:this.multisample=t.MSAA_QUALITY.NONE},r.prototype.addSystem=function(t,e){var r=new t(this);if(this[e])throw new Error('Whoops! The name "'+e+'" is already in use');for(var i in this[e]=r,this.runners)this.runners[i].add(r);return this},r.prototype.render=function(t,e){var r,i,n,o;if(e&&(e instanceof Fr?(r=e,i=arguments[2],n=arguments[3],o=arguments[4]):(r=e.renderTexture,i=e.clear,n=e.transform,o=e.skipUpdateTransform)),this.renderingToScreen=!r,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=n,!this.context.isLost){if(r||(this._lastObjectRendered=t),!o){var s=t.enableTempParent();t.updateTransform(),t.disableTempParent(s)}this.renderTexture.bind(r),this.batch.currentRenderer.start(),(void 0!==i?i:this.clearBeforeRender)&&this.renderTexture.clear(),t.render(this),this.batch.currentRenderer.flush(),r&&r.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender")}},r.prototype.generateTexture=function(t,r,i,n){void 0===r&&(r={});var o=e.prototype.generateTexture.call(this,t,r,i,n);return this.framebuffer.blit(),o},r.prototype.resize=function(t,r){e.prototype.resize.call(this,t,r),this.runners.resize.emit(this.screen.height,this.screen.width)},r.prototype.reset=function(){return this.runners.reset.emit(),this},r.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},r.prototype.destroy=function(t){for(var r in this.runners.destroy.emit(),this.runners)this.runners[r].destroy();e.prototype.destroy.call(this,t),this.gl=null},Object.defineProperty(r.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),r.registerPlugin=function(e,r){nr.add({name:e,type:t.ExtensionType.RendererPlugin,ref:r})},r.__plugins={},r}(fn);function mn(t){return vn.create(t)}nr.handleByMap(t.ExtensionType.RendererPlugin,vn.__plugins);var yn="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",gn="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",Tn=function(){function t(t){this.renderer=t}return t.prototype.destroy=function(){this.renderer=null},t}(),En=function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},bn=function(){function t(){this.elements=[],this.ids=[],this.count=0}return t.prototype.clear=function(){for(var t=0;tthis.size&&this.flush(),this._vertexCount+=t.vertexData.length/2,this._indexCount+=t.indices.length,this._bufferedTextures[this._bufferSize]=t._texture.baseTexture,this._bufferedElements[this._bufferSize++]=t)},r.prototype.buildTexturesAndDrawCalls=function(){var t=this._bufferedTextures,e=this.MAX_TEXTURES,i=r._textureArrayPool,n=this.renderer.batch,o=this._tempBoundTextures,s=this.renderer.textureGC.count,a=++mr._globalBatch,h=0,u=i[0],l=0;n.copyBoundTextures(o,e);for(var c=0;c=e&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,c),l=c,u=i[++h],++a),d._batchEnabled=a,d.touched=s,u.elements[u.count++]=d)}for(u.count>0&&(n.boundArray(u,o,a,e),this.buildDrawCalls(u,l,this._bufferSize),++h,++a),c=0;c0&&(e+="\nelse "),r title : "+t.title+"
tabIndex: "+t.tabIndex},e.prototype.capHitArea=function(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);var e=this.renderer,r=e.width,i=e.height;t.x+t.width>r&&(t.width=r-t.x),t.y+t.height>i&&(t.height=i-t.y)},e.prototype.addChild=function(t){var e=this.pool.pop();e||((e=document.createElement("button")).style.width="100px",e.style.height="100px",e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=2..toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?e.setAttribute("aria-live","off"):e.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?e.setAttribute("aria-relevant","additions"):e.setAttribute("aria-relevant","text"),e.addEventListener("click",this._onClick.bind(this)),e.addEventListener("focus",this._onFocus.bind(this)),e.addEventListener("focusout",this._onFocusOut.bind(this))),e.style.pointerEvents=t.accessiblePointerEvents,e.type=t.accessibleType,t.accessibleTitle&&null!==t.accessibleTitle?e.title=t.accessibleTitle:t.accessibleHint&&null!==t.accessibleHint||(e.title="displayObject "+t.tabIndex),t.accessibleHint&&null!==t.accessibleHint&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this.updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.displayObject=t,this.children.push(t),this.div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex},e.prototype._onClick=function(t){var e=this.renderer.plugins.interaction,r=t.target.displayObject,i=e.eventData;e.dispatchEvent(r,"click",i),e.dispatchEvent(r,"pointertap",i),e.dispatchEvent(r,"tap",i)},e.prototype._onFocus=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive");var e=this.renderer.plugins.interaction,r=t.target.displayObject,i=e.eventData;e.dispatchEvent(r,"mouseover",i)},e.prototype._onFocusOut=function(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite");var e=this.renderer.plugins.interaction,r=t.target.displayObject,i=e.eventData;e.dispatchEvent(r,"mouseout",i)},e.prototype._onKeyDown=function(t){9===t.keyCode&&this.activate()},e.prototype._onMouseMove=function(t){0===t.movementX&&0===t.movementY||this.deactivate()},e.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},e.extension={name:"accessibility",type:[t.ExtensionType.RendererPlugin,t.ExtensionType.CanvasRendererPlugin]},e}(),Gn=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new De,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(t.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),t.prototype.getLocalPosition=function(t,e,r){return t.worldTransform.applyInverse(r||this.global,e)},t.prototype.copyEvent=function(t){"isPrimary"in t&&t.isPrimary&&(this.isPrimary=!0),this.button="button"in t&&t.button;var e="buttons"in t&&t.buttons;this.buttons=Number.isInteger(e)?e:"which"in t&&t.which,this.width="width"in t&&t.width,this.height="height"in t&&t.height,this.tiltX="tiltX"in t&&t.tiltX,this.tiltY="tiltY"in t&&t.tiltY,this.pointerType="pointerType"in t&&t.pointerType,this.pressure="pressure"in t&&t.pressure,this.rotationAngle="rotationAngle"in t&&t.rotationAngle,this.twist="twist"in t&&t.twist||0,this.tangentialPressure="tangentialPressure"in t&&t.tangentialPressure||0},t.prototype.reset=function(){this.isPrimary=!1},t}(),Un=function(t,e){return Un=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])},Un(t,e)},kn=function(){function t(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return t.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},t.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},t}(),Xn=function(){function t(e){this._pointerId=e,this._flags=t.FLAGS.NONE}return t.prototype._doSet=function(t,e){this._flags=e?this._flags|t:this._flags&~t},Object.defineProperty(t.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"flags",{get:function(){return this._flags},set:function(t){this._flags=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"none",{get:function(){return this._flags===t.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"over",{get:function(){return 0!=(this._flags&t.FLAGS.OVER)},set:function(e){this._doSet(t.FLAGS.OVER,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"rightDown",{get:function(){return 0!=(this._flags&t.FLAGS.RIGHT_DOWN)},set:function(e){this._doSet(t.FLAGS.RIGHT_DOWN,e)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"leftDown",{get:function(){return 0!=(this._flags&t.FLAGS.LEFT_DOWN)},set:function(e){this._doSet(t.FLAGS.LEFT_DOWN,e)},enumerable:!1,configurable:!0}),t.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),t}(),jn=function(){function t(){this._tempPoint=new De}return t.prototype.recursiveFindHit=function(t,e,r,i,n){var o;if(!e||!e.visible)return!1;var s=t.data.global,a=!1,h=n=e.interactive||n,u=!0;if(e.hitArea)i&&(e.worldTransform.applyInverse(s,this._tempPoint),e.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?a=!0:(i=!1,u=!1)),h=!1;else if(e._mask&&i){var l=e._mask.isMaskData?e._mask.maskObject:e._mask;l&&!(null===(o=l.containsPoint)||void 0===o?void 0:o.call(l,s))&&(i=!1)}if(u&&e.interactiveChildren&&e.children)for(var c=e.children,d=c.length-1;d>=0;d--){var f=c[d],p=this.recursiveFindHit(t,f,r,i,h);if(p){if(!f.parent)continue;h=!1,p&&(t.target&&(i=!1),a=!0)}}return n&&(i&&!t.target&&!e.hitArea&&e.containsPoint&&e.containsPoint(s)&&(a=!0),e.interactive&&(a&&!t.target&&(t.target=e),r&&r(t,e,!!a))),a},t.prototype.findHit=function(t,e,r,i){this.recursiveFindHit(t,e,r,i,!1)},t}(),Hn={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(t){t?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0};Je.mixin(Hn);var Yn={target:null,data:{global:null}},Vn=function(e){function r(t,r){var i=e.call(this)||this;return r=r||{},i.renderer=t,i.autoPreventDefault=void 0===r.autoPreventDefault||r.autoPreventDefault,i.interactionFrequency=r.interactionFrequency||10,i.mouse=new Gn,i.mouse.identifier=1,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[1]=i.mouse,i.interactionDataPool=[],i.eventData=new kn,i.interactionDOMElement=null,i.moveWhenInside=!1,i.eventsAdded=!1,i.tickerAdded=!1,i.mouseOverRenderer=!("PointerEvent"in globalThis),i.supportsTouchEvents="ontouchstart"in globalThis,i.supportsPointerEvents=!!globalThis.PointerEvent,i.onPointerUp=i.onPointerUp.bind(i),i.processPointerUp=i.processPointerUp.bind(i),i.onPointerCancel=i.onPointerCancel.bind(i),i.processPointerCancel=i.processPointerCancel.bind(i),i.onPointerDown=i.onPointerDown.bind(i),i.processPointerDown=i.processPointerDown.bind(i),i.onPointerMove=i.onPointerMove.bind(i),i.processPointerMove=i.processPointerMove.bind(i),i.onPointerOut=i.onPointerOut.bind(i),i.processPointerOverOut=i.processPointerOverOut.bind(i),i.onPointerOver=i.onPointerOver.bind(i),i.cursorStyles={default:"inherit",pointer:"pointer"},i.currentCursorMode=null,i.cursor=null,i.resolution=1,i.delayedEvents=[],i.search=new jn,i._tempDisplayObject=new $e,i._eventListenerOptions={capture:!0,passive:!1},i._useSystemTicker=void 0===r.useSystemTicker||r.useSystemTicker,i.setTargetElement(i.renderer.view,i.renderer.resolution),i}return function(t,e){function r(){this.constructor=t}Un(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),Object.defineProperty(r.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(t){this._useSystemTicker=t,t?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),r.prototype.hitTest=function(t,e){return Yn.target=null,Yn.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(Yn,e,null,!0),Yn.target},r.prototype.setTargetElement=function(t,e){void 0===e&&(e=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=t,this.resolution=e,this.addEvents(),this.addTickerListener()},r.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(ar.system.add(this.tickerUpdate,this,t.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},r.prototype.removeTickerListener=function(){this.tickerAdded&&(ar.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},r.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="none",t.msTouchAction="none"):this.supportsPointerEvents&&(t.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},r.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var t=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(t.msContentZooming="",t.msTouchAction=""):this.supportsPointerEvents&&(t.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},r.prototype.tickerUpdate=function(t){this._deltaTime+=t,this._deltaTime0&&(o=t.composedPath()[0]);for(var s=o!==this.interactionDOMElement?"outside":"",a=0;a0||e.responseType===t.XHR_RESPONSE_TYPE.BUFFER)?i=200:1223===i&&(i=204),2==(i/100|0)){if(this.xhrType===t.XHR_RESPONSE_TYPE.TEXT)this.data=r,this.type=t.TYPE.TEXT;else if(this.xhrType===t.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(r),this.type=t.TYPE.JSON}catch(t){return void this.abort("Error trying to parse loaded json: "+t)}else if(this.xhrType===t.XHR_RESPONSE_TYPE.DOCUMENT)try{if(globalThis.DOMParser){var n=new DOMParser;this.data=n.parseFromString(r,"text/xml")}else{var o=document.createElement("div");o.innerHTML=r,this.data=o}this.type=t.TYPE.XML}catch(t){return void this.abort("Error trying to parse loaded xml: "+t)}else this.data=e.response||r;this.complete()}else this.abort("["+e.status+"] "+e.statusText+": "+e.responseURL)},t.prototype._determineCrossOrigin=function(t,e){if(0===t.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";e=e||globalThis.location,$n||($n=document.createElement("a")),$n.href=t;var r=Jn($n.href,{strictMode:!0}),i=!r.port&&""===e.port||r.port===e.port,n=r.protocol?r.protocol+":":"";return r.host===e.hostname&&i&&n===e.protocol?"":"anonymous"},t.prototype._determineXhrType=function(){return t._xhrTypeMap[this.extension]||t.XHR_RESPONSE_TYPE.TEXT},t.prototype._determineLoadType=function(){return t._loadTypeMap[this.extension]||t.LOAD_TYPE.XHR},t.prototype._getExtension=function(t){void 0===t&&(t=this.url);var e="";if(this.isDataUrl){var r=t.indexOf("/");e=t.substring(r+1,t.indexOf(";",r))}else{var i=t.indexOf("?"),n=t.indexOf("#"),o=Math.min(i>-1?i:t.length,n>-1?n:t.length);e=(t=t.substring(0,o)).substring(t.lastIndexOf(".")+1)}return e.toLowerCase()},t.prototype._getMimeFromXhrType=function(e){switch(e){case t.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case t.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case t.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case t.XHR_RESPONSE_TYPE.JSON:return"application/json";case t.XHR_RESPONSE_TYPE.DEFAULT:case t.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},t}(),function(t){var e,r,i,n;(e=t.STATUS_FLAGS||(t.STATUS_FLAGS={}))[e.NONE=0]="NONE",e[e.DATA_URL=1]="DATA_URL",e[e.COMPLETE=2]="COMPLETE",e[e.LOADING=4]="LOADING",(r=t.TYPE||(t.TYPE={}))[r.UNKNOWN=0]="UNKNOWN",r[r.JSON=1]="JSON",r[r.XML=2]="XML",r[r.IMAGE=3]="IMAGE",r[r.AUDIO=4]="AUDIO",r[r.VIDEO=5]="VIDEO",r[r.TEXT=6]="TEXT",(i=t.LOAD_TYPE||(t.LOAD_TYPE={}))[i.XHR=1]="XHR",i[i.IMAGE=2]="IMAGE",i[i.AUDIO=3]="AUDIO",i[i.VIDEO=4]="VIDEO",(n=t.XHR_RESPONSE_TYPE||(t.XHR_RESPONSE_TYPE={})).DEFAULT="text",n.BUFFER="arraybuffer",n.BLOB="blob",n.DOCUMENT="document",n.JSON="json",n.TEXT="text",t._loadTypeMap={gif:t.LOAD_TYPE.IMAGE,png:t.LOAD_TYPE.IMAGE,bmp:t.LOAD_TYPE.IMAGE,jpg:t.LOAD_TYPE.IMAGE,jpeg:t.LOAD_TYPE.IMAGE,tif:t.LOAD_TYPE.IMAGE,tiff:t.LOAD_TYPE.IMAGE,webp:t.LOAD_TYPE.IMAGE,tga:t.LOAD_TYPE.IMAGE,avif:t.LOAD_TYPE.IMAGE,svg:t.LOAD_TYPE.IMAGE,"svg+xml":t.LOAD_TYPE.IMAGE,mp3:t.LOAD_TYPE.AUDIO,ogg:t.LOAD_TYPE.AUDIO,wav:t.LOAD_TYPE.AUDIO,mp4:t.LOAD_TYPE.VIDEO,webm:t.LOAD_TYPE.VIDEO},t._xhrTypeMap={xhtml:t.XHR_RESPONSE_TYPE.DOCUMENT,html:t.XHR_RESPONSE_TYPE.DOCUMENT,htm:t.XHR_RESPONSE_TYPE.DOCUMENT,xml:t.XHR_RESPONSE_TYPE.DOCUMENT,tmx:t.XHR_RESPONSE_TYPE.DOCUMENT,svg:t.XHR_RESPONSE_TYPE.DOCUMENT,tsx:t.XHR_RESPONSE_TYPE.DOCUMENT,gif:t.XHR_RESPONSE_TYPE.BLOB,png:t.XHR_RESPONSE_TYPE.BLOB,bmp:t.XHR_RESPONSE_TYPE.BLOB,jpg:t.XHR_RESPONSE_TYPE.BLOB,jpeg:t.XHR_RESPONSE_TYPE.BLOB,tif:t.XHR_RESPONSE_TYPE.BLOB,tiff:t.XHR_RESPONSE_TYPE.BLOB,webp:t.XHR_RESPONSE_TYPE.BLOB,tga:t.XHR_RESPONSE_TYPE.BLOB,avif:t.XHR_RESPONSE_TYPE.BLOB,json:t.XHR_RESPONSE_TYPE.JSON,text:t.XHR_RESPONSE_TYPE.TEXT,txt:t.XHR_RESPONSE_TYPE.TEXT,ttf:t.XHR_RESPONSE_TYPE.BUFFER,otf:t.XHR_RESPONSE_TYPE.BUFFER},t.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(t.LoaderResource||(t.LoaderResource={}));var oo=function(t,e){this.data=t,this.callback=e},so=function(){function t(t,e){var r=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=io,this.unsaturated=io,this.empty=io,this.drain=io,this.error=io,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(t,e,i){if(i&&"function"!=typeof i)throw new Error("task callback must be a function");if(r.started=!0,null==t&&r.idle())setTimeout((function(){return r.drain()}),1);else{var n=new oo(t,"function"==typeof i?i:io);e?r._tasks.unshift(n):r._tasks.push(n),setTimeout(r.process,1)}},this.process=function(){for(;!r.paused&&r.workers>2,n[1]=(3&i[0])<<4|i[1]>>4,n[2]=(15&i[1])<<2|i[2]>>6,n[3]=63&i[2],r-(t.length-1)){case 2:n[3]=64,n[2]=64;break;case 1:n[3]=64}for(o=0;o0&&n[n.length-1])||6!==o[0]&&2!==o[0])){s=0;continue}if(3===o[0]&&(!n||o[1]>n[0]&&o[1]=33776&&t<=33779)return"s3tc";if(t>=37488&&t<=37497)return"etc";if(t>=35840&&t<=35843)return"pvrtc";if(t>=36196)return"etc1";if(t>=35986&&t<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},e._createLevelBuffers=function(t,e,r,i,n,o,s){for(var a=new Array(r),h=t.byteOffset,u=o,l=s,c=u+i-1&~(i-1),d=l+n-1&~(n-1),f=c*d*_o[e],p=0;p1?u:c,levelHeight:r>1?l:d,levelBuffer:new Uint8Array(t.buffer,h,f)},h+=f,f=(c=(u=u>>1||1)+i-1&~(i-1))*(d=(l=l>>1||1)+n-1&~(n-1))*_o[e];return a},e}(To),bo=function(){function e(){}return e.use=function(r,i){var n=r.data;if(r.type===t.LoaderResource.TYPE.JSON&&n&&n.cacheID&&n.textures){for(var o=n.textures,s=void 0,a=void 0,h=0,u=o.length;h>>=1,E>>>=1;var x=148;for(b=0;b<_;b++)m.push(new Uint8Array(t,x,g)),x+=g}return m.map((function(t){return new Eo(t,{format:v,width:n,height:i,levels:o})}))}if(64&a)throw new Error("DDSParser does not support uncompressed texture data.");if(512&a)throw new Error("DDSParser does not supported YUV uncompressed texture data.");if(131072&a)throw new Error("DDSParser does not support single-channel (lumninance) texture data!");if(2&a)throw new Error("DDSParser does not support single-channel (alpha) texture data!");throw new Error("DDSParser failed to load a texture file due to an unknown reason!")}var wo=[171,75,84,88,32,49,49,187,13,10,26,10],Co=((Ro={})[t.TYPES.UNSIGNED_BYTE]=1,Ro[t.TYPES.UNSIGNED_SHORT]=2,Ro[t.TYPES.INT]=4,Ro[t.TYPES.UNSIGNED_INT]=4,Ro[t.TYPES.FLOAT]=4,Ro[t.TYPES.HALF_FLOAT]=8,Ro),No=((Oo={})[t.FORMATS.RGBA]=4,Oo[t.FORMATS.RGB]=3,Oo[t.FORMATS.RG]=2,Oo[t.FORMATS.RED]=1,Oo[t.FORMATS.LUMINANCE]=1,Oo[t.FORMATS.LUMINANCE_ALPHA]=2,Oo[t.FORMATS.ALPHA]=1,Oo),Fo=((Mo={})[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,Mo[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,Mo[t.TYPES.UNSIGNED_SHORT_5_6_5]=2,Mo);function Lo(e,r,i){void 0===i&&(i=!1);var n=new DataView(r);if(!function(t,e){for(var r=0;re-n){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(var h=0;h1||0!==s?x:S,levelHeight:p>1||0!==s?A:R,levelBuffer:new Uint8Array(r,I,b)},I+=b}O=(O+=P+4)%4!=0?O+4-O%4:O,b=(S=(x=x>>1||1)+4-1&-4)*(R=(A=A>>1||1)+4-1&-4)*v}return 0!==s?{uncompressed:g.map((function(e){var r=e[0].levelBuffer,i=!1;return s===t.TYPES.FLOAT?r=new Float32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4):s===t.TYPES.UNSIGNED_INT?(i=!0,r=new Uint32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)):s===t.TYPES.INT&&(i=!0,r=new Int32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)),{resource:new _r(r,{width:e[0].levelWidth,height:e[0].levelHeight}),type:s,format:i?Bo(a):a}})),kvData:E}:{compressed:g.map((function(t){return new Eo(null,{format:h,width:u,height:l,levels:p,levelBuffers:t})})),kvData:E}}function Bo(e){switch(e){case t.FORMATS.RGBA:return t.FORMATS.RGBA_INTEGER;case t.FORMATS.RGB:return t.FORMATS.RGB_INTEGER;case t.FORMATS.RG:return t.FORMATS.RG_INTEGER;case t.FORMATS.RED:return t.FORMATS.RED_INTEGER;default:return e}}t.LoaderResource.setExtensionXhrType("dds",t.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var Go=function(){function e(){}return e.use=function(t,e){if("dds"===t.extension&&t.data)try{Object.assign(t,xo(t.name||t.url,Do(t.data),t.metadata))}catch(t){return void e(t)}e()},e.extension=t.ExtensionType.Loader,e}();t.LoaderResource.setExtensionXhrType("ktx",t.LoaderResource.XHR_RESPONSE_TYPE.BUFFER);var Uo=function(){function e(){}return e.use=function(e,r){if("ktx"===e.extension&&e.data)try{var i=e.name||e.url,n=Lo(0,e.data,this.loadKeyValueData),o=n.compressed,s=n.uncompressed,a=n.kvData;if(o){var h=xo(i,o,e.metadata);if(a&&h.textures)for(var u in h.textures)h.textures[u].baseTexture.ktxKeyValueData=a;Object.assign(e,h)}else if(s){var l={};s.forEach((function(e,r){var n=new Nr(new mr(e.resource,{mipmap:t.MIPMAP_MODES.OFF,alphaMode:t.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,type:e.type,format:e.format})),o=i+"-"+(r+1);a&&(n.baseTexture.ktxKeyValueData=a),mr.addToCache(n.baseTexture,o),Nr.addToCache(n,o),0===r&&(l[i]=n,mr.addToCache(n.baseTexture,i),Nr.addToCache(n,i)),l[o]=n})),Object.assign(e,{textures:l})}}catch(t){return void r(t)}r()},e.extension=t.ExtensionType.Loader,e.loadKeyValueData=!1,e}(),ko=function(t,e){return ko=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])},ko(t,e)};function Xo(t,e){function r(){this.constructor=t}ko(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var jo=function(e){function r(r,i,n,o){void 0===r&&(r=1500),void 0===n&&(n=16384),void 0===o&&(o=!1);var s=e.call(this)||this;return n>16384&&(n=16384),s._properties=[!1,!0,!1,!1,!1],s._maxSize=r,s._batchSize=n,s._buffers=null,s._bufferUpdateIDs=[],s._updateID=0,s.interactiveChildren=!1,s.blendMode=t.BLEND_MODES.NORMAL,s.autoResize=o,s.roundPixels=!0,s.baseTexture=null,s.setProperties(i),s._tint=0,s.tintRgb=new Float32Array(4),s.tint=16777215,s}return Xo(r,e),r.prototype.setProperties=function(t){t&&(this._properties[0]="vertices"in t||"scale"in t?!!t.vertices||!!t.scale:this._properties[0],this._properties[1]="position"in t?!!t.position:this._properties[1],this._properties[2]="rotation"in t?!!t.rotation:this._properties[2],this._properties[3]="uvs"in t?!!t.uvs:this._properties[3],this._properties[4]="tint"in t||"alpha"in t?!!t.tint||!!t.alpha:this._properties[4])},r.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(r.prototype,"tint",{get:function(){return this._tint},set:function(t){this._tint=t,$t(t,this.tintRgb)},enumerable:!1,configurable:!0}),r.prototype.render=function(t){var e=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",(function(){return e.onChildrenChange(0)}))),t.batch.setObjectRenderer(t.plugins.particle),t.plugins.particle.render(this))},r.prototype.onChildrenChange=function(t){for(var e=Math.floor(t/this._batchSize);this._bufferUpdateIDs.lengthr&&!t.autoResize&&(o=r);var s=t._buffers;s||(s=t._buffers=this.generateBuffers(t));var a=e[0]._texture.baseTexture,h=a.alphaMode>0;this.state.blendMode=ie(t.blendMode,h),n.state.set(this.state);var u=n.gl,l=t.worldTransform.copyTo(this.tempMatrix);l.prepend(n.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=l.toArray(!0),this.shader.uniforms.uColor=ne(t.tintRgb,t.worldAlpha,this.shader.uniforms.uColor,h),this.shader.uniforms.uSampler=a,this.renderer.shader.bind(this.shader);for(var c=!1,d=0,f=0;di&&(p=i),f>=s.length&&s.push(this._generateOneMoreBuffer(t));var _=s[f];_.uploadDynamic(e,d,p);var v=t._bufferUpdateIDs[f]||0;(c=c||_._updateID0,u=a.alpha,l=u<1&&h?oe(a._tintRGB,u):a._tintRGB+(255*u<<24);i[o]=l,i[o+n]=l,i[o+2*n]=l,i[o+3*n]=l,o+=4*n}},r.prototype.destroy=function(){e.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},r.extension={name:"particle",type:t.ExtensionType.RendererPlugin},r}($r);t.LINE_JOIN=void 0,t.LINE_CAP=void 0,function(t){t.MITER="miter",t.BEVEL="bevel",t.ROUND="round"}(t.LINE_JOIN||(t.LINE_JOIN={})),function(t){t.BUTT="butt",t.ROUND="round",t.SQUARE="square"}(t.LINE_CAP||(t.LINE_CAP={}));var Vo={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(t,e){if(void 0===e&&(e=20),!this.adaptive||!t||isNaN(t))return e;var r=Math.ceil(t/this.maxLength);return rthis.maxSegments&&(r=this.maxSegments),r}},zo=function(){function t(){this.color=16777215,this.alpha=1,this.texture=Nr.WHITE,this.matrix=null,this.visible=!1,this.reset()}return t.prototype.clone=function(){var e=new t;return e.color=this.color,e.alpha=this.alpha,e.texture=this.texture,e.matrix=this.matrix,e.visible=this.visible,e},t.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=Nr.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),Wo=function(t,e){return Wo=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])},Wo(t,e)};function qo(t,e){function r(){this.constructor=t}Wo(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Ko(t,e){var r,i;void 0===e&&(e=!1);var n=t.length;if(!(n<6)){for(var o=0,s=0,a=t[n-2],h=t[n-1];s0||e&&o<=0){var c=n/2;for(s=c+c%2;s=6){Ko(r,!1);for(var s=[],a=0;a=0&&a>=0&&n>=0&&o>=0){var p=Math.ceil(2.3*Math.sqrt(s+a)),_=8*p+(n?4:0)+(o?4:0);if(h.length=_,0!==_){if(0===p)return h.length=8,h[0]=h[6]=r+n,h[1]=h[3]=i+o,h[2]=h[4]=r-n,void(h[5]=h[7]=i-o);var v,m,y=0,g=4*p+(n?2:0)+2,T=g,E=_,b=r+(v=n+s),x=r-v,A=i+(m=o);if(h[y++]=b,h[y++]=A,h[--g]=A,h[--g]=x,o){var S=i-m;h[T++]=x,h[T++]=S,h[--E]=S,h[--E]=b}for(var R=1;Rc&&(c+=2*Math.PI);var d=l,f=c-l,p=Math.abs(f),_=Math.sqrt(h*h+u*u),v=1+(15*p*Math.sqrt(_)/Math.PI>>0),m=f/v;if(d+=m,a){s.push(t,e),s.push(r,i);for(var y=1,g=d;y=0&&(s.join===t.LINE_JOIN.ROUND?_+=is(b,x,b-R*w,x-O*w,b-M*w,x-P*w,f,!1)+4:_+=2,f.push(b-M*C,x-P*C),f.push(b+M*w,x+P*w));else{var j=(-R+T)*(-O+x)-(-R+b)*(-O+E),H=(-M+A)*(-P+x)-(-M+b)*(-P+S),Y=(F*H-B*j)/k,V=(G*j-L*H)/k,z=(Y-b)*(Y-b)+(V-x)*(V-x),W=b+(Y-b)*w,q=x+(V-x)*w,K=b-(Y-b)*C,Z=x-(V-x)*C,Q=X?w:C;z<=Math.min(F*F+L*L,B*B+G*G)+Q*Q*y?s.join===t.LINE_JOIN.BEVEL||z/y>g?(X?(f.push(W,q),f.push(b+R*C,x+O*C),f.push(W,q),f.push(b+M*C,x+P*C)):(f.push(b-R*w,x-O*w),f.push(K,Z),f.push(b-M*w,x-P*w),f.push(K,Z)),_+=2):s.join===t.LINE_JOIN.ROUND?X?(f.push(W,q),f.push(b+R*C,x+O*C),_+=is(b,x,b+R*C,x+O*C,b+M*C,x+P*C,f,!0)+4,f.push(W,q),f.push(b+M*C,x+P*C)):(f.push(b-R*w,x-O*w),f.push(K,Z),_+=is(b,x,b-R*w,x-O*w,b-M*w,x-P*w,f,!1)+4,f.push(b-M*w,x-P*w),f.push(K,Z)):(f.push(W,q),f.push(K,Z)):(f.push(b-R*w,x-O*w),f.push(b+R*C,x+O*C),s.join===t.LINE_JOIN.ROUND?_+=X?is(b,x,b+R*C,x+O*C,b+M*C,x+P*C,f,!0)+2:is(b,x,b-R*w,x-O*w,b-M*w,x-P*w,f,!1)+2:s.join===t.LINE_JOIN.MITER&&z/y<=g&&(X?(f.push(K,Z),f.push(K,Z)):(f.push(W,q),f.push(W,q)),_+=2),f.push(b-M*w,x-P*w),f.push(b+M*C,x+P*C),_+=2)}}T=n[2*(p-2)],E=n[2*(p-2)+1],b=n[2*(p-1)],R=-(E-(x=n[2*(p-1)+1])),O=T-b,R/=I=Math.sqrt(R*R+O*O),O/=I,R*=m,O*=m,f.push(b-R*w,x-O*w),f.push(b+R*C,x+O*C),u||(s.cap===t.LINE_CAP.ROUND?_+=is(b-R*(w-C)*.5,x-O*(w-C)*.5,b-R*w,x-O*w,b+R*C,x+O*C,f,!1)+2:s.cap===t.LINE_CAP.SQUARE&&(_+=rs(b,x,R,O,w,C,!1,f)));var J=r.indices,$=Vo.epsilon*Vo.epsilon;for(N=v;N<_+v-2;++N)T=f[2*N],E=f[2*N+1],b=f[2*(N+1)],x=f[2*(N+1)+1],A=f[2*(N+2)],S=f[2*(N+2)+1],Math.abs(T*(x-S)+b*(S-E)+A*(E-x))<$||J.push(N,N+1,N+2)}}(e,r)}var os,ss=function(){function t(){}return t.curveTo=function(t,e,r,i,n,o){var s=o[o.length-2],a=o[o.length-1]-e,h=s-t,u=i-e,l=r-t,c=Math.abs(a*l-h*u);if(c<1e-8||0===n)return o[o.length-2]===t&&o[o.length-1]===e||o.push(t,e),null;var d=a*a+h*h,f=u*u+l*l,p=a*u+h*l,_=n*Math.sqrt(d)/c,v=n*Math.sqrt(f)/c,m=_*p/d,y=v*p/f,g=_*l+v*h,T=_*u+v*a,E=h*(v+m),b=a*(v+m),x=l*(_+y),A=u*(_+y);return{cx:g+t,cy:T+e,radius:n,startAngle:Math.atan2(b-T,E-g),endAngle:Math.atan2(A-T,x-g),anticlockwise:h*u>l*a}},t.arc=function(t,e,r,i,n,o,s,a,h){for(var u=s-o,l=Vo._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/Me)),c=u/(2*l),d=2*c,f=Math.cos(c),p=Math.sin(c),_=l-1,v=_%1/_,m=0;m<=_;++m){var y=c+o+d*(m+v*m),g=Math.cos(y),T=-Math.sin(y);h.push((f*g+p*T)*n+r,(f*-T+p*g)*n+i)}},t}(),as=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o,s,a){for(var h=0,u=0,l=0,c=0,d=0,f=0,p=0,_=0,v=0,m=0,y=0,g=t,T=e,E=1;E<=10;++E)m=g-(_=(p=(f=(d=1-(u=E/10))*d)*d)*t+3*f*u*r+3*d*(l=u*u)*n+(c=l*u)*s),y=T-(v=p*e+3*f*u*i+3*d*l*o+c*a),g=_,T=v,h+=Math.sqrt(m*m+y*y);return h},t.curveTo=function(e,r,i,n,o,s,a){var h=a[a.length-2],u=a[a.length-1];a.length-=2;var l=Vo._segmentsCount(t.curveLength(h,u,e,r,i,n,o,s)),c=0,d=0,f=0,p=0,_=0;a.push(h,u);for(var v=1,m=0;v<=l;++v)f=(d=(c=1-(m=v/l))*c)*c,_=(p=m*m)*m,a.push(f*h+3*d*m*e+3*c*p*i+_*o,f*u+3*d*m*r+3*c*p*n+_*s)},t}(),hs=function(){function t(){}return t.curveLength=function(t,e,r,i,n,o){var s=t-2*r+n,a=e-2*i+o,h=2*r-2*t,u=2*i-2*e,l=4*(s*s+a*a),c=4*(s*h+a*u),d=h*h+u*u,f=2*Math.sqrt(l+c+d),p=Math.sqrt(l),_=2*l*p,v=2*Math.sqrt(d),m=c/p;return(_*f+p*c*(f-v)+(4*d*l-c*c)*Math.log((2*p+m+f)/(m+v)))/(4*_)},t.curveTo=function(e,r,i,n,o){for(var s=o[o.length-2],a=o[o.length-1],h=Vo._segmentsCount(t.curveLength(s,a,e,r,i,n)),u=0,l=0,c=1;c<=h;++c){var d=c/h;u=s+(e-s)*d,l=a+(r-a)*d,o.push(u+(e+(i-e)*d-u)*d,l+(r+(n-r)*d-l)*d)}},t}(),us=function(){function t(){this.reset()}return t.prototype.begin=function(t,e,r){this.reset(),this.style=t,this.start=e,this.attribStart=r},t.prototype.end=function(t,e){this.attribSize=e-this.attribStart,this.size=t-this.start},t.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},t}(),ls=((os={})[t.SHAPES.POLY]=Zo,os[t.SHAPES.CIRC]=Qo,os[t.SHAPES.ELIP]=Qo,os[t.SHAPES.RECT]=Jo,os[t.SHAPES.RREC]=es,os),cs=[],ds=[],fs=function(){function t(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null),this.points=[],this.holes=[],this.shape=t,this.lineStyle=r,this.fillStyle=e,this.matrix=i,this.type=t.type}return t.prototype.clone=function(){return new t(this.shape,this.fillStyle,this.lineStyle,this.matrix)},t.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},t}(),ps=new De,_s=function(e){function r(){var t=e.call(this)||this;return t.closePointEps=1e-4,t.boundsPadding=0,t.uvsFloat32=null,t.indicesUint16=null,t.batchable=!1,t.points=[],t.colors=[],t.uvs=[],t.indices=[],t.textureIds=[],t.graphicsData=[],t.drawCalls=[],t.batchDirty=-1,t.batches=[],t.dirty=0,t.cacheDirty=-1,t.clearDirty=0,t.shapeIndex=0,t._bounds=new Ke,t.boundsDirty=-1,t}return qo(r,e),Object.defineProperty(r.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),r.prototype.invalidate=function(){this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(var t=0;t0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},r.prototype.drawShape=function(t,e,r,i){void 0===e&&(e=null),void 0===r&&(r=null),void 0===i&&(i=null);var n=new fs(t,e,r,i);return this.graphicsData.push(n),this.dirty++,this},r.prototype.drawHole=function(t,e){if(void 0===e&&(e=null),!this.graphicsData.length)return null;var r=new fs(t,null,null,e),i=this.graphicsData[this.graphicsData.length-1];return r.lineStyle=i.lineStyle,i.holes.push(r),this.dirty++,this},r.prototype.destroy=function(){e.prototype.destroy.call(this);for(var t=0;t0&&(n=(i=this.batches[this.batches.length-1]).style);for(var o=this.shapeIndex;o65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&m===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=m?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}else this.batchable=!0}}else this.batchable=!0},r.prototype._compareStyles=function(t,e){return!(!t||!e)&&t.texture.baseTexture===e.texture.baseTexture&&t.color+t.alpha===e.color+e.alpha&&!!t.native==!!e.native},r.prototype.validateBatching=function(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(var t=0,e=this.graphicsData.length;t131070)return!1;for(var t=this.batches,e=0;e0&&((o=ds.pop())||((o=new En).texArray=new bn),this.drawCalls.push(o)),o.start=c,o.size=0,o.texArray.count=0,o.type=l),p.touched=1,p._batchEnabled=e,p._batchLocation=s,p.wrapMode=t.WRAP_MODES.REPEAT,o.texArray.elements[o.texArray.count++]=p,s++)),o.size+=d.size,c+=d.size,h=p._batchLocation,this.addColors(i,f.color,f.alpha,d.attribSize,d.attribStart),this.addTextureIds(n,h,d.attribSize,d.attribStart)}mr._globalBatch=e,this.packAttributes()},r.prototype.packAttributes=function(){for(var t=this.points,e=this.uvs,r=this.colors,i=this.textureIds,n=new ArrayBuffer(3*t.length*4),o=new Float32Array(n),s=new Uint32Array(n),a=0,h=0;h>16)+(65280&e)+((255&e)<<16),r);t.length=Math.max(t.length,n+i);for(var s=0;s0&&e.alpha>0;return r?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:r},e)):this._lineStyle.reset(),this},r.prototype.startPoly=function(){if(this.currentPath){var t=this.currentPath.points,e=this.currentPath.points.length;e>2&&(this.drawShape(this.currentPath),this.currentPath=new Le,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new Le,this.currentPath.closeStroke=!1},r.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},r.prototype.moveTo=function(t,e){return this.startPoly(),this.currentPath.points[0]=t,this.currentPath.points[1]=e,this},r.prototype.lineTo=function(t,e){this.currentPath||this.moveTo(0,0);var r=this.currentPath.points,i=r[r.length-2],n=r[r.length-1];return i===t&&n===e||r.push(t,e),this},r.prototype._initCurve=function(t,e){void 0===t&&(t=0),void 0===e&&(e=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[t,e]):this.moveTo(t,e)},r.prototype.quadraticCurveTo=function(t,e,r,i){this._initCurve();var n=this.currentPath.points;return 0===n.length&&this.moveTo(0,0),hs.curveTo(t,e,r,i,n),this},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._initCurve(),as.curveTo(t,e,r,i,n,o,this.currentPath.points),this},r.prototype.arcTo=function(t,e,r,i,n){this._initCurve(t,e);var o=this.currentPath.points,s=ss.curveTo(t,e,r,i,n,o);if(s){var a=s.cx,h=s.cy,u=s.radius,l=s.startAngle,c=s.endAngle,d=s.anticlockwise;this.arc(a,h,u,l,c,d)}return this},r.prototype.arc=function(t,e,r,i,n,o){if(void 0===o&&(o=!1),i===n)return this;if(!o&&n<=i?n+=Me:o&&i<=n&&(i+=Me),0==n-i)return this;var s=t+Math.cos(i)*r,a=e+Math.sin(i)*r,h=this._geometry.closePointEps,u=this.currentPath?this.currentPath.points:null;if(u){var l=Math.abs(u[u.length-2]-s),c=Math.abs(u[u.length-1]-a);l0;return e?(t.matrix&&(t.matrix=t.matrix.clone(),t.matrix.invert()),Object.assign(this._fillStyle,{visible:e},t)):this._fillStyle.reset(),this},r.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},r.prototype.drawRect=function(t,e,r,i){return this.drawShape(new Ce(t,e,r,i))},r.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new Be(t,e,r,i,n))},r.prototype.drawCircle=function(t,e,r){return this.drawShape(new Ne(t,e,r))},r.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new Fe(t,e,r,i))},r.prototype.drawPolygon=function(){for(var t,e=arguments,r=[],i=0;i>16&255)/255*n,o.tint[1]=(i>>8&255)/255*n,o.tint[2]=(255&i)/255*n,o.tint[3]=n,t.shader.bind(e),t.geometry.bind(r,e),t.state.set(this.state);for(var a=0,h=s.length;a>16)+(65280&n)+((255&n)<<16)}}},r.prototype.calculateVertices=function(){var t=this.transform._worldID;if(this._transformID!==t){this._transformID=t;for(var e=this.transform.worldTransform,r=e.a,i=e.b,n=e.c,o=e.d,s=e.tx,a=e.ty,h=this._geometry.points,u=this.vertexData,l=0,c=0;c=i&&bs.x=n&&bs.y>16)+(65280&t)+((255&t)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return this._texture},set:function(t){this._texture!==t&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=t||Nr.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,t&&(t.baseTexture.valid?this._onTextureUpdate():t.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),r}(er);t.TEXT_GRADIENT=void 0;var Ss=function(t,e){return Ss=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])},Ss(t,e)};!function(t){t[t.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",t[t.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(t.TEXT_GRADIENT||(t.TEXT_GRADIENT={}));var Rs={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:t.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},Os=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],Ms=function(){function t(t){this.styleID=0,this.reset(),Ds(this,t,t)}return t.prototype.clone=function(){var e={};return Ds(e,this,Rs),new t(e)},t.prototype.reset=function(){Ds(this,Rs,Rs)},Object.defineProperty(t.prototype,"align",{get:function(){return this._align},set:function(t){this._align!==t&&(this._align=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"breakWords",{get:function(){return this._breakWords},set:function(t){this._breakWords!==t&&(this._breakWords=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(t){this._dropShadow!==t&&(this._dropShadow=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(t){this._dropShadowAlpha!==t&&(this._dropShadowAlpha=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(t){this._dropShadowAngle!==t&&(this._dropShadowAngle=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(t){this._dropShadowBlur!==t&&(this._dropShadowBlur=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(t){var e=Is(t);this._dropShadowColor!==e&&(this._dropShadowColor=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(t){this._dropShadowDistance!==t&&(this._dropShadowDistance=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fill",{get:function(){return this._fill},set:function(t){var e=Is(t);this._fill!==e&&(this._fill=e,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(t){this._fillGradientType!==t&&(this._fillGradientType=t,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(t){(function(t,e){if(!Array.isArray(t)||!Array.isArray(e))return!1;if(t.length!==e.length)return!1;for(var r=0;r=0;r--){var i=e[r].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&Os.indexOf(i)<0&&(i='"'+i+'"'),e[r]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function Ps(t){return"number"==typeof t?te(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function Is(t){if(Array.isArray(t)){for(var e=0;ep)if(""!==s&&(a+=t.addLine(s),s="",o=0),t.canBreakWords(m,r.breakWords))for(var E=t.wordWrapSplit(m),b=0;bp&&(a+=t.addLine(s),f=!1,s="",o=0),s+=x,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var M=v===_.length-1;a+=t.addLine(m,!M),f=!1,s="",o=0}else T+o>p&&(f=!1,a+=t.addLine(s),s="",o=0),(s.length>0||!t.isBreakingSpace(m)||f)&&(s+=m,o+=T)}return a+t.addLine(s,!1)},t.addLine=function(e,r){return void 0===r&&(r=!0),e=t.trimRight(e),r?e+"\n":e},t.getFromCache=function(t,e,r,i){var n=r[t];if("number"!=typeof n){var o=t.length*e;n=i.measureText(t).width+o,r[t]=n}return n},t.collapseSpaces=function(t){return"normal"===t||"pre-line"===t},t.collapseNewlines=function(t){return"normal"===t},t.trimRight=function(e){if("string"!=typeof e)return"";for(var r=e.length-1;r>=0;r--){var i=e[r];if(!t.isBreakingSpace(i))break;e=e.slice(0,-1)}return e},t.isNewline=function(e){return"string"==typeof e&&t._newlines.indexOf(e.charCodeAt(0))>=0},t.isBreakingSpace=function(e,r){return"string"==typeof e&&t._breakingSpaces.indexOf(e.charCodeAt(0))>=0},t.tokenize=function(e){var r=[],i="";if("string"!=typeof e)return r;for(var n=0;na;--d){for(_=0;_0&&_>v&&(m=(v+_)/2);var y=v+p,g=i.lineHeight*(f+1),T=y;f+10},t}();function Gs(t,e){var r=!1;if(t&&t._textures&&t._textures.length)for(var i=0;i=0;e--)this.add(t.children[e]);return this},e.prototype.destroy=function(){this.ticking&&ar.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},e}();function zs(t,e){return e instanceof mr&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function Ws(t,e){if(!(e instanceof gs))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n=i&&ea.x=n&&ea.y1?Ci.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",e):Ci.from(ia,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",e)},r.prototype.render=function(e){var r=this.renderer,i=this.quad,n=i.vertices;n[0]=n[6]=e._width*-e.anchor.x,n[1]=n[3]=e._height*-e.anchor.y,n[2]=n[4]=e._width*(1-e.anchor.x),n[5]=n[7]=e._height*(1-e.anchor.y);var o=e.uvRespectAnchor?e.anchor.x:0,s=e.uvRespectAnchor?e.anchor.y:0;(n=i.uvs)[0]=n[6]=-o,n[1]=n[3]=-s,n[2]=n[4]=1-o,n[5]=n[7]=1-s,i.invalidate();var a=e._texture,h=a.baseTexture,u=h.alphaMode>0,l=e.tileTransform.localTransform,c=e.uvMatrix,d=h.isPowerOfTwo&&a.frame.width===h.width&&a.frame.height===h.height;d&&(h._glTextures[r.CONTEXT_UID]?d=h.wrapMode!==t.WRAP_MODES.CLAMP:h.wrapMode===t.WRAP_MODES.CLAMP&&(h.wrapMode=t.WRAP_MODES.REPEAT));var f=d?this.simpleShader:this.shader,p=a.width,_=a.height,v=e._width,m=e._height;na.set(l.a*p/v,l.b*p/m,l.c*_/v,l.d*_/m,l.tx/v,l.ty/m),na.invert(),d?na.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=na.toArray(!0),f.uniforms.uColor=se(e.tint,e.worldAlpha,f.uniforms.uColor,u),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=a,r.shader.bind(f),r.geometry.bind(i),this.state.blendMode=ie(e.blendMode,u),r.state.set(this.state),r.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},r.extension={name:"tilingSprite",type:t.ExtensionType.RendererPlugin},r}($r),sa=function(t,e){return sa=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])},sa(t,e)};function aa(t,e){function r(){this.constructor=t}sa(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var ha=function(){function t(t,e){this.uvBuffer=t,this.uvMatrix=e,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return t.prototype.update=function(t){if(t||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var e=this.uvBuffer.data;this.data&&this.data.length===e.length||(this.data=new Float32Array(e.length)),this.uvMatrix.multiplyUvs(e,this.data),this._updateID++}},t}(),ua=new De,la=new Le,ca=function(e){function r(r,i,n,o){void 0===o&&(o=t.DRAW_MODES.TRIANGLES);var s=e.call(this)||this;return s.geometry=r,s.shader=i,s.state=n||Ni.for2d(),s.drawMode=o,s.start=0,s.size=0,s.uvs=null,s.indices=null,s.vertexData=new Float32Array(1),s.vertexDirty=-1,s._transformID=-1,s._roundPixels=U.ROUND_PIXELS,s.batchUvs=null,s}return aa(r,e),Object.defineProperty(r.prototype,"geometry",{get:function(){return this._geometry},set:function(t){this._geometry!==t&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=t,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"material",{get:function(){return this.shader},set:function(t){this.shader=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(t){this.state.blendMode=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(t){this._roundPixels!==t&&(this._transformID=-1),this._roundPixels=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(t){this.shader.tint=t},enumerable:!1,configurable:!0}),Object.defineProperty(r.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(t){this.shader.texture=t},enumerable:!1,configurable:!0}),r.prototype._render=function(e){var i=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===t.DRAW_MODES.TRIANGLES&&i.length<2*r.BATCHABLE_SIZE?this._renderToBatch(e):this._renderDefault(e)},r.prototype._renderDefault=function(t){var e=this.shader;e.alpha=this.worldAlpha,e.update&&e.update(),t.batch.flush(),e.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),t.shader.bind(e),t.state.set(this.state),t.geometry.bind(this.geometry,e),t.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},r.prototype._renderToBatch=function(t){var e=this.geometry,r=this.shader;r.uvMatrix&&(r.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=e.indexBuffer.data,this._tintRGB=r._tintRGB,this._texture=r.texture;var i=this.material.pluginName;t.batch.setObjectRenderer(t.plugins[i]),t.plugins[i].render(this)},r.prototype.calculateVertices=function(){var t=this.geometry.buffers[0],e=t.data,r=t._updateID;if(r!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(var i=this.transform.worldTransform,n=i.a,o=i.b,s=i.c,a=i.d,h=i.tx,u=i.ty,l=this.vertexData,c=0;c>16)+(65280&t)+((255&t)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),e.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var t=this.texture.baseTexture;se(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(Ci),fa=function(e){function r(r,i,n){var o=e.call(this)||this,s=new Ur(r),a=new Ur(i,!0),h=new Ur(n,!0,!0);return o.addAttribute("aVertexPosition",s,2,!1,t.TYPES.FLOAT).addAttribute("aTextureCoord",a,2,!1,t.TYPES.FLOAT).addIndex(h),o._updateId=-1,o}return aa(r,e),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(Yr),pa=function(t,e){return pa=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])},pa(t,e)},_a=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},va=function(){function t(){}return t.test=function(t){return"string"==typeof t&&0===t.indexOf("info face=")},t.parse=function(t){var e=t.match(/^[a-z]+\s+.+$/gm),r={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(var i in e){var n=e[i].match(/^[a-z]+/gm)[0],o=e[i].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),s={};for(var a in o){var h=o[a].split("="),u=h[0],l=h[1].replace(/"/gm,""),c=parseFloat(l),d=isNaN(c)?l:c;s[u]=d}r[n].push(s)}var f=new _a;return r.info.forEach((function(t){return f.info.push({face:t.face,size:parseInt(t.size,10)})})),r.common.forEach((function(t){return f.common.push({lineHeight:parseInt(t.lineHeight,10)})})),r.page.forEach((function(t){return f.page.push({id:parseInt(t.id,10),file:t.file})})),r.char.forEach((function(t){return f.char.push({id:parseInt(t.id,10),page:parseInt(t.page,10),x:parseInt(t.x,10),y:parseInt(t.y,10),width:parseInt(t.width,10),height:parseInt(t.height,10),xoffset:parseInt(t.xoffset,10),yoffset:parseInt(t.yoffset,10),xadvance:parseInt(t.xadvance,10)})})),r.kerning.forEach((function(t){return f.kerning.push({first:parseInt(t.first,10),second:parseInt(t.second,10),amount:parseInt(t.amount,10)})})),r.distanceField.forEach((function(t){return f.distanceField.push({distanceRange:parseInt(t.distanceRange,10),fieldType:t.fieldType})})),f},t}(),ma=function(){function t(){}return t.test=function(t){return t instanceof XMLDocument&&t.getElementsByTagName("page").length&&null!==t.getElementsByTagName("info")[0].getAttribute("face")},t.parse=function(t){for(var e=new _a,r=t.getElementsByTagName("info"),i=t.getElementsByTagName("common"),n=t.getElementsByTagName("page"),o=t.getElementsByTagName("char"),s=t.getElementsByTagName("kerning"),a=t.getElementsByTagName("distanceField"),h=0;h")>-1){var e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return ma.test(e)}return!1},t.parse=function(t){var e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return ma.parse(e)},t}(),ga=[va,ma,ya];function Ta(t){for(var e=0;e=u-S*a){if(0===y)throw new Error("[BitmapFont] textureHeight "+u+"px is too small (fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+b+"')");--E,p=null,_=null,v=null,y=0,m=0,g=0}else if(g=Math.max(S+x.fontProperties.descent,g),R*a+m>=d){if(0===m)throw new Error("[BitmapFont] textureWidth "+h+"px is too small (fontFamily: '"+c.fontFamily+"', fontSize: "+c.fontSize+"px, char: '"+b+"')");--E,y+=g*a,y=Math.ceil(y),m=0,g=0}else{Ea(p,_,x,m,y,a,c);var O=xa(x.text);f.char.push({id:O,page:T.length-1,x:m/a,y:y/a,width:R,height:S,xoffset:0,yoffset:0,xadvance:Math.ceil(A-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),m+=(R+2*s)*a,m=Math.ceil(m)}}E=0;for(var M=l.length;E0&&o.x>l&&(fe(s,1+v-++y,1+E-v),E=v,v=-1,a.push(m),h.push(s.length>0?s[s.length-1].prevSpaces:0),p=Math.max(p,m),_++,o.x=0,o.y+=r.lineHeight,d=null,T=0)}}else a.push(f),h.push(-1),p=Math.max(p,f),++_,++y,o.x=0,o.y+=r.lineHeight,d=null,T=0}var S=u[u.length-1];"\r"!==S&&"\n"!==S&&(/(?:\s)/.test(S)&&(f=m),a.push(f),p=Math.max(p,f),h.push(-1));var R=[];for(E=0;E<=_;E++){var O=0;"right"===this._align?O=p-a[E]:"center"===this._align?O=(p-a[E])/2:"justify"===this._align&&(O=h[E]<0?0:(p-a[E])/h[E]),R.push(O)}var M=s.length,P={},I=[],D=this._activePagesMeshData;for(c.push.apply(c,D),E=0;E 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),F=t.BLEND_MODES.NORMAL_NPM);var L=new ca(C,N);L.blendMode=F,Q={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:L,vertices:null,uvs:null,indices:null}}Q.index=0,Q.indexCount=0,Q.vertexCount=0,Q.uvsCount=0,Q.total=0;var B=this._textureCache;B[w]=B[w]||new Nr(Y.baseTexture),Q.mesh.texture=B[w],Q.mesh.tint=this._tint,I.push(Q),P[w]=Q}P[w].total++}for(E=0;E6*G)||Q.vertices.length<2*ca.BATCHABLE_SIZE)Q.vertices=new Float32Array(8*G),Q.uvs=new Float32Array(8*G),Q.indices=new Uint16Array(6*G);else for(var U=Q.total,k=Q.vertices,X=4*U*2;X=i&&(e=t-s-1),o+=a=a.replace("%value%",r[e].toString()),o+="\n"}return(n=n.replace("%blur%",o)).replace("%size%",t.toString())}(o);return(s=e.call(this,a,h)||this).horizontal=t,s.resolution=n,s._quality=0,s.quality=i,s.blur=r,s}return Ca(r,e),r.prototype.apply=function(e,r,i,n){if(i?this.horizontal?this.uniforms.strength=1/i.width*(i.width/r.width):this.uniforms.strength=1/i.height*(i.height/r.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/r.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/r.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)e.applyFilter(this,r,i,n);else{var o=e.getFilterTexture(),s=e.renderer,a=r,h=o;this.state.blend=!1,e.applyFilter(this,a,h,t.CLEAR_MODES.CLEAR);for(var u=1;u 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",r)||this).alpha=1,e}return function(t,e){function r(){this.constructor=t}Ga(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype._loadMatrix=function(t,e){void 0===e&&(e=!1);var r=t;e&&(this._multiply(r,this.uniforms.m,t),r=this._colorMatrix(r)),this.uniforms.m=r},e.prototype._multiply=function(t,e,r){return t[0]=e[0]*r[0]+e[1]*r[5]+e[2]*r[10]+e[3]*r[15],t[1]=e[0]*r[1]+e[1]*r[6]+e[2]*r[11]+e[3]*r[16],t[2]=e[0]*r[2]+e[1]*r[7]+e[2]*r[12]+e[3]*r[17],t[3]=e[0]*r[3]+e[1]*r[8]+e[2]*r[13]+e[3]*r[18],t[4]=e[0]*r[4]+e[1]*r[9]+e[2]*r[14]+e[3]*r[19]+e[4],t[5]=e[5]*r[0]+e[6]*r[5]+e[7]*r[10]+e[8]*r[15],t[6]=e[5]*r[1]+e[6]*r[6]+e[7]*r[11]+e[8]*r[16],t[7]=e[5]*r[2]+e[6]*r[7]+e[7]*r[12]+e[8]*r[17],t[8]=e[5]*r[3]+e[6]*r[8]+e[7]*r[13]+e[8]*r[18],t[9]=e[5]*r[4]+e[6]*r[9]+e[7]*r[14]+e[8]*r[19]+e[9],t[10]=e[10]*r[0]+e[11]*r[5]+e[12]*r[10]+e[13]*r[15],t[11]=e[10]*r[1]+e[11]*r[6]+e[12]*r[11]+e[13]*r[16],t[12]=e[10]*r[2]+e[11]*r[7]+e[12]*r[12]+e[13]*r[17],t[13]=e[10]*r[3]+e[11]*r[8]+e[12]*r[13]+e[13]*r[18],t[14]=e[10]*r[4]+e[11]*r[9]+e[12]*r[14]+e[13]*r[19]+e[14],t[15]=e[15]*r[0]+e[16]*r[5]+e[17]*r[10]+e[18]*r[15],t[16]=e[15]*r[1]+e[16]*r[6]+e[17]*r[11]+e[18]*r[16],t[17]=e[15]*r[2]+e[16]*r[7]+e[17]*r[12]+e[18]*r[17],t[18]=e[15]*r[3]+e[16]*r[8]+e[17]*r[13]+e[18]*r[18],t[19]=e[15]*r[4]+e[16]*r[9]+e[17]*r[14]+e[18]*r[19]+e[19],t},e.prototype._colorMatrix=function(t){var e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e},e.prototype.brightness=function(t,e){var r=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.tint=function(t,e){var r=[(t>>16&255)/255,0,0,0,0,0,(t>>8&255)/255,0,0,0,0,0,(255&t)/255,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.greyscale=function(t,e){var r=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.blackAndWhite=function(t){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],t)},e.prototype.hue=function(t,e){t=(t||0)/180*Math.PI;var r=Math.cos(t),i=Math.sin(t),n=1/3,o=(0,Math.sqrt)(n),s=[r+(1-r)*n,n*(1-r)-o*i,n*(1-r)+o*i,0,0,n*(1-r)+o*i,r+n*(1-r),n*(1-r)-o*i,0,0,n*(1-r)-o*i,n*(1-r)+o*i,r+n*(1-r),0,0,0,0,0,1,0];this._loadMatrix(s,e)},e.prototype.contrast=function(t,e){var r=(t||0)+1,i=-.5*(r-1),n=[r,0,0,0,i,0,r,0,0,i,0,0,r,0,i,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.saturate=function(t,e){void 0===t&&(t=0);var r=2*t/3+1,i=-.5*(r-1),n=[r,i,i,0,0,i,r,i,0,0,i,i,r,0,0,0,0,0,1,0];this._loadMatrix(n,e)},e.prototype.desaturate=function(){this.saturate(-1)},e.prototype.negative=function(t){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],t)},e.prototype.sepia=function(t){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],t)},e.prototype.technicolor=function(t){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],t)},e.prototype.polaroid=function(t){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],t)},e.prototype.toBGR=function(t){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],t)},e.prototype.kodachrome=function(t){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],t)},e.prototype.browni=function(t){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],t)},e.prototype.vintage=function(t){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],t)},e.prototype.colorTone=function(t,e,r,i,n){var o=((r=r||16770432)>>16&255)/255,s=(r>>8&255)/255,a=(255&r)/255,h=((i=i||3375104)>>16&255)/255,u=(i>>8&255)/255,l=(255&i)/255,c=[.3,.59,.11,0,0,o,s,a,t=t||.2,0,h,u,l,e=e||.15,0,o-h,s-u,a-l,0,0];this._loadMatrix(c,n)},e.prototype.night=function(t,e){var r=[-2*(t=t||.1),-t,0,0,0,-t,0,t,0,0,0,t,2*t,0,0,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.predator=function(t,e){var r=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(r,e)},e.prototype.lsd=function(t){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],t)},e.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(e.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(t){this.uniforms.m=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(t){this.uniforms.uAlpha=t},enumerable:!1,configurable:!0}),e}(Fi);Ua.prototype.grayscale=Ua.prototype.greyscale;var ka=function(t,e){return ka=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])},ka(t,e)},Xa=function(t){function e(e,r){var i=this,n=new Ue;return e.renderable=!1,(i=t.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n\tgl_Position = filterVertexPosition();\n\tvTextureCoord = filterTextureCoord();\n\tvFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:e._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=e,i.maskMatrix=n,null==r&&(r=20),i.scale=new De(r,r),i}return function(t,e){function r(){this.constructor=t}ka(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e.prototype.apply=function(t,e,r,i){this.uniforms.filterMatrix=t.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var n=this.maskSprite.worldTransform,o=Math.sqrt(n.a*n.a+n.b*n.b),s=Math.sqrt(n.c*n.c+n.d*n.d);0!==o&&0!==s&&(this.uniforms.rotation[0]=n.a/o,this.uniforms.rotation[1]=n.b/o,this.uniforms.rotation[2]=n.c/s,this.uniforms.rotation[3]=n.d/s),t.applyFilter(this,e,r,i)},Object.defineProperty(e.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(t){this.uniforms.mapSampler=t},enumerable:!1,configurable:!0}),e}(Fi),ja=function(t,e){return ja=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])},ja(t,e)},Ha=function(t){function e(){return t.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}return function(t,e){function r(){this.constructor=t}ja(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Fi),Ya=function(t,e){return Ya=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])},Ya(t,e)},Va=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random());var i=t.call(this,gn,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return i.noise=e,i.seed=r,i}return function(t,e){function r(){this.constructor=t}Ya(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),Object.defineProperty(e.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(t){this.uniforms.uNoise=t},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(t){this.uniforms.uSeed=t},enumerable:!1,configurable:!0}),e}(Fi),za=new Ue;Je.prototype._cacheAsBitmap=!1,Je.prototype._cacheData=null,Je.prototype._cacheAsBitmapResolution=null,Je.prototype._cacheAsBitmapMultisample=t.MSAA_QUALITY.NONE;var Wa=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null};Object.defineProperties(Je.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(t){t!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(t){t!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=t,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(t){var e;this._cacheAsBitmap!==t&&(this._cacheAsBitmap=t,t?(this._cacheData||(this._cacheData=new Wa),(e=this._cacheData).originalRender=this.render,e.originalRenderCanvas=this.renderCanvas,e.originalUpdateTransform=this.updateTransform,e.originalCalculateBounds=this.calculateBounds,e.originalGetLocalBounds=this.getLocalBounds,e.originalDestroy=this.destroy,e.originalContainsPoint=this.containsPoint,e.originalMask=this._mask,e.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((e=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=e.originalRender,this.renderCanvas=e.originalRenderCanvas,this.calculateBounds=e.originalCalculateBounds,this.getLocalBounds=e.originalGetLocalBounds,this.destroy=e.originalDestroy,this.updateTransform=e.originalUpdateTransform,this.containsPoint=e.originalContainsPoint,this._mask=e.originalMask,this.filterArea=e.originalFilterArea))}}}),Je.prototype._renderCached=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(t),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(t))},Je.prototype._initCachedDisplayObject=function(t){var e;if(!this._cacheData||!this._cacheData.sprite){var r=this.alpha;this.alpha=1,t.batch.flush();var i=this.getLocalBounds(null,!0).clone();if(this.filters&&this.filters.length){var n=this.filters[0].padding;i.pad(n)}i.ceil(U.RESOLUTION);var o=t.renderTexture.current,s=t.renderTexture.sourceFrame.clone(),a=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,u=Fr.create({width:i.width,height:i.height,resolution:this.cacheAsBitmapResolution||t.resolution,multisample:null!==(e=this.cacheAsBitmapMultisample)&&void 0!==e?e:t.multisample}),l="cacheAsBitmap_"+ve();this._cacheData.textureCacheId=l,mr.addToCache(u.baseTexture,l),Nr.addToCache(u,l);var c=this.transform.localTransform.copyTo(za).invert().translate(-i.x,-i.y);this.render=this._cacheData.originalRender,t.render(this,{renderTexture:u,clear:!0,transform:c,skipUpdateTransform:!1}),t.framebuffer.blit(),t.projection.transform=h,t.renderTexture.bind(o,s,a),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;var d=new As(u);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-i.x/i.width,d.anchor.y=-i.y/i.height,d.alpha=r,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=d.containsPoint.bind(d)}},Je.prototype._renderCachedCanvas=function(t){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(t),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(t))},Je.prototype._initCachedDisplayObjectCanvas=function(t){if(!this._cacheData||!this._cacheData.sprite){var e=this.getLocalBounds(null,!0),r=this.alpha;this.alpha=1;var i=t.context,n=t._projTransform;e.ceil(U.RESOLUTION);var o=Fr.create({width:e.width,height:e.height}),s="cacheAsBitmap_"+ve();this._cacheData.textureCacheId=s,mr.addToCache(o.baseTexture,s),Nr.addToCache(o,s);var a=za;this.transform.localTransform.copyTo(a),a.invert(),a.tx-=e.x,a.ty-=e.y,this.renderCanvas=this._cacheData.originalRenderCanvas,t.render(this,{renderTexture:o,clear:!0,transform:a,skipUpdateTransform:!1}),t.context=i,t._projTransform=n,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=r;var h=new As(o);h.transform.worldTransform=this.transform.worldTransform,h.anchor.x=-e.x/e.width,h.anchor.y=-e.y/e.height,h.alpha=r,h._bounds=this._bounds,this._cacheData.sprite=h,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=t._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=h.containsPoint.bind(h)}},Je.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Je.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Je.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,mr.removeFromCache(this._cacheData.textureCacheId),Nr.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Je.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Je.prototype.name=null,er.prototype.getChildByName=function(t,e){for(var r=0,i=this.children.length;r0){var d=a.x-t[l].x,f=a.y-t[l].y,p=Math.sqrt(d*d+f*f);a=t[l],s+=p/h}else s=l/(u-1);n[c]=s,n[c+1]=0,n[c+2]=s,n[c+3]=1}var _=0;for(l=0;l0?this.textureScale*this._width/2:this._width/2;i/=l,n/=l,i*=c,n*=c,o[u]=h.x+i,o[u+1]=h.y+n,o[u+2]=h.x-i,o[u+3]=h.y-n,r=h}this.buffers[0].update()}},e.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},e}(fa),th=function(e){function r(r,i,n){void 0===n&&(n=0);var o=this,s=new $a(r.height,i,n),a=new da(r);return n>0&&(r.baseTexture.wrapMode=t.WRAP_MODES.REPEAT),(o=e.call(this,s,a)||this).autoUpdate=!0,o}return Qa(r,e),r.prototype._render=function(t){var r=this.geometry;(this.autoUpdate||r._width!==this.shader.texture.height)&&(r._width=this.shader.texture.height,r.update()),e.prototype._render.call(this,t)},r}(ca),eh=function(t){function e(e,r,i){var n=this,o=new Ja(e.width,e.height,r,i),s=new da(Nr.WHITE);return(n=t.call(this,o,s)||this).texture=e,n.autoResize=!0,n}return Qa(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var t=this.geometry,e=this.shader.texture,r=e.width,i=e.height;!this.autoResize||t.width===r&&t.height===i||(t.width=this.shader.texture.width,t.height=this.shader.texture.height,t.build())},Object.defineProperty(e.prototype,"texture",{get:function(){return this.shader.texture},set:function(t){this.shader.texture!==t&&(this.shader.texture=t,this._textureID=-1,t.baseTexture.valid?this.textureUpdated():t.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),t.prototype._render.call(this,e)},e.prototype.destroy=function(e){this.shader.texture.off("update",this.textureUpdated,this),t.prototype.destroy.call(this,e)},e}(ca),rh=function(t){function e(e,r,i,n,o){void 0===e&&(e=Nr.EMPTY);var s=this,a=new fa(r,i,n);a.getBuffer("aVertexPosition").static=!1;var h=new da(e);return(s=t.call(this,a,h,null,o)||this).autoUpdate=!0,s}return Qa(e,t),Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype._render=function(e){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),t.prototype._render.call(this,e)},e}(ca),ih=function(t){function e(e,r,i,n,o){void 0===r&&(r=10),void 0===i&&(i=10),void 0===n&&(n=10),void 0===o&&(o=10);var s=t.call(this,Nr.WHITE,4,4)||this;return s._origWidth=e.orig.width,s._origHeight=e.orig.height,s._width=s._origWidth,s._height=s._origHeight,s._leftWidth=r,s._rightWidth=n,s._topHeight=i,s._bottomHeight=o,s.texture=e,s}return Qa(e,t),e.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(e.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(t){this.geometry.getBuffer("aVertexPosition").data=t},enumerable:!1,configurable:!0}),e.prototype.updateHorizontalVertices=function(){var t=this.vertices,e=this._getMinScale();t[9]=t[11]=t[13]=t[15]=this._topHeight*e,t[17]=t[19]=t[21]=t[23]=this._height-this._bottomHeight*e,t[25]=t[27]=t[29]=t[31]=this._height},e.prototype.updateVerticalVertices=function(){var t=this.vertices,e=this._getMinScale();t[2]=t[10]=t[18]=t[26]=this._leftWidth*e,t[4]=t[12]=t[20]=t[28]=this._width-this._rightWidth*e,t[6]=t[14]=t[22]=t[30]=this._width},e.prototype._getMinScale=function(){var t=this._leftWidth+this._rightWidth,e=this._width>t?1:this._width/t,r=this._topHeight+this._bottomHeight,i=this._height>r?1:this._height/r;return Math.min(e,i)},Object.defineProperty(e.prototype,"width",{get:function(){return this._width},set:function(t){this._width=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height},set:function(t){this._height=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(t){this._leftWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(t){this._rightWidth=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"topHeight",{get:function(){return this._topHeight},set:function(t){this._topHeight=t,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(t){this._bottomHeight=t,this._refresh()},enumerable:!1,configurable:!0}),e.prototype._refresh=function(){var t=this.texture,e=this.geometry.buffers[1].data;this._origWidth=t.orig.width,this._origHeight=t.orig.height;var r=1/this._origWidth,i=1/this._origHeight;e[0]=e[8]=e[16]=e[24]=0,e[1]=e[3]=e[5]=e[7]=0,e[6]=e[14]=e[22]=e[30]=1,e[25]=e[27]=e[29]=e[31]=1,e[2]=e[10]=e[18]=e[26]=r*this._leftWidth,e[4]=e[12]=e[20]=e[28]=1-r*this._rightWidth,e[9]=e[11]=e[13]=e[15]=i*this._topHeight,e[17]=e[19]=e[21]=e[23]=1-i*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},e}(eh),nh=function(t,e){return nh=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])},nh(t,e)},oh=function(e){function r(t,r){void 0===r&&(r=!0);var i=e.call(this,t[0]instanceof Nr?t[0]:t[0].texture)||this;return i._textures=null,i._durations=null,i._autoUpdate=r,i._isConnectedToTicker=!1,i.animationSpeed=1,i.loop=!0,i.updateAnchor=!1,i.onComplete=null,i.onFrameChange=null,i.onLoop=null,i._currentTime=0,i._playing=!1,i._previousFrame=null,i.textures=t,i}return function(t,e){function r(){this.constructor=t}nh(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ar.shared.remove(this.update,this),this._isConnectedToTicker=!1))},r.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ar.shared.add(this.update,this,t.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},r.prototype.gotoAndStop=function(t){this.stop();var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture()},r.prototype.gotoAndPlay=function(t){var e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this.updateTexture(),this.play()},r.prototype.update=function(t){if(this._playing){var e=this.animationSpeed*t,r=this.currentFrame;if(null!==this._durations){var i=this._currentTime%1*this._durations[this.currentFrame];for(i+=e/60*1e3;i<0;)this._currentTime--,i+=this._durations[this.currentFrame];var n=Math.sign(this.animationSpeed*t);for(this._currentTime=Math.floor(this._currentTime);i>=this._durations[this.currentFrame];)i-=this._durations[this.currentFrame]*n,this._currentTime+=n;this._currentTime+=i/this._durations[this.currentFrame]}else this._currentTime+=e;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):r!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFramer)&&this.onLoop(),this.updateTexture())}},r.prototype.updateTexture=function(){var t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this._texture=this._textures[t],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},r.prototype.destroy=function(t){this.stop(),e.prototype.destroy.call(this,t),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},r.fromFrames=function(t){for(var e=[],i=0;i=2*Math.PI?this.drawCircle(t,a,o).beginHole().drawCircle(t,a,r).endHole():(this.finishPoly(),this.arc(t,a,r,i,n,!0).arc(t,a,o,n,i,!1).finishPoly(),this)}},drawChamferRect:{value:function(t,a,r,o,n){if(n<=0)return this.drawRect(t,a,r,o);for(var i=Math.min(n,Math.min(r,o)/2),e=t+r,h=a+o,s=[t+i,a,e-i,a,e,a+i,e,h-i,e-i,h,t+i,h,t,h-i,t,a+i],c=s.length-1;c>=2;c-=2)s[c]===s[c-2]&&s[c-1]===s[c-3]&&s.splice(c-1,2);return this.drawPolygon(s)}},drawFilletRect:{value:function(t,a,r,o,n){if(0===n)return this.drawRect(t,a,r,o);var i=Math.min(r,o)/2,e=Math.min(i,Math.max(-i,n)),h=t+r,s=a+o,c=e<0?-e:0,u=Math.abs(e);return this.moveTo(t,a+u).arcTo(t+c,a+c,t+u,a,u).lineTo(h-u,a).arcTo(h-c,a+c,h,a+u,u).lineTo(h,s-u).arcTo(h-c,s-c,t+r-u,s,u).lineTo(t+u,s).arcTo(t+c,s-c,t,s-u,u).closePath()}},drawRegularPolygon:{value:function(t,a,r,o,n){void 0===n&&(n=0),o=Math.max(0|o,3);for(var i=-1*Math.PI/2+n,e=2*Math.PI/o,h=[],s=0;s{ + const objSafe=(proto,arg)=>{ if(typeof(arg)!=="object"){ return proto; } @@ -278,7 +283,25 @@ class{ pixi:PIXI, api:{} }; - kagura.exitFullscreen=Document.exitFullscreen; + kagura.Howl=Howl; + kagura.api.Howler=class{ + constructor(url){ + this.url=url; + } + make(options){ + options.src=[this.url]; + return new kagura.Howl(options); + } +}; + kagura.api.isUrl=function(str){ + try { + new URL(str); + return true; + }catch (e){ + return false; + } +}; + kagura.exitFullscreen=document.exitFullscreen; kagura.Grid=class{ constructor(n,w,h){ this.n=n; @@ -650,6 +673,14 @@ class extends kagura.obj.Object{ if(!loads){ console.error("Loads arguments is undefined.");return; } + const invurls={}; + Object.keys(loads).forEach(key=>{ + const url=loads[key]; + if(kagura.api.isUrl(key)){ + invurls[key]=url; + } + }); + loads=invurls; this.assets={}; if(!loaded)loaded=function(){}; this.loaded=loaded; @@ -686,6 +717,7 @@ class extends kagura.obj.Object{ my._text=new FileReader() my._text.readAsText(my.blobObj) my.sounder=new kagura.Sounder(my.blob); + my.howler=new kagura.api.Houler(my.blob); } setTimeout(()=>this.loadedOneXhr(load),0) }; @@ -868,3 +900,5 @@ class extends kagura.obj.Object{ return kagura; }(); console.log("Kagura.js -github.com/tiocumo/kagura.js") + return kagura; +})()||kagura) diff --git a/dist/kagura.min.js b/dist/kagura.min.js index 48528ff..be74fad 100644 --- a/dist/kagura.min.js +++ b/dist/kagura.min.js @@ -1 +1 @@ -function scaleToWindow(a,h){var f=window.innerWidth/a.offsetWidth,g=window.innerHeight/a.offsetHeight,b=Math.min(f,g),c,d,e;return a.style.transformOrigin="0 0",a.style.transform="scale("+b+")",a.offsetWidth>a.offsetHeight?a.offsetWidth*b-1,b}var PIXI=function(a){"use strict";var ie=setTimeout,ep,hM,hK,ha,hy,dj,eH,da,c_,eK,cY,eL,eR,ff,cT,fg,ag,ba,B,fi,fj,fm,ft,fA,fD,fL,s,b,cK,af,aT,hb,gt,cj,gm,bz,gp,gs,az,gv,ce,gy,gD,gL,gT,gU,gX,gZ,cb,fZ,fY,fW,g_,g$,bW,ad,L,fH,bR,bQ,hh,bN,hi,hj,fs,bG,q,r,bF,by,fp,hm,aA,fh,fe,g,bn,d,fd,fa,aG,e_,P,m,M,N,W,R,bT,eZ,aV,i,bX,aO,bZ,k,ca,u,aD,eT,A,p,ch,o,eQ,aq,cm,co,Z,S,hs,e,bm,cu,z,cw,cx,bc,cz,cA,cB,eN,hw,a_,cF,cG,eF,c,G,eB,cM,hz,n,hA,ew,hD,hE,an,en,cV,hO,J,ek,bi,dD,c$,aF,db,ej,dd,ei,ih,dg,dh,di,eg,br,dV,aC,hX,bv,dL,at,Y,hZ,h_,h$,ib,bl,al,D,K,C,dM,bu,dO,du,dQ,dR,dS,dt,ds,dq,$,aE,dk,hU,d$,ed,hS,bp,df,de,dc,be,cW,em,cU,eo,hN,hH,cS,et,cR,hB,bb,aY,aW,ez,eA,cL,eC,eD,eE,cH,eG,hx,cD,eJ,hu,eh,eM,cC,cr,eP,bA,hr,eS,bw,eU,eV,eW,aX,bU,E,bh,ho,bE,hn,aJ,fk,fl,f,hk,av,bD,bs,y,fu,bk,fw,w,bL,U,H,aZ,hg,hf,fG,bS,fI,fJ,fM,fN,bV,hd,fR,fS,ac,dE,bY,b$,aL,f_,gb,aj,cd,gh,gi,gj,bt,cf,ay,cg,am,dF,gn,gr,ci,ar,gu,cn,aw,gx,ai,cp,cq,gB,X,bf,x,gI,cy,cE,gf,ge,ga,gY,f$,fV,cI,aN,hc,fQ,aU,fE,cN,fv,cP,fo,ah,ao,aI,cQ,aH,eX,bd,eO,cX,F,ey,ex,ev,hC,eu,dl,hF,dn,hI,hJ,dp,hL,dr,dv,dw,hP,dx,hR,dA,hT,d_,hV,dZ,dP,dB,dI,dH,ia,dG,ic,id,dC,ig,gw;function dJ(a){return Boolean(a&&void 0!==a.length)}function hY(){}function l(a){if(!(this instanceof l))throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],el(a,this)}function ef(a,b){for(;3===a._state;)a=a._value;0!==a._state?(a._handled=!0,l._immediateFn(function(){var c=1===a._state?b.onFulfilled:b.onRejected,d;if(null!==c){try{d=c(a._value)}catch(a){return void aB(b.promise,a)}dz(b.promise,d)}else(1===a._state?dz:aB)(b.promise,a._value)})):a._deferreds.push(b)}function dz(a,b){var c,d,e;try{if(b===a)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){if(c=b.then,b instanceof l)return a._state=3,a._value=b,void dy(a);if("function"==typeof c)return void el((d=c,e=b,function(){d.apply(e,arguments)}),a)}a._state=1,a._value=b,dy(a)}catch(b){aB(a,b)}}function aB(a,b){a._state=2,a._value=b,dy(a)}function dy(a){2===a._state&&0===a._deferreds.length&&l._immediateFn(function(){a._handled||l._unhandledRejectionFn(a._value)});for(var b=0,c=a._deferreds.length;b0?1:-1}),Number.isInteger||(Number.isInteger=function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array),a.ENV=void 0,a.RENDERER_TYPE=void 0,a.BUFFER_BITS=void 0,a.BLEND_MODES=void 0,a.DRAW_MODES=void 0,a.FORMATS=void 0,a.TARGETS=void 0,a.TYPES=void 0,a.SAMPLER_TYPES=void 0,a.SCALE_MODES=void 0,a.WRAP_MODES=void 0,a.MIPMAP_MODES=void 0,a.ALPHA_MODES=void 0,a.CLEAR_MODES=void 0,a.GC_MODES=void 0,a.PRECISION=void 0,a.MASK_TYPES=void 0,a.COLOR_MASK_BITS=void 0,a.MSAA_QUALITY=void 0,a.BUFFER_TYPE=void 0,function(a){a[a.WEBGL_LEGACY=0]="WEBGL_LEGACY",a[a.WEBGL=1]="WEBGL",a[a.WEBGL2=2]="WEBGL2"}(a.ENV||(a.ENV={})),function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.WEBGL=1]="WEBGL",a[a.CANVAS=2]="CANVAS"}(a.RENDERER_TYPE||(a.RENDERER_TYPE={})),function(a){a[a.COLOR=16384]="COLOR",a[a.DEPTH=256]="DEPTH",a[a.STENCIL=1024]="STENCIL"}(a.BUFFER_BITS||(a.BUFFER_BITS={})),function(a){a[a.NORMAL=0]="NORMAL",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.SCREEN=3]="SCREEN",a[a.OVERLAY=4]="OVERLAY",a[a.DARKEN=5]="DARKEN",a[a.LIGHTEN=6]="LIGHTEN",a[a.COLOR_DODGE=7]="COLOR_DODGE",a[a.COLOR_BURN=8]="COLOR_BURN",a[a.HARD_LIGHT=9]="HARD_LIGHT",a[a.SOFT_LIGHT=10]="SOFT_LIGHT",a[a.DIFFERENCE=11]="DIFFERENCE",a[a.EXCLUSION=12]="EXCLUSION",a[a.HUE=13]="HUE",a[a.SATURATION=14]="SATURATION",a[a.COLOR=15]="COLOR",a[a.LUMINOSITY=16]="LUMINOSITY",a[a.NORMAL_NPM=17]="NORMAL_NPM",a[a.ADD_NPM=18]="ADD_NPM",a[a.SCREEN_NPM=19]="SCREEN_NPM",a[a.NONE=20]="NONE",a[a.SRC_OVER=0]="SRC_OVER",a[a.SRC_IN=21]="SRC_IN",a[a.SRC_OUT=22]="SRC_OUT",a[a.SRC_ATOP=23]="SRC_ATOP",a[a.DST_OVER=24]="DST_OVER",a[a.DST_IN=25]="DST_IN",a[a.DST_OUT=26]="DST_OUT",a[a.DST_ATOP=27]="DST_ATOP",a[a.ERASE=26]="ERASE",a[a.SUBTRACT=28]="SUBTRACT",a[a.XOR=29]="XOR"}(a.BLEND_MODES||(a.BLEND_MODES={})),function(a){a[a.POINTS=0]="POINTS",a[a.LINES=1]="LINES",a[a.LINE_LOOP=2]="LINE_LOOP",a[a.LINE_STRIP=3]="LINE_STRIP",a[a.TRIANGLES=4]="TRIANGLES",a[a.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",a[a.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(a.DRAW_MODES||(a.DRAW_MODES={})),function(a){a[a.RGBA=6408]="RGBA",a[a.RGB=6407]="RGB",a[a.RG=33319]="RG",a[a.RED=6403]="RED",a[a.RGBA_INTEGER=36249]="RGBA_INTEGER",a[a.RGB_INTEGER=36248]="RGB_INTEGER",a[a.RG_INTEGER=33320]="RG_INTEGER",a[a.RED_INTEGER=36244]="RED_INTEGER",a[a.ALPHA=6406]="ALPHA",a[a.LUMINANCE=6409]="LUMINANCE",a[a.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",a[a.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",a[a.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(a.FORMATS||(a.FORMATS={})),function(a){a[a.TEXTURE_2D=3553]="TEXTURE_2D",a[a.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",a[a.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",a[a.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",a[a.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",a[a.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",a[a.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(a.TARGETS||(a.TARGETS={})),function(a){a[a.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",a[a.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",a[a.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",a[a.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",a[a.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",a[a.UNSIGNED_INT=5125]="UNSIGNED_INT",a[a.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",a[a.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",a[a.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",a[a.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",a[a.BYTE=5120]="BYTE",a[a.SHORT=5122]="SHORT",a[a.INT=5124]="INT",a[a.FLOAT=5126]="FLOAT",a[a.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",a[a.HALF_FLOAT=36193]="HALF_FLOAT"}(a.TYPES||(a.TYPES={})),function(a){a[a.FLOAT=0]="FLOAT",a[a.INT=1]="INT",a[a.UINT=2]="UINT"}(a.SAMPLER_TYPES||(a.SAMPLER_TYPES={})),function(a){a[a.NEAREST=0]="NEAREST",a[a.LINEAR=1]="LINEAR"}(a.SCALE_MODES||(a.SCALE_MODES={})),function(a){a[a.CLAMP=33071]="CLAMP",a[a.REPEAT=10497]="REPEAT",a[a.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(a.WRAP_MODES||(a.WRAP_MODES={})),function(a){a[a.OFF=0]="OFF",a[a.POW2=1]="POW2",a[a.ON=2]="ON",a[a.ON_MANUAL=3]="ON_MANUAL"}(a.MIPMAP_MODES||(a.MIPMAP_MODES={})),function(a){a[a.NPM=0]="NPM",a[a.UNPACK=1]="UNPACK",a[a.PMA=2]="PMA",a[a.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",a[a.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",a[a.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",a[a.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(a.ALPHA_MODES||(a.ALPHA_MODES={})),function(a){a[a.NO=0]="NO",a[a.YES=1]="YES",a[a.AUTO=2]="AUTO",a[a.BLEND=0]="BLEND",a[a.CLEAR=1]="CLEAR",a[a.BLIT=2]="BLIT"}(a.CLEAR_MODES||(a.CLEAR_MODES={})),function(a){a[a.AUTO=0]="AUTO",a[a.MANUAL=1]="MANUAL"}(a.GC_MODES||(a.GC_MODES={})),function(a){a.LOW="lowp",a.MEDIUM="mediump",a.HIGH="highp"}(a.PRECISION||(a.PRECISION={})),function(a){a[a.NONE=0]="NONE",a[a.SCISSOR=1]="SCISSOR",a[a.STENCIL=2]="STENCIL",a[a.SPRITE=3]="SPRITE",a[a.COLOR=4]="COLOR"}(a.MASK_TYPES||(a.MASK_TYPES={})),function(a){a[a.RED=1]="RED",a[a.GREEN=2]="GREEN",a[a.BLUE=4]="BLUE",a[a.ALPHA=8]="ALPHA"}(a.COLOR_MASK_BITS||(a.COLOR_MASK_BITS={})),function(a){a[a.NONE=0]="NONE",a[a.LOW=2]="LOW",a[a.MEDIUM=4]="MEDIUM",a[a.HIGH=8]="HIGH"}(a.MSAA_QUALITY||(a.MSAA_QUALITY={})),function(a){a[a.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",a[a.ARRAY_BUFFER=34962]="ARRAY_BUFFER",a[a.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(a.BUFFER_TYPE||(a.BUFFER_TYPE={})),eK={createCanvas:function(b,c){var a=document.createElement("canvas");return a.width=b,a.height=c,a},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var a;return null!==(a=document.baseURI)&&void 0!==a?a:window.location.href},fetch:function(a,b){return fetch(a,b)}},cY=/iPhone/i,eL=/iPod/i,eR=/iPad/i,ff=/\biOS-universal(?:.+)Mac\b/i,cT=/\bAndroid(?:.+)Mobile\b/i,fg=/Android/i,ag=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ba=/Silk/i,B=/Windows Phone/i,fi=/\bWindows(?:.+)ARM\b/i,fj=/BlackBerry/i,fm=/BB10/i,ft=/Opera Mini/i,fA=/\b(CriOS|Chrome)(?:.+)Mobile/i,fD=/Mobile(?:.+)Firefox\b/i,fL=function(a){return void 0!==a&&"MacIntel"===a.platform&&"number"==typeof a.maxTouchPoints&&a.maxTouchPoints>1&&"undefined"==typeof MSStream},s=function(c){var d={userAgent:"",platform:"",maxTouchPoints:0},e,f,a,b;return c||"undefined"==typeof navigator?"string"==typeof c?d.userAgent=c:c&&c.userAgent&&(d={userAgent:c.userAgent,platform:c.platform,maxTouchPoints:c.maxTouchPoints||0}):d={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0},e=d.userAgent,f=e.split("[FBAN"),void 0!==f[1]&&(e=f[0]),void 0!==(f=e.split("Twitter"))[1]&&(e=f[0]),a=function(a){return function(b){return b.test(a)}}(e),b={apple:{phone:a(cY)&&!a(B),ipod:a(eL),tablet:!a(cY)&&(a(eR)||fL(d))&&!a(B),universal:a(ff),device:(a(cY)||a(eL)||a(eR)||a(ff)||fL(d))&&!a(B)},amazon:{phone:a(ag),tablet:!a(ag)&&a(ba),device:a(ag)||a(ba)},android:{phone:!a(B)&&a(ag)||!a(B)&&a(cT),tablet:!a(B)&&!a(ag)&&!a(cT)&&(a(ba)||a(fg)),device:!a(B)&&(a(ag)||a(ba)||a(cT)||a(fg))||a(/\bokhttp\b/i)},windows:{phone:a(B),tablet:a(fi),device:a(B)||a(fi)},other:{blackberry:a(fj),blackberry10:a(fm),opera:a(ft),firefox:a(fD),chrome:a(fA),device:a(fj)||a(fm)||a(ft)||a(fD)||a(fA)},any:!1,phone:!1,tablet:!1},b.any=b.apple.device||b.android.device||b.windows.device||b.other.device,b.phone=b.apple.phone||b.android.phone||b.windows.phone,b.tablet=b.apple.tablet||b.android.tablet||b.windows.tablet,b}(globalThis.navigator),b={ADAPTER:eK,MIPMAP_TEXTURES:a.MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:a.MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(c){var a,b=!0;return(s.tablet||s.phone)&&(s.apple.device&&(a=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(a[1],10)<11&&(b=!1),s.android.device&&(a=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(a[1],10)<7&&(b=!1)),b?32:4}(),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:a.GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:a.WRAP_MODES.CLAMP,SCALE_MODE:a.SCALE_MODES.LINEAR,PRECISION_VERTEX:a.PRECISION.HIGH,PRECISION_FRAGMENT:s.apple.device?a.PRECISION.HIGH:a.PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!s.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},cK="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function cJ(b,c,a){return b(a={path:c,exports:{},require:function(c,b){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==b&&a.path)}},a.exports),a.exports}af=cJ(function(g){var h=Object.prototype.hasOwnProperty,b="~";function c(){}function f(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function e(a,e,g,h,i){if("function"!=typeof g)throw new TypeError("The listener must be a function");var d=new f(g,h||a,i),c=b?b+e:e;return a._events[c]?a._events[c].fn?a._events[c]=[a._events[c],d]:a._events[c].push(d):(a._events[c]=d,a._eventsCount++),a}function d(a,b){0==--a._eventsCount?a._events=new c:delete a._events[b]}function a(){this._events=new c,this._eventsCount=0}Object.create&&(c.prototype=Object.create(null),(new c).__proto__||(b=!1)),a.prototype.eventNames=function(){var d,a,c=[];if(0===this._eventsCount)return c;for(a in d=this._events)h.call(d,a)&&c.push(b?a.slice(1):a);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(d){var g=b?b+d:d,a=this._events[g],c,e,f;if(!a)return[];if(a.fn)return[a.fn];for(c=0,e=a.length,f=new Array(e);c80*a){d=g=b[0],e=h=b[1];for(k=a;kg&&(g=j),i>h&&(h=i);f=0!==(f=Math.max(g-d,h-e))?32767/f:0}return aM(c,m,a,d,e,f,0),m}function fT(c,e,f,d,g){var a,b;if(g===ck(c,e,f,d)>0)for(a=e;a=e;a-=d)b=gl(a,c[a],c[a+1],b);return b&&aR(b,b.next)&&(au(b),b=b.next),b}function V(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner||!aR(a,a.next)&&0!==j(a.prev,a,a.next))a=a.next;else{if(au(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function aM(a,b,c,e,f,d,h){if(a){!h&&d&&function(b,c,d,e){var a=b;do 0===a.z&&(a.z=cs(a.x,a.y,c,d,e)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==b)a.prevZ.nextZ=null,a.prevZ=null,function(g){var i,b,a,c,d,h,e,f,j=1;do{for(b=g,g=null,d=null,h=0;b;){for(h++,a=b,e=0,i=0;i0||f>0&&a;)0!==e&&(0===f||!a||b.z<=a.z)?(c=b,b=b.nextZ,e--):(c=a,a=a.nextZ,f--),d?d.nextZ=c:g=c,c.prevZ=d,d=c;b=a}d.nextZ=null,j*=2}while(h>1)}(a)}(a,e,f,d);for(var i,g,j=a;a.prev!==a.next;)if(i=a.prev,g=a.next,d?gJ(a,e,f,d):gK(a))b.push(i.i/c|0),b.push(a.i/c|0),b.push(g.i/c|0),au(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?aM(a=gH(V(a),b,c),b,c,e,f,d,2):2===h&&gG(a,b,c,e,f,d):aM(V(a),b,c,e,f,d,1);break}}}function gK(l){var i=l.prev,k=l,h=l.next,e,f,b,g,d,c,m,n,o,p,a;if(j(i,k,h)>=0)return!1;for(e=i.x,f=k.x,b=h.x,g=i.y,d=k.y,c=h.y,m=ef?e>b?e:b:f>b?f:b,p=g>d?g>c?g:c:d>c?d:c,a=h.next;a!==i;){if(a.x>=m&&a.x<=o&&a.y>=n&&a.y<=p&&ae(e,g,f,d,b,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function gJ(p,u,v,r){var i=p.prev,q=p,k=p.next,e,g,d,h,f,c,l,o,n,m,s,t,a,b;if(j(i,q,k)>=0)return!1;for(e=i.x,g=q.x,d=k.x,h=i.y,f=q.y,c=k.y,l=eg?e>d?e:d:g>d?g:d,m=h>f?h>c?h:c:f>c?f:c,s=cs(l,o,u,v,r),t=cs(n,m,u,v,r),a=p.prevZ,b=p.nextZ;a&&a.z>=s&&b&&b.z<=t;){if(a.x>=l&&a.x<=n&&a.y>=o&&a.y<=m&&a!==i&&a!==k&&ae(e,h,g,f,d,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;if(a=a.prevZ,b.x>=l&&b.x<=n&&b.y>=o&&b.y<=m&&b!==i&&b!==k&&ae(e,h,g,f,d,c,b.x,b.y)&&j(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;a&&a.z>=s;){if(a.x>=l&&a.x<=n&&a.y>=o&&a.y<=m&&a!==i&&a!==k&&ae(e,h,g,f,d,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;a=a.prevZ}for(;b&&b.z<=t;){if(b.x>=l&&b.x<=n&&b.y>=o&&b.y<=m&&b!==i&&b!==k&&ae(e,h,g,f,d,c,b.x,b.y)&&j(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function gH(d,e,f){var a=d,c,b;do c=a.prev,b=a.next.next,!aR(c,b)&&gk(c,a,a.next,b)&&ax(c,b)&&ax(b,c)&&(e.push(c.i/f|0),e.push(a.i/f|0),e.push(b.i/f|0),au(a),au(a.next),a=d=b),a=a.next;while(a!==d)return V(a)}function gG(g,h,i,d,e,f){var a=g,b,c;do{for(b=a.next.next;b!==a.prev;){if(a.i!==b.i&&gz(a,b))return c=fU(a,b),a=V(a,a.next),c=V(c,c.next),aM(a,h,i,d,e,f,0),void aM(c,h,i,d,e,f,0);b=b.next}a=a.next}while(a!==g)}function gF(a,b){return a.x-b.x}function gE(b,c){var a=function(h,l){var b,a=l,d=h.x,c=h.y,g=-1/0,e,f,m,k,i,j;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y)if(e=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y),e<=d&&e>g&&(g=e,b=a.x=a.x&&a.x>=k&&d!==a.x&&ae(cb.x||a.x===b.x&&gC(b,a)))&&(b=a,j=f)),a=a.next;while(a!==m)return b}(b,c),d;return a?(d=fU(a,b),V(d,d.next),V(a,a.next)):c}function gC(a,b){return j(a.prev,a,b.prev)<0&&j(b.next,a,a.next)<0}function cs(a,b,d,e,c){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-d)*c|0)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=(b-e)*c|0)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function gA(c){var a=c,b=c;do(a.x=(g-a)*(f-b)&&(g-a)*(d-b)>=(c-a)*(h-b)&&(c-a)*(f-b)>=(e-a)*(d-b)}function gz(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(b,c){var a=b;do{if(a.i!==b.i&&a.next.i!==b.i&&a.i!==c.i&&a.next.i!==c.i&&gk(a,a.next,b,c))return!0;a=a.next}while(a!==b)return!1}(a,b)&&(ax(a,b)&&ax(b,a)&&function(b,e){var a=b,c=!1,f=(b.x+e.x)/2,d=(b.y+e.y)/2;do a.y>d!=a.next.y>d&&a.next.y!==a.y&&f<(a.next.x-a.x)*(d-a.y)/(a.next.y-a.y)+a.x&&(c=!c),a=a.next;while(a!==b)return c}(a,b)&&(j(a.prev,a,b.prev)||j(a,b.prev,b))||aR(a,b)&&j(a.prev,a,a.next)>0&&j(b.prev,b,b.next)>0)}function j(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function aR(a,b){return a.x===b.x&&a.y===b.y}function gk(a,b,c,d){var e=bx(j(a,b,c)),f=bx(j(a,b,d)),g=bx(j(c,d,a)),h=bx(j(c,d,b));return e!==f&&g!==h||!(0!==e||!bq(a,c,b))||!(0!==f||!bq(a,d,b))||!(0!==g||!bq(c,a,d))||!(0!==h||!bq(c,b,d))}function bq(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function bx(a){return a>0?1:a<0?-1:0}function ax(a,b){return j(a.prev,a,a.next)<0?j(a,b,a.next)>=0&&j(a,a.prev,b)>=0:j(a,b,a.prev)<0||j(a,a.next,b)<0}function fU(a,b){var d=new cl(a.i,a.x,a.y),c=new cl(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,d.next=e,e.prev=d,c.next=d,d.prev=c,f.next=c,c.prev=f,c}function gl(c,d,e,b){var a=new cl(c,d,e);return b?(a.next=b.next,a.prev=b,b.next.prev=a,b.next=a):(a.prev=a,a.next=a),a}function au(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function cl(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ck(b,g,d,e){for(var f=0,a=g,c=d-e;a0&&(g+=b[a-1].length,c.holes.push(g))}return c},aT.default=hb,gt=cJ(function(a,b){!function(n){var k=b&&!b.nodeType&&b,q=a&&!a.nodeType&&a,f="object"==typeof cK&&cK,g,j,h,d,x,w,v,y,c,i;f.global!==f&&f.window!==f&&f.self!==f||(n=f),h=2147483647,d=36,x=/^xn--/,w=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,i=String.fromCharCode;function e(a){throw RangeError(y[a])}function r(b,d){for(var a=b.length,c=[];a--;)c[a]=d(b[a]);return c}function s(a,d){var b=a.split("@"),c="";return b.length>1&&(c=b[0]+"@",a=b[1]),c+r((a=a.replace(v,".")).split("."),d).join(".")}function t(d){for(var a,e,c=[],b=0,f=d.length;b=55296&&a<=56319&&b65535&&(b+=i((a-=65536)>>>10&1023|55296),a=56320|1023&a),b+=i(a)}).join("")}function m(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function o(a,e,f){var b=0;for(a=f?c(a/700):a>>1,a+=c(a/e);a>455;b+=d)a=c(a/35);return c(b+36*a/(a+38))}function p(k){var m,g,i,l,r,j,f,p,v,t,b,n=[],w=k.length,a=0,s=128,q=72;for((g=k.lastIndexOf("-"))<0&&(g=0),i=0;i=128&&e("not-basic"),n.push(k.charCodeAt(i));for(l=g>0?g+1:0;l=w&&e("invalid-input"),((p=(b=k.charCodeAt(l++))-48<10?b-22:b-65<26?b-65:b-97<26?b-97:d)>=d||p>c((h-a)/j))&&e("overflow"),a+=p*j,!(p<(v=f<=q?1:f>=q+26?26:f-q));f+=d)j>c(h/(t=d-v))&&e("overflow"),j*=t;q=o(a-r,m=n.length+1,0==r),c(a/m)>h-s&&e("overflow"),s+=c(a/m),a%=m,n.splice(a++,0,s)}return u(n)}function l(s){var b,f,l,v,p,a,j,r,q,u,g,n,w,x,y,k=[];for(n=(s=t(s)).length,b=128,f=0,p=72,a=0;a=b&&gc((h-f)/(w=l+1))&&e("overflow"),f+=(j-b)*w,b=j,a=0;ah&&e("overflow"),g==b){for(r=f,q=d;!(r<(u=q<=p?1:q>=p+26?26:q-p));q+=d)y=r-u,x=d-u,k.push(i(m(u+y%x,0))),r=c(y/x);k.push(i(m(r,0))),p=o(f,w,l==v),f=0,++l}++f,++b}return k.join("")}if(g={version:"1.3.2",ucs2:{decode:t,encode:u},decode:p,encode:l,toASCII:function(a){return s(a,function(a){return w.test(a)?"xn--"+l(a):a})},toUnicode:function(a){return s(a,function(a){return x.test(a)?p(a.slice(4).toLowerCase()):a})}},k&&q)if(a.exports==k)q.exports=g;else for(j in g)g.hasOwnProperty(j)&&(k[j]=g[j]);else n.punycode=g}(cK)}),cj=function(a){return"string"==typeof a},gm=function(a){return"object"==typeof a&&null!==a},bz=function(a){return null===a},gp=function(a){return null==a};function gq(a,b){return Object.prototype.hasOwnProperty.call(a,b)}gs=function(c,n,m,l){var a,o,d,j,i,h,g,b,e,f,k;if(n=n||"&",m=m||"=",a={},"string"!=typeof c||0===c.length)return a;o=/\+/g,c=c.split(n),d=1e3,l&&"number"==typeof l.maxKeys&&(d=l.maxKeys),j=c.length,d>0&&j>d&&(j=d);for(i=0;i=0?(h=f.substr(0,k),g=f.substr(k+1)):(h=f,g=""),b=decodeURIComponent(h),e=decodeURIComponent(g),gq(a,b)?Array.isArray(a[b])?a[b].push(e):a[b]=[a[b],e]:a[b]=e;return a},az=function(a){switch(typeof a){case"string":return a;case"boolean":return a?"true":"false";case"number":return isFinite(a)?a:"";default:return""}},gv=function(a,b,c,d){return b=b||"&",c=c||"=",null===a&&(a=void 0),"object"==typeof a?Object.keys(a).map(function(d){var e=encodeURIComponent(az(d))+c;return Array.isArray(a[d])?a[d].map(function(a){return e+encodeURIComponent(az(a))}).join(b):e+encodeURIComponent(az(a[d]))}).join(b):d?encodeURIComponent(az(d))+c+encodeURIComponent(az(a)):""},ce=cJ(function(b,a){a.decode=a.parse=gs,a.encode=a.stringify=gv}),gy=aS,gD=function(a,b){return aS(a,!1,!0).resolve(b)},gL=function(a){return cj(a)&&(a=aS(a)),!(a instanceof t)?t.prototype.format.call(a):a.format()};function t(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}gT=/^([a-z0-9.+-]+:)/i,gU=/:[0-9]*$/,gX=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,gZ=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n"," "]),cb=["'"].concat(gZ),fZ=["%","/","?",";","#"].concat(cb),fY=["/","?","#"],fW=/^[+a-z0-9A-Z_-]{0,63}$/,g_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g$={javascript:!0,"javascript:":!0},bW={javascript:!0,"javascript:":!0},ad={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function aS(a,c,d){if(a&&gm(a)&&a instanceof t)return a;var b=new t;return b.parse(a,c,d),b}t.prototype.parse=function(g,v,F){var C,B,q,a,j,d,p,A,z,n,c,b,f,x,l,s,e,u,i,D,y,m,w,o,E,h,r,t,k,G;if(!cj(g))throw new TypeError("Parameter 'url' must be a string, not "+typeof g);if(C=g.indexOf("?"),B=-1!==C&&C127?u+="x":u+=e[i];if(!u.match(fW)){y=l.slice(0,b),m=l.slice(b+1),w=e.match(g_),w&&(y.push(w[1]),m.unshift(w[2])),m.length&&(a="/"+m.join(".")+a),this.hostname=y.join(".");break}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=gt.toASCII(this.hostname)),o=this.port?":"+this.port:"",E=this.hostname||"",this.host=E+o,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!g$[p])for(b=0,s=cb.length;b0)&&a.host.split("@"))&&(a.auth=f.shift(),a.host=a.hostname=f.shift())),a.search=b.search,a.query=b.query,bz(a.pathname)&&bz(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a;if(!c.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(h=c.slice(-1)[0],x=(a.host||b.host||c.length>1)&&("."===h||".."===h)||""===h,i=0,g=c.length;g>=0;g--)"."===(h=c[g])?c.splice(g,1):".."===h?(c.splice(g,1),i++):i&&(c.splice(g,1),i--);if(!e&&!y)for(;i--;i)c.unshift("..");return!e||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),x&&"/"!==c.join("/").substr(-1)&&c.push(""),w=""===c[0]||c[0]&&"/"===c[0].charAt(0),n&&(a.hostname=a.host=w?"":c.length?c.shift():"",(f=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=f.shift(),a.host=a.hostname=f.shift())),(e=e||a.host&&c.length)&&!w&&c.unshift(""),c.length?a.pathname=c.join("/"):(a.pathname=null,a.path=null),bz(a.pathname)&&bz(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=b.auth||a.auth,a.slashes=a.slashes||b.slashes,a.href=a.format(),a},t.prototype.parseHost=function(){var a=this.host,b=gU.exec(a);b&&(":"!==(b=b[0])&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)},L={parse:gy,format:gL,resolve:gD};function v(a){if("string"!=typeof a)throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function fO(a){return a.split("?")[0].split("#")[0]}fH={toPosix:function(a){return"\\","/",a.replace(new RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")},isUrl:function(a){return/^https?:/.test(this.toPosix(a))},isDataUrl:function(a){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(a)},hasProtocol:function(a){return/^[^/:]+:\//.test(this.toPosix(a))},getProtocol:function(a){var e,b,c,d,f;return v(a),a=this.toPosix(a),e="",b=/^file:\/\/\//.exec(a),c=/^[^/:]+:\/\//.exec(a),d=/^[^/:]+:\//.exec(a),(b||c||d)&&(f=(null==b?void 0:b[0])||(null==c?void 0:c[0])||(null==d?void 0:d[0]),e=f,a=a.slice(f.length)),e},toAbsolute:function(a,c,d){if(this.isDataUrl(a))return a;var e=fO(this.toPosix(null!=c?c:b.ADAPTER.getBaseUrl())),f=fO(this.toPosix(null!=d?d:this.rootname(e)));return v(a),(a=this.toPosix(a)).startsWith("/")?fH.join(f,a.slice(1)):this.isAbsolute(a)?a:this.join(e,a)},normalize:function(a){var b,c,d;return v(a=this.toPosix(a)),0===a.length?".":(b="",c=a.startsWith("/"),this.hasProtocol(a)&&(b=this.rootname(a),a=a.slice(b.length)),d=a.endsWith("/"),(a=function(g,i){for(var e,a="",f=0,d=-1,c=0,b=0,h;b<=g.length;++b){if(b2){if(h=a.lastIndexOf("/"),h!==a.length-1){-1===h?(a="",f=0):f=(a=a.slice(0,h)).length-1-a.lastIndexOf("/"),d=b,c=0;continue}}else if(2===a.length||1===a.length){a="",f=0,d=b,c=0;continue}}else a.length>0?a+="/"+g.slice(d+1,b):a=g.slice(d+1,b),f=b-d-1;d=b,c=0}else 46===e&&-1!==c?++c:c=-1}return a}(a)).length>0&&d&&(a+="/"),c?"/"+a:b+a)},isAbsolute:function(a){return v(a),a=this.toPosix(a),!!this.hasProtocol(a)||a.startsWith("/")},join:function(){for(var f,a,g=arguments,c=[],d=0,e,b,h;d0)&&(void 0===a?a=b:(h=null!==(f=c[e-1])&&void 0!==f?f:"",this.extname(h)?a+="/../"+b:a+="/"+b));return void 0===a?".":this.normalize(a)},dirname:function(a){if(v(a),0===a.length)return".";for(var g=(a=this.toPosix(a)).charCodeAt(0),e=47===g,c=-1,f=!0,d=this.getProtocol(a),h=a,b=(a=a.slice(d.length)).length-1;b>=1;--b)if(47===(g=a.charCodeAt(b))){if(!f){c=b;break}}else f=!1;return-1===c?e?"/":this.isUrl(h)?d+a:d:e&&1===c?"//":d+a.slice(0,c)},rootname:function(a){var b,c;return v(a),b="",(b=(a=this.toPosix(a)).startsWith("/")?"/":this.getProtocol(a),this.isUrl(a))&&(c=a.indexOf("/",b.length),(b=-1!==c?a.slice(0,c):a).endsWith("/")||(b+="/")),b},basename:function(b,d){var a,e,c,f,g,h,i;if(v(b),d&&v(d),b=this.toPosix(b),e=0,c=-1,f=!0,void 0!==d&&d.length>0&&d.length<=b.length){if(d.length===b.length&&d===b)return"";g=d.length-1,h=-1;for(a=b.length-1;a>=0;--a)if(i=b.charCodeAt(a),47===i){if(!f){e=a+1;break}}else-1===h&&(f=!1,h=a+1),g>=0&&(i===d.charCodeAt(g)?-1==--g&&(c=a):(g=-1,c=h));return e===c?c=h:-1===c&&(c=b.length),b.slice(e,c)}for(a=b.length-1;a>=0;--a)if(47===b.charCodeAt(a)){if(!f){e=a+1;break}}else-1===c&&(f=!1,c=a+1);return-1===c?"":b.slice(e,c)},extname:function(e){var a,f,c,g,d,b,h;v(e);for(a=-1,f=0,c=-1,g=!0,d=0,b=(e=this.toPosix(e)).length-1;b>=0;--b)if(h=e.charCodeAt(b),47!==h)-1===c&&(g=!1,c=b+1),46===h?-1===a?a=b:1!==d&&(d=1):-1!==a&&(d=-1);else if(!g){f=b+1;break}return-1===a||-1===c||0===d||1===d&&a===c-1&&a===f+1?"":e.slice(a,c)},parse:function(a){var b,i,k,h,d,e,c,j,f,g;if(v(a),b={root:"",dir:"",base:"",ext:"",name:""},0===a.length)return b;k=(a=this.toPosix(a)).charCodeAt(0),h=this.isAbsolute(a),b.root=this.rootname(a),i=h||this.hasProtocol(a)?1:0;for(d=-1,e=0,c=-1,j=!0,f=a.length-1,g=0;f>=i;--f)if(47!==(k=a.charCodeAt(f)))-1===c&&(j=!1,c=f+1),46===k?-1===d?d=f:1!==g&&(g=1):-1!==d&&(g=-1);else if(!j){e=f+1;break}return-1===d||-1===c||0===g||1===g&&d===c-1&&d===e+1?-1!==c&&(b.base=b.name=0===e&&h?a.slice(1,c):a.slice(e,c)):(0===e&&h?(b.name=a.slice(1,d),b.base=a.slice(1,c)):(b.name=a.slice(e,d),b.base=a.slice(e,c)),b.ext=a.slice(d,c)),b.dir=this.dirname(a),b},sep:"/",delimiter:":"},b.RETINA_PREFIX=/@([0-9\.]+)x/,b.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1,bQ=!1;function fC(a){var c,d;bQ||(b.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1?(d=["\n %c %c %c PixiJS 6.5.8 - ✰ "+a+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"],(c=globalThis.console).log.apply(c,d)):globalThis.console&&globalThis.console.log("PixiJS 6.5.8 - "+a+" - http://www.pixijs.com/"),bQ=!0)}function fB(){return void 0===bR&&(bR=function(){var c={stencil:!0,failIfMajorPerformanceCaveat:b.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT},d,a,f,e;try{return!!b.ADAPTER.getWebGLRenderingContext()&&(d=b.ADAPTER.createCanvas(),a=d.getContext("webgl",c)||d.getContext("experimental-webgl",c),f=!(!a||!a.getContextAttributes().stencil),a&&(e=a.getExtension("WEBGL_lose_context"),e&&e.loseContext()),a=null,f)}catch(a){return!1}}()),bR}hh={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function T(b,a){return void 0===a&&(a=[]),a[0]=(b>>16&255)/255,a[1]=(b>>8&255)/255,a[2]=(255&b)/255,a}function bP(b){var a=b.toString(16);return"#"+("000000".substring(0,6-a.length)+a)}function bO(a){return"string"==typeof a&&"#"===(a=hh[a.toLowerCase()]||a)[0]&&(a=a.slice(1)),parseInt(a,16)}bN=function(){for(var c=[],d=[],b=0,e;b<32;b++)c[b]=b,d[b]=b;return c[a.BLEND_MODES.NORMAL_NPM]=a.BLEND_MODES.NORMAL,c[a.BLEND_MODES.ADD_NPM]=a.BLEND_MODES.ADD,c[a.BLEND_MODES.SCREEN_NPM]=a.BLEND_MODES.SCREEN,d[a.BLEND_MODES.NORMAL]=a.BLEND_MODES.NORMAL_NPM,d[a.BLEND_MODES.ADD]=a.BLEND_MODES.ADD_NPM,d[a.BLEND_MODES.SCREEN]=a.BLEND_MODES.SCREEN_NPM,e=[],e.push(d),e.push(c),e}();function bM(a,b){return bN[b?1:0][a]}function fz(b,c,a,d){return a=a||new Float32Array(4),d||void 0===d?(a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c):(a[0]=b[0],a[1]=b[1],a[2]=b[2]),a[3]=c,a}function bg(b,a){if(1===a)return(255*a<<24)+b;if(0===a)return 0;var c=b>>16&255,d=b>>8&255,e=255&b;return(255*a<<24)+((c=c*a+.5|0)<<16)+((d=d*a+.5|0)<<8)+(e*a+.5|0)}function bK(c,b,a,d){return(a=a||new Float32Array(4))[0]=(c>>16&255)/255,a[1]=(c>>8&255)/255,a[2]=(255&c)/255,(d||void 0===d)&&(a[0]*=b,a[1]*=b,a[2]*=b),a[3]=b,a}function fy(e,a){var d,b,c;if(void 0===a&&(a=null),d=6*e,(a=a||new Uint16Array(d)).length!==d)throw new Error("Out buffer length is incorrect, got "+a.length+" and expected "+d);for(b=0,c=0;b>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,1+(a|=a>>>16)}function bI(a){return!(a&a-1||!a)}function bH(b){var c=(b>65535?1:0)<<4,a=((b>>>=c)>255?1:0)<<3;return c|=a,c|=a=((b>>>=a)>15?1:0)<<2,(c|=a=((b>>>=a)>3?1:0)<<1)|(b>>>=a)>>1}function _(c,d,a){var b,e=c.length,f;if(!(d>=e||0===a)){f=e-(a=d+a>e?e-d:a);for(b=d;b=this.x&&a=this.y&&b=j||Math.max(a.y,e.y,d.y,c.y)<=i||Math.min(a.y,e.y,d.y,c.y)>=h)&&(!(n=o*(e.y-a.y),g=o*(a.x-e.x),p=n*k+g*i,q=n*j+g*i,r=n*k+g*h,s=n*j+g*h,Math.max(p,q,r,s)<=n*a.x+g*a.y||Math.min(p,q,r,s)>=n*c.x+g*c.y)&&(l=o*(a.y-d.y),m=o*(d.x-a.x),t=l*k+m*i,u=l*j+m*i,v=l*k+m*h,w=l*j+m*h,!(Math.max(t,u,v,w)<=l*a.x+m*a.y||Math.min(t,u,v,w)>=l*c.x+m*c.y)))))):!(y=this.xb.right?b.right:this.right)<=y)&&(x=this.yb.bottom?b.bottom:this.bottom)>x)},b.prototype.pad=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this.x-=a,this.y-=b,this.width+=2*a,this.height+=2*b,this},b.prototype.fit=function(a){var b=Math.max(this.x,a.x),d=Math.min(this.x+this.width,a.x+a.width),c=Math.max(this.y,a.y),e=Math.min(this.y+this.height,a.y+a.height);return this.x=b,this.width=Math.max(d-b,0),this.y=c,this.height=Math.max(e-c,0),this},b.prototype.ceil=function(a,b){void 0===a&&(a=1),void 0===b&&(b=.001);var c=Math.ceil((this.x+this.width-b)*a)/a,d=Math.ceil((this.y+this.height-b)*a)/a;return this.x=Math.floor((this.x+b)*a)/a,this.y=Math.floor((this.y+b)*a)/a,this.width=c-this.x,this.height=d-this.y,this},b.prototype.enlarge=function(a){var b=Math.min(this.x,a.x),d=Math.max(this.x+this.width,a.x+a.width),c=Math.min(this.y,a.y),e=Math.max(this.y+this.height,a.y+a.height);return this.x=b,this.width=d-b,this.y=c,this.height=e-c,this},b}(),fd=function(){function b(b,c,d){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=b,this.y=c,this.radius=d,this.type=a.SHAPES.CIRC}return b.prototype.clone=function(){return new b(this.x,this.y,this.radius)},b.prototype.contains=function(c,d){if(this.radius<=0)return!1;var e=this.radius*this.radius,a=this.x-c,b=this.y-d;return(a*=a)+(b*=b)<=e},b.prototype.getBounds=function(){return new d(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},b}(),fa=function(){function b(b,c,d,e){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0),this.x=b,this.y=c,this.width=d,this.height=e,this.type=a.SHAPES.ELIP}return b.prototype.clone=function(){return new b(this.x,this.y,this.width,this.height)},b.prototype.contains=function(c,d){if(this.width<=0||this.height<=0)return!1;var a=(c-this.x)/this.width,b=(d-this.y)/this.height;return(a*=a)+(b*=b)<=1},b.prototype.getBounds=function(){return new d(this.x-this.width,this.y-this.height,this.width,this.height)},b}(),aG=function(){function b(){for(var g=arguments,c=[],d=0,b,f,e,h;db!=h>b&&i<(b-e)/(h-e)*(j-f)+f&&(c=!c);return c},b}(),e_=function(){function b(b,c,d,e,f){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0),void 0===f&&(f=20),this.x=b,this.y=c,this.width=d,this.height=e,this.radius=f,this.type=a.SHAPES.RREC}return b.prototype.clone=function(){return new b(this.x,this.y,this.width,this.height,this.radius)},b.prototype.contains=function(d,e){var a,b,c,f;if(this.width<=0||this.height<=0)return!1;if(d>=this.x&&d<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(a=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2)),e>=this.y+a&&e<=this.y+this.height-a||d>=this.x+a&&d<=this.x+this.width-a)return!0;if(b=d-(this.x+a),c=e-(this.y+a),f=a*a,b*b+c*c<=f)return!0;if((b=d-(this.x+this.width-a))*b+c*c<=f)return!0;if(b*b+(c=e-(this.y+this.height-a))*c<=f)return!0;if((b=d-(this.x+a))*b+c*c<=f)return!0}return!1},b}(),P=function(){function a(c,d,a,b){void 0===a&&(a=0),void 0===b&&(b=0),this._x=a,this._y=b,this.cb=c,this.scope=d}return a.prototype.clone=function(b,c){return void 0===b&&(b=this.cb),void 0===c&&(c=this.scope),new a(b,c,this._x,this._y)},a.prototype.set=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this._x===a&&this._y===b||(this._x=a,this._y=b,this.cb.call(this.scope)),this},a.prototype.copyFrom=function(a){return this._x===a.x&&this._y===a.y||(this._x=a.x,this._y=a.y,this.cb.call(this.scope)),this},a.prototype.copyTo=function(a){return a.set(this._x,this._y),a},a.prototype.equals=function(a){return a.x===this._x&&a.y===this._y},Object.defineProperty(a.prototype,"x",{get:function(){return this._x},set:function(a){this._x!==a&&(this._x=a,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return this._y},set:function(a){this._y!==a&&(this._y=a,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),a}(),m=function(){function a(a,b,c,d,e,f){void 0===a&&(a=1),void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=1),void 0===e&&(e=0),void 0===f&&(f=0),this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=e,this.ty=f}return a.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},a.prototype.set=function(a,b,c,d,e,f){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=e,this.ty=f,this},a.prototype.toArray=function(b,c){this.array||(this.array=new Float32Array(9));var a=c||this.array;return b?(a[0]=this.a,a[1]=this.b,a[2]=0,a[3]=this.c,a[4]=this.d,a[5]=0,a[6]=this.tx,a[7]=this.ty,a[8]=1):(a[0]=this.a,a[1]=this.c,a[2]=this.tx,a[3]=this.b,a[4]=this.d,a[5]=this.ty,a[6]=0,a[7]=0,a[8]=1),a},a.prototype.apply=function(b,a){a=a||new g;var c=b.x,d=b.y;return a.x=this.a*c+this.c*d+this.tx,a.y=this.b*c+this.d*d+this.ty,a},a.prototype.applyInverse=function(c,b){b=b||new g;var a=1/(this.a*this.d+this.c*-this.b),d=c.x,e=c.y;return b.x=this.d*a*d+-this.c*a*e+(this.ty*this.c-this.tx*this.d)*a,b.y=this.a*a*e+-this.b*a*d+(-this.ty*this.a+this.tx*this.b)*a,b},a.prototype.translate=function(a,b){return this.tx+=a,this.ty+=b,this},a.prototype.scale=function(a,b){return this.a*=a,this.d*=b,this.c*=a,this.b*=b,this.tx*=a,this.ty*=b,this},a.prototype.rotate=function(c){var a=Math.cos(c),b=Math.sin(c),d=this.a,e=this.c,f=this.tx;return this.a=d*a-this.b*b,this.b=d*b+this.b*a,this.c=e*a-this.d*b,this.d=e*b+this.d*a,this.tx=f*a-this.ty*b,this.ty=f*b+this.ty*a,this},a.prototype.append=function(a){var b=this.a,c=this.b,d=this.c,e=this.d;return this.a=a.a*b+a.b*d,this.b=a.a*c+a.b*e,this.c=a.c*b+a.d*d,this.d=a.c*c+a.d*e,this.tx=a.tx*b+a.ty*d+this.tx,this.ty=a.tx*c+a.ty*e+this.ty,this},a.prototype.setTransform=function(h,i,c,d,e,f,a,b,g){return this.a=Math.cos(a+g)*e,this.b=Math.sin(a+g)*e,this.c=-Math.sin(a-b)*f,this.d=Math.cos(a-b)*f,this.tx=h-(c*this.a+d*this.c),this.ty=i-(c*this.b+d*this.d),this},a.prototype.prepend=function(a){var b=this.tx,c,d;return(1!==a.a||0!==a.b||0!==a.c||1!==a.d)&&(c=this.a,d=this.c,this.a=c*a.a+this.b*a.c,this.b=c*a.b+this.b*a.d,this.c=d*a.a+this.d*a.c,this.d=d*a.b+this.d*a.d),this.tx=b*a.a+this.ty*a.c+a.tx,this.ty=b*a.b+this.ty*a.d+a.ty,this},a.prototype.decompose=function(a){var b=this.a,c=this.b,d=this.c,e=this.d,f=a.pivot,h=-Math.atan2(-d,e),g=Math.atan2(c,b),i=Math.abs(h+g);return i<1e-5||Math.abs(aA-i)<1e-5?(a.rotation=g,a.skew.x=a.skew.y=0):(a.rotation=0,a.skew.x=h,a.skew.y=g),a.scale.x=Math.sqrt(b*b+c*c),a.scale.y=Math.sqrt(d*d+e*e),a.position.x=this.tx+(f.x*b+f.y*d),a.position.y=this.ty+(f.x*c+f.y*e),a},a.prototype.invert=function(){var b=this.a,c=this.b,d=this.c,e=this.d,f=this.tx,a=b*e-c*d;return this.a=e/a,this.b=-c/a,this.c=-d/a,this.d=b/a,this.tx=(d*this.ty-e*f)/a,this.ty=-(b*this.ty-c*f)/a,this},a.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},a.prototype.clone=function(){var b=new a;return b.a=this.a,b.b=this.b,b.c=this.c,b.d=this.d,b.tx=this.tx,b.ty=this.ty,b},a.prototype.copyTo=function(a){return a.a=this.a,a.b=this.b,a.c=this.c,a.d=this.d,a.tx=this.tx,a.ty=this.ty,a},a.prototype.copyFrom=function(a){return this.a=a.a,this.b=a.b,this.c=a.c,this.d=a.d,this.tx=a.tx,this.ty=a.ty,this},Object.defineProperty(a,"IDENTITY",{get:function(){return new a},enumerable:!1,configurable:!0}),Object.defineProperty(a,"TEMP_MATRIX",{get:function(){return new a},enumerable:!1,configurable:!0}),a}(),M=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],N=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],W=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],R=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],bT=[],eZ=[],aV=Math.sign,!function(){for(var a=0,d,b,f,g,h,i,c,e;a<16;a++){d=[],bT.push(d);for(b=0;b<16;b++)for(f=aV(M[a]*M[b]+W[a]*N[b]),g=aV(N[a]*M[b]+R[a]*N[b]),h=aV(M[a]*W[b]+W[a]*R[b]),i=aV(N[a]*W[b]+R[a]*R[b]),c=0;c<16;c++)if(M[c]===f&&N[c]===g&&W[c]===h&&R[c]===i){d.push(c);break}}for(a=0;a<16;a++)e=new m,e.set(M[a],N[a],W[a],R[a],0,0),eZ.push(e)}(),i={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(a){return M[a]},uY:function(a){return N[a]},vX:function(a){return W[a]},vY:function(a){return R[a]},inv:function(a){return 8&a?15&a:7&-a},add:function(a,b){return bT[a][b]},sub:function(a,b){return bT[a][i.inv(b)]},rotate180:function(a){return 4^a},isVertical:function(a){return 2==(3&a)},byDirection:function(a,b){return 2*Math.abs(a)<=Math.abs(b)?b>=0?i.S:i.N:2*Math.abs(b)<=Math.abs(a)?a>0?i.E:i.W:b>0?a>0?i.SE:i.SW:a>0?i.NE:i.NW},matrixAppendRotationInv:function(d,e,a,b){void 0===a&&(a=0),void 0===b&&(b=0);var c=eZ[i.inv(e)];c.tx=a,c.ty=b,d.append(c)}},bX=function(){function a(){this.worldTransform=new m,this.localTransform=new m,this.position=new P(this.onChange,this,0,0),this.scale=new P(this.onChange,this,1,1),this.pivot=new P(this.onChange,this,0,0),this.skew=new P(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return a.prototype.onChange=function(){this._localID++},a.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},a.prototype.updateLocalTransform=function(){var a=this.localTransform;this._localID!==this._currentLocalID&&(a.a=this._cx*this.scale.x,a.b=this._sx*this.scale.x,a.c=this._cy*this.scale.y,a.d=this._sy*this.scale.y,a.tx=this.position.x-(this.pivot.x*a.a+this.pivot.y*a.c),a.ty=this.position.y-(this.pivot.x*a.b+this.pivot.y*a.d),this._currentLocalID=this._localID,this._parentID=-1)},a.prototype.updateTransform=function(d){var a=this.localTransform,b,c;this._localID!==this._currentLocalID&&(a.a=this._cx*this.scale.x,a.b=this._sx*this.scale.x,a.c=this._cy*this.scale.y,a.d=this._sy*this.scale.y,a.tx=this.position.x-(this.pivot.x*a.a+this.pivot.y*a.c),a.ty=this.position.y-(this.pivot.x*a.b+this.pivot.y*a.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==d._worldID&&(b=d.worldTransform,c=this.worldTransform,c.a=a.a*b.a+a.b*b.c,c.b=a.a*b.b+a.b*b.d,c.c=a.c*b.a+a.d*b.c,c.d=a.c*b.b+a.d*b.d,c.tx=a.tx*b.a+a.ty*b.c+b.tx,c.ty=a.tx*b.b+a.ty*b.d+b.ty,this._parentID=d._worldID,this._worldID++)},a.prototype.setFromMatrix=function(a){a.decompose(this),this._localID++},Object.defineProperty(a.prototype,"rotation",{get:function(){return this._rotation},set:function(a){this._rotation!==a&&(this._rotation=a,this.updateSkew())},enumerable:!1,configurable:!0}),a.IDENTITY=new a,a}(),b.SORTABLE_CHILDREN=!1,aO=function(){function a(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return a.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},a.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},a.prototype.getRectangle=function(a){return this.minX>this.maxX||this.minY>this.maxY?d.EMPTY:((a=a||new d(0,0,1,1)).x=this.minX,a.y=this.minY,a.width=this.maxX-this.minX,a.height=this.maxY-this.minY,a)},a.prototype.addPoint=function(a){this.minX=Math.min(this.minX,a.x),this.maxX=Math.max(this.maxX,a.x),this.minY=Math.min(this.minY,a.y),this.maxY=Math.max(this.maxY,a.y)},a.prototype.addPointMatrix=function(a,b){var i=a.a,j=a.b,e=a.c,f=a.d,g=a.tx,h=a.ty,c=i*b.x+e*b.y+g,d=j*b.x+f*b.y+h;this.minX=Math.min(this.minX,c),this.maxX=Math.max(this.maxX,c),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)},a.prototype.addQuad=function(g){var c=this.minX,d=this.minY,e=this.maxX,f=this.maxY,b=g[0],a=g[1];c=be?b:e,f=a>f?a:f,c=(b=g[2])e?b:e,f=a>f?a:f,c=(b=g[4])e?b:e,f=a>f?a:f,c=(b=g[6])e?b:e,f=a>f?a:f,this.minX=c,this.minY=d,this.maxX=e,this.maxY=f},a.prototype.addFrame=function(a,b,c,d,e){this.addFrameMatrix(a.worldTransform,b,c,d,e)},a.prototype.addFrameMatrix=function(g,p,o,n,m){var l=g.a,i=g.b,h=g.c,q=g.d,j=g.tx,k=g.ty,f=this.minX,e=this.minY,d=this.maxX,c=this.maxY,b=l*p+h*o+j,a=i*p+q*o+k;f=bd?b:d,c=a>c?a:c,f=(b=l*n+h*o+j)d?b:d,c=a>c?a:c,f=(b=l*p+h*m+j)d?b:d,c=a>c?a:c,f=(b=l*n+h*m+j)d?b:d,c=a>c?a:c,this.minX=f,this.minY=e,this.maxX=d,this.maxY=c},a.prototype.addVertexData=function(h,i,j){for(var d=this.minX,e=this.minY,f=this.maxX,a=this.maxY,b=i,c,g;bf?c:f,a=g>a?g:a;this.minX=d,this.minY=e,this.maxX=f,this.maxY=a},a.prototype.addVertices=function(a,b,c,d){this.addVerticesMatrix(a.worldTransform,b,c,d)},a.prototype.addVerticesMatrix=function(a,r,u,t,c,g){var q,p,o,n,s,m,h,f,e,d,b,k,j,i,l;void 0===c&&(c=0),void 0===g&&(g=c);for(q=a.a,p=a.b,o=a.c,n=a.d,s=a.tx,m=a.ty,h=this.minX,f=this.minY,e=this.maxX,d=this.maxY,b=u;bd?a.maxX:d,this.maxY=a.maxY>e?a.maxY:e},a.prototype.addBoundsMask=function(a,b){var c=a.minX>b.minX?a.minX:b.minX,d=a.minY>b.minY?a.minY:b.minY,e=a.maxXi?e:i,this.maxY=f>j?f:j)},a.prototype.addBoundsMatrix=function(a,b){this.addFrameMatrix(b,a.minX,a.minY,a.maxX,a.maxY)},a.prototype.addBoundsArea=function(b,a){var c=b.minX>a.x?b.minX:a.x,d=b.minY>a.y?b.minY:a.y,e=b.maxXi?e:i,this.maxY=f>j?f:j)},a.prototype.pad=function(a,b){void 0===a&&(a=0),void 0===b&&(b=a),this.isEmpty()||(this.minX-=a,this.maxX+=a,this.minY-=b,this.maxY+=b)},a.prototype.addFramePad=function(a,b,c,d,e,f){a-=e,b-=f,c+=e,d+=f,this.minX=this.minXc?this.maxX:c,this.minY=this.minYd?this.maxY:d},a}(),bZ=function(a,b){return bZ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bZ(a,b)};function b_(b,a){function c(){this.constructor=b}bZ(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}k=function(b){function a(){var a=b.call(this)||this;return a.tempDisplayObjectParent=null,a.transform=new bX,a.alpha=1,a.visible=!0,a.renderable=!0,a.cullable=!1,a.cullArea=null,a.parent=null,a.worldAlpha=1,a._lastSortedIndex=0,a._zIndex=0,a.filterArea=null,a.filters=null,a._enabledFilters=null,a._bounds=new aO,a._localBounds=null,a._boundsID=0,a._boundsRect=null,a._localBoundsRect=null,a._mask=null,a._maskRefCount=0,a._destroyed=!1,a.isSprite=!1,a.isMask=!1,a}return b_(a,b),a.mixin=function(c){for(var d=Object.keys(c),b=0,e;b1)for(d=0;dthis.children.length)throw new Error(a+"addChildAt: The index "+b+" supplied is out of bounds "+this.children.length);return a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.splice(b,0,a),this._boundsID++,this.onChildrenChange(b),a.emit("added",this),this.emit("childAdded",a,this,b),a},c.prototype.swapChildren=function(a,b){if(a!==b){var c=this.getChildIndex(a),d=this.getChildIndex(b);this.children[c]=b,this.children[d]=a,this.onChildrenChange(c=this.children.length)throw new Error("The index "+a+" supplied is out of bounds "+this.children.length);var c=this.getChildIndex(b);_(this.children,c,1),this.children.splice(a,0,b),this.onChildrenChange(a)},c.prototype.getChildAt=function(a){if(a<0||a>=this.children.length)throw new Error("getChildAt: Index ("+a+") does not exist.");return this.children[a]},c.prototype.removeChild=function(){for(var f=arguments,a=[],c=0,e,b,d;c1)for(e=0;e0&&c<=e){b=this.children.splice(f,c);for(a=0;a1&&this.children.sort(hq),this.sortDirty=!1},c.prototype.updateTransform=function(){var a,c,b;this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(a=0,c=this.children.length;a0&&d.height>0){if(this.cullArea?(b=this.cullArea,g=this.worldTransform):this._render!==c.prototype._render&&(b=this.getBounds(!0)),b&&d.intersects(b,g))this._render(f);else if(this.cullArea)return;for(e=0,i=this.children.length;e8)throw new Error("max arguments reached");c=this,e=c.name,b=c.items,this._aliasCount++;for(a=0,d=b.length;a0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},a.prototype.add=function(a){return a[this._name]&&(this.ensureNonAliasedItems(),this.remove(a),this.items.push(a)),this},a.prototype.remove=function(b){var a=this.items.indexOf(b);return-1!==a&&(this.ensureNonAliasedItems(),this.items.splice(a,1)),this},a.prototype.contains=function(a){return-1!==this.items.indexOf(a)},a.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},a.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(a.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),a}(),Object.defineProperties(p.prototype,{dispatch:{value:p.prototype.emit},run:{value:p.prototype.emit}}),a.UPDATE_PRIORITY=void 0,b.TARGET_FPMS=.06,function(a){a[a.INTERACTION=50]="INTERACTION",a[a.HIGH=25]="HIGH",a[a.NORMAL=0]="NORMAL",a[a.LOW=-25]="LOW",a[a.UTILITY=-50]="UTILITY"}(a.UPDATE_PRIORITY||(a.UPDATE_PRIORITY={})),ch=function(){function a(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=0),void 0===c&&(c=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=d,this.context=a,this.priority=b,this.once=c}return a.prototype.match=function(b,a){return void 0===a&&(a=null),this.fn===b&&this.context===a},a.prototype.emit=function(a){this.fn&&(this.context?this.fn.call(this.context,a):this.fn(a));var b=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),b},a.prototype.connect=function(a){this.previous=a,a.next&&(a.next.previous=this),this.next=a.next,a.next=this},a.prototype.destroy=function(a){void 0===a&&(a=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var b=this.next;return this.next=a?null:b,this.previous=null,b},a}(),o=function(){function c(){var a=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ch(null,null,1/0),this.deltaMS=1/b.TARGET_FPMS,this.elapsedMS=1/b.TARGET_FPMS,this._tick=function(b){a._requestId=null,a.started&&(a.update(b),a.started&&null===a._requestId&&a._head.next&&(a._requestId=requestAnimationFrame(a._tick)))}}return c.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},c.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},c.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},c.prototype.add=function(c,d,b){return void 0===b&&(b=a.UPDATE_PRIORITY.NORMAL),this._addListener(new ch(c,d,b))},c.prototype.addOnce=function(c,d,b){return void 0===b&&(b=a.UPDATE_PRIORITY.NORMAL),this._addListener(new ch(c,d,b,!0))},c.prototype._addListener=function(b){var a=this._head.next,c=this._head;if(a){for(;a;){if(b.priority>a.priority){b.connect(c);break}c=a,a=a.next}b.previous||b.connect(c)}else b.connect(c);return this._startIfPossible(),this},c.prototype.remove=function(b,c){for(var a=this._head.next;a;)a=a.match(b,c)?a.destroy():a.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(c.prototype,"count",{get:function(){if(!this._head)return 0;for(var a=0,b=this._head;b=b.next;)a++;return a},enumerable:!1,configurable:!0}),c.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},c.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},c.prototype.destroy=function(){if(!this._protected){this.stop();for(var a=this._head.next;a;)a=a.destroy(!0);this._head.destroy(),this._head=null}},c.prototype.update=function(a){var c,e,f,d;if(void 0===a&&(a=performance.now()),a>this.lastTime){if((c=this.elapsedMS=a-this.lastTime)>this._maxElapsedMS&&(c=this._maxElapsedMS),c*=this.speed,this._minElapsedMS){if(e=a-this._lastFrame|0,e=0;--b)if(c=aq[b],c.test&&c.test(a,d))return new c(a,f);throw new Error("Unrecognized source type to auto-detect Resource")}cm=function(a,b){return cm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cm(a,b)};function h(b,a){function c(){this.constructor=b}cm(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}co=function(){return co=Object.assign||function(d){for(var a,e=arguments,b=1,f=arguments.length,c;b0&&g>0,c.textureCacheIds=[],c.destroyed=!1,c.resource=null,c._batchEnabled=0,c._batchLocation=0,c.parentTextureArray=null,c.setResource(f),c}return h(c,d),Object.defineProperty(c.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"mipmap",{get:function(){return this._mipmap},set:function(a){this._mipmap!==a&&(this._mipmap=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(a){this._scaleMode!==a&&(this._scaleMode=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(a){this._wrapMode!==a&&(this._wrapMode=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),c.prototype.setStyle=function(a,b){var c;return void 0!==a&&a!==this.scaleMode&&(this.scaleMode=a,c=!0),void 0!==b&&b!==this.mipmap&&(this.mipmap=b,c=!0),c&&this.dirtyStyleId++,this},c.prototype.setSize=function(b,c,a){return a=a||this.resolution,this.setRealSize(b*a,c*a,a)},c.prototype.setRealSize=function(a,b,c){return this.resolution=c||this.resolution,this.width=Math.round(a)/this.resolution,this.height=Math.round(b)/this.resolution,this._refreshPOT(),this.update(),this},c.prototype._refreshPOT=function(){this.isPowerOfTwo=bI(this.realWidth)&&bI(this.realHeight)},c.prototype.setResolution=function(a){var b=this.resolution;return b===a||(this.resolution=a,this.valid&&(this.width=Math.round(this.width*b)/a,this.height=Math.round(this.height*b)/a,this.emit("update",this)),this._refreshPOT()),this},c.prototype.setResource=function(a){if(this.resource===a)return this;if(this.resource)throw new Error("Resource can be set only once");return a.bind(this),this.resource=a,this},c.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},c.prototype.onError=function(a){this.emit("error",this,a)},c.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete r[this.cacheId],delete q[this.cacheId],this.cacheId=null),this.dispose(),c.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},c.prototype.dispose=function(){this.emit("dispose",this)},c.prototype.castToBaseTexture=function(){return this},c.from=function(d,f,g){var h,a,i,e;if(void 0===g&&(g=b.STRICT_TEXTURE_CACHE),h="string"==typeof d,a=null,h?a=d:(d._pixiId||(i=f&&f.pixiIdPrefix||"pixiid",d._pixiId=i+"_"+I()),a=d._pixiId),e=r[a],h&&g&&!e)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return e||((e=new c(d,f)).cacheId=a,c.addToCache(e,a)),e},c.fromBuffer=function(b,d,e,f){b=b||new Float32Array(d*e*4);var g=new S(b,{width:d,height:e}),h=b instanceof Float32Array?a.TYPES.FLOAT:a.TYPES.UNSIGNED_BYTE;return new c(g,Object.assign({},hs,f||{width:d,height:e,type:h}))},c.addToCache=function(b,a){a&&(-1===b.textureCacheIds.indexOf(a)&&b.textureCacheIds.push(a),r[a]&&console.warn("BaseTexture added to the cache with an id ["+a+"] that already had an entry"),r[a]=b)},c.removeFromCache=function(a){var b,d,c;if("string"==typeof a){if(b=r[a],b)return d=b.textureCacheIds.indexOf(a),d>-1&&b.textureCacheIds.splice(d,1),delete r[a],b}else if(a&&a.textureCacheIds){for(c=0;c0){if(!b.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(b.resource,c)}else b.target=a.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.parentTextureArray=this.baseTexture,this.items[c]=b;return b.valid&&!this.valid&&this.resize(b.realWidth,b.realHeight),this.items[c]=b,this},b.prototype.upload=function(g,d,e){for(var f=this.itemDirtyIds,a=0,c;a)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,a}(z),cA=function(b){function a(d,e){var c=this,f,n,g,h,l,i,j,k,m;if(e=e||{},!(d instanceof HTMLVideoElement)){f=document.createElement("video"),f.setAttribute("preload","auto"),f.setAttribute("webkit-playsinline",""),f.setAttribute("playsinline",""),"string"==typeof d&&(d=[d]),n=d[0].src||d[0],z.crossOrigin(f,n,e.crossorigin);for(g=0;g2},a.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(o.shared.add(this.update,this),this._isConnectedToTicker=!0)},a.prototype._onPlayStop=function(){this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1)},a.prototype._onCanPlay=function(){var a=this.source,b;a.removeEventListener("canplay",this._onCanPlay),a.removeEventListener("canplaythrough",this._onCanPlay),b=this.valid,this.resize(a.videoWidth,a.videoHeight),!b&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&a.play()},a.prototype.dispose=function(){this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1);var a=this.source;a&&(a.removeEventListener("error",this._onError,!0),a.pause(),a.src="",a.load()),b.prototype.dispose.call(this)},Object.defineProperty(a.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(a){a!==this._autoUpdate&&(this._autoUpdate=a,!this._autoUpdate&&this._isConnectedToTicker?(o.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(o.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(a){a!==this._updateFPS&&(this._updateFPS=a)},enumerable:!1,configurable:!0}),a.test=function(b,c){return globalThis.HTMLVideoElement&&b instanceof HTMLVideoElement||a.TYPES.indexOf(c)>-1},a.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],a.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},a}(z),cB=function(b){function a(a){return b.call(this,a)||this}return h(a,b),a.test=function(a){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&a instanceof ImageBitmap},a}(z),aq.push(bc,cB,cw,cA,cz,S,cx,cu),eN={__proto__:null,Resource:Z,BaseImageResource:z,INSTALLED:aq,autoDetectResource:bB,AbstractMultiResource:bm,ArrayResource:cu,BufferResource:S,CanvasResource:cw,CubeResource:cx,ImageResource:bc,SVGResource:cz,VideoResource:cA,ImageBitmapResource:cB},hw=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return h(c,b),c.prototype.upload=function(g,b,c){var d=g.gl,e,f;return d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.alphaMode===a.ALPHA_MODES.UNPACK),e=b.realWidth,f=b.realHeight,c.width===e&&c.height===f?d.texSubImage2D(b.target,0,0,0,e,f,b.format,c.type,this.data):(c.width=e,c.height=f,d.texImage2D(b.target,0,c.internalFormat,e,f,0,b.format,c.type,this.data)),!0},c}(S),a_=function(){function b(b,c){this.width=Math.round(b||100),this.height=Math.round(c||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new p("disposeFramebuffer"),this.multisample=a.MSAA_QUALITY.NONE}return Object.defineProperty(b.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),b.prototype.addColorTexture=function(b,c){return void 0===b&&(b=0),this.colorTextures[b]=c||new e(null,{scaleMode:a.SCALE_MODES.NEAREST,resolution:1,mipmap:a.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},b.prototype.addDepthTexture=function(b){return this.depthTexture=b||new e(new hw(null,{width:this.width,height:this.height}),{scaleMode:a.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:a.MIPMAP_MODES.OFF,format:a.FORMATS.DEPTH_COMPONENT,type:a.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},b.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},b.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},b.prototype.resize=function(a,b){var d,e,c;if(a=Math.round(a),b=Math.round(b),a!==this.width||b!==this.height){this.width=a,this.height=b,this.dirtyId++,this.dirtySize++;for(d=0;d-1&&b.textureCacheIds.splice(d,1),delete q[a],b}else if(a&&a.textureCacheIds){for(c=0;cthis.baseTexture.width,g=e+c>this.baseTexture.height,f||g)throw h=f&&g?"and":"or",i="X: "+d+" + "+b+" = "+(d+b)+" > "+this.baseTexture.width,j="Y: "+e+" + "+c+" = "+(e+c)+" > "+this.baseTexture.height,new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+i+" "+h+" "+j);this.valid=b&&c&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=a),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rotate",{get:function(){return this._rotate},set:function(a){this._rotate=a,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),a.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(a,"EMPTY",{get:function(){return a._EMPTY||(a._EMPTY=new a(new e),aP(a._EMPTY),aP(a._EMPTY.baseTexture)),a._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(a,"WHITE",{get:function(){if(!a._WHITE){var c=b.ADAPTER.createCanvas(16,16),d=c.getContext("2d");c.width=16,c.height=16,d.fillStyle="white",d.fillRect(0,0,16,16),a._WHITE=new a(e.from(c)),aP(a._WHITE),aP(a._WHITE.baseTexture)}return a._WHITE},enumerable:!1,configurable:!0}),a}(af),G=function(b){function a(c,d){var a=b.call(this,c,d)||this;return a.valid=!0,a.filterFrame=null,a.filterPoolKey=null,a.updateUvs(),a}return h(a,b),Object.defineProperty(a.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(a){this.framebuffer.multisample=a},enumerable:!1,configurable:!0}),a.prototype.resize=function(e,f,b){void 0===b&&(b=!0);var a=this.baseTexture.resolution,c=Math.round(e*a)/a,d=Math.round(f*a)/a;this.valid=c>0&&d>0,this._frame.width=this.orig.width=c,this._frame.height=this.orig.height=d,b&&this.baseTexture.resize(c,d),this.updateUvs()},a.prototype.setResolution=function(b){var a=this.baseTexture;a.resolution!==b&&(a.setResolution(b),this.resize(a.width,a.height,!1))},a.create=function(b){for(var e=arguments,c=[],d=1;d1?-b:-1:(c=((65535&(d=aK(d)))<<16|65535&(e=aK(e)))>>>0,b>1&&(c+=4294967296*b)),this.texturePool[c]||(this.texturePool[c]=[]),g=this.texturePool[c].pop(),g||(g=this.createTexture(d,e,b)),g.filterPoolKey=c,g.setResolution(f),g},b.prototype.getFilterTexture=function(b,d,e){var c=this.getOptimalTexture(b.width,b.height,d||b.resolution,e||a.MSAA_QUALITY.NONE);return c.filterFrame=b.filterFrame,c},b.prototype.returnTexture=function(a){var b=a.filterPoolKey;a.filterFrame=null,this.texturePool[b].push(a)},b.prototype.returnFilterTexture=function(a){this.returnTexture(a)},b.prototype.clear=function(c){var d,a,b;if(c=!1!==c)for(d in this.texturePool)if(a=this.texturePool[d],a)for(b=0;b0&&a.height>0,this.texturePool)if(Number(b)<0){if(c=this.texturePool[b],c)for(d=0;d1){for(g=0;g1&&((h=this.getOptimalFilterTexture(c.width,c.height,b.resolution)).filterFrame=c.filterFrame),i[g].apply(this,c,h,a.CLEAR_MODES.CLEAR,b),n=c,c=h,h=n;i[g].apply(this,c,m.renderTexture,a.CLEAR_MODES.BLEND,b),g>1&&b.multisample>1&&this.returnFilterTexture(b.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}b.clear(),this.statePool.push(b)},b.prototype.bindAndClear=function(b,d){var e,f,g,c,h;void 0===d&&(d=a.CLEAR_MODES.CLEAR),e=this.renderer,f=e.renderTexture,g=e.state,(b===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,b&&b.filterFrame)?(c=this.tempRect,c.x=0,c.y=0,c.width=b.filterFrame.width,c.height=b.filterFrame.height,f.bind(b,b.filterFrame,c)):b!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?f.bind(b):this.renderer.renderTexture.bind(b,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame),h=1&g.stateId||this.forceClear,(d===a.CLEAR_MODES.CLEAR||d===a.CLEAR_MODES.BLIT&&h)&&this.renderer.framebuffer.clear(0,0,0,0)},b.prototype.applyFilter=function(b,d,e,f){var c=this.renderer;c.state.set(b.state),this.bindAndClear(e,f),b.uniforms.uSampler=d,b.uniforms.filterGlobals=this.globalUniforms,c.shader.bind(b),b.legacy=!!b.program.attributeData.aTextureCoord,b.legacy?(this.quadUv.map(d._frame,d.filterFrame),c.geometry.bind(this.quadUv),c.geometry.draw(a.DRAW_MODES.TRIANGLES)):(c.geometry.bind(this.quad),c.geometry.draw(a.DRAW_MODES.TRIANGLE_STRIP))},b.prototype.calculateSpriteMatrix=function(h,b){var c=this.activeState,d=c.sourceFrame,e=c.destinationFrame,f=b._texture.orig,a=h.set(e.width,0,0,e.height,d.x,d.y),g=b.worldTransform.copyTo(m.TEMP_MATRIX);return g.invert(),a.prepend(g),a.scale(1/f.width,1/f.height),a.translate(b.anchor.x,b.anchor.y),a},b.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},b.prototype.getOptimalFilterTexture=function(d,e,b,c){return void 0===b&&(b=1),void 0===c&&(c=a.MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(d,e,b,c)},b.prototype.getFilterTexture=function(b,c,f){var e,d;return"number"==typeof b&&(e=b,b=c,c=e),b=b||this.activeState.renderTexture,d=this.texturePool.getOptimalTexture(b.width,b.height,c||b.resolution,f||a.MSAA_QUALITY.NONE),d.filterFrame=b.filterFrame,d},b.prototype.returnFilterTexture=function(a){this.texturePool.returnTexture(a)},b.prototype.emptyPool=function(){this.texturePool.clear(!0)},b.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},b.prototype.transformAABB=function(f,a){var b=bi[0],c=bi[1],d=bi[2],e=bi[3],g,h,i,j;b.set(a.left,a.top),c.set(a.left,a.bottom),d.set(a.right,a.top),e.set(a.right,a.bottom),f.apply(b,b),f.apply(c,c),f.apply(d,d),f.apply(e,e),g=Math.min(b.x,c.x,d.x,e.x),h=Math.min(b.y,c.y,d.y,e.y),i=Math.max(b.x,c.x,d.x,e.x),j=Math.max(b.y,c.y,d.y,e.y),a.x=g,a.y=h,a.width=i-g,a.height=j-h},b.prototype.roundFrame=function(c,e,b,d,a){if(!(c.width<=0||c.height<=0||b.width<=0||b.height<=0)){if(a){var f=a.a,g=a.b,h=a.c,i=a.d;if((Math.abs(g)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(f)>1e-4||Math.abs(i)>1e-4))return}(a=a?dD.copyFrom(a):dD.identity()).translate(-b.x,-b.y).scale(d.width/b.width,d.height/b.height).translate(d.x,d.y),this.transformAABB(a,c),c.ceil(e),this.transformAABB(a.invert(),c)}},b}(),aF=function(){function a(a){this.renderer=a}return a.prototype.flush=function(){},a.prototype.destroy=function(){this.renderer=null},a.prototype.start=function(){},a.prototype.stop=function(){this.flush()},a.prototype.render=function(a){},a}(),db=function(){function a(a){this.renderer=a,this.emptyRenderer=new aF(a),this.currentRenderer=this.emptyRenderer}return a.prototype.setObjectRenderer=function(a){this.currentRenderer!==a&&(this.currentRenderer.stop(),this.currentRenderer=a,this.currentRenderer.start())},a.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},a.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},a.prototype.copyBoundTextures=function(b,c){for(var d=this.renderer.texture.boundTextures,a=c-1;a>=0;--a)b[a]=d[a]||null,b[a]&&(b[a]._batchLocation=a)},a.prototype.boundArray=function(e,g,k,h){for(var l=e.elements,i=e.ids,j=e.count,a=0,b=0,c,d,f;b=0&&d=a.ENV.WEBGL2&&(c=d.getContext("webgl2",e)),c)this.webGLVersion=2;else if(this.webGLVersion=1,!(c=d.getContext("webgl",e)||d.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=c,this.getExtensions(),this.gl},c.prototype.getExtensions=function(){var a=this.gl,b={anisotropicFiltering:a.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:a.getExtension("OES_texture_float_linear"),s3tc:a.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:a.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:a.getExtension("WEBGL_compressed_texture_etc"),etc1:a.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:a.getExtension("WEBGL_compressed_texture_atc"),astc:a.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,b,{drawBuffers:a.getExtension("WEBGL_draw_buffers"),depthTexture:a.getExtension("WEBGL_depth_texture"),loseContext:a.getExtension("WEBGL_lose_context"),vertexArrayObject:a.getExtension("OES_vertex_array_object")||a.getExtension("MOZ_OES_vertex_array_object")||a.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:a.getExtension("OES_element_index_uint"),floatTexture:a.getExtension("OES_texture_float"),floatTextureLinear:a.getExtension("OES_texture_float_linear"),textureHalfFloat:a.getExtension("OES_texture_half_float"),textureHalfFloatLinear:a.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,b,{colorBufferFloat:a.getExtension("EXT_color_buffer_float")})},c.prototype.handleContextLost=function(a){a.preventDefault()},c.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},c.prototype.destroy=function(){var a=this.renderer.view;this.renderer=null,a.removeEventListener("webglcontextlost",this.handleContextLost),a.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},c.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},c.prototype.validateContext=function(a){var b=a.getContextAttributes(),c="WebGL2RenderingContext"in globalThis&&a instanceof globalThis.WebGL2RenderingContext,d;c&&(this.webGLVersion=2),b&&!b.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly"),d=c||!!a.getExtension("OES_element_index_uint"),this.supports.uint32Indices=d,d||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},c}(),ei=function(b){this.framebuffer=b,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=a.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},ih=new d,dg=function(){function c(a){this.renderer=a,this.managedFramebuffers=[],this.unknownFramebuffer=new a_(10,10),this.msaaSamples=null}return c.prototype.contextChange=function(){var c=this.gl=this.renderer.gl,e,f;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new d,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion?(e=this.renderer.context.extensions.drawBuffers,f=this.renderer.context.extensions.depthTexture,b.PREFER_ENV===a.ENV.WEBGL_LEGACY&&(e=null,f=null),e?c.drawBuffers=function(a){return e.drawBuffersWEBGL(a)}:(this.hasMRT=!1,c.drawBuffers=function(){}),f||(this.writeDepthTexture=!1)):this.msaaSamples=c.getInternalformatParameter(c.RENDERBUFFER,c.RGBA8,c.SAMPLES)},c.prototype.bind=function(a,b,d){var e,c,g,i,f,h,j;if(void 0===d&&(d=0),e=this.gl,a){c=a.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(a),this.current!==a&&(this.current=a,e.bindFramebuffer(e.FRAMEBUFFER,c.framebuffer)),c.mipLevel!==d&&(a.dirtyId++,a.dirtyFormat++,c.mipLevel=d),c.dirtyId!==a.dirtyId&&(c.dirtyId=a.dirtyId,c.dirtyFormat!==a.dirtyFormat?(c.dirtyFormat=a.dirtyFormat,c.dirtySize=a.dirtySize,this.updateFramebuffer(a,d)):c.dirtySize!==a.dirtySize&&(c.dirtySize=a.dirtySize,this.resizeFramebuffer(a)));for(g=0;g>d,h=b.height>>d,j=f/b.width,this.setViewport(b.x*j,b.y*j,f,h)):(f=a.width>>d,h=a.height>>d,this.setViewport(0,0,f,h))}else this.current&&(this.current=null,e.bindFramebuffer(e.FRAMEBUFFER,null)),b?this.setViewport(b.x,b.y,b.width,b.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},c.prototype.setViewport=function(b,c,d,e){var a=this.viewport;b=Math.round(b),c=Math.round(c),d=Math.round(d),e=Math.round(e),a.width===d&&a.height===e&&a.x===b&&a.y===c||(a.x=b,a.y=c,a.width=d,a.height=e,this.gl.viewport(b,c,d,e))},Object.defineProperty(c.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),c.prototype.clear=function(d,e,f,g,b){void 0===b&&(b=a.BUFFER_BITS.COLOR|a.BUFFER_BITS.DEPTH);var c=this.gl;c.clearColor(d,e,f,g),c.clear(b)},c.prototype.initFramebuffer=function(a){var c=this.gl,b=new ei(c.createFramebuffer());return b.multisample=this.detectSamples(a.multisample),a.glFramebuffers[this.CONTEXT_UID]=b,this.managedFramebuffers.push(a),a.disposeRunner.add(this),b},c.prototype.resizeFramebuffer=function(b){var a=this.gl,c=b.glFramebuffers[this.CONTEXT_UID],f,d,e,g,h;c.msaaBuffer&&(a.bindRenderbuffer(a.RENDERBUFFER,c.msaaBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,c.multisample,a.RGBA8,b.width,b.height)),c.stencil&&(a.bindRenderbuffer(a.RENDERBUFFER,c.stencil),c.msaaBuffer?a.renderbufferStorageMultisample(a.RENDERBUFFER,c.multisample,a.DEPTH24_STENCIL8,b.width,b.height):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,b.width,b.height)),f=b.colorTextures,d=f.length,a.drawBuffers||(d=Math.min(d,1));for(e=0;e1&&this.canMultisampleFramebuffer(c)?(b.msaaBuffer=b.msaaBuffer||a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,b.msaaBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,b.multisample,a.RGBA8,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,b.msaaBuffer)):b.msaaBuffer&&(a.deleteRenderbuffer(b.msaaBuffer),b.msaaBuffer=null,b.blitFramebuffer&&(b.blitFramebuffer.dispose(),b.blitFramebuffer=null));for(f=[],d=0;d1&&a.drawBuffers(f),c.depthTexture&&this.writeDepthTexture&&(k=c.depthTexture,this.renderer.texture.bind(k,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,k._glTextures[this.CONTEXT_UID].texture,i)),!c.stencil&&!c.depth||c.depthTexture&&this.writeDepthTexture?b.stencil&&(a.deleteRenderbuffer(b.stencil),b.stencil=null):(b.stencil=b.stencil||a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,b.stencil),b.msaaBuffer?a.renderbufferStorageMultisample(a.RENDERBUFFER,b.multisample,a.DEPTH24_STENCIL8,c.width,c.height):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,b.stencil))},c.prototype.canMultisampleFramebuffer=function(a){return 1!==this.renderer.context.webGLVersion&&a.colorTextures.length<=1&&!a.depthTexture},c.prototype.detectSamples=function(e){var c=this.msaaSamples,b=a.MSAA_QUALITY.NONE,d;if(e<=1||null===c)return b;for(d=0;d=0&&this.managedFramebuffers.splice(d,1),b.disposeRunner.remove(this),e||(c.deleteFramebuffer(a.framebuffer),a.msaaBuffer&&c.deleteRenderbuffer(a.msaaBuffer),a.stencil&&c.deleteRenderbuffer(a.stencil)),a.blitFramebuffer&&a.blitFramebuffer.dispose())},c.prototype.disposeAll=function(c){var b=this.managedFramebuffers,a;this.managedFramebuffers=[];for(a=0;a=a.ENV.WEBGL2&&(c=d.getContext("webgl2",{})),c||((c=d.getContext("webgl",{})||d.getContext("experimental-webgl",{}))?c.getExtension("WEBGL_draw_buffers"):c=null),aC=c}return aC}function dT(b,c,d){if("precision"!==b.substring(0,9)){var e=c;return c===a.PRECISION.HIGH&&d!==a.PRECISION.HIGH&&(e=a.PRECISION.MEDIUM),"precision "+e+" float;\n"+b}return d!==a.PRECISION.HIGH&&"precision highp"===b.substring(0,15)?b.replace("precision highp","precision mediump"):b}hX={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function dN(a){return hX[a]}bv=null,dL={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function dK(d,e){var b,a,c;if(!bv){b=Object.keys(dL),bv={};for(a=0;a0&&(b+="\nelse "),a0?this.maskStack[this.maskStack.length-1]._colorMask:15;a!==c&&this.renderer.gl.colorMask(0!=(1&a),0!=(2&a),0!=(4&a),0!=(8&a))},b.prototype.destroy=function(){this.renderer=null},b}(),dQ=function(){function a(a){this.renderer=a,this.maskStack=[],this.glConst=0}return a.prototype.getStackLength=function(){return this.maskStack.length},a.prototype.setMaskStack=function(c){var a=this.renderer.gl,d=this.getStackLength(),b;this.maskStack=c,b=this.getStackLength(),b!==d&&(0===b?a.disable(this.glConst):(a.enable(this.glConst),this._useCurrent()))},a.prototype._useCurrent=function(){},a.prototype.destroy=function(){this.renderer=null,this.maskStack=null},a}(),dR=new m,dS=[],dt=function(c){function a(d){var a=c.call(this,d)||this;return a.glConst=b.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,a}return h(a,c),a.prototype.getStackLength=function(){var a=this.maskStack[this.maskStack.length-1];return a?a._scissorCounter:0},a.prototype.calcScissorRect=function(a){var c,g,h,e,b,f;a._scissorRectLocal||(g=a._scissorRect,h=a.maskObject,e=this.renderer,b=e.renderTexture,f=h.getBounds(!0,null!==(c=dS.pop())&&void 0!==c?c:new d),this.roundFrameToPixels(f,b.current?b.current.resolution:e.resolution,b.sourceFrame,b.destinationFrame,e.projection.transform),g&&f.fit(g),a._scissorRectLocal=f)},a.isMatrixRotated=function(a){if(!a)return!1;var b=a.a,c=a.b,d=a.c,e=a.d;return(Math.abs(c)>1e-4||Math.abs(d)>1e-4)&&(Math.abs(b)>1e-4||Math.abs(e)>1e-4)},a.prototype.testScissor=function(b){var c=b.maskObject,d;return!(!c.isFastRect||!c.isFastRect())&&(!a.isMatrixRotated(c.worldTransform)&&(!a.isMatrixRotated(this.renderer.projection.transform)&&(this.calcScissorRect(b),d=b._scissorRectLocal,d.width>0&&d.height>0)))},a.prototype.roundFrameToPixels=function(b,e,f,c,d){a.isMatrixRotated(d)||((d=d?dR.copyFrom(d):dR.identity()).translate(-f.x,-f.y).scale(c.width/f.width,c.height/f.height).translate(c.x,c.y),this.renderer.filter.transformAABB(d,b),b.fit(c),b.x=Math.round(b.x*e),b.y=Math.round(b.y*e),b.width=Math.round(b.width*e),b.height=Math.round(b.height*e))},a.prototype.push=function(a){a._scissorRectLocal||this.calcScissorRect(a);var b=this.renderer.gl;a._scissorRect||b.enable(b.SCISSOR_TEST),a._scissorCounter++,a._scissorRect=a._scissorRectLocal,this._useCurrent()},a.prototype.pop=function(a){var b=this.renderer.gl;a&&dS.push(a._scissorRectLocal),this.getStackLength()>0?this._useCurrent():b.disable(b.SCISSOR_TEST)},a.prototype._useCurrent=function(){var b,a=this.maskStack[this.maskStack.length-1]._scissorRect;b=this.renderer.renderTexture.current?a.y:this.renderer.height-a.height-a.y,this.renderer.gl.scissor(a.x,b,a.width,a.height)},a}(dQ),ds=function(c){function a(d){var a=c.call(this,d)||this;return a.glConst=b.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,a}return h(a,c),a.prototype.getStackLength=function(){var a=this.maskStack[this.maskStack.length-1];return a?a._stencilCounter:0},a.prototype.push=function(c){var d=c.maskObject,a=this.renderer.gl,e=c._stencilCounter,b;0===e&&(this.renderer.framebuffer.forceStencil(),a.clearStencil(0),a.clear(a.STENCIL_BUFFER_BIT),a.enable(a.STENCIL_TEST)),c._stencilCounter++,b=c._colorMask,0!==b&&(c._colorMask=0,a.colorMask(!1,!1,!1,!1)),a.stencilFunc(a.EQUAL,e,4294967295),a.stencilOp(a.KEEP,a.KEEP,a.INCR),d.renderable=!0,d.render(this.renderer),this.renderer.batch.flush(),d.renderable=!1,0!==b&&(c._colorMask=b,a.colorMask(0!=(1&b),0!=(2&b),0!=(4&b),0!=(8&b))),this._useCurrent()},a.prototype.pop=function(d){var a=this.renderer.gl,c,b;0===this.getStackLength()?a.disable(a.STENCIL_TEST):(c=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,b=c?c._colorMask:15,0!==b&&(c._colorMask=0,a.colorMask(!1,!1,!1,!1)),a.stencilOp(a.KEEP,a.KEEP,a.DECR),d.renderable=!0,d.render(this.renderer),this.renderer.batch.flush(),d.renderable=!1,0!==b&&(c._colorMask=b,a.colorMask(0!=(1&b),0!=(2&b),0!=(4&b),0!=(8&b))),this._useCurrent())},a.prototype._useCurrent=function(){var a=this.renderer.gl;a.stencilFunc(a.EQUAL,this.getStackLength(),4294967295),a.stencilOp(a.KEEP,a.KEEP,a.KEEP)},a}(dQ),dq=function(){function a(a){this.renderer=a,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new m,this.transform=null}return a.prototype.update=function(b,c,d,e){this.destinationFrame=b||this.destinationFrame||this.defaultFrame,this.sourceFrame=c||this.sourceFrame||b,this.calculateProjection(this.destinationFrame,this.sourceFrame,d,e),this.transform&&this.projectionMatrix.append(this.transform);var a=this.renderer;a.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,a.globalUniforms.update(),a.shader.shader&&a.shader.syncUniformGroup(a.shader.shader.uniforms.globals)},a.prototype.calculateProjection=function(e,b,f,d){var a=this.projectionMatrix,c=d?-1:1;a.identity(),a.a=1/b.width*2,a.d=c*(1/b.height*2),a.tx=-1-b.x*a.a,a.ty=-c-b.y*a.d},a.prototype.setTransform=function(a){},a.prototype.destroy=function(){this.renderer=null},a}(),$=new d,aE=new d,dk=function(){function a(a){this.renderer=a,this.clearColor=a._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new d,this.destinationFrame=new d,this.viewportFrame=new d}return a.prototype.bind=function(a,c,b){var g,h,e,f,d;void 0===a&&(a=null),f=this.renderer,this.current=a,a?(e=(g=a.baseTexture).resolution,c||($.width=a.frame.width,$.height=a.frame.height,c=$),b||(aE.x=a.frame.x,aE.y=a.frame.y,aE.width=c.width,aE.height=c.height,b=aE),h=g.framebuffer):(e=f.resolution,c||($.width=f.screen.width,$.height=f.screen.height,c=$),b||((b=$).width=c.width,b.height=c.height)),d=this.viewportFrame,d.x=b.x*e,d.y=b.y*e,d.width=b.width*e,d.height=b.height*e,a||(d.y=f.view.height-(d.y+d.height)),d.ceil(),this.renderer.framebuffer.bind(h,d),this.renderer.projection.update(b,c,e,!h),a?this.renderer.mask.setMaskStack(g.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(c),this.destinationFrame.copyFrom(b)},a.prototype.clear=function(a,j){var h,i,g,b,f,c,d,e;a=this.current?a||this.current.baseTexture.clearColor:a||this.clearColor,h=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,g=h.width!==i.width||h.height!==i.height,g&&(b=this.viewportFrame,f=b.x,c=b.y,d=b.width,e=b.height,f=Math.round(f),c=Math.round(c),d=Math.round(d),e=Math.round(e),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(f,c,d,e)),this.renderer.framebuffer.clear(a[0],a[1],a[2],a[3],j),g&&this.renderer.scissor.pop()},a.prototype.resize=function(){this.bind(null)},a.prototype.reset=function(){this.bind(null)},a.prototype.destroy=function(){this.renderer=null},a}();function hW(c,d,a,e,b){a.buffer.update(b)}hU={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},d$={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function ea(h){for(var e=h.map(function(a){return{data:a,offset:0,dataLen:0,dirty:0}}),a=0,c=0,b=0,f=0,d,g;f1&&(a=Math.max(a,16)*d.data.size),d.dataLen=a,c%a!=0&&c<16)&&(g=c%a%16,c+=g,b+=g),c+a>16?(b=16*Math.ceil(b/16),d.offset=b,b+=a,c=a):(d.offset=b,c+=a,b+=a);return{uboElements:e,size:b=16*Math.ceil(b/16)}}function eb(d,b){var a=[],c;for(c in d)b[c]&&a.push(b[c]);return a.sort(function(a,b){return a.index-b.index}),a}function ec(m,r){var f,k,o,b,e,a,j,c,l,d,h,n,g,i,p,q;if(!m.autoManage)return{size:0,syncFunc:hW};for(f=ea(eb(m.uniforms,r)),k=f.uboElements,o=f.size,b=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],e=0;e1?(n=dN(a.data.type),g=Math.max(d$[a.data.type]/16,1),i=n/g,p=(4-i%4)%4,b.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*g+"; i++)\n {\n for(var j = 0; j < "+i+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+p+";\n }\n\n ")):(q=hU[a.data.type],b.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+a.offset/4+";\n "+q+";\n ")))}return b.push("\n renderer.buffer.update(buffer);\n "),{size:o,syncFunc:new Function("ud","uv","renderer","syncData","buffer",b.join("\n"))}}ed=function(){function a(a,b){this.program=a,this.uniformData=b,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return a.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},a}();function ee(a,d){var f=dY(a,a.VERTEX_SHADER,d.vertexSrc),g=dY(a,a.FRAGMENT_SHADER,d.fragmentSrc),b=a.createProgram(),e,c,h,i;if(a.attachShader(b,f),a.attachShader(b,g),a.linkProgram(b),a.getProgramParameter(b,a.LINK_STATUS)||function(a,b,c,d){a.getProgramParameter(b,a.LINK_STATUS)||(a.getShaderParameter(c,a.COMPILE_STATUS)||dX(a,c),a.getShaderParameter(d,a.COMPILE_STATUS)||dX(a,d),console.error("PixiJS Error: Could not initialize shader."),""!==a.getProgramInfoLog(b)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",a.getProgramInfoLog(b)))}(a,b,f,g),d.attributeData=function(c,a){for(var e={},g=a.getProgramParameter(c,a.ACTIVE_ATTRIBUTES),d=0,b,f,h;db?1:-1});for(c=0;c>=1,b++;this.stateId=a.data}for(b=0;bthis.checkCountMax&&(this.checkCount=0,this.run())))},c.prototype.run=function(){for(var d=this.renderer.texture,b=d.managedTextures,e=!1,a=0,c,f;athis.maxIdle&&(d.destroyTexture(c,!0),b[a]=null,e=!0);if(e){f=0;for(a=0;a=0;c--)this.unload(a.children[c])},c.prototype.destroy=function(){this.renderer=null},c}(),be=function(b){this.texture=b,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=a.TYPES.UNSIGNED_BYTE,this.internalFormat=a.FORMATS.RGBA,this.samplerType=0},cW=function(){function b(a){this.renderer=a,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new e,this.hasIntegerTextures=!1}return b.prototype.contextChange=function(){var b=this.gl=this.renderer.gl,d,c,e;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(b){var c,d,e,f,l,i,j,h,k,u,t,y,n,p,q,r,s,m,g,v,w,x,o;return"WebGL2RenderingContext"in globalThis&&b instanceof globalThis.WebGL2RenderingContext?((c={})[a.TYPES.UNSIGNED_BYTE]=((d={})[a.FORMATS.RGBA]=b.RGBA8,d[a.FORMATS.RGB]=b.RGB8,d[a.FORMATS.RG]=b.RG8,d[a.FORMATS.RED]=b.R8,d[a.FORMATS.RGBA_INTEGER]=b.RGBA8UI,d[a.FORMATS.RGB_INTEGER]=b.RGB8UI,d[a.FORMATS.RG_INTEGER]=b.RG8UI,d[a.FORMATS.RED_INTEGER]=b.R8UI,d[a.FORMATS.ALPHA]=b.ALPHA,d[a.FORMATS.LUMINANCE]=b.LUMINANCE,d[a.FORMATS.LUMINANCE_ALPHA]=b.LUMINANCE_ALPHA,d),c[a.TYPES.BYTE]=((e={})[a.FORMATS.RGBA]=b.RGBA8_SNORM,e[a.FORMATS.RGB]=b.RGB8_SNORM,e[a.FORMATS.RG]=b.RG8_SNORM,e[a.FORMATS.RED]=b.R8_SNORM,e[a.FORMATS.RGBA_INTEGER]=b.RGBA8I,e[a.FORMATS.RGB_INTEGER]=b.RGB8I,e[a.FORMATS.RG_INTEGER]=b.RG8I,e[a.FORMATS.RED_INTEGER]=b.R8I,e),c[a.TYPES.UNSIGNED_SHORT]=((f={})[a.FORMATS.RGBA_INTEGER]=b.RGBA16UI,f[a.FORMATS.RGB_INTEGER]=b.RGB16UI,f[a.FORMATS.RG_INTEGER]=b.RG16UI,f[a.FORMATS.RED_INTEGER]=b.R16UI,f[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT16,f),c[a.TYPES.SHORT]=((l={})[a.FORMATS.RGBA_INTEGER]=b.RGBA16I,l[a.FORMATS.RGB_INTEGER]=b.RGB16I,l[a.FORMATS.RG_INTEGER]=b.RG16I,l[a.FORMATS.RED_INTEGER]=b.R16I,l),c[a.TYPES.UNSIGNED_INT]=((i={})[a.FORMATS.RGBA_INTEGER]=b.RGBA32UI,i[a.FORMATS.RGB_INTEGER]=b.RGB32UI,i[a.FORMATS.RG_INTEGER]=b.RG32UI,i[a.FORMATS.RED_INTEGER]=b.R32UI,i[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT24,i),c[a.TYPES.INT]=((j={})[a.FORMATS.RGBA_INTEGER]=b.RGBA32I,j[a.FORMATS.RGB_INTEGER]=b.RGB32I,j[a.FORMATS.RG_INTEGER]=b.RG32I,j[a.FORMATS.RED_INTEGER]=b.R32I,j),c[a.TYPES.FLOAT]=((h={})[a.FORMATS.RGBA]=b.RGBA32F,h[a.FORMATS.RGB]=b.RGB32F,h[a.FORMATS.RG]=b.RG32F,h[a.FORMATS.RED]=b.R32F,h[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT32F,h),c[a.TYPES.HALF_FLOAT]=((k={})[a.FORMATS.RGBA]=b.RGBA16F,k[a.FORMATS.RGB]=b.RGB16F,k[a.FORMATS.RG]=b.RG16F,k[a.FORMATS.RED]=b.R16F,k),c[a.TYPES.UNSIGNED_SHORT_5_6_5]=((u={})[a.FORMATS.RGB]=b.RGB565,u),c[a.TYPES.UNSIGNED_SHORT_4_4_4_4]=((t={})[a.FORMATS.RGBA]=b.RGBA4,t),c[a.TYPES.UNSIGNED_SHORT_5_5_5_1]=((y={})[a.FORMATS.RGBA]=b.RGB5_A1,y),c[a.TYPES.UNSIGNED_INT_2_10_10_10_REV]=((n={})[a.FORMATS.RGBA]=b.RGB10_A2,n[a.FORMATS.RGBA_INTEGER]=b.RGB10_A2UI,n),c[a.TYPES.UNSIGNED_INT_10F_11F_11F_REV]=((p={})[a.FORMATS.RGB]=b.R11F_G11F_B10F,p),c[a.TYPES.UNSIGNED_INT_5_9_9_9_REV]=((q={})[a.FORMATS.RGB]=b.RGB9_E5,q),c[a.TYPES.UNSIGNED_INT_24_8]=((r={})[a.FORMATS.DEPTH_STENCIL]=b.DEPTH24_STENCIL8,r),c[a.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=((s={})[a.FORMATS.DEPTH_STENCIL]=b.DEPTH32F_STENCIL8,s),o=c):((m={})[a.TYPES.UNSIGNED_BYTE]=((g={})[a.FORMATS.RGBA]=b.RGBA,g[a.FORMATS.RGB]=b.RGB,g[a.FORMATS.ALPHA]=b.ALPHA,g[a.FORMATS.LUMINANCE]=b.LUMINANCE,g[a.FORMATS.LUMINANCE_ALPHA]=b.LUMINANCE_ALPHA,g),m[a.TYPES.UNSIGNED_SHORT_5_6_5]=((v={})[a.FORMATS.RGB]=b.RGB,v),m[a.TYPES.UNSIGNED_SHORT_4_4_4_4]=((w={})[a.FORMATS.RGBA]=b.RGBA,w),m[a.TYPES.UNSIGNED_SHORT_5_5_5_1]=((x={})[a.FORMATS.RGBA]=b.RGBA,x),o=m),o}(b),d=b.getParameter(b.MAX_TEXTURE_IMAGE_UNITS),this.boundTextures.length=d;for(c=0;c=0;--d)b=e[d],b&&b._glTextures[g].samplerType!==a.SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(b)},b.prototype.initTexture=function(a){var b=new be(this.gl.createTexture());return b.dirtyId=-1,a._glTextures[this.CONTEXT_UID]=b,this.managedTextures.push(a),a.on("dispose",this.destroyTexture,this),b},b.prototype.initTextureType=function(b,c){var d,e;c.internalFormat=null!==(e=null===(d=this.internalFormats[b.type])||void 0===d?void 0:d[b.format])&&void 0!==e?e:b.format,2===this.webGLVersion&&b.type===a.TYPES.HALF_FLOAT?c.type=this.gl.HALF_FLOAT:c.type=b.type},b.prototype.updateTexture=function(c){var b=c._glTextures[this.CONTEXT_UID],f,d,e,g;b&&(f=this.renderer,(this.initTextureType(c,b),c.resource&&c.resource.upload(f,c,b))?b.samplerType!==a.SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0):(d=c.realWidth,e=c.realHeight,g=f.gl,(b.width!==d||b.height!==e||b.dirtyId<0)&&(b.width=d,b.height=e,g.texImage2D(c.target,0,b.internalFormat,d,e,0,c.format,b.type,null))),c.dirtyStyleId!==b.dirtyStyleId&&this.updateTextureStyle(c),b.dirtyId=c.dirtyId)},b.prototype.destroyTexture=function(a,c){var d=this.gl,b;(a=a.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(a),d.deleteTexture(a._glTextures[this.CONTEXT_UID].texture),a.off("dispose",this.destroyTexture,this),delete a._glTextures[this.CONTEXT_UID],!c)&&(b=this.managedTextures.indexOf(a),-1!==b&&_(this.managedTextures,b,1))},b.prototype.updateTextureStyle=function(b){var c=b._glTextures[this.CONTEXT_UID];c&&(b.mipmap!==a.MIPMAP_MODES.POW2&&2===this.webGLVersion||b.isPowerOfTwo?c.mipmap=b.mipmap>=1:c.mipmap=!1,2===this.webGLVersion||b.isPowerOfTwo?c.wrapMode=b.wrapMode:c.wrapMode=a.WRAP_MODES.CLAMP,b.resource&&b.resource.style(this.renderer,b,c)||this.setStyle(b,c),c.dirtyStyleId=b.dirtyStyleId)},b.prototype.setStyle=function(c,d){var b=this.gl,e,f;d.mipmap&&c.mipmap!==a.MIPMAP_MODES.ON_MANUAL&&b.generateMipmap(c.target),b.texParameteri(c.target,b.TEXTURE_WRAP_S,d.wrapMode),b.texParameteri(c.target,b.TEXTURE_WRAP_T,d.wrapMode),d.mipmap?(b.texParameteri(c.target,b.TEXTURE_MIN_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR_MIPMAP_LINEAR:b.NEAREST_MIPMAP_NEAREST),e=this.renderer.context.extensions.anisotropicFiltering,e&&c.anisotropicLevel>0&&c.scaleMode===a.SCALE_MODES.LINEAR&&(f=Math.min(c.anisotropicLevel,b.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),b.texParameterf(c.target,e.TEXTURE_MAX_ANISOTROPY_EXT,f))):b.texParameteri(c.target,b.TEXTURE_MIN_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR:b.NEAREST),b.texParameteri(c.target,b.TEXTURE_MAG_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR:b.NEAREST)},b.prototype.destroy=function(){this.renderer=null},b}(),em={__proto__:null,FilterSystem:c$,BatchSystem:db,ContextSystem:dd,FramebufferSystem:dg,GeometrySystem:di,MaskSystem:du,ScissorSystem:dt,StencilSystem:ds,ProjectionSystem:dq,RenderTextureSystem:dk,ShaderSystem:df,StateSystem:de,TextureGCSystem:dc,TextureSystem:cW},cU=new m,eo=function(e){function c(g,f){void 0===g&&(g=a.RENDERER_TYPE.UNKNOWN);var c=e.call(this)||this;return f=Object.assign({},b.RENDER_OPTIONS,f),c.options=f,c.type=g,c.screen=new d(0,0,f.width,f.height),c.view=f.view||b.ADAPTER.createCanvas(),c.resolution=f.resolution||b.RESOLUTION,c.useContextAlpha=f.useContextAlpha,c.autoDensity=!!f.autoDensity,c.preserveDrawingBuffer=f.preserveDrawingBuffer,c.clearBeforeRender=f.clearBeforeRender,c._backgroundColor=0,c._backgroundColorRgba=[0,0,0,1],c._backgroundColorString="#000000",c.backgroundColor=f.backgroundColor||c._backgroundColor,c.backgroundAlpha=f.backgroundAlpha,void 0!==f.transparent&&(c.useContextAlpha=f.transparent,c.backgroundAlpha=f.transparent?0:1),c._lastObjectRendered=null,c.plugins={},c}return h(c,e),c.prototype.initPlugins=function(a){for(var b in a)this.plugins[b]=new a[b](this)},Object.defineProperty(c.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),c.prototype.resize=function(c,d){this.view.width=Math.round(c*this.resolution),this.view.height=Math.round(d*this.resolution);var a=this.view.width/this.resolution,b=this.view.height/this.resolution;this.screen.width=a,this.screen.height=b,this.autoDensity&&(this.view.style.width=a+"px",this.view.style.height=b+"px"),this.emit("resize",a,b)},c.prototype.generateTexture=function(c,b,g,a){var e,f,d;return void 0===b&&(b={}),"number"==typeof b&&(b={scaleMode:b,resolution:g,region:a}),e=b.region,f=function(b,e){var d={},a,c;for(a in b)Object.prototype.hasOwnProperty.call(b,a)&&e.indexOf(a)<0&&(d[a]=b[a]);if(null!=b&&"function"==typeof Object.getOwnPropertySymbols){c=0;for(a=Object.getOwnPropertySymbols(b);c=a.data.byteLength?b.bufferSubData(a.type,0,a.data):(e=a.static?b.STATIC_DRAW:b.DYNAMIC_DRAW,c.byteLength=a.data.byteLength,b.bufferData(a.type,a.data,e)))},a.prototype.dispose=function(a,c){if(this.managedBuffers[a.id]){delete this.managedBuffers[a.id];var b=a._glBuffers[this.CONTEXT_UID],d=this.gl;a.disposeRunner.remove(this),b&&(c||d.deleteBuffer(b.buffer),delete a._glBuffers[this.CONTEXT_UID])}},a.prototype.disposeAll=function(c){for(var b=Object.keys(this.managedBuffers),a=0;a=a.MSAA_QUALITY.HIGH?this.multisample=a.MSAA_QUALITY.HIGH:c>=a.MSAA_QUALITY.MEDIUM?this.multisample=a.MSAA_QUALITY.MEDIUM:c>=a.MSAA_QUALITY.LOW?this.multisample=a.MSAA_QUALITY.LOW:this.multisample=a.MSAA_QUALITY.NONE},b.prototype.addSystem=function(c,a){var b=new c(this),d;if(this[a])throw new Error('Whoops! The name "'+a+'" is already in use');for(d in this[a]=b,this.runners)this.runners[d].add(b);return this},b.prototype.render=function(c,a){var b,d,e,f,g;a&&(a instanceof G?(b=a,d=arguments[2],e=arguments[3],f=arguments[4]):(b=a.renderTexture,d=a.clear,e=a.transform,f=a.skipUpdateTransform)),this.renderingToScreen=!b,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=e,!this.context.isLost&&(b||(this._lastObjectRendered=c),!f&&(g=c.enableTempParent(),c.updateTransform(),c.disableTempParent(g)),this.renderTexture.bind(b),this.batch.currentRenderer.start(),(void 0!==d?d:this.clearBeforeRender)&&this.renderTexture.clear(),c.render(this),this.batch.currentRenderer.flush(),b&&b.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender"))},b.prototype.generateTexture=function(b,a,d,e){void 0===a&&(a={});var f=c.prototype.generateTexture.call(this,b,a,d,e);return this.framebuffer.blit(),f},b.prototype.resize=function(a,b){c.prototype.resize.call(this,a,b),this.runners.resize.emit(this.screen.height,this.screen.width)},b.prototype.reset=function(){return this.runners.reset.emit(),this},b.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},b.prototype.destroy=function(a){for(var b in this.runners.destroy.emit(),this.runners)this.runners[b].destroy();c.prototype.destroy.call(this,a),this.gl=null},Object.defineProperty(b.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),b.registerPlugin=function(b,c){A.add({name:b,type:a.ExtensionType.RendererPlugin,ref:c})},b.__plugins={},b}(eo);function es(a){return cS.create(a)}A.handleByMap(a.ExtensionType.RendererPlugin,cS.__plugins),et="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",cR="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",hB=function(){function a(a){this.renderer=a}return a.prototype.destroy=function(){this.renderer=null},a}(),bb=function(){this.texArray=null,this.blend=0,this.type=a.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},aY=function(){function a(){this.elements=[],this.ids=[],this.count=0}return a.prototype.clear=function(){for(var a=0;athis.size&&this.flush(),this._vertexCount+=a.vertexData.length/2,this._indexCount+=a.indices.length,this._bufferedTextures[this._bufferSize]=a._texture.baseTexture,this._bufferedElements[this._bufferSize++]=a)},c.prototype.buildTexturesAndDrawCalls=function(){var k=this._bufferedTextures,g=this.MAX_TEXTURES,m=c._textureArrayPool,i=this.renderer.batch,f=this._tempBoundTextures,n=this.renderer.textureGC.count,d=++e._globalBatch,l=0,b=m[0],j=0,a,h;i.copyBoundTextures(f,g);for(a=0;a=g&&(i.boundArray(b,f,d,g),this.buildDrawCalls(b,j,a),j=a,b=m[++l],++d),h._batchEnabled=d,h.touched=n,b.elements[b.count++]=h);for(b.count>0&&(i.boundArray(b,f,d,g),this.buildDrawCalls(b,j,this._bufferSize),++l,++d),a=0;a0&&(a+="\nelse "),b title : "+a.title+"
tabIndex: "+a.tabIndex},b.prototype.capHitArea=function(a){a.x<0&&(a.width+=a.x,a.x=0),a.y<0&&(a.height+=a.y,a.y=0);var b=this.renderer,c=b.width,d=b.height;a.x+a.width>c&&(a.width=c-a.x),a.y+a.height>d&&(a.height=d-a.y)},b.prototype.addChild=function(b){var a=this.pool.pop();a||((a=document.createElement("button")).style.width="100px",a.style.height="100px",a.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",a.style.position="absolute",a.style.zIndex=2..toString(),a.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?a.setAttribute("aria-live","off"):a.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?a.setAttribute("aria-relevant","additions"):a.setAttribute("aria-relevant","text"),a.addEventListener("click",this._onClick.bind(this)),a.addEventListener("focus",this._onFocus.bind(this)),a.addEventListener("focusout",this._onFocusOut.bind(this))),a.style.pointerEvents=b.accessiblePointerEvents,a.type=b.accessibleType,b.accessibleTitle&&null!==b.accessibleTitle?a.title=b.accessibleTitle:b.accessibleHint&&null!==b.accessibleHint||(a.title="displayObject "+b.tabIndex),b.accessibleHint&&null!==b.accessibleHint&&a.setAttribute("aria-label",b.accessibleHint),this.debug&&this.updateDebugHTML(a),b._accessibleActive=!0,b._accessibleDiv=a,a.displayObject=b,this.children.push(b),this.div.appendChild(b._accessibleDiv),b._accessibleDiv.tabIndex=b.tabIndex},b.prototype._onClick=function(d){var a=this.renderer.plugins.interaction,b=d.target.displayObject,c=a.eventData;a.dispatchEvent(b,"click",c),a.dispatchEvent(b,"pointertap",c),a.dispatchEvent(b,"tap",c)},b.prototype._onFocus=function(a){a.target.getAttribute("aria-live")||a.target.setAttribute("aria-live","assertive");var b=this.renderer.plugins.interaction,c=a.target.displayObject,d=b.eventData;b.dispatchEvent(c,"mouseover",d)},b.prototype._onFocusOut=function(a){a.target.getAttribute("aria-live")||a.target.setAttribute("aria-live","polite");var b=this.renderer.plugins.interaction,c=a.target.displayObject,d=b.eventData;b.dispatchEvent(c,"mouseout",d)},b.prototype._onKeyDown=function(a){9===a.keyCode&&this.activate()},b.prototype._onMouseMove=function(a){0===a.movementX&&0===a.movementY||this.deactivate()},b.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},b.extension={name:"accessibility",type:[a.ExtensionType.RendererPlugin,a.ExtensionType.CanvasRendererPlugin]},b}(),cC=function(){function a(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new g,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(a.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),a.prototype.getLocalPosition=function(a,b,c){return a.worldTransform.applyInverse(c||this.global,b)},a.prototype.copyEvent=function(a){"isPrimary"in a&&a.isPrimary&&(this.isPrimary=!0),this.button="button"in a&&a.button;var b="buttons"in a&&a.buttons;this.buttons=Number.isInteger(b)?b:"which"in a&&a.which,this.width="width"in a&&a.width,this.height="height"in a&&a.height,this.tiltX="tiltX"in a&&a.tiltX,this.tiltY="tiltY"in a&&a.tiltY,this.pointerType="pointerType"in a&&a.pointerType,this.pressure="pressure"in a&&a.pressure,this.rotationAngle="rotationAngle"in a&&a.rotationAngle,this.twist="twist"in a&&a.twist||0,this.tangentialPressure="tangentialPressure"in a&&a.tangentialPressure||0},a.prototype.reset=function(){this.isPrimary=!1},a}(),cr=function(a,b){return cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cr(a,b)},eP=function(){function a(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return a.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},a.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},a}(),bA=function(){function a(b){this._pointerId=b,this._flags=a.FLAGS.NONE}return a.prototype._doSet=function(a,b){this._flags=b?this._flags|a:this._flags&~a},Object.defineProperty(a.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"flags",{get:function(){return this._flags},set:function(a){this._flags=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"none",{get:function(){return this._flags===a.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"over",{get:function(){return 0!=(this._flags&a.FLAGS.OVER)},set:function(b){this._doSet(a.FLAGS.OVER,b)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rightDown",{get:function(){return 0!=(this._flags&a.FLAGS.RIGHT_DOWN)},set:function(b){this._doSet(a.FLAGS.RIGHT_DOWN,b)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"leftDown",{get:function(){return 0!=(this._flags&a.FLAGS.LEFT_DOWN)},set:function(b){this._doSet(a.FLAGS.LEFT_DOWN,b)},enumerable:!1,configurable:!0}),a.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),a}(),hr=function(){function a(){this._tempPoint=new g}return a.prototype.recursiveFindHit=function(c,a,h,b,e){var f,g,d,i,l,j,m,k,n,o;if(!a||!a.visible)return!1;if(g=c.data.global,d=!1,i=e=a.interactive||e,l=!0,a.hitArea?(b&&(a.worldTransform.applyInverse(g,this._tempPoint),a.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?d=!0:(b=!1,l=!1)),i=!1):a._mask&&b&&(j=a._mask.isMaskData?a._mask.maskObject:a._mask,j&&!(null===(f=j.containsPoint)||void 0===f?void 0:f.call(j,g))&&(b=!1)),l&&a.interactiveChildren&&a.children)for(m=a.children,k=m.length-1;k>=0;k--)if(n=m[k],o=this.recursiveFindHit(c,n,h,b,i),o){if(!n.parent)continue;i=!1,o&&(c.target&&(b=!1),d=!0)}return e&&(b&&!c.target&&!a.hitArea&&a.containsPoint&&a.containsPoint(g)&&(d=!0),a.interactive&&(d&&!c.target&&(c.target=a),h&&h(c,a,!!d))),d},a.prototype.findHit=function(a,b,c,d){this.recursiveFindHit(a,b,c,d,!1)},a}(),eS={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(a){a?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0},k.mixin(eS),bw={target:null,data:{global:null}},eU=function(c){function b(d,b){var a=c.call(this)||this;return b=b||{},a.renderer=d,a.autoPreventDefault=void 0===b.autoPreventDefault||b.autoPreventDefault,a.interactionFrequency=b.interactionFrequency||10,a.mouse=new cC,a.mouse.identifier=1,a.mouse.global.set(-999999),a.activeInteractionData={},a.activeInteractionData[1]=a.mouse,a.interactionDataPool=[],a.eventData=new eP,a.interactionDOMElement=null,a.moveWhenInside=!1,a.eventsAdded=!1,a.tickerAdded=!1,a.mouseOverRenderer=!("PointerEvent"in globalThis),a.supportsTouchEvents="ontouchstart"in globalThis,a.supportsPointerEvents=!!globalThis.PointerEvent,a.onPointerUp=a.onPointerUp.bind(a),a.processPointerUp=a.processPointerUp.bind(a),a.onPointerCancel=a.onPointerCancel.bind(a),a.processPointerCancel=a.processPointerCancel.bind(a),a.onPointerDown=a.onPointerDown.bind(a),a.processPointerDown=a.processPointerDown.bind(a),a.onPointerMove=a.onPointerMove.bind(a),a.processPointerMove=a.processPointerMove.bind(a),a.onPointerOut=a.onPointerOut.bind(a),a.processPointerOverOut=a.processPointerOverOut.bind(a),a.onPointerOver=a.onPointerOver.bind(a),a.cursorStyles={default:"inherit",pointer:"pointer"},a.currentCursorMode=null,a.cursor=null,a.resolution=1,a.delayedEvents=[],a.search=new hr,a._tempDisplayObject=new ca,a._eventListenerOptions={capture:!0,passive:!1},a._useSystemTicker=void 0===b.useSystemTicker||b.useSystemTicker,a.setTargetElement(a.renderer.view,a.renderer.resolution),a}return function(b,a){function c(){this.constructor=b}cr(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,c),Object.defineProperty(b.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(a){this._useSystemTicker=a,a?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),b.prototype.hitTest=function(b,a){return bw.target=null,bw.data.global=b,a||(a=this.lastObjectRendered),this.processInteractive(bw,a,null,!0),bw.target},b.prototype.setTargetElement=function(b,a){void 0===a&&(a=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=b,this.resolution=a,this.addEvents(),this.addTickerListener()},b.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(o.system.add(this.tickerUpdate,this,a.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},b.prototype.removeTickerListener=function(){this.tickerAdded&&(o.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},b.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var a=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(a.msContentZooming="none",a.msTouchAction="none"):this.supportsPointerEvents&&(a.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},b.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var a=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(a.msContentZooming="",a.msTouchAction=""):this.supportsPointerEvents&&(a.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},b.prototype.tickerUpdate=function(a){this._deltaTime+=a,this._deltaTime0&&(h=b.composedPath()[0]);for(d=h!==this.interactionDOMElement?"outside":"",f=0;f0||b.responseType===a.XHR_RESPONSE_TYPE.BUFFER)?d=200:1223===d&&(d=204),2==(d/100|0)){if(this.xhrType===a.XHR_RESPONSE_TYPE.TEXT)this.data=c,this.type=a.TYPE.TEXT;else if(this.xhrType===a.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(c),this.type=a.TYPE.JSON}catch(a){return void this.abort("Error trying to parse loaded json: "+a)}else if(this.xhrType===a.XHR_RESPONSE_TYPE.DOCUMENT)try{globalThis.DOMParser?(f=new DOMParser,this.data=f.parseFromString(c,"text/xml")):(e=document.createElement("div"),e.innerHTML=c,this.data=e),this.type=a.TYPE.XML}catch(a){return void this.abort("Error trying to parse loaded xml: "+a)}else this.data=b.response||c;this.complete()}else this.abort("["+b.status+"] "+b.statusText+": "+b.responseURL)},a.prototype._determineCrossOrigin=function(c,a){if(0===c.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";a=a||globalThis.location,bh||(bh=document.createElement("a")),bh.href=c;var b=e$(bh.href,{strictMode:!0}),d=!b.port&&""===a.port||b.port===a.port,e=b.protocol?b.protocol+":":"";return b.host===a.hostname&&d&&e===a.protocol?"":"anonymous"},a.prototype._determineXhrType=function(){return a._xhrTypeMap[this.extension]||a.XHR_RESPONSE_TYPE.TEXT},a.prototype._determineLoadType=function(){return a._loadTypeMap[this.extension]||a.LOAD_TYPE.XHR},a.prototype._getExtension=function(a){var b,c,d,e,f;return void 0===a&&(a=this.url),b="",this.isDataUrl?(c=a.indexOf("/"),b=a.substring(c+1,a.indexOf(";",c))):(d=a.indexOf("?"),e=a.indexOf("#"),f=Math.min(d>-1?d:a.length,e>-1?e:a.length),b=(a=a.substring(0,f)).substring(a.lastIndexOf(".")+1)),b.toLowerCase()},a.prototype._getMimeFromXhrType=function(b){switch(b){case a.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case a.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case a.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case a.XHR_RESPONSE_TYPE.JSON:return"application/json";case a.XHR_RESPONSE_TYPE.DEFAULT:case a.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},a}(),function(a){var c,b,d,e;(c=a.STATUS_FLAGS||(a.STATUS_FLAGS={}))[c.NONE=0]="NONE",c[c.DATA_URL=1]="DATA_URL",c[c.COMPLETE=2]="COMPLETE",c[c.LOADING=4]="LOADING",(b=a.TYPE||(a.TYPE={}))[b.UNKNOWN=0]="UNKNOWN",b[b.JSON=1]="JSON",b[b.XML=2]="XML",b[b.IMAGE=3]="IMAGE",b[b.AUDIO=4]="AUDIO",b[b.VIDEO=5]="VIDEO",b[b.TEXT=6]="TEXT",(d=a.LOAD_TYPE||(a.LOAD_TYPE={}))[d.XHR=1]="XHR",d[d.IMAGE=2]="IMAGE",d[d.AUDIO=3]="AUDIO",d[d.VIDEO=4]="VIDEO",(e=a.XHR_RESPONSE_TYPE||(a.XHR_RESPONSE_TYPE={})).DEFAULT="text",e.BUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.TEXT="text",a._loadTypeMap={gif:a.LOAD_TYPE.IMAGE,png:a.LOAD_TYPE.IMAGE,bmp:a.LOAD_TYPE.IMAGE,jpg:a.LOAD_TYPE.IMAGE,jpeg:a.LOAD_TYPE.IMAGE,tif:a.LOAD_TYPE.IMAGE,tiff:a.LOAD_TYPE.IMAGE,webp:a.LOAD_TYPE.IMAGE,tga:a.LOAD_TYPE.IMAGE,avif:a.LOAD_TYPE.IMAGE,svg:a.LOAD_TYPE.IMAGE,"svg+xml":a.LOAD_TYPE.IMAGE,mp3:a.LOAD_TYPE.AUDIO,ogg:a.LOAD_TYPE.AUDIO,wav:a.LOAD_TYPE.AUDIO,mp4:a.LOAD_TYPE.VIDEO,webm:a.LOAD_TYPE.VIDEO},a._xhrTypeMap={xhtml:a.XHR_RESPONSE_TYPE.DOCUMENT,html:a.XHR_RESPONSE_TYPE.DOCUMENT,htm:a.XHR_RESPONSE_TYPE.DOCUMENT,xml:a.XHR_RESPONSE_TYPE.DOCUMENT,tmx:a.XHR_RESPONSE_TYPE.DOCUMENT,svg:a.XHR_RESPONSE_TYPE.DOCUMENT,tsx:a.XHR_RESPONSE_TYPE.DOCUMENT,gif:a.XHR_RESPONSE_TYPE.BLOB,png:a.XHR_RESPONSE_TYPE.BLOB,bmp:a.XHR_RESPONSE_TYPE.BLOB,jpg:a.XHR_RESPONSE_TYPE.BLOB,jpeg:a.XHR_RESPONSE_TYPE.BLOB,tif:a.XHR_RESPONSE_TYPE.BLOB,tiff:a.XHR_RESPONSE_TYPE.BLOB,webp:a.XHR_RESPONSE_TYPE.BLOB,tga:a.XHR_RESPONSE_TYPE.BLOB,avif:a.XHR_RESPONSE_TYPE.BLOB,json:a.XHR_RESPONSE_TYPE.JSON,text:a.XHR_RESPONSE_TYPE.TEXT,txt:a.XHR_RESPONSE_TYPE.TEXT,ttf:a.XHR_RESPONSE_TYPE.BUFFER,otf:a.XHR_RESPONSE_TYPE.BUFFER},a.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(a.LoaderResource||(a.LoaderResource={})),ho=function(a,b){this.data=a,this.callback=b},bE=function(){function a(c,b){var a=this;if(void 0===b&&(b=1),this.workers=0,this.saturated=Q,this.unsaturated=Q,this.empty=Q,this.drain=Q,this.error=Q,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(c,e,b){if(b&&"function"!=typeof b)throw new Error("task callback must be a function");if(a.started=!0,null==c&&a.idle())setTimeout(function(){return a.drain()},1);else{var d=new ho(c,"function"==typeof b?b:Q);e?a._tasks.unshift(d):a._tasks.push(d),setTimeout(a.process,1)}},this.process=function(){for(;!a.paused&&a.workers>2,b[1]=(3&a[0])<<4|a[1]>>4,b[2]=(15&a[1])<<2|a[2]>>6,b[3]=63&a[2],e-(d.length-1)){case 2:b[3]=64,b[2]=64;break;case 1:b[3]=64}for(c=0;c0&&a[a.length-1])||6!==d[0]&&2!==d[0])){b=0;continue}if(3===d[0]&&(!a||d[1]>a[0]&&d[1]=33776&&a<=33779)return"s3tc";if(a>=37488&&a<=37497)return"etc";if(a>=35840&&a<=35843)return"pvrtc";if(a>=36196)return"etc1";if(a>=35986&&a<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},a._createLevelBuffers=function(m,l,c,d,e,o,n){for(var j=new Array(c),k=m.byteOffset,a=o,f=n,i=a+d-1&~(d-1),h=f+e-1&~(e-1),g=i*h*av[l],b=0;b1?a:i,levelHeight:c>1?f:h,levelBuffer:new Uint8Array(m.buffer,k,g)},k+=g,g=(i=(a=a>>1||1)+d-1&~(d-1))*(h=(f=f>>1||1)+e-1&~(e-1))*av[l];return j},a}(fu),fw=function(){function c(){}return c.use=function(b,f){var d=b.data,h,e,i,g,m,k,l,j,n,o,p;if(b.type===a.LoaderResource.TYPE.JSON&&d&&d.cacheID&&d.textures){for(h=d.textures,e=void 0,i=void 0,g=0,m=h.length;g>>=1,l>>>=1;s=148;for(c=0;cf-c){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(a=0;a1||0!==c?l:z,levelHeight:g>1||0!==c?p:A,levelBuffer:new Uint8Array(F,w,m)},w+=m;e=(e+=D+4)%4!=0?e+4-e%4:e,m=(z=(l=l>>1||1)+4-1&-4)*(A=(p=p>>1||1)+4-1&-4)*q}return 0!==c?{uncompressed:k.map(function(b){var d=b[0].levelBuffer,e=!1;return c===a.TYPES.FLOAT?d=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):c===a.TYPES.UNSIGNED_INT?(e=!0,d=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):c===a.TYPES.INT&&(e=!0,d=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new S(d,{width:b[0].levelWidth,height:b[0].levelHeight}),type:c,format:e?he(r):r}}),kvData:v}:{compressed:k.map(function(a){return new bk(null,{format:y,width:j,height:f,levels:g,levelBuffers:a})}),kvData:v}}function he(b){switch(b){case a.FORMATS.RGBA:return a.FORMATS.RGBA_INTEGER;case a.FORMATS.RGB:return a.FORMATS.RGB_INTEGER;case a.FORMATS.RG:return a.FORMATS.RG_INTEGER;case a.FORMATS.RED:return a.FORMATS.RED_INTEGER;default:return b}}a.LoaderResource.setExtensionXhrType("dds",a.LoaderResource.XHR_RESPONSE_TYPE.BUFFER),fM=function(){function b(){}return b.use=function(a,b){if("dds"===a.extension&&a.data)try{Object.assign(a,fx(a.name||a.url,fF(a.data),a.metadata))}catch(a){return void b(a)}b()},b.extension=a.ExtensionType.Loader,b}(),a.LoaderResource.setExtensionXhrType("ktx",a.LoaderResource.XHR_RESPONSE_TYPE.BUFFER),fN=function(){function b(){}return b.use=function(b,l){var d,h,j,k,g,f,m,i;if("ktx"===b.extension&&b.data)try{if(d=b.name||b.url,h=fK(0,b.data,this.loadKeyValueData),j=h.compressed,k=h.uncompressed,g=h.kvData,j){if(f=fx(d,j,b.metadata),g&&f.textures)for(m in f.textures)f.textures[m].baseTexture.ktxKeyValueData=g;Object.assign(b,f)}else k&&(i={},k.forEach(function(f,j){var b=new c(new e(f.resource,{mipmap:a.MIPMAP_MODES.OFF,alphaMode:a.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),h=d+"-"+(j+1);g&&(b.baseTexture.ktxKeyValueData=g),e.addToCache(b.baseTexture,h),c.addToCache(b,h),0===j&&(i[d]=b,e.addToCache(b.baseTexture,d),c.addToCache(b,d)),i[h]=b}),Object.assign(b,{textures:i}))}catch(a){return void l(a)}l()},b.extension=a.ExtensionType.Loader,b.loadKeyValueData=!1,b}(),bV=function(a,b){return bV=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bV(a,b)};function fP(b,a){function c(){this.constructor=b}bV(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}hd=function(c){function b(e,g,d,f){void 0===e&&(e=1500),void 0===d&&(d=16384),void 0===f&&(f=!1);var b=c.call(this)||this;return d>16384&&(d=16384),b._properties=[!1,!0,!1,!1,!1],b._maxSize=e,b._batchSize=d,b._buffers=null,b._bufferUpdateIDs=[],b._updateID=0,b.interactiveChildren=!1,b.blendMode=a.BLEND_MODES.NORMAL,b.autoResize=f,b.roundPixels=!0,b.baseTexture=null,b.setProperties(g),b._tint=0,b.tintRgb=new Float32Array(4),b.tint=16777215,b}return fP(b,c),b.prototype.setProperties=function(a){a&&(this._properties[0]="vertices"in a||"scale"in a?!!a.vertices||!!a.scale:this._properties[0],this._properties[1]="position"in a?!!a.position:this._properties[1],this._properties[2]="rotation"in a?!!a.rotation:this._properties[2],this._properties[3]="uvs"in a?!!a.uvs:this._properties[3],this._properties[4]="tint"in a||"alpha"in a?!!a.tint||!!a.alpha:this._properties[4])},b.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(b.prototype,"tint",{get:function(){return this._tint},set:function(a){this._tint=a,T(a,this.tintRgb)},enumerable:!1,configurable:!0}),b.prototype.render=function(a){var b=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return b.onChildrenChange(0)})),a.batch.setObjectRenderer(a.plugins.particle),a.plugins.particle.render(this))},b.prototype.onChildrenChange=function(b){for(var a=Math.floor(b/this._batchSize);this._bufferUpdateIDs.lengthp&&!a.autoResize&&(d=p),e=a._buffers,e||(e=a._buffers=this.generateBuffers(a)),o=h[0]._texture.baseTexture,l=o.alphaMode>0,this.state.blendMode=bM(a.blendMode,l),g.state.set(this.state),k=g.gl,n=a.worldTransform.copyTo(this.tempMatrix),n.prepend(g.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=n.toArray(!0),this.shader.uniforms.uColor=fz(a.tintRgb,a.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);for(m=!1,b=0,i=0;bj&&(c=j),i>=e.length&&e.push(this._generateOneMoreBuffer(a)),f=e[i],f.uploadDynamic(h,b,c),q=a._bufferUpdateIDs[i]||0,(m=m||f._updateID0,g=b.alpha,e=g<1&&k?bg(b._tintRGB,g):b._tintRGB+(255*g<<24),c[a]=e,c[a+d]=e,c[a+2*d]=e,c[a+3*d]=e,a+=4*d},b.prototype.destroy=function(){c.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},b.extension={name:"particle",type:a.ExtensionType.RendererPlugin},b}(aF),a.LINE_JOIN=void 0,a.LINE_CAP=void 0,function(a){a.MITER="miter",a.BEVEL="bevel",a.ROUND="round"}(a.LINE_JOIN||(a.LINE_JOIN={})),function(a){a.BUTT="butt",a.ROUND="round",a.SQUARE="square"}(a.LINE_CAP||(a.LINE_CAP={})),ac={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(b,c){if(void 0===c&&(c=20),!this.adaptive||!b||isNaN(b))return c;var a=Math.ceil(b/this.maxLength);return athis.maxSegments&&(a=this.maxSegments),a}},dE=function(){function a(){this.color=16777215,this.alpha=1,this.texture=c.WHITE,this.matrix=null,this.visible=!1,this.reset()}return a.prototype.clone=function(){var b=new a;return b.color=this.color,b.alpha=this.alpha,b.texture=this.texture,b.matrix=this.matrix,b.visible=this.visible,b},a.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=c.WHITE,this.matrix=null,this.visible=!1},a.prototype.destroy=function(){this.texture=null,this.matrix=null},a}(),bY=function(a,b){return bY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bY(a,b)};function bC(b,a){function c(){this.constructor=b}bY(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function fX(a,d){var e,f,c,g,b,i,h,j,k,l,m,n,o,p;if(void 0===d&&(d=!1),c=a.length,!(c<6)){for(g=0,b=0,i=a[c-2],h=a[c-1];b0||d&&g<=0){l=c/2;for(b=l+l%2;b=6){fX(b,!1);for(g=[],a=0;a=0&&i>=0&&c>=0&&e>=0){if(t=Math.ceil(2.3*Math.sqrt(n+i)),w=8*t+(c?4:0)+(e?4:0),b.length=w,0!==w){if(0===t)return b.length=8,b[0]=b[6]=f+c,b[1]=b[3]=d+e,b[2]=b[4]=f-c,void(b[5]=b[7]=d-e);m=0,s=4*t+(c?2:0)+2,u=s,h=w,l=f+(p=c+n),g=f-p,k=d+(q=e),(b[m++]=l,b[m++]=k,b[--s]=k,b[--s]=g,e)&&(j=d-q,b[u++]=g,b[u++]=j,b[--h]=j,b[--h]=l);for(A=1;Ah&&(h+=2*Math.PI),j=g,s=h-g,t=Math.abs(s),e=Math.sqrt(m*m+l*l),i=1+(15*t*Math.sqrt(e)/Math.PI>>0),o=s/i,j+=o,n){a.push(c,b),a.push(k,p);for(f=1,d=j;f=0&&(p.join===a.LINE_JOIN.ROUND?q+=aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+4:q+=2,d.push(b-l*f,c-k*f),d.push(b+l*e,c+k*e))):(Q=(-h+o)*(-i+c)-(-h+b)*(-i+n),S=(-l+y)*(-k+c)-(-l+b)*(-k+x),H=(D*S-B*Q)/J,G=(A*Q-C*S)/J,L=(H-b)*(H-b)+(G-c)*(G-c),t=b+(H-b)*e,w=c+(G-c)*e,v=b-(H-b)*f,u=c-(G-c)*f,T=F?e:f,L<=Math.min(D*D+C*C,B*B+A*A)+T*T*O?p.join===a.LINE_JOIN.BEVEL||L/O>Y?(F?(d.push(t,w),d.push(b+h*f,c+i*f),d.push(t,w),d.push(b+l*f,c+k*f)):(d.push(b-h*e,c-i*e),d.push(v,u),d.push(b-l*e,c-k*e),d.push(v,u)),q+=2):p.join===a.LINE_JOIN.ROUND?F?(d.push(t,w),d.push(b+h*f,c+i*f),q+=aa(b,c,b+h*f,c+i*f,b+l*f,c+k*f,d,!0)+4,d.push(t,w),d.push(b+l*f,c+k*f)):(d.push(b-h*e,c-i*e),d.push(v,u),q+=aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+4,d.push(b-l*e,c-k*e),d.push(v,u)):(d.push(t,w),d.push(v,u)):(d.push(b-h*e,c-i*e),d.push(b+h*f,c+i*f),p.join===a.LINE_JOIN.ROUND?q+=F?aa(b,c,b+h*f,c+i*f,b+l*f,c+k*f,d,!0)+2:aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+2:p.join===a.LINE_JOIN.MITER&&L/O<=Y&&(F?(d.push(v,u),d.push(v,u)):(d.push(t,w),d.push(t,w)),q+=2),d.push(b-l*e,c-k*e),d.push(b+l*f,c+k*f),q+=2));o=j[2*(E-2)],n=j[2*(E-2)+1],b=j[2*(E-1)],h=-(n-(c=j[2*(E-1)+1])),i=o-b,h/=s=Math.sqrt(h*h+i*i),i/=s,h*=r,i*=r,d.push(b-h*e,c-i*e),d.push(b+h*f,c+i*f),P||(p.cap===a.LINE_CAP.ROUND?q+=aa(b-h*(e-f)*.5,c-i*(e-f)*.5,b-h*e,c-i*e,b+h*f,c+i*f,d,!1)+2:p.cap===a.LINE_CAP.SQUARE&&(q+=gc(b,c,h,i,e,f,!1,d))),ab=M.indices,_=ac.epsilon*ac.epsilon;for(m=W;md*c})},a.arc=function(u,t,r,q,c,h,o,s,n){for(var e=o-h,k=ac._segmentsCount(Math.abs(e)*c,40*Math.ceil(Math.abs(e)/aA)),a=e/(2*k),m=2*a,j=Math.cos(a),i=Math.sin(a),d=k-1,p=d%1/d,b=0,g,f,l;b<=d;++b)g=a+h+m*(b+p*b),f=Math.cos(g),l=-Math.sin(g),n.push((j*f+i*l)*c+r,(j*-l+i*f)*c+q)},a}(),gh=function(){function a(){}return a.curveLength=function(p,m,u,t,s,r,q,v){for(var i=0,a=0,d=0,o=0,b=0,g=0,n=0,h=0,j=0,f=0,e=0,k=p,l=m,c=1;c<=10;++c)f=k-(h=(n=(g=(b=1-(a=c/10))*b)*b)*p+3*g*a*u+3*b*(d=a*a)*s+(o=d*a)*q),e=l-(j=n*m+3*g*a*t+3*b*d*r+o*v),k=h,l=j,i+=Math.sqrt(f*f+e*e);return i},a.curveTo=function(r,q,p,o,n,m,b){var i=b[b.length-2],k=b[b.length-1],l,d,h,g,f,j,e,c;b.length-=2,l=ac._segmentsCount(a.curveLength(i,k,r,q,p,o,n,m)),d=0,h=0,g=0,f=0,j=0,b.push(i,k);for(e=1,c=0;e<=l;++e)g=(h=(d=1-(c=e/l))*d)*d,j=(f=c*c)*c,b.push(g*i+3*h*c*r+3*d*f*p+j*n,g*k+3*h*c*q+3*d*f*o+j*m)},a}(),gi=function(){function a(){}return a.curveLength=function(j,o,n,m,r,q){var g=j-2*n+r,h=o-2*m+q,i=2*n-2*j,d=2*m-2*o,c=4*(g*g+h*h),a=4*(g*i+h*d),f=i*i+d*d,e=2*Math.sqrt(c+a+f),b=Math.sqrt(c),k=2*c*b,l=2*Math.sqrt(f),p=a/b;return(k*e+b*a*(e-l)+(4*f*c-a*a)*Math.log((2*b+p+e)/(p+l)))/(4*k)},a.curveTo=function(d,e,l,m,c){for(var j=c[c.length-2],h=c[c.length-1],k=ac._segmentsCount(a.curveLength(j,h,d,e,l,m)),f=0,g=0,i=1,b;i<=k;++i)b=i/k,f=j+(d-j)*b,g=h+(e-h)*b,c.push(f+(d+(l-d)*b-f)*b,g+(e+(m-e)*b-g)*b)},a}(),gj=function(){function a(){this.reset()}return a.prototype.begin=function(a,b,c){this.reset(),this.style=a,this.start=b,this.attribStart=c},a.prototype.end=function(a,b){this.attribSize=b-this.attribStart,this.size=a-this.start},a.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},a}(),bt=((aj={})[a.SHAPES.POLY]=b$,aj[a.SHAPES.CIRC]=aL,aj[a.SHAPES.ELIP]=aL,aj[a.SHAPES.RECT]=f_,aj[a.SHAPES.RREC]=gb,aj),cf=[],ay=[],cg=function(){function a(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=null),void 0===c&&(c=null),this.points=[],this.holes=[],this.shape=d,this.lineStyle=b,this.fillStyle=a,this.matrix=c,this.type=d.type}return a.prototype.clone=function(){return new a(this.shape,this.fillStyle,this.lineStyle,this.matrix)},a.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},a}(),am=new g,dF=function(c){function b(){var a=c.call(this)||this;return a.closePointEps=1e-4,a.boundsPadding=0,a.uvsFloat32=null,a.indicesUint16=null,a.batchable=!1,a.points=[],a.colors=[],a.uvs=[],a.indices=[],a.textureIds=[],a.graphicsData=[],a.drawCalls=[],a.batchDirty=-1,a.batches=[],a.dirty=0,a.cacheDirty=-1,a.clearDirty=0,a.shapeIndex=0,a._bounds=new aO,a.boundsDirty=-1,a}return bC(b,c),Object.defineProperty(b.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),b.prototype.invalidate=function(){var a,b;this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(a=0;a0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},b.prototype.drawShape=function(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=null),void 0===c&&(c=null);var e=new cg(d,a,b,c);return this.graphicsData.push(e),this.dirty++,this},b.prototype.drawHole=function(d,a){if(void 0===a&&(a=null),!this.graphicsData.length)return null;var b=new cg(d,null,null,a),c=this.graphicsData[this.graphicsData.length-1];return b.lineStyle=c.lineStyle,c.holes.push(b),this.dirty++,this},b.prototype.destroy=function(){c.prototype.destroy.call(this);for(var a=0;a0&&(g=(c=this.batches[this.batches.length-1]).style);for(h=this.shapeIndex;h65535,this.indicesUint16&&this.indices.length===this.indicesUint16.length&&i===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=i?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()):this.batchable=!0}}else this.batchable=!0},b.prototype._compareStyles=function(a,b){return!(!a||!b)&&a.texture.baseTexture===b.texture.baseTexture&&a.color+a.alpha===b.color+b.alpha&&!!a.native==!!b.native},b.prototype.validateBatching=function(){var a,e,b,c,d;if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(a=0,e=this.graphicsData.length;a131070)return!1;for(var c=this.batches,a=0;a0&&((b=ay.pop())||((b=new bb).texArray=new aY),this.drawCalls.push(b)),b.start=m,b.size=0,b.texArray.count=0,b.type=l),c.touched=1,c._batchEnabled=i,c._batchLocation=h,c.wrapMode=a.WRAP_MODES.REPEAT,b.texArray.elements[b.texArray.count++]=c,h++)),b.size+=f.size,m+=f.size,n=c._batchLocation,this.addColors(p,g.color,g.alpha,f.attribSize,f.attribStart),this.addTextureIds(o,n,f.attribSize,f.attribStart);e._globalBatch=i,this.packAttributes()},b.prototype.packAttributes=function(){for(var d=this.points,f=this.uvs,i=this.colors,g=this.textureIds,e=new ArrayBuffer(3*d.length*4),c=new Float32Array(e),h=new Uint32Array(e),b=0,a=0;a>16)+(65280&c)+((255&c)<<16),g),d.length=Math.max(d.length,b+e);for(a=0;a0&&b.alpha>0;return d?(b.matrix&&(b.matrix=b.matrix.clone(),b.matrix.invert()),Object.assign(this._lineStyle,{visible:d},b)):this._lineStyle.reset(),this},b.prototype.startPoly=function(){if(this.currentPath){var b=this.currentPath.points,a=this.currentPath.points.length;a>2&&(this.drawShape(this.currentPath),this.currentPath=new aG,this.currentPath.closeStroke=!1,this.currentPath.points.push(b[a-2],b[a-1]))}else this.currentPath=new aG,this.currentPath.closeStroke=!1},b.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},b.prototype.moveTo=function(a,b){return this.startPoly(),this.currentPath.points[0]=a,this.currentPath.points[1]=b,this},b.prototype.lineTo=function(b,c){this.currentPath||this.moveTo(0,0);var a=this.currentPath.points,d=a[a.length-2],e=a[a.length-1];return d===b&&e===c||a.push(b,c),this},b.prototype._initCurve=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[a,b]):this.moveTo(a,b)},b.prototype.quadraticCurveTo=function(b,c,d,e){this._initCurve();var a=this.currentPath.points;return 0===a.length&&this.moveTo(0,0),gi.curveTo(b,c,d,e,a),this},b.prototype.bezierCurveTo=function(a,b,c,d,e,f){return this._initCurve(),gh.curveTo(a,b,c,d,e,f,this.currentPath.points),this},b.prototype.arcTo=function(b,g,m,l,k){var f,a,h,i,e,d,c,j;return this._initCurve(b,g),f=this.currentPath.points,a=cd.curveTo(b,g,m,l,k,f),a&&(h=a.cx,i=a.cy,e=a.radius,d=a.startAngle,c=a.endAngle,j=a.anticlockwise,this.arc(h,i,e,d,c,j)),this},b.prototype.arc=function(i,j,g,b,c,f){var d,e,h,a,k,l;return void 0===f&&(f=!1),b===c?this:(!f&&c<=b?c+=aA:f&&b<=c&&(b+=aA),0==c-b)?this:(d=i+Math.cos(b)*g,e=j+Math.sin(b)*g,h=this._geometry.closePointEps,a=this.currentPath?this.currentPath.points:null,a?(k=Math.abs(a[a.length-2]-d),l=Math.abs(a[a.length-1]-e),k0;return b?(a.matrix&&(a.matrix=a.matrix.clone(),a.matrix.invert()),Object.assign(this._fillStyle,{visible:b},a)):this._fillStyle.reset(),this},b.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},b.prototype.drawRect=function(a,b,c,e){return this.drawShape(new d(a,b,c,e))},b.prototype.drawRoundedRect=function(a,b,c,d,e){return this.drawShape(new e_(a,b,c,d,e))},b.prototype.drawCircle=function(a,b,c){return this.drawShape(new fd(a,b,c))},b.prototype.drawEllipse=function(a,b,c,d){return this.drawShape(new fa(a,b,c,d))},b.prototype.drawPolygon=function(){for(var c,g=arguments,a=[],b=0,e,d,f;b>16&255)/255*c,b.tint[1]=(f>>8&255)/255*c,b.tint[2]=(255&f)/255*c,b.tint[3]=c,a.shader.bind(d),a.geometry.bind(e,d),a.state.set(this.state);for(g=0,i=h.length;g>16)+(65280&d)+((255&d)<<16)}},b.prototype.calculateVertices=function(){var g=this.transform._worldID,a,m,l,k,j,i,n,c,f,e,b,d,h;if(this._transformID!==g){this._transformID=g;for(a=this.transform.worldTransform,m=a.a,l=a.b,k=a.c,j=a.d,i=a.tx,n=a.ty,c=this._geometry.points,f=this.vertexData,e=0,b=0;b=d&&aw.x=a&&aw.y>16)+(65280&a)+((255&a)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(a){this._texture!==a&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=a||c.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,a&&(a.baseTexture.valid?this._onTextureUpdate():a.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(u),a.TEXT_GRADIENT=void 0,cp=function(a,b){return cp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cp(a,b)},!function(a){a[a.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",a[a.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(a.TEXT_GRADIENT||(a.TEXT_GRADIENT={})),cq={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:a.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},gB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],X=function(){function a(a){this.styleID=0,this.reset(),cv(this,a,a)}return a.prototype.clone=function(){var b={};return cv(b,this,cq),new a(b)},a.prototype.reset=function(){cv(this,cq,cq)},Object.defineProperty(a.prototype,"align",{get:function(){return this._align},set:function(a){this._align!==a&&(this._align=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"breakWords",{get:function(){return this._breakWords},set:function(a){this._breakWords!==a&&(this._breakWords=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(a){this._dropShadow!==a&&(this._dropShadow=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(a){this._dropShadowAlpha!==a&&(this._dropShadowAlpha=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(a){this._dropShadowAngle!==a&&(this._dropShadowAngle=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(a){this._dropShadowBlur!==a&&(this._dropShadowBlur=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(b){var a=ct(b);this._dropShadowColor!==a&&(this._dropShadowColor=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(a){this._dropShadowDistance!==a&&(this._dropShadowDistance=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fill",{get:function(){return this._fill},set:function(b){var a=ct(b);this._fill!==a&&(this._fill=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(a){this._fillGradientType!==a&&(this._fillGradientType=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(a){(function(a,c){if(!Array.isArray(a)||!Array.isArray(c))return!1;if(a.length!==c.length)return!1;for(var b=0;b=0;c--)b=a[c].trim(),!/([\"\'])[^\'\"]+\1/.test(b)&&gB.indexOf(b)<0&&(b='"'+b+'"'),a[c]=b;return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+d+" "+a.join(",")},a}();function gg(a){return"number"==typeof a?bP(a):("string"==typeof a&&0===a.indexOf("0x")&&(a=a.replace("0x","#")),a)}function ct(a){if(Array.isArray(a)){for(var b=0;bo)if(""!==b&&(f+=a.addLine(b),b="",d=0),a.canBreakWords(c,k.breakWords))for(i=a.wordWrapSplit(c),e=0;eo&&(f+=a.addLine(b),h=!1,b="",d=0),b+=g,d+=w}else b.length>0&&(f+=a.addLine(b),b="",d=0),x=j===p.length-1,f+=a.addLine(c,!x),h=!1,b="",d=0;else q+d>o&&(h=!1,f+=a.addLine(b),b="",d=0),(b.length>0||!a.isBreakingSpace(c)||h)&&(b+=c,d+=q)}return f+a.addLine(b,!1)},a.addLine=function(b,c){return void 0===c&&(c=!0),b=a.trimRight(b),c?b+"\n":b},a.getFromCache=function(a,d,c,e){var b=c[a],f;return"number"!=typeof b&&(f=a.length*d,b=e.measureText(a).width+f,c[a]=b),b},a.collapseSpaces=function(a){return"normal"===a||"pre-line"===a},a.collapseNewlines=function(a){return"normal"===a},a.trimRight=function(b){var c,d;if("string"!=typeof b)return"";for(c=b.length-1;c>=0;c--){if(d=b[c],!a.isBreakingSpace(d))break;b=b.slice(0,-1)}return b},a.isNewline=function(b){return"string"==typeof b&&a._newlines.indexOf(b.charCodeAt(0))>=0},a.isBreakingSpace=function(b,c){return"string"==typeof b&&a._breakingSpaces.indexOf(b.charCodeAt(0))>=0},a.tokenize=function(d){var c=[],b="",e,f,g;if("string"!=typeof d)return c;for(e=0;ec;--d){for(f=0;f0&&r>k&&(p=(k+r)/2),n=k+q,t=l.lineHeight*(b+1),u=n,b+10},a}();function gM(a,d){var e=!1,b,f;if(a&&a._textures&&a._textures.length)for(b=0;b=0;a--)this.add(b.children[a]);return this},c.prototype.destroy=function(){this.ticking&&o.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},c}();function gd(b,a){return a instanceof e&&(a._glTextures[b.CONTEXT_UID]||b.texture.bind(a),!0)}function gV(d,b){var a,e,c,f;if(!(b instanceof ar))return!1;a=b.geometry,b.finishPoly(),a.updateBatches();for(e=a.batches,c=0;c=c&&aN.x=d&&aN.y1?D.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",a):D.from(fQ,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",a)},b.prototype.render=function(b){var h=this.renderer,k=this.quad,c=k.vertices,q,n,f,e,r,g,i,j,d,o,p,l,m;c[0]=c[6]=b._width*-b.anchor.x,c[1]=c[3]=b._height*-b.anchor.y,c[2]=c[4]=b._width*(1-b.anchor.x),c[5]=c[7]=b._height*(1-b.anchor.y),q=b.uvRespectAnchor?b.anchor.x:0,n=b.uvRespectAnchor?b.anchor.y:0,(c=k.uvs)[0]=c[6]=-q,c[1]=c[3]=-n,c[2]=c[4]=1-q,c[5]=c[7]=1-n,k.invalidate(),f=b._texture,e=f.baseTexture,r=e.alphaMode>0,g=b.tileTransform.localTransform,i=b.uvMatrix,j=e.isPowerOfTwo&&f.frame.width===e.width&&f.frame.height===e.height,j&&(e._glTextures[h.CONTEXT_UID]?j=e.wrapMode!==a.WRAP_MODES.CLAMP:e.wrapMode===a.WRAP_MODES.CLAMP&&(e.wrapMode=a.WRAP_MODES.REPEAT)),d=j?this.simpleShader:this.shader,o=f.width,p=f.height,l=b._width,m=b._height,aU.set(g.a*o/l,g.b*o/m,g.c*p/l,g.d*p/m,g.tx/l,g.ty/m),aU.invert(),j?aU.prepend(i.mapCoord):(d.uniforms.uMapCoord=i.mapCoord.toArray(!0),d.uniforms.uClampFrame=i.uClampFrame,d.uniforms.uClampOffset=i.uClampOffset),d.uniforms.uTransform=aU.toArray(!0),d.uniforms.uColor=bK(b.tint,b.worldAlpha,d.uniforms.uColor,r),d.uniforms.translationMatrix=b.transform.worldTransform.toArray(!0),d.uniforms.uSampler=f,h.shader.bind(d),h.geometry.bind(k),this.state.blendMode=bM(b.blendMode,r),h.state.set(this.state),h.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},b.extension={name:"tilingSprite",type:a.ExtensionType.RendererPlugin},b}(aF),cN=function(a,b){return cN=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cN(a,b)};function cO(b,a){function c(){this.constructor=b}cN(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}fv=function(){function a(a,b){this.uvBuffer=a,this.uvMatrix=b,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return a.prototype.update=function(b){if(b||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var a=this.uvBuffer.data;this.data&&this.data.length===a.length||(this.data=new Float32Array(a.length)),this.uvMatrix.multiplyUvs(a,this.data),this._updateID++}},a}(),cP=new g,fo=new aG,ah=function(d){function c(f,g,h,e){void 0===e&&(e=a.DRAW_MODES.TRIANGLES);var c=d.call(this)||this;return c.geometry=f,c.shader=g,c.state=h||K.for2d(),c.drawMode=e,c.start=0,c.size=0,c.uvs=null,c.indices=null,c.vertexData=new Float32Array(1),c.vertexDirty=-1,c._transformID=-1,c._roundPixels=b.ROUND_PIXELS,c.batchUvs=null,c}return cO(c,d),Object.defineProperty(c.prototype,"geometry",{get:function(){return this._geometry},set:function(a){this._geometry!==a&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=a,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"material",{get:function(){return this.shader},set:function(a){this.shader=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(a){this.state.blendMode=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(a){this._roundPixels!==a&&(this._transformID=-1),this._roundPixels=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(a){this.shader.tint=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(a){this.shader.texture=a},enumerable:!1,configurable:!0}),c.prototype._render=function(b){var d=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===a.DRAW_MODES.TRIANGLES&&d.length<2*c.BATCHABLE_SIZE?this._renderToBatch(b):this._renderDefault(b)},c.prototype._renderDefault=function(b){var a=this.shader;a.alpha=this.worldAlpha,a.update&&a.update(),b.batch.flush(),a.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),b.shader.bind(a),b.state.set(this.state),b.geometry.bind(this.geometry,a),b.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},c.prototype._renderToBatch=function(b){var d=this.geometry,a=this.shader,c;a.uvMatrix&&(a.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=d.indexBuffer.data,this._tintRGB=a._tintRGB,this._texture=a.texture,c=this.material.pluginName,b.batch.setObjectRenderer(b.plugins[c]),b.plugins[c].render(this)},c.prototype.calculateVertices=function(){var i=this.geometry.buffers[0],e=i.data,f=i._updateID,c,o,n,m,p,l,k,d,a,h,g,j;if(f!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(c=this.transform.worldTransform,o=c.a,n=c.b,m=c.c,p=c.d,l=c.tx,k=c.ty,d=this.vertexData,a=0;a>16)+(65280&a)+((255&a)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),a.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var a=this.texture.baseTexture;bK(this._tint,this._alpha,this.uniforms.uColor,a.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},a}(D),aI=function(c){function b(d,e,f){var b=c.call(this)||this,g=new n(d),h=new n(e,!0),i=new n(f,!0,!0);return b.addAttribute("aVertexPosition",g,2,!1,a.TYPES.FLOAT).addAttribute("aTextureCoord",h,2,!1,a.TYPES.FLOAT).addIndex(i),b._updateId=-1,b}return cO(b,c),Object.defineProperty(b.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),b}(an),cQ=function(a,b){return cQ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cQ(a,b)},aH=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},eX=function(){function a(){}return a.test=function(a){return"string"==typeof a&&0===a.indexOf("info face=")},a.parse=function(n){var c=n.match(/^[a-z]+\s+.+$/gm),b={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]},e,l,g,h,j,i,k,d,f,m,a;for(e in c){l=c[e].match(/^[a-z]+/gm)[0],g=c[e].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(j in g)i=g[j].split("="),k=i[0],d=i[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f,h[k]=m;b[l].push(h)}return a=new aH,b.info.forEach(function(b){return a.info.push({face:b.face,size:parseInt(b.size,10)})}),b.common.forEach(function(b){return a.common.push({lineHeight:parseInt(b.lineHeight,10)})}),b.page.forEach(function(b){return a.page.push({id:parseInt(b.id,10),file:b.file})}),b.char.forEach(function(b){return a.char.push({id:parseInt(b.id,10),page:parseInt(b.page,10),x:parseInt(b.x,10),y:parseInt(b.y,10),width:parseInt(b.width,10),height:parseInt(b.height,10),xoffset:parseInt(b.xoffset,10),yoffset:parseInt(b.yoffset,10),xadvance:parseInt(b.xadvance,10)})}),b.kerning.forEach(function(b){return a.kerning.push({first:parseInt(b.first,10),second:parseInt(b.second,10),amount:parseInt(b.amount,10)})}),b.distanceField.forEach(function(b){return a.distanceField.push({distanceRange:parseInt(b.distanceRange,10),fieldType:b.fieldType})}),a},a}(),bd=function(){function a(){}return a.test=function(a){return a instanceof XMLDocument&&a.getElementsByTagName("page").length&&null!==a.getElementsByTagName("info")[0].getAttribute("face")},a.parse=function(d){for(var c=new aH,h=d.getElementsByTagName("info"),j=d.getElementsByTagName("common"),f=d.getElementsByTagName("page"),i=d.getElementsByTagName("char"),e=d.getElementsByTagName("kerning"),g=d.getElementsByTagName("distanceField"),a=0,b;a")>-1){var b=(new globalThis.DOMParser).parseFromString(a,"text/xml");return bd.test(b)}return!1},a.parse=function(a){var b=(new globalThis.DOMParser).parseFromString(a,"text/xml");return bd.parse(b)},a}(),cX=[eX,bd,eO];function cZ(b){for(var a=0;a=s-r*i){if(0===h)throw new Error("[BitmapFont] textureHeight "+s+"px is too small (fontFamily: '"+a.fontFamily+"', fontSize: "+a.fontSize+"px, char: '"+A+"')");--d,j=null,l=null,t=null,h=0,g=0,p=0}else if(p=Math.max(r+o.fontProperties.descent,p),v*i+g>=J){if(0===g)throw new Error("[BitmapFont] textureWidth "+u+"px is too small (fontFamily: '"+a.fontFamily+"', fontSize: "+a.fontSize+"px, char: '"+A+"')");--d,h+=p*i,h=Math.ceil(h),g=0,p=0}else hv(j,l,o,g,h,i,a),I=bo(o.text),k.char.push({id:I,page:q.length-1,x:g/i,y:h/i,width:v,height:r,xoffset:0,yoffset:0,xadvance:Math.ceil(C-(a.dropShadow?a.dropShadowDistance:0)-(a.stroke?a.strokeThickness:0))}),g+=(v+2*H)*i,g=Math.ceil(g);d=0;for(E=n.length;d0&&i.x>aa&&(_(k,1+t-++ab,1+b-t),b=t,t=-1,w.push(B),z.push(k.length>0?k[k.length-1].prevSpaces:0),j=Math.max(j,B),M++,i.x=0,i.y+=m.lineHeight,x=null,H=0))):(w.push(s),z.push(-1),j=Math.max(j,s),++M,++ab,i.x=0,i.y+=m.lineHeight,x=null,H=0);W=G[G.length-1],"\r"!==W&&"\n"!==W&&(/(?:\s)/.test(W)&&(s=B),w.push(s),j=Math.max(j,s),z.push(-1)),ae=[];for(b=0;b<=M;b++)D=0,"right"===this._align?D=j-w[b]:"center"===this._align?D=(j-w[b])/2:"justify"===this._align&&(D=z[b]<0?0:(j-w[b])/z[b]),ae.push(D);ad=k.length,q={},v=[],I=this._activePagesMeshData;for(Q.push.apply(Q,I),b=0;b 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),T=a.BLEND_MODES.NORMAL_NPM),X=new ah(aj,N),X.blendMode=T,d={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}),d.index=0,d.indexCount=0,d.vertexCount=0,d.uvsCount=0,d.total=0,O=this._textureCache,O[u]=O[u]||new c(A.baseTexture),d.mesh.texture=O[u],d.mesh.tint=this._tint,v.push(d),q[u]=d),q[u].total++;for(b=0;b6*y)||d.vertices.length<2*ah.BATCHABLE_SIZE)d.vertices=new Float32Array(8*y),d.uvs=new Float32Array(8*y),d.indices=new Uint16Array(6*y);else for(ai=d.total,Z=d.vertices,S=4*ai*2;S=h&&(c=b-a-1),d+=g=g.replace("%value%",e[c].toString()),d+="\n";return(f=f.replace("%blur%",d)).replace("%size%",b.toString())}(c);return(a=d.call(this,i,j)||this).horizontal=h,a.resolution=g,a._quality=0,a.quality=f,a.blur=e,a}return eq(c,d),c.prototype.apply=function(b,d,c,j){var g,h,f,e,i,k;if(c?this.horizontal?this.uniforms.strength=1/c.width*(c.width/d.width):this.uniforms.strength=1/c.height*(c.height/d.height):this.horizontal?this.uniforms.strength=1/b.renderer.width*(b.renderer.width/d.width):this.uniforms.strength=1/b.renderer.height*(b.renderer.height/d.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)b.applyFilter(this,d,c,j);else{g=b.getFilterTexture(),h=b.renderer,f=d,e=g,this.state.blend=!1,b.applyFilter(this,f,e,a.CLEAR_MODES.CLEAR);for(i=1;i 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",c)||this).alpha=1,a}return function(b,a){function c(){this.constructor=b}dr(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),a.prototype._loadMatrix=function(c,b){void 0===b&&(b=!1);var a=c;b&&(this._multiply(a,this.uniforms.m,c),a=this._colorMatrix(a)),this.uniforms.m=a},a.prototype._multiply=function(c,a,b){return c[0]=a[0]*b[0]+a[1]*b[5]+a[2]*b[10]+a[3]*b[15],c[1]=a[0]*b[1]+a[1]*b[6]+a[2]*b[11]+a[3]*b[16],c[2]=a[0]*b[2]+a[1]*b[7]+a[2]*b[12]+a[3]*b[17],c[3]=a[0]*b[3]+a[1]*b[8]+a[2]*b[13]+a[3]*b[18],c[4]=a[0]*b[4]+a[1]*b[9]+a[2]*b[14]+a[3]*b[19]+a[4],c[5]=a[5]*b[0]+a[6]*b[5]+a[7]*b[10]+a[8]*b[15],c[6]=a[5]*b[1]+a[6]*b[6]+a[7]*b[11]+a[8]*b[16],c[7]=a[5]*b[2]+a[6]*b[7]+a[7]*b[12]+a[8]*b[17],c[8]=a[5]*b[3]+a[6]*b[8]+a[7]*b[13]+a[8]*b[18],c[9]=a[5]*b[4]+a[6]*b[9]+a[7]*b[14]+a[8]*b[19]+a[9],c[10]=a[10]*b[0]+a[11]*b[5]+a[12]*b[10]+a[13]*b[15],c[11]=a[10]*b[1]+a[11]*b[6]+a[12]*b[11]+a[13]*b[16],c[12]=a[10]*b[2]+a[11]*b[7]+a[12]*b[12]+a[13]*b[17],c[13]=a[10]*b[3]+a[11]*b[8]+a[12]*b[13]+a[13]*b[18],c[14]=a[10]*b[4]+a[11]*b[9]+a[12]*b[14]+a[13]*b[19]+a[14],c[15]=a[15]*b[0]+a[16]*b[5]+a[17]*b[10]+a[18]*b[15],c[16]=a[15]*b[1]+a[16]*b[6]+a[17]*b[11]+a[18]*b[16],c[17]=a[15]*b[2]+a[16]*b[7]+a[17]*b[12]+a[18]*b[17],c[18]=a[15]*b[3]+a[16]*b[8]+a[17]*b[13]+a[18]*b[18],c[19]=a[15]*b[4]+a[16]*b[9]+a[17]*b[14]+a[18]*b[19]+a[19],c},a.prototype._colorMatrix=function(b){var a=new Float32Array(b);return a[4]/=255,a[9]/=255,a[14]/=255,a[19]/=255,a},a.prototype.brightness=function(a,b){var c=[a,0,0,0,0,0,a,0,0,0,0,0,a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.tint=function(a,b){var c=[(a>>16&255)/255,0,0,0,0,0,(a>>8&255)/255,0,0,0,0,0,(255&a)/255,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.greyscale=function(a,b){var c=[a,a,a,0,0,a,a,a,0,0,a,a,a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.blackAndWhite=function(a){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],a)},a.prototype.hue=function(e,f){e=(e||0)/180*Math.PI;var a=Math.cos(e),c=Math.sin(e),b=1/3,d=(0,Math.sqrt)(b),g=[a+(1-a)*b,b*(1-a)-d*c,b*(1-a)+d*c,0,0,b*(1-a)+d*c,a+b*(1-a),b*(1-a)-d*c,0,0,b*(1-a)-d*c,b*(1-a)+d*c,a+b*(1-a),0,0,0,0,0,1,0];this._loadMatrix(g,f)},a.prototype.contrast=function(c,d){var a=(c||0)+1,b=-.5*(a-1),e=[a,0,0,0,b,0,a,0,0,b,0,0,a,0,b,0,0,0,1,0];this._loadMatrix(e,d)},a.prototype.saturate=function(c,d){void 0===c&&(c=0);var b=2*c/3+1,a=-.5*(b-1),e=[b,a,a,0,0,a,b,a,0,0,a,a,b,0,0,0,0,0,1,0];this._loadMatrix(e,d)},a.prototype.desaturate=function(){this.saturate(-1)},a.prototype.negative=function(a){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],a)},a.prototype.sepia=function(a){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],a)},a.prototype.technicolor=function(a){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],a)},a.prototype.polaroid=function(a){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],a)},a.prototype.toBGR=function(a){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],a)},a.prototype.kodachrome=function(a){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],a)},a.prototype.browni=function(a){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],a)},a.prototype.vintage=function(a){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],a)},a.prototype.colorTone=function(c,d,a,b,k){var f=((a=a||16770432)>>16&255)/255,g=(a>>8&255)/255,h=(255&a)/255,i=((b=b||3375104)>>16&255)/255,j=(b>>8&255)/255,e=(255&b)/255,l=[.3,.59,.11,0,0,f,g,h,c=c||.2,0,i,j,e,d=d||.15,0,f-i,g-j,h-e,0,0];this._loadMatrix(l,k)},a.prototype.night=function(a,b){var c=[-2*(a=a||.1),-a,0,0,0,-a,0,a,0,0,0,a,2*a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.predator=function(a,b){var c=[11.224130630493164*a,-4.794486999511719*a,-2.8746118545532227*a,0*a,.40342438220977783*a,-3.6330697536468506*a,9.193157196044922*a,-2.951810836791992*a,0*a,-1.316135048866272*a,-3.2184197902679443*a,-4.2375030517578125*a,7.476448059082031*a,0*a,.8044459223747253*a,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.lsd=function(a){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],a)},a.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(a.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(a){this.uniforms.m=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(a){this.uniforms.uAlpha=a},enumerable:!1,configurable:!0}),a}(C),dv.prototype.grayscale=dv.prototype.greyscale,dw=function(a,b){return dw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dw(a,b)},hP=function(b){function a(d,a){var c=this,e=new m;return d.renderable=!1,(c=b.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:d._texture,filterMatrix:e,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=d,c.maskMatrix=e,null==a&&(a=20),c.scale=new g(a,a),c}return function(b,a){function c(){this.constructor=b}dw(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),a.prototype.apply=function(d,e,f,g){this.uniforms.filterMatrix=d.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,c=Math.sqrt(a.a*a.a+a.b*a.b),b=Math.sqrt(a.c*a.c+a.d*a.d);0!==c&&0!==b&&(this.uniforms.rotation[0]=a.a/c,this.uniforms.rotation[1]=a.b/c,this.uniforms.rotation[2]=a.c/b,this.uniforms.rotation[3]=a.d/b),d.applyFilter(this,e,f,g)},Object.defineProperty(a.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(a){this.uniforms.mapSampler=a},enumerable:!1,configurable:!0}),a}(C),dx=function(a,b){return dx=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dx(a,b)},hR=function(a){function b(){return a.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}return function(b,a){function c(){this.constructor=b}dx(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,a),b}(C),dA=function(a,b){return dA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dA(a,b)},hT=function(b){function a(a,c){void 0===a&&(a=.5),void 0===c&&(c=Math.random());var d=b.call(this,cR,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return d.noise=a,d.seed=c,d}return function(b,a){function c(){this.constructor=b}dA(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),Object.defineProperty(a.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(a){this.uniforms.uNoise=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(a){this.uniforms.uSeed=a},enumerable:!1,configurable:!0}),a}(C),d_=new m,k.prototype._cacheAsBitmap=!1,k.prototype._cacheData=null,k.prototype._cacheAsBitmapResolution=null,k.prototype._cacheAsBitmapMultisample=a.MSAA_QUALITY.NONE,hV=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null},Object.defineProperties(k.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(a){a!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=a,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(a){a!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=a,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(b){var a;this._cacheAsBitmap!==b&&(this._cacheAsBitmap=b,b?(this._cacheData||(this._cacheData=new hV),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),k.prototype._renderCached=function(a){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(a),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(a))},k.prototype._initCachedDisplayObject=function(a){var i,j,d,n,k,p,l,m,g,h,o,f;(!this._cacheData||!this._cacheData.sprite)&&(j=this.alpha,this.alpha=1,a.batch.flush(),d=this.getLocalBounds(null,!0).clone(),this.filters&&this.filters.length&&(n=this.filters[0].padding,d.pad(n)),d.ceil(b.RESOLUTION),k=a.renderTexture.current,p=a.renderTexture.sourceFrame.clone(),l=a.renderTexture.destinationFrame.clone(),m=a.projection.transform,g=G.create({width:d.width,height:d.height,resolution:this.cacheAsBitmapResolution||a.resolution,multisample:null!==(i=this.cacheAsBitmapMultisample)&&void 0!==i?i:a.multisample}),h="cacheAsBitmap_"+I(),this._cacheData.textureCacheId=h,e.addToCache(g.baseTexture,h),c.addToCache(g,h),o=this.transform.localTransform.copyTo(d_).invert().translate(-d.x,-d.y),this.render=this._cacheData.originalRender,a.render(this,{renderTexture:g,clear:!0,transform:o,skipUpdateTransform:!1}),a.framebuffer.blit(),a.projection.transform=m,a.renderTexture.bind(k,p,l),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=j,f=new ai(g),f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-d.x/d.width,f.anchor.y=-d.y/d.height,f.alpha=j,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f))},k.prototype._renderCachedCanvas=function(a){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(a),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(a))},k.prototype._initCachedDisplayObjectCanvas=function(f){var a,j,k,l,h,i,g,d;(!this._cacheData||!this._cacheData.sprite)&&(a=this.getLocalBounds(null,!0),j=this.alpha,this.alpha=1,k=f.context,l=f._projTransform,a.ceil(b.RESOLUTION),h=G.create({width:a.width,height:a.height}),i="cacheAsBitmap_"+I(),this._cacheData.textureCacheId=i,e.addToCache(h.baseTexture,i),c.addToCache(h,i),g=d_,this.transform.localTransform.copyTo(g),g.invert(),g.tx-=a.x,g.ty-=a.y,this.renderCanvas=this._cacheData.originalRenderCanvas,f.render(this,{renderTexture:h,clear:!0,transform:g,skipUpdateTransform:!1}),f.context=k,f._projTransform=l,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=j,d=new ai(h),d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-a.x/a.width,d.anchor.y=-a.y/a.height,d.alpha=j,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=f._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=d.containsPoint.bind(d))},k.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},k.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},k.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,e.removeFromCache(this._cacheData.textureCacheId),c.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},k.prototype._cacheAsBitmapDestroy=function(a){this.cacheAsBitmap=!1,this.destroy(a)},k.prototype.name=null,u.prototype.getChildByName=function(c,f){for(var a=0,b=this.children.length,d,e;a0?(m=h.x-c[b].x,n=h.y-c[b].y,o=Math.sqrt(m*m+n*n),h=c[b],g+=o/p):g=b/(j-1),d[a]=g,d[a+1]=0,d[a+2]=g,d[a+3]=1;f=0;for(b=0;b0?this.textureScale*this._width/2:this._width/2,a/=j,b/=j,a*=k,b*=k,f[g]=e.x+a,f[g+1]=e.y+b,f[g+2]=e.x-a,f[g+3]=e.y-b,h=e;this.buffers[0].update()}},a.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},a}(aI),ia=function(b){function c(d,f,c){void 0===c&&(c=0);var e=this,g=new dH(d.height,f,c),h=new ao(d);return c>0&&(d.baseTexture.wrapMode=a.WRAP_MODES.REPEAT),(e=b.call(this,g,h)||this).autoUpdate=!0,e}return ak(c,b),c.prototype._render=function(c){var a=this.geometry;(this.autoUpdate||a._width!==this.shader.texture.height)&&(a._width=this.shader.texture.height,a.update()),b.prototype._render.call(this,c)},c}(ah),dG=function(b){function a(a,e,f){var d=this,g=new dI(a.width,a.height,e,f),h=new ao(c.WHITE);return(d=b.call(this,g,h)||this).texture=a,d.autoResize=!0,d}return ak(a,b),a.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var a=this.geometry,b=this.shader.texture,c=b.width,d=b.height;!this.autoResize||a.width===c&&a.height===d||(a.width=this.shader.texture.width,a.height=this.shader.texture.height,a.build())},Object.defineProperty(a.prototype,"texture",{get:function(){return this.shader.texture},set:function(a){this.shader.texture!==a&&(this.shader.texture=a,this._textureID=-1,a.baseTexture.valid?this.textureUpdated():a.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),a.prototype._render=function(a){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),b.prototype._render.call(this,a)},a.prototype.destroy=function(a){this.shader.texture.off("update",this.textureUpdated,this),b.prototype.destroy.call(this,a)},a}(ah),ic=function(b){function a(a,j,g,h,i){var d,e,f;return void 0===a&&(a=c.EMPTY),d=this,e=new aI(j,g,h),e.getBuffer("aVertexPosition").static=!1,f=new ao(a),(d=b.call(this,e,f,null,i)||this).autoUpdate=!0,d}return ak(a,b),Object.defineProperty(a.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(a){this.geometry.getBuffer("aVertexPosition").data=a},enumerable:!1,configurable:!0}),a.prototype._render=function(a){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),b.prototype._render.call(this,a)},a}(ah),id=function(b){function a(d,e,f,g,h){void 0===e&&(e=10),void 0===f&&(f=10),void 0===g&&(g=10),void 0===h&&(h=10);var a=b.call(this,c.WHITE,4,4)||this;return a._origWidth=d.orig.width,a._origHeight=d.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=e,a._rightWidth=g,a._topHeight=f,a._bottomHeight=h,a.texture=d,a}return ak(a,b),a.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(a.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(a){this.geometry.getBuffer("aVertexPosition").data=a},enumerable:!1,configurable:!0}),a.prototype.updateHorizontalVertices=function(){var a=this.vertices,b=this._getMinScale();a[9]=a[11]=a[13]=a[15]=this._topHeight*b,a[17]=a[19]=a[21]=a[23]=this._height-this._bottomHeight*b,a[25]=a[27]=a[29]=a[31]=this._height},a.prototype.updateVerticalVertices=function(){var a=this.vertices,b=this._getMinScale();a[2]=a[10]=a[18]=a[26]=this._leftWidth*b,a[4]=a[12]=a[20]=a[28]=this._width-this._rightWidth*b,a[6]=a[14]=a[22]=a[30]=this._width},a.prototype._getMinScale=function(){var a=this._leftWidth+this._rightWidth,c=this._width>a?1:this._width/a,b=this._topHeight+this._bottomHeight,d=this._height>b?1:this._height/b;return Math.min(c,d)},Object.defineProperty(a.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(a){this._leftWidth=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(a){this._rightWidth=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"topHeight",{get:function(){return this._topHeight},set:function(a){this._topHeight=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(a){this._bottomHeight=a,this._refresh()},enumerable:!1,configurable:!0}),a.prototype._refresh=function(){var b=this.texture,a=this.geometry.buffers[1].data,c,d;this._origWidth=b.orig.width,this._origHeight=b.orig.height,c=1/this._origWidth,d=1/this._origHeight,a[0]=a[8]=a[16]=a[24]=0,a[1]=a[3]=a[5]=a[7]=0,a[6]=a[14]=a[22]=a[30]=1,a[25]=a[27]=a[29]=a[31]=1,a[2]=a[10]=a[18]=a[26]=c*this._leftWidth,a[4]=a[12]=a[20]=a[28]=1-c*this._rightWidth,a[9]=a[11]=a[13]=a[15]=d*this._topHeight,a[17]=a[19]=a[21]=a[23]=1-d*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},a}(dG),dC=function(a,b){return dC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dC(a,b)},ig=function(d){function b(b,e){void 0===e&&(e=!0);var a=d.call(this,b[0]instanceof c?b[0]:b[0].texture)||this;return a._textures=null,a._durations=null,a._autoUpdate=e,a._isConnectedToTicker=!1,a.animationSpeed=1,a.loop=!0,a.updateAnchor=!1,a.onComplete=null,a.onFrameChange=null,a.onLoop=null,a._currentTime=0,a._playing=!1,a._previousFrame=null,a.textures=b,a}return function(b,a){function c(){this.constructor=b}dC(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,d),b.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1))},b.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(o.shared.add(this.update,this,a.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},b.prototype.gotoAndStop=function(a){this.stop();var b=this.currentFrame;this._currentTime=a,b!==this.currentFrame&&this.updateTexture()},b.prototype.gotoAndPlay=function(a){var b=this.currentFrame;this._currentTime=a,b!==this.currentFrame&&this.updateTexture(),this.play()},b.prototype.update=function(e){var c,b,a,d;if(this._playing){if(c=this.animationSpeed*e,b=this.currentFrame,null!==this._durations){a=this._currentTime%1*this._durations[this.currentFrame];for(a+=c/60*1e3;a<0;)this._currentTime--,a+=this._durations[this.currentFrame];d=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);a>=this._durations[this.currentFrame];)a-=this._durations[this.currentFrame]*d,this._currentTime+=d;this._currentTime+=a/this._durations[this.currentFrame]}else this._currentTime+=c;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):b!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrameb)&&this.onLoop(),this.updateTexture())}},b.prototype.updateTexture=function(){var a=this.currentFrame;this._previousFrame!==a&&(this._previousFrame=a,this._texture=this._textures[a],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},b.prototype.destroy=function(a){this.stop(),d.prototype.destroy.call(this,a),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},b.fromFrames=function(d){for(var e=[],a=0;a=2*Math.PI?this.drawCircle(c,d,f).beginHole().drawCircle(c,d,e).endHole():(this.finishPoly(),this.arc(c,d,e,b,a,!0).arc(c,d,f,a,b,!1).finishPoly(),this)}},drawChamferRect:{value:function(d,e,h,i,j){if(j<=0)return this.drawRect(d,e,h,i);for(var a=Math.min(j,Math.min(h,i)/2),f=d+h,g=e+i,b=[d+a,e,f-a,e,f,e+a,f,g-a,f-a,g,d+a,g,d,g-a,d,e+a],c=b.length-1;c>=2;c-=2)b[c]===b[c-2]&&b[c-1]===b[c-3]&&b.splice(c-1,2);return this.drawPolygon(b)}},drawFilletRect:{value:function(b,c,g,i,k){if(0===k)return this.drawRect(b,c,g,i);var j=Math.min(g,i)/2,h=Math.min(j,Math.max(-j,k)),f=b+g,e=c+i,d=h<0?-h:0,a=Math.abs(h);return this.moveTo(b,c+a).arcTo(b+d,c+d,b+a,c,a).lineTo(f-a,c).arcTo(f-d,c+d,f,c+a,a).lineTo(f,e-a).arcTo(f-d,e-d,b+g-a,e,a).lineTo(b+a,e).arcTo(b+d,e-d,b,e-a,a).closePath()}},drawRegularPolygon:{value:function(i,j,h,b,d){var g,f,c,a,e;void 0===d&&(d=0),b=Math.max(0|b,3);for(g=-1*Math.PI/2+d,f=2*Math.PI/b,c=[],a=0;a{if(typeof b!="object")return a;for(let c of Object.keys(b))a[c]=b[c];return a},kagura=function(){const a={Kagura:class{constructor(b){b=objSafe({element:null,fps:30,width:null,height:null,StartScene:a.Scene,backgroundColor:"#000",autoFpsControl:!0,autoViewSize:!1},b),this.options=b;const c={view:b.element,width:b.width,height:b.height,backgroundColor:b.backgroundColor};this.app=new PIXI.Application(c),this.app.renderer.resize(b.width,b.height),this.view=this.app.view,this.grid=new a.Grid(32,this.view.width,this.view.height);let d=b.StartScene;this.scene=this.newClass(d),b.autoViewSize&&(scaleToWindow(this.app.view),window.addEventListener("resize",()=>{scaleToWindow(this.app.view)})),this.keyboard=new a.Keyboard(document),this.touchs=new a.Touches(this.view),b.autoFpsControl&&(this.fpsHistory=[]),this.backgroundColor=b.backgroundColor,this.backFlameTime=new Date}roop(){let b=(new Date).getTime()-this.backFlameTime.getTime();if(this.backFlameTime=new Date,this.sceneFlame++,this.grid.w=this.app.view.width,this.grid.h=this.app.view.height,this.scene.update({sceneFlame:this.sceneFlame,sceneTime:((new Date).getTime()-this.sceneStartTime.getTime())/1e3,fps:1e3/b,deltaTime:b,deltaFlame:b/(1e3/this.options.fps),keyboard:this.keyboard,pointers:this.touchs.get}),this.scene.nextScene!==!1){let a=this.app;this.app.stage.children=[],this.scene=this.newClass(this.scene.nextScene,this.scene.passValue)}this.app.renderer.backgroundColor=this.scene.backgroundColor;let a;if(this.options.autoFpsControl){this.fpsHistory.push(1e3/b),this.fpsHistory.length===10&&this.fpsHistory.shift();let c=this.fpsHistory.reduce((a,b)=>a+b)/this.fpsHistory.length;a=this.options.fps,a*=a/c}else a=this.options.fps;setTimeout(this.roop.bind(this),1e3/a)}newClass(a,b={}){return this.sceneFlame=0,this.sceneStartTime=new Date,a.prototype.app=this.app,a.prototype.width=this.app.renderer.width,a.prototype.height=this.app.renderer.height,a.prototype.backgroundColor=this.options.backgroundColor,a.prototype.grid=this.grid,new a({catches:b})}mainroop(){requestAnimationFrame(this.roop.bind(this))}fullscreen(){a.FullScreen(document)}},Scene:class{constructor(a){this.nextScene=!1,this.stage=this.app.stage,this.renderer=this.app.renderer}exit(a,b){this.passValue=b,this.nextScene=a}update(a){}addChild(...a){return this.app.stage.addChild(...a)}},obj:{shape:{isNewTest:""}},Boxer:class{constructor(a){for(let b of Object.keys(a))this[b]=a[b]}},fullscreen:function(a){a||(a=document.documentElement);function b(a,b){return b in a}b(a,"webkitRequestFullscreen")?a.webkitRequestFullscreen():b(a,"requestFullscreen")?a.requestFullscreen():b(a,"mozRequestFullScreen")&&a.mozRequestFullScreen()},pixi:PIXI,api:{}};return a.exitFullscreen=Document.exitFullscreen,a.Grid=class{constructor(a,b,c){this.n=a,this._w=b,this._h=c,this.ud(),this.x=function(a){return this.vw*a+this.w/2},this.y=function(a){return this.vh*a+this.h/2}}xy(a,b){return{x:this.vw*a+this._w/2,y:this.vh*b+this._h/2}}ud(){this.vw=this._w/(2*this.n),this.vh=this._h/(2*this.n),this.c={x:this._w/2,y:this._h/2}}set w(a){this._w=a,this.ud()}set h(a){this._h=a,this.ud()}get w(){return this._w}get h(){return this._h}lxy(a,b){return Object.values(this.xy(a,b))}},a.browser=function(a){return a=a.toLowerCase(),a.indexOf('msie')!=-1||a.indexOf('trident')!=-1?'ie':a.indexOf('edge')!=-1?'edge':a.indexOf('chrome')!=-1?'chrome':a.indexOf('safari')!=-1?'safari':a.indexOf('firefox')!=-1?'firefox':a.indexOf('opera')!=-1?'opera':''}(window.navigator.userAgent),a.Timer=class{constructor(a){this._startTime=new Date,this.unit=a}get time(){return this.unit*((new Date).getTime()-this._startTime.getTime())}},a.Sounder=class{constructor(a){this.url=a}make(a=!0){return new class{constructor(a,b=!0){this.elem=document.createElement("audio"),this.elem.src=a,b&&this.elem.addEventListener("ended",()=>{this.kill()})}play(){this.elem.play()}pause(){this.elem.pause()}get time(){return this.elem.currentTime}set time(a){this.elem.currentTime=a}get max(){return this.elem.max}set max(a){this.elem.max=a}get volume(){return this.elem.volume}set volume(a){this.elem.volume=a}get ended(){return this.elem.ended}get speed(){return this.elem.playbackRate}set speed(a){this.elem.playbackRate=a}kill(){this.elem.remove(),delete this.elem}}(this.url,a)}},a.obj.Object=class{constructor(a){this.obj=a;for(let a of Object.getOwnPropertyNames(this.obj)){let b=Object.getOwnPropertyDescriptor(this.obj,a);Object.defineProperty(this,a,{get:function(){return this.obj[a]},set:function(b){this.obj[a]=b}})}this.__proto__=this.obj.__proto__,Object.assign(this.__proto__,{addChildTo:function(a){return a.addChild(this.obj),this}})}},a.obj.Text=class extends a.obj.Object{constructor(b){b=objSafe({text:"",x:0,y:0,fill:16777215,align:"left",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",stroke:"black",strokeThickness:0,anchor:{x:0,y:0},options:{}},b),b.options=objSafe({fill:b.fill,align:b.align,fontFamily:b.fontFamily,fontSize:b.fontSize,fontVariant:b.fontVariant,fontWeight:b.fontWeight,stroke:b.stroke,strokeThickness:b.strokeThickness},b.options),super(new a.pixi.Text(b.text,b.options)),this.obj.x=b.x,this.obj.y=b.y}},a.obj.Group=class extends PIXI.Container{constructor(a){a=objSafe({x:0,y:0,rotation:0,alpha:1},a),super(),this.x=a.x,this.y=a.y,this.rotation=a.rotation,this.alpha=a.alpha}addChildTo(a){return a.addChild(this),this}each(b){let a=[];return this.children.forEach((c,d)=>{const e=b.call(c,c,d);e===!0&&a.push(d)}),a.reverse().forEach(a=>this.children.splice(a,1)),this}},a.obj.shape.GraphicsProto=class extends a.obj.Object{constructor(a){super(new PIXI.Graphics),a=objSafe({x:0,y:0,rotation:0,alpha:1,scale:{x:1,y:1}},a),this.obj.x=a.x,this.obj.y=a.y,this.obj.rotation=a.rotation,this.obj.alpha=a.alpha,this.obj.scale=a.scale}},a.obj.shape.GraphicsFill=class extends a.obj.shape.GraphicsProto{constructor(a,b){a=objSafe({fill:16777215},a),super(a),this.draw=b,this.options=a,this.obj.beginFill(a.fill),this.draw(this.obj,this.options),this.obj.pivot.x=0,this.obj.pivot.y=0}set fill(a){this.obj.clear(),this.obj.beginFill(a),this.draw(this.obj,this.options)}},a.obj.shape.Circle=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({radius:10},a),super(a,(a,b)=>{a.drawCircle(0,0,b.radius).endFill()})}get radius(){return this.obj.radius}set radius(a){this.obj.radius=a}},a.obj.shape.Ellipse=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({width:10,height:10},a),super(a,(b,a)=>{b.drawEllipse(0,0,a.width,a.height).endFill()})}},a.obj.shape.Path=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({paths:[[100,0],[70,70],[0,100],[-70,70],[-100,0],[-70,-70],[0,-100],[70,-70]]},a),super(a,(b,c)=>{let a=[];for(let b of c.paths)if(b.length===2&&Array.isArray(b))a.push(b[0],b[1]);else{console.error("Paths's arguments type is array, and children array's length is 2.");return}b.drawPolygon(a).endFill()})}},a.obj.shape.Rect=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({width:100,height:100,fillet:0},a),super(a,(b,a)=>{b.drawFilletRect(0,0,a.width,a.height,a.fillet).endFill()})}},a.obj.shape.Polygon=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({radius:10,sides:1,corner:1},a),super(a,(b,a)=>{b.drawRoundedPolygon(0,0,a.radius,a.sides,a.corner,0).endFill()})}},a.obj.shape.Star=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({points:5,radius:10,innerRadius:20},a),super(a,(b,a)=>{b.drawStar(0,0,a.points,a.radius,a.innerRadius,0).endFill()})}},a.obj.shape.Torus=class extends a.obj.shape.GraphicsFill{constructor(a){a=objSafe({points:5,radius:10,innerRadius:0,outerRadius:Math.PI*2},a),super(a,(b,a)=>{b.drawTorus(0,0,a.innerRadius,a.outerRadius,a.startArc,a.endArc).endFill()})}},a.obj.shape.Line=class extends a.obj.shape.GraphicsProto{constructor(a){a=objSafe({color:16777215,paths:[[0,0],[10,10]],size:1},a),super(a),this.options=a,Object.defineProperty(this,"color",{set:function(a){this.options.color=a,this.draw()}}),this.draw=()=>{const a=this.options;this.clear(),this.lineStyle(a.size,a.color);let b=0;for(let c of a.paths)if(b++,c.length===2&&Array.isArray(c))b===1&&this.moveTo(...c),this.lineTo(...c);else{console.error("Paths's arguments type is array, and children array's length is 2.");return}},this.draw()}},a.Loader=class{constructor(b,c){if(!b){console.error("Loads arguments is undefined.");return}this.assets={},c||(c=function(){}),this.loaded=c,this.loader=new a.pixi.Loader,this.loadedXhr={__pixiLoaded__:!1},Object.keys(b).forEach(a=>{this.loadedXhr[a]=!1});for(const d of Object.keys(b)){const e=b[d];this.loader.add(d,e),this.assets[d]={get text(){return this._text.result},get json(){try{return JSON.parse(this.text)}catch{return void 0}}};let c=new XMLHttpRequest;c.onreadystatechange=()=>{if(c.readyState==4&&c.status==200){const b=this.assets[d];b.blobObj=c.response,b.blob=window.URL.createObjectURL(c.response),b.image=new Image(b.blob),b.sound=new Audio(b.blob),b.url=c.responseURL,b._text=new FileReader,b._text.readAsText(b.blobObj),b.sounder=new a.Sounder(b.blob)}setTimeout(()=>this.loadedOneXhr(d),0)},c.responseType="blob",c.open('GET',e,!0),c.send()}this.loader.load(()=>{for(const c of Object.keys(this.loader.resources)){const a=this.loader.resources[c],b=this.assets[c];b.pixiLoad=a,b.texture=a.texture,b.textures=a.textures}this.loadedOneXhr("__pixiLoaded__")})}get(a){return this.assets[a]}loadedOneXhr(a){this.loadedXhr[a]=!0,Object.values(this.loadedXhr).reduce((a,b)=>a&&b)&&this.loaded(this.assets,this)}},a.obj.Sprite=class extends a.pixi.Sprite{constructor(a){super(),a=objSafe({texture:void 0,alpha:1,x:0,y:0,width:this.width,height:this.height},a),this.texture=a.texture,this.alpha=a.alpha,this.x=a.x,this.y=a.y}addChildTo(a){return a.addChild(this),this}},a.Keyboard=class{constructor(a=document){this.keys=[],this.elem=a,this.keycodes={0:{id:0,key:["",""],code:""},1:{id:1,key:["unidentified",""],code:""},2:{id:2,key:["",""],code:""},3:{id:3,key:["cancel",""],code:"pause"},4:{id:4,key:["",""],code:""},5:{id:5,key:["",""],code:""},6:{id:6,key:["",""],code:""},7:{id:7,key:["",""],code:""},8:{id:8,key:["backspace",""],code:"backspace"},9:{id:9,key:["tab",""],code:"tab"},10:{id:10,key:["",""],code:""},11:{id:11,key:["",""],code:""},12:{id:12,key:["clear",""],code:"numlock"},13:{id:13,key:["enter",""],code:"enter"},14:{id:14,key:["",""],code:""},15:{id:15,key:["",""],code:""},16:{id:16,key:["shift",""],code:"shiftleft"},17:{id:17,key:["control",""],code:"controlleft"},18:{id:18,key:["alt",""],code:"altleft"},19:{id:19,key:["pause",""],code:"pause"},20:{id:20,key:["capslock",""],code:"capslock"},21:{id:21,key:["unidentified",""],code:"lang1"},22:{id:22,key:["",""],code:""},23:{id:23,key:["",""],code:""},24:{id:24,key:["",""],code:""},25:{id:25,key:["unidentified",""],code:"lang2"},26:{id:26,key:["",""],code:""},27:{id:27,key:["escape",""],code:"escape"},28:{id:28,key:["",""],code:""},29:{id:29,key:["",""],code:""},30:{id:30,key:["",""],code:""},31:{id:31,key:["",""],code:""},32:{id:32,key:[" ",""],code:"space"},33:{id:33,key:["pageup",""],code:"numpad9"},34:{id:34,key:["pagedown",""],code:"numpad3"},35:{id:35,key:["end",""],code:"numpad1"},36:{id:36,key:["home",""],code:"numpad7"},37:{id:37,key:["arrowleft",""],code:"arrowleft"},38:{id:38,key:["arrowup",""],code:"arrowup"},39:{id:39,key:["arrowright",""],code:"arrowright"},40:{id:40,key:["arrowdown",""],code:"arrowdown"},41:{id:41,key:["",""],code:""},42:{id:42,key:["",""],code:""},43:{id:43,key:["",""],code:""},44:{id:44,key:["f13",""],code:"f13"},45:{id:45,key:["insert",""],code:"numpad0"},46:{id:46,key:["delete",""],code:"numpaddecimal"},47:{id:47,key:["",""],code:""},48:{id:48,key:["0",""],code:"digit0"},49:{id:49,key:["1",""],code:"digit1"},50:{id:50,key:["2",""],code:"digit2"},51:{id:51,key:["3",""],code:"digit3"},52:{id:52,key:["4",""],code:"digit4"},53:{id:53,key:["5",""],code:"digit5"},54:{id:54,key:["6",""],code:"digit6"},55:{id:55,key:["7",""],code:"digit7"},56:{id:56,key:["8",""],code:"digit8"},57:{id:57,key:["9",""],code:"digit9"},58:{id:58,key:[":",""],code:"period"},59:{id:59,key:[";",""],code:"semicolon"},60:{id:60,key:["<",""],code:"backquote"},61:{id:61,key:["=",""],code:"equal"},62:{id:62,key:["",""],code:""},63:{id:63,key:["\u03b2",""],code:"minus"},64:{id:64,key:["",""],code:""},65:{id:65,key:["a",""],code:"keya"},66:{id:66,key:["b",""],code:"keyb"},67:{id:67,key:["c",""],code:"keyc"},68:{id:68,key:["d",""],code:"keyd"},69:{id:69,key:["e",""],code:"keye"},70:{id:70,key:["f",""],code:"keyf"},71:{id:71,key:["g",""],code:"keyg"},72:{id:72,key:["h",""],code:"keyh"},73:{id:73,key:["i",""],code:"keyi"},74:{id:74,key:["j",""],code:"keyj"},75:{id:75,key:["k",""],code:"keyk"},76:{id:76,key:["l",""],code:"keyl"},77:{id:77,key:["m",""],code:"keym"},78:{id:78,key:["n",""],code:"keyn"},79:{id:79,key:["o",""],code:"keyo"},80:{id:80,key:["p",""],code:"keyp"},81:{id:81,key:["q",""],code:"keyq"},82:{id:82,key:["r",""],code:"keyr"},83:{id:83,key:["s",""],code:"keys"},84:{id:84,key:["t",""],code:"keyt"},85:{id:85,key:["u",""],code:"keyu"},86:{id:86,key:["v",""],code:"keyv"},87:{id:87,key:["w",""],code:"keyw"},88:{id:88,key:["x",""],code:"keyx"},89:{id:89,key:["y",""],code:"keyy"},90:{id:90,key:["z",""],code:"keyz"},91:{id:91,key:["meta",""],code:"metaleft"},92:{id:92,key:["meta",""],code:"metaright"},93:{id:93,key:["contextmenu",""],code:"contextmenu"},94:{id:94,key:["",""],code:""},95:{id:95,key:["",""],code:""},96:{id:96,key:["0",""],code:"numpad0"},97:{id:97,key:["1",""],code:"numpad1"},98:{id:98,key:["2",""],code:"numpad2"},99:{id:99,key:["3",""],code:"numpad3"},100:{id:100,key:["4",""],code:"numpad4"},101:{id:101,key:["5",""],code:"numpad5"},102:{id:102,key:["6",""],code:"numpad6"},103:{id:103,key:["7",""],code:"numpad7"},104:{id:104,key:["8",""],code:"numpad8"},105:{id:105,key:["9",""],code:"numpad9"},106:{id:106,key:["*",""],code:"numpadmultiply"},107:{id:107,key:["+",""],code:"numpadadd"},108:{id:108,key:[",",""],code:"numpaddecimal"},109:{id:109,key:["-",""],code:"numpadsubtract"},110:{id:110,key:[".",""],code:"numpaddecimal"},111:{id:111,key:["/",""],code:"numpaddivide"},112:{id:112,key:["f1",""],code:"f1"},113:{id:113,key:["f2",""],code:"f2"},114:{id:114,key:["f3",""],code:"f3"},115:{id:115,key:["f4",""],code:"f4"},116:{id:116,key:["f5",""],code:"f5"},117:{id:117,key:["f6",""],code:"f6"},118:{id:118,key:["f7",""],code:"f7"},119:{id:119,key:["f8",""],code:"f8"},120:{id:120,key:["f9",""],code:"f9"},121:{id:121,key:["f10",""],code:"f10"},122:{id:122,key:["f11",""],code:"f11"},123:{id:123,key:["f12",""],code:"f12"},124:{id:124,key:["f13",""],code:"f13"},125:{id:125,key:["f14",""],code:"f14"},126:{id:126,key:["f15",""],code:"f15"},127:{id:127,key:["f16",""],code:"f16"},128:{id:128,key:["f17",""],code:"f17"},129:{id:129,key:["f18",""],code:"f18"},130:{id:130,key:["f19",""],code:"f19"},131:{id:131,key:["f20",""],code:"f20"},132:{id:132,key:["f21",""],code:"f21"},133:{id:133,key:["f22",""],code:"f22"},134:{id:134,key:["f23",""],code:"f23"},135:{id:135,key:["f24",""],code:"f24"},136:{id:136,key:["f25",""],code:"f25"},137:{id:137,key:["f26",""],code:"f26"},138:{id:138,key:["f27",""],code:"f27"},139:{id:139,key:["f28",""],code:"f28"},140:{id:140,key:["f29",""],code:"f29"},141:{id:141,key:["f30",""],code:"f30"},142:{id:142,key:["f31",""],code:"f31"},143:{id:143,key:["f32",""],code:"f32"},144:{id:144,key:["numlock",""],code:"numlock"},145:{id:145,key:["scrolllock",""],code:"scrolllock"},146:{id:146,key:["",""],code:""},147:{id:147,key:["",""],code:""},148:{id:148,key:["",""],code:""},149:{id:149,key:["",""],code:""},150:{id:150,key:["",""],code:""},151:{id:151,key:["",""],code:""},152:{id:152,key:["",""],code:""},153:{id:153,key:["",""],code:""},154:{id:154,key:["",""],code:""},155:{id:155,key:["",""],code:""},156:{id:156,key:["",""],code:""},157:{id:157,key:["",""],code:""},158:{id:158,key:["",""],code:""},159:{id:159,key:["",""],code:""},160:{id:160,key:["[",""],code:"blacketleft"},161:{id:161,key:["dead",""],code:"blacketright"},162:{id:162,key:["",""],code:""},163:{id:163,key:["\\",""],code:"backquote"},164:{id:164,key:["$",""],code:"backslash"},165:{id:165,key:["^\u00f9",""],code:"quote"},166:{id:166,key:["",""],code:""},167:{id:167,key:["",""],code:""},168:{id:168,key:["",""],code:""},169:{id:169,key:[")",""],code:"minus"},170:{id:170,key:["*",""],code:"backslash"},171:{id:171,key:["+",""],code:"bracketright"},172:{id:172,key:["",""],code:""},173:{id:173,key:["-",""],code:"minus"},174:{id:174,key:["audiovolumedown",""],code:""},175:{id:175,key:["audiovolumeup",""],code:""},176:{id:176,key:["mediatracknext",""],code:"mediatracknext"},177:{id:177,key:["mediatrackprevious",""],code:"mediatrackprevious"},178:{id:178,key:["",""],code:""},179:{id:179,key:["mediaplaypause",""],code:""},180:{id:180,key:["launchmail",""],code:""},181:{id:181,key:["audiovolumemute",""],code:"volumemute"},182:{id:182,key:["audiovolumedown",""],code:"volumedown"},183:{id:183,key:["audiovolumeup",""],code:"volumeup"},184:{id:184,key:["",""],code:""},185:{id:185,key:["",""],code:""},186:{id:186,key:[";",""],code:"semicolon"},187:{id:187,key:["+",""],code:"equal"},188:{id:188,key:[",",""],code:"comma"},189:{id:189,key:["-",""],code:"minus"},190:{id:190,key:[".",""],code:"period"},191:{id:191,key:["/","?"],code:"slash"},192:{id:192,key:["`",""],code:"backquote"},193:{id:193,key:["/",""],code:"intlro"},194:{id:194,key:[".",""],code:"numpadcomma"},195:{id:195,key:["",""],code:""},196:{id:196,key:["",""],code:""},197:{id:197,key:["",""],code:""},198:{id:198,key:["",""],code:""},199:{id:199,key:["",""],code:""},200:{id:200,key:["",""],code:""},201:{id:201,key:["",""],code:""},202:{id:202,key:["",""],code:""},203:{id:203,key:["",""],code:""},204:{id:204,key:["",""],code:""},205:{id:205,key:["",""],code:""},206:{id:206,key:["",""],code:""},207:{id:207,key:["",""],code:""},208:{id:208,key:["",""],code:""},209:{id:209,key:["",""],code:""},210:{id:210,key:["",""],code:""},211:{id:211,key:["",""],code:""},212:{id:212,key:["",""],code:""},213:{id:213,key:["",""],code:""},214:{id:214,key:["",""],code:""},215:{id:215,key:["",""],code:""},216:{id:216,key:["",""],code:""},217:{id:217,key:["",""],code:""},218:{id:218,key:["",""],code:""},219:{id:219,key:["[",""],code:"blacketleft"},220:{id:220,key:["\\",""],code:"backslash"},221:{id:221,key:["]",""],code:"bracketright"},222:{id:222,key:["'",""],code:"quote"},223:{id:223,key:["`",""],code:"backquote"},224:{id:224,key:["meta",""],code:"osleft"},225:{id:225,key:["altgraph",""],code:"altright"},226:{id:226,key:["\\",""],code:"intlbackslash"},227:{id:227,key:["",""],code:""},228:{id:228,key:["",""],code:""},229:{id:229,key:["",""],code:""},230:{id:230,key:["",""],code:""},231:{id:231,key:["",""],code:""},232:{id:232,key:["",""],code:""},233:{id:233,key:["",""],code:""},234:{id:234,key:["",""],code:""},235:{id:235,key:["",""],code:""},236:{id:236,key:["",""],code:""},237:{id:237,key:["",""],code:""},238:{id:238,key:["",""],code:""},239:{id:239,key:["",""],code:""},240:{id:240,key:["",""],code:""},241:{id:241,key:["",""],code:""},242:{id:242,key:["",""],code:""},243:{id:243,key:["",""],code:""},244:{id:244,key:["",""],code:""},245:{id:245,key:["",""],code:""},246:{id:246,key:["",""],code:""},247:{id:247,key:["",""],code:""},248:{id:248,key:["",""],code:""},249:{id:249,key:["",""],code:""},250:{id:250,key:["",""],code:""},251:{id:251,key:["",""],code:""},252:{id:252,key:["",""],code:""},253:{id:253,key:["",""],code:""},254:{id:254,key:["",""],code:""},255:{id:255,key:["unidentified",""],code:"wakeup"}},a.addEventListener("keydown",a=>{this.addkey(a.keyCode)}),a.addEventListener("keyup",b=>{const a=this.keys.indexOf(b.keyCode);a!==-1&&this.keys.splice(a,1)})}addkey(a){this.keys.includes(a)||this.keys.push(a)}delkey(b){const a=this.keys.indexOf(b);a!==-1&&this.keys.splice(a,1)}metaKey(a){a.shiftKey===!0?this.addkey("shift"):this.delkey("shift")}get allKeys(){let a=[];for(let c of this.keys){const b=this.keycodes[c];a.push(b.code),a.push(b.id),a=a.concat(b.key)}return a}isDown(a){return this.allKeys.includes(a)}},a.Touches=class{constructor(a=document){this.mouse={x:0,y:0,down:!1},this.touches={},this.lastPointer={x:0,y:0},a.addEventListener('mousemove',a=>{this.mouse.x=a.clientX,this.mouse.y=a.clientY}),a.addEventListener("mousedown",a=>{this.mouse.x=a.clientX,this.mouse.y=a.clientY,this.mouse.down=!0}),a.addEventListener("mouseup",a=>{this.mouse.x=a.clientX,this.mouse.y=a.clientY,this.mouse.down=!1}),a.addEventListener("touchstart",a=>{for(let c=0;c{for(let b=0;b{for(let c=0;c1&&a.preventDefault()}),a.addEventListener("touchcancel",a=>{for(let b=0;b=0&&c<=1){if(b._volume=c,b._muted)return b;b.usingWebAudio&&b.masterGain.gain.setValueAtTime(c,a.ctx.currentTime);for(d=0;d=0;c--)b._howls[c].unload();return b.usingWebAudio&&b.ctx&&void 0!==b.ctx.close&&(b.ctx.close(),b.ctx=null,f()),b},codecs:function(b){return(this||a)._codecs[b.replace(/^x-/,"")]},_setup:function(){var b=this||a,c;if(b.state=b.ctx?b.ctx.state||"suspended":"suspended",b._autoSuspend(),!b.usingWebAudio)if("undefined"!=typeof Audio)try{c=new Audio,void 0===c.oncanplaythrough&&(b._canPlayEvent="canplay")}catch(a){b.noAudio=!0}else b.noAudio=!0;try{c=new Audio,c.muted&&(b.noAudio=!0)}catch(a){}return b.noAudio||b._setupCodecs(),b},_setupCodecs:function(){var c=this||a,b=null,e,d,f,i,j,g,h;try{b="undefined"!=typeof Audio?new Audio:null}catch(a){return c}return!b||"function"!=typeof b.canPlayType?c:(e=b.canPlayType("audio/mpeg;").replace(/^no$/,""),d=c._navigator?c._navigator.userAgent:"",f=d.match(/OPR\/([0-6].)/g),i=f&&parseInt(f[0].split("/")[1],10)<33,j=-1!==d.indexOf("Safari")&&-1===d.indexOf("Chrome"),g=d.match(/Version\/(.*?) /),h=j&&g&&parseInt(g[1],10)<15,c._codecs={mp3:!(i||!e&&!b.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!e,opus:!!b.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!b.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!b.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(b.canPlayType('audio/wav; codecs="1"')||b.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!b.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!b.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(b.canPlayType("audio/x-m4a;")||b.canPlayType("audio/m4a;")||b.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(b.canPlayType("audio/x-m4b;")||b.canPlayType("audio/m4b;")||b.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(b.canPlayType("audio/x-mp4;")||b.canPlayType("audio/mp4;")||b.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(h||!b.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(h||!b.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!b.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(b.canPlayType("audio/x-flac;")||b.canPlayType("audio/flac;")).replace(/^no$/,"")},c)},_unlockAudio:function(){var b=this||a,c;if(!b._audioUnlocked&&b.ctx)return b._audioUnlocked=!1,b.autoUnlock=!1,b._mobileUnloaded||44100===b.ctx.sampleRate||(b._mobileUnloaded=!0,b.unload()),b._scratchBuffer=b.ctx.createBuffer(1,1,22050),c=function(i){for(var g,d,h,f,e,a;b._html5AudioPool.length0?c._seek:b._sprite[e][0]/1e3),l=Math.max(0,(b._sprite[e][0]+b._sprite[e][1])/1e3-f),j=1e3*l/Math.abs(c._rate),s=b._sprite[e][0]/1e3,m=(b._sprite[e][0]+b._sprite[e][1])/1e3,c._sprite=e,c._ended=!1,k=function(){c._paused=!1,c._seek=f,c._start=s,c._stop=m,c._loop=!(!c._loop&&!b._sprite[e][2])},f>=m)?void b._ended(c):(d=c._node,b._webAudio?(p=function(){b._playLock=!1,k(),b._refreshBuffer(c);var e=c._muted||b._muted?0:c._volume;d.gain.setValueAtTime(e,a.ctx.currentTime),c._playStart=a.ctx.currentTime,void 0===d.bufferSource.start?c._loop?d.bufferSource.noteGrainOn(0,f,86400):d.bufferSource.noteGrainOn(0,f,l):c._loop?d.bufferSource.start(0,f,86400):d.bufferSource.start(0,f,l),j!==1/0&&(b._endTimers[c._id]=setTimeout(b._ended.bind(b,c),j)),i||setTimeout(function(){b._emit("play",c._id),b._loadQueue()},0)},"running"===a.state&&"interrupted"!==a.ctx.state?p():(b._playLock=!0,b.once("resume",p),b._clearTimer(c._id))):(q=function(){d.currentTime=f,d.muted=c._muted||b._muted||a._muted||d.muted,d.volume=c._volume*a.volume(),d.playbackRate=c._rate;try{var g=d.play();if(g&&"undefined"!=typeof Promise&&(g instanceof Promise||"function"==typeof g.then)?(b._playLock=!0,k(),g.then(function(){b._playLock=!1,d._unlocked=!0,i?b._loadQueue():b._emit("play",c._id)}).catch(function(){b._playLock=!1,b._emit("playerror",c._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),c._ended=!0,c._paused=!0})):i||(b._playLock=!1,k(),b._emit("play",c._id)),d.playbackRate=c._rate,d.paused)return void b._emit("playerror",c._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||c._loop?b._endTimers[c._id]=setTimeout(b._ended.bind(b,c),j):(b._endTimers[c._id]=function(){b._ended(c),d.removeEventListener("ended",b._endTimers[c._id],!1)},d.addEventListener("ended",b._endTimers[c._id],!1))}catch(a){b._emit("playerror",c._id,a)}},"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===d.src&&(d.src=b._src,d.load()),t=window&&window.ejecta||!d.readyState&&a._navigator.isCocoonJS,d.readyState>=3||t?q():(b._playLock=!0,b._state="loading",r=function(){b._state="loaded",q(),d.removeEventListener(a._canPlayEvent,r,!1)},d.addEventListener(a._canPlayEvent,r,!1),b._clearTimer(c._id))),c._id)},pause:function(e){var b=this,d,c,a;if("loaded"!==b._state||b._playLock)return b._queue.push({event:"pause",action:function(){b.pause(e)}}),b;for(d=b._getSoundIds(e),c=0;c=0?e=parseInt(c[0],10):f=parseFloat(c[0]):c.length>=2&&(f=parseFloat(c[0]),e=parseInt(c[1],10)),!(void 0!==f&&f>=0&&f<=1))return d=e?b._soundById(e):b._sounds[0],d?d._volume:0;if("loaded"!==b._state||b._playLock)return b._queue.push({event:"volume",action:function(){b.volume.apply(b,c)}}),b;void 0===e&&(b._volume=f),e=b._getSoundIds(e);for(g=0;g0?f/i:f),h=Date.now();b._fadeTo=c,b._interval=setInterval(function(){var i=(Date.now()-h)/f;h=Date.now(),a+=g*i,a=Math.round(100*a)/100,a=g<0?Math.max(c,a):Math.min(c,a),d._webAudio?b._volume=a:d.volume(a,b._id,!0),k&&(d._volume=a),(ce&&a>=c)&&(clearInterval(b._interval),b._interval=null,b._fadeTo=null,d.volume(c,b._id),d._emit("fade",b._id))},j)},_stopFade:function(d){var c=this,b=c._soundById(d);return b&&b._interval&&(c._webAudio&&b._node.gain.cancelScheduledValues(a.ctx.currentTime),clearInterval(b._interval),b._interval=null,c.volume(b._fadeTo,d),b._fadeTo=null,c._emit("fade",d)),c},loop:function(){var d,g,a,b=this,c=arguments,f,e;if(0===c.length)return b._loop;if(1===c.length){if("boolean"!=typeof c[0])return!!(a=b._soundById(parseInt(c[0],10)))&&a._loop;d=c[0],b._loop=d}else 2===c.length&&(d=c[0],g=parseInt(c[1],10));for(f=b._getSoundIds(g),e=0;e=0?d=parseInt(e[0],10):g=parseFloat(e[0])):2===e.length&&(g=parseFloat(e[0]),d=parseInt(e[1],10)),"number"!=typeof g)return c=b._soundById(d),c?c._rate:b._rate;if("loaded"!==b._state||b._playLock)return b._queue.push({event:"rate",action:function(){b.rate.apply(b,e)}}),b;void 0===d&&(b._rate=g),d=b._getSoundIds(d);for(f=0;f=0?d=parseInt(e[0],10):b._sounds.length&&(d=b._sounds[0]._id,f=parseFloat(e[0]))):2===e.length&&(f=parseFloat(e[0]),d=parseInt(e[1],10)),void 0===d)return 0;if("number"==typeof f&&("loaded"!==b._state||b._playLock))return b._queue.push({event:"seek",action:function(){b.seek.apply(b,e)}}),b;if(c=b._soundById(d),c){if(!("number"==typeof f&&f>=0))return b._webAudio?(j=b.playing(d)?a.ctx.currentTime-c._playStart:0,k=c._rateSeek?c._rateSeek-c._seek:0,c._seek+(k+j*Math.abs(c._rate))):c._node.currentTime;g=b.playing(d),g&&b.pause(d,!0),c._seek=f,c._ended=!1,b._clearTimer(d),b._webAudio||!c._node||isNaN(c._node.duration)||(c._node.currentTime=f),h=function(){g&&b.play(d,!0),b._emit("seek",d)},g&&!b._webAudio?(i=function(){b._playLock?setTimeout(i,0):h()},setTimeout(i,0)):h()}return b},playing:function(c){var a=this,d,b;if("number"==typeof c)return d=a._soundById(c),!!d&&!d._paused;for(b=0;b=0&&a._howls.splice(f,1),g=!0;for(c=0;c=0){g=!1;break}return b&&g&&delete b[e._src],a.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,a,b,c){var d=this,f=d["_on"+e];return"function"==typeof a&&f.push(c?{id:b,fn:a,once:c}:{id:b,fn:a}),d},off:function(f,b,g){var c=this,d=c["_on"+f],a=0,h,e;if("number"==typeof b&&(g=b,b=null),b||g){for(a=0;a=0;a--)b[a].id&&b[a].id!==e&&"load"!==d||(setTimeout(function(a){a.call(this,e,f)}.bind(c,b[a].fn),0),b[a].once&&c.off(d,b[a].fn,b[a].id));return c._loadQueue(d),c},_loadQueue:function(b){var a=this,c;return a._queue.length>0&&(c=a._queue[0],c.event===b&&(a._queue.shift(),a._loadQueue()),b||c.action()),a},_ended:function(b){var c=this,e=b._sprite,d,f;return!c._webAudio&&b._node&&!b._node.paused&&!b._node.ended&&b._node.currentTime=0;a--){if(c<=d)return;b._sounds[a]._ended&&(b._webAudio&&b._sounds[a]._node&&b._sounds[a]._node.disconnect(0),b._sounds.splice(a,1),c--)}}},_getSoundIds:function(b){var c=this,d,a;if(void 0===b){for(d=[],a=0;a=0;if(a._scratchBuffer&&b.bufferSource&&(b.bufferSource.onended=null,b.bufferSource.disconnect(0),d))try{b.bufferSource.buffer=a._scratchBuffer}catch(a){}return b.bufferSource=null,c},_clearSound:function(b){/MSIE |Trident\//.test(a._navigator&&a._navigator.userAgent)||(b.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}},d=function(a){this._parent=a,this.init()},d.prototype={init:function(){var b=this,c=b._parent;return b._muted=c._muted,b._loop=c._loop,b._volume=c._volume,b._rate=c._rate,b._seek=0,b._paused=!0,b._ended=!0,b._sprite="__default",b._id=++a._counter,c._sounds.push(b),b.create(),b},create:function(){var b=this,c=b._parent,d=a._muted||b._muted||b._parent._muted?0:b._volume;return c._webAudio?(b._node=void 0===a.ctx.createGain?a.ctx.createGainNode():a.ctx.createGain(),b._node.gain.setValueAtTime(d,a.ctx.currentTime),b._node.paused=!0,b._node.connect(a.masterGain)):a.noAudio||(b._node=a._obtainHtml5Audio(),b._errorFn=b._errorListener.bind(b),b._node.addEventListener("error",b._errorFn,!1),b._loadFn=b._loadListener.bind(b),b._node.addEventListener(a._canPlayEvent,b._loadFn,!1),b._endFn=b._endListener.bind(b),b._node.addEventListener("ended",b._endFn,!1),b._node.src=c._src,b._node.preload=!0===c._preload?"auto":c._preload,b._node.volume=d*a.volume(),b._node.load()),b},reset:function(){var b=this,c=b._parent;return b._muted=c._muted,b._loop=c._loop,b._volume=c._volume,b._rate=c._rate,b._seek=0,b._rateSeek=0,b._paused=!0,b._ended=!0,b._sprite="__default",b._id=++a._counter,b},_errorListener:function(){var a=this;a._parent._emit("loaderror",a._id,a._node.error?a._node.error.code:0),a._node.removeEventListener("error",a._errorFn,!1)},_loadListener:function(){var c=this,b=c._parent;b._duration=Math.ceil(10*c._node.duration)/10,0===Object.keys(b._sprite).length&&(b._sprite={__default:[0,1e3*b._duration]}),"loaded"!==b._state&&(b._state="loaded",b._emit("load"),b._loadQueue()),c._node.removeEventListener(a._canPlayEvent,c._loadFn,!1)},_endListener:function(){var b=this,a=b._parent;a._duration===1/0&&(a._duration=Math.ceil(10*b._node.duration)/10,a._sprite.__default[1]===1/0&&(a._sprite.__default[1]=1e3*a._duration),a._ended(b)),b._node.removeEventListener("ended",b._endFn,!1)}},b={},i=function(a){var d=a._src,f,i,e,c;if(b[d])return a._duration=b[d].duration,void h(a);if(/^data:[^;]+;base64,/.test(d)){for(f=atob(d.split(",")[1]),i=new Uint8Array(f.length),e=0;e0?(b[c._src]=a,h(c,a)):d()};"undefined"!=typeof Promise&&1===a.ctx.decodeAudioData.length?a.ctx.decodeAudioData(e).then(f).catch(d):a.ctx.decodeAudioData(e,f,d)},h=function(a,b){b&&!a._duration&&(a._duration=b.duration),0===Object.keys(a._sprite).length&&(a._sprite={__default:[0,1e3*a._duration]}),"loaded"!==a._state&&(a._state="loaded",a._emit("load"),a._loadQueue())},f=function(){var d,b,c,e;if(a.usingWebAudio){try{"undefined"!=typeof AudioContext?a.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?a.ctx=new webkitAudioContext:a.usingWebAudio=!1}catch(b){a.usingWebAudio=!1}a.ctx||(a.usingWebAudio=!1),d=/iP(hone|od|ad)/.test(a._navigator&&a._navigator.platform),b=a._navigator&&a._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),c=b?parseInt(b[1],10):null,d&&c&&c<9&&(e=/safari/.test(a._navigator&&a._navigator.userAgent.toLowerCase()),a._navigator&&!e&&(a.usingWebAudio=!1)),a.usingWebAudio&&(a.masterGain=void 0===a.ctx.createGain?a.ctx.createGainNode():a.ctx.createGain(),a.masterGain.gain.setValueAtTime(a._muted?0:a._volume,a.ctx.currentTime),a.masterGain.connect(a.ctx.destination)),a._setup()}},"function"==typeof define&&define.amd&&define([],function(){return{Howler:a,Howl:c}}),"undefined"!=typeof exports&&(exports.Howler=a,exports.Howl=c),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=a,global.Howl=c,global.Sound=d):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=a,window.Howl=c,window.Sound=d)}(),!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(c){var a=this,b;if(!a.ctx||!a.ctx.listener)return a;for(b=a._howls.length-1;b>=0;b--)a._howls[b].stereo(c);return a},HowlerGlobal.prototype.pos=function(d,b,c){var a=this;return a.ctx&&a.ctx.listener?(b="number"!=typeof b?a._pos[1]:b,c="number"!=typeof c?a._pos[2]:c,"number"!=typeof d?a._pos:(a._pos=[d,b,c],void 0!==a.ctx.listener.positionX?(a.ctx.listener.positionX.setTargetAtTime(a._pos[0],Howler.ctx.currentTime,.1),a.ctx.listener.positionY.setTargetAtTime(a._pos[1],Howler.ctx.currentTime,.1),a.ctx.listener.positionZ.setTargetAtTime(a._pos[2],Howler.ctx.currentTime,.1)):a.ctx.listener.setPosition(a._pos[0],a._pos[1],a._pos[2]),a)):a},HowlerGlobal.prototype.orientation=function(h,b,c,d,e,f){var a=this,g;return!a.ctx||!a.ctx.listener?a:(g=a._orientation,b="number"!=typeof b?g[1]:b,c="number"!=typeof c?g[2]:c,d="number"!=typeof d?g[3]:d,e="number"!=typeof e?g[4]:e,f="number"!=typeof f?g[5]:f,"number"!=typeof h?g:(a._orientation=[h,b,c,d,e,f],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(h,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(b,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(c,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(d,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(f,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(h,b,c,d,e,f),a))},Howl.prototype.init=function(a){return function(b){var c=this;return c._orientation=b.orientation||[1,0,0],c._stereo=b.stereo||null,c._pos=b.pos||null,c._pannerAttr={coneInnerAngle:void 0!==b.coneInnerAngle?b.coneInnerAngle:360,coneOuterAngle:void 0!==b.coneOuterAngle?b.coneOuterAngle:360,coneOuterGain:void 0!==b.coneOuterGain?b.coneOuterGain:0,distanceModel:void 0!==b.distanceModel?b.distanceModel:"inverse",maxDistance:void 0!==b.maxDistance?b.maxDistance:1e4,panningModel:void 0!==b.panningModel?b.panningModel:"HRTF",refDistance:void 0!==b.refDistance?b.refDistance:1,rolloffFactor:void 0!==b.rolloffFactor?b.rolloffFactor:1},c._onstereo=b.onstereo?[{fn:b.onstereo}]:[],c._onpos=b.onpos?[{fn:b.onpos}]:[],c._onorientation=b.onorientation?[{fn:b.onorientation}]:[],a.call(this,b)}}(Howl.prototype.init),Howl.prototype.stereo=function(d,e){var c=this,g,h,f,b;if(!c._webAudio)return c;if("loaded"!==c._state)return c._queue.push({event:"stereo",action:function(){c.stereo(d,e)}}),c;if(g=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo",void 0===e){if("number"!=typeof d)return c._stereo;c._stereo=d,c._pos=[d,0,0]}for(h=c._getSoundIds(e),f=0;fa.offsetHeight?a.offsetWidth*b-1,b}var b=function(a){"use strict";var ie=setTimeout,ep,hM,hK,ha,hy,dj,eH,da,c_,eK,cY,eL,eR,ff,cT,fg,ag,ba,B,fi,fj,fm,ft,fA,fD,fL,s,b,cK,af,aT,hb,gt,cj,gm,bz,gp,gs,az,gv,ce,gy,gD,gL,gT,gU,gX,gZ,cb,fZ,fY,fW,g_,g$,bW,ad,L,fH,bR,bQ,hh,bN,hi,hj,fs,bG,q,r,bF,by,fp,hm,aA,fh,fe,g,bn,d,fd,fa,aG,e_,P,m,M,N,W,R,bT,eZ,aV,i,bX,aO,bZ,k,ca,u,aD,eT,A,p,ch,o,eQ,aq,cm,co,Z,S,hs,e,bm,cu,z,cw,cx,bc,cz,cA,cB,eN,hw,a_,cF,cG,eF,c,G,eB,cM,hz,n,hA,ew,hD,hE,an,en,cV,hO,J,ek,bi,dD,c$,aF,db,ej,dd,ei,ih,dg,dh,di,eg,br,dV,aC,hX,bv,dL,at,Y,hZ,h_,h$,ib,bl,al,D,K,C,dM,bu,dO,du,dQ,dR,dS,dt,ds,dq,$,aE,dk,hU,d$,ed,hS,bp,df,de,dc,be,cW,em,cU,eo,hN,hH,cS,et,cR,hB,bb,aY,aW,ez,eA,cL,eC,eD,eE,cH,eG,hx,cD,eJ,hu,eh,eM,cC,cr,eP,bA,hr,eS,bw,eU,eV,eW,aX,bU,E,bh,ho,bE,hn,aJ,fk,fl,f,hk,av,bD,bs,y,fu,bk,fw,w,bL,U,H,aZ,hg,hf,fG,bS,fI,fJ,fM,fN,bV,hd,fR,fS,ac,dE,bY,b$,aL,f_,gb,aj,cd,gh,gi,gj,bt,cf,ay,cg,am,dF,gn,gr,ci,ar,gu,cn,aw,gx,ai,cp,cq,gB,X,bf,x,gI,cy,cE,gf,ge,ga,gY,f$,fV,cI,aN,hc,fQ,aU,fE,cN,fv,cP,fo,ah,ao,aI,cQ,aH,eX,bd,eO,cX,F,ey,ex,ev,hC,eu,dl,hF,dn,hI,hJ,dp,hL,dr,dv,dw,hP,dx,hR,dA,hT,d_,hV,dZ,dP,dB,dI,dH,ia,dG,ic,id,dC,ig,gw;function dJ(a){return Boolean(a&&void 0!==a.length)}function hY(){}function l(a){if(!(this instanceof l))throw new TypeError("Promises must be constructed via new");if("function"!=typeof a)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],el(a,this)}function ef(a,b){for(;3===a._state;)a=a._value;0!==a._state?(a._handled=!0,l._immediateFn(function(){var c=1===a._state?b.onFulfilled:b.onRejected,d;if(null!==c){try{d=c(a._value)}catch(a){return void aB(b.promise,a)}dz(b.promise,d)}else(1===a._state?dz:aB)(b.promise,a._value)})):a._deferreds.push(b)}function dz(a,b){var c,d,e;try{if(b===a)throw new TypeError("A promise cannot be resolved with itself.");if(b&&("object"==typeof b||"function"==typeof b)){if(c=b.then,b instanceof l)return a._state=3,a._value=b,void dy(a);if("function"==typeof c)return void el((d=c,e=b,function(){d.apply(e,arguments)}),a)}a._state=1,a._value=b,dy(a)}catch(b){aB(a,b)}}function aB(a,b){a._state=2,a._value=b,dy(a)}function dy(a){2===a._state&&0===a._deferreds.length&&l._immediateFn(function(){a._handled||l._unhandledRejectionFn(a._value)});for(var b=0,c=a._deferreds.length;b0?1:-1}),Number.isInteger||(Number.isInteger=function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a}),globalThis.ArrayBuffer||(globalThis.ArrayBuffer=Array),globalThis.Float32Array||(globalThis.Float32Array=Array),globalThis.Uint32Array||(globalThis.Uint32Array=Array),globalThis.Uint16Array||(globalThis.Uint16Array=Array),globalThis.Uint8Array||(globalThis.Uint8Array=Array),globalThis.Int32Array||(globalThis.Int32Array=Array),a.ENV=void 0,a.RENDERER_TYPE=void 0,a.BUFFER_BITS=void 0,a.BLEND_MODES=void 0,a.DRAW_MODES=void 0,a.FORMATS=void 0,a.TARGETS=void 0,a.TYPES=void 0,a.SAMPLER_TYPES=void 0,a.SCALE_MODES=void 0,a.WRAP_MODES=void 0,a.MIPMAP_MODES=void 0,a.ALPHA_MODES=void 0,a.CLEAR_MODES=void 0,a.GC_MODES=void 0,a.PRECISION=void 0,a.MASK_TYPES=void 0,a.COLOR_MASK_BITS=void 0,a.MSAA_QUALITY=void 0,a.BUFFER_TYPE=void 0,function(a){a[a.WEBGL_LEGACY=0]="WEBGL_LEGACY",a[a.WEBGL=1]="WEBGL",a[a.WEBGL2=2]="WEBGL2"}(a.ENV||(a.ENV={})),function(a){a[a.UNKNOWN=0]="UNKNOWN",a[a.WEBGL=1]="WEBGL",a[a.CANVAS=2]="CANVAS"}(a.RENDERER_TYPE||(a.RENDERER_TYPE={})),function(a){a[a.COLOR=16384]="COLOR",a[a.DEPTH=256]="DEPTH",a[a.STENCIL=1024]="STENCIL"}(a.BUFFER_BITS||(a.BUFFER_BITS={})),function(a){a[a.NORMAL=0]="NORMAL",a[a.ADD=1]="ADD",a[a.MULTIPLY=2]="MULTIPLY",a[a.SCREEN=3]="SCREEN",a[a.OVERLAY=4]="OVERLAY",a[a.DARKEN=5]="DARKEN",a[a.LIGHTEN=6]="LIGHTEN",a[a.COLOR_DODGE=7]="COLOR_DODGE",a[a.COLOR_BURN=8]="COLOR_BURN",a[a.HARD_LIGHT=9]="HARD_LIGHT",a[a.SOFT_LIGHT=10]="SOFT_LIGHT",a[a.DIFFERENCE=11]="DIFFERENCE",a[a.EXCLUSION=12]="EXCLUSION",a[a.HUE=13]="HUE",a[a.SATURATION=14]="SATURATION",a[a.COLOR=15]="COLOR",a[a.LUMINOSITY=16]="LUMINOSITY",a[a.NORMAL_NPM=17]="NORMAL_NPM",a[a.ADD_NPM=18]="ADD_NPM",a[a.SCREEN_NPM=19]="SCREEN_NPM",a[a.NONE=20]="NONE",a[a.SRC_OVER=0]="SRC_OVER",a[a.SRC_IN=21]="SRC_IN",a[a.SRC_OUT=22]="SRC_OUT",a[a.SRC_ATOP=23]="SRC_ATOP",a[a.DST_OVER=24]="DST_OVER",a[a.DST_IN=25]="DST_IN",a[a.DST_OUT=26]="DST_OUT",a[a.DST_ATOP=27]="DST_ATOP",a[a.ERASE=26]="ERASE",a[a.SUBTRACT=28]="SUBTRACT",a[a.XOR=29]="XOR"}(a.BLEND_MODES||(a.BLEND_MODES={})),function(a){a[a.POINTS=0]="POINTS",a[a.LINES=1]="LINES",a[a.LINE_LOOP=2]="LINE_LOOP",a[a.LINE_STRIP=3]="LINE_STRIP",a[a.TRIANGLES=4]="TRIANGLES",a[a.TRIANGLE_STRIP=5]="TRIANGLE_STRIP",a[a.TRIANGLE_FAN=6]="TRIANGLE_FAN"}(a.DRAW_MODES||(a.DRAW_MODES={})),function(a){a[a.RGBA=6408]="RGBA",a[a.RGB=6407]="RGB",a[a.RG=33319]="RG",a[a.RED=6403]="RED",a[a.RGBA_INTEGER=36249]="RGBA_INTEGER",a[a.RGB_INTEGER=36248]="RGB_INTEGER",a[a.RG_INTEGER=33320]="RG_INTEGER",a[a.RED_INTEGER=36244]="RED_INTEGER",a[a.ALPHA=6406]="ALPHA",a[a.LUMINANCE=6409]="LUMINANCE",a[a.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",a[a.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",a[a.DEPTH_STENCIL=34041]="DEPTH_STENCIL"}(a.FORMATS||(a.FORMATS={})),function(a){a[a.TEXTURE_2D=3553]="TEXTURE_2D",a[a.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",a[a.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",a[a.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",a[a.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",a[a.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",a[a.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",a[a.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",a[a.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z"}(a.TARGETS||(a.TARGETS={})),function(a){a[a.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",a[a.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",a[a.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",a[a.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",a[a.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",a[a.UNSIGNED_INT=5125]="UNSIGNED_INT",a[a.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",a[a.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",a[a.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",a[a.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",a[a.BYTE=5120]="BYTE",a[a.SHORT=5122]="SHORT",a[a.INT=5124]="INT",a[a.FLOAT=5126]="FLOAT",a[a.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",a[a.HALF_FLOAT=36193]="HALF_FLOAT"}(a.TYPES||(a.TYPES={})),function(a){a[a.FLOAT=0]="FLOAT",a[a.INT=1]="INT",a[a.UINT=2]="UINT"}(a.SAMPLER_TYPES||(a.SAMPLER_TYPES={})),function(a){a[a.NEAREST=0]="NEAREST",a[a.LINEAR=1]="LINEAR"}(a.SCALE_MODES||(a.SCALE_MODES={})),function(a){a[a.CLAMP=33071]="CLAMP",a[a.REPEAT=10497]="REPEAT",a[a.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(a.WRAP_MODES||(a.WRAP_MODES={})),function(a){a[a.OFF=0]="OFF",a[a.POW2=1]="POW2",a[a.ON=2]="ON",a[a.ON_MANUAL=3]="ON_MANUAL"}(a.MIPMAP_MODES||(a.MIPMAP_MODES={})),function(a){a[a.NPM=0]="NPM",a[a.UNPACK=1]="UNPACK",a[a.PMA=2]="PMA",a[a.NO_PREMULTIPLIED_ALPHA=0]="NO_PREMULTIPLIED_ALPHA",a[a.PREMULTIPLY_ON_UPLOAD=1]="PREMULTIPLY_ON_UPLOAD",a[a.PREMULTIPLY_ALPHA=2]="PREMULTIPLY_ALPHA",a[a.PREMULTIPLIED_ALPHA=2]="PREMULTIPLIED_ALPHA"}(a.ALPHA_MODES||(a.ALPHA_MODES={})),function(a){a[a.NO=0]="NO",a[a.YES=1]="YES",a[a.AUTO=2]="AUTO",a[a.BLEND=0]="BLEND",a[a.CLEAR=1]="CLEAR",a[a.BLIT=2]="BLIT"}(a.CLEAR_MODES||(a.CLEAR_MODES={})),function(a){a[a.AUTO=0]="AUTO",a[a.MANUAL=1]="MANUAL"}(a.GC_MODES||(a.GC_MODES={})),function(a){a.LOW="lowp",a.MEDIUM="mediump",a.HIGH="highp"}(a.PRECISION||(a.PRECISION={})),function(a){a[a.NONE=0]="NONE",a[a.SCISSOR=1]="SCISSOR",a[a.STENCIL=2]="STENCIL",a[a.SPRITE=3]="SPRITE",a[a.COLOR=4]="COLOR"}(a.MASK_TYPES||(a.MASK_TYPES={})),function(a){a[a.RED=1]="RED",a[a.GREEN=2]="GREEN",a[a.BLUE=4]="BLUE",a[a.ALPHA=8]="ALPHA"}(a.COLOR_MASK_BITS||(a.COLOR_MASK_BITS={})),function(a){a[a.NONE=0]="NONE",a[a.LOW=2]="LOW",a[a.MEDIUM=4]="MEDIUM",a[a.HIGH=8]="HIGH"}(a.MSAA_QUALITY||(a.MSAA_QUALITY={})),function(a){a[a.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",a[a.ARRAY_BUFFER=34962]="ARRAY_BUFFER",a[a.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER"}(a.BUFFER_TYPE||(a.BUFFER_TYPE={})),eK={createCanvas:function(b,c){var a=document.createElement("canvas");return a.width=b,a.height=c,a},getWebGLRenderingContext:function(){return WebGLRenderingContext},getNavigator:function(){return navigator},getBaseUrl:function(){var a;return null!==(a=document.baseURI)&&void 0!==a?a:window.location.href},fetch:function(a,b){return fetch(a,b)}},cY=/iPhone/i,eL=/iPod/i,eR=/iPad/i,ff=/\biOS-universal(?:.+)Mac\b/i,cT=/\bAndroid(?:.+)Mobile\b/i,fg=/Android/i,ag=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,ba=/Silk/i,B=/Windows Phone/i,fi=/\bWindows(?:.+)ARM\b/i,fj=/BlackBerry/i,fm=/BB10/i,ft=/Opera Mini/i,fA=/\b(CriOS|Chrome)(?:.+)Mobile/i,fD=/Mobile(?:.+)Firefox\b/i,fL=function(a){return void 0!==a&&"MacIntel"===a.platform&&"number"==typeof a.maxTouchPoints&&a.maxTouchPoints>1&&"undefined"==typeof MSStream},s=function(c){var d={userAgent:"",platform:"",maxTouchPoints:0},e,f,a,b;return c||"undefined"==typeof navigator?"string"==typeof c?d.userAgent=c:c&&c.userAgent&&(d={userAgent:c.userAgent,platform:c.platform,maxTouchPoints:c.maxTouchPoints||0}):d={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0},e=d.userAgent,f=e.split("[FBAN"),void 0!==f[1]&&(e=f[0]),void 0!==(f=e.split("Twitter"))[1]&&(e=f[0]),a=function(a){return function(b){return b.test(a)}}(e),b={apple:{phone:a(cY)&&!a(B),ipod:a(eL),tablet:!a(cY)&&(a(eR)||fL(d))&&!a(B),universal:a(ff),device:(a(cY)||a(eL)||a(eR)||a(ff)||fL(d))&&!a(B)},amazon:{phone:a(ag),tablet:!a(ag)&&a(ba),device:a(ag)||a(ba)},android:{phone:!a(B)&&a(ag)||!a(B)&&a(cT),tablet:!a(B)&&!a(ag)&&!a(cT)&&(a(ba)||a(fg)),device:!a(B)&&(a(ag)||a(ba)||a(cT)||a(fg))||a(/\bokhttp\b/i)},windows:{phone:a(B),tablet:a(fi),device:a(B)||a(fi)},other:{blackberry:a(fj),blackberry10:a(fm),opera:a(ft),firefox:a(fD),chrome:a(fA),device:a(fj)||a(fm)||a(ft)||a(fD)||a(fA)},any:!1,phone:!1,tablet:!1},b.any=b.apple.device||b.android.device||b.windows.device||b.other.device,b.phone=b.apple.phone||b.android.phone||b.windows.phone,b.tablet=b.apple.tablet||b.android.tablet||b.windows.tablet,b}(globalThis.navigator),b={ADAPTER:eK,MIPMAP_TEXTURES:a.MIPMAP_MODES.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:a.MSAA_QUALITY.NONE,SPRITE_MAX_TEXTURES:function(c){var a,b=!0;return(s.tablet||s.phone)&&(s.apple.device&&(a=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(a[1],10)<11&&(b=!1),s.android.device&&(a=navigator.userAgent.match(/Android\s([0-9.]*)/))&&parseInt(a[1],10)<7&&(b=!1)),b?32:4}(),SPRITE_BATCH_SIZE:4096,RENDER_OPTIONS:{view:null,antialias:!1,autoDensity:!1,backgroundColor:0,backgroundAlpha:1,useContextAlpha:!0,clearBeforeRender:!0,preserveDrawingBuffer:!1,width:800,height:600,legacy:!1},GC_MODE:a.GC_MODES.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:a.WRAP_MODES.CLAMP,SCALE_MODE:a.SCALE_MODES.LINEAR,PRECISION_VERTEX:a.PRECISION.HIGH,PRECISION_FRAGMENT:s.apple.device?a.PRECISION.HIGH:a.PRECISION.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!s.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},cK="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function cJ(b,c,a){return b(a={path:c,exports:{},require:function(c,b){return function(){throw new Error("Dynamic requires are not currently supported by @rollup/plugin-commonjs")}(null==b&&a.path)}},a.exports),a.exports}af=cJ(function(g){var h=Object.prototype.hasOwnProperty,b="~";function c(){}function f(a,b,c){this.fn=a,this.context=b,this.once=c||!1}function e(a,e,g,h,i){if("function"!=typeof g)throw new TypeError("The listener must be a function");var d=new f(g,h||a,i),c=b?b+e:e;return a._events[c]?a._events[c].fn?a._events[c]=[a._events[c],d]:a._events[c].push(d):(a._events[c]=d,a._eventsCount++),a}function d(a,b){0==--a._eventsCount?a._events=new c:delete a._events[b]}function a(){this._events=new c,this._eventsCount=0}Object.create&&(c.prototype=Object.create(null),(new c).__proto__||(b=!1)),a.prototype.eventNames=function(){var d,a,c=[];if(0===this._eventsCount)return c;for(a in d=this._events)h.call(d,a)&&c.push(b?a.slice(1):a);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(d)):c},a.prototype.listeners=function(d){var g=b?b+d:d,a=this._events[g],c,e,f;if(!a)return[];if(a.fn)return[a.fn];for(c=0,e=a.length,f=new Array(e);c80*a){d=g=b[0],e=h=b[1];for(k=a;kg&&(g=j),i>h&&(h=i);f=0!==(f=Math.max(g-d,h-e))?32767/f:0}return aM(c,m,a,d,e,f,0),m}function fT(c,e,f,d,g){var a,b;if(g===ck(c,e,f,d)>0)for(a=e;a=e;a-=d)b=gl(a,c[a],c[a+1],b);return b&&aR(b,b.next)&&(au(b),b=b.next),b}function V(c,b){if(!c)return c;b||(b=c);var d,a=c;do if(d=!1,a.steiner||!aR(a,a.next)&&0!==j(a.prev,a,a.next))a=a.next;else{if(au(a),(a=b=a.prev)===a.next)break;d=!0}while(d||a!==b)return b}function aM(a,b,c,e,f,d,h){if(a){!h&&d&&function(b,c,d,e){var a=b;do 0===a.z&&(a.z=cs(a.x,a.y,c,d,e)),a.prevZ=a.prev,a.nextZ=a.next,a=a.next;while(a!==b)a.prevZ.nextZ=null,a.prevZ=null,function(g){var i,b,a,c,d,h,e,f,j=1;do{for(b=g,g=null,d=null,h=0;b;){for(h++,a=b,e=0,i=0;i0||f>0&&a;)0!==e&&(0===f||!a||b.z<=a.z)?(c=b,b=b.nextZ,e--):(c=a,a=a.nextZ,f--),d?d.nextZ=c:g=c,c.prevZ=d,d=c;b=a}d.nextZ=null,j*=2}while(h>1)}(a)}(a,e,f,d);for(var i,g,j=a;a.prev!==a.next;)if(i=a.prev,g=a.next,d?gJ(a,e,f,d):gK(a))b.push(i.i/c|0),b.push(a.i/c|0),b.push(g.i/c|0),au(a),a=g.next,j=g.next;else if((a=g)===j){h?1===h?aM(a=gH(V(a),b,c),b,c,e,f,d,2):2===h&&gG(a,b,c,e,f,d):aM(V(a),b,c,e,f,d,1);break}}}function gK(l){var i=l.prev,k=l,h=l.next,e,f,b,g,d,c,m,n,o,p,a;if(j(i,k,h)>=0)return!1;for(e=i.x,f=k.x,b=h.x,g=i.y,d=k.y,c=h.y,m=ef?e>b?e:b:f>b?f:b,p=g>d?g>c?g:c:d>c?d:c,a=h.next;a!==i;){if(a.x>=m&&a.x<=o&&a.y>=n&&a.y<=p&&ae(e,g,f,d,b,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;a=a.next}return!0}function gJ(p,u,v,r){var i=p.prev,q=p,k=p.next,e,g,d,h,f,c,l,o,n,m,s,t,a,b;if(j(i,q,k)>=0)return!1;for(e=i.x,g=q.x,d=k.x,h=i.y,f=q.y,c=k.y,l=eg?e>d?e:d:g>d?g:d,m=h>f?h>c?h:c:f>c?f:c,s=cs(l,o,u,v,r),t=cs(n,m,u,v,r),a=p.prevZ,b=p.nextZ;a&&a.z>=s&&b&&b.z<=t;){if(a.x>=l&&a.x<=n&&a.y>=o&&a.y<=m&&a!==i&&a!==k&&ae(e,h,g,f,d,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;if(a=a.prevZ,b.x>=l&&b.x<=n&&b.y>=o&&b.y<=m&&b!==i&&b!==k&&ae(e,h,g,f,d,c,b.x,b.y)&&j(b.prev,b,b.next)>=0)return!1;b=b.nextZ}for(;a&&a.z>=s;){if(a.x>=l&&a.x<=n&&a.y>=o&&a.y<=m&&a!==i&&a!==k&&ae(e,h,g,f,d,c,a.x,a.y)&&j(a.prev,a,a.next)>=0)return!1;a=a.prevZ}for(;b&&b.z<=t;){if(b.x>=l&&b.x<=n&&b.y>=o&&b.y<=m&&b!==i&&b!==k&&ae(e,h,g,f,d,c,b.x,b.y)&&j(b.prev,b,b.next)>=0)return!1;b=b.nextZ}return!0}function gH(d,e,f){var a=d,c,b;do c=a.prev,b=a.next.next,!aR(c,b)&&gk(c,a,a.next,b)&&ax(c,b)&&ax(b,c)&&(e.push(c.i/f|0),e.push(a.i/f|0),e.push(b.i/f|0),au(a),au(a.next),a=d=b),a=a.next;while(a!==d)return V(a)}function gG(g,h,i,d,e,f){var a=g,b,c;do{for(b=a.next.next;b!==a.prev;){if(a.i!==b.i&&gz(a,b))return c=fU(a,b),a=V(a,a.next),c=V(c,c.next),aM(a,h,i,d,e,f,0),void aM(c,h,i,d,e,f,0);b=b.next}a=a.next}while(a!==g)}function gF(a,b){return a.x-b.x}function gE(b,c){var a=function(h,l){var b,a=l,d=h.x,c=h.y,g=-1/0,e,f,m,k,i,j;do{if(c<=a.y&&c>=a.next.y&&a.next.y!==a.y)if(e=a.x+(c-a.y)*(a.next.x-a.x)/(a.next.y-a.y),e<=d&&e>g&&(g=e,b=a.x=a.x&&a.x>=k&&d!==a.x&&ae(cb.x||a.x===b.x&&gC(b,a)))&&(b=a,j=f)),a=a.next;while(a!==m)return b}(b,c),d;return a?(d=fU(a,b),V(d,d.next),V(a,a.next)):c}function gC(a,b){return j(a.prev,a,b.prev)<0&&j(b.next,a,a.next)<0}function cs(a,b,d,e,c){return(a=1431655765&((a=858993459&((a=252645135&((a=16711935&((a=(a-d)*c|0)|a<<8))|a<<4))|a<<2))|a<<1))|(b=1431655765&((b=858993459&((b=252645135&((b=16711935&((b=(b-e)*c|0)|b<<8))|b<<4))|b<<2))|b<<1))<<1}function gA(c){var a=c,b=c;do(a.x=(g-a)*(f-b)&&(g-a)*(d-b)>=(c-a)*(h-b)&&(c-a)*(f-b)>=(e-a)*(d-b)}function gz(a,b){return a.next.i!==b.i&&a.prev.i!==b.i&&!function(b,c){var a=b;do{if(a.i!==b.i&&a.next.i!==b.i&&a.i!==c.i&&a.next.i!==c.i&&gk(a,a.next,b,c))return!0;a=a.next}while(a!==b)return!1}(a,b)&&(ax(a,b)&&ax(b,a)&&function(b,e){var a=b,c=!1,f=(b.x+e.x)/2,d=(b.y+e.y)/2;do a.y>d!=a.next.y>d&&a.next.y!==a.y&&f<(a.next.x-a.x)*(d-a.y)/(a.next.y-a.y)+a.x&&(c=!c),a=a.next;while(a!==b)return c}(a,b)&&(j(a.prev,a,b.prev)||j(a,b.prev,b))||aR(a,b)&&j(a.prev,a,a.next)>0&&j(b.prev,b,b.next)>0)}function j(b,a,c){return(a.y-b.y)*(c.x-a.x)-(a.x-b.x)*(c.y-a.y)}function aR(a,b){return a.x===b.x&&a.y===b.y}function gk(a,b,c,d){var e=bx(j(a,b,c)),f=bx(j(a,b,d)),g=bx(j(c,d,a)),h=bx(j(c,d,b));return e!==f&&g!==h||!(0!==e||!bq(a,c,b))||!(0!==f||!bq(a,d,b))||!(0!==g||!bq(c,a,d))||!(0!==h||!bq(c,b,d))}function bq(a,b,c){return b.x<=Math.max(a.x,c.x)&&b.x>=Math.min(a.x,c.x)&&b.y<=Math.max(a.y,c.y)&&b.y>=Math.min(a.y,c.y)}function bx(a){return a>0?1:a<0?-1:0}function ax(a,b){return j(a.prev,a,a.next)<0?j(a,b,a.next)>=0&&j(a,a.prev,b)>=0:j(a,b,a.prev)<0||j(a,a.next,b)<0}function fU(a,b){var d=new cl(a.i,a.x,a.y),c=new cl(b.i,b.x,b.y),e=a.next,f=b.prev;return a.next=b,b.prev=a,d.next=e,e.prev=d,c.next=d,d.prev=c,f.next=c,c.prev=f,c}function gl(c,d,e,b){var a=new cl(c,d,e);return b?(a.next=b.next,a.prev=b,b.next.prev=a,b.next=a):(a.prev=a,a.next=a),a}function au(a){a.next.prev=a.prev,a.prev.next=a.next,a.prevZ&&(a.prevZ.nextZ=a.nextZ),a.nextZ&&(a.nextZ.prevZ=a.prevZ)}function cl(a,b,c){this.i=a,this.x=b,this.y=c,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}function ck(b,g,d,e){for(var f=0,a=g,c=d-e;a0&&(g+=b[a-1].length,c.holes.push(g))}return c},aT.default=hb,gt=cJ(function(a,b){!function(n){var k=b&&!b.nodeType&&b,q=a&&!a.nodeType&&a,f="object"==typeof cK&&cK,g,j,h,d,x,w,v,y,c,i;f.global!==f&&f.window!==f&&f.self!==f||(n=f),h=2147483647,d=36,x=/^xn--/,w=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:"Overflow: input needs wider integers to process","not-basic":"Illegal input >= 0x80 (not a basic code point)","invalid-input":"Invalid input"},c=Math.floor,i=String.fromCharCode;function e(a){throw RangeError(y[a])}function r(b,d){for(var a=b.length,c=[];a--;)c[a]=d(b[a]);return c}function s(a,d){var b=a.split("@"),c="";return b.length>1&&(c=b[0]+"@",a=b[1]),c+r((a=a.replace(v,".")).split("."),d).join(".")}function t(d){for(var a,e,c=[],b=0,f=d.length;b=55296&&a<=56319&&b65535&&(b+=i((a-=65536)>>>10&1023|55296),a=56320|1023&a),b+=i(a)}).join("")}function m(a,b){return a+22+75*(a<26)-((0!=b)<<5)}function o(a,e,f){var b=0;for(a=f?c(a/700):a>>1,a+=c(a/e);a>455;b+=d)a=c(a/35);return c(b+36*a/(a+38))}function p(k){var m,g,i,l,r,j,f,p,v,t,b,n=[],w=k.length,a=0,s=128,q=72;for((g=k.lastIndexOf("-"))<0&&(g=0),i=0;i=128&&e("not-basic"),n.push(k.charCodeAt(i));for(l=g>0?g+1:0;l=w&&e("invalid-input"),((p=(b=k.charCodeAt(l++))-48<10?b-22:b-65<26?b-65:b-97<26?b-97:d)>=d||p>c((h-a)/j))&&e("overflow"),a+=p*j,!(p<(v=f<=q?1:f>=q+26?26:f-q));f+=d)j>c(h/(t=d-v))&&e("overflow"),j*=t;q=o(a-r,m=n.length+1,0==r),c(a/m)>h-s&&e("overflow"),s+=c(a/m),a%=m,n.splice(a++,0,s)}return u(n)}function l(s){var b,f,l,v,p,a,j,r,q,u,g,n,w,x,y,k=[];for(n=(s=t(s)).length,b=128,f=0,p=72,a=0;a=b&&gc((h-f)/(w=l+1))&&e("overflow"),f+=(j-b)*w,b=j,a=0;ah&&e("overflow"),g==b){for(r=f,q=d;!(r<(u=q<=p?1:q>=p+26?26:q-p));q+=d)y=r-u,x=d-u,k.push(i(m(u+y%x,0))),r=c(y/x);k.push(i(m(r,0))),p=o(f,w,l==v),f=0,++l}++f,++b}return k.join("")}if(g={version:"1.3.2",ucs2:{decode:t,encode:u},decode:p,encode:l,toASCII:function(a){return s(a,function(a){return w.test(a)?"xn--"+l(a):a})},toUnicode:function(a){return s(a,function(a){return x.test(a)?p(a.slice(4).toLowerCase()):a})}},k&&q)if(a.exports==k)q.exports=g;else for(j in g)g.hasOwnProperty(j)&&(k[j]=g[j]);else n.punycode=g}(cK)}),cj=function(a){return"string"==typeof a},gm=function(a){return"object"==typeof a&&null!==a},bz=function(a){return null===a},gp=function(a){return null==a};function gq(a,b){return Object.prototype.hasOwnProperty.call(a,b)}gs=function(c,n,m,l){var a,o,d,j,i,h,g,b,e,f,k;if(n=n||"&",m=m||"=",a={},"string"!=typeof c||0===c.length)return a;o=/\+/g,c=c.split(n),d=1e3,l&&"number"==typeof l.maxKeys&&(d=l.maxKeys),j=c.length,d>0&&j>d&&(j=d);for(i=0;i=0?(h=f.substr(0,k),g=f.substr(k+1)):(h=f,g=""),b=decodeURIComponent(h),e=decodeURIComponent(g),gq(a,b)?Array.isArray(a[b])?a[b].push(e):a[b]=[a[b],e]:a[b]=e;return a},az=function(a){switch(typeof a){case"string":return a;case"boolean":return a?"true":"false";case"number":return isFinite(a)?a:"";default:return""}},gv=function(a,b,c,d){return b=b||"&",c=c||"=",null===a&&(a=void 0),"object"==typeof a?Object.keys(a).map(function(d){var e=encodeURIComponent(az(d))+c;return Array.isArray(a[d])?a[d].map(function(a){return e+encodeURIComponent(az(a))}).join(b):e+encodeURIComponent(az(a[d]))}).join(b):d?encodeURIComponent(az(d))+c+encodeURIComponent(az(a)):""},ce=cJ(function(b,a){a.decode=a.parse=gs,a.encode=a.stringify=gv}),gy=aS,gD=function(a,b){return aS(a,!1,!0).resolve(b)},gL=function(a){return cj(a)&&(a=aS(a)),!(a instanceof t)?t.prototype.format.call(a):a.format()};function t(){this.protocol=null,this.slashes=null,this.auth=null,this.host=null,this.port=null,this.hostname=null,this.hash=null,this.search=null,this.query=null,this.pathname=null,this.path=null,this.href=null}gT=/^([a-z0-9.+-]+:)/i,gU=/:[0-9]*$/,gX=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,gZ=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n"," "]),cb=["'"].concat(gZ),fZ=["%","/","?",";","#"].concat(cb),fY=["/","?","#"],fW=/^[+a-z0-9A-Z_-]{0,63}$/,g_=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,g$={javascript:!0,"javascript:":!0},bW={javascript:!0,"javascript:":!0},ad={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function aS(a,c,d){if(a&&gm(a)&&a instanceof t)return a;var b=new t;return b.parse(a,c,d),b}t.prototype.parse=function(g,v,F){var C,B,q,a,j,d,p,A,z,n,c,b,f,x,l,s,e,u,i,D,y,m,w,o,E,h,r,t,k,G;if(!cj(g))throw new TypeError("Parameter 'url' must be a string, not "+typeof g);if(C=g.indexOf("?"),B=-1!==C&&C127?u+="x":u+=e[i];if(!u.match(fW)){y=l.slice(0,b),m=l.slice(b+1),w=e.match(g_),w&&(y.push(w[1]),m.unshift(w[2])),m.length&&(a="/"+m.join(".")+a),this.hostname=y.join(".");break}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),x||(this.hostname=gt.toASCII(this.hostname)),o=this.port?":"+this.port:"",E=this.hostname||"",this.host=E+o,this.href+=this.host,x&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==a[0]&&(a="/"+a))}if(!g$[p])for(b=0,s=cb.length;b0)&&a.host.split("@"))&&(a.auth=f.shift(),a.host=a.hostname=f.shift())),a.search=b.search,a.query=b.query,bz(a.pathname)&&bz(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.href=a.format(),a;if(!c.length)return a.pathname=null,a.search?a.path="/"+a.search:a.path=null,a.href=a.format(),a;for(h=c.slice(-1)[0],x=(a.host||b.host||c.length>1)&&("."===h||".."===h)||""===h,i=0,g=c.length;g>=0;g--)"."===(h=c[g])?c.splice(g,1):".."===h?(c.splice(g,1),i++):i&&(c.splice(g,1),i--);if(!e&&!y)for(;i--;i)c.unshift("..");return!e||""===c[0]||c[0]&&"/"===c[0].charAt(0)||c.unshift(""),x&&"/"!==c.join("/").substr(-1)&&c.push(""),w=""===c[0]||c[0]&&"/"===c[0].charAt(0),n&&(a.hostname=a.host=w?"":c.length?c.shift():"",(f=!!(a.host&&a.host.indexOf("@")>0)&&a.host.split("@"))&&(a.auth=f.shift(),a.host=a.hostname=f.shift())),(e=e||a.host&&c.length)&&!w&&c.unshift(""),c.length?a.pathname=c.join("/"):(a.pathname=null,a.path=null),bz(a.pathname)&&bz(a.search)||(a.path=(a.pathname?a.pathname:"")+(a.search?a.search:"")),a.auth=b.auth||a.auth,a.slashes=a.slashes||b.slashes,a.href=a.format(),a},t.prototype.parseHost=function(){var a=this.host,b=gU.exec(a);b&&(":"!==(b=b[0])&&(this.port=b.substr(1)),a=a.substr(0,a.length-b.length)),a&&(this.hostname=a)},L={parse:gy,format:gL,resolve:gD};function v(a){if("string"!=typeof a)throw new TypeError("Path must be a string. Received "+JSON.stringify(a))}function fO(a){return a.split("?")[0].split("#")[0]}fH={toPosix:function(a){return"\\","/",a.replace(new RegExp("\\".replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),"/")},isUrl:function(a){return/^https?:/.test(this.toPosix(a))},isDataUrl:function(a){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(a)},hasProtocol:function(a){return/^[^/:]+:\//.test(this.toPosix(a))},getProtocol:function(a){var e,b,c,d,f;return v(a),a=this.toPosix(a),e="",b=/^file:\/\/\//.exec(a),c=/^[^/:]+:\/\//.exec(a),d=/^[^/:]+:\//.exec(a),(b||c||d)&&(f=(null==b?void 0:b[0])||(null==c?void 0:c[0])||(null==d?void 0:d[0]),e=f,a=a.slice(f.length)),e},toAbsolute:function(a,c,d){if(this.isDataUrl(a))return a;var e=fO(this.toPosix(null!=c?c:b.ADAPTER.getBaseUrl())),f=fO(this.toPosix(null!=d?d:this.rootname(e)));return v(a),(a=this.toPosix(a)).startsWith("/")?fH.join(f,a.slice(1)):this.isAbsolute(a)?a:this.join(e,a)},normalize:function(a){var b,c,d;return v(a=this.toPosix(a)),0===a.length?".":(b="",c=a.startsWith("/"),this.hasProtocol(a)&&(b=this.rootname(a),a=a.slice(b.length)),d=a.endsWith("/"),(a=function(g,i){for(var e,a="",f=0,d=-1,c=0,b=0,h;b<=g.length;++b){if(b2){if(h=a.lastIndexOf("/"),h!==a.length-1){-1===h?(a="",f=0):f=(a=a.slice(0,h)).length-1-a.lastIndexOf("/"),d=b,c=0;continue}}else if(2===a.length||1===a.length){a="",f=0,d=b,c=0;continue}}else a.length>0?a+="/"+g.slice(d+1,b):a=g.slice(d+1,b),f=b-d-1;d=b,c=0}else 46===e&&-1!==c?++c:c=-1}return a}(a)).length>0&&d&&(a+="/"),c?"/"+a:b+a)},isAbsolute:function(a){return v(a),a=this.toPosix(a),!!this.hasProtocol(a)||a.startsWith("/")},join:function(){for(var f,a,g=arguments,c=[],d=0,e,b,h;d0)&&(void 0===a?a=b:(h=null!==(f=c[e-1])&&void 0!==f?f:"",this.extname(h)?a+="/../"+b:a+="/"+b));return void 0===a?".":this.normalize(a)},dirname:function(a){if(v(a),0===a.length)return".";for(var g=(a=this.toPosix(a)).charCodeAt(0),e=47===g,c=-1,f=!0,d=this.getProtocol(a),h=a,b=(a=a.slice(d.length)).length-1;b>=1;--b)if(47===(g=a.charCodeAt(b))){if(!f){c=b;break}}else f=!1;return-1===c?e?"/":this.isUrl(h)?d+a:d:e&&1===c?"//":d+a.slice(0,c)},rootname:function(a){var b,c;return v(a),b="",(b=(a=this.toPosix(a)).startsWith("/")?"/":this.getProtocol(a),this.isUrl(a))&&(c=a.indexOf("/",b.length),(b=-1!==c?a.slice(0,c):a).endsWith("/")||(b+="/")),b},basename:function(b,d){var a,e,c,f,g,h,i;if(v(b),d&&v(d),b=this.toPosix(b),e=0,c=-1,f=!0,void 0!==d&&d.length>0&&d.length<=b.length){if(d.length===b.length&&d===b)return"";g=d.length-1,h=-1;for(a=b.length-1;a>=0;--a)if(i=b.charCodeAt(a),47===i){if(!f){e=a+1;break}}else-1===h&&(f=!1,h=a+1),g>=0&&(i===d.charCodeAt(g)?-1==--g&&(c=a):(g=-1,c=h));return e===c?c=h:-1===c&&(c=b.length),b.slice(e,c)}for(a=b.length-1;a>=0;--a)if(47===b.charCodeAt(a)){if(!f){e=a+1;break}}else-1===c&&(f=!1,c=a+1);return-1===c?"":b.slice(e,c)},extname:function(e){var a,f,c,g,d,b,h;v(e);for(a=-1,f=0,c=-1,g=!0,d=0,b=(e=this.toPosix(e)).length-1;b>=0;--b)if(h=e.charCodeAt(b),47!==h)-1===c&&(g=!1,c=b+1),46===h?-1===a?a=b:1!==d&&(d=1):-1!==a&&(d=-1);else if(!g){f=b+1;break}return-1===a||-1===c||0===d||1===d&&a===c-1&&a===f+1?"":e.slice(a,c)},parse:function(a){var b,i,k,h,d,e,c,j,f,g;if(v(a),b={root:"",dir:"",base:"",ext:"",name:""},0===a.length)return b;k=(a=this.toPosix(a)).charCodeAt(0),h=this.isAbsolute(a),b.root=this.rootname(a),i=h||this.hasProtocol(a)?1:0;for(d=-1,e=0,c=-1,j=!0,f=a.length-1,g=0;f>=i;--f)if(47!==(k=a.charCodeAt(f)))-1===c&&(j=!1,c=f+1),46===k?-1===d?d=f:1!==g&&(g=1):-1!==d&&(g=-1);else if(!j){e=f+1;break}return-1===d||-1===c||0===g||1===g&&d===c-1&&d===e+1?-1!==c&&(b.base=b.name=0===e&&h?a.slice(1,c):a.slice(e,c)):(0===e&&h?(b.name=a.slice(1,d),b.base=a.slice(1,c)):(b.name=a.slice(e,d),b.base=a.slice(e,c)),b.ext=a.slice(d,c)),b.dir=this.dirname(a),b},sep:"/",delimiter:":"},b.RETINA_PREFIX=/@([0-9\.]+)x/,b.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1,bQ=!1;function fC(a){var c,d;bQ||(b.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1?(d=["\n %c %c %c PixiJS 6.5.8 - ✰ "+a+" ✰ %c %c http://www.pixijs.com/ %c %c ♥%c♥%c♥ \n\n","background: #ff66a5; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff66a5; background: #030307; padding:5px 0;","background: #ff66a5; padding:5px 0;","background: #ffc3dc; padding:5px 0;","background: #ff66a5; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;","color: #ff2424; background: #fff; padding:5px 0;"],(c=globalThis.console).log.apply(c,d)):globalThis.console&&globalThis.console.log("PixiJS 6.5.8 - "+a+" - http://www.pixijs.com/"),bQ=!0)}function fB(){return void 0===bR&&(bR=function(){var c={stencil:!0,failIfMajorPerformanceCaveat:b.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT},d,a,f,e;try{return!!b.ADAPTER.getWebGLRenderingContext()&&(d=b.ADAPTER.createCanvas(),a=d.getContext("webgl",c)||d.getContext("experimental-webgl",c),f=!(!a||!a.getContextAttributes().stencil),a&&(e=a.getExtension("WEBGL_lose_context"),e&&e.loseContext()),a=null,f)}catch(a){return!1}}()),bR}hh={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dimgrey:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",goldenrod:"#daa520",gold:"#ffd700",gray:"#808080",green:"#008000",greenyellow:"#adff2f",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",indianred:"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavenderblush:"#fff0f5",lavender:"#e6e6fa",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgray:"#d3d3d3",lightgreen:"#90ee90",lightgrey:"#d3d3d3",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightslategrey:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370db",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#db7093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",slategrey:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function T(b,a){return void 0===a&&(a=[]),a[0]=(b>>16&255)/255,a[1]=(b>>8&255)/255,a[2]=(255&b)/255,a}function bP(b){var a=b.toString(16);return"#"+("000000".substring(0,6-a.length)+a)}function bO(a){return"string"==typeof a&&"#"===(a=hh[a.toLowerCase()]||a)[0]&&(a=a.slice(1)),parseInt(a,16)}bN=function(){for(var c=[],d=[],b=0,e;b<32;b++)c[b]=b,d[b]=b;return c[a.BLEND_MODES.NORMAL_NPM]=a.BLEND_MODES.NORMAL,c[a.BLEND_MODES.ADD_NPM]=a.BLEND_MODES.ADD,c[a.BLEND_MODES.SCREEN_NPM]=a.BLEND_MODES.SCREEN,d[a.BLEND_MODES.NORMAL]=a.BLEND_MODES.NORMAL_NPM,d[a.BLEND_MODES.ADD]=a.BLEND_MODES.ADD_NPM,d[a.BLEND_MODES.SCREEN]=a.BLEND_MODES.SCREEN_NPM,e=[],e.push(d),e.push(c),e}();function bM(a,b){return bN[b?1:0][a]}function fz(b,c,a,d){return a=a||new Float32Array(4),d||void 0===d?(a[0]=b[0]*c,a[1]=b[1]*c,a[2]=b[2]*c):(a[0]=b[0],a[1]=b[1],a[2]=b[2]),a[3]=c,a}function bg(b,a){if(1===a)return(255*a<<24)+b;if(0===a)return 0;var c=b>>16&255,d=b>>8&255,e=255&b;return(255*a<<24)+((c=c*a+.5|0)<<16)+((d=d*a+.5|0)<<8)+(e*a+.5|0)}function bK(c,b,a,d){return(a=a||new Float32Array(4))[0]=(c>>16&255)/255,a[1]=(c>>8&255)/255,a[2]=(255&c)/255,(d||void 0===d)&&(a[0]*=b,a[1]*=b,a[2]*=b),a[3]=b,a}function fy(e,a){var d,b,c;if(void 0===a&&(a=null),d=6*e,(a=a||new Uint16Array(d)).length!==d)throw new Error("Out buffer length is incorrect, got "+a.length+" and expected "+d);for(b=0,c=0;b>>1,a|=a>>>2,a|=a>>>4,a|=a>>>8,1+(a|=a>>>16)}function bI(a){return!(a&a-1||!a)}function bH(b){var c=(b>65535?1:0)<<4,a=((b>>>=c)>255?1:0)<<3;return c|=a,c|=a=((b>>>=a)>15?1:0)<<2,(c|=a=((b>>>=a)>3?1:0)<<1)|(b>>>=a)>>1}function _(c,d,a){var b,e=c.length,f;if(!(d>=e||0===a)){f=e-(a=d+a>e?e-d:a);for(b=d;b=this.x&&a=this.y&&b=j||Math.max(a.y,e.y,d.y,c.y)<=i||Math.min(a.y,e.y,d.y,c.y)>=h)&&(!(n=o*(e.y-a.y),g=o*(a.x-e.x),p=n*k+g*i,q=n*j+g*i,r=n*k+g*h,s=n*j+g*h,Math.max(p,q,r,s)<=n*a.x+g*a.y||Math.min(p,q,r,s)>=n*c.x+g*c.y)&&(l=o*(a.y-d.y),m=o*(d.x-a.x),t=l*k+m*i,u=l*j+m*i,v=l*k+m*h,w=l*j+m*h,!(Math.max(t,u,v,w)<=l*a.x+m*a.y||Math.min(t,u,v,w)>=l*c.x+m*c.y)))))):!(y=this.xb.right?b.right:this.right)<=y)&&(x=this.yb.bottom?b.bottom:this.bottom)>x)},b.prototype.pad=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this.x-=a,this.y-=b,this.width+=2*a,this.height+=2*b,this},b.prototype.fit=function(a){var b=Math.max(this.x,a.x),d=Math.min(this.x+this.width,a.x+a.width),c=Math.max(this.y,a.y),e=Math.min(this.y+this.height,a.y+a.height);return this.x=b,this.width=Math.max(d-b,0),this.y=c,this.height=Math.max(e-c,0),this},b.prototype.ceil=function(a,b){void 0===a&&(a=1),void 0===b&&(b=.001);var c=Math.ceil((this.x+this.width-b)*a)/a,d=Math.ceil((this.y+this.height-b)*a)/a;return this.x=Math.floor((this.x+b)*a)/a,this.y=Math.floor((this.y+b)*a)/a,this.width=c-this.x,this.height=d-this.y,this},b.prototype.enlarge=function(a){var b=Math.min(this.x,a.x),d=Math.max(this.x+this.width,a.x+a.width),c=Math.min(this.y,a.y),e=Math.max(this.y+this.height,a.y+a.height);return this.x=b,this.width=d-b,this.y=c,this.height=e-c,this},b}(),fd=function(){function b(b,c,d){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=b,this.y=c,this.radius=d,this.type=a.SHAPES.CIRC}return b.prototype.clone=function(){return new b(this.x,this.y,this.radius)},b.prototype.contains=function(c,d){if(this.radius<=0)return!1;var e=this.radius*this.radius,a=this.x-c,b=this.y-d;return(a*=a)+(b*=b)<=e},b.prototype.getBounds=function(){return new d(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},b}(),fa=function(){function b(b,c,d,e){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0),this.x=b,this.y=c,this.width=d,this.height=e,this.type=a.SHAPES.ELIP}return b.prototype.clone=function(){return new b(this.x,this.y,this.width,this.height)},b.prototype.contains=function(c,d){if(this.width<=0||this.height<=0)return!1;var a=(c-this.x)/this.width,b=(d-this.y)/this.height;return(a*=a)+(b*=b)<=1},b.prototype.getBounds=function(){return new d(this.x-this.width,this.y-this.height,this.width,this.height)},b}(),aG=function(){function b(){for(var g=arguments,c=[],d=0,b,f,e,h;db!=h>b&&i<(b-e)/(h-e)*(j-f)+f&&(c=!c);return c},b}(),e_=function(){function b(b,c,d,e,f){void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),void 0===e&&(e=0),void 0===f&&(f=20),this.x=b,this.y=c,this.width=d,this.height=e,this.radius=f,this.type=a.SHAPES.RREC}return b.prototype.clone=function(){return new b(this.x,this.y,this.width,this.height,this.radius)},b.prototype.contains=function(d,e){var a,b,c,f;if(this.width<=0||this.height<=0)return!1;if(d>=this.x&&d<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){if(a=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2)),e>=this.y+a&&e<=this.y+this.height-a||d>=this.x+a&&d<=this.x+this.width-a)return!0;if(b=d-(this.x+a),c=e-(this.y+a),f=a*a,b*b+c*c<=f)return!0;if((b=d-(this.x+this.width-a))*b+c*c<=f)return!0;if(b*b+(c=e-(this.y+this.height-a))*c<=f)return!0;if((b=d-(this.x+a))*b+c*c<=f)return!0}return!1},b}(),P=function(){function a(c,d,a,b){void 0===a&&(a=0),void 0===b&&(b=0),this._x=a,this._y=b,this.cb=c,this.scope=d}return a.prototype.clone=function(b,c){return void 0===b&&(b=this.cb),void 0===c&&(c=this.scope),new a(b,c,this._x,this._y)},a.prototype.set=function(a,b){return void 0===a&&(a=0),void 0===b&&(b=a),this._x===a&&this._y===b||(this._x=a,this._y=b,this.cb.call(this.scope)),this},a.prototype.copyFrom=function(a){return this._x===a.x&&this._y===a.y||(this._x=a.x,this._y=a.y,this.cb.call(this.scope)),this},a.prototype.copyTo=function(a){return a.set(this._x,this._y),a},a.prototype.equals=function(a){return a.x===this._x&&a.y===this._y},Object.defineProperty(a.prototype,"x",{get:function(){return this._x},set:function(a){this._x!==a&&(this._x=a,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"y",{get:function(){return this._y},set:function(a){this._y!==a&&(this._y=a,this.cb.call(this.scope))},enumerable:!1,configurable:!0}),a}(),m=function(){function a(a,b,c,d,e,f){void 0===a&&(a=1),void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=1),void 0===e&&(e=0),void 0===f&&(f=0),this.array=null,this.a=a,this.b=b,this.c=c,this.d=d,this.tx=e,this.ty=f}return a.prototype.fromArray=function(a){this.a=a[0],this.b=a[1],this.c=a[3],this.d=a[4],this.tx=a[2],this.ty=a[5]},a.prototype.set=function(a,b,c,d,e,f){return this.a=a,this.b=b,this.c=c,this.d=d,this.tx=e,this.ty=f,this},a.prototype.toArray=function(b,c){this.array||(this.array=new Float32Array(9));var a=c||this.array;return b?(a[0]=this.a,a[1]=this.b,a[2]=0,a[3]=this.c,a[4]=this.d,a[5]=0,a[6]=this.tx,a[7]=this.ty,a[8]=1):(a[0]=this.a,a[1]=this.c,a[2]=this.tx,a[3]=this.b,a[4]=this.d,a[5]=this.ty,a[6]=0,a[7]=0,a[8]=1),a},a.prototype.apply=function(b,a){a=a||new g;var c=b.x,d=b.y;return a.x=this.a*c+this.c*d+this.tx,a.y=this.b*c+this.d*d+this.ty,a},a.prototype.applyInverse=function(c,b){b=b||new g;var a=1/(this.a*this.d+this.c*-this.b),d=c.x,e=c.y;return b.x=this.d*a*d+-this.c*a*e+(this.ty*this.c-this.tx*this.d)*a,b.y=this.a*a*e+-this.b*a*d+(-this.ty*this.a+this.tx*this.b)*a,b},a.prototype.translate=function(a,b){return this.tx+=a,this.ty+=b,this},a.prototype.scale=function(a,b){return this.a*=a,this.d*=b,this.c*=a,this.b*=b,this.tx*=a,this.ty*=b,this},a.prototype.rotate=function(c){var a=Math.cos(c),b=Math.sin(c),d=this.a,e=this.c,f=this.tx;return this.a=d*a-this.b*b,this.b=d*b+this.b*a,this.c=e*a-this.d*b,this.d=e*b+this.d*a,this.tx=f*a-this.ty*b,this.ty=f*b+this.ty*a,this},a.prototype.append=function(a){var b=this.a,c=this.b,d=this.c,e=this.d;return this.a=a.a*b+a.b*d,this.b=a.a*c+a.b*e,this.c=a.c*b+a.d*d,this.d=a.c*c+a.d*e,this.tx=a.tx*b+a.ty*d+this.tx,this.ty=a.tx*c+a.ty*e+this.ty,this},a.prototype.setTransform=function(h,i,c,d,e,f,a,b,g){return this.a=Math.cos(a+g)*e,this.b=Math.sin(a+g)*e,this.c=-Math.sin(a-b)*f,this.d=Math.cos(a-b)*f,this.tx=h-(c*this.a+d*this.c),this.ty=i-(c*this.b+d*this.d),this},a.prototype.prepend=function(a){var b=this.tx,c,d;return(1!==a.a||0!==a.b||0!==a.c||1!==a.d)&&(c=this.a,d=this.c,this.a=c*a.a+this.b*a.c,this.b=c*a.b+this.b*a.d,this.c=d*a.a+this.d*a.c,this.d=d*a.b+this.d*a.d),this.tx=b*a.a+this.ty*a.c+a.tx,this.ty=b*a.b+this.ty*a.d+a.ty,this},a.prototype.decompose=function(a){var b=this.a,c=this.b,d=this.c,e=this.d,f=a.pivot,h=-Math.atan2(-d,e),g=Math.atan2(c,b),i=Math.abs(h+g);return i<1e-5||Math.abs(aA-i)<1e-5?(a.rotation=g,a.skew.x=a.skew.y=0):(a.rotation=0,a.skew.x=h,a.skew.y=g),a.scale.x=Math.sqrt(b*b+c*c),a.scale.y=Math.sqrt(d*d+e*e),a.position.x=this.tx+(f.x*b+f.y*d),a.position.y=this.ty+(f.x*c+f.y*e),a},a.prototype.invert=function(){var b=this.a,c=this.b,d=this.c,e=this.d,f=this.tx,a=b*e-c*d;return this.a=e/a,this.b=-c/a,this.c=-d/a,this.d=b/a,this.tx=(d*this.ty-e*f)/a,this.ty=-(b*this.ty-c*f)/a,this},a.prototype.identity=function(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this},a.prototype.clone=function(){var b=new a;return b.a=this.a,b.b=this.b,b.c=this.c,b.d=this.d,b.tx=this.tx,b.ty=this.ty,b},a.prototype.copyTo=function(a){return a.a=this.a,a.b=this.b,a.c=this.c,a.d=this.d,a.tx=this.tx,a.ty=this.ty,a},a.prototype.copyFrom=function(a){return this.a=a.a,this.b=a.b,this.c=a.c,this.d=a.d,this.tx=a.tx,this.ty=a.ty,this},Object.defineProperty(a,"IDENTITY",{get:function(){return new a},enumerable:!1,configurable:!0}),Object.defineProperty(a,"TEMP_MATRIX",{get:function(){return new a},enumerable:!1,configurable:!0}),a}(),M=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],N=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],W=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],R=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],bT=[],eZ=[],aV=Math.sign,!function(){for(var a=0,d,b,f,g,h,i,c,e;a<16;a++){d=[],bT.push(d);for(b=0;b<16;b++)for(f=aV(M[a]*M[b]+W[a]*N[b]),g=aV(N[a]*M[b]+R[a]*N[b]),h=aV(M[a]*W[b]+W[a]*R[b]),i=aV(N[a]*W[b]+R[a]*R[b]),c=0;c<16;c++)if(M[c]===f&&N[c]===g&&W[c]===h&&R[c]===i){d.push(c);break}}for(a=0;a<16;a++)e=new m,e.set(M[a],N[a],W[a],R[a],0,0),eZ.push(e)}(),i={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:function(a){return M[a]},uY:function(a){return N[a]},vX:function(a){return W[a]},vY:function(a){return R[a]},inv:function(a){return 8&a?15&a:7&-a},add:function(a,b){return bT[a][b]},sub:function(a,b){return bT[a][i.inv(b)]},rotate180:function(a){return 4^a},isVertical:function(a){return 2==(3&a)},byDirection:function(a,b){return 2*Math.abs(a)<=Math.abs(b)?b>=0?i.S:i.N:2*Math.abs(b)<=Math.abs(a)?a>0?i.E:i.W:b>0?a>0?i.SE:i.SW:a>0?i.NE:i.NW},matrixAppendRotationInv:function(d,e,a,b){void 0===a&&(a=0),void 0===b&&(b=0);var c=eZ[i.inv(e)];c.tx=a,c.ty=b,d.append(c)}},bX=function(){function a(){this.worldTransform=new m,this.localTransform=new m,this.position=new P(this.onChange,this,0,0),this.scale=new P(this.onChange,this,1,1),this.pivot=new P(this.onChange,this,0,0),this.skew=new P(this.updateSkew,this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._localID=0,this._currentLocalID=0,this._worldID=0,this._parentID=0}return a.prototype.onChange=function(){this._localID++},a.prototype.updateSkew=function(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this._localID++},a.prototype.updateLocalTransform=function(){var a=this.localTransform;this._localID!==this._currentLocalID&&(a.a=this._cx*this.scale.x,a.b=this._sx*this.scale.x,a.c=this._cy*this.scale.y,a.d=this._sy*this.scale.y,a.tx=this.position.x-(this.pivot.x*a.a+this.pivot.y*a.c),a.ty=this.position.y-(this.pivot.x*a.b+this.pivot.y*a.d),this._currentLocalID=this._localID,this._parentID=-1)},a.prototype.updateTransform=function(d){var a=this.localTransform,b,c;this._localID!==this._currentLocalID&&(a.a=this._cx*this.scale.x,a.b=this._sx*this.scale.x,a.c=this._cy*this.scale.y,a.d=this._sy*this.scale.y,a.tx=this.position.x-(this.pivot.x*a.a+this.pivot.y*a.c),a.ty=this.position.y-(this.pivot.x*a.b+this.pivot.y*a.d),this._currentLocalID=this._localID,this._parentID=-1),this._parentID!==d._worldID&&(b=d.worldTransform,c=this.worldTransform,c.a=a.a*b.a+a.b*b.c,c.b=a.a*b.b+a.b*b.d,c.c=a.c*b.a+a.d*b.c,c.d=a.c*b.b+a.d*b.d,c.tx=a.tx*b.a+a.ty*b.c+b.tx,c.ty=a.tx*b.b+a.ty*b.d+b.ty,this._parentID=d._worldID,this._worldID++)},a.prototype.setFromMatrix=function(a){a.decompose(this),this._localID++},Object.defineProperty(a.prototype,"rotation",{get:function(){return this._rotation},set:function(a){this._rotation!==a&&(this._rotation=a,this.updateSkew())},enumerable:!1,configurable:!0}),a.IDENTITY=new a,a}(),b.SORTABLE_CHILDREN=!1,aO=function(){function a(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}return a.prototype.isEmpty=function(){return this.minX>this.maxX||this.minY>this.maxY},a.prototype.clear=function(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0},a.prototype.getRectangle=function(a){return this.minX>this.maxX||this.minY>this.maxY?d.EMPTY:((a=a||new d(0,0,1,1)).x=this.minX,a.y=this.minY,a.width=this.maxX-this.minX,a.height=this.maxY-this.minY,a)},a.prototype.addPoint=function(a){this.minX=Math.min(this.minX,a.x),this.maxX=Math.max(this.maxX,a.x),this.minY=Math.min(this.minY,a.y),this.maxY=Math.max(this.maxY,a.y)},a.prototype.addPointMatrix=function(a,b){var i=a.a,j=a.b,e=a.c,f=a.d,g=a.tx,h=a.ty,c=i*b.x+e*b.y+g,d=j*b.x+f*b.y+h;this.minX=Math.min(this.minX,c),this.maxX=Math.max(this.maxX,c),this.minY=Math.min(this.minY,d),this.maxY=Math.max(this.maxY,d)},a.prototype.addQuad=function(g){var c=this.minX,d=this.minY,e=this.maxX,f=this.maxY,b=g[0],a=g[1];c=be?b:e,f=a>f?a:f,c=(b=g[2])e?b:e,f=a>f?a:f,c=(b=g[4])e?b:e,f=a>f?a:f,c=(b=g[6])e?b:e,f=a>f?a:f,this.minX=c,this.minY=d,this.maxX=e,this.maxY=f},a.prototype.addFrame=function(a,b,c,d,e){this.addFrameMatrix(a.worldTransform,b,c,d,e)},a.prototype.addFrameMatrix=function(g,p,o,n,m){var l=g.a,i=g.b,h=g.c,q=g.d,j=g.tx,k=g.ty,f=this.minX,e=this.minY,d=this.maxX,c=this.maxY,b=l*p+h*o+j,a=i*p+q*o+k;f=bd?b:d,c=a>c?a:c,f=(b=l*n+h*o+j)d?b:d,c=a>c?a:c,f=(b=l*p+h*m+j)d?b:d,c=a>c?a:c,f=(b=l*n+h*m+j)d?b:d,c=a>c?a:c,this.minX=f,this.minY=e,this.maxX=d,this.maxY=c},a.prototype.addVertexData=function(h,i,j){for(var d=this.minX,e=this.minY,f=this.maxX,a=this.maxY,b=i,c,g;bf?c:f,a=g>a?g:a;this.minX=d,this.minY=e,this.maxX=f,this.maxY=a},a.prototype.addVertices=function(a,b,c,d){this.addVerticesMatrix(a.worldTransform,b,c,d)},a.prototype.addVerticesMatrix=function(a,r,u,t,c,g){var q,p,o,n,s,m,h,f,e,d,b,k,j,i,l;void 0===c&&(c=0),void 0===g&&(g=c);for(q=a.a,p=a.b,o=a.c,n=a.d,s=a.tx,m=a.ty,h=this.minX,f=this.minY,e=this.maxX,d=this.maxY,b=u;bd?a.maxX:d,this.maxY=a.maxY>e?a.maxY:e},a.prototype.addBoundsMask=function(a,b){var c=a.minX>b.minX?a.minX:b.minX,d=a.minY>b.minY?a.minY:b.minY,e=a.maxXi?e:i,this.maxY=f>j?f:j)},a.prototype.addBoundsMatrix=function(a,b){this.addFrameMatrix(b,a.minX,a.minY,a.maxX,a.maxY)},a.prototype.addBoundsArea=function(b,a){var c=b.minX>a.x?b.minX:a.x,d=b.minY>a.y?b.minY:a.y,e=b.maxXi?e:i,this.maxY=f>j?f:j)},a.prototype.pad=function(a,b){void 0===a&&(a=0),void 0===b&&(b=a),this.isEmpty()||(this.minX-=a,this.maxX+=a,this.minY-=b,this.maxY+=b)},a.prototype.addFramePad=function(a,b,c,d,e,f){a-=e,b-=f,c+=e,d+=f,this.minX=this.minXc?this.maxX:c,this.minY=this.minYd?this.maxY:d},a}(),bZ=function(a,b){return bZ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bZ(a,b)};function b_(b,a){function c(){this.constructor=b}bZ(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}k=function(b){function a(){var a=b.call(this)||this;return a.tempDisplayObjectParent=null,a.transform=new bX,a.alpha=1,a.visible=!0,a.renderable=!0,a.cullable=!1,a.cullArea=null,a.parent=null,a.worldAlpha=1,a._lastSortedIndex=0,a._zIndex=0,a.filterArea=null,a.filters=null,a._enabledFilters=null,a._bounds=new aO,a._localBounds=null,a._boundsID=0,a._boundsRect=null,a._localBoundsRect=null,a._mask=null,a._maskRefCount=0,a._destroyed=!1,a.isSprite=!1,a.isMask=!1,a}return b_(a,b),a.mixin=function(c){for(var d=Object.keys(c),b=0,e;b1)for(d=0;dthis.children.length)throw new Error(a+"addChildAt: The index "+b+" supplied is out of bounds "+this.children.length);return a.parent&&a.parent.removeChild(a),a.parent=this,this.sortDirty=!0,a.transform._parentID=-1,this.children.splice(b,0,a),this._boundsID++,this.onChildrenChange(b),a.emit("added",this),this.emit("childAdded",a,this,b),a},c.prototype.swapChildren=function(a,b){if(a!==b){var c=this.getChildIndex(a),d=this.getChildIndex(b);this.children[c]=b,this.children[d]=a,this.onChildrenChange(c=this.children.length)throw new Error("The index "+a+" supplied is out of bounds "+this.children.length);var c=this.getChildIndex(b);_(this.children,c,1),this.children.splice(a,0,b),this.onChildrenChange(a)},c.prototype.getChildAt=function(a){if(a<0||a>=this.children.length)throw new Error("getChildAt: Index ("+a+") does not exist.");return this.children[a]},c.prototype.removeChild=function(){for(var f=arguments,a=[],c=0,e,b,d;c1)for(e=0;e0&&c<=e){b=this.children.splice(f,c);for(a=0;a1&&this.children.sort(hq),this.sortDirty=!1},c.prototype.updateTransform=function(){var a,c,b;this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(a=0,c=this.children.length;a0&&d.height>0){if(this.cullArea?(b=this.cullArea,g=this.worldTransform):this._render!==c.prototype._render&&(b=this.getBounds(!0)),b&&d.intersects(b,g))this._render(f);else if(this.cullArea)return;for(e=0,i=this.children.length;e8)throw new Error("max arguments reached");c=this,e=c.name,b=c.items,this._aliasCount++;for(a=0,d=b.length;a0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))},a.prototype.add=function(a){return a[this._name]&&(this.ensureNonAliasedItems(),this.remove(a),this.items.push(a)),this},a.prototype.remove=function(b){var a=this.items.indexOf(b);return-1!==a&&(this.ensureNonAliasedItems(),this.items.splice(a,1)),this},a.prototype.contains=function(a){return-1!==this.items.indexOf(a)},a.prototype.removeAll=function(){return this.ensureNonAliasedItems(),this.items.length=0,this},a.prototype.destroy=function(){this.removeAll(),this.items=null,this._name=null},Object.defineProperty(a.prototype,"empty",{get:function(){return 0===this.items.length},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"name",{get:function(){return this._name},enumerable:!1,configurable:!0}),a}(),Object.defineProperties(p.prototype,{dispatch:{value:p.prototype.emit},run:{value:p.prototype.emit}}),a.UPDATE_PRIORITY=void 0,b.TARGET_FPMS=.06,function(a){a[a.INTERACTION=50]="INTERACTION",a[a.HIGH=25]="HIGH",a[a.NORMAL=0]="NORMAL",a[a.LOW=-25]="LOW",a[a.UTILITY=-50]="UTILITY"}(a.UPDATE_PRIORITY||(a.UPDATE_PRIORITY={})),ch=function(){function a(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=0),void 0===c&&(c=!1),this.next=null,this.previous=null,this._destroyed=!1,this.fn=d,this.context=a,this.priority=b,this.once=c}return a.prototype.match=function(b,a){return void 0===a&&(a=null),this.fn===b&&this.context===a},a.prototype.emit=function(a){this.fn&&(this.context?this.fn.call(this.context,a):this.fn(a));var b=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),b},a.prototype.connect=function(a){this.previous=a,a.next&&(a.next.previous=this),this.next=a.next,a.next=this},a.prototype.destroy=function(a){void 0===a&&(a=!1),this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);var b=this.next;return this.next=a?null:b,this.previous=null,b},a}(),o=function(){function c(){var a=this;this.autoStart=!1,this.deltaTime=1,this.lastTime=-1,this.speed=1,this.started=!1,this._requestId=null,this._maxElapsedMS=100,this._minElapsedMS=0,this._protected=!1,this._lastFrame=-1,this._head=new ch(null,null,1/0),this.deltaMS=1/b.TARGET_FPMS,this.elapsedMS=1/b.TARGET_FPMS,this._tick=function(b){a._requestId=null,a.started&&(a.update(b),a.started&&null===a._requestId&&a._head.next&&(a._requestId=requestAnimationFrame(a._tick)))}}return c.prototype._requestIfNeeded=function(){null===this._requestId&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))},c.prototype._cancelIfNeeded=function(){null!==this._requestId&&(cancelAnimationFrame(this._requestId),this._requestId=null)},c.prototype._startIfPossible=function(){this.started?this._requestIfNeeded():this.autoStart&&this.start()},c.prototype.add=function(c,d,b){return void 0===b&&(b=a.UPDATE_PRIORITY.NORMAL),this._addListener(new ch(c,d,b))},c.prototype.addOnce=function(c,d,b){return void 0===b&&(b=a.UPDATE_PRIORITY.NORMAL),this._addListener(new ch(c,d,b,!0))},c.prototype._addListener=function(b){var a=this._head.next,c=this._head;if(a){for(;a;){if(b.priority>a.priority){b.connect(c);break}c=a,a=a.next}b.previous||b.connect(c)}else b.connect(c);return this._startIfPossible(),this},c.prototype.remove=function(b,c){for(var a=this._head.next;a;)a=a.match(b,c)?a.destroy():a.next;return this._head.next||this._cancelIfNeeded(),this},Object.defineProperty(c.prototype,"count",{get:function(){if(!this._head)return 0;for(var a=0,b=this._head;b=b.next;)a++;return a},enumerable:!1,configurable:!0}),c.prototype.start=function(){this.started||(this.started=!0,this._requestIfNeeded())},c.prototype.stop=function(){this.started&&(this.started=!1,this._cancelIfNeeded())},c.prototype.destroy=function(){if(!this._protected){this.stop();for(var a=this._head.next;a;)a=a.destroy(!0);this._head.destroy(),this._head=null}},c.prototype.update=function(a){var c,e,f,d;if(void 0===a&&(a=performance.now()),a>this.lastTime){if((c=this.elapsedMS=a-this.lastTime)>this._maxElapsedMS&&(c=this._maxElapsedMS),c*=this.speed,this._minElapsedMS){if(e=a-this._lastFrame|0,e=0;--b)if(c=aq[b],c.test&&c.test(a,d))return new c(a,f);throw new Error("Unrecognized source type to auto-detect Resource")}cm=function(a,b){return cm=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cm(a,b)};function h(b,a){function c(){this.constructor=b}cm(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}co=function(){return co=Object.assign||function(d){for(var a,e=arguments,b=1,f=arguments.length,c;b0&&g>0,c.textureCacheIds=[],c.destroyed=!1,c.resource=null,c._batchEnabled=0,c._batchLocation=0,c.parentTextureArray=null,c.setResource(f),c}return h(c,d),Object.defineProperty(c.prototype,"realWidth",{get:function(){return Math.round(this.width*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"realHeight",{get:function(){return Math.round(this.height*this.resolution)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"mipmap",{get:function(){return this._mipmap},set:function(a){this._mipmap!==a&&(this._mipmap=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"scaleMode",{get:function(){return this._scaleMode},set:function(a){this._scaleMode!==a&&(this._scaleMode=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"wrapMode",{get:function(){return this._wrapMode},set:function(a){this._wrapMode!==a&&(this._wrapMode=a,this.dirtyStyleId++)},enumerable:!1,configurable:!0}),c.prototype.setStyle=function(a,b){var c;return void 0!==a&&a!==this.scaleMode&&(this.scaleMode=a,c=!0),void 0!==b&&b!==this.mipmap&&(this.mipmap=b,c=!0),c&&this.dirtyStyleId++,this},c.prototype.setSize=function(b,c,a){return a=a||this.resolution,this.setRealSize(b*a,c*a,a)},c.prototype.setRealSize=function(a,b,c){return this.resolution=c||this.resolution,this.width=Math.round(a)/this.resolution,this.height=Math.round(b)/this.resolution,this._refreshPOT(),this.update(),this},c.prototype._refreshPOT=function(){this.isPowerOfTwo=bI(this.realWidth)&&bI(this.realHeight)},c.prototype.setResolution=function(a){var b=this.resolution;return b===a||(this.resolution=a,this.valid&&(this.width=Math.round(this.width*b)/a,this.height=Math.round(this.height*b)/a,this.emit("update",this)),this._refreshPOT()),this},c.prototype.setResource=function(a){if(this.resource===a)return this;if(this.resource)throw new Error("Resource can be set only once");return a.bind(this),this.resource=a,this},c.prototype.update=function(){this.valid?(this.dirtyId++,this.dirtyStyleId++,this.emit("update",this)):this.width>0&&this.height>0&&(this.valid=!0,this.emit("loaded",this),this.emit("update",this))},c.prototype.onError=function(a){this.emit("error",this,a)},c.prototype.destroy=function(){this.resource&&(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),this.resource=null),this.cacheId&&(delete r[this.cacheId],delete q[this.cacheId],this.cacheId=null),this.dispose(),c.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0},c.prototype.dispose=function(){this.emit("dispose",this)},c.prototype.castToBaseTexture=function(){return this},c.from=function(d,f,g){var h,a,i,e;if(void 0===g&&(g=b.STRICT_TEXTURE_CACHE),h="string"==typeof d,a=null,h?a=d:(d._pixiId||(i=f&&f.pixiIdPrefix||"pixiid",d._pixiId=i+"_"+I()),a=d._pixiId),e=r[a],h&&g&&!e)throw new Error('The cacheId "'+a+'" does not exist in BaseTextureCache.');return e||((e=new c(d,f)).cacheId=a,c.addToCache(e,a)),e},c.fromBuffer=function(b,d,e,f){b=b||new Float32Array(d*e*4);var g=new S(b,{width:d,height:e}),h=b instanceof Float32Array?a.TYPES.FLOAT:a.TYPES.UNSIGNED_BYTE;return new c(g,Object.assign({},hs,f||{width:d,height:e,type:h}))},c.addToCache=function(b,a){a&&(-1===b.textureCacheIds.indexOf(a)&&b.textureCacheIds.push(a),r[a]&&console.warn("BaseTexture added to the cache with an id ["+a+"] that already had an entry"),r[a]=b)},c.removeFromCache=function(a){var b,d,c;if("string"==typeof a){if(b=r[a],b)return d=b.textureCacheIds.indexOf(a),d>-1&&b.textureCacheIds.splice(d,1),delete r[a],b}else if(a&&a.textureCacheIds){for(c=0;c0){if(!b.resource)throw new Error("CubeResource does not support copying of renderTexture.");this.addResourceAt(b.resource,c)}else b.target=a.TARGETS.TEXTURE_CUBE_MAP_POSITIVE_X+c,b.parentTextureArray=this.baseTexture,this.items[c]=b;return b.valid&&!this.valid&&this.resize(b.realWidth,b.realHeight),this.items[c]=b,this},b.prototype.upload=function(g,d,e){for(var f=this.itemDirtyIds,a=0,c;a)?\s*()]*-->)?\s*\]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i,a}(z),cA=function(b){function a(d,e){var c=this,f,n,g,h,l,i,j,k,m;if(e=e||{},!(d instanceof HTMLVideoElement)){f=document.createElement("video"),f.setAttribute("preload","auto"),f.setAttribute("webkit-playsinline",""),f.setAttribute("playsinline",""),"string"==typeof d&&(d=[d]),n=d[0].src||d[0],z.crossOrigin(f,n,e.crossorigin);for(g=0;g2},a.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(o.shared.add(this.update,this),this._isConnectedToTicker=!0)},a.prototype._onPlayStop=function(){this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1)},a.prototype._onCanPlay=function(){var a=this.source,b;a.removeEventListener("canplay",this._onCanPlay),a.removeEventListener("canplaythrough",this._onCanPlay),b=this.valid,this.resize(a.videoWidth,a.videoHeight),!b&&this._resolve&&(this._resolve(this),this._resolve=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&a.play()},a.prototype.dispose=function(){this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1);var a=this.source;a&&(a.removeEventListener("error",this._onError,!0),a.pause(),a.src="",a.load()),b.prototype.dispose.call(this)},Object.defineProperty(a.prototype,"autoUpdate",{get:function(){return this._autoUpdate},set:function(a){a!==this._autoUpdate&&(this._autoUpdate=a,!this._autoUpdate&&this._isConnectedToTicker?(o.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(o.shared.add(this.update,this),this._isConnectedToTicker=!0))},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"updateFPS",{get:function(){return this._updateFPS},set:function(a){a!==this._updateFPS&&(this._updateFPS=a)},enumerable:!1,configurable:!0}),a.test=function(b,c){return globalThis.HTMLVideoElement&&b instanceof HTMLVideoElement||a.TYPES.indexOf(c)>-1},a.TYPES=["mp4","m4v","webm","ogg","ogv","h264","avi","mov"],a.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"},a}(z),cB=function(b){function a(a){return b.call(this,a)||this}return h(a,b),a.test=function(a){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&a instanceof ImageBitmap},a}(z),aq.push(bc,cB,cw,cA,cz,S,cx,cu),eN={__proto__:null,Resource:Z,BaseImageResource:z,INSTALLED:aq,autoDetectResource:bB,AbstractMultiResource:bm,ArrayResource:cu,BufferResource:S,CanvasResource:cw,CubeResource:cx,ImageResource:bc,SVGResource:cz,VideoResource:cA,ImageBitmapResource:cB},hw=function(b){function c(){return null!==b&&b.apply(this,arguments)||this}return h(c,b),c.prototype.upload=function(g,b,c){var d=g.gl,e,f;return d.pixelStorei(d.UNPACK_PREMULTIPLY_ALPHA_WEBGL,b.alphaMode===a.ALPHA_MODES.UNPACK),e=b.realWidth,f=b.realHeight,c.width===e&&c.height===f?d.texSubImage2D(b.target,0,0,0,e,f,b.format,c.type,this.data):(c.width=e,c.height=f,d.texImage2D(b.target,0,c.internalFormat,e,f,0,b.format,c.type,this.data)),!0},c}(S),a_=function(){function b(b,c){this.width=Math.round(b||100),this.height=Math.round(c||100),this.stencil=!1,this.depth=!1,this.dirtyId=0,this.dirtyFormat=0,this.dirtySize=0,this.depthTexture=null,this.colorTextures=[],this.glFramebuffers={},this.disposeRunner=new p("disposeFramebuffer"),this.multisample=a.MSAA_QUALITY.NONE}return Object.defineProperty(b.prototype,"colorTexture",{get:function(){return this.colorTextures[0]},enumerable:!1,configurable:!0}),b.prototype.addColorTexture=function(b,c){return void 0===b&&(b=0),this.colorTextures[b]=c||new e(null,{scaleMode:a.SCALE_MODES.NEAREST,resolution:1,mipmap:a.MIPMAP_MODES.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this},b.prototype.addDepthTexture=function(b){return this.depthTexture=b||new e(new hw(null,{width:this.width,height:this.height}),{scaleMode:a.SCALE_MODES.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:a.MIPMAP_MODES.OFF,format:a.FORMATS.DEPTH_COMPONENT,type:a.TYPES.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this},b.prototype.enableDepth=function(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this},b.prototype.enableStencil=function(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this},b.prototype.resize=function(a,b){var d,e,c;if(a=Math.round(a),b=Math.round(b),a!==this.width||b!==this.height){this.width=a,this.height=b,this.dirtyId++,this.dirtySize++;for(d=0;d-1&&b.textureCacheIds.splice(d,1),delete q[a],b}else if(a&&a.textureCacheIds){for(c=0;cthis.baseTexture.width,g=e+c>this.baseTexture.height,f||g)throw h=f&&g?"and":"or",i="X: "+d+" + "+b+" = "+(d+b)+" > "+this.baseTexture.width,j="Y: "+e+" + "+c+" = "+(e+c)+" > "+this.baseTexture.height,new Error("Texture Error: frame does not fit inside the base Texture dimensions: "+i+" "+h+" "+j);this.valid=b&&c&&this.baseTexture.valid,this.trim||this.rotate||(this.orig=a),this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rotate",{get:function(){return this._rotate},set:function(a){this._rotate=a,this.valid&&this.updateUvs()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"width",{get:function(){return this.orig.width},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this.orig.height},enumerable:!1,configurable:!0}),a.prototype.castToBaseTexture=function(){return this.baseTexture},Object.defineProperty(a,"EMPTY",{get:function(){return a._EMPTY||(a._EMPTY=new a(new e),aP(a._EMPTY),aP(a._EMPTY.baseTexture)),a._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(a,"WHITE",{get:function(){if(!a._WHITE){var c=b.ADAPTER.createCanvas(16,16),d=c.getContext("2d");c.width=16,c.height=16,d.fillStyle="white",d.fillRect(0,0,16,16),a._WHITE=new a(e.from(c)),aP(a._WHITE),aP(a._WHITE.baseTexture)}return a._WHITE},enumerable:!1,configurable:!0}),a}(af),G=function(b){function a(c,d){var a=b.call(this,c,d)||this;return a.valid=!0,a.filterFrame=null,a.filterPoolKey=null,a.updateUvs(),a}return h(a,b),Object.defineProperty(a.prototype,"framebuffer",{get:function(){return this.baseTexture.framebuffer},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"multisample",{get:function(){return this.framebuffer.multisample},set:function(a){this.framebuffer.multisample=a},enumerable:!1,configurable:!0}),a.prototype.resize=function(e,f,b){void 0===b&&(b=!0);var a=this.baseTexture.resolution,c=Math.round(e*a)/a,d=Math.round(f*a)/a;this.valid=c>0&&d>0,this._frame.width=this.orig.width=c,this._frame.height=this.orig.height=d,b&&this.baseTexture.resize(c,d),this.updateUvs()},a.prototype.setResolution=function(b){var a=this.baseTexture;a.resolution!==b&&(a.setResolution(b),this.resize(a.width,a.height,!1))},a.create=function(b){for(var e=arguments,c=[],d=1;d1?-b:-1:(c=((65535&(d=aK(d)))<<16|65535&(e=aK(e)))>>>0,b>1&&(c+=4294967296*b)),this.texturePool[c]||(this.texturePool[c]=[]),g=this.texturePool[c].pop(),g||(g=this.createTexture(d,e,b)),g.filterPoolKey=c,g.setResolution(f),g},b.prototype.getFilterTexture=function(b,d,e){var c=this.getOptimalTexture(b.width,b.height,d||b.resolution,e||a.MSAA_QUALITY.NONE);return c.filterFrame=b.filterFrame,c},b.prototype.returnTexture=function(a){var b=a.filterPoolKey;a.filterFrame=null,this.texturePool[b].push(a)},b.prototype.returnFilterTexture=function(a){this.returnTexture(a)},b.prototype.clear=function(c){var d,a,b;if(c=!1!==c)for(d in this.texturePool)if(a=this.texturePool[d],a)for(b=0;b0&&a.height>0,this.texturePool)if(Number(b)<0){if(c=this.texturePool[b],c)for(d=0;d1){for(g=0;g1&&((h=this.getOptimalFilterTexture(c.width,c.height,b.resolution)).filterFrame=c.filterFrame),i[g].apply(this,c,h,a.CLEAR_MODES.CLEAR,b),n=c,c=h,h=n;i[g].apply(this,c,m.renderTexture,a.CLEAR_MODES.BLEND,b),g>1&&b.multisample>1&&this.returnFilterTexture(b.renderTexture),this.returnFilterTexture(c),this.returnFilterTexture(h)}b.clear(),this.statePool.push(b)},b.prototype.bindAndClear=function(b,d){var e,f,g,c,h;void 0===d&&(d=a.CLEAR_MODES.CLEAR),e=this.renderer,f=e.renderTexture,g=e.state,(b===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,b&&b.filterFrame)?(c=this.tempRect,c.x=0,c.y=0,c.width=b.filterFrame.width,c.height=b.filterFrame.height,f.bind(b,b.filterFrame,c)):b!==this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?f.bind(b):this.renderer.renderTexture.bind(b,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame),h=1&g.stateId||this.forceClear,(d===a.CLEAR_MODES.CLEAR||d===a.CLEAR_MODES.BLIT&&h)&&this.renderer.framebuffer.clear(0,0,0,0)},b.prototype.applyFilter=function(b,d,e,f){var c=this.renderer;c.state.set(b.state),this.bindAndClear(e,f),b.uniforms.uSampler=d,b.uniforms.filterGlobals=this.globalUniforms,c.shader.bind(b),b.legacy=!!b.program.attributeData.aTextureCoord,b.legacy?(this.quadUv.map(d._frame,d.filterFrame),c.geometry.bind(this.quadUv),c.geometry.draw(a.DRAW_MODES.TRIANGLES)):(c.geometry.bind(this.quad),c.geometry.draw(a.DRAW_MODES.TRIANGLE_STRIP))},b.prototype.calculateSpriteMatrix=function(h,b){var c=this.activeState,d=c.sourceFrame,e=c.destinationFrame,f=b._texture.orig,a=h.set(e.width,0,0,e.height,d.x,d.y),g=b.worldTransform.copyTo(m.TEMP_MATRIX);return g.invert(),a.prepend(g),a.scale(1/f.width,1/f.height),a.translate(b.anchor.x,b.anchor.y),a},b.prototype.destroy=function(){this.renderer=null,this.texturePool.clear(!1)},b.prototype.getOptimalFilterTexture=function(d,e,b,c){return void 0===b&&(b=1),void 0===c&&(c=a.MSAA_QUALITY.NONE),this.texturePool.getOptimalTexture(d,e,b,c)},b.prototype.getFilterTexture=function(b,c,f){var e,d;return"number"==typeof b&&(e=b,b=c,c=e),b=b||this.activeState.renderTexture,d=this.texturePool.getOptimalTexture(b.width,b.height,c||b.resolution,f||a.MSAA_QUALITY.NONE),d.filterFrame=b.filterFrame,d},b.prototype.returnFilterTexture=function(a){this.texturePool.returnTexture(a)},b.prototype.emptyPool=function(){this.texturePool.clear(!0)},b.prototype.resize=function(){this.texturePool.setScreenSize(this.renderer.view)},b.prototype.transformAABB=function(f,a){var b=bi[0],c=bi[1],d=bi[2],e=bi[3],g,h,i,j;b.set(a.left,a.top),c.set(a.left,a.bottom),d.set(a.right,a.top),e.set(a.right,a.bottom),f.apply(b,b),f.apply(c,c),f.apply(d,d),f.apply(e,e),g=Math.min(b.x,c.x,d.x,e.x),h=Math.min(b.y,c.y,d.y,e.y),i=Math.max(b.x,c.x,d.x,e.x),j=Math.max(b.y,c.y,d.y,e.y),a.x=g,a.y=h,a.width=i-g,a.height=j-h},b.prototype.roundFrame=function(c,e,b,d,a){if(!(c.width<=0||c.height<=0||b.width<=0||b.height<=0)){if(a){var f=a.a,g=a.b,h=a.c,i=a.d;if((Math.abs(g)>1e-4||Math.abs(h)>1e-4)&&(Math.abs(f)>1e-4||Math.abs(i)>1e-4))return}(a=a?dD.copyFrom(a):dD.identity()).translate(-b.x,-b.y).scale(d.width/b.width,d.height/b.height).translate(d.x,d.y),this.transformAABB(a,c),c.ceil(e),this.transformAABB(a.invert(),c)}},b}(),aF=function(){function a(a){this.renderer=a}return a.prototype.flush=function(){},a.prototype.destroy=function(){this.renderer=null},a.prototype.start=function(){},a.prototype.stop=function(){this.flush()},a.prototype.render=function(a){},a}(),db=function(){function a(a){this.renderer=a,this.emptyRenderer=new aF(a),this.currentRenderer=this.emptyRenderer}return a.prototype.setObjectRenderer=function(a){this.currentRenderer!==a&&(this.currentRenderer.stop(),this.currentRenderer=a,this.currentRenderer.start())},a.prototype.flush=function(){this.setObjectRenderer(this.emptyRenderer)},a.prototype.reset=function(){this.setObjectRenderer(this.emptyRenderer)},a.prototype.copyBoundTextures=function(b,c){for(var d=this.renderer.texture.boundTextures,a=c-1;a>=0;--a)b[a]=d[a]||null,b[a]&&(b[a]._batchLocation=a)},a.prototype.boundArray=function(e,g,k,h){for(var l=e.elements,i=e.ids,j=e.count,a=0,b=0,c,d,f;b=0&&d=a.ENV.WEBGL2&&(c=d.getContext("webgl2",e)),c)this.webGLVersion=2;else if(this.webGLVersion=1,!(c=d.getContext("webgl",e)||d.getContext("experimental-webgl",e)))throw new Error("This browser does not support WebGL. Try using the canvas renderer");return this.gl=c,this.getExtensions(),this.gl},c.prototype.getExtensions=function(){var a=this.gl,b={anisotropicFiltering:a.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:a.getExtension("OES_texture_float_linear"),s3tc:a.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:a.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:a.getExtension("WEBGL_compressed_texture_etc"),etc1:a.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:a.getExtension("WEBGL_compressed_texture_pvrtc")||a.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:a.getExtension("WEBGL_compressed_texture_atc"),astc:a.getExtension("WEBGL_compressed_texture_astc")};1===this.webGLVersion?Object.assign(this.extensions,b,{drawBuffers:a.getExtension("WEBGL_draw_buffers"),depthTexture:a.getExtension("WEBGL_depth_texture"),loseContext:a.getExtension("WEBGL_lose_context"),vertexArrayObject:a.getExtension("OES_vertex_array_object")||a.getExtension("MOZ_OES_vertex_array_object")||a.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:a.getExtension("OES_element_index_uint"),floatTexture:a.getExtension("OES_texture_float"),floatTextureLinear:a.getExtension("OES_texture_float_linear"),textureHalfFloat:a.getExtension("OES_texture_half_float"),textureHalfFloatLinear:a.getExtension("OES_texture_half_float_linear")}):2===this.webGLVersion&&Object.assign(this.extensions,b,{colorBufferFloat:a.getExtension("EXT_color_buffer_float")})},c.prototype.handleContextLost=function(a){a.preventDefault()},c.prototype.handleContextRestored=function(){this.renderer.runners.contextChange.emit(this.gl)},c.prototype.destroy=function(){var a=this.renderer.view;this.renderer=null,a.removeEventListener("webglcontextlost",this.handleContextLost),a.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()},c.prototype.postrender=function(){this.renderer.renderingToScreen&&this.gl.flush()},c.prototype.validateContext=function(a){var b=a.getContextAttributes(),c="WebGL2RenderingContext"in globalThis&&a instanceof globalThis.WebGL2RenderingContext,d;c&&(this.webGLVersion=2),b&&!b.stencil&&console.warn("Provided WebGL context does not have a stencil buffer, masks may not render correctly"),d=c||!!a.getExtension("OES_element_index_uint"),this.supports.uint32Indices=d,d||console.warn("Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly")},c}(),ei=function(b){this.framebuffer=b,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=a.MSAA_QUALITY.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0},ih=new d,dg=function(){function c(a){this.renderer=a,this.managedFramebuffers=[],this.unknownFramebuffer=new a_(10,10),this.msaaSamples=null}return c.prototype.contextChange=function(){var c=this.gl=this.renderer.gl,e,f;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new d,this.hasMRT=!0,this.writeDepthTexture=!0,this.disposeAll(!0),1===this.renderer.context.webGLVersion?(e=this.renderer.context.extensions.drawBuffers,f=this.renderer.context.extensions.depthTexture,b.PREFER_ENV===a.ENV.WEBGL_LEGACY&&(e=null,f=null),e?c.drawBuffers=function(a){return e.drawBuffersWEBGL(a)}:(this.hasMRT=!1,c.drawBuffers=function(){}),f||(this.writeDepthTexture=!1)):this.msaaSamples=c.getInternalformatParameter(c.RENDERBUFFER,c.RGBA8,c.SAMPLES)},c.prototype.bind=function(a,b,d){var e,c,g,i,f,h,j;if(void 0===d&&(d=0),e=this.gl,a){c=a.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(a),this.current!==a&&(this.current=a,e.bindFramebuffer(e.FRAMEBUFFER,c.framebuffer)),c.mipLevel!==d&&(a.dirtyId++,a.dirtyFormat++,c.mipLevel=d),c.dirtyId!==a.dirtyId&&(c.dirtyId=a.dirtyId,c.dirtyFormat!==a.dirtyFormat?(c.dirtyFormat=a.dirtyFormat,c.dirtySize=a.dirtySize,this.updateFramebuffer(a,d)):c.dirtySize!==a.dirtySize&&(c.dirtySize=a.dirtySize,this.resizeFramebuffer(a)));for(g=0;g>d,h=b.height>>d,j=f/b.width,this.setViewport(b.x*j,b.y*j,f,h)):(f=a.width>>d,h=a.height>>d,this.setViewport(0,0,f,h))}else this.current&&(this.current=null,e.bindFramebuffer(e.FRAMEBUFFER,null)),b?this.setViewport(b.x,b.y,b.width,b.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)},c.prototype.setViewport=function(b,c,d,e){var a=this.viewport;b=Math.round(b),c=Math.round(c),d=Math.round(d),e=Math.round(e),a.width===d&&a.height===e&&a.x===b&&a.y===c||(a.x=b,a.y=c,a.width=d,a.height=e,this.gl.viewport(b,c,d,e))},Object.defineProperty(c.prototype,"size",{get:function(){return this.current?{x:0,y:0,width:this.current.width,height:this.current.height}:{x:0,y:0,width:this.renderer.width,height:this.renderer.height}},enumerable:!1,configurable:!0}),c.prototype.clear=function(d,e,f,g,b){void 0===b&&(b=a.BUFFER_BITS.COLOR|a.BUFFER_BITS.DEPTH);var c=this.gl;c.clearColor(d,e,f,g),c.clear(b)},c.prototype.initFramebuffer=function(a){var c=this.gl,b=new ei(c.createFramebuffer());return b.multisample=this.detectSamples(a.multisample),a.glFramebuffers[this.CONTEXT_UID]=b,this.managedFramebuffers.push(a),a.disposeRunner.add(this),b},c.prototype.resizeFramebuffer=function(b){var a=this.gl,c=b.glFramebuffers[this.CONTEXT_UID],f,d,e,g,h;c.msaaBuffer&&(a.bindRenderbuffer(a.RENDERBUFFER,c.msaaBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,c.multisample,a.RGBA8,b.width,b.height)),c.stencil&&(a.bindRenderbuffer(a.RENDERBUFFER,c.stencil),c.msaaBuffer?a.renderbufferStorageMultisample(a.RENDERBUFFER,c.multisample,a.DEPTH24_STENCIL8,b.width,b.height):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,b.width,b.height)),f=b.colorTextures,d=f.length,a.drawBuffers||(d=Math.min(d,1));for(e=0;e1&&this.canMultisampleFramebuffer(c)?(b.msaaBuffer=b.msaaBuffer||a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,b.msaaBuffer),a.renderbufferStorageMultisample(a.RENDERBUFFER,b.multisample,a.RGBA8,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.RENDERBUFFER,b.msaaBuffer)):b.msaaBuffer&&(a.deleteRenderbuffer(b.msaaBuffer),b.msaaBuffer=null,b.blitFramebuffer&&(b.blitFramebuffer.dispose(),b.blitFramebuffer=null));for(f=[],d=0;d1&&a.drawBuffers(f),c.depthTexture&&this.writeDepthTexture&&(k=c.depthTexture,this.renderer.texture.bind(k,0),a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_2D,k._glTextures[this.CONTEXT_UID].texture,i)),!c.stencil&&!c.depth||c.depthTexture&&this.writeDepthTexture?b.stencil&&(a.deleteRenderbuffer(b.stencil),b.stencil=null):(b.stencil=b.stencil||a.createRenderbuffer(),a.bindRenderbuffer(a.RENDERBUFFER,b.stencil),b.msaaBuffer?a.renderbufferStorageMultisample(a.RENDERBUFFER,b.multisample,a.DEPTH24_STENCIL8,c.width,c.height):a.renderbufferStorage(a.RENDERBUFFER,a.DEPTH_STENCIL,c.width,c.height),a.framebufferRenderbuffer(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.RENDERBUFFER,b.stencil))},c.prototype.canMultisampleFramebuffer=function(a){return 1!==this.renderer.context.webGLVersion&&a.colorTextures.length<=1&&!a.depthTexture},c.prototype.detectSamples=function(e){var c=this.msaaSamples,b=a.MSAA_QUALITY.NONE,d;if(e<=1||null===c)return b;for(d=0;d=0&&this.managedFramebuffers.splice(d,1),b.disposeRunner.remove(this),e||(c.deleteFramebuffer(a.framebuffer),a.msaaBuffer&&c.deleteRenderbuffer(a.msaaBuffer),a.stencil&&c.deleteRenderbuffer(a.stencil)),a.blitFramebuffer&&a.blitFramebuffer.dispose())},c.prototype.disposeAll=function(c){var b=this.managedFramebuffers,a;this.managedFramebuffers=[];for(a=0;a=a.ENV.WEBGL2&&(c=d.getContext("webgl2",{})),c||((c=d.getContext("webgl",{})||d.getContext("experimental-webgl",{}))?c.getExtension("WEBGL_draw_buffers"):c=null),aC=c}return aC}function dT(b,c,d){if("precision"!==b.substring(0,9)){var e=c;return c===a.PRECISION.HIGH&&d!==a.PRECISION.HIGH&&(e=a.PRECISION.MEDIUM),"precision "+e+" float;\n"+b}return d!==a.PRECISION.HIGH&&"precision highp"===b.substring(0,15)?b.replace("precision highp","precision mediump"):b}hX={float:1,vec2:2,vec3:3,vec4:4,int:1,ivec2:2,ivec3:3,ivec4:4,uint:1,uvec2:2,uvec3:3,uvec4:4,bool:1,bvec2:2,bvec3:3,bvec4:4,mat2:4,mat3:9,mat4:16,sampler2D:1};function dN(a){return hX[a]}bv=null,dL={FLOAT:"float",FLOAT_VEC2:"vec2",FLOAT_VEC3:"vec3",FLOAT_VEC4:"vec4",INT:"int",INT_VEC2:"ivec2",INT_VEC3:"ivec3",INT_VEC4:"ivec4",UNSIGNED_INT:"uint",UNSIGNED_INT_VEC2:"uvec2",UNSIGNED_INT_VEC3:"uvec3",UNSIGNED_INT_VEC4:"uvec4",BOOL:"bool",BOOL_VEC2:"bvec2",BOOL_VEC3:"bvec3",BOOL_VEC4:"bvec4",FLOAT_MAT2:"mat2",FLOAT_MAT3:"mat3",FLOAT_MAT4:"mat4",SAMPLER_2D:"sampler2D",INT_SAMPLER_2D:"sampler2D",UNSIGNED_INT_SAMPLER_2D:"sampler2D",SAMPLER_CUBE:"samplerCube",INT_SAMPLER_CUBE:"samplerCube",UNSIGNED_INT_SAMPLER_CUBE:"samplerCube",SAMPLER_2D_ARRAY:"sampler2DArray",INT_SAMPLER_2D_ARRAY:"sampler2DArray",UNSIGNED_INT_SAMPLER_2D_ARRAY:"sampler2DArray"};function dK(d,e){var b,a,c;if(!bv){b=Object.keys(dL),bv={};for(a=0;a0&&(b+="\nelse "),a0?this.maskStack[this.maskStack.length-1]._colorMask:15;a!==c&&this.renderer.gl.colorMask(0!=(1&a),0!=(2&a),0!=(4&a),0!=(8&a))},b.prototype.destroy=function(){this.renderer=null},b}(),dQ=function(){function a(a){this.renderer=a,this.maskStack=[],this.glConst=0}return a.prototype.getStackLength=function(){return this.maskStack.length},a.prototype.setMaskStack=function(c){var a=this.renderer.gl,d=this.getStackLength(),b;this.maskStack=c,b=this.getStackLength(),b!==d&&(0===b?a.disable(this.glConst):(a.enable(this.glConst),this._useCurrent()))},a.prototype._useCurrent=function(){},a.prototype.destroy=function(){this.renderer=null,this.maskStack=null},a}(),dR=new m,dS=[],dt=function(c){function a(d){var a=c.call(this,d)||this;return a.glConst=b.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,a}return h(a,c),a.prototype.getStackLength=function(){var a=this.maskStack[this.maskStack.length-1];return a?a._scissorCounter:0},a.prototype.calcScissorRect=function(a){var c,g,h,e,b,f;a._scissorRectLocal||(g=a._scissorRect,h=a.maskObject,e=this.renderer,b=e.renderTexture,f=h.getBounds(!0,null!==(c=dS.pop())&&void 0!==c?c:new d),this.roundFrameToPixels(f,b.current?b.current.resolution:e.resolution,b.sourceFrame,b.destinationFrame,e.projection.transform),g&&f.fit(g),a._scissorRectLocal=f)},a.isMatrixRotated=function(a){if(!a)return!1;var b=a.a,c=a.b,d=a.c,e=a.d;return(Math.abs(c)>1e-4||Math.abs(d)>1e-4)&&(Math.abs(b)>1e-4||Math.abs(e)>1e-4)},a.prototype.testScissor=function(b){var c=b.maskObject,d;return!(!c.isFastRect||!c.isFastRect())&&(!a.isMatrixRotated(c.worldTransform)&&(!a.isMatrixRotated(this.renderer.projection.transform)&&(this.calcScissorRect(b),d=b._scissorRectLocal,d.width>0&&d.height>0)))},a.prototype.roundFrameToPixels=function(b,e,f,c,d){a.isMatrixRotated(d)||((d=d?dR.copyFrom(d):dR.identity()).translate(-f.x,-f.y).scale(c.width/f.width,c.height/f.height).translate(c.x,c.y),this.renderer.filter.transformAABB(d,b),b.fit(c),b.x=Math.round(b.x*e),b.y=Math.round(b.y*e),b.width=Math.round(b.width*e),b.height=Math.round(b.height*e))},a.prototype.push=function(a){a._scissorRectLocal||this.calcScissorRect(a);var b=this.renderer.gl;a._scissorRect||b.enable(b.SCISSOR_TEST),a._scissorCounter++,a._scissorRect=a._scissorRectLocal,this._useCurrent()},a.prototype.pop=function(a){var b=this.renderer.gl;a&&dS.push(a._scissorRectLocal),this.getStackLength()>0?this._useCurrent():b.disable(b.SCISSOR_TEST)},a.prototype._useCurrent=function(){var b,a=this.maskStack[this.maskStack.length-1]._scissorRect;b=this.renderer.renderTexture.current?a.y:this.renderer.height-a.height-a.y,this.renderer.gl.scissor(a.x,b,a.width,a.height)},a}(dQ),ds=function(c){function a(d){var a=c.call(this,d)||this;return a.glConst=b.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,a}return h(a,c),a.prototype.getStackLength=function(){var a=this.maskStack[this.maskStack.length-1];return a?a._stencilCounter:0},a.prototype.push=function(c){var d=c.maskObject,a=this.renderer.gl,e=c._stencilCounter,b;0===e&&(this.renderer.framebuffer.forceStencil(),a.clearStencil(0),a.clear(a.STENCIL_BUFFER_BIT),a.enable(a.STENCIL_TEST)),c._stencilCounter++,b=c._colorMask,0!==b&&(c._colorMask=0,a.colorMask(!1,!1,!1,!1)),a.stencilFunc(a.EQUAL,e,4294967295),a.stencilOp(a.KEEP,a.KEEP,a.INCR),d.renderable=!0,d.render(this.renderer),this.renderer.batch.flush(),d.renderable=!1,0!==b&&(c._colorMask=b,a.colorMask(0!=(1&b),0!=(2&b),0!=(4&b),0!=(8&b))),this._useCurrent()},a.prototype.pop=function(d){var a=this.renderer.gl,c,b;0===this.getStackLength()?a.disable(a.STENCIL_TEST):(c=0!==this.maskStack.length?this.maskStack[this.maskStack.length-1]:null,b=c?c._colorMask:15,0!==b&&(c._colorMask=0,a.colorMask(!1,!1,!1,!1)),a.stencilOp(a.KEEP,a.KEEP,a.DECR),d.renderable=!0,d.render(this.renderer),this.renderer.batch.flush(),d.renderable=!1,0!==b&&(c._colorMask=b,a.colorMask(0!=(1&b),0!=(2&b),0!=(4&b),0!=(8&b))),this._useCurrent())},a.prototype._useCurrent=function(){var a=this.renderer.gl;a.stencilFunc(a.EQUAL,this.getStackLength(),4294967295),a.stencilOp(a.KEEP,a.KEEP,a.KEEP)},a}(dQ),dq=function(){function a(a){this.renderer=a,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new m,this.transform=null}return a.prototype.update=function(b,c,d,e){this.destinationFrame=b||this.destinationFrame||this.defaultFrame,this.sourceFrame=c||this.sourceFrame||b,this.calculateProjection(this.destinationFrame,this.sourceFrame,d,e),this.transform&&this.projectionMatrix.append(this.transform);var a=this.renderer;a.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,a.globalUniforms.update(),a.shader.shader&&a.shader.syncUniformGroup(a.shader.shader.uniforms.globals)},a.prototype.calculateProjection=function(e,b,f,d){var a=this.projectionMatrix,c=d?-1:1;a.identity(),a.a=1/b.width*2,a.d=c*(1/b.height*2),a.tx=-1-b.x*a.a,a.ty=-c-b.y*a.d},a.prototype.setTransform=function(a){},a.prototype.destroy=function(){this.renderer=null},a}(),$=new d,aE=new d,dk=function(){function a(a){this.renderer=a,this.clearColor=a._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new d,this.destinationFrame=new d,this.viewportFrame=new d}return a.prototype.bind=function(a,c,b){var g,h,e,f,d;void 0===a&&(a=null),f=this.renderer,this.current=a,a?(e=(g=a.baseTexture).resolution,c||($.width=a.frame.width,$.height=a.frame.height,c=$),b||(aE.x=a.frame.x,aE.y=a.frame.y,aE.width=c.width,aE.height=c.height,b=aE),h=g.framebuffer):(e=f.resolution,c||($.width=f.screen.width,$.height=f.screen.height,c=$),b||((b=$).width=c.width,b.height=c.height)),d=this.viewportFrame,d.x=b.x*e,d.y=b.y*e,d.width=b.width*e,d.height=b.height*e,a||(d.y=f.view.height-(d.y+d.height)),d.ceil(),this.renderer.framebuffer.bind(h,d),this.renderer.projection.update(b,c,e,!h),a?this.renderer.mask.setMaskStack(g.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(c),this.destinationFrame.copyFrom(b)},a.prototype.clear=function(a,j){var h,i,g,b,f,c,d,e;a=this.current?a||this.current.baseTexture.clearColor:a||this.clearColor,h=this.destinationFrame,i=this.current?this.current.baseTexture:this.renderer.screen,g=h.width!==i.width||h.height!==i.height,g&&(b=this.viewportFrame,f=b.x,c=b.y,d=b.width,e=b.height,f=Math.round(f),c=Math.round(c),d=Math.round(d),e=Math.round(e),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(f,c,d,e)),this.renderer.framebuffer.clear(a[0],a[1],a[2],a[3],j),g&&this.renderer.scissor.pop()},a.prototype.resize=function(){this.bind(null)},a.prototype.reset=function(){this.bind(null)},a.prototype.destroy=function(){this.renderer=null},a}();function hW(c,d,a,e,b){a.buffer.update(b)}hU={float:"\n data[offset] = v;\n ",vec2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n ",vec3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n ",vec4:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n data[offset+3] = v[3];\n ",mat2:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n\n data[offset+4] = v[2];\n data[offset+5] = v[3];\n ",mat3:"\n data[offset] = v[0];\n data[offset+1] = v[1];\n data[offset+2] = v[2];\n\n data[offset + 4] = v[3];\n data[offset + 5] = v[4];\n data[offset + 6] = v[5];\n\n data[offset + 8] = v[6];\n data[offset + 9] = v[7];\n data[offset + 10] = v[8];\n ",mat4:"\n for(var i = 0; i < 16; i++)\n {\n data[offset + i] = v[i];\n }\n "},d$={float:4,vec2:8,vec3:12,vec4:16,int:4,ivec2:8,ivec3:12,ivec4:16,uint:4,uvec2:8,uvec3:12,uvec4:16,bool:4,bvec2:8,bvec3:12,bvec4:16,mat2:32,mat3:48,mat4:64};function ea(h){for(var e=h.map(function(a){return{data:a,offset:0,dataLen:0,dirty:0}}),a=0,c=0,b=0,f=0,d,g;f1&&(a=Math.max(a,16)*d.data.size),d.dataLen=a,c%a!=0&&c<16)&&(g=c%a%16,c+=g,b+=g),c+a>16?(b=16*Math.ceil(b/16),d.offset=b,b+=a,c=a):(d.offset=b,c+=a,b+=a);return{uboElements:e,size:b=16*Math.ceil(b/16)}}function eb(d,b){var a=[],c;for(c in d)b[c]&&a.push(b[c]);return a.sort(function(a,b){return a.index-b.index}),a}function ec(m,r){var f,k,o,b,e,a,j,c,l,d,h,n,g,i,p,q;if(!m.autoManage)return{size:0,syncFunc:hW};for(f=ea(eb(m.uniforms,r)),k=f.uboElements,o=f.size,b=["\n var v = null;\n var v2 = null;\n var cv = null;\n var t = 0;\n var gl = renderer.gl\n var index = 0;\n var data = buffer.data;\n "],e=0;e1?(n=dN(a.data.type),g=Math.max(d$[a.data.type]/16,1),i=n/g,p=(4-i%4)%4,b.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+a.offset/4+";\n\n t = 0;\n\n for(var i=0; i < "+a.data.size*g+"; i++)\n {\n for(var j = 0; j < "+i+"; j++)\n {\n data[offset++] = v[t++];\n }\n offset += "+p+";\n }\n\n ")):(q=hU[a.data.type],b.push("\n cv = ud."+c+".value;\n v = uv."+c+";\n offset = "+a.offset/4+";\n "+q+";\n ")))}return b.push("\n renderer.buffer.update(buffer);\n "),{size:o,syncFunc:new Function("ud","uv","renderer","syncData","buffer",b.join("\n"))}}ed=function(){function a(a,b){this.program=a,this.uniformData=b,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}return a.prototype.destroy=function(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null},a}();function ee(a,d){var f=dY(a,a.VERTEX_SHADER,d.vertexSrc),g=dY(a,a.FRAGMENT_SHADER,d.fragmentSrc),b=a.createProgram(),e,c,h,i;if(a.attachShader(b,f),a.attachShader(b,g),a.linkProgram(b),a.getProgramParameter(b,a.LINK_STATUS)||function(a,b,c,d){a.getProgramParameter(b,a.LINK_STATUS)||(a.getShaderParameter(c,a.COMPILE_STATUS)||dX(a,c),a.getShaderParameter(d,a.COMPILE_STATUS)||dX(a,d),console.error("PixiJS Error: Could not initialize shader."),""!==a.getProgramInfoLog(b)&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",a.getProgramInfoLog(b)))}(a,b,f,g),d.attributeData=function(c,a){for(var e={},g=a.getProgramParameter(c,a.ACTIVE_ATTRIBUTES),d=0,b,f,h;db?1:-1});for(c=0;c>=1,b++;this.stateId=a.data}for(b=0;bthis.checkCountMax&&(this.checkCount=0,this.run())))},c.prototype.run=function(){for(var d=this.renderer.texture,b=d.managedTextures,e=!1,a=0,c,f;athis.maxIdle&&(d.destroyTexture(c,!0),b[a]=null,e=!0);if(e){f=0;for(a=0;a=0;c--)this.unload(a.children[c])},c.prototype.destroy=function(){this.renderer=null},c}(),be=function(b){this.texture=b,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=a.TYPES.UNSIGNED_BYTE,this.internalFormat=a.FORMATS.RGBA,this.samplerType=0},cW=function(){function b(a){this.renderer=a,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new e,this.hasIntegerTextures=!1}return b.prototype.contextChange=function(){var b=this.gl=this.renderer.gl,d,c,e;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=function(b){var c,d,e,f,l,i,j,h,k,u,t,y,n,p,q,r,s,m,g,v,w,x,o;return"WebGL2RenderingContext"in globalThis&&b instanceof globalThis.WebGL2RenderingContext?((c={})[a.TYPES.UNSIGNED_BYTE]=((d={})[a.FORMATS.RGBA]=b.RGBA8,d[a.FORMATS.RGB]=b.RGB8,d[a.FORMATS.RG]=b.RG8,d[a.FORMATS.RED]=b.R8,d[a.FORMATS.RGBA_INTEGER]=b.RGBA8UI,d[a.FORMATS.RGB_INTEGER]=b.RGB8UI,d[a.FORMATS.RG_INTEGER]=b.RG8UI,d[a.FORMATS.RED_INTEGER]=b.R8UI,d[a.FORMATS.ALPHA]=b.ALPHA,d[a.FORMATS.LUMINANCE]=b.LUMINANCE,d[a.FORMATS.LUMINANCE_ALPHA]=b.LUMINANCE_ALPHA,d),c[a.TYPES.BYTE]=((e={})[a.FORMATS.RGBA]=b.RGBA8_SNORM,e[a.FORMATS.RGB]=b.RGB8_SNORM,e[a.FORMATS.RG]=b.RG8_SNORM,e[a.FORMATS.RED]=b.R8_SNORM,e[a.FORMATS.RGBA_INTEGER]=b.RGBA8I,e[a.FORMATS.RGB_INTEGER]=b.RGB8I,e[a.FORMATS.RG_INTEGER]=b.RG8I,e[a.FORMATS.RED_INTEGER]=b.R8I,e),c[a.TYPES.UNSIGNED_SHORT]=((f={})[a.FORMATS.RGBA_INTEGER]=b.RGBA16UI,f[a.FORMATS.RGB_INTEGER]=b.RGB16UI,f[a.FORMATS.RG_INTEGER]=b.RG16UI,f[a.FORMATS.RED_INTEGER]=b.R16UI,f[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT16,f),c[a.TYPES.SHORT]=((l={})[a.FORMATS.RGBA_INTEGER]=b.RGBA16I,l[a.FORMATS.RGB_INTEGER]=b.RGB16I,l[a.FORMATS.RG_INTEGER]=b.RG16I,l[a.FORMATS.RED_INTEGER]=b.R16I,l),c[a.TYPES.UNSIGNED_INT]=((i={})[a.FORMATS.RGBA_INTEGER]=b.RGBA32UI,i[a.FORMATS.RGB_INTEGER]=b.RGB32UI,i[a.FORMATS.RG_INTEGER]=b.RG32UI,i[a.FORMATS.RED_INTEGER]=b.R32UI,i[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT24,i),c[a.TYPES.INT]=((j={})[a.FORMATS.RGBA_INTEGER]=b.RGBA32I,j[a.FORMATS.RGB_INTEGER]=b.RGB32I,j[a.FORMATS.RG_INTEGER]=b.RG32I,j[a.FORMATS.RED_INTEGER]=b.R32I,j),c[a.TYPES.FLOAT]=((h={})[a.FORMATS.RGBA]=b.RGBA32F,h[a.FORMATS.RGB]=b.RGB32F,h[a.FORMATS.RG]=b.RG32F,h[a.FORMATS.RED]=b.R32F,h[a.FORMATS.DEPTH_COMPONENT]=b.DEPTH_COMPONENT32F,h),c[a.TYPES.HALF_FLOAT]=((k={})[a.FORMATS.RGBA]=b.RGBA16F,k[a.FORMATS.RGB]=b.RGB16F,k[a.FORMATS.RG]=b.RG16F,k[a.FORMATS.RED]=b.R16F,k),c[a.TYPES.UNSIGNED_SHORT_5_6_5]=((u={})[a.FORMATS.RGB]=b.RGB565,u),c[a.TYPES.UNSIGNED_SHORT_4_4_4_4]=((t={})[a.FORMATS.RGBA]=b.RGBA4,t),c[a.TYPES.UNSIGNED_SHORT_5_5_5_1]=((y={})[a.FORMATS.RGBA]=b.RGB5_A1,y),c[a.TYPES.UNSIGNED_INT_2_10_10_10_REV]=((n={})[a.FORMATS.RGBA]=b.RGB10_A2,n[a.FORMATS.RGBA_INTEGER]=b.RGB10_A2UI,n),c[a.TYPES.UNSIGNED_INT_10F_11F_11F_REV]=((p={})[a.FORMATS.RGB]=b.R11F_G11F_B10F,p),c[a.TYPES.UNSIGNED_INT_5_9_9_9_REV]=((q={})[a.FORMATS.RGB]=b.RGB9_E5,q),c[a.TYPES.UNSIGNED_INT_24_8]=((r={})[a.FORMATS.DEPTH_STENCIL]=b.DEPTH24_STENCIL8,r),c[a.TYPES.FLOAT_32_UNSIGNED_INT_24_8_REV]=((s={})[a.FORMATS.DEPTH_STENCIL]=b.DEPTH32F_STENCIL8,s),o=c):((m={})[a.TYPES.UNSIGNED_BYTE]=((g={})[a.FORMATS.RGBA]=b.RGBA,g[a.FORMATS.RGB]=b.RGB,g[a.FORMATS.ALPHA]=b.ALPHA,g[a.FORMATS.LUMINANCE]=b.LUMINANCE,g[a.FORMATS.LUMINANCE_ALPHA]=b.LUMINANCE_ALPHA,g),m[a.TYPES.UNSIGNED_SHORT_5_6_5]=((v={})[a.FORMATS.RGB]=b.RGB,v),m[a.TYPES.UNSIGNED_SHORT_4_4_4_4]=((w={})[a.FORMATS.RGBA]=b.RGBA,w),m[a.TYPES.UNSIGNED_SHORT_5_5_5_1]=((x={})[a.FORMATS.RGBA]=b.RGBA,x),o=m),o}(b),d=b.getParameter(b.MAX_TEXTURE_IMAGE_UNITS),this.boundTextures.length=d;for(c=0;c=0;--d)b=e[d],b&&b._glTextures[g].samplerType!==a.SAMPLER_TYPES.FLOAT&&this.renderer.texture.unbind(b)},b.prototype.initTexture=function(a){var b=new be(this.gl.createTexture());return b.dirtyId=-1,a._glTextures[this.CONTEXT_UID]=b,this.managedTextures.push(a),a.on("dispose",this.destroyTexture,this),b},b.prototype.initTextureType=function(b,c){var d,e;c.internalFormat=null!==(e=null===(d=this.internalFormats[b.type])||void 0===d?void 0:d[b.format])&&void 0!==e?e:b.format,2===this.webGLVersion&&b.type===a.TYPES.HALF_FLOAT?c.type=this.gl.HALF_FLOAT:c.type=b.type},b.prototype.updateTexture=function(c){var b=c._glTextures[this.CONTEXT_UID],f,d,e,g;b&&(f=this.renderer,(this.initTextureType(c,b),c.resource&&c.resource.upload(f,c,b))?b.samplerType!==a.SAMPLER_TYPES.FLOAT&&(this.hasIntegerTextures=!0):(d=c.realWidth,e=c.realHeight,g=f.gl,(b.width!==d||b.height!==e||b.dirtyId<0)&&(b.width=d,b.height=e,g.texImage2D(c.target,0,b.internalFormat,d,e,0,c.format,b.type,null))),c.dirtyStyleId!==b.dirtyStyleId&&this.updateTextureStyle(c),b.dirtyId=c.dirtyId)},b.prototype.destroyTexture=function(a,c){var d=this.gl,b;(a=a.castToBaseTexture())._glTextures[this.CONTEXT_UID]&&(this.unbind(a),d.deleteTexture(a._glTextures[this.CONTEXT_UID].texture),a.off("dispose",this.destroyTexture,this),delete a._glTextures[this.CONTEXT_UID],!c)&&(b=this.managedTextures.indexOf(a),-1!==b&&_(this.managedTextures,b,1))},b.prototype.updateTextureStyle=function(b){var c=b._glTextures[this.CONTEXT_UID];c&&(b.mipmap!==a.MIPMAP_MODES.POW2&&2===this.webGLVersion||b.isPowerOfTwo?c.mipmap=b.mipmap>=1:c.mipmap=!1,2===this.webGLVersion||b.isPowerOfTwo?c.wrapMode=b.wrapMode:c.wrapMode=a.WRAP_MODES.CLAMP,b.resource&&b.resource.style(this.renderer,b,c)||this.setStyle(b,c),c.dirtyStyleId=b.dirtyStyleId)},b.prototype.setStyle=function(c,d){var b=this.gl,e,f;d.mipmap&&c.mipmap!==a.MIPMAP_MODES.ON_MANUAL&&b.generateMipmap(c.target),b.texParameteri(c.target,b.TEXTURE_WRAP_S,d.wrapMode),b.texParameteri(c.target,b.TEXTURE_WRAP_T,d.wrapMode),d.mipmap?(b.texParameteri(c.target,b.TEXTURE_MIN_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR_MIPMAP_LINEAR:b.NEAREST_MIPMAP_NEAREST),e=this.renderer.context.extensions.anisotropicFiltering,e&&c.anisotropicLevel>0&&c.scaleMode===a.SCALE_MODES.LINEAR&&(f=Math.min(c.anisotropicLevel,b.getParameter(e.MAX_TEXTURE_MAX_ANISOTROPY_EXT)),b.texParameterf(c.target,e.TEXTURE_MAX_ANISOTROPY_EXT,f))):b.texParameteri(c.target,b.TEXTURE_MIN_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR:b.NEAREST),b.texParameteri(c.target,b.TEXTURE_MAG_FILTER,c.scaleMode===a.SCALE_MODES.LINEAR?b.LINEAR:b.NEAREST)},b.prototype.destroy=function(){this.renderer=null},b}(),em={__proto__:null,FilterSystem:c$,BatchSystem:db,ContextSystem:dd,FramebufferSystem:dg,GeometrySystem:di,MaskSystem:du,ScissorSystem:dt,StencilSystem:ds,ProjectionSystem:dq,RenderTextureSystem:dk,ShaderSystem:df,StateSystem:de,TextureGCSystem:dc,TextureSystem:cW},cU=new m,eo=function(e){function c(g,f){void 0===g&&(g=a.RENDERER_TYPE.UNKNOWN);var c=e.call(this)||this;return f=Object.assign({},b.RENDER_OPTIONS,f),c.options=f,c.type=g,c.screen=new d(0,0,f.width,f.height),c.view=f.view||b.ADAPTER.createCanvas(),c.resolution=f.resolution||b.RESOLUTION,c.useContextAlpha=f.useContextAlpha,c.autoDensity=!!f.autoDensity,c.preserveDrawingBuffer=f.preserveDrawingBuffer,c.clearBeforeRender=f.clearBeforeRender,c._backgroundColor=0,c._backgroundColorRgba=[0,0,0,1],c._backgroundColorString="#000000",c.backgroundColor=f.backgroundColor||c._backgroundColor,c.backgroundAlpha=f.backgroundAlpha,void 0!==f.transparent&&(c.useContextAlpha=f.transparent,c.backgroundAlpha=f.transparent?0:1),c._lastObjectRendered=null,c.plugins={},c}return h(c,e),c.prototype.initPlugins=function(a){for(var b in a)this.plugins[b]=new a[b](this)},Object.defineProperty(c.prototype,"width",{get:function(){return this.view.width},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"height",{get:function(){return this.view.height},enumerable:!1,configurable:!0}),c.prototype.resize=function(c,d){this.view.width=Math.round(c*this.resolution),this.view.height=Math.round(d*this.resolution);var a=this.view.width/this.resolution,b=this.view.height/this.resolution;this.screen.width=a,this.screen.height=b,this.autoDensity&&(this.view.style.width=a+"px",this.view.style.height=b+"px"),this.emit("resize",a,b)},c.prototype.generateTexture=function(c,b,g,a){var e,f,d;return void 0===b&&(b={}),"number"==typeof b&&(b={scaleMode:b,resolution:g,region:a}),e=b.region,f=function(b,e){var d={},a,c;for(a in b)Object.prototype.hasOwnProperty.call(b,a)&&e.indexOf(a)<0&&(d[a]=b[a]);if(null!=b&&"function"==typeof Object.getOwnPropertySymbols){c=0;for(a=Object.getOwnPropertySymbols(b);c=a.data.byteLength?b.bufferSubData(a.type,0,a.data):(e=a.static?b.STATIC_DRAW:b.DYNAMIC_DRAW,c.byteLength=a.data.byteLength,b.bufferData(a.type,a.data,e)))},a.prototype.dispose=function(a,c){if(this.managedBuffers[a.id]){delete this.managedBuffers[a.id];var b=a._glBuffers[this.CONTEXT_UID],d=this.gl;a.disposeRunner.remove(this),b&&(c||d.deleteBuffer(b.buffer),delete a._glBuffers[this.CONTEXT_UID])}},a.prototype.disposeAll=function(c){for(var b=Object.keys(this.managedBuffers),a=0;a=a.MSAA_QUALITY.HIGH?this.multisample=a.MSAA_QUALITY.HIGH:c>=a.MSAA_QUALITY.MEDIUM?this.multisample=a.MSAA_QUALITY.MEDIUM:c>=a.MSAA_QUALITY.LOW?this.multisample=a.MSAA_QUALITY.LOW:this.multisample=a.MSAA_QUALITY.NONE},b.prototype.addSystem=function(c,a){var b=new c(this),d;if(this[a])throw new Error('Whoops! The name "'+a+'" is already in use');for(d in this[a]=b,this.runners)this.runners[d].add(b);return this},b.prototype.render=function(c,a){var b,d,e,f,g;a&&(a instanceof G?(b=a,d=arguments[2],e=arguments[3],f=arguments[4]):(b=a.renderTexture,d=a.clear,e=a.transform,f=a.skipUpdateTransform)),this.renderingToScreen=!b,this.runners.prerender.emit(),this.emit("prerender"),this.projection.transform=e,!this.context.isLost&&(b||(this._lastObjectRendered=c),!f&&(g=c.enableTempParent(),c.updateTransform(),c.disableTempParent(g)),this.renderTexture.bind(b),this.batch.currentRenderer.start(),(void 0!==d?d:this.clearBeforeRender)&&this.renderTexture.clear(),c.render(this),this.batch.currentRenderer.flush(),b&&b.baseTexture.update(),this.runners.postrender.emit(),this.projection.transform=null,this.emit("postrender"))},b.prototype.generateTexture=function(b,a,d,e){void 0===a&&(a={});var f=c.prototype.generateTexture.call(this,b,a,d,e);return this.framebuffer.blit(),f},b.prototype.resize=function(a,b){c.prototype.resize.call(this,a,b),this.runners.resize.emit(this.screen.height,this.screen.width)},b.prototype.reset=function(){return this.runners.reset.emit(),this},b.prototype.clear=function(){this.renderTexture.bind(),this.renderTexture.clear()},b.prototype.destroy=function(a){for(var b in this.runners.destroy.emit(),this.runners)this.runners[b].destroy();c.prototype.destroy.call(this,a),this.gl=null},Object.defineProperty(b.prototype,"extract",{get:function(){return this.plugins.extract},enumerable:!1,configurable:!0}),b.registerPlugin=function(b,c){A.add({name:b,type:a.ExtensionType.RendererPlugin,ref:c})},b.__plugins={},b}(eo);function es(a){return cS.create(a)}A.handleByMap(a.ExtensionType.RendererPlugin,cS.__plugins),et="attribute vec2 aVertexPosition;\nattribute vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n vTextureCoord = aTextureCoord;\n}",cR="attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 vTextureCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n}\n",hB=function(){function a(a){this.renderer=a}return a.prototype.destroy=function(){this.renderer=null},a}(),bb=function(){this.texArray=null,this.blend=0,this.type=a.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},aY=function(){function a(){this.elements=[],this.ids=[],this.count=0}return a.prototype.clear=function(){for(var a=0;athis.size&&this.flush(),this._vertexCount+=a.vertexData.length/2,this._indexCount+=a.indices.length,this._bufferedTextures[this._bufferSize]=a._texture.baseTexture,this._bufferedElements[this._bufferSize++]=a)},c.prototype.buildTexturesAndDrawCalls=function(){var k=this._bufferedTextures,g=this.MAX_TEXTURES,m=c._textureArrayPool,i=this.renderer.batch,f=this._tempBoundTextures,n=this.renderer.textureGC.count,d=++e._globalBatch,l=0,b=m[0],j=0,a,h;i.copyBoundTextures(f,g);for(a=0;a=g&&(i.boundArray(b,f,d,g),this.buildDrawCalls(b,j,a),j=a,b=m[++l],++d),h._batchEnabled=d,h.touched=n,b.elements[b.count++]=h);for(b.count>0&&(i.boundArray(b,f,d,g),this.buildDrawCalls(b,j,this._bufferSize),++l,++d),a=0;a0&&(a+="\nelse "),b title : "+a.title+"
tabIndex: "+a.tabIndex},b.prototype.capHitArea=function(a){a.x<0&&(a.width+=a.x,a.x=0),a.y<0&&(a.height+=a.y,a.y=0);var b=this.renderer,c=b.width,d=b.height;a.x+a.width>c&&(a.width=c-a.x),a.y+a.height>d&&(a.height=d-a.y)},b.prototype.addChild=function(b){var a=this.pool.pop();a||((a=document.createElement("button")).style.width="100px",a.style.height="100px",a.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",a.style.position="absolute",a.style.zIndex=2..toString(),a.style.borderStyle="none",navigator.userAgent.toLowerCase().indexOf("chrome")>-1?a.setAttribute("aria-live","off"):a.setAttribute("aria-live","polite"),navigator.userAgent.match(/rv:.*Gecko\//)?a.setAttribute("aria-relevant","additions"):a.setAttribute("aria-relevant","text"),a.addEventListener("click",this._onClick.bind(this)),a.addEventListener("focus",this._onFocus.bind(this)),a.addEventListener("focusout",this._onFocusOut.bind(this))),a.style.pointerEvents=b.accessiblePointerEvents,a.type=b.accessibleType,b.accessibleTitle&&null!==b.accessibleTitle?a.title=b.accessibleTitle:b.accessibleHint&&null!==b.accessibleHint||(a.title="displayObject "+b.tabIndex),b.accessibleHint&&null!==b.accessibleHint&&a.setAttribute("aria-label",b.accessibleHint),this.debug&&this.updateDebugHTML(a),b._accessibleActive=!0,b._accessibleDiv=a,a.displayObject=b,this.children.push(b),this.div.appendChild(b._accessibleDiv),b._accessibleDiv.tabIndex=b.tabIndex},b.prototype._onClick=function(d){var a=this.renderer.plugins.interaction,b=d.target.displayObject,c=a.eventData;a.dispatchEvent(b,"click",c),a.dispatchEvent(b,"pointertap",c),a.dispatchEvent(b,"tap",c)},b.prototype._onFocus=function(a){a.target.getAttribute("aria-live")||a.target.setAttribute("aria-live","assertive");var b=this.renderer.plugins.interaction,c=a.target.displayObject,d=b.eventData;b.dispatchEvent(c,"mouseover",d)},b.prototype._onFocusOut=function(a){a.target.getAttribute("aria-live")||a.target.setAttribute("aria-live","polite");var b=this.renderer.plugins.interaction,c=a.target.displayObject,d=b.eventData;b.dispatchEvent(c,"mouseout",d)},b.prototype._onKeyDown=function(a){9===a.keyCode&&this.activate()},b.prototype._onMouseMove=function(a){0===a.movementX&&0===a.movementY||this.deactivate()},b.prototype.destroy=function(){this.destroyTouchHook(),this.div=null,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown),this.pool=null,this.children=null,this.renderer=null},b.extension={name:"accessibility",type:[a.ExtensionType.RendererPlugin,a.ExtensionType.CanvasRendererPlugin]},b}(),cC=function(){function a(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new g,this.target=null,this.originalEvent=null,this.identifier=null,this.isPrimary=!1,this.button=0,this.buttons=0,this.width=0,this.height=0,this.tiltX=0,this.tiltY=0,this.pointerType=null,this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0}return Object.defineProperty(a.prototype,"pointerId",{get:function(){return this.identifier},enumerable:!1,configurable:!0}),a.prototype.getLocalPosition=function(a,b,c){return a.worldTransform.applyInverse(c||this.global,b)},a.prototype.copyEvent=function(a){"isPrimary"in a&&a.isPrimary&&(this.isPrimary=!0),this.button="button"in a&&a.button;var b="buttons"in a&&a.buttons;this.buttons=Number.isInteger(b)?b:"which"in a&&a.which,this.width="width"in a&&a.width,this.height="height"in a&&a.height,this.tiltX="tiltX"in a&&a.tiltX,this.tiltY="tiltY"in a&&a.tiltY,this.pointerType="pointerType"in a&&a.pointerType,this.pressure="pressure"in a&&a.pressure,this.rotationAngle="rotationAngle"in a&&a.rotationAngle,this.twist="twist"in a&&a.twist||0,this.tangentialPressure="tangentialPressure"in a&&a.tangentialPressure||0},a.prototype.reset=function(){this.isPrimary=!1},a}(),cr=function(a,b){return cr=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cr(a,b)},eP=function(){function a(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.target=null,this.currentTarget=null,this.type=null,this.data=null}return a.prototype.stopPropagation=function(){this.stopped=!0,this.stopPropagationHint=!0,this.stopsPropagatingAt=this.currentTarget},a.prototype.reset=function(){this.stopped=!1,this.stopsPropagatingAt=null,this.stopPropagationHint=!1,this.currentTarget=null,this.target=null},a}(),bA=function(){function a(b){this._pointerId=b,this._flags=a.FLAGS.NONE}return a.prototype._doSet=function(a,b){this._flags=b?this._flags|a:this._flags&~a},Object.defineProperty(a.prototype,"pointerId",{get:function(){return this._pointerId},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"flags",{get:function(){return this._flags},set:function(a){this._flags=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"none",{get:function(){return this._flags===a.FLAGS.NONE},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"over",{get:function(){return 0!=(this._flags&a.FLAGS.OVER)},set:function(b){this._doSet(a.FLAGS.OVER,b)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rightDown",{get:function(){return 0!=(this._flags&a.FLAGS.RIGHT_DOWN)},set:function(b){this._doSet(a.FLAGS.RIGHT_DOWN,b)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"leftDown",{get:function(){return 0!=(this._flags&a.FLAGS.LEFT_DOWN)},set:function(b){this._doSet(a.FLAGS.LEFT_DOWN,b)},enumerable:!1,configurable:!0}),a.FLAGS=Object.freeze({NONE:0,OVER:1,LEFT_DOWN:2,RIGHT_DOWN:4}),a}(),hr=function(){function a(){this._tempPoint=new g}return a.prototype.recursiveFindHit=function(c,a,h,b,e){var f,g,d,i,l,j,m,k,n,o;if(!a||!a.visible)return!1;if(g=c.data.global,d=!1,i=e=a.interactive||e,l=!0,a.hitArea?(b&&(a.worldTransform.applyInverse(g,this._tempPoint),a.hitArea.contains(this._tempPoint.x,this._tempPoint.y)?d=!0:(b=!1,l=!1)),i=!1):a._mask&&b&&(j=a._mask.isMaskData?a._mask.maskObject:a._mask,j&&!(null===(f=j.containsPoint)||void 0===f?void 0:f.call(j,g))&&(b=!1)),l&&a.interactiveChildren&&a.children)for(m=a.children,k=m.length-1;k>=0;k--)if(n=m[k],o=this.recursiveFindHit(c,n,h,b,i),o){if(!n.parent)continue;i=!1,o&&(c.target&&(b=!1),d=!0)}return e&&(b&&!c.target&&!a.hitArea&&a.containsPoint&&a.containsPoint(g)&&(d=!0),a.interactive&&(d&&!c.target&&(c.target=a),h&&h(c,a,!!d))),d},a.prototype.findHit=function(a,b,c,d){this.recursiveFindHit(a,b,c,d,!1)},a}(),eS={interactive:!1,interactiveChildren:!0,hitArea:null,get buttonMode(){return"pointer"===this.cursor},set buttonMode(a){a?this.cursor="pointer":"pointer"===this.cursor&&(this.cursor=null)},cursor:null,get trackedPointers(){return void 0===this._trackedPointers&&(this._trackedPointers={}),this._trackedPointers},_trackedPointers:void 0},k.mixin(eS),bw={target:null,data:{global:null}},eU=function(c){function b(d,b){var a=c.call(this)||this;return b=b||{},a.renderer=d,a.autoPreventDefault=void 0===b.autoPreventDefault||b.autoPreventDefault,a.interactionFrequency=b.interactionFrequency||10,a.mouse=new cC,a.mouse.identifier=1,a.mouse.global.set(-999999),a.activeInteractionData={},a.activeInteractionData[1]=a.mouse,a.interactionDataPool=[],a.eventData=new eP,a.interactionDOMElement=null,a.moveWhenInside=!1,a.eventsAdded=!1,a.tickerAdded=!1,a.mouseOverRenderer=!("PointerEvent"in globalThis),a.supportsTouchEvents="ontouchstart"in globalThis,a.supportsPointerEvents=!!globalThis.PointerEvent,a.onPointerUp=a.onPointerUp.bind(a),a.processPointerUp=a.processPointerUp.bind(a),a.onPointerCancel=a.onPointerCancel.bind(a),a.processPointerCancel=a.processPointerCancel.bind(a),a.onPointerDown=a.onPointerDown.bind(a),a.processPointerDown=a.processPointerDown.bind(a),a.onPointerMove=a.onPointerMove.bind(a),a.processPointerMove=a.processPointerMove.bind(a),a.onPointerOut=a.onPointerOut.bind(a),a.processPointerOverOut=a.processPointerOverOut.bind(a),a.onPointerOver=a.onPointerOver.bind(a),a.cursorStyles={default:"inherit",pointer:"pointer"},a.currentCursorMode=null,a.cursor=null,a.resolution=1,a.delayedEvents=[],a.search=new hr,a._tempDisplayObject=new ca,a._eventListenerOptions={capture:!0,passive:!1},a._useSystemTicker=void 0===b.useSystemTicker||b.useSystemTicker,a.setTargetElement(a.renderer.view,a.renderer.resolution),a}return function(b,a){function c(){this.constructor=b}cr(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,c),Object.defineProperty(b.prototype,"useSystemTicker",{get:function(){return this._useSystemTicker},set:function(a){this._useSystemTicker=a,a?this.addTickerListener():this.removeTickerListener()},enumerable:!1,configurable:!0}),Object.defineProperty(b.prototype,"lastObjectRendered",{get:function(){return this.renderer._lastObjectRendered||this._tempDisplayObject},enumerable:!1,configurable:!0}),b.prototype.hitTest=function(b,a){return bw.target=null,bw.data.global=b,a||(a=this.lastObjectRendered),this.processInteractive(bw,a,null,!0),bw.target},b.prototype.setTargetElement=function(b,a){void 0===a&&(a=1),this.removeTickerListener(),this.removeEvents(),this.interactionDOMElement=b,this.resolution=a,this.addEvents(),this.addTickerListener()},b.prototype.addTickerListener=function(){!this.tickerAdded&&this.interactionDOMElement&&this._useSystemTicker&&(o.system.add(this.tickerUpdate,this,a.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},b.prototype.removeTickerListener=function(){this.tickerAdded&&(o.system.remove(this.tickerUpdate,this),this.tickerAdded=!1)},b.prototype.addEvents=function(){if(!this.eventsAdded&&this.interactionDOMElement){var a=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(a.msContentZooming="none",a.msTouchAction="none"):this.supportsPointerEvents&&(a.touchAction="none"),this.supportsPointerEvents?(globalThis.document.addEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.addEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.addEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.addEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.addEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.addEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.addEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.eventsAdded=!0}},b.prototype.removeEvents=function(){if(this.eventsAdded&&this.interactionDOMElement){var a=this.interactionDOMElement.style;globalThis.navigator.msPointerEnabled?(a.msContentZooming="",a.msTouchAction=""):this.supportsPointerEvents&&(a.touchAction=""),this.supportsPointerEvents?(globalThis.document.removeEventListener("pointermove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerdown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerleave",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("pointerover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("pointercancel",this.onPointerCancel,this._eventListenerOptions),globalThis.removeEventListener("pointerup",this.onPointerUp,this._eventListenerOptions)):(globalThis.document.removeEventListener("mousemove",this.onPointerMove,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mousedown",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseout",this.onPointerOut,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("mouseover",this.onPointerOver,this._eventListenerOptions),globalThis.removeEventListener("mouseup",this.onPointerUp,this._eventListenerOptions)),this.supportsTouchEvents&&(this.interactionDOMElement.removeEventListener("touchstart",this.onPointerDown,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchcancel",this.onPointerCancel,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchend",this.onPointerUp,this._eventListenerOptions),this.interactionDOMElement.removeEventListener("touchmove",this.onPointerMove,this._eventListenerOptions)),this.interactionDOMElement=null,this.eventsAdded=!1}},b.prototype.tickerUpdate=function(a){this._deltaTime+=a,this._deltaTime0&&(h=b.composedPath()[0]);for(d=h!==this.interactionDOMElement?"outside":"",f=0;f0||b.responseType===a.XHR_RESPONSE_TYPE.BUFFER)?d=200:1223===d&&(d=204),2==(d/100|0)){if(this.xhrType===a.XHR_RESPONSE_TYPE.TEXT)this.data=c,this.type=a.TYPE.TEXT;else if(this.xhrType===a.XHR_RESPONSE_TYPE.JSON)try{this.data=JSON.parse(c),this.type=a.TYPE.JSON}catch(a){return void this.abort("Error trying to parse loaded json: "+a)}else if(this.xhrType===a.XHR_RESPONSE_TYPE.DOCUMENT)try{globalThis.DOMParser?(f=new DOMParser,this.data=f.parseFromString(c,"text/xml")):(e=document.createElement("div"),e.innerHTML=c,this.data=e),this.type=a.TYPE.XML}catch(a){return void this.abort("Error trying to parse loaded xml: "+a)}else this.data=b.response||c;this.complete()}else this.abort("["+b.status+"] "+b.statusText+": "+b.responseURL)},a.prototype._determineCrossOrigin=function(c,a){if(0===c.indexOf("data:"))return"";if(globalThis.origin!==globalThis.location.origin)return"anonymous";a=a||globalThis.location,bh||(bh=document.createElement("a")),bh.href=c;var b=e$(bh.href,{strictMode:!0}),d=!b.port&&""===a.port||b.port===a.port,e=b.protocol?b.protocol+":":"";return b.host===a.hostname&&d&&e===a.protocol?"":"anonymous"},a.prototype._determineXhrType=function(){return a._xhrTypeMap[this.extension]||a.XHR_RESPONSE_TYPE.TEXT},a.prototype._determineLoadType=function(){return a._loadTypeMap[this.extension]||a.LOAD_TYPE.XHR},a.prototype._getExtension=function(a){var b,c,d,e,f;return void 0===a&&(a=this.url),b="",this.isDataUrl?(c=a.indexOf("/"),b=a.substring(c+1,a.indexOf(";",c))):(d=a.indexOf("?"),e=a.indexOf("#"),f=Math.min(d>-1?d:a.length,e>-1?e:a.length),b=(a=a.substring(0,f)).substring(a.lastIndexOf(".")+1)),b.toLowerCase()},a.prototype._getMimeFromXhrType=function(b){switch(b){case a.XHR_RESPONSE_TYPE.BUFFER:return"application/octet-binary";case a.XHR_RESPONSE_TYPE.BLOB:return"application/blob";case a.XHR_RESPONSE_TYPE.DOCUMENT:return"application/xml";case a.XHR_RESPONSE_TYPE.JSON:return"application/json";case a.XHR_RESPONSE_TYPE.DEFAULT:case a.XHR_RESPONSE_TYPE.TEXT:default:return"text/plain"}},a}(),function(a){var c,b,d,e;(c=a.STATUS_FLAGS||(a.STATUS_FLAGS={}))[c.NONE=0]="NONE",c[c.DATA_URL=1]="DATA_URL",c[c.COMPLETE=2]="COMPLETE",c[c.LOADING=4]="LOADING",(b=a.TYPE||(a.TYPE={}))[b.UNKNOWN=0]="UNKNOWN",b[b.JSON=1]="JSON",b[b.XML=2]="XML",b[b.IMAGE=3]="IMAGE",b[b.AUDIO=4]="AUDIO",b[b.VIDEO=5]="VIDEO",b[b.TEXT=6]="TEXT",(d=a.LOAD_TYPE||(a.LOAD_TYPE={}))[d.XHR=1]="XHR",d[d.IMAGE=2]="IMAGE",d[d.AUDIO=3]="AUDIO",d[d.VIDEO=4]="VIDEO",(e=a.XHR_RESPONSE_TYPE||(a.XHR_RESPONSE_TYPE={})).DEFAULT="text",e.BUFFER="arraybuffer",e.BLOB="blob",e.DOCUMENT="document",e.JSON="json",e.TEXT="text",a._loadTypeMap={gif:a.LOAD_TYPE.IMAGE,png:a.LOAD_TYPE.IMAGE,bmp:a.LOAD_TYPE.IMAGE,jpg:a.LOAD_TYPE.IMAGE,jpeg:a.LOAD_TYPE.IMAGE,tif:a.LOAD_TYPE.IMAGE,tiff:a.LOAD_TYPE.IMAGE,webp:a.LOAD_TYPE.IMAGE,tga:a.LOAD_TYPE.IMAGE,avif:a.LOAD_TYPE.IMAGE,svg:a.LOAD_TYPE.IMAGE,"svg+xml":a.LOAD_TYPE.IMAGE,mp3:a.LOAD_TYPE.AUDIO,ogg:a.LOAD_TYPE.AUDIO,wav:a.LOAD_TYPE.AUDIO,mp4:a.LOAD_TYPE.VIDEO,webm:a.LOAD_TYPE.VIDEO},a._xhrTypeMap={xhtml:a.XHR_RESPONSE_TYPE.DOCUMENT,html:a.XHR_RESPONSE_TYPE.DOCUMENT,htm:a.XHR_RESPONSE_TYPE.DOCUMENT,xml:a.XHR_RESPONSE_TYPE.DOCUMENT,tmx:a.XHR_RESPONSE_TYPE.DOCUMENT,svg:a.XHR_RESPONSE_TYPE.DOCUMENT,tsx:a.XHR_RESPONSE_TYPE.DOCUMENT,gif:a.XHR_RESPONSE_TYPE.BLOB,png:a.XHR_RESPONSE_TYPE.BLOB,bmp:a.XHR_RESPONSE_TYPE.BLOB,jpg:a.XHR_RESPONSE_TYPE.BLOB,jpeg:a.XHR_RESPONSE_TYPE.BLOB,tif:a.XHR_RESPONSE_TYPE.BLOB,tiff:a.XHR_RESPONSE_TYPE.BLOB,webp:a.XHR_RESPONSE_TYPE.BLOB,tga:a.XHR_RESPONSE_TYPE.BLOB,avif:a.XHR_RESPONSE_TYPE.BLOB,json:a.XHR_RESPONSE_TYPE.JSON,text:a.XHR_RESPONSE_TYPE.TEXT,txt:a.XHR_RESPONSE_TYPE.TEXT,ttf:a.XHR_RESPONSE_TYPE.BUFFER,otf:a.XHR_RESPONSE_TYPE.BUFFER},a.EMPTY_GIF="data:image/gif;base64,R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="}(a.LoaderResource||(a.LoaderResource={})),ho=function(a,b){this.data=a,this.callback=b},bE=function(){function a(c,b){var a=this;if(void 0===b&&(b=1),this.workers=0,this.saturated=Q,this.unsaturated=Q,this.empty=Q,this.drain=Q,this.error=Q,this.started=!1,this.paused=!1,this._tasks=[],this._insert=function(c,e,b){if(b&&"function"!=typeof b)throw new Error("task callback must be a function");if(a.started=!0,null==c&&a.idle())setTimeout(function(){return a.drain()},1);else{var d=new ho(c,"function"==typeof b?b:Q);e?a._tasks.unshift(d):a._tasks.push(d),setTimeout(a.process,1)}},this.process=function(){for(;!a.paused&&a.workers>2,b[1]=(3&a[0])<<4|a[1]>>4,b[2]=(15&a[1])<<2|a[2]>>6,b[3]=63&a[2],e-(d.length-1)){case 2:b[3]=64,b[2]=64;break;case 1:b[3]=64}for(c=0;c0&&a[a.length-1])||6!==d[0]&&2!==d[0])){b=0;continue}if(3===d[0]&&(!a||d[1]>a[0]&&d[1]=33776&&a<=33779)return"s3tc";if(a>=37488&&a<=37497)return"etc";if(a>=35840&&a<=35843)return"pvrtc";if(a>=36196)return"etc1";if(a>=35986&&a<=34798)return"atc";throw new Error("Invalid (compressed) texture format given!")},a._createLevelBuffers=function(m,l,c,d,e,o,n){for(var j=new Array(c),k=m.byteOffset,a=o,f=n,i=a+d-1&~(d-1),h=f+e-1&~(e-1),g=i*h*av[l],b=0;b1?a:i,levelHeight:c>1?f:h,levelBuffer:new Uint8Array(m.buffer,k,g)},k+=g,g=(i=(a=a>>1||1)+d-1&~(d-1))*(h=(f=f>>1||1)+e-1&~(e-1))*av[l];return j},a}(fu),fw=function(){function c(){}return c.use=function(b,f){var d=b.data,h,e,i,g,m,k,l,j,n,o,p;if(b.type===a.LoaderResource.TYPE.JSON&&d&&d.cacheID&&d.textures){for(h=d.textures,e=void 0,i=void 0,g=0,m=h.length;g>>=1,l>>>=1;s=148;for(c=0;cf-c){console.error("KTXLoader: keyAndValueByteSize out of bounds");break}for(a=0;a1||0!==c?l:z,levelHeight:g>1||0!==c?p:A,levelBuffer:new Uint8Array(F,w,m)},w+=m;e=(e+=D+4)%4!=0?e+4-e%4:e,m=(z=(l=l>>1||1)+4-1&-4)*(A=(p=p>>1||1)+4-1&-4)*q}return 0!==c?{uncompressed:k.map(function(b){var d=b[0].levelBuffer,e=!1;return c===a.TYPES.FLOAT?d=new Float32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4):c===a.TYPES.UNSIGNED_INT?(e=!0,d=new Uint32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)):c===a.TYPES.INT&&(e=!0,d=new Int32Array(b[0].levelBuffer.buffer,b[0].levelBuffer.byteOffset,b[0].levelBuffer.byteLength/4)),{resource:new S(d,{width:b[0].levelWidth,height:b[0].levelHeight}),type:c,format:e?he(r):r}}),kvData:v}:{compressed:k.map(function(a){return new bk(null,{format:y,width:j,height:f,levels:g,levelBuffers:a})}),kvData:v}}function he(b){switch(b){case a.FORMATS.RGBA:return a.FORMATS.RGBA_INTEGER;case a.FORMATS.RGB:return a.FORMATS.RGB_INTEGER;case a.FORMATS.RG:return a.FORMATS.RG_INTEGER;case a.FORMATS.RED:return a.FORMATS.RED_INTEGER;default:return b}}a.LoaderResource.setExtensionXhrType("dds",a.LoaderResource.XHR_RESPONSE_TYPE.BUFFER),fM=function(){function b(){}return b.use=function(a,b){if("dds"===a.extension&&a.data)try{Object.assign(a,fx(a.name||a.url,fF(a.data),a.metadata))}catch(a){return void b(a)}b()},b.extension=a.ExtensionType.Loader,b}(),a.LoaderResource.setExtensionXhrType("ktx",a.LoaderResource.XHR_RESPONSE_TYPE.BUFFER),fN=function(){function b(){}return b.use=function(b,l){var d,h,j,k,g,f,m,i;if("ktx"===b.extension&&b.data)try{if(d=b.name||b.url,h=fK(0,b.data,this.loadKeyValueData),j=h.compressed,k=h.uncompressed,g=h.kvData,j){if(f=fx(d,j,b.metadata),g&&f.textures)for(m in f.textures)f.textures[m].baseTexture.ktxKeyValueData=g;Object.assign(b,f)}else k&&(i={},k.forEach(function(f,j){var b=new c(new e(f.resource,{mipmap:a.MIPMAP_MODES.OFF,alphaMode:a.ALPHA_MODES.NO_PREMULTIPLIED_ALPHA,type:f.type,format:f.format})),h=d+"-"+(j+1);g&&(b.baseTexture.ktxKeyValueData=g),e.addToCache(b.baseTexture,h),c.addToCache(b,h),0===j&&(i[d]=b,e.addToCache(b.baseTexture,d),c.addToCache(b,d)),i[h]=b}),Object.assign(b,{textures:i}))}catch(a){return void l(a)}l()},b.extension=a.ExtensionType.Loader,b.loadKeyValueData=!1,b}(),bV=function(a,b){return bV=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bV(a,b)};function fP(b,a){function c(){this.constructor=b}bV(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}hd=function(c){function b(e,g,d,f){void 0===e&&(e=1500),void 0===d&&(d=16384),void 0===f&&(f=!1);var b=c.call(this)||this;return d>16384&&(d=16384),b._properties=[!1,!0,!1,!1,!1],b._maxSize=e,b._batchSize=d,b._buffers=null,b._bufferUpdateIDs=[],b._updateID=0,b.interactiveChildren=!1,b.blendMode=a.BLEND_MODES.NORMAL,b.autoResize=f,b.roundPixels=!0,b.baseTexture=null,b.setProperties(g),b._tint=0,b.tintRgb=new Float32Array(4),b.tint=16777215,b}return fP(b,c),b.prototype.setProperties=function(a){a&&(this._properties[0]="vertices"in a||"scale"in a?!!a.vertices||!!a.scale:this._properties[0],this._properties[1]="position"in a?!!a.position:this._properties[1],this._properties[2]="rotation"in a?!!a.rotation:this._properties[2],this._properties[3]="uvs"in a?!!a.uvs:this._properties[3],this._properties[4]="tint"in a||"alpha"in a?!!a.tint||!!a.alpha:this._properties[4])},b.prototype.updateTransform=function(){this.displayObjectUpdateTransform()},Object.defineProperty(b.prototype,"tint",{get:function(){return this._tint},set:function(a){this._tint=a,T(a,this.tintRgb)},enumerable:!1,configurable:!0}),b.prototype.render=function(a){var b=this;this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable&&(this.baseTexture||(this.baseTexture=this.children[0]._texture.baseTexture,this.baseTexture.valid||this.baseTexture.once("update",function(){return b.onChildrenChange(0)})),a.batch.setObjectRenderer(a.plugins.particle),a.plugins.particle.render(this))},b.prototype.onChildrenChange=function(b){for(var a=Math.floor(b/this._batchSize);this._bufferUpdateIDs.lengthp&&!a.autoResize&&(d=p),e=a._buffers,e||(e=a._buffers=this.generateBuffers(a)),o=h[0]._texture.baseTexture,l=o.alphaMode>0,this.state.blendMode=bM(a.blendMode,l),g.state.set(this.state),k=g.gl,n=a.worldTransform.copyTo(this.tempMatrix),n.prepend(g.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=n.toArray(!0),this.shader.uniforms.uColor=fz(a.tintRgb,a.worldAlpha,this.shader.uniforms.uColor,l),this.shader.uniforms.uSampler=o,this.renderer.shader.bind(this.shader);for(m=!1,b=0,i=0;bj&&(c=j),i>=e.length&&e.push(this._generateOneMoreBuffer(a)),f=e[i],f.uploadDynamic(h,b,c),q=a._bufferUpdateIDs[i]||0,(m=m||f._updateID0,g=b.alpha,e=g<1&&k?bg(b._tintRGB,g):b._tintRGB+(255*g<<24),c[a]=e,c[a+d]=e,c[a+2*d]=e,c[a+3*d]=e,a+=4*d},b.prototype.destroy=function(){c.prototype.destroy.call(this),this.shader&&(this.shader.destroy(),this.shader=null),this.tempMatrix=null},b.extension={name:"particle",type:a.ExtensionType.RendererPlugin},b}(aF),a.LINE_JOIN=void 0,a.LINE_CAP=void 0,function(a){a.MITER="miter",a.BEVEL="bevel",a.ROUND="round"}(a.LINE_JOIN||(a.LINE_JOIN={})),function(a){a.BUTT="butt",a.ROUND="round",a.SQUARE="square"}(a.LINE_CAP||(a.LINE_CAP={})),ac={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount:function(b,c){if(void 0===c&&(c=20),!this.adaptive||!b||isNaN(b))return c;var a=Math.ceil(b/this.maxLength);return athis.maxSegments&&(a=this.maxSegments),a}},dE=function(){function a(){this.color=16777215,this.alpha=1,this.texture=c.WHITE,this.matrix=null,this.visible=!1,this.reset()}return a.prototype.clone=function(){var b=new a;return b.color=this.color,b.alpha=this.alpha,b.texture=this.texture,b.matrix=this.matrix,b.visible=this.visible,b},a.prototype.reset=function(){this.color=16777215,this.alpha=1,this.texture=c.WHITE,this.matrix=null,this.visible=!1},a.prototype.destroy=function(){this.texture=null,this.matrix=null},a}(),bY=function(a,b){return bY=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},bY(a,b)};function bC(b,a){function c(){this.constructor=b}bY(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}function fX(a,d){var e,f,c,g,b,i,h,j,k,l,m,n,o,p;if(void 0===d&&(d=!1),c=a.length,!(c<6)){for(g=0,b=0,i=a[c-2],h=a[c-1];b0||d&&g<=0){l=c/2;for(b=l+l%2;b=6){fX(b,!1);for(g=[],a=0;a=0&&i>=0&&c>=0&&e>=0){if(t=Math.ceil(2.3*Math.sqrt(n+i)),w=8*t+(c?4:0)+(e?4:0),b.length=w,0!==w){if(0===t)return b.length=8,b[0]=b[6]=f+c,b[1]=b[3]=d+e,b[2]=b[4]=f-c,void(b[5]=b[7]=d-e);m=0,s=4*t+(c?2:0)+2,u=s,h=w,l=f+(p=c+n),g=f-p,k=d+(q=e),(b[m++]=l,b[m++]=k,b[--s]=k,b[--s]=g,e)&&(j=d-q,b[u++]=g,b[u++]=j,b[--h]=j,b[--h]=l);for(A=1;Ah&&(h+=2*Math.PI),j=g,s=h-g,t=Math.abs(s),e=Math.sqrt(m*m+l*l),i=1+(15*t*Math.sqrt(e)/Math.PI>>0),o=s/i,j+=o,n){a.push(c,b),a.push(k,p);for(f=1,d=j;f=0&&(p.join===a.LINE_JOIN.ROUND?q+=aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+4:q+=2,d.push(b-l*f,c-k*f),d.push(b+l*e,c+k*e))):(Q=(-h+o)*(-i+c)-(-h+b)*(-i+n),S=(-l+y)*(-k+c)-(-l+b)*(-k+x),H=(D*S-B*Q)/J,G=(A*Q-C*S)/J,L=(H-b)*(H-b)+(G-c)*(G-c),t=b+(H-b)*e,w=c+(G-c)*e,v=b-(H-b)*f,u=c-(G-c)*f,T=F?e:f,L<=Math.min(D*D+C*C,B*B+A*A)+T*T*O?p.join===a.LINE_JOIN.BEVEL||L/O>Y?(F?(d.push(t,w),d.push(b+h*f,c+i*f),d.push(t,w),d.push(b+l*f,c+k*f)):(d.push(b-h*e,c-i*e),d.push(v,u),d.push(b-l*e,c-k*e),d.push(v,u)),q+=2):p.join===a.LINE_JOIN.ROUND?F?(d.push(t,w),d.push(b+h*f,c+i*f),q+=aa(b,c,b+h*f,c+i*f,b+l*f,c+k*f,d,!0)+4,d.push(t,w),d.push(b+l*f,c+k*f)):(d.push(b-h*e,c-i*e),d.push(v,u),q+=aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+4,d.push(b-l*e,c-k*e),d.push(v,u)):(d.push(t,w),d.push(v,u)):(d.push(b-h*e,c-i*e),d.push(b+h*f,c+i*f),p.join===a.LINE_JOIN.ROUND?q+=F?aa(b,c,b+h*f,c+i*f,b+l*f,c+k*f,d,!0)+2:aa(b,c,b-h*e,c-i*e,b-l*e,c-k*e,d,!1)+2:p.join===a.LINE_JOIN.MITER&&L/O<=Y&&(F?(d.push(v,u),d.push(v,u)):(d.push(t,w),d.push(t,w)),q+=2),d.push(b-l*e,c-k*e),d.push(b+l*f,c+k*f),q+=2));o=j[2*(E-2)],n=j[2*(E-2)+1],b=j[2*(E-1)],h=-(n-(c=j[2*(E-1)+1])),i=o-b,h/=s=Math.sqrt(h*h+i*i),i/=s,h*=r,i*=r,d.push(b-h*e,c-i*e),d.push(b+h*f,c+i*f),P||(p.cap===a.LINE_CAP.ROUND?q+=aa(b-h*(e-f)*.5,c-i*(e-f)*.5,b-h*e,c-i*e,b+h*f,c+i*f,d,!1)+2:p.cap===a.LINE_CAP.SQUARE&&(q+=gc(b,c,h,i,e,f,!1,d))),ab=M.indices,_=ac.epsilon*ac.epsilon;for(m=W;md*c})},a.arc=function(u,t,r,q,c,h,o,s,n){for(var e=o-h,k=ac._segmentsCount(Math.abs(e)*c,40*Math.ceil(Math.abs(e)/aA)),a=e/(2*k),m=2*a,j=Math.cos(a),i=Math.sin(a),d=k-1,p=d%1/d,b=0,g,f,l;b<=d;++b)g=a+h+m*(b+p*b),f=Math.cos(g),l=-Math.sin(g),n.push((j*f+i*l)*c+r,(j*-l+i*f)*c+q)},a}(),gh=function(){function a(){}return a.curveLength=function(p,m,u,t,s,r,q,v){for(var i=0,a=0,d=0,o=0,b=0,g=0,n=0,h=0,j=0,f=0,e=0,k=p,l=m,c=1;c<=10;++c)f=k-(h=(n=(g=(b=1-(a=c/10))*b)*b)*p+3*g*a*u+3*b*(d=a*a)*s+(o=d*a)*q),e=l-(j=n*m+3*g*a*t+3*b*d*r+o*v),k=h,l=j,i+=Math.sqrt(f*f+e*e);return i},a.curveTo=function(r,q,p,o,n,m,b){var i=b[b.length-2],k=b[b.length-1],l,d,h,g,f,j,e,c;b.length-=2,l=ac._segmentsCount(a.curveLength(i,k,r,q,p,o,n,m)),d=0,h=0,g=0,f=0,j=0,b.push(i,k);for(e=1,c=0;e<=l;++e)g=(h=(d=1-(c=e/l))*d)*d,j=(f=c*c)*c,b.push(g*i+3*h*c*r+3*d*f*p+j*n,g*k+3*h*c*q+3*d*f*o+j*m)},a}(),gi=function(){function a(){}return a.curveLength=function(j,o,n,m,r,q){var g=j-2*n+r,h=o-2*m+q,i=2*n-2*j,d=2*m-2*o,c=4*(g*g+h*h),a=4*(g*i+h*d),f=i*i+d*d,e=2*Math.sqrt(c+a+f),b=Math.sqrt(c),k=2*c*b,l=2*Math.sqrt(f),p=a/b;return(k*e+b*a*(e-l)+(4*f*c-a*a)*Math.log((2*b+p+e)/(p+l)))/(4*k)},a.curveTo=function(d,e,l,m,c){for(var j=c[c.length-2],h=c[c.length-1],k=ac._segmentsCount(a.curveLength(j,h,d,e,l,m)),f=0,g=0,i=1,b;i<=k;++i)b=i/k,f=j+(d-j)*b,g=h+(e-h)*b,c.push(f+(d+(l-d)*b-f)*b,g+(e+(m-e)*b-g)*b)},a}(),gj=function(){function a(){this.reset()}return a.prototype.begin=function(a,b,c){this.reset(),this.style=a,this.start=b,this.attribStart=c},a.prototype.end=function(a,b){this.attribSize=b-this.attribStart,this.size=a-this.start},a.prototype.reset=function(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0},a}(),bt=((aj={})[a.SHAPES.POLY]=b$,aj[a.SHAPES.CIRC]=aL,aj[a.SHAPES.ELIP]=aL,aj[a.SHAPES.RECT]=f_,aj[a.SHAPES.RREC]=gb,aj),cf=[],ay=[],cg=function(){function a(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=null),void 0===c&&(c=null),this.points=[],this.holes=[],this.shape=d,this.lineStyle=b,this.fillStyle=a,this.matrix=c,this.type=d.type}return a.prototype.clone=function(){return new a(this.shape,this.fillStyle,this.lineStyle,this.matrix)},a.prototype.destroy=function(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null},a}(),am=new g,dF=function(c){function b(){var a=c.call(this)||this;return a.closePointEps=1e-4,a.boundsPadding=0,a.uvsFloat32=null,a.indicesUint16=null,a.batchable=!1,a.points=[],a.colors=[],a.uvs=[],a.indices=[],a.textureIds=[],a.graphicsData=[],a.drawCalls=[],a.batchDirty=-1,a.batches=[],a.dirty=0,a.cacheDirty=-1,a.clearDirty=0,a.shapeIndex=0,a._bounds=new aO,a.boundsDirty=-1,a}return bC(b,c),Object.defineProperty(b.prototype,"bounds",{get:function(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds},enumerable:!1,configurable:!0}),b.prototype.invalidate=function(){var a,b;this.boundsDirty=-1,this.dirty++,this.batchDirty++,this.shapeIndex=0,this.points.length=0,this.colors.length=0,this.uvs.length=0,this.indices.length=0,this.textureIds.length=0;for(a=0;a0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this},b.prototype.drawShape=function(d,a,b,c){void 0===a&&(a=null),void 0===b&&(b=null),void 0===c&&(c=null);var e=new cg(d,a,b,c);return this.graphicsData.push(e),this.dirty++,this},b.prototype.drawHole=function(d,a){if(void 0===a&&(a=null),!this.graphicsData.length)return null;var b=new cg(d,null,null,a),c=this.graphicsData[this.graphicsData.length-1];return b.lineStyle=c.lineStyle,c.holes.push(b),this.dirty++,this},b.prototype.destroy=function(){c.prototype.destroy.call(this);for(var a=0;a0&&(g=(c=this.batches[this.batches.length-1]).style);for(h=this.shapeIndex;h65535,this.indicesUint16&&this.indices.length===this.indicesUint16.length&&i===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=i?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()):this.batchable=!0}}else this.batchable=!0},b.prototype._compareStyles=function(a,b){return!(!a||!b)&&a.texture.baseTexture===b.texture.baseTexture&&a.color+a.alpha===b.color+b.alpha&&!!a.native==!!b.native},b.prototype.validateBatching=function(){var a,e,b,c,d;if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(a=0,e=this.graphicsData.length;a131070)return!1;for(var c=this.batches,a=0;a0&&((b=ay.pop())||((b=new bb).texArray=new aY),this.drawCalls.push(b)),b.start=m,b.size=0,b.texArray.count=0,b.type=l),c.touched=1,c._batchEnabled=i,c._batchLocation=h,c.wrapMode=a.WRAP_MODES.REPEAT,b.texArray.elements[b.texArray.count++]=c,h++)),b.size+=f.size,m+=f.size,n=c._batchLocation,this.addColors(p,g.color,g.alpha,f.attribSize,f.attribStart),this.addTextureIds(o,n,f.attribSize,f.attribStart);e._globalBatch=i,this.packAttributes()},b.prototype.packAttributes=function(){for(var d=this.points,f=this.uvs,i=this.colors,g=this.textureIds,e=new ArrayBuffer(3*d.length*4),c=new Float32Array(e),h=new Uint32Array(e),b=0,a=0;a>16)+(65280&c)+((255&c)<<16),g),d.length=Math.max(d.length,b+e);for(a=0;a0&&b.alpha>0;return d?(b.matrix&&(b.matrix=b.matrix.clone(),b.matrix.invert()),Object.assign(this._lineStyle,{visible:d},b)):this._lineStyle.reset(),this},b.prototype.startPoly=function(){if(this.currentPath){var b=this.currentPath.points,a=this.currentPath.points.length;a>2&&(this.drawShape(this.currentPath),this.currentPath=new aG,this.currentPath.closeStroke=!1,this.currentPath.points.push(b[a-2],b[a-1]))}else this.currentPath=new aG,this.currentPath.closeStroke=!1},b.prototype.finishPoly=function(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)},b.prototype.moveTo=function(a,b){return this.startPoly(),this.currentPath.points[0]=a,this.currentPath.points[1]=b,this},b.prototype.lineTo=function(b,c){this.currentPath||this.moveTo(0,0);var a=this.currentPath.points,d=a[a.length-2],e=a[a.length-1];return d===b&&e===c||a.push(b,c),this},b.prototype._initCurve=function(a,b){void 0===a&&(a=0),void 0===b&&(b=0),this.currentPath?0===this.currentPath.points.length&&(this.currentPath.points=[a,b]):this.moveTo(a,b)},b.prototype.quadraticCurveTo=function(b,c,d,e){this._initCurve();var a=this.currentPath.points;return 0===a.length&&this.moveTo(0,0),gi.curveTo(b,c,d,e,a),this},b.prototype.bezierCurveTo=function(a,b,c,d,e,f){return this._initCurve(),gh.curveTo(a,b,c,d,e,f,this.currentPath.points),this},b.prototype.arcTo=function(b,g,m,l,k){var f,a,h,i,e,d,c,j;return this._initCurve(b,g),f=this.currentPath.points,a=cd.curveTo(b,g,m,l,k,f),a&&(h=a.cx,i=a.cy,e=a.radius,d=a.startAngle,c=a.endAngle,j=a.anticlockwise,this.arc(h,i,e,d,c,j)),this},b.prototype.arc=function(i,j,g,b,c,f){var d,e,h,a,k,l;return void 0===f&&(f=!1),b===c?this:(!f&&c<=b?c+=aA:f&&b<=c&&(b+=aA),0==c-b)?this:(d=i+Math.cos(b)*g,e=j+Math.sin(b)*g,h=this._geometry.closePointEps,a=this.currentPath?this.currentPath.points:null,a?(k=Math.abs(a[a.length-2]-d),l=Math.abs(a[a.length-1]-e),k0;return b?(a.matrix&&(a.matrix=a.matrix.clone(),a.matrix.invert()),Object.assign(this._fillStyle,{visible:b},a)):this._fillStyle.reset(),this},b.prototype.endFill=function(){return this.finishPoly(),this._fillStyle.reset(),this},b.prototype.drawRect=function(a,b,c,e){return this.drawShape(new d(a,b,c,e))},b.prototype.drawRoundedRect=function(a,b,c,d,e){return this.drawShape(new e_(a,b,c,d,e))},b.prototype.drawCircle=function(a,b,c){return this.drawShape(new fd(a,b,c))},b.prototype.drawEllipse=function(a,b,c,d){return this.drawShape(new fa(a,b,c,d))},b.prototype.drawPolygon=function(){for(var c,g=arguments,a=[],b=0,e,d,f;b>16&255)/255*c,b.tint[1]=(f>>8&255)/255*c,b.tint[2]=(255&f)/255*c,b.tint[3]=c,a.shader.bind(d),a.geometry.bind(e,d),a.state.set(this.state);for(g=0,i=h.length;g>16)+(65280&d)+((255&d)<<16)}},b.prototype.calculateVertices=function(){var g=this.transform._worldID,a,m,l,k,j,i,n,c,f,e,b,d,h;if(this._transformID!==g){this._transformID=g;for(a=this.transform.worldTransform,m=a.a,l=a.b,k=a.c,j=a.d,i=a.tx,n=a.ty,c=this._geometry.points,f=this.vertexData,e=0,b=0;b=d&&aw.x=a&&aw.y>16)+(65280&a)+((255&a)<<16)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._texture},set:function(a){this._texture!==a&&(this._texture&&this._texture.off("update",this._onTextureUpdate,this),this._texture=a||c.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,a&&(a.baseTexture.valid?this._onTextureUpdate():a.once("update",this._onTextureUpdate,this)))},enumerable:!1,configurable:!0}),e}(u),a.TEXT_GRADIENT=void 0,cp=function(a,b){return cp=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cp(a,b)},!function(a){a[a.LINEAR_VERTICAL=0]="LINEAR_VERTICAL",a[a.LINEAR_HORIZONTAL=1]="LINEAR_HORIZONTAL"}(a.TEXT_GRADIENT||(a.TEXT_GRADIENT={})),cq={align:"left",breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:"black",dropShadowDistance:5,fill:"black",fillGradientType:a.TEXT_GRADIENT.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",letterSpacing:0,lineHeight:0,lineJoin:"miter",miterLimit:10,padding:0,stroke:"black",strokeThickness:0,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100,leading:0},gB=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],X=function(){function a(a){this.styleID=0,this.reset(),cv(this,a,a)}return a.prototype.clone=function(){var b={};return cv(b,this,cq),new a(b)},a.prototype.reset=function(){cv(this,cq,cq)},Object.defineProperty(a.prototype,"align",{get:function(){return this._align},set:function(a){this._align!==a&&(this._align=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"breakWords",{get:function(){return this._breakWords},set:function(a){this._breakWords!==a&&(this._breakWords=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadow",{get:function(){return this._dropShadow},set:function(a){this._dropShadow!==a&&(this._dropShadow=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowAlpha",{get:function(){return this._dropShadowAlpha},set:function(a){this._dropShadowAlpha!==a&&(this._dropShadowAlpha=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowAngle",{get:function(){return this._dropShadowAngle},set:function(a){this._dropShadowAngle!==a&&(this._dropShadowAngle=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowBlur",{get:function(){return this._dropShadowBlur},set:function(a){this._dropShadowBlur!==a&&(this._dropShadowBlur=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowColor",{get:function(){return this._dropShadowColor},set:function(b){var a=ct(b);this._dropShadowColor!==a&&(this._dropShadowColor=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"dropShadowDistance",{get:function(){return this._dropShadowDistance},set:function(a){this._dropShadowDistance!==a&&(this._dropShadowDistance=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fill",{get:function(){return this._fill},set:function(b){var a=ct(b);this._fill!==a&&(this._fill=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fillGradientType",{get:function(){return this._fillGradientType},set:function(a){this._fillGradientType!==a&&(this._fillGradientType=a,this.styleID++)},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"fillGradientStops",{get:function(){return this._fillGradientStops},set:function(a){(function(a,c){if(!Array.isArray(a)||!Array.isArray(c))return!1;if(a.length!==c.length)return!1;for(var b=0;b=0;c--)b=a[c].trim(),!/([\"\'])[^\'\"]+\1/.test(b)&&gB.indexOf(b)<0&&(b='"'+b+'"'),a[c]=b;return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+d+" "+a.join(",")},a}();function gg(a){return"number"==typeof a?bP(a):("string"==typeof a&&0===a.indexOf("0x")&&(a=a.replace("0x","#")),a)}function ct(a){if(Array.isArray(a)){for(var b=0;bo)if(""!==b&&(f+=a.addLine(b),b="",d=0),a.canBreakWords(c,k.breakWords))for(i=a.wordWrapSplit(c),e=0;eo&&(f+=a.addLine(b),h=!1,b="",d=0),b+=g,d+=w}else b.length>0&&(f+=a.addLine(b),b="",d=0),x=j===p.length-1,f+=a.addLine(c,!x),h=!1,b="",d=0;else q+d>o&&(h=!1,f+=a.addLine(b),b="",d=0),(b.length>0||!a.isBreakingSpace(c)||h)&&(b+=c,d+=q)}return f+a.addLine(b,!1)},a.addLine=function(b,c){return void 0===c&&(c=!0),b=a.trimRight(b),c?b+"\n":b},a.getFromCache=function(a,d,c,e){var b=c[a],f;return"number"!=typeof b&&(f=a.length*d,b=e.measureText(a).width+f,c[a]=b),b},a.collapseSpaces=function(a){return"normal"===a||"pre-line"===a},a.collapseNewlines=function(a){return"normal"===a},a.trimRight=function(b){var c,d;if("string"!=typeof b)return"";for(c=b.length-1;c>=0;c--){if(d=b[c],!a.isBreakingSpace(d))break;b=b.slice(0,-1)}return b},a.isNewline=function(b){return"string"==typeof b&&a._newlines.indexOf(b.charCodeAt(0))>=0},a.isBreakingSpace=function(b,c){return"string"==typeof b&&a._breakingSpaces.indexOf(b.charCodeAt(0))>=0},a.tokenize=function(d){var c=[],b="",e,f,g;if("string"!=typeof d)return c;for(e=0;ec;--d){for(f=0;f0&&r>k&&(p=(k+r)/2),n=k+q,t=l.lineHeight*(b+1),u=n,b+10},a}();function gM(a,d){var e=!1,b,f;if(a&&a._textures&&a._textures.length)for(b=0;b=0;a--)this.add(b.children[a]);return this},c.prototype.destroy=function(){this.ticking&&o.system.remove(this.tick,this),this.ticking=!1,this.addHooks=null,this.uploadHooks=null,this.renderer=null,this.completes=null,this.queue=null,this.limiter=null,this.uploadHookHelper=null},c}();function gd(b,a){return a instanceof e&&(a._glTextures[b.CONTEXT_UID]||b.texture.bind(a),!0)}function gV(d,b){var a,e,c,f;if(!(b instanceof ar))return!1;a=b.geometry,b.finishPoly(),a.updateBatches();for(e=a.batches,c=0;c=c&&aN.x=d&&aN.y1?D.from("#version 300 es\n#define SHADER_NAME Tiling-Sprite-300\n\nprecision lowp float;\n\nin vec2 aVertexPosition;\nin vec2 aTextureCoord;\n\nuniform mat3 projectionMatrix;\nuniform mat3 translationMatrix;\nuniform mat3 uTransform;\n\nout vec2 vTextureCoord;\n\nvoid main(void)\n{\n gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\n\n vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;\n}\n","#version 300 es\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nin vec2 vTextureCoord;\n\nout vec4 fragmentColor;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0\n\n fragmentColor = texSample * uColor;\n}\n",a):D.from(fQ,"#version 100\n#ifdef GL_EXT_shader_texture_lod\n #extension GL_EXT_shader_texture_lod : enable\n#endif\n#define SHADER_NAME Tiling-Sprite-100\n\nprecision lowp float;\n\nvarying vec2 vTextureCoord;\n\nuniform sampler2D uSampler;\nuniform vec4 uColor;\nuniform mat3 uMapCoord;\nuniform vec4 uClampFrame;\nuniform vec2 uClampOffset;\n\nvoid main(void)\n{\n vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);\n coord = (uMapCoord * vec3(coord, 1.0)).xy;\n vec2 unclamped = coord;\n coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);\n\n #ifdef GL_EXT_shader_texture_lod\n vec4 texSample = unclamped == coord\n ? texture2D(uSampler, coord) \n : texture2DLodEXT(uSampler, coord, 0);\n #else\n vec4 texSample = texture2D(uSampler, coord);\n #endif\n\n gl_FragColor = texSample * uColor;\n}\n",a)},b.prototype.render=function(b){var h=this.renderer,k=this.quad,c=k.vertices,q,n,f,e,r,g,i,j,d,o,p,l,m;c[0]=c[6]=b._width*-b.anchor.x,c[1]=c[3]=b._height*-b.anchor.y,c[2]=c[4]=b._width*(1-b.anchor.x),c[5]=c[7]=b._height*(1-b.anchor.y),q=b.uvRespectAnchor?b.anchor.x:0,n=b.uvRespectAnchor?b.anchor.y:0,(c=k.uvs)[0]=c[6]=-q,c[1]=c[3]=-n,c[2]=c[4]=1-q,c[5]=c[7]=1-n,k.invalidate(),f=b._texture,e=f.baseTexture,r=e.alphaMode>0,g=b.tileTransform.localTransform,i=b.uvMatrix,j=e.isPowerOfTwo&&f.frame.width===e.width&&f.frame.height===e.height,j&&(e._glTextures[h.CONTEXT_UID]?j=e.wrapMode!==a.WRAP_MODES.CLAMP:e.wrapMode===a.WRAP_MODES.CLAMP&&(e.wrapMode=a.WRAP_MODES.REPEAT)),d=j?this.simpleShader:this.shader,o=f.width,p=f.height,l=b._width,m=b._height,aU.set(g.a*o/l,g.b*o/m,g.c*p/l,g.d*p/m,g.tx/l,g.ty/m),aU.invert(),j?aU.prepend(i.mapCoord):(d.uniforms.uMapCoord=i.mapCoord.toArray(!0),d.uniforms.uClampFrame=i.uClampFrame,d.uniforms.uClampOffset=i.uClampOffset),d.uniforms.uTransform=aU.toArray(!0),d.uniforms.uColor=bK(b.tint,b.worldAlpha,d.uniforms.uColor,r),d.uniforms.translationMatrix=b.transform.worldTransform.toArray(!0),d.uniforms.uSampler=f,h.shader.bind(d),h.geometry.bind(k),this.state.blendMode=bM(b.blendMode,r),h.state.set(this.state),h.geometry.draw(this.renderer.gl.TRIANGLES,6,0)},b.extension={name:"tilingSprite",type:a.ExtensionType.RendererPlugin},b}(aF),cN=function(a,b){return cN=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cN(a,b)};function cO(b,a){function c(){this.constructor=b}cN(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}fv=function(){function a(a,b){this.uvBuffer=a,this.uvMatrix=b,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}return a.prototype.update=function(b){if(b||this._bufferUpdateId!==this.uvBuffer._updateID||this._textureUpdateId!==this.uvMatrix._updateID){this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;var a=this.uvBuffer.data;this.data&&this.data.length===a.length||(this.data=new Float32Array(a.length)),this.uvMatrix.multiplyUvs(a,this.data),this._updateID++}},a}(),cP=new g,fo=new aG,ah=function(d){function c(f,g,h,e){void 0===e&&(e=a.DRAW_MODES.TRIANGLES);var c=d.call(this)||this;return c.geometry=f,c.shader=g,c.state=h||K.for2d(),c.drawMode=e,c.start=0,c.size=0,c.uvs=null,c.indices=null,c.vertexData=new Float32Array(1),c.vertexDirty=-1,c._transformID=-1,c._roundPixels=b.ROUND_PIXELS,c.batchUvs=null,c}return cO(c,d),Object.defineProperty(c.prototype,"geometry",{get:function(){return this._geometry},set:function(a){this._geometry!==a&&(this._geometry&&(this._geometry.refCount--,0===this._geometry.refCount&&this._geometry.dispose()),this._geometry=a,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"uvBuffer",{get:function(){return this.geometry.buffers[1]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"verticesBuffer",{get:function(){return this.geometry.buffers[0]},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"material",{get:function(){return this.shader},set:function(a){this.shader=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"blendMode",{get:function(){return this.state.blendMode},set:function(a){this.state.blendMode=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"roundPixels",{get:function(){return this._roundPixels},set:function(a){this._roundPixels!==a&&(this._transformID=-1),this._roundPixels=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"tint",{get:function(){return"tint"in this.shader?this.shader.tint:null},set:function(a){this.shader.tint=a},enumerable:!1,configurable:!0}),Object.defineProperty(c.prototype,"texture",{get:function(){return"texture"in this.shader?this.shader.texture:null},set:function(a){this.shader.texture=a},enumerable:!1,configurable:!0}),c.prototype._render=function(b){var d=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===a.DRAW_MODES.TRIANGLES&&d.length<2*c.BATCHABLE_SIZE?this._renderToBatch(b):this._renderDefault(b)},c.prototype._renderDefault=function(b){var a=this.shader;a.alpha=this.worldAlpha,a.update&&a.update(),b.batch.flush(),a.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),b.shader.bind(a),b.state.set(this.state),b.geometry.bind(this.geometry,a),b.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)},c.prototype._renderToBatch=function(b){var d=this.geometry,a=this.shader,c;a.uvMatrix&&(a.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=d.indexBuffer.data,this._tintRGB=a._tintRGB,this._texture=a.texture,c=this.material.pluginName,b.batch.setObjectRenderer(b.plugins[c]),b.plugins[c].render(this)},c.prototype.calculateVertices=function(){var i=this.geometry.buffers[0],e=i.data,f=i._updateID,c,o,n,m,p,l,k,d,a,h,g,j;if(f!==this.vertexDirty||this._transformID!==this.transform._worldID){this._transformID=this.transform._worldID,this.vertexData.length!==e.length&&(this.vertexData=new Float32Array(e.length));for(c=this.transform.worldTransform,o=c.a,n=c.b,m=c.c,p=c.d,l=c.tx,k=c.ty,d=this.vertexData,a=0;a>16)+(65280&a)+((255&a)<<16),this._colorDirty=!0)},enumerable:!1,configurable:!0}),a.prototype.update=function(){if(this._colorDirty){this._colorDirty=!1;var a=this.texture.baseTexture;bK(this._tint,this._alpha,this.uniforms.uColor,a.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},a}(D),aI=function(c){function b(d,e,f){var b=c.call(this)||this,g=new n(d),h=new n(e,!0),i=new n(f,!0,!0);return b.addAttribute("aVertexPosition",g,2,!1,a.TYPES.FLOAT).addAttribute("aTextureCoord",h,2,!1,a.TYPES.FLOAT).addIndex(i),b._updateId=-1,b}return cO(b,c),Object.defineProperty(b.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),b}(an),cQ=function(a,b){return cQ=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},cQ(a,b)},aH=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},eX=function(){function a(){}return a.test=function(a){return"string"==typeof a&&0===a.indexOf("info face=")},a.parse=function(n){var c=n.match(/^[a-z]+\s+.+$/gm),b={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]},e,l,g,h,j,i,k,d,f,m,a;for(e in c){l=c[e].match(/^[a-z]+/gm)[0],g=c[e].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),h={};for(j in g)i=g[j].split("="),k=i[0],d=i[1].replace(/"/gm,""),f=parseFloat(d),m=isNaN(f)?d:f,h[k]=m;b[l].push(h)}return a=new aH,b.info.forEach(function(b){return a.info.push({face:b.face,size:parseInt(b.size,10)})}),b.common.forEach(function(b){return a.common.push({lineHeight:parseInt(b.lineHeight,10)})}),b.page.forEach(function(b){return a.page.push({id:parseInt(b.id,10),file:b.file})}),b.char.forEach(function(b){return a.char.push({id:parseInt(b.id,10),page:parseInt(b.page,10),x:parseInt(b.x,10),y:parseInt(b.y,10),width:parseInt(b.width,10),height:parseInt(b.height,10),xoffset:parseInt(b.xoffset,10),yoffset:parseInt(b.yoffset,10),xadvance:parseInt(b.xadvance,10)})}),b.kerning.forEach(function(b){return a.kerning.push({first:parseInt(b.first,10),second:parseInt(b.second,10),amount:parseInt(b.amount,10)})}),b.distanceField.forEach(function(b){return a.distanceField.push({distanceRange:parseInt(b.distanceRange,10),fieldType:b.fieldType})}),a},a}(),bd=function(){function a(){}return a.test=function(a){return a instanceof XMLDocument&&a.getElementsByTagName("page").length&&null!==a.getElementsByTagName("info")[0].getAttribute("face")},a.parse=function(d){for(var c=new aH,h=d.getElementsByTagName("info"),j=d.getElementsByTagName("common"),f=d.getElementsByTagName("page"),i=d.getElementsByTagName("char"),e=d.getElementsByTagName("kerning"),g=d.getElementsByTagName("distanceField"),a=0,b;a")>-1){var b=(new globalThis.DOMParser).parseFromString(a,"text/xml");return bd.test(b)}return!1},a.parse=function(a){var b=(new globalThis.DOMParser).parseFromString(a,"text/xml");return bd.parse(b)},a}(),cX=[eX,bd,eO];function cZ(b){for(var a=0;a=s-r*i){if(0===h)throw new Error("[BitmapFont] textureHeight "+s+"px is too small (fontFamily: '"+a.fontFamily+"', fontSize: "+a.fontSize+"px, char: '"+A+"')");--d,j=null,l=null,t=null,h=0,g=0,p=0}else if(p=Math.max(r+o.fontProperties.descent,p),v*i+g>=J){if(0===g)throw new Error("[BitmapFont] textureWidth "+u+"px is too small (fontFamily: '"+a.fontFamily+"', fontSize: "+a.fontSize+"px, char: '"+A+"')");--d,h+=p*i,h=Math.ceil(h),g=0,p=0}else hv(j,l,o,g,h,i,a),I=bo(o.text),k.char.push({id:I,page:q.length-1,x:g/i,y:h/i,width:v,height:r,xoffset:0,yoffset:0,xadvance:Math.ceil(C-(a.dropShadow?a.dropShadowDistance:0)-(a.stroke?a.strokeThickness:0))}),g+=(v+2*H)*i,g=Math.ceil(g);d=0;for(E=n.length;d0&&i.x>aa&&(_(k,1+t-++ab,1+b-t),b=t,t=-1,w.push(B),z.push(k.length>0?k[k.length-1].prevSpaces:0),j=Math.max(j,B),M++,i.x=0,i.y+=m.lineHeight,x=null,H=0))):(w.push(s),z.push(-1),j=Math.max(j,s),++M,++ab,i.x=0,i.y+=m.lineHeight,x=null,H=0);W=G[G.length-1],"\r"!==W&&"\n"!==W&&(/(?:\s)/.test(W)&&(s=B),w.push(s),j=Math.max(j,s),z.push(-1)),ae=[];for(b=0;b<=M;b++)D=0,"right"===this._align?D=j-w[b]:"center"===this._align?D=(j-w[b])/2:"justify"===this._align&&(D=z[b]<0?0:(j-w[b])/z[b]),ae.push(D);ad=k.length,q={},v=[],I=this._activePagesMeshData;for(Q.push.apply(Q,I),b=0;b 0.99) {\r\n alpha = 1.0;\r\n }\r\n\r\n // NPM Textures, NPM outputs\r\n gl_FragColor = vec4(uColor.rgb, uColor.a * alpha);\r\n\r\n}\r\n"),uniforms:{uFWidth:0}}),T=a.BLEND_MODES.NORMAL_NPM),X=new ah(aj,N),X.blendMode=T,d={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:X,vertices:null,uvs:null,indices:null}),d.index=0,d.indexCount=0,d.vertexCount=0,d.uvsCount=0,d.total=0,O=this._textureCache,O[u]=O[u]||new c(A.baseTexture),d.mesh.texture=O[u],d.mesh.tint=this._tint,v.push(d),q[u]=d),q[u].total++;for(b=0;b6*y)||d.vertices.length<2*ah.BATCHABLE_SIZE)d.vertices=new Float32Array(8*y),d.uvs=new Float32Array(8*y),d.indices=new Uint16Array(6*y);else for(ai=d.total,Z=d.vertices,S=4*ai*2;S=h&&(c=b-a-1),d+=g=g.replace("%value%",e[c].toString()),d+="\n";return(f=f.replace("%blur%",d)).replace("%size%",b.toString())}(c);return(a=d.call(this,i,j)||this).horizontal=h,a.resolution=g,a._quality=0,a.quality=f,a.blur=e,a}return eq(c,d),c.prototype.apply=function(b,d,c,j){var g,h,f,e,i,k;if(c?this.horizontal?this.uniforms.strength=1/c.width*(c.width/d.width):this.uniforms.strength=1/c.height*(c.height/d.height):this.horizontal?this.uniforms.strength=1/b.renderer.width*(b.renderer.width/d.width):this.uniforms.strength=1/b.renderer.height*(b.renderer.height/d.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)b.applyFilter(this,d,c,j);else{g=b.getFilterTexture(),h=b.renderer,f=d,e=g,this.state.blend=!1,b.applyFilter(this,f,e,a.CLEAR_MODES.CLEAR);for(i=1;i 0.0) {\n c.rgb /= c.a;\n }\n\n vec4 result;\n\n result.r = (m[0] * c.r);\n result.r += (m[1] * c.g);\n result.r += (m[2] * c.b);\n result.r += (m[3] * c.a);\n result.r += m[4];\n\n result.g = (m[5] * c.r);\n result.g += (m[6] * c.g);\n result.g += (m[7] * c.b);\n result.g += (m[8] * c.a);\n result.g += m[9];\n\n result.b = (m[10] * c.r);\n result.b += (m[11] * c.g);\n result.b += (m[12] * c.b);\n result.b += (m[13] * c.a);\n result.b += m[14];\n\n result.a = (m[15] * c.r);\n result.a += (m[16] * c.g);\n result.a += (m[17] * c.b);\n result.a += (m[18] * c.a);\n result.a += m[19];\n\n vec3 rgb = mix(c.rgb, result.rgb, uAlpha);\n\n // Premultiply alpha again.\n rgb *= result.a;\n\n gl_FragColor = vec4(rgb, result.a);\n}\n",c)||this).alpha=1,a}return function(b,a){function c(){this.constructor=b}dr(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),a.prototype._loadMatrix=function(c,b){void 0===b&&(b=!1);var a=c;b&&(this._multiply(a,this.uniforms.m,c),a=this._colorMatrix(a)),this.uniforms.m=a},a.prototype._multiply=function(c,a,b){return c[0]=a[0]*b[0]+a[1]*b[5]+a[2]*b[10]+a[3]*b[15],c[1]=a[0]*b[1]+a[1]*b[6]+a[2]*b[11]+a[3]*b[16],c[2]=a[0]*b[2]+a[1]*b[7]+a[2]*b[12]+a[3]*b[17],c[3]=a[0]*b[3]+a[1]*b[8]+a[2]*b[13]+a[3]*b[18],c[4]=a[0]*b[4]+a[1]*b[9]+a[2]*b[14]+a[3]*b[19]+a[4],c[5]=a[5]*b[0]+a[6]*b[5]+a[7]*b[10]+a[8]*b[15],c[6]=a[5]*b[1]+a[6]*b[6]+a[7]*b[11]+a[8]*b[16],c[7]=a[5]*b[2]+a[6]*b[7]+a[7]*b[12]+a[8]*b[17],c[8]=a[5]*b[3]+a[6]*b[8]+a[7]*b[13]+a[8]*b[18],c[9]=a[5]*b[4]+a[6]*b[9]+a[7]*b[14]+a[8]*b[19]+a[9],c[10]=a[10]*b[0]+a[11]*b[5]+a[12]*b[10]+a[13]*b[15],c[11]=a[10]*b[1]+a[11]*b[6]+a[12]*b[11]+a[13]*b[16],c[12]=a[10]*b[2]+a[11]*b[7]+a[12]*b[12]+a[13]*b[17],c[13]=a[10]*b[3]+a[11]*b[8]+a[12]*b[13]+a[13]*b[18],c[14]=a[10]*b[4]+a[11]*b[9]+a[12]*b[14]+a[13]*b[19]+a[14],c[15]=a[15]*b[0]+a[16]*b[5]+a[17]*b[10]+a[18]*b[15],c[16]=a[15]*b[1]+a[16]*b[6]+a[17]*b[11]+a[18]*b[16],c[17]=a[15]*b[2]+a[16]*b[7]+a[17]*b[12]+a[18]*b[17],c[18]=a[15]*b[3]+a[16]*b[8]+a[17]*b[13]+a[18]*b[18],c[19]=a[15]*b[4]+a[16]*b[9]+a[17]*b[14]+a[18]*b[19]+a[19],c},a.prototype._colorMatrix=function(b){var a=new Float32Array(b);return a[4]/=255,a[9]/=255,a[14]/=255,a[19]/=255,a},a.prototype.brightness=function(a,b){var c=[a,0,0,0,0,0,a,0,0,0,0,0,a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.tint=function(a,b){var c=[(a>>16&255)/255,0,0,0,0,0,(a>>8&255)/255,0,0,0,0,0,(255&a)/255,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.greyscale=function(a,b){var c=[a,a,a,0,0,a,a,a,0,0,a,a,a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.blackAndWhite=function(a){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],a)},a.prototype.hue=function(e,f){e=(e||0)/180*Math.PI;var a=Math.cos(e),c=Math.sin(e),b=1/3,d=(0,Math.sqrt)(b),g=[a+(1-a)*b,b*(1-a)-d*c,b*(1-a)+d*c,0,0,b*(1-a)+d*c,a+b*(1-a),b*(1-a)-d*c,0,0,b*(1-a)-d*c,b*(1-a)+d*c,a+b*(1-a),0,0,0,0,0,1,0];this._loadMatrix(g,f)},a.prototype.contrast=function(c,d){var a=(c||0)+1,b=-.5*(a-1),e=[a,0,0,0,b,0,a,0,0,b,0,0,a,0,b,0,0,0,1,0];this._loadMatrix(e,d)},a.prototype.saturate=function(c,d){void 0===c&&(c=0);var b=2*c/3+1,a=-.5*(b-1),e=[b,a,a,0,0,a,b,a,0,0,a,a,b,0,0,0,0,0,1,0];this._loadMatrix(e,d)},a.prototype.desaturate=function(){this.saturate(-1)},a.prototype.negative=function(a){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],a)},a.prototype.sepia=function(a){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],a)},a.prototype.technicolor=function(a){this._loadMatrix([1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0],a)},a.prototype.polaroid=function(a){this._loadMatrix([1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0],a)},a.prototype.toBGR=function(a){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],a)},a.prototype.kodachrome=function(a){this._loadMatrix([1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0],a)},a.prototype.browni=function(a){this._loadMatrix([.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0],a)},a.prototype.vintage=function(a){this._loadMatrix([.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0],a)},a.prototype.colorTone=function(c,d,a,b,k){var f=((a=a||16770432)>>16&255)/255,g=(a>>8&255)/255,h=(255&a)/255,i=((b=b||3375104)>>16&255)/255,j=(b>>8&255)/255,e=(255&b)/255,l=[.3,.59,.11,0,0,f,g,h,c=c||.2,0,i,j,e,d=d||.15,0,f-i,g-j,h-e,0,0];this._loadMatrix(l,k)},a.prototype.night=function(a,b){var c=[-2*(a=a||.1),-a,0,0,0,-a,0,a,0,0,0,a,2*a,0,0,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.predator=function(a,b){var c=[11.224130630493164*a,-4.794486999511719*a,-2.8746118545532227*a,0*a,.40342438220977783*a,-3.6330697536468506*a,9.193157196044922*a,-2.951810836791992*a,0*a,-1.316135048866272*a,-3.2184197902679443*a,-4.2375030517578125*a,7.476448059082031*a,0*a,.8044459223747253*a,0,0,0,1,0];this._loadMatrix(c,b)},a.prototype.lsd=function(a){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],a)},a.prototype.reset=function(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)},Object.defineProperty(a.prototype,"matrix",{get:function(){return this.uniforms.m},set:function(a){this.uniforms.m=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"alpha",{get:function(){return this.uniforms.uAlpha},set:function(a){this.uniforms.uAlpha=a},enumerable:!1,configurable:!0}),a}(C),dv.prototype.grayscale=dv.prototype.greyscale,dw=function(a,b){return dw=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dw(a,b)},hP=function(b){function a(d,a){var c=this,e=new m;return d.renderable=!1,(c=b.call(this,"attribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\nuniform mat3 filterMatrix;\n\nvarying vec2 vTextureCoord;\nvarying vec2 vFilterCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvec2 filterTextureCoord( void )\n{\n return aVertexPosition * (outputFrame.zw * inputSize.zw);\n}\n\nvoid main(void)\n{\n gl_Position = filterVertexPosition();\n vTextureCoord = filterTextureCoord();\n vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;\n}\n","varying vec2 vFilterCoord;\nvarying vec2 vTextureCoord;\n\nuniform vec2 scale;\nuniform mat2 rotation;\nuniform sampler2D uSampler;\nuniform sampler2D mapSampler;\n\nuniform highp vec4 inputSize;\nuniform vec4 inputClamp;\n\nvoid main(void)\n{\n vec4 map = texture2D(mapSampler, vFilterCoord);\n\n map -= 0.5;\n map.xy = scale * inputSize.zw * (rotation * map.xy);\n\n gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));\n}\n",{mapSampler:d._texture,filterMatrix:e,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])})||this).maskSprite=d,c.maskMatrix=e,null==a&&(a=20),c.scale=new g(a,a),c}return function(b,a){function c(){this.constructor=b}dw(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),a.prototype.apply=function(d,e,f,g){this.uniforms.filterMatrix=d.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;var a=this.maskSprite.worldTransform,c=Math.sqrt(a.a*a.a+a.b*a.b),b=Math.sqrt(a.c*a.c+a.d*a.d);0!==c&&0!==b&&(this.uniforms.rotation[0]=a.a/c,this.uniforms.rotation[1]=a.b/c,this.uniforms.rotation[2]=a.c/b,this.uniforms.rotation[3]=a.d/b),d.applyFilter(this,e,f,g)},Object.defineProperty(a.prototype,"map",{get:function(){return this.uniforms.mapSampler},set:function(a){this.uniforms.mapSampler=a},enumerable:!1,configurable:!0}),a}(C),dx=function(a,b){return dx=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dx(a,b)},hR=function(a){function b(){return a.call(this,"\nattribute vec2 aVertexPosition;\n\nuniform mat3 projectionMatrix;\n\nvarying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\n\nuniform vec4 inputSize;\nuniform vec4 outputFrame;\n\nvec4 filterVertexPosition( void )\n{\n vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;\n\n return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);\n}\n\nvoid texcoords(vec2 fragCoord, vec2 inverseVP,\n out vec2 v_rgbNW, out vec2 v_rgbNE,\n out vec2 v_rgbSW, out vec2 v_rgbSE,\n out vec2 v_rgbM) {\n v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;\n v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;\n v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;\n v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;\n v_rgbM = vec2(fragCoord * inverseVP);\n}\n\nvoid main(void) {\n\n gl_Position = filterVertexPosition();\n\n vFragCoord = aVertexPosition * outputFrame.zw;\n\n texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n}\n",'varying vec2 v_rgbNW;\nvarying vec2 v_rgbNE;\nvarying vec2 v_rgbSW;\nvarying vec2 v_rgbSE;\nvarying vec2 v_rgbM;\n\nvarying vec2 vFragCoord;\nuniform sampler2D uSampler;\nuniform highp vec4 inputSize;\n\n\n/**\n Basic FXAA implementation based on the code on geeks3d.com with the\n modification that the texture2DLod stuff was removed since it\'s\n unsupported by WebGL.\n\n --\n\n From:\n https://github.com/mitsuhiko/webgl-meincraft\n\n Copyright (c) 2011 by Armin Ronacher.\n\n Some rights reserved.\n\n Redistribution and use in source and binary forms, with or without\n modification, are permitted provided that the following conditions are\n met:\n\n * Redistributions of source code must retain the above copyright\n notice, this list of conditions and the following disclaimer.\n\n * Redistributions in binary form must reproduce the above\n copyright notice, this list of conditions and the following\n disclaimer in the documentation and/or other materials provided\n with the distribution.\n\n * The names of the contributors may not be used to endorse or\n promote products derived from this software without specific\n prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n#ifndef FXAA_REDUCE_MIN\n#define FXAA_REDUCE_MIN (1.0/ 128.0)\n#endif\n#ifndef FXAA_REDUCE_MUL\n#define FXAA_REDUCE_MUL (1.0 / 8.0)\n#endif\n#ifndef FXAA_SPAN_MAX\n#define FXAA_SPAN_MAX 8.0\n#endif\n\n//optimized version for mobile, where dependent\n//texture reads can be a bottleneck\nvec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,\n vec2 v_rgbNW, vec2 v_rgbNE,\n vec2 v_rgbSW, vec2 v_rgbSE,\n vec2 v_rgbM) {\n vec4 color;\n vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;\n vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;\n vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;\n vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;\n vec4 texColor = texture2D(tex, v_rgbM);\n vec3 rgbM = texColor.xyz;\n vec3 luma = vec3(0.299, 0.587, 0.114);\n float lumaNW = dot(rgbNW, luma);\n float lumaNE = dot(rgbNE, luma);\n float lumaSW = dot(rgbSW, luma);\n float lumaSE = dot(rgbSE, luma);\n float lumaM = dot(rgbM, luma);\n float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));\n float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));\n\n mediump vec2 dir;\n dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));\n dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));\n\n float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *\n (0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);\n\n float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);\n dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),\n max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),\n dir * rcpDirMin)) * inverseVP;\n\n vec3 rgbA = 0.5 * (\n texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);\n vec3 rgbB = rgbA * 0.5 + 0.25 * (\n texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +\n texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);\n\n float lumaB = dot(rgbB, luma);\n if ((lumaB < lumaMin) || (lumaB > lumaMax))\n color = vec4(rgbA, texColor.a);\n else\n color = vec4(rgbB, texColor.a);\n return color;\n}\n\nvoid main() {\n\n vec4 color;\n\n color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);\n\n gl_FragColor = color;\n}\n')||this}return function(b,a){function c(){this.constructor=b}dx(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,a),b}(C),dA=function(a,b){return dA=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dA(a,b)},hT=function(b){function a(a,c){void 0===a&&(a=.5),void 0===c&&(c=Math.random());var d=b.call(this,cR,"precision highp float;\n\nvarying vec2 vTextureCoord;\nvarying vec4 vColor;\n\nuniform float uNoise;\nuniform float uSeed;\nuniform sampler2D uSampler;\n\nfloat rand(vec2 co)\n{\n return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);\n}\n\nvoid main()\n{\n vec4 color = texture2D(uSampler, vTextureCoord);\n float randomValue = rand(gl_FragCoord.xy * uSeed);\n float diff = (randomValue - 0.5) * uNoise;\n\n // Un-premultiply alpha before applying the color matrix. See issue #3539.\n if (color.a > 0.0) {\n color.rgb /= color.a;\n }\n\n color.r += diff;\n color.g += diff;\n color.b += diff;\n\n // Premultiply alpha again.\n color.rgb *= color.a;\n\n gl_FragColor = color;\n}\n",{uNoise:0,uSeed:0})||this;return d.noise=a,d.seed=c,d}return function(b,a){function c(){this.constructor=b}dA(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(a,b),Object.defineProperty(a.prototype,"noise",{get:function(){return this.uniforms.uNoise},set:function(a){this.uniforms.uNoise=a},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"seed",{get:function(){return this.uniforms.uSeed},set:function(a){this.uniforms.uSeed=a},enumerable:!1,configurable:!0}),a}(C),d_=new m,k.prototype._cacheAsBitmap=!1,k.prototype._cacheData=null,k.prototype._cacheAsBitmapResolution=null,k.prototype._cacheAsBitmapMultisample=a.MSAA_QUALITY.NONE,hV=function(){this.textureCacheId=null,this.originalRender=null,this.originalRenderCanvas=null,this.originalCalculateBounds=null,this.originalGetLocalBounds=null,this.originalUpdateTransform=null,this.originalDestroy=null,this.originalMask=null,this.originalFilterArea=null,this.originalContainsPoint=null,this.sprite=null},Object.defineProperties(k.prototype,{cacheAsBitmapResolution:{get:function(){return this._cacheAsBitmapResolution},set:function(a){a!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=a,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmapMultisample:{get:function(){return this._cacheAsBitmapMultisample},set:function(a){a!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=a,this.cacheAsBitmap&&(this.cacheAsBitmap=!1,this.cacheAsBitmap=!0))}},cacheAsBitmap:{get:function(){return this._cacheAsBitmap},set:function(b){var a;this._cacheAsBitmap!==b&&(this._cacheAsBitmap=b,b?(this._cacheData||(this._cacheData=new hV),(a=this._cacheData).originalRender=this.render,a.originalRenderCanvas=this.renderCanvas,a.originalUpdateTransform=this.updateTransform,a.originalCalculateBounds=this.calculateBounds,a.originalGetLocalBounds=this.getLocalBounds,a.originalDestroy=this.destroy,a.originalContainsPoint=this.containsPoint,a.originalMask=this._mask,a.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):((a=this._cacheData).sprite&&this._destroyCachedDisplayObject(),this.render=a.originalRender,this.renderCanvas=a.originalRenderCanvas,this.calculateBounds=a.originalCalculateBounds,this.getLocalBounds=a.originalGetLocalBounds,this.destroy=a.originalDestroy,this.updateTransform=a.originalUpdateTransform,this.containsPoint=a.originalContainsPoint,this._mask=a.originalMask,this.filterArea=a.originalFilterArea))}}}),k.prototype._renderCached=function(a){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(a),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(a))},k.prototype._initCachedDisplayObject=function(a){var i,j,d,n,k,p,l,m,g,h,o,f;(!this._cacheData||!this._cacheData.sprite)&&(j=this.alpha,this.alpha=1,a.batch.flush(),d=this.getLocalBounds(null,!0).clone(),this.filters&&this.filters.length&&(n=this.filters[0].padding,d.pad(n)),d.ceil(b.RESOLUTION),k=a.renderTexture.current,p=a.renderTexture.sourceFrame.clone(),l=a.renderTexture.destinationFrame.clone(),m=a.projection.transform,g=G.create({width:d.width,height:d.height,resolution:this.cacheAsBitmapResolution||a.resolution,multisample:null!==(i=this.cacheAsBitmapMultisample)&&void 0!==i?i:a.multisample}),h="cacheAsBitmap_"+I(),this._cacheData.textureCacheId=h,e.addToCache(g.baseTexture,h),c.addToCache(g,h),o=this.transform.localTransform.copyTo(d_).invert().translate(-d.x,-d.y),this.render=this._cacheData.originalRender,a.render(this,{renderTexture:g,clear:!0,transform:o,skipUpdateTransform:!1}),a.framebuffer.blit(),a.projection.transform=m,a.renderTexture.bind(k,p,l),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=j,f=new ai(g),f.transform.worldTransform=this.transform.worldTransform,f.anchor.x=-d.x/d.width,f.anchor.y=-d.y/d.height,f.alpha=j,f._bounds=this._bounds,this._cacheData.sprite=f,this.transform._parentID=-1,this.parent?this.updateTransform():(this.enableTempParent(),this.updateTransform(),this.disableTempParent(null)),this.containsPoint=f.containsPoint.bind(f))},k.prototype._renderCachedCanvas=function(a){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(a),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(a))},k.prototype._initCachedDisplayObjectCanvas=function(f){var a,j,k,l,h,i,g,d;(!this._cacheData||!this._cacheData.sprite)&&(a=this.getLocalBounds(null,!0),j=this.alpha,this.alpha=1,k=f.context,l=f._projTransform,a.ceil(b.RESOLUTION),h=G.create({width:a.width,height:a.height}),i="cacheAsBitmap_"+I(),this._cacheData.textureCacheId=i,e.addToCache(h.baseTexture,i),c.addToCache(h,i),g=d_,this.transform.localTransform.copyTo(g),g.invert(),g.tx-=a.x,g.ty-=a.y,this.renderCanvas=this._cacheData.originalRenderCanvas,f.render(this,{renderTexture:h,clear:!0,transform:g,skipUpdateTransform:!1}),f.context=k,f._projTransform=l,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=j,d=new ai(h),d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-a.x/a.width,d.anchor.y=-a.y/a.height,d.alpha=j,d._bounds=this._bounds,this._cacheData.sprite=d,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=f._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=d.containsPoint.bind(d))},k.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},k.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},k.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,e.removeFromCache(this._cacheData.textureCacheId),c.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},k.prototype._cacheAsBitmapDestroy=function(a){this.cacheAsBitmap=!1,this.destroy(a)},k.prototype.name=null,u.prototype.getChildByName=function(c,f){for(var a=0,b=this.children.length,d,e;a0?(m=h.x-c[b].x,n=h.y-c[b].y,o=Math.sqrt(m*m+n*n),h=c[b],g+=o/p):g=b/(j-1),d[a]=g,d[a+1]=0,d[a+2]=g,d[a+3]=1;f=0;for(b=0;b0?this.textureScale*this._width/2:this._width/2,a/=j,b/=j,a*=k,b*=k,f[g]=e.x+a,f[g+1]=e.y+b,f[g+2]=e.x-a,f[g+3]=e.y-b,h=e;this.buffers[0].update()}},a.prototype.update=function(){this.textureScale>0?this.build():this.updateVertices()},a}(aI),ia=function(b){function c(d,f,c){void 0===c&&(c=0);var e=this,g=new dH(d.height,f,c),h=new ao(d);return c>0&&(d.baseTexture.wrapMode=a.WRAP_MODES.REPEAT),(e=b.call(this,g,h)||this).autoUpdate=!0,e}return ak(c,b),c.prototype._render=function(c){var a=this.geometry;(this.autoUpdate||a._width!==this.shader.texture.height)&&(a._width=this.shader.texture.height,a.update()),b.prototype._render.call(this,c)},c}(ah),dG=function(b){function a(a,e,f){var d=this,g=new dI(a.width,a.height,e,f),h=new ao(c.WHITE);return(d=b.call(this,g,h)||this).texture=a,d.autoResize=!0,d}return ak(a,b),a.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID;var a=this.geometry,b=this.shader.texture,c=b.width,d=b.height;!this.autoResize||a.width===c&&a.height===d||(a.width=this.shader.texture.width,a.height=this.shader.texture.height,a.build())},Object.defineProperty(a.prototype,"texture",{get:function(){return this.shader.texture},set:function(a){this.shader.texture!==a&&(this.shader.texture=a,this._textureID=-1,a.baseTexture.valid?this.textureUpdated():a.once("update",this.textureUpdated,this))},enumerable:!1,configurable:!0}),a.prototype._render=function(a){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),b.prototype._render.call(this,a)},a.prototype.destroy=function(a){this.shader.texture.off("update",this.textureUpdated,this),b.prototype.destroy.call(this,a)},a}(ah),ic=function(b){function a(a,j,g,h,i){var d,e,f;return void 0===a&&(a=c.EMPTY),d=this,e=new aI(j,g,h),e.getBuffer("aVertexPosition").static=!1,f=new ao(a),(d=b.call(this,e,f,null,i)||this).autoUpdate=!0,d}return ak(a,b),Object.defineProperty(a.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(a){this.geometry.getBuffer("aVertexPosition").data=a},enumerable:!1,configurable:!0}),a.prototype._render=function(a){this.autoUpdate&&this.geometry.getBuffer("aVertexPosition").update(),b.prototype._render.call(this,a)},a}(ah),id=function(b){function a(d,e,f,g,h){void 0===e&&(e=10),void 0===f&&(f=10),void 0===g&&(g=10),void 0===h&&(h=10);var a=b.call(this,c.WHITE,4,4)||this;return a._origWidth=d.orig.width,a._origHeight=d.orig.height,a._width=a._origWidth,a._height=a._origHeight,a._leftWidth=e,a._rightWidth=g,a._topHeight=f,a._bottomHeight=h,a.texture=d,a}return ak(a,b),a.prototype.textureUpdated=function(){this._textureID=this.shader.texture._updateID,this._refresh()},Object.defineProperty(a.prototype,"vertices",{get:function(){return this.geometry.getBuffer("aVertexPosition").data},set:function(a){this.geometry.getBuffer("aVertexPosition").data=a},enumerable:!1,configurable:!0}),a.prototype.updateHorizontalVertices=function(){var a=this.vertices,b=this._getMinScale();a[9]=a[11]=a[13]=a[15]=this._topHeight*b,a[17]=a[19]=a[21]=a[23]=this._height-this._bottomHeight*b,a[25]=a[27]=a[29]=a[31]=this._height},a.prototype.updateVerticalVertices=function(){var a=this.vertices,b=this._getMinScale();a[2]=a[10]=a[18]=a[26]=this._leftWidth*b,a[4]=a[12]=a[20]=a[28]=this._width-this._rightWidth*b,a[6]=a[14]=a[22]=a[30]=this._width},a.prototype._getMinScale=function(){var a=this._leftWidth+this._rightWidth,c=this._width>a?1:this._width/a,b=this._topHeight+this._bottomHeight,d=this._height>b?1:this._height/b;return Math.min(c,d)},Object.defineProperty(a.prototype,"width",{get:function(){return this._width},set:function(a){this._width=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"height",{get:function(){return this._height},set:function(a){this._height=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"leftWidth",{get:function(){return this._leftWidth},set:function(a){this._leftWidth=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"rightWidth",{get:function(){return this._rightWidth},set:function(a){this._rightWidth=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"topHeight",{get:function(){return this._topHeight},set:function(a){this._topHeight=a,this._refresh()},enumerable:!1,configurable:!0}),Object.defineProperty(a.prototype,"bottomHeight",{get:function(){return this._bottomHeight},set:function(a){this._bottomHeight=a,this._refresh()},enumerable:!1,configurable:!0}),a.prototype._refresh=function(){var b=this.texture,a=this.geometry.buffers[1].data,c,d;this._origWidth=b.orig.width,this._origHeight=b.orig.height,c=1/this._origWidth,d=1/this._origHeight,a[0]=a[8]=a[16]=a[24]=0,a[1]=a[3]=a[5]=a[7]=0,a[6]=a[14]=a[22]=a[30]=1,a[25]=a[27]=a[29]=a[31]=1,a[2]=a[10]=a[18]=a[26]=c*this._leftWidth,a[4]=a[12]=a[20]=a[28]=1-c*this._rightWidth,a[9]=a[11]=a[13]=a[15]=d*this._topHeight,a[17]=a[19]=a[21]=a[23]=1-d*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()},a}(dG),dC=function(a,b){return dC=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(a,b){a.__proto__=b}||function(c,a){for(var b in a)a.hasOwnProperty(b)&&(c[b]=a[b])},dC(a,b)},ig=function(d){function b(b,e){void 0===e&&(e=!0);var a=d.call(this,b[0]instanceof c?b[0]:b[0].texture)||this;return a._textures=null,a._durations=null,a._autoUpdate=e,a._isConnectedToTicker=!1,a.animationSpeed=1,a.loop=!0,a.updateAnchor=!1,a.onComplete=null,a.onFrameChange=null,a.onLoop=null,a._currentTime=0,a._playing=!1,a._previousFrame=null,a.textures=b,a}return function(b,a){function c(){this.constructor=b}dC(b,a),b.prototype=null===a?Object.create(a):(c.prototype=a.prototype,new c)}(b,d),b.prototype.stop=function(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(o.shared.remove(this.update,this),this._isConnectedToTicker=!1))},b.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(o.shared.add(this.update,this,a.UPDATE_PRIORITY.HIGH),this._isConnectedToTicker=!0))},b.prototype.gotoAndStop=function(a){this.stop();var b=this.currentFrame;this._currentTime=a,b!==this.currentFrame&&this.updateTexture()},b.prototype.gotoAndPlay=function(a){var b=this.currentFrame;this._currentTime=a,b!==this.currentFrame&&this.updateTexture(),this.play()},b.prototype.update=function(e){var c,b,a,d;if(this._playing){if(c=this.animationSpeed*e,b=this.currentFrame,null!==this._durations){a=this._currentTime%1*this._durations[this.currentFrame];for(a+=c/60*1e3;a<0;)this._currentTime--,a+=this._durations[this.currentFrame];d=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);a>=this._durations[this.currentFrame];)a-=this._durations[this.currentFrame]*d,this._currentTime+=d;this._currentTime+=a/this._durations[this.currentFrame]}else this._currentTime+=c;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):b!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrameb)&&this.onLoop(),this.updateTexture())}},b.prototype.updateTexture=function(){var a=this.currentFrame;this._previousFrame!==a&&(this._previousFrame=a,this._texture=this._textures[a],this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this.uvs=this._texture._uvs.uvsFloat32,this.updateAnchor&&this._anchor.copyFrom(this._texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))},b.prototype.destroy=function(a){this.stop(),d.prototype.destroy.call(this,a),this.onComplete=null,this.onFrameChange=null,this.onLoop=null},b.fromFrames=function(d){for(var e=[],a=0;a{ + const url=loads[key]; + if(kagura.api.isUrl(key)){ + invurls[key]=url; + } + }); + loads=invurls; this.assets={}; if(!loaded)loaded=function(){}; this.loaded=loaded; @@ -39,6 +47,7 @@ class{ my._text=new FileReader() my._text.readAsText(my.blobObj) my.sounder=new kagura.Sounder(my.blob); + my.howler=new kagura.api.Houler(my.blob); } setTimeout(()=>this.loadedOneXhr(load),0) }; diff --git a/src/core.js b/src/core.js index 90a56a4..75c1fb1 100644 --- a/src/core.js +++ b/src/core.js @@ -14,7 +14,10 @@ const kagura=function(){ pixi:PIXI, api:{} }; - kagura.exitFullscreen=Document.exitFullscreen; + kagura.Howl=Howl; + kagura.api.Howler={{!api/howler.js!}}; + kagura.api.isUrl={{!api/isurl.js!}}; + kagura.exitFullscreen=document.exitFullscreen; kagura.Grid={{!api/grid.js!}} kagura.browser={{!browsercheck.js!}}(window.navigator.userAgent) kagura.Timer={{!api/timer.js!}} diff --git a/src/lib/howler.min.js b/src/lib/howler.min.js new file mode 100644 index 0000000..ac43c39 --- /dev/null +++ b/src/lib/howler.min.js @@ -0,0 +1,4 @@ +/*! howler.js v2.2.3 | (c) 2013-2020, James Simpson of GoldFire Studios | MIT License | howlerjs.com */ +!function(){"use strict";var e=function(){this.init()};e.prototype={init:function(){var e=this||n;return e._counter=1e3,e._html5AudioPool=[],e.html5PoolSize=10,e._codecs={},e._howls=[],e._muted=!1,e._volume=1,e._canPlayEvent="canplaythrough",e._navigator="undefined"!=typeof window&&window.navigator?window.navigator:null,e.masterGain=null,e.noAudio=!1,e.usingWebAudio=!0,e.autoSuspend=!0,e.ctx=null,e.autoUnlock=!0,e._setup(),e},volume:function(e){var o=this||n;if(e=parseFloat(e),o.ctx||_(),void 0!==e&&e>=0&&e<=1){if(o._volume=e,o._muted)return o;o.usingWebAudio&&o.masterGain.gain.setValueAtTime(e,n.ctx.currentTime);for(var t=0;t=0;o--)e._howls[o].unload();return e.usingWebAudio&&e.ctx&&void 0!==e.ctx.close&&(e.ctx.close(),e.ctx=null,_()),e},codecs:function(e){return(this||n)._codecs[e.replace(/^x-/,"")]},_setup:function(){var e=this||n;if(e.state=e.ctx?e.ctx.state||"suspended":"suspended",e._autoSuspend(),!e.usingWebAudio)if("undefined"!=typeof Audio)try{var o=new Audio;void 0===o.oncanplaythrough&&(e._canPlayEvent="canplay")}catch(n){e.noAudio=!0}else e.noAudio=!0;try{var o=new Audio;o.muted&&(e.noAudio=!0)}catch(e){}return e.noAudio||e._setupCodecs(),e},_setupCodecs:function(){var e=this||n,o=null;try{o="undefined"!=typeof Audio?new Audio:null}catch(n){return e}if(!o||"function"!=typeof o.canPlayType)return e;var t=o.canPlayType("audio/mpeg;").replace(/^no$/,""),r=e._navigator?e._navigator.userAgent:"",a=r.match(/OPR\/([0-6].)/g),u=a&&parseInt(a[0].split("/")[1],10)<33,d=-1!==r.indexOf("Safari")&&-1===r.indexOf("Chrome"),i=r.match(/Version\/(.*?) /),_=d&&i&&parseInt(i[1],10)<15;return e._codecs={mp3:!(u||!t&&!o.canPlayType("audio/mp3;").replace(/^no$/,"")),mpeg:!!t,opus:!!o.canPlayType('audio/ogg; codecs="opus"').replace(/^no$/,""),ogg:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),oga:!!o.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),wav:!!(o.canPlayType('audio/wav; codecs="1"')||o.canPlayType("audio/wav")).replace(/^no$/,""),aac:!!o.canPlayType("audio/aac;").replace(/^no$/,""),caf:!!o.canPlayType("audio/x-caf;").replace(/^no$/,""),m4a:!!(o.canPlayType("audio/x-m4a;")||o.canPlayType("audio/m4a;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),m4b:!!(o.canPlayType("audio/x-m4b;")||o.canPlayType("audio/m4b;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),mp4:!!(o.canPlayType("audio/x-mp4;")||o.canPlayType("audio/mp4;")||o.canPlayType("audio/aac;")).replace(/^no$/,""),weba:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),webm:!(_||!o.canPlayType('audio/webm; codecs="vorbis"').replace(/^no$/,"")),dolby:!!o.canPlayType('audio/mp4; codecs="ec-3"').replace(/^no$/,""),flac:!!(o.canPlayType("audio/x-flac;")||o.canPlayType("audio/flac;")).replace(/^no$/,"")},e},_unlockAudio:function(){var e=this||n;if(!e._audioUnlocked&&e.ctx){e._audioUnlocked=!1,e.autoUnlock=!1,e._mobileUnloaded||44100===e.ctx.sampleRate||(e._mobileUnloaded=!0,e.unload()),e._scratchBuffer=e.ctx.createBuffer(1,1,22050);var o=function(n){for(;e._html5AudioPool.length0?d._seek:t._sprite[e][0]/1e3),s=Math.max(0,(t._sprite[e][0]+t._sprite[e][1])/1e3-_),l=1e3*s/Math.abs(d._rate),c=t._sprite[e][0]/1e3,f=(t._sprite[e][0]+t._sprite[e][1])/1e3;d._sprite=e,d._ended=!1;var p=function(){d._paused=!1,d._seek=_,d._start=c,d._stop=f,d._loop=!(!d._loop&&!t._sprite[e][2])};if(_>=f)return void t._ended(d);var m=d._node;if(t._webAudio){var v=function(){t._playLock=!1,p(),t._refreshBuffer(d);var e=d._muted||t._muted?0:d._volume;m.gain.setValueAtTime(e,n.ctx.currentTime),d._playStart=n.ctx.currentTime,void 0===m.bufferSource.start?d._loop?m.bufferSource.noteGrainOn(0,_,86400):m.bufferSource.noteGrainOn(0,_,s):d._loop?m.bufferSource.start(0,_,86400):m.bufferSource.start(0,_,s),l!==1/0&&(t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l)),o||setTimeout(function(){t._emit("play",d._id),t._loadQueue()},0)};"running"===n.state&&"interrupted"!==n.ctx.state?v():(t._playLock=!0,t.once("resume",v),t._clearTimer(d._id))}else{var h=function(){m.currentTime=_,m.muted=d._muted||t._muted||n._muted||m.muted,m.volume=d._volume*n.volume(),m.playbackRate=d._rate;try{var r=m.play();if(r&&"undefined"!=typeof Promise&&(r instanceof Promise||"function"==typeof r.then)?(t._playLock=!0,p(),r.then(function(){t._playLock=!1,m._unlocked=!0,o?t._loadQueue():t._emit("play",d._id)}).catch(function(){t._playLock=!1,t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction."),d._ended=!0,d._paused=!0})):o||(t._playLock=!1,p(),t._emit("play",d._id)),m.playbackRate=d._rate,m.paused)return void t._emit("playerror",d._id,"Playback was unable to start. This is most commonly an issue on mobile devices and Chrome where playback was not within a user interaction.");"__default"!==e||d._loop?t._endTimers[d._id]=setTimeout(t._ended.bind(t,d),l):(t._endTimers[d._id]=function(){t._ended(d),m.removeEventListener("ended",t._endTimers[d._id],!1)},m.addEventListener("ended",t._endTimers[d._id],!1))}catch(e){t._emit("playerror",d._id,e)}};"data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA"===m.src&&(m.src=t._src,m.load());var y=window&&window.ejecta||!m.readyState&&n._navigator.isCocoonJS;if(m.readyState>=3||y)h();else{t._playLock=!0,t._state="loading";var g=function(){t._state="loaded",h(),m.removeEventListener(n._canPlayEvent,g,!1)};m.addEventListener(n._canPlayEvent,g,!1),t._clearTimer(d._id)}}return d._id},pause:function(e){var n=this;if("loaded"!==n._state||n._playLock)return n._queue.push({event:"pause",action:function(){n.pause(e)}}),n;for(var o=n._getSoundIds(e),t=0;t=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else r.length>=2&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var a;if(!(void 0!==e&&e>=0&&e<=1))return a=o?t._soundById(o):t._sounds[0],a?a._volume:0;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"volume",action:function(){t.volume.apply(t,r)}}),t;void 0===o&&(t._volume=e),o=t._getSoundIds(o);for(var u=0;u0?t/_:t),l=Date.now();e._fadeTo=o,e._interval=setInterval(function(){var r=(Date.now()-l)/t;l=Date.now(),d+=i*r,d=Math.round(100*d)/100,d=i<0?Math.max(o,d):Math.min(o,d),u._webAudio?e._volume=d:u.volume(d,e._id,!0),a&&(u._volume=d),(on&&d>=o)&&(clearInterval(e._interval),e._interval=null,e._fadeTo=null,u.volume(o,e._id),u._emit("fade",e._id))},s)},_stopFade:function(e){var o=this,t=o._soundById(e);return t&&t._interval&&(o._webAudio&&t._node.gain.cancelScheduledValues(n.ctx.currentTime),clearInterval(t._interval),t._interval=null,o.volume(t._fadeTo,e),t._fadeTo=null,o._emit("fade",e)),o},loop:function(){var e,n,o,t=this,r=arguments;if(0===r.length)return t._loop;if(1===r.length){if("boolean"!=typeof r[0])return!!(o=t._soundById(parseInt(r[0],10)))&&o._loop;e=r[0],t._loop=e}else 2===r.length&&(e=r[0],n=parseInt(r[1],10));for(var a=t._getSoundIds(n),u=0;u=0?o=parseInt(r[0],10):e=parseFloat(r[0])}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));var d;if("number"!=typeof e)return d=t._soundById(o),d?d._rate:t._rate;if("loaded"!==t._state||t._playLock)return t._queue.push({event:"rate",action:function(){t.rate.apply(t,r)}}),t;void 0===o&&(t._rate=e),o=t._getSoundIds(o);for(var i=0;i=0?o=parseInt(r[0],10):t._sounds.length&&(o=t._sounds[0]._id,e=parseFloat(r[0]))}else 2===r.length&&(e=parseFloat(r[0]),o=parseInt(r[1],10));if(void 0===o)return 0;if("number"==typeof e&&("loaded"!==t._state||t._playLock))return t._queue.push({event:"seek",action:function(){t.seek.apply(t,r)}}),t;var d=t._soundById(o);if(d){if(!("number"==typeof e&&e>=0)){if(t._webAudio){var i=t.playing(o)?n.ctx.currentTime-d._playStart:0,_=d._rateSeek?d._rateSeek-d._seek:0;return d._seek+(_+i*Math.abs(d._rate))}return d._node.currentTime}var s=t.playing(o);s&&t.pause(o,!0),d._seek=e,d._ended=!1,t._clearTimer(o),t._webAudio||!d._node||isNaN(d._node.duration)||(d._node.currentTime=e);var l=function(){s&&t.play(o,!0),t._emit("seek",o)};if(s&&!t._webAudio){var c=function(){t._playLock?setTimeout(c,0):l()};setTimeout(c,0)}else l()}return t},playing:function(e){var n=this;if("number"==typeof e){var o=n._soundById(e);return!!o&&!o._paused}for(var t=0;t=0&&n._howls.splice(a,1);var u=!0;for(t=0;t=0){u=!1;break}return r&&u&&delete r[e._src],n.noAudio=!1,e._state="unloaded",e._sounds=[],e=null,null},on:function(e,n,o,t){var r=this,a=r["_on"+e];return"function"==typeof n&&a.push(t?{id:o,fn:n,once:t}:{id:o,fn:n}),r},off:function(e,n,o){var t=this,r=t["_on"+e],a=0;if("number"==typeof n&&(o=n,n=null),n||o)for(a=0;a=0;a--)r[a].id&&r[a].id!==n&&"load"!==e||(setTimeout(function(e){e.call(this,n,o)}.bind(t,r[a].fn),0),r[a].once&&t.off(e,r[a].fn,r[a].id));return t._loadQueue(e),t},_loadQueue:function(e){var n=this;if(n._queue.length>0){var o=n._queue[0];o.event===e&&(n._queue.shift(),n._loadQueue()),e||o.action()}return n},_ended:function(e){var o=this,t=e._sprite;if(!o._webAudio&&e._node&&!e._node.paused&&!e._node.ended&&e._node.currentTime=0;t--){if(o<=n)return;e._sounds[t]._ended&&(e._webAudio&&e._sounds[t]._node&&e._sounds[t]._node.disconnect(0),e._sounds.splice(t,1),o--)}}},_getSoundIds:function(e){var n=this;if(void 0===e){for(var o=[],t=0;t=0;if(n._scratchBuffer&&e.bufferSource&&(e.bufferSource.onended=null,e.bufferSource.disconnect(0),t))try{e.bufferSource.buffer=n._scratchBuffer}catch(e){}return e.bufferSource=null,o},_clearSound:function(e){/MSIE |Trident\//.test(n._navigator&&n._navigator.userAgent)||(e.src="data:audio/wav;base64,UklGRigAAABXQVZFZm10IBIAAAABAAEARKwAAIhYAQACABAAAABkYXRhAgAAAAEA")}};var t=function(e){this._parent=e,this.init()};t.prototype={init:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,o._sounds.push(e),e.create(),e},create:function(){var e=this,o=e._parent,t=n._muted||e._muted||e._parent._muted?0:e._volume;return o._webAudio?(e._node=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),e._node.gain.setValueAtTime(t,n.ctx.currentTime),e._node.paused=!0,e._node.connect(n.masterGain)):n.noAudio||(e._node=n._obtainHtml5Audio(),e._errorFn=e._errorListener.bind(e),e._node.addEventListener("error",e._errorFn,!1),e._loadFn=e._loadListener.bind(e),e._node.addEventListener(n._canPlayEvent,e._loadFn,!1),e._endFn=e._endListener.bind(e),e._node.addEventListener("ended",e._endFn,!1),e._node.src=o._src,e._node.preload=!0===o._preload?"auto":o._preload,e._node.volume=t*n.volume(),e._node.load()),e},reset:function(){var e=this,o=e._parent;return e._muted=o._muted,e._loop=o._loop,e._volume=o._volume,e._rate=o._rate,e._seek=0,e._rateSeek=0,e._paused=!0,e._ended=!0,e._sprite="__default",e._id=++n._counter,e},_errorListener:function(){var e=this;e._parent._emit("loaderror",e._id,e._node.error?e._node.error.code:0),e._node.removeEventListener("error",e._errorFn,!1)},_loadListener:function(){var e=this,o=e._parent;o._duration=Math.ceil(10*e._node.duration)/10,0===Object.keys(o._sprite).length&&(o._sprite={__default:[0,1e3*o._duration]}),"loaded"!==o._state&&(o._state="loaded",o._emit("load"),o._loadQueue()),e._node.removeEventListener(n._canPlayEvent,e._loadFn,!1)},_endListener:function(){var e=this,n=e._parent;n._duration===1/0&&(n._duration=Math.ceil(10*e._node.duration)/10,n._sprite.__default[1]===1/0&&(n._sprite.__default[1]=1e3*n._duration),n._ended(e)),e._node.removeEventListener("ended",e._endFn,!1)}};var r={},a=function(e){var n=e._src;if(r[n])return e._duration=r[n].duration,void i(e);if(/^data:[^;]+;base64,/.test(n)){for(var o=atob(n.split(",")[1]),t=new Uint8Array(o.length),a=0;a0?(r[o._src]=e,i(o,e)):t()};"undefined"!=typeof Promise&&1===n.ctx.decodeAudioData.length?n.ctx.decodeAudioData(e).then(a).catch(t):n.ctx.decodeAudioData(e,a,t)},i=function(e,n){n&&!e._duration&&(e._duration=n.duration),0===Object.keys(e._sprite).length&&(e._sprite={__default:[0,1e3*e._duration]}),"loaded"!==e._state&&(e._state="loaded",e._emit("load"),e._loadQueue())},_=function(){if(n.usingWebAudio){try{"undefined"!=typeof AudioContext?n.ctx=new AudioContext:"undefined"!=typeof webkitAudioContext?n.ctx=new webkitAudioContext:n.usingWebAudio=!1}catch(e){n.usingWebAudio=!1}n.ctx||(n.usingWebAudio=!1);var e=/iP(hone|od|ad)/.test(n._navigator&&n._navigator.platform),o=n._navigator&&n._navigator.appVersion.match(/OS (\d+)_(\d+)_?(\d+)?/),t=o?parseInt(o[1],10):null;if(e&&t&&t<9){var r=/safari/.test(n._navigator&&n._navigator.userAgent.toLowerCase());n._navigator&&!r&&(n.usingWebAudio=!1)}n.usingWebAudio&&(n.masterGain=void 0===n.ctx.createGain?n.ctx.createGainNode():n.ctx.createGain(),n.masterGain.gain.setValueAtTime(n._muted?0:n._volume,n.ctx.currentTime),n.masterGain.connect(n.ctx.destination)),n._setup()}};"function"==typeof define&&define.amd&&define([],function(){return{Howler:n,Howl:o}}),"undefined"!=typeof exports&&(exports.Howler=n,exports.Howl=o),"undefined"!=typeof global?(global.HowlerGlobal=e,global.Howler=n,global.Howl=o,global.Sound=t):"undefined"!=typeof window&&(window.HowlerGlobal=e,window.Howler=n,window.Howl=o,window.Sound=t)}(); +/*! Spatial Plugin */ +!function(){"use strict";HowlerGlobal.prototype._pos=[0,0,0],HowlerGlobal.prototype._orientation=[0,0,-1,0,1,0],HowlerGlobal.prototype.stereo=function(e){var n=this;if(!n.ctx||!n.ctx.listener)return n;for(var t=n._howls.length-1;t>=0;t--)n._howls[t].stereo(e);return n},HowlerGlobal.prototype.pos=function(e,n,t){var r=this;return r.ctx&&r.ctx.listener?(n="number"!=typeof n?r._pos[1]:n,t="number"!=typeof t?r._pos[2]:t,"number"!=typeof e?r._pos:(r._pos=[e,n,t],void 0!==r.ctx.listener.positionX?(r.ctx.listener.positionX.setTargetAtTime(r._pos[0],Howler.ctx.currentTime,.1),r.ctx.listener.positionY.setTargetAtTime(r._pos[1],Howler.ctx.currentTime,.1),r.ctx.listener.positionZ.setTargetAtTime(r._pos[2],Howler.ctx.currentTime,.1)):r.ctx.listener.setPosition(r._pos[0],r._pos[1],r._pos[2]),r)):r},HowlerGlobal.prototype.orientation=function(e,n,t,r,o,i){var a=this;if(!a.ctx||!a.ctx.listener)return a;var s=a._orientation;return n="number"!=typeof n?s[1]:n,t="number"!=typeof t?s[2]:t,r="number"!=typeof r?s[3]:r,o="number"!=typeof o?s[4]:o,i="number"!=typeof i?s[5]:i,"number"!=typeof e?s:(a._orientation=[e,n,t,r,o,i],void 0!==a.ctx.listener.forwardX?(a.ctx.listener.forwardX.setTargetAtTime(e,Howler.ctx.currentTime,.1),a.ctx.listener.forwardY.setTargetAtTime(n,Howler.ctx.currentTime,.1),a.ctx.listener.forwardZ.setTargetAtTime(t,Howler.ctx.currentTime,.1),a.ctx.listener.upX.setTargetAtTime(r,Howler.ctx.currentTime,.1),a.ctx.listener.upY.setTargetAtTime(o,Howler.ctx.currentTime,.1),a.ctx.listener.upZ.setTargetAtTime(i,Howler.ctx.currentTime,.1)):a.ctx.listener.setOrientation(e,n,t,r,o,i),a)},Howl.prototype.init=function(e){return function(n){var t=this;return t._orientation=n.orientation||[1,0,0],t._stereo=n.stereo||null,t._pos=n.pos||null,t._pannerAttr={coneInnerAngle:void 0!==n.coneInnerAngle?n.coneInnerAngle:360,coneOuterAngle:void 0!==n.coneOuterAngle?n.coneOuterAngle:360,coneOuterGain:void 0!==n.coneOuterGain?n.coneOuterGain:0,distanceModel:void 0!==n.distanceModel?n.distanceModel:"inverse",maxDistance:void 0!==n.maxDistance?n.maxDistance:1e4,panningModel:void 0!==n.panningModel?n.panningModel:"HRTF",refDistance:void 0!==n.refDistance?n.refDistance:1,rolloffFactor:void 0!==n.rolloffFactor?n.rolloffFactor:1},t._onstereo=n.onstereo?[{fn:n.onstereo}]:[],t._onpos=n.onpos?[{fn:n.onpos}]:[],t._onorientation=n.onorientation?[{fn:n.onorientation}]:[],e.call(this,n)}}(Howl.prototype.init),Howl.prototype.stereo=function(n,t){var r=this;if(!r._webAudio)return r;if("loaded"!==r._state)return r._queue.push({event:"stereo",action:function(){r.stereo(n,t)}}),r;var o=void 0===Howler.ctx.createStereoPanner?"spatial":"stereo";if(void 0===t){if("number"!=typeof n)return r._stereo;r._stereo=n,r._pos=[n,0,0]}for(var i=r._getSoundIds(t),a=0;a