diff --git a/engine/core/src/main/resources/view/core/Drawer.js b/engine/core/src/main/resources/view/core/Drawer.js index 784047a0..6463740c 100644 --- a/engine/core/src/main/resources/view/core/Drawer.js +++ b/engine/core/src/main/resources/view/core/Drawer.js @@ -40,7 +40,7 @@ export class Drawer { static get requirements () { return { - PIXI: 'PIXI6' + PIXI: 'PIXI' } } diff --git a/engine/core/src/main/resources/view/core/utils.js b/engine/core/src/main/resources/view/core/utils.js index 53c97a87..ba202c81 100644 --- a/engine/core/src/main/resources/view/core/utils.js +++ b/engine/core/src/main/resources/view/core/utils.js @@ -102,5 +102,5 @@ export function pushAll (self, arr) { */ export function fitAspectRatio (srcWidth, srcHeight, maxWidth, maxHeight, padding) { padding = padding || 0 - return Math.min(maxWidth / (srcWidth + padding), maxHeight / (srcHeight + padding)) + return Math.min((maxWidth + padding) / srcWidth, (maxHeight + padding) / srcHeight) } diff --git a/playground/misc/misc-3-release-notes.md b/playground/misc/misc-3-release-notes.md index dc420412..f4779767 100644 --- a/playground/misc/misc-3-release-notes.md +++ b/playground/misc/misc-3-release-notes.md @@ -2,6 +2,16 @@ The CodinGame SDK is regularly updated and improved. This document lets you know what changed in the latest releases. +## 4.5.1 + +### 🎁 Features + +- Updated to PIXI 8.4.1 + +### 🐞 Bug fix + +- Fixed fitAspectRatio's padding in utils.js + ## 4.5.0 ### 🎁 Features diff --git a/runner/src/main/resources/view/app.js b/runner/src/main/resources/view/app.js index de2f67f0..61bda3d9 100644 --- a/runner/src/main/resources/view/app.js +++ b/runner/src/main/resources/view/app.js @@ -9,7 +9,7 @@ const createCGPlayer = (opts) => { localStorageKey: 'ngStorage-gameParams', src: './player.html', libraries: { - PIXI6: './lib/pixi6.js' + PIXI: './lib/pixi8.js' } }) } diff --git a/runner/src/main/resources/view/lib/pixi6.js b/runner/src/main/resources/view/lib/pixi6.js deleted file mode 100644 index d6b9e8a1..00000000 --- a/runner/src/main/resources/view/lib/pixi6.js +++ /dev/null @@ -1,9 +0,0 @@ -/*! - * pixi.js-legacy - v6.5.3 - * Compiled Fri, 09 Sep 2022 13:49:32 UTC - * - * pixi.js-legacy is licensed under the MIT License. - * http://www.opensource.org/licenses/mit-license - */ -var PIXI=function(t){"use strict";var e=setTimeout;function r(t){return Boolean(t&&void 0!==t.length)}function i(){}function n(t){if(!(this instanceof n))throw new TypeError("Promises must be constructed via new");if("function"!=typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],l(t,this)}function o(t,e){for(;3===t._state;)t=t._value;0!==t._state?(t._handled=!0,n._immediateFn((function(){var r=1===t._state?e.onFulfilled:e.onRejected;if(null!==r){var i;try{i=r(t._value)}catch(t){return void a(e.promise,t)}s(e.promise,i)}else(1===t._state?s:a)(e.promise,t._value)}))):t._deferreds.push(e)}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"==typeof e||"function"==typeof e)){var r=e.then;if(e instanceof n)return t._state=3,t._value=e,void h(t);if("function"==typeof r)return void l((i=r,o=e,function(){i.apply(o,arguments)}),t)}t._state=1,t._value=e,h(t)}catch(e){a(t,e)}var i,o}function a(t,e){t._state=2,t._value=e,h(t)}function h(t){2===t._state&&0===t._deferreds.length&&n._immediateFn((function(){t._handled||n._unhandledRejectionFn(t._value)}));for(var e=0,r=t._deferreds.length;e0?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),function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(_||(_={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(v||(v={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(m||(m={})),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"}(E||(E={})),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"}(g||(g={})),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||(T={})),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"}(y||(y={})),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"}(b||(b={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(R||(R={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(x||(x={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(A||(A={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(S||(S={})),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"}(O||(O={})),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"}(I||(I={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(M||(M={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(P||(P={})),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"}(D||(D={})),function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"}(N||(N={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(C||(C={})),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"}(w||(w={}));var k={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)}},H=/iPhone/i,Y=/iPod/i,j=/iPad/i,V=/\biOS-universal(?:.+)Mac\b/i,W=/\bAndroid(?:.+)Mobile\b/i,z=/Android/i,q=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,K=/Silk/i,Z=/Windows Phone/i,Q=/\bWindows(?:.+)ARM\b/i,J=/BlackBerry/i,$=/BB10/i,tt=/Opera Mini/i,et=/\b(CriOS|Chrome)(?:.+)Mobile/i,rt=/Mobile(?:.+)Firefox\b/i,it=function(t){return void 0!==t&&"MacIntel"===t.platform&&"number"==typeof t.maxTouchPoints&&t.maxTouchPoints>1&&"undefined"==typeof MSStream},nt=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(H)&&!n(Z),ipod:n(Y),tablet:!n(H)&&(n(j)||it(e))&&!n(Z),universal:n(V),device:(n(H)||n(Y)||n(j)||n(V)||it(e))&&!n(Z)},amazon:{phone:n(q),tablet:!n(q)&&n(K),device:n(q)||n(K)},android:{phone:!n(Z)&&n(q)||!n(Z)&&n(W),tablet:!n(Z)&&!n(q)&&!n(W)&&(n(K)||n(z)),device:!n(Z)&&(n(q)||n(K)||n(W)||n(z))||n(/\bokhttp\b/i)},windows:{phone:n(Z),tablet:n(Q),device:n(Z)||n(Q)},other:{blackberry:n(J),blackberry10:n($),opera:n(tt),firefox:n(rt),chrome:n(et),device:n(J)||n($)||n(tt)||n(rt)||n(et)},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),ot={ADAPTER:k,MIPMAP_TEXTURES:S.POW2,ANISOTROPIC_LEVEL:0,RESOLUTION:1,FILTER_RESOLUTION:1,FILTER_MULTISAMPLE:C.NONE,SPRITE_MAX_TEXTURES:function(t){var e,r=!0;(nt.tablet||nt.phone)&&(nt.apple.device&&(e=navigator.userAgent.match(/OS (\d+)_(\d+)?/))&&parseInt(e[1],10)<11&&(r=!1),nt.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:M.AUTO,GC_MAX_IDLE:3600,GC_MAX_CHECK_COUNT:600,WRAP_MODE:A.CLAMP,SCALE_MODE:x.LINEAR,PRECISION_VERTEX:P.HIGH,PRECISION_FRAGMENT:nt.apple.device?P.HIGH:P.MEDIUM,CAN_UPLOAD_SAME_BUFFER:!nt.apple.device,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},st="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function at(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 ht=at((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 pt(d,f,r,i,n,u,0),f}function dt(t,e,r,i,n){var o,s;if(n===Ft(t,e,r,i)>0)for(o=e;o=e;o-=i)s=Ct(o,t[o],t[o+1],s);return s&&Ot(s,s.next)&&(wt(s),s=s.next),s}function ft(t,e){if(!t)return t;e||(e=t);var r,i=t;do{if(r=!1,i.steiner||!Ot(i,i.next)&&0!==St(i.prev,i,i.next))i=i.next;else{if(wt(i),(i=e=i.prev)===i.next)break;r=!0}}while(r||i!==e);return e}function pt(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=bt(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?vt(t,i,n,o):_t(t))e.push(a.i/r|0),e.push(t.i/r|0),e.push(h.i/r|0),wt(t),t=h.next,u=h.next;else if((t=h)===u){s?1===s?pt(t=mt(ft(t),e,r),e,r,i,n,o,2):2===s&&Et(t,e,r,i,n,o):pt(ft(t),e,r,i,n,o,1);break}}}function _t(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&&xt(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 vt(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=bt(f,p,e,r,i),E=bt(_,v,e,r,i),g=t.prevZ,T=t.nextZ;g&&g.z>=m&&T&&T.z<=E;){if(g.x>=f&&g.x<=_&&g.y>=p&&g.y<=v&&g!==n&&g!==s&&xt(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&&xt(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&&xt(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<=E;){if(T.x>=f&&T.x<=_&&T.y>=p&&T.y<=v&&T!==n&&T!==s&&xt(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 mt(t,e,r){var i=t;do{var n=i.prev,o=i.next.next;!Ot(n,o)&&It(n,i,i.next,o)&&Dt(n,o)&&Dt(o,n)&&(e.push(n.i/r|0),e.push(i.i/r|0),e.push(o.i/r|0),wt(i),wt(i.next),i=t=o),i=i.next}while(i!==t);return ft(i)}function Et(t,e,r,i,n,o){var s=t;do{for(var a=s.next.next;a!==s.prev;){if(s.i!==a.i&&At(s,a)){var h=Nt(s,a);return s=ft(s,s.next),h=ft(h,h.next),pt(s,e,r,i,n,o,0),void pt(h,e,r,i,n,o,0)}a=a.next}s=s.next}while(s!==t)}function gt(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&&xt(or.x||i.x===r.x&&yt(r,i)))&&(r=i,d=h)),i=i.next}while(i!==u);return r}(t,e);if(!r)return e;var i=Nt(r,t);return ft(i,i.next),ft(r,r.next)}function yt(t,e){return St(t.prev,t,e.prev)<0&&St(e.next,t,t.next)<0}function bt(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 Rt(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 At(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&&It(r,r.next,t,e))return!0;r=r.next}while(r!==t);return!1}(t,e)&&(Dt(t,e)&&Dt(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))||Ot(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 Ot(t,e){return t.x===e.x&&t.y===e.y}function It(t,e,r,i){var n=Pt(St(t,e,r)),o=Pt(St(t,e,i)),s=Pt(St(r,i,t)),a=Pt(St(r,i,e));return n!==o&&s!==a||(!(0!==n||!Mt(t,r,e))||(!(0!==o||!Mt(t,i,e))||(!(0!==s||!Mt(r,t,i))||!(0!==a||!Mt(r,e,i)))))}function Mt(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 Pt(t){return t>0?1:t<0?-1:0}function Dt(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 Nt(t,e){var r=new Lt(t.i,t.x,t.y),i=new Lt(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 Ct(t,e,r,i){var n=new Lt(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 wt(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 Lt(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 Ft(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},ut.default=lt;var Ut=at((function(t,e){!function(r){var i=e&&!e.nodeType&&e,n=t&&!t.nodeType&&t,o="object"==typeof st&&st;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 E(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 y(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 R(t){var e,r,i,n,o,s,a,l,c,d,f,_=[],m=t.length,E=0,g=128,y=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-E)/s))&&v("overflow"),E+=l*s,!(l<(c=a<=y?1:a>=y+26?26:a-y));a+=u)s>p(h/(d=u-c))&&v("overflow"),s*=d;y=b(E-o,e=_.length+1,0==o),p(E/e)>h-g&&v("overflow"),g+=p(E/e),E%=e,_.splice(E++,0,g)}return T(_)}function x(t){var e,r,i,n,o,s,a,l,c,d,f,m,E,T,R,x=[];for(m=(t=g(t)).length,e=128,r=0,o=72,s=0;s=e&&fp((h-r)/(E=i+1))&&v("overflow"),r+=(a-e)*E,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)R=l-d,T=u-d,x.push(_(y(d+R%T,0))),l=p(R/T);x.push(_(y(l,0))),o=b(r,E,i==n),r=0,++i}++r,++e}return x.join("")}if(s={version:"1.3.2",ucs2:{decode:g,encode:T},decode:R,encode:x,toASCII:function(t){return E(t,(function(t){return c.test(t)?"xn--"+x(t):t}))},toUnicode:function(t){return E(t,(function(t){return l.test(t)?R(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}(st)})),Bt=function(t){return"string"==typeof t},Gt=function(t){return"object"==typeof t&&null!==t},Xt=function(t){return null===t},kt=function(t){return null==t};function Ht(t,e){return Object.prototype.hasOwnProperty.call(t,e)}var Yt=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),Ht(n,c)?Array.isArray(n[c])?n[c].push(d):n[c]=[n[c],d]:n[c]=d}return n},jt=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}},Vt=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(jt(i))+r;return Array.isArray(t[i])?t[i].map((function(t){return n+encodeURIComponent(jt(t))})).join(e):n+encodeURIComponent(jt(t[i]))})).join(e):i?encodeURIComponent(jt(i))+r+encodeURIComponent(jt(t)):""},Wt=at((function(t,e){e.decode=e.parse=Yt,e.encode=e.stringify=Vt})),zt=ue,qt=function(t,e){return ue(t,!1,!0).resolve(e)},Kt=function(t){Bt(t)&&(t=ue(t));if(!(t instanceof Zt))return Zt.prototype.format.call(t);return t.format()};function Zt(){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 Qt=/^([a-z0-9.+-]+:)/i,Jt=/:[0-9]*$/,$t=/^(\/\/?(?!\/)[^\?\s]*)(\?[^\s]*)?$/,te=["{","}","|","\\","^","`"].concat(["<",">",'"',"`"," ","\r","\n","\t"]),ee=["'"].concat(te),re=["%","/","?",";","#"].concat(ee),ie=["/","?","#"],ne=/^[+a-z0-9A-Z_-]{0,63}$/,oe=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,se={javascript:!0,"javascript:":!0},ae={javascript:!0,"javascript:":!0},he={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0};function ue(t,e,r){if(t&&Gt(t)&&t instanceof Zt)return t;var i=new Zt;return i.parse(t,e,r),i}Zt.prototype.parse=function(t,e,r){if(!Bt(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[y];if(!T.match(ne)){var R=m.slice(0,p),x=m.slice(p+1),A=g.match(oe);A&&(R.push(A[1]),x.unshift(A[2])),x.length&&(s="/"+x.join(".")+s),this.hostname=R.join(".");break}}}this.hostname.length>255?this.hostname="":this.hostname=this.hostname.toLowerCase(),v||(this.hostname=Ut.toASCII(this.hostname));var S=this.port?":"+this.port:"",O=this.hostname||"";this.host=O+S,this.href+=this.host,v&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),"/"!==s[0]&&(s="/"+s))}if(!se[u])for(p=0,E=ee.length;p0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift());return r.search=t.search,r.query=t.query,Xt(r.pathname)&&Xt(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 y=g.slice(-1)[0],b=(r.host||t.host||g.length>1)&&("."===y||".."===y)||""===y,R=0,x=g.length;x>=0;x--)"."===(y=g[x])?g.splice(x,1):".."===y?(g.splice(x,1),R++):R&&(g.splice(x,1),R--);if(!m&&!E)for(;R--;R)g.unshift("..");!m||""===g[0]||g[0]&&"/"===g[0].charAt(0)||g.unshift(""),b&&"/"!==g.join("/").substr(-1)&&g.push("");var A,S=""===g[0]||g[0]&&"/"===g[0].charAt(0);T&&(r.hostname=r.host=S?"":g.length?g.shift():"",(A=!!(r.host&&r.host.indexOf("@")>0)&&r.host.split("@"))&&(r.auth=A.shift(),r.host=r.hostname=A.shift()));return(m=m||r.host&&g.length)&&!S&&g.unshift(""),g.length?r.pathname=g.join("/"):(r.pathname=null,r.path=null),Xt(r.pathname)&&Xt(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},Zt.prototype.parseHost=function(){var t=this.host,e=Jt.exec(t);e&&(":"!==(e=e[0])&&(this.port=e.substr(1)),t=t.substr(0,t.length-e.length)),t&&(this.hostname=t)};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 le={parse:zt,format:Kt,resolve:qt};function ce(t){if("string"!=typeof t)throw new TypeError("Path must be a string. Received "+JSON.stringify(t))}function de(t){return t.split("?")[0].split("#")[0]}var fe={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){ce(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=de(this.toPosix(null!=e?e:ot.ADAPTER.getBaseUrl())),n=de(this.toPosix(null!=r?r:this.rootname(i)));return ce(t),(t=this.toPosix(t)).startsWith("/")?fe.join(n,t.slice(1)):this.isAbsolute(t)?t:this.join(i,t)},normalize:function(t){if(ce(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 ce(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(ce(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){ce(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){ce(t),e&&ce(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){ce(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){ce(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:":"};ot.RETINA_PREFIX=/@([0-9\.]+)x/,ot.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var pe,_e=!1;function ve(t){var e;if(!_e){if(ot.ADAPTER.getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){var r=["\n %c %c %c PixiJS 6.5.3 - ✰ "+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.3 - "+t+" - http://www.pixijs.com/");_e=!0}}function me(){return void 0===pe&&(pe=function(){var t={stencil:!0,failIfMajorPerformanceCaveat:ot.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!ot.ADAPTER.getWebGLRenderingContext())return!1;var e=ot.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}}()),pe}var Ee={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 ge(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 ye(t){return"string"==typeof t&&"#"===(t=Ee[t.toLowerCase()]||t)[0]&&(t=t.slice(1)),parseInt(t,16)}function be(t){return(255*t[0]<<16)+(255*t[1]<<8)+(255*t[2]|0)}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 xe(t,e){return Re[e?1:0][t]}function Ae(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 Se(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 Oe(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 Ie(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 Ne(t){return!(t&t-1||!t)}function Ce(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 we(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=$e[0].set(t.left,t.top),u=$e[1].set(t.left,t.bottom),l=$e[2].set(t.right,t.top),c=$e[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,E=f*o+p*a;if(Math.max(_,v,m,E)<=f*h.x+p*h.y||Math.min(_,v,m,E)>=f*c.x+p*c.y)return!1;var g=d*(h.y-l.y),T=d*(l.x-h.x),y=g*n+T*s,b=g*o+T*s,R=g*n+T*a,x=g*o+T*a;return!(Math.max(y,b,R,x)<=g*h.x+T*h.y||Math.min(y,b,R,x)>=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}(),er=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 tr(this.x-this.radius,this.y-this.radius,2*this.radius,2*this.radius)},e}(),rr=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 tr(this.x-this.width,this.y-this.height,this.width,this.height)},e}(),ir=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}(),nr=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}(),or=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}(),sr=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 Je;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 Je;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(Ke-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}(),ar=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],hr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],ur=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],lr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],cr=[],dr=[],fr=Math.sign;!function(){for(var t=0;t<16;t++){var e=[];cr.push(e);for(var r=0;r<16;r++)for(var i=fr(ar[t]*ar[r]+ur[t]*hr[r]),n=fr(hr[t]*ar[r]+lr[t]*hr[r]),o=fr(ar[t]*ur[r]+ur[t]*lr[r]),s=fr(hr[t]*ur[r]+lr[t]*lr[r]),a=0;a<16;a++)if(ar[a]===i&&hr[a]===n&&ur[a]===o&&lr[a]===s){e.push(a);break}}for(t=0;t<16;t++){var h=new sr;h.set(ar[t],hr[t],ur[t],lr[t],0,0),dr.push(h)}}();var pr={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 ar[t]},uY:function(t){return hr[t]},vX:function(t){return ur[t]},vY:function(t){return lr[t]},inv:function(t){return 8&t?15&t:7&-t},add:function(t,e){return cr[t][e]},sub:function(t,e){return cr[t][pr.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?pr.S:pr.N:2*Math.abs(e)<=Math.abs(t)?t>0?pr.E:pr.W:e>0?t>0?pr.SE:pr.SW:t>0?pr.NE:pr.NW},matrixAppendRotationInv:function(t,e,r,i){void 0===r&&(r=0),void 0===i&&(i=0);var n=dr[pr.inv(e)];n.tx=r,n.ty=i,t.append(n)}},_r=function(){function t(){this.worldTransform=new sr,this.localTransform=new sr,this.position=new or(this.onChange,this,0,0),this.scale=new or(this.onChange,this,1,1),this.pivot=new or(this.onChange,this,0,0),this.skew=new or(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}();ot.SORTABLE_CHILDREN=!1;var vr=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?tr.EMPTY:((t=t||new tr(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}(),mr=function(t,e){return mr=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])},mr(t,e)};function Er(t,e){function r(){this.constructor=t}mr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var gr,Tr,yr,br,Rr,xr,Ar,Sr,Or,Ir,Mr,Pr,Dr,Nr,Cr,wr,Lr,Fr,Ur,Br,Gr=function(t){function e(){var e=t.call(this)||this;return e.tempDisplayObjectParent=null,e.transform=new _r,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 vr,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 Er(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},e.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);we(this.children,r,1),this.children.splice(e,0,t),this.onChildrenChange(e)},e.prototype.getChildAt=function(t){if(t<0||t>=this.children.length)throw new Error("getChildAt: Index ("+t+") does not exist.");return this.children[t]},e.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(kr),this.sortDirty=!1},e.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&&r.height>0){var i,n;if(this.cullArea?(i=this.cullArea,n=this.worldTransform):this._render!==e.prototype._render&&(i=this.getBounds(!0)),i&&r.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(Wr.prototype,{dispatch:{value:Wr.prototype.emit},run:{value:Wr.prototype.emit}}),t.UPDATE_PRIORITY=void 0,ot.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 zr=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}(),qr=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 zr(null,null,1/0),this.deltaMS=1/ot.TARGET_FPMS,this.elapsedMS=1/ot.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 zr(e,r,i))},e.prototype.addOnce=function(e,r,i){return void 0===i&&(i=t.UPDATE_PRIORITY.NORMAL),this._addListener(new zr(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=Zr[n];if(o.test&&o.test(t,r))return new o(t,e)}throw new Error("Unrecognized source type to auto-detect Resource")}var Jr=function(t,e){return Jr=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])},Jr(t,e)};function $r(t,e){function r(){this.constructor=t}Jr(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var ti=function(){return ti=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 $r(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=Ne(this.realWidth)&&Ne(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 ke[this.cacheId],delete Xe[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=ot.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+"_"+Ue()}o=t._pixiId}var a=ke[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 ri(e,{width:i,height:n}),a=e instanceof Float32Array?t.TYPES.FLOAT:t.TYPES.UNSIGNED_BYTE;return new r(s,Object.assign(ii,o||{width:i,height:n,type:a}))},r.addToCache=function(t,e){e&&(-1===t.textureCacheIds.indexOf(e)&&t.textureCacheIds.push(e),ke[e]&&console.warn("BaseTexture added to the cache with an id ["+e+"] that already had an entry"),ke[e]=t)},r.removeFromCache=function(t){if("string"==typeof t){var e=ke[t];if(e){var r=e.textureCacheIds.indexOf(t);return r>-1&&e.textureCacheIds.splice(r,1),delete ke[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}(ai),di=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];ai.crossOrigin(o,s,i.crossorigin);for(var a=0;a0&&!1===t.paused&&!1===t.ended&&t.readyState>2},e.prototype._isSourceReady=function(){var t=this.source;return 3===t.readyState||4===t.readyState},e.prototype._onPlayStart=function(){this.valid||this._onCanPlay(),this.autoUpdate&&!this._isConnectedToTicker&&(qr.shared.add(this.update,this),this._isConnectedToTicker=!0)},e.prototype._onPlayStop=function(){this._isConnectedToTicker&&(qr.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&&(qr.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?(qr.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._isSourcePlaying()&&(qr.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}(ai),fi=function(t){function e(e){return t.call(this,e)||this}return $r(e,t),e.test=function(t){return!!globalThis.createImageBitmap&&"undefined"!=typeof ImageBitmap&&t instanceof ImageBitmap},e}(ai);Zr.push(li,fi,hi,di,ci,ri,ui,si);var pi={__proto__:null,Resource:ei,BaseImageResource:ai,INSTALLED:Zr,autoDetectResource:Qr,AbstractMultiResource:oi,ArrayResource:si,BufferResource:ri,CanvasResource:hi,CubeResource:ui,ImageResource:li,SVGResource:ci,VideoResource:di,ImageBitmapResource:fi},_i=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return $r(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}(ri),vi=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 Wr("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 ni(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 ni(new _i(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 Xe[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 ni),Ti(e._EMPTY),Ti(e._EMPTY.baseTexture)),e._EMPTY},enumerable:!1,configurable:!0}),Object.defineProperty(e,"WHITE",{get:function(){if(!e._WHITE){var t=ot.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(ni.from(t)),Ti(e._WHITE),Ti(e._WHITE.baseTexture)}return e._WHITE},enumerable:!1,configurable:!0}),e}(ht),bi=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 $r(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=De(e)))<<16|65535&(r=De(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(sr.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=Ui[0],i=Ui[1],n=Ui[2],o=Ui[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?Bi.copyFrom(n):Bi.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}(),Xi=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}(),ki=function(){function t(t){this.renderer=t,this.emptyRenderer=new Xi(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}(),ji=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},Vi=new tr,Wi=function(){function e(t){this.renderer=t,this.managedFramebuffers=[],this.unknownFramebuffer=new vi(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 tr,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;ot.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 ji(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),rn=r}return rn}function on(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 sn={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 an(t){return sn[t]}var hn=null,un={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 ln(t,e){if(!hn){var r=Object.keys(un);hn={};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}(),In=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}(),Mn=new sr,Pn=[],Dn=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=ot.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST,r}return $r(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=Pn.pop())&&void 0!==e?e:new tr);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?Mn.copyFrom(o):Mn.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&&Pn.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}(In),Nn=function(t){function e(e){var r=t.call(this,e)||this;return r.glConst=ot.ADAPTER.getWebGLRenderingContext().STENCIL_TEST,r}return $r(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}(In),Cn=function(){function t(t){this.renderer=t,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new sr,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}(),wn=new tr,Ln=new tr,Fn=function(){function t(t){this.renderer=t,this.clearColor=t._backgroundColorRgba,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new tr,this.destinationFrame=new tr,this.viewportFrame=new tr}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||(wn.width=t.frame.width,wn.height=t.frame.height,e=wn),r||(Ln.x=t.frame.x,Ln.y=t.frame.y,Ln.width=e.width,Ln.height=e.height,r=Ln),n=i.framebuffer):(o=s.resolution,e||(wn.width=s.screen.width,wn.height=s.screen.height,e=wn),r||((r=wn).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 Un(t,e,r,i,n){r.buffer.update(n)}var Bn={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 "},Gn={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 Xn(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 kn(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 Hn(t,e){if(!t.autoManage)return{size:0,syncFunc:Un};for(var r=Xn(kn(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=an(a.data.type),p=Math.max(Gn[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=Bn[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 Yn=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 jn(t,e){var r=Zi(t,t.VERTEX_SHADER,e.vertexSrc),i=Zi(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)||Qi(t,r),t.getShaderParameter(i,t.COMPILE_STATUS)||Qi(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}(),Zn=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},Qn=function(){function e(t){this.renderer=t,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new ni,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,E,g,T,y,b,R,x;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]=((E={})[t.FORMATS.DEPTH_STENCIL]=e.DEPTH32F_STENCIL8,E),x=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]=((y={})[t.FORMATS.RGB]=e.RGB,y),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]=((R={})[t.FORMATS.RGBA]=e.RGBA,R),x=g),x}(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 Zn(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&&we(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}(),Jn={__proto__:null,FilterSystem:Gi,BatchSystem:ki,ContextSystem:Yi,FramebufferSystem:Wi,GeometrySystem:qi,MaskSystem:On,ScissorSystem:Dn,StencilSystem:Nn,ProjectionSystem:Cn,RenderTextureSystem:Fn,ShaderSystem:zn,StateSystem:qn,TextureGCSystem:Kn,TextureSystem:Qn},$n=new sr,to=function(e){function r(r,i){void 0===r&&(r=t.RENDERER_TYPE.UNKNOWN);var n=e.call(this)||this;return i=Object.assign({},ot.RENDER_OPTIONS,i),n.options=i,n.type=r,n.screen=new tr(0,0,i.width,i.height),n.view=i.view||ot.ADAPTER.createCanvas(),n.resolution=i.resolution||ot.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 $r(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 bi?(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){Vr.add({name:e,type:t.ExtensionType.RendererPlugin,ref:r})},r.__plugins={},r}(to);function no(t){return io.create(t)}Vr.handleByMap(t.ExtensionType.RendererPlugin,io.__plugins);var oo="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}",so="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",ao=function(){function t(t){this.renderer=t}return t.prototype.destroy=function(){this.renderer=null},t}(),ho=function(){this.texArray=null,this.blend=0,this.type=t.DRAW_MODES.TRIANGLES,this.start=0,this.size=0,this.data=null},uo=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=++ni._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}(),So=function(){function t(){this.pressure=0,this.rotationAngle=0,this.twist=0,this.tangentialPressure=0,this.global=new Je,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}(),Oo=function(t,e){return Oo=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])},Oo(t,e)},Io=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}(),Mo=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}(),Po=function(){function t(){this._tempPoint=new Je}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}(),Do={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};Gr.mixin(Do);var No={target:null,data:{global:null}},Co=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 So,i.mouse.identifier=1,i.mouse.global.set(-999999),i.activeInteractionData={},i.activeInteractionData[1]=i.mouse,i.interactionDataPool=[],i.eventData=new Io,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 Po,i._tempDisplayObject=new Xr,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}Oo(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 No.target=null,No.data.global=t,e||(e=this.lastObjectRendered),this.processInteractive(No,e,null,!0),No.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&&(qr.system.add(this.tickerUpdate,this,t.UPDATE_PRIORITY.INTERACTION),this.tickerAdded=!0)},r.prototype.removeTickerListener=function(){this.tickerAdded&&(qr.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,ko||(ko=document.createElement("a")),ko.href=t;var r=Xo(ko.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,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,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 zo=function(t,e){this.data=t,this.callback=e},qo=function(){function t(t,e){var r=this;if(void 0===e&&(e=1),this.workers=0,this.saturated=Vo,this.unsaturated=Vo,this.empty=Vo,this.drain=Vo,this.error=Vo,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 zo(t,"function"==typeof i?i:Vo);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*rs[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))*rs[e];return a},e}(as),us=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,y>>>=1;var R=148;for(b=0;b<_;b++)m.push(new Uint8Array(t,R,g)),R+=g}return m.map((function(t){return new hs(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 gs=[171,75,84,88,32,49,49,187,13,10,26,10],Ts=((fs={})[t.TYPES.UNSIGNED_BYTE]=1,fs[t.TYPES.UNSIGNED_SHORT]=2,fs[t.TYPES.INT]=4,fs[t.TYPES.UNSIGNED_INT]=4,fs[t.TYPES.FLOAT]=4,fs[t.TYPES.HALF_FLOAT]=8,fs),ys=((ps={})[t.FORMATS.RGBA]=4,ps[t.FORMATS.RGB]=3,ps[t.FORMATS.RG]=2,ps[t.FORMATS.RED]=1,ps[t.FORMATS.LUMINANCE]=1,ps[t.FORMATS.LUMINANCE_ALPHA]=2,ps[t.FORMATS.ALPHA]=1,ps),bs=((_s={})[t.TYPES.UNSIGNED_SHORT_4_4_4_4]=2,_s[t.TYPES.UNSIGNED_SHORT_5_5_5_1]=2,_s[t.TYPES.UNSIGNED_SHORT_5_6_5]=2,_s);function Rs(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?R:A,levelHeight:p>1||0!==s?x:S,levelBuffer:new Uint8Array(r,P,b)},P+=b}O=(O+=M+4)%4!=0?O+4-O%4:O,b=(A=(R=R>>1||1)+4-1&-4)*(S=(x=x>>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 ri(r,{width:e[0].levelWidth,height:e[0].levelHeight}),type:s,format:i?xs(a):a}})),kvData:y}:{compressed:g.map((function(t){return new hs(null,{format:h,width:u,height:l,levels:p,levelBuffers:t})})),kvData:y}}function xs(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 As=function(){function e(){}return e.use=function(t,e){if("dds"===t.extension&&t.data)try{Object.assign(t,ls(t.name||t.url,Es(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 Ss=function(){function e(){}return e.use=function(e,r){if("ktx"===e.extension&&e.data)try{var i=e.name||e.url,n=Rs(0,e.data,this.loadKeyValueData),o=n.compressed,s=n.uncompressed,a=n.kvData;if(o){var h=ls(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 yi(new ni(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),ni.addToCache(n.baseTexture,o),yi.addToCache(n,o),0===r&&(l[i]=n,ni.addToCache(n.baseTexture,i),yi.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}(),Os=function(t,e){return Os=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])},Os(t,e)};function Is(t,e){function r(){this.constructor=t}Os(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var Ms=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 Is(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,ge(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=xe(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=Ae(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?Se(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}(Xi);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 Ns={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}},Cs=function(){function t(){this.color=16777215,this.alpha=1,this.texture=yi.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=yi.WHITE,this.matrix=null,this.visible=!1},t.prototype.destroy=function(){this.texture=null,this.matrix=null},t}(),ws=function(t,e){return ws=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])},ws(t,e)};function Ls(t,e){function r(){this.constructor=t}ws(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function Fs(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){Fs(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,E=0,g=4*p+(n?2:0)+2,T=g,y=_,b=r+(v=n+s),R=r-v,x=i+(m=o);if(h[E++]=b,h[E++]=x,h[--g]=x,h[--g]=R,o){var A=i-m;h[T++]=R,h[T++]=A,h[--y]=A,h[--y]=b}for(var S=1;Sc&&(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 E=1,g=d;Eg?(X?(f.push(W,z),f.push(b+S*C,R+O*C),f.push(W,z),f.push(b+I*C,R+M*C)):(f.push(b-S*N,R-O*N),f.push(q,K),f.push(b-I*N,R-M*N),f.push(q,K)),_+=2):s.join===t.LINE_JOIN.ROUND?X?(f.push(W,z),f.push(b+S*C,R+O*C),_+=js(b,R,b+S*C,R+O*C,b+I*C,R+M*C,f,!0)+4,f.push(W,z),f.push(b+I*C,R+M*C)):(f.push(b-S*N,R-O*N),f.push(q,K),_+=js(b,R,b-S*N,R-O*N,b-I*N,R-M*N,f,!1)+4,f.push(b-I*N,R-M*N),f.push(q,K)):(f.push(W,z),f.push(q,K)):(f.push(b-S*N,R-O*N),f.push(b+S*C,R+O*C),s.join===t.LINE_JOIN.ROUND?_+=X?js(b,R,b+S*C,R+O*C,b+I*C,R+M*C,f,!0)+2:js(b,R,b-S*N,R-O*N,b-I*N,R-M*N,f,!1)+2:s.join===t.LINE_JOIN.MITER&&V/E<=g&&(X?(f.push(q,K),f.push(q,K)):(f.push(W,z),f.push(W,z)),_+=2),f.push(b-I*N,R-M*N),f.push(b+I*C,R+M*C),_+=2)}}T=n[2*(p-2)],y=n[2*(p-2)+1],b=n[2*(p-1)],S=-(y-(R=n[2*(p-1)+1])),O=T-b,S/=P=Math.sqrt(S*S+O*O),O/=P,S*=m,O*=m,f.push(b-S*N,R-O*N),f.push(b+S*C,R+O*C),u||(s.cap===t.LINE_CAP.ROUND?_+=js(b-S*(N-C)*.5,R-O*(N-C)*.5,b-S*N,R-O*N,b+S*C,R+O*C,f,!1)+2:s.cap===t.LINE_CAP.SQUARE&&(_+=Ys(b,R,S,O,N,C,!1,f)));var Q=r.indices,J=Ns.epsilon*Ns.epsilon;for(w=v;w<_+v-2;++w)T=f[2*w],y=f[2*w+1],b=f[2*(w+1)],R=f[2*(w+1)+1],x=f[2*(w+2)],A=f[2*(w+2)+1],Math.abs(T*(R-A)+b*(A-y)+x*(y-R))l*a}},t.arc=function(t,e,r,i,n,o,s,a,h){for(var u=s-o,l=Ns._segmentsCount(Math.abs(u)*n,40*Math.ceil(Math.abs(u)/Ke)),c=u/(2*l),d=2*c,f=Math.cos(c),p=Math.sin(c),_=l-1,v=_%1/_,m=0;m<=_;++m){var E=c+o+d*(m+v*m),g=Math.cos(E),T=-Math.sin(E);h.push((f*g+p*T)*n+r,(f*-T+p*g)*n+i)}},t}(),qs=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,E=0,g=t,T=e,y=1;y<=10;++y)m=g-(_=(p=(f=(d=1-(u=y/10))*d)*d)*t+3*f*u*r+3*d*(l=u*u)*n+(c=l*u)*s),E=T-(v=p*e+3*f*u*i+3*d*l*o+c*a),g=_,T=v,h+=Math.sqrt(m*m+E*E);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=Ns._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}(),Ks=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=Ns._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}(),Zs=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}(),Qs=((Ws={})[t.SHAPES.POLY]=Us,Ws[t.SHAPES.CIRC]=Bs,Ws[t.SHAPES.ELIP]=Bs,Ws[t.SHAPES.RECT]=Gs,Ws[t.SHAPES.RREC]=Hs,Ws),Js=[],$s=[],ta=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}(),ea=new Je,ra=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 vr,t.boundsDirty=-1,t}return Ls(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 ta(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 ta(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=$s.pop())||((o=new ho).texArray=new uo),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)}ni._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 ir,this.currentPath.closeStroke=!1,this.currentPath.points.push(t[e-2],t[e-1]))}else this.currentPath=new ir,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),Ks.curveTo(t,e,r,i,n),this},r.prototype.bezierCurveTo=function(t,e,r,i,n,o){return this._initCurve(),qs.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=zs.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+=Ke:o&&i<=n&&(i+=Ke),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 tr(t,e,r,i))},r.prototype.drawRoundedRect=function(t,e,r,i,n){return this.drawShape(new nr(t,e,r,i,n))},r.prototype.drawCircle=function(t,e,r){return this.drawShape(new er(t,e,r))},r.prototype.drawEllipse=function(t,e,r,i){return this.drawShape(new rr(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&&ua.x=n&&ua.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||yi.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}(Hr);t.TEXT_GRADIENT=void 0;var da=function(t,e){return da=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])},da(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 fa={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},pa=["serif","sans-serif","monospace","cursive","fantasy","system-ui"],_a=function(){function t(t){this.styleID=0,this.reset(),Ea(this,t,t)}return t.prototype.clone=function(){var e={};return Ea(e,this,fa),new t(e)},t.prototype.reset=function(){Ea(this,fa,fa)},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=ma(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=ma(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)&&pa.indexOf(i)<0&&(i='"'+i+'"'),e[r]=i}return this.fontStyle+" "+this.fontVariant+" "+this.fontWeight+" "+t+" "+e.join(",")},t}();function va(t){return"number"==typeof t?Te(t):("string"==typeof t&&0===t.indexOf("0x")&&(t=t.replace("0x","#")),t)}function ma(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 y=t.wordWrapSplit(m),b=0;bp&&(a+=t.addLine(s),f=!1,s="",o=0),s+=R,o+=O}else{s.length>0&&(a+=t.addLine(s),s="",o=0);var I=v===_.length-1;a+=t.addLine(m,!I),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 E=v+p,g=i.lineHeight*(f+1),T=E;f+10},t}();function xa(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&&qr.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 Na(t,e){return e instanceof ni&&(e._glTextures[t.CONTEXT_UID]||t.texture.bind(e),!0)}function Ca(t,e){if(!(e instanceof sa))return!1;var r=e.geometry;e.finishPoly(),r.updateBatches();for(var i=r.batches,n=0;n=i&&ka.x=n&&ka.y1?yn.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):yn.from(Ya,"#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;ja.set(l.a*p/v,l.b*p/m,l.c*_/v,l.d*_/m,l.tx/v,l.ty/m),ja.invert(),d?ja.prepend(c.mapCoord):(f.uniforms.uMapCoord=c.mapCoord.toArray(!0),f.uniforms.uClampFrame=c.uClampFrame,f.uniforms.uClampOffset=c.uClampOffset),f.uniforms.uTransform=ja.toArray(!0),f.uniforms.uColor=Oe(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=xe(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}(Xi),Wa=function(t,e){return Wa=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])},Wa(t,e)};function za(t,e){function r(){this.constructor=t}Wa(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}var qa=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}(),Ka=new Je,Za=new ir,Qa=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||bn.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=ot.ROUND_PIXELS,s.batchUvs=null,s}return za(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;Oe(this._tint,this._alpha,this.uniforms.uColor,t.alphaMode)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)},e}(yn),$a=function(e){function r(r,i,n){var o=e.call(this)||this,s=new Si(r),a=new Si(i,!0),h=new Si(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 za(r,e),Object.defineProperty(r.prototype,"vertexDirtyId",{get:function(){return this.buffers[0]._updateID},enumerable:!1,configurable:!0}),r}(Di),th=function(t,e){return th=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])},th(t,e)},eh=function(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]},rh=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 eh;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}(),ih=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 eh,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 ih.test(e)}return!1},t.parse=function(t){var e=(new globalThis.DOMParser).parseFromString(t,"text/xml");return ih.parse(e)},t}(),oh=[rh,ih,nh];function sh(t){for(var e=0;e=u-x*a){if(0===E)throw new Error("[BitmapFont] textureHeight "+u+"px is too small for "+c.fontSize+"px fonts");--y,p=null,_=null,v=null,E=0,m=0,g=0}else if(g=Math.max(x+b.fontProperties.descent,g),A*a+m>=d)--y,E+=g*a,E=Math.ceil(E),m=0,g=0;else{ah(p,_,b,m,E,a,c);var S=uh(b.text);f.char.push({id:S,page:T.length-1,x:m/a,y:E/a,width:A,height:x,xoffset:0,yoffset:0,xadvance:Math.ceil(R-(c.dropShadow?c.dropShadowDistance:0)-(c.stroke?c.strokeThickness:0))}),m+=(A+2*s)*a,m=Math.ceil(m)}}y=0;for(var O=l.length;y0&&n.x>u&&(we(o,1+_-++m,1+T-_),T=_,_=-1,s.push(v),a.push(o.length>0?o[o.length-1].prevSpaces:0),f=Math.max(f,v),p++,n.x=0,n.y+=r.lineHeight,c=null,g=0)}}else s.push(d),a.push(-1),f=Math.max(f,d),++p,++m,n.x=0,n.y+=r.lineHeight,c=null,g=0}var x=h[h.length-1];"\r"!==x&&"\n"!==x&&(/(?:\s)/.test(x)&&(d=v),s.push(d),f=Math.max(f,d),a.push(-1));var A=[];for(T=0;T<=p;T++){var S=0;"right"===this._align?S=f-s[T]:"center"===this._align?S=(f-s[T])/2:"justify"===this._align&&(S=a[T]<0?0:(f-s[T])/a[T]),A.push(S)}var O=o.length,I={},M=[],P=this._activePagesMeshData;for(T=0;T6*U)||Z.vertices.length<2*Qa.BATCHABLE_SIZE)Z.vertices=new Float32Array(8*U),Z.uvs=new Float32Array(8*U),Z.indices=new Uint16Array(6*U);else for(var B=Z.total,G=Z.vertices,X=4*B*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=t.call(this,a,h)||this).horizontal=e,s.resolution=n,s._quality=0,s.quality=i,s.blur=r,s}return gh(e,t),e.prototype.apply=function(t,e,r,i){if(r?this.horizontal?this.uniforms.strength=1/r.width*(r.width/e.width):this.uniforms.strength=1/r.height*(r.height/e.height):this.horizontal?this.uniforms.strength=1/t.renderer.width*(t.renderer.width/e.width):this.uniforms.strength=1/t.renderer.height*(t.renderer.height/e.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,1===this.passes)t.applyFilter(this,e,r,i);else{var n=t.getFilterTexture(),o=t.renderer,s=e,a=n;this.state.blend=!1,t.applyFilter(this,s,a,Ch.CLEAR);for(var h=1;h 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}jh(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}(Rn);Vh.prototype.grayscale=Vh.prototype.greyscale;var Wh,zh,qh,Kh,Zh,Qh,Jh,$h,tu,eu,ru,iu,nu,ou,su,au,hu,uu,lu,cu,du=function(t,e){return du=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])},du(t,e)},fu=function(t){function e(e,r){var i=this,n=new sr;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 Je(r,r),i}return function(t,e){function r(){this.constructor=t}du(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}(Rn),pu=function(t,e){return pu=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])},pu(t,e)},_u=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}pu(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(e,t),e}(Rn),vu=function(t,e){return vu=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])},vu(t,e)},mu=function(t){function e(e,r){void 0===e&&(e=.5),void 0===r&&(r=Math.random());var i=t.call(this,so,"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}vu(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}(Rn);!function(t){t[t.WEBGL_LEGACY=0]="WEBGL_LEGACY",t[t.WEBGL=1]="WEBGL",t[t.WEBGL2=2]="WEBGL2"}(Wh||(Wh={})),function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.WEBGL=1]="WEBGL",t[t.CANVAS=2]="CANVAS"}(zh||(zh={})),function(t){t[t.COLOR=16384]="COLOR",t[t.DEPTH=256]="DEPTH",t[t.STENCIL=1024]="STENCIL"}(qh||(qh={})),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"}(Kh||(Kh={})),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"}(Zh||(Zh={})),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"}(Qh||(Qh={})),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"}(Jh||(Jh={})),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"}($h||($h={})),function(t){t[t.FLOAT=0]="FLOAT",t[t.INT=1]="INT",t[t.UINT=2]="UINT"}(tu||(tu={})),function(t){t[t.NEAREST=0]="NEAREST",t[t.LINEAR=1]="LINEAR"}(eu||(eu={})),function(t){t[t.CLAMP=33071]="CLAMP",t[t.REPEAT=10497]="REPEAT",t[t.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT"}(ru||(ru={})),function(t){t[t.OFF=0]="OFF",t[t.POW2=1]="POW2",t[t.ON=2]="ON",t[t.ON_MANUAL=3]="ON_MANUAL"}(iu||(iu={})),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"}(nu||(nu={})),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"}(ou||(ou={})),function(t){t[t.AUTO=0]="AUTO",t[t.MANUAL=1]="MANUAL"}(su||(su={})),function(t){t.LOW="lowp",t.MEDIUM="mediump",t.HIGH="highp"}(au||(au={})),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"}(hu||(hu={})),function(t){t[t.RED=1]="RED",t[t.GREEN=2]="GREEN",t[t.BLUE=4]="BLUE",t[t.ALPHA=8]="ALPHA"}(uu||(uu={})),function(t){t[t.NONE=0]="NONE",t[t.LOW=2]="LOW",t[t.MEDIUM=4]="MEDIUM",t[t.HIGH=8]="HIGH"}(lu||(lu={})),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"}(cu||(cu={}));var Eu=new sr;Gr.prototype._cacheAsBitmap=!1,Gr.prototype._cacheData=null,Gr.prototype._cacheAsBitmapResolution=null,Gr.prototype._cacheAsBitmapMultisample=lu.NONE;var gu=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(Gr.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 gu),(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))}}}),Gr.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))},Gr.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(ot.RESOLUTION);var o=t.renderTexture.current,s=t.renderTexture.sourceFrame.clone(),a=t.renderTexture.destinationFrame.clone(),h=t.projection.transform,u=bi.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_"+Ue();this._cacheData.textureCacheId=l,ni.addToCache(u.baseTexture,l),yi.addToCache(u,l);var c=this.transform.localTransform.copyTo(Eu).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 ca(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)}},Gr.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))},Gr.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(ot.RESOLUTION);var o=bi.create({width:e.width,height:e.height}),s="cacheAsBitmap_"+Ue();this._cacheData.textureCacheId=s,ni.addToCache(o.baseTexture,s),yi.addToCache(o,s);var a=Eu;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 ca(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)}},Gr.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},Gr.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},Gr.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,ni.removeFromCache(this._cacheData.textureCacheId),yi.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},Gr.prototype._cacheAsBitmapDestroy=function(t){this.cacheAsBitmap=!1,this.destroy(t)},Gr.prototype.name=null,Hr.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}($a),Su=function(e){function r(r,i,n){void 0===n&&(n=0);var o=this,s=new Au(r.height,i,n),a=new Ja(r);return n>0&&(r.baseTexture.wrapMode=t.WRAP_MODES.REPEAT),(o=e.call(this,s,a)||this).autoUpdate=!0,o}return Ru(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}(Qa),Ou=function(t){function e(e,r,i){var n=this,o=new xu(e.width,e.height,r,i),s=new Ja(yi.WHITE);return(n=t.call(this,o,s)||this).texture=e,n.autoResize=!0,n}return Ru(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}(Qa),Iu=function(t){function e(e,r,i,n,o){void 0===e&&(e=yi.EMPTY);var s=this,a=new $a(r,i,n);a.getBuffer("aVertexPosition").static=!1;var h=new Ja(e);return(s=t.call(this,a,h,null,o)||this).autoUpdate=!0,s}return Ru(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}(Qa),Mu=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,yi.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 Ru(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}(Ou),Pu=function(t,e){return Pu=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])},Pu(t,e)},Du=function(e){function r(t,r){void 0===r&&(r=!0);var i=e.call(this,t[0]instanceof yi?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}Pu(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&&(qr.shared.remove(this.update,this),this._isConnectedToTicker=!1))},r.prototype.play=function(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(qr.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;i0){var n=e.context;n.beginPath();for(var o=0;o0){for(l=0,d=h[0],f=h[1],p=2;p+2=0;p-=2)r.lineTo(h[p],h[p+1]);u[_].shape.closeStroke&&r.closePath()}}h[0]===h[h.length-2]&&h[1]===h[h.length-1]&&r.closePath()}else if(a.type===t.SHAPES.RECT)r.rect(a.x,a.y,a.width,a.height),r.closePath();else if(a.type===t.SHAPES.CIRC)r.arc(a.x,a.y,a.radius,0,2*Math.PI),r.closePath();else if(a.type===t.SHAPES.ELIP){var v=2*a.width,m=2*a.height,E=a.x-v/2,g=a.y-m/2,T=.5522848,y=v/2*T,b=m/2*T,R=E+v,x=g+m,A=E+v/2,S=g+m/2;r.moveTo(E,S),r.bezierCurveTo(E,S-b,A-y,g,A,g),r.bezierCurveTo(A+y,g,R,S-b,R,S),r.bezierCurveTo(R,S+b,A+y,x,A,x),r.bezierCurveTo(A-y,x,E,S+b,E,S),r.closePath()}else if(a.type===t.SHAPES.RREC){var O=a.x,I=a.y,M=a.width,P=a.height,D=a.radius,N=Math.min(M,P)/2;D=D>N?N:D,r.moveTo(O,I+D),r.lineTo(O,I+P-D),r.quadraticCurveTo(O,I+P,O+D,I+P),r.lineTo(O+M-D,I+P),r.quadraticCurveTo(O+M,I+P,O+M,I+P-D),r.lineTo(O+M,I+D),r.quadraticCurveTo(O+M,I,O+M-D,I),r.lineTo(O+D,I),r.quadraticCurveTo(O,I,O,I+D),r.closePath()}}},e.prototype.popMask=function(t){t.context.restore(),t.invalidateBlendMode()},e.prototype.destroy=function(){},e}();function Lu(t){var e=ot.ADAPTER.createCanvas(6,1),r=e.getContext("2d");return r.fillStyle=t,r.fillRect(0,0,6,1),e}function Fu(){if("undefined"==typeof document)return!1;var t=Lu("#ff00ff"),e=Lu("#ffff00"),r=ot.ADAPTER.createCanvas(6,1).getContext("2d");r.globalCompositeOperation="multiply",r.drawImage(t,0,0),r.drawImage(e,2,0);var i=r.getImageData(2,0,1,1);if(!i)return!1;var n=i.data;return 255===n[0]&&0===n[1]&&0===n[2]}var Uu=new sr,Bu=function(e){function r(i){var n,o=e.call(this,t.RENDERER_TYPE.CANVAS,i)||this;if(o.refresh=!0,o.maskManager=new wu(o),o.smoothProperty="imageSmoothingEnabled",o.blendModes=(void 0===n&&(n=[]),Fu()?(n[t.BLEND_MODES.NORMAL]="source-over",n[t.BLEND_MODES.ADD]="lighter",n[t.BLEND_MODES.MULTIPLY]="multiply",n[t.BLEND_MODES.SCREEN]="screen",n[t.BLEND_MODES.OVERLAY]="overlay",n[t.BLEND_MODES.DARKEN]="darken",n[t.BLEND_MODES.LIGHTEN]="lighten",n[t.BLEND_MODES.COLOR_DODGE]="color-dodge",n[t.BLEND_MODES.COLOR_BURN]="color-burn",n[t.BLEND_MODES.HARD_LIGHT]="hard-light",n[t.BLEND_MODES.SOFT_LIGHT]="soft-light",n[t.BLEND_MODES.DIFFERENCE]="difference",n[t.BLEND_MODES.EXCLUSION]="exclusion",n[t.BLEND_MODES.HUE]="hue",n[t.BLEND_MODES.SATURATION]="saturation",n[t.BLEND_MODES.COLOR]="color",n[t.BLEND_MODES.LUMINOSITY]="luminosity"):(n[t.BLEND_MODES.NORMAL]="source-over",n[t.BLEND_MODES.ADD]="lighter",n[t.BLEND_MODES.MULTIPLY]="source-over",n[t.BLEND_MODES.SCREEN]="source-over",n[t.BLEND_MODES.OVERLAY]="source-over",n[t.BLEND_MODES.DARKEN]="source-over",n[t.BLEND_MODES.LIGHTEN]="source-over",n[t.BLEND_MODES.COLOR_DODGE]="source-over",n[t.BLEND_MODES.COLOR_BURN]="source-over",n[t.BLEND_MODES.HARD_LIGHT]="source-over",n[t.BLEND_MODES.SOFT_LIGHT]="source-over",n[t.BLEND_MODES.DIFFERENCE]="source-over",n[t.BLEND_MODES.EXCLUSION]="source-over",n[t.BLEND_MODES.HUE]="source-over",n[t.BLEND_MODES.SATURATION]="source-over",n[t.BLEND_MODES.COLOR]="source-over",n[t.BLEND_MODES.LUMINOSITY]="source-over"),n[t.BLEND_MODES.NORMAL_NPM]=n[t.BLEND_MODES.NORMAL],n[t.BLEND_MODES.ADD_NPM]=n[t.BLEND_MODES.ADD],n[t.BLEND_MODES.SCREEN_NPM]=n[t.BLEND_MODES.SCREEN],n[t.BLEND_MODES.SRC_IN]="source-in",n[t.BLEND_MODES.SRC_OUT]="source-out",n[t.BLEND_MODES.SRC_ATOP]="source-atop",n[t.BLEND_MODES.DST_OVER]="destination-over",n[t.BLEND_MODES.DST_IN]="destination-in",n[t.BLEND_MODES.DST_OUT]="destination-out",n[t.BLEND_MODES.DST_ATOP]="destination-atop",n[t.BLEND_MODES.XOR]="xor",n[t.BLEND_MODES.SUBTRACT]="source-over",n),o.renderingToScreen=!1,o._activeBlendMode=null,o._projTransform=null,o._outerBlend=!1,o.rootContext=o.view.getContext("2d",{alpha:o.useContextAlpha}),o.context=o.rootContext,!o.rootContext.imageSmoothingEnabled){var s=o.rootContext;s.webkitImageSmoothingEnabled?o.smoothProperty="webkitImageSmoothingEnabled":s.mozImageSmoothingEnabled?o.smoothProperty="mozImageSmoothingEnabled":s.oImageSmoothingEnabled?o.smoothProperty="oImageSmoothingEnabled":s.msImageSmoothingEnabled&&(o.smoothProperty="msImageSmoothingEnabled")}return o.initPlugins(r.__plugins),ve("Canvas"),o.resize(o.options.width,o.options.height),o}return function(t,e){function r(){this.constructor=t}Cu(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.addSystem=function(){return this},r.prototype.render=function(e,r){if(this.view){var i,n,o,s;r&&(r instanceof bi||r instanceof mi?(i=r,n=arguments[2],o=arguments[3],s=arguments[4]):(i=r.renderTexture,n=r.clear,o=r.transform,s=r.skipUpdateTransform)),this.renderingToScreen=!i,this.emit("prerender");var a=this.resolution;i?((i=i.castToBaseTexture())._canvasRenderTarget||(i._canvasRenderTarget=new He(i.width,i.height,i.resolution),i.resource=new hi(i._canvasRenderTarget.canvas),i.valid=!0),this.context=i._canvasRenderTarget.context,this.resolution=i._canvasRenderTarget.resolution):this.context=this.rootContext;var h=this.context;if(this._projTransform=o||null,i||(this._lastObjectRendered=e),!s){var u=e.enableTempParent();e.updateTransform(),e.disableTempParent(u)}if(h.save(),h.setTransform(1,0,0,1,0,0),h.globalAlpha=1,this._activeBlendMode=t.BLEND_MODES.NORMAL,this._outerBlend=!1,h.globalCompositeOperation=this.blendModes[t.BLEND_MODES.NORMAL],void 0!==n?n:this.clearBeforeRender)if(this.renderingToScreen)h.clearRect(0,0,this.width,this.height),this.backgroundAlpha>0&&(h.globalAlpha=this.useContextAlpha?this.backgroundAlpha:1,h.fillStyle=this._backgroundColorString,h.fillRect(0,0,this.width,this.height),h.globalAlpha=1);else{(i=i)._canvasRenderTarget.clear();var l=i.clearColor;l[3]>0&&(h.globalAlpha=this.useContextAlpha?l[3]:1,h.fillStyle=Te(be(l)),h.fillRect(0,0,i.realWidth,i.realHeight),h.globalAlpha=1)}var c=this.context;this.context=h,e.renderCanvas(this),this.context=c,h.restore(),this.resolution=a,this._projTransform=null,this.emit("postrender")}},r.prototype.setContextTransform=function(t,e,r){var i=t,n=this._projTransform,o=this.resolution;r=r||o,n&&((i=Uu).copyFrom(t),i.prepend(n)),e?this.context.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*o|0,i.ty*o|0):this.context.setTransform(i.a*r,i.b*r,i.c*r,i.d*r,i.tx*o,i.ty*o)},r.prototype.clear=function(t,e){void 0===t&&(t=this._backgroundColorString),void 0===e&&(e=this.backgroundAlpha);var r=this.context;r.clearRect(0,0,this.width,this.height),t&&(r.globalAlpha=this.useContextAlpha?e:1,r.fillStyle=t,r.fillRect(0,0,this.width,this.height),r.globalAlpha=1)},r.prototype.setBlendMode=function(e,r){var i=e===t.BLEND_MODES.SRC_IN||e===t.BLEND_MODES.SRC_OUT||e===t.BLEND_MODES.DST_IN||e===t.BLEND_MODES.DST_ATOP;!r&&i&&(e=t.BLEND_MODES.NORMAL),this._activeBlendMode!==e&&(this._activeBlendMode=e,this._outerBlend=i,this.context.globalCompositeOperation=this.blendModes[e])},r.prototype.destroy=function(t){e.prototype.destroy.call(this,t),this.context=null,this.refresh=!0,this.maskManager.destroy(),this.maskManager=null,this.smoothProperty=null},r.prototype.resize=function(r,i){e.prototype.resize.call(this,r,i),this.smoothProperty&&(this.rootContext[this.smoothProperty]=ot.SCALE_MODE===t.SCALE_MODES.LINEAR)},r.prototype.invalidateBlendMode=function(){this._activeBlendMode=this.blendModes.indexOf(this.context.globalCompositeOperation)},r.registerPlugin=function(e,r){Vr.add({name:e,type:t.ExtensionType.CanvasRendererPlugin,ref:r})},r.__plugins={},r}(to);Vr.handleByMap(t.ExtensionType.CanvasRendererPlugin,Bu.__plugins);var Gu={canvas:null,getTintedCanvas:function(t,e){var r=t.texture,i="#"+("00000"+(0|(e=Gu.roundColor(e))).toString(16)).slice(-6);r.tintCache=r.tintCache||{};var n,o=r.tintCache[i];if(o){if(o.tintId===r._updateID)return r.tintCache[i];n=r.tintCache[i]}else n=ot.ADAPTER.createCanvas();if(Gu.tintMethod(r,e,n),n.tintId=r._updateID,Gu.convertTintToImage){var s=new Image;s.src=n.toDataURL(),r.tintCache[i]=s}else r.tintCache[i]=n;return n},getTintedPattern:function(t,e){var r="#"+("00000"+(0|(e=Gu.roundColor(e))).toString(16)).slice(-6);t.patternCache=t.patternCache||{};var i=t.patternCache[r];return i&&i.tintId===t._updateID||(Gu.canvas||(Gu.canvas=ot.ADAPTER.createCanvas()),Gu.tintMethod(t,e,Gu.canvas),(i=Gu.canvas.getContext("2d").createPattern(Gu.canvas,"repeat")).tintId=t._updateID,t.patternCache[r]=i),i},tintWithMultiply:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.fillStyle="#"+("00000"+(0|e).toString(16)).slice(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="multiply";var s=t.baseTexture.getDrawableSource();i.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(s,n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithOverlay:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.fillStyle="#"+("00000"+(0|e).toString(16)).slice(-6),i.fillRect(0,0,n.width,n.height),i.globalCompositeOperation="destination-atop",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore()},tintWithPerPixel:function(t,e,r){var i=r.getContext("2d"),n=t._frame.clone(),o=t.baseTexture.resolution;n.x*=o,n.y*=o,n.width*=o,n.height*=o,r.width=Math.ceil(n.width),r.height=Math.ceil(n.height),i.save(),i.globalCompositeOperation="copy",i.drawImage(t.baseTexture.getDrawableSource(),n.x,n.y,n.width,n.height,0,0,n.width,n.height),i.restore();for(var s=ge(e),a=s[0],h=s[1],u=s[2],l=i.getImageData(0,0,n.width,n.height),c=l.data,d=0;d0){var S=t.worldTransform,O=S.a,I=S.b,M=S.c,P=S.d,D=(g+T+y)/3,N=(b+R+x)/3,C=g-D,w=b-N,L=O*C+M*w,F=I*C+P*w,U=Math.sqrt(L*L+F*F),B=1+A/U;g=D+C*B,b=N+w*B,L=O*(C=T-D)+M*(w=R-N),F=I*C+P*w,T=D+C*(B=1+A/(U=Math.sqrt(L*L+F*F))),R=N+w*B,L=O*(C=y-D)+M*(w=x-N),F=I*C+P*w,y=D+C*(B=1+A/(U=Math.sqrt(L*L+F*F))),x=N+w*B}n.save(),n.beginPath(),n.moveTo(g,b),n.lineTo(T,R),n.lineTo(y,x),n.closePath(),n.clip();var G=f*m+v*_+p*E-m*_-v*p-f*E,X=g*m+v*y+T*E-m*y-v*T-g*E,k=f*T+g*_+p*y-T*_-g*p-f*y,H=f*m*y+v*T*_+g*p*E-g*m*_-v*p*y-f*T*E,Y=b*m+v*x+R*E-m*x-v*R-b*E,j=f*R+b*_+p*x-R*_-b*p-f*x,V=f*m*x+v*R*_+b*p*E-b*m*_-v*p*x-f*R*E;n.transform(X/G,Y/G,k/G,j/G,H/G,V/G),n.drawImage(d,0,0,l*u.resolution,c*u.resolution,0,0,l,c),n.restore(),this.renderer.invalidateBlendMode()}},e.prototype.renderMeshFlat=function(t){var e=this.renderer.context,r=t.geometry.getBuffer("aVertexPosition").data,i=r.length/2;e.beginPath();for(var n=1;n0},t}(),Vu=function(){function e(t){this._svgMatrix=null,this._tempMatrix=new sr,this.renderer=t}return e.prototype._calcCanvasStyle=function(t,e){var r;return t.texture&&t.texture.baseTexture!==yi.WHITE.baseTexture?t.texture.valid?(r=Gu.getTintedPattern(t.texture,e),this.setPatternTransform(r,t.matrix||sr.IDENTITY)):r="#808080":r="#"+("00000"+(0|e).toString(16)).slice(-6),r},e.prototype.render=function(e){var r=this.renderer,i=r.context,n=e.worldAlpha,o=e.transform.worldTransform;r.setContextTransform(o),r.setBlendMode(e.blendMode);for(var s,a,h=e.geometry.graphicsData,u=(e.tint>>16&255)/255,l=(e.tint>>8&255)/255,c=(255&e.tint)/255,d=0;d>16&255)/255*u*255<<16)+((m>>8&255)/255*l*255<<8)+(255&m)/255*c*255;s=this._calcCanvasStyle(_,g)}if(v.visible){var T=((E>>16&255)/255*u*255<<16)+((E>>8&255)/255*l*255<<8)+(255&E)/255*c*255;a=this._calcCanvasStyle(v,T)}if(i.lineWidth=v.width,i.lineCap=v.cap,i.lineJoin=v.join,i.miterLimit=v.miterLimit,f.type===t.SHAPES.POLY){i.beginPath();var y=(P=p).points,b=f.holes,R=void 0,x=void 0,A=void 0,S=void 0,O=void 0;i.moveTo(y[0],y[1]);for(var I=2;I0){for(O=[],R=0,A=y[0],S=y[1],I=2;I+2=0;I-=2)i.lineTo(y[I],y[I+1]);b[M].shape.closeStroke&&i.closePath(),O[M]=x*R<0}}_.visible&&(i.globalAlpha=_.alpha*n,i.fillStyle=s,i.fill()),v.visible&&this.paintPolygonStroke(P,v,a,b,O,n,i)}else if(f.type===t.SHAPES.RECT){var P=p;if(_.visible&&(i.globalAlpha=_.alpha*n,i.fillStyle=s,i.fillRect(P.x,P.y,P.width,P.height)),v.visible){var D=v.width*(.5-(1-v.alignment)),N=P.width+2*D,C=P.height+2*D;i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.strokeRect(P.x-D,P.y-D,N,C)}}else if(f.type===t.SHAPES.CIRC)P=p,i.beginPath(),i.arc(P.x,P.y,P.radius,0,2*Math.PI),i.closePath(),_.visible&&(i.globalAlpha=_.alpha*n,i.fillStyle=s,i.fill()),v.visible&&(.5!==v.alignment&&(D=v.width*(.5-(1-v.alignment)),i.beginPath(),i.arc(P.x,P.y,P.radius+D,0,2*Math.PI),i.closePath()),i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke());else if(f.type===t.SHAPES.ELIP){if(P=p,(V=1===v.alignment)||this.paintEllipse(P,_,v,s,n,i),v.visible){if(.5!==v.alignment){var w=.5522848,L=(D=v.width*(.5-(1-v.alignment)),2*(P.width+D)),F=2*(P.height+D),U=P.x-L/2,B=P.y-F/2,G=L/2*w,X=F/2*w,k=U+L,H=B+F,Y=U+L/2,j=B+F/2;i.beginPath(),i.moveTo(U,j),i.bezierCurveTo(U,j-X,Y-G,B,Y,B),i.bezierCurveTo(Y+G,B,k,j-X,k,j),i.bezierCurveTo(k,j+X,Y+G,H,Y,H),i.bezierCurveTo(Y-G,H,U,j+X,U,j),i.closePath()}i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke()}V&&this.paintEllipse(P,_,v,s,n,i)}else if(f.type===t.SHAPES.RREC){var V;if(P=p,(V=1===v.alignment)||this.paintRoundedRectangle(P,_,v,s,n,i),v.visible){if(.5!==v.alignment){N=P.width,C=P.height,D=v.width*(.5-(1-v.alignment));var W=P.x-D,z=P.y-D,q=P.width+2*D,K=P.height+2*D,Z=D*(v.alignment>=1?Math.min(q/N,K/C):Math.min(N/q,C/K)),Q=P.radius+Z,J=Math.min(q,K)/2;Q=Q>J?J:Q,i.beginPath(),i.moveTo(W,z+Q),i.lineTo(W,z+K-Q),i.quadraticCurveTo(W,z+K,W+Q,z+K),i.lineTo(W+q-Q,z+K),i.quadraticCurveTo(W+q,z+K,W+q,z+K-Q),i.lineTo(W+q,z+Q),i.quadraticCurveTo(W+q,z,W+q-Q,z),i.lineTo(W+Q,z),i.quadraticCurveTo(W,z,W,z+Q),i.closePath()}i.globalAlpha=v.alpha*n,i.strokeStyle=a,i.stroke()}V&&this.paintRoundedRectangle(P,_,v,s,n,i)}}},e.prototype.paintPolygonStroke=function(t,e,r,i,n,o,s){if(.5!==e.alignment){var a=e.width*(.5-(1-e.alignment)),h=ju.offsetPolygon(t.points,a),u=void 0;s.beginPath(),s.moveTo(h[0],h[1]);for(var l=2;l=0;l-=2)s.lineTo(h[l],h[l+1]);i[c].shape.closeStroke&&s.closePath()}}s.globalAlpha=e.alpha*o,s.strokeStyle=r,s.stroke()},e.prototype.paintEllipse=function(t,e,r,i,n,o){var s=2*t.width,a=2*t.height,h=t.x-s/2,u=t.y-a/2,l=.5522848,c=s/2*l,d=a/2*l,f=h+s,p=u+a,_=h+s/2,v=u+a/2;0===r.alignment&&o.save(),o.beginPath(),o.moveTo(h,v),o.bezierCurveTo(h,v-d,_-c,u,_,u),o.bezierCurveTo(_+c,u,f,v-d,f,v),o.bezierCurveTo(f,v+d,_+c,p,_,p),o.bezierCurveTo(_-c,p,h,v+d,h,v),o.closePath(),0===r.alignment&&o.clip(),e.visible&&(o.globalAlpha=e.alpha*n,o.fillStyle=i,o.fill()),0===r.alignment&&o.restore()},e.prototype.paintRoundedRectangle=function(t,e,r,i,n,o){var s=t.x,a=t.y,h=t.width,u=t.height,l=t.radius,c=Math.min(h,u)/2;l=l>c?c:l,0===r.alignment&&o.save(),o.beginPath(),o.moveTo(s,a+l),o.lineTo(s,a+u-l),o.quadraticCurveTo(s,a+u,s+l,a+u),o.lineTo(s+h-l,a+u),o.quadraticCurveTo(s+h,a+u,s+h,a+u-l),o.lineTo(s+h,a+l),o.quadraticCurveTo(s+h,a,s+h-l,a),o.lineTo(s+l,a),o.quadraticCurveTo(s,a,s,a+l),o.closePath(),0===r.alignment&&o.clip(),e.visible&&(o.globalAlpha=e.alpha*n,o.fillStyle=i,o.fill()),0===r.alignment&&o.restore()},e.prototype.setPatternTransform=function(t,e){if(!1!==this._svgMatrix){if(!this._svgMatrix){var r=document.createElementNS("http://www.w3.org/2000/svg","svg");if(r&&r.createSVGMatrix&&(this._svgMatrix=r.createSVGMatrix()),!this._svgMatrix||!t.setTransform)return void(this._svgMatrix=!1)}this._svgMatrix.a=e.a,this._svgMatrix.b=e.b,this._svgMatrix.c=e.c,this._svgMatrix.d=e.d,this._svgMatrix.e=e.tx,this._svgMatrix.f=e.ty,t.setTransform(this._svgMatrix.inverse())}},e.prototype.destroy=function(){this.renderer=null,this._svgMatrix=null,this._tempMatrix=null},e.extension={name:"graphics",type:t.ExtensionType.CanvasRendererPlugin},e}(),Wu=new sr;sa.prototype.generateCanvasTexture=function(t,e){void 0===e&&(e=1);var r=this.getLocalBounds(),i=bi.create({width:r.width,height:r.height,scaleMode:t,resolution:e});Yu||(Yu=new Bu),this.transform.updateLocalTransform(),this.transform.localTransform.copyTo(Wu),Wu.invert(),Wu.tx-=r.x,Wu.ty-=r.y,Yu.render(this,{renderTexture:i,clear:!0,transform:Wu});var n=yi.from(i.baseTexture._canvasRenderTarget.canvas,{scaleMode:t});return n.baseTexture.setResolution(e),n},sa.prototype.cachedGraphicsData=[],sa.prototype._renderCanvas=function(t){!0!==this.isMask&&(this.finishPoly(),t.plugins.graphics.render(this))};var zu=new sr,qu=function(){function e(t){this.renderer=t}return e.prototype.render=function(e){var r=e._texture,i=this.renderer,n=i.context;if(r.valid){var o=r._frame.width,s=r._frame.height,a=r._frame.width,h=r._frame.height;r.trim&&(a=r.trim.width,h=r.trim.height);var u=e.transform.worldTransform,l=0,c=0,d=r.baseTexture.getDrawableSource();if(!(r.orig.width<=0||r.orig.height<=0)&&r.valid&&d){i.setBlendMode(e.blendMode,!0),i.context.globalAlpha=e.worldAlpha;var f=r.baseTexture.scaleMode===t.SCALE_MODES.LINEAR;i.smoothProperty&&i.context[i.smoothProperty]!==f&&(n[i.smoothProperty]=f),r.trim?(l=r.trim.width/2+r.trim.x-e.anchor.x*r.orig.width,c=r.trim.height/2+r.trim.y-e.anchor.y*r.orig.height):(l=(.5-e.anchor.x)*r.orig.width,c=(.5-e.anchor.y)*r.orig.height),r.rotate&&(u.copyTo(zu),u=zu,pr.matrixAppendRotationInv(u,r.rotate,l,c),l=0,c=0),l-=a/2,c-=h/2,i.setContextTransform(u,e.roundPixels,1),e.roundPixels&&(l|=0,c|=0);var p=r.baseTexture.resolution,_=i._outerBlend;_&&(n.save(),n.beginPath(),n.rect(l*i.resolution,c*i.resolution,a*i.resolution,h*i.resolution),n.clip()),16777215!==e.tint?(e._cachedTint===e.tint&&e._tintedCanvas.tintId===e._texture._updateID||(e._cachedTint=e.tint,e._tintedCanvas=Gu.getTintedCanvas(e,e.tint)),n.drawImage(e._tintedCanvas,0,0,Math.floor(o*p),Math.floor(s*p),Math.floor(l*i.resolution),Math.floor(c*i.resolution),Math.floor(a*i.resolution),Math.floor(h*i.resolution))):n.drawImage(d,r._frame.x*p,r._frame.y*p,Math.floor(o*p),Math.floor(s*p),Math.floor(l*i.resolution),Math.floor(c*i.resolution),Math.floor(a*i.resolution),Math.floor(h*i.resolution)),_&&n.restore(),i.setBlendMode(t.BLEND_MODES.NORMAL)}}},e.prototype.destroy=function(){this.renderer=null},e.extension={name:"sprite",type:t.ExtensionType.CanvasRendererPlugin},e}();ca.prototype._tintedCanvas=null,ca.prototype._renderCanvas=function(t){t.plugins.sprite.render(this)};var Ku=new tr,Zu=function(){function e(t){this.renderer=t}return e.prototype.image=function(t,e,r){var i=new Image;return i.src=this.base64(t,e,r),i},e.prototype.base64=function(t,e,r){return this.canvas(t).toDataURL(e,r)},e.prototype.canvas=function(t,e){var r,i,n,o=this.renderer;t&&(n=t instanceof bi?t:o.generateTexture(t)),n?(r=n.baseTexture._canvasRenderTarget.context,i=n.baseTexture._canvasRenderTarget.resolution,e=null!=e?e:n.frame):(r=o.rootContext,i=o.resolution,e||((e=Ku).width=o.width,e.height=o.height));var s=Math.round(e.x*i),a=Math.round(e.y*i),h=Math.round(e.width*i),u=Math.round(e.height*i),l=new He(h,u,1),c=r.getImageData(s,a,h,u);return l.context.putImageData(c,0,0),l.canvas},e.prototype.pixels=function(t,e){var r,i,n,o=this.renderer;t&&(n=t instanceof bi?t:o.generateTexture(t)),n?(r=n.baseTexture._canvasRenderTarget.context,i=n.baseTexture._canvasRenderTarget.resolution,e=null!=e?e:n.frame):(r=o.rootContext,i=o.resolution,e||((e=Ku).width=o.width,e.height=o.height));var s=Math.round(e.x*i),a=Math.round(e.y*i),h=Math.round(e.width*i),u=Math.round(e.height*i);return r.getImageData(s,a,h,u).data},e.prototype.destroy=function(){this.renderer=null},e.extension={name:"extract",type:t.ExtensionType.CanvasRendererPlugin},e}(),Qu=function(t,e){return Qu=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])},Qu(t,e)};function Ju(t,e){var r=t;if(e instanceof ni){var i=e.source,n=0===i.width?r.canvas.width:Math.min(r.canvas.width,i.width),o=0===i.height?r.canvas.height:Math.min(r.canvas.height,i.height);return r.ctx.drawImage(i,0,0,n,o,0,0,r.canvas.width,r.canvas.height),!0}return!1}var $u=function(e){function r(t){var r=e.call(this,t)||this;return r.uploadHookHelper=r,r.canvas=ot.ADAPTER.createCanvas(16,16),r.ctx=r.canvas.getContext("2d"),r.registerUploadHook(Ju),r}return function(t,e){function r(){this.constructor=t}Qu(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}(r,e),r.prototype.destroy=function(){e.prototype.destroy.call(this),this.ctx=null,this.canvas=null},r.extension={name:"prepare",type:t.ExtensionType.CanvasRendererPlugin},r}(Da),tl=new sr,el=new sr,rl=[new Je,new Je,new Je,new Je];return Ha.prototype._renderCanvas=function(t){var e=this._texture;if(e.baseTexture.valid){var r=t.context,i=this.worldTransform,n=e.baseTexture,o=n.getDrawableSource(),s=n.resolution;if(this._textureID!==this._texture._updateID||this._cachedTint!==this.tint){this._textureID=this._texture._updateID;var a=new He(e._frame.width,e._frame.height,s);16777215!==this.tint?(this._tintedCanvas=Gu.getTintedCanvas(this,this.tint),a.context.drawImage(this._tintedCanvas,0,0)):a.context.drawImage(o,-e._frame.x*s,-e._frame.y*s),this._cachedTint=this.tint,this._canvasPattern=a.context.createPattern(a.canvas,"repeat")}r.globalAlpha=this.worldAlpha,t.setBlendMode(this.blendMode),this.tileTransform.updateLocalTransform();var h=this.tileTransform.localTransform,u=this._width,l=this._height;tl.identity(),el.copyFrom(h),this.uvRespectAnchor||el.translate(-this.anchor.x*u,-this.anchor.y*l),el.scale(this.tileScale.x/s,this.tileScale.y/s),tl.prepend(el),tl.prepend(i),t.setContextTransform(tl),r.fillStyle=this._canvasPattern;var c=this.anchor.x*-u,d=this.anchor.y*-l;rl[0].set(c,d),rl[1].set(c+u,d),rl[2].set(c+u,d+l),rl[3].set(c,d+l);for(var f=0;f<4;f++)el.applyInverse(rl[f],rl[f]);for(r.beginPath(),r.moveTo(rl[0].x,rl[0].y),f=1;f<4;f++)r.lineTo(rl[f].x,rl[f].y);r.closePath(),r.fill()}},Ms.prototype.renderCanvas=function(t){if(this.visible&&!(this.worldAlpha<=0)&&this.children.length&&this.renderable){var e=t.context,r=this.worldTransform,i=!0,n=0,o=0,s=0,a=0;t.setBlendMode(this.blendMode),e.globalAlpha=this.worldAlpha,this.displayObjectUpdateTransform();for(var h=0;ht in r?uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ru=(r,t)=>{for(var e in t||(t={}))dv.call(t,e)&&wu(r,e,t[e]);if(Pu)for(var e of Pu(t))pv.call(t,e)&&wu(r,e,t[e]);return r},fv=(r,t)=>cv(r,hv(t)),x=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(x||{});const rn=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=fv(Ru({},t),{ref:r})}if(typeof r=="object")r=Ru({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},or=(r,t)=>{var e;return(e=rn(r).priority)!=null?e:t},U={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(rn).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(rn).forEach(t=>{t.type.forEach(e=>{var i,s;const n=this._addHandlers,o=this._queue;n[e]?(s=n[e])==null||s.call(n,t):(o[e]=o[e]||[],(i=o[e])==null||i.push(t))})}),this},handle(r,t,e){var i;const s=this._addHandlers,n=this._removeHandlers;s[r]=t,n[r]=e;const o=this._queue;return o[r]&&((i=o[r])==null||i.forEach(a=>t(a)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(s=>s.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((s,n)=>or(n.value,e)-or(s.value,e)))},i=>{const s=t.findIndex(n=>n.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>or(n,e)-or(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};var Dw=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function sn(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function Uw(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kw(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function $w(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var nn={exports:{}},Lw=nn.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(l,u,c){this.fn=l,this.context=u,this.once=c||!1}function n(l,u,c,h,p){if(typeof c!="function")throw new TypeError("The listener must be a function");var f=new s(c,h||l,p),m=e?e+u:u;return l._events[m]?l._events[m].fn?l._events[m]=[l._events[m],f]:l._events[m].push(f):(l._events[m]=f,l._eventsCount++),l}function o(l,u){--l._eventsCount===0?l._events=new i:delete l._events[u]}function a(){this._events=new i,this._eventsCount=0}a.prototype.eventNames=function(){var u=[],c,h;if(this._eventsCount===0)return u;for(h in c=this._events)t.call(c,h)&&u.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?u.concat(Object.getOwnPropertySymbols(c)):u},a.prototype.listeners=function(u){var c=e?e+u:u,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var p=0,f=h.length,m=new Array(f);p0:typeof r=="number"},ot=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},wt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},Mu=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Cu=function(r){return{r:wt(r.r,0,255),g:wt(r.g,0,255),b:wt(r.b,0,255),a:wt(r.a)}},on=function(r){return{r:ot(r.r),g:ot(r.g),b:ot(r.b),a:ot(r.a,3)}},_v=/^#([0-9a-f]{3,8})$/i,oi=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Ou=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),o=n-Math.min(t,e,i),a=o?n===t?(e-i)/o:n===e?2+(i-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:s}},Gu=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),o=i*(1-e),a=i*(1-(t-n)*e),l=i*(1-(1-t+n)*e),u=n%6;return{r:255*[i,a,o,o,l,i][u],g:255*[l,i,i,a,o,o][u],b:255*[o,o,l,i,i,a][u],a:s}},Bu=function(r){return{h:Mu(r.h),s:wt(r.s,0,100),l:wt(r.l,0,100),a:wt(r.a)}},Iu=function(r){return{h:ot(r.h),s:ot(r.s),l:ot(r.l),a:ot(r.a,3)}},Fu=function(r){return Gu((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},ar=function(r){return{h:(t=Ou(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},bv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,yv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,vv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,xv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,an={string:[[function(r){var t=_v.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?ot(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?ot(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=vv.exec(r)||xv.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Cu({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=bv.exec(r)||yv.exec(r);if(!t)return null;var e,i,s=Bu({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(gv[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Fu(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return zt(t)&&zt(e)&&zt(i)?Cu({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!zt(t)||!zt(e)||!zt(i))return null;var o=Bu({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Fu(o)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!zt(t)||!zt(e)||!zt(i))return null;var o=function(a){return{h:Mu(a.h),s:wt(a.s,0,100),v:wt(a.v,0,100),a:wt(a.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return Gu(o)},"hsv"]]},Du=function(r,t){for(var e=0;e=.5},r.prototype.toHex=function(){return t=on(this.rgba),e=t.r,i=t.g,s=t.b,o=(n=t.a)<1?oi(ot(255*n)):"","#"+oi(e)+oi(i)+oi(s)+o;var t,e,i,s,n,o},r.prototype.toRgb=function(){return on(this.rgba)},r.prototype.toRgbString=function(){return t=on(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return Iu(ar(this.rgba))},r.prototype.toHslString=function(){return t=Iu(ar(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Ou(this.rgba),{h:ot(t.h),s:ot(t.s),v:ot(t.v),a:ot(t.a,3)};var t},r.prototype.invert=function(){return kt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),kt(ln(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),kt(ln(this.rgba,-t))},r.prototype.grayscale=function(){return kt(ln(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),kt(ku(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),kt(ku(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?kt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ot(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=ar(this.rgba);return typeof t=="number"?kt({h:t,s:e.s,l:e.l,a:e.a}):ot(e.h)},r.prototype.isEqual=function(t){return this.toHex()===kt(t).toHex()},r}(),kt=function(r){return r instanceof ai?r:new ai(r)},$u=[],Tv=function(r){r.forEach(function(t){$u.indexOf(t)<0&&(t(ai,an),$u.push(t))})},Hw=function(){return new ai({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function Sv(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,l,u=i[this.toHex()];if(u)return u;if(o!=null&&o.closest){var c=this.toRgb(),h=1/0,p="black";if(!n.length)for(var f in e)n[f]=new r(e[f]).toRgb();for(var m in e){var _=(a=c,l=n[m],Math.pow(a.r-l.r,2)+Math.pow(a.g-l.g,2)+Math.pow(a.b-l.b,2));_t in r?Ev(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wv=(r,t)=>{for(var e in t||(t={}))Av.call(t,e)&&Nu(r,e,t[e]);if(Lu)for(var e of Lu(t))Pv.call(t,e)&&Nu(r,e,t[e]);return r};Tv([Sv]);const Ce=class si{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof si)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?wv({},t):t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=si._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,i=(o>>8&255)/255,s=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=si.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=kt(t);o.isValid()&&({r:e,g:i,b:s,a:n}=o.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof si||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Ce.shared=new Ce,Ce._temp=new Ce,Ce.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let V=Ce;const Hu={cullArea:null,cullable:!1,cullableChildren:!0},Xu=Math.PI*2,ju=180/Math.PI,zu=Math.PI/180;class Y{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new Y(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}static get shared(){return cn.x=0,cn.y=0,cn}}const cn=new Y;class G{constructor(t=1,e=0,i=0,s=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o}fromArray(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]}set(t,e,i,s,n,o){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new Y;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new Y;const i=this.a,s=this.b,n=this.c,o=this.d,a=this.tx,l=this.ty,u=1/(i*o+n*-s),c=t.x,h=t.y;return e.x=o*u*c+-n*u*h+(l*n-a*o)*u,e.y=i*u*h+-s*u*c+(-l*i+a*s)*u,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),i=Math.sin(t),s=this.a,n=this.c,o=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=o*e-this.ty*i,this.ty=o*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,s=t.b,n=t.c,o=t.d,a=t.tx,l=t.ty,u=e.a,c=e.b,h=e.c,p=e.d;return this.a=i*u+s*h,this.b=i*c+s*p,this.c=n*u+o*h,this.d=n*c+o*p,this.tx=a*u+l*h+e.tx,this.ty=a*c+l*p+e.ty,this}setTransform(t,e,i,s,n,o,a,l,u){return this.a=Math.cos(a+u)*n,this.b=Math.sin(a+u)*n,this.c=-Math.sin(a-l)*o,this.d=Math.cos(a-l)*o,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*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}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-s,n),l=Math.atan2(i,e),u=Math.abs(a+l);return u<1e-5||Math.abs(Xu-u)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=l),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(o.x*e+o.y*s),t.position.y=this.ty+(o.x*i+o.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,o=t*s-e*i;return this.a=s/o,this.b=-e/o,this.c=-i/o,this.d=t/o,this.tx=(i*this.ty-s*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new G;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}copyTo(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}copyFrom(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}equals(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}static get IDENTITY(){return Mv.identity()}static get shared(){return Rv.identity()}}const Rv=new G,Mv=new G;class it{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new it(t!=null?t:this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}const lr={default:-1};function Q(r="default"){return lr[r]===void 0&&(lr[r]=-1),++lr[r]}function Cv(){for(const r in lr)delete lr[r]}class li{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e0?i=this._pool[--this._index]:i=new this._classType,(e=i.init)==null||e.call(i,t),i}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class Vu{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new li(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const H=new Vu;function hn(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s0&&i<=e){for(let o=e-1;o>=r;o--){const a=this.children[o];a&&(s.push(a),a.parent=null)}hn(this.children,r,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(s);for(let o=0;o=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){const s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r.didViewUpdate=!1,r._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}};class ur{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;ee.priority-i.priority);const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),ui.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=ui.getMaskEffect(r),this.addEffect(this._maskEffect)))},get mask(){var r;return(r=this._maskEffect)==null?void 0:r.mask},set filters(r){var t;!Array.isArray(r)&&r&&(r=[r]);const e=this._filterEffect||(this._filterEffect=new ur);r=r;const i=(r==null?void 0:r.length)>0,s=((t=e.filters)==null?void 0:t.length)>0,n=i!==s;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new ur),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},qu={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let i=0;i=this.x&&t=this.y&&e=l&&t<=u&&e>=c&&e<=h&&!(t>p&&tm&&e<_)}intersects(t,e){if(!e){const M=this.xt.right?t.right:this.right)<=M)return!1;const S=this.yt.bottom?t.bottom:this.bottom)>S}const i=this.left,s=this.right,n=this.top,o=this.bottom;if(s<=i||o<=n)return!1;const a=ci[0].set(t.left,t.top),l=ci[1].set(t.left,t.bottom),u=ci[2].set(t.right,t.top),c=ci[3].set(t.right,t.bottom);if(u.x<=a.x||l.y<=a.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(a,a),e.apply(l,l),e.apply(u,u),e.apply(c,c),Math.max(a.x,l.x,u.x,c.x)<=i||Math.min(a.x,l.x,u.x,c.x)>=s||Math.max(a.y,l.y,u.y,c.y)<=n||Math.min(a.y,l.y,u.y,c.y)>=o))return!1;const p=h*(l.y-a.y),f=h*(a.x-l.x),m=p*i+f*n,_=p*s+f*n,g=p*i+f*o,b=p*s+f*o;if(Math.max(m,_,g,b)<=p*a.x+f*a.y||Math.min(m,_,g,b)>=p*c.x+f*c.y)return!1;const v=h*(a.y-u.y),y=h*(u.x-a.x),T=v*i+y*n,E=v*s+y*n,R=v*i+y*o,w=v*s+y*o;return!(Math.max(T,E,R,w)<=v*a.x+y*a.y||Math.min(T,E,R,w)>=v*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=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(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=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=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}getBounds(t){return t=t||new W,t.copyFrom(this),t}}const Zu=new G;class ut{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Zu,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new W);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Zu,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,n){n||(n=this.matrix);const o=n.a,a=n.b,l=n.c,u=n.d,c=n.tx,h=n.ty;let p=this.minX,f=this.minY,m=this.maxX,_=this.maxY,g=o*t+l*e+c,b=a*t+u*e+h;gm&&(m=g),b>_&&(_=b),g=o*i+l*e+c,b=a*i+u*e+h,gm&&(m=g),b>_&&(_=b),g=o*t+l*s+c,b=a*t+u*s+h,gm&&(m=g),b>_&&(_=b),g=o*i+l*s+c,b=a*i+u*s+h,gm&&(m=g),b>_&&(_=b),this.minX=p,this.minY=f,this.maxX=m,this.maxY=_}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxXthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=o*e+l*n+c,f=a*e+u*n+h,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY,p=o*s+l*n+c,f=a*s+u*n+h,this.minX=pthis.maxX?p:this.maxX,this.maxY=f>this.maxY?f:this.maxY}fit(t){return this.minXt.right&&(this.maxX=t.right),this.minYt.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,i,s){return this.minXe&&(this.maxX=e),this.minYs&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new ut(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let n=this.minX,o=this.minY,a=this.maxX,l=this.maxY;s||(s=this.matrix);const u=s.a,c=s.b,h=s.c,p=s.d,f=s.tx,m=s.ty;for(let _=e;_a?v:a,l=y>l?y:l}this.minX=n,this.minY=o,this.maxX=a,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}const $t=new li(G),Lt=new li(ut);function cr(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=$t.get().identity(),i=hr(r,s)):i=G.IDENTITY,dn(r,e,i,t),s&&$t.return(s),e.isValid||e.set(0,0,0,0),e}function dn(r,t,e,i){var s,n;if(!r.visible||!r.measurable)return;let o;i?o=r.worldTransform:(r.updateLocalTransform(),o=$t.get(),o.appendFrom(r.localTransform,e));const a=t,l=!!r.effects.length;if(l&&(t=Lt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.addBounds&&(t.matrix=o,r.addBounds(t));for(let u=0;u-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let i=0;i0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;tthis.addChild(s)),(i=t.parent)==null||i.addChild(this)}static mixin(t){Object.defineProperties(J.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(t.length>1){for(let s=0;s1){for(let s=0;s-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=H.get(sc,this),this.groupTransform=G.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),H.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*ju}set angle(t){this.rotation=t*zu}get pivot(){return this._pivot===gn&&(this._pivot=new it(this,0,0)),this._pivot}set pivot(t){this._pivot===gn&&(this._pivot=new it(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===mn&&(this._skew=new it(this,0,0)),this._skew}set skew(t){this._skew===mn&&(this._skew=new it(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===_n&&(this._scale=new it(this,1,1)),this._scale}set scale(t){this._scale===_n&&(this._scale=new it(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var i;const s=this.getLocalBounds();typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,s.width),e!==void 0&&this._setHeight(e,s.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,s=this._pivot,n=this._position,o=i._x,a=i._y,l=s._x,u=s._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=n._x-(l*e.a+u*e.c),e.ty=n._y-(l*e.b+u*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=dr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=V.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=dr,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=di,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Oe,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=Oe,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=Oe,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;this.destroyed=!0;const i=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.children)for(let s=0;s1&&typeof MSStream=="undefined"};function Fv(r){return function(t){return t.test(r)}}function _c(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]!="undefined"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]!="undefined"&&(e=i[0]);var s=Fv(e),n={apple:{phone:s(bn)&&!s(Vt),ipod:s(oc),tablet:!s(bn)&&(s(ac)||gc(t))&&!s(Vt),universal:s(lc),device:(s(bn)||s(oc)||s(ac)||s(lc)||gc(t))&&!s(Vt)},amazon:{phone:s(Be),tablet:!s(Be)&&s(pi),device:s(Be)||s(pi)},android:{phone:!s(Vt)&&s(Be)||!s(Vt)&&s(yn),tablet:!s(Vt)&&!s(Be)&&!s(yn)&&(s(pi)||s(uc)),device:!s(Vt)&&(s(Be)||s(pi)||s(yn)||s(uc))||s(/\bokhttp\b/i)},windows:{phone:s(Vt),tablet:s(cc),device:s(Vt)||s(cc)},other:{blackberry:s(hc),blackberry10:s(dc),opera:s(pc),firefox:s(mc),chrome:s(fc),device:s(hc)||s(dc)||s(pc)||s(mc)||s(fc)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var bc;const yc=((bc=_c.default)!=null?bc:_c)(globalThis.navigator),Dv=9,fi=100,Uv=0,kv=0,vc=2,xc=1,$v=-1e3,Lv=-1e3,Nv=2;class vn{constructor(t,e=yc){this._mobileInfo=e,this.debug=!1,this._isActive=!1,this._isMobileAccessibility=!1,this._pool=[],this._renderId=0,this._children=[],this._androidUpdateCount=0,this._androidUpdateFrequency=500,this._hookDiv=null,(e.tablet||e.phone)&&this._createTouchHook();const i=document.createElement("div");i.style.width=`${fi}px`,i.style.height=`${fi}px`,i.style.position="absolute",i.style.top=`${Uv}px`,i.style.left=`${kv}px`,i.style.zIndex=vc.toString(),this._div=i,this._renderer=t,this._onKeyDown=this._onKeyDown.bind(this),this._onMouseMove=this._onMouseMove.bind(this),globalThis.addEventListener("keydown",this._onKeyDown,!1)}get isActive(){return this._isActive}get isMobileAccessibility(){return this._isMobileAccessibility}get hookDiv(){return this._hookDiv}_createTouchHook(){const t=document.createElement("button");t.style.width=`${xc}px`,t.style.height=`${xc}px`,t.style.position="absolute",t.style.top=`${$v}px`,t.style.left=`${Lv}px`,t.style.zIndex=Nv.toString(),t.style.backgroundColor="#FF0000",t.title="select to enable accessibility for this content",t.addEventListener("focus",()=>{this._isMobileAccessibility=!0,this._activate(),this._destroyTouchHook()}),document.body.appendChild(t),this._hookDiv=t}_destroyTouchHook(){this._hookDiv&&(document.body.removeChild(this._hookDiv),this._hookDiv=null)}_activate(){var t;this._isActive||(this._isActive=!0,globalThis.document.addEventListener("mousemove",this._onMouseMove,!0),globalThis.removeEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.add(this),(t=this._renderer.view.canvas.parentNode)==null||t.appendChild(this._div))}_deactivate(){var t;!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener("mousemove",this._onMouseMove,!0),globalThis.addEventListener("keydown",this._onKeyDown,!1),this._renderer.runners.postrender.remove(this),(t=this._div.parentNode)==null||t.removeChild(this._div))}_updateAccessibleObjects(t){if(!t.visible||!t.accessibleChildren)return;t.accessible&&t.isInteractive()&&(t._accessibleActive||this._addChild(t),t._renderId=this._renderId);const e=t.children;if(e)for(let i=0;i title : ${t.title}
tabIndex: ${t.tabIndex}`}_capHitArea(t){t.x<0&&(t.width+=t.x,t.x=0),t.y<0&&(t.height+=t.y,t.y=0);const{width:e,height:i}=this._renderer;t.x+t.width>e&&(t.width=e-t.x),t.y+t.height>i&&(t.height=i-t.y)}_addChild(t){let e=this._pool.pop();e||(e=document.createElement("button"),e.style.width=`${fi}px`,e.style.height=`${fi}px`,e.style.backgroundColor=this.debug?"rgba(255,255,255,0.5)":"transparent",e.style.position="absolute",e.style.zIndex=vc.toString(),e.style.borderStyle="none",navigator.userAgent.toLowerCase().includes("chrome")?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&&t.accessibleTitle!==null?e.title=t.accessibleTitle:(!t.accessibleHint||t.accessibleHint===null)&&(e.title=`container ${t.tabIndex}`),t.accessibleHint&&t.accessibleHint!==null&&e.setAttribute("aria-label",t.accessibleHint),this.debug&&this._updateDebugHTML(e),t._accessibleActive=!0,t._accessibleDiv=e,e.container=t,this._children.push(t),this._div.appendChild(t._accessibleDiv),t._accessibleDiv.tabIndex=t.tabIndex}_dispatchEvent(t,e){const{container:i}=t.target,s=this._renderer.events.rootBoundary,n=Object.assign(new Ge(s),{target:i});s.rootTarget=this._renderer.lastObjectRendered,e.forEach(o=>s.dispatchEvent(n,o))}_onClick(t){this._dispatchEvent(t,["click","pointertap","tap"])}_onFocus(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","assertive"),this._dispatchEvent(t,["mouseover"])}_onFocusOut(t){t.target.getAttribute("aria-live")||t.target.setAttribute("aria-live","polite"),this._dispatchEvent(t,["mouseout"])}_onKeyDown(t){t.keyCode===Dv&&this._activate()}_onMouseMove(t){t.movementX===0&&t.movementY===0||this._deactivate()}destroy(){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}}vn.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"accessibility"};const Tc={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:"button",accessiblePointerEvents:"auto",accessibleChildren:!0,_renderId:-1};U.add(vn),J.mixin(Tc);class xn{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}xn.extension=x.Application;var Wt=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(Wt||{});class mi{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(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);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const Sc=class Pt{constructor(){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 mi(null,null,1/0),this.deltaMS=1/Pt.targetFPMS,this.elapsedMS=1/Pt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=Wt.NORMAL){return this._addListener(new mi(t,e,i))}addOnce(t,e,i=Wt.NORMAL){return this._addListener(new mi(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?ct.shared:new ct,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}Tn.extension=x.Application,U.add(xn),U.add(Tn);let Hv=class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}init(t){this.removeTickerListener(),this.events=t,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this._tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(t){this._pauseUpdate=t}addTickerListener(){this._tickerAdded||!this.domElement||(ct.system.add(this._tickerUpdate,this,Wt.INTERACTION),this._tickerAdded=!0)}removeTickerListener(){this._tickerAdded&&(ct.system.remove(this._tickerUpdate,this),this._tickerAdded=!1)}pointerMoved(){this._didMove=!0}_update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}const t=this.events._rootPointerEvent;this.events.supportsTouchEvents&&t.pointerType==="touch"||globalThis.document.dispatchEvent(new PointerEvent("pointermove",{clientX:t.clientX,clientY:t.clientY,pointerType:t.pointerType,pointerId:t.pointerId}))}_tickerUpdate(t){this._deltaTime+=t.deltaTime,!(this._deltaTimei.priority-s.priority)}dispatchEvent(t,e){t.propagationStopped=!1,t.propagationImmediatelyStopped=!1,this.propagate(t,e),this.dispatch.emit(e||t.type,t)}mapEvent(t){if(!this.rootTarget)return;const e=this.mappingTable[t.type];if(e)for(let i=0,s=e.length;i=0;s--)if(t.currentTarget=i[s],this.notifyTarget(t,e),t.propagationStopped||t.propagationImmediatelyStopped)return}}all(t,e,i=this._allInteractiveElements){if(i.length===0)return;t.eventPhase=t.BUBBLING_PHASE;const s=Array.isArray(e)?e:[e];for(let n=i.length-1;n>=0;n--)s.forEach(o=>{t.currentTarget=i[n],this.notifyTarget(t,o)})}propagationPath(t){const e=[t];for(let i=0;i=0;h--){const p=c[h],f=this.hitTestMoveRecursive(p,this._isInteractive(e)?e:p.eventMode,i,s,n,o||n(t,i));if(f){if(f.length>0&&!f[f.length-1].parent)continue;const m=t.isInteractive();(f.length>0||m)&&(m&&this._allInteractiveElements.push(t),f.push(t)),this._hitElements.length===0&&(this._hitElements=f),a=!0}}}const l=this._isInteractive(e),u=t.isInteractive();return u&&u&&this._allInteractiveElements.push(t),o||this._hitElements.length>0?null:a?this._hitElements:l&&!n(t,i)&&s(t,i)?u?[t]:[]:null}hitTestRecursive(t,e,i,s,n){if(this._interactivePrune(t)||n(t,i))return null;if((t.eventMode==="dynamic"||e==="dynamic")&&(Yt.pauseUpdate=!1),t.interactiveChildren&&t.children){const l=t.children,u=i;for(let c=l.length-1;c>=0;c--){const h=l[c],p=this.hitTestRecursive(h,this._isInteractive(e)?e:h.eventMode,u,s,n);if(p){if(p.length>0&&!p[p.length-1].parent)continue;const f=t.isInteractive();return(p.length>0||f)&&p.push(t),p}}}const o=this._isInteractive(e),a=t.isInteractive();return o&&s(t,i)?a?[t]:[]:null}_isInteractive(t){return t==="static"||t==="dynamic"}_interactivePrune(t){return!t||!t.visible||!t.renderable||!t.includeInBuild||!t.measurable||t.eventMode==="none"||t.eventMode==="passive"&&!t.interactiveChildren}hitPruneFn(t,e){if(t.hitArea&&(t.worldTransform.applyInverse(e,fr),!t.hitArea.contains(fr.x,fr.y)))return!0;if(t.effects&&t.effects.length)for(let i=0;i0&&l!==n.target){const h=t.type==="mousemove"?"mouseout":"pointerout",p=this.createPointerEvent(t,h,l);if(this.dispatchEvent(p,"pointerout"),o&&this.dispatchEvent(p,"mouseout"),!n.composedPath().includes(l)){const f=this.createPointerEvent(t,"pointerleave",l);for(f.eventPhase=f.AT_TARGET;f.target&&!n.composedPath().includes(f.target);)f.currentTarget=f.target,this.notifyTarget(f),o&&this.notifyTarget(f,"mouseleave"),f.target=f.target.parent;this.freeEvent(f)}this.freeEvent(p)}if(l!==n.target){const h=t.type==="mousemove"?"mouseover":"pointerover",p=this.clonePointerEvent(n,h);this.dispatchEvent(p,"pointerover"),o&&this.dispatchEvent(p,"mouseover");let f=l==null?void 0:l.parent;for(;f&&f!==this.rootTarget.parent&&f!==n.target;)f=f.parent;if(!f||f===this.rootTarget.parent){const m=this.clonePointerEvent(n,"pointerenter");for(m.eventPhase=m.AT_TARGET;m.target&&m.target!==l&&m.target!==this.rootTarget.parent;)m.currentTarget=m.target,this.notifyTarget(m),o&&this.notifyTarget(m,"mouseenter"),m.target=m.target.parent;this.freeEvent(m)}this.freeEvent(p)}const u=[],c=(i=this.enableGlobalMoveEvents)!=null?i:!0;this.moveOnAll?u.push("pointermove"):this.dispatchEvent(n,"pointermove"),c&&u.push("globalpointermove"),n.pointerType==="touch"&&(this.moveOnAll?u.splice(1,0,"touchmove"):this.dispatchEvent(n,"touchmove"),c&&u.push("globaltouchmove")),o&&(this.moveOnAll?u.splice(1,0,"mousemove"):this.dispatchEvent(n,"mousemove"),c&&u.push("globalmousemove"),this.cursor=(s=n.target)==null?void 0:s.cursor),u.length>0&&this.all(n,u),this._allInteractiveElements.length=0,this._hitElements.length=0,a.overTargets=n.composedPath(),this.freeEvent(n)}mapPointerOver(t){var e;if(!(t instanceof Rt))return;const i=this.trackingData(t.pointerId),s=this.createPointerEvent(t),n=s.pointerType==="mouse"||s.pointerType==="pen";this.dispatchEvent(s,"pointerover"),n&&this.dispatchEvent(s,"mouseover"),s.pointerType==="mouse"&&(this.cursor=(e=s.target)==null?void 0:e.cursor);const o=this.clonePointerEvent(s,"pointerenter");for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),n&&this.notifyTarget(o,"mouseenter"),o.target=o.target.parent;i.overTargets=s.composedPath(),this.freeEvent(s),this.freeEvent(o)}mapPointerOut(t){if(!(t instanceof Rt))return;const e=this.trackingData(t.pointerId);if(e.overTargets){const i=t.pointerType==="mouse"||t.pointerType==="pen",s=this.findMountedTarget(e.overTargets),n=this.createPointerEvent(t,"pointerout",s);this.dispatchEvent(n),i&&this.dispatchEvent(n,"mouseout");const o=this.createPointerEvent(t,"pointerleave",s);for(o.eventPhase=o.AT_TARGET;o.target&&o.target!==this.rootTarget.parent;)o.currentTarget=o.target,this.notifyTarget(o),i&&this.notifyTarget(o,"mouseleave"),o.target=o.target.parent;e.overTargets=null,this.freeEvent(n),this.freeEvent(o)}this.cursor=null}mapPointerUp(t){if(!(t instanceof Rt))return;const e=performance.now(),i=this.createPointerEvent(t);if(this.dispatchEvent(i,"pointerup"),i.pointerType==="touch")this.dispatchEvent(i,"touchend");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const a=i.button===2;this.dispatchEvent(i,a?"rightup":"mouseup")}const s=this.trackingData(t.pointerId),n=this.findMountedTarget(s.pressTargetsByButton[t.button]);let o=n;if(n&&!i.composedPath().includes(n)){let a=n;for(;a&&!i.composedPath().includes(a);){if(i.currentTarget=a,this.notifyTarget(i,"pointerupoutside"),i.pointerType==="touch")this.notifyTarget(i,"touchendoutside");else if(i.pointerType==="mouse"||i.pointerType==="pen"){const l=i.button===2;this.notifyTarget(i,l?"rightupoutside":"mouseupoutside")}a=a.parent}delete s.pressTargetsByButton[t.button],o=a}if(o){const a=this.clonePointerEvent(i,"click");a.target=o,a.path=null,s.clicksByButton[t.button]||(s.clicksByButton[t.button]={clickCount:0,target:a.target,timeStamp:e});const l=s.clicksByButton[t.button];if(l.target===a.target&&e-l.timeStamp<200?++l.clickCount:l.clickCount=1,l.target=a.target,l.timeStamp=e,a.detail=l.clickCount,a.pointerType==="mouse"){const u=a.button===2;this.dispatchEvent(a,u?"rightclick":"click")}else a.pointerType==="touch"&&this.dispatchEvent(a,"tap");this.dispatchEvent(a,"pointertap"),this.freeEvent(a)}this.freeEvent(i)}mapPointerUpOutside(t){if(!(t instanceof Rt))return;const e=this.trackingData(t.pointerId),i=this.findMountedTarget(e.pressTargetsByButton[t.button]),s=this.createPointerEvent(t);if(i){let n=i;for(;n;)s.currentTarget=n,this.notifyTarget(s,"pointerupoutside"),s.pointerType==="touch"?this.notifyTarget(s,"touchendoutside"):(s.pointerType==="mouse"||s.pointerType==="pen")&&this.notifyTarget(s,s.button===2?"rightupoutside":"mouseupoutside"),n=n.parent;delete e.pressTargetsByButton[t.button]}this.freeEvent(s)}mapWheel(t){if(!(t instanceof ce))return;const e=this.createWheelEvent(t);this.dispatchEvent(e),this.freeEvent(e)}findMountedTarget(t){if(!t)return null;let e=t[0];for(let i=1;it in r?zv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Yv=(r,t)=>{for(var e in t||(t={}))Vv.call(t,e)&&Pc(r,e,t[e]);if(Ac)for(var e of Ac(t))Wv.call(t,e)&&Pc(r,e,t[e]);return r};const Kv=1,qv={touchstart:"pointerdown",touchend:"pointerup",touchendoutside:"pointerupoutside",touchmove:"pointermove",touchcancel:"pointercancel"},Sn=class yu{constructor(t){this.supportsTouchEvents="ontouchstart"in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Ec(null),Yt.init(this),this.autoPreventDefault=!0,this._eventsAdded=!1,this._rootPointerEvent=new Rt(null),this._rootWheelEvent=new ce(null),this.cursorStyles={default:"inherit",pointer:"pointer"},this.features=new Proxy(Yv({},yu.defaultEventFeatures),{set:(e,i,s)=>(i==="globalMove"&&(this.rootBoundary.enableGlobalMoveEvents=s),e[i]=s,!0)}),this._onPointerDown=this._onPointerDown.bind(this),this._onPointerMove=this._onPointerMove.bind(this),this._onPointerUp=this._onPointerUp.bind(this),this._onPointerOverOut=this._onPointerOverOut.bind(this),this.onWheel=this.onWheel.bind(this)}static get defaultEventMode(){return this._defaultEventMode}init(t){var e,i;const{canvas:s,resolution:n}=this.renderer;this.setTargetElement(s),this.resolution=n,yu._defaultEventMode=(e=t.eventMode)!=null?e:"passive",Object.assign(this.features,(i=t.eventFeatures)!=null?i:{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(t){this.resolution=t}destroy(){this.setTargetElement(null),this.renderer=null,this._currentCursor=null}setCursor(t){t=t||"default";let e=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(e=!1),this._currentCursor===t)return;this._currentCursor=t;const i=this.cursorStyles[t];if(i)switch(typeof i){case"string":e&&(this.domElement.style.cursor=i);break;case"function":i(t);break;case"object":e&&Object.assign(this.domElement.style,i);break}else e&&typeof t=="string"&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,t)&&(this.domElement.style.cursor=t)}get pointer(){return this._rootPointerEvent}_onPointerDown(t){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;const e=this._normalizeToPointerData(t);this.autoPreventDefault&&e[0].isNormalized&&(t.cancelable||!("cancelable"in t))&&t.preventDefault();for(let i=0,s=e.length;i0&&(e=t.composedPath()[0]);const i=e!==this.domElement?"outside":"",s=this._normalizeToPointerData(t);for(let n=0,o=s.length;n{l.off(r,a,o)}),n?l.once(r,a,o):l.on(r,a,o)},removeEventListener(r,t,e){const i=typeof e=="boolean"&&e||typeof e=="object"&&e.capture,s=typeof t=="function"?void 0:t;r=i?`${r}capture`:r,t=typeof t=="function"?t:t.handleEvent,this.off(r,t,s)},dispatchEvent(r){if(!(r instanceof Ge))throw new Error("Container cannot propagate events outside of the Federated Events API");return r.defaultPrevented=!1,r.path=null,r.target=this,r.manager.dispatchEvent(r),!r.defaultPrevented}};U.add(En),J.mixin(wc);var vt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(vt||{});const Rc={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let Mc=Rc;const $={get(){return Mc},set(r){Mc=r}};function Bt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function mr(r){return r.split("?")[0].split("#")[0]}function Zv(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Qv(r,t,e){return r.replace(new RegExp(Zv(t),"g"),e)}function Jv(r,t){let e="",i=0,s=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",i=0):(e=e.slice(0,l),i=e.length-1-e.lastIndexOf("/")),s=a,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,a)}`:e=r.slice(s+1,a),i=a-s-1;s=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const mt={toPosix(r){return Qv(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){Bt(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(Bt(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const i=mr(this.toPosix(t!=null?t:$.get().getBaseUrl())),s=mr(this.toPosix(e!=null?e:this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?mt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,r)},normalize(r){if(Bt(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const i=r.endsWith("/");return r=Jv(r,!1),r.length>0&&i&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Bt(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let i=0;i0)if(e===void 0)e=s;else{const n=(t=r[i-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(Bt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!s){i=a;break}}else s=!1;return i===-1?e?"/":this.isUrl(o)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},rootname(r){Bt(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){Bt(r),t&&Bt(t),r=mr(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const l=r.charCodeAt(n);if(l===47){if(!s){e=n+1;break}}else a===-1&&(s=!1,a=n+1),o>=0&&(l===t.charCodeAt(o)?--o===-1&&(i=n):(o=-1,i=a))}return e===i?i=a:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){Bt(r),r=mr(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!s){e=o+1;break}continue}i===-1&&(s=!1,i=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){Bt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=mr(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;const n="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let o=-1,a=0,l=-1,u=!0,c=r.length-1,h=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!u){a=c+1;break}continue}l===-1&&(u=!1,l=c+1),e===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||l===-1||h===0||h===1&&o===l-1&&o===a+1?l!==-1&&(a===0&&i?t.base=t.name=r.slice(1,l):t.base=t.name=r.slice(a,l)):(a===0&&i?(t.name=r.slice(1,o),t.base=r.slice(1,l)):(t.name=r.slice(a,o),t.base=r.slice(a,l)),t.ext=r.slice(o,l)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},Mt=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r);function Cc(r,t,e,i,s){const n=t[e];for(let o=0;o{const o=n.substring(1,n.length-1).split(",");s.push(o)}),Cc(r,s,0,e,i)}else i.push(r);return i}const gr=r=>!Array.isArray(r);var t0=Object.defineProperty,e0=Object.defineProperties,r0=Object.getOwnPropertyDescriptors,Gc=Object.getOwnPropertySymbols,i0=Object.prototype.hasOwnProperty,s0=Object.prototype.propertyIsEnumerable,Bc=(r,t,e)=>t in r?t0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ie=(r,t)=>{for(var e in t||(t={}))i0.call(t,e)&&Bc(r,e,t[e]);if(Gc)for(var e of Gc(t))s0.call(t,e)&&Bc(r,e,t[e]);return r},n0=(r,t)=>e0(r,r0(t));class Jt{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,i,s;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(i=t.createBundleAssetId)!=null?i:this._createBundleAssetId,this._extractAssetIdFromBundle=(s=t.extractAssetIdFromBundle)!=null?s:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Mt(e||i,s=>typeof s=="string"?s:Array.isArray(s)?s.map(n=>{var o;return(o=n==null?void 0:n.src)!=null?o:n}):s!=null&&s.src?s.src:s,!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let s=e;Array.isArray(e)||(s=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:Ie({alias:n},o))),s.forEach(n=>{const o=n.src,a=n.alias;let l;if(typeof a=="string"){const u=this._createBundleAssetId(t,a);i.push(u),l=[a,u]}else{const u=a.map(c=>this._createBundleAssetId(t,c));i.push(...u),l=[...a,...u]}this.add(n0(Ie({},n),{alias:l,src:o}))}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;Mt(e).forEach(s=>{const{src:n}=s;let{data:o,format:a,loadParser:l}=s;const u=Mt(n).map(p=>typeof p=="string"?Oc(p):Array.isArray(p)?p:[p]),c=this.getAlias(s),h=[];u.forEach(p=>{p.forEach(f=>{var m,_,g;let b={};if(typeof f!="object"){b.src=f;for(let v=0;v{this._assetMap[p]=h})})}resolveBundle(t){const e=gr(t);t=Mt(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const o=this.resolve(n),a={};for(const l in o){const u=o[l];a[this._extractAssetIdFromBundle(s,l)]=u}i[s]=a}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=gr(t);t=Mt(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(l=>{const u=n.filter(c=>c[a]?c[a]===l:!1);u.length&&(n=u)})}),this._resolverHash[s]=n[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;en.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var i,s;const{aliases:n,data:o,loadParser:a,format:l}=e;return(this._basePath||this._rootPath)&&(t.src=mt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(i=n!=null?n:t.alias)!=null?i:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Ie(Ie({},o||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=(s=l!=null?l:t.format)!=null?s:Ic(t.src),t}}Jt.RETINA_PREFIX=/@([0-9\.]+)x/;function Ic(r){return r.split(".").pop().split("?").shift().split("#").shift()}const gi=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r},he=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],de=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],pe=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],fe=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],An=[],Fc=[],_i=Math.sign;function o0(){for(let r=0;r<16;r++){const t=[];An.push(t);for(let e=0;e<16;e++){const i=_i(he[r]*he[e]+pe[r]*de[e]),s=_i(de[r]*he[e]+fe[r]*de[e]),n=_i(he[r]*pe[e]+pe[r]*fe[e]),o=_i(de[r]*pe[e]+fe[r]*fe[e]);for(let a=0;a<16;a++)if(he[a]===i&&de[a]===s&&pe[a]===n&&fe[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new G;t.set(he[r],de[r],pe[r],fe[r],0,0),Fc.push(t)}}o0();const k={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:r=>he[r],uY:r=>de[r],vX:r=>pe[r],vY:r=>fe[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>An[r][t],sub:(r,t)=>An[r][k.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?k.S:k.N:Math.abs(t)*2<=Math.abs(r)?r>0?k.E:k.W:t>0?r>0?k.SE:k.SW:r>0?k.NE:k.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Fc[k.inv(t)];s.tx=e,s.ty=i,r.append(s)}},Pn=()=>{};function me(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function wn(r){return!(r&r-1)&&!!r}function a0(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Nt(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var l0=Object.defineProperty,Dc=Object.getOwnPropertySymbols,u0=Object.prototype.hasOwnProperty,c0=Object.prototype.propertyIsEnumerable,Uc=(r,t,e)=>t in r?l0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kc=(r,t)=>{for(var e in t||(t={}))u0.call(t,e)&&Uc(r,e,t[e]);if(Dc)for(var e of Dc(t))c0.call(t,e)&&Uc(r,e,t[e]);return r};const $c=Object.create(null);function h0(r){const t=$c[r];return t===void 0&&($c[r]=Q("resource")),t}const Lc=class Fy extends ft{constructor(t={}){var e,i,s,n,o,a,l;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=kc(kc({},Fy.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(i=t.addressModeV)!=null?i:this.addressModeV,this.addressModeW=(s=t.addressModeW)!=null?s:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(n=t.magFilter)!=null?n:this.magFilter,this.minFilter=(o=t.minFilter)!=null?o:this.minFilter,this.mipmapFilter=(a=t.mipmapFilter)!=null?a:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=(l=t.maxAnisotropy)!=null?l:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=h0(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Lc.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Nc=Lc;var d0=Object.defineProperty,Hc=Object.getOwnPropertySymbols,p0=Object.prototype.hasOwnProperty,f0=Object.prototype.propertyIsEnumerable,Xc=(r,t,e)=>t in r?d0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jc=(r,t)=>{for(var e in t||(t={}))p0.call(t,e)&&Xc(r,e,t[e]);if(Hc)for(var e of Hc(t))f0.call(t,e)&&Xc(r,e,t[e]);return r};const zc=class Dy extends ft{constructor(t={}){var e,i,s;super(),this.options=t,this.uid=Q("textureSource"),this._resourceType="textureSource",this._resourceId=Q("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t=jc(jc({},Dy.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(i=this.resourceWidth)!=null?i:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(s=this.resourceHeight)!=null?s:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Nc(Nt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Q("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i=i||this._resolution,t=t||this.width,e=e||this.height;const s=Math.round(t*i),n=Math.round(e*i);return this.width=s/i,this.height=n/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=n,this.emit("resize",this),this._resourceId=Q("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=wn(this.pixelWidth)&&wn(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};zc.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let et=zc;var m0=Object.defineProperty,g0=Object.defineProperties,_0=Object.getOwnPropertyDescriptors,Vc=Object.getOwnPropertySymbols,b0=Object.prototype.hasOwnProperty,y0=Object.prototype.propertyIsEnumerable,Wc=(r,t,e)=>t in r?m0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,v0=(r,t)=>{for(var e in t||(t={}))b0.call(t,e)&&Wc(r,e,t[e]);if(Vc)for(var e of Vc(t))y0.call(t,e)&&Wc(r,e,t[e]);return r},x0=(r,t)=>g0(r,_0(t));class bi extends et{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super(x0(v0({},t),{resource:e,format:i})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}bi.extension=x.TextureSource;const Yc=new G;class Rn{constructor(t,e){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s{this._callback=t,this._batchIndex=0,this._frameKeys.length<=ni.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=ni.BATCH_SIZE;for(;e-t{this._batchIndex*ni.BATCH_SIZE{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=mt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=qc([`${s}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(i,a)})}return i}const Zc={extension:x.Asset,cache:{test:r=>r instanceof Mn,getCacheableAssets:(r,t)=>qc(r,t,!1)},resolver:{extension:{type:x.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&T0.includes(i)},parse:r=>{var t,e;const i=r.split(".");return{resolution:parseFloat((e=(t=Jt.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i[i.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:x.LoadParser,priority:vt.Normal,name:"spritesheetLoader"},async testParse(r,t){return mt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var i,s,n;const{texture:o,imageFilename:a}=(i=t==null?void 0:t.data)!=null?i:{};let l=mt.dirname(t.src);l&&l.lastIndexOf("/")!==l.length-1&&(l+="/");let u;if(o instanceof P)u=o;else{const p=gi(l+(a!=null?a:r.meta.image),t.src);u=(await e.load([p]))[p]}const c=new Mn(u.source,r);await c.parse();const h=(s=r==null?void 0:r.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(h)){const p=[];for(const m of h){if(typeof m!="string")continue;let _=l+m;(n=t.data)!=null&&n.ignoreMultiPack||(_=gi(_,t.src),p.push(e.load({src:_,data:{ignoreMultiPack:!0}})))}const f=await Promise.all(p);c.linkedSheets=f,f.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(_=>_!==m))})}return c},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};U.add(Zc);function _r(r,t,e,i){const{width:s,height:n}=e.orig,o=e.trim;if(o){const a=o.width,l=o.height;r.minX=o.x-t._x*s-i,r.maxX=r.minX+a,r.minY=o.y-t._y*n-i,r.maxY=r.minY+l}else r.minX=-t._x*s-i,r.maxX=r.minX+s,r.minY=-t._y*n-i,r.maxY=r.minY+n}class ge extends J{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new ut(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}var S0=Object.defineProperty,yi=Object.getOwnPropertySymbols,Qc=Object.prototype.hasOwnProperty,Jc=Object.prototype.propertyIsEnumerable,th=(r,t,e)=>t in r?S0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,E0=(r,t)=>{for(var e in t||(t={}))Qc.call(t,e)&&th(r,e,t[e]);if(yi)for(var e of yi(t))Jc.call(t,e)&&th(r,e,t[e]);return r},A0=(r,t)=>{var e={};for(var i in r)Qc.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&yi)for(var i of yi(r))t.indexOf(i)<0&&Jc.call(r,i)&&(e[i]=r[i]);return e};class It extends ge{constructor(t=P.EMPTY){t instanceof P&&(t={texture:t});const e=t,{texture:i=P.EMPTY,anchor:s,roundPixels:n,width:o,height:a}=e,l=A0(e,["texture","anchor","roundPixels","width","height"]);super(E0({label:"Sprite"},l)),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new it({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n!=null?n:!1,o!==void 0&&(this.width=o),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof P?new It(t):new It(P.from(t,e))}set texture(t){t||(t=P.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){_r(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,i=this._sourceBounds,{width:s,height:n}=e.orig;i.maxX=-t._x*s,i.minX=i.maxX+s,i.maxY=-t._y*n,i.minY=i.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const P0=new ut;function vi(r,t,e){const i=P0;r.measurable=!0,cr(r,e,i),t.addBoundsMask(i),r.measurable=!1}function xi(r,t,e){const i=Lt.get();r.measurable=!0;const s=$t.get().identity(),n=Cn(r,e,s);hi(r,i,n),r.measurable=!1,t.addBoundsMask(i),$t.return(s),Lt.return(i)}function Cn(r,t,e){return r&&r!==t&&(Cn(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class On{constructor(t){this.priority=0,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof It),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){vi(this.mask,t,e)}addLocalBounds(t,e){xi(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof It}}On.extension=x.MaskEffect;class Gn{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}Gn.extension=x.MaskEffect;class Bn{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){vi(this.mask,t,e)}addLocalBounds(t,e){xi(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof J}}Bn.extension=x.MaskEffect;class Kt extends et{constructor(t){t.resource||(t.resource=$.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}Kt.extension=x.TextureSource;class _e extends et{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=$.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}_e.extension=x.TextureSource;let In;async function Fn(){return In!=null||(In=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(s),t.deleteTexture(i),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),In}var w0=Object.defineProperty,R0=Object.defineProperties,M0=Object.getOwnPropertyDescriptors,eh=Object.getOwnPropertySymbols,C0=Object.prototype.hasOwnProperty,O0=Object.prototype.propertyIsEnumerable,rh=(r,t,e)=>t in r?w0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dn=(r,t)=>{for(var e in t||(t={}))C0.call(t,e)&&rh(r,e,t[e]);if(eh)for(var e of eh(t))O0.call(t,e)&&rh(r,e,t[e]);return r},G0=(r,t)=>R0(r,M0(t));const Ti=class Uy extends et{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Dn(Dn({},Uy.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=(e=t.alphaMode)!=null?e:"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=ct.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Fn(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ct.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(ct.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ct.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Ti.extension=x.TextureSource,Ti.defaultOptions=G0(Dn({},et.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),Ti.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let br=Ti,B0=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const i=Mt(t);let s;for(let l=0;l{n.set(l,e)});const o=[...n.keys()],a={cacheKeys:o,keys:i};i.forEach(l=>{this._cacheMap.set(l,a)}),o.forEach(l=>{const u=s?s[l]:e;this._cache.has(l)&&this._cache.get(l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}};const K=new B0,Un=[];U.handleByList(x.TextureSource,Un);function I0(r={}){return kn(r)}function kn(r={}){const t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s{K.has(i)&&K.remove(i)}),t||K.set(i,n),n}function sh(r,t=!1){return typeof r=="string"?K.get(r):r instanceof et?new P({source:r}):ih(r,t)}P.from=sh,et.from=kn,U.add(On,Gn,Bn,br,_e,Kt,bi);class Ht{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var i,s;const n=this.resources[e];t!==n&&(n&&((i=t.off)==null||i.call(t,"change",this.onResourceChange,this)),(s=t.on)==null||s.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var t;const e=this.resources;for(const i in e){const s=e[i];(t=s.off)==null||t.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}let yr;function $n(){return(!yr||yr!=null&&yr.isContextLost())&&(yr=$.get().createCanvas().getContext("webgl",{})),yr}const F0=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(` +`);function D0(r){let t="";for(let e=0;e0&&(t+=` +else `),e>>=0;return oh[e]||U0(r,t,e)}let Ln=0;function U0(r,t,e){const i={};let s=0;Ln||(Ln=be());for(let o=0;o0){const n=new Uint8Array(r,e*8,s);new Uint8Array(t,e*8,s).set(n)}}const ah={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var nt=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",r[r.NONE=4]="NONE",r))(nt||{});function vr(r,t){return t.alphaMode==="no-premultiply-alpha"&&ah[r]||r}class lh{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;tt in r?k0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hh=(r,t)=>{for(var e in t||(t={}))$0.call(t,e)&&ch(r,e,t[e]);if(uh)for(var e of uh(t))L0.call(t,e)&&ch(r,e,t[e]);return r};class dh{constructor(){this.renderPipeId="batch",this.action="http://github.com/startBatch",this.start=0,this.size=0,this.textures=new lh,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const ph=[];let Hn=0;function fh(){return Hn>0?ph[--Hn]:new dh}function mh(r){ph[Hn++]=r}let xr=0;const gh=class tn{constructor(t={}){this.uid=Q("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[];var e;tn.defaultOptions.maxTextures=(e=tn.defaultOptions.maxTextures)!=null?e:be(),t=hh(hh({},tn.defaultOptions),t);const{maxTextures:i,attributesInitialSize:s,indicesInitialSize:n}=t;this.attributeBuffer=new Nn(s*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;tthis.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,l=this.attributeBuffer.uint32View,u=this.indexBuffer;let c=this._batchIndexSize,h=this._batchIndexStart,p="startBatch";const f=this.maxTextures;for(let m=this.elementStart;m=f||v)&&(this._finishBatch(i,h,c-h,s,o,t,p),p="renderBatch",h=c,o=b,i=fh(),s=i.textures,s.clear(),++xr),_._textureId=g._textureBindLocation=s.count,s.ids[g.uid]=s.count,s.textures[s.count++]=g,_._batch=i,c+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,a,l,_._attributeStart,_._textureId),this.packQuadIndex(u,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,a,l,_._attributeStart,_._textureId),this.packIndex(_,u,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,h,c-h,s,o,t,p),h=c,++xr),this.elementStart=this.elementSize,this._batchIndexStart=h,this._batchIndexSize=c}_finishBatch(t,e,i,s,n,o,a){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=s,t.blendMode=n,t.start=e,t.size=i,++xr,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new Nn(e);Ei(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(j||{});class xt extends ft{constructor(t){let{data:e,size:i}=t;const{usage:s,label:n,shrinkToFit:o}=t;super(),this.uid=Q("buffer"),this._resourceType="buffer",this._resourceId=Q("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i!=null?i:e==null?void 0:e.byteLength;const a=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:a,label:n},this.shrinkToFit=o!=null?o:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&j.STATIC)}set static(t){t?this.descriptor.usage|=j.STATIC:this.descriptor.usage&=~j.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const s=this._data;if(this._data=t,s.length!==t.length){!this.shrinkToFit&&t.byteLengtha&&(a=f),m>l&&(l=m),fe.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const H0=new Float32Array(1),X0=new Uint32Array(1);class yh extends De{constructor(){const t=new xt({data:H0,label:"attribute-batch-buffer",usage:j.VERTEX|j.COPY_DST,shrinkToFit:!1}),e=new xt({data:X0,label:"index-batch-buffer",usage:j.INDEX|j.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:20}},indexBuffer:e})}}const jn=Object.create(null),vh=Object.create(null);function Ue(r,t){let e=vh[r];return e===void 0&&(jn[t]===void 0&&(jn[t]=1),vh[r]=e=jn[t]++),e}let Ai;function xh(){if(!Ai){Ai="mediump";const r=$n();r&&r.getShaderPrecisionFormat&&(Ai=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return Ai}function Th(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in varying + #define finalColor gl_FragColor + #define texture texture2D + #endif + ${r} + `):` + + #ifdef GL_ES // This checks if it is WebGL1 + #define in attribute + #define out varying + #endif + ${r} + `}function Sh(r,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float; +${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function Eh(r,t){return t?`#version 300 es +${r}`:r}const j0={},z0={};function Ah(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?j0:z0;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`} +${r}`}function Ph(r,t){return t?r.replace("#version 300 es",""):r}var V0=Object.defineProperty,wh=Object.getOwnPropertySymbols,W0=Object.prototype.hasOwnProperty,Y0=Object.prototype.propertyIsEnumerable,Rh=(r,t,e)=>t in r?V0(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mh=(r,t)=>{for(var e in t||(t={}))W0.call(t,e)&&Rh(r,e,t[e]);if(wh)for(var e of wh(t))Y0.call(t,e)&&Rh(r,e,t[e]);return r};const zn={stripVersion:Ph,ensurePrecision:Sh,addProgramDefines:Th,setProgramName:Ah,insertVersion:Eh},Vn=Object.create(null),Ch=class vu{constructor(t){t=Mh(Mh({},vu.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:xh()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let s=t.fragment,n=t.vertex;Object.keys(zn).forEach(o=>{const a=i[o];s=zn[o](s,a,!0),n=zn[o](n,a,!1)}),this.fragment=s,this.vertex=n,this._key=Ue(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Vn[e]||(Vn[e]=new vu(t)),Vn[e]}};Ch.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let Ct=Ch;const Oh={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function ke(r){var t;return(t=Oh[r])!=null?t:Oh.float32}const K0={f32:"float32","vec2":"float32x2","vec3":"float32x3","vec4":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2":"sint32x2","vec3":"sint32x3","vec4":"sint32x4",u32:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4",bool:"uint32","vec2":"uint32x2","vec3":"uint32x3","vec4":"uint32x4"};function Gh({source:r,entryPoint:t}){var e;const i={},s=r.indexOf(`fn ${t}`);if(s!==-1){const n=r.indexOf("->",s);if(n!==-1){const o=r.substring(s,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let l;for(;(l=a.exec(o))!==null;){const u=(e=K0[l[3]])!=null?e:"float32";i[l[2]]={location:parseInt(l[1],10),format:u,stride:ke(u).stride,offset:0,instance:!1,start:0}}}}return i}function Pi(r){var t,e,i;const s=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,o=/@binding\((\d+)\)/,a=/var(<[^>]+>)? (\w+)/,l=/:\s*(\w+)/,u=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,p=(t=r.match(s))==null?void 0:t.map(m=>({group:parseInt(m.match(n)[1],10),binding:parseInt(m.match(o)[1],10),name:m.match(a)[2],isUniform:m.match(a)[1]==="",type:m.match(l)[1]}));if(!p)return{groups:[],structs:[]};const f=(i=(e=r.match(u))==null?void 0:e.map(m=>{const _=m.match(h)[1],g=m.match(c).reduce((b,v)=>{const[y,T]=v.split(":");return b[y.trim()]=T.trim(),b},{});return g?{name:_,members:g}:null}).filter(({name:m})=>p.some(_=>_.type===m)))!=null?i:[];return{groups:p,structs:f}}var $e=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))($e||{});function Bh({groups:r}){const t=[];for(let e=0;ee.has(o.name)?!1:(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return i.has(a)?!1:(i.add(a),!0)});return{structs:s,groups:n}}const Wn=Object.create(null);class Tt{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,i;const{fragment:s,vertex:n,layout:o,gpuLayout:a,name:l}=t;if(this.name=l,this.fragment=s,this.vertex=n,s.source===n.source){const u=Pi(s.source);this.structsAndGroups=u}else{const u=Pi(n.source),c=Pi(s.source);this.structsAndGroups=Fh(u,c)}this.layout=o!=null?o:Ih(this.structsAndGroups),this.gpuLayout=a!=null?a:Bh(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((i=this.layout[1])==null?void 0:i.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=Ue(i,"program")}get attributeData(){var t;return(t=this._attributeData)!=null||(this._attributeData=Gh(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return Wn[e]||(Wn[e]=new Tt(t)),Wn[e]}}function Yn(r,t,e){if(r)for(const i in r){const s=i.toLocaleLowerCase(),n=t[s];if(n){let o=r[i];i==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}}}const Dh=/\{\{(.*?)\}\}/g;function Kn(r){var t,e;const i={};return((e=(t=r.match(Dh))==null?void 0:t.map(s=>s.replace(/[{()}]/g,"")))!=null?e:[]).forEach(s=>{i[s]=[]}),i}function Uh(r,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function qn(r,t,e=!1){const i=[];Uh(t,i),r.forEach(a=>{a.header&&Uh(a.header,i)});const s=i;e&&s.sort();const n=s.map((a,l)=>` @location(${l}) ${a},`).join(` +`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",` +${n} +`),o}function kh(r,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function q0(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function Z0(r){const t=/@.*?\s+/g;return r.replace(t,"")}function $h(r,t){const e=[];kh(t,e),r.forEach(l=>{l.header&&kh(l.header,e)});let i=0;const s=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${i++}) ${l}`).join(`, +`),n=e.sort().map(l=>` var ${Z0(l)};`).join(` +`),o=`return VSOutput( + ${e.sort().map(l=>` ${q0(l)}`).join(`, +`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",` +${s} +`),a=a.replace("{{start}}",` +${n} +`),a=a.replace("{{return}}",` +${o} +`),a}function Zn(r,t){let e=r;for(const i in t){const s=t[i];s.join(` +`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----// +${s.join(` +`)} +//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const ye=Object.create(null),Qn=new Map;let Q0=0;function Lh({template:r,bits:t}){const e=Hh(r,t);if(ye[e])return ye[e];const{vertex:i,fragment:s}=J0(r,t);return ye[e]=Xh(i,s,t),ye[e]}function Nh({template:r,bits:t}){const e=Hh(r,t);return ye[e]||(ye[e]=Xh(r.vertex,r.fragment,t)),ye[e]}function J0(r,t){const e=t.map(o=>o.vertex).filter(o=>!!o),i=t.map(o=>o.fragment).filter(o=>!!o);let s=qn(e,r.vertex,!0);s=$h(e,s);const n=qn(i,r.fragment,!0);return{vertex:s,fragment:n}}function Hh(r,t){return t.map(e=>(Qn.has(e)||Qn.set(e,Q0++),Qn.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function Xh(r,t,e){const i=Kn(r),s=Kn(t);return e.forEach(n=>{Yn(n.vertex,i,n.name),Yn(n.fragment,s,n.name)}),{vertex:Zn(r,i),fragment:Zn(t,s)}}const jh=` + @in aPosition: vec2; + @in aUV: vec2; + + @out @builtin(position) vPosition: vec4; + @out vUV : vec2; + @out vColor : vec4; + + {{header}} + + struct VSOutput { + {{struct}} + }; + + @vertex + fn main( {{in}} ) -> VSOutput { + + var worldTransformMatrix = globalUniforms.uWorldTransformMatrix; + var modelMatrix = mat3x3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + var position = aPosition; + var uv = aUV; + + {{start}} + + vColor = vec4(1., 1., 1., 1.); + + {{main}} + + vUV = uv; + + var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix; + + vPosition = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= globalUniforms.uWorldColorAlpha; + + {{end}} + + {{return}} + }; +`,zh=` + @in vUV : vec2; + @in vColor : vec4; + + {{header}} + + @fragment + fn main( + {{in}} + ) -> @location(0) vec4 { + + {{start}} + + var outColor:vec4; + + {{main}} + + var finalColor:vec4 = outColor * vColor; + + {{end}} + + return finalColor; + }; +`,Vh=` + in vec2 aPosition; + in vec2 aUV; + + out vec4 vColor; + out vec2 vUV; + + {{header}} + + void main(void){ + + mat3 worldTransformMatrix = uWorldTransformMatrix; + mat3 modelMatrix = mat3( + 1.0, 0.0, 0.0, + 0.0, 1.0, 0.0, + 0.0, 0.0, 1.0 + ); + vec2 position = aPosition; + vec2 uv = aUV; + + {{start}} + + vColor = vec4(1.); + + {{main}} + + vUV = uv; + + mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix; + + gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0); + + vColor *= uWorldColorAlpha; + + {{end}} + } +`,Wh=` + + in vec4 vColor; + in vec2 vUV; + + out vec4 finalColor; + + {{header}} + + void main(void) { + + {{start}} + + vec4 outColor; + + {{main}} + + finalColor = outColor * vColor; + + {{end}} + } +`,Yh={name:"global-uniforms-bit",vertex:{header:` + struct GlobalUniforms { + uProjectionMatrix:mat3x3, + uWorldTransformMatrix:mat3x3, + uWorldColorAlpha: vec4, + uResolution: vec2, + } + + @group(0) @binding(0) var globalUniforms : GlobalUniforms; + `}},tx={name:"global-uniforms-ubo-bit",vertex:{header:` + uniform globalUniforms { + mat3 uProjectionMatrix; + mat3 uWorldTransformMatrix; + vec4 uWorldColorAlpha; + vec2 uResolution; + }; + `}},Kh={name:"global-uniforms-bit",vertex:{header:` + uniform mat3 uProjectionMatrix; + uniform mat3 uWorldTransformMatrix; + uniform vec4 uWorldColorAlpha; + uniform vec2 uResolution; + `}};var ex=Object.defineProperty,qh=Object.getOwnPropertySymbols,rx=Object.prototype.hasOwnProperty,ix=Object.prototype.propertyIsEnumerable,Zh=(r,t,e)=>t in r?ex(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,sx=(r,t)=>{for(var e in t||(t={}))rx.call(t,e)&&Zh(r,e,t[e]);if(qh)for(var e of qh(t))ix.call(t,e)&&Zh(r,e,t[e]);return r};function Le({bits:r,name:t}){const e=Lh({template:{fragment:zh,vertex:jh},bits:[Yh,...r]});return Tt.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function Ne({bits:r,name:t}){return new Ct(sx({name:t},Nh({template:{vertex:Vh,fragment:Wh},bits:[Kh,...r]})))}const wi={name:"color-bit",vertex:{header:` + @in aColor: vec4; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},Ri={name:"color-bit",vertex:{header:` + in vec4 aColor; + `,main:` + vColor *= vec4(aColor.rgb * aColor.a, aColor.a); + `}},Jn={};function nx(r){const t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let i=0;i;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(` +`)}function ox(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e; + @out @interpolate(flat) vTextureId : u32; + `,main:` + vTextureId = aTextureIdAndRound.y; + `,end:` + if(aTextureIdAndRound.x == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + @in @interpolate(flat) vTextureId: u32; + + ${nx(r)} + `,main:` + var uvDx = dpdx(vUV); + var uvDy = dpdy(vUV); + + ${ox(r)} + `}}),Jn[r]}const to={};function ax(r){const t=[];for(let e=0;e0&&t.push("else"),e, targetSize: vec2) -> vec2 + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},Xe={name:"round-pixels-bit",vertex:{header:` + vec2 roundPixels(vec2 position, vec2 targetSize) + { + return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0; + } + `}},eo=["f32","i32","vec2","vec3","vec4","mat2x2","mat3x3","mat4x4","mat3x2","mat4x2","mat2x3","mat4x3","mat2x4","mat3x4"],Qh=eo.reduce((r,t)=>(r[t]=!0,r),{});function Jh(r,t){switch(r){case"f32":return 0;case"vec2":return new Float32Array(2*t);case"vec3":return new Float32Array(3*t);case"vec4":return new Float32Array(4*t);case"mat2x2":return new Float32Array([1,0,0,1]);case"mat3x3":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var lx=Object.defineProperty,td=Object.getOwnPropertySymbols,ux=Object.prototype.hasOwnProperty,cx=Object.prototype.propertyIsEnumerable,ed=(r,t,e)=>t in r?lx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rd=(r,t)=>{for(var e in t||(t={}))ux.call(t,e)&&ed(r,e,t[e]);if(td)for(var e of td(t))cx.call(t,e)&&ed(r,e,t[e]);return r};const id=class ky{constructor(t,e){this._touched=0,this.uid=Q("uniform"),this._resourceType="uniformGroup",this._resourceId=Q("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var i,s;e=rd(rd({},ky.defaultOptions),e),this.uniformStructures=t;const n={};for(const o in t){const a=t[o];if(a.name=o,a.size=(i=a.size)!=null?i:1,!Qh[a.type])throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: ${eo.join(", ")}`);(s=a.value)!=null||(a.value=Jh(a.type,a.size)),n[o]=a.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=Ue(Object.keys(n).map(o=>`${o}-${t[o].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};id.defaultOptions={ubo:!1,isStatic:!1};let st=id;const sd={};function Oi(r){let t=sd[r];if(t)return t;const e=new Int32Array(r);for(let i=0;i(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(gt||{}),hx=Object.defineProperty,Gi=Object.getOwnPropertySymbols,nd=Object.prototype.hasOwnProperty,od=Object.prototype.propertyIsEnumerable,ad=(r,t,e)=>t in r?hx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dx=(r,t)=>{for(var e in t||(t={}))nd.call(t,e)&&ad(r,e,t[e]);if(Gi)for(var e of Gi(t))od.call(t,e)&&ad(r,e,t[e]);return r},px=(r,t)=>{var e={};for(var i in r)nd.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Gi)for(var i of Gi(r))t.indexOf(i)<0&&od.call(r,i)&&(e[i]=r[i]);return e};class Ot extends ft{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=i,o===void 0&&(o=0,e&&(o|=gt.WEBGPU),i&&(o|=gt.WEBGL)),this.compatibleRenderers=o;const l={};if(!n&&!s&&(n={}),n&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&a)for(const u in a)for(const c in a[u]){const h=a[u][c];l[h]={group:u,binding:c,name:h}}else if(e&&s&&!a){const u=e.structsAndGroups.groups;a={},u.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c})}else if(n){s={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,l[c.name]=c});let u=0;for(const c in n)l[c]||(s[99]||(s[99]=new Ht,this._ownedBindGroups.push(s[99])),l[c]={group:99,binding:u,name:c},a[99]=a[99]||{},a[99][u]=c,u++);for(const c in n){const h=c;let p=n[c];!p.source&&!p._resourceType&&(p=new st(p));const f=l[h];f&&(s[f.group]||(s[f.group]=new Ht,this._ownedBindGroups.push(s[f.group])),s[f.group].setResource(p,f.binding))}}this.groups=s,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(s,l)}addResource(t,e,i){var s,n;(s=this._uniformBindMap)[e]||(s[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Ht,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const s in e){const n=e[s];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return i}destroy(t=!1){var e,i;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:i,gl:s}=e,n=px(e,["gpu","gl"]);let o,a;return i&&(o=Tt.from(i)),s&&(a=Ct.from(s)),new Ot(dx({gpuProgram:o,glProgram:a},n))}}class ld extends Ot{constructor(t){const e=Ne({name:"batch",bits:[Ri,Ci(t),Xe]}),i=Le({name:"batch",bits:[wi,Mi(t),He]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:Oi(t)}})}}let ud=null;const cd=class $y extends _h{constructor(){super(...arguments),this.geometry=new yh,this.shader=ud||(ud=new ld(this.maxTextures)),this.name=$y.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,n){const o=n<<16|t.roundPixels&65535,a=t.transform,l=a.a,u=a.b,c=a.c,h=a.d,p=a.tx,f=a.ty,{positions:m,uvs:_}=t,g=t.color,b=t.attributeOffset,v=b+t.attributeSize;for(let y=b;y>16&255,i=r>>8&255,s=r&255,n=t>>16&255,o=t>>8&255,a=t&255,l=e*n/255,u=i*o/255,c=s*a/255;return(l<<16)+(u<<8)+c}const mx=new G;class Fi{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?pd(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||mx}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0,this.renderable=null}}var gx=Object.defineProperty,_x=Object.defineProperties,bx=Object.getOwnPropertyDescriptors,fd=Object.getOwnPropertySymbols,yx=Object.prototype.hasOwnProperty,vx=Object.prototype.propertyIsEnumerable,md=(r,t,e)=>t in r?gx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Di=(r,t)=>{for(var e in t||(t={}))yx.call(t,e)&&md(r,e,t[e]);if(fd)for(var e of fd(t))vx.call(t,e)&&md(r,e,t[e]);return r},Ui=(r,t)=>_x(r,bx(t));const qt={extension:{type:x.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,n,o,a;if(r.type==="circle"){const T=r;e=T.x,i=T.y,o=a=T.radius,s=n=0}else if(r.type==="ellipse"){const T=r;e=T.x,i=T.y,o=T.halfWidth,a=T.halfHeight,s=n=0}else{const T=r,E=T.width/2,R=T.height/2;e=T.x+E,i=T.y+R,o=a=Math.max(0,Math.min(T.radius,Math.min(E,R))),s=E-o,n=R-a}if(!(o>=0&&a>=0&&s>=0&&n>=0))return t;const l=Math.ceil(2.3*Math.sqrt(o+a)),u=l*8+(s?4:0)+(n?4:0);if(u===0)return t;if(l===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n,t;let c=0,h=l*4+(s?2:0)+2,p=h,f=u,m=s+o,_=n,g=e+m,b=e-m,v=i+_;if(t[c++]=g,t[c++]=v,t[--h]=v,t[--h]=b,n){const T=i-_;t[p++]=b,t[p++]=T,t[--f]=T,t[--f]=g}for(let T=1;T0&&(s[n++]=l,s[n++]=u,s[n++]=l-1),l++;s[n++]=u+1,s[n++]=u,s[n++]=l-1}},gd=Ui(Di({},qt),{extension:Ui(Di({},qt.extension),{name:"ellipse"})}),_d=Ui(Di({},qt),{extension:Ui(Di({},qt.extension),{name:"roundedRectangle"})}),bd=1e-4,no=1e-4;function yd(r){const t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],n=r[t-1];ih&&(h+=Math.PI*2);let p=c;const f=h-c,m=Math.abs(f),_=Math.sqrt(l*l+u*u),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=f/g;if(p+=b,a){o.push(r,t),o.push(e,i);for(let v=1,y=p;v=0&&(c.join==="round"?v+=ve(S,A,S-O*I,A-B*I,S-q*I,A-N*I,g,!1)+4:v+=2,g.push(S-q*D,A-N*D),g.push(S+q*I,A+N*I));continue}const Gy=(-O+w)*(-B+A)-(-O+S)*(-B+M),By=(-q+X)*(-N+A)-(-q+S)*(-N+L),Qs=(ue*By-ei*Gy)/Zs,Js=(ri*Gy-ti*By)/Zs,bu=(Qs-S)*(Qs-S)+(Js-A)*(Js-A),Pe=S+(Qs-S)*I,we=A+(Js-A)*I,Re=S-(Qs-S)*D,Me=A-(Js-A)*D,Iw=Math.min(ue*ue+ti*ti,ei*ei+ri*ri),Iy=ii?I:D,Fw=Iw+Iy*Iy*E;bu<=Fw?c.join==="bevel"||bu/E>R?(ii?(g.push(Pe,we),g.push(S+O*D,A+B*D),g.push(Pe,we),g.push(S+q*D,A+N*D)):(g.push(S-O*I,A-B*I),g.push(Re,Me),g.push(S-q*I,A-N*I),g.push(Re,Me)),v+=2):c.join==="round"?ii?(g.push(Pe,we),g.push(S+O*D,A+B*D),v+=ve(S,A,S+O*D,A+B*D,S+q*D,A+N*D,g,!0)+4,g.push(Pe,we),g.push(S+q*D,A+N*D)):(g.push(S-O*I,A-B*I),g.push(Re,Me),v+=ve(S,A,S-O*I,A-B*I,S-q*I,A-N*I,g,!1)+4,g.push(S-q*I,A-N*I),g.push(Re,Me)):(g.push(Pe,we),g.push(Re,Me)):(g.push(S-O*I,A-B*I),g.push(S+O*D,A+B*D),c.join==="round"?ii?v+=ve(S,A,S+O*D,A+B*D,S+q*D,A+N*D,g,!0)+2:v+=ve(S,A,S-O*I,A-B*I,S-q*I,A-N*I,g,!1)+2:c.join==="miter"&&bu/E<=R&&(ii?(g.push(Re,Me),g.push(Re,Me)):(g.push(Pe,we),g.push(Pe,we)),v+=2),g.push(S-q*I,A-N*I),g.push(S+q*D,A+N*D),v+=2)}w=r[(b-2)*2],M=r[(b-2)*2+1],S=r[(b-1)*2],A=r[(b-1)*2+1],O=-(M-A),B=w-S,At=Math.sqrt(O*O+B*B),O/=At,B/=At,O*=T,B*=T,g.push(S-O*I,A-B*I),g.push(S+O*D,A+B*D),m||(c.cap==="round"?v+=ve(S-O*(I-D)*.5,A-B*(I-D)*.5,S-O*I,A-B*I,S+O*D,A+B*D,g,!1)+2:c.cap==="square"&&(v+=vd(S,A,O,B,I,D,!1,g)));const Bw=no*no;for(let Z=y;Z80*e){a=u=r[0],l=c=r[1];for(var m=e;mu&&(u=h),p>c&&(c=p);f=Math.max(u-a,c-l),f=f!==0?32767/f:0}return Tr(n,o,e,a,l,f,0),o}function Td(r,t,e,i,s){var n,o;if(s===lo(r,t,e,i)>0)for(n=t;n=t;n-=i)o=Ad(n,r[n],r[n+1],o);return o&&Li(o,o.next)&&(Er(o),o=o.next),o}function xe(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(Li(e,e.next)||tt(e.prev,e,e.next)===0)){if(Er(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Tr(r,t,e,i,s,n,o){if(r){!o&&n&&Cx(r,i,s,n);for(var a=r,l,u;r.prev!==r.next;){if(l=r.prev,u=r.next,n?Tx(r,i,s,n):xx(r)){t.push(l.i/e|0),t.push(r.i/e|0),t.push(u.i/e|0),Er(r),r=u.next,a=u.next;continue}if(r=u,r===a){o?o===1?(r=Sx(xe(r),t,e),Tr(r,t,e,i,s,n,2)):o===2&&Ex(r,t,e,i,s,n):Tr(xe(r),t,e,i,s,n,1);break}}}}function xx(r){var t=r.prev,e=r,i=r.next;if(tt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,o=i.x,a=t.y,l=e.y,u=i.y,c=sn?s>o?s:o:n>o?n:o,f=a>l?a>u?a:u:l>u?l:u,m=i.next;m!==t;){if(m.x>=c&&m.x<=p&&m.y>=h&&m.y<=f&&je(s,a,n,l,o,u,m.x,m.y)&&tt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function Tx(r,t,e,i){var s=r.prev,n=r,o=r.next;if(tt(s,n,o)>=0)return!1;for(var a=s.x,l=n.x,u=o.x,c=s.y,h=n.y,p=o.y,f=al?a>u?a:u:l>u?l:u,g=c>h?c>p?c:p:h>p?h:p,b=oo(f,m,t,e,i),v=oo(_,g,t,e,i),y=r.prevZ,T=r.nextZ;y&&y.z>=b&&T&&T.z<=v;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&je(a,c,l,h,u,p,y.x,y.y)&&tt(y.prev,y,y.next)>=0||(y=y.prevZ,T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&je(a,c,l,h,u,p,T.x,T.y)&&tt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;y&&y.z>=b;){if(y.x>=f&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==o&&je(a,c,l,h,u,p,y.x,y.y)&&tt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;T&&T.z<=v;){if(T.x>=f&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==o&&je(a,c,l,h,u,p,T.x,T.y)&&tt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function Sx(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!Li(s,n)&&Sd(s,i,i.next,n)&&Sr(s,n)&&Sr(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),Er(i),Er(i.next),i=r=n),i=i.next}while(i!==r);return xe(i)}function Ex(r,t,e,i,s,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&Bx(o,a)){var l=Ed(o,a);o=xe(o,o.next),l=xe(l,l.next),Tr(o,t,e,i,s,n,0),Tr(l,t,e,i,s,n,0);return}a=a.next}o=o.next}while(o!==r)}function Ax(r,t,e,i){var s=[],n,o,a,l,u;for(n=0,o=t.length;n=e.next.y&&e.next.y!==e.y){var a=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=i&&a>n&&(n=a,o=e.x=e.x&&e.x>=u&&i!==e.x&&je(so.x||e.x===o.x&&Mx(o,e)))&&(o=e,h=p)),e=e.next;while(e!==l);return o}function Mx(r,t){return tt(r.prev,r,t.prev)<0&&tt(t.next,r,r.next)<0}function Cx(r,t,e,i){var s=r;do s.z===0&&(s.z=oo(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,Ox(s)}function Ox(r){var t,e,i,s,n,o,a,l,u=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,i=e,a=0,t=0;t0||l>0&&i;)a!==0&&(l===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,a--):(s=i,i=i.nextZ,l--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,u*=2}while(o>1);return r}function oo(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function Gx(r){var t=r,e=r;do(t.x=(r-o)*(n-a)&&(r-o)*(i-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(s-o)*(i-a)}function Bx(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!Ix(r,t)&&(Sr(r,t)&&Sr(t,r)&&Fx(r,t)&&(tt(r.prev,r,t.prev)||tt(r,t.prev,t))||Li(r,t)&&tt(r.prev,r,r.next)>0&&tt(t.prev,t,t.next)>0)}function tt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function Li(r,t){return r.x===t.x&&r.y===t.y}function Sd(r,t,e,i){var s=Hi(tt(r,t,e)),n=Hi(tt(r,t,i)),o=Hi(tt(e,i,r)),a=Hi(tt(e,i,t));return!!(s!==n&&o!==a||s===0&&Ni(r,e,t)||n===0&&Ni(r,i,t)||o===0&&Ni(e,r,i)||a===0&&Ni(e,t,i))}function Ni(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Hi(r){return r>0?1:r<0?-1:0}function Ix(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Sd(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Sr(r,t){return tt(r.prev,r,r.next)<0?tt(r,t,r.next)>=0&&tt(r,r.prev,t)>=0:tt(r,t,r.prev)<0||tt(r,r.next,t)<0}function Fx(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Ed(r,t){var e=new ao(r.i,r.x,r.y),i=new ao(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Ad(r,t,e,i){var s=new ao(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function Er(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ao(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}$i.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,o=Math.abs(lo(r,0,n,e));if(s)for(var a=0,l=t.length;a0&&(i+=r[s-1].length,e.holes.push(i))}return e};var Dx=ki.exports,Pd=sn(Dx);function uo(r,t,e,i,s,n,o){const a=Pd(r,t,2);if(!a)return;for(let u=0;u=0&&o>=0&&(t[0]=i,t[1]=s,t[2]=i+n,t[3]=s,t[4]=i+n,t[5]=s+o,t[6]=i,t[7]=s+o),t},triangulate(r,t,e,i,s,n){let o=0;i*=e,t[i+o]=r[0],t[i+o+1]=r[1],o+=e,t[i+o]=r[2],t[i+o+1]=r[3],o+=e,t[i+o]=r[6],t[i+o+1]=r[7],o+=e,t[i+o]=r[4],t[i+o+1]=r[5],o+=e;const a=i/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2,s[n++]=a+1,s[n++]=a+3,s[n++]=a+2}},po={extension:{type:x.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,n){let o=0;i*=e,t[i+o]=r[0],t[i+o+1]=r[1],o+=e,t[i+o]=r[2],t[i+o+1]=r[3],o+=e,t[i+o]=r[4],t[i+o+1]=r[5];const a=i/e;s[n++]=a,s[n++]=a+1,s[n++]=a+2}},Ar={};U.handleByMap(x.ShapeBuilder,Ar),U.add(ho,co,po,qt,gd,_d);const kx=new W;function wd(r,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s{var f;const m=l.length,_=o.length/2,g=[],b=Ar[c.type];if(b.build(c,g),h&&Ii(g,h),i){const E=(f=c.closePath)!=null?f:!0;xd(g,t,!1,E,o,2,_,l,m)}else if(e&&u===p){u!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const E=[],R=g.slice();Lx(e.shapePath).forEach(w=>{E.push(R.length/2),R.push(...w)}),uo(R,E,o,2,_,l,m)}else b.triangulate(g,o,2,_,l,m);const v=a.length/2,y=t.texture;if(y!==P.WHITE){const E=t.matrix;E&&(h&&E.append(h.clone().invert()),io(o,2,_,a,v,2,o.length/2-_,E))}else so(a,v,2,o.length/2-_);const T=H.get(Fi);T.indexOffset=m,T.indexSize=l.length-m,T.attributeOffset=_,T.attributeSize=o.length/2-_,T.baseColor=t.color,T.alpha=t.alpha,T.texture=y,T.geometryData=n,s.push(T)})}function Lx(r){if(!r)return[];const t=r.shapePrimitives,e=[];for(let i=0;i{H.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};fo.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"graphicsContext"},fo.defaultOptions={bezierSmoothness:.5};let Xi=fo;const Nx={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},mo=0,go=1,_o=2,bo=3,yo=4,vo=5,xo=class Ly{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<>16&255)/255,e[i++]=(r>>8&255)/255,e[i++]=(r&255)/255,e[i++]=t}function Pr(r,t,e){const i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}class To{constructor(t,e){this.state=Ft.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t._didGraphicsUpdate&&(t._didGraphicsUpdate=!1,this._rebuild(t)),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i{const a=H.get(Fi);return o.copyTo(a),a.renderable=t,a.roundPixels=s,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{H.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}}To.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"graphics"},U.add(To),U.add(Xi);class ji{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let i=e;const s=this.texture.textureMatrix;return s.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==s._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Ht({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){const n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;const o=this._getBatchableMesh(t),a=t.texture;if(o.texture._source!==a._source&&o.texture._source!==a._source)return!o._batcher.checkAndUpdateTexture(o,a)}return!1}addRenderable(t,e){const i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){const n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,i.addToBatch(n,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;const e=this._gpuBatchableMeshHash[t.uid];e&&(H.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=vr(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),Pr(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e,i;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:(e=t._geometry.indices)==null?void 0:e.length,vertexSize:(i=t._geometry.positions)==null?void 0:i.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=H.get(ji);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(const t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&H.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}So.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"mesh"},U.add(So);class zi{constructor(){this.batcherName="default",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}class Eo{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),i=t._getKey();if(e.currentKey!==i){const{width:s,height:n}=this._renderer.canvasText.getTextureSize(t.text,t.resolution,t._style);return!(this._renderer.canvasText.getReferenceCount(e.currentKey)===1&&s===e.texture._source.width&&n===e.texture._source.height)}return!1}addRenderable(t,e){const i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),H.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;const n=t._style.padding;_r(s.bounds,t._anchor,s.texture,n)}_updateGpuText(t){const e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:null,currentKey:"--",batchableSprite:H.get(zi)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}Eo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"text"};class Od{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=$.get().createCanvas();i.width=t,i.height=e;const s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=me(t),e=me(e);const s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let n=this._canvasPool[s].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:s}=e,n=(i<<17)+(s<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Xt=new Od;var Xx=Object.defineProperty,jx=Object.defineProperties,zx=Object.getOwnPropertyDescriptors,Gd=Object.getOwnPropertySymbols,Vx=Object.prototype.hasOwnProperty,Wx=Object.prototype.propertyIsEnumerable,Bd=(r,t,e)=>t in r?Xx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Yx=(r,t)=>{for(var e in t||(t={}))Vx.call(t,e)&&Bd(r,e,t[e]);if(Gd)for(var e of Gd(t))Wx.call(t,e)&&Bd(r,e,t[e]);return r},Kx=(r,t)=>jx(r,zx(t));let qx=0;class Id{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){const s=new et(Kx(Yx({},this.textureOptions),{width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!0}));return new P({source:s,label:`texturePool_${qx++}`})}getOptimalTexture(t,e,i=1,s){let n=Math.ceil(t*i-1e-6),o=Math.ceil(e*i-1e-6);n=me(n),o=me(o);const a=(n<<17)+(o<<1)+(s?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let l=this._texturePool[a].pop();return l||(l=this.createTexture(n,o,s)),l.source._resolution=i,l.source.width=n/i,l.source.height=o/i,l.source.pixelWidth=n,l.source.pixelHeight=o,l.frame.x=0,l.frame.y=0,l.frame.width=t,l.frame.height=e,l.updateUvs(),this._poolKeyHash[l.uid]=a,l}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let s=0;s`${s.offset}-${s.color}`).join("-"),e=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};kd.defaultTextureSize=256;let ze=kd;const $d={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class wr{constructor(t,e){this.uid=Q("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=$d[e].addressModeU,t.source.style.addressModeV=$d[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}var Zx=Jx,Ao={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},Qx=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function Jx(r){var t=[];return r.replace(Qx,function(e,i,s){var n=i.toLowerCase();for(s=e1(s),n=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(s.length==Ao[n])return s.unshift(i),t.push(s);if(s.length0&&(s=i.pop(),s?(n=s.startX,o=s.startY):(n=0,o=0)),s=null;break;default:}u!=="Z"&&u!=="z"&&s===null&&(s={startX:n,startY:o},i.push(s))}return t}class Vi{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Vi(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}strokeContains(t,e,i){if(this.radius===0)return!1;const s=this.x-t,n=this.y-e,o=this.radius,a=i/2,l=Math.sqrt(s*s+n*n);return lo-a}getBounds(t){return t=t||new W,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class Wi{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new Wi(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i){const{halfWidth:s,halfHeight:n}=this;if(s<=0||n<=0)return!1;const o=i/2,a=s-o,l=n-o,u=s+o,c=n+o,h=t-this.x,p=e-this.y,f=h*h/(a*a)+p*p/(l*l),m=h*h/(u*u)+p*p/(c*c);return f>1&&m<=1}getBounds(t){return t=t||new W,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}function Rr(r,t,e,i,s,n){const o=r-e,a=t-i,l=s-e,u=n-i,c=o*l+a*u,h=l*l+u*u;let p=-1;h!==0&&(p=c/h);let f,m;p<0?(f=e,m=i):p>1?(f=s,m=n):(f=e+p*l,m=i+p*u);const _=r-f,g=t-m;return _*_+g*g}class Ve{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;se!=c>e&&t<(u-a)*((e-l)/(c-l))+a&&(i=!i)}return i}strokeContains(t,e,i){const s=i/2,n=s*s,{points:o}=this,a=o.length-(this.closePath?0:2);for(let l=0;ls?u:s,n=co?c:o}return t.x=i,t.width=s-i,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Yi=(r,t,e,i,s,n)=>{const o=r-e,a=t-i,l=Math.sqrt(o*o+a*a);return l>=s-n&&l<=s+n};class Ki{constructor(t=0,e=0,i=0,s=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n}getBounds(t){return t=t||new W,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Ki(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(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){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const o=i*i;if(s*s+n*n<=o||(s=t-(this.x+this.width-i),s*s+n*n<=o)||(n=e-(this.y+this.height-i),s*s+n*n<=o)||(s=t-(this.x+i),s*s+n*n<=o))return!0}return!1}strokeContains(t,e,i){const{x:s,y:n,width:o,height:a,radius:l}=this,u=i/2,c=s+l,h=n+l,p=o-l*2,f=a-l*2,m=s+o,_=n+a;return(t>=s-u&&t<=s+u||t>=m-u&&t<=m+u)&&e>=h&&e<=h+f||(e>=n-u&&e<=n+u||e>=_-u&&e<=_+u)&&t>=c&&t<=c+p?!0:tm-l&&em-l&&e>_-l&&Yi(t,e,m-l,_-l,l,u)||t_-l&&Yi(t,e,c,_-l,l,u)}}const i1=8,qi=11920929e-14,s1=1,Po=.01,We=0,Te=0;function wo(r,t,e,i,s,n,o,a,l,u){const c=Math.min(.99,Math.max(0,u!=null?u:Xi.defaultOptions.bezierSmoothness));let h=(s1-c)/1;return h*=h,n1(t,e,i,s,n,o,a,l,r,h),r}function n1(r,t,e,i,s,n,o,a,l,u){Ro(r,t,e,i,s,n,o,a,l,u,0),l.push(o,a)}function Ro(r,t,e,i,s,n,o,a,l,u,c){if(c>i1)return;const h=Math.PI,p=(r+e)/2,f=(t+i)/2,m=(e+s)/2,_=(i+n)/2,g=(s+o)/2,b=(n+a)/2,v=(p+m)/2,y=(f+_)/2,T=(m+g)/2,E=(_+b)/2,R=(v+T)/2,w=(y+E)/2;if(c>0){let M=o-r,S=a-t;const A=Math.abs((e-o)*S-(i-a)*M),X=Math.abs((s-o)*S-(n-a)*M);let L,O;if(A>qi&&X>qi){if((A+X)*(A+X)<=u*(M*M+S*S)){if(We=h&&(L=2*h-L),O>=h&&(O=2*h-O),L+OTe){l.push(e,i);return}if(O>Te){l.push(s,n);return}}}}else if(A>qi){if(A*A<=u*(M*M+S*S)){if(We=h&&(L=2*h-L),LTe){l.push(e,i);return}}}else if(X>qi){if(X*X<=u*(M*M+S*S)){if(We=h&&(L=2*h-L),LTe){l.push(s,n);return}}}else if(M=R-(r+o)/2,S=w-(t+a)/2,M*M+S*S<=u){l.push(R,w);return}}Ro(r,t,p,f,v,y,R,w,l,u,c+1),Ro(R,w,T,E,g,b,o,a,l,u,c+1)}const o1=8,a1=11920929e-14,l1=1,u1=.01,Nd=0;function Hd(r,t,e,i,s,n,o,a){const l=Math.min(.99,Math.max(0,a!=null?a:Xi.defaultOptions.bezierSmoothness));let u=(l1-l)/1;return u*=u,c1(t,e,i,s,n,o,r,u),r}function c1(r,t,e,i,s,n,o,a){Mo(o,r,t,e,i,s,n,a,0),o.push(s,n)}function Mo(r,t,e,i,s,n,o,a,l){if(l>o1)return;const u=Math.PI,c=(t+i)/2,h=(e+s)/2,p=(i+n)/2,f=(s+o)/2,m=(c+p)/2,_=(h+f)/2;let g=n-t,b=o-e;const v=Math.abs((i-n)*b-(s-o)*g);if(v>a1){if(v*v<=a*(g*g+b*b)){if(Nd=u&&(y=2*u-y),yn||o&&n>s)&&(l=2*Math.PI-l),a=a||Math.max(6,Math.floor(6*Math.pow(i,.3333333333333333)*(l/Math.PI))),a=Math.max(a,3);let u=l/a,c=s;u*=o?-1:1;for(let h=0;hc*a)}const Mr=Math.PI*2,Oo={centerX:0,centerY:0,ang1:0,ang2:0},Go=({x:r,y:t},e,i,s,n,o,a,l)=>{r*=e,t*=i;const u=s*r-n*t,c=n*r+s*t;return l.x=u+o,l.y=c+a,l};function h1(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),n=Math.sin(r),o=Math.cos(r+t),a=Math.sin(r+t);return[{x:s-n*i,y:n+s*i},{x:o+a*i,y:a-o*i},{x:o,y:a}]}const jd=(r,t,e,i)=>{const s=r*i-t*e<0?-1:1;let n=r*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),s*Math.acos(n)},d1=(r,t,e,i,s,n,o,a,l,u,c,h,p)=>{const f=Math.pow(s,2),m=Math.pow(n,2),_=Math.pow(c,2),g=Math.pow(h,2);let b=f*m-f*g-m*_;b<0&&(b=0),b/=f*g+m*_,b=Math.sqrt(b)*(o===a?-1:1);const v=b*s/n*h,y=b*-n/s*c,T=u*v-l*y+(r+e)/2,E=l*v+u*y+(t+i)/2,R=(c-v)/s,w=(h-y)/n,M=(-c-v)/s,S=(-h-y)/n,A=jd(1,0,R,w);let X=jd(R,w,M,S);a===0&&X>0&&(X-=Mr),a===1&&X<0&&(X+=Mr),p.centerX=T,p.centerY=E,p.ang1=A,p.ang2=X};function zd(r,t,e,i,s,n,o,a=0,l=0,u=0){if(n===0||o===0)return;const c=Math.sin(a*Mr/360),h=Math.cos(a*Mr/360),p=h*(t-i)/2+c*(e-s)/2,f=-c*(t-i)/2+h*(e-s)/2;if(p===0&&f===0)return;n=Math.abs(n),o=Math.abs(o);const m=Math.pow(p,2)/Math.pow(n,2)+Math.pow(f,2)/Math.pow(o,2);m>1&&(n*=Math.sqrt(m),o*=Math.sqrt(m)),d1(t,e,i,s,n,o,l,u,c,h,p,f,Oo);let{ang1:_,ang2:g}=Oo;const{centerX:b,centerY:v}=Oo;let y=Math.abs(g)/(Mr/4);Math.abs(1-y)<1e-7&&(y=1);const T=Math.max(Math.ceil(y),1);g/=T;let E=r[r.length-2],R=r[r.length-1];const w={x:0,y:0};for(let M=0;M{const u=l.x-a.x,c=l.y-a.y,h=Math.sqrt(u*u+c*c),p=u/h,f=c/h;return{len:h,nx:p,ny:f}},n=(a,l)=>{a===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y)};let o=t[t.length-1];for(let a=0;a0&&(m=-1,_=!0);const g=f/2;let b,v=Math.abs(Math.cos(g)*u/Math.sin(g));v>Math.min(h.len/2,p.len/2)?(v=Math.min(h.len/2,p.len/2),b=Math.abs(v*Math.sin(g)/Math.cos(g))):b=u;const y=l.x+p.nx*v+-p.ny*b*m,T=l.y+p.ny*v+p.nx*b*m,E=Math.atan2(h.ny,h.nx)+Math.PI/2*m,R=Math.atan2(p.ny,p.nx)-Math.PI/2*m;a===0&&r.moveTo(y+Math.cos(E)*b,T+Math.sin(E)*b),r.arc(y,T,b,E,R,_),o=l}}function Wd(r,t,e,i){var s;const n=(l,u)=>Math.sqrt((l.x-u.x)**2+(l.y-u.y)**2),o=(l,u,c)=>({x:l.x+(u.x-l.x)*c,y:l.y+(u.y-l.y)*c}),a=t.length;for(let l=0;l=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,o)}ellipse(t,e,i,s,n){return this.drawShape(new Wi(t,e,i,s),n),this}roundRect(t,e,i,s,n,o){return this.drawShape(new Ki(t,e,i,s,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new Ve,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Ve,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=i;i=n.a*i+n.c*s+n.tx,s=n.b*o+n.d*s+n.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;et in r?f1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zi=(r,t)=>{for(var e in t||(t={}))m1.call(t,e)&&qd(r,e,t[e]);if(Kd)for(var e of Kd(t))g1.call(t,e)&&qd(r,e,t[e]);return r};function Zd(r,t){if(typeof r=="string"){const i=document.createElement("div");i.innerHTML=r.trim(),r=i.querySelector("svg")}const e={context:t,path:new te};return Qd(r,e,null,null),t}function Qd(r,t,e,i){const s=r.children,{fillStyle:n,strokeStyle:o}=_1(r);n&&e?e=Zi(Zi({},e),n):n&&(e=n),o&&i?i=Zi(Zi({},i),o):o&&(i=o),t.context.fillStyle=e,t.context.strokeStyle=i;let a,l,u,c,h,p,f,m,_,g,b,v,y,T,E,R,w;switch(r.nodeName.toLowerCase()){case"path":T=r.getAttribute("d"),E=new te(T),t.context.path(E),e&&t.context.fill(),i&&t.context.stroke();break;case"circle":f=at(r,"cx",0),m=at(r,"cy",0),_=at(r,"r",0),t.context.ellipse(f,m,_,_),e&&t.context.fill(),i&&t.context.stroke();break;case"rect":a=at(r,"x",0),l=at(r,"y",0),R=at(r,"width",0),w=at(r,"height",0),g=at(r,"rx",0),b=at(r,"ry",0),g||b?t.context.roundRect(a,l,R,w,g||b):t.context.rect(a,l,R,w),e&&t.context.fill(),i&&t.context.stroke();break;case"ellipse":f=at(r,"cx",0),m=at(r,"cy",0),g=at(r,"rx",0),b=at(r,"ry",0),t.context.beginPath(),t.context.ellipse(f,m,g,b),e&&t.context.fill(),i&&t.context.stroke();break;case"line":u=at(r,"x1",0),c=at(r,"y1",0),h=at(r,"x2",0),p=at(r,"y2",0),t.context.beginPath(),t.context.moveTo(u,c),t.context.lineTo(h,p),i&&t.context.stroke();break;case"polygon":y=r.getAttribute("points"),v=y.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!0),e&&t.context.fill(),i&&t.context.stroke();break;case"polyline":y=r.getAttribute("points"),v=y.match(/\d+/g).map(M=>parseInt(M,10)),t.context.poly(v,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}for(let M=0;Mt in r?b1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Zt=(r,t)=>{for(var e in t||(t={}))Jd.call(t,e)&&ep(r,e,t[e]);if(Qi)for(var e of Qi(t))tp.call(t,e)&&ep(r,e,t[e]);return r},y1=(r,t)=>{var e={};for(var i in r)Jd.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Qi)for(var i of Qi(r))t.indexOf(i)<0&&tp.call(r,i)&&(e[i]=r[i]);return e};function v1(r){return V.isColorLike(r)}function rp(r){return r instanceof wr}function ip(r){return r instanceof ze}function x1(r,t,e){const i=V.shared.setValue(t!=null?t:0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=P.WHITE,Zt(Zt({},e),r)}function sp(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Zt(Zt({},e),r)}function np(r,t,e){return t.buildLinearGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,Zt(Zt({},e),r)}function T1(r,t){var e;const i=Zt(Zt({},t),r);if(i.texture){if(i.texture!==P.WHITE){const o=((e=i.matrix)==null?void 0:e.invert())||new G;o.translate(i.texture.frame.x,i.texture.frame.y),o.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=o}const n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}const s=V.shared.setValue(i.color);return i.alpha*=s.alpha,i.color=s.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function ee(r,t){if(r==null)return null;const e={},i=r;return v1(r)?x1(e,r,t):rp(r)?sp(e,r,t):ip(r)?np(e,r,t):i.fill&&rp(i.fill)?sp(i,i.fill,t):i.fill&&ip(i.fill)?np(i,i.fill,t):T1(i,t)}function Or(r,t){const e=t,{width:i,alignment:s,miterLimit:n,cap:o,join:a}=e,l=y1(e,["width","alignment","miterLimit","cap","join"]),u=ee(r,l);return u?Zt({width:i,alignment:s,miterLimit:n,cap:o,join:a},u):null}var S1=Object.defineProperty,op=Object.getOwnPropertySymbols,E1=Object.prototype.hasOwnProperty,A1=Object.prototype.propertyIsEnumerable,ap=(r,t,e)=>t in r?S1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ye=(r,t)=>{for(var e in t||(t={}))E1.call(t,e)&&ap(r,e,t[e]);if(op)for(var e of op(t))A1.call(t,e)&&ap(r,e,t[e]);return r};const P1=new Y,lp=new G,Bo=class jt extends ft{constructor(){super(...arguments),this.uid=Q("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new te,this._transform=new G,this._fillStyle=Ye({},jt.defaultFillStyle),this._strokeStyle=Ye({},jt.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new ut,this._boundsDirty=!0}clone(){const t=new jt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=Ye({},this._fillStyle),t._strokeStyle=Ye({},this._strokeStyle),t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=ee(t,jt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Or(t,jt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=ee(t,jt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=ee(t,jt.defaultStrokeStyle),this}texture(t,e,i,s,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new te,this}fill(t,e){let i;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=ee(t,jt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(Y.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Or(t,jt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,i,s,n,o),this}arcTo(t,e,i,s,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*s+o.tx,o.b*i+o.d*s+o.ty,n),this}arcToSvg(t,e,i,s,n,o,a){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,i,s,n,l.a*o+l.c*a+l.tx,l.b*o+l.d*a+l.ty),this}bezierCurveTo(t,e,i,s,n,o,a){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*i+l.c*s+l.tx,l.b*i+l.d*s+l.ty,l.a*n+l.c*o+l.tx,l.b*n+l.d*o+l.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,s=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,o=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=n,s[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,i,s,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*i+o.c*s+o.tx,o.b*i+o.d*s+o.ty,n),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,n){return this._tick++,this._activePath.roundRect(t,e,i,s,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,i,s,n,o),this}roundPoly(t,e,i,s,n,o){return this._tick++,this._activePath.roundPoly(t,e,i,s,n,o),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,n){return this._tick++,this._activePath.filletRect(t,e,i,s,n),this}chamferRect(t,e,i,s,n,o){return this._tick++,this._activePath.chamferRect(t,e,i,s,n,o),this}star(t,e,i,s,n=0,o=0){return this._tick++,this._activePath.star(t,e,i,s,n,o,this._transform.clone()),this}svg(t){return this._tick++,Zd(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:Ye({},this._fillStyle),strokeStyle:Ye({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,i,s,n,o){return t instanceof G?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,n,o),this)}transform(t,e,i,s,n,o){return t instanceof G?(this._transform.append(t),this):(lp.set(t,e,i,s,n,o),this._transform.append(lp),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;const t=this._bounds;t.clear();for(let e=0;et in r?M1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,St=(r,t)=>{for(var e in t||(t={}))G1.call(t,e)&&dp(r,e,t[e]);if(hp)for(var e of hp(t))B1.call(t,e)&&dp(r,e,t[e]);return r},I1=(r,t)=>C1(r,O1(t));const Fo=class nr extends ft{constructor(t={}){super(),F1(t);const e=St(St({},nr.defaultTextStyle),t);for(const i in e){const s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(St(St({},nr.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(St({},nr.defaultDropShadow)):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy(St(St({},dt.defaultFillStyle),t),()=>{this._fill=ee(St({},this._originalFill),dt.defaultFillStyle)})),this._fill=ee(t===0?"black":t,dt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(St(St({},dt.defaultStrokeStyle),t),()=>{this._stroke=Or(St({},this._originalStroke),dt.defaultStrokeStyle)})),this._stroke=Or(t,dt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Io(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=nr.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new nr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?St({},this._dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var e,i,s,n;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(o),(i=this._originalFill)!=null&&i.texture&&this._originalFill.texture.destroy(o),(s=this._stroke)!=null&&s.texture&&this._stroke.texture.destroy(o),(n=this._originalStroke)!=null&&n.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,n)=>(i[s]=n,e==null||e(s,n),this.update(),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(V.isColorLike(t)||t instanceof ze||t instanceof wr)}};Fo.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Fo.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Et=Fo;function F1(r){var t,e,i,s,n;const o=r;if(typeof o.dropShadow=="boolean"&&o.dropShadow){const a=Et.defaultDropShadow;r.dropShadow={alpha:(t=o.dropShadowAlpha)!=null?t:a.alpha,angle:(e=o.dropShadowAngle)!=null?e:a.angle,blur:(i=o.dropShadowBlur)!=null?i:a.blur,color:(s=o.dropShadowColor)!=null?s:a.color,distance:(n=o.dropShadowDistance)!=null?n:a.distance}}if(o.strokeThickness!==void 0){const a=o.stroke;let l={};if(V.isColorLike(a))l.color=a;else if(a instanceof ze||a instanceof wr)l.fill=a;else if(Object.hasOwnProperty.call(a,"color")||Object.hasOwnProperty.call(a,"fill"))l=a;else throw new Error("Invalid stroke value.");r.stroke=I1(St({},l),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let a;r.fontSize==null?r.fontSize=Et.defaultTextStyle.fontSize:typeof r.fontSize=="string"?a=parseInt(r.fontSize,10):a=r.fontSize;const l=new ze(0,0,0,a*1.7),u=o.fillGradientStops.map(c=>V.shared.setValue(c).toNumber());u.forEach((c,h)=>{const p=h/(u.length-1);l.addColorStop(p,c)}),r.fill={fill:l}}}const D1=new ut;function Do(r,t,e,i){const s=D1;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;const n=ht.getOptimalTexture(s.width,s.height,i,!1);return n.source.uploadMethodId="image",n.source.resource=r,n.source.alphaMode="premultiply-alpha-on-upload",n.frame.width=t/i,n.frame.height=e/i,n.source.emit("update",n.source),n.updateUvs(),n}const U1=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function Gr(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!U1.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const Uo={willReadFrequently:!0},Dt=class C{static get experimentalLetterSpacingSupported(){let t=C._experimentalLetterSpacingSupported;if(t!==void 0){const e=$.get().getCanvasRenderingContext2D().prototype;t=C._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,o,a,l,u){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=l,this.fontProperties=u}static measureText(t=" ",e,i=C._canvas,s=e.wordWrap){var n;const o=`${t}:${e.styleKey}`;if(C._measurementCache[o])return C._measurementCache[o];const a=Gr(e),l=C.measureFont(a);l.fontSize===0&&(l.fontSize=e.fontSize,l.ascent=e.fontSize);const u=C.__context;u.font=a;const c=(s?C._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(c.length);let p=0;for(let b=0;b0&&(s?n-=e:n+=(C.graphemeSegmenter(t).length-1)*e),n}static _wordWrap(t,e,i=C._canvas){const s=i.getContext("2d",Uo);let n=0,o="",a="";const l=Object.create(null),{letterSpacing:u,whiteSpace:c}=e,h=C._collapseSpaces(c),p=C._collapseNewlines(c);let f=!h;const m=e.wordWrapWidth+u,_=C._tokenize(t);for(let g=0;g<_.length;g++){let b=_[g];if(C._isNewline(b)){if(!p){a+=C._addLine(o),f=!h,o="",n=0;continue}b=" "}if(h){const y=C.isBreakingSpace(b),T=C.isBreakingSpace(o[o.length-1]);if(y&&T)continue}const v=C._getFromCache(b,u,l,s);if(v>m)if(o!==""&&(a+=C._addLine(o),o="",n=0),C.canBreakWords(b,e.breakWords)){const y=C.wordWrapSplit(b);for(let T=0;Tm&&(a+=C._addLine(o),f=!1,o="",n=0),o+=E,n+=M}}else{o.length>0&&(a+=C._addLine(o),o="",n=0);const y=g===_.length-1;a+=C._addLine(b,!y),f=!1,o="",n=0}else v+n>m&&(f=!1,a+=C._addLine(o),o="",n=0),(o.length>0||!C.isBreakingSpace(b)||f)&&(o+=b,n+=v)}return a+=C._addLine(o,!1),a}static _addLine(t,e=!0){return t=C._trimRight(t),t=e?`${t} +`:t,t}static _getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=C._measureText(t,e,s)+e,i[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!C.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:C._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:C._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),Dt.experimentalLetterSpacing=!1,Dt._fonts={},Dt._newlines=[10,13],Dt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Dt._measurementCache={};let Ut=Dt;function Br(r,t){var e;if(r.texture===P.WHITE&&!r.fill)return V.shared.setValue(r.color).setAlpha((e=r.alpha)!=null?e:1).toHexa();if(r.fill){if(r.fill instanceof wr){const i=r.fill,s=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(G.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(n),s}else if(r.fill instanceof ze){const i=r.fill;if(i.type==="linear"){const s=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{s.addColorStop(n.offset,V.shared.setValue(n.color).toHex())}),s}}}else{const i=t.createPattern(r.texture.source.resource,"repeat"),s=r.matrix.copyTo(G.shared);return s.scale(r.texture.frame.width,r.texture.frame.height),i.setTransform(s),i}return"red"}class ko{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){const s=Ut.measureText(t||" ",i);let n=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),o=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return n=Math.ceil(n-1e-6),o=Math.ceil(o-1e-6),n=me(n),o=me(o),{width:n,height:o}}getTexture(t,e,i,s){typeof t=="string"&&(ro("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Et||(t.style=new Et(t.style));const{texture:n,canvasAndContext:o}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Xt.returnCanvasAndContext(o),n}createTextureAndCanvas(t){var e;const{text:i,style:s}=t,n=(e=t.resolution)!=null?e:this._renderer.resolution,o=Ut.measureText(i||" ",s),a=Math.ceil(Math.ceil(Math.max(1,o.width)+s.padding*2)*n),l=Math.ceil(Math.ceil(Math.max(1,o.height)+s.padding*2)*n),u=Xt.getOptimalCanvasAndContext(a,l),{canvas:c}=u;this.renderTextToCanvas(i,s,n,u);const h=Do(c,a,l,n);if(s.trim){const p=Ud(c,n);h.frame.copyFrom(p),h.updateUvs()}return{texture:h,canvasAndContext:u}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const{texture:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Xt.returnCanvasAndContext(e.canvasAndContext),ht.returnTexture(e.texture);const i=e.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){var n,o,a,l,u,c,h;const{canvas:p,context:f}=s,m=Gr(e),_=Ut.measureText(t||" ",e),g=_.lines,b=_.lineHeight,v=_.lineWidths,y=_.maxLineWidth,T=_.fontProperties,E=p.height;f.resetTransform(),f.scale(i,i);const R=e.padding*2;if(f.clearRect(0,0,_.width+4+R,_.height+4+R),(n=e._stroke)!=null&&n.width){const A=e._stroke;f.lineWidth=A.width,f.miterLimit=A.miterLimit,f.lineJoin=A.join,f.lineCap=A.cap}f.font=m;let w,M;const S=e.dropShadow?2:1;for(let A=0;At in r?k1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$1=(r,t)=>{for(var e in t||(t={}))pp.call(t,e)&&mp(r,e,t[e]);if(Ji)for(var e of Ji(t))fp.call(t,e)&&mp(r,e,t[e]);return r},L1=(r,t)=>{var e={};for(var i in r)pp.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ji)for(var i of Ji(r))t.indexOf(i)<0&&fp.call(r,i)&&(e[i]=r[i]);return e};class Ke extends ge{constructor(t){t instanceof dt&&(t={context:t});const e=t||{},{context:i,roundPixels:s}=e,n=L1(e,["context","roundPixels"]);super($1({label:"Graphics"},n)),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new dt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=s!=null?s:!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new Ke(this._context.clone()):(this._ownedContext=null,new Ke(this._context))}lineStyle(t,e,i){const s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){const i={};return t&&(i.color=t),e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==dt.defaultStrokeStyle.width||t.color!==dt.defaultStrokeStyle.color||t.alpha!==dt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const gp={name:"local-uniform-msdf-bit",vertex:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32, + uRound:f32, + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `},fragment:{header:` + struct LocalUniforms { + uColor:vec4, + uTransformMatrix:mat3x3, + uDistance: f32 + } + + @group(2) @binding(0) var localUniforms : LocalUniforms; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance)); + `}},_p={name:"local-uniform-msdf-bit",vertex:{header:` + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix *= uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `},fragment:{header:` + uniform float uDistance; + `,main:` + outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance)); + `}},bp={name:"msdf-bit",fragment:{header:` + fn calculateMSDFAlpha(msdfColor:vec4, shapeColor:vec4, distance:f32) -> f32 { + + // MSDF + var median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + var screenPxDistance = distance * (median - 0.5); + var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + var luma: f32 = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + var gamma: f32 = mix(1.0, 1.0 / 2.2, luma); + var coverage: f32 = pow(shapeColor.a * alpha, gamma); + + return coverage; + + } + `}},yp={name:"msdf-bit",fragment:{header:` + float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) { + + // MSDF + float median = msdfColor.r + msdfColor.g + msdfColor.b - + min(msdfColor.r, min(msdfColor.g, msdfColor.b)) - + max(msdfColor.r, max(msdfColor.g, msdfColor.b)); + + // SDF + median = min(median, msdfColor.a); + + float screenPxDistance = distance * (median - 0.5); + float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0); + + if (median < 0.01) { + alpha = 0.0; + } else if (median > 0.99) { + alpha = 1.0; + } + + // Gamma correction for coverage-like alpha + float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114)); + float gamma = mix(1.0, 1.0 / 2.2, luma); + float coverage = pow(shapeColor.a * alpha, gamma); + + return coverage; + } + `}};let $o,Lo;class vp extends Ot{constructor(){const t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=be();$o!=null||($o=Le({name:"sdf-shader",bits:[wi,Mi(e),gp,bp,He]})),Lo!=null||(Lo=Ne({name:"sdf-shader",bits:[Ri,Ci(e),_p,yp,Xe]})),super({glProgram:Lo,gpuProgram:$o,resources:{localUniforms:t,batchSamplers:Oi(e)}})}}let No=0;const xp=500;function re(...r){No!==xp&&(No++,No===xp?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}class Ho extends ft{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}function Xo(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;et in r?N1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ep=(r,t)=>{for(var e in t||(t={}))H1.call(t,e)&&Sp(r,e,t[e]);if(Tp)for(var e of Tp(t))X1.call(t,e)&&Sp(r,e,t[e]);return r};const Ap=class Ny extends Ho{constructor(t){var e,i,s;super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;const n=Ep(Ep({},Ny.defaultOptions),t);this._textureSize=n.textureSize,this._mipmap=n.mipmap;const o=n.style.clone();n.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=P.WHITE,o._fill.fill=null),this.applyFillAsTint=n.overrideFill;const a=o.fontSize;o.fontSize=this.baseMeasurementFontSize;const l=Gr(o);n.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=(e=n.skipKerning)!=null?e:!1,this.resolution=(i=n.resolution)!=null?i:1,this._padding=(s=n.padding)!=null?s:4,this.fontMetrics=Ut.measureFont(l),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var e,i,s,n;const o=Xo(t).filter(y=>!this._currentChars.includes(y)).filter((y,T,E)=>E.indexOf(y)===T);if(!o.length)return;this._currentChars=[...this._currentChars,...o];let a;this._currentPageIndex===-1?a=this._nextPage():a=this.pages[this._currentPageIndex];let{canvas:l,context:u}=a.canvasAndContext,c=a.texture.source;const h=this._style;let p=this._currentX,f=this._currentY;const m=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*m,g=h.fontStyle==="italic"?2:1;let b=0,v=!1;for(let y=0;ythis._textureSize&&(f+=b,b=S,p=0,f+b>this._textureSize)){c.update();const X=this._nextPage();l=X.canvasAndContext.canvas,u=X.canvasAndContext.context,c=X.texture.source,f=0}const A=R/m-((i=(e=h.dropShadow)==null?void 0:e.distance)!=null?i:0)-((n=(s=h._stroke)==null?void 0:s.width)!=null?n:0);if(this.chars[T]={id:T.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:A,kerning:{}},v){this._drawGlyph(u,E,p+_,f+_,m,h);const X=c.width*m,L=c.height*m,O=new W(p/X*c.width,f/L*c.height,M/X*c.width,S/L*c.height);this.chars[T].texture=new P({source:c,frame:O}),p+=Math.ceil(M)}}c.update(),this._currentX=p,this._currentY=f,this._skipKerning&&this._applyKerning(o,u)}get pageTextures(){return this.pages}_applyKerning(t,e){const i=this._measureCache;for(let s=0;s{const _=n.width;for(let g=0;g{let m=n.chars.length-1;if(i){let _=n.chars[m];for(;_===" ";)n.width-=e.chars[_].xAdvance,_=n.chars[--m]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,s.lines.push(n),s.height+=e.lineHeight},h=e.baseMeasurementFontSize/t.fontSize,p=t.letterSpacing*h,f=t.wordWrapWidth*h;for(let m=0;mf?(c(),u(l),g||n.charPositions.push(0)):(l.start=n.width,u(l),g||n.charPositions.push(0)),_==="\r"||_===` +`)n.width!==0&&c();else if(!g){const v=b.xAdvance+(b.kerning[o]||0)+p;n.width+=v,n.spaceWidth=v,n.spacesIndex.push(n.charPositions.length),n.chars.push(_)}}else{const v=b.kerning[o]||0,y=b.xAdvance+v+p;l.positions[l.index++]=l.width+v,l.chars.push(_),l.width+=y}o=_}return c(),t.align==="center"?j1(s):t.align==="right"?z1(s):t.align==="justify"&&V1(s),s}function j1(r){for(let t=0;tt in r?W1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vo=(r,t)=>{for(var e in t||(t={}))Y1.call(t,e)&&wp(r,e,t[e]);if(Pp)for(var e of Pp(t))K1.call(t,e)&&wp(r,e,t[e]);return r};let ts=0,q1=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){var i;let s=`${e.fontFamily}-bitmap`,n=!0;if(e._fill.fill&&!e._stroke)s+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let a=e.styleKey;a=a.substring(0,a.lastIndexOf("-")),s=`${a}-bitmap`,n=!1}if(!K.has(s)){const a=new jo(Vo({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions));ts++,ts>50&&re("BitmapText",`You have dynamically created ${ts} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{ts--,K.remove(s)}),K.set(s,a)}const o=K.get(s);return(i=o.ensureCharacters)==null||i.call(o,t),o}getLayout(t,e,i=!0){const s=this.getFont(t,e);return zo([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var e,i,s,n;let o=t[0];typeof o=="string"&&(o={name:o,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(i=t[2])==null?void 0:i.resolution,padding:(s=t[2])==null?void 0:s.padding,skipKerning:(n=t[2])==null?void 0:n.skipKerning});const a=o==null?void 0:o.name;if(!a)throw new Error("[BitmapFontManager] Property `name` is required.");o=Vo(Vo({},this.defaultOptions),o);const l=o.style,u=l instanceof Et?l:new Et(l),c=u._fill.fill!==null&&u._fill.fill!==void 0,h=new jo({style:u,overrideFill:c,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1}),p=Xo(o.chars);return h.ensureCharacters(p.join("")),K.set(`${a}-bitmap`,h),h.once("destroy",()=>K.remove(`${a}-bitmap`)),h}uninstall(t){const e=`${t}-bitmap`,i=K.get(e);i&&(K.remove(e),i.destroy())}};const Ir=new q1;class Wo{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const i=this._getGpuBitmapText(t);Rp(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){const e=this._gpuBitmapText[t].context;e.customShader&&(H.return(e.customShader),e.customShader=null),H.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){const e=this._getGpuBitmapText(t);Rp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:i}=e,s=Ir.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=H.get(vp)));const n=Array.from(t.text),o=t._style;let a=s.baseLineOffset;const l=zo(n,o,s,!0);let u=0;const c=o.padding,h=l.scale;let p=l.width,f=l.height+l.offsetY;o._stroke&&(p+=o._stroke.width/h,f+=o._stroke.width/h),i.translate(-t._anchor._x*p-c,-t._anchor._y*f-c).scale(h,h);const m=s.applyFillAsTint?o._fill.color:16777215;for(let _=0;_{console.error(o)}),t._didTextUpdate=!1;const n=t._style.padding;_r(s.bounds,t._anchor,s.texture,n)}async _updateGpuText(t){var e;t._didTextUpdate=!1;const i=this._getGpuText(t);if(i.generatingTexture)return;const s=t._getKey();this._renderer.htmlText.decreaseReferenceCount(i.currentKey),i.generatingTexture=!0,i.currentKey=s;const n=(e=t.resolution)!=null?e:this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,n,t._style,t._getKey()),a=i.batchableSprite;a.texture=i.texture=o,i.generatingTexture=!1,i.textureNeedsUploading=!0,t.onViewUpdate();const l=t._style.padding;_r(a.bounds,t._anchor,a.texture,l)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:P.EMPTY,currentKey:"--",batchableSprite:H.get(zi),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=P.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}Yo.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"htmlText"};function Mp(){const{userAgent:r}=$.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}const Ko="http://www.w3.org/2000/svg",qo="http://www.w3.org/1999/xhtml";class Zo{constructor(){this.svgRoot=document.createElementNS(Ko,"svg"),this.foreignObject=document.createElementNS(Ko,"foreignObject"),this.domElement=document.createElementNS(qo,"div"),this.styleElement=document.createElementNS(qo,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}function Cp(r){const t=r._stroke,e=r._fill,i=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Gp(t)]:[],...r.dropShadow?[Op(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return Z1(r.tagStyles,i),i.join(" ")}function Op(r){const t=V.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Gp(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${V.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}const Bp={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},Ip={fill:r=>`color: ${V.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Gp,dropShadow:Op};function Z1(r,t){for(const e in r){const i=r[e],s=[];for(const n in i)Ip[n]?s.push(Ip[n](i[n])):Bp[n]&&s.push(Bp[n].replace("{{VALUE}}",i[n]));t.push(`${e} { ${s.join(";")} }`)}}var Q1=Object.defineProperty,Fp=Object.getOwnPropertySymbols,J1=Object.prototype.hasOwnProperty,tT=Object.prototype.propertyIsEnumerable,Dp=(r,t,e)=>t in r?Q1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,eT=(r,t)=>{for(var e in t||(t={}))J1.call(t,e)&&Dp(r,e,t[e]);if(Fp)for(var e of Fp(t))tT.call(t,e)&&Dp(r,e,t[e]);return r};class Se extends Et{constructor(t={}){var e,i;super(t),this._cssOverrides=[],(e=this.cssOverrides)!=null||(this.cssOverrides=t.cssOverrides),this.tagStyles=(i=t.tagStyles)!=null?i:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Io(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new Se({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?eT({},this.dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Cp(this)),this._cssStyle}addOverride(...t){const e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function Up(r,t){const e=t.fontFamily,i=[],s={},n=/font-family:([^;"\s]+)/g,o=r.match(n);function a(l){s[l]||(i.push(l),s[l]=!0)}if(Array.isArray(e))for(let l=0;l{const u=l.split(":")[1].trim();a(u)});for(const l in t.tagStyles){const u=t.tagStyles[l].fontFamily;a(u)}return i}async function kp(r){const t=await(await $.get().fetch(r)).blob(),e=new FileReader;return await new Promise((i,s)=>{e.onloadend=()=>i(e.result),e.onerror=s,e.readAsDataURL(t)})}async function Qo(r,t){const e=await kp(t);return`@font-face { + font-family: "${r.fontFamily}"; + src: url('http://github.com/$%7Be%7D'); + font-weight: ${r.fontWeight}; + font-style: ${r.fontStyle}; + }`}const Fr=new Map;async function $p(r,t,e){const i=r.filter(s=>K.has(`${s}-and-url`)).map((s,n)=>{if(!Fr.has(s)){const{url:o}=K.get(`${s}-and-url`);n===0?Fr.set(s,Qo({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},o)):Fr.set(s,Qo({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},o))}return Fr.get(s)});return(await Promise.all(i)).join(` +`)}function Lp(r,t,e,i,s){const{domElement:n,styleElement:o,svgRoot:a}=s;n.innerHTML=`
${r}
`,n.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),o.textContent=i;const{width:l,height:u}=s.image;return a.setAttribute("width",l.toString()),a.setAttribute("height",u.toString()),new XMLSerializer().serializeToString(a)}function Np(r,t){const e=Xt.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),Xt.returnCanvasAndContext(e),e.canvas}function Hp(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}let Xp;function Jo(r,t,e,i){i=i||Xp||(Xp=new Zo);const{domElement:s,styleElement:n,svgRoot:o}=i;s.innerHTML=`
${r}
`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(o);const a=s.getBoundingClientRect();o.remove();const l=Ut.measureFont(t.fontStyle).descent,u=t.padding*2;return{width:a.width-u,height:a.height+l-u}}class es{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===gt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;const n=this._buildTexturePromise(t,e,i).then(o=>(this._activeTextures[s].texture=o,o));return this._activeTextures[s]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,i){const s=H.get(Zo),n=Up(t,i),o=await $p(n,i,Se.defaultTextStyle),a=Jo(t,i,o,s),l=Math.ceil(Math.ceil(Math.max(1,a.width)+i.padding*2)*e),u=Math.ceil(Math.ceil(Math.max(1,a.height)+i.padding*2)*e),c=s.image,h=2;c.width=(l|0)+h,c.height=(u|0)+h;const p=Lp(t,i,e,o,s);await Hp(c,p,Mp()&&n.length>0);let f=c;this._createCanvas&&(f=Np(c,e));const m=Do(f,c.width-h,c.height-h,e);return this._createCanvas&&this._renderer.texture.initSource(m.source),H.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{}),this._activeTextures[t]=null))}_cleanUp(t){ht.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}es.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"htmlText"},es.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},U.add(es),U.add(Yo);var rT=Object.defineProperty,jp=Object.getOwnPropertySymbols,iT=Object.prototype.hasOwnProperty,sT=Object.prototype.propertyIsEnumerable,zp=(r,t,e)=>t in r?rT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vp=(r,t)=>{for(var e in t||(t={}))iT.call(t,e)&&zp(r,e,t[e]);if(jp)for(var e of jp(t))sT.call(t,e)&&zp(r,e,t[e]);return r};const Wp=class Hy extends De{constructor(...t){var e;let i=(e=t[0])!=null?e:{};i instanceof Float32Array&&(i={positions:i,uvs:t[1],indices:t[2]}),i=Vp(Vp({},Hy.defaultOptions),i);const s=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),o=i.indices||new Uint32Array([0,1,2,0,2,3]),a=i.shrinkBuffersToFit,l=new xt({data:s,label:"attribute-mesh-positions",shrinkToFit:a,usage:j.VERTEX|j.COPY_DST}),u=new xt({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:j.VERTEX|j.COPY_DST}),c=new xt({data:o,label:"index-mesh-buffer",shrinkToFit:a,usage:j.INDEX|j.COPY_DST});super({attributes:{aPosition:{buffer:l,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:u,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};Wp.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let ie=Wp;var nT=Object.defineProperty,oT=Object.defineProperties,aT=Object.getOwnPropertyDescriptors,Yp=Object.getOwnPropertySymbols,lT=Object.prototype.hasOwnProperty,uT=Object.prototype.propertyIsEnumerable,Kp=(r,t,e)=>t in r?nT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qp=(r,t)=>{for(var e in t||(t={}))lT.call(t,e)&&Kp(r,e,t[e]);if(Yp)for(var e of Yp(t))uT.call(t,e)&&Kp(r,e,t[e]);return r},Zp=(r,t)=>oT(r,aT(t));const qe={name:"local-uniform-bit",vertex:{header:` + + struct LocalUniforms { + uTransformMatrix:mat3x3, + uColor:vec4, + uRound:f32, + } + + @group(1) @binding(0) var localUniforms : LocalUniforms; + `,main:` + vColor *= localUniforms.uColor; + modelMatrix *= localUniforms.uTransformMatrix; + `,end:` + if(localUniforms.uRound == 1) + { + vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw); + } + `}},Qp=Zp(qp({},qe),{vertex:Zp(qp({},qe.vertex),{header:qe.vertex.header.replace("group(1)","group(2)")})}),rs={name:"local-uniform-bit",vertex:{header:` + + uniform mat3 uTransformMatrix; + uniform vec4 uColor; + uniform float uRound; + `,main:` + vColor *= uColor; + modelMatrix = uTransformMatrix; + `,end:` + if(uRound == 1.) + { + gl_Position.xy = roundPixels(gl_Position.xy, uResolution); + } + `}},Jp={name:"tiling-bit",vertex:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy; + + position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy; + `},fragment:{header:` + struct TilingUniforms { + uMapCoord:mat3x3, + uClampFrame:vec4, + uClampOffset:vec2, + uTextureTransform:mat3x3, + uSizeAnchor:vec4 + }; + + @group(2) @binding(0) var tilingUniforms: TilingUniforms; + @group(2) @binding(1) var uTexture: texture_2d; + @group(2) @binding(2) var uSampler: sampler; + `,main:` + + var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV); + coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy; + var unclamped = coord; + coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw); + + var bias = 0.; + + if(unclamped.x == coord.x && unclamped.y == coord.y) + { + bias = -32.; + } + + outColor = textureSampleBias(uTexture, uSampler, coord, bias); + `}},tf={name:"tiling-bit",vertex:{header:` + uniform mat3 uTextureTransform; + uniform vec4 uSizeAnchor; + + `,main:` + uv = (uTextureTransform * vec3(aUV, 1.0)).xy; + + position = (position - uSizeAnchor.zw) * uSizeAnchor.xy; + `},fragment:{header:` + uniform sampler2D uTexture; + uniform mat3 uMapCoord; + uniform vec4 uClampFrame; + uniform vec2 uClampOffset; + `,main:` + + vec2 coord = vUV + ceil(uClampOffset - vUV); + coord = (uMapCoord * vec3(coord, 1.0)).xy; + vec2 unclamped = coord; + coord = clamp(coord, uClampFrame.xy, uClampFrame.zw); + + outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0 + + `}};let ta,ea;class ef extends Ot{constructor(){ta!=null||(ta=Le({name:"tiling-sprite-shader",bits:[qe,Jp,He]})),ea!=null||(ea=Ne({name:"tiling-sprite-shader",bits:[rs,tf,Xe]}));const t=new st({uMapCoord:{value:new G,type:"mat3x3"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2"},uTextureTransform:{value:new G,type:"mat3x3"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4"}});super({glProgram:ea,gpuProgram:ta,resources:{localUniforms:new st({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:P.EMPTY.source,uSampler:P.EMPTY.source.style}})}updateUniforms(t,e,i,s,n,o){const a=this.resources.tilingUniforms,l=o.width,u=o.height,c=o.textureMatrix,h=a.uniforms.uTextureTransform;h.set(i.a*l/t,i.b*l/e,i.c*u/t,i.d*u/e,i.tx/t,i.ty/e),h.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=s,a.uniforms.uSizeAnchor[3]=n,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class rf extends ie{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function sf(r,t){const e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}function nf(r,t,e,i){let s=0;const n=r.length/(t||2),o=i.a,a=i.b,l=i.c,u=i.d,c=i.tx,h=i.ty;for(e*=t;st in r?cT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uf=(r,t)=>{for(var e in t||(t={}))hT.call(t,e)&&lf(r,e,t[e]);if(af)for(var e of af(t))dT.call(t,e)&&lf(r,e,t[e]);return r};const cf=class Xy extends ie{constructor(...t){var e;super({});let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){var e,i,s,n;t=uf(uf({},Xy.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(i=this.verticesY)!=null?i:t.verticesY,this.width=(s=this.width)!=null?s:t.width,this.height=(n=this.height)!=null?n:t.height;const o=this.verticesX*this.verticesY,a=[],l=[],u=[],c=this.verticesX-1,h=this.verticesY-1,p=this.width/c,f=this.height/h;for(let _=0;_t in r?pT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pf=(r,t)=>{for(var e in t||(t={}))fT.call(t,e)&&df(r,e,t[e]);if(hf)for(var e of hf(t))mT.call(t,e)&&df(r,e,t[e]);return r};const ff=class jy extends ss{constructor(t={}){t=pf(pf({},jy.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e,i,s,n,o,a,l,u;this.width=(e=t.width)!=null?e:this.width,this.height=(i=t.height)!=null?i:this.height,this._originalWidth=(s=t.originalWidth)!=null?s:this._originalWidth,this._originalHeight=(n=t.originalHeight)!=null?n:this._originalHeight,this._leftWidth=(o=t.leftWidth)!=null?o:this._leftWidth,this._rightWidth=(a=t.rightWidth)!=null?a:this._rightWidth,this._topHeight=(l=t.topHeight)!=null?l:this._topHeight,this._bottomHeight=(u=t.bottomHeight)!=null?u:this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,e=this._leftWidth+this._rightWidth,i=this.width>e?1:this.width/e,s=this._topHeight+this._bottomHeight,n=this.height>s?1:this.height/s,o=Math.min(i,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*o,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*o,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*o,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*o,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};ff.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let se=ff;class ia{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e.geometry),H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(ji);return e.geometry=H.get(se),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._didSpriteUpdate=!0,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}ia.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"nineSliceSprite"},U.add(ia);class sa{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}sa.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"filter"};const gT=new G;function mf(r,t){return t.clear(),na(r,t),t.isValid||t.set(0,0,0,0),r.renderGroup?t.applyMatrix(r.renderGroup.localTransform):t.applyMatrix(r.parentRenderGroup.worldTransform),t}function na(r,t){if(r.localDisplayStatus!==7||!r.measurable)return;const e=!!r.effects.length;let i=t;if((r.renderGroup||e)&&(i=Lt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,r.worldTransform);else{if(r.renderPipeId){const n=r.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,r.groupTransform)}const s=r.children;for(let n=0;n"},uInputPixel:{value:new Float32Array(4),type:"vec4"},uInputClamp:{value:new Float32Array(4),type:"vec4"},uOutputFrame:{value:new Float32Array(4),type:"vec4"},uGlobalFrame:{value:new Float32Array(4),type:"vec4"},uOutputTexture:{value:new Float32Array(4),type:"vec4"}}),this._globalFilterBindGroup=new Ht({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){var e,i;const s=this.renderer,n=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const o=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,n.length===0){o.skip=!0;return}const a=o.bounds;t.renderables?gf(t.renderables,a):t.filterEffect.filterArea?(a.clear(),a.addRect(t.filterEffect.filterArea),a.applyMatrix(t.container.worldTransform)):mf(t.container,a);const l=s.renderTarget.renderTarget.colorTexture.source;let u=1/0,c=0,h=!0,p=!1,f=!1;for(let _=0;_0?this._filterStack[this._filterStackIndex-1].bounds:null,l=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(l,s,a)}e.backTexture=n;const o=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),o.length===1)o[0].apply(this,i,e.previousRenderSurface,!1),ht.returnTexture(i);else{let a=e.inputTexture,l=ht.getOptimalTexture(s.width,s.height,a.source._resolution,!1),u=0;for(u=0;u0&&this._filterStack[h].skip;)--h;h>0&&(c=this._filterStack[h].inputTexture.source._resolution);const p=this._filterGlobalUniforms,f=p.uniforms,m=f.uOutputFrame,_=f.uInputSize,g=f.uInputPixel,b=f.uInputClamp,v=f.uGlobalFrame,y=f.uOutputTexture;if(u){let R=this._filterStackIndex;for(;R>0;){R--;const w=this._filterStack[this._filterStackIndex-1];if(!w.skip){l.x=w.bounds.minX,l.y=w.bounds.minY;break}}m[0]=a.minX-l.x,m[1]=a.minY-l.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[1],g[0]=e.source.pixelWidth,g[1]=e.source.pixelHeight,g[2]=1/g[0],g[3]=1/g[1],b[0]=.5*g[2],b[1]=.5*g[3],b[2]=e.frame.width*_[2]-.5*g[2],b[3]=e.frame.height*_[3]-.5*g[3];const T=this.renderer.renderTarget.rootRenderTarget.colorTexture;v[0]=l.x*c,v[1]=l.y*c,v[2]=T.source.width*c,v[3]=T.source.height*c;const E=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!s),i instanceof P?(y[0]=i.frame.width,y[1]=i.frame.height):(y[0]=E.width,y[1]=E.height),y[2]=E.isRoot?-1:1,p.update(),n.renderPipes.uniformBatch){const R=n.renderPipes.uniformBatch.getUboResource(p);this._globalFilterBindGroup.setResource(R,0)}else this._globalFilterBindGroup.setResource(p,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:_T,shader:t,state:t._state,topology:"triangle-list"}),n.type===gt.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new ut,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){const i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=e.worldTransform.copyTo(G.shared);return n.invert(),s.prepend(n),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}}oa.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"filter"},U.add(oa),U.add(sa);var bT={__proto__:null};const aa=[];U.handleByNamedList(x.Environment,aa);async function la(r){if(!r)for(let t=0;t(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(_t||{});class ca{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,n,o,a,l){const{name:u,items:c}=this;for(let h=0,p=c.length;ht in r?vT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ns=(r,t)=>{for(var e in t||(t={}))xT.call(t,e)&&bf(r,e,t[e]);if(_f)for(var e of _f(t))TT.call(t,e)&&bf(r,e,t[e]);return r};const ST=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],yf=class zy extends ft{constructor(t){var e;super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const i=[...ST,...(e=this.config.runners)!=null?e:[]];this._addRunners(...i),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await la(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const i in this._systemsHash){const s=this._systemsHash[i].constructor.defaultOptions;t=ns(ns({},s),t)}t=ns(ns({},zy.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let i=0;i{this.runners[e]=new ca(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){const i=e.reduce((s,n)=>(s[n.name]=n.value,s),{});t.forEach(s=>{const n=s.value,o=s.name,a=i[o];this.renderPipes[o]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ua())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};yf.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let Ur=yf,ha;function kr(r){return ha!==void 0||(ha=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:Ur.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let i=$.get().createCanvas().getContext("webgl",e);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch(i){return!1}})()),ha}let da;async function $r(r={}){return da!==void 0||(da=await(async()=>{const t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),da}var ET=Object.defineProperty,vf=Object.getOwnPropertySymbols,AT=Object.prototype.hasOwnProperty,PT=Object.prototype.propertyIsEnumerable,xf=(r,t,e)=>t in r?ET(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lr=(r,t)=>{for(var e in t||(t={}))AT.call(t,e)&&xf(r,e,t[e]);if(vf)for(var e of vf(t))PT.call(t,e)&&xf(r,e,t[e]);return r};const Tf=["webgl","webgpu","canvas"];async function Sf(r){var t;let e=[];r.preference?(e.push(r.preference),Tf.forEach(o=>{o!==r.preference&&e.push(o)})):e=Tf.slice();let i,s={};for(let o=0;ot in r?RT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,OT=(r,t)=>{for(var e in t||(t={}))MT.call(t,e)&&Af(r,e,t[e]);if(Ef)for(var e of Ef(t))CT.call(t,e)&&Af(r,e,t[e]);return r};const Pf=class Su{constructor(...t){this.stage=new J}async init(t){t=OT({},t),this.renderer=await Sf(t),Su._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=Su._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Pf._plugins=[];let wf=Pf;U.handleByList(x.Application,wf._plugins),U.add(pa);class ma extends Ho{constructor(t,e){var i;super();const{textures:s,data:n}=t;Object.keys(n.pages).forEach(o=>{const a=n.pages[parseInt(o,10)],l=s[a.id];this.pages.push({texture:l})}),Object.keys(n.chars).forEach(o=>{var a;const l=n.chars[o],{frame:u,source:c}=s[l.page],h=new W(l.x+u.x,l.y+u.y,l.width,l.height),p=new P({source:c,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:l.xOffset,yOffset:l.yOffset,xAdvance:l.xAdvance,kerning:(a=l.kerning)!=null?a:{},texture:p}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=(i=n.distanceField)!=null?i:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t")?ga.test($.get().parseXML(r)):!1},parse(r){return ga.parse($.get().parseXML(r))}},GT=[".xml",".fnt"],Rf={extension:{type:x.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof ma,getCacheableAssets(r,t){const e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},Mf={extension:{type:x.LoadParser,priority:vt.Normal},name:"loadBitmapFont",test(r){return GT.includes(mt.extname(r).toLowerCase())},async testParse(r){return os.test(r)||_a.test(r)},async parse(r,t,e){const i=os.test(r)?os.parse(r):_a.parse(r),{src:s}=t,{pages:n}=i,o=[],a=i.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let c=0;cl[c.src]);return new ma({data:i,textures:u},s)},async load(r,t){return await(await $.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};class Cf{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;iArray.isArray(r)&&r.every(t=>t instanceof P),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),e}};async function ba(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const Gf={extension:{type:x.DetectionParser,priority:1},test:async()=>ba("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")},Bf=["png","jpg","jpeg"],If={extension:{type:x.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Bf],remove:async r=>r.filter(t=>!Bf.includes(t))},BT="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function as(r){return BT?!1:document.createElement("video").canPlayType(r)!==""}const Ff={extension:{type:x.DetectionParser,priority:0},test:async()=>as("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},Df={extension:{type:x.DetectionParser,priority:0},test:async()=>as("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},Uf={extension:{type:x.DetectionParser,priority:0},test:async()=>as("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},kf={extension:{type:x.DetectionParser,priority:0},test:async()=>ba("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};var IT=Object.defineProperty,FT=Object.defineProperties,DT=Object.getOwnPropertyDescriptors,$f=Object.getOwnPropertySymbols,UT=Object.prototype.hasOwnProperty,kT=Object.prototype.propertyIsEnumerable,Lf=(r,t,e)=>t in r?IT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$T=(r,t)=>{for(var e in t||(t={}))UT.call(t,e)&&Lf(r,e,t[e]);if($f)for(var e of $f(t))kT.call(t,e)&&Lf(r,e,t[e]);return r},LT=(r,t)=>FT(r,DT(t));class Nf{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var s,n;let o=null,a=null;if(e.loadParser&&(a=this._parserHash[e.loadParser]),!a){for(let l=0;l({alias:[u],src:u,data:{}})),a=o.length,l=o.map(async u=>{const c=mt.toAbsolute(u.src);if(!s[u.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,u)),s[u.src]=await this.promiseCache[c].promise,e&&e(++i/a)}catch(h){throw delete this.promiseCache[c],delete s[u.src],new Error(`[Loader.load] Failed to load ${c}. +${h}`)}});return await Promise.all(l),n?s[o[0].src]:s}async unload(t){const e=Mt(t,i=>({alias:[i],src:i})).map(async i=>{var s,n;const o=mt.toAbsolute(i.src),a=this.promiseCache[o];if(a){const l=await a.promise;delete this.promiseCache[o],await((n=(s=a.parser)==null?void 0:s.unload)==null?void 0:n.call(s,l,i,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],LT($T({},t),{[e.name]:e})),{})}}function Ee(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Gt(r,t){const e=r.split("?")[0],i=mt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const NT=".json",HT="application/json",Hf={extension:{type:x.LoadParser,priority:vt.Low},name:"loadJson",test(r){return Ee(r,HT)||Gt(r,NT)},async load(r){return await(await $.get().fetch(r)).json()}},XT=".txt",jT="text/plain",Xf={name:"loadTxt",extension:{type:x.LoadParser,priority:vt.Low,name:"loadTxt"},test(r){return Ee(r,jT)||Gt(r,XT)},async load(r){return await(await $.get().fetch(r)).text()}};var zT=Object.defineProperty,VT=Object.defineProperties,WT=Object.getOwnPropertyDescriptors,jf=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,KT=Object.prototype.propertyIsEnumerable,zf=(r,t,e)=>t in r?zT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qT=(r,t)=>{for(var e in t||(t={}))YT.call(t,e)&&zf(r,e,t[e]);if(jf)for(var e of jf(t))KT.call(t,e)&&zf(r,e,t[e]);return r},ZT=(r,t)=>VT(r,WT(t));const QT=["normal","bold","100","200","300","400","500","600","700","800","900"],JT=[".ttf",".otf",".woff",".woff2"],tS=["font/ttf","font/otf","font/woff","font/woff2"],eS=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Vf(r){const t=mt.extname(r),e=mt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(eS)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const rS=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function iS(r){return rS.test(r)?r:encodeURI(r)}const Wf={extension:{type:x.LoadParser,priority:vt.Low},name:"loadWebFont",test(r){return Ee(r,tS)||Gt(r,JT)},async load(r,t){var e,i,s,n,o,a;const l=$.get().getFontFaceSet();if(l){const u=[],c=(i=(e=t.data)==null?void 0:e.family)!=null?i:Vf(r),h=(o=(n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(f=>QT.includes(f)))!=null?o:["normal"],p=(a=t.data)!=null?a:{};for(let f=0;f{K.remove(t.family),$.get().getFontFaceSet().delete(t)})}};function ls(r,t=1){var e;const i=(e=Jt.RETINA_PREFIX)==null?void 0:e.exec(r);return i?parseFloat(i[1]):t}function ne(r,t,e){r.label=e,r._sourceOrigin=e;const i=new P({source:r,label:e}),s=()=>{delete t.promiseCache[e],K.has(e)&&K.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&s()}),i.once("destroy",()=>{r.destroyed||s()}),i}var sS=Object.defineProperty,us=Object.getOwnPropertySymbols,Yf=Object.prototype.hasOwnProperty,Kf=Object.prototype.propertyIsEnumerable,qf=(r,t,e)=>t in r?sS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nS=(r,t)=>{for(var e in t||(t={}))Yf.call(t,e)&&qf(r,e,t[e]);if(us)for(var e of us(t))Kf.call(t,e)&&qf(r,e,t[e]);return r},oS=(r,t)=>{var e={};for(var i in r)Yf.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&us)for(var i of us(r))t.indexOf(i)<0&&Kf.call(r,i)&&(e[i]=r[i]);return e};const aS=".svg",lS="image/svg+xml",Zf={extension:{type:x.LoadParser,priority:vt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return Ee(r,lS)||Gt(r,aS)},async load(r,t,e){var i;return((i=t.data.parseAsGraphicsContext)!=null?i:this.config.parseAsGraphicsContext)?cS(r):uS(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function uS(r,t,e,i){var s,n,o,a,l;const u=await(await $.get().fetch(r)).blob(),c=URL.createObjectURL(u),h=new Image;h.src=c,h.crossOrigin=i,await h.decode(),URL.revokeObjectURL(c);const p=document.createElement("canvas"),f=p.getContext("2d"),m=((s=t.data)==null?void 0:s.resolution)||ls(r),_=(o=(n=t.data)==null?void 0:n.width)!=null?o:h.width,g=(l=(a=t.data)==null?void 0:a.height)!=null?l:h.height;p.width=_*m,p.height=g*m,f.drawImage(h,0,0,_*m,g*m);const b=t.data,{parseAsGraphicsContext:v}=b,y=oS(b,["parseAsGraphicsContext"]),T=new _e(nS({resource:p,alphaMode:"premultiply-alpha-on-upload",resolution:m},y));return ne(T,e,r)}async function cS(r){const t=await(await $.get().fetch(r)).text(),e=new dt;return e.svg(t),e}const hS=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})(); +`;let Ze=null,ya=class{constructor(){Ze||(Ze=URL.createObjectURL(new Blob([hS],{type:"application/javascript"}))),this.worker=new Worker(Ze)}};ya.revokeObjectURL=function(){Ze&&(URL.revokeObjectURL(Ze),Ze=null)};const dS='(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n';let Qe=null,Qf=class{constructor(){Qe||(Qe=URL.createObjectURL(new Blob([dS],{type:"application/javascript"}))),this.worker=new Worker(Qe)}};Qf.revokeObjectURL=function(){Qe&&(URL.revokeObjectURL(Qe),Qe=null)};let Jf=0,va,pS=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new ya;e.addEventListener("message",i=>{e.terminate(),ya.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){va===void 0&&(va=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const i=new Promise((s,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[Jf]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:Jf++,id:i})}};const xa=new pS;var fS=Object.defineProperty,tm=Object.getOwnPropertySymbols,mS=Object.prototype.hasOwnProperty,gS=Object.prototype.propertyIsEnumerable,em=(r,t,e)=>t in r?fS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_S=(r,t)=>{for(var e in t||(t={}))mS.call(t,e)&&em(r,e,t[e]);if(tm)for(var e of tm(t))gS.call(t,e)&&em(r,e,t[e]);return r};const bS=[".jpeg",".jpg",".png",".webp",".avif"],yS=["image/jpeg","image/png","image/webp","image/avif"];async function rm(r,t){var e;const i=await $.get().fetch(r);if(!i.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${i.status} ${i.statusText}`);const s=await i.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(s,{premultiplyAlpha:"none"}):createImageBitmap(s)}const Ta={name:"loadTextures",extension:{type:x.LoadParser,priority:vt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Ee(r,yS)||Gt(r,bS)},async load(r,t,e){var i;let s=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await xa.isImageBitmapSupported()?s=await xa.loadImageBitmap(r,t):s=await rm(r,t):s=await new Promise(o=>{s=new Image,s.crossOrigin=this.config.crossOrigin,s.src=r,s.complete?o(s):s.onload=()=>{o(s)}});const n=new _e(_S({resource:s,alphaMode:"premultiply-alpha-on-upload",resolution:((i=t.data)==null?void 0:i.resolution)||ls(r)},t.data));return ne(n,e,r)},unload(r){r.destroy(!0)}};var vS=Object.defineProperty,xS=Object.defineProperties,TS=Object.getOwnPropertyDescriptors,im=Object.getOwnPropertySymbols,SS=Object.prototype.hasOwnProperty,ES=Object.prototype.propertyIsEnumerable,sm=(r,t,e)=>t in r?vS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Sa=(r,t)=>{for(var e in t||(t={}))SS.call(t,e)&&sm(r,e,t[e]);if(im)for(var e of im(t))ES.call(t,e)&&sm(r,e,t[e]);return r},nm=(r,t)=>xS(r,TS(t));const om=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],AS=om.map(r=>`video/${r.substring(1)}`);function am(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=um(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function lm(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){n(),t()}function s(o){n(),e(o)}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function um(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const cm={name:"loadVideo",extension:{type:x.LoadParser,name:"loadVideo"},test(r){const t=Ee(r,AS),e=Gt(r,om);return t||e},async load(r,t,e){var i,s;const n=Sa(nm(Sa({},br.defaultOptions),{resolution:((i=t.data)==null?void 0:i.resolution)||ls(r),alphaMode:((s=t.data)==null?void 0:s.alphaMode)||await Fn()}),t.data),o=document.createElement("video"),a={preload:n.autoLoad!==!1?"auto":void 0,"webkit-playsinline":n.playsinline!==!1?"":void 0,playsinline:n.playsinline!==!1?"":void 0,muted:n.muted===!0?"":void 0,loop:n.loop===!0?"":void 0,autoplay:n.autoPlay!==!1?"":void 0};Object.keys(a).forEach(c=>{const h=a[c];h!==void 0&&o.setAttribute(c,h)}),n.muted===!0&&(o.muted=!0),am(o,r,n.crossorigin);const l=document.createElement("source");let u;if(r.startsWith("data:"))u=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){const c=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();u=br.MIME_TYPES[c]||`video/${c}`}return l.src=r,u&&(l.type=u),new Promise(c=>{const h=async()=>{const p=new br(nm(Sa({},n),{resource:o}));o.removeEventListener("canplay",h),t.data.preload&&await lm(o),c(ne(p,e,r))};o.addEventListener("canplay",h),o.appendChild(l)})},unload(r){r.destroy(!0)}},Ea={extension:{type:x.ResolveParser,name:"resolveTexture"},test:Ta.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=Jt.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},hm={extension:{type:x.ResolveParser,priority:-2,name:"resolveJson"},test:r=>Jt.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:Ea.parse};class dm{constructor(){this._detections=[],this._initialized=!1,this.resolver=new Jt,this.loader=new Nf,this.cache=K,this._backgroundLoader=new Cf(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,i,s;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let l=t.manifest;typeof l=="string"&&(l=await this.load(l)),this.resolver.addManifest(l)}const n=(i=(e=t.texturePreference)==null?void 0:e.resolution)!=null?i:1,o=typeof n=="number"?[n]:n,a=await this._detectFormats({preferredFormats:(s=t.texturePreference)==null?void 0:s.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:a,resolution:o}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=gr(t),s=Mt(t).map(a=>{if(typeof a!="string"){const l=this.resolver.getAlias(a);return l.some(u=>!this.resolver.hasKey(u))&&this.add(a),Array.isArray(l)?l[0]:l}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(s),o=await this._mapLoadToResolve(n,e);return i?o[s[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},o=Object.keys(s);let a=0,l=0;const u=()=>{e==null||e(++a/l)},c=o.map(h=>{const p=s[h];return l+=Object.keys(p).length,this._mapLoadToResolve(p,u).then(f=>{n[h]=f})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return K.get(t);const e={};for(let i=0;i{const a=s[o.src],l=[o.src];o.alias&&l.push(...o.alias),l.forEach(u=>{n[u]=a}),K.set(l,a)}),n}async unload(t){this._initialized||await this.init();const e=Mt(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Mt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{K.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const Hr=new dm;U.handleByList(x.LoadParser,Hr.loader.parsers).handleByList(x.ResolveParser,Hr.resolver.parsers).handleByList(x.CacheParser,Hr.cache.parsers).handleByList(x.DetectionParser,Hr.detections),U.add(Of,If,Gf,kf,Ff,Df,Uf,Hf,Xf,Wf,Zf,Ta,cm,Mf,Rf,Ea,hm);const pm={loader:x.LoadParser,resolver:x.ResolveParser,cache:x.CacheParser,detection:x.DetectionParser};U.handle(x.Asset,r=>{const t=r.ref;Object.entries(pm).filter(([e])=>!!t[e]).forEach(([e,i])=>{var s;return U.add(Object.assign(t[e],{extension:(s=t[e].extension)!=null?s:i}))})},r=>{const t=r.ref;Object.keys(pm).filter(e=>!!t[e]).forEach(e=>U.remove(t[e]))});const PS={extension:{type:x.DetectionParser,priority:3},test:async()=>!!(await $r()||kr()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};class Xr extends et{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let cs;function Aa(){if(cs)return cs;const r=document.createElement("canvas").getContext("webgl");return r?(cs=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],cs):[]}let hs;async function Pa(){if(hs)return hs;const r=await $.get().getNavigator().gpu.requestAdapter();return hs=[...r.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...r.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],hs}let wa;async function Ra(){return wa!==void 0||(wa=await(async()=>{const r=await $r(),t=kr();if(r&&t){const e=await Pa(),i=Aa();return e.filter(s=>i.includes(s))}else{if(r)return await Pa();if(t)return Aa()}return[]})()),wa}const fm=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let ds;async function jr(){if(ds!==void 0)return ds;const r=await Ra();return ds=[...fm,...r],ds}const wS='(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n';let Je=null,mm=class{constructor(){Je||(Je=URL.createObjectURL(new Blob([wS],{type:"application/javascript"}))),this.worker=new Worker(Je)}};mm.revokeObjectURL=function(){Je&&(URL.revokeObjectURL(Je),Je=null)};const ps={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"http://github.com/service/https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};function RS(r){Object.assign(ps,r)}let zr;const gm={};function MS(r){return zr||(zr=new mm().worker,zr.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load Basis texture",i),gm[i](s)},zr.postMessage({type:"init",jsUrl:ps.jsUrl,wasmUrl:ps.wasmUrl,supportedTextures:r})),zr}function _m(r,t){const e=MS(t);return new Promise(i=>{gm[r]=i,e.postMessage({type:"load",url:r})})}const CS={extension:{type:x.LoadParser,priority:vt.High,name:"loadBasis"},name:"loadBasis",test(r){return Gt(r,[".basis"])},async load(r,t,e){const i=await jr(),s=await _m(r,i),n=new Xr(s);return ne(n,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function OS(r,t){const e=r.getNumImages(),i=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const s=[];for(let n=0;n(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))(Ma||{}),Ca=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))(Ca||{});function lt(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var bt=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=lt("UYVY")]="UYVY",r[r.R8G8_B8G8=lt("RGBG")]="R8G8_B8G8",r[r.YUY2=lt("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=lt("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=lt("DXT1")]="DXT1",r[r.DXT2=lt("DXT2")]="DXT2",r[r.DXT3=lt("DXT3")]="DXT3",r[r.DXT4=lt("DXT4")]="DXT4",r[r.DXT5=lt("DXT5")]="DXT5",r[r.ATI1=lt("ATI1")]="ATI1",r[r.AT1N=lt("AT1N")]="AT1N",r[r.ATI2=lt("ATI2")]="ATI2",r[r.AT2N=lt("AT2N")]="AT2N",r[r.BC4U=lt("BC4U")]="BC4U",r[r.BC4S=lt("BC4S")]="BC4S",r[r.BC5U=lt("BC5U")]="BC5U",r[r.BC5S=lt("BC5S")]="BC5S",r[r.DX10=lt("DX10")]="DX10",r))(bt||{});const Oa={[bt.DXT1]:"bc1-rgba-unorm",[bt.DXT2]:"bc2-rgba-unorm",[bt.DXT3]:"bc2-rgba-unorm",[bt.DXT4]:"bc3-rgba-unorm",[bt.DXT5]:"bc3-rgba-unorm",[bt.ATI1]:"bc4-r-unorm",[bt.BC4U]:"bc4-r-unorm",[bt.BC4S]:"bc4-r-snorm",[bt.ATI2]:"bc5-rg-unorm",[bt.BC5U]:"bc5-rg-unorm",[bt.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},yt={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},F={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:IS,HEADER_DX10_FIELDS:FS,DXGI_FORMAT:Ma,D3D10_RESOURCE_DIMENSION:Ca,D3DFMT:bt},bm={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function ym(r,t){const{format:e,fourCC:i,width:s,height:n,dataOffset:o,mipmapCount:a}=US(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${i} ${e}, supported: ${t}`);if(a<=1)return{format:e,width:s,height:n,resource:[new Uint8Array(r,o)],alphaMode:"no-premultiply-alpha"};const l=DS(e,s,n,o,a,r);return{format:e,width:s,height:n,resource:l,alphaMode:"no-premultiply-alpha"}}function DS(r,t,e,i,s,n){const o=[],a=bm[r];let l=t,u=e,c=i;for(let h=0;h>1,1),u=Math.max(u>>1,1)}return o}function US(r){const t=new Uint32Array(r,0,F.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[F.HEADER_FIELDS.MAGIC]!==F.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[F.HEADER_FIELDS.HEIGHT],i=t[F.HEADER_FIELDS.WIDTH],s=Math.max(1,t[F.HEADER_FIELDS.MIPMAP_COUNT]),n=t[F.HEADER_FIELDS.PF_FLAGS],o=t[F.HEADER_FIELDS.FOURCC],a=kS(t,n,o,r),l=F.MAGIC_SIZE+F.HEADER_SIZE+(o===F.D3DFMT.DX10?F.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:i,height:e,dataOffset:l,mipmapCount:s}}function kS(r,t,e,i){if(t&F.PIXEL_FORMAT_FLAGS.FOURCC){if(e===F.D3DFMT.DX10){const s=new Uint32Array(i,F.MAGIC_SIZE+F.HEADER_SIZE,F.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(s[F.HEADER_DX10_FIELDS.MISC_FLAG]===F.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(s[F.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===F.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const n=s[F.HEADER_DX10_FIELDS.DXGI_FORMAT];if(n in yt)return yt[n];throw new Error(`DDSParser cannot parse texture data with DXGI format ${n}`)}if(e in Oa)return Oa[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&F.PIXEL_FORMAT_FLAGS.RGB||t&F.PIXEL_FORMAT_FLAGS.RGBA)return $S(r);throw t&F.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&F.PIXEL_FORMAT_FLAGS.LUMINANCE||t&F.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&F.PIXEL_FORMAT_FLAGS.ALPHA||t&F.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}function $S(r){const t=r[F.HEADER_FIELDS.RGB_BITCOUNT],e=r[F.HEADER_FIELDS.R_BIT_MASK],i=r[F.HEADER_FIELDS.G_BIT_MASK],s=r[F.HEADER_FIELDS.B_BIT_MASK],n=r[F.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&i===65280&&s===16711680&&n===4278190080)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&i===65280&&s===255&&n===4278190080)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&i===1047552&&s===1023&&n===3221225472)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&i===4294901760&&s===0&&n===0)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&i===0&&s===0&&n===0)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&i===992&&s===31&&n===32768)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&i===2016&&s===31&&n===0)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&i===240&&s===15&&n===61440)return yt[F.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&i===0&&s===0&&n===65280)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&i===0&&s===0&&n===0)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&i===0&&s===0&&n===0)return yt[F.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration: + bitCount = ${t}, rBitMask = ${e}, gBitMask = ${i}, aBitMask = ${n}`)}const LS={extension:{type:x.LoadParser,priority:vt.High,name:"loadDDS"},name:"loadDDS",test(r){return Gt(r,[".dds"])},async load(r,t,e){const i=await jr(),s=await(await fetch(r)).arrayBuffer(),n=ym(s,i),o=new Xr(n);return ne(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var vm=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(vm||{}),NS=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(NS||{}),HS=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(HS||{});const rt={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function xm(r,t){const e=new DataView(r);if(!VS(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:i,glType:s,glFormat:n,glInternalFormat:o,pixelWidth:a,pixelHeight:l,numberOfMipmapLevels:u,offset:c}=zS(e),h=rt.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!h)throw new Error(`Unknown texture format ${o}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const p=jS(s,n,o),f=XS(e,s,p,a,l,c,u,i);return{format:h,width:a,height:l,resource:f,alphaMode:"no-premultiply-alpha"}}function XS(r,t,e,i,s,n,o,a){const l=i+3&-4,u=s+3&-4;let c=i*s;t===0&&(c=l*u);let h=c*e,p=i,f=s,m=l,_=u,g=n;const b=new Array(o);for(let v=0;v>1||1,f=f>>1||1,m=p+4-1&-4,_=f+4-1&-4,h=m*_*e}return b}function jS(r,t,e){let i=rt.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(rt.TYPES_TO_BYTES_PER_COMPONENT[r]?i=rt.TYPES_TO_BYTES_PER_COMPONENT[r]*rt.FORMATS_TO_COMPONENTS[t]:i=rt.TYPES_TO_BYTES_PER_PIXEL[r]),i===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return i}function zS(r){const t=r.getUint32(rt.FIELDS.ENDIANNESS,!0)===rt.ENDIANNESS,e=r.getUint32(rt.FIELDS.GL_TYPE,t),i=r.getUint32(rt.FIELDS.GL_FORMAT,t),s=r.getUint32(rt.FIELDS.GL_INTERNAL_FORMAT,t),n=r.getUint32(rt.FIELDS.PIXEL_WIDTH,t),o=r.getUint32(rt.FIELDS.PIXEL_HEIGHT,t)||1,a=r.getUint32(rt.FIELDS.PIXEL_DEPTH,t)||1,l=r.getUint32(rt.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,u=r.getUint32(rt.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(rt.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(rt.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(o===0||a!==1)throw new Error("Only 2D textures are supported");if(u!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(l!==1)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:e,glFormat:i,glInternalFormat:s,pixelWidth:n,pixelHeight:o,numberOfMipmapLevels:c,offset:rt.FILE_HEADER_SIZE+h}}function VS(r){for(let t=0;tt.destroy(!0)):r.destroy(!0)}},YS='(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n';let tr=null;class Tm{constructor(){tr||(tr=URL.createObjectURL(new Blob([YS],{type:"application/javascript"}))),this.worker=new Worker(tr)}}Tm.revokeObjectURL=function(){tr&&(URL.revokeObjectURL(tr),tr=null)};const fs={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"http://github.com/service/https://files.pixijs.download/transcoders/ktx/libktx.wasm"};function KS(r){Object.assign(fs,r)}let Vr;const Sm={};function qS(r){return Vr||(Vr=new Tm().worker,Vr.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load KTX texture",i),Sm[i](s)},Vr.postMessage({type:"init",jsUrl:fs.jsUrl,wasmUrl:fs.wasmUrl,supportedTextures:r})),Vr}function Em(r,t){const e=qS(t);return new Promise(i=>{Sm[r]=i,e.postMessage({type:"load",url:r})})}const ZS={extension:{type:x.LoadParser,priority:vt.High,name:"loadKTX2"},name:"loadKTX2",test(r){return Gt(r,".ktx2")},async load(r,t,e){const i=await jr(),s=await Em(r,i),n=new Xr(s);return ne(n,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},Ga={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:Am},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:Am}};function QS(r){const t=r.format;if(Ga[t]){const e=Ga[t].convertFunction,i=r.resource;for(let s=0;sGt(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let i;const s=r.split(".");if(s.length>2){const n=s[s.length-2];ms.includes(n)&&(i=n)}else i=s[s.length-1];return{resolution:parseFloat((e=(t=Jt.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i,src:r}}};let gs;const o2={extension:{type:x.DetectionParser,priority:2},test:async()=>!!(await $r()||kr()),add:async r=>{const t=await Ra();return gs=a2(t),[...gs,...r]},remove:async r=>gs?r.filter(t=>!(t in gs)):r};function a2(r){const t=["basis"],e={};return r.forEach(i=>{const s=i.split("-")[0];s&&!e[s]&&(e[s]=!0,t.push(s))}),t.sort((i,s)=>{const n=ms.indexOf(i),o=ms.indexOf(s);return n===-1?1:o===-1?-1:n-o}),t}const l2=new ut,Ba=class{cull(t,e,i=!0){this._cullRecursive(t,e,i)}_cullRecursive(t,e,i=!0){var s;if(t.cullable&&t.measurable&&t.includeInBuild){const n=(s=t.cullArea)!=null?s:cr(t,i,l2);t.culled=n.x>=e.x+e.width||n.y>=e.y+e.height||n.x+n.width<=e.x||n.y+n.height<=e.y}else t.culled=!1;if(!(!t.cullableChildren||t.culled||!t.renderable||!t.measurable||!t.includeInBuild))for(let n=0;n{Rm.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}Mm.extension={priority:10,type:x.Application,name:"culler"};const u2={extension:{type:x.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Promise.resolve().then(function(){return bT})}};var c2=Object.defineProperty,_s=Object.getOwnPropertySymbols,Cm=Object.prototype.hasOwnProperty,Om=Object.prototype.propertyIsEnumerable,Gm=(r,t,e)=>t in r?c2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ia=(r,t)=>{for(var e in t||(t={}))Cm.call(t,e)&&Gm(r,e,t[e]);if(_s)for(var e of _s(t))Om.call(t,e)&&Gm(r,e,t[e]);return r},h2=(r,t)=>{var e={};for(var i in r)Cm.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&_s)for(var i of _s(r))t.indexOf(i)<0&&Om.call(r,i)&&(e[i]=r[i]);return e};const Bm=class Eu extends Ot{constructor(t){t=Ia(Ia({},Eu.defaultOptions),t),super(t),this.enabled=!0,this._state=Ft.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:i,gl:s}=e,n=h2(e,["gpu","gl"]);let o,a;return i&&(o=Tt.from(i)),s&&(a=Ct.from(s)),new Eu(Ia({gpuProgram:o,glProgram:a},n))}};Bm.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1};let Qt=Bm;var Im=` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uBlend; + +uniform sampler2D uTexture; +uniform sampler2D uBackTexture; + +{FUNCTIONS} + +void main() +{ + vec4 back = texture(uBackTexture, vTextureCoord); + vec4 front = texture(uTexture, vTextureCoord); + float blendedAlpha = front.a + back.a * (1.0 - front.a); + + {MAIN} +} +`,Fm=`in vec2 aPosition; +out vec2 vTextureCoord; +out vec2 backgroundUv; + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`,Dm=` +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct BlendUniforms { + uBlend:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; +@group(0) @binding(3) var uBackTexture: texture_2d; + +@group(1) @binding(0) var blendUniforms : BlendUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +{FUNCTIONS} + +@fragment +fn mainFragment( + @location(0) uv: vec2 +) -> @location(0) vec4 { + + + var back = textureSample(uBackTexture, uSampler, uv); + var front = textureSample(uTexture, uSampler, uv); + var blendedAlpha = front.a + back.a * (1.0 - front.a); + + var out = vec4(0.0,0.0,0.0,0.0); + + {MAIN} + + return out; +}`,d2=Object.defineProperty,Um=Object.getOwnPropertySymbols,p2=Object.prototype.hasOwnProperty,f2=Object.prototype.propertyIsEnumerable,km=(r,t,e)=>t in r?d2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$m=(r,t)=>{for(var e in t||(t={}))p2.call(t,e)&&km(r,e,t[e]);if(Um)for(var e of Um(t))f2.call(t,e)&&km(r,e,t[e]);return r};class m2 extends Qt{constructor(t){const e=t.gpu,i=Lm($m({source:Dm},e)),s=Tt.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:i,entryPoint:"mainFragment"}}),n=t.gl,o=Lm($m({source:Im},n)),a=Ct.from({vertex:Fm,fragment:o}),l=new st({uBlend:{value:1,type:"f32"}});super({gpuProgram:s,glProgram:a,blendRequired:!0,resources:{blendUniforms:l,uBackTexture:P.EMPTY}})}}function Lm(r){const{source:t,functions:e,main:i}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",i)}const g2=` + float getLuminosity(vec3 c) { + return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b; + } + + vec3 setLuminosity(vec3 c, float lum) { + float modLum = lum - getLuminosity(c); + vec3 color = c.rgb + vec3(modLum); + + // clip back into legal range + modLum = getLuminosity(color); + vec3 modLumVec = vec3(modLum); + + float cMin = min(color.r, min(color.g, color.b)); + float cMax = max(color.r, max(color.g, color.b)); + + if(cMin < 0.0) { + color = mix(modLumVec, color, modLum / (modLum - cMin)); + } + + if(cMax > 1.0) { + color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum)); + } + + return color; + } + + float getSaturation(vec3 c) { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); + } + + vec3 setSaturationMinMidMax(vec3 cSorted, float s) { + vec3 colorSorted = cSorted; + + if(colorSorted.z > colorSorted.x) { + colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x)); + colorSorted.z = s; + } + else { + colorSorted.y = 0.0; + colorSorted.z = 0.0; + } + + colorSorted.x = 0.0; + + return colorSorted; + } + + vec3 setSaturation(vec3 c, float s) { + vec3 color = c; + + if(color.r <= color.g && color.r <= color.b) { + if(color.g <= color.b) { + color = setSaturationMinMidMax(color.rgb, s).rgb; + } + else { + color = setSaturationMinMidMax(color.rbg, s).rbg; + } + } + else if(color.g <= color.r && color.g <= color.b) { + if(color.r <= color.b) { + color = setSaturationMinMidMax(color.grb, s).grb; + } + else { + color = setSaturationMinMidMax(color.gbr, s).gbr; + } + } + else { + // Using bgr for both fixes part of hue + if(color.r <= color.g) { + color = setSaturationMinMidMax(color.brg, s).brg; + } + else { + color = setSaturationMinMidMax(color.bgr, s).bgr; + } + } + + return color; + } + `,_2=` + fn getLuminosity(c: vec3) -> f32 + { + return 0.3*c.r + 0.59*c.g + 0.11*c.b; + } + + fn setLuminosity(c: vec3, lum: f32) -> vec3 + { + var modLum: f32 = lum - getLuminosity(c); + var color: vec3 = c.rgb + modLum; + + // clip back into legal range + modLum = getLuminosity(color); + let modLumVec = vec3(modLum); + + let cMin: f32 = min(color.r, min(color.g, color.b)); + let cMax: f32 = max(color.r, max(color.g, color.b)); + + if(cMin < 0.0) + { + color = mix(modLumVec, color, modLum / (modLum - cMin)); + } + + if(cMax > 1.0) + { + color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum)); + } + + return color; + } + + fn getSaturation(c: vec3) -> f32 + { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); + } + + fn setSaturationMinMidMax(cSorted: vec3, s: f32) -> vec3 + { + var colorSorted = cSorted; + + if(colorSorted.z > colorSorted.x) + { + colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x)); + colorSorted.z = s; + } + else + { + colorSorted.y = 0; + colorSorted.z = 0; + } + + colorSorted.x = 0; + + return colorSorted; + } + + fn setSaturation(c: vec3, s: f32) -> vec3 + { + var color = c; + + if (color.r <= color.g && color.r <= color.b) + { + if (color.g <= color.b) + { + color = vec3(setSaturationMinMidMax(color.rgb, s)).rgb; + } + else + { + color = vec3(setSaturationMinMidMax(color.rbg, s)).rbg; + } + } + else if (color.g <= color.r && color.g <= color.b) + { + if (color.r <= color.b) + { + color = vec3(setSaturationMinMidMax(color.grb, s)).grb; + } + else + { + color = vec3(setSaturationMinMidMax(color.gbr, s)).gbr; + } + } + else + { + // Using bgr for both fixes part of hue + if (color.r <= color.g) + { + color = vec3(setSaturationMinMidMax(color.brg, s)).brg; + } + else + { + color = vec3(setSaturationMinMidMax(color.bgr, s)).bgr; + } + } + + return color; + } + `;var bs=`in vec2 aPosition; +out vec2 vTextureCoord; + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); +} +`,Nm=` +in vec2 vTextureCoord; + +out vec4 finalColor; + +uniform float uAlpha; +uniform sampler2D uTexture; + +void main() +{ + finalColor = texture(uTexture, vTextureCoord) * uAlpha; +} +`,Fa=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct AlphaUniforms { + uAlpha:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var alphaUniforms : AlphaUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var sample = textureSample(uTexture, uSampler, uv); + + return sample * alphaUniforms.uAlpha; +}`,b2=Object.defineProperty,y2=Object.defineProperties,v2=Object.getOwnPropertyDescriptors,ys=Object.getOwnPropertySymbols,Hm=Object.prototype.hasOwnProperty,Xm=Object.prototype.propertyIsEnumerable,jm=(r,t,e)=>t in r?b2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Da=(r,t)=>{for(var e in t||(t={}))Hm.call(t,e)&&jm(r,e,t[e]);if(ys)for(var e of ys(t))Xm.call(t,e)&&jm(r,e,t[e]);return r},x2=(r,t)=>y2(r,v2(t)),T2=(r,t)=>{var e={};for(var i in r)Hm.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ys)for(var i of ys(r))t.indexOf(i)<0&&Xm.call(r,i)&&(e[i]=r[i]);return e};const zm=class Vy extends Qt{constructor(t){t=Da(Da({},Vy.defaultOptions),t);const e=Tt.from({vertex:{source:Fa,entryPoint:"mainVertex"},fragment:{source:Fa,entryPoint:"mainFragment"}}),i=Ct.from({vertex:bs,fragment:Nm,name:"alpha-filter"}),s=t,{alpha:n}=s,o=T2(s,["alpha"]),a=new st({uAlpha:{value:n,type:"f32"}});super(x2(Da({},o),{gpuProgram:e,glProgram:i,resources:{alphaUniforms:a}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};zm.defaultOptions={alpha:1};let S2=zm;const Ua={5:[.153388,.221461,.250301],7:[.071303,.131514,.189879,.214607],9:[.028532,.067234,.124009,.179044,.20236],11:[.0093,.028002,.065984,.121703,.175713,.198596],13:[.002406,.009255,.027867,.065666,.121117,.174868,.197641],15:[489e-6,.002403,.009246,.02784,.065602,.120999,.174697,.197448]},E2=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(` +`);function Vm(r){const t=Ua[r],e=t.length;let i=E2,s="";const n="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a=e&&(o=r-a-1),l=l.replace("%value%",t[o].toString()),s+=l,s+=` +`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const A2=` + in vec2 aPosition; + + uniform float uStrength; + + out vec2 vBlurTexCoords[%size%]; + + uniform vec4 uInputSize; + uniform vec4 uOutputFrame; + uniform vec4 uOutputTexture; + + vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + + vec2 filterTextureCoord( void ) + { + return aPosition * (uOutputFrame.zw * uInputSize.zw); + } + + void main(void) + { + gl_Position = filterVertexPosition(); + + float pixelStrength = uInputSize.%dimension% * uStrength; + + vec2 textureCoord = filterTextureCoord(); + %blur% + }`;function Wm(r,t){const e=Math.ceil(r/2);let i=A2,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let o=0;o, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct BlurUniforms { + uStrength:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var blurUniforms : BlurUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + %blur-struct% + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + + let filteredCord = filterTextureCoord(aPosition); + + let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength; + + return VSOutput( + filterVertexPosition(aPosition), + %blur-vertex-out% + ); +} + +@fragment +fn mainFragment( + @builtin(position) position: vec4, + %blur-fragment-in% +) -> @location(0) vec4 { + + var finalColor = vec4(0.0); + + %blur-sampling% + + return finalColor; +}`;function qm(r,t){const e=Ua[t],i=e.length,s=[],n=[],o=[];for(let h=0;h,`,r?n[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:n[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;const p=ht in r?P2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ka=(r,t)=>{for(var e in t||(t={}))w2.call(t,e)&&Qm(r,e,t[e]);if(Zm)for(var e of Zm(t))R2.call(t,e)&&Qm(r,e,t[e]);return r};const Jm=class Wy extends Qt{constructor(t){t=ka(ka({},Wy.defaultOptions),t);const e=Ym(t.horizontal,t.kernelSize),i=qm(t.horizontal,t.kernelSize);super(ka({glProgram:e,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,i,s);else{const n=ht.getSameSizeTexture(e);let o=e,a=n;this._state.blend=!1;const l=t.renderer.type===gt.WEBGPU;for(let u=0;ut in r?M2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Wr=(r,t)=>{for(var e in t||(t={}))tg.call(t,e)&&rg(r,e,t[e]);if(xs)for(var e of xs(t))eg.call(t,e)&&rg(r,e,t[e]);return r},G2=(r,t)=>C2(r,O2(t)),B2=(r,t)=>{var e={};for(var i in r)tg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&xs)for(var i of xs(r))t.indexOf(i)<0&&eg.call(r,i)&&(e[i]=r[i]);return e};class ig extends Qt{constructor(...t){var e;let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={strength:i},t[1]!==void 0&&(i.quality=t[1]),t[2]!==void 0&&(i.resolution=t[2]||"inherit"),t[3]!==void 0&&(i.kernelSize=t[3])),i=Wr(Wr({},vs.defaultOptions),i);const s=i,{strength:n,strengthX:o,strengthY:a,quality:l}=s,u=B2(s,["strength","strengthX","strengthY","quality"]);super(G2(Wr({},u),{compatibleRenderers:gt.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new vs(Wr({horizontal:!0},i)),this.blurYFilter=new vs(Wr({horizontal:!1},i)),this.quality=l,this.strengthX=o!=null?o:n,this.strengthY=a!=null?a:n,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=ht.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,a,i,s),ht.returnTexture(a)}else o?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}ig.defaultOptions={strength:8,quality:4,kernelSize:5};var sg=` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uColorMatrix[20]; +uniform float uAlpha; + +uniform sampler2D uTexture; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture(uTexture, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * 0.2); + float diff = (randomValue - 0.5) * 0.5; + + if (uAlpha == 0.0) { + finalColor = color; + return; + } + + if (color.a > 0.0) { + color.rgb /= color.a; + } + + vec4 result; + + result.r = (uColorMatrix[0] * color.r); + result.r += (uColorMatrix[1] * color.g); + result.r += (uColorMatrix[2] * color.b); + result.r += (uColorMatrix[3] * color.a); + result.r += uColorMatrix[4]; + + result.g = (uColorMatrix[5] * color.r); + result.g += (uColorMatrix[6] * color.g); + result.g += (uColorMatrix[7] * color.b); + result.g += (uColorMatrix[8] * color.a); + result.g += uColorMatrix[9]; + + result.b = (uColorMatrix[10] * color.r); + result.b += (uColorMatrix[11] * color.g); + result.b += (uColorMatrix[12] * color.b); + result.b += (uColorMatrix[13] * color.a); + result.b += uColorMatrix[14]; + + result.a = (uColorMatrix[15] * color.r); + result.a += (uColorMatrix[16] * color.g); + result.a += (uColorMatrix[17] * color.b); + result.a += (uColorMatrix[18] * color.a); + result.a += uColorMatrix[19]; + + vec3 rgb = mix(color.rgb, result.rgb, uAlpha); + + // Premultiply alpha again. + rgb *= result.a; + + finalColor = vec4(rgb, result.a); +} +`,$a=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct ColorMatrixUniforms { + uColorMatrix:array, 5>, + uAlpha:f32, +}; + + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; +@group(1) @binding(0) var colorMatrixUniforms : ColorMatrixUniforms; + + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + ); +} + + +@fragment +fn mainFragment( + @location(0) uv: vec2, +) -> @location(0) vec4 { + + + var c = textureSample(uTexture, uSampler, uv); + + if (colorMatrixUniforms.uAlpha == 0.0) { + return c; + } + + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (c.a > 0.0) { + c.r /= c.a; + c.g /= c.a; + c.b /= c.a; + } + + var cm = colorMatrixUniforms.uColorMatrix; + + + var result = vec4(0.); + + result.r = (cm[0][0] * c.r); + result.r += (cm[0][1] * c.g); + result.r += (cm[0][2] * c.b); + result.r += (cm[0][3] * c.a); + result.r += cm[1][0]; + + result.g = (cm[1][1] * c.r); + result.g += (cm[1][2] * c.g); + result.g += (cm[1][3] * c.b); + result.g += (cm[2][0] * c.a); + result.g += cm[2][1]; + + result.b = (cm[2][2] * c.r); + result.b += (cm[2][3] * c.g); + result.b += (cm[3][0] * c.b); + result.b += (cm[3][1] * c.a); + result.b += cm[3][2]; + + result.a = (cm[3][3] * c.r); + result.a += (cm[4][0] * c.g); + result.a += (cm[4][1] * c.b); + result.a += (cm[4][2] * c.a); + result.a += cm[4][3]; + + var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha); + + rgb.r *= result.a; + rgb.g *= result.a; + rgb.b *= result.a; + + return vec4(rgb, result.a); +}`,I2=Object.defineProperty,F2=Object.defineProperties,D2=Object.getOwnPropertyDescriptors,ng=Object.getOwnPropertySymbols,U2=Object.prototype.hasOwnProperty,k2=Object.prototype.propertyIsEnumerable,og=(r,t,e)=>t in r?I2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$2=(r,t)=>{for(var e in t||(t={}))U2.call(t,e)&&og(r,e,t[e]);if(ng)for(var e of ng(t))k2.call(t,e)&&og(r,e,t[e]);return r},L2=(r,t)=>F2(r,D2(t));class N2 extends Qt{constructor(t={}){const e=new st({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),i=Tt.from({vertex:{source:$a,entryPoint:"mainVertex"},fragment:{source:$a,entryPoint:"mainFragment"}}),s=Ct.from({vertex:bs,fragment:sg,name:"color-matrix-filter"});super(L2($2({},t),{gpuProgram:i,glProgram:s,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.matrix,t),i=this._colorMatrix(i)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=i,this.resources.colorMatrixUniforms.update()}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=V.shared.setValue(t).toArray(),o=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),l=i+(1-i)*o,u=o*(1-i)-a*s,c=o*(1-i)+a*s,h=o*(1-i)+a*s,p=i+o*(1-i),f=o*(1-i)-a*s,m=o*(1-i)-a*s,_=o*(1-i)+a*s,g=i+o*(1-i),b=[l,u,c,0,0,h,p,f,0,0,m,_,g,0,0,0,0,0,1,0];this._loadMatrix(b,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[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];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[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];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const o=V.shared,[a,l,u]=o.setValue(i).toArray(),[c,h,p]=o.setValue(s).toArray(),f=[.3,.59,.11,0,0,a,l,u,t,0,c,h,p,e,0,a-c,l-h,u-p,0,0];this._loadMatrix(f,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[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(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var ag=` +in vec2 vTextureCoord; +in vec2 vFilterUv; + +out vec4 finalColor; + +uniform sampler2D uTexture; +uniform sampler2D uMapTexture; + +uniform vec4 uInputClamp; +uniform highp vec4 uInputSize; +uniform mat2 uRotation; +uniform vec2 uScale; + +void main() +{ + vec4 map = texture(uMapTexture, vFilterUv); + + vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale; + + finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw)); +} +`,lg=`in vec2 aPosition; +out vec2 vTextureCoord; +out vec2 vFilterUv; + + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; + +uniform mat3 uFilterMatrix; + +vec4 filterVertexPosition( void ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( void ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +vec2 getFilterCoord( void ) +{ + return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy; +} + + +void main(void) +{ + gl_Position = filterVertexPosition(); + vTextureCoord = filterTextureCoord(); + vFilterUv = getFilterCoord(); +} +`,La=` +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct DisplacementUniforms { + uFilterMatrix:mat3x3, + uScale:vec2, + uRotation:mat2x2 +}; + + + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : DisplacementUniforms; +@group(1) @binding(1) var uMapTexture: texture_2d; +@group(1) @binding(2) var uMapSampler : sampler; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + + + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var map = textureSample(uMapTexture, uMapSampler, filterUv); + + var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale; + + return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw)); +}`,H2=Object.defineProperty,X2=Object.defineProperties,j2=Object.getOwnPropertyDescriptors,Ts=Object.getOwnPropertySymbols,ug=Object.prototype.hasOwnProperty,cg=Object.prototype.propertyIsEnumerable,hg=(r,t,e)=>t in r?H2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,z2=(r,t)=>{for(var e in t||(t={}))ug.call(t,e)&&hg(r,e,t[e]);if(Ts)for(var e of Ts(t))cg.call(t,e)&&hg(r,e,t[e]);return r},V2=(r,t)=>X2(r,j2(t)),W2=(r,t)=>{var e={};for(var i in r)ug.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ts)for(var i of Ts(r))t.indexOf(i)<0&&cg.call(r,i)&&(e[i]=r[i]);return e};class Y2 extends Qt{constructor(...t){let e=t[0];e instanceof It&&(e={sprite:e,scale:t[1]});const i=e,{sprite:s,scale:n}=i,o=W2(i,["sprite","scale"]);let a=n!=null?n:20;typeof a=="number"&&(a=new Y(a,a));const l=new st({uFilterMatrix:{value:new G,type:"mat3x3"},uScale:{value:a,type:"vec2"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2"}}),u=Ct.from({vertex:lg,fragment:ag,name:"displacement-filter"}),c=Tt.from({vertex:{source:La,entryPoint:"mainVertex"},fragment:{source:La,entryPoint:"mainFragment"}}),h=s.texture.source;super(V2(z2({},o),{gpuProgram:c,glProgram:u,resources:{filterUniforms:l,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,i,s){const n=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite);const o=this._sprite.worldTransform,a=Math.sqrt(o.a*o.a+o.b*o.b),l=Math.sqrt(o.c*o.c+o.d*o.d);a!==0&&l!==0&&(n.uRotation[0]=o.a/a,n.uRotation[1]=o.b/a,n.uRotation[2]=o.c/l,n.uRotation[3]=o.d/l),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,i,s)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var dg=` +in vec2 vTextureCoord; +in vec4 vColor; + +out vec4 finalColor; + +uniform float uNoise; +uniform float uSeed; +uniform sampler2D uTexture; + +float rand(vec2 co) +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + +void main() +{ + vec4 color = texture(uTexture, vTextureCoord); + float randomValue = rand(gl_FragCoord.xy * uSeed); + float diff = (randomValue - 0.5) * uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (color.a > 0.0) { + color.rgb /= color.a; + } + + color.r += diff; + color.g += diff; + color.b += diff; + + // Premultiply alpha again. + color.rgb *= color.a; + + finalColor = color; +} +`,Na=` + +struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct NoiseUniforms { + uNoise:f32, + uSeed:f32, +}; + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var noiseUniforms : NoiseUniforms; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2 + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getSize() -> vec2 +{ + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition) + ); +} + +fn rand(co:vec2) -> f32 +{ + return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453); +} + + + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy); + + + var sample = textureSample(uTexture, uSampler, uv); + var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed); + var diff = (randomValue - 0.5) * noiseUniforms.uNoise; + + // Un-premultiply alpha before applying the color matrix. See issue #3539. + if (sample.a > 0.0) { + sample.r /= sample.a; + sample.g /= sample.a; + sample.b /= sample.a; + } + + sample.r += diff; + sample.g += diff; + sample.b += diff; + + // Premultiply alpha again. + sample.r *= sample.a; + sample.g *= sample.a; + sample.b *= sample.a; + + return sample; +}`,K2=Object.defineProperty,q2=Object.defineProperties,Z2=Object.getOwnPropertyDescriptors,Ss=Object.getOwnPropertySymbols,pg=Object.prototype.hasOwnProperty,fg=Object.prototype.propertyIsEnumerable,mg=(r,t,e)=>t in r?K2(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ha=(r,t)=>{for(var e in t||(t={}))pg.call(t,e)&&mg(r,e,t[e]);if(Ss)for(var e of Ss(t))fg.call(t,e)&&mg(r,e,t[e]);return r},Q2=(r,t)=>q2(r,Z2(t)),J2=(r,t)=>{var e={};for(var i in r)pg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ss)for(var i of Ss(r))t.indexOf(i)<0&&fg.call(r,i)&&(e[i]=r[i]);return e};const gg=class Yy extends Qt{constructor(t={}){t=Ha(Ha({},Yy.defaultOptions),t);const e=Tt.from({vertex:{source:Na,entryPoint:"mainVertex"},fragment:{source:Na,entryPoint:"mainFragment"}}),i=Ct.from({vertex:bs,fragment:dg,name:"noise-filter"}),s=t,{noise:n,seed:o}=s,a=J2(s,["noise","seed"]);super(Q2(Ha({},a),{gpuProgram:e,glProgram:i,resources:{noiseUniforms:new st({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=o!=null?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};gg.defaultOptions={noise:.5};let tE=gg;var _g=`in vec2 vMaskCoord; +in vec2 vTextureCoord; + +uniform sampler2D uTexture; +uniform sampler2D uMaskTexture; + +uniform float uAlpha; +uniform vec4 uMaskClamp; + +out vec4 finalColor; + +void main(void) +{ + float clip = step(3.5, + step(uMaskClamp.x, vMaskCoord.x) + + step(uMaskClamp.y, vMaskCoord.y) + + step(vMaskCoord.x, uMaskClamp.z) + + step(vMaskCoord.y, uMaskClamp.w)); + + // TODO look into why this is needed + float npmAlpha = uAlpha; + vec4 original = texture(uTexture, vTextureCoord); + vec4 masky = texture(uMaskTexture, vMaskCoord); + float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a); + + original *= (alphaMul * masky.r * uAlpha * clip); + + finalColor = original; +} +`,bg=`in vec2 aPosition; + +out vec2 vTextureCoord; +out vec2 vMaskCoord; + + +uniform vec4 uInputSize; +uniform vec4 uOutputFrame; +uniform vec4 uOutputTexture; +uniform mat3 uFilterMatrix; + +vec4 filterVertexPosition( vec2 aPosition ) +{ + vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy; + + position.x = position.x * (2.0 / uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +vec2 filterTextureCoord( vec2 aPosition ) +{ + return aPosition * (uOutputFrame.zw * uInputSize.zw); +} + +vec2 getFilterCoord( vec2 aPosition ) +{ + return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +void main(void) +{ + gl_Position = filterVertexPosition(aPosition); + vTextureCoord = filterTextureCoord(aPosition); + vMaskCoord = getFilterCoord(aPosition); +} +`,Xa=`struct GlobalFilterUniforms { + uInputSize:vec4, + uInputPixel:vec4, + uInputClamp:vec4, + uOutputFrame:vec4, + uGlobalFrame:vec4, + uOutputTexture:vec4, +}; + +struct MaskUniforms { + uFilterMatrix:mat3x3, + uMaskClamp:vec4, + uAlpha:f32, +}; + + +@group(0) @binding(0) var gfu: GlobalFilterUniforms; +@group(0) @binding(1) var uTexture: texture_2d; +@group(0) @binding(2) var uSampler : sampler; + +@group(1) @binding(0) var filterUniforms : MaskUniforms; +@group(1) @binding(1) var uMaskTexture: texture_2d; + +struct VSOutput { + @builtin(position) position: vec4, + @location(0) uv : vec2, + @location(1) filterUv : vec2, + }; + +fn filterVertexPosition(aPosition:vec2) -> vec4 +{ + var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy; + + position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0; + position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z; + + return vec4(position, 0.0, 1.0); +} + +fn filterTextureCoord( aPosition:vec2 ) -> vec2 +{ + return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw); +} + +fn globalTextureCoord( aPosition:vec2 ) -> vec2 +{ + return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw); +} + +fn getFilterCoord(aPosition:vec2 ) -> vec2 +{ + return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy; +} + +fn getSize() -> vec2 +{ + + + return gfu.uGlobalFrame.zw; +} + +@vertex +fn mainVertex( + @location(0) aPosition : vec2, +) -> VSOutput { + return VSOutput( + filterVertexPosition(aPosition), + filterTextureCoord(aPosition), + getFilterCoord(aPosition) + ); +} + +@fragment +fn mainFragment( + @location(0) uv: vec2, + @location(1) filterUv: vec2, + @builtin(position) position: vec4 +) -> @location(0) vec4 { + + var maskClamp = filterUniforms.uMaskClamp; + + var clip = step(3.5, + step(maskClamp.x, filterUv.x) + + step(maskClamp.y, filterUv.y) + + step(filterUv.x, maskClamp.z) + + step(filterUv.y, maskClamp.w)); + + var mask = textureSample(uMaskTexture, uSampler, filterUv); + var source = textureSample(uTexture, uSampler, uv); + + var npmAlpha = 0.0; + + var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a); + + var a = (alphaMul * mask.r) * clip; + + return vec4(source.rgb, source.a) * a; +}`,eE=Object.defineProperty,rE=Object.defineProperties,iE=Object.getOwnPropertyDescriptors,Es=Object.getOwnPropertySymbols,yg=Object.prototype.hasOwnProperty,vg=Object.prototype.propertyIsEnumerable,xg=(r,t,e)=>t in r?eE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,sE=(r,t)=>{for(var e in t||(t={}))yg.call(t,e)&&xg(r,e,t[e]);if(Es)for(var e of Es(t))vg.call(t,e)&&xg(r,e,t[e]);return r},nE=(r,t)=>rE(r,iE(t)),oE=(r,t)=>{var e={};for(var i in r)yg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Es)for(var i of Es(r))t.indexOf(i)<0&&vg.call(r,i)&&(e[i]=r[i]);return e};class Tg extends Qt{constructor(t){const e=t,{sprite:i}=e,s=oE(e,["sprite"]),n=new Rn(i.texture),o=new st({uFilterMatrix:{value:new G,type:"mat3x3"},uMaskClamp:{value:n.uClampFrame,type:"vec4"},uAlpha:{value:1,type:"f32"}}),a=Tt.from({vertex:{source:Xa,entryPoint:"mainVertex"},fragment:{source:Xa,entryPoint:"mainFragment"}}),l=Ct.from({vertex:bg,fragment:_g,name:"mask-filter"});super(nE(sE({},s),{gpuProgram:a,glProgram:l,resources:{filterUniforms:o,uMaskTexture:i.texture.source}})),this.sprite=i,this._textureMatrix=n}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}var aE=`fn getLuminosity(c: vec3) -> f32 { + return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b; +} + +fn setLuminosity(c: vec3, lum: f32) -> vec3 { + let d: f32 = lum - getLuminosity(c); + let newColor: vec3 = c.rgb + vec3(d, d, d); + + // clip back into legal range + let newLum: f32 = getLuminosity(newColor); + let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b)); + let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b)); + + let t1: f32 = newLum / (newLum - cMin); + let t2: f32 = (1.0 - newLum) / (cMax - newLum); + + let finalColor = mix(vec3(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0)); + + return finalColor; +} + +fn getSaturation(c: vec3) -> f32 { + return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b)); +} + +// Set saturation if color components are sorted in ascending order. +fn setSaturationMinMidMax(cSorted: vec3, s: f32) -> vec3 { + var result: vec3; + if (cSorted.z > cSorted.x) { + let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x)); + result = vec3(0.0, newY, s); + } else { + result = vec3(0.0, 0.0, 0.0); + } + return vec3(result.x, result.y, result.z); +} + +fn setSaturation(c: vec3, s: f32) -> vec3 { + var result: vec3 = c; + + if (c.r <= c.g && c.r <= c.b) { + if (c.g <= c.b) { + result = setSaturationMinMidMax(result, s); + } else { + var temp: vec3 = vec3(result.r, result.b, result.g); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.r, temp.b, temp.g); + } + } else if (c.g <= c.r && c.g <= c.b) { + if (c.r <= c.b) { + var temp: vec3 = vec3(result.g, result.r, result.b); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.g, temp.r, temp.b); + } else { + var temp: vec3 = vec3(result.g, result.b, result.r); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.g, temp.b, temp.r); + } + } else { + if (c.r <= c.g) { + var temp: vec3 = vec3(result.b, result.r, result.g); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.b, temp.r, temp.g); + } else { + var temp: vec3 = vec3(result.b, result.g, result.r); + temp = setSaturationMinMidMax(temp, s); + result = vec3(temp.b, temp.g, temp.r); + } + } + + return result; +}`;function ja(r,t,e,i,s,n,o,a){const l=o-e,u=a-i,c=s-e,h=n-i,p=r-e,f=t-i,m=l*l+u*u,_=l*c+u*h,g=l*p+u*f,b=c*c+h*h,v=c*p+h*f,y=1/(m*b-_*_),T=(b*g-_*v)*y,E=(m*v-_*g)*y;return T>=0&&E>=0&&T+E<1}class za{constructor(t=0,e=0,i=0,s=0,n=0,o=0){this.type="triangle",this.x=t,this.y=e,this.x2=i,this.y2=s,this.x3=n,this.y3=o}contains(t,e){const i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),s=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=s<0&&i!==0&&s!==0)return!1;const n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return n===0||n<0==i+s<=0}strokeContains(t,e,i){const s=i/2,n=s*s,{x:o,x2:a,x3:l,y:u,y2:c,y3:h}=this;return Rr(t,e,o,u,a,h)<=n||Rr(t,e,a,c,l,h)<=n||Rr(t,e,l,h,o,u)<=n}clone(){return new za(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new W;const e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),s=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=s,t.width=i-e,t.height=n-s,t}}const Sg=class Ky{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let i=0;for(;e.length&&i{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),ct.system.addOnce(this._tick,this,Wt.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let i=0;it in r?lE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uE=(r,t)=>{for(var e in t||(t={}))Ag.call(t,e)&&wg(r,e,t[e]);if(As)for(var e of As(t))Pg.call(t,e)&&wg(r,e,t[e]);return r},cE=(r,t)=>{var e={};for(var i in r)Ag.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&As)for(var i of As(r))t.indexOf(i)<0&&Pg.call(r,i)&&(e[i]=r[i]);return e};class er extends ge{constructor(...t){var e;let i=t[0];i instanceof De&&(i={geometry:i,shader:t[1]},t[3]&&(i.geometry.topology=t[3]));const s=i,{geometry:n,shader:o,texture:a,roundPixels:l,state:u}=s,c=cE(s,["geometry","shader","texture","roundPixels","state"]);super(uE({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=o!=null?o:null,this.texture=(e=a!=null?a:o==null?void 0:o.texture)!=null?e:P.WHITE,this.state=u!=null?u:Ft.for2d(),this._geometry=n,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=l!=null?l:!1}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&((e=this._geometry)==null||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=P.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return this._shader||this.state.data&12?!1:this._geometry instanceof ie?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}addBounds(t){t.addBounds(this.geometry.bounds)}containsPoint(t){const{x:e,y:i}=t;if(!this.bounds.containsPoint(e,i))return!1;const s=this.geometry.getBuffer("aPosition").data,n=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const o=this.geometry.getIndex().data,a=o.length;for(let l=0;l+2t in r?hE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fE=(r,t)=>{for(var e in t||(t={}))Rg.call(t,e)&&Cg(r,e,t[e]);if(Ps)for(var e of Ps(t))Mg.call(t,e)&&Cg(r,e,t[e]);return r},mE=(r,t)=>dE(r,pE(t)),gE=(r,t)=>{var e={};for(var i in r)Rg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ps)for(var i of Ps(r))t.indexOf(i)<0&&Mg.call(r,i)&&(e[i]=r[i]);return e};class Yr extends It{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const i=e,{textures:s,autoUpdate:n}=i,o=gE(i,["textures","autoUpdate"]),[a]=s;super(mE(fE({},o),{texture:a instanceof P?a:a.texture})),this._textures=null,this._durations=null,this._autoUpdate=n!=null?n:!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=s}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(ct.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(ct.shared.add(this.update,this,Wt.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;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()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrames)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;ithis.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(ct.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(ct.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Og{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new G,this.observer=e,this.position=new it(this,0,0),this.scale=new it(this,1,1),this.pivot=new it(this,0,0),this.skew=new it(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(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.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),(e=this.observer)==null||e._onUpdate(this)}updateSkew(){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.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var _E=Object.defineProperty,ws=Object.getOwnPropertySymbols,Gg=Object.prototype.hasOwnProperty,Bg=Object.prototype.propertyIsEnumerable,Ig=(r,t,e)=>t in r?_E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Kr=(r,t)=>{for(var e in t||(t={}))Gg.call(t,e)&&Ig(r,e,t[e]);if(ws)for(var e of ws(t))Bg.call(t,e)&&Ig(r,e,t[e]);return r},bE=(r,t)=>{var e={};for(var i in r)Gg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ws)for(var i of ws(r))t.indexOf(i)<0&&Bg.call(r,i)&&(e[i]=r[i]);return e};const Fg=class en extends ge{constructor(...t){let e=t[0]||{};e instanceof P&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=Kr(Kr({},en.defaultOptions),e);const i=e!=null?e:{},{texture:s,anchor:n,tilePosition:o,tileScale:a,tileRotation:l,width:u,height:c,applyAnchorToTexture:h,roundPixels:p}=i,f=bE(i,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Kr({label:"TilingSprite"},f)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new it({_onUpdate:()=>{this.onViewUpdate()}}),this._applyAnchorToTexture=h,this.texture=s,this._width=u!=null?u:s.width,this._height=c!=null?c:s.height,this._tileTransform=new Og({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=o,this.tileScale=a,this.tileRotation=l,this.roundPixels=p!=null?p:!1}static from(t,e={}){return typeof t=="string"?new en(Kr({texture:K.get(t)},e)):new en(Kr({texture:t},e))}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}set texture(t){t||(t=P.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}_updateBounds(){const t=this._bounds,e=this._anchor,i=this._width,s=this._height;t.maxX=-e._x*i,t.minX=t.maxX+i,t.maxY=-e._y*s,t.minY=t.maxY+s}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this._width,i=this._height,s=-e*this._anchor._x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this._anchor._y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._boundsDirty=!0,this._didTilingSpriteUpdate=!0,this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};Fg.defaultOptions={texture:P.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let Dg=Fg;var yE=Object.defineProperty,Rs=Object.getOwnPropertySymbols,Ug=Object.prototype.hasOwnProperty,kg=Object.prototype.propertyIsEnumerable,$g=(r,t,e)=>t in r?yE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,vE=(r,t)=>{for(var e in t||(t={}))Ug.call(t,e)&&$g(r,e,t[e]);if(Rs)for(var e of Rs(t))kg.call(t,e)&&$g(r,e,t[e]);return r},xE=(r,t)=>{var e={};for(var i in r)Ug.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Rs)for(var i of Rs(r))t.indexOf(i)<0&&kg.call(r,i)&&(e[i]=r[i]);return e};class Ms extends ge{constructor(t,e){const i=t,{text:s,resolution:n,style:o,anchor:a,width:l,height:u,roundPixels:c}=i,h=xE(i,["text","resolution","style","anchor","width","height","roundPixels"]);super(vE({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=s!=null?s:"",this.style=o,this.resolution=n!=null?n:null,this.allowChildren=!1,this._anchor=new it({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c!=null?c:!1,l!==void 0&&(this.width=l),u!==void 0&&(this.height=u)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function Cs(r,t){var e;let i=(e=r[0])!=null?e:{};return(typeof i=="string"||r[1])&&(i={text:i,style:r[1]}),i}class Va extends Ms{constructor(...t){const e=Cs(t,"Text");super(e,Et),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Ut.measureText(this._text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class Lg extends Eg{resolveQueueItem(t,e){return t instanceof J?this.resolveContainerQueueItem(t,e):t instanceof et||t instanceof P?e.push(t.source):t instanceof dt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof It||t instanceof Dg||t instanceof er?e.push(t.texture.source):t instanceof Va?e.push(t):t instanceof Ke?e.push(t.context):t instanceof Yr&&t.textures.forEach(i=>{i.source?e.push(i.source):e.push(i.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;return s.source}else if(i.action==="fill"){const{texture:s}=i.data.style;return s.source}return null}}class Ng extends Ms{constructor(...t){var e,i,s;const n=Cs(t,"BitmapText");(e=n.style)!=null||(n.style=n.style||{}),(s=(i=n.style).fill)!=null||(i.fill=16777215),super(n,Et),this.renderPipeId="bitmapText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Ir.measureText(this.text,this._style),s=i.scale,n=i.offsetY*s;let o=i.width*s,a=i.height*s;const l=this._style._stroke;l&&(o+=l.width,a+=l.width),t.minX=-e._x*o,t.maxX=t.minX+o,t.minY=-e._y*(a+n),t.maxY=t.minY+a}}class Hg extends Ms{constructor(...t){const e=Cs(t,"HtmlText");super(e,Se),this.renderPipeId="htmlText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Jo(this.text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class Xg extends Lg{uploadQueueItem(t){t instanceof et?this.uploadTextureSource(t):t instanceof Va?this.uploadText(t):t instanceof Hg?this.uploadHTMLText(t):t instanceof Ng?this.uploadBitmapText(t):t instanceof dt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;this.uploadTextureSource(s.source)}else if(i.action==="fill"){const{texture:s}=i.data.style;this.uploadTextureSource(s.source)}return null}}class jg extends Xg{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}jg.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"prepare"};class Wa{constructor(){this._didUpload=!1,this._tempState=Ft.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,i){const s=t.renderer;s.shader.bind(i,this._didUpload),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){const i=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);const s=e.textures.textures;for(let n=0;ni.trim()).filter(i=>i.length);let e="";return t.map(i=>{let s=e+i;return i==="{"?e+=" ":i==="}"&&(e=e.substr(0,e.length-4),s=e+i),s}).join(` +`)}const zg={name:"texture-bit",vertex:{header:` + + struct TextureUniforms { + uTextureMatrix:mat3x3, + } + + @group(2) @binding(2) var textureUniforms : TextureUniforms; + `,main:` + uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + @group(2) @binding(0) var uTexture: texture_2d; + @group(2) @binding(1) var uSampler: sampler; + + + `,main:` + outColor = textureSample(uTexture, uSampler, vUV); + `}},Vg={name:"texture-bit",vertex:{header:` + uniform mat3 uTextureMatrix; + `,main:` + uv = (uTextureMatrix * vec3(uv, 1.0)).xy; + `},fragment:{header:` + uniform sampler2D uTexture; + + + `,main:` + outColor = texture(uTexture, vUV); + `}};function Wg(r,t){const e=r.root,i=r.instructionSet;i.reset();const s=t.renderPipes?t:t.batch.renderer,n=s.renderPipes;n.batch.buildStart(i),n.blendMode.buildStart(),n.colorMask.buildStart(),e.sortableChildren&&e.sortChildren(),Yg(e,i,s,!0),n.batch.buildEnd(i),n.blendMode.buildEnd(i)}function qr(r,t,e){const i=e.renderPipes?e:e.batch.renderer;r.globalDisplayStatus<7||!r.includeInBuild||(r.sortableChildren&&r.sortChildren(),r.isSimple?AE(r,t,i):Yg(r,t,i,!1))}function AE(r,t,e){if(r.renderPipeId){const{renderPipes:i,renderableGC:s}=e;i.blendMode.setBlendMode(r,r.groupBlendMode,t),r.didViewUpdate=!1,i[r.renderPipeId].addRenderable(r,t),s.addRenderable(r,t)}if(!r.renderGroup){const i=r.children,s=i.length;for(let n=0;n=0;l--){const u=r.effects[l];s[u.pipe].pop(u,r,t)}}}const PE=new ut;let wE=class extends ur{constructor(){super(),this.filters=[new Tg({sprite:new It(P.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}};class Za{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){const s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,canBundle:!1,maskedContainer:e}),t.renderMaskToTexture){const n=t.mask;n.includeInBuild=!0,qr(n,i,s),n.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,canBundle:!1})}execute(t){const e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const s=H.get(wE);if(i){t.mask.mask.measurable=!0;const n=cr(t.mask.mask,!0,PE);t.mask.mask.measurable=!1,n.ceil();const o=e.renderTarget.renderTarget.colorTexture.source,a=ht.getOptimalTexture(n.width,n.height,o._resolution,o.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});const l=s.sprite;l.texture=a,l.worldTransform.tx=n.minX,l.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:a})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){const s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===gt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();const s=this._activeMaskStage.pop();i&&ht.returnTexture(s.filterTexture),H.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}Za.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"alphaMask"};class Qa{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&t.mask;const n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;this._colorStackIndex--;const n=s[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}Qa.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"colorMask"};class RE{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){vi(this.mask,t,e)}addLocalBounds(t,e){xi(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}}class Ja{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s,n;const o=t,a=this._renderer;a.renderPipes.batch.break(i),a.renderPipes.blendMode.setBlendMode(o.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,canBundle:!1});const l=o.mask;l.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});const u=this._maskHash.get(o);u.instructionsStart=i.instructionSize,qr(l,i,a),l.includeInBuild=!1,a.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,canBundle:!1});const c=i.instructionSize-u.instructionsStart-1;u.instructionsLength=c;const h=a.renderTarget.renderTarget.uid;(n=(s=this._maskStackHash)[h])!=null||(s[h]=0)}pop(t,e,i){const s=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});const o=this._maskHash.get(t);for(let a=0;a(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Zr||{});class Kg{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class tl{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){const{_gl:i}=this;if(this._boundBufferBases[e]!==t){const s=this.getGlBuffer(t);this._boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,i){const{_gl:s}=this;i=i||0;const n=this.getGlBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}updateBuffer(t){const{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);const s=t.data;if(i.byteLength>=t.data.byteLength)e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT);else{const n=t.descriptor.usage&j.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=s.byteLength,e.bufferData(i.type,s,n)}return i}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let i=Zr.ARRAY_BUFFER;t.descriptor.usage&j.INDEX?i=Zr.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&j.UNIFORM&&(i=Zr.UNIFORM_BUFFER);const s=new Kg(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}}tl.extension={type:[x.WebGLSystem],name:"buffer"};var ME=Object.defineProperty,CE=Object.defineProperties,OE=Object.getOwnPropertyDescriptors,qg=Object.getOwnPropertySymbols,GE=Object.prototype.hasOwnProperty,BE=Object.prototype.propertyIsEnumerable,Zg=(r,t,e)=>t in r?ME(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gs=(r,t)=>{for(var e in t||(t={}))GE.call(t,e)&&Zg(r,e,t[e]);if(qg)for(var e of qg(t))BE.call(t,e)&&Zg(r,e,t[e]);return r},Qg=(r,t)=>CE(r,OE(t));const el=class Zy{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){var e,i;t=Gs(Gs({},Zy.defaultOptions),t);let s=this.multiView=t.multiView;if(t.context&&s&&(re("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),s=!1),s?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const n=this._renderer.background.alpha<1,o=(e=t.premultipliedAlpha)!=null?e:!0,a=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:o,antialias:a,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(i=t.powerPreference)!=null?i:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&re("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:e}=this;(e.width{var e;this.gl.isContextLost()&&((e=this.extensions.loseContext)==null||e.restoreContext())},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var t;(t=this.extensions.loseContext)==null||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const i=this.supports,s=this.webGLVersion===2,n=this.extensions;i.uint32Indices=s||!!n.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!n.vertexArrayObject,i.srgbTextures=s||!!n.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices}};el.extension={type:[x.WebGLSystem],name:"context"},el.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let Jg=el;function rl(r,t){var e,i,s;for(const n in r.attributes){const o=r.attributes[n],a=t[n];a?((e=o.format)!=null||(o.format=a.format),(i=o.offset)!=null||(o.offset=a.offset),(s=o.instance)!=null||(o.instance=a.instance)):re(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}IE(r)}function IE(r){var t,e;const{buffers:i,attributes:s}=r,n={},o={};for(const a in i){const l=i[a];n[l.uid]=0,o[l.uid]=0}for(const a in s){const l=s[a];n[l.buffer.uid]+=ke(l.format).stride}for(const a in s){const l=s[a];(t=l.stride)!=null||(l.stride=n[l.buffer.uid]),(e=l.start)!=null||(l.start=o[l.buffer.uid]),o[l.buffer.uid]+=ke(l.format).stride}}var Bs=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(Bs||{}),il=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(il||{}),t_=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(t_||{}),z=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(z||{});const e_={uint8x2:z.UNSIGNED_BYTE,uint8x4:z.UNSIGNED_BYTE,sint8x2:z.BYTE,sint8x4:z.BYTE,unorm8x2:z.UNSIGNED_BYTE,unorm8x4:z.UNSIGNED_BYTE,snorm8x2:z.BYTE,snorm8x4:z.BYTE,uint16x2:z.UNSIGNED_SHORT,uint16x4:z.UNSIGNED_SHORT,sint16x2:z.SHORT,sint16x4:z.SHORT,unorm16x2:z.UNSIGNED_SHORT,unorm16x4:z.UNSIGNED_SHORT,snorm16x2:z.SHORT,snorm16x4:z.SHORT,float16x2:z.HALF_FLOAT,float16x4:z.HALF_FLOAT,float32:z.FLOAT,float32x2:z.FLOAT,float32x3:z.FLOAT,float32x4:z.FLOAT,uint32:z.UNSIGNED_INT,uint32x2:z.UNSIGNED_INT,uint32x3:z.UNSIGNED_INT,uint32x4:z.UNSIGNED_INT,sint32:z.INT,sint32x2:z.INT,sint32x3:z.INT,sint32x4:z.INT};function r_(r){var t;return(t=e_[r])!=null?t:e_.float32}const FE={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class sl{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){const t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));const i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,n,o,a)=>{i.drawArraysInstancedANGLE(s,n,o,a)},t.drawElementsInstanced=(s,n,o,a,l)=>{i.drawElementsInstancedANGLE(s,n,o,a,l)},t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const i=this.gl;this._activeGeometry=t;const s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i1?n.drawElementsInstanced(a,e||o.indexBuffer.data.length,u,(i||0)*l,s):n.drawElements(a,e||o.indexBuffer.data.length,u,(i||0)*l)}else s>1?n.drawArraysInstanced(a,i||0,e||o.getSize(),s):n.drawArrays(a,i||0,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}sl.extension={type:[x.WebGLSystem],name:"geometry"};var DE=Object.defineProperty,i_=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,s_=(r,t,e)=>t in r?DE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,n_=(r,t)=>{for(var e in t||(t={}))UE.call(t,e)&&s_(r,e,t[e]);if(i_)for(var e of i_(t))kE.call(t,e)&&s_(r,e,t[e]);return r};const $E=new De({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),nl=class Qy{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:i}=n_(n_({},Qy.defaultOptions),t);this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(re("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Ft.for2d();const s=new Ct({vertex:` + attribute vec2 aPosition; + out vec2 vUv; + + void main() { + gl_Position = vec4(aPosition, 0.0, 1.0); + + vUv = (aPosition + 1.0) / 2.0; + + // flip dem UVs + vUv.y = 1.0 - vUv.y; + }`,fragment:` + in vec2 vUv; + out vec4 finalColor; + + uniform sampler2D uTexture; + + void main() { + finalColor = texture(uTexture, vUv); + }`,name:"big-triangle"});this._bigTriangleShader=new Ot({glProgram:s,resources:{uTexture:P.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:$E,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new P({source:new et({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};nl.extension={type:[x.WebGLSystem],name:"backBuffer",priority:1},nl.defaultOptions={useBackBuffer:!1};let o_=nl;class ol{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}}ol.extension={type:[x.WebGLSystem],name:"colorMask"};class al{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:i,shader:s,state:n,skipSync:o,topology:a,size:l,start:u,instanceCount:c}=t;e.shader.bind(s,o),e.geometry.bind(i,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,l,u,c!=null?c:i.instanceCount)}destroy(){this._renderer=null}}al.extension={type:[x.WebGLSystem],name:"encoder"};class a_{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const oe=[];oe[nt.NONE]=void 0,oe[nt.DISABLED]={stencilWriteMask:0,stencilReadMask:0},oe[nt.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},oe[nt.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},oe[nt.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};class ll{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:nt.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=nt.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:nt.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=oe[t],o=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===nt.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==o.stencilMode||o.stencilReference!==e)&&(o.stencilMode=t,o.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}ll.extension={type:[x.WebGLSystem],name:"stencil"};class ul{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!ua())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new xt({data:new Float32Array(e.layout.size/4),usage:j.UNIFORM|j.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let i=this._syncFunctionHash[e];if(!i){const s=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(s),o=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[e]={layout:n,syncFunction:o}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){const s=this.getUniformGroupData(t);return t.buffer||(t.buffer=new xt({data:new Float32Array(s.layout.size/4),usage:j.UNIFORM|j.COPY_DST})),e||(e=t.buffer.data),i||(i=0),s.syncFunction(t.uniforms,e,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const cl={f32:4,"vec2":8,"vec3":12,"vec4":16,"mat2x2":32,"mat3x3":48,"mat4x4":64};function l_(r){const t=r.map(n=>({data:n,offset:0,size:0}));let e=0,i=0,s=0;for(let n=0;n1&&(e=Math.max(e,16)*o.data.size),o.size=e,i%e!==0&&i<16){const a=i%e%16;i+=a,s+=a}i+e>16?(s=Math.ceil(s/16)*16,o.offset=s,s+=e,i=e):(o.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}const ae=[{type:"mat3x3",test:r=>r.value.a!==void 0,ubo:` + var matrix = uv[name].toArray(true); + data[offset] = matrix[0]; + data[offset + 1] = matrix[1]; + data[offset + 2] = matrix[2]; + data[offset + 4] = matrix[3]; + data[offset + 5] = matrix[4]; + data[offset + 6] = matrix[5]; + data[offset + 8] = matrix[6]; + data[offset + 9] = matrix[7]; + data[offset + 10] = matrix[8]; + `,uniform:` + gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true)); + `},{type:"vec4",test:r=>r.type==="vec4"&&r.size===1&&r.value.width!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + data[offset + 2] = v.width; + data[offset + 3] = v.height; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) { + cv[0] = v.x; + cv[1] = v.y; + cv[2] = v.width; + cv[3] = v.height; + gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height); + } + `},{type:"vec2",test:r=>r.type==="vec2"&&r.size===1&&r.value.x!==void 0,ubo:` + v = uv[name]; + data[offset] = v.x; + data[offset + 1] = v.y; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.x || cv[1] !== v.y) { + cv[0] = v.x; + cv[1] = v.y; + gl.uniform2f(ud[name].location, v.x, v.y); + } + `},{type:"vec4",test:r=>r.type==="vec4"&&r.size===1&&r.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + data[offset + 3] = v.alpha; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + cv[3] = v.alpha; + gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha); + } + `},{type:"vec3",test:r=>r.type==="vec3"&&r.size===1&&r.value.red!==void 0,ubo:` + v = uv[name]; + data[offset] = v.red; + data[offset + 1] = v.green; + data[offset + 2] = v.blue; + `,uniform:` + cv = ud[name].value; + v = uv[name]; + if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) { + cv[0] = v.red; + cv[1] = v.green; + cv[2] = v.blue; + gl.uniform3f(ud[name].location, v.red, v.green, v.blue); + } + `}];function hl(r,t,e,i){const s=[` + var v = null; + var v2 = null; + var t = 0; + var index = 0; + var name = null; + var arrayOffset = null; + `];let n=0;for(let a=0;a1)h=l.offset/4,s.push(e(l,h-n));else{const p=i[l.data.type];h=l.offset/4,s.push(` + v = uv.${u}; + offset += ${h-n}; + ${p}; + `)}n=h}const o=s.join(` +`);return new Function("uv","data","offset",o)}var LE=Object.defineProperty,NE=Object.defineProperties,HE=Object.getOwnPropertyDescriptors,u_=Object.getOwnPropertySymbols,XE=Object.prototype.hasOwnProperty,jE=Object.prototype.propertyIsEnumerable,c_=(r,t,e)=>t in r?LE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,zE=(r,t)=>{for(var e in t||(t={}))XE.call(t,e)&&c_(r,e,t[e]);if(u_)for(var e of u_(t))jE.call(t,e)&&c_(r,e,t[e]);return r},VE=(r,t)=>NE(r,HE(t));function rr(r,t){return` + for (let i = 0; i < ${r*t}; i++) { + data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i]; + } + `}const dl={f32:` + data[offset] = v;`,i32:` + data[offset] = v;`,"vec2":` + data[offset] = v[0]; + data[offset + 1] = v[1];`,"vec3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2];`,"vec4":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3];`,"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 4] = v[2]; + data[offset + 5] = v[3];`,"mat3x3":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 4] = v[3]; + data[offset + 5] = v[4]; + data[offset + 6] = v[5]; + data[offset + 8] = v[6]; + data[offset + 9] = v[7]; + data[offset + 10] = v[8];`,"mat4x4":` + for (let i = 0; i < 16; i++) { + data[offset + i] = v[i]; + }`,"mat3x2":rr(3,2),"mat4x2":rr(4,2),"mat2x3":rr(2,3),"mat4x3":rr(4,3),"mat2x4":rr(2,4),"mat3x4":rr(3,4)},h_=VE(zE({},dl),{"mat2x2":` + data[offset] = v[0]; + data[offset + 1] = v[1]; + data[offset + 2] = v[2]; + data[offset + 3] = v[3]; + `});function d_(r,t){const e=Math.max(cl[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4;return` + v = uv.${r.data.name}; + offset += ${t}; + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${r.data.size*e}; i++) + { + for(var j = 0; j < ${i}; j++) + { + data[arrayOffset++] = v[t++]; + } + ${s!==0?`arrayOffset += ${s};`:""} + } + `}function p_(r){return hl(r,"uboStd40",d_,dl)}class pl extends ul{constructor(){super({createUboElements:l_,generateUboSync:p_})}}pl.extension={type:[x.WebGLSystem],name:"ubo"};class f_{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new W}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new W}copyToTexture(t,e,i,s,n){const o=this._renderTargetSystem,a=this._renderer,l=o.getGpuRenderTarget(t),u=a.gl;return this.finishRenderPass(t),u.bindFramebuffer(u.FRAMEBUFFER,l.resolveTargetFramebuffer),a.texture.bind(e,0),u.copyTexSubImage2D(u.TEXTURE_2D,0,n.x,n.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem,o=t.colorTexture,a=n.getGpuRenderTarget(t);let l=s.y;t.isRoot&&(l=o.pixelHeight-s.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const u=this._renderer.gl;u.bindFramebuffer(u.FRAMEBUFFER,a.framebuffer);const c=this._viewPortCache;(c.x!==s.x||c.y!==l||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=l,c.width=s.width,c.height=s.height,u.viewport(s.x,l,s.width,s.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,i)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,e.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,e.framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer.gl,i=new a_,s=t.colorTexture;return Kt.test(s.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),i.framebuffer=null,i):(this._initColor(t,i),e.bindFramebuffer(e.FRAMEBUFFER,null),i)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;const s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?_t.ALL:_t.NONE);const n=this._renderer.gl;if(e&_t.COLOR){i!=null||(i=s.defaultClearColor);const o=this._clearColorCache,a=i;(o[0]!==a[0]||o[1]!==a[1]||o[2]!==a[2]||o[3]!==a[3])&&(o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const i=this._renderer,s=i.gl,n=s.createFramebuffer();if(e.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((o,a)=>{const l=o.source;l.antialias&&(i.context.supports.msaa?e.msaa=!0:re("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(l,0);const u=i.texture.getGlSource(l).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+a,3553,u,0)}),e.msaa){const o=s.createFramebuffer();e.framebuffer=o,s.bindFramebuffer(s.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{const u=s.createRenderbuffer();e.msaaRenderBuffer[l]=u})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){const i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,n)=>{n!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){const s=this._renderer,n=s.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorTextures.forEach((a,l)=>{const u=a.source;s.texture.bindSource(u,0);const c=s.texture.getGlSource(u).internalFormat,h=e.msaaRenderBuffer[l];n.bindRenderbuffer(n.RENDERBUFFER,h),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,c,u.pixelWidth,u.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+l,n.RENDERBUFFER,h)})}}_initStencil(t){if(t.framebuffer===null)return;const e=this._renderer.gl,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}postrender(t){if(this._renderer.context.multiView&&Kt.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}function m_(r,t,e,i,s,n){const o=n?1:-1;return r.identity(),r.a=1/i*2,r.d=o*(1/s*2),r.tx=-1-t*r.a,r.ty=-o-e*r.d,r}var WE=Object.defineProperty,g_=Object.getOwnPropertySymbols,YE=Object.prototype.hasOwnProperty,KE=Object.prototype.propertyIsEnumerable,__=(r,t,e)=>t in r?WE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qE=(r,t)=>{for(var e in t||(t={}))YE.call(t,e)&&__(r,e,t[e]);if(g_)for(var e of g_(t))KE.call(t,e)&&__(r,e,t[e]);return r};const ir=new Map;function fl(r,t){if(!ir.has(r)){const e=new P({source:new Kt(qE({resource:r},t))}),i=()=>{ir.get(r)===e&&ir.delete(r)};e.once("destroy",i),e.source.once("destroy",i),ir.set(r,e)}return ir.get(r)}function ZE(r){return ir.has(r)}function b_(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var QE=Object.defineProperty,y_=Object.getOwnPropertySymbols,JE=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,v_=(r,t,e)=>t in r?QE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,x_=(r,t)=>{for(var e in t||(t={}))JE.call(t,e)&&v_(r,e,t[e]);if(y_)for(var e of y_(t))tA.call(t,e)&&v_(r,e,t[e]);return r};const T_=class Jy{constructor(t={}){if(this.uid=Q("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=x_(x_({},Jy.defaultOptions),t),this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;ei.source)];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof P||t.depthStencilTexture instanceof et?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new et({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((n,o)=>{s&&o===0||n.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};T_.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let Is=T_;class ml{constructor(t){this.rootViewPort=new W,this.viewport=new W,this.onRenderTargetChange=new ca("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=b_(this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,i,s){const n=this.getRenderTarget(t),o=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;const a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);const l=n.colorTexture,u=this.viewport,c=l.pixelWidth,h=l.pixelHeight;if(!s&&t instanceof P&&(s=t.frame),s){const p=l._resolution;u.x=s.x*p+.5|0,u.y=s.y*p+.5|0,u.width=s.width*p+.5|0,u.height=s.height*p+.5|0}else u.x=0,u.y=0,u.width=c,u.height=h;return m_(this.projectionMatrix,0,0,u.width/l.resolution,u.height/l.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,i,u),o&&this.onRenderTargetChange.emit(n),n}clear(t,e=_t.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=_t.ALL,i,s){const n=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:n,frame:s}),n}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,i,s,n){i.x<0&&(s.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,n.y-=i.y,i.y=0);const{pixelWidth:o,pixelHeight:a}=t;return s.width=Math.min(s.width,o-i.x),s.height=Math.min(s.height,a-i.y),this.adaptor.copyToTexture(t,e,i,s,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return Kt.test(t)&&(t=fl(t).source),t instanceof Is?e=t:t instanceof et&&(e=new Is({colorTextures:[t]}),Kt.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}class gl extends ml{constructor(t){super(t),this.adaptor=new f_,this.adaptor.init(t,this)}}gl.extension={type:[x.WebGLSystem],name:"renderTarget"};class Fs extends ft{constructor({buffer:t,offset:e,size:i}){super(),this.uid=Q("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Q("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Q("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function S_(r,t){const e=[],i=[` + var g = s.groups; + var sS = r.shader; + var p = s.glProgram; + var ugS = r.uniformGroup; + var resources; + `];let s=!1,n=0,o=0;const a=t._getProgramData(r.glProgram);for(const u in r.groups){const c=r.groups[u];e.push(` + resources = g[${u}].resources; + `);for(const h in c.resources){const p=c.resources[h];if(p instanceof st)p.ubo?e.push(` + sS.bindUniformBlock( + resources[${h}], + sS._uniformBindMap[${u}[${h}], + ${n++} + ); + `):e.push(` + ugS.updateUniformGroup(resources[${h}], p, sD); + `);else if(p instanceof Fs)e.push(` + sS.bindUniformBlock( + resources[${h}], + sS._uniformBindMap[${u}[${h}], + ${n++} + ); + `);else if(p instanceof et){const f=r._uniformBindMap[u][h],m=a.uniformData[f];m&&(s||(s=!0,i.push(` + var tS = r.texture; + `)),t._gl.uniform1i(m.location,o),e.push(` + tS.bind(resources[${h}], ${o}); + `),o++)}}}const l=[...i,...e].join(` +`);return new Function("r","s","sD",l)}class eA{}class E_{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function _l(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function bl(r){const t=new Array(r);for(let e=0;eo>a?1:-1);for(let o=0;o`${c}: ${u}`),i=r.getShaderInfoLog(t),s=i.split(` +`),n={},o=s.map(u=>parseFloat(u.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(u=>u&&!n[u]?(n[u]=!0,!0):!1),a=[""];o.forEach(u=>{e[u-1]=`%c${e[u-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const l=e.join(` +`);a[0]=l,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function O_(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||C_(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||C_(r,i),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function G_(r,t){const e=_l(r,r.VERTEX_SHADER,t.vertex),i=_l(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=t.transformFeedbackVaryings;n&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||O_(r,s,e,i),t._attributeData=w_(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=M_(s,r),t._uniformBlockData=R_(s,r),r.deleteShader(e),r.deleteShader(i);const o={};for(const a in t._uniformData){const l=t._uniformData[a];o[a]={location:r.getUniformLocation(s,a),value:yl(l.type,l.size)}}return new E_(s,o)}const Us={textureCount:0,blockIndex:0};class xl{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t}contextChange(t){this._gl=t,this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=be()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Us.textureCount=0,Us.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),i(this._renderer,t,Us)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Us)}bindUniformBlock(t,e,i=0){const s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource;o&&this._renderer.ubo.updateUniformGroup(t),s.updateBuffer(t.buffer);let a=this._boundUniformsIdsToIndexHash[t.uid];if(a===void 0){const c=this._nextIndex++%this._maxBindings,h=this._boundIndexToUniformsHash[c];h&&(this._boundUniformsIdsToIndexHash[h.uid]=void 0),a=this._boundUniformsIdsToIndexHash[t.uid]=c,this._boundIndexToUniformsHash[c]=t,o?s.bindBufferRange(t.buffer,c,t.offset):s.bindBufferBase(t.buffer,c)}const l=this._gl,u=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[i]!==a&&(n.uniformBlockBindings[i]=a,l.uniformBlockBinding(n.program,u,a))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=G_(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(t,e){return S_(t,e)}}xl.extension={type:[x.WebGLSystem],name:"shader"};const B_={f32:`if (cv !== v) { + cu.value = v; + gl.uniform1f(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2f(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3f(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4f(location, v[0], v[1], v[2], v[3]); + }`,i32:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,u32:`if (cv !== v) { + cu.value = v; + gl.uniform1ui(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2ui(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3ui(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4ui(location, v[0], v[1], v[2], v[3]); + }`,bool:`if (cv !== v) { + cu.value = v; + gl.uniform1i(location, v); + }`,"vec2":`if (cv[0] !== v[0] || cv[1] !== v[1]) { + cv[0] = v[0]; + cv[1] = v[1]; + gl.uniform2i(location, v[0], v[1]); + }`,"vec3":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + gl.uniform3i(location, v[0], v[1], v[2]); + }`,"vec4":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) { + cv[0] = v[0]; + cv[1] = v[1]; + cv[2] = v[2]; + cv[3] = v[3]; + gl.uniform4i(location, v[0], v[1], v[2], v[3]); + }`,"mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);"},I_={f32:"gl.uniform1fv(location, v);","vec2":"gl.uniform2fv(location, v);","vec3":"gl.uniform3fv(location, v);","vec4":"gl.uniform4fv(location, v);","mat2x2":"gl.uniformMatrix2fv(location, false, v);","mat3x3":"gl.uniformMatrix3fv(location, false, v);","mat4x4":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2":"gl.uniform2iv(location, v);","vec3":"gl.uniform3iv(location, v);","vec4":"gl.uniform4iv(location, v);"};function F_(r,t){const e=[` + var v = null; + var cv = null; + var cu = null; + var t = 0; + var gl = renderer.gl; + var name = null; + `];for(const i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof st?r.uniforms[i].ubo?e.push(` + renderer.shader.bindUniformBlock(uv.${i}, "${i}"); + `):e.push(` + renderer.shader.updateUniformGroup(uv.${i}); + `):r.uniforms[i]instanceof Fs&&e.push(` + renderer.shader.bindBufferResource(uv.${i}, "${i}"); + `);continue}const s=r.uniformStructures[i];let n=!1;for(let o=0;o>1,i++;this.stateId=t.data}for(let e=0;e>1,1),s=Math.max(s>>1,1)}}},Sl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,o=t.height,a=r.pixelWidth,l=r.pixelHeight,u=r.resourceWidth,c=r.resourceHeight;u1){const u=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](l,i.TEXTURE_MAX_ANISOTROPY_EXT,u)}r.compare&&t[s](l,t.TEXTURE_COMPARE_FUNC,j_[r.compare])}function z_(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var pA=Object.defineProperty,fA=Object.defineProperties,mA=Object.getOwnPropertyDescriptors,V_=Object.getOwnPropertySymbols,gA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,W_=(r,t,e)=>t in r?pA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ae=(r,t)=>{for(var e in t||(t={}))gA.call(t,e)&&W_(r,e,t[e]);if(V_)for(var e of V_(t))_A.call(t,e)&&W_(r,e,t[e]);return r},bA=(r,t)=>fA(r,mA(t));function Y_(r,t){let e={},i=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),Ae(Ae(Ae(Ae(Ae(Ae(bA(Ae({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function K_(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function yA(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,Al(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=$.get().createCanvas();n.width=i,n.height=s;const o=n.getContext("2d");if(o){const a=o.createImageData(i,s);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),o=new Uint8Array(vA*s*n),a=this._renderer,l=a.renderTarget.getRenderTarget(t),u=a.renderTarget.getGpuRenderTarget(l),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,u.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}Pl.extension={type:[x.WebGLSystem],name:"texture"};class wl{init(){const t=new st({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uTransformMatrix:{value:new G,type:"mat3x3"},uRound:{value:0,type:"f32"}}),e=be(),i=Ne({name:"graphics",bits:[Ri,Ci(e),rs,Xe]});this.shader=new Ot({glProgram:i,resources:{localUniforms:t,batchSamplers:Oi(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(a.geometry,s.glProgram);const u=l.instructions;for(let c=0;c",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,o=n.source;s.resources.uTexture=o,s.resources.uSampler=o.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}Rl.extension={type:[x.WebGLPipesAdaptor],name:"mesh"};class Ml{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}Ml.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"customRender"};function Cl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s>16&255,s=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,l=t&255,u=i+(o-i)*e,c=s+(a-s)*e,h=n+(l-n)*e;return(u<<16)+(c<<8)+h}const sr=16777215;function Il(r,t){return r===sr||t===sr?r+t-sr:Bl(r,t,.5)}function xA(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===sr||o===sr?a=n+o-sr:a=Bl(n,o,.5),a+(s<<24)}const TA=new J,q_=Oe|dr|di;function Fl(r,t=!1){Z_(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),o=e[s],a=o.list,l=o.index;for(let u=0;u1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Dl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&q_&&Q_(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&q_&&Q_(r,TA,e)),!r.renderGroup){const n=r.children,o=n.length;for(let l=0;l1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&di&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&Oe&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function J_(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;nt in r?AA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rb=(r,t)=>{for(var e in t||(t={}))PA.call(t,e)&&eb(r,e,t[e]);if(tb)for(var e of tb(t))wA.call(t,e)&&eb(r,e,t[e]);return r};const $l=class tv{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=rb(rb({},tv.defaultOptions),t),this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};$l.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"background",priority:0},$l.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let ib=$l;const Qr={};U.handle(x.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Qr[r.name]=r.ref},r=>{delete Qr[r.name]});class Ll{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Qr[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Qr[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new ur,i.filters=[new Qr[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ll.extension={type:[x.WebGLPipes,x.WebGPUPipes,x.CanvasPipes],name:"blendMode"};var RA=Object.defineProperty,sb=Object.getOwnPropertySymbols,MA=Object.prototype.hasOwnProperty,CA=Object.prototype.propertyIsEnumerable,nb=(r,t,e)=>t in r?RA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Nl=(r,t)=>{for(var e in t||(t={}))MA.call(t,e)&&nb(r,e,t[e]);if(sb)for(var e of sb(t))CA.call(t,e)&&nb(r,e,t[e]);return r};const Hl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Xl=class ev{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof J||t instanceof P?Nl({target:t},e):Nl(Nl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,ev.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,o)=>{s.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const l=new FileReader;l.onload=()=>n(l.result),l.onerror=o,l.readAsDataURL(a)},Hl[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Hl[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Hl[e],quality:i});return new Promise((o,a)=>{const l=new FileReader;l.onload=()=>o(l.result),l.onerror=a,l.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer;if(e instanceof P)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof P?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof J&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof P?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const o=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(http://github.com/$%7Bn%7D) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Xl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"extract"},Xl.defaultImageOptions={format:"png",quality:1};let ob=Xl;class Ls extends P{static create(t){return new Ls({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var OA=Object.defineProperty,GA=Object.defineProperties,BA=Object.getOwnPropertyDescriptors,ab=Object.getOwnPropertySymbols,IA=Object.prototype.hasOwnProperty,FA=Object.prototype.propertyIsEnumerable,lb=(r,t,e)=>t in r?OA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,DA=(r,t)=>{for(var e in t||(t={}))IA.call(t,e)&&lb(r,e,t[e]);if(ab)for(var e of ab(t))FA.call(t,e)&&lb(r,e,t[e]);return r},UA=(r,t)=>GA(r,BA(t));const kA=new W,$A=new ut,LA=[0,0,0,0];class jl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof J&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:V.shared.setValue(o).toArray():o=LA;const a=((e=t.frame)==null?void 0:e.copyTo(kA))||hi(n,$A).rectangle;a.width=Math.max(a.width,1/i)|0,a.height=Math.max(a.height,1/i)|0;const l=Ls.create(UA(DA({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:i,antialias:s})),u=G.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:u,target:l,clearColor:o}),l.source.updateMipmaps(),l}destroy(){this._renderer=null}}jl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGenerator"};class zl{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t"},uWorldTransformMatrix:{value:new G,type:"mat3x3"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4"},uResolution:{value:[0,0],type:"vec2"}},{isStatic:!0})}destroy(){this._renderer=null}}zl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"globalUniforms"};let NA=1;class Vl{constructor(){this._tasks=[]}init(){ct.system.add(this._update,this)}repeat(t,e){const i=NA++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){ct.system.remove(this._update,this),this._tasks.length=0}}Vl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"scheduler",priority:0};let ub=!1;function cb(r){if(!ub){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${Nr} (${r}) http://www.pixijs.com/ + +`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${Nr} - ${r} - http://www.pixijs.com/`);ub=!0}}class Ns{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===gt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),cb(e)}}}Ns.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"hello",priority:-2},Ns.defaultOptions={hello:!1};var HA=Object.defineProperty,hb=Object.getOwnPropertySymbols,XA=Object.prototype.hasOwnProperty,jA=Object.prototype.propertyIsEnumerable,db=(r,t,e)=>t in r?HA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pb=(r,t)=>{for(var e in t||(t={}))XA.call(t,e)&&db(r,e,t[e]);if(hb)for(var e of hb(t))jA.call(t,e)&&db(r,e,t[e]);return r};const Wl=class rv{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=pb(pb({},rv.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){this.enabled&&(t._lastUsed=this._now,t._lastInstructionTick===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastInstructionTick=e.tick)}run(){var t,e,i;const s=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let l=0;lthis.maxUnusedTime?(u.destroyed||o[u.renderPipeId].destroyRenderable(u),u._lastInstructionTick=-1,a++,u.off("destroyed",this._removeRenderable,this)):n[l-a]=u}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}_removeRenderable(t){const e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}};Wl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"renderableGC"},Wl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let fb=Wl;var zA=Object.defineProperty,mb=Object.getOwnPropertySymbols,VA=Object.prototype.hasOwnProperty,WA=Object.prototype.propertyIsEnumerable,gb=(r,t,e)=>t in r?zA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_b=(r,t)=>{for(var e in t||(t={}))VA.call(t,e)&&gb(r,e,t[e]);if(mb)for(var e of mb(t))WA.call(t,e)&&gb(r,e,t[e]);return r};const Yl=class iv{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=_b(_b({},iv.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e:t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this._renderer.texture.managedTextures;for(let e=0;e-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};Yl.extension={type:[x.WebGLSystem,x.WebGPUSystem],name:"textureGC"},Yl.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let bb=Yl;var YA=Object.defineProperty,yb=Object.getOwnPropertySymbols,KA=Object.prototype.hasOwnProperty,qA=Object.prototype.propertyIsEnumerable,vb=(r,t,e)=>t in r?YA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xb=(r,t)=>{for(var e in t||(t={}))KA.call(t,e)&&vb(r,e,t[e]);if(yb)for(var e of yb(t))qA.call(t,e)&&vb(r,e,t[e]);return r};const Kl=class sv{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=xb(xb({},sv.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new W(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=fl(this.canvas,t),this.renderTarget=new Is({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Kl.extension={type:[x.WebGLSystem,x.WebGPUSystem,x.CanvasSystem],name:"view",priority:0},Kl.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let Tb=Kl;const ql=[ib,zl,Ns,Tb,Ul,bb,jl,ob,fa,fb,Vl],Zl=[Ll,qa,kl,Ol,Za,Ja,Qa,Ml],ZA=[...ql,pl,o_,Jg,tl,Pl,gl,sl,Tl,xl,al,k_,ll,ol],QA=[...Zl],JA=[Wa,Rl,wl],Sb=[],Eb=[],Ab=[];U.handleByNamedList(x.WebGLSystem,Sb),U.handleByNamedList(x.WebGLPipes,Eb),U.handleByNamedList(x.WebGLPipesAdaptor,Ab),U.add(...ZA,...QA,...JA);class Pb extends Ur{constructor(){const t={name:"webgl",type:gt.WEBGL,systems:Sb,renderPipes:Eb,renderPipeAdaptors:Ab};super(t)}}var tP={__proto__:null,WebGLRenderer:Pb};class Ql{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var s;const n=this._gpu.device,o=e.layout[i],a=[],l=this._renderer;for(const h in o){const p=(s=t.resources[h])!=null?s:t.resources[o[h]];let f;if(p._resourceType==="uniformGroup"){const m=p;l.ubo.updateUniformGroup(m);const _=m.buffer;f={buffer:l.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(p._resourceType==="buffer"){const m=p;f={buffer:l.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(p._resourceType==="bufferResource"){const m=p;f={buffer:l.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(p._resourceType==="textureSampler"){const m=p;f=l.texture.getGpuSampler(m)}else if(p._resourceType==="textureSource"){const m=p;f=l.texture.getGpuSource(m).createView({})}a.push({binding:o[h],resource:f})}const u=l.shader.getProgramData(e).bindGroups[i],c=n.createBindGroup({layout:u,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}Ql.extension={type:[x.WebGPUSystem],name:"bindGroup"};class Jl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(Ei(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}Jl.extension={type:[x.WebGPUSystem],name:"buffer"};function eP(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new xt({data:new Float32Array(24e5),usage:j.MAP_READ|j.COPY_DST}),n=t.buffer.createGPUBuffer(s),o=i.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class wb{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}Hs.extension={type:[x.WebGPUSystem],name:"device"},Hs.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var rP=Object.defineProperty,Rb=Object.getOwnPropertySymbols,iP=Object.prototype.hasOwnProperty,sP=Object.prototype.propertyIsEnumerable,Mb=(r,t,e)=>t in r?rP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cb=(r,t)=>{for(var e in t||(t={}))iP.call(t,e)&&Mb(r,e,t[e]);if(Rb)for(var e of Rb(t))sP.call(t,e)&&Mb(r,e,t[e]);return r};class eu{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){const n=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){const i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:s,topology:n,size:o,start:a,instanceCount:l,skipSync:u}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,u),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,l||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),l||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=Cb({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=Cb({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in i)this._setVertexBuffer(a,i[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}eu.extension={type:[x.WebGPUSystem],name:"encoder",priority:1};class ru{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:nt.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}ru.extension={type:[x.WebGPUSystem],name:"stencil"};const Jr={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:8,size:8},"vec2":{align:4,size:4},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:16,size:12},"vec3":{align:8,size:6},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:16,size:16},"vec4":{align:8,size:8},"mat2x2":{align:8,size:16},"mat2x2":{align:4,size:8},"mat3x2":{align:8,size:24},"mat3x2":{align:4,size:12},"mat4x2":{align:8,size:32},"mat4x2":{align:4,size:16},"mat2x3":{align:16,size:32},"mat2x3":{align:8,size:16},"mat3x3":{align:16,size:48},"mat3x3":{align:8,size:24},"mat4x3":{align:16,size:64},"mat4x3":{align:8,size:32},"mat2x4":{align:16,size:32},"mat2x4":{align:8,size:16},"mat3x4":{align:16,size:48},"mat3x4":{align:8,size:24},"mat4x4":{align:16,size:64},"mat4x4":{align:8,size:32}};function Ob(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i1&&(n=Math.max(n,o)*s.data.size),e=Math.ceil(e/o)*o,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function Gb(r,t){const{size:e,align:i}=Jr[r.data.type],s=(i-e)/4;return` + v = uv.${r.data.name}; + ${t!==0?`offset += ${t};`:""} + + arrayOffset = offset; + + t = 0; + + for(var i=0; i < ${r.data.size*(e/4)}; i++) + { + for(var j = 0; j < ${e/4}; j++) + { + data[arrayOffset++] = v[t++]; + } + ${s!==0?`arrayOffset += ${s};`:""} + } + `}function Bb(r){return hl(r,"uboWgsl",Gb,h_)}class iu extends ul{constructor(){super({createUboElements:Ob,generateUboSync:Bb})}}iu.extension={type:[x.WebGPUSystem],name:"ubo"};const le=128;class su{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new wb({minUniformOffsetAlignment:le});const e=256/le;for(let i=0;it in r?nP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,cP=(r,t)=>{for(var e in t||(t={}))lP.call(t,e)&&Fb(r,e,t[e]);if(Ib)for(var e of Ib(t))uP.call(t,e)&&Fb(r,e,t[e]);return r},hP=(r,t)=>oP(r,aP(t));const dP={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function pP(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function fP(r,t,e,i){return e<<6|r<<3|i<<1|t}class nu{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(nt.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=oe[t],this._updatePipeHash())}setPipeline(t,e,i,s){const n=this.getPipeline(t,e,i);s.setPipeline(n)}getPipeline(t,e,i,s){t._layoutKey||(rl(t,e.attributeData),this._generateBufferKey(t)),s=s||t.topology;const n=pP(t._layoutKey,e._layoutKey,i.data,i._blendModeId,dP[s]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,i,s),this._pipeCache[n])}_createPipeline(t,e,i,s){const n=this._gpu.device,o=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(i);a[0].writeMask=this._stencilMode===nt.RENDERING_MASK_ADD?0:this._colorMask;const l=this._renderer.shader.getProgramData(e).pipeline,u={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:o},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:s,cullMode:i.cullMode},layout:l,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(u.depthStencil=hP(cP({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.depthTest?"less":"always"})),n.createRenderPipeline(u)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let i=0;const s=Object.keys(t.attributes).sort();for(let o=0;o{var o;const a={arrayStride:0,stepMode:"vertex",attributes:[]},l=a.attributes;for(const u in e.attributeData){const c=t.attributes[u];((o=c.divisor)!=null?o:1)!==1&&re(`Attribute ${u} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(a.arrayStride=c.stride,a.stepMode=c.instance?"instance":"vertex",l.push({shaderLocation:e.attributeData[u].location,offset:c.offset,format:c.format}))}l.length&&s.push(a)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){const t=fP(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}nu.extension={type:[x.WebGPUSystem],name:"pipeline"};class Db{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class Ub{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,n){const o=this._renderer,a=this._getGpuColorTexture(t),l=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:i},{texture:l,origin:n},s),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem.getGpuRenderTarget(t),o=this.getDescriptor(t,e,i);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?_t.ALL:_t.NONE);const s=this._renderTargetSystem,n=s.getGpuRenderTarget(t),o=t.colorTextures.map((l,u)=>{const c=n.contexts[u];let h,p;c?h=c.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(l).createView({mipLevelCount:1}),n.msaaTextures[u]&&(p=h,h=this._renderer.texture.getTextureView(n.msaaTextures[u]));const f=e&_t.COLOR?"clear":"load";return i!=null||(i=s.defaultClearColor),{view:h,resolveTarget:p,clearValue:i,storeOp:"store",loadOp:f}});let a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){const l=e&_t.STENCIL?"clear":"load",u=e&_t.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:l,depthClearValue:1,depthLoadOp:u,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:a}}clear(t,e=!0,i,s){if(!e)return;const{gpu:n,encoder:o}=this._renderer,a=n.device;if(o.commandEncoder===null){const l=a.createCommandEncoder(),u=this.getDescriptor(t,e,i),c=l.beginRenderPass(u);c.setViewport(s.x,s.y,s.width,s.height,0,1),c.end();const h=l.finish();a.queue.submit([h])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;const e=new Db;return t.colorTextures.forEach((i,s)=>{if(Kt.test(i.resource)){const n=i.resource.getContext("webgpu"),o=i.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:o})}catch(a){console.error(a)}e.contexts[s]=n}if(e.msaa=i.source.antialias,i.source.antialias){const n=new et({width:0,height:0,sampleCount:4});e.msaaTextures[s]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{const n=e.msaaTextures[s];n==null||n.resize(i.source.width,i.source.height,i.source._resolution)})}}class ou extends ml{constructor(t){super(t),this.adaptor=new Ub,this.adaptor.init(t,this)}}ou.extension={type:[x.WebGPUSystem],name:"renderTarget"};class au{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,i=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}au.extension={type:[x.WebGPUSystem],name:"shader"};const pt={};pt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},pt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},pt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},pt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},pt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},pt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},pt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},pt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},pt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},pt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},pt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},pt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class lu{constructor(){this.defaultState=new Ft,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:pt[t.blendMode]||pt.normal}]}destroy(){this.gpu=null}}lu.extension={type:[x.WebGPUSystem],name:"state"};const kb={type:"image",upload(r,t,e){const i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),n=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*n},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},uu={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},mP={blockBytes:4,blockWidth:1,blockHeight:1},$b={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight;const n=uu[r.format]||mP;for(let o=0;o>1,1),s=Math.max(s>>1,1)}}},cu={type:"image",upload(r,t,e){const i=r.resource;if(!i)return;const s=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),o=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:o},{width:s,height:n})}},Lb={type:"video",upload(r,t,e){cu.upload(r,t,e)}};class Nb{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:` + var pos : array, 3> = array, 3>( + vec2(-1.0, -1.0), vec2(-1.0, 3.0), vec2(3.0, -1.0)); + + struct VertexOutput { + @builtin(position) position : vec4, + @location(0) texCoord : vec2, + }; + + @vertex + fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput { + var output : VertexOutput; + output.texCoord = pos[vertexIndex] * vec2(0.5, -0.5) + vec2(0.5); + output.position = vec4(pos[vertexIndex], 0.0, 1.0); + return output; + } + + @group(0) @binding(0) var imgSampler : sampler; + @group(0) @binding(1) var img : texture_2d; + + @fragment + fn fragmentMain(@location(0) texCoord : vec2) -> @location(0) vec4 { + return textureSample(img, imgSampler, texCoord); + } + `})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){const e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let i=t;const s=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){const l={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(l)}const o=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let l=0;l1&&this.onUpdateMipmaps(t))}onSourceUnload(t){const e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new Nb(this._gpu.device));const e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){const e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){var e;return(e=this._bindGroupHash[t.uid])!=null?e:this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Ht({0:e,1:e.style,2:new st({uTextureMatrix:{type:"mat3x3",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const i=t.source;return(e=this._textureViewHash[i.uid])!=null?e:this._createTextureView(i)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=$.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;const n=s.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:$.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){const e=this.generateCanvas(t),i=Xt.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);const{width:n,height:o}=e,a=s.getImageData(0,0,n,o),l=new Uint8ClampedArray(a.data.buffer);return Xt.returnCanvasAndContext(i),{pixels:l,width:n,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),i=this._bindGroupHash[e];i==null||i.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}hu.extension={type:[x.WebGPUSystem],name:"texture"};class du{init(){const t=new st({uTransformMatrix:{value:new G,type:"mat3x3"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4"},uRound:{value:0,type:"f32"}}),e=Le({name:"graphics",bits:[wi,Mi(be()),Qp,He]});this.shader=new Ot({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:l}=o.getContextRenderData(i),u=n.encoder;u.setPipelineFromGeometryProgramAndState(a.geometry,s.gpuProgram,t.state),u.setGeometry(a.geometry,s.gpuProgram);const c=n.globalUniforms.bindGroup;u.setBindGroup(0,c,s.gpuProgram);const h=n.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);u.setBindGroup(2,h,s.gpuProgram);const p=l.instructions;for(let f=0;f",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram)return;const n=s.gpuProgram;if(n.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){const o=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}pu.extension={type:[x.WebGPUPipesAdaptor],name:"mesh"};const gP=[...ql,iu,eu,Hs,Jl,hu,ou,au,lu,nu,tu,ru,Ql],_P=[...Zl,su],bP=[Ya,pu,du],Hb=[],Xb=[],jb=[];U.handleByNamedList(x.WebGPUSystem,Hb),U.handleByNamedList(x.WebGPUPipes,Xb),U.handleByNamedList(x.WebGPUPipesAdaptor,jb),U.add(...gP,..._P,...bP);class zb extends Ur{constructor(){const t={name:"webgpu",type:gt.WEBGPU,systems:Hb,renderPipes:Xb,renderPipeAdaptors:jb};super(t)}}var yP={__proto__:null,WebGPURenderer:zb};const vP={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},xP=new Proxy(vP,{get(r,t){return r[t]}}),TP=new W(0,0,1,1);function SP(r,t,e){e||(e=TP);const i=t.pixelWidth,s=t.pixelHeight;return r.x=e.x*i|0,r.y=e.y*s|0,r.width=e.width*i|0,r.height=e.height*s|0,r}var Vb=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(Vb||{}),fu=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(fu||{});const EP=new Proxy(fu,{get(r,t){return r[t]}});var mu=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(mu||{});const AP=new Proxy(mu,{get(r,t){return r[t]}});class PP{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const o=t.width/2/s,a=t.height/2/n,l=t.x/s+o,u=t.y/n+a;i=k.add(i,k.NW),this.x0=l+o*k.uX(i),this.y0=u+a*k.uY(i),i=k.add(i,2),this.x1=l+o*k.uX(i),this.y1=u+a*k.uY(i),i=k.add(i,2),this.x2=l+o*k.uX(i),this.y2=u+a*k.uY(i),i=k.add(i,2),this.x3=l+o*k.uX(i),this.y3=u+a*k.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}let wP=0;function RP(){return wP++}function MP(r){const t=r.toString(),e=t.indexOf("{"),i=t.lastIndexOf("}");if(e===-1||i===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,i).trim()}var CP=Object.defineProperty,Xs=Object.getOwnPropertySymbols,Wb=Object.prototype.hasOwnProperty,Yb=Object.prototype.propertyIsEnumerable,Kb=(r,t,e)=>t in r?CP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,OP=(r,t)=>{for(var e in t||(t={}))Wb.call(t,e)&&Kb(r,e,t[e]);if(Xs)for(var e of Xs(t))Yb.call(t,e)&&Kb(r,e,t[e]);return r},GP=(r,t)=>{var e={};for(var i in r)Wb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Xs)for(var i of Xs(r))t.indexOf(i)<0&&Yb.call(r,i)&&(e[i]=r[i]);return e};class BP extends J{constructor(t){var e,i;typeof t=="function"&&(t={render:t});const s=t,{render:n}=s,o=GP(s,["render"]);super(OP({label:"RenderContainer"},o)),this.batched=!1,this._lastUsed=0,this._lastInstructionTick=-1,this.bounds=new ut,this.canBundle=!1,this.renderPipeId="customRender",n&&(this.render=n),this.containsPoint=(e=t.containsPoint)!=null?e:()=>!1,this.addBounds=(i=t.addBounds)!=null?i:()=>!1}render(t){}}function IP(r,t){const e=t._scale,i=t._pivot,s=t._position,n=e._x,o=e._y,a=i._x,l=i._y;r.a=t._cx*n,r.b=t._sx*n,r.c=t._cy*o,r.d=t._sy*o,r.tx=s._x-(a*r.a+l*r.c),r.ty=s._y-(a*r.b+l*r.d)}function FP(r,t,e){const i=r.a,s=r.b,n=r.c,o=r.d,a=r.tx,l=r.ty,u=t.a,c=t.b,h=t.c,p=t.d;e.a=i*u+s*h,e.b=i*c+s*p,e.c=n*u+o*h,e.d=n*c+o*p,e.tx=a*u+l*h+t.tx,e.ty=a*c+l*p+t.ty}const DP={rectangle:ho,polygon:co,triangle:po,circle:qt,ellipse:qt,roundedRectangle:qt};function UP(r){r instanceof te&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],i=[],s=r.path.shapePath,n=r.textureMatrix;s.shapePrimitives.forEach(({shape:a,transform:l})=>{const u=i.length,c=t.length/2,h=[],p=DP[a.type];p.build(a,h),l&&Ii(h,l),p.triangulate(h,t,2,c,i,u);const f=e.length/2;n?(l&&n.append(l.clone().invert()),io(t,2,c,e,f,2,t.length/2-c,n)):so(e,f,2,t.length/2-c)});const o=r.out;return o?(o.positions=new Float32Array(t),o.uvs=new Float32Array(e),o.indices=new Uint32Array(i),o):new ie({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(i)})}function qb(r,t,e,i){const s=e.buffers[0],n=s.data,{verticesX:o,verticesY:a}=e,l=r/(o-1),u=t/(a-1);let c=0;const h=i[0],p=i[1],f=i[2],m=i[3],_=i[4],g=i[5],b=i[6],v=i[7],y=i[8];for(let T=0;Tt in r?XP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gu=(r,t)=>{for(var e in t||(t={}))ry.call(t,e)&&sy(r,e,t[e]);if(zs)for(var e of zs(t))iy.call(t,e)&&sy(r,e,t[e]);return r},VP=(r,t)=>jP(r,zP(t)),WP=(r,t)=>{var e={};for(var i in r)ry.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&zs)for(var i of zs(r))t.indexOf(i)<0&&iy.call(r,i)&&(e[i]=r[i]);return e};const ny=class nv extends er{constructor(t){t=gu(gu({},nv.defaultOptions),t);const e=t,{texture:i,verticesX:s,verticesY:n}=e,o=WP(e,["texture","verticesX","verticesY"]),a=new ey(Nt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Nt(VP(gu({},o),{geometry:a}))),this._texture=i,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:i}=this.texture;(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,i,s,n,o,a,l){this.geometry.setCorners(t,e,i,s,n,o,a,l)}};ny.defaultOptions={texture:P.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let YP=ny;var KP=Object.defineProperty,qP=Object.defineProperties,ZP=Object.getOwnPropertyDescriptors,Vs=Object.getOwnPropertySymbols,oy=Object.prototype.hasOwnProperty,ay=Object.prototype.propertyIsEnumerable,ly=(r,t,e)=>t in r?KP(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,QP=(r,t)=>{for(var e in t||(t={}))oy.call(t,e)&&ly(r,e,t[e]);if(Vs)for(var e of Vs(t))ay.call(t,e)&&ly(r,e,t[e]);return r},JP=(r,t)=>qP(r,ZP(t)),tw=(r,t)=>{var e={};for(var i in r)oy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Vs)for(var i of Vs(r))t.indexOf(i)<0&&ay.call(r,i)&&(e[i]=r[i]);return e};class ew extends er{constructor(t){const e=t,{texture:i,verticesX:s,verticesY:n}=e,o=tw(e,["texture","verticesX","verticesY"]),a=new ss(Nt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Nt(JP(QP({},o),{geometry:a,texture:i}))),this.texture=i,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:i}=this.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var rw=Object.defineProperty,uy=Object.getOwnPropertySymbols,iw=Object.prototype.hasOwnProperty,sw=Object.prototype.propertyIsEnumerable,cy=(r,t,e)=>t in r?rw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,hy=(r,t)=>{for(var e in t||(t={}))iw.call(t,e)&&cy(r,e,t[e]);if(uy)for(var e of uy(t))sw.call(t,e)&&cy(r,e,t[e]);return r};const dy=class ov extends ie{constructor(t){const{width:e,points:i,textureScale:s}=hy(hy({},ov.defaultOptions),t);super({positions:new Float32Array(i.length*4),uvs:new Float32Array(i.length*4),indices:new Uint32Array((i.length-1)*6)}),this.points=i,this._width=e,this.textureScale=s,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),i=this.getBuffer("aUV"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,o=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,l=t[0];const u=this._width*this.textureScale,c=t.length;for(let p=0;p0){const m=l.x-t[p].x,_=l.y-t[p].y,g=Math.sqrt(m*m+_*_);l=t[p],a+=g/u}else a=p/(c-1);n[f]=a,n[f+1]=0,n[f+2]=a,n[f+3]=1}let h=0;for(let p=0;p0?this.textureScale*this._width/2:this._width/2;for(let u=0;u1&&(p=1);const f=Math.sqrt(s*s+n*n);f<1e-6?(s=0,n=0):(s/=f,n/=f,s*=l,n*=l),o[h]=c.x+s,o[h+1]=c.y+n,o[h+2]=c.x-s,o[h+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};dy.defaultOptions={width:200,points:[],textureScale:0};let py=dy;var nw=Object.defineProperty,ow=Object.defineProperties,aw=Object.getOwnPropertyDescriptors,Ws=Object.getOwnPropertySymbols,fy=Object.prototype.hasOwnProperty,my=Object.prototype.propertyIsEnumerable,gy=(r,t,e)=>t in r?nw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_u=(r,t)=>{for(var e in t||(t={}))fy.call(t,e)&&gy(r,e,t[e]);if(Ws)for(var e of Ws(t))my.call(t,e)&&gy(r,e,t[e]);return r},lw=(r,t)=>ow(r,aw(t)),uw=(r,t)=>{var e={};for(var i in r)fy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ws)for(var i of Ws(r))t.indexOf(i)<0&&my.call(r,i)&&(e[i]=r[i]);return e};const _y=class av extends er{constructor(t){const e=_u(_u({},av.defaultOptions),t),{texture:i,points:s,textureScale:n}=e,o=uw(e,["texture","points","textureScale"]),a=new py(Nt({width:i.height,points:s,textureScale:n}));n>0&&(i.source.style.addressMode="repeat"),super(Nt(lw(_u({},o),{texture:i,geometry:a}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};_y.defaultOptions={textureScale:0};let cw=_y;var hw=Object.defineProperty,dw=Object.defineProperties,pw=Object.getOwnPropertyDescriptors,Ys=Object.getOwnPropertySymbols,by=Object.prototype.hasOwnProperty,yy=Object.prototype.propertyIsEnumerable,vy=(r,t,e)=>t in r?hw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fw=(r,t)=>{for(var e in t||(t={}))by.call(t,e)&&vy(r,e,t[e]);if(Ys)for(var e of Ys(t))yy.call(t,e)&&vy(r,e,t[e]);return r},mw=(r,t)=>dw(r,pw(t)),gw=(r,t)=>{var e={};for(var i in r)by.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ys)for(var i of Ys(r))t.indexOf(i)<0&&yy.call(r,i)&&(e[i]=r[i]);return e};class _w extends er{constructor(t){const e=t,{texture:i,vertices:s,uvs:n,indices:o,topology:a}=e,l=gw(e,["texture","vertices","uvs","indices","topology"]),u=new ie(Nt({positions:s,uvs:n,indices:o,topology:a}));super(Nt(mw(fw({},l),{texture:i,geometry:u}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}function bw(r,t){const{width:e,height:i}=r.frame;return t.scale(1/e,1/i),t}var yw=Object.defineProperty,Ks=Object.getOwnPropertySymbols,xy=Object.prototype.hasOwnProperty,Ty=Object.prototype.propertyIsEnumerable,Sy=(r,t,e)=>t in r?yw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,vw=(r,t)=>{for(var e in t||(t={}))xy.call(t,e)&&Sy(r,e,t[e]);if(Ks)for(var e of Ks(t))Ty.call(t,e)&&Sy(r,e,t[e]);return r},xw=(r,t)=>{var e={};for(var i in r)xy.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ks)for(var i of Ks(r))t.indexOf(i)<0&&Ty.call(r,i)&&(e[i]=r[i]);return e};const Ey=class lv extends ge{constructor(t){var e,i,s,n,o,a,l,u,c,h;t instanceof P&&(t={texture:t});const p=t,{width:f,height:m,leftWidth:_,rightWidth:g,topHeight:b,bottomHeight:v,texture:y,roundPixels:T}=p,E=xw(p,["width","height","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(vw({label:"NineSliceSprite"},E)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._didSpriteUpdate=!0,this._leftWidth=(i=_!=null?_:(e=y==null?void 0:y.defaultBorders)==null?void 0:e.left)!=null?i:se.defaultOptions.leftWidth,this._topHeight=(n=b!=null?b:(s=y==null?void 0:y.defaultBorders)==null?void 0:s.top)!=null?n:se.defaultOptions.topHeight,this._rightWidth=(a=g!=null?g:(o=y==null?void 0:y.defaultBorders)==null?void 0:o.right)!=null?a:se.defaultOptions.rightWidth,this._bottomHeight=(u=v!=null?v:(l=y==null?void 0:y.defaultBorders)==null?void 0:l.bottom)!=null?u:se.defaultOptions.bottomHeight,this.bounds.maxX=this._width=(c=f!=null?f:y.width)!=null?c:se.defaultOptions.width,this.bounds.maxY=this._height=(h=m!=null?m:y.height)!=null?h:se.defaultOptions.height,this.allowChildren=!1,this.texture=y!=null?y:lv.defaultOptions.texture,this.roundPixels=T!=null?T:!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=P.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};Ey.defaultOptions={texture:P.EMPTY};let Ay=Ey;class Tw extends Ay{constructor(...t){let e=t[0];e instanceof P&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}function Sw(r,t){return t instanceof Et||t instanceof Se?t:r==="html"?new Se(t):new Et(t)}async function Ew(r,t,e=200){const i=await t.extract.base64(r);await t.encoder.commandFinished;const s=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const n=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(http://github.com/$%7Bi%7D) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}var Aw=Object.defineProperty,Pw=Object.defineProperties,ww=Object.getOwnPropertyDescriptors,Py=Object.getOwnPropertySymbols,Rw=Object.prototype.hasOwnProperty,Mw=Object.prototype.propertyIsEnumerable,wy=(r,t,e)=>t in r?Aw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ry=(r,t)=>{for(var e in t||(t={}))Rw.call(t,e)&&wy(r,e,t[e]);if(Py)for(var e of Py(t))Mw.call(t,e)&&wy(r,e,t[e]);return r},Cw=(r,t)=>Pw(r,ww(t));const Ow=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let Gw=0;function My(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=Ow[Gw++]);let i="";for(let o=0;o \ No newline at end of file + (()=>{var e={691:(e,t,n)=>{var r;!function(){"use strict";angular.module("cfp.hotkeys",[]).provider("hotkeys",["$injector",function(e){this.includeCheatSheet=!0,this.useNgRoute=e.has("ngViewDirective"),this.templateTitle="Keyboard Shortcuts:",this.templateHeader=null,this.templateFooter=null,this.template='',this.cheatSheetHotkey="?",this.cheatSheetDescription="Show / hide this help menu",this.$get=["$rootElement","$rootScope","$compile","$window","$document",function(e,t,n,r,i){var o=!0;function a(e){var t={command:"⌘",shift:"⇧",left:"←",right:"→",up:"↑",down:"↓",return:"⏎",backspace:"⌫"};e=e.split("+");for(var n=0;n=0?e[n]="command":e[n]="ctrl"),e[n]=t[e[n]]||e[n];return e.join(" + ")}function s(e,t,n,r,i,o){this.combo=e instanceof Array?e:[e],this.description=t,this.callback=n,this.action=r,this.allowIn=i,this.persistent=o,this._formated=null}Mousetrap.prototype.stopCallback=function(e,t){return!o||!((" "+t.className+" ").indexOf(" mousetrap ")>-1)&&t.contentEditable&&"true"==t.contentEditable},s.prototype.format=function(){if(null===this._formated){for(var e=this.combo[0].split(/[\s]/),t=0;t-1)t=!0;else for(var i=0;i-1&&(u.hotkeys[i].combo.length>1?u.hotkeys[i].combo.splice(u.hotkeys[i].combo.indexOf(t),1):(angular.forEach(c,(function(e){var t=e.indexOf(u.hotkeys[i]);-1!==t&&e.splice(t,1)})),u.hotkeys.splice(i,1)),!0)}function y(e){if(!e)return u.hotkeys;for(var t,n=0;n-1)return t;return!1}function b(e){return function(n,r){if(e instanceof Array){var i=e[0],o=e[1];e=function(e){o.scope.$eval(i)}}t.$apply((function(){e(n,y(r))}))}}var $={add:v,del:m,get:y,bindTo:function(e){return e.$id in c||(c[e.$id]=[],e.$on("$destroy",(function(){for(var t=c[e.$id].length;t--;)m(c[e.$id].pop())}))),{add:function(t){var n;return n=arguments.length>1?v.apply(this,arguments):v(t),c[e.$id].push(n),this}}},template:this.template,toggleCheatSheet:g,includeCheatSheet:this.includeCheatSheet,cheatSheetHotkey:this.cheatSheetHotkey,cheatSheetDescription:this.cheatSheetDescription,useNgRoute:this.useNgRoute,purgeHotkeys:d,templateTitle:this.templateTitle,pause:function(){o=!1},unpause:function(){o=!0}};return $}]}]).directive("hotkey",["hotkeys",function(e){return{restrict:"A",link:function(t,n,r){var i,o=[];angular.forEach(t.$eval(r.hotkey),(function(t,n){i="string"==typeof r.hotkeyAllowIn?r.hotkeyAllowIn.split(/[\s,]+/):[],o.push(n),e.add({combo:n,description:r.hotkeyDescription,callback:t,action:r.hotkeyAction,allowIn:i})})),n.bind("$destroy",(function(){angular.forEach(o,e.del)}))}}}]).run(["hotkeys",function(e){}])}(),function(i,o,a){for(var s,u={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},c={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},l={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},p={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},f=1;f<20;++f)u[111+f]="f"+f;for(f=0;f<=9;++f)u[f+96]=f;function d(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent("on"+t,n)}function h(e){if("keypress"==e.type){var t=String.fromCharCode(e.which);return e.shiftKey||(t=t.toLowerCase()),t}return u[e.which]?u[e.which]:c[e.which]?c[e.which]:String.fromCharCode(e.which).toLowerCase()}function g(e){return"shift"==e||"ctrl"==e||"alt"==e||"meta"==e}function v(e,t,n){return n||(n=function(){if(!s)for(var e in s={},u)e>95&&e<112||u.hasOwnProperty(e)&&(s[u[e]]=e);return s}()[e]?"keydown":"keypress"),"keypress"==n&&t.length&&(n="keydown"),n}function m(e,t){var n,r,i,o=[];for(n=function(e){return"+"===e?["+"]:(e=e.replace(/\+{2}/g,"+plus")).split("+")}(e),i=0;i1?function(e,t,o,a){function c(t){return function(){s=t,++r[e],clearTimeout(n),n=setTimeout(u,1e3)}}function p(t){l(o,t,e),"keyup"!==a&&(i=h(t)),setTimeout(u,10)}r[e]=0;for(var d=0;d-1)&&!y(t,this.target)&&("INPUT"==t.tagName||"SELECT"==t.tagName||"TEXTAREA"==t.tagName||t.isContentEditable)},b.prototype.handleKey=function(){var e=this;return e._handleKey.apply(e,arguments)},b.init=function(){var e=b(o);for(var t in e)"_"!==t.charAt(0)&&(b[t]=function(t){return function(){return e[t].apply(e,arguments)}}(t))},b.init(),i.Mousetrap=b,e.exports&&(e.exports=b),void 0===(r=function(){return b}.call(t,n,t,e))||(e.exports=r)}(window,document)},2067:function(e,t){var n;void 0===(n=function(){return function(){function e(e){"use strict";var t=e.storageKey(),n=e.storage(),r=function(){var r=e.preferredLanguage();angular.isString(r)?e.use(r):n.put(t,e.use())};r.displayName="fallbackFromIncorrectStorageValue",n?n.get(t)?e.use(n.get(t)).catch(r):r():angular.isString(e.preferredLanguage())&&e.use(e.preferredLanguage())}function t(e,t,n,r){"use strict";var i,o,a,s,u,c,l,p,f,d,h,g,v,m,y,b,$={},w=[],x=e,A=[],E="translate-cloak",S=!1,k=!1,C=!0,M=".",T=!1,I=!1,R=0,O=!0,N="default",j={default:function(e){return(e||"").split("-").join("_")},java:function(e){var t=(e||"").split("-").join("_"),n=t.split("_");return n.length>1?n[0].toLowerCase()+"_"+n[1].toUpperCase():t},bcp47:function(e){var t=(e||"").split("_").join("-"),n=t.split("-");switch(n.length){case 1:n[0]=n[0].toLowerCase();break;case 2:n[0]=n[0].toLowerCase(),4===n[1].length?n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase():n[1]=n[1].toUpperCase();break;case 3:n[0]=n[0].toLowerCase(),n[1]=n[1].charAt(0).toUpperCase()+n[1].slice(1).toLowerCase(),n[2]=n[2].toUpperCase();break;default:return t}return n.join("-")},"iso639-1":function(e){return(e||"").split("_").join("-").split("-")[0].toLowerCase()}},_=function(){if(angular.isFunction(r.getLocale))return r.getLocale();var e,n,i=t.$get().navigator,o=["language","browserLanguage","systemLanguage","userLanguage"];if(angular.isArray(i.languages))for(e=0;e-1)return w[i];if(o)for(var s in o)if(o.hasOwnProperty(s)){var u=!1,c=Object.prototype.hasOwnProperty.call(o,s)&&P(s)===P(e);if("*"===s.slice(-1)&&(u=P(s.slice(0,-1))===P(e.slice(0,s.length-1))),(c||u)&&(t=o[s],L(n,P(t))>-1))return t}var l=e.split("_");return l.length>1&&L(n,P(l[0]))>-1?l[0]:void 0}},V=function(e,t){if(!e&&!t)return $;if(e&&!t){if(angular.isString(e))return $[e]}else angular.isObject($[e])||($[e]={}),angular.extend($[e],G(t));return this};this.translations=V,this.cloakClassName=function(e){return e?(E=e,this):E},this.allowNamespaces=function(e){return void 0===e?C:(C=e,this)},this.nestedObjectDelimeter=function(e){return e?(M=e,this):M};var G=function(e,t,n,r){var i,o,a;if(t||(t=[]),n||(n={}),!C)return e;for(i in e)Object.prototype.hasOwnProperty.call(e,i)&&(a=e[i],angular.isObject(a)?G(a,t.concat(i),n,i):(o=t.length?""+t.join(M)+M+i:i,t.length&&i===r&&(n[""+t.join(M)]="@:"+o),n[o]=a));return n};G.displayName="flatObject",this.addInterpolation=function(e){return A.push(e),this},this.useMessageFormatInterpolation=function(){return this.useInterpolation("$translateMessageFormatInterpolation")},this.useInterpolation=function(e){return d=e,this},this.useSanitizeValueStrategy=function(e){return n.useStrategy(e),this},this.preferredLanguage=function(e){return e?(B(e),this):i};var B=function(e){return e&&(i=e),i};this.translationNotFoundIndicator=function(e){return this.translationNotFoundIndicatorLeft(e),this.translationNotFoundIndicatorRight(e),this},this.translationNotFoundIndicatorLeft=function(e){return e?(v=e,this):v},this.translationNotFoundIndicatorRight=function(e){return e?(m=e,this):m},this.fallbackLanguage=function(e){return z(e),this};var z=function(e){return e?(angular.isString(e)?(s=!0,a=[e]):angular.isArray(e)&&(s=!1,a=e),angular.isString(i)&&L(a,i)<0&&a.push(i),this):s?a[0]:a};this.use=function(e){if(e){if(!$[e]&&!h)throw new Error("$translateProvider couldn't find translationTable for langKey: '"+e+"'");return u=e,this}return u},this.resolveClientLocale=function(){return D()};var H=function(e){return e?(x=e,this):p?p+x:x};this.storageKey=H,this.useUrlLoader=function(e,t){return this.useLoader("$translateUrlLoader",angular.extend({url:e},t))},this.useStaticFilesLoader=function(e){return this.useLoader("$translateStaticFilesLoader",e)},this.useLoader=function(e,t){return h=e,g=t||{},this},this.useLocalStorage=function(){return this.useStorage("$translateLocalStorage")},this.useCookieStorage=function(){return this.useStorage("$translateCookieStorage")},this.useStorage=function(e){return l=e,this},this.storagePrefix=function(e){return e?(p=e,this):e},this.useMissingTranslationHandlerLog=function(){return this.useMissingTranslationHandler("$translateMissingTranslationHandlerLog")},this.useMissingTranslationHandler=function(e){return f=e,this},this.usePostCompiling=function(e){return S=!!e,this},this.forceAsyncReload=function(e){return k=!!e,this},this.uniformLanguageTag=function(e){return e?angular.isString(e)&&(e={standard:e}):e={},N=e.standard,this},this.determinePreferredLanguage=function(e){var t=e&&angular.isFunction(e)?e():D();return i=w.length&&F(t)||t,this},this.registerAvailableLanguageKeys=function(e,t){return e?(w=e,t&&(o=t),this):w},this.useLoaderCache=function(e){return!1===e?y=void 0:!0===e?y=!0:void 0===e?y="$translationCache":e&&(y=e),this},this.directivePriority=function(e){return void 0===e?R:(R=e,this)},this.statefulFilter=function(e){return void 0===e?O:(O=e,this)},this.postProcess=function(e){return b=e||void 0,this},this.keepContent=function(e){return I=!!e,this},this.$get=["$log","$injector","$rootScope","$q",function(e,t,n,r){var o,p,N,j=t.get(d||"$translateDefaultInterpolation"),_=!1,P={},Z={},Y=function(e,t,n,s,c,f){!u&&i&&(u=i);var d=c&&c!==u?F(c)||c:u;if(c&&ae(c),angular.isArray(e)){return function(e){for(var i={},o=[],a=function(e){var o=r.defer(),a=function(t){i[e]=t,o.resolve([e,t])};return Y(e,t,n,s,c,f).then(a,a),o.promise},u=0,l=e.length;u0?N:p,e,t,n,r,i)}(e,t,l,i,s).then((function(e){u.resolve(e)}),(function(e){u.reject(W(e))})):f&&!_&&g?i?u.resolve(i):u.resolve(g):i?u.resolve(i):u.reject(W(e))}return u.promise},ie=function(e,t,n,r,i){var o,s=r?$[r]:$,u=j;if(P&&Object.prototype.hasOwnProperty.call(P,n)&&(u=P[n]),s&&Object.prototype.hasOwnProperty.call(s,e)&&null!==s[e]){var c=s[e];"@:"===c.substr(0,2)?o=ie(c.substr(2),t,n,r,i):(o=u.interpolate(c,t,"filter",i,e),o=oe(e,c,o,t,r,i))}else{var l;f&&!_&&(l=ee(e,t,i)),r&&a&&a.length?(p=0,o=function(e,t,n,r){return ne(N>0?N:p,e,t,n,r)}(e,t,u,i)):o=f&&!_&&l?l:W(e)}return o},oe=function(e,n,r,i,o,a){var s=b;return s&&("string"==typeof s&&(s=t.get(s)),s)?s(e,n,r,i,o,a):r},ae=function(e){$[e]||!h||Z[e]||(Z[e]=Q(e).then((function(e){return V(e.key,e.table),e})))};Y.preferredLanguage=function(e){return e&&B(e),i},Y.cloakClassName=function(){return E},Y.allowNamespaces=function(){return C},Y.nestedObjectDelimeter=function(){return M},Y.fallbackLanguage=function(e){if(null!=e){if(z(e),h&&a&&a.length)for(var t=0,n=a.length;t-1&&(N=t)}else N=0},Y.proposedLanguage=function(){return c},Y.storage=function(){return o},Y.negotiateLocale=F,Y.use=function(e){if(!e)return u;var t=r.defer();t.promise.then(null,angular.noop),n.$emit("$translateChangeStart",{language:e});var i=F(e);return w.length>0&&!i?r.reject(e):(i&&(e=i),c=e,!k&&$[e]||!h||Z[e]?Z[e]?Z[e].then((function(e){return c===e.key&&J(e.key),t.resolve(e.key),e}),(function(e){return!u&&a&&a.length>0&&a[0]!==e?Y.use(a[0]).then(t.resolve,t.reject):t.reject(e)})):(t.resolve(e),J(e)):(Z[e]=Q(e).then((function(n){return V(n.key,n.table),t.resolve(n.key),c===e&&J(n.key),n}),(function(e){return n.$emit("$translateChangeError",{language:e}),t.reject(e),n.$emit("$translateChangeEnd",{language:e}),r.reject(e)})),Z[e].finally((function(){!function(e){c===e&&(c=void 0),Z[e]=void 0}(e)})).catch(angular.noop)),t.promise)},Y.resolveClientLocale=function(){return D()},Y.storageKey=function(){return H()},Y.isPostCompilingEnabled=function(){return S},Y.isForceAsyncReloadEnabled=function(){return k},Y.isKeepContent=function(){return I},Y.refresh=function(e){if(!h)throw new Error("Couldn't refresh translation table, no loader registered!");n.$emit("$translateRefreshStart",{language:e});var t=r.defer(),i={};function o(e){var t=Q(e);return Z[e]=t,t.then((function(t){$[e]={},V(e,t.table),i[e]=!0}),angular.noop),t}if(t.promise.then((function(){for(var e in $)$.hasOwnProperty(e)&&(e in i||delete $[e]);u&&J(u)}),angular.noop).finally((function(){n.$emit("$translateRefreshEnd",{language:e})})),e)$[e]?o(e).then(t.resolve,t.reject):t.reject();else{var s=a&&a.slice()||[];u&&-1===s.indexOf(u)&&s.push(u),r.all(s.map(o)).then(t.resolve,t.reject)}return t.promise},Y.instant=function(e,t,n,r,o){var s=r&&r!==u?F(r)||r:u;if(null===e||angular.isUndefined(e))return e;if(r&&ae(r),angular.isArray(e)){for(var c={},l=0,p=e.length;l0?w:null},Y.getTranslationTable=function(e){return(e=e||Y.use())&&$[e]?angular.copy($[e]):null};var ue=n.$on("$translateReady",(function(){se.resolve(),ue(),ue=null})),ce=n.$on("$translateChangeEnd",(function(){se.resolve(),ce(),ce=null}));if(h){if(angular.equals($,{})&&Y.use()&&Y.use(Y.use()),a&&a.length)for(var le=function(e){return V(e.key,e.table),n.$emit("$translateChangeEnd",{language:e.key}),e},pe=0,fe=a.length;pe13&&$(x);if(m.$observe("translateDefault",(function(e){u.defaultText=e,S()})),f&&m.$observe("translateSanitizeStrategy",(function(e){u.sanitizeStrategy=r(e)(u.$parent),S()})),l&&m.$observe("translateValues",(function(e){e&&u.$parent.$watch((function(){angular.extend(u.interpolateParams,r(e)(u.$parent))}))})),d){var A=function(e){m.$observe(e,(function(t){var n=s(e.substr(14,1))+e.substr(15);u.interpolateParams[n]=t}))};for(var E in m)Object.prototype.hasOwnProperty.call(m,E)&&"translateValue"===E.substr(0,14)&&"translateValues"!==E&&A(E)}var S=function(){for(var e in y)y.hasOwnProperty(e)&&void 0!==y[e]&&k(e,y[e],u,u.interpolateParams,u.defaultText,u.translateNamespace)},k=function(t,n,r,i,o,a){n?(a&&"."===n.charAt(0)&&(n=a+n),e(n,i,p,o,r.translateLanguage,r.sanitizeStrategy).then((function(e){C(e,r,!0,t)}),(function(e){C(e,r,!1,t)}))):C(n,r,!1,t)},C=function(t,r,i,o){if(i||void 0!==r.defaultText&&(t=r.defaultText),"translate"===o){(i||!i&&!e.isKeepContent()&&void 0===m.translateKeepContent)&&v.empty().append(r.preText+t+r.postText);var a=e.isPostCompilingEnabled(),s=void 0!==c.translateCompile,u=s&&"false"!==c.translateCompile;(a&&!s||u)&&n(v.contents())(r)}else{var l=m.$attr[o];"data-"===l.substr(0,5)&&(l=l.substr(5)),l=l.substr(15),v.attr(l,t)}};(l||d||m.translateDefault)&&u.$watch("interpolateParams",S,!0),u.$on("translateLanguageChanged",S);var M=o.$on("$translateChangeSuccess",S);v.text().length?m.translate?b(m.translate):b(""):m.translate&&b(m.translate),S(),u.$on("$destroy",M)}}}}function i(e){"use strict";return e.translateNamespace?e.translateNamespace:e.$parent?i(e.$parent):void 0}function o(e,t){"use strict";return{restrict:"A",priority:e.directivePriority(),link:function(n,r,i){var o,s,u,c={},l=function(){angular.forEach(o,(function(t,o){t&&(c[o]=!0,n.translateNamespace&&"."===t.charAt(0)&&(t=n.translateNamespace+t),e(t,s,i.translateInterpolation,void 0,n.translateLanguage,u).then((function(e){r.attr(o,e)}),(function(e){r.attr(o,e)})))})),angular.forEach(c,(function(e,t){o[t]||(r.removeAttr(t),delete c[t])}))};a(n,i.translateAttr,(function(e){o=e}),l),a(n,i.translateValues,(function(e){s=e}),l),a(n,i.translateSanitizeStrategy,(function(e){u=e}),l),i.translateValues&&n.$watch(i.translateValues,l,!0),n.$on("translateLanguageChanged",l);var p=t.$on("$translateChangeSuccess",l);l(),n.$on("$destroy",p)}}}function a(e,t,n,r){"use strict";t&&("::"===t.substr(0,2)?t=t.substr(2):e.$watch(t,(function(e){n(e),r()}),!0),n(e.$eval(t)))}function s(e,t){"use strict";return{compile:function(n){var r=function(t){t.addClass(e.cloakClassName())},i=function(t){t.removeClass(e.cloakClassName())};return r(n),function(n,o,a){var s=i.bind(this,o),u=r.bind(this,o);a.translateCloak&&a.translateCloak.length?(a.$observe("translateCloak",(function(t){e(t).then(s,u)})),t.$on("$translateChangeSuccess",(function(){e(a.translateCloak).then(s,u)}))):e.onReady(s)}}}}function u(){"use strict";return{restrict:"A",scope:!0,compile:function(){return{pre:function(e,t,n){e.translateNamespace=c(e),e.translateNamespace&&"."===n.translateNamespace.charAt(0)?e.translateNamespace+=n.translateNamespace:e.translateNamespace=n.translateNamespace}}}}}function c(e){"use strict";return e.translateNamespace?e.translateNamespace:e.$parent?c(e.$parent):void 0}function l(){"use strict";return{restrict:"A",scope:!0,compile:function(){return function(e,t,n){n.$observe("translateLanguage",(function(t){e.translateLanguage=t})),e.$watch("translateLanguage",(function(){e.$broadcast("translateLanguageChanged")}))}}}}function p(e,t){"use strict";var n=function(n,r,i,o){if(!angular.isObject(r)){var a=this||{__SCOPE_IS_NOT_AVAILABLE:"More info at https://github.com/angular/angular.js/commit/8863b9d04c722b278fa93c5d66ad1e578ad6eb1f"};r=e(r)(a)}return t.instant(n,r,i,o)};return t.statefulFilter()&&(n.$stateful=!0),n}function f(e){"use strict";return e("translations")}return e.$inject=["$translate"],t.$inject=["$STORAGE_KEY","$windowProvider","$translateSanitizationProvider","pascalprechtTranslateOverrider"],n.$inject=["$interpolate","$translateSanitization"],r.$inject=["$translate","$interpolate","$compile","$parse","$rootScope"],o.$inject=["$translate","$rootScope"],s.$inject=["$translate","$rootScope"],p.$inject=["$parse","$translate"],f.$inject=["$cacheFactory"],angular.module("pascalprecht.translate",["ng"]).run(e),e.displayName="runTranslate",angular.module("pascalprecht.translate").provider("$translateSanitization",(function(){"use strict";var e,t,n,r=null,i=!1,o=!1;(n={sanitize:function(e,t){return"text"===t&&(e=s(e)),e},escape:function(e,t){return"text"===t&&(e=a(e)),e},sanitizeParameters:function(e,t){return"params"===t&&(e=c(e,s)),e},escapeParameters:function(e,t){return"params"===t&&(e=c(e,a)),e},sce:function(e,t,n){return"text"===t?e=u(e):"params"===t&&"filter"!==n&&(e=c(e,a)),e},sceParameters:function(e,t){return"params"===t&&(e=c(e,u)),e}}).escaped=n.escapeParameters,this.addStrategy=function(e,t){return n[e]=t,this},this.removeStrategy=function(e){return delete n[e],this},this.useStrategy=function(e){return i=!0,r=e,this},this.$get=["$injector","$log",function(a,s){var u={};return a.has("$sanitize")&&(e=a.get("$sanitize")),a.has("$sce")&&(t=a.get("$sce")),{useStrategy:function(e){return function(t){e.useStrategy(t)}}(this),sanitize:function(e,t,c,l){return r||i||o||(s.warn("pascalprecht.translate.$translateSanitization: No sanitization strategy has been configured. This can have serious security implications. See http://angular-translate.github.io/docs/#/guide/19_security for details."),o=!0),c||null===c||(c=r),c?(l||(l="service"),function(e,t,r,i){return angular.forEach(i,(function(i){if(angular.isFunction(i))e=i(e,t,r);else if(angular.isFunction(n[i]))e=n[i](e,t,r);else{if(!angular.isString(n[i]))throw new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+i+"'");if(!u[n[i]])try{u[n[i]]=a.get(n[i])}catch(e){throw u[n[i]]=function(){},new Error("pascalprecht.translate.$translateSanitization: Unknown sanitization strategy: '"+i+"'")}e=u[n[i]](e,t,r)}})),e}(e,t,l,angular.isArray(c)?c:[c])):e}}}];var a=function(e){var t=angular.element("
");return t.text(e),t.html()},s=function(t){if(!e)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sanitize service. Either include the ngSanitize module (https://docs.angularjs.org/api/ngSanitize) or use a sanitization strategy which does not depend on $sanitize, such as 'escape'.");return e(t)},u=function(e){if(!t)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot find $sce service.");return t.trustAsHtml(e)},c=function(e,t,n){if(angular.isDate(e))return e;if(angular.isObject(e)){var r=angular.isArray(e)?[]:{};if(n){if(n.indexOf(e)>-1)throw new Error("pascalprecht.translate.$translateSanitization: Error cannot interpolate parameter due recursive object")}else n=[];return n.push(e),angular.forEach(e,(function(e,i){angular.isFunction(e)||(r[i]=c(e,t,n))})),n.splice(-1,1),r}return angular.isNumber(e)||!0===e||!1===e||angular.isUndefined(e)||null===e?e:t(e)}})),angular.module("pascalprecht.translate").constant("pascalprechtTranslateOverrider",{}).provider("$translate",t),t.displayName="displayName",angular.module("pascalprecht.translate").factory("$translateDefaultInterpolation",n),n.displayName="$translateDefaultInterpolation",angular.module("pascalprecht.translate").constant("$STORAGE_KEY","NG_TRANSLATE_LANG_KEY"),angular.module("pascalprecht.translate").directive("translate",r),r.displayName="translateDirective",angular.module("pascalprecht.translate").directive("translateAttr",o),o.displayName="translateAttrDirective",angular.module("pascalprecht.translate").directive("translateCloak",s),s.displayName="translateCloakDirective",angular.module("pascalprecht.translate").directive("translateNamespace",u),u.displayName="translateNamespaceDirective",angular.module("pascalprecht.translate").directive("translateLanguage",l),l.displayName="translateLanguageDirective",angular.module("pascalprecht.translate").filter("translate",p),p.displayName="translateFilterFactory",angular.module("pascalprecht.translate").factory("$translationCache",f),f.displayName="$translationCache","pascalprecht.translate"}()}.apply(t,[]))||(e.exports=n)},4426:(e,t,n)=>{var r=n(9755);!function(e){"use strict";var t={objectMaxDepth:5,urlErrorParamsEnabled:!0};function n(e){if(!F(e))return t;P(e.objectMaxDepth)&&(t.objectMaxDepth=i(e.objectMaxDepth)?e.objectMaxDepth:NaN),P(e.urlErrorParamsEnabled)&&q(e.urlErrorParamsEnabled)&&(t.urlErrorParamsEnabled=e.urlErrorParamsEnabled)}function i(e){return B(e)&&e>0}function o(e,n){n=n||Error;var r="https://errors.angularjs.org/1.8.2/",i=r.replace(".","\\.")+"[\\s\\S]*",o=new RegExp(i,"g");return function(){var i,a,s=arguments[0],u=arguments[1],c="["+(e?e+":":"")+s+"] ",l=fe(arguments,2).map((function(e){return Be(e,t.objectMaxDepth)}));if(c+=u.replace(/\{\d+\}/g,(function(e){var t=+e.slice(1,-1);return t=0&&t-1 in e||"function"==typeof e.item)}function A(e,t,n){var r,i;if(e)if(Y(e))for(r in e)"prototype"!==r&&"length"!==r&&"name"!==r&&e.hasOwnProperty(r)&&t.call(n,e[r],r,e);else if(H(e)||x(e)){var o="object"!=typeof e;for(r=0,i=e.length;r=0&&e.splice(n,1),n}function ae(e,t,n){var r,o,a=[],s=[];if(n=i(n)?n:NaN,t){if((o=t)&&B(o.length)&&K.test(m.call(o))||(r=t,"[object ArrayBuffer]"===m.call(r)))throw b("cpta","Can't copy! TypedArray destination cannot be mutated.");if(e===t)throw b("cpi","Can't copy! Source and destination are identical.");return H(t)?t.length=0:A(t,(function(e,n){"$$hashKey"!==n&&delete t[n]})),a.push(e),s.push(t),u(e,t,n)}return c(e,n);function u(e,t,n){if(--n<0)return"...";var r,i=t.$$hashKey;if(H(e))for(var o=0,a=e.length;o2?fe(arguments,2):[];return!Y(t)||t instanceof RegExp?t:n.length?function(){return arguments.length?t.apply(e,pe(n,arguments,0)):t.apply(e,n)}:function(){return arguments.length?t.apply(e,arguments):t.call(e)}}function he(t,n){var r=n;return"string"==typeof t&&"$"===t.charAt(0)&&"$"===t.charAt(1)?r=void 0:J(n)?r="$WINDOW":n&&e.document===n?r="$DOCUMENT":Q(n)&&(r="$SCOPE"),r}function ge(e,t){if(!U(e))return B(t)||(t=t?2:null),JSON.stringify(e,he,t)}function ve(e){return G(e)?JSON.parse(e):e}var me=/:/g;function ye(e,t){e=e.replace(me,"");var n=Date.parse("Jan 01, 1970 00:00:00 "+e)/6e4;return O(n)?t:n}function be(e,t){return(e=new Date(e.getTime())).setMinutes(e.getMinutes()+t),e}function $e(e,t,n){n=n?-1:1;var r=e.getTimezoneOffset();return be(e,n*(ye(t,r)-r))}function we(e){e=s(e).clone().empty();var t=s("
").append(e).html();try{return e[0].nodeType===Ve?f(t):t.match(/^(<[^>]+>)/)[1].replace(/^<([\w-]+)/,(function(e,t){return"<"+f(t)}))}catch(e){return f(t)}}function xe(e){try{return decodeURIComponent(e)}catch(e){}}function Ae(e){var t={};return A((e||"").split("&"),(function(e){var n,r,i;e&&(r=e=e.replace(/\+/g,"%20"),-1!==(n=e.indexOf("="))&&(r=e.substring(0,n),i=e.substring(n+1)),P(r=xe(r))&&(i=!P(i)||xe(i),p.call(t,r)?H(t[r])?t[r].push(i):t[r]=[t[r],i]:t[r]=i))})),t}function Ee(e){return Se(e,!0).replace(/%26/gi,"&").replace(/%3D/gi,"=").replace(/%2B/gi,"+")}function Se(e,t){return encodeURIComponent(e).replace(/%40/gi,"@").replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%3B/gi,";").replace(/%20/g,t?"%20":"+")}var ke=["ng-","data-ng-","ng:","x-ng-"],Ce=function(t){var n=t.currentScript;if(!n)return!0;if(!(n instanceof e.HTMLScriptElement||n instanceof e.SVGScriptElement))return!1;var r=n.attributes;return[r.getNamedItem("src"),r.getNamedItem("href"),r.getNamedItem("xlink:href")].every((function(e){if(!e)return!0;if(!e.value)return!1;var n=t.createElement("a");if(n.href=e.value,t.location.origin===n.origin)return!0;switch(n.protocol){case"http:":case"https:":case"ftp:":case"blob:":case"file:":case"data:":return!0;default:return!1}}))}(e.document);function Me(t,n,r){F(r)||(r={}),r=T({strictDi:!1},r);var i=function(){if((t=s(t)).injector()){var i=t[0]===e.document?"document":we(t);throw b("btstrpd","App already bootstrapped with this element '{0}'",i.replace(//,">"))}(n=n||[]).unshift(["$provide",function(e){e.value("$rootElement",t)}]),r.debugInfoEnabled&&n.push(["$compileProvider",function(e){e.debugInfoEnabled(!0)}]),n.unshift("ng");var o=qt(n,r.strictDi);return o.invoke(["$rootScope","$rootElement","$compile","$injector",function(e,t,n,r){e.$apply((function(){t.data("$injector",r),n(t)(e)}))}]),o},o=/^NG_ENABLE_DEBUG_INFO!/,a=/^NG_DEFER_BOOTSTRAP!/;if(e&&o.test(e.name)&&(r.debugInfoEnabled=!0,e.name=e.name.replace(o,"")),e&&!a.test(e.name))return i();e.name=e.name.replace(a,""),$.resumeBootstrap=function(e){return A(e,(function(e){n.push(e)})),i()},Y($.resumeDeferredBootstrap)&&$.resumeDeferredBootstrap()}function Te(){e.name="NG_ENABLE_DEBUG_INFO!"+e.name,e.location.reload()}function Ie(e){var t=$.element(e).injector();if(!t)throw b("test","no injector found for element argument to getTestability");return t.get("$$testability")}var Re=/[A-Z]/g;function Oe(e,t){return t=t||"_",e.replace(Re,(function(e,n){return(n?t:"")+e.toLowerCase()}))}var Ne=!1;function je(){ft.legacyXHTMLReplacement=!0}function _e(e,t,n){if(!e)throw b("areq","Argument '{0}' is {1}",t||"?",n||"required");return e}function De(e,t,n){return n&&H(e)&&(e=e[e.length-1]),_e(Y(e),t,"not a function, got "+(e&&"object"==typeof e?e.constructor.name||"Object":typeof e)),e}function Le(e,t){if("hasOwnProperty"===e)throw b("badname","hasOwnProperty is not a valid {0} name",t)}function Ue(e){for(var t,n=e[0],r=e[e.length-1],i=1;n!==r&&(n=n.nextSibling);i++)(t||e[i]!==n)&&(t||(t=s(h.call(e,0,i))),t.push(n));return t||e}function Pe(){return Object.create(null)}function Fe(e){if(null==e)return"";switch(typeof e){case"string":break;case"number":e=""+e;break;default:e=!L(e)||H(e)||z(e)?ge(e):e.toString()}return e}var Ve=3;function Ge(e,t){if(H(e)){t=t||[];for(var n=0,r=e.length;n=0)return"...";n.push(t)}return t}))}(e,t):e}var ze={full:"1.8.2",major:1,minor:8,dot:2,codeName:"meteoric-mining"};ft.expando="ng339";var He=ft.cache={},Ze=1;ft._data=function(e){return this.cache[e[this.expando]]||{}};var Ye=/-([a-z])/g,We=/^-ms-/,Je={mouseleave:"mouseout",mouseenter:"mouseover"},Qe=o("jqLite");function qe(e,t){return t.toUpperCase()}function Xe(e){return e.replace(Ye,qe)}var Ke=/^<([\w-]+)\s*\/?>(?:<\/\1>|)$/,et=/<|&#?\w+;/,tt=/<([\w:-]+)/,nt=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:-]+)[^>]*)\/>/gi,rt={thead:["table"],col:["colgroup","table"],tr:["tbody","table"],td:["tr","tbody","table"]};rt.tbody=rt.tfoot=rt.colgroup=rt.caption=rt.thead,rt.th=rt.td;var it={option:[1,'"],_default:[0,"",""]};for(var ot in rt){var at=rt[ot],st=at.slice().reverse();it[ot]=[st.length,"<"+st.join("><")+">",""]}function ut(e){return!et.test(e)}function ct(e){var t=e.nodeType;return 1===t||!t||9===t}function lt(t,n){var r,i,o,s,u,c=n.createDocumentFragment(),l=[];if(ut(t))l.push(n.createTextNode(t));else{if(r=c.appendChild(n.createElement("div")),i=(tt.exec(t)||["",""])[1].toLowerCase(),s=ft.legacyXHTMLReplacement?t.replace(nt,"<$1>"):t,a<10)for(o=it[i]||it._default,r.innerHTML=o[1]+s+o[2],u=o[0];u--;)r=r.firstChild;else{for(u=(o=rt[i]||[]).length;--u>-1;)r.appendChild(e.document.createElement(o[u])),r=r.firstChild;r.innerHTML=s}l=pe(l,r.childNodes),(r=c.firstChild).textContent=""}return c.textContent="",c.innerHTML="",A(l,(function(e){c.appendChild(e)})),c}it.optgroup=it.option;var pt=e.Node.prototype.contains||function(e){return!!(16&this.compareDocumentPosition(e))};function ft(t){if(t instanceof ft)return t;var n,r,i,o;if(G(t)&&(t=ee(t),n=!0),!(this instanceof ft)){if(n&&"<"!==t.charAt(0))throw Qe("nosel","Looking up elements via selectors is not supported by jqLite! See: http://docs.angularjs.org/api/angular.element");return new ft(t)}n?Et(this,(r=t,i=i||e.document,(o=Ke.exec(r))?[i.createElement(o[1])]:(o=lt(r,i))?o.childNodes:[])):Y(t)?Tt(t):Et(this,t)}function dt(e){return e.cloneNode(!0)}function ht(e,t){!t&&ct(e)&&s.cleanData([e]),e.querySelectorAll&&s.cleanData(e.querySelectorAll("*"))}function gt(e){var t;for(t in e)return!1;return!0}function vt(e){var t=e.ng339,n=t&&He[t],r=n&&n.events,i=n&&n.data;i&&!gt(i)||r&&!gt(r)||(delete He[t],e.ng339=void 0)}function mt(e,t,n,r){if(P(r))throw Qe("offargs","jqLite#off() does not support the `selector` argument");var i=bt(e),o=i&&i.events,a=i&&i.handle;if(a){if(t){var s=function(t){var r=o[t];P(n)&&oe(r||[],n),P(n)&&r&&r.length>0||(e.removeEventListener(t,a),delete o[t])};A(t.split(" "),(function(e){s(e),Je[e]&&s(Je[e])}))}else for(t in o)"$destroy"!==t&&e.removeEventListener(t,a),delete o[t];vt(e)}}function yt(e,t){var n=e.ng339,r=n&&He[n];r&&(t?delete r.data[t]:r.data={},vt(e))}function bt(e,t){var n=e.ng339,r=n&&He[n];return t&&!r&&(e.ng339=n=++Ze,r=He[n]={events:{},data:{},handle:void 0}),r}function $t(e,t,n){if(ct(e)){var r,i=P(n),o=!i&&t&&!F(t),a=!t,s=bt(e,!o),u=s&&s.data;if(i)u[Xe(t)]=n;else{if(a)return u;if(o)return u&&u[Xe(t)];for(r in t)u[Xe(r)]=t[r]}}}function wt(e,t){return!!e.getAttribute&&(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," ").indexOf(" "+t+" ")>-1}function xt(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),r=n;A(t.split(" "),(function(e){e=ee(e),r=r.replace(" "+e+" "," ")})),r!==n&&e.setAttribute("class",ee(r))}}function At(e,t){if(t&&e.setAttribute){var n=(" "+(e.getAttribute("class")||"")+" ").replace(/[\n\t]/g," "),r=n;A(t.split(" "),(function(e){e=ee(e),-1===r.indexOf(" "+e+" ")&&(r+=e+" ")})),r!==n&&e.setAttribute("class",ee(r))}}function Et(e,t){if(t)if(t.nodeType)e[e.length++]=t;else{var n=t.length;if("number"==typeof n&&t.window!==t){if(n)for(var r=0;r=0?this[e]:this[this.length+e])},length:0,push:v,sort:[].sort,splice:[].splice},Rt={};A("multiple,selected,checked,disabled,readOnly,required,open".split(","),(function(e){Rt[f(e)]=e}));var Ot={};A("input,select,option,textarea,button,form,details".split(","),(function(e){Ot[e]=!0}));var Nt={ngMinlength:"minlength",ngMaxlength:"maxlength",ngMin:"min",ngMax:"max",ngPattern:"pattern",ngStep:"step"};function jt(e,t){var n=Rt[t.toLowerCase()];return n&&Ot[re(e)]&&n}function _t(e,t,n){n.call(e,t)}function Dt(e,t,n){var r=t.relatedTarget;r&&(r===e||pt.call(e,r))||n.call(e,t)}function Lt(){this.$get=function(){return T(ft,{hasClass:function(e,t){return e.attr&&(e=e[0]),wt(e,t)},addClass:function(e,t){return e.attr&&(e=e[0]),At(e,t)},removeClass:function(e,t){return e.attr&&(e=e[0]),xt(e,t)}})}}function Ut(e,t){var n=e&&e.$$hashKey;if(n)return"function"==typeof n&&(n=e.$$hashKey()),n;var r=typeof e;return"function"===r||"object"===r&&null!==e?e.$$hashKey=r+":"+(t||k)():r+":"+e}A({data:$t,removeData:yt,hasData:function(e){for(var t in He[e.ng339])return!0;return!1},cleanData:function(e){for(var t=0,n=e.length;t1&&(i=Ge(i));for(var u=0;u=0?t.split(" "):[t],u=s.length,c=function(t,r,i){var s=o[t];s||((s=o[t]=[]).specialHandlerWrapper=r,"$destroy"===t||i||e.addEventListener(t,a)),s.push(n)};u--;)t=s[u],Je[t]?(c(Je[t],Dt),c(t,void 0,!0)):c(t)}},off:mt,one:function(e,t,n){(e=s(e)).on(t,(function r(){e.off(t,n),e.off(t,r)})),e.on(t,n)},replaceWith:function(e,t){var n,r=e.parentNode;ht(e),A(new ft(t),(function(t){n?r.insertBefore(t,n.nextSibling):r.replaceChild(t,e),n=t}))},children:function(e){var t=[];return A(e.childNodes,(function(e){1===e.nodeType&&t.push(e)})),t},contents:function(e){return e.contentDocument||e.childNodes||[]},append:function(e,t){var n=e.nodeType;if(1===n||11===n)for(var r=0,i=(t=new ft(t)).length;r/,zt=/^[^(]*\(\s*([^)]*)\)/m,Ht=/,/,Zt=/^\s*(_?)(\S+?)\1\s*$/,Yt=/((\/\/.*$)|(\/\*[\s\S]*?\*\/))/gm,Wt=o("$injector");function Jt(e){return Function.prototype.toString.call(e)}function Qt(e){var t=Jt(e).replace(Yt,"");return t.match(Bt)||t.match(zt)}function qt(e,t){t=!0===t;var n={},r="Provider",i=[],o=new Vt,s={$provide:{provider:h(g),factory:h(m),service:h((function(e,t){return m(e,["$injector",function(e){return e.instantiate(t)}])})),value:h((function(e,t){return m(e,D(t),!1)})),constant:h((function(e,t){Le(e,"constant"),s[e]=t,l[e]=t})),decorator:function(e,t){var n=u.get(e+r),i=n.$get;n.$get=function(){var e=f.invoke(i,n);return f.invoke(t,null,{$delegate:e})}}}},u=s.$injector=b(s,(function(e,t){throw $.isString(t)&&i.push(t),Wt("unpr","Unknown provider: {0}",i.join(" <- "))})),l={},p=b(l,(function(e,t){var n=u.get(e+r,t);return f.invoke(n.$get,n,void 0,e)})),f=p;s.$injectorProvider={$get:D(p)},f.modules=u.modules=Pe();var d=y(e);return(f=p.get("$injector")).strictDi=t,A(d,(function(e){e&&f.invoke(e)})),f.loadNewModules=function(e){A(y(e),(function(e){e&&f.invoke(e)}))},f;function h(e){return function(t,n){if(!F(t))return e(t,n);A(t,S(e))}}function g(e,t){if(Le(e,"service"),(Y(t)||H(t))&&(t=u.instantiate(t)),!t.$get)throw Wt("pget","Provider '{0}' must define $get factory method.",e);return s[e+r]=t}function v(e,t){return function(){var n=f.invoke(t,this);if(U(n))throw Wt("undef","Provider '{0}' must return a value from $get factory method.",e);return n}}function m(e,t,n){return g(e,{$get:!1!==n?v(e,t):t})}function y(e){_e(U(e)||H(e),"modulesToLoad","not an array");var t,n=[];return A(e,(function(e){if(!o.get(e)){o.set(e,!0);try{G(e)?(t=c(e),f.modules[e]=t,n=n.concat(y(t.requires)).concat(t._runBlocks),r(t._invokeQueue),r(t._configBlocks)):Y(e)||H(e)?n.push(u.invoke(e)):De(e,"module")}catch(t){throw H(e)&&(e=e[e.length-1]),t.message&&t.stack&&-1===t.stack.indexOf(t.message)&&(t=t.message+"\n"+t.stack),Wt("modulerr","Failed to instantiate module {0} due to:\n{1}",e,t.stack||t.message||t)}}function r(e){var t,n;for(t=0,n=e.length;t1||e((function(){for(var e=0;es&&this.remove(l.key),t},get:function(e){if(s0&&I.addClass(this.$$element,e)},$removeClass:function(e){e&&e.length>0&&I.removeClass(this.$$element,e)},$updateClass:function(e,t){var n=wn(e,t);n&&n.length&&I.addClass(this.$$element,n);var r=wn(t,e);r&&r.length&&I.removeClass(this.$$element,r)},$set:function(e,t,n,r){var i=jt(this.$$element[0],e),o=Nt[e],a=e;i?(this.$$element.prop(e,t),r=i):o&&(this[o]=t,a=o),this[e]=t,r?this.$attr[e]=r:(r=this.$attr[e])||(this.$attr[e]=r=Oe(e,"-")),"img"===re(this.$$element)&&"srcset"===e&&(this[e]=t=z(t,"$set('srcset', value)")),!1!==n&&(null===t||U(t)?this.$$element.removeAttr(r):O.test(r)?i&&!1===t?this.$$element.removeAttr(r):this.$$element.attr(r,t):function(e,t,n){D.innerHTML="";var r=D.firstChild.attributes,i=r[0];r.removeNamedItem(i.name),i.value=n,e.attributes.setNamedItem(i)}(this.$$element[0],r,t));var s=this.$$observers;s&&A(s[a],(function(e){try{e(t)}catch(e){h(e)}}))},$observe:function(e,t){var n=this,r=n.$$observers||(n.$$observers=Pe()),i=r[e]||(r[e]=[]);return i.push(t),C.$evalAsync((function(){i.$$inter||!n.hasOwnProperty(e)||U(n[e])||t(n[e])})),function(){oe(i,t)}}};var X=n.startSymbol(),K=n.endSymbol(),te="{{"===X&&"}}"===K?_:function(e){return e.replace(/\{\{/g,X).replace(/}}/g,K)},ne=/^ng(Attr|Prop|On)([A-Z].*)$/,ie=/^(.+)Start$/;return ae.$$addBindingInfo=y?function(e,t){var n=e.data("$binding")||[];H(t)?n=n.concat(t):n.push(t),e.data("$binding",n)}:j,ae.$$addBindingClass=y?function(e){J(e,"ng-binding")}:j,ae.$$addScopeInfo=y?function(e,t,n,r){var i=n?r?"$isolateScopeNoTemplate":"$isolateScope":"$scope";e.data(i,t)}:j,ae.$$addScopeClass=y?function(e,t){J(e,t?"ng-isolate-scope":"ng-scope")}:j,ae.$$createComment=function(t,n){var r="";return y&&(r=" "+(t||"")+": ",n&&(r+=n+" ")),e.document.createComment(r)},ae;function ae(e,t,n,r,i){e instanceof s||(e=s(e));var o=ce(e,t,e,n,r,i);ae.$$addScopeClass(e);var a=null;return function(t,n,r){if(!e)throw hn("multilink","This element has already been linked.");_e(t,"scope"),i&&i.needsNewScope&&(t=t.$parent.$new());var u,c,l,p=(r=r||{}).parentBoundTranscludeFn,f=r.transcludeControllers,d=r.futureParentElement;if(p&&p.$$boundTransclude&&(p=p.$$boundTransclude),a||(c=(u=d)&&u[0],a=c&&"foreignobject"!==re(c)&&m.call(c).match(/SVG/)?"svg":"html"),l="html"!==a?s(Me(a,s("
").append(e).html())):n?It.clone.call(e):e,f)for(var h in f)l.data("$"+h+"Controller",f[h].instance);return ae.$$addScopeInfo(l,t),n&&n(l,t),o&&o(t,l,l,p),n||(e=o=null),l}}function ce(e,t,n,r,i,o){for(var u,c,l,p,f,d,h,g=[],v=H(e)||e instanceof s,m=0;m0);else r.push(e);return s(r)}function ve(e,t,n){return function(r,i,o,a,s){return i=ge(i[0],t,n),e(r,i,o,a,s)}}function me(e,t,n,r,i,o){var a;return e?ae(t,n,r,i,o):function(){return a||(a=ae(t,n,r,i,o),t=n=o=null),a.apply(this,arguments)}}function ye(t,n,r,i,o,a,u,c,l){l=l||{};for(var p,f,d,g,v,m=-Number.MAX_VALUE,y=l.newScopeDirective,b=l.controllerDirectives,$=l.newIsolateScopeDirective,w=l.templateDirective,x=l.nonTlbTranscludeDirective,E=!1,S=!1,C=l.hasElementTranscludeDirective,M=r.$$element=s(n),I=a,R=i,O=!1,N=!1,j=0,_=t.length;j<_;j++){var D=(p=t[j]).$$start,L=p.$$end;if(D&&(M=ge(n,D,L)),d=void 0,m>p.priority)break;if((v=p.scope)&&(p.templateUrl||(F(v)?(Ce("new/isolated scope",$||y,p,M),$=p):Ce("new/isolated scope",$,p,M)),y=y||p),f=p.name,!O&&(p.replace&&(p.templateUrl||p.template)||p.transclude&&!p.$$tlb)){for(var P,V=j+1;P=t[V++];)if(P.transclude&&!P.$$tlb||P.replace&&(P.templateUrl||P.template)){N=!0;break}O=!0}if(!p.templateUrl&&p.controller&&(b=b||Pe(),Ce("'"+f+"' controller",b[f],p,M),b[f]=p),v=p.transclude)if(E=!0,p.$$tlb||(Ce("transclusion",x,p,M),x=p),"element"===v)C=!0,m=p.priority,d=M,M=r.$$element=s(ae.$$createComment(f,r[f])),n=M[0],je(o,fe(d),n),R=me(N,d,i,m,I&&I.name,{nonTlbTranscludeDirective:x});else{var G=Pe();if(F(v)){d=e.document.createDocumentFragment();var B=Pe(),z=Pe();for(var Z in A(v,(function(e,t){var n="?"===e.charAt(0);e=n?e.substring(1):e,B[e]=t,G[t]=null,z[t]=n})),A(M.contents(),(function(t){var n=B[$n(re(t))];n?(z[n]=!0,G[n]=G[n]||e.document.createDocumentFragment(),G[n].appendChild(t)):d.appendChild(t)})),A(z,(function(e,t){if(!e)throw hn("reqslot","Required transclusion slot `{0}` was not filled.",t)})),G)if(G[Z]){var J=s(G[Z].childNodes);G[Z]=me(N,J,i)}d=s(d.childNodes)}else d=s(dt(n)).contents();M.empty(),(R=me(N,d,i,void 0,void 0,{needsNewScope:p.$$isolateScope||p.$$newScope})).$$slots=G}if(p.template)if(S=!0,Ce("template",w,p,M),w=p,v=Y(p.template)?p.template(M,r):p.template,v=te(v),p.replace){if(I=p,d=ut(v)?[]:xn(Me(p.templateNamespace,ee(v))),n=d[0],1!==d.length||1!==n.nodeType)throw hn("tplrt","Template for directive '{0}' must have exactly one root element. {1}",f,"");je(o,M,n);var q={$attr:{}},X=he(n,[],q),K=t.splice(j+1,t.length-(j+1));($||y)&&$e(X,$,y),t=t.concat(X).concat(K),Ee(r,q),_=t.length}else M.html(v);if(p.templateUrl)S=!0,Ce("template",w,p,M),w=p,p.replace&&(I=p),oe=Se(t.splice(j,t.length-j),M,r,o,E&&R,u,c,{controllerDirectives:b,newScopeDirective:y!==p&&y,newIsolateScopeDirective:$,templateDirective:w,nonTlbTranscludeDirective:x}),_=t.length;else if(p.compile)try{g=p.compile(M,r,R);var ne=p.$$originalDirective||p;Y(g)?ie(null,de(ne,g),D,L):g&&ie(de(ne,g.pre),de(ne,g.post),D,L)}catch(e){h(e,we(M))}p.terminal&&(oe.terminal=!0,m=Math.max(m,p.priority))}return oe.scope=y&&!0===y.scope,oe.transcludeOnThisElement=E,oe.templateOnThisElement=S,oe.transclude=R,l.hasElementTranscludeDirective=C,oe;function ie(e,t,n,r){e&&(n&&(e=ve(e,n,r)),e.require=p.require,e.directiveName=f,($===p||p.$$isolateScope)&&(e=De(e,{isolateScope:!0})),u.push(e)),t&&(n&&(t=ve(t,n,r)),t.require=p.require,t.directiveName=f,($===p||p.$$isolateScope)&&(t=De(t,{isolateScope:!0})),c.push(t))}function oe(e,t,i,o,a){var l,p,f,d,g,v,m,x,E,S;for(var M in n===i?(E=r,x=r.$$element):E=new W(x=s(i),r),g=t,$?d=t.$new(!0):y&&(g=t.$parent),a&&(m=function(e,t,n,r){var i;if(Q(e)||(r=n,n=t,t=e,e=void 0),C&&(i=v),n||(n=C?x.parent():x),!r)return a(e,t,i,n,N);var o=a.$$slots[r];if(o)return o(e,t,i,n,N);if(U(o))throw hn("noslot",'No parent directive that requires a transclusion with slot name "{0}". Element: {1}',r,we(x))},m.$$boundTransclude=a,m.isSlotFilled=function(e){return!!a.$$slots[e]}),b&&(v=function(e,t,n,r,i,o,a){var s=Pe();for(var u in r){var c=r[u],l={$scope:c===a||c.$$isolateScope?i:o,$element:e,$attrs:t,$transclude:n},p=c.controller;"@"===p&&(p=t[c.name]);var f=k(p,l,!0,c.controllerAs);s[c.name]=f,e.data("$"+c.name+"Controller",f.instance)}return s}(x,E,m,b,d,t,$)),$&&(ae.$$addScopeInfo(x,d,!0,!(w&&(w===$||w===$.$$originalDirective))),ae.$$addScopeClass(x,!0),d.$$isolateBindings=$.$$isolateBindings,(S=Fe(t,E,d,d.$$isolateBindings,$)).removeWatches&&d.$on("$destroy",S.removeWatches)),v){var I=b[M],R=v[M],O=I.$$bindings.bindToController;R.instance=R(),x.data("$"+I.name+"Controller",R.instance),R.bindingInfo=Fe(g,E,R.instance,O,I)}for(A(b,(function(e,t){var n=e.require;e.bindToController&&!H(n)&&F(n)&&T(v[t].instance,be(t,n,x,v))})),A(v,(function(e){var t=e.instance;if(Y(t.$onChanges))try{t.$onChanges(e.bindingInfo.initialChanges)}catch(e){h(e)}if(Y(t.$onInit))try{t.$onInit()}catch(e){h(e)}Y(t.$doCheck)&&(g.$watch((function(){t.$doCheck()})),t.$doCheck()),Y(t.$onDestroy)&&g.$on("$destroy",(function(){t.$onDestroy()}))})),l=0,p=u.length;l=0;l--)Le(f=c[l],f.isolateScope?d:t,x,E,f.require&&be(f.directiveName,f.require,x,v),m);A(v,(function(e){var t=e.instance;Y(t.$postLink)&&t.$postLink()}))}}function be(e,t,n,r){var i;if(G(t)){var o=t.match(l),a=t.substring(o[0].length),s=o[1]||o[3],u="?"===o[2];if("^^"===s?n=n.parent():i=(i=r&&r[a])&&i.instance,!i){var c="$"+a+"Controller";i="^^"===s&&n[0]&&9===n[0].nodeType?null:s?n.inheritedData(c):n.data(c)}if(!i&&!u)throw hn("ctreq","Controller '{0}', required by directive '{1}', can't be found!",a,e)}else if(H(t)){i=[];for(var p=0,f=t.length;pp.priority)&&-1!==p.restrict.indexOf(o)){if(u&&(p=N(p,{$$start:u,$$end:c})),!p.$$bindings){var g=p.$$bindings=v(p,p.name);F(g.isolateScope)&&(p.$$isolateBindings=g.isolateScope)}e.push(p),l=p}return l}function Ae(e){if(r.hasOwnProperty(e))for(var n=t.get(e+i),o=0,a=n.length;o"+n+"",r.childNodes[0].childNodes;default:return n}}function Te(e){return z(M.valueOf(e),"ng-prop-srcset")}function Ie(e,t,n,r){if(d.test(r))throw hn("nodomevents","Property bindings for HTML DOM event properties are disallowed");var i=re(e),o=function(e,t){var n=t.toLowerCase();return E[e+"|"+n]||E["*|"+n]}(i,r),a=_;"srcset"!==r||"img"!==i&&"source"!==i?o&&(a=M.getTrusted.bind(M,o)):a=Te,t.push({priority:100,compile:function(e,t){var i=S(t[n]),o=S(t[n],(function(e){return M.valueOf(e)}));return{pre:function(e,t){function n(){var n=i(e);t[0][r]=a(n)}n(),e.$watch(o,n)}}}})}function Re(e,t,n){e.push(jo(S,C,h,t,n,!1))}function Ne(e,t,r,i,o){var a=re(e),s=function(e,t){return"srcdoc"===t?M.HTML:"src"===t||"ngSrc"===t?-1===["img","video","audio","source","track"].indexOf(e)?M.RESOURCE_URL:M.MEDIA_URL:"xlinkHref"===t?"image"===e?M.MEDIA_URL:"a"===e?M.URL:M.RESOURCE_URL:"form"===e&&"action"===t||"base"===e&&"href"===t||"link"===e&&"href"===t?M.RESOURCE_URL:"a"!==e||"href"!==t&&"ngHref"!==t?void 0:M.URL}(a,i),u=!o,l=c[i]||o,p=n(r,u,s,l);if(p){if("multiple"===i&&"select"===a)throw hn("selmulti","Binding to the 'multiple' attribute is not supported. Element: {0}",we(e));if(d.test(i))throw hn("nodomevents","Interpolations for HTML DOM event attributes are disallowed");t.push({priority:100,compile:function(){return{pre:function(e,t,o){var a=o.$$observers||(o.$$observers=Pe()),u=o[i];u!==r&&(p=u&&n(u,!0,s,l),r=u),p&&(o[i]=p(e),(a[i]||(a[i]=[])).$$inter=!0,(o.$$observers&&o.$$observers[i].$$scope||e).$watch(p,(function(e,t){"class"===i&&e!==t?o.$updateClass(e,t):o.$set(i,e)})))}}}})}}function je(t,n,r){var i,o,a=n[0],u=n.length,c=a.parentNode;if(t)for(i=0,o=t.length;i0?" ":"")+a}return n}function xn(e){var t=(e=s(e)).length;if(t<=1)return e;for(;t--;){var n=e[t];(8===n.nodeType||n.nodeType===Ve&&""===n.nodeValue.trim())&&g.call(e,t,1)}return e}var An=o("$controller"),En=/^(\S+)(\s+as\s+([\w$]+))?$/;function Sn(e,t){if(t&&G(t))return t;if(G(e)){var n=En.exec(e);if(n)return n[3]}}function kn(){var e={};this.has=function(t){return e.hasOwnProperty(t)},this.register=function(t,n){Le(t,"controller"),F(t)?T(e,t):e[t]=n},this.$get=["$injector",function(t){return function(r,i,o,a){var s,u,c,l;if(o=!0===o,a&&G(a)&&(l=a),G(r)){if(!(u=r.match(En)))throw An("ctrlfmt","Badly formed controller string '{0}'. Must match `__name__ as __id__` or `__name__`.",r);if(c=u[1],l=l||u[3],r=e.hasOwnProperty(c)?e[c]:function(e,t,n){if(!t)return e;for(var r,i=t.split("."),o=i.length,a=0;a0&&(e+=(-1===e.indexOf("?")?"?":"&")+t),e}(m,n.paramSerializer(n.params)),v&&(m=function(e,t){var n=e.split("?");if(n.length>2)throw _n("badjsonp",'Illegal use more than one "?", in url, "{1}"',e);return A(Ae(n[1]),(function(n,r){if("JSON_CALLBACK"===n)throw _n("badjsonp",'Illegal use of JSON_CALLBACK in url, "{0}"',e);if(r===t)throw _n("badjsonp",'Illegal use of callback param, "{0}", in url, "{1}"',t,e)})),e+=(-1===e.indexOf("?")?"?":"&")+t+"=JSON_CALLBACK"}(m,n.jsonpCallbackParam)),b.pendingRequests.push(n),p.then(S,S),!n.cache&&!e.cache||!1===n.cache||"GET"!==n.method&&"JSONP"!==n.method||(i=F(n.cache)?n.cache:F(e.cache)?e.cache:g),i&&(P(o=i.get(m))?X(o)?o.then(E,E):H(o)?x(o[1],o[0],Ge(o[2]),o[3],o[4]):x(o,200,{},"OK","complete"):i.put(m,p)),U(o)){var $=y(n.url)?s()[n.xsrfCookieName||e.xsrfCookieName]:void 0;$&&(d[n.xsrfHeaderName||e.xsrfHeaderName]=$),a(n.method,m,r,(function(e,n,r,o,a){function s(){x(n,e,r,o,a)}i&&(Bn(e)?i.put(m,[e,n,Fn(r),o,a]):i.remove(m)),t?c.$applyAsync(s):(s(),c.$$phase||c.$apply())}),d,n.timeout,n.withCredentials,n.responseType,w(n.eventHandlers),w(n.uploadEventHandlers))}return p;function w(e){if(e){var n={};return A(e,(function(e,r){n[r]=function(n){function r(){e(n)}t?c.$applyAsync(r):c.$$phase?r():c.$apply(r)}})),n}}function x(e,t,r,i,o){(Bn(t=t>=-1?t:0)?u.resolve:u.reject)({data:e,status:t,headers:Vn(r),config:n,statusText:i,xhrStatus:o})}function E(e){x(e.data,e.status,Ge(e.headers()),e.statusText,e.xhrStatus)}function S(){var e=b.pendingRequests.indexOf(n);-1!==e&&b.pendingRequests.splice(e,1)}}(n,i).then(x,x)})),($=w($,m)).finally((function(){i.$$completeOutstandingRequest(j,"$http")}));function w(e,t){for(var n=0,r=t.length;n0)var $=n((function(){w("timeout")}),l);else X(l)&&l.then((function(){w(P(l.$$timeoutId)?"timeout":"abort")}));function w(e){b="timeout"===e,m&&m(),y&&y.abort()}function x(e,t,r,i,o,a){P($)&&n.cancel($),m=y=null,e(t,r,i,o,a)}}}(e,r,e.defer,t,n[0])}]}var Yn=$.$interpolateMinErr=o("$interpolate");function Wn(){var e="{{",t="}}";this.startSymbol=function(t){return t?(e=t,this):e},this.endSymbol=function(e){return e?(t=e,this):t},this.$get=["$parse","$exceptionHandler","$sce",function(n,r,i){var o=e.length,a=t.length,s=new RegExp(e.replace(/./g,c),"g"),u=new RegExp(t.replace(/./g,c),"g");function c(e){return"\\\\\\"+e}function l(n){return n.replace(s,e).replace(u,t)}function p(e,t,n,r){var i=e.$watch((function(e){return i(),r(e)}),t,n);return i}function f(s,u,c,f){var d=c===i.URL||c===i.MEDIA_URL;if(!s.length||-1===s.indexOf(e)){if(u)return;var h=l(s);d&&(h=i.getTrusted(c,h));var g=D(h);return g.exp=s,g.expressions=[],g.$$watchDelegate=p,g}f=!!f;for(var v,m,y,b,$,w=0,x=[],A=s.length,E=[],S=[];w1&&Yn.throwNoconcat(s),E.join(""))};return T((function(e){var t=0,n=x.length,i=new Array(n);try{for(;t4,p=l?fe(arguments,4):[],f=0,d=P(c)&&!c,h=(d?n:t).defer(),g=h.promise;function v(){l?a.apply(null,p):a(f)}function m(){d?e.defer(v):r.$evalAsync(v),h.notify(f++),u>0&&f>=u&&(h.resolve(f),o(g.$$intervalId)),d||r.$apply()}return u=P(u)?u:0,g.$$intervalId=i(m,s,h,d),g}}}]}var Xn=function(){this.$get=function(){var e=$.callbacks,t={};return{createCallback:function(n){var r="_"+(e.$$counter++).toString(36),i="angular.callbacks."+r,o=function(e){var t=function(e){t.data=e,t.called=!0};return t.id=e,t}(r);return t[i]=e[r]=o,i},wasCalled:function(e){return t[e].called},getResponse:function(e){return t[e].data},removeCallback:function(n){var r=t[n];delete e[r.id],delete t[n]}}}},Kn=/^([^?#]*)(\?([^#]*))?(#(.*))?$/,er={http:80,https:443,ftp:21},tr=o("$location");function nr(e,t){var n=ui(e);t.$$protocol=n.protocol,t.$$host=n.hostname,t.$$port=R(n.port)||er[n.protocol]||null}var rr=/^\s*[\\/]{2,}/;function ir(e,t,n){if(rr.test(e))throw tr("badpath",'Invalid url "{0}".',e);var r="/"!==e.charAt(0);r&&(e="/"+e);var i=ui(e),o=r&&"/"===i.pathname.charAt(0)?i.pathname.substring(1):i.pathname;t.$$path=function(e,t){for(var n=e.split("/"),r=n.length;r--;)n[r]=decodeURIComponent(n[r]),t&&(n[r]=n[r].replace(/\//g,"%2F"));return n.join("/")}(o,n),t.$$search=Ae(i.search),t.$$hash=decodeURIComponent(i.hash),t.$$path&&"/"!==t.$$path.charAt(0)&&(t.$$path="/"+t.$$path)}function or(e,t){return e.slice(0,t.length)===t}function ar(e,t){if(or(t,e))return t.substr(e.length)}function sr(e){var t=e.indexOf("#");return-1===t?e:e.substr(0,t)}function ur(e,t,n){this.$$html5=!0,n=n||"",nr(e,this),this.$$parse=function(e){var n=ar(t,e);if(!G(n))throw tr("ipthprfx",'Invalid url "{0}", missing path prefix "{1}".',e,t);ir(n,this,!0),this.$$path||(this.$$path="/"),this.$$compose()},this.$$normalizeUrl=function(e){return t+e.substr(1)},this.$$parseLinkUrl=function(r,i){return i&&"#"===i[0]?(this.hash(i.slice(1)),!0):(P(o=ar(e,r))?(a=o,s=n&&P(o=ar(n,o))?t+(ar("/",o)||o):e+a):P(o=ar(t,r))?s=t+o:t===r+"/"&&(s=t),s&&this.$$parse(s),!!s);var o,a,s}}function cr(e,t,n){nr(e,this),this.$$parse=function(r){var i,o=ar(e,r)||ar(t,r);U(o)||"#"!==o.charAt(0)?this.$$html5?i=o:(i="",U(o)&&(e=r,this.replace())):U(i=ar(n,o))&&(i=o),ir(i,this,!1),this.$$path=function(e,t,n){var r,i=/^\/[A-Z]:(\/.*)/;return or(t,n)&&(t=t.replace(n,"")),i.exec(t)?e:(r=i.exec(e))?r[1]:e}(this.$$path,i,e),this.$$compose()},this.$$normalizeUrl=function(t){return e+(t?n+t:"")},this.$$parseLinkUrl=function(t,n){return sr(e)===sr(t)&&(this.$$parse(t),!0)}}function lr(e,t,n){this.$$html5=!0,cr.apply(this,arguments),this.$$parseLinkUrl=function(r,i){return i&&"#"===i[0]?(this.hash(i.slice(1)),!0):(e===sr(r)?o=r:(a=ar(t,r))?o=e+n+a:t===r+"/"&&(o=t),o&&this.$$parse(o),!!o);var o,a},this.$$normalizeUrl=function(t){return e+n+t}}var pr={$$absUrl:"",$$html5:!1,$$replace:!1,$$compose:function(){var e,t,n,r,i,o;this.$$url=(e=this.$$path,t=this.$$search,n=this.$$hash,r=[],A(t,(function(e,t){H(e)?A(e,(function(e){r.push(Se(t,!0)+(!0===e?"":"="+Se(e,!0)))})):r.push(Se(t,!0)+(!0===e?"":"="+Se(e,!0)))})),i=r.length?r.join("&"):"",o=n?"#"+Ee(n):"",function(e){for(var t=e.split("/"),n=t.length;n--;)t[n]=Ee(t[n].replace(/%2F/g,"/"));return t.join("/")}(e)+(i?"?"+i:"")+o),this.$$absUrl=this.$$normalizeUrl(this.$$url),this.$$urlUpdatedByLocation=!0},absUrl:fr("$$absUrl"),url:function(e){if(U(e))return this.$$url;var t=Kn.exec(e);return(t[1]||""===e)&&this.path(decodeURIComponent(t[1])),(t[2]||t[1]||""===e)&&this.search(t[3]||""),this.hash(t[5]||""),this},protocol:fr("$$protocol"),host:fr("$$host"),port:fr("$$port"),path:dr("$$path",(function(e){return"/"===(e=null!==e?e.toString():"").charAt(0)?e:"/"+e})),search:function(e,t){switch(arguments.length){case 0:return this.$$search;case 1:if(G(e)||B(e))e=e.toString(),this.$$search=Ae(e);else{if(!F(e))throw tr("isrcharg","The first argument of the `$location#search()` call must be a string or an object.");A(e=ae(e,{}),(function(t,n){null==t&&delete e[n]})),this.$$search=e}break;default:U(t)||null===t?delete this.$$search[e]:this.$$search[e]=t}return this.$$compose(),this},hash:dr("$$hash",(function(e){return null!==e?e.toString():""})),replace:function(){return this.$$replace=!0,this}};function fr(e){return function(){return this[e]}}function dr(e,t){return function(n){return U(n)?this[e]:(this[e]=t(n),this.$$compose(),this)}}function hr(){var e="!",t={enabled:!1,requireBase:!0,rewriteLinks:!0};this.hashPrefix=function(t){return P(t)?(e=t,this):e},this.html5Mode=function(e){return q(e)?(t.enabled=e,this):F(e)?(q(e.enabled)&&(t.enabled=e.enabled),q(e.requireBase)&&(t.requireBase=e.requireBase),(q(e.rewriteLinks)||G(e.rewriteLinks))&&(t.rewriteLinks=e.rewriteLinks),this):t},this.$get=["$rootScope","$browser","$sniffer","$rootElement","$window",function(n,r,i,o,a){var u,c,l,p,f=r.baseHref(),d=r.url();if(t.enabled){if(!f&&t.requireBase)throw tr("nobase","$location in HTML5 mode requires a tag to be present!");l=(p=d).substring(0,p.indexOf("/",p.indexOf("//")+2))+(f||"/"),c=i.history?ur:lr}else l=sr(d),c=cr;var h=function(e){return e.substr(0,sr(e).lastIndexOf("/")+1)}(l);(u=new c(l,h,"#"+e)).$$parseLinkUrl(d,d),u.$$state=r.state();var g=/^\s*(javascript|mailto):/i;function v(e,t,n){var i=u.url(),o=u.$$state;try{r.url(http://github.com/e,t,n),u.$$state=r.state()}catch(e){throw u.url(http://github.com/i),u.$$state=o,e}}o.on("click",(function(e){var i=t.rewriteLinks;if(i&&!e.ctrlKey&&!e.metaKey&&!e.shiftKey&&2!==e.which&&2!==e.button){for(var a=s(e.target);"a"!==re(a[0]);)if(a[0]===o[0]||!(a=a.parent())[0])return;if(!G(i)||!U(a.attr(i))){var c=a.prop("href"),l=a.attr("href")||a.attr("xlink:href");F(c)&&"[object SVGAnimatedString]"===c.toString()&&(c=ui(c.animVal).href),g.test(c)||!c||a.attr("target")||e.isDefaultPrevented()||u.$$parseLinkUrl(c,l)&&(e.preventDefault(),u.absUrl()!==r.url()&&n.$apply())}}})),u.absUrl()!==d&&r.url(http://github.com/u.absUrl(),!0);var m=!0;return r.onUrlChange((function(e,t){or(e,h)?(n.$evalAsync((function(){var r,i=u.absUrl(),o=u.$$state;u.$$parse(e),u.$$state=t,r=n.$broadcast("$locationChangeStart",e,i,t,o).defaultPrevented,u.absUrl()===e&&(r?(u.$$parse(i),u.$$state=o,v(i,!1,o)):(m=!1,y(i,o)))})),n.$$phase||n.$digest()):a.location.href=e})),n.$watch((function(){if(m||u.$$urlUpdatedByLocation){u.$$urlUpdatedByLocation=!1;var e=r.url(),t=u.absUrl(),o=r.state(),a=u.$$replace,s=!((c=e)===(l=t)||ui(c).href===ui(l).href)||u.$$html5&&i.history&&o!==u.$$state;(m||s)&&(m=!1,n.$evalAsync((function(){var t=u.absUrl(),r=n.$broadcast("$locationChangeStart",t,e,u.$$state,o).defaultPrevented;u.absUrl()===t&&(r?(u.$$parse(e),u.$$state=o):(s&&v(t,a,o===u.$$state?null:u.$$state),y(e,o)))})))}var c,l;u.$$replace=!1})),u;function y(e,t){n.$broadcast("$locationChangeSuccess",u.absUrl(),e,u.$$state,t)}}]}function gr(){var e=!0,t=this;this.debugEnabled=function(t){return P(t)?(e=t,this):e},this.$get=["$window",function(n){var r,i=a||/\bEdge\//.test(n.navigator&&n.navigator.userAgent);return{log:s("log"),info:s("info"),warn:s("warn"),error:s("error"),debug:(r=s("debug"),function(){e&&r.apply(t,arguments)})};function o(e){return Z(e)&&(e.stack&&i?e=e.message&&-1===e.stack.indexOf(e.message)?"Error: "+e.message+"\n"+e.stack:e.stack:e.sourceURL&&(e=e.message+"\n"+e.sourceURL+":"+e.line)),e}function s(e){var t=n.console||{},r=t[e]||t.log||j;return function(){var e=[];return A(arguments,(function(t){e.push(o(t))})),Function.prototype.apply.call(r,t,e)}}}]}A([lr,cr,ur],(function(e){e.prototype=Object.create(pr),e.prototype.state=function(t){if(!arguments.length)return this.$$state;if(e!==ur||!this.$$html5)throw tr("nostate","History API state support is available only in HTML5 mode and only in browsers supporting HTML5 History API");return this.$$state=U(t)?null:t,this.$$urlUpdatedByLocation=!0,this}}));var vr=o("$parse"),mr={}.constructor.prototype.valueOf;function yr(e){return e+""}var br=Pe();A("+ - * / % === !== == != < > <= >= && || ! = |".split(" "),(function(e){br[e]=!0}));var $r={n:"\n",f:"\f",r:"\r",t:"\t",v:"\v","'":"'",'"':'"'},wr=function(e){this.options=e};wr.prototype={constructor:wr,lex:function(e){for(this.text=e,this.index=0,this.tokens=[];this.index=55296&&n<=56319&&r>=56320&&r<=57343?e+t:e},isExpOperator:function(e){return"-"===e||"+"===e||this.isNumber(e)},throwError:function(e,t,n){n=n||this.index;var r=P(t)?"s "+t+"-"+this.index+" ["+this.text.substring(t,n)+"]":" "+n;throw vr("lexerr","Lexer Error: {0} at column{1} in expression [{2}].",e,r,this.text)},readNumber:function(){for(var e="",t=this.index;this.index0&&p(this.$$state),r},catch:function(e){return this.then(null,e)},finally:function(e,t){return this.then((function(t){return y(t,$,e)}),(function(t){return y(t,m,e)}),t)}});var $=b;function w(e){if(!Y(e))throw r("norslvr","Expected resolverFn, got '{0}'",e);var t=new c;return e((function(e){f(t,e)}),(function(e){h(t,e)})),t}return w.prototype=c.prototype,w.defer=s,w.reject=m,w.when=b,w.resolve=$,w.all=function(e){var t=new c,n=0,r=H(e)?[]:{};return A(e,(function(e,i){n++,b(e).then((function(e){r[i]=e,--n||f(t,r)}),(function(e){h(t,e)}))})),0===n&&f(t,r),t},w.race=function(e){var t=s();return A(e,(function(e){b(e).then(t.resolve,t.reject)})),t.promise},w}function Lr(e){return!!e.pur}function Ur(e){e.pur=!0}function Pr(e){e.$$state&&Ur(e.$$state)}function Fr(){this.$get=["$window","$timeout",function(e,t){var n=e.requestAnimationFrame||e.webkitRequestAnimationFrame,r=e.cancelAnimationFrame||e.webkitCancelAnimationFrame||e.webkitCancelRequestAnimationFrame,i=!!n,o=i?function(e){var t=n(e);return function(){r(t)}}:function(e){var n=t(e,16.66,!1);return function(){t.cancel(n)}};return o.supported=i,o}]}function Vr(){var e=10,t=o("$rootScope"),n=null,r=null;this.digestTtl=function(t){return arguments.length&&(e=t),e},this.$get=["$exceptionHandler","$parse","$browser",function(i,o,s){function u(e){e.currentScope.$$destroyed=!0}function c(e){9===a&&(e.$$childHead&&c(e.$$childHead),e.$$nextSibling&&c(e.$$nextSibling)),e.$parent=e.$$nextSibling=e.$$prevSibling=e.$$childHead=e.$$childTail=e.$root=e.$$watchers=null}function l(){this.$id=k(),this.$$phase=this.$parent=this.$$watchers=this.$$nextSibling=this.$$prevSibling=this.$$childHead=this.$$childTail=null,this.$root=this,this.$$destroyed=!1,this.$$suspended=!1,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$$isolateBindings=null}l.prototype={constructor:l,$new:function(e,t){var n;return t=t||this,e?(n=new l).$root=this.$root:(this.$$ChildScope||(this.$$ChildScope=function(e){function t(){this.$$watchers=this.$$nextSibling=this.$$childHead=this.$$childTail=null,this.$$listeners={},this.$$listenerCount={},this.$$watchersCount=0,this.$id=k(),this.$$ChildScope=null,this.$$suspended=!1}return t.prototype=e,t}(this)),n=new this.$$ChildScope),n.$parent=t,n.$$prevSibling=t.$$childTail,t.$$childHead?(t.$$childTail.$$nextSibling=n,t.$$childTail=n):t.$$childHead=t.$$childTail=n,(e||t!==this)&&n.$on("$destroy",u),n},$watch:function(e,t,r,i){var a=o(e),s=Y(t)?t:j;if(a.$$watchDelegate)return a.$$watchDelegate(this,s,r,a,e);var u=this,c=u.$$watchers,l={fn:s,last:w,get:a,exp:i||e,eq:!!r};return n=null,c||((c=u.$$watchers=[]).$$digestWatchIndex=-1),c.unshift(l),c.$$digestWatchIndex++,b(this,1),function(){var e=oe(c,l);e>=0&&(b(u,-1),e1,u=0,c=o(e,g),l=[],f={},d=!0,h=0;function g(e){var t,i,o,a;if(!U(n=e)){if(F(n))if(x(n)){r!==l&&(h=(r=l).length=0,u++),t=n.length,h!==t&&(u++,r.length=h=t);for(var s=0;st)for(i in u++,r)p.call(n,i)||(h--,delete r[i])}else r!==n&&(r=n,u++);return u}}return this.$watch(c,(function(){if(d?(d=!1,t(n,n,a)):t(n,i,a),s)if(F(n))if(x(n)){i=new Array(n.length);for(var e=0;e0&&!this.peek("}",")",";","]")&&e.push(this.expressionStatement()),!this.expect(";"))return{type:xr.Program,body:e}},expressionStatement:function(){return{type:xr.ExpressionStatement,expression:this.filterChain()}},filterChain:function(){for(var e=this.expression();this.expect("|");)e=this.filter(e);return e},expression:function(){return this.assignment()},assignment:function(){var e=this.ternary();if(this.expect("=")){if(!Cr(e))throw vr("lval","Trying to assign a value to a non l-value");e={type:xr.AssignmentExpression,left:e,right:this.assignment(),operator:"="}}return e},ternary:function(){var e,t,n=this.logicalOR();return this.expect("?")&&(e=this.expression(),this.consume(":"))?(t=this.expression(),{type:xr.ConditionalExpression,test:n,alternate:e,consequent:t}):n},logicalOR:function(){for(var e=this.logicalAND();this.expect("||");)e={type:xr.LogicalExpression,operator:"||",left:e,right:this.logicalAND()};return e},logicalAND:function(){for(var e=this.equality();this.expect("&&");)e={type:xr.LogicalExpression,operator:"&&",left:e,right:this.equality()};return e},equality:function(){for(var e,t=this.relational();e=this.expect("==","!=","===","!==");)t={type:xr.BinaryExpression,operator:e.text,left:t,right:this.relational()};return t},relational:function(){for(var e,t=this.additive();e=this.expect("<",">","<=",">=");)t={type:xr.BinaryExpression,operator:e.text,left:t,right:this.additive()};return t},additive:function(){for(var e,t=this.multiplicative();e=this.expect("+","-");)t={type:xr.BinaryExpression,operator:e.text,left:t,right:this.multiplicative()};return t},multiplicative:function(){for(var e,t=this.unary();e=this.expect("*","/","%");)t={type:xr.BinaryExpression,operator:e.text,left:t,right:this.unary()};return t},unary:function(){var e;return(e=this.expect("+","-","!"))?{type:xr.UnaryExpression,operator:e.text,prefix:!0,argument:this.unary()}:this.primary()},primary:function(){var e,t;for(this.expect("(")?(e=this.filterChain(),this.consume(")")):this.expect("[")?e=this.arrayDeclaration():this.expect("{")?e=this.object():this.selfReferential.hasOwnProperty(this.peek().text)?e=ae(this.selfReferential[this.consume().text]):this.options.literals.hasOwnProperty(this.peek().text)?e={type:xr.Literal,value:this.options.literals[this.consume().text]}:this.peek().identifier?e=this.identifier():this.peek().constant?e=this.constant():this.throwError("not a primary expression",this.peek());t=this.expect("(","[",".");)"("===t.text?(e={type:xr.CallExpression,callee:e,arguments:this.parseArguments()},this.consume(")")):"["===t.text?(e={type:xr.MemberExpression,object:e,property:this.expression(),computed:!0},this.consume("]")):"."===t.text?e={type:xr.MemberExpression,object:e,property:this.identifier(),computed:!1}:this.throwError("IMPOSSIBLE");return e},filter:function(e){for(var t=[e],n={type:xr.CallExpression,callee:this.identifier(),arguments:t,filter:!0};this.expect(":");)t.push(this.expression());return n},parseArguments:function(){var e=[];if(")"!==this.peekToken().text)do{e.push(this.filterChain())}while(this.expect(","));return e},identifier:function(){var e=this.consume();return e.identifier||this.throwError("is not a valid identifier",e),{type:xr.Identifier,name:e.text}},constant:function(){return{type:xr.Literal,value:this.consume().value}},arrayDeclaration:function(){var e=[];if("]"!==this.peekToken().text)do{if(this.peek("]"))break;e.push(this.expression())}while(this.expect(","));return this.consume("]"),{type:xr.ArrayExpression,elements:e}},object:function(){var e,t=[];if("}"!==this.peekToken().text)do{if(this.peek("}"))break;e={type:xr.Property,kind:"init"},this.peek().constant?(e.key=this.constant(),e.computed=!1,this.consume(":"),e.value=this.expression()):this.peek().identifier?(e.key=this.identifier(),e.computed=!1,this.peek(":")?(this.consume(":"),e.value=this.expression()):e.value=e.key):this.peek("[")?(this.consume("["),e.key=this.expression(),this.consume("]"),e.computed=!0,this.consume(":"),e.value=this.expression()):this.throwError("invalid key",this.peek()),t.push(e)}while(this.expect(","));return this.consume("}"),{type:xr.ObjectExpression,properties:t}},throwError:function(e,t){throw vr("syntax","Syntax Error: Token '{0}' {1} at column {2} of the expression [{3}] starting at [{4}].",t.text,e,t.index+1,this.text,this.text.substring(t.index))},consume:function(e){if(0===this.tokens.length)throw vr("ueoe","Unexpected end of expression: {0}",this.text);var t=this.expect(e);return t||this.throwError("is unexpected, expecting ["+e+"]",this.peek()),t},peekToken:function(){if(0===this.tokens.length)throw vr("ueoe","Unexpected end of expression: {0}",this.text);return this.tokens[0]},peek:function(e,t,n,r){return this.peekAhead(0,e,t,n,r)},peekAhead:function(e,t,n,r,i){if(this.tokens.length>e){var o=this.tokens[e],a=o.text;if(a===t||a===n||a===r||a===i||!t&&!n&&!r&&!i)return o}return!1},expect:function(e,t,n,r){var i=this.peek(e,t,n,r);return!!i&&(this.tokens.shift(),i)},selfReferential:{this:{type:xr.ThisExpression},$locals:{type:xr.LocalsExpression}}},Tr.prototype={compile:function(e){var t=this;this.state={nextId:0,filters:{},fn:{vars:[],body:[],own:{}},assign:{vars:[],body:[],own:{}},inputs:[]},Sr(e,t.$filter);var n,r="";if(this.stage="assign",n=Mr(e)){this.state.computing="assign";var i=this.nextId();this.recurse(n,i),this.return_(i),r="fn.assign="+this.generateFunction("assign","s,v,l")}var o=kr(e.body);t.stage="inputs",A(o,(function(e,n){var r="fn"+n;t.state[r]={vars:[],body:[],own:{}},t.state.computing=r;var i=t.nextId();t.recurse(e,i),t.return_(i),t.state.inputs.push({name:r,isPure:e.isPure}),e.watchId=n})),this.state.computing="fn",this.stage="main",this.recurse(e);var a='"'+this.USE+" "+this.STRICT+'";\n'+this.filterPrefix()+"var fn="+this.generateFunction("fn","s,l,a,i")+r+this.watchFns()+"return fn;",s=new Function("$filter","getStringValue","ifDefined","plus",a)(this.$filter,yr,Ar,Er);return this.state=this.stage=void 0,s},USE:"use",STRICT:"strict",watchFns:function(){var e=[],t=this.state.inputs,n=this;return A(t,(function(t){e.push("var "+t.name+"="+n.generateFunction(t.name,"s")),t.isPure&&e.push(t.name,".isPure="+JSON.stringify(t.isPure)+";")})),t.length&&e.push("fn.inputs=["+t.map((function(e){return e.name})).join(",")+"];"),e.join("")},generateFunction:function(e,t){return"function("+t+"){"+this.varsPrefix(e)+this.body(e)+"};"},filterPrefix:function(){var e=[],t=this;return A(this.state.filters,(function(n,r){e.push(n+"=$filter("+t.escape(r)+")")})),e.length?"var "+e.join(",")+";":""},varsPrefix:function(e){return this.state[e].vars.length?"var "+this.state[e].vars.join(",")+";":""},body:function(e){return this.state[e].body.join("")},recurse:function(e,t,n,r,i,o){var a,s,u,c,l,p=this;if(r=r||j,!o&&P(e.watchId))return t=t||this.nextId(),void this.if_("i",this.lazyAssign(t,this.computedMember("i",e.watchId)),this.lazyRecurse(e,t,n,r,i,!0));switch(e.type){case xr.Program:A(e.body,(function(t,n){p.recurse(t.expression,void 0,void 0,(function(e){s=e})),n!==e.body.length-1?p.current().body.push(s,";"):p.return_(s)}));break;case xr.Literal:c=this.escape(e.value),this.assign(t,c),r(t||c);break;case xr.UnaryExpression:this.recurse(e.argument,void 0,void 0,(function(e){s=e})),c=e.operator+"("+this.ifDefined(s,0)+")",this.assign(t,c),r(c);break;case xr.BinaryExpression:this.recurse(e.left,void 0,void 0,(function(e){a=e})),this.recurse(e.right,void 0,void 0,(function(e){s=e})),c="+"===e.operator?this.plus(a,s):"-"===e.operator?this.ifDefined(a,0)+e.operator+this.ifDefined(s,0):"("+a+")"+e.operator+"("+s+")",this.assign(t,c),r(c);break;case xr.LogicalExpression:t=t||this.nextId(),p.recurse(e.left,t),p.if_("&&"===e.operator?t:p.not(t),p.lazyRecurse(e.right,t)),r(t);break;case xr.ConditionalExpression:t=t||this.nextId(),p.recurse(e.test,t),p.if_(t,p.lazyRecurse(e.alternate,t),p.lazyRecurse(e.consequent,t)),r(t);break;case xr.Identifier:t=t||this.nextId(),n&&(n.context="inputs"===p.stage?"s":this.assign(this.nextId(),this.getHasOwnProperty("l",e.name)+"?l:s"),n.computed=!1,n.name=e.name),p.if_("inputs"===p.stage||p.not(p.getHasOwnProperty("l",e.name)),(function(){p.if_("inputs"===p.stage||"s",(function(){i&&1!==i&&p.if_(p.isNull(p.nonComputedMember("s",e.name)),p.lazyAssign(p.nonComputedMember("s",e.name),"{}")),p.assign(t,p.nonComputedMember("s",e.name))}))}),t&&p.lazyAssign(t,p.nonComputedMember("l",e.name))),r(t);break;case xr.MemberExpression:a=n&&(n.context=this.nextId())||this.nextId(),t=t||this.nextId(),p.recurse(e.object,a,void 0,(function(){p.if_(p.notNull(a),(function(){e.computed?(s=p.nextId(),p.recurse(e.property,s),p.getStringValue(s),i&&1!==i&&p.if_(p.not(p.computedMember(a,s)),p.lazyAssign(p.computedMember(a,s),"{}")),c=p.computedMember(a,s),p.assign(t,c),n&&(n.computed=!0,n.name=s)):(i&&1!==i&&p.if_(p.isNull(p.nonComputedMember(a,e.property.name)),p.lazyAssign(p.nonComputedMember(a,e.property.name),"{}")),c=p.nonComputedMember(a,e.property.name),p.assign(t,c),n&&(n.computed=!1,n.name=e.property.name))}),(function(){p.assign(t,"undefined")})),r(t)}),!!i);break;case xr.CallExpression:t=t||this.nextId(),e.filter?(s=p.filter(e.callee.name),u=[],A(e.arguments,(function(e){var t=p.nextId();p.recurse(e,t),u.push(t)})),c=s+"("+u.join(",")+")",p.assign(t,c),r(t)):(s=p.nextId(),a={},u=[],p.recurse(e.callee,s,a,(function(){p.if_(p.notNull(s),(function(){A(e.arguments,(function(t){p.recurse(t,e.constant?void 0:p.nextId(),void 0,(function(e){u.push(e)}))})),c=a.name?p.member(a.context,a.name,a.computed)+"("+u.join(",")+")":s+"("+u.join(",")+")",p.assign(t,c)}),(function(){p.assign(t,"undefined")})),r(t)})));break;case xr.AssignmentExpression:s=this.nextId(),a={},this.recurse(e.left,void 0,a,(function(){p.if_(p.notNull(a.context),(function(){p.recurse(e.right,s),c=p.member(a.context,a.name,a.computed)+e.operator+s,p.assign(t,c),r(t||c)}))}),1);break;case xr.ArrayExpression:u=[],A(e.elements,(function(t){p.recurse(t,e.constant?void 0:p.nextId(),void 0,(function(e){u.push(e)}))})),c="["+u.join(",")+"]",this.assign(t,c),r(t||c);break;case xr.ObjectExpression:u=[],l=!1,A(e.properties,(function(e){e.computed&&(l=!0)})),l?(t=t||this.nextId(),this.assign(t,"{}"),A(e.properties,(function(e){e.computed?(a=p.nextId(),p.recurse(e.key,a)):a=e.key.type===xr.Identifier?e.key.name:""+e.key.value,s=p.nextId(),p.recurse(e.value,s),p.assign(p.member(t,a,e.computed),s)}))):(A(e.properties,(function(t){p.recurse(t.value,e.constant?void 0:p.nextId(),void 0,(function(e){u.push(p.escape(t.key.type===xr.Identifier?t.key.name:""+t.key.value)+":"+e)}))})),c="{"+u.join(",")+"}",this.assign(t,c)),r(t||c);break;case xr.ThisExpression:this.assign(t,"s"),r(t||"s");break;case xr.LocalsExpression:this.assign(t,"l"),r(t||"l");break;case xr.NGValueParameter:this.assign(t,"v"),r(t||"v")}},getHasOwnProperty:function(e,t){var n=e+"."+t,r=this.current().own;return r.hasOwnProperty(n)||(r[n]=this.nextId(!1,e+"&&("+this.escape(t)+" in "+e+")")),r[n]},assign:function(e,t){if(e)return this.current().body.push(e,"=",t,";"),e},filter:function(e){return this.state.filters.hasOwnProperty(e)||(this.state.filters[e]=this.nextId(!0)),this.state.filters[e]},ifDefined:function(e,t){return"ifDefined("+e+","+this.escape(t)+")"},plus:function(e,t){return"plus("+e+","+t+")"},return_:function(e){this.current().body.push("return ",e,";")},if_:function(e,t,n){if(!0===e)t();else{var r=this.current().body;r.push("if(",e,"){"),t(),r.push("}"),n&&(r.push("else{"),n(),r.push("}"))}},not:function(e){return"!("+e+")"},isNull:function(e){return e+"==null"},notNull:function(e){return e+"!=null"},nonComputedMember:function(e,t){return/^[$_a-zA-Z][$_a-zA-Z0-9]*$/.test(t)?e+"."+t:e+'["'+t.replace(/[^$_a-zA-Z0-9]/g,this.stringEscapeFn)+'"]'},computedMember:function(e,t){return e+"["+t+"]"},member:function(e,t,n){return n?this.computedMember(e,t):this.nonComputedMember(e,t)},getStringValue:function(e){this.assign(e,"getStringValue("+e+")")},lazyRecurse:function(e,t,n,r,i,o){var a=this;return function(){a.recurse(e,t,n,r,i,o)}},lazyAssign:function(e,t){var n=this;return function(){n.assign(e,t)}},stringEscapeRegex:/[^ a-zA-Z0-9]/g,stringEscapeFn:function(e){return"\\u"+("0000"+e.charCodeAt(0).toString(16)).slice(-4)},escape:function(e){if(G(e))return"'"+e.replace(this.stringEscapeRegex,this.stringEscapeFn)+"'";if(B(e))return e.toString();if(!0===e)return"true";if(!1===e)return"false";if(null===e)return"null";if(void 0===e)return"undefined";throw vr("esc","IMPOSSIBLE")},nextId:function(e,t){var n="v"+this.state.nextId++;return e||this.current().vars.push(n+(t?"="+t:"")),n},current:function(){return this.state[this.state.computing]}},Ir.prototype={compile:function(e){var t,n,r=this;Sr(e,r.$filter),(t=Mr(e))&&(n=this.recurse(t));var i,o=kr(e.body);o&&(i=[],A(o,(function(e,t){var n=r.recurse(e);n.isPure=e.isPure,e.input=n,i.push(n),e.watchId=t})));var a=[];A(e.body,(function(e){a.push(r.recurse(e.expression))}));var s=0===e.body.length?j:1===e.body.length?a[0]:function(e,t){var n;return A(a,(function(r){n=r(e,t)})),n};return n&&(s.assign=function(e,t,r){return n(e,r,t)}),i&&(s.inputs=i),s},recurse:function(e,t,n){var r,i,o,a=this;if(e.input)return this.inputs(e.input,e.watchId);switch(e.type){case xr.Literal:return this.value(e.value,t);case xr.UnaryExpression:return i=this.recurse(e.argument),this["unary"+e.operator](i,t);case xr.BinaryExpression:case xr.LogicalExpression:return r=this.recurse(e.left),i=this.recurse(e.right),this["binary"+e.operator](r,i,t);case xr.ConditionalExpression:return this["ternary?:"](this.recurse(e.test),this.recurse(e.alternate),this.recurse(e.consequent),t);case xr.Identifier:return a.identifier(e.name,t,n);case xr.MemberExpression:return r=this.recurse(e.object,!1,!!n),e.computed||(i=e.property.name),e.computed&&(i=this.recurse(e.property)),e.computed?this.computedMember(r,i,t,n):this.nonComputedMember(r,i,t,n);case xr.CallExpression:return o=[],A(e.arguments,(function(e){o.push(a.recurse(e))})),e.filter&&(i=this.$filter(e.callee.name)),e.filter||(i=this.recurse(e.callee,!0)),e.filter?function(e,n,r,a){for(var s=[],u=0;u":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>t(r,i,o,a);return n?{value:s}:s}},"binary<=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)<=t(r,i,o,a);return n?{value:s}:s}},"binary>=":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)>=t(r,i,o,a);return n?{value:s}:s}},"binary&&":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)&&t(r,i,o,a);return n?{value:s}:s}},"binary||":function(e,t,n){return function(r,i,o,a){var s=e(r,i,o,a)||t(r,i,o,a);return n?{value:s}:s}},"ternary?:":function(e,t,n,r){return function(i,o,a,s){var u=e(i,o,a,s)?t(i,o,a,s):n(i,o,a,s);return r?{value:u}:u}},value:function(e,t){return function(){return t?{context:void 0,name:void 0,value:e}:e}},identifier:function(e,t,n){return function(r,i,o,a){var s=i&&e in i?i:r;n&&1!==n&&s&&null==s[e]&&(s[e]={});var u=s?s[e]:void 0;return t?{context:s,name:e,value:u}:u}},computedMember:function(e,t,n,r){return function(i,o,a,s){var u,c,l=e(i,o,a,s);return null!=l&&(u=yr(u=t(i,o,a,s)),r&&1!==r&&l&&!l[u]&&(l[u]={}),c=l[u]),n?{context:l,name:u,value:c}:c}},nonComputedMember:function(e,t,n,r){return function(i,o,a,s){var u=e(i,o,a,s);r&&1!==r&&u&&null==u[t]&&(u[t]={});var c=null!=u?u[t]:void 0;return n?{context:u,name:t,value:c}:c}},inputs:function(e,t){return function(n,r,i,o){return o?o[t]:e(n,r,i)}}},Rr.prototype={constructor:Rr,parse:function(e){var t=this.getAst(e),n=this.astCompiler.compile(t.ast);return n.literal=function(e){return 0===e.body.length||1===e.body.length&&(e.body[0].expression.type===xr.Literal||e.body[0].expression.type===xr.ArrayExpression||e.body[0].expression.type===xr.ObjectExpression)}(t.ast),n.constant=function(e){return e.constant}(t.ast),n.oneTime=t.oneTime,n},getAst:function(e){var t=!1;return":"===(e=e.trim()).charAt(0)&&":"===e.charAt(1)&&(t=!0,e=e.substring(2)),{ast:this.ast.ast(e),oneTime:t}}};var Br=o("$sce"),zr={HTML:"html",CSS:"css",MEDIA_URL:"mediaUrl",URL:"url",RESOURCE_URL:"resourceUrl",JS:"js"},Hr=/_([a-z])/g;function Zr(e){return e.replace(Hr,qe)}function Yr(e){var t=[];return P(e)&&A(e,(function(e){t.push(function(e){if("self"===e)return e;if(G(e)){if(e.indexOf("***")>-1)throw Br("iwcard","Illegal sequence *** in string matcher. String: {0}",e);return e=te(e).replace(/\\\*\\\*/g,".*").replace(/\\\*/g,"[^:/.?&;]*"),new RegExp("^"+e+"$")}if(W(e))return new RegExp("^"+e.source+"$");throw Br("imatcher",'Matchers may only be "self", string patterns or RegExp objects')}(e))})),t}function Wr(){this.SCE_CONTEXTS=zr;var t=["self"],n=[];this.trustedResourceUrlList=function(e){return arguments.length&&(t=Yr(e)),t},Object.defineProperty(this,"resourceUrlWhitelist",{get:function(){return this.trustedResourceUrlList},set:function(e){this.trustedResourceUrlList=e}}),this.bannedResourceUrlList=function(e){return arguments.length&&(n=Yr(e)),n},Object.defineProperty(this,"resourceUrlBlacklist",{get:function(){return this.bannedResourceUrlList},set:function(e){this.bannedResourceUrlList=e}}),this.$get=["$injector","$$sanitizeUri",function(r,i){var o=function(e){throw Br("unsafe","Attempting to use an unsafe value in a safe context.")};function a(t,n){return"self"===t?ci(n,ai)||ci(n,e.document.baseURI?e.document.baseURI:(ii||((ii=e.document.createElement("a")).href="http://github.com/",ii=ii.cloneNode(!1)),ii.href)):!!t.exec(n.href)}function s(e){var t=function(e){this.$$unwrapTrustedValue=function(){return e}};return e&&(t.prototype=new e),t.prototype.valueOf=function(){return this.$$unwrapTrustedValue()},t.prototype.toString=function(){return this.$$unwrapTrustedValue().toString()},t}r.has("$sanitize")&&(o=r.get("$sanitize"));var u=s(),c={};return c[zr.HTML]=s(u),c[zr.CSS]=s(u),c[zr.MEDIA_URL]=s(u),c[zr.URL]=s(c[zr.MEDIA_URL]),c[zr.JS]=s(u),c[zr.RESOURCE_URL]=s(c[zr.URL]),{trustAs:function(e,t){var n=c.hasOwnProperty(e)?c[e]:null;if(!n)throw Br("icontext","Attempted to trust a value in invalid context. Context: {0}; Value: {1}",e,t);if(null===t||U(t)||""===t)return t;if("string"!=typeof t)throw Br("itype","Attempted to trust a non-string value in a content requiring a string: Context: {0}",e);return new n(t)},getTrusted:function(e,r){if(null===r||U(r)||""===r)return r;var s=c.hasOwnProperty(e)?c[e]:null;if(s&&r instanceof s)return r.$$unwrapTrustedValue();if(Y(r.$$unwrapTrustedValue)&&(r=r.$$unwrapTrustedValue()),e===zr.MEDIA_URL||e===zr.URL)return i(r.toString(),e===zr.MEDIA_URL);if(e===zr.RESOURCE_URL){if(function(e){var r,i,o=ui(e.toString()),s=!1;for(r=0,i=t.length;r to the top of your HTML document. See http://docs.angularjs.org/api/ng.$sce for more information.");var r=Ge(zr);r.isEnabled=function(){return e},r.trustAs=n.trustAs,r.getTrusted=n.getTrusted,r.valueOf=n.valueOf,e||(r.trustAs=r.getTrusted=function(e,t){return t},r.valueOf=_),r.parseAs=function(e,n){var i=t(n);return i.literal&&i.constant?i:t(n,(function(t){return r.getTrusted(e,t)}))};var i=r.parseAs,o=r.getTrusted,s=r.trustAs;return A(zr,(function(e,t){var n=f(t);r[Zr("parse_as_"+n)]=function(t){return i(e,t)},r[Zr("get_trusted_"+n)]=function(t){return o(e,t)},r[Zr("trust_as_"+n)]=function(t){return s(e,t)}})),r}]}function Qr(){this.$get=["$window","$document",function(e,t){var n={},r=!((!e.nw||!e.nw.process)&&e.chrome&&(e.chrome.app&&e.chrome.app.runtime||!e.chrome.app&&e.chrome.runtime&&e.chrome.runtime.id))&&e.history&&e.history.pushState,i=R((/android (\d+)/.exec(f((e.navigator||{}).userAgent))||[])[1]),o=/Boxee/i.test((e.navigator||{}).userAgent),s=t[0]||{},u=s.body&&s.body.style,c=!1,l=!1;return u&&(c=!(!("transition"in u)&&!("webkitTransition"in u)),l=!(!("animation"in u)&&!("webkitAnimation"in u))),{history:!(!r||i<4||o),hasEvent:function(e){if("input"===e&&a)return!1;if(U(n[e])){var t=s.createElement("div");n[e]="on"+e in t}return n[e]},csp:ce(),transitions:c,animations:l,android:i}}]}function qr(){this.$get=D((function(e){return new Xr(e)}))}function Xr(e){var t=this,n={},r=[],i=t.ALL_TASKS_TYPE="$$all$$",o=t.DEFAULT_TASK_TYPE="$$default$$";function a(){var e=r.pop();return e&&e.cb}function s(e){for(var t=r.length-1;t>=0;--t){var n=r[t];if(n.type===e)return r.splice(t,1),n.cb}}t.completeTask=function(t,r){r=r||o;try{t()}finally{!function(e){n[e=e||o]&&(n[e]--,n[i]--)}(r);var u=n[r],c=n[i];if(!c||!u)for(var l,p=c?s:a;l=p(r);)try{l()}catch(t){e.error(t)}}},t.incTaskCount=function(e){n[e=e||o]=(n[e]||0)+1,n[i]=(n[i]||0)+1},t.notifyWhenNoPendingTasks=function(e,t){n[t=t||i]?r.push({type:t,cb:e}):e()}}var Kr=o("$templateRequest");function ei(){var e;this.httpOptions=function(t){return t?(e=t,this):e},this.$get=["$exceptionHandler","$templateCache","$http","$q","$sce",function(t,n,r,i,o){function a(s,u){a.totalPendingRequests++,G(s)&&!U(n.get(s))||(s=o.getTrustedResourceUrl(s));var c=r.defaults&&r.defaults.transformResponse;return H(c)?c=c.filter((function(e){return e!==Pn})):c===Pn&&(c=null),r.get(s,T({cache:n,transformResponse:c},e)).finally((function(){a.totalPendingRequests--})).then((function(e){return n.put(s,e.data)}),(function(e){return u||(e=Kr("tpload","Failed to load template: {0} (HTTP status: {1} {2})",s,e.status,e.statusText),t(e)),i.reject(e)}))}return a.totalPendingRequests=0,a}]}function ti(){this.$get=["$rootScope","$browser","$location",function(e,t,n){return{findBindings:function(e,t,n){var r=e.getElementsByClassName("ng-binding"),i=[];return A(r,(function(e){var r=$.element(e).data("$binding");r&&A(r,(function(r){n?new RegExp("(^|\\s)"+te(t)+"(\\s|\\||$)").test(r)&&i.push(e):-1!==r.indexOf(t)&&i.push(e)}))})),i},findModels:function(e,t,n){for(var r=["ng-","data-ng-","ng\\:"],i=0;i-1&&(n="["+n+"]"),{href:oi.href,protocol:oi.protocol?oi.protocol.replace(/:$/,""):"",host:oi.host,search:oi.search?oi.search.replace(/^\?/,""):"",hash:oi.hash?oi.hash.replace(/^#/,""):"",hostname:n,port:oi.port,pathname:"/"===oi.pathname.charAt(0)?oi.pathname:"/"+oi.pathname}}function ci(e,t){return e=ui(e),t=ui(t),e.protocol===t.protocol&&e.host===t.host}function li(){this.$get=D(e)}function pi(e){var t=e[0]||{},n={},r="";function i(e){try{return decodeURIComponent(e)}catch(t){return e}}return function(){var e,o,a,s,u,c=function(e){try{return e.cookie||""}catch(e){return""}}(t);if(c!==r)for(e=(r=c).split("; "),n={},a=0;a0&&(u=i(o.substring(0,s)),U(n[u])&&(n[u]=i(o.substring(s+1))));return n}}function fi(){this.$get=pi}function di(e){var t="Filter";function n(r,i){if(F(r)){var o={};return A(r,(function(e,t){o[t]=n(t,e)})),o}return e.factory(r+t,i)}this.register=n,this.$get=["$injector",function(e){return function(n){return e.get(n+t)}}],n("currency",mi),n("date",Ti),n("filter",hi),n("json",Ii),n("limitTo",Ni),n("lowercase",Ri),n("number",yi),n("orderBy",_i),n("uppercase",Oi)}function hi(){return function(e,t,n,r){if(!x(e)){if(null==e)return e;throw o("filter")("notarray","Expected array but received: {0}",e)}var i,a;switch(r=r||"$",vi(t)){case"function":i=t;break;case"boolean":case"null":case"number":case"string":a=!0;case"object":i=function(e,t,n,r){var i=F(e)&&n in e;return!0===t?t=ue:Y(t)||(t=function(e,t){return!(U(e)||(null===e||null===t?e!==t:F(t)||F(e)&&!L(e)||(e=f(""+e),t=f(""+t),-1===e.indexOf(t))))}),function(o){return i&&!F(o)?gi(o,e[n],t,n,!1):gi(o,e,t,n,r)}}(t,n,r,a);break;default:return e}return Array.prototype.filter.call(e,i)}}function gi(e,t,n,r,i,o){var a=vi(e),s=vi(t);if("string"===s&&"!"===t.charAt(0))return!gi(e,t.substring(1),n,r,i);if(H(e))return e.some((function(e){return gi(e,t,n,r,i)}));switch(a){case"object":var u;if(i){for(u in e)if(u.charAt&&"$"!==u.charAt(0)&&gi(e[u],t,n,r,!0))return!0;return!o&&gi(e,t,n,r,!1)}if("object"===s){for(u in t){var c=t[u];if(!Y(c)&&!U(c)){var l=u===r;if(!gi(l?e:e[u],c,n,r,l,l))return!1}}return!0}return n(e,t);case"function":return!1;default:return n(e,t)}}function vi(e){return null===e?"null":typeof e}function mi(e){var t=e.NUMBER_FORMATS;return function(e,n,r){U(n)&&(n=t.CURRENCY_SYM),U(r)&&(r=t.PATTERNS[1].maxFrac);var i=n?/\u00A4/g:/\s*\u00A4\s*/g;return null==e?e:bi(e,t.PATTERNS[1],t.GROUP_SEP,t.DECIMAL_SEP,r).replace(i,n)}}function yi(e){var t=e.NUMBER_FORMATS;return function(e,n){return null==e?e:bi(e,t.PATTERNS[0],t.GROUP_SEP,t.DECIMAL_SEP,n)}}function bi(e,t,n,r,i){if(!G(e)&&!B(e)||isNaN(e))return"";var o,a=!isFinite(e),s=!1,u=Math.abs(e)+"",c="";if(a)c="∞";else{o=function(e){var t,n,r,i,o,a=0;for((n=e.indexOf("."))>-1&&(e=e.replace(".","")),(r=e.search(/e/i))>0?(n<0&&(n=r),n+=+e.slice(r+1),e=e.substring(0,r)):n<0&&(n=e.length),r=0;"0"===e.charAt(r);r++);if(r===(o=e.length))t=[0],n=1;else{for(o--;"0"===e.charAt(o);)o--;for(n-=r,t=[],i=0;r<=o;r++,i++)t[i]=+e.charAt(r)}return n>22&&(t=t.splice(0,21),a=n-1,n=1),{d:t,e:a,i:n}}(u),function(e,t,n,r){var i=e.d,o=i.length-e.i,a=(t=U(t)?Math.min(Math.max(n,o),r):+t)+e.i,s=i[a];if(a>0){i.splice(Math.max(e.i,a));for(var u=a;u=5)if(a-1<0){for(var l=0;l>a;l--)i.unshift(0),e.i++;i.unshift(1),e.i++}else i[a-1]++;for(;o0?d=l.splice(p,l.length):(d=l,l=[0]);var h=[];for(l.length>=t.lgSize&&h.unshift(l.splice(-t.lgSize,l.length).join(""));l.length>t.gSize;)h.unshift(l.splice(-t.gSize,l.length).join(""));l.length&&h.unshift(l.join("")),c=h.join(n),d.length&&(c+=r+d.join("")),f&&(c+="e+"+f)}return e<0&&!s?t.negPre+c+t.negSuf:t.posPre+c+t.posSuf}function $i(e,t,n,r){var i="";for((e<0||r&&e<=0)&&(r?e=1-e:(e=-e,i="-")),e=""+e;e.length0||a>-n)&&(a+=n),0===a&&-12===n&&(a=12),$i(a,t,r,i)}}function xi(e,t,n){return function(r,i){var o=r["get"+e]();return i[d((n?"STANDALONE":"")+(t?"SHORT":"")+e)][o]}}function Ai(e){var t=new Date(e,0,1).getDay();return new Date(e,0,(t<=4?5:12)-t)}function Ei(e){return function(t){var n,r=Ai(t.getFullYear()),i=(n=t,+new Date(n.getFullYear(),n.getMonth(),n.getDate()+(4-n.getDay()))-+r);return $i(1+Math.round(i/6048e5),e)}}function Si(e,t){return e.getFullYear()<=0?t.ERAS[0]:t.ERAS[1]}pi.$inject=["$document"],di.$inject=["$provide"],mi.$inject=["$locale"],yi.$inject=["$locale"];var ki={yyyy:wi("FullYear",4,0,!1,!0),yy:wi("FullYear",2,0,!0,!0),y:wi("FullYear",1,0,!1,!0),MMMM:xi("Month"),MMM:xi("Month",!0),MM:wi("Month",2,1),M:wi("Month",1,1),LLLL:xi("Month",!1,!0),dd:wi("Date",2),d:wi("Date",1),HH:wi("Hours",2),H:wi("Hours",1),hh:wi("Hours",2,-12),h:wi("Hours",1,-12),mm:wi("Minutes",2),m:wi("Minutes",1),ss:wi("Seconds",2),s:wi("Seconds",1),sss:wi("Milliseconds",3),EEEE:xi("Day"),EEE:xi("Day",!0),a:function(e,t){return e.getHours()<12?t.AMPMS[0]:t.AMPMS[1]},Z:function(e,t,n){var r=-1*n;return(r>=0?"+":"")+($i(Math[r>0?"floor":"ceil"](r/60),2)+$i(Math.abs(r%60),2))},ww:Ei(2),w:Ei(1),G:Si,GG:Si,GGG:Si,GGGG:function(e,t){return e.getFullYear()<=0?t.ERANAMES[0]:t.ERANAMES[1]}},Ci=/((?:[^yMLdHhmsaZEwG']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|m+|s+|a|Z|G+|w+))([\s\S]*)/,Mi=/^-?\d+$/;function Ti(e){var t=/^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;return function(n,r,i){var o,a,s="",u=[];if(r=r||"mediumDate",r=e.DATETIME_FORMATS[r]||r,G(n)&&(n=Mi.test(n)?R(n):function(e){var n;if(n=e.match(t)){var r=new Date(0),i=0,o=0,a=n[8]?r.setUTCFullYear:r.setFullYear,s=n[8]?r.setUTCHours:r.setHours;n[9]&&(i=R(n[9]+n[10]),o=R(n[9]+n[11])),a.call(r,R(n[1]),R(n[2])-1,R(n[3]));var u=R(n[4]||0)-i,c=R(n[5]||0)-o,l=R(n[6]||0),p=Math.round(1e3*parseFloat("0."+(n[7]||0)));return s.call(r,u,c,l,p),r}return e}(n)),B(n)&&(n=new Date(n)),!z(n)||!isFinite(n.getTime()))return n;for(;r;)(a=Ci.exec(r))?r=(u=pe(u,a,1)).pop():(u.push(r),r=null);var c=n.getTimezoneOffset();return i&&(c=ye(i,c),n=$e(n,i,!0)),A(u,(function(t){s+=(o=ki[t])?o(n,e.DATETIME_FORMATS,c):"''"===t?"'":t.replace(/(^'|'$)/g,"").replace(/''/g,"'")})),s}}function Ii(){return function(e,t){return U(t)&&(t=2),ge(e,t)}}Ti.$inject=["$locale"];var Ri=D(f),Oi=D(d);function Ni(){return function(e,t,n){return t=Math.abs(Number(t))===1/0?Number(t):R(t),O(t)?e:(B(e)&&(e=e.toString()),x(e)?(n=(n=!n||isNaN(n)?0:R(n))<0?Math.max(0,e.length+n):n,t>=0?ji(e,n,n+t):0===n?ji(e,t,e.length):ji(e,Math.max(0,n+t),n)):e)}}function ji(e,t,n){return G(e)?e.slice(t,n):h.call(e,t,n)}function _i(e){return function(r,i,a,s){if(null==r)return r;if(!x(r))throw o("orderBy")("notarray","Expected array but received: {0}",r);H(i)||(i=[i]),0===i.length&&(i=["+"]);var u=i.map((function(t){var n=1,r=_;if(Y(t))r=t;else if(G(t)&&("+"!==t.charAt(0)&&"-"!==t.charAt(0)||(n="-"===t.charAt(0)?-1:1,t=t.substring(1)),""!==t&&(r=e(t)).constant)){var i=r();r=function(e){return e[i]}}return{get:r,descending:n}})),c=a?-1:1,l=Y(s)?s:n,p=Array.prototype.map.call(r,(function(e,n){return{value:e,tieBreaker:{value:n,type:"number",index:n},predicateValues:u.map((function(r){return function(e,n){var r=typeof e;return null===e?r="null":"object"===r&&(e=function(e){return Y(e.valueOf)&&t(e=e.valueOf())||L(e)&&t(e=e.toString()),e}(e)),{value:e,type:r,index:n}}(r.get(e),n)}))}}));return p.sort((function(e,t){for(var r=0,i=u.length;r=u},n.$observe("min",(function(e){e!==c&&(u=fo(e),c=e,r.$validate())}))}if(P(n.max)||n.ngMax){var l=n.max||s(n.ngMax)(e),p=fo(l);r.$validators.max=function(e,t){return r.$isEmpty(t)||U(p)||t<=p},n.$observe("max",(function(e){e!==l&&(p=fo(e),l=e,r.$validate())}))}if(P(n.step)||n.ngStep){var f=n.step||s(n.ngStep)(e),d=fo(f);r.$validators.step=function(e,t){return r.$isEmpty(t)||U(d)||vo(t,u||0,d)},n.$observe("step",(function(e){e!==f&&(d=fo(e),f=e,r.$validate())}))}},url:function(e,t,n,r,i,o){so(0,t,n,r,i,o),ao(r),r.$validators.url=function(e,t){var n=e||t;return r.$isEmpty(n)||Qi.test(n)}},email:function(e,t,n,r,i,o){so(0,t,n,r,i,o),ao(r),r.$validators.email=function(e,t){var n=e||t;return r.$isEmpty(n)||qi.test(n)}},radio:function(e,t,n,r){var i=!n.ngTrim||"false"!==ee(n.ngTrim);U(n.name)&&t.attr("name",k()),t.on("change",(function(e){var o;t[0].checked&&(o=n.value,i&&(o=ee(o)),r.$setViewValue(o,e&&e.type))})),r.$render=function(){var e=n.value;i&&(e=ee(e)),t[0].checked=e===r.$viewValue},n.$observe("value",r.$render)},range:function(e,t,n,r,i,o){lo(0,t,0,r,"range"),po(r),so(0,t,n,r,i,o);var a=r.$$hasNativeValidators&&"range"===t[0].type,s=a?0:void 0,u=a?100:void 0,c=a?1:void 0,l=t[0].validity,p=P(n.min),f=P(n.max),d=P(n.step),h=r.$render;function g(e,r){t.attr(e,n[e]);var i=n[e];n.$observe(e,(function(e){e!==i&&(i=e,r(e))}))}r.$render=a&&P(l.rangeUnderflow)&&P(l.rangeOverflow)?function(){h(),r.$setViewValue(t.val())}:h,p&&(s=fo(n.min),r.$validators.min=a?function(){return!0}:function(e,t){return r.$isEmpty(t)||U(s)||t>=s},g("min",(function(e){if(s=fo(e),!O(r.$modelValue))if(a){var n=t.val();s>n&&(n=s,t.val(n)),r.$setViewValue(n)}else r.$validate()}))),f&&(u=fo(n.max),r.$validators.max=a?function(){return!0}:function(e,t){return r.$isEmpty(t)||U(u)||t<=u},g("max",(function(e){if(u=fo(e),!O(r.$modelValue))if(a){var n=t.val();u=v},a.$observe("min",(function(e){e!==g&&(v=$(e),g=e,s.$validate())}))}if(P(a.max)||a.ngMax){var m=a.max||p(a.ngMax)(i),y=$(m);s.$validators.max=function(e){return!b(e)||U(y)||n(e)<=y},a.$observe("max",(function(e){e!==m&&(y=$(e),m=e,s.$validate())}))}function b(e){return e&&!(e.getTime&&e.getTime()!=e.getTime())}function $(e){return P(e)&&!z(e)?w(e)||void 0:e}function w(e,t){var r=s.$options.getOption("timezone");d&&d!==r&&(t=be(t,ye(d)));var i=n(e,t);return!isNaN(i)&&r&&(i=$e(i,r)),i}}}function lo(e,t,n,r,i){var o=t[0];(r.$$hasNativeValidators=F(o.validity))&&r.$parsers.push((function(e){var n=t.prop("validity")||{};if(!n.badInput&&!n.typeMismatch)return e;r.$$parserName=i}))}function po(e){e.$parsers.push((function(t){return e.$isEmpty(t)?null:Xi.test(t)?parseFloat(t):void(e.$$parserName="number")})),e.$formatters.push((function(t){if(!e.$isEmpty(t)){if(!B(t))throw Wo("numfmt","Expected `{0}` to be a number",t);t=t.toString()}return t}))}function fo(e){return P(e)&&!B(e)&&(e=parseFloat(e)),O(e)?void 0:e}function ho(e){return(0|e)===e}function go(e){var t=e.toString(),n=t.indexOf(".");if(-1===n){if(-10||p[e])&&(p[e]=(p[e]||0)+t,p[e]===+(t>0)&&n.push(e))})),n.join(" ")}p||(p=Pe(),u.data("$classCounts",p)),"ngClass"!==e&&(n||(n=a("$index",(function(e){return 1&e}))),s.$watch(n,(function(e){var n;e===t?(n=d(i(n=l),1),c.$addClass(n)):function(e){e=d(i(e),-1),c.$removeClass(e)}(l),f=e}))),s.$watch(a(c[e],o),(function(e){f===t&&function(e,t){var n=i(e),o=i(t),a=r(n,o),s=r(o,n),u=d(a,-1),l=d(s,1);c.$addClass(l),c.$removeClass(u)}(l,e),l=e}))}}}];function r(e,t){if(!e||!e.length)return[];if(!t||!t.length)return e;var n=[];e:for(var r=0;r0?this.$$pendingDebounce=this.$$timeout((function(){n.$commitViewValue()}),t):this.$$rootScope.$$phase?this.$commitViewValue():this.$$scope.$apply((function(){n.$commitViewValue()}))},$overrideModelOptions:function(e){this.$options=this.$options.createChild(e),this.$$setUpdateOnEvents()},$processModelValue:function(){var e=this.$$format();this.$viewValue!==e&&(this.$$updateEmptyClasses(e),this.$viewValue=this.$$lastCommittedViewValue=e,this.$render(),this.$$runValidators(this.$modelValue,this.$viewValue,j))},$$format:function(){for(var e=this.$formatters,t=e.length,n=this.$modelValue;t--;)n=e[t](n);return n},$$setModelValue:function(e){this.$modelValue=this.$$rawModelValue=e,this.$$parserValid=void 0,this.$processModelValue()},$$setUpdateOnEvents:function(){this.$$updateEvents&&this.$$element.off(this.$$updateEvents,this.$$updateEventHandler),this.$$updateEvents=this.$options.getOption("updateOn"),this.$$updateEvents&&this.$$element.on(this.$$updateEvents,this.$$updateEventHandler)},$$updateEventHandler:function(e){this.$$debounceViewValueCommit(e&&e.type)}},Yi({clazz:Jo,set:function(e,t){e[t]=!0},unset:function(e,t){delete e[t]}});var Qo,qo=["$rootScope",function(e){return{restrict:"A",require:["ngModel","^?form","^?ngModelOptions"],controller:Jo,priority:1,compile:function(t){return t.addClass(Go).addClass(zo).addClass(Fo),{pre:function(e,t,n,r){var i=r[0],o=r[1]||i.$$parentForm,a=r[2];a&&(i.$options=a.$options),i.$$initGetterSetters(),o.$addControl(i),n.$observe("name",(function(e){i.$name!==e&&i.$$parentForm.$$renameControl(i,e)})),e.$on("$destroy",(function(){i.$$parentForm.$removeControl(i)}))},post:function(t,n,r,i){var o=i[0];function a(){o.$setTouched()}o.$$setUpdateOnEvents(),n.on("blur",(function(){o.$touched||(e.$$phase?t.$evalAsync(a):t.$apply(a))}))}}}}}],Xo=/(\s+|^)default(\s+|$)/;function Ko(e){this.$$options=e}Ko.prototype={getOption:function(e){return this.$$options[e]},createChild:function(e){var t=!1;return A(e=T({},e),(function(n,r){"$inherit"===n?"*"===r?t=!0:(e[r]=this.$$options[r],"updateOn"===r&&(e.updateOnDefault=this.$$options.updateOnDefault)):"updateOn"===r&&(e.updateOnDefault=!1,e[r]=ee(n.replace(Xo,(function(){return e.updateOnDefault=!0," "}))))}),this),t&&(delete e["*"],ta(e,this.$$options)),ta(e,Qo.$$options),new Ko(e)}},Qo=new Ko({updateOn:"",updateOnDefault:!0,debounce:0,getterSetter:!1,allowInvalid:!1,timezone:null});var ea=function(){function e(e,t){this.$$attrs=e,this.$$scope=t}return e.$inject=["$attrs","$scope"],e.prototype={$onInit:function(){var e=this.parentCtrl?this.parentCtrl.$options:Qo,t=this.$$scope.$eval(this.$$attrs.ngModelOptions);this.$options=e.createChild(t)}},{restrict:"A",priority:10,require:{parentCtrl:"?^^ngModelOptions"},bindToController:!0,controller:e}};function ta(e,t){A(t,(function(t,n){P(e[n])||(e[n]=t)}))}var na=Di({terminal:!0,priority:1e3}),ra=o("ngOptions"),ia=/^\s*([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+group\s+by\s+([\s\S]+?))?(?:\s+disable\s+when\s+([\s\S]+?))?\s+for\s+(?:([$\w][$\w]*)|(?:\(\s*([$\w][$\w]*)\s*,\s*([$\w][$\w]*)\s*\)))\s+in\s+([\s\S]+?)(?:\s+track\s+by\s+([\s\S]+?))?$/,oa=["$compile","$document","$parse",function(t,n,r){var i=e.document.createElement("option"),o=e.document.createElement("optgroup");return{restrict:"A",terminal:!0,require:["select","ngModel"],link:{pre:function(e,t,n,r){r[0].registerOption=j},post:function(e,a,u,c){for(var l=c[0],p=c[1],f=u.multiple,d=0,h=a.children(),g=h.length;d=0;t--){var n=v.items[t];P(n.group)?Mt(n.element.parentNode):Mt(n.element)}v=y.getOptions();var r={};if(v.items.forEach((function(e){var t;P(e.group)?((t=r[e.group])||(t=o.cloneNode(!1),b.appendChild(t),t.label=null===e.group?"null":e.group,r[e.group]=t),$(e,t)):$(e,b)})),a[0].appendChild(b),p.$render(),!p.$isEmpty(e)){var i=l.readValue();(y.trackBy||f?ue(e,i):e===i)||(p.$setViewValue(i),p.$render())}}))}}}}],aa=["$locale","$interpolate","$log",function(e,t,n){var r=/{}/g,i=/^when(Minus)?(.+)$/;return{link:function(o,a,s){var u,c=s.count,l=s.$attr.when&&a.attr(s.$attr.when),p=s.offset||0,d=o.$eval(l)||{},h={},g=t.startSymbol(),v=t.endSymbol(),m=g+c+"-"+p+v,y=$.noop;function b(e){a.text(e||"")}A(s,(function(e,t){var n=i.exec(t);if(n){var r=(n[1]?"-":"")+f(n[2]);d[r]=a.attr(s.$attr[t])}})),A(d,(function(e,n){h[n]=t(e.replace(r,m))})),o.$watch(c,(function(t){var r=parseFloat(t),i=O(r);if(i||r in d||(r=e.pluralCat(r-p)),!(r===u||i&&O(u))){y();var a=h[r];U(a)?(null!=t&&n.debug("ngPluralize: no rule defined for '"+r+"' in "+l),y=j,b()):y=o.$watch(a,b),u=r}}))}}}],sa=o("ngRef"),ua=["$parse",function(e){return{priority:-1,restrict:"A",compile:function(t,n){var r=$n(re(t)),i=e(n.ngRef),o=i.assign||function(){throw sa("nonassign",'Expression in ngRef="{0}" is non-assignable!',n.ngRef)};return function(e,t,a){var s;if(a.hasOwnProperty("ngRefRead")){if("$element"===a.ngRefRead)s=t;else if(!(s=t.data("$"+a.ngRefRead+"Controller")))throw sa("noctrl",'The controller for ngRefRead="{0}" could not be found on ngRef="{1}"',a.ngRefRead,n.ngRef)}else s=t.data("$"+r+"Controller");o(e,s=s||t),t.on("$destroy",(function(){i(e)===s&&o(e,null)}))}}}}],ca=["$parse","$animate","$compile",function(e,t,n){var r="$$NG_REMOVED",i=o("ngRepeat"),a=function(e,t,n,r,i,o,a){e[n]=r,i&&(e[i]=o),e.$index=t,e.$first=0===t,e.$last=t===a-1,e.$middle=!(e.$first||e.$last),e.$odd=!(e.$even=0==(1&t))},s=function(e){return e.clone[0]},u=function(e){return e.clone[e.clone.length-1]},c=function(e,t,n){return Ut(n)},l=function(e,t){return t};return{restrict:"A",multiElement:!0,transclude:"element",priority:1e3,terminal:!0,$$tlb:!0,compile:function(o,f){var d=f.ngRepeat,h=n.$$createComment("end ngRepeat",d),g=d.match(/^\s*([\s\S]+?)\s+in\s+([\s\S]+?)(?:\s+as\s+([\s\S]+?))?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!g)throw i("iexp","Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",d);var v=g[1],m=g[2],y=g[3],b=g[4];if(!(g=v.match(/^(?:(\s*[$\w]+)|\(\s*([$\w]+)\s*,\s*([$\w]+)\s*\))$/)))throw i("iidexp","'_item_' in '_item_ in _collection_' should be an identifier or '(_key_, _value_)' expression, but got '{0}'.",v);var $,w=g[3]||g[1],E=g[2];if(y&&(!/^[$a-zA-Z_][$a-zA-Z0-9_]*$/.test(y)||/^(null|undefined|this|\$index|\$first|\$middle|\$last|\$even|\$odd|\$parent|\$root|\$id)$/.test(y)))throw i("badident","alias '{0}' is invalid --- must be a valid JS identifier which is not a reserved name.",y);if(b){var S={$id:Ut},k=e(b);$=function(e,t,n,r){return E&&(S[E]=t),S[w]=n,S.$index=r,k(e,S)}}return function(e,n,o,f,g){var v=Pe();e.$watchCollection(m,(function(o){var f,m,b,k,C,M,T,I,R,O,N,j,_=n[0],D=Pe();if(y&&(e[y]=o),x(o))R=o,I=$||c;else for(var L in I=$||l,R=[],o)p.call(o,L)&&"$"!==L.charAt(0)&&R.push(L);for(k=R.length,N=new Array(k),f=0;f=a}}}}}];function Ia(e,t,n){if(e){if(G(e)&&(e=new RegExp("^"+e+"$")),!e.test)throw o("ngPattern")("noregexp","Expected {0} to be a RegExp but was {1}. Element: {2}",t,e,we(n));return e}}function Ra(e){var t=R(e);return O(t)?-1:t}e.angular.bootstrap?e.console&&console.log("WARNING: Tried to load AngularJS more than once."):(function(){var t;if(!Ne){var n=le();(u=U(n)?r:n?e[n]:void 0)&&u.fn.on?(s=u,T(u.fn,{scope:It.scope,isolateScope:It.isolateScope,controller:It.controller,injector:It.injector,inheritedData:It.inheritedData})):s=ft,t=s.cleanData,s.cleanData=function(e){for(var n,r,i=0;null!=(r=e[i]);i++)(n=(s._data(r)||{}).events)&&n.$destroy&&s(r).triggerHandler("$destroy");t(e)},$.element=s,Ne=!0}}(),function(t){T(t,{errorHandlingConfig:n,bootstrap:Me,copy:ae,extend:T,merge:I,equals:ue,element:s,forEach:A,injector:qt,noop:j,bind:de,toJson:ge,fromJson:ve,identity:_,isUndefined:U,isDefined:P,isString:G,isFunction:Y,isObject:F,isNumber:B,isElement:ne,isArray:H,version:ze,isDate:z,callbacks:{$$counter:0},getTestability:Ie,reloadWithDebugInfo:Te,UNSAFE_restoreLegacyJqLiteXHTMLReplacement:je,$$minErr:o,$$csp:ce,$$encodeUriSegment:Ee,$$encodeUriQuery:Se,$$lowercase:f,$$stringify:Fe,$$uppercase:d}),c=function(e){var t=o("$injector"),n=o("ng");function r(e,t,n){return e[t]||(e[t]=n())}var i=r(e,"angular",Object);return i.$$minErr=i.$$minErr||o,r(i,"module",(function(){var e={};return function(i,o,a){var s={};return function(e,t){if("hasOwnProperty"===e)throw n("badname","hasOwnProperty is not a valid {0} name","module")}(i),o&&e.hasOwnProperty(i)&&(e[i]=null),r(e,i,(function(){if(!o)throw t("nomod","Module '{0}' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.",i);var e=[],r=[],u=[],c=p("$injector","invoke","push",r),l={_invokeQueue:e,_configBlocks:r,_runBlocks:u,info:function(e){if(P(e)){if(!F(e))throw n("aobj","Argument '{0}' must be an object","value");return s=e,this}return s},requires:o,name:i,provider:f("$provide","provider"),factory:f("$provide","factory"),service:f("$provide","service"),value:p("$provide","value"),constant:p("$provide","constant","unshift"),decorator:f("$provide","decorator",r),animation:f("$animateProvider","register"),filter:f("$filterProvider","register"),controller:f("$controllerProvider","register"),directive:f("$compileProvider","directive"),component:f("$compileProvider","component"),config:c,run:function(e){return u.push(e),this}};return a&&c(a),l;function p(t,n,r,i){return i||(i=e),function(){return i[r||"push"]([t,n,arguments]),l}}function f(t,n,r){return r||(r=e),function(e,o){return o&&Y(o)&&(o.$$moduleName=i),r.push([t,n,arguments]),l}}}))}}))}(e),c("ng",["ngLocale"],["$provide",function(e){e.provider({$$sanitizeUri:Gr}),e.provider("$compile",vn).directive({a:Li,input:yo,textarea:yo,form:zi,script:$a,select:Ea,option:Sa,ngBind:xo,ngBindHtml:Eo,ngBindTemplate:Ao,ngClass:Co,ngClassEven:To,ngClassOdd:Mo,ngCloak:Io,ngController:Ro,ngForm:Hi,ngHide:da,ngIf:_o,ngInclude:Do,ngInit:Uo,ngNonBindable:na,ngPluralize:aa,ngRef:ua,ngRepeat:ca,ngShow:fa,ngStyle:ha,ngSwitch:ga,ngSwitchWhen:va,ngSwitchDefault:ma,ngOptions:oa,ngTransclude:ba,ngModel:qo,ngList:Po,ngChange:So,pattern:Ca,ngPattern:Ca,required:ka,ngRequired:ka,minlength:Ta,ngMinlength:Ta,maxlength:Ma,ngMaxlength:Ma,ngValue:wo,ngModelOptions:ea}).directive({ngInclude:Lo,input:bo}).directive(Ui).directive(Oo),e.provider({$anchorScroll:Xt,$animate:an,$animateCss:cn,$$animateJs:rn,$$animateQueue:on,$$AnimateRunner:un,$$animateAsyncRun:sn,$browser:pn,$cacheFactory:fn,$controller:kn,$document:Cn,$$isDocumentHidden:Mn,$exceptionHandler:Tn,$filter:di,$$forceReflow:In,$interpolate:Wn,$interval:Qn,$$intervalFactory:qn,$http:zn,$httpParamSerializer:Ln,$httpParamSerializerJQLike:Un,$httpBackend:Zn,$xhrFactory:Hn,$jsonpCallbacks:Xn,$location:hr,$log:gr,$parse:Nr,$rootScope:Vr,$q:jr,$$q:_r,$sce:Jr,$sceDelegate:Wr,$sniffer:Qr,$$taskTrackerFactory:qr,$templateCache:dn,$templateRequest:ei,$$testability:ti,$timeout:ri,$window:li,$$rAF:Fr,$$jqLite:Lt,$$Map:Gt,$$cookieReader:fi})}]).info({angularVersion:"1.8.2"})}($),$.module("ngLocale",[],["$provide",function(e){e.value("$locale",{DATETIME_FORMATS:{AMPMS:["AM","PM"],DAY:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],ERANAMES:["Before Christ","Anno Domini"],ERAS:["BC","AD"],FIRSTDAYOFWEEK:6,MONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],SHORTDAY:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],SHORTMONTH:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],STANDALONEMONTH:["January","February","March","April","May","June","July","August","September","October","November","December"],WEEKENDRANGE:[5,6],fullDate:"EEEE, MMMM d, y",longDate:"MMMM d, y",medium:"MMM d, y h:mm:ss a",mediumDate:"MMM d, y",mediumTime:"h:mm:ss a",short:"M/d/yy h:mm a",shortDate:"M/d/yy",shortTime:"h:mm a"},NUMBER_FORMATS:{CURRENCY_SYM:"$",DECIMAL_SEP:".",GROUP_SEP:",",PATTERNS:[{gSize:3,lgSize:3,maxFrac:3,minFrac:0,minInt:1,negPre:"-",negSuf:"",posPre:"",posSuf:""},{gSize:3,lgSize:3,maxFrac:2,minFrac:2,minInt:1,negPre:"-¤",negSuf:"",posPre:"¤",posSuf:""}]},id:"en-us",localeID:"en_US",pluralCat:function(e,t){var n=0|e,r=function(e,t){var n=t;void 0===n&&(n=Math.min(function(e){var t=(e+="").indexOf(".");return-1==t?0:e.length-t-1}(e),3));var r=Math.pow(10,n);return{v:n,f:(e*r|0)%r}}(e,t);return 1==n&&0==r.v?"one":"other"}})}]),s((function(){!function(t,n){var r,i,o={};if(A(ke,(function(e){var n=e+"app";!r&&t.hasAttribute&&t.hasAttribute(n)&&(r=t,i=t.getAttribute(n))})),A(ke,(function(e){var n,o=e+"app";!r&&(n=t.querySelector("["+o.replace(":","\\:")+"]"))&&(r=n,i=n.getAttribute(o))})),r){if(!Ce)return void e.console.error("AngularJS: disabling automatic bootstrap. \ No newline at end of file diff --git a/runner/src/main/resources/view/player.js b/runner/src/main/resources/view/player.js index 4d64b281..60ffa234 100644 --- a/runner/src/main/resources/view/player.js +++ b/runner/src/main/resources/view/player.js @@ -1 +1,2 @@ -!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["cg-player"]=e():t["cg-player"]=e()}(self,(()=>(()=>{var t={897:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r{var n=r(897);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports},156:t=>{function e(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function u(t){e(i,o,a,u,s,"next",t)}function s(t){e(i,o,a,u,s,"throw",t)}u(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},836:t=>{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},498:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},281:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},61:(t,e,r)=>{var n=r(698).default;function o(){"use strict";t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=E(i,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=p(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d={};function h(){}function y(){}function v(){}var m={};l(m,u,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(O([])));w&&w!==r&&a.call(w,u)&&(m=w);var x=v.prototype=h.prototype=Object.create(m);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,u,s){var c=p(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,s)}),(function(t){r("throw",t,u,s)})):e.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return r("throw",t,u,s)}))}s(c.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function E(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=p(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function O(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},861:(t,e,r)=>{var n=r(405),o=r(498),a=r(116),i=r(281);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports},698:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},116:(t,e,r)=>{var n=r(897);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},687:(t,e,r)=>{var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}var n={};return(()=>{"use strict";var t=n,e=r(836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=e(r(687)),a=e(r(861)),i=e(r(156));t.default=function(t){var e,r,n,u,s,c,l,f,p,d=t.viewer,h=t.viewerUrl,y=t.customDemo,v=null,m=null,g=[],w=new Promise((function(t){e=t})),x=new Promise((function(t){r=t})),b={},_=function(t){return b[t]||[]},E=!1,L={ready:function(){E||(E=!0,T({type:"libraries",libraries:t.libraries}),T({type:"baseUrl",baseUrl:window.location.origin}),T({type:"loggedUserId",loggedUserId:f}),W(),(d||h)&&T({type:"viewer",viewer:d,viewerUrl:h,customDemo:y}),e())},resize:function(t){v.parentElement.style.paddingTop=t.iframeHeight,R("resize",t)},progress:function(t){g.forEach((function(e){return e(t.frame,t.progress,t.playing,t.isSubFrame,t.isTurnBasedGame,t.atEnd)})),n=t.atEnd,u=t.playing},viewerOptions:function(t){var e,r;s=t.playerColors,c=t.canSwapPlayers,l=t.gameName,e=N(),T({type:"gameParams",gameParams:(r=z())[e]||(r[e]={})})},parsedGameInfo:function(t){R("parsedGameInfo",t)},play:function(t){u=!0,R("play",t.data)},pause:function(t){u=!1,R("pause",t.data)},gameParams:function(e){!function(e){var r=z();r[N()]=e;try{window.localStorage.setItem(t.localStorageKey,JSON.stringify(r))}catch(t){console.log.error("Error while saving player settings to localStorage.")}}(e.gameParams)},analyticsOpenReplay:function(t){R("analyticsOpenReplay",t)},error:function(t){R("error",t.error)}};return{createIframe:function(e){return(v=document.createElement("iframe")).src=t.src,v.setAttribute("allowfullscreen",""),v.sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox",v.style.position="absolute",v.style.left=0,v.style.top=0,v.style.width="100%",v.style.height="100%",v.style.border=0,v.style.display="block",e.style.position="relative",e.innerHTML="",e.appendChild(v),window.addEventListener("message",C),T({type:"ready"}),v},setViewer:function(t){return S.apply(this,arguments)},setLoggedUserId:function(t){f=t},setCurrentLanguage:function(t){p=t,W()},sendFrames:function(t,e){return k.apply(this,arguments)},setOptions:function(t){return O.apply(this,arguments)},setFrame:P,first:function(){return I.apply(this,arguments)},play:M,pause:G,setSpeed:function(t){return F.apply(this,arguments)},on:function(t,e){b[t]=[].concat((0,a.default)(_(t)),[e])},off:function(t,e){b[t]=_(t).filter((function(t){return t!==e}))},waitReady:D,destroy:function(){window.removeEventListener("message",C)},subscribe:function(t){g=[].concat((0,a.default)(g),[t])},unsubscribe:function(t){g=g.filter((function(e){return e!==t}))},clear:function(){g=[]},getFrameCount:function(){return m?m.frames.length:0},isPlaying:function(){return u},isAtEnd:function(){return n},canSwapPlayers:function(){return c},getPlayerColors:function(){return s},isGameLoaded:function(){return null!=m}};function S(){return(S=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d=e,t.next=3,D();case 3:T({type:"viewer",viewer:d});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(){return(k=(0,i.default)(o.default.mark((function t(e,n){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return x=new Promise((function(t){r=t})),m=e,t.next=4,D();case 4:if(T({type:"frames",gameInfo:null}),!e.agents){t.next=10;break}return t.next=8,Promise.all(e.agents.map((function(t){return H(t)})));case 8:t.next=12;break;case 10:return t.next=12,H(e);case 12:T({type:"frames",gameInfo:e,isUserGame:n}),r(),u?M():G();case 15:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function O(){return(O=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D();case 2:T({type:"options",options:e});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function P(t,e){return j.apply(this,arguments)}function j(){return(j=(0,i.default)(o.default.mark((function t(e,r){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x;case 2:T({type:"frame",frame:e,progress:r});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(){return(I=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P(0);case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function M(){return U.apply(this,arguments)}function U(){return(U=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=!0,t.next=3,x;case 3:T({type:"play"});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function G(){return A.apply(this,arguments)}function A(){return(A=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=!1,t.next=3,x;case 3:T({type:"pause"});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function F(){return(F=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D();case 2:T({type:"speed",speed:e});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function N(){return(l||(d||h).split("").reduce((function(t,e){return(t=(t<<5)-t+e.charCodeAt(0))&t}),0).toString()).toLowerCase().replace(/ /g,"")}function T(t){null!=v&&null!=v.contentWindow&&v.contentWindow.postMessage(t,"*")}function C(t){t.source===v.contentWindow&&null!=L[t.data.type]&&L[t.data.type](t.data)}function R(t,e){_(t).forEach((function(t){return t(e)}))}function D(){return K.apply(this,arguments)}function K(){return(K=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",w);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function W(){T({type:"language",lang:p})}function z(){var e={};try{var r=window.localStorage.getItem(t.localStorageKey);null==r?window.localStorage.setItem(t.localStorageKey,"{}"):e=JSON.parse(r)}catch(t){console.log.error("Error while accessing player settings from localStorage.")}return e}function H(t){return J.apply(this,arguments)}function J(){return(J=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e.avatarUrl){t.next=11;break}return t.prev=1,t.next=4,Y(e.avatarUrl);case 4:e.avatarUrl=t.sent,t.next=11;break;case 7:t.prev=7,t.t0=t.catch(1),console.error("Failed to load avatar!",e.avatarUrl),e.avatarUrl=null;case 11:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)}function Y(t){return new Promise((function(e,r){var n=new window.Image;n.crossOrigin="anonymous",n.onload=function(){var t=document.createElement("canvas"),r=t.getContext("2d");t.width=n.width,t.height=n.height,r.drawImage(n,0,0,n.width,n.height),e(t.toDataURL())},n.onerror=function(){r(new Error)},n.src=t}))}}})(),n})())); \ No newline at end of file +/*! For license information please see main.js.LICENSE.txt */ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["cg-player"]=e():t["cg-player"]=e()}(self,(()=>(()=>{var t={897:t=>{t.exports=function(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r{var n=r(897);t.exports=function(t){if(Array.isArray(t))return n(t)},t.exports.__esModule=!0,t.exports.default=t.exports},156:t=>{function e(t,e,r,n,o,a,i){try{var u=t[a](i),s=u.value}catch(t){return void r(t)}u.done?e(s):Promise.resolve(s).then(n,o)}t.exports=function(t){return function(){var r=this,n=arguments;return new Promise((function(o,a){var i=t.apply(r,n);function u(t){e(i,o,a,u,s,"next",t)}function s(t){e(i,o,a,u,s,"throw",t)}u(void 0)}))}},t.exports.__esModule=!0,t.exports.default=t.exports},836:t=>{t.exports=function(t){return t&&t.__esModule?t:{default:t}},t.exports.__esModule=!0,t.exports.default=t.exports},498:t=>{t.exports=function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)},t.exports.__esModule=!0,t.exports.default=t.exports},281:t=>{t.exports=function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},t.exports.__esModule=!0,t.exports.default=t.exports},61:(t,e,r)=>{var n=r(698).default;function o(){"use strict";t.exports=o=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,a=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",s=i.asyncIterator||"@@asyncIterator",c=i.toStringTag||"@@toStringTag";function l(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{l({},"")}catch(t){l=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var o=e&&e.prototype instanceof h?e:h,a=Object.create(o.prototype),i=new k(n||[]);return a._invoke=function(t,e,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=E(i,r);if(u){if(u===d)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var s=p(t,e,r);if("normal"===s.type){if(n=r.done?"completed":"suspendedYield",s.arg===d)continue;return{value:s.arg,done:r.done}}"throw"===s.type&&(n="completed",r.method="throw",r.arg=s.arg)}}}(t,r,i),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var d={};function h(){}function y(){}function v(){}var m={};l(m,u,(function(){return this}));var g=Object.getPrototypeOf,w=g&&g(g(O([])));w&&w!==r&&a.call(w,u)&&(m=w);var x=v.prototype=h.prototype=Object.create(m);function b(t){["next","throw","return"].forEach((function(e){l(t,e,(function(t){return this._invoke(e,t)}))}))}function _(t,e){function r(o,i,u,s){var c=p(t[o],t,i);if("throw"!==c.type){var l=c.arg,f=l.value;return f&&"object"==n(f)&&a.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,u,s)}),(function(t){r("throw",t,u,s)})):e.resolve(f).then((function(t){l.value=t,u(l)}),(function(t){return r("throw",t,u,s)}))}s(c.arg)}var o;this._invoke=function(t,n){function a(){return new e((function(e,o){r(t,n,e,o)}))}return o=o?o.then(a,a):a()}}function E(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,E(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var n=p(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,d;var o=n.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,d):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function L(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function S(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function k(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(L,this),this.reset(!0)}function O(t){if(t){var e=t[u];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r=0;--n){var o=this.tryEntries[n],i=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var u=a.call(o,"catchLoc"),s=a.call(o,"finallyLoc");if(u&&s){if(this.prev=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),S(r),d}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;S(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:O(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),d}},e}t.exports=o,t.exports.__esModule=!0,t.exports.default=t.exports},861:(t,e,r)=>{var n=r(405),o=r(498),a=r(116),i=r(281);t.exports=function(t){return n(t)||o(t)||a(t)||i()},t.exports.__esModule=!0,t.exports.default=t.exports},698:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},116:(t,e,r)=>{var n=r(897);t.exports=function(t,e){if(t){if("string"==typeof t)return n(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?n(t,e):void 0}},t.exports.__esModule=!0,t.exports.default=t.exports},687:(t,e,r)=>{var n=r(61)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var a=e[n]={exports:{}};return t[n](a,a.exports,r),a.exports}var n={};return(()=>{"use strict";var t=n,e=r(836);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var o=e(r(687)),a=e(r(861)),i=e(r(156));t.default=function(t){var e,r,n,u,s,c,l,f,p,d=t.viewer,h=t.viewerUrl,y=t.customDemo,v=null,m=null,g=[],w=new Promise((function(t){e=t})),x=new Promise((function(t){r=t})),b={},_=function(t){return b[t]||[]},E=!1,L={ready:function(){E||(E=!0,T({type:"libraries",libraries:t.libraries}),T({type:"baseUrl",baseUrl:window.location.origin}),T({type:"loggedUserId",loggedUserId:f}),W(),(d||h)&&T({type:"viewer",viewer:d,viewerUrl:h,customDemo:y}),e())},resize:function(t){v.parentElement.style.paddingTop=t.iframeHeight,R("resize",t)},progress:function(t){g.forEach((function(e){return e(t.frame,t.progress,t.playing,t.isSubFrame,t.isTurnBasedGame,t.atEnd)})),n=t.atEnd,u=t.playing},viewerOptions:function(t){var e,r;s=t.playerColors,c=t.canSwapPlayers,l=t.gameName,e=N(),T({type:"gameParams",gameParams:(r=z())[e]||(r[e]={})})},parsedGameInfo:function(t){R("parsedGameInfo",t)},play:function(t){u=!0,R("play",t.data)},pause:function(t){u=!1,R("pause",t.data)},gameParams:function(e){!function(e){var r=z();r[N()]=e;try{window.localStorage.setItem(t.localStorageKey,JSON.stringify(r))}catch(t){console.log.error("Error while saving player settings to localStorage.")}}(e.gameParams)},analyticsOpenReplay:function(t){R("analyticsOpenReplay",t)},error:function(t){R("error",t.error)},wheelEvent:function(t){R("wheel",t.payload)}};return{createIframe:function(e){var r,n;return(v=document.createElement("iframe")).src=t.src,v.title=t.title,v.setAttribute("allowfullscreen",""),v.sandbox="allow-scripts allow-popups allow-popups-to-escape-sandbox",v.style.position="absolute",v.style.left=0,v.style.top=0,v.style.width="100%",v.style.height="100%",v.style.border=0,v.style.display="block",e.style.position="relative",e.innerHTML="",e.appendChild(v),(null!==(r=null==e||null===(n=e.ownerDocument)||void 0===n?void 0:n.defaultView)&&void 0!==r?r:window).addEventListener("message",C),T({type:"ready"}),v},setViewer:function(t){return S.apply(this,arguments)},setLoggedUserId:function(t){f=t},setCurrentLanguage:function(t){p=t,W()},sendFrames:function(t,e){return k.apply(this,arguments)},setOptions:function(t){return O.apply(this,arguments)},setFrame:P,first:function(){return I.apply(this,arguments)},play:M,pause:G,setSpeed:function(t){return F.apply(this,arguments)},on:function(t,e){b[t]=[].concat((0,a.default)(_(t)),[e])},off:function(t,e){b[t]=_(t).filter((function(t){return t!==e}))},waitReady:D,destroy:function(){window.removeEventListener("message",C)},subscribe:function(t){g=[].concat((0,a.default)(g),[t])},unsubscribe:function(t){g=g.filter((function(e){return e!==t}))},clear:function(){g=[]},getFrameCount:function(){return m?m.frames.length:0},isPlaying:function(){return u},isAtEnd:function(){return n},canSwapPlayers:function(){return c},getPlayerColors:function(){return s},isGameLoaded:function(){return null!=m}};function S(){return(S=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return d=e,t.next=3,D();case 3:T({type:"viewer",viewer:d});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function k(){return(k=(0,i.default)(o.default.mark((function t(e,n){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return x=new Promise((function(t){r=t})),m=e,t.next=4,D();case 4:if(T({type:"frames",gameInfo:null}),!e.agents){t.next=10;break}return t.next=8,Promise.all(e.agents.map((function(t){return H(t)})));case 8:t.next=12;break;case 10:return t.next=12,H(e);case 12:T({type:"frames",gameInfo:e,isUserGame:n}),r(),u?M():G();case 15:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function O(){return(O=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D();case 2:T({type:"options",options:e});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function P(t,e){return j.apply(this,arguments)}function j(){return(j=(0,i.default)(o.default.mark((function t(e,r){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,x;case 2:T({type:"frame",frame:e,progress:r});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function I(){return(I=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P(0);case 2:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function M(){return U.apply(this,arguments)}function U(){return(U=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=!0,t.next=3,x;case 3:T({type:"play"});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function G(){return A.apply(this,arguments)}function A(){return(A=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return u=!1,t.next=3,x;case 3:T({type:"pause"});case 4:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function F(){return(F=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,D();case 2:T({type:"speed",speed:e});case 3:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function N(){return(l||(d||h).split("").reduce((function(t,e){return(t=(t<<5)-t+e.charCodeAt(0))&t}),0).toString()).toLowerCase().replace(/ /g,"")}function T(t){null!=v&&null!=v.contentWindow&&v.contentWindow.postMessage(t,"*")}function C(t){t.source===v.contentWindow&&null!=L[t.data.type]&&L[t.data.type](t.data)}function R(t,e){_(t).forEach((function(t){return t(e)}))}function D(){return K.apply(this,arguments)}function K(){return(K=(0,i.default)(o.default.mark((function t(){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",w);case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function W(){T({type:"language",lang:p})}function z(){var e={};try{var r=window.localStorage.getItem(t.localStorageKey);null==r?window.localStorage.setItem(t.localStorageKey,"{}"):e=JSON.parse(r)}catch(t){console.log.error("Error while accessing player settings from localStorage.")}return e}function H(t){return J.apply(this,arguments)}function J(){return(J=(0,i.default)(o.default.mark((function t(e){return o.default.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(null==e.avatarUrl){t.next=11;break}return t.prev=1,t.next=4,V(e.avatarUrl);case 4:e.avatarUrl=t.sent,t.next=11;break;case 7:t.prev=7,t.t0=t.catch(1),console.error("Failed to load avatar!",e.avatarUrl),e.avatarUrl=null;case 11:case"end":return t.stop()}}),t,null,[[1,7]])})))).apply(this,arguments)}function V(t){return new Promise((function(e,r){var n=new window.Image;n.crossOrigin="anonymous",n.onload=function(){var t=document.createElement("canvas"),r=t.getContext("2d");t.width=n.width,t.height=n.height,r.drawImage(n,0,0,n.width,n.height),e(t.toDataURL())},n.onerror=function(){r(new Error)},n.src=t}))}}})(),n})())); \ No newline at end of file