@lamplitisles/codex-for-love 0.3.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/vendor/IMPORTS.md +1 -1
- package/vendor/build/_app/immutable/assets/0.BI9m5aW9.css +2 -0
- package/vendor/build/_app/immutable/assets/2.GU_203nr.css +1 -0
- package/vendor/build/_app/immutable/chunks/{utqCDLTs.js → Bg1Ry2sd.js} +1 -1
- package/vendor/build/_app/immutable/chunks/CTZw3jzS.js +3 -0
- package/vendor/build/_app/immutable/chunks/CtNIUOtb.js +1147 -0
- package/vendor/build/_app/immutable/chunks/uBIymjUX.js +1 -0
- package/vendor/build/_app/immutable/entry/app.CAV4mc4Y.js +2 -0
- package/vendor/build/_app/immutable/entry/start.C7zzoZ2c.js +1 -0
- package/vendor/build/_app/immutable/nodes/0.sNCrAP8k.js +1 -0
- package/vendor/build/_app/immutable/nodes/{1.DXp8K3IS.js → 1.CcVh3vuf.js} +1 -1
- package/vendor/build/_app/immutable/nodes/2.D1r5MxMF.js +327 -0
- package/vendor/build/_app/version.json +1 -1
- package/vendor/build/index.html +10 -9
- package/vendor/config.example.toml +12 -1
- package/vendor/runtime/cli.mjs +726 -25
- package/vendor/runtime/companion-mcp.mjs +52 -13
- package/vendor/build/_app/immutable/assets/0.D3rCUG9u.css +0 -2
- package/vendor/build/_app/immutable/assets/2.D_B1Of5x.css +0 -1
- package/vendor/build/_app/immutable/chunks/DtqGwW3l.js +0 -3
- package/vendor/build/_app/immutable/entry/app.BbmlpP2X.js +0 -2
- package/vendor/build/_app/immutable/entry/start.BmMe00-v.js +0 -1
- package/vendor/build/_app/immutable/nodes/0.Wk08-krq.js +0 -1
- package/vendor/build/_app/immutable/nodes/2.DVm7T6dW.js +0 -326
|
@@ -0,0 +1,1147 @@
|
|
|
1
|
+
import{Et as e,Tt as t,wt as n}from"./CTZw3jzS.js";var r=(e=>(e[e.WEBGL_LEGACY=0]=`WEBGL_LEGACY`,e[e.WEBGL=1]=`WEBGL`,e[e.WEBGL2=2]=`WEBGL2`,e))(r||{}),i=(e=>(e[e.UNKNOWN=0]=`UNKNOWN`,e[e.WEBGL=1]=`WEBGL`,e[e.CANVAS=2]=`CANVAS`,e))(i||{}),a=(e=>(e[e.COLOR=16384]=`COLOR`,e[e.DEPTH=256]=`DEPTH`,e[e.STENCIL=1024]=`STENCIL`,e))(a||{}),o=(e=>(e[e.NORMAL=0]=`NORMAL`,e[e.ADD=1]=`ADD`,e[e.MULTIPLY=2]=`MULTIPLY`,e[e.SCREEN=3]=`SCREEN`,e[e.OVERLAY=4]=`OVERLAY`,e[e.DARKEN=5]=`DARKEN`,e[e.LIGHTEN=6]=`LIGHTEN`,e[e.COLOR_DODGE=7]=`COLOR_DODGE`,e[e.COLOR_BURN=8]=`COLOR_BURN`,e[e.HARD_LIGHT=9]=`HARD_LIGHT`,e[e.SOFT_LIGHT=10]=`SOFT_LIGHT`,e[e.DIFFERENCE=11]=`DIFFERENCE`,e[e.EXCLUSION=12]=`EXCLUSION`,e[e.HUE=13]=`HUE`,e[e.SATURATION=14]=`SATURATION`,e[e.COLOR=15]=`COLOR`,e[e.LUMINOSITY=16]=`LUMINOSITY`,e[e.NORMAL_NPM=17]=`NORMAL_NPM`,e[e.ADD_NPM=18]=`ADD_NPM`,e[e.SCREEN_NPM=19]=`SCREEN_NPM`,e[e.NONE=20]=`NONE`,e[e.SRC_OVER=0]=`SRC_OVER`,e[e.SRC_IN=21]=`SRC_IN`,e[e.SRC_OUT=22]=`SRC_OUT`,e[e.SRC_ATOP=23]=`SRC_ATOP`,e[e.DST_OVER=24]=`DST_OVER`,e[e.DST_IN=25]=`DST_IN`,e[e.DST_OUT=26]=`DST_OUT`,e[e.DST_ATOP=27]=`DST_ATOP`,e[e.ERASE=26]=`ERASE`,e[e.SUBTRACT=28]=`SUBTRACT`,e[e.XOR=29]=`XOR`,e))(o||{}),s=(e=>(e[e.POINTS=0]=`POINTS`,e[e.LINES=1]=`LINES`,e[e.LINE_LOOP=2]=`LINE_LOOP`,e[e.LINE_STRIP=3]=`LINE_STRIP`,e[e.TRIANGLES=4]=`TRIANGLES`,e[e.TRIANGLE_STRIP=5]=`TRIANGLE_STRIP`,e[e.TRIANGLE_FAN=6]=`TRIANGLE_FAN`,e))(s||{}),c=(e=>(e[e.RGBA=6408]=`RGBA`,e[e.RGB=6407]=`RGB`,e[e.RG=33319]=`RG`,e[e.RED=6403]=`RED`,e[e.RGBA_INTEGER=36249]=`RGBA_INTEGER`,e[e.RGB_INTEGER=36248]=`RGB_INTEGER`,e[e.RG_INTEGER=33320]=`RG_INTEGER`,e[e.RED_INTEGER=36244]=`RED_INTEGER`,e[e.ALPHA=6406]=`ALPHA`,e[e.LUMINANCE=6409]=`LUMINANCE`,e[e.LUMINANCE_ALPHA=6410]=`LUMINANCE_ALPHA`,e[e.DEPTH_COMPONENT=6402]=`DEPTH_COMPONENT`,e[e.DEPTH_STENCIL=34041]=`DEPTH_STENCIL`,e))(c||{}),l=(e=>(e[e.TEXTURE_2D=3553]=`TEXTURE_2D`,e[e.TEXTURE_CUBE_MAP=34067]=`TEXTURE_CUBE_MAP`,e[e.TEXTURE_2D_ARRAY=35866]=`TEXTURE_2D_ARRAY`,e[e.TEXTURE_CUBE_MAP_POSITIVE_X=34069]=`TEXTURE_CUBE_MAP_POSITIVE_X`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]=`TEXTURE_CUBE_MAP_NEGATIVE_X`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]=`TEXTURE_CUBE_MAP_POSITIVE_Y`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]=`TEXTURE_CUBE_MAP_NEGATIVE_Y`,e[e.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]=`TEXTURE_CUBE_MAP_POSITIVE_Z`,e[e.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]=`TEXTURE_CUBE_MAP_NEGATIVE_Z`,e))(l||{}),u=(e=>(e[e.UNSIGNED_BYTE=5121]=`UNSIGNED_BYTE`,e[e.UNSIGNED_SHORT=5123]=`UNSIGNED_SHORT`,e[e.UNSIGNED_SHORT_5_6_5=33635]=`UNSIGNED_SHORT_5_6_5`,e[e.UNSIGNED_SHORT_4_4_4_4=32819]=`UNSIGNED_SHORT_4_4_4_4`,e[e.UNSIGNED_SHORT_5_5_5_1=32820]=`UNSIGNED_SHORT_5_5_5_1`,e[e.UNSIGNED_INT=5125]=`UNSIGNED_INT`,e[e.UNSIGNED_INT_10F_11F_11F_REV=35899]=`UNSIGNED_INT_10F_11F_11F_REV`,e[e.UNSIGNED_INT_2_10_10_10_REV=33640]=`UNSIGNED_INT_2_10_10_10_REV`,e[e.UNSIGNED_INT_24_8=34042]=`UNSIGNED_INT_24_8`,e[e.UNSIGNED_INT_5_9_9_9_REV=35902]=`UNSIGNED_INT_5_9_9_9_REV`,e[e.BYTE=5120]=`BYTE`,e[e.SHORT=5122]=`SHORT`,e[e.INT=5124]=`INT`,e[e.FLOAT=5126]=`FLOAT`,e[e.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]=`FLOAT_32_UNSIGNED_INT_24_8_REV`,e[e.HALF_FLOAT=36193]=`HALF_FLOAT`,e))(u||{}),d=(e=>(e[e.FLOAT=0]=`FLOAT`,e[e.INT=1]=`INT`,e[e.UINT=2]=`UINT`,e))(d||{}),f=(e=>(e[e.NEAREST=0]=`NEAREST`,e[e.LINEAR=1]=`LINEAR`,e))(f||{}),p=(e=>(e[e.CLAMP=33071]=`CLAMP`,e[e.REPEAT=10497]=`REPEAT`,e[e.MIRRORED_REPEAT=33648]=`MIRRORED_REPEAT`,e))(p||{}),m=(e=>(e[e.OFF=0]=`OFF`,e[e.POW2=1]=`POW2`,e[e.ON=2]=`ON`,e[e.ON_MANUAL=3]=`ON_MANUAL`,e))(m||{}),h=(e=>(e[e.NPM=0]=`NPM`,e[e.UNPACK=1]=`UNPACK`,e[e.PMA=2]=`PMA`,e[e.NO_PREMULTIPLIED_ALPHA=0]=`NO_PREMULTIPLIED_ALPHA`,e[e.PREMULTIPLY_ON_UPLOAD=1]=`PREMULTIPLY_ON_UPLOAD`,e[e.PREMULTIPLIED_ALPHA=2]=`PREMULTIPLIED_ALPHA`,e))(h||{}),g=(e=>(e[e.NO=0]=`NO`,e[e.YES=1]=`YES`,e[e.AUTO=2]=`AUTO`,e[e.BLEND=0]=`BLEND`,e[e.CLEAR=1]=`CLEAR`,e[e.BLIT=2]=`BLIT`,e))(g||{}),_=(e=>(e[e.AUTO=0]=`AUTO`,e[e.MANUAL=1]=`MANUAL`,e))(_||{}),v=(e=>(e.LOW=`lowp`,e.MEDIUM=`mediump`,e.HIGH=`highp`,e))(v||{}),y=(e=>(e[e.NONE=0]=`NONE`,e[e.SCISSOR=1]=`SCISSOR`,e[e.STENCIL=2]=`STENCIL`,e[e.SPRITE=3]=`SPRITE`,e[e.COLOR=4]=`COLOR`,e))(y||{}),b=(e=>(e[e.RED=1]=`RED`,e[e.GREEN=2]=`GREEN`,e[e.BLUE=4]=`BLUE`,e[e.ALPHA=8]=`ALPHA`,e))(b||{}),x=(e=>(e[e.NONE=0]=`NONE`,e[e.LOW=2]=`LOW`,e[e.MEDIUM=4]=`MEDIUM`,e[e.HIGH=8]=`HIGH`,e))(x||{}),S=(e=>(e[e.ELEMENT_ARRAY_BUFFER=34963]=`ELEMENT_ARRAY_BUFFER`,e[e.ARRAY_BUFFER=34962]=`ARRAY_BUFFER`,e[e.UNIFORM_BUFFER=35345]=`UNIFORM_BUFFER`,e))(S||{}),C={createCanvas:(e,t)=>{let n=document.createElement(`canvas`);return n.width=e,n.height=t,n},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(e,t)=>fetch(e,t),parseXML:e=>new DOMParser().parseFromString(e,`text/xml`)},w={ADAPTER:C,RESOLUTION:1,CREATE_IMAGE_BITMAP:!1,ROUND_PIXELS:!1},T=/iPhone/i,E=/iPod/i,D=/iPad/i,O=/\biOS-universal(?:.+)Mac\b/i,k=/\bAndroid(?:.+)Mobile\b/i,A=/Android/i,j=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,M=/Silk/i,N=/Windows Phone/i,P=/\bWindows(?:.+)ARM\b/i,F=/BlackBerry/i,I=/BB10/i,ee=/Opera Mini/i,te=/\b(CriOS|Chrome)(?:.+)Mobile/i,ne=/Mobile(?:.+)Firefox\b/i,re=function(e){return e!==void 0&&e.platform===`MacIntel`&&typeof e.maxTouchPoints==`number`&&e.maxTouchPoints>1&&typeof MSStream>`u`};function L(e){return function(t){return t.test(e)}}function ie(e){var t={userAgent:``,platform:``,maxTouchPoints:0};!e&&typeof navigator<`u`?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof e==`string`?t.userAgent=e:e&&e.userAgent&&(t={userAgent:e.userAgent,platform:e.platform,maxTouchPoints:e.maxTouchPoints||0});var n=t.userAgent,r=n.split(`[FBAN`);r[1]!==void 0&&(n=r[0]),r=n.split(`Twitter`),r[1]!==void 0&&(n=r[0]);var i=L(n),a={apple:{phone:i(T)&&!i(N),ipod:i(E),tablet:!i(T)&&(i(D)||re(t))&&!i(N),universal:i(O),device:(i(T)||i(E)||i(D)||i(O)||re(t))&&!i(N)},amazon:{phone:i(j),tablet:!i(j)&&i(M),device:i(j)||i(M)},android:{phone:!i(N)&&i(j)||!i(N)&&i(k),tablet:!i(N)&&!i(j)&&!i(k)&&(i(M)||i(A)),device:!i(N)&&(i(j)||i(M)||i(k)||i(A))||i(/\bokhttp\b/i)},windows:{phone:i(N),tablet:i(P),device:i(N)||i(P)},other:{blackberry:i(F),blackberry10:i(I),opera:i(ee),firefox:i(ne),chrome:i(te),device:i(F)||i(I)||i(ee)||i(ne)||i(te)},any:!1,phone:!1,tablet:!1};return a.any=a.apple.device||a.android.device||a.windows.device||a.other.device,a.phone=a.apple.phone||a.android.phone||a.windows.phone,a.tablet=a.apple.tablet||a.android.tablet||a.windows.tablet,a}var R=(ie.default??ie)(globalThis.navigator);w.RETINA_PREFIX=/@([0-9\.]+)x/,w.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT=!1;var ae=n(((e,t)=>{var n=Object.prototype.hasOwnProperty,r=`~`;function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1));function a(e,t,n){this.fn=e,this.context=t,this.once=n||!1}function o(e,t,n,i,o){if(typeof n!=`function`)throw TypeError(`The listener must be a function`);var s=new a(n,i||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],s]:e._events[c].push(s):(e._events[c]=s,e._eventsCount++),e}function s(e,t){--e._eventsCount===0?e._events=new i:delete e._events[t]}function c(){this._events=new i,this._eventsCount=0}c.prototype.eventNames=function(){var e=[],t,i;if(this._eventsCount===0)return e;for(i in t=this._events)n.call(t,i)&&e.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?e.concat(Object.getOwnPropertySymbols(t)):e},c.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,a=n.length,o=Array(a);i<a;i++)o[i]=n[i].fn;return o},c.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},c.prototype.emit=function(e,t,n,i,a,o){var s=r?r+e:e;if(!this._events[s])return!1;var c=this._events[s],l=arguments.length,u,d;if(c.fn){switch(c.once&&this.removeListener(e,c.fn,void 0,!0),l){case 1:return c.fn.call(c.context),!0;case 2:return c.fn.call(c.context,t),!0;case 3:return c.fn.call(c.context,t,n),!0;case 4:return c.fn.call(c.context,t,n,i),!0;case 5:return c.fn.call(c.context,t,n,i,a),!0;case 6:return c.fn.call(c.context,t,n,i,a,o),!0}for(d=1,u=Array(l-1);d<l;d++)u[d-1]=arguments[d];c.fn.apply(c.context,u)}else{var f=c.length,p;for(d=0;d<f;d++)switch(c[d].once&&this.removeListener(e,c[d].fn,void 0,!0),l){case 1:c[d].fn.call(c[d].context);break;case 2:c[d].fn.call(c[d].context,t);break;case 3:c[d].fn.call(c[d].context,t,n);break;case 4:c[d].fn.call(c[d].context,t,n,i);break;default:if(!u)for(p=1,u=Array(l-1);p<l;p++)u[p-1]=arguments[p];c[d].fn.apply(c[d].context,u)}}return!0},c.prototype.on=function(e,t,n){return o(this,e,t,n,!1)},c.prototype.once=function(e,t,n){return o(this,e,t,n,!0)},c.prototype.removeListener=function(e,t,n,i){var a=r?r+e:e;if(!this._events[a])return this;if(!t)return s(this,a),this;var o=this._events[a];if(o.fn)o.fn===t&&(!i||o.once)&&(!n||o.context===n)&&s(this,a);else{for(var c=0,l=[],u=o.length;c<u;c++)(o[c].fn!==t||i&&!o[c].once||n&&o[c].context!==n)&&l.push(o[c]);l.length?this._events[a]=l.length===1?l[0]:l:s(this,a)}return this},c.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&s(this,t)):(this._events=new i,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t!==void 0&&(t.exports=c)})),oe=n(((e,t)=>{t.exports=n,t.exports.default=n;function n(e,t,n){n||=2;var i=t&&t.length,o=i?t[0]*n:e.length,s=r(e,0,o,n,!0),c=[];if(!s||s.next===s.prev)return c;var l,d,f,p,m,h,g;if(i&&(s=u(e,t,s,n)),e.length>80*n){l=f=e[0],d=p=e[1];for(var _=n;_<o;_+=n)m=e[_],h=e[_+1],m<l&&(l=m),h<d&&(d=h),m>f&&(f=m),h>p&&(p=h);g=Math.max(f-l,p-d),g=g===0?0:32767/g}return a(s,c,n,l,d,g,0),c}function r(e,t,n,r,i){var a,o;if(i===N(e,t,n,r)>0)for(a=t;a<n;a+=r)o=A(a,e[a],e[a+1],o);else for(a=n-r;a>=t;a-=r)o=A(a,e[a],e[a+1],o);return o&&S(o,o.next)&&(j(o),o=o.next),o}function i(e,t){if(!e)return e;t||=e;var n=e,r;do if(r=!1,!n.steiner&&(S(n,n.next)||x(n.prev,n,n.next)===0)){if(j(n),n=t=n.prev,n===n.next)break;r=!0}else n=n.next;while(r||n!==t);return t}function a(e,t,n,r,u,d,f){if(e){!f&&d&&h(e,r,u,d);for(var p=e,m,g;e.prev!==e.next;){if(m=e.prev,g=e.next,d?s(e,r,u,d):o(e)){t.push(m.i/n|0),t.push(e.i/n|0),t.push(g.i/n|0),j(e),e=g.next,p=g.next;continue}if(e=g,e===p){f?f===1?(e=c(i(e),t,n),a(e,t,n,r,u,d,2)):f===2&&l(e,t,n,r,u,d):a(i(e),t,n,r,u,d,1);break}}}}function o(e){var t=e.prev,n=e,r=e.next;if(x(t,n,r)>=0)return!1;for(var i=t.x,a=n.x,o=r.x,s=t.y,c=n.y,l=r.y,u=i<a?i<o?i:o:a<o?a:o,d=s<c?s<l?s:l:c<l?c:l,f=i>a?i>o?i:o:a>o?a:o,p=s>c?s>l?s:l:c>l?c:l,m=r.next;m!==t;){if(m.x>=u&&m.x<=f&&m.y>=d&&m.y<=p&&y(i,s,a,c,o,l,m.x,m.y)&&x(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function s(e,t,n,r){var i=e.prev,a=e,o=e.next;if(x(i,a,o)>=0)return!1;for(var s=i.x,c=a.x,l=o.x,u=i.y,d=a.y,f=o.y,p=s<c?s<l?s:l:c<l?c:l,m=u<d?u<f?u:f:d<f?d:f,h=s>c?s>l?s:l:c>l?c:l,g=u>d?u>f?u:f:d>f?d:f,v=_(p,m,t,n,r),b=_(h,g,t,n,r),S=e.prevZ,C=e.nextZ;S&&S.z>=v&&C&&C.z<=b;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0||(S=S.prevZ,C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0))return!1;C=C.nextZ}for(;S&&S.z>=v;){if(S.x>=p&&S.x<=h&&S.y>=m&&S.y<=g&&S!==i&&S!==o&&y(s,u,c,d,l,f,S.x,S.y)&&x(S.prev,S,S.next)>=0)return!1;S=S.prevZ}for(;C&&C.z<=b;){if(C.x>=p&&C.x<=h&&C.y>=m&&C.y<=g&&C!==i&&C!==o&&y(s,u,c,d,l,f,C.x,C.y)&&x(C.prev,C,C.next)>=0)return!1;C=C.nextZ}return!0}function c(e,t,n){var r=e;do{var a=r.prev,o=r.next.next;!S(a,o)&&C(a,r,r.next,o)&&D(a,o)&&D(o,a)&&(t.push(a.i/n|0),t.push(r.i/n|0),t.push(o.i/n|0),j(r),j(r.next),r=e=o),r=r.next}while(r!==e);return i(r)}function l(e,t,n,r,o,s){var c=e;do{for(var l=c.next.next;l!==c.prev;){if(c.i!==l.i&&b(c,l)){var u=k(c,l);c=i(c,c.next),u=i(u,u.next),a(c,t,n,r,o,s,0),a(u,t,n,r,o,s,0);return}l=l.next}c=c.next}while(c!==e)}function u(e,t,n,i){for(var a=[],o=0,s=t.length,c,l,u;o<s;o++)c=t[o]*i,l=o<s-1?t[o+1]*i:e.length,u=r(e,c,l,i,!1),u===u.next&&(u.steiner=!0),a.push(v(u));for(a.sort(d),o=0;o<a.length;o++)n=f(a[o],n);return n}function d(e,t){return e.x-t.x}function f(e,t){var n=p(e,t);if(!n)return t;var r=k(n,e);return i(r,r.next),i(n,n.next)}function p(e,t){var n=t,r=e.x,i=e.y,a=-1/0,o;do{if(i<=n.y&&i>=n.next.y&&n.next.y!==n.y){var s=n.x+(i-n.y)*(n.next.x-n.x)/(n.next.y-n.y);if(s<=r&&s>a&&(a=s,o=n.x<n.next.x?n:n.next,s===r))return o}n=n.next}while(n!==t);if(!o)return null;var c=o,l=o.x,u=o.y,d=1/0,f;n=o;do r>=n.x&&n.x>=l&&r!==n.x&&y(i<u?r:a,i,l,u,i<u?a:r,i,n.x,n.y)&&(f=Math.abs(i-n.y)/(r-n.x),D(n,e)&&(f<d||f===d&&(n.x>o.x||n.x===o.x&&m(o,n)))&&(o=n,d=f)),n=n.next;while(n!==c);return o}function m(e,t){return x(e.prev,e,t.prev)<0&&x(t.next,e,e.next)<0}function h(e,t,n,r){var i=e;do i.z===0&&(i.z=_(i.x,i.y,t,n,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==e);i.prevZ.nextZ=null,i.prevZ=null,g(i)}function g(e){var t,n,r,i,a,o,s,c,l=1;do{for(n=e,e=null,a=null,o=0;n;){for(o++,r=n,s=0,t=0;t<l&&(s++,r=r.nextZ,r);t++);for(c=l;s>0||c>0&&r;)s!==0&&(c===0||!r||n.z<=r.z)?(i=n,n=n.nextZ,s--):(i=r,r=r.nextZ,c--),a?a.nextZ=i:e=i,i.prevZ=a,a=i;n=r}a.nextZ=null,l*=2}while(o>1);return e}function _(e,t,n,r,i){return e=(e-n)*i|0,t=(t-r)*i|0,e=(e|e<<8)&16711935,e=(e|e<<4)&252645135,e=(e|e<<2)&858993459,e=(e|e<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,e|t<<1}function v(e){var t=e,n=e;do(t.x<n.x||t.x===n.x&&t.y<n.y)&&(n=t),t=t.next;while(t!==e);return n}function y(e,t,n,r,i,a,o,s){return(i-o)*(t-s)>=(e-o)*(a-s)&&(e-o)*(r-s)>=(n-o)*(t-s)&&(n-o)*(a-s)>=(i-o)*(r-s)}function b(e,t){return e.next.i!==t.i&&e.prev.i!==t.i&&!E(e,t)&&(D(e,t)&&D(t,e)&&O(e,t)&&(x(e.prev,e,t.prev)||x(e,t.prev,t))||S(e,t)&&x(e.prev,e,e.next)>0&&x(t.prev,t,t.next)>0)}function x(e,t,n){return(t.y-e.y)*(n.x-t.x)-(t.x-e.x)*(n.y-t.y)}function S(e,t){return e.x===t.x&&e.y===t.y}function C(e,t,n,r){var i=T(x(e,t,n)),a=T(x(e,t,r)),o=T(x(n,r,e)),s=T(x(n,r,t));return!!(i!==a&&o!==s||i===0&&w(e,n,t)||a===0&&w(e,r,t)||o===0&&w(n,e,r)||s===0&&w(n,t,r))}function w(e,t,n){return t.x<=Math.max(e.x,n.x)&&t.x>=Math.min(e.x,n.x)&&t.y<=Math.max(e.y,n.y)&&t.y>=Math.min(e.y,n.y)}function T(e){return e>0?1:e<0?-1:0}function E(e,t){var n=e;do{if(n.i!==e.i&&n.next.i!==e.i&&n.i!==t.i&&n.next.i!==t.i&&C(n,n.next,e,t))return!0;n=n.next}while(n!==e);return!1}function D(e,t){return x(e.prev,e,e.next)<0?x(e,t,e.next)>=0&&x(e,e.prev,t)>=0:x(e,t,e.prev)<0||x(e,e.next,t)<0}function O(e,t){var n=e,r=!1,i=(e.x+t.x)/2,a=(e.y+t.y)/2;do n.y>a!=n.next.y>a&&n.next.y!==n.y&&i<(n.next.x-n.x)*(a-n.y)/(n.next.y-n.y)+n.x&&(r=!r),n=n.next;while(n!==e);return r}function k(e,t){var n=new M(e.i,e.x,e.y),r=new M(t.i,t.x,t.y),i=e.next,a=t.prev;return e.next=t,t.prev=e,n.next=i,i.prev=n,r.next=n,n.prev=r,a.next=r,r.prev=a,r}function A(e,t,n,r){var i=new M(e,t,n);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function j(e){e.next.prev=e.prev,e.prev.next=e.next,e.prevZ&&(e.prevZ.nextZ=e.nextZ),e.nextZ&&(e.nextZ.prevZ=e.prevZ)}function M(e,t,n){this.i=e,this.x=t,this.y=n,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}n.deviation=function(e,t,n,r){var i=t&&t.length,a=i?t[0]*n:e.length,o=Math.abs(N(e,0,a,n));if(i)for(var s=0,c=t.length;s<c;s++){var l=t[s]*n,u=s<c-1?t[s+1]*n:e.length;o-=Math.abs(N(e,l,u,n))}var d=0;for(s=0;s<r.length;s+=3){var f=r[s]*n,p=r[s+1]*n,m=r[s+2]*n;d+=Math.abs((e[f]-e[m])*(e[p+1]-e[f+1])-(e[f]-e[p])*(e[m+1]-e[f+1]))}return o===0&&d===0?0:Math.abs((d-o)/o)};function N(e,t,n,r){for(var i=0,a=t,o=n-r;a<n;a+=r)i+=(e[o]-e[a])*(e[a+1]+e[o+1]),o=a;return i}n.flatten=function(e){for(var t=e[0][0].length,n={vertices:[],holes:[],dimensions:t},r=0,i=0;i<e.length;i++){for(var a=0;a<e[i].length;a++)for(var o=0;o<t;o++)n.vertices.push(e[i][a][o]);i>0&&(r+=e[i-1].length,n.holes.push(r))}return n}})),se=n(((e,t)=>{(function(n){var r=typeof e==`object`&&e&&!e.nodeType&&e,i=typeof t==`object`&&t&&!t.nodeType&&t,a=typeof global==`object`&&global;(a.global===a||a.window===a||a.self===a)&&(n=a);var o,s=2147483647,c=36,l=1,u=26,d=38,f=700,p=72,m=128,h=`-`,g=/^xn--/,_=/[^\x20-\x7E]/,v=/[\x2E\u3002\uFF0E\uFF61]/g,y={overflow:`Overflow: input needs wider integers to process`,"not-basic":`Illegal input >= 0x80 (not a basic code point)`,"invalid-input":`Invalid input`},b=c-l,x=Math.floor,S=String.fromCharCode,C;function w(e){throw RangeError(y[e])}function T(e,t){for(var n=e.length,r=[];n--;)r[n]=t(e[n]);return r}function E(e,t){var n=e.split(`@`),r=``;n.length>1&&(r=n[0]+`@`,e=n[1]),e=e.replace(v,`.`);var i=T(e.split(`.`),t).join(`.`);return r+i}function D(e){for(var t=[],n=0,r=e.length,i,a;n<r;)i=e.charCodeAt(n++),i>=55296&&i<=56319&&n<r?(a=e.charCodeAt(n++),(a&64512)==56320?t.push(((i&1023)<<10)+(a&1023)+65536):(t.push(i),n--)):t.push(i);return t}function O(e){return T(e,function(e){var t=``;return e>65535&&(e-=65536,t+=S(e>>>10&1023|55296),e=56320|e&1023),t+=S(e),t}).join(``)}function k(e){return e-48<10?e-22:e-65<26?e-65:e-97<26?e-97:c}function A(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function j(e,t,n){var r=0;for(e=n?x(e/f):e>>1,e+=x(e/t);e>b*u>>1;r+=c)e=x(e/b);return x(r+(b+1)*e/(e+d))}function M(e){var t=[],n=e.length,r,i=0,a=m,o=p,d=e.lastIndexOf(h),f,g,_,v,y,b,S,C;for(d<0&&(d=0),f=0;f<d;++f)e.charCodeAt(f)>=128&&w(`not-basic`),t.push(e.charCodeAt(f));for(g=d>0?d+1:0;g<n;){for(_=i,v=1,y=c;g>=n&&w(`invalid-input`),b=k(e.charCodeAt(g++)),(b>=c||b>x((s-i)/v))&&w(`overflow`),i+=b*v,S=y<=o?l:y>=o+u?u:y-o,!(b<S);y+=c)C=c-S,v>x(s/C)&&w(`overflow`),v*=C;r=t.length+1,o=j(i-_,r,_==0),x(i/r)>s-a&&w(`overflow`),a+=x(i/r),i%=r,t.splice(i++,0,a)}return O(t)}function N(e){var t,n,r,i,a,o,d,f,g,_,v,y=[],b,C,T,E;for(e=D(e),b=e.length,t=m,n=0,a=p,o=0;o<b;++o)v=e[o],v<128&&y.push(S(v));for(r=i=y.length,i&&y.push(h);r<b;){for(d=s,o=0;o<b;++o)v=e[o],v>=t&&v<d&&(d=v);for(C=r+1,d-t>x((s-n)/C)&&w(`overflow`),n+=(d-t)*C,t=d,o=0;o<b;++o)if(v=e[o],v<t&&++n>s&&w(`overflow`),v==t){for(f=n,g=c;_=g<=a?l:g>=a+u?u:g-a,!(f<_);g+=c)E=f-_,T=c-_,y.push(S(A(_+E%T,0))),f=x(E/T);y.push(S(A(f,0))),a=j(n,C,r==i),n=0,++r}++n,++t}return y.join(``)}function P(e){return E(e,function(e){return g.test(e)?M(e.slice(4).toLowerCase()):e})}function F(e){return E(e,function(e){return _.test(e)?`xn--`+N(e):e})}if(o={version:`1.4.1`,ucs2:{decode:D,encode:O},decode:M,encode:N,toASCII:F,toUnicode:P},typeof define==`function`&&typeof define.amd==`object`&&define.amd)define(`punycode`,function(){return o});else if(r&&i){if(t.exports==r)i.exports=o;else for(C in o)o.hasOwnProperty(C)&&(r[C]=o[C])}else n.punycode=o})(e)})),ce=n(((e,t)=>{t.exports=TypeError})),le=n(((e,t)=>{t.exports={}})),ue=n(((e,t)=>{var n=typeof Map==`function`&&Map.prototype,r=Object.getOwnPropertyDescriptor&&n?Object.getOwnPropertyDescriptor(Map.prototype,`size`):null,i=n&&r&&typeof r.get==`function`?r.get:null,a=n&&Map.prototype.forEach,o=typeof Set==`function`&&Set.prototype,s=Object.getOwnPropertyDescriptor&&o?Object.getOwnPropertyDescriptor(Set.prototype,`size`):null,c=o&&s&&typeof s.get==`function`?s.get:null,l=o&&Set.prototype.forEach,u=typeof WeakMap==`function`&&WeakMap.prototype?WeakMap.prototype.has:null,d=typeof WeakSet==`function`&&WeakSet.prototype?WeakSet.prototype.has:null,f=typeof WeakRef==`function`&&WeakRef.prototype?WeakRef.prototype.deref:null,p=Boolean.prototype.valueOf,m=Object.prototype.toString,h=Function.prototype.toString,g=String.prototype.match,_=String.prototype.slice,v=String.prototype.replace,y=String.prototype.toUpperCase,b=String.prototype.toLowerCase,x=RegExp.prototype.test,S=Array.prototype.concat,C=Array.prototype.join,w=Array.prototype.slice,T=Math.floor,E=typeof BigInt==`function`?BigInt.prototype.valueOf:null,D=Object.getOwnPropertySymbols,O=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?Symbol.prototype.toString:null,k=typeof Symbol==`function`&&typeof Symbol.iterator==`object`,A=typeof Symbol==`function`&&Symbol.toStringTag?Symbol.toStringTag:null,j=Object.prototype.propertyIsEnumerable,M=(typeof Reflect==`function`?Reflect.getPrototypeOf:Object.getPrototypeOf)||([].__proto__===Array.prototype?function(e){return e.__proto__}:null);function N(e,t){if(e===1/0||e===-1/0||e!==e||e&&e>-1e3&&e<1e3||x.call(/e/,t))return t;var n=/[0-9](?=(?:[0-9]{3})+(?![0-9]))/g;if(typeof e==`number`){var r=e<0?-T(-e):T(e);if(r!==e){var i=String(r),a=_.call(t,i.length+1);return v.call(i,n,`$&_`)+`.`+v.call(v.call(a,/([0-9]{3})/g,`$&_`),/_$/,``)}}return v.call(t,n,`$&_`)}var P=le(),F=P.custom,I=de(F)?F:null,ee={__proto__:null,double:`"`,single:`'`},te={__proto__:null,double:/(["\\])/g,single:/(['\\])/g};t.exports=function e(t,n,r,o){var s=n||{};if(me(s,`quoteStyle`)&&!me(ee,s.quoteStyle))throw TypeError(`option "quoteStyle" must be "single" or "double"`);if(me(s,`maxStringLength`)&&(typeof s.maxStringLength==`number`?s.maxStringLength<0&&s.maxStringLength!==1/0:s.maxStringLength!==null))throw TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');var u=!me(s,`customInspect`)||s.customInspect;if(typeof u!=`boolean`&&u!==`symbol`)throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");if(me(s,`indent`)&&s.indent!==null&&s.indent!==` `&&!(parseInt(s.indent,10)===s.indent&&s.indent>0))throw TypeError('option "indent" must be "\\t", an integer > 0, or `null`');if(me(s,`numericSeparator`)&&typeof s.numericSeparator!=`boolean`)throw TypeError('option "numericSeparator", if provided, must be `true` or `false`');var d=s.numericSeparator;if(t===void 0)return`undefined`;if(t===null)return`null`;if(typeof t==`boolean`)return t?`true`:`false`;if(typeof t==`string`)return we(t,s);if(typeof t==`number`){if(t===0)return 1/0/t>0?`0`:`-0`;var f=String(t);return d?N(t,f):f}if(typeof t==`bigint`){var m=String(t)+`n`;return d?N(t,m):m}var h=s.depth===void 0?5:s.depth;if(r===void 0&&(r=0),r>=h&&h>0&&typeof t==`object`)return ie(t)?`[Array]`:`[Object]`;var g=Ae(s,r);if(o===void 0)o=[];else if(_e(o,t)>=0)return`[Circular]`;function y(t,n,i){if(n&&(o=w.call(o),o.push(n)),i){var a={depth:s.depth};return me(s,`quoteStyle`)&&(a.quoteStyle=s.quoteStyle),e(t,a,r+1,o)}return e(t,s,r+1,o)}if(typeof t==`function`&&!ae(t)){var x=ge(t),T=Me(t,y);return`[Function`+(x?`: `+x:` (anonymous)`)+`]`+(T.length>0?` { `+C.call(T,`, `)+` }`:``)}if(de(t)){var D=k?v.call(String(t),/^(Symbol\(.*\))_[^)]*$/,`$1`):O.call(t);return typeof t==`object`&&!k?Ee(D):D}if(Ce(t)){for(var F=`<`+b.call(String(t.nodeName)),te=t.attributes||[],L=0;L<te.length;L++)F+=` `+te[L].name+`=`+ne(re(te[L].value),`double`,s);return F+=`>`,t.childNodes&&t.childNodes.length&&(F+=`...`),F+=`</`+b.call(String(t.nodeName))+`>`,F}if(ie(t)){if(t.length===0)return`[]`;var le=Me(t,y);return g&&!ke(le)?`[`+je(le,g)+`]`:`[ `+C.call(le,`, `)+` ]`}if(oe(t)){var pe=Me(t,y);return!(`cause`in Error.prototype)&&`cause`in t&&!j.call(t,`cause`)?`{ [`+String(t)+`] `+C.call(S.call(`[cause]: `+y(t.cause),pe),`, `)+` }`:pe.length===0?`[`+String(t)+`]`:`{ [`+String(t)+`] `+C.call(pe,`, `)+` }`}if(typeof t==`object`&&u){if(I&&typeof t[I]==`function`&&P)return P(t,{depth:h-r});if(u!==`symbol`&&typeof t.inspect==`function`)return t.inspect()}if(ve(t)){var Te=[];return a&&a.call(t,function(e,n){Te.push(y(n,t,!0)+` => `+y(e,t))}),Oe(`Map`,i.call(t),Te,g)}if(xe(t)){var Ne=[];return l&&l.call(t,function(e){Ne.push(y(e,t))}),Oe(`Set`,c.call(t),Ne,g)}if(ye(t))return De(`WeakMap`);if(Se(t))return De(`WeakSet`);if(be(t))return De(`WeakRef`);if(ce(t))return Ee(y(Number(t)));if(fe(t))return Ee(y(E.call(t)));if(ue(t))return Ee(p.call(t));if(se(t))return Ee(y(String(t)));if(typeof window<`u`&&t===window)return`{ [object Window] }`;if(typeof globalThis<`u`&&t===globalThis||typeof global<`u`&&t===global)return`{ [object globalThis] }`;if(!R(t)&&!ae(t)){var Pe=Me(t,y),Fe=M?M(t)===Object.prototype:t instanceof Object||t.constructor===Object,Ie=t instanceof Object?``:`null prototype`,Le=!Fe&&A&&Object(t)===t&&A in t?_.call(he(t),8,-1):Ie?`Object`:``,Re=(Fe||typeof t.constructor!=`function`?``:t.constructor.name?t.constructor.name+` `:``)+(Le||Ie?`[`+C.call(S.call([],Le||[],Ie||[]),`: `)+`] `:``);return Pe.length===0?Re+`{}`:g?Re+`{`+je(Pe,g)+`}`:Re+`{ `+C.call(Pe,`, `)+` }`}return String(t)};function ne(e,t,n){var r=ee[n.quoteStyle||t];return r+e+r}function re(e){return v.call(String(e),/"/g,`"`)}function L(e){return!A||!(typeof e==`object`&&(A in e||e[A]!==void 0))}function ie(e){return he(e)===`[object Array]`&&L(e)}function R(e){return he(e)===`[object Date]`&&L(e)}function ae(e){return he(e)===`[object RegExp]`&&L(e)}function oe(e){return he(e)===`[object Error]`&&L(e)}function se(e){return he(e)===`[object String]`&&L(e)}function ce(e){return he(e)===`[object Number]`&&L(e)}function ue(e){return he(e)===`[object Boolean]`&&L(e)}function de(e){if(k)return e&&typeof e==`object`&&e instanceof Symbol;if(typeof e==`symbol`)return!0;if(!e||typeof e!=`object`||!O)return!1;try{return O.call(e),!0}catch{}return!1}function fe(e){if(!e||typeof e!=`object`||!E)return!1;try{return E.call(e),!0}catch{}return!1}var pe=Object.prototype.hasOwnProperty||function(e){return e in this};function me(e,t){return pe.call(e,t)}function he(e){return m.call(e)}function ge(e){if(e.name)return e.name;var t=g.call(h.call(e),/^function\s*([\w$]+)/);return t?t[1]:null}function _e(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(e[n]===t)return n;return-1}function ve(e){if(!i||!e||typeof e!=`object`)return!1;try{i.call(e);try{c.call(e)}catch{return!0}return e instanceof Map}catch{}return!1}function ye(e){if(!u||!e||typeof e!=`object`)return!1;try{u.call(e,u);try{d.call(e,d)}catch{return!0}return e instanceof WeakMap}catch{}return!1}function be(e){if(!f||!e||typeof e!=`object`)return!1;try{return f.call(e),!0}catch{}return!1}function xe(e){if(!c||!e||typeof e!=`object`)return!1;try{c.call(e);try{i.call(e)}catch{return!0}return e instanceof Set}catch{}return!1}function Se(e){if(!d||!e||typeof e!=`object`)return!1;try{d.call(e,d);try{u.call(e,u)}catch{return!0}return e instanceof WeakSet}catch{}return!1}function Ce(e){return!e||typeof e!=`object`?!1:typeof HTMLElement<`u`&&e instanceof HTMLElement||typeof e.nodeName==`string`&&typeof e.getAttribute==`function`}function we(e,t){if(e.length>t.maxStringLength){var n=e.length-t.maxStringLength,r=`... `+n+` more character`+(n>1?`s`:``);return we(_.call(e,0,t.maxStringLength),t)+r}var i=te[t.quoteStyle||`single`];return i.lastIndex=0,ne(v.call(v.call(e,i,`\\$1`),/[\x00-\x1f]/g,Te),`single`,t)}function Te(e){var t=e.charCodeAt(0),n={8:`b`,9:`t`,10:`n`,12:`f`,13:`r`}[t];return n?`\\`+n:`\\x`+(t<16?`0`:``)+y.call(t.toString(16))}function Ee(e){return`Object(`+e+`)`}function De(e){return e+` { ? }`}function Oe(e,t,n,r){var i=r?je(n,r):C.call(n,`, `);return e+` (`+t+`) {`+i+`}`}function ke(e){for(var t=0;t<e.length;t++)if(_e(e[t],`
|
|
2
|
+
`)>=0)return!1;return!0}function Ae(e,t){var n;if(e.indent===` `)n=` `;else if(typeof e.indent==`number`&&e.indent>0)n=C.call(Array(e.indent+1),` `);else return null;return{base:n,prev:C.call(Array(t+1),n)}}function je(e,t){if(e.length===0)return``;var n=`
|
|
3
|
+
`+t.prev+t.base;return n+C.call(e,`,`+n)+`
|
|
4
|
+
`+t.prev}function Me(e,t){var n=ie(e),r=[];if(n){r.length=e.length;for(var i=0;i<e.length;i++)r[i]=me(e,i)?t(e[i],e):``}var a=typeof D==`function`?D(e):[],o;if(k){o={};for(var s=0;s<a.length;s++)o[`$`+a[s]]=a[s]}for(var c in e)me(e,c)&&(n&&String(Number(c))===c&&c<e.length||k&&o[`$`+c]instanceof Symbol||(x.call(/[^\w$]/,c)?r.push(t(c,e)+`: `+t(e[c],e)):r.push(c+`: `+t(e[c],e))));if(typeof D==`function`)for(var l=0;l<a.length;l++)j.call(e,a[l])&&r.push(`[`+t(a[l])+`]: `+t(e[a[l]],e));return r}})),de=n(((e,t)=>{var n=ue(),r=ce(),i=function(e,t,n){for(var r=e,i;(i=r.next)!=null;r=i)if(i.key===t)return r.next=i.next,n||(i.next=e.next,e.next=i),i},a=function(e,t){if(e){var n=i(e,t);return n&&n.value}},o=function(e,t,n){var r=i(e,t);r?r.value=n:e.next={key:t,next:e.next,value:n}},s=function(e,t){return e?!!i(e,t):!1},c=function(e,t){if(e)return i(e,t,!0)};t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new r(`Side channel does not contain `+n(e))},delete:function(t){var n=c(e,t);return n&&e&&!e.next&&(e=void 0),!!n},get:function(t){return a(e,t)},has:function(t){return s(e,t)},set:function(t,n){e||={next:void 0},o(e,t,n)}};return t}})),fe=n(((e,t)=>{t.exports=Object})),pe=n(((e,t)=>{t.exports=Error})),me=n(((e,t)=>{t.exports=EvalError})),he=n(((e,t)=>{t.exports=RangeError})),ge=n(((e,t)=>{t.exports=ReferenceError})),_e=n(((e,t)=>{t.exports=SyntaxError})),ve=n(((e,t)=>{t.exports=URIError})),ye=n(((e,t)=>{t.exports=Math.abs})),be=n(((e,t)=>{t.exports=Math.floor})),xe=n(((e,t)=>{t.exports=Math.max})),Se=n(((e,t)=>{t.exports=Math.min})),Ce=n(((e,t)=>{t.exports=Math.pow})),we=n(((e,t)=>{t.exports=Math.round})),Te=n(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),Ee=n(((e,t)=>{var n=Te();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),De=n(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),Oe=n(((e,t)=>{var n=De();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),ke=n(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),Ae=n(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),je=n(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=Ae();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),Me=n(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),Ne=n(((e,t)=>{t.exports=fe().getPrototypeOf||null})),Pe=n(((e,t)=>{var n=Object.prototype.toString,r=Math.max,i=`[object Function]`,a=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},o=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},s=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||n.apply(t)!==i)throw TypeError(`Function.prototype.bind called on incompatible `+t);for(var c=o(arguments,1),l,u=function(){if(this instanceof l){var n=t.apply(this,a(c,arguments));return Object(n)===n?n:this}return t.apply(e,a(c,arguments))},d=r(0,t.length-c.length),f=[],p=0;p<d;p++)f[p]=`$`+p;if(l=Function(`binder`,`return function (`+s(f,`,`)+`){ return binder.apply(this,arguments); }`)(u),t.prototype){var m=function(){};m.prototype=t.prototype,l.prototype=new m,m.prototype=null}return l}})),Fe=n(((e,t)=>{var n=Pe();t.exports=Function.prototype.bind||n})),Ie=n(((e,t)=>{t.exports=Function.prototype.call})),Le=n(((e,t)=>{t.exports=Function.prototype.apply})),Re=n(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),ze=n(((e,t)=>{var n=Fe(),r=Le(),i=Ie();t.exports=Re()||n.call(i,r)})),Be=n(((e,t)=>{var n=Fe(),r=ce(),i=Ie(),a=ze();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),Ve=n(((e,t)=>{var n=Be(),r=Oe(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`&&function(e){return s(e==null?e:o(e))}})),He=n(((e,t)=>{var n=Me(),r=Ne(),i=Ve();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null})),Ue=n(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=Fe().call(n,r)})),We=n(((e,t)=>{var n,r=fe(),i=pe(),a=me(),o=he(),s=ge(),c=_e(),l=ce(),u=ve(),d=ye(),f=be(),p=xe(),m=Se(),h=Ce(),g=we(),_=Ee(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=Oe(),x=ke(),S=function(){throw new l},C=b?function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}}():S,w=je()(),T=He(),E=Ne(),D=Me(),O=Le(),k=Ie(),A={},j=typeof Uint8Array>`u`||!T?n:T(Uint8Array),M={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":j,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){M[`%Error.prototype%`]=T(T(e))}var N=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return M[t]=n,n},P={__proto__:null,"%ArrayBufferPrototype%":[`ArrayBuffer`,`prototype`],"%ArrayPrototype%":[`Array`,`prototype`],"%ArrayProto_entries%":[`Array`,`prototype`,`entries`],"%ArrayProto_forEach%":[`Array`,`prototype`,`forEach`],"%ArrayProto_keys%":[`Array`,`prototype`,`keys`],"%ArrayProto_values%":[`Array`,`prototype`,`values`],"%AsyncFunctionPrototype%":[`AsyncFunction`,`prototype`],"%AsyncGenerator%":[`AsyncGeneratorFunction`,`prototype`],"%AsyncGeneratorPrototype%":[`AsyncGeneratorFunction`,`prototype`,`prototype`],"%BooleanPrototype%":[`Boolean`,`prototype`],"%DataViewPrototype%":[`DataView`,`prototype`],"%DatePrototype%":[`Date`,`prototype`],"%ErrorPrototype%":[`Error`,`prototype`],"%EvalErrorPrototype%":[`EvalError`,`prototype`],"%Float32ArrayPrototype%":[`Float32Array`,`prototype`],"%Float64ArrayPrototype%":[`Float64Array`,`prototype`],"%FunctionPrototype%":[`Function`,`prototype`],"%Generator%":[`GeneratorFunction`,`prototype`],"%GeneratorPrototype%":[`GeneratorFunction`,`prototype`,`prototype`],"%Int8ArrayPrototype%":[`Int8Array`,`prototype`],"%Int16ArrayPrototype%":[`Int16Array`,`prototype`],"%Int32ArrayPrototype%":[`Int32Array`,`prototype`],"%JSONParse%":[`JSON`,`parse`],"%JSONStringify%":[`JSON`,`stringify`],"%MapPrototype%":[`Map`,`prototype`],"%NumberPrototype%":[`Number`,`prototype`],"%ObjectPrototype%":[`Object`,`prototype`],"%ObjProto_toString%":[`Object`,`prototype`,`toString`],"%ObjProto_valueOf%":[`Object`,`prototype`,`valueOf`],"%PromisePrototype%":[`Promise`,`prototype`],"%PromiseProto_then%":[`Promise`,`prototype`,`then`],"%Promise_all%":[`Promise`,`all`],"%Promise_reject%":[`Promise`,`reject`],"%Promise_resolve%":[`Promise`,`resolve`],"%RangeErrorPrototype%":[`RangeError`,`prototype`],"%ReferenceErrorPrototype%":[`ReferenceError`,`prototype`],"%RegExpPrototype%":[`RegExp`,`prototype`],"%SetPrototype%":[`Set`,`prototype`],"%SharedArrayBufferPrototype%":[`SharedArrayBuffer`,`prototype`],"%StringPrototype%":[`String`,`prototype`],"%SymbolPrototype%":[`Symbol`,`prototype`],"%SyntaxErrorPrototype%":[`SyntaxError`,`prototype`],"%TypedArrayPrototype%":[`TypedArray`,`prototype`],"%TypeErrorPrototype%":[`TypeError`,`prototype`],"%Uint8ArrayPrototype%":[`Uint8Array`,`prototype`],"%Uint8ClampedArrayPrototype%":[`Uint8ClampedArray`,`prototype`],"%Uint16ArrayPrototype%":[`Uint16Array`,`prototype`],"%Uint32ArrayPrototype%":[`Uint32Array`,`prototype`],"%URIErrorPrototype%":[`URIError`,`prototype`],"%WeakMapPrototype%":[`WeakMap`,`prototype`],"%WeakSetPrototype%":[`WeakSet`,`prototype`]},F=Fe(),I=Ue(),ee=F.call(k,Array.prototype.concat),te=F.call(O,Array.prototype.splice),ne=F.call(k,String.prototype.replace),re=F.call(k,String.prototype.slice),L=F.call(k,RegExp.prototype.exec),ie=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,R=/\\(\\)?/g,ae=function(e){var t=re(e,0,1),n=re(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return ne(e,ie,function(e,t,n,i){r[r.length]=n?ne(i,R,`$1`):t||e}),r},oe=function(e,t){var n=e,r;if(I(P,n)&&(r=P[n],n=`%`+r[0]+`%`),I(M,n)){var i=M[n];if(i===A&&(i=N(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(L(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=ae(e),r=n.length>0?n[0]:``,i=oe(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],te(n,ee([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=re(p,0,1),h=re(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,I(M,a))o=M[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=I(o,p),o=o[p];f&&!s&&(M[a]=o)}}return o}})),Ge=n(((e,t)=>{var n=We(),r=Be(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}})),Ke=n(((e,t)=>{var n=We(),r=Ge(),i=ue(),a=ce(),o=n(`%Map%`,!0),s=r(`Map.prototype.get`,!0),c=r(`Map.prototype.set`,!0),l=r(`Map.prototype.has`,!0),u=r(`Map.prototype.delete`,!0),d=r(`Map.prototype.size`,!0);t.exports=!!o&&function(){var e,t={assert:function(e){if(!t.has(e))throw new a(`Side channel does not contain `+i(e))},delete:function(t){if(e){var n=u(e,t);return d(e)===0&&(e=void 0),n}return!1},get:function(t){if(e)return s(e,t)},has:function(t){return e?l(e,t):!1},set:function(t,n){e||=new o,c(e,t,n)}};return t}})),qe=n(((e,t)=>{var n=We(),r=Ge(),i=ue(),a=Ke(),o=ce(),s=n(`%WeakMap%`,!0),c=r(`WeakMap.prototype.get`,!0),l=r(`WeakMap.prototype.set`,!0),u=r(`WeakMap.prototype.has`,!0),d=r(`WeakMap.prototype.delete`,!0);t.exports=s?function(){var e,t,n={assert:function(e){if(!n.has(e))throw new o(`Side channel does not contain `+i(e))},delete:function(n){if(s&&n&&(typeof n==`object`||typeof n==`function`)){if(e)return d(e,n)}else if(a&&t)return t.delete(n);return!1},get:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?c(e,n):t&&t.get(n)},has:function(n){return s&&n&&(typeof n==`object`||typeof n==`function`)&&e?u(e,n):!!t&&t.has(n)},set:function(n,r){s&&n&&(typeof n==`object`||typeof n==`function`)?(e||=new s,l(e,n,r)):a&&(t||=a(),t.set(n,r))}};return n}:a})),Je=n(((e,t)=>{var n=ce(),r=ue(),i=de(),a=Ke(),o=qe()||a||i;t.exports=function(){var e,t={assert:function(e){if(!t.has(e))throw new n(`Side channel does not contain `+(e&&Object(e)===e?`the given object key`:r(e)))},delete:function(t){return!!e&&e.delete(t)},get:function(t){return e&&e.get(t)},has:function(t){return!!e&&e.has(t)},set:function(t,n){e||=o(),e.set(t,n)}};return t}})),Ye=n(((e,t)=>{var n=String.prototype.replace,r=/%20/g,i={RFC1738:`RFC1738`,RFC3986:`RFC3986`};t.exports={default:i.RFC3986,formatters:{RFC1738:function(e){return n.call(e,r,`+`)},RFC3986:function(e){return String(e)}},RFC1738:i.RFC1738,RFC3986:i.RFC3986}})),Xe=n(((e,t)=>{var n=Ye(),r=Je(),i=ke(),a=Object.prototype.hasOwnProperty,o=Array.isArray,s=r(),c=function(e,t){return s.set(e,t),e},l=function(e){return s.has(e)},u=function(e){return s.get(e)},d=function(e,t){s.set(e,t)},f=function(){for(var e=[],t=0;t<256;++t)e[e.length]=`%`+((t<16?`0`:``)+t.toString(16)).toUpperCase();return e}(),p=function(e){for(;e.length>1;){var t=e.pop(),n=t.obj[t.prop];if(o(n)){for(var r=[],i=0;i<n.length;++i)n[i]!==void 0&&(r[r.length]=n[i]);t.obj[t.prop]=r}}},m=function(e,t){for(var n=t&&t.plainObjects?{__proto__:null}:{},r=0;r<e.length;++r)e[r]!==void 0&&(n[r]=e[r]);return n},h=function(e,t,n){t===`__proto__`&&i?i(e,t,{configurable:!0,enumerable:!0,value:n,writable:!0}):e[t]=n},g=function e(t,n,r){if(!n)return t;if(typeof n!=`object`&&typeof n!=`function`){if(o(t)){var i=t.length;if(r&&typeof r.arrayLimit==`number`&&i>=r.arrayLimit){if(r.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+r.arrayLimit+` element`+(r.arrayLimit===1?``:`s`)+` allowed in an array.`);return c(m(t.concat(n),r),i)}t[i]=n}else if(t&&typeof t==`object`){if(l(t)){var s=u(t)+1;t[s]=n,d(t,s)}else if(r&&r.strictMerge)return[t,n];else(r&&(r.plainObjects||r.allowPrototypes)||!a.call(Object.prototype,n))&&(t[n]=!0)}else return[t,n];return t}if(!t||typeof t!=`object`){if(l(n)){for(var f=Object.keys(n),p=r&&r.plainObjects?{__proto__:null,0:t}:{0:t},g=0;g<f.length;g++){var _=parseInt(f[g],10);p[_+1]=n[f[g]]}return c(p,u(n)+1)}var v=[t].concat(n);if(r&&typeof r.arrayLimit==`number`&&v.length>r.arrayLimit){if(r.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+r.arrayLimit+` element`+(r.arrayLimit===1?``:`s`)+` allowed in an array.`);return c(m(v,r),v.length-1)}return v}var y=t;if(o(t)&&!o(n)&&(y=m(t,r)),o(t)&&o(n)){if(n.forEach(function(n,i){if(a.call(t,i)){var o=t[i];o&&typeof o==`object`&&n&&typeof n==`object`?t[i]=e(o,n,r):t[t.length]=n}else t[i]=n}),r&&typeof r.arrayLimit==`number`&&t.length>r.arrayLimit){if(r.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+r.arrayLimit+` element`+(r.arrayLimit===1?``:`s`)+` allowed in an array.`);return c(m(t,r),t.length-1)}return t}return Object.keys(n).reduce(function(t,i){var o=n[i];if(a.call(t,i)?h(t,i,e(t[i],o,r)):h(t,i,o),l(n)&&!l(t)&&c(t,u(n)),l(t)){var s=parseInt(i,10);String(s)===i&&s>=0&&s>u(t)&&d(t,s)}return t},y)},_=function(e,t){return Object.keys(t).reduce(function(e,n){return h(e,n,t[n]),e},e)},v=function(e,t,n){var r=e.replace(/\+/g,` `);if(n===`iso-8859-1`)return r.replace(/%[0-9a-f]{2}/gi,unescape);try{return decodeURIComponent(r)}catch{return r}},y=1024;t.exports={arrayToObject:m,assign:_,combine:function(e,t,n,r,i){if(l(e)){if(i)throw RangeError(`Array limit exceeded. Only `+n+` element`+(n===1?``:`s`)+` allowed in an array.`);for(var a=o(t)?t:[t],s=u(e),f=0;f<a.length;++f)s+=1,e[s]=a[f];return d(e,s),e}var p=[].concat(e,t);if(p.length>n){if(i)throw RangeError(`Array limit exceeded. Only `+n+` element`+(n===1?``:`s`)+` allowed in an array.`);return c(m(p,{plainObjects:r}),p.length-1)}return p},compact:function(e){for(var t=[{obj:{o:e},prop:`o`}],n=r(),i=0;i<t.length;++i)for(var a=t[i],o=a.obj[a.prop],s=Object.keys(o),c=0;c<s.length;++c){var l=s[c],u=o[l];typeof u==`object`&&u&&!n.has(u)&&(t[t.length]={obj:o,prop:l},n.set(u,!0))}return p(t),e},decode:v,encode:function(e,t,r,i,a){if(e.length===0)return e;var o=e;if(typeof e==`symbol`?o=Symbol.prototype.toString.call(e):typeof e!=`string`&&(o=String(e)),r===`iso-8859-1`)return escape(o).replace(/%u[0-9a-f]{4}/gi,function(e){return`%26%23`+parseInt(e.slice(2),16)+`%3B`});for(var s=``,c=0;c<o.length;c+=y){var l=o.length>=y?o.slice(c,c+y):o;if(c+y<o.length){var u=l.charCodeAt(l.length-1);u>=55296&&u<=56319&&(l=l.slice(0,-1),--c)}for(var d=[],p=0;p<l.length;++p){var m=l.charCodeAt(p);if(m===45||m===46||m===95||m===126||m>=48&&m<=57||m>=65&&m<=90||m>=97&&m<=122||a===n.RFC1738&&(m===40||m===41)){d[d.length]=l.charAt(p);continue}if(m<128){d[d.length]=f[m];continue}if(m<2048){d[d.length]=f[192|m>>6]+f[128|m&63];continue}if(m<55296||m>=57344){d[d.length]=f[224|m>>12]+f[128|m>>6&63]+f[128|m&63];continue}p+=1,m=65536+((m&1023)<<10|l.charCodeAt(p)&1023),d[d.length]=f[240|m>>18]+f[128|m>>12&63]+f[128|m>>6&63]+f[128|m&63]}s+=d.join(``)}return s},isBuffer:function(e){return!e||typeof e!=`object`?!1:!!(e.constructor&&typeof e.constructor.isBuffer==`function`&&e.constructor.isBuffer(e))},isOverflow:l,isRegExp:function(e){return Object.prototype.toString.call(e)===`[object RegExp]`},markOverflow:c,maybeMap:function(e,t){if(o(e)){for(var n=[],r=0;r<e.length;r+=1)n[n.length]=t(e[r]);return n}return t(e)},merge:g}})),Ze=n(((e,t)=>{var n=Je(),r=Xe(),i=Ye(),a=Object.prototype.hasOwnProperty,o={brackets:function(e){return e+`[]`},comma:`comma`,indices:function(e,t){return e+`[`+t+`]`},repeat:function(e){return e}},s=Array.isArray,c=Array.prototype.push,l=function(e,t){c.apply(e,s(t)?t:[t])},u=Date.prototype.toISOString,d=i.default,f={addQueryPrefix:!1,allowDots:!1,allowEmptyArrays:!1,arrayFormat:`indices`,charset:`utf-8`,charsetSentinel:!1,commaRoundTrip:!1,delimiter:`&`,depth:1/0,encode:!0,encodeDotInKeys:!1,encoder:r.encode,encodeValuesOnly:!1,filter:void 0,format:d,formatter:i.formatters[d],indices:!1,serializeDate:function(e){return u.call(e)},skipNulls:!1,strictNullHandling:!1},p=function(e){return typeof e==`string`||typeof e==`number`||typeof e==`boolean`||typeof e==`symbol`||typeof e==`bigint`},m={},h=function e(t,i,a,o,c,u,d,h,g,_,v,y,b,x,S,C,w,T,E,D){var O=t;if(D>E)throw RangeError(`Input depth exceeded depth option of `+E);for(var k=T,A=0,j=!1;(k=k.get(m))!==void 0&&!j;){var M=k.get(t);if(A+=1,M!==void 0){if(M===A)throw RangeError(`Cyclic object value`);j=!0}k.get(m)===void 0&&(A=0)}if(O=typeof _==`function`?_(i,O):O,O instanceof Date?O=b(O):a===`comma`&&s(O)&&(O=r.maybeMap(O,function(e){return e instanceof Date?b(e):e})),O===null){if(u)return S(g&&!C?g(i,f.encoder,w,`key`,x):i);O=``}if(p(O)||r.isBuffer(O))return g?[S(C?i:g(i,f.encoder,w,`key`,x))+`=`+S(g(O,f.encoder,w,`value`,x))]:[S(i)+`=`+S(String(O))];var N=[];if(O===void 0)return N;var P;if(a===`comma`&&s(O))C&&g&&(O=r.maybeMap(O,function(e){return e==null?e:g(e)})),P=[{value:O.length>0?O.join(`,`)||null:void 0}];else if(s(_))P=_;else{var F=Object.keys(O);P=v?F.sort(v):F}var I=h?String(i).replace(/\./g,`%2E`):String(i),ee=o&&s(O)&&O.length===1?I+`[]`:I;if(c&&s(O)&&O.length===0&&Object.keys(O).length===0)return ee+`[]`;for(var te=0;te<P.length;++te){var ne=P[te],re=typeof ne==`object`&&ne&&ne.value!==void 0?ne.value:O[ne];if(!(d&&re===null)){var L=y&&h?String(ne).replace(/\./g,`%2E`):String(ne),ie=s(O)?typeof a==`function`?a(ee,L):ee:ee+(y?`.`+L:`[`+L+`]`);T.set(t,A);var R=n();R.set(m,T),l(N,e(re,ie,a,o,c,u,d,h,a===`comma`&&C&&s(O)?null:g,_,v,y,b,x,S,C,w,R,E,D+1))}}return N},g=function(e){if(!e)return f;if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.encodeDotInKeys!==void 0&&typeof e.encodeDotInKeys!=`boolean`)throw TypeError("`encodeDotInKeys` option can only be `true` or `false`, when provided");if(e.encoder!==null&&e.encoder!==void 0&&typeof e.encoder!=`function`)throw TypeError(`Encoder has to be a function.`);var t=e.charset||f.charset;if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);var n=i.default;if(e.format!==void 0){if(!a.call(i.formatters,e.format))throw TypeError(`Unknown format option provided.`);n=e.format}var r=i.formatters[n],c=f.filter;(typeof e.filter==`function`||s(e.filter))&&(c=e.filter);var l=e.arrayFormat in o?e.arrayFormat:`indices`in e?e.indices?`indices`:`repeat`:f.arrayFormat;if(`commaRoundTrip`in e&&typeof e.commaRoundTrip!=`boolean`)throw TypeError("`commaRoundTrip` must be a boolean, or absent");var u=e.allowDots===void 0?e.encodeDotInKeys===!0||f.allowDots:!!e.allowDots;return{addQueryPrefix:typeof e.addQueryPrefix==`boolean`?e.addQueryPrefix:f.addQueryPrefix,allowDots:u,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:f.allowEmptyArrays,arrayFormat:l,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:f.charsetSentinel,commaRoundTrip:!!e.commaRoundTrip,delimiter:e.delimiter===void 0?f.delimiter:e.delimiter,depth:typeof e.depth==`number`?e.depth:f.depth,encode:typeof e.encode==`boolean`?e.encode:f.encode,encodeDotInKeys:typeof e.encodeDotInKeys==`boolean`?e.encodeDotInKeys:f.encodeDotInKeys,encoder:typeof e.encoder==`function`?e.encoder:f.encoder,encodeValuesOnly:typeof e.encodeValuesOnly==`boolean`?e.encodeValuesOnly:f.encodeValuesOnly,filter:c,format:n,formatter:r,serializeDate:typeof e.serializeDate==`function`?e.serializeDate:f.serializeDate,skipNulls:typeof e.skipNulls==`boolean`?e.skipNulls:f.skipNulls,sort:typeof e.sort==`function`?e.sort:null,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:f.strictNullHandling}};t.exports=function(e,t){var r=e,i=g(t),a,c;typeof i.filter==`function`?(c=i.filter,r=c(``,r)):s(i.filter)&&(c=i.filter,a=c);var u=[];if(typeof r!=`object`||!r)return``;var d=o[i.arrayFormat],f=d===`comma`&&i.commaRoundTrip;a||=Object.keys(r),i.sort&&a.sort(i.sort);for(var p=n(),m=0;m<a.length;++m){var _=a[m];if(_!=null){var v=r[_];i.skipNulls&&v===null||l(u,h(v,i.encodeDotInKeys?String(_).replace(/\./g,`%2E`):String(_),d,f,i.allowEmptyArrays,i.strictNullHandling,i.skipNulls,i.encodeDotInKeys,i.encode?i.encoder:null,i.filter,i.sort,i.allowDots,i.serializeDate,i.format,i.formatter,i.encodeValuesOnly,i.charset,p,i.depth,0))}}var y=u.join(i.delimiter),b=i.addQueryPrefix===!0?`?`:``;return i.charsetSentinel&&(i.charset===`iso-8859-1`?b+=`utf8=%26%2310003%3B`+i.delimiter:b+=`utf8=%E2%9C%93`+i.delimiter),y.length>0?b+y:``}})),Qe=n(((e,t)=>{var n=Xe(),r=Object.prototype.hasOwnProperty,i=Array.isArray,a={allowDots:!1,allowEmptyArrays:!1,allowPrototypes:!1,allowSparse:!1,arrayLimit:20,charset:`utf-8`,charsetSentinel:!1,comma:!1,decodeDotInKeys:!1,decoder:n.decode,delimiter:`&`,depth:5,duplicates:`combine`,ignoreQueryPrefix:!1,interpretNumericEntities:!1,parameterLimit:1e3,parseArrays:!0,plainObjects:!1,strictDepth:!1,strictMerge:!0,strictNullHandling:!1,throwOnLimitExceeded:!1},o=function(e){return e.replace(/&#(\d+);/g,function(e,t){return String.fromCharCode(parseInt(t,10))})},s=function(e,t,n){if(e&&typeof e==`string`&&t.comma&&e.indexOf(`,`)>-1){if(t.throwOnLimitExceeded)for(var r=0,i=e.indexOf(`,`);i>-1;){if(r+=1,r>=t.arrayLimit)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);i=e.indexOf(`,`,i+1)}return e.split(`,`)}if(t.throwOnLimitExceeded&&n>=t.arrayLimit)throw RangeError(`Array limit exceeded. Only `+t.arrayLimit+` element`+(t.arrayLimit===1?``:`s`)+` allowed in an array.`);return e},c=`utf8=%26%2310003%3B`,l=`utf8=%E2%9C%93`,u=function(e,t){var u={__proto__:null},d=t.ignoreQueryPrefix?e.replace(/^\?/,``):e;d=d.replace(/%5B/gi,`[`).replace(/%5D/gi,`]`);var f=t.parameterLimit===1/0?void 0:t.parameterLimit,p=d.split(t.delimiter,t.throwOnLimitExceeded&&f!==void 0?f+1:f);if(t.throwOnLimitExceeded&&f!==void 0&&p.length>f)throw RangeError(`Parameter limit exceeded. Only `+f+` parameter`+(f===1?``:`s`)+` allowed.`);var m=-1,h,g=t.charset;if(t.charsetSentinel)for(h=0;h<p.length;++h)p[h].indexOf(`utf8=`)===0&&(p[h]===l?g=`utf-8`:p[h]===c&&(g=`iso-8859-1`),m=h,h=p.length);for(h=0;h<p.length;++h)if(h!==m){var _=p[h],v=_.indexOf(`]=`),y=v===-1?_.indexOf(`=`):v+1,b,x;if(y===-1?(b=t.decoder(_,a.decoder,g,`key`),x=t.strictNullHandling?null:``):(b=t.decoder(_.slice(0,y),a.decoder,g,`key`),b!==null&&(x=n.maybeMap(s(_.slice(y+1),t,i(u[b])?u[b].length:0),function(e){return t.decoder(e,a.decoder,g,`value`)}))),x&&t.interpretNumericEntities&&g===`iso-8859-1`&&(x=o(String(x))),_.indexOf(`[]=`)>-1&&(x=i(x)?[x]:x),t.comma&&i(x)&&x.length>t.arrayLimit&&(x=n.combine([],x,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded)),b!==null){var S=r.call(u,b);S&&(t.duplicates===`combine`||_.indexOf(`[]=`)>-1)?u[b]=n.combine(u[b],x,t.arrayLimit,t.plainObjects,t.throwOnLimitExceeded):(!S||t.duplicates===`last`)&&(u[b]=x)}}return u},d=function(e,t,r,i){var a=0;if(e.length>0&&e[e.length-1]===`[]`){var o=e.slice(0,-1).join(``);a=Array.isArray(t)&&t[o]?t[o].length:0}for(var c=i?t:s(t,r,a),l=e.length-1;l>=0;--l){var u,d=e[l];if(d===`[]`&&r.parseArrays)u=n.isOverflow(c)?c:r.allowEmptyArrays&&(c===``||r.strictNullHandling&&c===null)?[]:n.combine([],c,r.arrayLimit,r.plainObjects,r.throwOnLimitExceeded);else{u=r.plainObjects?{__proto__:null}:{};var f=d.charAt(0)===`[`&&d.charAt(d.length-1)===`]`?d.slice(1,-1):d,p=r.decodeDotInKeys?f.replace(/%2E/g,`.`):f,m=parseInt(p,10),h=!isNaN(m)&&d!==p&&String(m)===p&&m>=0&&r.parseArrays;if(!r.parseArrays&&p===``)u={0:c};else if(h&&m<r.arrayLimit)u=[],u[m]=c;else if(h&&r.throwOnLimitExceeded)throw RangeError(`Array limit exceeded. Only `+r.arrayLimit+` element`+(r.arrayLimit===1?``:`s`)+` allowed in an array.`);else h?(u[m]=c,n.markOverflow(u,m)):p!==`__proto__`&&(u[p]=c)}c=u}return c},f=function(e,t){var n=t.allowDots?e.replace(/\.([^.[]+)/g,`[$1]`):e;if(t.depth<=0)return!t.plainObjects&&r.call(Object.prototype,n)&&!t.allowPrototypes?void 0:[n];var i=[],a=n.indexOf(`[`),o=a>=0?n.slice(0,a):n;if(o){if(!t.plainObjects&&r.call(Object.prototype,o)&&!t.allowPrototypes)return;i[i.length]=o}for(var s=n.length,c=a,l=0;c>=0&&l<t.depth;){for(var u=1,d=c+1,f=-1;d<s&&f<0;){var p=n.charCodeAt(d);p===91?u+=1:p===93&&(--u,u===0&&(f=d)),d+=1}if(f<0)return i[i.length]=`[`+n.slice(c)+`]`,i;var m=n.slice(c,f+1),h=m.slice(1,-1);if(!t.plainObjects&&r.call(Object.prototype,h)&&!t.allowPrototypes)return;i[i.length]=m,l+=1,c=n.indexOf(`[`,f+1)}if(c>=0){if(t.strictDepth===!0)throw RangeError(`Input depth exceeded depth option of `+t.depth+` and strictDepth is true`);i[i.length]=`[`+n.slice(c)+`]`}return i},p=function(e,t,n,r){if(e){var i=f(e,n);if(i)return d(i,t,n,r)}},m=function(e){if(!e)return a;if(e.allowEmptyArrays!==void 0&&typeof e.allowEmptyArrays!=`boolean`)throw TypeError("`allowEmptyArrays` option can only be `true` or `false`, when provided");if(e.decodeDotInKeys!==void 0&&typeof e.decodeDotInKeys!=`boolean`)throw TypeError("`decodeDotInKeys` option can only be `true` or `false`, when provided");if(e.decoder!==null&&e.decoder!==void 0&&typeof e.decoder!=`function`)throw TypeError(`Decoder has to be a function.`);if(e.charset!==void 0&&e.charset!==`utf-8`&&e.charset!==`iso-8859-1`)throw TypeError(`The charset option must be either utf-8, iso-8859-1, or undefined`);if(e.throwOnLimitExceeded!==void 0&&typeof e.throwOnLimitExceeded!=`boolean`)throw TypeError("`throwOnLimitExceeded` option must be a boolean");var t=e.charset===void 0?a.charset:e.charset,r=e.duplicates===void 0?a.duplicates:e.duplicates;if(r!==`combine`&&r!==`first`&&r!==`last`)throw TypeError(`The duplicates option must be either combine, first, or last`);return{allowDots:e.allowDots===void 0?e.decodeDotInKeys===!0||a.allowDots:!!e.allowDots,allowEmptyArrays:typeof e.allowEmptyArrays==`boolean`?!!e.allowEmptyArrays:a.allowEmptyArrays,allowPrototypes:typeof e.allowPrototypes==`boolean`?e.allowPrototypes:a.allowPrototypes,allowSparse:typeof e.allowSparse==`boolean`?e.allowSparse:a.allowSparse,arrayLimit:typeof e.arrayLimit==`number`?e.arrayLimit:a.arrayLimit,charset:t,charsetSentinel:typeof e.charsetSentinel==`boolean`?e.charsetSentinel:a.charsetSentinel,comma:typeof e.comma==`boolean`?e.comma:a.comma,decodeDotInKeys:typeof e.decodeDotInKeys==`boolean`?e.decodeDotInKeys:a.decodeDotInKeys,decoder:typeof e.decoder==`function`?e.decoder:a.decoder,delimiter:typeof e.delimiter==`string`||n.isRegExp(e.delimiter)?e.delimiter:a.delimiter,depth:typeof e.depth==`number`||e.depth===!1?+e.depth:a.depth,duplicates:r,ignoreQueryPrefix:e.ignoreQueryPrefix===!0,interpretNumericEntities:typeof e.interpretNumericEntities==`boolean`?e.interpretNumericEntities:a.interpretNumericEntities,parameterLimit:typeof e.parameterLimit==`number`?e.parameterLimit:a.parameterLimit,parseArrays:e.parseArrays!==!1,plainObjects:typeof e.plainObjects==`boolean`?e.plainObjects:a.plainObjects,strictDepth:typeof e.strictDepth==`boolean`?!!e.strictDepth:a.strictDepth,strictMerge:typeof e.strictMerge==`boolean`?!!e.strictMerge:a.strictMerge,strictNullHandling:typeof e.strictNullHandling==`boolean`?e.strictNullHandling:a.strictNullHandling,throwOnLimitExceeded:typeof e.throwOnLimitExceeded==`boolean`&&e.throwOnLimitExceeded}};t.exports=function(e,t){var r=m(t);if(e===``||e==null)return r.plainObjects?{__proto__:null}:{};for(var i=typeof e==`string`?u(e,r):e,a=r.plainObjects?{__proto__:null}:{},o=Object.keys(i),s=0;s<o.length;++s){var c=o[s],l=p(c,i[c],r,typeof e==`string`);a=n.merge(a,l,r)}return r.allowSparse===!0?a:n.compact(a)}})),$e=n(((e,t)=>{var n=Ze(),r=Qe();t.exports={formats:Ye(),parse:r,stringify:n}})),et=n((e=>{var t=se();function n(){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 r=/^([a-z0-9.+-]+:)/i,i=/:[0-9]*$/,a=/^(\/\/?(?!\/)[^?\s]*)(\?[^\s]*)?$/,o=[`'`,`{`,`}`,`|`,`\\`,`^`,"`",`<`,`>`,`"`,"`",` `,`\r`,`
|
|
5
|
+
`,` `],s=[`%`,`/`,`?`,`;`,`#`].concat(o),c=[`/`,`?`,`#`],l=255,u=/^[+a-z0-9A-Z_-]{0,63}$/,d=/^([+a-z0-9A-Z_-]{0,63})(.*)$/,f={javascript:!0,"javascript:":!0},p={javascript:!0,"javascript:":!0},m={http:!0,https:!0,ftp:!0,gopher:!0,file:!0,"http:":!0,"https:":!0,"ftp:":!0,"gopher:":!0,"file:":!0},h=$e();function g(e,t,r){if(e&&typeof e==`object`&&e instanceof n)return e;var i=new n;return i.parse(e,t,r),i}n.prototype.parse=function(e,n,i){if(typeof e!=`string`)throw TypeError(`Parameter 'url' must be a string, not `+typeof e);var g=e.indexOf(`?`),_=g!==-1&&g<e.indexOf(`#`)?`?`:`#`,v=e.split(_);v[0]=v[0].replace(/\\/g,`/`),e=v.join(_);var y=e;if(y=y.trim(),!i&&e.split(`#`).length===1){var b=a.exec(y);if(b)return this.path=y,this.href=y,this.pathname=b[1],b[2]?(this.search=b[2],this.query=n?h.parse(this.search.substr(1)):this.search.substr(1)):n&&(this.search=``,this.query={}),this}var x=r.exec(y);if(x){x=x[0];var S=x.toLowerCase();this.protocol=S,y=y.substr(x.length)}if(i||x||y.match(/^\/\/[^@/]+@[^@/]+/)){var C=y.substr(0,2)===`//`;C&&!(x&&p[x])&&(y=y.substr(2),this.slashes=!0)}if(!p[x]&&(C||x&&!m[x])){for(var w=-1,T=0;T<c.length;T++){var E=y.indexOf(c[T]);E!==-1&&(w===-1||E<w)&&(w=E)}var D,O=w===-1?y.lastIndexOf(`@`):y.lastIndexOf(`@`,w);O!==-1&&(D=y.slice(0,O),y=y.slice(O+1),this.auth=decodeURIComponent(D)),w=-1;for(var T=0;T<s.length;T++){var E=y.indexOf(s[T]);E!==-1&&(w===-1||E<w)&&(w=E)}w===-1&&(w=y.length),this.host=y.slice(0,w),y=y.slice(w),this.parseHost(),this.hostname=this.hostname||``;var k=this.hostname[0]===`[`&&this.hostname[this.hostname.length-1]===`]`;if(!k)for(var A=this.hostname.split(/\./),T=0,j=A.length;T<j;T++){var M=A[T];if(M&&!M.match(u)){for(var N=``,P=0,F=M.length;P<F;P++)M.charCodeAt(P)>127?N+=`x`:N+=M[P];if(!N.match(u)){var I=A.slice(0,T),ee=A.slice(T+1),te=M.match(d);te&&(I.push(te[1]),ee.unshift(te[2])),ee.length&&(y=`/`+ee.join(`.`)+y),this.hostname=I.join(`.`);break}}}this.hostname=this.hostname.length>l?``:this.hostname.toLowerCase(),k||(this.hostname=t.toASCII(this.hostname));var ne=this.port?`:`+this.port:``,re=this.hostname||``;this.host=re+ne,this.href+=this.host,k&&(this.hostname=this.hostname.substr(1,this.hostname.length-2),y[0]!==`/`&&(y=`/`+y))}if(!f[S])for(var T=0,j=o.length;T<j;T++){var L=o[T];if(y.indexOf(L)!==-1){var ie=encodeURIComponent(L);ie===L&&(ie=escape(L)),y=y.split(L).join(ie)}}var R=y.indexOf(`#`);R!==-1&&(this.hash=y.substr(R),y=y.slice(0,R));var ae=y.indexOf(`?`);if(ae===-1?n&&(this.search=``,this.query={}):(this.search=y.substr(ae),this.query=y.substr(ae+1),n&&(this.query=h.parse(this.query)),y=y.slice(0,ae)),y&&(this.pathname=y),m[S]&&this.hostname&&!this.pathname&&(this.pathname=`/`),this.pathname||this.search){var ne=this.pathname||``,oe=this.search||``;this.path=ne+oe}return this.href=this.format(),this};function _(e){return typeof e==`string`&&(e=g(e)),e instanceof n?e.format():n.prototype.format.call(e)}n.prototype.format=function(){var e=this.auth||``;e&&(e=encodeURIComponent(e),e=e.replace(/%3A/i,`:`),e+=`@`);var t=this.protocol||``,n=this.pathname||``,r=this.hash||``,i=!1,a=``;this.host?i=e+this.host:this.hostname&&(i=e+(this.hostname.indexOf(`:`)===-1?this.hostname:`[`+this.hostname+`]`),this.port&&(i+=`:`+this.port)),this.query&&typeof this.query==`object`&&Object.keys(this.query).length&&(a=h.stringify(this.query,{arrayFormat:`repeat`,addQueryPrefix:!1}));var o=this.search||a&&`?`+a||``;return t&&t.substr(-1)!==`:`&&(t+=`:`),this.slashes||(!t||m[t])&&i!==!1?(i=`//`+(i||``),n&&n.charAt(0)!==`/`&&(n=`/`+n)):i||=``,r&&r.charAt(0)!==`#`&&(r=`#`+r),o&&o.charAt(0)!==`?`&&(o=`?`+o),n=n.replace(/[?#]/g,function(e){return encodeURIComponent(e)}),o=o.replace(`#`,`%23`),t+i+n+o+r};function v(e,t){return g(e,!1,!0).resolve(t)}n.prototype.resolve=function(e){return this.resolveObject(g(e,!1,!0)).format()},n.prototype.resolveObject=function(e){if(typeof e==`string`){var t=new n;t.parse(e,!1,!0),e=t}for(var r=new n,i=Object.keys(this),a=0;a<i.length;a++){var o=i[a];r[o]=this[o]}if(r.hash=e.hash,e.href===``)return r.href=r.format(),r;if(e.slashes&&!e.protocol){for(var s=Object.keys(e),c=0;c<s.length;c++){var l=s[c];l!==`protocol`&&(r[l]=e[l])}return m[r.protocol]&&r.hostname&&!r.pathname&&(r.pathname=`/`,r.path=r.pathname),r.href=r.format(),r}if(e.protocol&&e.protocol!==r.protocol){if(!m[e.protocol]){for(var u=Object.keys(e),d=0;d<u.length;d++){var f=u[d];r[f]=e[f]}return r.href=r.format(),r}if(r.protocol=e.protocol,!e.host&&!p[e.protocol]){for(var h=(e.pathname||``).split(`/`);h.length&&!(e.host=h.shift()););e.host||(e.host=``),e.hostname||(e.hostname=``),h[0]!==``&&h.unshift(``),h.length<2&&h.unshift(``),r.pathname=h.join(`/`)}else r.pathname=e.pathname;return r.search=e.search,r.query=e.query,r.host=e.host||``,r.auth=e.auth,r.hostname=e.hostname||e.host,r.port=e.port,(r.pathname||r.search)&&(r.path=(r.pathname||``)+(r.search||``)),r.slashes=r.slashes||e.slashes,r.href=r.format(),r}var g=r.pathname&&r.pathname.charAt(0)===`/`,_=e.host||e.pathname&&e.pathname.charAt(0)===`/`,v=_||g||r.host&&e.pathname,y=v,b=r.pathname&&r.pathname.split(`/`)||[],h=e.pathname&&e.pathname.split(`/`)||[],x=r.protocol&&!m[r.protocol];if(x&&(r.hostname=``,r.port=null,r.host&&(b[0]===``?b[0]=r.host:b.unshift(r.host)),r.host=``,e.protocol&&(e.hostname=null,e.port=null,e.host&&(h[0]===``?h[0]=e.host:h.unshift(e.host)),e.host=null),v&&=h[0]===``||b[0]===``),_)r.host=e.host||e.host===``?e.host:r.host,r.hostname=e.hostname||e.hostname===``?e.hostname:r.hostname,r.search=e.search,r.query=e.query,b=h;else if(h.length)b||=[],b.pop(),b=b.concat(h),r.search=e.search,r.query=e.query;else if(e.search!=null){if(x){r.host=b.shift(),r.hostname=r.host;var S=r.host&&r.host.indexOf(`@`)>0?r.host.split(`@`):!1;S&&(r.auth=S.shift(),r.hostname=S.shift(),r.host=r.hostname)}return r.search=e.search,r.query=e.query,(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:``)+(r.search?r.search:``)),r.href=r.format(),r}if(!b.length)return r.pathname=null,r.path=r.search?`/`+r.search:null,r.href=r.format(),r;for(var C=b.slice(-1)[0],w=(r.host||e.host||b.length>1)&&(C===`.`||C===`..`)||C===``,T=0,E=b.length;E>=0;E--)C=b[E],C===`.`?b.splice(E,1):C===`..`?(b.splice(E,1),T++):T&&(b.splice(E,1),T--);if(!v&&!y)for(;T--;)b.unshift(`..`);v&&b[0]!==``&&(!b[0]||b[0].charAt(0)!==`/`)&&b.unshift(``),w&&b.join(`/`).substr(-1)!==`/`&&b.push(``);var D=b[0]===``||b[0]&&b[0].charAt(0)===`/`;if(x){r.hostname=D?``:b.length?b.shift():``,r.host=r.hostname;var S=r.host&&r.host.indexOf(`@`)>0?r.host.split(`@`):!1;S&&(r.auth=S.shift(),r.hostname=S.shift(),r.host=r.hostname)}return v||=r.host&&b.length,v&&!D&&b.unshift(``),b.length>0?r.pathname=b.join(`/`):(r.pathname=null,r.path=null),(r.pathname!==null||r.search!==null)&&(r.path=(r.pathname?r.pathname:``)+(r.search?r.search:``)),r.auth=e.auth||r.auth,r.slashes=r.slashes||e.slashes,r.href=r.format(),r},n.prototype.parseHost=function(){var e=this.host,t=i.exec(e);t&&(t=t[0],t!==`:`&&(this.port=t.substr(1)),e=e.substr(0,e.length-t.length)),e&&(this.hostname=e)},e.parse=g,e.resolve=v,e.format=_})),tt=e(ae(),1),nt=e(oe(),1),rt=et(),it={};function z(e,t,n=3){if(it[t])return;let r=Error().stack;typeof r>`u`?console.warn(`PixiJS Deprecation Warning: `,`${t}
|
|
6
|
+
Deprecated since v${e}`):(r=r.split(`
|
|
7
|
+
`).splice(n).join(`
|
|
8
|
+
`),console.groupCollapsed?(console.groupCollapsed(`%cPixiJS Deprecation Warning: %c%s`,`color:#614108;background:#fffbe6`,`font-weight:normal;color:#614108;background:#fffbe6`,`${t}
|
|
9
|
+
Deprecated since v${e}`),console.warn(r),console.groupEnd()):(console.warn(`PixiJS Deprecation Warning: `,`${t}
|
|
10
|
+
Deprecated since v${e}`),console.warn(r))),it[t]=!0}var at={get parse(){return z(`7.3.0`,`utils.url.parse is deprecated, use native URL API instead.`),rt.parse},get format(){return z(`7.3.0`,`utils.url.format is deprecated, use native URL API instead.`),rt.format},get resolve(){return z(`7.3.0`,`utils.url.resolve is deprecated, use native URL API instead.`),rt.resolve}};function ot(e){if(typeof e!=`string`)throw TypeError(`Path must be a string. Received ${JSON.stringify(e)}`)}function st(e){return e.split(`?`)[0].split(`#`)[0]}function ct(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function lt(e,t,n){return e.replace(new RegExp(ct(t),`g`),n)}function ut(e,t){let n=``,r=0,i=-1,a=0,o=-1;for(let s=0;s<=e.length;++s){if(s<e.length)o=e.charCodeAt(s);else{if(o===47)break;o=47}if(o===47){if(i!==s-1&&a!==1){if(i!==s-1&&a===2){if(n.length<2||r!==2||n.charCodeAt(n.length-1)!==46||n.charCodeAt(n.length-2)!==46){if(n.length>2){let e=n.lastIndexOf(`/`);if(e!==n.length-1){e===-1?(n=``,r=0):(n=n.slice(0,e),r=n.length-1-n.lastIndexOf(`/`)),i=s,a=0;continue}}else if(n.length===2||n.length===1){n=``,r=0,i=s,a=0;continue}}t&&(n.length>0?n+=`/..`:n=`..`,r=2)}else n.length>0?n+=`/${e.slice(i+1,s)}`:n=e.slice(i+1,s),r=s-i-1}i=s,a=0}else o===46&&a!==-1?++a:a=-1}return n}var B={toPosix(e){return lt(e,`\\`,`/`)},isUrl(e){return/^https?:/.test(this.toPosix(e))},isDataUrl(e){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(e)},isBlobUrl(e){return e.startsWith(`blob:`)},hasProtocol(e){return/^[^/:]+:/.test(this.toPosix(e))},getProtocol(e){ot(e),e=this.toPosix(e);let t=/^file:\/\/\//.exec(e);if(t)return t[0];let n=/^[^/:]+:\/{0,2}/.exec(e);return n?n[0]:``},toAbsolute(e,t,n){if(ot(e),this.isDataUrl(e)||this.isBlobUrl(e))return e;let r=st(this.toPosix(t??w.ADAPTER.getBaseUrl())),i=st(this.toPosix(n??this.rootname(r)));return e=this.toPosix(e),e.startsWith(`/`)?B.join(i,e.slice(1)):this.isAbsolute(e)?e:this.join(r,e)},normalize(e){if(ot(e),e.length===0)return`.`;if(this.isDataUrl(e)||this.isBlobUrl(e))return e;e=this.toPosix(e);let t=``,n=e.startsWith(`/`);this.hasProtocol(e)&&(t=this.rootname(e),e=e.slice(t.length));let r=e.endsWith(`/`);return e=ut(e,!1),e.length>0&&r&&(e+=`/`),n?`/${e}`:t+e},isAbsolute(e){return ot(e),e=this.toPosix(e),this.hasProtocol(e)?!0:e.startsWith(`/`)},join(...e){if(e.length===0)return`.`;let t;for(let n=0;n<e.length;++n){let r=e[n];if(ot(r),r.length>0){if(t===void 0)t=r;else{let i=e[n-1]??``;this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}}return t===void 0?`.`:this.normalize(t)},dirname(e){if(ot(e),e.length===0)return`.`;e=this.toPosix(e);let t=e.charCodeAt(0),n=t===47,r=-1,i=!0,a=this.getProtocol(e),o=e;e=e.slice(a.length);for(let n=e.length-1;n>=1;--n)if(t=e.charCodeAt(n),t===47){if(!i){r=n;break}}else i=!1;return r===-1?n?`/`:this.isUrl(o)?a+e:a:n&&r===1?`//`:a+e.slice(0,r)},rootname(e){ot(e),e=this.toPosix(e);let t=``;if(t=e.startsWith(`/`)?`/`:this.getProtocol(e),this.isUrl(e)){let n=e.indexOf(`/`,t.length);t=n===-1?e:e.slice(0,n),t.endsWith(`/`)||(t+=`/`)}return t},basename(e,t){ot(e),t&&ot(t),e=st(this.toPosix(e));let n=0,r=-1,i=!0,a;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t.length===e.length&&t===e)return``;let o=t.length-1,s=-1;for(a=e.length-1;a>=0;--a){let c=e.charCodeAt(a);if(c===47){if(!i){n=a+1;break}}else s===-1&&(i=!1,s=a+1),o>=0&&(c===t.charCodeAt(o)?--o===-1&&(r=a):(o=-1,r=s))}return n===r?r=s:r===-1&&(r=e.length),e.slice(n,r)}for(a=e.length-1;a>=0;--a)if(e.charCodeAt(a)===47){if(!i){n=a+1;break}}else r===-1&&(i=!1,r=a+1);return r===-1?``:e.slice(n,r)},extname(e){ot(e),e=st(this.toPosix(e));let t=-1,n=0,r=-1,i=!0,a=0;for(let o=e.length-1;o>=0;--o){let s=e.charCodeAt(o);if(s===47){if(!i){n=o+1;break}continue}r===-1&&(i=!1,r=o+1),s===46?t===-1?t=o:a!==1&&(a=1):t!==-1&&(a=-1)}return t===-1||r===-1||a===0||a===1&&t===r-1&&t===n+1?``:e.slice(t,r)},parse(e){ot(e);let t={root:``,dir:``,base:``,ext:``,name:``};if(e.length===0)return t;e=st(this.toPosix(e));let n=e.charCodeAt(0),r=this.isAbsolute(e),i;t.root=this.rootname(e),i=r||this.hasProtocol(e)?1:0;let a=-1,o=0,s=-1,c=!0,l=e.length-1,u=0;for(;l>=i;--l){if(n=e.charCodeAt(l),n===47){if(!c){o=l+1;break}continue}s===-1&&(c=!1,s=l+1),n===46?a===-1?a=l:u!==1&&(u=1):a!==-1&&(u=-1)}return a===-1||s===-1||u===0||u===1&&a===s-1&&a===o+1?s!==-1&&(t.base=t.name=o===0&&r?e.slice(1,s):e.slice(o,s)):(o===0&&r?(t.name=e.slice(1,a),t.base=e.slice(1,s)):(t.name=e.slice(o,a),t.base=e.slice(o,s)),t.ext=e.slice(a,s)),t.dir=this.dirname(e),t},sep:`/`,delimiter:`:`,joinExtensions:[`.html`]},dt;async function ft(){return dt??=(async()=>{let e=document.createElement(`canvas`).getContext(`webgl`);if(!e)return h.UNPACK;let t=await new Promise(e=>{let t=document.createElement(`video`);t.onloadeddata=()=>e(t),t.onerror=()=>e(null),t.autoplay=!1,t.crossOrigin=`anonymous`,t.preload=`auto`,t.src=`data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=`,t.load()});if(!t)return h.UNPACK;let n=e.createTexture();e.bindTexture(e.TEXTURE_2D,n);let r=e.createFramebuffer();e.bindFramebuffer(e.FRAMEBUFFER,r),e.framebufferTexture2D(e.FRAMEBUFFER,e.COLOR_ATTACHMENT0,e.TEXTURE_2D,n,0),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.NONE),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t);let i=new Uint8Array(4);return e.readPixels(0,0,1,1,e.RGBA,e.UNSIGNED_BYTE,i),e.deleteFramebuffer(r),e.deleteTexture(n),e.getExtension(`WEBGL_lose_context`)?.loseContext(),i[0]<=i[3]?h.PMA:h.UNPACK})(),dt}function pt(){z(`7.0.0`,`skipHello is deprecated, please use settings.RENDER_OPTIONS.hello`)}function mt(){z(`7.0.0`,`sayHello is deprecated, please use Renderer's "hello" option`)}var ht;function gt(){return typeof ht>`u`&&(ht=function(){let e={stencil:!0,failIfMajorPerformanceCaveat:w.FAIL_IF_MAJOR_PERFORMANCE_CAVEAT};try{if(!w.ADAPTER.getWebGLRenderingContext())return!1;let t=w.ADAPTER.createCanvas(),n=t.getContext(`webgl`,e)||t.getContext(`experimental-webgl`,e),r=!!n?.getContextAttributes()?.stencil;if(n){let e=n.getExtension(`WEBGL_lose_context`);e&&e.loseContext()}return n=null,r}catch{return!1}}()),ht}var _t={grad:.9,turn:360,rad:360/(2*Math.PI)},vt=function(e){return typeof e==`string`?e.length>0:typeof e==`number`},V=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=10**t),Math.round(n*e)/n+0},yt=function(e,t,n){return t===void 0&&(t=0),n===void 0&&(n=1),e>n?n:e>t?e:t},bt=function(e){return(e=isFinite(e)?e%360:0)>0?e:e+360},xt=function(e){return{r:yt(e.r,0,255),g:yt(e.g,0,255),b:yt(e.b,0,255),a:yt(e.a)}},St=function(e){return{r:V(e.r),g:V(e.g),b:V(e.b),a:V(e.a,3)}},Ct=/^#([0-9a-f]{3,8})$/i,wt=function(e){var t=e.toString(16);return t.length<2?`0`+t:t},Tt=function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=Math.max(t,n,r),o=a-Math.min(t,n,r),s=o?a===t?(n-r)/o:a===n?2+(r-t)/o:4+(t-n)/o:0;return{h:60*(s<0?s+6:s),s:a?o/a*100:0,v:a/255*100,a:i}},Et=function(e){var t=e.h,n=e.s,r=e.v,i=e.a;t=t/360*6,n/=100,r/=100;var a=Math.floor(t),o=r*(1-n),s=r*(1-(t-a)*n),c=r*(1-(1-t+a)*n),l=a%6;return{r:255*[r,s,o,o,c,r][l],g:255*[c,r,r,s,o,o][l],b:255*[o,o,c,r,r,s][l],a:i}},Dt=function(e){return{h:bt(e.h),s:yt(e.s,0,100),l:yt(e.l,0,100),a:yt(e.a)}},Ot=function(e){return{h:V(e.h),s:V(e.s),l:V(e.l),a:V(e.a,3)}},kt=function(e){return Et((n=(t=e).s,{h:t.h,s:(n*=((r=t.l)<50?r:100-r)/100)>0?2*n/(r+n)*100:0,v:r+n,a:t.a}));var t,n,r},At=function(e){return{h:(t=Tt(e)).h,s:(i=(200-(n=t.s))*(r=t.v)/100)>0&&i<200?n*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,n,r,i},jt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Mt=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Nt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pt=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Ft={string:[[function(e){var t=Ct.exec(e);return t?(e=t[1]).length<=4?{r:parseInt(e[0]+e[0],16),g:parseInt(e[1]+e[1],16),b:parseInt(e[2]+e[2],16),a:e.length===4?V(parseInt(e[3]+e[3],16)/255,2):1}:e.length===6||e.length===8?{r:parseInt(e.substr(0,2),16),g:parseInt(e.substr(2,2),16),b:parseInt(e.substr(4,2),16),a:e.length===8?V(parseInt(e.substr(6,2),16)/255,2):1}:null:null},`hex`],[function(e){var t=Nt.exec(e)||Pt.exec(e);return t?t[2]!==t[4]||t[4]!==t[6]?null:xt({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(e){var t=jt.exec(e)||Mt.exec(e);if(!t)return null;var n,r;return kt(Dt({h:(n=t[1],r=t[2],r===void 0&&(r=`deg`),Number(n)*(_t[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)}))},`hsl`]],object:[[function(e){var t=e.r,n=e.g,r=e.b,i=e.a,a=i===void 0?1:i;return vt(t)&&vt(n)&&vt(r)?xt({r:Number(t),g:Number(n),b:Number(r),a:Number(a)}):null},`rgb`],[function(e){var t=e.h,n=e.s,r=e.l,i=e.a,a=i===void 0?1:i;return!vt(t)||!vt(n)||!vt(r)?null:kt(Dt({h:Number(t),s:Number(n),l:Number(r),a:Number(a)}))},`hsl`],[function(e){var t=e.h,n=e.s,r=e.v,i=e.a,a=i===void 0?1:i;return!vt(t)||!vt(n)||!vt(r)?null:Et(function(e){return{h:bt(e.h),s:yt(e.s,0,100),v:yt(e.v,0,100),a:yt(e.a)}}({h:Number(t),s:Number(n),v:Number(r),a:Number(a)}))},`hsv`]]},It=function(e,t){for(var n=0;n<t.length;n++){var r=t[n][0](e);if(r)return[r,t[n][1]]}return[null,void 0]},Lt=function(e){return typeof e==`string`?It(e.trim(),Ft.string):typeof e==`object`&&e?It(e,Ft.object):[null,void 0]},Rt=function(e,t){var n=At(e);return{h:n.h,s:yt(n.s+100*t,0,100),l:n.l,a:n.a}},zt=function(e){return(299*e.r+587*e.g+114*e.b)/1e3/255},Bt=function(e,t){var n=At(e);return{h:n.h,s:n.s,l:yt(n.l+100*t,0,100),a:n.a}},Vt=function(){function e(e){this.parsed=Lt(e)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return e.prototype.isValid=function(){return this.parsed!==null},e.prototype.brightness=function(){return V(zt(this.rgba),2)},e.prototype.isDark=function(){return zt(this.rgba)<.5},e.prototype.isLight=function(){return zt(this.rgba)>=.5},e.prototype.toHex=function(){return e=St(this.rgba),t=e.r,n=e.g,r=e.b,a=(i=e.a)<1?wt(V(255*i)):``,`#`+wt(t)+wt(n)+wt(r)+a;var e,t,n,r,i,a},e.prototype.toRgb=function(){return St(this.rgba)},e.prototype.toRgbString=function(){return e=St(this.rgba),t=e.r,n=e.g,r=e.b,(i=e.a)<1?`rgba(`+t+`, `+n+`, `+r+`, `+i+`)`:`rgb(`+t+`, `+n+`, `+r+`)`;var e,t,n,r,i},e.prototype.toHsl=function(){return Ot(At(this.rgba))},e.prototype.toHslString=function(){return e=Ot(At(this.rgba)),t=e.h,n=e.s,r=e.l,(i=e.a)<1?`hsla(`+t+`, `+n+`%, `+r+`%, `+i+`)`:`hsl(`+t+`, `+n+`%, `+r+`%)`;var e,t,n,r,i},e.prototype.toHsv=function(){return e=Tt(this.rgba),{h:V(e.h),s:V(e.s),v:V(e.v),a:V(e.a,3)};var e},e.prototype.invert=function(){return Ht({r:255-(e=this.rgba).r,g:255-e.g,b:255-e.b,a:e.a});var e},e.prototype.saturate=function(e){return e===void 0&&(e=.1),Ht(Rt(this.rgba,e))},e.prototype.desaturate=function(e){return e===void 0&&(e=.1),Ht(Rt(this.rgba,-e))},e.prototype.grayscale=function(){return Ht(Rt(this.rgba,-1))},e.prototype.lighten=function(e){return e===void 0&&(e=.1),Ht(Bt(this.rgba,e))},e.prototype.darken=function(e){return e===void 0&&(e=.1),Ht(Bt(this.rgba,-e))},e.prototype.rotate=function(e){return e===void 0&&(e=15),this.hue(this.hue()+e)},e.prototype.alpha=function(e){return typeof e==`number`?Ht({r:(t=this.rgba).r,g:t.g,b:t.b,a:e}):V(this.rgba.a,3);var t},e.prototype.hue=function(e){var t=At(this.rgba);return typeof e==`number`?Ht({h:e,s:t.s,l:t.l,a:t.a}):V(t.h)},e.prototype.isEqual=function(e){return this.toHex()===Ht(e).toHex()},e}(),Ht=function(e){return e instanceof Vt?e:new Vt(e)},Ut=[],Wt=function(e){e.forEach(function(e){Ut.indexOf(e)<0&&(e(Vt,Ft),Ut.push(e))})};function Gt(e,t){var n={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`},r={};for(var i in n)r[n[i]]=i;var a={};e.prototype.toName=function(t){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return`transparent`;var i,o,s=r[this.toHex()];if(s)return s;if(t?.closest){var c=this.toRgb(),l=1/0,u=`black`;if(!a.length)for(var d in n)a[d]=new e(n[d]).toRgb();for(var f in n){var p=(i=c,o=a[f],(i.r-o.r)**2+(i.g-o.g)**2+(i.b-o.b)**2);p<l&&(l=p,u=f)}return u}},t.string.push([function(t){var r=t.toLowerCase(),i=r===`transparent`?`#0000`:n[r];return i?new e(i).toRgb():null},`name`])}Wt([Gt]);var Kt=class e{constructor(e=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=e}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(e){return this.value=e,this}set value(t){if(t instanceof e)this._value=this.cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw Error(`Cannot set PIXI.Color#value to null`);(this._value===null||!this.isSourceEqual(this._value,t))&&(this.normalize(t),this._value=this.cloneSource(t))}}get value(){return this._value}cloneSource(e){return typeof e==`string`||typeof e==`number`||e instanceof Number||e===null?e:Array.isArray(e)||ArrayBuffer.isView(e)?e.slice(0):typeof e==`object`&&e?{...e}:e}isSourceEqual(e,t){let n=typeof e;if(n!==typeof t)return!1;if(n===`number`||n===`string`||e instanceof Number)return e===t;if(Array.isArray(e)&&Array.isArray(t)||ArrayBuffer.isView(e)&&ArrayBuffer.isView(t))return e.length===t.length&&e.every((e,n)=>e===t[n]);if(e!==null&&t!==null){let n=Object.keys(e),r=Object.keys(t);return n.length===r.length&&n.every(n=>e[n]===t[n])}return e===t}toRgba(){let[e,t,n,r]=this._components;return{r:e,g:t,b:n,a:r}}toRgb(){let[e,t,n]=this._components;return{r:e,g:t,b:n}}toRgbaString(){let[e,t,n]=this.toUint8RgbArray();return`rgba(${e},${t},${n},${this.alpha})`}toUint8RgbArray(e){let[t,n,r]=this._components;return e??=[],e[0]=Math.round(t*255),e[1]=Math.round(n*255),e[2]=Math.round(r*255),e}toRgbArray(e){e??=[];let[t,n,r]=this._components;return e[0]=t,e[1]=n,e[2]=r,e}toNumber(){return this._int}toLittleEndianNumber(){let e=this._int;return(e>>16)+(e&65280)+((e&255)<<16)}multiply(t){let[n,r,i,a]=e.temp.setValue(t)._components;return this._components[0]*=n,this._components[1]*=r,this._components[2]*=i,this._components[3]*=a,this.refreshInt(),this._value=null,this}premultiply(e,t=!0){return t&&(this._components[0]*=e,this._components[1]*=e,this._components[2]*=e),this._components[3]=e,this.refreshInt(),this._value=null,this}toPremultiplied(e,t=!0){if(e===1)return(255<<24)+this._int;if(e===0)return t?0:this._int;let n=this._int>>16&255,r=this._int>>8&255,i=this._int&255;return t&&(n=n*e+.5|0,r=r*e+.5|0,i=i*e+.5|0),(e*255<<24)+(n<<16)+(r<<8)+i}toHex(){let e=this._int.toString(16);return`#${`000000`.substring(0,6-e.length)+e}`}toHexa(){let e=Math.round(this._components[3]*255).toString(16);return this.toHex()+`00`.substring(0,2-e.length)+e}setAlpha(e){return this._components[3]=this._clamp(e),this}round(e){let[t,n,r]=this._components;return this._components[0]=Math.round(t*e)/e,this._components[1]=Math.round(n*e)/e,this._components[2]=Math.round(r*e)/e,this.refreshInt(),this._value=null,this}toArray(e){e??=[];let[t,n,r,i]=this._components;return e[0]=t,e[1]=n,e[2]=r,e[3]=i,e}normalize(t){let n,r,i,a;if((typeof t==`number`||t instanceof Number)&&t>=0&&t<=16777215){let e=t;n=(e>>16&255)/255,r=(e>>8&255)/255,i=(e&255)/255,a=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[n,r,i,a=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[n,r,i,a=255]=t,n/=255,r/=255,i/=255,a/=255;else if(typeof t==`string`||typeof t==`object`){if(typeof t==`string`){let n=e.HEX_PATTERN.exec(t);n&&(t=`#${n[2]}`)}let o=Ht(t);o.isValid()&&({r:n,g:r,b:i,a}=o.rgba,n/=255,r/=255,i/=255)}if(n!==void 0)this._components[0]=n,this._components[1]=r,this._components[2]=i,this._components[3]=a,this.refreshInt();else throw Error(`Unable to convert color ${t}`)}refreshInt(){this._clamp(this._components);let[e,t,n]=this._components;this._int=(e*255<<16)+(t*255<<8)+(n*255|0)}_clamp(e,t=0,n=1){return typeof e==`number`?Math.min(Math.max(e,t),n):(e.forEach((r,i)=>{e[i]=Math.min(Math.max(r,t),n)}),e)}};Kt.shared=new Kt,Kt.temp=new Kt,Kt.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;var H=Kt;function qt(e,t=[]){return z(`7.2.0`,`utils.hex2rgb is deprecated, use Color#toRgbArray instead`),H.shared.setValue(e).toRgbArray(t)}function Jt(e){return z(`7.2.0`,`utils.hex2string is deprecated, use Color#toHex instead`),H.shared.setValue(e).toHex()}function Yt(e){return z(`7.2.0`,`utils.string2hex is deprecated, use Color#toNumber instead`),H.shared.setValue(e).toNumber()}function Xt(e){return z(`7.2.0`,`utils.rgb2hex is deprecated, use Color#toNumber instead`),H.shared.setValue(e).toNumber()}function Zt(){let e=[],t=[];for(let n=0;n<32;n++)e[n]=n,t[n]=n;e[o.NORMAL_NPM]=o.NORMAL,e[o.ADD_NPM]=o.ADD,e[o.SCREEN_NPM]=o.SCREEN,t[o.NORMAL]=o.NORMAL_NPM,t[o.ADD]=o.ADD_NPM,t[o.SCREEN]=o.SCREEN_NPM;let n=[];return n.push(t),n.push(e),n}var Qt=Zt();function $t(e,t){return Qt[+!!t][e]}function en(e,t,n,r=!0){return z(`7.2.0`,`utils.premultiplyRgba has moved to Color.premultiply`),H.shared.setValue(e).premultiply(t,r).toArray(n??new Float32Array(4))}function tn(e,t){return z(`7.2.0`,`utils.premultiplyTint has moved to Color.toPremultiplied`),H.shared.setValue(e).toPremultiplied(t)}function nn(e,t,n,r=!0){return z(`7.2.0`,`utils.premultiplyTintToRgba has moved to Color.premultiply`),H.shared.setValue(e).premultiply(t,r).toArray(n??new Float32Array(4))}var rn=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i;function an(e,t=null){let n=e*6;if(t||=new Uint16Array(n),t.length!==n)throw Error(`Out buffer length is incorrect, got ${t.length} and expected ${n}`);for(let e=0,r=0;e<n;e+=6,r+=4)t[e+0]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3;return t}function on(e){if(e.BYTES_PER_ELEMENT===4)return e instanceof Float32Array?`Float32Array`:e instanceof Uint32Array?`Uint32Array`:`Int32Array`;if(e.BYTES_PER_ELEMENT===2){if(e instanceof Uint16Array)return`Uint16Array`}else if(e.BYTES_PER_ELEMENT===1&&e instanceof Uint8Array)return`Uint8Array`;return null}var sn={Float32Array,Uint32Array,Int32Array,Uint8Array};function cn(e,t){let n=0,r=0,i={};for(let i=0;i<e.length;i++)r+=t[i],n+=e[i].length;let a=new ArrayBuffer(n*4),o=null,s=0;for(let n=0;n<e.length;n++){let c=t[n],l=e[n],u=on(l);i[u]||(i[u]=new sn[u](a)),o=i[u];for(let e=0;e<l.length;e++){let t=(e/c|0)*r+s,n=e%c;o[t+n]=l[e]}s+=c}return new Float32Array(a)}function ln(e){return e+=+(e===0),--e,e|=e>>>1,e|=e>>>2,e|=e>>>4,e|=e>>>8,e|=e>>>16,e+1}function un(e){return!(e&e-1)&&!!e}function dn(e){let t=(e>65535)<<4;e>>>=t;let n=(e>255)<<3;return e>>>=n,t|=n,n=(e>15)<<2,e>>>=n,t|=n,n=(e>3)<<1,e>>>=n,t|=n,t|e>>1}function fn(e,t,n){let r=e.length,i;if(t>=r||n===0)return;n=t+n>r?r-t:n;let a=r-n;for(i=t;i<a;++i)e[i]=e[i+n];e.length=a}function pn(e){return e===0?0:e<0?-1:1}var mn=0;function hn(){return++mn}var gn=class{constructor(e,t,n,r){this.left=e,this.top=t,this.right=n,this.bottom=r}get width(){return this.right-this.left}get height(){return this.bottom-this.top}isEmpty(){return this.left===this.right||this.top===this.bottom}};gn.EMPTY=new gn(0,0,0,0);var _n=gn,vn={},yn=Object.create(null),bn=Object.create(null);function xn(){let e;for(e in yn)yn[e].destroy();for(e in bn)bn[e].destroy()}function Sn(){let e;for(e in yn)delete yn[e];for(e in bn)delete bn[e]}var Cn=class{constructor(e,t,n){this._canvas=w.ADAPTER.createCanvas(),this._context=this._canvas.getContext(`2d`),this.resolution=n||w.RESOLUTION,this.resize(e,t)}clear(){this._checkDestroyed(),this._context.setTransform(1,0,0,1,0,0),this._context.clearRect(0,0,this._canvas.width,this._canvas.height)}resize(e,t){this._checkDestroyed(),this._canvas.width=Math.round(e*this.resolution),this._canvas.height=Math.round(t*this.resolution)}destroy(){this._context=null,this._canvas=null}get width(){return this._checkDestroyed(),this._canvas.width}set width(e){this._checkDestroyed(),this._canvas.width=Math.round(e)}get height(){return this._checkDestroyed(),this._canvas.height}set height(e){this._checkDestroyed(),this._canvas.height=Math.round(e)}get canvas(){return this._checkDestroyed(),this._canvas}get context(){return this._checkDestroyed(),this._context}_checkDestroyed(){if(this._canvas===null)throw TypeError(`The CanvasRenderTarget has already been destroyed`)}};function wn(e,t,n){for(let r=0,i=4*n*t;r<t;++r,i+=4)if(e[i+3]!==0)return!1;return!0}function Tn(e,t,n,r,i){let a=4*t;for(let t=r,o=r*a+4*n;t<=i;++t,o+=a)if(e[o+3]!==0)return!1;return!0}function En(e){let{width:t,height:n}=e,r=e.getContext(`2d`,{willReadFrequently:!0});if(r===null)throw TypeError(`Failed to get canvas 2D context`);let i=r.getImageData(0,0,t,n).data,a=0,o=0,s=t-1,c=n-1;for(;o<n&&wn(i,t,o);)++o;if(o===n)return _n.EMPTY;for(;wn(i,t,c);)--c;for(;Tn(i,t,a,o,c);)++a;for(;Tn(i,t,s,o,c);)--s;return++s,++c,new _n(a,o,s,c)}function Dn(e){let t=En(e),{width:n,height:r}=t,i=null;if(!t.isEmpty()){let a=e.getContext(`2d`);if(a===null)throw TypeError(`Failed to get canvas 2D context`);i=a.getImageData(t.left,t.top,n,r)}return{width:n,height:r,data:i}}function On(e){let t=rn.exec(e);if(t)return{mediaType:t[1]?t[1].toLowerCase():void 0,subType:t[2]?t[2].toLowerCase():void 0,charset:t[3]?t[3].toLowerCase():void 0,encoding:t[4]?t[4].toLowerCase():void 0,data:t[5]}}function kn(e,t=globalThis.location){if(e.startsWith(`data:`))return``;t||=globalThis.location;let n=new URL(e,document.baseURI);return n.hostname!==t.hostname||n.port!==t.port||n.protocol!==t.protocol?`anonymous`:``}function An(e,t=1){let n=w.RETINA_PREFIX?.exec(e);return n?parseFloat(n[1]):t}var jn=t({BaseTextureCache:()=>bn,BoundingBox:()=>_n,CanvasRenderTarget:()=>Cn,DATA_URI:()=>rn,EventEmitter:()=>tt.default,ProgramCache:()=>vn,TextureCache:()=>yn,clearTextureCache:()=>Sn,correctBlendMode:()=>$t,createIndicesForQuads:()=>an,decomposeDataUri:()=>On,deprecation:()=>z,destroyTextureCache:()=>xn,detectVideoAlphaMode:()=>ft,determineCrossOrigin:()=>kn,earcut:()=>nt.default,getBufferType:()=>on,getCanvasBoundingBox:()=>En,getResolutionOfUrl:()=>An,hex2rgb:()=>qt,hex2string:()=>Jt,interleaveTypedArrays:()=>cn,isMobile:()=>R,isPow2:()=>un,isWebGLSupported:()=>gt,log2:()=>dn,nextPow2:()=>ln,path:()=>B,premultiplyBlendMode:()=>Qt,premultiplyRgba:()=>en,premultiplyTint:()=>tn,premultiplyTintToRgba:()=>nn,removeItems:()=>fn,rgb2hex:()=>Xt,sayHello:()=>mt,sign:()=>pn,skipHello:()=>pt,string2hex:()=>Yt,trimCanvas:()=>Dn,uid:()=>hn,url:()=>at}),U=(e=>(e.Renderer=`renderer`,e.Application=`application`,e.RendererSystem=`renderer-webgl-system`,e.RendererPlugin=`renderer-webgl-plugin`,e.CanvasRendererSystem=`renderer-canvas-system`,e.CanvasRendererPlugin=`renderer-canvas-plugin`,e.Asset=`asset`,e.LoadParser=`load-parser`,e.ResolveParser=`resolve-parser`,e.CacheParser=`cache-parser`,e.DetectionParser=`detection-parser`,e))(U||{}),Mn=e=>{if(typeof e==`function`||typeof e==`object`&&e.extension){if(!e.extension)throw Error(`Extension class must have an extension object`);e={...typeof e.extension==`object`?e.extension:{type:e.extension},ref:e}}if(typeof e==`object`)e={...e};else throw Error(`Invalid extension type`);return typeof e.type==`string`&&(e.type=[e.type]),e},Nn=(e,t)=>Mn(e).priority??t,W={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...e){return e.map(Mn).forEach(e=>{e.type.forEach(t=>this._removeHandlers[t]?.(e))}),this},add(...e){return e.map(Mn).forEach(e=>{e.type.forEach(t=>{let n=this._addHandlers,r=this._queue;n[t]?n[t]?.(e):(r[t]=r[t]||[],r[t]?.push(e))})}),this},handle(e,t,n){let r=this._addHandlers,i=this._removeHandlers;if(r[e]||i[e])throw Error(`Extension type ${e} already has a handler`);r[e]=t,i[e]=n;let a=this._queue;return a[e]&&(a[e]?.forEach(e=>t(e)),delete a[e]),this},handleByMap(e,t){return this.handle(e,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByList(e,t,n=-1){return this.handle(e,e=>{t.includes(e.ref)||(t.push(e.ref),t.sort((e,t)=>Nn(t,n)-Nn(e,n)))},e=>{let n=t.indexOf(e.ref);n!==-1&&t.splice(n,1)})}},Pn=class{constructor(e){this.rawBinaryData=typeof e==`number`?new ArrayBuffer(e):e instanceof Uint8Array?e.buffer:e,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData)}get int8View(){return this._int8View||=new Int8Array(this.rawBinaryData),this._int8View}get uint8View(){return this._uint8View||=new Uint8Array(this.rawBinaryData),this._uint8View}get int16View(){return this._int16View||=new Int16Array(this.rawBinaryData),this._int16View}get uint16View(){return this._uint16View||=new Uint16Array(this.rawBinaryData),this._uint16View}get int32View(){return this._int32View||=new Int32Array(this.rawBinaryData),this._int32View}view(e){return this[`${e}View`]}destroy(){this.rawBinaryData=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._uint16View=null,this._int32View=null,this.uint32View=null,this.float32View=null}static sizeOf(e){switch(e){case`int8`:case`uint8`:return 1;case`int16`:case`uint16`:return 2;case`int32`:case`uint32`:case`float32`:return 4;default:throw Error(`${e} isn't a valid view type`)}}},Fn=[`precision mediump float;`,`void main(void){`,`float test = 0.1;`,`%forloop%`,`gl_FragColor = vec4(0.0);`,`}`].join(`
|
|
11
|
+
`);function In(e){let t=``;for(let n=0;n<e;++n)n>0&&(t+=`
|
|
12
|
+
else `),n<e-1&&(t+=`if(test == ${n}.0){}`);return t}function Ln(e,t){if(e===0)throw Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");let n=t.createShader(t.FRAGMENT_SHADER);for(;;){let r=Fn.replace(/%forloop%/gi,In(e));if(t.shaderSource(n,r),t.compileShader(n),!t.getShaderParameter(n,t.COMPILE_STATUS))e=e/2|0;else break}return e}var Rn=class e{constructor(){this.data=0,this.blendMode=o.NORMAL,this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1)}set blend(e){!!(this.data&1)!==e&&(this.data^=1)}get offsets(){return!!(this.data&2)}set offsets(e){!!(this.data&2)!==e&&(this.data^=2)}get culling(){return!!(this.data&4)}set culling(e){!!(this.data&4)!==e&&(this.data^=4)}get depthTest(){return!!(this.data&8)}set depthTest(e){!!(this.data&8)!==e&&(this.data^=8)}get depthMask(){return!!(this.data&32)}set depthMask(e){!!(this.data&32)!==e&&(this.data^=32)}get clockwiseFrontFace(){return!!(this.data&16)}set clockwiseFrontFace(e){!!(this.data&16)!==e&&(this.data^=16)}get blendMode(){return this._blendMode}set blendMode(e){this.blend=e!==o.NONE,this._blendMode=e}get polygonOffset(){return this._polygonOffset}set polygonOffset(e){this.offsets=!!e,this._polygonOffset=e}static for2d(){let t=new e;return t.depthTest=!1,t.blend=!0,t}};Rn.prototype.toString=function(){return`[@pixi/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`};var zn=[];function Bn(e,t){if(!e)return null;let n=``;if(typeof e==`string`){let t=/\.(\w{3,4})(?:$|\?|#)/i.exec(e);t&&(n=t[1].toLowerCase())}for(let r=zn.length-1;r>=0;--r){let i=zn[r];if(i.test&&i.test(e,n))return new i(e,t)}throw Error(`Unrecognized source type to auto-detect Resource`)}var Vn=class{constructor(e){this.items=[],this._name=e,this._aliasCount=0}emit(e,t,n,r,i,a,o,s){if(arguments.length>8)throw Error(`max arguments reached`);let{name:c,items:l}=this;this._aliasCount++;for(let u=0,d=l.length;u<d;u++)l[u][c](e,t,n,r,i,a,o,s);return l===this.items&&this._aliasCount--,this}ensureNonAliasedItems(){this._aliasCount>0&&this.items.length>1&&(this._aliasCount=0,this.items=this.items.slice(0))}add(e){return e[this._name]&&(this.ensureNonAliasedItems(),this.remove(e),this.items.push(e)),this}remove(e){let t=this.items.indexOf(e);return t!==-1&&(this.ensureNonAliasedItems(),this.items.splice(t,1)),this}contains(e){return this.items.includes(e)}removeAll(){return this.ensureNonAliasedItems(),this.items.length=0,this}destroy(){this.removeAll(),this.items.length=0,this._name=``}get empty(){return this.items.length===0}get name(){return this._name}};Object.defineProperties(Vn.prototype,{dispatch:{value:Vn.prototype.emit},run:{value:Vn.prototype.emit}});var Hn=class{constructor(e=0,t=0){this._width=e,this._height=t,this.destroyed=!1,this.internal=!1,this.onResize=new Vn(`setRealSize`),this.onUpdate=new Vn(`update`),this.onError=new Vn(`onError`)}bind(e){this.onResize.add(e),this.onUpdate.add(e),this.onError.add(e),(this._width||this._height)&&this.onResize.emit(this._width,this._height)}unbind(e){this.onResize.remove(e),this.onUpdate.remove(e),this.onError.remove(e)}resize(e,t){(e!==this._width||t!==this._height)&&(this._width=e,this._height=t,this.onResize.emit(e,t))}get valid(){return!!this._width&&!!this._height}update(){this.destroyed||this.onUpdate.emit()}load(){return Promise.resolve(this)}get width(){return this._width}get height(){return this._height}style(e,t,n){return!1}dispose(){}destroy(){this.destroyed||(this.destroyed=!0,this.dispose(),this.onError.removeAll(),this.onError=null,this.onResize.removeAll(),this.onResize=null,this.onUpdate.removeAll(),this.onUpdate=null)}static test(e,t){return!1}},Un=class extends Hn{constructor(e,t){let{width:n,height:r}=t||{};if(!n||!r)throw Error(`BufferResource width or height invalid`);super(n,r),this.data=e,this.unpackAlignment=t.unpackAlignment??4}upload(e,t,n){let r=e.gl;r.pixelStorei(r.UNPACK_ALIGNMENT,this.unpackAlignment),r.pixelStorei(r.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===h.UNPACK);let i=t.realWidth,a=t.realHeight;return n.width===i&&n.height===a?r.texSubImage2D(t.target,0,0,0,i,a,t.format,n.type,this.data):(n.width=i,n.height=a,r.texImage2D(t.target,0,n.internalFormat,i,a,0,t.format,n.type,this.data)),!0}dispose(){this.data=null}static test(e){return e===null||e instanceof Int8Array||e instanceof Uint8Array||e instanceof Uint8ClampedArray||e instanceof Int16Array||e instanceof Uint16Array||e instanceof Int32Array||e instanceof Uint32Array||e instanceof Float32Array}},Wn={scaleMode:f.NEAREST,alphaMode:h.NPM},Gn=class e extends tt.default{constructor(t=null,n=null){super(),n=Object.assign({},e.defaultOptions,n);let{alphaMode:r,mipmap:i,anisotropicLevel:a,scaleMode:o,width:s,height:c,wrapMode:l,format:u,type:d,target:f,resolution:p,resourceOptions:m}=n;t&&!(t instanceof Hn)&&(t=Bn(t,m),t.internal=!0),this.resolution=p||w.RESOLUTION,this.width=Math.round((s||0)*this.resolution)/this.resolution,this.height=Math.round((c||0)*this.resolution)/this.resolution,this._mipmap=i,this.anisotropicLevel=a,this._wrapMode=l,this._scaleMode=o,this.format=u,this.type=d,this.target=f,this.alphaMode=r,this.uid=hn(),this.touched=0,this.isPowerOfTwo=!1,this._refreshPOT(),this._glTextures={},this.dirtyId=0,this.dirtyStyleId=0,this.cacheId=null,this.valid=s>0&&c>0,this.textureCacheIds=[],this.destroyed=!1,this.resource=null,this._batchEnabled=0,this._batchLocation=0,this.parentTextureArray=null,this.setResource(t)}get realWidth(){return Math.round(this.width*this.resolution)}get realHeight(){return Math.round(this.height*this.resolution)}get mipmap(){return this._mipmap}set mipmap(e){this._mipmap!==e&&(this._mipmap=e,this.dirtyStyleId++)}get scaleMode(){return this._scaleMode}set scaleMode(e){this._scaleMode!==e&&(this._scaleMode=e,this.dirtyStyleId++)}get wrapMode(){return this._wrapMode}set wrapMode(e){this._wrapMode!==e&&(this._wrapMode=e,this.dirtyStyleId++)}setStyle(e,t){let n;return e!==void 0&&e!==this.scaleMode&&(this.scaleMode=e,n=!0),t!==void 0&&t!==this.mipmap&&(this.mipmap=t,n=!0),n&&this.dirtyStyleId++,this}setSize(e,t,n){return n||=this.resolution,this.setRealSize(e*n,t*n,n)}setRealSize(e,t,n){return this.resolution=n||this.resolution,this.width=Math.round(e)/this.resolution,this.height=Math.round(t)/this.resolution,this._refreshPOT(),this.update(),this}_refreshPOT(){this.isPowerOfTwo=un(this.realWidth)&&un(this.realHeight)}setResolution(e){let t=this.resolution;return t===e?this:(this.resolution=e,this.valid&&(this.width=Math.round(this.width*t)/e,this.height=Math.round(this.height*t)/e,this.emit(`update`,this)),this._refreshPOT(),this)}setResource(e){if(this.resource===e)return this;if(this.resource)throw Error(`Resource can be set only once`);return e.bind(this),this.resource=e,this}update(){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))}onError(e){this.emit(`error`,this,e)}destroy(){this.resource&&=(this.resource.unbind(this),this.resource.internal&&this.resource.destroy(),null),this.cacheId&&=(delete bn[this.cacheId],delete yn[this.cacheId],null),this.valid=!1,this.dispose(),e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit(`destroyed`,this),this.removeAllListeners()}dispose(){this.emit(`dispose`,this)}castToBaseTexture(){return this}static from(t,n,r=w.STRICT_TEXTURE_CACHE){let i=typeof t==`string`,a=null;i?a=t:(t._pixiId||=`${n?.pixiIdPrefix||`pixiid`}_${hn()}`,a=t._pixiId);let o=bn[a];if(i&&r&&!o)throw Error(`The cacheId "${a}" does not exist in BaseTextureCache.`);return o||(o=new e(t,n),o.cacheId=a,e.addToCache(o,a)),o}static fromBuffer(t,n,r,i){t||=new Float32Array(n*r*4);let a=new Un(t,{width:n,height:r,...i?.resourceOptions}),o,s;return t instanceof Float32Array?(o=c.RGBA,s=u.FLOAT):t instanceof Int32Array?(o=c.RGBA_INTEGER,s=u.INT):t instanceof Uint32Array?(o=c.RGBA_INTEGER,s=u.UNSIGNED_INT):t instanceof Int16Array?(o=c.RGBA_INTEGER,s=u.SHORT):t instanceof Uint16Array?(o=c.RGBA_INTEGER,s=u.UNSIGNED_SHORT):t instanceof Int8Array?(o=c.RGBA,s=u.BYTE):(o=c.RGBA,s=u.UNSIGNED_BYTE),a.internal=!0,new e(a,Object.assign({},Wn,{type:s,format:o},i))}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),bn[t]&&bn[t]!==e&&console.warn(`BaseTexture added to the cache with an id [${t}] that already had an entry`),bn[t]=e)}static removeFromCache(e){if(typeof e==`string`){let t=bn[e];if(t){let n=t.textureCacheIds.indexOf(e);return n>-1&&t.textureCacheIds.splice(n,1),delete bn[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)delete bn[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}};Gn.defaultOptions={mipmap:m.POW2,anisotropicLevel:0,scaleMode:f.LINEAR,wrapMode:p.CLAMP,alphaMode:h.UNPACK,target:l.TEXTURE_2D,format:c.RGBA,type:u.UNSIGNED_BYTE},Gn._globalBatch=0;var G=Gn,Kn=class{constructor(){this.texArray=null,this.blend=0,this.type=s.TRIANGLES,this.start=0,this.size=0,this.data=null}},qn=0,K=class e{constructor(e,t=!0,n=!1){this.data=e||new Float32Array(1),this._glBuffers={},this._updateID=0,this.index=n,this.static=t,this.id=qn++,this.disposeRunner=new Vn(`disposeBuffer`)}update(e){e instanceof Array&&(e=new Float32Array(e)),this.data=e||this.data,this._updateID++}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.data=null}set index(e){this.type=e?S.ELEMENT_ARRAY_BUFFER:S.ARRAY_BUFFER}get index(){return this.type===S.ELEMENT_ARRAY_BUFFER}static from(t){return t instanceof Array&&(t=new Float32Array(t)),new e(t)}},Jn=class e{constructor(e,t=0,n=!1,r=u.FLOAT,i,a,o,s=1){this.buffer=e,this.size=t,this.normalized=n,this.type=r,this.stride=i,this.start=a,this.instance=o,this.divisor=s}destroy(){this.buffer=null}static from(t,n,r,i,a){return new e(t,n,r,i,a)}},Yn={Float32Array,Uint32Array,Int32Array,Uint8Array};function Xn(e,t){let n=0,r=0,i={};for(let i=0;i<e.length;i++)r+=t[i],n+=e[i].length;let a=new ArrayBuffer(n*4),o=null,s=0;for(let n=0;n<e.length;n++){let c=t[n],l=e[n],u=on(l);i[u]||(i[u]=new Yn[u](a)),o=i[u];for(let e=0;e<l.length;e++){let t=(e/c|0)*r+s,n=e%c;o[t+n]=l[e]}s+=c}return new Float32Array(a)}var Zn={5126:4,5123:2,5121:1},Qn=0,$n={Float32Array,Uint32Array,Int32Array,Uint8Array,Uint16Array},er=class e{constructor(e=[],t={}){this.buffers=e,this.indexBuffer=null,this.attributes=t,this.glVertexArrayObjects={},this.id=Qn++,this.instanced=!1,this.instanceCount=1,this.disposeRunner=new Vn(`disposeGeometry`),this.refCount=0}addAttribute(e,t,n=0,r=!1,i,a,o,s=!1){if(!t)throw Error(`You must pass a buffer when creating an attribute`);t instanceof K||(t instanceof Array&&(t=new Float32Array(t)),t=new K(t));let c=e.split(`|`);if(c.length>1){for(let e=0;e<c.length;e++)this.addAttribute(c[e],t,n,r,i);return this}let l=this.buffers.indexOf(t);return l===-1&&(this.buffers.push(t),l=this.buffers.length-1),this.attributes[e]=new Jn(l,n,r,i,a,o,s),this.instanced=this.instanced||s,this}getAttribute(e){return this.attributes[e]}getBuffer(e){return this.buffers[this.getAttribute(e).buffer]}addIndex(e){return e instanceof K||(e instanceof Array&&(e=new Uint16Array(e)),e=new K(e)),e.type=S.ELEMENT_ARRAY_BUFFER,this.indexBuffer=e,this.buffers.includes(e)||this.buffers.push(e),this}getIndex(){return this.indexBuffer}interleave(){if(this.buffers.length===1||this.buffers.length===2&&this.indexBuffer)return this;let e=[],t=[],n=new K,r;for(r in this.attributes){let n=this.attributes[r],i=this.buffers[n.buffer];e.push(i.data),t.push(n.size*Zn[n.type]/4),n.buffer=0}for(n.data=Xn(e,t),r=0;r<this.buffers.length;r++)this.buffers[r]!==this.indexBuffer&&this.buffers[r].destroy();return this.buffers=[n],this.indexBuffer&&this.buffers.push(this.indexBuffer),this}getSize(){for(let e in this.attributes){let t=this.attributes[e];return this.buffers[t.buffer].data.length/(t.stride/4||t.size)}return 0}dispose(){this.disposeRunner.emit(this,!1)}destroy(){this.dispose(),this.buffers=null,this.indexBuffer=null,this.attributes=null}clone(){let t=new e;for(let e=0;e<this.buffers.length;e++)t.buffers[e]=new K(this.buffers[e].data.slice(0));for(let e in this.attributes){let n=this.attributes[e];t.attributes[e]=new Jn(n.buffer,n.size,n.normalized,n.type,n.stride,n.start,n.instance)}return this.indexBuffer&&(t.indexBuffer=t.buffers[this.buffers.indexOf(this.indexBuffer)],t.indexBuffer.type=S.ELEMENT_ARRAY_BUFFER),t}static merge(t){let n=new e,r=[],i=[],a=[],o;for(let e=0;e<t.length;e++){o=t[e];for(let e=0;e<o.buffers.length;e++)i[e]=i[e]||0,i[e]+=o.buffers[e].data.length,a[e]=0}for(let e=0;e<o.buffers.length;e++)r[e]=new $n[on(o.buffers[e].data)](i[e]),n.buffers[e]=new K(r[e]);for(let e=0;e<t.length;e++){o=t[e];for(let e=0;e<o.buffers.length;e++)r[e].set(o.buffers[e].data,a[e]),a[e]+=o.buffers[e].data.length}if(n.attributes=o.attributes,o.indexBuffer){n.indexBuffer=n.buffers[o.buffers.indexOf(o.indexBuffer)],n.indexBuffer.type=S.ELEMENT_ARRAY_BUFFER;let e=0,r=0,i=0,a=0;for(let e=0;e<o.buffers.length;e++)if(o.buffers[e]!==o.indexBuffer){a=e;break}for(let e in o.attributes){let t=o.attributes[e];(t.buffer|0)===a&&(r+=t.size*Zn[t.type]/4)}for(let o=0;o<t.length;o++){let s=t[o].indexBuffer.data;for(let t=0;t<s.length;t++)n.indexBuffer.data[t+i]+=e;e+=t[o].buffers[a].data.length/r,i+=s.length}}return n}},tr=class extends er{constructor(e=!1){super(),this._buffer=new K(null,e,!1),this._indexBuffer=new K(null,e,!0),this.addAttribute(`aVertexPosition`,this._buffer,2,!1,u.FLOAT).addAttribute(`aTextureCoord`,this._buffer,2,!1,u.FLOAT).addAttribute(`aColor`,this._buffer,4,!0,u.UNSIGNED_BYTE).addAttribute(`aTextureId`,this._buffer,1,!0,u.FLOAT).addIndex(this._indexBuffer)}},nr=Math.PI*2,rr=180/Math.PI,ir=Math.PI/180,q=(e=>(e[e.POLY=0]=`POLY`,e[e.RECT=1]=`RECT`,e[e.CIRC=2]=`CIRC`,e[e.ELIP=3]=`ELIP`,e[e.RREC=4]=`RREC`,e))(q||{}),J=class e{constructor(e=0,t=0){this.x=0,this.y=0,this.x=e,this.y=t}clone(){return new e(this.x,this.y)}copyFrom(e){return this.set(e.x,e.y),this}copyTo(e){return e.set(this.x,this.y),e}equals(e){return e.x===this.x&&e.y===this.y}set(e=0,t=e){return this.x=e,this.y=t,this}};J.prototype.toString=function(){return`[@pixi/math:Point x=${this.x} y=${this.y}]`};var ar=[new J,new J,new J,new J],Y=class e{constructor(e=0,t=0,n=0,r=0){this.x=Number(e),this.y=Number(t),this.width=Number(n),this.height=Number(r),this.type=q.RECT}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}static get EMPTY(){return new e(0,0,0,0)}clone(){return new e(this.x,this.y,this.width,this.height)}copyFrom(e){return this.x=e.x,this.y=e.y,this.width=e.width,this.height=e.height,this}copyTo(e){return e.x=this.x,e.y=this.y,e.width=this.width,e.height=this.height,e}contains(e,t){return this.width<=0||this.height<=0?!1:e>=this.x&&e<this.x+this.width&&t>=this.y&&t<this.y+this.height}intersects(e,t){if(!t){let t=this.x<e.x?e.x:this.x;if((this.right>e.right?e.right:this.right)<=t)return!1;let n=this.y<e.y?e.y:this.y;return(this.bottom>e.bottom?e.bottom:this.bottom)>n}let n=this.left,r=this.right,i=this.top,a=this.bottom;if(r<=n||a<=i)return!1;let o=ar[0].set(e.left,e.top),s=ar[1].set(e.left,e.bottom),c=ar[2].set(e.right,e.top),l=ar[3].set(e.right,e.bottom);if(c.x<=o.x||s.y<=o.y)return!1;let u=Math.sign(t.a*t.d-t.b*t.c);if(u===0||(t.apply(o,o),t.apply(s,s),t.apply(c,c),t.apply(l,l),Math.max(o.x,s.x,c.x,l.x)<=n||Math.min(o.x,s.x,c.x,l.x)>=r||Math.max(o.y,s.y,c.y,l.y)<=i||Math.min(o.y,s.y,c.y,l.y)>=a))return!1;let d=u*(s.y-o.y),f=u*(o.x-s.x),p=d*n+f*i,m=d*r+f*i,h=d*n+f*a,g=d*r+f*a;if(Math.max(p,m,h,g)<=d*o.x+f*o.y||Math.min(p,m,h,g)>=d*l.x+f*l.y)return!1;let _=u*(o.y-c.y),v=u*(c.x-o.x),y=_*n+v*i,b=_*r+v*i,x=_*n+v*a,S=_*r+v*a;return!(Math.max(y,b,x,S)<=_*o.x+v*o.y||Math.min(y,b,x,S)>=_*l.x+v*l.y)}pad(e=0,t=e){return this.x-=e,this.y-=t,this.width+=e*2,this.height+=t*2,this}fit(e){let t=Math.max(this.x,e.x),n=Math.min(this.x+this.width,e.x+e.width),r=Math.max(this.y,e.y),i=Math.min(this.y+this.height,e.y+e.height);return this.x=t,this.width=Math.max(n-t,0),this.y=r,this.height=Math.max(i-r,0),this}ceil(e=1,t=.001){let n=Math.ceil((this.x+this.width-t)*e)/e,r=Math.ceil((this.y+this.height-t)*e)/e;return this.x=Math.floor((this.x+t)*e)/e,this.y=Math.floor((this.y+t)*e)/e,this.width=n-this.x,this.height=r-this.y,this}enlarge(e){let t=Math.min(this.x,e.x),n=Math.max(this.x+this.width,e.x+e.width),r=Math.min(this.y,e.y),i=Math.max(this.y+this.height,e.y+e.height);return this.x=t,this.width=n-t,this.y=r,this.height=i-r,this}};Y.prototype.toString=function(){return`[@pixi/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var or=class e{constructor(e=0,t=0,n=0){this.x=e,this.y=t,this.radius=n,this.type=q.CIRC}clone(){return new e(this.x,this.y,this.radius)}contains(e,t){if(this.radius<=0)return!1;let n=this.radius*this.radius,r=this.x-e,i=this.y-t;return r*=r,i*=i,r+i<=n}getBounds(){return new Y(this.x-this.radius,this.y-this.radius,this.radius*2,this.radius*2)}};or.prototype.toString=function(){return`[@pixi/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`};var sr=class e{constructor(e=0,t=0,n=0,r=0){this.x=e,this.y=t,this.width=n,this.height=r,this.type=q.ELIP}clone(){return new e(this.x,this.y,this.width,this.height)}contains(e,t){if(this.width<=0||this.height<=0)return!1;let n=(e-this.x)/this.width,r=(t-this.y)/this.height;return n*=n,r*=r,n+r<=1}getBounds(){return new Y(this.x-this.width,this.y-this.height,this.width,this.height)}};sr.prototype.toString=function(){return`[@pixi/math:Ellipse x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`};var cr=class e{constructor(...e){let t=Array.isArray(e[0])?e[0]:e;if(typeof t[0]!=`number`){let e=[];for(let n=0,r=t.length;n<r;n++)e.push(t[n].x,t[n].y);t=e}this.points=t,this.type=q.POLY,this.closeStroke=!0}clone(){let t=this.points.slice(),n=new e(t);return n.closeStroke=this.closeStroke,n}contains(e,t){let n=!1,r=this.points.length/2;for(let i=0,a=r-1;i<r;a=i++){let r=this.points[i*2],o=this.points[i*2+1],s=this.points[a*2],c=this.points[a*2+1];o>t!=c>t&&e<(s-r)*((t-o)/(c-o))+r&&(n=!n)}return n}};cr.prototype.toString=function(){return`[@pixi/math:PolygoncloseStroke=${this.closeStroke}points=${this.points.reduce((e,t)=>`${e}, ${t}`,``)}]`};var lr=class e{constructor(e=0,t=0,n=0,r=0,i=20){this.x=e,this.y=t,this.width=n,this.height=r,this.radius=i,this.type=q.RREC}clone(){return new e(this.x,this.y,this.width,this.height,this.radius)}contains(e,t){if(this.width<=0||this.height<=0)return!1;if(e>=this.x&&e<=this.x+this.width&&t>=this.y&&t<=this.y+this.height){let n=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(t>=this.y+n&&t<=this.y+this.height-n||e>=this.x+n&&e<=this.x+this.width-n)return!0;let r=e-(this.x+n),i=t-(this.y+n),a=n*n;if(r*r+i*i<=a||(r=e-(this.x+this.width-n),r*r+i*i<=a)||(i=t-(this.y+this.height-n),r*r+i*i<=a)||(r=e-(this.x+n),r*r+i*i<=a))return!0}return!1}};lr.prototype.toString=function(){return`[@pixi/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`};var X=class e{constructor(e=1,t=0,n=0,r=1,i=0,a=0){this.array=null,this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a}fromArray(e){this.a=e[0],this.b=e[1],this.c=e[3],this.d=e[4],this.tx=e[2],this.ty=e[5]}set(e,t,n,r,i,a){return this.a=e,this.b=t,this.c=n,this.d=r,this.tx=i,this.ty=a,this}toArray(e,t){this.array||=new Float32Array(9);let n=t||this.array;return e?(n[0]=this.a,n[1]=this.b,n[2]=0,n[3]=this.c,n[4]=this.d,n[5]=0,n[6]=this.tx,n[7]=this.ty,n[8]=1):(n[0]=this.a,n[1]=this.c,n[2]=this.tx,n[3]=this.b,n[4]=this.d,n[5]=this.ty,n[6]=0,n[7]=0,n[8]=1),n}apply(e,t){t||=new J;let n=e.x,r=e.y;return t.x=this.a*n+this.c*r+this.tx,t.y=this.b*n+this.d*r+this.ty,t}applyInverse(e,t){t||=new J;let n=1/(this.a*this.d+this.c*-this.b),r=e.x,i=e.y;return t.x=this.d*n*r+-this.c*n*i+(this.ty*this.c-this.tx*this.d)*n,t.y=this.a*n*i+-this.b*n*r+(-this.ty*this.a+this.tx*this.b)*n,t}translate(e,t){return this.tx+=e,this.ty+=t,this}scale(e,t){return this.a*=e,this.d*=t,this.c*=e,this.b*=t,this.tx*=e,this.ty*=t,this}rotate(e){let t=Math.cos(e),n=Math.sin(e),r=this.a,i=this.c,a=this.tx;return this.a=r*t-this.b*n,this.b=r*n+this.b*t,this.c=i*t-this.d*n,this.d=i*n+this.d*t,this.tx=a*t-this.ty*n,this.ty=a*n+this.ty*t,this}append(e){let t=this.a,n=this.b,r=this.c,i=this.d;return this.a=e.a*t+e.b*r,this.b=e.a*n+e.b*i,this.c=e.c*t+e.d*r,this.d=e.c*n+e.d*i,this.tx=e.tx*t+e.ty*r+this.tx,this.ty=e.tx*n+e.ty*i+this.ty,this}setTransform(e,t,n,r,i,a,o,s,c){return this.a=Math.cos(o+c)*i,this.b=Math.sin(o+c)*i,this.c=-Math.sin(o-s)*a,this.d=Math.cos(o-s)*a,this.tx=e-(n*this.a+r*this.c),this.ty=t-(n*this.b+r*this.d),this}prepend(e){let t=this.tx;if(e.a!==1||e.b!==0||e.c!==0||e.d!==1){let t=this.a,n=this.c;this.a=t*e.a+this.b*e.c,this.b=t*e.b+this.b*e.d,this.c=n*e.a+this.d*e.c,this.d=n*e.b+this.d*e.d}return this.tx=t*e.a+this.ty*e.c+e.tx,this.ty=t*e.b+this.ty*e.d+e.ty,this}decompose(e){let t=this.a,n=this.b,r=this.c,i=this.d,a=e.pivot,o=-Math.atan2(-r,i),s=Math.atan2(n,t),c=Math.abs(o+s);return c<1e-5||Math.abs(nr-c)<1e-5?(e.rotation=s,e.skew.x=e.skew.y=0):(e.rotation=0,e.skew.x=o,e.skew.y=s),e.scale.x=Math.sqrt(t*t+n*n),e.scale.y=Math.sqrt(r*r+i*i),e.position.x=this.tx+(a.x*t+a.y*r),e.position.y=this.ty+(a.x*n+a.y*i),e}invert(){let e=this.a,t=this.b,n=this.c,r=this.d,i=this.tx,a=e*r-t*n;return this.a=r/a,this.b=-t/a,this.c=-n/a,this.d=e/a,this.tx=(n*this.ty-r*i)/a,this.ty=-(e*this.ty-t*i)/a,this}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){let t=new e;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(e){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}copyFrom(e){return this.a=e.a,this.b=e.b,this.c=e.c,this.d=e.d,this.tx=e.tx,this.ty=e.ty,this}static get IDENTITY(){return new e}static get TEMP_MATRIX(){return new e}};X.prototype.toString=function(){return`[@pixi/math:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`};var ur=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],dr=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],fr=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],pr=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],mr=[],hr=[],gr=Math.sign;function _r(){for(let e=0;e<16;e++){let t=[];mr.push(t);for(let n=0;n<16;n++){let r=gr(ur[e]*ur[n]+fr[e]*dr[n]),i=gr(dr[e]*ur[n]+pr[e]*dr[n]),a=gr(ur[e]*fr[n]+fr[e]*pr[n]),o=gr(dr[e]*fr[n]+pr[e]*pr[n]);for(let e=0;e<16;e++)if(ur[e]===r&&dr[e]===i&&fr[e]===a&&pr[e]===o){t.push(e);break}}}for(let e=0;e<16;e++){let t=new X;t.set(ur[e],dr[e],fr[e],pr[e],0,0),hr.push(t)}}_r();var Z={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:e=>ur[e],uY:e=>dr[e],vX:e=>fr[e],vY:e=>pr[e],inv:e=>e&8?e&15:-e&7,add:(e,t)=>mr[e][t],sub:(e,t)=>mr[e][Z.inv(t)],rotate180:e=>e^4,isVertical:e=>(e&3)==2,byDirection:(e,t)=>Math.abs(e)*2<=Math.abs(t)?t>=0?Z.S:Z.N:Math.abs(t)*2<=Math.abs(e)?e>0?Z.E:Z.W:t>0?e>0?Z.SE:Z.SW:e>0?Z.NE:Z.NW,matrixAppendRotationInv:(e,t,n=0,r=0)=>{let i=hr[Z.inv(t)];i.tx=n,i.ty=r,e.append(i)}},vr=class e{constructor(e,t,n=0,r=0){this._x=n,this._y=r,this.cb=e,this.scope=t}clone(t=this.cb,n=this.scope){return new e(t,n,this._x,this._y)}set(e=0,t=e){return(this._x!==e||this._y!==t)&&(this._x=e,this._y=t,this.cb.call(this.scope)),this}copyFrom(e){return(this._x!==e.x||this._y!==e.y)&&(this._x=e.x,this._y=e.y,this.cb.call(this.scope)),this}copyTo(e){return e.set(this._x,this._y),e}equals(e){return e.x===this._x&&e.y===this._y}get x(){return this._x}set x(e){this._x!==e&&(this._x=e,this.cb.call(this.scope))}get y(){return this._y}set y(e){this._y!==e&&(this._y=e,this.cb.call(this.scope))}};vr.prototype.toString=function(){return`[@pixi/math:ObservablePoint x=${this.x} y=${this.y} scope=${this.scope}]`};var yr=class{constructor(){this.worldTransform=new X,this.localTransform=new X,this.position=new vr(this.onChange,this,0,0),this.scale=new vr(this.onChange,this,1,1),this.pivot=new vr(this.onChange,this,0,0),this.skew=new vr(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}onChange(){this._localID++}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._localID++}updateLocalTransform(){let e=this.localTransform;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)}updateTransform(e){let t=this.localTransform;if(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),this._parentID!==e._worldID){let n=e.worldTransform,r=this.worldTransform;r.a=t.a*n.a+t.b*n.c,r.b=t.a*n.b+t.b*n.d,r.c=t.c*n.a+t.d*n.c,r.d=t.c*n.b+t.d*n.d,r.tx=t.tx*n.a+t.ty*n.c+n.tx,r.ty=t.tx*n.b+t.ty*n.d+n.ty,this._parentID=e._worldID,this._worldID++}}setFromMatrix(e){e.decompose(this),this._localID++}get rotation(){return this._rotation}set rotation(e){this._rotation!==e&&(this._rotation=e,this.updateSkew())}};yr.IDENTITY=new yr;var br=yr;br.prototype.toString=function(){return`[@pixi/math:Transform position=(${this.position.x}, ${this.position.y}) rotation=${this.rotation} scale=(${this.scale.x}, ${this.scale.y}) skew=(${this.skew.x}, ${this.skew.y}) ]`};var xr=`varying vec2 vTextureCoord;
|
|
13
|
+
|
|
14
|
+
uniform sampler2D uSampler;
|
|
15
|
+
|
|
16
|
+
void main(void){
|
|
17
|
+
gl_FragColor *= texture2D(uSampler, vTextureCoord);
|
|
18
|
+
}`,Sr=`attribute vec2 aVertexPosition;
|
|
19
|
+
attribute vec2 aTextureCoord;
|
|
20
|
+
|
|
21
|
+
uniform mat3 projectionMatrix;
|
|
22
|
+
|
|
23
|
+
varying vec2 vTextureCoord;
|
|
24
|
+
|
|
25
|
+
void main(void){
|
|
26
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
27
|
+
vTextureCoord = aTextureCoord;
|
|
28
|
+
}
|
|
29
|
+
`;function Cr(e,t,n){let r=e.createShader(t);return e.shaderSource(r,n),e.compileShader(r),r}function wr(e){let t=Array(e);for(let e=0;e<t.length;e++)t[e]=!1;return t}function Tr(e,t){switch(e){case`float`:return 0;case`vec2`:return new Float32Array(2*t);case`vec3`:return new Float32Array(3*t);case`vec4`:return new Float32Array(4*t);case`int`:case`uint`:case`sampler2D`:case`sampler2DArray`:return 0;case`ivec2`:return new Int32Array(2*t);case`ivec3`:return new Int32Array(3*t);case`ivec4`:return new Int32Array(4*t);case`uvec2`:return new Uint32Array(2*t);case`uvec3`:return new Uint32Array(3*t);case`uvec4`:return new Uint32Array(4*t);case`bool`:return!1;case`bvec2`:return wr(2*t);case`bvec3`:return wr(3*t);case`bvec4`:return wr(4*t);case`mat2`:return new Float32Array([1,0,0,1]);case`mat3`:return new Float32Array([1,0,0,0,1,0,0,0,1]);case`mat4`:return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Er=[{test:e=>e.type===`float`&&e.size===1&&!e.isArray,code:e=>`
|
|
30
|
+
if(uv["${e}"] !== ud["${e}"].value)
|
|
31
|
+
{
|
|
32
|
+
ud["${e}"].value = uv["${e}"]
|
|
33
|
+
gl.uniform1f(ud["${e}"].location, uv["${e}"])
|
|
34
|
+
}
|
|
35
|
+
`},{test:(e,t)=>(e.type===`sampler2D`||e.type===`samplerCube`||e.type===`sampler2DArray`)&&e.size===1&&!e.isArray&&(t==null||t.castToBaseTexture!==void 0),code:e=>`t = syncData.textureCount++;
|
|
36
|
+
|
|
37
|
+
renderer.texture.bind(uv["${e}"], t);
|
|
38
|
+
|
|
39
|
+
if(ud["${e}"].value !== t)
|
|
40
|
+
{
|
|
41
|
+
ud["${e}"].value = t;
|
|
42
|
+
gl.uniform1i(ud["${e}"].location, t);
|
|
43
|
+
; // eslint-disable-line max-len
|
|
44
|
+
}`},{test:(e,t)=>e.type===`mat3`&&e.size===1&&!e.isArray&&t.a!==void 0,code:e=>`
|
|
45
|
+
gl.uniformMatrix3fv(ud["${e}"].location, false, uv["${e}"].toArray(true));
|
|
46
|
+
`,codeUbo:e=>`
|
|
47
|
+
var ${e}_matrix = uv.${e}.toArray(true);
|
|
48
|
+
|
|
49
|
+
data[offset] = ${e}_matrix[0];
|
|
50
|
+
data[offset+1] = ${e}_matrix[1];
|
|
51
|
+
data[offset+2] = ${e}_matrix[2];
|
|
52
|
+
|
|
53
|
+
data[offset + 4] = ${e}_matrix[3];
|
|
54
|
+
data[offset + 5] = ${e}_matrix[4];
|
|
55
|
+
data[offset + 6] = ${e}_matrix[5];
|
|
56
|
+
|
|
57
|
+
data[offset + 8] = ${e}_matrix[6];
|
|
58
|
+
data[offset + 9] = ${e}_matrix[7];
|
|
59
|
+
data[offset + 10] = ${e}_matrix[8];
|
|
60
|
+
`},{test:(e,t)=>e.type===`vec2`&&e.size===1&&!e.isArray&&t.x!==void 0,code:e=>`
|
|
61
|
+
cv = ud["${e}"].value;
|
|
62
|
+
v = uv["${e}"];
|
|
63
|
+
|
|
64
|
+
if(cv[0] !== v.x || cv[1] !== v.y)
|
|
65
|
+
{
|
|
66
|
+
cv[0] = v.x;
|
|
67
|
+
cv[1] = v.y;
|
|
68
|
+
gl.uniform2f(ud["${e}"].location, v.x, v.y);
|
|
69
|
+
}`,codeUbo:e=>`
|
|
70
|
+
v = uv.${e};
|
|
71
|
+
|
|
72
|
+
data[offset] = v.x;
|
|
73
|
+
data[offset+1] = v.y;
|
|
74
|
+
`},{test:e=>e.type===`vec2`&&e.size===1&&!e.isArray,code:e=>`
|
|
75
|
+
cv = ud["${e}"].value;
|
|
76
|
+
v = uv["${e}"];
|
|
77
|
+
|
|
78
|
+
if(cv[0] !== v[0] || cv[1] !== v[1])
|
|
79
|
+
{
|
|
80
|
+
cv[0] = v[0];
|
|
81
|
+
cv[1] = v[1];
|
|
82
|
+
gl.uniform2f(ud["${e}"].location, v[0], v[1]);
|
|
83
|
+
}
|
|
84
|
+
`},{test:(e,t)=>e.type===`vec4`&&e.size===1&&!e.isArray&&t.width!==void 0,code:e=>`
|
|
85
|
+
cv = ud["${e}"].value;
|
|
86
|
+
v = uv["${e}"];
|
|
87
|
+
|
|
88
|
+
if(cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height)
|
|
89
|
+
{
|
|
90
|
+
cv[0] = v.x;
|
|
91
|
+
cv[1] = v.y;
|
|
92
|
+
cv[2] = v.width;
|
|
93
|
+
cv[3] = v.height;
|
|
94
|
+
gl.uniform4f(ud["${e}"].location, v.x, v.y, v.width, v.height)
|
|
95
|
+
}`,codeUbo:e=>`
|
|
96
|
+
v = uv.${e};
|
|
97
|
+
|
|
98
|
+
data[offset] = v.x;
|
|
99
|
+
data[offset+1] = v.y;
|
|
100
|
+
data[offset+2] = v.width;
|
|
101
|
+
data[offset+3] = v.height;
|
|
102
|
+
`},{test:(e,t)=>e.type===`vec4`&&e.size===1&&!e.isArray&&t.red!==void 0,code:e=>`
|
|
103
|
+
cv = ud["${e}"].value;
|
|
104
|
+
v = uv["${e}"];
|
|
105
|
+
|
|
106
|
+
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha)
|
|
107
|
+
{
|
|
108
|
+
cv[0] = v.red;
|
|
109
|
+
cv[1] = v.green;
|
|
110
|
+
cv[2] = v.blue;
|
|
111
|
+
cv[3] = v.alpha;
|
|
112
|
+
gl.uniform4f(ud["${e}"].location, v.red, v.green, v.blue, v.alpha)
|
|
113
|
+
}`,codeUbo:e=>`
|
|
114
|
+
v = uv.${e};
|
|
115
|
+
|
|
116
|
+
data[offset] = v.red;
|
|
117
|
+
data[offset+1] = v.green;
|
|
118
|
+
data[offset+2] = v.blue;
|
|
119
|
+
data[offset+3] = v.alpha;
|
|
120
|
+
`},{test:(e,t)=>e.type===`vec3`&&e.size===1&&!e.isArray&&t.red!==void 0,code:e=>`
|
|
121
|
+
cv = ud["${e}"].value;
|
|
122
|
+
v = uv["${e}"];
|
|
123
|
+
|
|
124
|
+
if(cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.a)
|
|
125
|
+
{
|
|
126
|
+
cv[0] = v.red;
|
|
127
|
+
cv[1] = v.green;
|
|
128
|
+
cv[2] = v.blue;
|
|
129
|
+
|
|
130
|
+
gl.uniform3f(ud["${e}"].location, v.red, v.green, v.blue)
|
|
131
|
+
}`,codeUbo:e=>`
|
|
132
|
+
v = uv.${e};
|
|
133
|
+
|
|
134
|
+
data[offset] = v.red;
|
|
135
|
+
data[offset+1] = v.green;
|
|
136
|
+
data[offset+2] = v.blue;
|
|
137
|
+
`},{test:e=>e.type===`vec4`&&e.size===1&&!e.isArray,code:e=>`
|
|
138
|
+
cv = ud["${e}"].value;
|
|
139
|
+
v = uv["${e}"];
|
|
140
|
+
|
|
141
|
+
if(cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
142
|
+
{
|
|
143
|
+
cv[0] = v[0];
|
|
144
|
+
cv[1] = v[1];
|
|
145
|
+
cv[2] = v[2];
|
|
146
|
+
cv[3] = v[3];
|
|
147
|
+
|
|
148
|
+
gl.uniform4f(ud["${e}"].location, v[0], v[1], v[2], v[3])
|
|
149
|
+
}`}],Dr={float:`
|
|
150
|
+
if (cv !== v)
|
|
151
|
+
{
|
|
152
|
+
cu.value = v;
|
|
153
|
+
gl.uniform1f(location, v);
|
|
154
|
+
}`,vec2:`
|
|
155
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
156
|
+
{
|
|
157
|
+
cv[0] = v[0];
|
|
158
|
+
cv[1] = v[1];
|
|
159
|
+
|
|
160
|
+
gl.uniform2f(location, v[0], v[1])
|
|
161
|
+
}`,vec3:`
|
|
162
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
163
|
+
{
|
|
164
|
+
cv[0] = v[0];
|
|
165
|
+
cv[1] = v[1];
|
|
166
|
+
cv[2] = v[2];
|
|
167
|
+
|
|
168
|
+
gl.uniform3f(location, v[0], v[1], v[2])
|
|
169
|
+
}`,vec4:`
|
|
170
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
171
|
+
{
|
|
172
|
+
cv[0] = v[0];
|
|
173
|
+
cv[1] = v[1];
|
|
174
|
+
cv[2] = v[2];
|
|
175
|
+
cv[3] = v[3];
|
|
176
|
+
|
|
177
|
+
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
|
|
178
|
+
}`,int:`
|
|
179
|
+
if (cv !== v)
|
|
180
|
+
{
|
|
181
|
+
cu.value = v;
|
|
182
|
+
|
|
183
|
+
gl.uniform1i(location, v);
|
|
184
|
+
}`,ivec2:`
|
|
185
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
186
|
+
{
|
|
187
|
+
cv[0] = v[0];
|
|
188
|
+
cv[1] = v[1];
|
|
189
|
+
|
|
190
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
191
|
+
}`,ivec3:`
|
|
192
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
193
|
+
{
|
|
194
|
+
cv[0] = v[0];
|
|
195
|
+
cv[1] = v[1];
|
|
196
|
+
cv[2] = v[2];
|
|
197
|
+
|
|
198
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
199
|
+
}`,ivec4:`
|
|
200
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
201
|
+
{
|
|
202
|
+
cv[0] = v[0];
|
|
203
|
+
cv[1] = v[1];
|
|
204
|
+
cv[2] = v[2];
|
|
205
|
+
cv[3] = v[3];
|
|
206
|
+
|
|
207
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
208
|
+
}`,uint:`
|
|
209
|
+
if (cv !== v)
|
|
210
|
+
{
|
|
211
|
+
cu.value = v;
|
|
212
|
+
|
|
213
|
+
gl.uniform1ui(location, v);
|
|
214
|
+
}`,uvec2:`
|
|
215
|
+
if (cv[0] !== v[0] || cv[1] !== v[1])
|
|
216
|
+
{
|
|
217
|
+
cv[0] = v[0];
|
|
218
|
+
cv[1] = v[1];
|
|
219
|
+
|
|
220
|
+
gl.uniform2ui(location, v[0], v[1]);
|
|
221
|
+
}`,uvec3:`
|
|
222
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
223
|
+
{
|
|
224
|
+
cv[0] = v[0];
|
|
225
|
+
cv[1] = v[1];
|
|
226
|
+
cv[2] = v[2];
|
|
227
|
+
|
|
228
|
+
gl.uniform3ui(location, v[0], v[1], v[2]);
|
|
229
|
+
}`,uvec4:`
|
|
230
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
231
|
+
{
|
|
232
|
+
cv[0] = v[0];
|
|
233
|
+
cv[1] = v[1];
|
|
234
|
+
cv[2] = v[2];
|
|
235
|
+
cv[3] = v[3];
|
|
236
|
+
|
|
237
|
+
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
|
|
238
|
+
}`,bool:`
|
|
239
|
+
if (cv !== v)
|
|
240
|
+
{
|
|
241
|
+
cu.value = v;
|
|
242
|
+
gl.uniform1i(location, v);
|
|
243
|
+
}`,bvec2:`
|
|
244
|
+
if (cv[0] != v[0] || cv[1] != v[1])
|
|
245
|
+
{
|
|
246
|
+
cv[0] = v[0];
|
|
247
|
+
cv[1] = v[1];
|
|
248
|
+
|
|
249
|
+
gl.uniform2i(location, v[0], v[1]);
|
|
250
|
+
}`,bvec3:`
|
|
251
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2])
|
|
252
|
+
{
|
|
253
|
+
cv[0] = v[0];
|
|
254
|
+
cv[1] = v[1];
|
|
255
|
+
cv[2] = v[2];
|
|
256
|
+
|
|
257
|
+
gl.uniform3i(location, v[0], v[1], v[2]);
|
|
258
|
+
}`,bvec4:`
|
|
259
|
+
if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3])
|
|
260
|
+
{
|
|
261
|
+
cv[0] = v[0];
|
|
262
|
+
cv[1] = v[1];
|
|
263
|
+
cv[2] = v[2];
|
|
264
|
+
cv[3] = v[3];
|
|
265
|
+
|
|
266
|
+
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
|
|
267
|
+
}`,mat2:`gl.uniformMatrix2fv(location, false, v)`,mat3:`gl.uniformMatrix3fv(location, false, v)`,mat4:`gl.uniformMatrix4fv(location, false, v)`,sampler2D:`
|
|
268
|
+
if (cv !== v)
|
|
269
|
+
{
|
|
270
|
+
cu.value = v;
|
|
271
|
+
|
|
272
|
+
gl.uniform1i(location, v);
|
|
273
|
+
}`,samplerCube:`
|
|
274
|
+
if (cv !== v)
|
|
275
|
+
{
|
|
276
|
+
cu.value = v;
|
|
277
|
+
|
|
278
|
+
gl.uniform1i(location, v);
|
|
279
|
+
}`,sampler2DArray:`
|
|
280
|
+
if (cv !== v)
|
|
281
|
+
{
|
|
282
|
+
cu.value = v;
|
|
283
|
+
|
|
284
|
+
gl.uniform1i(location, v);
|
|
285
|
+
}`},Or={float:`gl.uniform1fv(location, v)`,vec2:`gl.uniform2fv(location, v)`,vec3:`gl.uniform3fv(location, v)`,vec4:`gl.uniform4fv(location, v)`,mat4:`gl.uniformMatrix4fv(location, false, v)`,mat3:`gl.uniformMatrix3fv(location, false, v)`,mat2:`gl.uniformMatrix2fv(location, false, v)`,int:`gl.uniform1iv(location, v)`,ivec2:`gl.uniform2iv(location, v)`,ivec3:`gl.uniform3iv(location, v)`,ivec4:`gl.uniform4iv(location, v)`,uint:`gl.uniform1uiv(location, v)`,uvec2:`gl.uniform2uiv(location, v)`,uvec3:`gl.uniform3uiv(location, v)`,uvec4:`gl.uniform4uiv(location, v)`,bool:`gl.uniform1iv(location, v)`,bvec2:`gl.uniform2iv(location, v)`,bvec3:`gl.uniform3iv(location, v)`,bvec4:`gl.uniform4iv(location, v)`,sampler2D:`gl.uniform1iv(location, v)`,samplerCube:`gl.uniform1iv(location, v)`,sampler2DArray:`gl.uniform1iv(location, v)`};function kr(e,t){let n=[`
|
|
286
|
+
var v = null;
|
|
287
|
+
var cv = null;
|
|
288
|
+
var cu = null;
|
|
289
|
+
var t = 0;
|
|
290
|
+
var gl = renderer.gl;
|
|
291
|
+
`];for(let r in e.uniforms){let i=t[r];if(!i){e.uniforms[r]?.group===!0&&(e.uniforms[r].ubo?n.push(`
|
|
292
|
+
renderer.shader.syncUniformBufferGroup(uv.${r}, '${r}');
|
|
293
|
+
`):n.push(`
|
|
294
|
+
renderer.shader.syncUniformGroup(uv.${r}, syncData);
|
|
295
|
+
`));continue}let a=e.uniforms[r],o=!1;for(let e=0;e<Er.length;e++)if(Er[e].test(i,a)){n.push(Er[e].code(r,a)),o=!0;break}if(!o){let e=(i.size===1&&!i.isArray?Dr:Or)[i.type].replace(`location`,`ud["${r}"].location`);n.push(`
|
|
296
|
+
cu = ud["${r}"];
|
|
297
|
+
cv = cu.value;
|
|
298
|
+
v = uv["${r}"];
|
|
299
|
+
${e};`)}}return Function(`ud`,`uv`,`renderer`,`syncData`,n.join(`
|
|
300
|
+
`))}var Ar={},jr=Ar;function Mr(){if(jr===Ar||jr?.isContextLost()){let e=w.ADAPTER.createCanvas(),t;w.PREFER_ENV>=r.WEBGL2&&(t=e.getContext(`webgl2`,{})),t||(t=e.getContext(`webgl`,{})||e.getContext(`experimental-webgl`,{}),t?t.getExtension(`WEBGL_draw_buffers`):t=null),jr=t}return jr}var Nr;function Pr(){if(!Nr){Nr=v.MEDIUM;let e=Mr();if(e&&e.getShaderPrecisionFormat){let t=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.HIGH_FLOAT);t&&(Nr=t.precision?v.HIGH:v.MEDIUM)}}return Nr}function Fr(e,t){let n=e.getShaderSource(t).split(`
|
|
301
|
+
`).map((e,t)=>`${t}: ${e}`),r=e.getShaderInfoLog(t),i=r.split(`
|
|
302
|
+
`),a={},o=i.map(e=>parseFloat(e.replace(/^ERROR\: 0\:([\d]+)\:.*$/,`$1`))).filter(e=>e&&!a[e]?(a[e]=!0,!0):!1),s=[``];o.forEach(e=>{n[e-1]=`%c${n[e-1]}%c`,s.push(`background: #FF0000; color:#FFFFFF; font-size: 10px`,`font-size: 10px`)}),s[0]=n.join(`
|
|
303
|
+
`),console.error(r),console.groupCollapsed(`click to view full shader code`),console.warn(...s),console.groupEnd()}function Ir(e,t,n,r){e.getProgramParameter(t,e.LINK_STATUS)||(e.getShaderParameter(n,e.COMPILE_STATUS)||Fr(e,n),e.getShaderParameter(r,e.COMPILE_STATUS)||Fr(e,r),console.error(`PixiJS Error: Could not initialize shader.`),e.getProgramInfoLog(t)!==``&&console.warn(`PixiJS Warning: gl.getProgramInfoLog()`,e.getProgramInfoLog(t)))}var Lr={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 Rr(e){return Lr[e]}var zr=null,Br={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 Vr(e,t){if(!zr){let t=Object.keys(Br);zr={};for(let n=0;n<t.length;++n){let r=t[n];zr[e[r]]=Br[r]}}return zr[t]}function Hr(e,t,n){if(e.substring(0,9)!==`precision`){let r=t;return t===v.HIGH&&n!==v.HIGH&&(r=v.MEDIUM),`precision ${r} float;
|
|
304
|
+
${e}`}return n!==v.HIGH&&e.substring(0,15)===`precision highp`?e.replace(`precision highp`,`precision mediump`):e}var Ur;function Wr(){if(typeof Ur==`boolean`)return Ur;try{Ur=Function(`param1`,`param2`,`param3`,`return param1[param2] === param3;`)({a:`b`},`a`,`b`)===!0}catch{Ur=!1}return Ur}var Gr=0,Kr={},qr=class e{constructor(t,n,r=`pixi-shader`,i={}){this.extra={},this.id=Gr++,this.vertexSrc=t||e.defaultVertexSrc,this.fragmentSrc=n||e.defaultFragmentSrc,this.vertexSrc=this.vertexSrc.trim(),this.fragmentSrc=this.fragmentSrc.trim(),this.extra=i,this.vertexSrc.substring(0,8)!==`#version`&&(r=r.replace(/\s+/g,`-`),Kr[r]?(Kr[r]++,r+=`-${Kr[r]}`):Kr[r]=1,this.vertexSrc=`#define SHADER_NAME ${r}
|
|
305
|
+
${this.vertexSrc}`,this.fragmentSrc=`#define SHADER_NAME ${r}
|
|
306
|
+
${this.fragmentSrc}`,this.vertexSrc=Hr(this.vertexSrc,e.defaultVertexPrecision,v.HIGH),this.fragmentSrc=Hr(this.fragmentSrc,e.defaultFragmentPrecision,Pr())),this.glPrograms={},this.syncUniforms=null}static get defaultVertexSrc(){return Sr}static get defaultFragmentSrc(){return xr}static from(t,n,r){let i=t+n,a=vn[i];return a||(vn[i]=a=new e(t,n,r)),a}};qr.defaultVertexPrecision=v.HIGH,qr.defaultFragmentPrecision=R.apple.device?v.HIGH:v.MEDIUM;var Jr=qr,Yr=0,Xr=class e{constructor(e,t,n){this.group=!0,this.syncUniforms={},this.dirtyId=0,this.id=Yr++,this.static=!!t,this.ubo=!!n,e instanceof K?(this.buffer=e,this.buffer.type=S.UNIFORM_BUFFER,this.autoManage=!1,this.ubo=!0):(this.uniforms=e,this.ubo&&(this.buffer=new K(new Float32Array(1)),this.buffer.type=S.UNIFORM_BUFFER,this.autoManage=!0))}update(){this.dirtyId++,!this.autoManage&&this.buffer&&this.buffer.update()}add(t,n,r){if(!this.ubo)this.uniforms[t]=new e(n,r);else throw Error(`[UniformGroup] uniform groups in ubo mode cannot be modified, or have uniform groups nested in them`)}static from(t,n,r){return new e(t,n,r)}static uboFrom(t,n){return new e(t,n??!0,!0)}},Zr=class e{constructor(e,t){this.uniformBindCount=0,this.program=e,this.uniformGroup=t?t instanceof Xr?t:new Xr(t):new Xr({}),this.disposeRunner=new Vn(`disposeShader`)}checkUniformExists(e,t){if(t.uniforms[e])return!0;for(let n in t.uniforms){let r=t.uniforms[n];if(r.group===!0&&this.checkUniformExists(e,r))return!0}return!1}destroy(){this.uniformGroup=null,this.disposeRunner.emit(this),this.disposeRunner.destroy()}get uniforms(){return this.uniformGroup.uniforms}static from(t,n,r){let i=Jr.from(t,n);return new e(i,r)}},Qr=class{constructor(e,t){if(this.vertexSrc=e,this.fragTemplate=t,this.programCache={},this.defaultGroupCache={},!t.includes(`%count%`))throw Error(`Fragment template must contain "%count%".`);if(!t.includes(`%forloop%`))throw Error(`Fragment template must contain "%forloop%".`)}generateShader(e){if(!this.programCache[e]){let t=new Int32Array(e);for(let n=0;n<e;n++)t[n]=n;this.defaultGroupCache[e]=Xr.from({uSamplers:t},!0);let n=this.fragTemplate;n=n.replace(/%count%/gi,`${e}`),n=n.replace(/%forloop%/gi,this.generateSampleSrc(e)),this.programCache[e]=new Jr(this.vertexSrc,n)}let t={tint:new Float32Array([1,1,1,1]),translationMatrix:new X,default:this.defaultGroupCache[e]};return new Zr(this.programCache[e],t)}generateSampleSrc(e){let t=``;t+=`
|
|
307
|
+
`,t+=`
|
|
308
|
+
`;for(let n=0;n<e;n++)n>0&&(t+=`
|
|
309
|
+
else `),n<e-1&&(t+=`if(vTextureId < ${n}.5)`),t+=`
|
|
310
|
+
{`,t+=`
|
|
311
|
+
color = texture2D(uSamplers[${n}], vTextureCoord);`,t+=`
|
|
312
|
+
}`;return t+=`
|
|
313
|
+
`,t+=`
|
|
314
|
+
`,t}},$r=class{constructor(){this.elements=[],this.ids=[],this.count=0}clear(){for(let e=0;e<this.count;e++)this.elements[e]=null;this.count=0}};function ei(){return!R.apple.device}function ti(e){let t=!0,n=w.ADAPTER.getNavigator();if(R.tablet||R.phone){if(R.apple.device){let e=n.userAgent.match(/OS (\d+)_(\d+)?/);e&&parseInt(e[1],10)<11&&(t=!1)}if(R.android.device){let e=n.userAgent.match(/Android\s([0-9.]*)/);e&&parseInt(e[1],10)<7&&(t=!1)}}return t?e:4}var ni=class{constructor(e){this.renderer=e}flush(){}destroy(){this.renderer=null}start(){}stop(){this.flush()}render(e){}},ri=`varying vec2 vTextureCoord;
|
|
315
|
+
varying vec4 vColor;
|
|
316
|
+
varying float vTextureId;
|
|
317
|
+
uniform sampler2D uSamplers[%count%];
|
|
318
|
+
|
|
319
|
+
void main(void){
|
|
320
|
+
vec4 color;
|
|
321
|
+
%forloop%
|
|
322
|
+
gl_FragColor = color * vColor;
|
|
323
|
+
}
|
|
324
|
+
`,ii=`precision highp float;
|
|
325
|
+
attribute vec2 aVertexPosition;
|
|
326
|
+
attribute vec2 aTextureCoord;
|
|
327
|
+
attribute vec4 aColor;
|
|
328
|
+
attribute float aTextureId;
|
|
329
|
+
|
|
330
|
+
uniform mat3 projectionMatrix;
|
|
331
|
+
uniform mat3 translationMatrix;
|
|
332
|
+
uniform vec4 tint;
|
|
333
|
+
|
|
334
|
+
varying vec2 vTextureCoord;
|
|
335
|
+
varying vec4 vColor;
|
|
336
|
+
varying float vTextureId;
|
|
337
|
+
|
|
338
|
+
void main(void){
|
|
339
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
340
|
+
|
|
341
|
+
vTextureCoord = aTextureCoord;
|
|
342
|
+
vTextureId = aTextureId;
|
|
343
|
+
vColor = aColor * tint;
|
|
344
|
+
}
|
|
345
|
+
`,ai=class e extends ni{constructor(t){super(t),this.setShaderGenerator(),this.geometryClass=tr,this.vertexSize=6,this.state=Rn.for2d(),this.size=e.defaultBatchSize*4,this._vertexCount=0,this._indexCount=0,this._bufferedElements=[],this._bufferedTextures=[],this._bufferSize=0,this._shader=null,this._packedGeometries=[],this._packedGeometryPoolSize=2,this._flushId=0,this._aBuffers={},this._iBuffers={},this.maxTextures=1,this.renderer.on(`prerender`,this.onPrerender,this),t.runners.contextChange.add(this),this._dcIndex=0,this._aIndex=0,this._iIndex=0,this._attributeBuffer=null,this._indexBuffer=null,this._tempBoundTextures=[]}static get defaultMaxTextures(){return this._defaultMaxTextures=this._defaultMaxTextures??ti(32),this._defaultMaxTextures}static set defaultMaxTextures(e){this._defaultMaxTextures=e}static get canUploadSameBuffer(){return this._canUploadSameBuffer=this._canUploadSameBuffer??ei(),this._canUploadSameBuffer}static set canUploadSameBuffer(e){this._canUploadSameBuffer=e}get MAX_TEXTURES(){return z(`7.1.0`,`BatchRenderer#MAX_TEXTURES renamed to BatchRenderer#maxTextures`),this.maxTextures}static get defaultVertexSrc(){return ii}static get defaultFragmentTemplate(){return ri}setShaderGenerator({vertex:t=e.defaultVertexSrc,fragment:n=e.defaultFragmentTemplate}={}){this.shaderGenerator=new Qr(t,n)}contextChange(){let t=this.renderer.gl;w.PREFER_ENV===r.WEBGL_LEGACY?this.maxTextures=1:(this.maxTextures=Math.min(t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),e.defaultMaxTextures),this.maxTextures=Ln(this.maxTextures,t)),this._shader=this.shaderGenerator.generateShader(this.maxTextures);for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]=new this.geometryClass;this.initFlushBuffers()}initFlushBuffers(){let{_drawCallPool:t,_textureArrayPool:n}=e,r=this.size/4,i=Math.floor(r/this.maxTextures)+1;for(;t.length<r;)t.push(new Kn);for(;n.length<i;)n.push(new $r);for(let e=0;e<this.maxTextures;e++)this._tempBoundTextures[e]=null}onPrerender(){this._flushId=0}render(e){e._texture.valid&&(this._vertexCount+e.vertexData.length/2>this.size&&this.flush(),this._vertexCount+=e.vertexData.length/2,this._indexCount+=e.indices.length,this._bufferedTextures[this._bufferSize]=e._texture.baseTexture,this._bufferedElements[this._bufferSize++]=e)}buildTexturesAndDrawCalls(){let{_bufferedTextures:t,maxTextures:n}=this,r=e._textureArrayPool,i=this.renderer.batch,a=this._tempBoundTextures,o=this.renderer.textureGC.count,s=++G._globalBatch,c=0,l=r[0],u=0;i.copyBoundTextures(a,n);for(let e=0;e<this._bufferSize;++e){let d=t[e];t[e]=null,d._batchEnabled!==s&&(l.count>=n&&(i.boundArray(l,a,s,n),this.buildDrawCalls(l,u,e),u=e,l=r[++c],++s),d._batchEnabled=s,d.touched=o,l.elements[l.count++]=d)}l.count>0&&(i.boundArray(l,a,s,n),this.buildDrawCalls(l,u,this._bufferSize),++c,++s);for(let e=0;e<a.length;e++)a[e]=null;G._globalBatch=s}buildDrawCalls(t,n,r){let{_bufferedElements:i,_attributeBuffer:a,_indexBuffer:o,vertexSize:s}=this,c=e._drawCallPool,l=this._dcIndex,u=this._aIndex,d=this._iIndex,f=c[l];f.start=this._iIndex,f.texArray=t;for(let e=n;e<r;++e){let r=i[e],p=Qt[+!!r._texture.baseTexture.alphaMode][r.blendMode];i[e]=null,n<e&&f.blend!==p&&(f.size=d-f.start,n=e,f=c[++l],f.texArray=t,f.start=d),this.packInterleavedGeometry(r,a,o,u,d),u+=r.vertexData.length/2*s,d+=r.indices.length,f.blend=p}n<r&&(f.size=d-f.start,++l),this._dcIndex=l,this._aIndex=u,this._iIndex=d}bindAndClearTexArray(e){let t=this.renderer.texture;for(let n=0;n<e.count;n++)t.bind(e.elements[n],e.ids[n]),e.elements[n]=null;e.count=0}updateGeometry(){let{_packedGeometries:t,_attributeBuffer:n,_indexBuffer:r}=this;e.canUploadSameBuffer?(t[this._flushId]._buffer.update(n.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.updateBuffers()):(this._packedGeometryPoolSize<=this._flushId&&(this._packedGeometryPoolSize++,t[this._flushId]=new this.geometryClass),t[this._flushId]._buffer.update(n.rawBinaryData),t[this._flushId]._indexBuffer.update(r),this.renderer.geometry.bind(t[this._flushId]),this.renderer.geometry.updateBuffers(),this._flushId++)}drawBatches(){let t=this._dcIndex,{gl:n,state:r}=this.renderer,i=e._drawCallPool,a=null;for(let e=0;e<t;e++){let{texArray:t,type:o,size:s,start:c,blend:l}=i[e];a!==t&&(a=t,this.bindAndClearTexArray(t)),this.state.blendMode=l,r.set(this.state),n.drawElements(o,s,n.UNSIGNED_SHORT,c*2)}}flush(){this._vertexCount!==0&&(this._attributeBuffer=this.getAttributeBuffer(this._vertexCount),this._indexBuffer=this.getIndexBuffer(this._indexCount),this._aIndex=0,this._iIndex=0,this._dcIndex=0,this.buildTexturesAndDrawCalls(),this.updateGeometry(),this.drawBatches(),this._bufferSize=0,this._vertexCount=0,this._indexCount=0)}start(){this.renderer.state.set(this.state),this.renderer.texture.ensureSamplerType(this.maxTextures),this.renderer.shader.bind(this._shader),e.canUploadSameBuffer&&this.renderer.geometry.bind(this._packedGeometries[this._flushId])}stop(){this.flush()}destroy(){for(let e=0;e<this._packedGeometryPoolSize;e++)this._packedGeometries[e]&&this._packedGeometries[e].destroy();this.renderer.off(`prerender`,this.onPrerender,this),this._aBuffers=null,this._iBuffers=null,this._packedGeometries=null,this._attributeBuffer=null,this._indexBuffer=null,this._shader&&=(this._shader.destroy(),null),super.destroy()}getAttributeBuffer(e){let t=ln(Math.ceil(e/8)),n=dn(t),r=t*8;this._aBuffers.length<=n&&(this._iBuffers.length=n+1);let i=this._aBuffers[r];return i||(this._aBuffers[r]=i=new Pn(r*this.vertexSize*4)),i}getIndexBuffer(e){let t=ln(Math.ceil(e/12)),n=dn(t),r=t*12;this._iBuffers.length<=n&&(this._iBuffers.length=n+1);let i=this._iBuffers[n];return i||(this._iBuffers[n]=i=new Uint16Array(r)),i}packInterleavedGeometry(e,t,n,r,i){let{uint32View:a,float32View:o}=t,s=r/this.vertexSize,c=e.uvs,l=e.indices,u=e.vertexData,d=e._texture.baseTexture._batchLocation,f=Math.min(e.worldAlpha,1),p=H.shared.setValue(e._tintRGB).toPremultiplied(f,e._texture.baseTexture.alphaMode>0);for(let e=0;e<u.length;e+=2)o[r++]=u[e],o[r++]=u[e+1],o[r++]=c[e],o[r++]=c[e+1],a[r++]=p,o[r++]=d;for(let e=0;e<l.length;e++)n[i++]=s+l[e]}};ai.defaultBatchSize=4096,ai.extension={name:`batch`,type:U.RendererPlugin},ai._drawCallPool=[],ai._textureArrayPool=[];var oi=ai;W.add(oi);var si=`varying vec2 vTextureCoord;
|
|
346
|
+
|
|
347
|
+
uniform sampler2D uSampler;
|
|
348
|
+
|
|
349
|
+
void main(void){
|
|
350
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord);
|
|
351
|
+
}
|
|
352
|
+
`,ci=`attribute vec2 aVertexPosition;
|
|
353
|
+
|
|
354
|
+
uniform mat3 projectionMatrix;
|
|
355
|
+
|
|
356
|
+
varying vec2 vTextureCoord;
|
|
357
|
+
|
|
358
|
+
uniform vec4 inputSize;
|
|
359
|
+
uniform vec4 outputFrame;
|
|
360
|
+
|
|
361
|
+
vec4 filterVertexPosition( void )
|
|
362
|
+
{
|
|
363
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
364
|
+
|
|
365
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
vec2 filterTextureCoord( void )
|
|
369
|
+
{
|
|
370
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
void main(void)
|
|
374
|
+
{
|
|
375
|
+
gl_Position = filterVertexPosition();
|
|
376
|
+
vTextureCoord = filterTextureCoord();
|
|
377
|
+
}
|
|
378
|
+
`,li=class e extends Zr{constructor(t,n,r){let i=Jr.from(t||e.defaultVertexSrc,n||e.defaultFragmentSrc);super(i,r),this.padding=0,this.resolution=e.defaultResolution,this.multisample=e.defaultMultisample,this.enabled=!0,this.autoFit=!0,this.state=new Rn}apply(e,t,n,r,i){e.applyFilter(this,t,n,r)}get blendMode(){return this.state.blendMode}set blendMode(e){this.state.blendMode=e}get resolution(){return this._resolution}set resolution(e){this._resolution=e}static get defaultVertexSrc(){return ci}static get defaultFragmentSrc(){return si}};li.defaultResolution=1,li.defaultMultisample=x.NONE;var ui=li,di=class{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new H(0),this.alpha=1}init(e){this.clearBeforeRender=e.clearBeforeRender;let{backgroundColor:t,background:n,backgroundAlpha:r}=e,i=n??t;i!==void 0&&(this.color=i),this.alpha=r}get color(){return this._backgroundColor.value}set color(e){this._backgroundColor.setValue(e)}get alpha(){return this._backgroundColor.alpha}set alpha(e){this._backgroundColor.setAlpha(e)}get backgroundColor(){return this._backgroundColor}destroy(){}};di.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0},di.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:`background`},W.add(di);var fi=class{constructor(e){this.renderer=e,this.emptyRenderer=new ni(e),this.currentRenderer=this.emptyRenderer}setObjectRenderer(e){this.currentRenderer!==e&&(this.currentRenderer.stop(),this.currentRenderer=e,this.currentRenderer.start())}flush(){this.setObjectRenderer(this.emptyRenderer)}reset(){this.setObjectRenderer(this.emptyRenderer)}copyBoundTextures(e,t){let{boundTextures:n}=this.renderer.texture;for(let r=t-1;r>=0;--r)e[r]=n[r]||null,e[r]&&(e[r]._batchLocation=r)}boundArray(e,t,n,r){let{elements:i,ids:a,count:o}=e,s=0;for(let e=0;e<o;e++){let o=i[e],c=o._batchLocation;if(c>=0&&c<r&&t[c]===o){a[e]=c;continue}for(;s<r;){let r=t[s];if(r&&r._batchEnabled===n&&r._batchLocation===s){s++;continue}a[e]=s,o._batchLocation=s,t[s]=o;break}}}destroy(){this.renderer=null}};fi.extension={type:U.RendererSystem,name:`batch`},W.add(fi);var pi=0,mi=class{constructor(e){this.renderer=e,this.webGLVersion=1,this.extensions={},this.supports={uint32Indices:!1},this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(e){this.gl=e,this.renderer.gl=e,this.renderer.CONTEXT_UID=pi++}init(e){if(e.context)this.initFromContext(e.context);else{let t=this.renderer.background.alpha<1,n=e.premultipliedAlpha;this.preserveDrawingBuffer=e.preserveDrawingBuffer,this.useContextAlpha=e.useContextAlpha,this.powerPreference=e.powerPreference,this.initFromOptions({alpha:t,premultipliedAlpha:n,antialias:e.antialias,stencil:!0,preserveDrawingBuffer:e.preserveDrawingBuffer,powerPreference:e.powerPreference})}}initFromContext(e){this.gl=e,this.validateContext(e),this.renderer.gl=e,this.renderer.CONTEXT_UID=pi++,this.renderer.runners.contextChange.emit(e);let t=this.renderer.view;t.addEventListener!==void 0&&(t.addEventListener(`webglcontextlost`,this.handleContextLost,!1),t.addEventListener(`webglcontextrestored`,this.handleContextRestored,!1))}initFromOptions(e){let t=this.createContext(this.renderer.view,e);this.initFromContext(t)}createContext(e,t){let n;if(w.PREFER_ENV>=r.WEBGL2&&(n=e.getContext(`webgl2`,t)),n)this.webGLVersion=2;else if(this.webGLVersion=1,n=e.getContext(`webgl`,t)||e.getContext(`experimental-webgl`,t),!n)throw Error(`This browser does not support WebGL. Try using the canvas renderer`);return this.gl=n,this.getExtensions(),this.gl}getExtensions(){let{gl:e}=this,t={loseContext:e.getExtension(`WEBGL_lose_context`),anisotropicFiltering:e.getExtension(`EXT_texture_filter_anisotropic`),floatTextureLinear:e.getExtension(`OES_texture_float_linear`),s3tc:e.getExtension(`WEBGL_compressed_texture_s3tc`),s3tc_sRGB:e.getExtension(`WEBGL_compressed_texture_s3tc_srgb`),etc:e.getExtension(`WEBGL_compressed_texture_etc`),etc1:e.getExtension(`WEBGL_compressed_texture_etc1`),pvrtc:e.getExtension(`WEBGL_compressed_texture_pvrtc`)||e.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`),atc:e.getExtension(`WEBGL_compressed_texture_atc`),astc:e.getExtension(`WEBGL_compressed_texture_astc`),bptc:e.getExtension(`EXT_texture_compression_bptc`)};this.webGLVersion===1?Object.assign(this.extensions,t,{drawBuffers:e.getExtension(`WEBGL_draw_buffers`),depthTexture:e.getExtension(`WEBGL_depth_texture`),vertexArrayObject:e.getExtension(`OES_vertex_array_object`)||e.getExtension(`MOZ_OES_vertex_array_object`)||e.getExtension(`WEBKIT_OES_vertex_array_object`),uint32ElementIndex:e.getExtension(`OES_element_index_uint`),floatTexture:e.getExtension(`OES_texture_float`),floatTextureLinear:e.getExtension(`OES_texture_float_linear`),textureHalfFloat:e.getExtension(`OES_texture_half_float`),textureHalfFloatLinear:e.getExtension(`OES_texture_half_float_linear`)}):this.webGLVersion===2&&Object.assign(this.extensions,t,{colorBufferFloat:e.getExtension(`EXT_color_buffer_float`)})}handleContextLost(e){e.preventDefault(),setTimeout(()=>{this.gl.isContextLost()&&this.extensions.loseContext&&this.extensions.loseContext.restoreContext()},0)}handleContextRestored(){this.renderer.runners.contextChange.emit(this.gl)}destroy(){let e=this.renderer.view;this.renderer=null,e.removeEventListener!==void 0&&(e.removeEventListener(`webglcontextlost`,this.handleContextLost),e.removeEventListener(`webglcontextrestored`,this.handleContextRestored)),this.gl.useProgram(null),this.extensions.loseContext&&this.extensions.loseContext.loseContext()}postrender(){this.renderer.objectRenderer.renderingToScreen&&this.gl.flush()}validateContext(e){let t=e.getContextAttributes(),n=`WebGL2RenderingContext`in globalThis&&e instanceof globalThis.WebGL2RenderingContext;n&&(this.webGLVersion=2),t&&!t.stencil&&console.warn(`Provided WebGL context does not have a stencil buffer, masks may not render correctly`);let r=n||!!e.getExtension(`OES_element_index_uint`);this.supports.uint32Indices=r,r||console.warn(`Provided WebGL context does not support 32 index buffer, complex graphics may not render correctly`)}};mi.defaultOptions={context:null,antialias:!1,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:`default`},mi.extension={type:U.RendererSystem,name:`context`},W.add(mi);var hi=class{constructor(e,t){if(this.width=Math.round(e),this.height=Math.round(t),!this.width||!this.height)throw Error(`Framebuffer width or height is zero`);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 Vn(`disposeFramebuffer`),this.multisample=x.NONE}get colorTexture(){return this.colorTextures[0]}addColorTexture(e=0,t){return this.colorTextures[e]=t||new G(null,{scaleMode:f.NEAREST,resolution:1,mipmap:m.OFF,width:this.width,height:this.height}),this.dirtyId++,this.dirtyFormat++,this}addDepthTexture(e){return this.depthTexture=e||new G(null,{scaleMode:f.NEAREST,resolution:1,width:this.width,height:this.height,mipmap:m.OFF,format:c.DEPTH_COMPONENT,type:u.UNSIGNED_SHORT}),this.dirtyId++,this.dirtyFormat++,this}enableDepth(){return this.depth=!0,this.dirtyId++,this.dirtyFormat++,this}enableStencil(){return this.stencil=!0,this.dirtyId++,this.dirtyFormat++,this}resize(e,t){if(e=Math.round(e),t=Math.round(t),!e||!t)throw Error(`Framebuffer width and height must not be zero`);if(e!==this.width||t!==this.height){this.width=e,this.height=t,this.dirtyId++,this.dirtySize++;for(let n=0;n<this.colorTextures.length;n++){let r=this.colorTextures[n],i=r.resolution;r.setSize(e/i,t/i)}if(this.depthTexture){let n=this.depthTexture.resolution;this.depthTexture.setSize(e/n,t/n)}}}dispose(){this.disposeRunner.emit(this,!1)}destroyDepthTexture(){this.depthTexture&&(this.depthTexture.destroy(),this.depthTexture=null,++this.dirtyId,++this.dirtyFormat)}},gi=class extends G{constructor(e={}){typeof e==`number`&&(e={width:arguments[0],height:arguments[1],scaleMode:arguments[2],resolution:arguments[3]}),e.width=e.width??100,e.height=e.height??100,e.multisample??(e.multisample=x.NONE),super(null,e),this.mipmap=m.OFF,this.valid=!0,this._clear=new H([0,0,0,0]),this.framebuffer=new hi(this.realWidth,this.realHeight).addColorTexture(0,this),this.framebuffer.multisample=e.multisample,this.maskStack=[],this.filterStack=[{}]}set clearColor(e){this._clear.setValue(e)}get clearColor(){return this._clear.value}get clear(){return this._clear}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t){this.framebuffer.resize(e*this.resolution,t*this.resolution),this.setRealSize(this.framebuffer.width,this.framebuffer.height)}dispose(){this.framebuffer.dispose(),super.dispose()}destroy(){super.destroy(),this.framebuffer.destroyDepthTexture(),this.framebuffer=null}},_i=class extends Hn{constructor(e){let t=e,n=t.naturalWidth||t.videoWidth||t.displayWidth||t.width,r=t.naturalHeight||t.videoHeight||t.displayHeight||t.height;super(n,r),this.source=e,this.noSubImage=!1}static crossOrigin(e,t,n){n===void 0&&!t.startsWith(`data:`)?e.crossOrigin=kn(t):n!==!1&&(e.crossOrigin=typeof n==`string`?n:`anonymous`)}upload(e,t,n,r){let i=e.gl,a=t.realWidth,o=t.realHeight;if(r||=this.source,typeof HTMLImageElement<`u`&&r instanceof HTMLImageElement){if(!r.complete||r.naturalWidth===0)return!1}else if(typeof HTMLVideoElement<`u`&&r instanceof HTMLVideoElement&&r.readyState<=1)return!1;return i.pixelStorei(i.UNPACK_PREMULTIPLY_ALPHA_WEBGL,t.alphaMode===h.UNPACK),!this.noSubImage&&t.target===i.TEXTURE_2D&&n.width===a&&n.height===o?i.texSubImage2D(i.TEXTURE_2D,0,0,0,t.format,n.type,r):(n.width=a,n.height=o,i.texImage2D(t.target,0,n.internalFormat,t.format,n.type,r)),!0}update(){if(this.destroyed)return;let e=this.source,t=e.naturalWidth||e.videoWidth||e.width,n=e.naturalHeight||e.videoHeight||e.height;this.resize(t,n),super.update()}dispose(){this.source=null}},vi=class extends _i{constructor(e,t){if(t||={},typeof e==`string`){let n=new Image;_i.crossOrigin(n,e,t.crossorigin),n.src=e,e=n}super(e),!e.complete&&this._width&&this._height&&(this._width=0,this._height=0),this.url=e.src,this._process=null,this.preserveBitmap=!1,this.createBitmap=(t.createBitmap??w.CREATE_IMAGE_BITMAP)&&!!globalThis.createImageBitmap,this.alphaMode=typeof t.alphaMode==`number`?t.alphaMode:null,this.bitmap=null,this._load=null,t.autoLoad!==!1&&this.load()}load(e){return this._load?this._load:(e!==void 0&&(this.createBitmap=e),this._load=new Promise((e,t)=>{let n=this.source;this.url=n.src;let r=()=>{this.destroyed||(n.onload=null,n.onerror=null,this.update(),this._load=null,this.createBitmap?e(this.process()):e(this))};n.complete&&n.src?r():(n.onload=r,n.onerror=e=>{t(e),this.onError.emit(e)})}),this._load)}process(){let e=this.source;if(this._process!==null)return this._process;if(this.bitmap!==null||!globalThis.createImageBitmap)return Promise.resolve(this);let t=globalThis.createImageBitmap,n=!e.crossOrigin||e.crossOrigin===`anonymous`;return this._process=fetch(e.src,{mode:n?`cors`:`no-cors`}).then(e=>e.blob()).then(n=>t(n,0,0,e.width,e.height,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===h.UNPACK?`premultiply`:`none`})).then(e=>this.destroyed?Promise.reject():(this.bitmap=e,this.update(),this._process=null,Promise.resolve(this))),this._process}upload(e,t,n){if(typeof this.alphaMode==`number`&&(t.alphaMode=this.alphaMode),!this.createBitmap)return super.upload(e,t,n);if(!this.bitmap&&(this.process(),!this.bitmap))return!1;if(super.upload(e,t,n,this.bitmap),!this.preserveBitmap){let e=!0,r=t._glTextures;for(let i in r){let a=r[i];if(a!==n&&a.dirtyId!==t.dirtyId){e=!1;break}}e&&(this.bitmap.close&&this.bitmap.close(),this.bitmap=null)}return!0}dispose(){this.source.onload=null,this.source.onerror=null,super.dispose(),this.bitmap&&=(this.bitmap.close(),null),this._process=null,this._load=null}static test(e){return typeof HTMLImageElement<`u`&&(typeof e==`string`||e instanceof HTMLImageElement)}},yi=class{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(e,t,n){let r=t.width,i=t.height;if(n){let t=e.width/2/r,a=e.height/2/i,o=e.x/r+t,s=e.y/i+a;n=Z.add(n,Z.NW),this.x0=o+t*Z.uX(n),this.y0=s+a*Z.uY(n),n=Z.add(n,2),this.x1=o+t*Z.uX(n),this.y1=s+a*Z.uY(n),n=Z.add(n,2),this.x2=o+t*Z.uX(n),this.y2=s+a*Z.uY(n),n=Z.add(n,2),this.x3=o+t*Z.uX(n),this.y3=s+a*Z.uY(n)}else this.x0=e.x/r,this.y0=e.y/i,this.x1=(e.x+e.width)/r,this.y1=e.y/i,this.x2=(e.x+e.width)/r,this.y2=(e.y+e.height)/i,this.x3=e.x/r,this.y3=(e.y+e.height)/i;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}};yi.prototype.toString=function(){return`[@pixi/core:TextureUvs x0=${this.x0} y0=${this.y0} x1=${this.x1} y1=${this.y1} x2=${this.x2} y2=${this.y2} x3=${this.x3} y3=${this.y3}]`};var bi=new yi;function xi(e){e.destroy=function(){},e.on=function(){},e.once=function(){},e.emit=function(){}}var Q=class e extends tt.default{constructor(t,n,r,i,a,o,s){if(super(),this.noFrame=!1,n||=(this.noFrame=!0,new Y(0,0,1,1)),t instanceof e&&(t=t.baseTexture),this.baseTexture=t,this._frame=n,this.trim=i,this.valid=!1,this.destroyed=!1,this._uvs=bi,this.uvMatrix=null,this.orig=r||n,this._rotate=Number(a||0),a===!0)this._rotate=2;else if(this._rotate%2!=0)throw Error(`attempt to use diamond-shaped UVs. If you are sure, set rotation manually`);this.defaultAnchor=o?new J(o.x,o.y):new J(0,0),this.defaultBorders=s,this._updateID=0,this.textureCacheIds=[],t.valid?this.noFrame?t.valid&&this.onBaseTextureUpdated(t):this.frame=n:t.once(`loaded`,this.onBaseTextureUpdated,this),this.noFrame&&t.on(`update`,this.onBaseTextureUpdated,this)}update(){this.baseTexture.resource&&this.baseTexture.resource.update()}onBaseTextureUpdated(e){if(this.noFrame){if(!this.baseTexture.valid)return;this._frame.width=e.width,this._frame.height=e.height,this.valid=!0,this.updateUvs()}else this.frame=this._frame;this.emit(`update`,this)}destroy(t){if(this.baseTexture){if(t){let{resource:t}=this.baseTexture;t?.url&&yn[t.url]&&e.removeFromCache(t.url),this.baseTexture.destroy()}this.baseTexture.off(`loaded`,this.onBaseTextureUpdated,this),this.baseTexture.off(`update`,this.onBaseTextureUpdated,this),this.baseTexture=null}this._frame=null,this._uvs=null,this.trim=null,this.orig=null,this.valid=!1,e.removeFromCache(this),this.textureCacheIds=null,this.destroyed=!0,this.emit(`destroyed`,this),this.removeAllListeners()}clone(){let t=this._frame.clone(),n=this._frame===this.orig?t:this.orig.clone(),r=new e(this.baseTexture,!this.noFrame&&t,n,this.trim?.clone(),this.rotate,this.defaultAnchor,this.defaultBorders);return this.noFrame&&(r._frame=t),r}updateUvs(){this._uvs===bi&&(this._uvs=new yi),this._uvs.set(this._frame,this.baseTexture,this.rotate),this._updateID++}static from(t,n={},r=w.STRICT_TEXTURE_CACHE){let i=typeof t==`string`,a=null;i?a=t:t instanceof G?(t.cacheId||(t.cacheId=`${n?.pixiIdPrefix||`pixiid`}-${hn()}`,G.addToCache(t,t.cacheId)),a=t.cacheId):(t._pixiId||=`${n?.pixiIdPrefix||`pixiid`}_${hn()}`,a=t._pixiId);let o=yn[a];if(i&&r&&!o)throw Error(`The cacheId "${a}" does not exist in TextureCache.`);return!o&&!(t instanceof G)?(n.resolution||=An(t),o=new e(new G(t,n)),o.baseTexture.cacheId=a,G.addToCache(o.baseTexture,a),e.addToCache(o,a)):!o&&t instanceof G&&(o=new e(t),e.addToCache(o,a)),o}static fromURL(t,n){let r=Object.assign({autoLoad:!1},n?.resourceOptions),i=e.from(t,Object.assign({resourceOptions:r},n),!1),a=i.baseTexture.resource;return i.baseTexture.valid?Promise.resolve(i):a.load().then(()=>Promise.resolve(i))}static fromBuffer(t,n,r,i){return new e(G.fromBuffer(t,n,r,i))}static fromLoader(t,n,r,i){let a=new G(t,Object.assign({scaleMode:G.defaultOptions.scaleMode,resolution:An(n)},i)),{resource:o}=a;o instanceof vi&&(o.url=n);let s=new e(a);return r||=n,G.addToCache(s.baseTexture,r),e.addToCache(s,r),r!==n&&(G.addToCache(s.baseTexture,n),e.addToCache(s,n)),s.baseTexture.valid?Promise.resolve(s):new Promise(e=>{s.baseTexture.once(`loaded`,()=>e(s))})}static addToCache(e,t){t&&(e.textureCacheIds.includes(t)||e.textureCacheIds.push(t),yn[t]&&yn[t]!==e&&console.warn(`Texture added to the cache with an id [${t}] that already had an entry`),yn[t]=e)}static removeFromCache(e){if(typeof e==`string`){let t=yn[e];if(t){let n=t.textureCacheIds.indexOf(e);return n>-1&&t.textureCacheIds.splice(n,1),delete yn[e],t}}else if(e?.textureCacheIds){for(let t=0;t<e.textureCacheIds.length;++t)yn[e.textureCacheIds[t]]===e&&delete yn[e.textureCacheIds[t]];return e.textureCacheIds.length=0,e}return null}get resolution(){return this.baseTexture.resolution}get frame(){return this._frame}set frame(e){this._frame=e,this.noFrame=!1;let{x:t,y:n,width:r,height:i}=e,a=t+r>this.baseTexture.width,o=n+i>this.baseTexture.height;if(a||o){let e=a&&o?`and`:`or`,s=`X: ${t} + ${r} = ${t+r} > ${this.baseTexture.width}`,c=`Y: ${n} + ${i} = ${n+i} > ${this.baseTexture.height}`;throw Error(`Texture Error: frame does not fit inside the base Texture dimensions: ${s} ${e} ${c}`)}this.valid=r&&i&&this.baseTexture.valid,!this.trim&&!this.rotate&&(this.orig=e),this.valid&&this.updateUvs()}get rotate(){return this._rotate}set rotate(e){this._rotate=e,this.valid&&this.updateUvs()}get width(){return this.orig.width}get height(){return this.orig.height}castToBaseTexture(){return this.baseTexture}static get EMPTY(){return e._EMPTY||(e._EMPTY=new e(new G),xi(e._EMPTY),xi(e._EMPTY.baseTexture)),e._EMPTY}static get WHITE(){if(!e._WHITE){let t=w.ADAPTER.createCanvas(16,16),n=t.getContext(`2d`);t.width=16,t.height=16,n.fillStyle=`white`,n.fillRect(0,0,16,16),e._WHITE=new e(G.from(t)),xi(e._WHITE),xi(e._WHITE.baseTexture)}return e._WHITE}},Si=class e extends Q{constructor(e,t){super(e,t),this.valid=!0,this.filterFrame=null,this.filterPoolKey=null,this.updateUvs()}get framebuffer(){return this.baseTexture.framebuffer}get multisample(){return this.framebuffer.multisample}set multisample(e){this.framebuffer.multisample=e}resize(e,t,n=!0){let r=this.baseTexture.resolution,i=Math.round(e*r)/r,a=Math.round(t*r)/r;this.valid=i>0&&a>0,this._frame.width=this.orig.width=i,this._frame.height=this.orig.height=a,n&&this.baseTexture.resize(i,a),this.updateUvs()}setResolution(e){let{baseTexture:t}=this;t.resolution!==e&&(t.setResolution(e),this.resize(t.width,t.height,!1))}static create(t){return new e(new gi(t))}},Ci=class{constructor(e){this.texturePool={},this.textureOptions=e||{},this.enableFullScreen=!1,this._pixelsWidth=0,this._pixelsHeight=0}createTexture(e,t,n=x.NONE){return new Si(new gi(Object.assign({width:e,height:t,resolution:1,multisample:n},this.textureOptions)))}getOptimalTexture(e,t,n=1,r=x.NONE){let i;e=Math.max(Math.ceil(e*n-1e-6),1),t=Math.max(Math.ceil(t*n-1e-6),1),!this.enableFullScreen||e!==this._pixelsWidth||t!==this._pixelsHeight?(e=ln(e),t=ln(t),i=((e&65535)<<16|t&65535)>>>0,r>1&&(i+=r*4294967296)):i=r>1?-r:-1,this.texturePool[i]||(this.texturePool[i]=[]);let a=this.texturePool[i].pop();return a||=this.createTexture(e,t,r),a.filterPoolKey=i,a.setResolution(n),a}getFilterTexture(e,t,n){let r=this.getOptimalTexture(e.width,e.height,t||e.resolution,n||x.NONE);return r.filterFrame=e.filterFrame,r}returnTexture(e){let t=e.filterPoolKey;e.filterFrame=null,this.texturePool[t].push(e)}returnFilterTexture(e){this.returnTexture(e)}clear(e){if(e=e!==!1,e)for(let e in this.texturePool){let t=this.texturePool[e];if(t)for(let e=0;e<t.length;e++)t[e].destroy(!0)}this.texturePool={}}setScreenSize(e){if(e.width!==this._pixelsWidth||e.height!==this._pixelsHeight){this.enableFullScreen=e.width>0&&e.height>0;for(let e in this.texturePool){if(!(Number(e)<0))continue;let t=this.texturePool[e];if(t)for(let e=0;e<t.length;e++)t[e].destroy(!0);this.texturePool[e]=[]}this._pixelsWidth=e.width,this._pixelsHeight=e.height}}};Ci.SCREEN_KEY=-1;var wi=class extends er{constructor(){super(),this.addAttribute(`aVertexPosition`,new Float32Array([0,0,1,0,1,1,0,1])).addIndex([0,1,3,2])}},Ti=class extends er{constructor(){super(),this.vertices=new Float32Array([-1,-1,1,-1,1,1,-1,1]),this.uvs=new Float32Array([0,0,1,0,1,1,0,1]),this.vertexBuffer=new K(this.vertices),this.uvBuffer=new K(this.uvs),this.addAttribute(`aVertexPosition`,this.vertexBuffer).addAttribute(`aTextureCoord`,this.uvBuffer).addIndex([0,1,2,0,2,3])}map(e,t){let n=0,r=0;return this.uvs[0]=n,this.uvs[1]=r,this.uvs[2]=n+t.width/e.width,this.uvs[3]=r,this.uvs[4]=n+t.width/e.width,this.uvs[5]=r+t.height/e.height,this.uvs[6]=n,this.uvs[7]=r+t.height/e.height,n=t.x,r=t.y,this.vertices[0]=n,this.vertices[1]=r,this.vertices[2]=n+t.width,this.vertices[3]=r,this.vertices[4]=n+t.width,this.vertices[5]=r+t.height,this.vertices[6]=n,this.vertices[7]=r+t.height,this.invalidate(),this}invalidate(){return this.vertexBuffer._updateID++,this.uvBuffer._updateID++,this}},Ei=class{constructor(){this.renderTexture=null,this.target=null,this.legacy=!1,this.resolution=1,this.multisample=x.NONE,this.sourceFrame=new Y,this.destinationFrame=new Y,this.bindingSourceFrame=new Y,this.bindingDestinationFrame=new Y,this.filters=[],this.transform=null}clear(){this.target=null,this.filters=null,this.renderTexture=null}},Di=[new J,new J,new J,new J],Oi=new X,ki=class{constructor(e){this.renderer=e,this.defaultFilterStack=[{}],this.texturePool=new Ci,this.statePool=[],this.quad=new wi,this.quadUv=new Ti,this.tempRect=new Y,this.activeState={},this.globalUniforms=new Xr({outputFrame:new Y,inputSize:new Float32Array(4),inputPixel:new Float32Array(4),inputClamp:new Float32Array(4),resolution:1,filterArea:new Float32Array(4),filterClamp:new Float32Array(4)},!0),this.forceClear=!1,this.useMaxPadding=!1}init(){this.texturePool.setScreenSize(this.renderer.view)}push(e,t){let n=this.renderer,r=this.defaultFilterStack,i=this.statePool.pop()||new Ei,a=n.renderTexture,o,s;if(a.current){let e=a.current;o=e.resolution,s=e.multisample}else o=n.resolution,s=n.multisample;let c=t[0].resolution||o,l=t[0].multisample??s,u=t[0].padding,d=t[0].autoFit,f=t[0].legacy??!0;for(let e=1;e<t.length;e++){let n=t[e];c=Math.min(c,n.resolution||o),l=Math.min(l,n.multisample??s),u=this.useMaxPadding?Math.max(u,n.padding):u+n.padding,d&&=n.autoFit,f||=n.legacy??!0}r.length===1&&(this.defaultFilterStack[0].renderTexture=a.current),r.push(i),i.resolution=c,i.multisample=l,i.legacy=f,i.target=e,i.sourceFrame.copyFrom(e.filterArea||e.getBounds(!0)),i.sourceFrame.pad(u);let p=this.tempRect.copyFrom(a.sourceFrame);n.projection.transform&&this.transformAABB(Oi.copyFrom(n.projection.transform).invert(),p),d?(i.sourceFrame.fit(p),(i.sourceFrame.width<=0||i.sourceFrame.height<=0)&&(i.sourceFrame.width=0,i.sourceFrame.height=0)):i.sourceFrame.intersects(p)||(i.sourceFrame.width=0,i.sourceFrame.height=0),this.roundFrame(i.sourceFrame,a.current?a.current.resolution:n.resolution,a.sourceFrame,a.destinationFrame,n.projection.transform),i.renderTexture=this.getOptimalFilterTexture(i.sourceFrame.width,i.sourceFrame.height,c,l),i.filters=t,i.destinationFrame.width=i.renderTexture.width,i.destinationFrame.height=i.renderTexture.height;let m=this.tempRect;m.x=0,m.y=0,m.width=i.sourceFrame.width,m.height=i.sourceFrame.height,i.renderTexture.filterFrame=i.sourceFrame,i.bindingSourceFrame.copyFrom(a.sourceFrame),i.bindingDestinationFrame.copyFrom(a.destinationFrame),i.transform=n.projection.transform,n.projection.transform=null,a.bind(i.renderTexture,i.sourceFrame,m),n.framebuffer.clear(0,0,0,0)}pop(){let e=this.defaultFilterStack,t=e.pop(),n=t.filters;this.activeState=t;let r=this.globalUniforms.uniforms;r.outputFrame=t.sourceFrame,r.resolution=t.resolution;let i=r.inputSize,a=r.inputPixel,o=r.inputClamp;if(i[0]=t.destinationFrame.width,i[1]=t.destinationFrame.height,i[2]=1/i[0],i[3]=1/i[1],a[0]=Math.round(i[0]*t.resolution),a[1]=Math.round(i[1]*t.resolution),a[2]=1/a[0],a[3]=1/a[1],o[0]=.5*a[2],o[1]=.5*a[3],o[2]=t.sourceFrame.width*i[2]-.5*a[2],o[3]=t.sourceFrame.height*i[3]-.5*a[3],t.legacy){let e=r.filterArea;e[0]=t.destinationFrame.width,e[1]=t.destinationFrame.height,e[2]=t.sourceFrame.x,e[3]=t.sourceFrame.y,r.filterClamp=r.inputClamp}this.globalUniforms.update();let s=e[e.length-1];if(this.renderer.framebuffer.blit(),n.length===1)n[0].apply(this,t.renderTexture,s.renderTexture,g.BLEND,t),this.returnFilterTexture(t.renderTexture);else{let e=t.renderTexture,r=this.getOptimalFilterTexture(e.width,e.height,t.resolution);r.filterFrame=e.filterFrame;let i=0;for(i=0;i<n.length-1;++i){i===1&&t.multisample>1&&(r=this.getOptimalFilterTexture(e.width,e.height,t.resolution),r.filterFrame=e.filterFrame),n[i].apply(this,e,r,g.CLEAR,t);let a=e;e=r,r=a}n[i].apply(this,e,s.renderTexture,g.BLEND,t),i>1&&t.multisample>1&&this.returnFilterTexture(t.renderTexture),this.returnFilterTexture(e),this.returnFilterTexture(r)}t.clear(),this.statePool.push(t)}bindAndClear(e,t=g.CLEAR){let{renderTexture:n,state:r}=this.renderer;if(e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.projection.transform=this.activeState.transform:this.renderer.projection.transform=null,e?.filterFrame){let t=this.tempRect;t.x=0,t.y=0,t.width=e.filterFrame.width,t.height=e.filterFrame.height,n.bind(e,e.filterFrame,t)}else e===this.defaultFilterStack[this.defaultFilterStack.length-1].renderTexture?this.renderer.renderTexture.bind(e,this.activeState.bindingSourceFrame,this.activeState.bindingDestinationFrame):n.bind(e);let i=r.stateId&1||this.forceClear;(t===g.CLEAR||t===g.BLIT&&i)&&this.renderer.framebuffer.clear(0,0,0,0)}applyFilter(e,t,n,r){let i=this.renderer;i.state.set(e.state),this.bindAndClear(n,r),e.uniforms.uSampler=t,e.uniforms.filterGlobals=this.globalUniforms,i.shader.bind(e),e.legacy=!!e.program.attributeData.aTextureCoord,e.legacy?(this.quadUv.map(t._frame,t.filterFrame),i.geometry.bind(this.quadUv),i.geometry.draw(s.TRIANGLES)):(i.geometry.bind(this.quad),i.geometry.draw(s.TRIANGLE_STRIP))}calculateSpriteMatrix(e,t){let{sourceFrame:n,destinationFrame:r}=this.activeState,{orig:i}=t._texture,a=e.set(r.width,0,0,r.height,n.x,n.y),o=t.worldTransform.copyTo(X.TEMP_MATRIX);return o.invert(),a.prepend(o),a.scale(1/i.width,1/i.height),a.translate(t.anchor.x,t.anchor.y),a}destroy(){this.renderer=null,this.texturePool.clear(!1)}getOptimalFilterTexture(e,t,n=1,r=x.NONE){return this.texturePool.getOptimalTexture(e,t,n,r)}getFilterTexture(e,t,n){if(typeof e==`number`){let n=e;e=t,t=n}e||=this.activeState.renderTexture;let r=this.texturePool.getOptimalTexture(e.width,e.height,t||e.resolution,n||x.NONE);return r.filterFrame=e.filterFrame,r}returnFilterTexture(e){this.texturePool.returnTexture(e)}emptyPool(){this.texturePool.clear(!0)}resize(){this.texturePool.setScreenSize(this.renderer.view)}transformAABB(e,t){let n=Di[0],r=Di[1],i=Di[2],a=Di[3];n.set(t.left,t.top),r.set(t.left,t.bottom),i.set(t.right,t.top),a.set(t.right,t.bottom),e.apply(n,n),e.apply(r,r),e.apply(i,i),e.apply(a,a);let o=Math.min(n.x,r.x,i.x,a.x),s=Math.min(n.y,r.y,i.y,a.y),c=Math.max(n.x,r.x,i.x,a.x),l=Math.max(n.y,r.y,i.y,a.y);t.x=o,t.y=s,t.width=c-o,t.height=l-s}roundFrame(e,t,n,r,i){if(!(e.width<=0||e.height<=0||n.width<=0||n.height<=0)){if(i){let{a:e,b:t,c:n,d:r}=i;if((Math.abs(t)>1e-4||Math.abs(n)>1e-4)&&(Math.abs(e)>1e-4||Math.abs(r)>1e-4))return}i=i?Oi.copyFrom(i):Oi.identity(),i.translate(-n.x,-n.y).scale(r.width/n.width,r.height/n.height).translate(r.x,r.y),this.transformAABB(i,e),e.ceil(t),this.transformAABB(i.invert(),e)}}};ki.extension={type:U.RendererSystem,name:`filter`},W.add(ki);var Ai=class{constructor(e){this.framebuffer=e,this.stencil=null,this.dirtyId=-1,this.dirtyFormat=-1,this.dirtySize=-1,this.multisample=x.NONE,this.msaaBuffer=null,this.blitFramebuffer=null,this.mipLevel=0}},ji=new Y,Mi=class{constructor(e){this.renderer=e,this.managedFramebuffers=[],this.unknownFramebuffer=new hi(10,10),this.msaaSamples=null}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.current=this.unknownFramebuffer,this.viewport=new Y,this.hasMRT=!0,this.writeDepthTexture=!0,this.renderer.context.webGLVersion===1){let t=this.renderer.context.extensions.drawBuffers,n=this.renderer.context.extensions.depthTexture;w.PREFER_ENV===r.WEBGL_LEGACY&&(t=null,n=null),t?e.drawBuffers=e=>t.drawBuffersWEBGL(e):(this.hasMRT=!1,e.drawBuffers=()=>{}),n||(this.writeDepthTexture=!1)}else this.msaaSamples=e.getInternalformatParameter(e.RENDERBUFFER,e.RGBA8,e.SAMPLES)}bind(e,t,n=0){let{gl:r}=this;if(e){let i=e.glFramebuffers[this.CONTEXT_UID]||this.initFramebuffer(e);this.current!==e&&(this.current=e,r.bindFramebuffer(r.FRAMEBUFFER,i.framebuffer)),i.mipLevel!==n&&(e.dirtyId++,e.dirtyFormat++,i.mipLevel=n),i.dirtyId!==e.dirtyId&&(i.dirtyId=e.dirtyId,i.dirtyFormat===e.dirtyFormat?i.dirtySize!==e.dirtySize&&(i.dirtySize=e.dirtySize,this.resizeFramebuffer(e)):(i.dirtyFormat=e.dirtyFormat,i.dirtySize=e.dirtySize,this.updateFramebuffer(e,n)));for(let t=0;t<e.colorTextures.length;t++){let n=e.colorTextures[t];this.renderer.texture.unbind(n.parentTextureArray||n)}if(e.depthTexture&&this.renderer.texture.unbind(e.depthTexture),t){let e=t.width>>n,r=t.height>>n,i=e/t.width;this.setViewport(t.x*i,t.y*i,e,r)}else{let t=e.width>>n,r=e.height>>n;this.setViewport(0,0,t,r)}}else this.current&&(this.current=null,r.bindFramebuffer(r.FRAMEBUFFER,null)),t?this.setViewport(t.x,t.y,t.width,t.height):this.setViewport(0,0,this.renderer.width,this.renderer.height)}setViewport(e,t,n,r){let i=this.viewport;e=Math.round(e),t=Math.round(t),n=Math.round(n),r=Math.round(r),(i.width!==n||i.height!==r||i.x!==e||i.y!==t)&&(i.x=e,i.y=t,i.width=n,i.height=r,this.gl.viewport(e,t,n,r))}get size(){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}}clear(e,t,n,r,i=a.COLOR|a.DEPTH){let{gl:o}=this;o.clearColor(e,t,n,r),o.clear(i)}initFramebuffer(e){let{gl:t}=this,n=new Ai(t.createFramebuffer());return n.multisample=this.detectSamples(e.multisample),e.glFramebuffers[this.CONTEXT_UID]=n,this.managedFramebuffers.push(e),e.disposeRunner.add(this),n}resizeFramebuffer(e){let{gl:t}=this,n=e.glFramebuffers[this.CONTEXT_UID];if(n.stencil){t.bindRenderbuffer(t.RENDERBUFFER,n.stencil);let r;r=this.renderer.context.webGLVersion===1?t.DEPTH_STENCIL:e.depth&&e.stencil?t.DEPTH24_STENCIL8:e.depth?t.DEPTH_COMPONENT24:t.STENCIL_INDEX8,n.msaaBuffer?t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,r,e.width,e.height):t.renderbufferStorage(t.RENDERBUFFER,r,e.width,e.height)}let r=e.colorTextures,i=r.length;t.drawBuffers||(i=Math.min(i,1));for(let a=0;a<i;a++){let i=r[a],o=i.parentTextureArray||i;this.renderer.texture.bind(o,0),a===0&&n.msaaBuffer&&(t.bindRenderbuffer(t.RENDERBUFFER,n.msaaBuffer),t.renderbufferStorageMultisample(t.RENDERBUFFER,n.multisample,o._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height))}e.depthTexture&&this.writeDepthTexture&&this.renderer.texture.bind(e.depthTexture,0)}updateFramebuffer(e,t){let{gl:n}=this,r=e.glFramebuffers[this.CONTEXT_UID],i=e.colorTextures,a=i.length;n.drawBuffers||(a=Math.min(a,1)),r.multisample>1&&this.canMultisampleFramebuffer(e)?r.msaaBuffer=r.msaaBuffer||n.createRenderbuffer():r.msaaBuffer&&(n.deleteRenderbuffer(r.msaaBuffer),r.msaaBuffer=null,r.blitFramebuffer&&=(r.blitFramebuffer.dispose(),null));let o=[];for(let s=0;s<a;s++){let a=i[s],c=a.parentTextureArray||a;this.renderer.texture.bind(c,0),s===0&&r.msaaBuffer?(n.bindRenderbuffer(n.RENDERBUFFER,r.msaaBuffer),n.renderbufferStorageMultisample(n.RENDERBUFFER,r.multisample,c._glTextures[this.CONTEXT_UID].internalFormat,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0,n.RENDERBUFFER,r.msaaBuffer)):(n.framebufferTexture2D(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+s,a.target,c._glTextures[this.CONTEXT_UID].texture,t),o.push(n.COLOR_ATTACHMENT0+s))}if(o.length>1&&n.drawBuffers(o),e.depthTexture&&this.writeDepthTexture){let r=e.depthTexture;this.renderer.texture.bind(r,0),n.framebufferTexture2D(n.FRAMEBUFFER,n.DEPTH_ATTACHMENT,n.TEXTURE_2D,r._glTextures[this.CONTEXT_UID].texture,t)}if((e.stencil||e.depth)&&!(e.depthTexture&&this.writeDepthTexture)){r.stencil=r.stencil||n.createRenderbuffer();let t,i;this.renderer.context.webGLVersion===1?(t=n.DEPTH_STENCIL_ATTACHMENT,i=n.DEPTH_STENCIL):e.depth&&e.stencil?(t=n.DEPTH_STENCIL_ATTACHMENT,i=n.DEPTH24_STENCIL8):e.depth?(t=n.DEPTH_ATTACHMENT,i=n.DEPTH_COMPONENT24):(t=n.STENCIL_ATTACHMENT,i=n.STENCIL_INDEX8),n.bindRenderbuffer(n.RENDERBUFFER,r.stencil),r.msaaBuffer?n.renderbufferStorageMultisample(n.RENDERBUFFER,r.multisample,i,e.width,e.height):n.renderbufferStorage(n.RENDERBUFFER,i,e.width,e.height),n.framebufferRenderbuffer(n.FRAMEBUFFER,t,n.RENDERBUFFER,r.stencil)}else r.stencil&&=(n.deleteRenderbuffer(r.stencil),null)}canMultisampleFramebuffer(e){return this.renderer.context.webGLVersion!==1&&e.colorTextures.length<=1&&!e.depthTexture}detectSamples(e){let{msaaSamples:t}=this,n=x.NONE;if(e<=1||t===null)return n;for(let r=0;r<t.length;r++)if(t[r]<=e){n=t[r];break}return n===1&&(n=x.NONE),n}blit(e,t,n){let{current:r,renderer:i,gl:a,CONTEXT_UID:o}=this;if(i.context.webGLVersion!==2||!r)return;let s=r.glFramebuffers[o];if(!s)return;if(!e){if(!s.msaaBuffer)return;let t=r.colorTextures[0];if(!t)return;s.blitFramebuffer||(s.blitFramebuffer=new hi(r.width,r.height),s.blitFramebuffer.addColorTexture(0,t)),e=s.blitFramebuffer,e.colorTextures[0]!==t&&(e.colorTextures[0]=t,e.dirtyId++,e.dirtyFormat++),(e.width!==r.width||e.height!==r.height)&&(e.width=r.width,e.height=r.height,e.dirtyId++,e.dirtySize++)}t||(t=ji,t.width=r.width,t.height=r.height),n||=t;let c=t.width===n.width&&t.height===n.height;this.bind(e),a.bindFramebuffer(a.READ_FRAMEBUFFER,s.framebuffer),a.blitFramebuffer(t.left,t.top,t.right,t.bottom,n.left,n.top,n.right,n.bottom,a.COLOR_BUFFER_BIT,c?a.NEAREST:a.LINEAR),a.bindFramebuffer(a.READ_FRAMEBUFFER,e.glFramebuffers[this.CONTEXT_UID].framebuffer)}disposeFramebuffer(e,t){let n=e.glFramebuffers[this.CONTEXT_UID],r=this.gl;if(!n)return;delete e.glFramebuffers[this.CONTEXT_UID];let i=this.managedFramebuffers.indexOf(e);i>=0&&this.managedFramebuffers.splice(i,1),e.disposeRunner.remove(this),t||(r.deleteFramebuffer(n.framebuffer),n.msaaBuffer&&r.deleteRenderbuffer(n.msaaBuffer),n.stencil&&r.deleteRenderbuffer(n.stencil)),n.blitFramebuffer&&this.disposeFramebuffer(n.blitFramebuffer,t)}disposeAll(e){let t=this.managedFramebuffers;this.managedFramebuffers=[];for(let n=0;n<t.length;n++)this.disposeFramebuffer(t[n],e)}forceStencil(){let e=this.current;if(!e)return;let t=e.glFramebuffers[this.CONTEXT_UID];if(!t||t.stencil&&e.stencil)return;e.stencil=!0;let n=e.width,r=e.height,i=this.gl,a=t.stencil=i.createRenderbuffer();i.bindRenderbuffer(i.RENDERBUFFER,a);let o,s;this.renderer.context.webGLVersion===1?(o=i.DEPTH_STENCIL_ATTACHMENT,s=i.DEPTH_STENCIL):e.depth?(o=i.DEPTH_STENCIL_ATTACHMENT,s=i.DEPTH24_STENCIL8):(o=i.STENCIL_ATTACHMENT,s=i.STENCIL_INDEX8),t.msaaBuffer?i.renderbufferStorageMultisample(i.RENDERBUFFER,t.multisample,s,n,r):i.renderbufferStorage(i.RENDERBUFFER,s,n,r),i.framebufferRenderbuffer(i.FRAMEBUFFER,o,i.RENDERBUFFER,a)}reset(){this.current=this.unknownFramebuffer,this.viewport=new Y}destroy(){this.renderer=null}};Mi.extension={type:U.RendererSystem,name:`framebuffer`},W.add(Mi);var Ni={5126:4,5123:2,5121:1},Pi=class{constructor(e){this.renderer=e,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0,this.canUseUInt32ElementIndex=!1,this.managedGeometries={}}contextChange(){this.disposeAll(!0);let e=this.gl=this.renderer.gl,t=this.renderer.context;if(this.CONTEXT_UID=this.renderer.CONTEXT_UID,t.webGLVersion!==2){let t=this.renderer.context.extensions.vertexArrayObject;w.PREFER_ENV===r.WEBGL_LEGACY&&(t=null),t?(e.createVertexArray=()=>t.createVertexArrayOES(),e.bindVertexArray=e=>t.bindVertexArrayOES(e),e.deleteVertexArray=e=>t.deleteVertexArrayOES(e)):(this.hasVao=!1,e.createVertexArray=()=>null,e.bindVertexArray=()=>null,e.deleteVertexArray=()=>null)}if(t.webGLVersion!==2){let t=e.getExtension(`ANGLE_instanced_arrays`);t?(e.vertexAttribDivisor=(e,n)=>t.vertexAttribDivisorANGLE(e,n),e.drawElementsInstanced=(e,n,r,i,a)=>t.drawElementsInstancedANGLE(e,n,r,i,a),e.drawArraysInstanced=(e,n,r,i)=>t.drawArraysInstancedANGLE(e,n,r,i)):this.hasInstance=!1}this.canUseUInt32ElementIndex=t.webGLVersion===2||!!t.extensions.uint32ElementIndex}bind(e,t){t||=this.renderer.shader.shader;let{gl:n}=this,r=e.glVertexArrayObjects[this.CONTEXT_UID],i=!1;r||(this.managedGeometries[e.id]=e,e.disposeRunner.add(this),e.glVertexArrayObjects[this.CONTEXT_UID]=r={},i=!0);let a=r[t.program.id]||this.initGeometryVao(e,t,i);this._activeGeometry=e,this._activeVao!==a&&(this._activeVao=a,this.hasVao?n.bindVertexArray(a):this.activateVao(e,t.program)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){let e=this._activeGeometry,t=this.renderer.buffer;for(let n=0;n<e.buffers.length;n++){let r=e.buffers[n];t.update(r)}}checkCompatibility(e,t){let n=e.attributes,r=t.attributeData;for(let e in r)if(!n[e])throw Error(`shader and geometry incompatible, geometry missing the "${e}" attribute`)}getSignature(e,t){let n=e.attributes,r=t.attributeData,i=[`g`,e.id];for(let e in n)r[e]&&i.push(e,r[e].location);return i.join(`-`)}initGeometryVao(e,t,n=!0){let r=this.gl,i=this.CONTEXT_UID,a=this.renderer.buffer,o=t.program;o.glPrograms[i]||this.renderer.shader.generateProgram(t),this.checkCompatibility(e,o);let s=this.getSignature(e,o),c=e.glVertexArrayObjects[this.CONTEXT_UID],l=c[s];if(l)return c[o.id]=l,l;let u=e.buffers,d=e.attributes,f={},p={};for(let e in u)f[e]=0,p[e]=0;for(let e in d)!d[e].size&&o.attributeData[e]?d[e].size=o.attributeData[e].size:d[e].size||console.warn(`PIXI Geometry attribute '${e}' size cannot be determined (likely the bound shader does not have the attribute)`),f[d[e].buffer]+=d[e].size*Ni[d[e].type];for(let e in d){let t=d[e],n=t.size;t.stride===void 0&&(t.stride=f[t.buffer]===n*Ni[t.type]?0:f[t.buffer]),t.start===void 0&&(t.start=p[t.buffer],p[t.buffer]+=n*Ni[t.type])}l=r.createVertexArray(),r.bindVertexArray(l);for(let e=0;e<u.length;e++){let t=u[e];a.bind(t),n&&t._glBuffers[i].refCount++}return this.activateVao(e,o),c[o.id]=l,c[s]=l,r.bindVertexArray(null),a.unbind(S.ARRAY_BUFFER),l}disposeGeometry(e,t){if(!this.managedGeometries[e.id])return;delete this.managedGeometries[e.id];let n=e.glVertexArrayObjects[this.CONTEXT_UID],r=this.gl,i=e.buffers,a=this.renderer?.buffer;if(e.disposeRunner.remove(this),n){if(a)for(let e=0;e<i.length;e++){let n=i[e]._glBuffers[this.CONTEXT_UID];n&&(n.refCount--,n.refCount===0&&!t&&a.dispose(i[e],t))}if(!t){for(let e in n)if(e[0]===`g`){let t=n[e];this._activeVao===t&&this.unbind(),r.deleteVertexArray(t)}}delete e.glVertexArrayObjects[this.CONTEXT_UID]}}disposeAll(e){let t=Object.keys(this.managedGeometries);for(let n=0;n<t.length;n++)this.disposeGeometry(this.managedGeometries[t[n]],e)}activateVao(e,t){let n=this.gl,r=this.CONTEXT_UID,i=this.renderer.buffer,a=e.buffers,o=e.attributes;e.indexBuffer&&i.bind(e.indexBuffer);let s=null;for(let e in o){let c=o[e],l=a[c.buffer],u=l._glBuffers[r];if(t.attributeData[e]){s!==u&&(i.bind(l),s=u);let r=t.attributeData[e].location;if(n.enableVertexAttribArray(r),n.vertexAttribPointer(r,c.size,c.type||n.FLOAT,c.normalized,c.stride,c.start),c.instance){if(this.hasInstance)n.vertexAttribDivisor(r,c.divisor);else throw Error(`geometry error, GPU Instancing is not supported on this device`)}}}}draw(e,t,n,r){let{gl:i}=this,a=this._activeGeometry;if(a.indexBuffer){let o=a.indexBuffer.data.BYTES_PER_ELEMENT,s=o===2?i.UNSIGNED_SHORT:i.UNSIGNED_INT;o===2||o===4&&this.canUseUInt32ElementIndex?a.instanced?i.drawElementsInstanced(e,t||a.indexBuffer.data.length,s,(n||0)*o,r||1):i.drawElements(e,t||a.indexBuffer.data.length,s,(n||0)*o):console.warn(`unsupported index buffer type: uint32`)}else a.instanced?i.drawArraysInstanced(e,n,t||a.getSize(),r||1):i.drawArrays(e,n,t||a.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this.renderer=null}};Pi.extension={type:U.RendererSystem,name:`geometry`},W.add(Pi);var Fi=new X,Ii=class{constructor(e,t){this._texture=e,this.mapCoord=new X,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,this.clampMargin=typeof t>`u`?.5:t,this.isSimple=!1}get texture(){return this._texture}set texture(e){this._texture=e,this._textureID=-1}multiplyUvs(e,t){t===void 0&&(t=e);let n=this.mapCoord;for(let r=0;r<e.length;r+=2){let i=e[r],a=e[r+1];t[r]=i*n.a+a*n.c+n.tx,t[r+1]=i*n.b+a*n.d+n.ty}return t}update(e){let t=this._texture;if(!t||!t.valid||!e&&this._textureID===t._updateID)return!1;this._textureID=t._updateID,this._updateID++;let n=t._uvs;this.mapCoord.set(n.x1-n.x0,n.y1-n.y0,n.x3-n.x0,n.y3-n.y0,n.x0,n.y0);let r=t.orig,i=t.trim;i&&(Fi.set(r.width/i.width,0,0,r.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Fi));let a=t.baseTexture,o=this.uClampFrame,s=this.clampMargin/a.resolution,c=this.clampOffset;return o[0]=(t._frame.x+s+c)/a.width,o[1]=(t._frame.y+s+c)/a.height,o[2]=(t._frame.x+t._frame.width-s+c)/a.width,o[3]=(t._frame.y+t._frame.height-s+c)/a.height,this.uClampOffset[0]=c/a.realWidth,this.uClampOffset[1]=c/a.realHeight,this.isSimple=t._frame.width===a.width&&t._frame.height===a.height&&t.rotate===0,!0}},Li=`varying vec2 vMaskCoord;
|
|
379
|
+
varying vec2 vTextureCoord;
|
|
380
|
+
|
|
381
|
+
uniform sampler2D uSampler;
|
|
382
|
+
uniform sampler2D mask;
|
|
383
|
+
uniform float alpha;
|
|
384
|
+
uniform float npmAlpha;
|
|
385
|
+
uniform vec4 maskClamp;
|
|
386
|
+
|
|
387
|
+
void main(void)
|
|
388
|
+
{
|
|
389
|
+
float clip = step(3.5,
|
|
390
|
+
step(maskClamp.x, vMaskCoord.x) +
|
|
391
|
+
step(maskClamp.y, vMaskCoord.y) +
|
|
392
|
+
step(vMaskCoord.x, maskClamp.z) +
|
|
393
|
+
step(vMaskCoord.y, maskClamp.w));
|
|
394
|
+
|
|
395
|
+
vec4 original = texture2D(uSampler, vTextureCoord);
|
|
396
|
+
vec4 masky = texture2D(mask, vMaskCoord);
|
|
397
|
+
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
|
|
398
|
+
|
|
399
|
+
original *= (alphaMul * masky.r * alpha * clip);
|
|
400
|
+
|
|
401
|
+
gl_FragColor = original;
|
|
402
|
+
}
|
|
403
|
+
`,Ri=`attribute vec2 aVertexPosition;
|
|
404
|
+
attribute vec2 aTextureCoord;
|
|
405
|
+
|
|
406
|
+
uniform mat3 projectionMatrix;
|
|
407
|
+
uniform mat3 otherMatrix;
|
|
408
|
+
|
|
409
|
+
varying vec2 vMaskCoord;
|
|
410
|
+
varying vec2 vTextureCoord;
|
|
411
|
+
|
|
412
|
+
void main(void)
|
|
413
|
+
{
|
|
414
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
415
|
+
|
|
416
|
+
vTextureCoord = aTextureCoord;
|
|
417
|
+
vMaskCoord = ( otherMatrix * vec3( aTextureCoord, 1.0) ).xy;
|
|
418
|
+
}
|
|
419
|
+
`,zi=class extends ui{constructor(e,t,n){let r=null;typeof e!=`string`&&t===void 0&&n===void 0&&(r=e,e=void 0,t=void 0,n=void 0),super(e||Ri,t||Li,n),this.maskSprite=r,this.maskMatrix=new X}get maskSprite(){return this._maskSprite}set maskSprite(e){this._maskSprite=e,this._maskSprite&&(this._maskSprite.renderable=!1)}apply(e,t,n,r){let i=this._maskSprite,a=i._texture;a.valid&&(a.uvMatrix||=new Ii(a,0),a.uvMatrix.update(),this.uniforms.npmAlpha=+!a.baseTexture.alphaMode,this.uniforms.mask=a,this.uniforms.otherMatrix=e.calculateSpriteMatrix(this.maskMatrix,i).prepend(a.uvMatrix.mapCoord),this.uniforms.alpha=i.worldAlpha,this.uniforms.maskClamp=a.uvMatrix.uClampFrame,e.applyFilter(this,t,n,r))}},Bi=class{constructor(e=null){this.type=y.NONE,this.autoDetect=!0,this.maskObject=e||null,this.pooled=!1,this.isMaskData=!0,this.resolution=null,this.multisample=ui.defaultMultisample,this.enabled=!0,this.colorMask=15,this._filters=null,this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null,this._scissorRectLocal=null,this._colorMask=15,this._target=null}get filter(){return this._filters?this._filters[0]:null}set filter(e){e?this._filters?this._filters[0]=e:this._filters=[e]:this._filters=null}reset(){this.pooled&&(this.maskObject=null,this.type=y.NONE,this.autoDetect=!0),this._target=null,this._scissorRectLocal=null}copyCountersOrReset(e){e?(this._stencilCounter=e._stencilCounter,this._scissorCounter=e._scissorCounter,this._scissorRect=e._scissorRect):(this._stencilCounter=0,this._scissorCounter=0,this._scissorRect=null)}},Vi=class{constructor(e){this.renderer=e,this.enableScissor=!0,this.alphaMaskPool=[],this.maskDataPool=[],this.maskStack=[],this.alphaMaskIndex=0}setMaskStack(e){this.maskStack=e,this.renderer.scissor.setMaskStack(e),this.renderer.stencil.setMaskStack(e)}push(e,t){let n=t;if(!n.isMaskData){let e=this.maskDataPool.pop()||new Bi;e.pooled=!0,e.maskObject=t,n=e}let r=this.maskStack.length===0?null:this.maskStack[this.maskStack.length-1];if(n.copyCountersOrReset(r),n._colorMask=r?r._colorMask:15,n.autoDetect&&this.detect(n),n._target=e,n.type!==y.SPRITE&&this.maskStack.push(n),n.enabled)switch(n.type){case y.SCISSOR:this.renderer.scissor.push(n);break;case y.STENCIL:this.renderer.stencil.push(n);break;case y.SPRITE:n.copyCountersOrReset(null),this.pushSpriteMask(n);break;case y.COLOR:this.pushColorMask(n)}n.type===y.SPRITE&&this.maskStack.push(n)}pop(e){let t=this.maskStack.pop();if(t&&t._target===e){if(t.enabled)switch(t.type){case y.SCISSOR:this.renderer.scissor.pop(t);break;case y.STENCIL:this.renderer.stencil.pop(t.maskObject);break;case y.SPRITE:this.popSpriteMask(t);break;case y.COLOR:this.popColorMask(t)}if(t.reset(),t.pooled&&this.maskDataPool.push(t),this.maskStack.length!==0){let e=this.maskStack[this.maskStack.length-1];e.type===y.SPRITE&&e._filters&&(e._filters[0].maskSprite=e.maskObject)}}}detect(e){let t=e.maskObject;e.type=t?t.isSprite?y.SPRITE:this.enableScissor&&this.renderer.scissor.testScissor(e)?y.SCISSOR:y.STENCIL:y.COLOR}pushSpriteMask(e){let{maskObject:t}=e,n=e._target,r=e._filters;r||(r=this.alphaMaskPool[this.alphaMaskIndex],r||=this.alphaMaskPool[this.alphaMaskIndex]=[new zi]),r[0].resolution=e.resolution,r[0].multisample=e.multisample,r[0].maskSprite=t;let i=n.filterArea;n.filterArea=t.getBounds(!0),this.renderer.filter.push(n,r),n.filterArea=i,e._filters||this.alphaMaskIndex++}popSpriteMask(e){this.renderer.filter.pop(),e._filters?e._filters[0].maskSprite=null:(this.alphaMaskIndex--,this.alphaMaskPool[this.alphaMaskIndex][0].maskSprite=null)}pushColorMask(e){let t=e._colorMask,n=e._colorMask=t&e.colorMask;n!==t&&this.renderer.gl.colorMask(!!(n&1),!!(n&2),!!(n&4),!!(n&8))}popColorMask(e){let t=e._colorMask,n=this.maskStack.length>0?this.maskStack[this.maskStack.length-1]._colorMask:15;n!==t&&this.renderer.gl.colorMask(!!(n&1),!!(n&2),!!(n&4),!!(n&8))}destroy(){this.renderer=null}};Vi.extension={type:U.RendererSystem,name:`mask`},W.add(Vi);var Hi=class{constructor(e){this.renderer=e,this.maskStack=[],this.glConst=0}getStackLength(){return this.maskStack.length}setMaskStack(e){let{gl:t}=this.renderer,n=this.getStackLength();this.maskStack=e;let r=this.getStackLength();r!==n&&(r===0?t.disable(this.glConst):(t.enable(this.glConst),this._useCurrent()))}_useCurrent(){}destroy(){this.renderer=null,this.maskStack=null}},Ui=new X,Wi=[],Gi=class e extends Hi{constructor(e){super(e),this.glConst=w.ADAPTER.getWebGLRenderingContext().SCISSOR_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._scissorCounter:0}calcScissorRect(e){if(e._scissorRectLocal)return;let t=e._scissorRect,{maskObject:n}=e,{renderer:r}=this,i=r.renderTexture,a=n.getBounds(!0,Wi.pop()??new Y);this.roundFrameToPixels(a,i.current?i.current.resolution:r.resolution,i.sourceFrame,i.destinationFrame,r.projection.transform),t&&a.fit(t),e._scissorRectLocal=a}static isMatrixRotated(e){if(!e)return!1;let{a:t,b:n,c:r,d:i}=e;return(Math.abs(n)>1e-4||Math.abs(r)>1e-4)&&(Math.abs(t)>1e-4||Math.abs(i)>1e-4)}testScissor(t){let{maskObject:n}=t;if(!n.isFastRect||!n.isFastRect()||e.isMatrixRotated(n.worldTransform)||e.isMatrixRotated(this.renderer.projection.transform))return!1;this.calcScissorRect(t);let r=t._scissorRectLocal;return r.width>0&&r.height>0}roundFrameToPixels(t,n,r,i,a){e.isMatrixRotated(a)||(a=a?Ui.copyFrom(a):Ui.identity(),a.translate(-r.x,-r.y).scale(i.width/r.width,i.height/r.height).translate(i.x,i.y),this.renderer.filter.transformAABB(a,t),t.fit(i),t.x=Math.round(t.x*n),t.y=Math.round(t.y*n),t.width=Math.round(t.width*n),t.height=Math.round(t.height*n))}push(e){e._scissorRectLocal||this.calcScissorRect(e);let{gl:t}=this.renderer;e._scissorRect||t.enable(t.SCISSOR_TEST),e._scissorCounter++,e._scissorRect=e._scissorRectLocal,this._useCurrent()}pop(e){let{gl:t}=this.renderer;e&&Wi.push(e._scissorRectLocal),this.getStackLength()>0?this._useCurrent():t.disable(t.SCISSOR_TEST)}_useCurrent(){let e=this.maskStack[this.maskStack.length-1]._scissorRect,t;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)}};Gi.extension={type:U.RendererSystem,name:`scissor`};var Ki=Gi;W.add(Ki);var qi=class extends Hi{constructor(e){super(e),this.glConst=w.ADAPTER.getWebGLRenderingContext().STENCIL_TEST}getStackLength(){let e=this.maskStack[this.maskStack.length-1];return e?e._stencilCounter:0}push(e){let t=e.maskObject,{gl:n}=this.renderer,r=e._stencilCounter;r===0&&(this.renderer.framebuffer.forceStencil(),n.clearStencil(0),n.clear(n.STENCIL_BUFFER_BIT),n.enable(n.STENCIL_TEST)),e._stencilCounter++;let i=e._colorMask;i!==0&&(e._colorMask=0,n.colorMask(!1,!1,!1,!1)),n.stencilFunc(n.EQUAL,r,4294967295),n.stencilOp(n.KEEP,n.KEEP,n.INCR),t.renderable=!0,t.render(this.renderer),this.renderer.batch.flush(),t.renderable=!1,i!==0&&(e._colorMask=i,n.colorMask(!!(i&1),!!(i&2),!!(i&4),!!(i&8))),this._useCurrent()}pop(e){let t=this.renderer.gl;if(this.getStackLength()===0)t.disable(t.STENCIL_TEST);else{let n=this.maskStack.length===0?null:this.maskStack[this.maskStack.length-1],r=n?n._colorMask:15;r!==0&&(n._colorMask=0,t.colorMask(!1,!1,!1,!1)),t.stencilOp(t.KEEP,t.KEEP,t.DECR),e.renderable=!0,e.render(this.renderer),this.renderer.batch.flush(),e.renderable=!1,r!==0&&(n._colorMask=r,t.colorMask(!!(r&1),!!(r&2),!!(r&4),!!(r&8))),this._useCurrent()}}_useCurrent(){let e=this.renderer.gl;e.stencilFunc(e.EQUAL,this.getStackLength(),4294967295),e.stencilOp(e.KEEP,e.KEEP,e.KEEP)}};qi.extension={type:U.RendererSystem,name:`stencil`},W.add(qi);var Ji=class{constructor(e){this.renderer=e,this.plugins={},Object.defineProperties(this.plugins,{extract:{enumerable:!1,get(){return z(`7.0.0`,`renderer.plugins.extract has moved to renderer.extract`),e.extract}},prepare:{enumerable:!1,get(){return z(`7.0.0`,`renderer.plugins.prepare has moved to renderer.prepare`),e.prepare}},interaction:{enumerable:!1,get(){return z(`7.0.0`,`renderer.plugins.interaction has been deprecated, use renderer.events`),e.events}}})}init(){let e=this.rendererPlugins;for(let t in e)this.plugins[t]=new e[t](this.renderer)}destroy(){for(let e in this.plugins)this.plugins[e].destroy(),this.plugins[e]=null}};Ji.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:`_plugin`},W.add(Ji);var Yi=class{constructor(e){this.renderer=e,this.destinationFrame=null,this.sourceFrame=null,this.defaultFrame=null,this.projectionMatrix=new X,this.transform=null}update(e,t,n,r){this.destinationFrame=e||this.destinationFrame||this.defaultFrame,this.sourceFrame=t||this.sourceFrame||e,this.calculateProjection(this.destinationFrame,this.sourceFrame,n,r),this.transform&&this.projectionMatrix.append(this.transform);let i=this.renderer;i.globalUniforms.uniforms.projectionMatrix=this.projectionMatrix,i.globalUniforms.update(),i.shader.shader&&i.shader.syncUniformGroup(i.shader.shader.uniforms.globals)}calculateProjection(e,t,n,r){let i=this.projectionMatrix,a=r?-1:1;i.identity(),i.a=1/t.width*2,i.d=a*(1/t.height*2),i.tx=-1-t.x*i.a,i.ty=-a-t.y*i.d}setTransform(e){}destroy(){this.renderer=null}};Yi.extension={type:U.RendererSystem,name:`projection`},W.add(Yi);var Xi=new br,Zi=new Y,Qi=class{constructor(e){this.renderer=e,this._tempMatrix=new X}generateTexture(e,t){let{region:n,...r}=t||{},i=n?.copyTo(Zi)||e.getLocalBounds(Zi,!0),a=r.resolution||this.renderer.resolution;i.width=Math.max(i.width,1/a),i.height=Math.max(i.height,1/a),r.width=i.width,r.height=i.height,r.resolution=a,r.multisample??=this.renderer.multisample;let o=Si.create(r);this._tempMatrix.tx=-i.x,this._tempMatrix.ty=-i.y;let s=e.transform;return e.transform=Xi,this.renderer.render(e,{renderTexture:o,transform:this._tempMatrix,skipUpdateTransform:!!e.parent,blit:!0}),e.transform=s,o}destroy(){}};Qi.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:`textureGenerator`},W.add(Qi);var $i=new Y,ea=new Y,ta=class{constructor(e){this.renderer=e,this.defaultMaskStack=[],this.current=null,this.sourceFrame=new Y,this.destinationFrame=new Y,this.viewportFrame=new Y}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}bind(e=null,t,n){let r=this.renderer;this.current=e;let i,a,o;e?(i=e.baseTexture,o=i.resolution,t||=($i.width=e.frame.width,$i.height=e.frame.height,$i),n||=(ea.x=e.frame.x,ea.y=e.frame.y,ea.width=t.width,ea.height=t.height,ea),a=i.framebuffer):(o=r.resolution,t||=($i.width=r._view.screen.width,$i.height=r._view.screen.height,$i),n||(n=$i,n.width=t.width,n.height=t.height));let s=this.viewportFrame;s.x=n.x*o,s.y=n.y*o,s.width=n.width*o,s.height=n.height*o,e||(s.y=r.view.height-(s.y+s.height)),s.ceil(),this.renderer.framebuffer.bind(a,s),this.renderer.projection.update(n,t,o,!a),e?this.renderer.mask.setMaskStack(i.maskStack):this.renderer.mask.setMaskStack(this.defaultMaskStack),this.sourceFrame.copyFrom(t),this.destinationFrame.copyFrom(n)}clear(e,t){let n=this.current?this.current.baseTexture.clear:this.renderer.background.backgroundColor,r=H.shared.setValue(e||n);(this.current&&this.current.baseTexture.alphaMode>0||!this.current&&this._rendererPremultipliedAlpha)&&r.premultiply(r.alpha);let i=this.destinationFrame,a=this.current?this.current.baseTexture:this.renderer._view.screen,o=i.width!==a.width||i.height!==a.height;if(o){let{x:e,y:t,width:n,height:r}=this.viewportFrame;e=Math.round(e),t=Math.round(t),n=Math.round(n),r=Math.round(r),this.renderer.gl.enable(this.renderer.gl.SCISSOR_TEST),this.renderer.gl.scissor(e,t,n,r)}this.renderer.framebuffer.clear(r.red,r.green,r.blue,r.alpha,t),o&&this.renderer.scissor.pop()}resize(){this.bind(null)}reset(){this.bind(null)}destroy(){this.renderer=null}};ta.extension={type:U.RendererSystem,name:`renderTexture`},W.add(ta);var na=class{},ra=class{constructor(e,t){this.program=e,this.uniformData=t,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBufferBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBufferBindings=null,this.program=null}};function ia(e,t){let n={},r=t.getProgramParameter(e,t.ACTIVE_ATTRIBUTES);for(let i=0;i<r;i++){let r=t.getActiveAttrib(e,i);if(r.name.startsWith(`gl_`))continue;let a=Vr(t,r.type),o={type:a,name:r.name,size:Rr(a),location:t.getAttribLocation(e,r.name)};n[r.name]=o}return n}function aa(e,t){let n={},r=t.getProgramParameter(e,t.ACTIVE_UNIFORMS);for(let i=0;i<r;i++){let r=t.getActiveUniform(e,i),a=r.name.replace(/\[.*?\]$/,``),o=!!r.name.match(/\[.*?\]$/),s=Vr(t,r.type);n[a]={name:a,index:i,type:s,size:r.size,isArray:o,value:Tr(s,r.size)}}return n}function oa(e,t){let n=Cr(e,e.VERTEX_SHADER,t.vertexSrc),r=Cr(e,e.FRAGMENT_SHADER,t.fragmentSrc),i=e.createProgram();e.attachShader(i,n),e.attachShader(i,r);let a=t.extra?.transformFeedbackVaryings;if(a&&(typeof e.transformFeedbackVaryings==`function`?e.transformFeedbackVaryings(i,a.names,a.bufferMode===`separate`?e.SEPARATE_ATTRIBS:e.INTERLEAVED_ATTRIBS):console.warn(`TransformFeedback is not supported but TransformFeedbackVaryings are given.`)),e.linkProgram(i),e.getProgramParameter(i,e.LINK_STATUS)||Ir(e,i,n,r),t.attributeData=ia(i,e),t.uniformData=aa(i,e),!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertexSrc)){let n=Object.keys(t.attributeData);n.sort((e,t)=>e>t?1:-1);for(let r=0;r<n.length;r++)t.attributeData[n[r]].location=r,e.bindAttribLocation(i,r,n[r]);e.linkProgram(i)}e.deleteShader(n),e.deleteShader(r);let o={};for(let n in t.uniformData){let r=t.uniformData[n];o[n]={location:e.getUniformLocation(i,n),value:Tr(r.type,r.size)}}return new ra(i,o)}function sa(e,t,n,r,i){n.buffer.update(i)}var ca={float:`
|
|
420
|
+
data[offset] = v;
|
|
421
|
+
`,vec2:`
|
|
422
|
+
data[offset] = v[0];
|
|
423
|
+
data[offset+1] = v[1];
|
|
424
|
+
`,vec3:`
|
|
425
|
+
data[offset] = v[0];
|
|
426
|
+
data[offset+1] = v[1];
|
|
427
|
+
data[offset+2] = v[2];
|
|
428
|
+
|
|
429
|
+
`,vec4:`
|
|
430
|
+
data[offset] = v[0];
|
|
431
|
+
data[offset+1] = v[1];
|
|
432
|
+
data[offset+2] = v[2];
|
|
433
|
+
data[offset+3] = v[3];
|
|
434
|
+
`,mat2:`
|
|
435
|
+
data[offset] = v[0];
|
|
436
|
+
data[offset+1] = v[1];
|
|
437
|
+
|
|
438
|
+
data[offset+4] = v[2];
|
|
439
|
+
data[offset+5] = v[3];
|
|
440
|
+
`,mat3:`
|
|
441
|
+
data[offset] = v[0];
|
|
442
|
+
data[offset+1] = v[1];
|
|
443
|
+
data[offset+2] = v[2];
|
|
444
|
+
|
|
445
|
+
data[offset + 4] = v[3];
|
|
446
|
+
data[offset + 5] = v[4];
|
|
447
|
+
data[offset + 6] = v[5];
|
|
448
|
+
|
|
449
|
+
data[offset + 8] = v[6];
|
|
450
|
+
data[offset + 9] = v[7];
|
|
451
|
+
data[offset + 10] = v[8];
|
|
452
|
+
`,mat4:`
|
|
453
|
+
for(var i = 0; i < 16; i++)
|
|
454
|
+
{
|
|
455
|
+
data[offset + i] = v[i];
|
|
456
|
+
}
|
|
457
|
+
`},la={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 ua(e){let t=e.map(e=>({data:e,offset:0,dataLen:0,dirty:0})),n=0,r=0,i=0;for(let e=0;e<t.length;e++){let a=t[e];if(n=la[a.data.type],a.data.size>1&&(n=Math.max(n,16)*a.data.size),a.dataLen=n,r%n!==0&&r<16){let e=r%n%16;r+=e,i+=e}r+n>16?(i=Math.ceil(i/16)*16,a.offset=i,i+=n,r=n):(a.offset=i,r+=n,i+=n)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}function da(e,t){let n=[];for(let r in e)t[r]&&n.push(t[r]);return n.sort((e,t)=>e.index-t.index),n}function fa(e,t){if(!e.autoManage)return{size:0,syncFunc:sa};let{uboElements:n,size:r}=ua(da(e.uniforms,t)),i=[`
|
|
458
|
+
var v = null;
|
|
459
|
+
var v2 = null;
|
|
460
|
+
var cv = null;
|
|
461
|
+
var t = 0;
|
|
462
|
+
var gl = renderer.gl
|
|
463
|
+
var index = 0;
|
|
464
|
+
var data = buffer.data;
|
|
465
|
+
`];for(let t=0;t<n.length;t++){let r=n[t],a=e.uniforms[r.data.name],o=r.data.name,s=!1;for(let e=0;e<Er.length;e++){let t=Er[e];if(t.codeUbo&&t.test(r.data,a)){i.push(`offset = ${r.offset/4};`,Er[e].codeUbo(r.data.name,a)),s=!0;break}}if(!s){if(r.data.size>1){let e=Rr(r.data.type),t=Math.max(la[r.data.type]/16,1),n=e/t,a=(4-n%4)%4;i.push(`
|
|
466
|
+
cv = ud.${o}.value;
|
|
467
|
+
v = uv.${o};
|
|
468
|
+
offset = ${r.offset/4};
|
|
469
|
+
|
|
470
|
+
t = 0;
|
|
471
|
+
|
|
472
|
+
for(var i=0; i < ${r.data.size*t}; i++)
|
|
473
|
+
{
|
|
474
|
+
for(var j = 0; j < ${n}; j++)
|
|
475
|
+
{
|
|
476
|
+
data[offset++] = v[t++];
|
|
477
|
+
}
|
|
478
|
+
offset += ${a};
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
`)}else{let e=ca[r.data.type];i.push(`
|
|
482
|
+
cv = ud.${o}.value;
|
|
483
|
+
v = uv.${o};
|
|
484
|
+
offset = ${r.offset/4};
|
|
485
|
+
${e};
|
|
486
|
+
`)}}}return i.push(`
|
|
487
|
+
renderer.buffer.update(buffer);
|
|
488
|
+
`),{size:r,syncFunc:Function(`ud`,`uv`,`renderer`,`syncData`,`buffer`,i.join(`
|
|
489
|
+
`))}}var pa=0,ma={textureCount:0,uboCount:0},ha=class{constructor(e){this.destroyed=!1,this.renderer=e,this.systemCheck(),this.gl=null,this.shader=null,this.program=null,this.cache={},this._uboCache={},this.id=pa++}systemCheck(){if(!Wr())throw Error(`Current environment does not allow unsafe-eval, please use @pixi/unsafe-eval module to enable support.`)}contextChange(e){this.gl=e,this.reset()}bind(e,t){e.disposeRunner.add(this),e.uniforms.globals=this.renderer.globalUniforms;let n=e.program,r=n.glPrograms[this.renderer.CONTEXT_UID]||this.generateProgram(e);return this.shader=e,this.program!==n&&(this.program=n,this.gl.useProgram(r.program)),t||(ma.textureCount=0,ma.uboCount=0,this.syncUniformGroup(e.uniformGroup,ma)),r}setUniforms(e){let t=this.shader.program,n=t.glPrograms[this.renderer.CONTEXT_UID];t.syncUniforms(n.uniformData,e,this.renderer)}syncUniformGroup(e,t){let n=this.getGlProgram();(!e.static||e.dirtyId!==n.uniformDirtyGroups[e.id])&&(n.uniformDirtyGroups[e.id]=e.dirtyId,this.syncUniforms(e,n,t))}syncUniforms(e,t,n){(e.syncUniforms[this.shader.program.id]||this.createSyncGroups(e))(t.uniformData,e.uniforms,this.renderer,n)}createSyncGroups(e){let t=this.getSignature(e,this.shader.program.uniformData,`u`);return this.cache[t]||(this.cache[t]=kr(e,this.shader.program.uniformData)),e.syncUniforms[this.shader.program.id]=this.cache[t],e.syncUniforms[this.shader.program.id]}syncUniformBufferGroup(e,t){let n=this.getGlProgram();if(!e.static||e.dirtyId!==0||!n.uniformGroups[e.id]){e.dirtyId=0;let r=n.uniformGroups[e.id]||this.createSyncBufferGroup(e,n,t);e.buffer.update(),r(n.uniformData,e.uniforms,this.renderer,ma,e.buffer)}this.renderer.buffer.bindBufferBase(e.buffer,n.uniformBufferBindings[t])}createSyncBufferGroup(e,t,n){let{gl:r}=this.renderer;this.renderer.buffer.bind(e.buffer);let i=this.gl.getUniformBlockIndex(t.program,n);t.uniformBufferBindings[n]=this.shader.uniformBindCount,r.uniformBlockBinding(t.program,i,this.shader.uniformBindCount),this.shader.uniformBindCount++;let a=this.getSignature(e,this.shader.program.uniformData,`ubo`),o=this._uboCache[a];if(o||=this._uboCache[a]=fa(e,this.shader.program.uniformData),e.autoManage){let t=new Float32Array(o.size/4);e.buffer.update(t)}return t.uniformGroups[e.id]=o.syncFunc,t.uniformGroups[e.id]}getSignature(e,t,n){let r=e.uniforms,i=[`${n}-`];for(let e in r)i.push(e),t[e]&&i.push(t[e].type);return i.join(`-`)}getGlProgram(){return this.shader?this.shader.program.glPrograms[this.renderer.CONTEXT_UID]:null}generateProgram(e){let t=this.gl,n=e.program,r=oa(t,n);return n.glPrograms[this.renderer.CONTEXT_UID]=r,r}reset(){this.program=null,this.shader=null}disposeShader(e){this.shader===e&&(this.shader=null)}destroy(){this.renderer=null,this.destroyed=!0}};ha.extension={type:U.RendererSystem,name:`shader`},W.add(ha);var ga=class{constructor(e){this.renderer=e}run(e){let{renderer:t}=this;t.runners.init.emit(t.options),e.hello&&console.log(`PixiJS 7.4.3 - ${t.rendererLogId} - https://pixijs.com`),t.resize(t.screen.width,t.screen.height)}destroy(){}};ga.defaultOptions={hello:!1},ga.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:`startup`},W.add(ga);function _a(e,t=[]){return t[o.NORMAL]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.ADD]=[e.ONE,e.ONE],t[o.MULTIPLY]=[e.DST_COLOR,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.SCREEN]=[e.ONE,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.OVERLAY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.DARKEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.LIGHTEN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.COLOR_DODGE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.COLOR_BURN]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.HARD_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.SOFT_LIGHT]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.DIFFERENCE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.EXCLUSION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.HUE]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.SATURATION]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.COLOR]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.LUMINOSITY]=[e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.NONE]=[0,0],t[o.NORMAL_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_ALPHA,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.ADD_NPM]=[e.SRC_ALPHA,e.ONE,e.ONE,e.ONE],t[o.SCREEN_NPM]=[e.SRC_ALPHA,e.ONE_MINUS_SRC_COLOR,e.ONE,e.ONE_MINUS_SRC_ALPHA],t[o.SRC_IN]=[e.DST_ALPHA,e.ZERO],t[o.SRC_OUT]=[e.ONE_MINUS_DST_ALPHA,e.ZERO],t[o.SRC_ATOP]=[e.DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[o.DST_OVER]=[e.ONE_MINUS_DST_ALPHA,e.ONE],t[o.DST_IN]=[e.ZERO,e.SRC_ALPHA],t[o.DST_OUT]=[e.ZERO,e.ONE_MINUS_SRC_ALPHA],t[o.DST_ATOP]=[e.ONE_MINUS_DST_ALPHA,e.SRC_ALPHA],t[o.XOR]=[e.ONE_MINUS_DST_ALPHA,e.ONE_MINUS_SRC_ALPHA],t[o.SUBTRACT]=[e.ONE,e.ONE,e.ONE,e.ONE,e.FUNC_REVERSE_SUBTRACT,e.FUNC_ADD],t}var va=0,ya=1,ba=2,xa=3,Sa=4,Ca=5,wa=class e{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode=o.NONE,this._blendEq=!1,this.map=[],this.map[va]=this.setBlend,this.map[ya]=this.setOffset,this.map[ba]=this.setCullFace,this.map[xa]=this.setDepthTest,this.map[Sa]=this.setFrontFace,this.map[Ca]=this.setDepthMask,this.checks=[],this.defaultState=new Rn,this.defaultState.blend=!0}contextChange(e){this.gl=e,this.blendModes=_a(e),this.set(this.defaultState),this.reset()}set(e){if(e||=this.defaultState,this.stateId!==e.data){let t=this.stateId^e.data,n=0;for(;t;)t&1&&this.map[n].call(this,!!(e.data&1<<n)),t>>=1,n++;this.stateId=e.data}for(let t=0;t<this.checks.length;t++)this.checks[t](this,e)}forceState(e){e||=this.defaultState;for(let t=0;t<this.map.length;t++)this.map[t].call(this,!!(e.data&1<<t));for(let t=0;t<this.checks.length;t++)this.checks[t](this,e);this.stateId=e.data}setBlend(t){this.updateCheck(e.checkBlendMode,t),this.gl[t?`enable`:`disable`](this.gl.BLEND)}setOffset(t){this.updateCheck(e.checkPolygonOffset,t),this.gl[t?`enable`:`disable`](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(e){this.gl[e?`enable`:`disable`](this.gl.DEPTH_TEST)}setDepthMask(e){this.gl.depthMask(e)}setCullFace(e){this.gl[e?`enable`:`disable`](this.gl.CULL_FACE)}setFrontFace(e){this.gl.frontFace(this.gl[e?`CW`:`CCW`])}setBlendMode(e){if(e===this.blendMode)return;this.blendMode=e;let t=this.blendModes[e],n=this.gl;t.length===2?n.blendFunc(t[0],t[1]):n.blendFuncSeparate(t[0],t[1],t[2],t[3]),t.length===6?(this._blendEq=!0,n.blendEquationSeparate(t[4],t[5])):this._blendEq&&(this._blendEq=!1,n.blendEquationSeparate(n.FUNC_ADD,n.FUNC_ADD))}setPolygonOffset(e,t){this.gl.polygonOffset(e,t)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode=-1,this.setBlendMode(0)}updateCheck(e,t){let n=this.checks.indexOf(e);t&&n===-1?this.checks.push(e):!t&&n!==-1&&this.checks.splice(n,1)}static checkBlendMode(e,t){e.setBlendMode(t.blendMode)}static checkPolygonOffset(e,t){e.setPolygonOffset(1,t.polygonOffset)}destroy(){this.gl=null}};wa.extension={type:U.RendererSystem,name:`state`};var Ta=wa;W.add(Ta);var Ea=class extends tt.default{constructor(){super(...arguments),this.runners={},this._systemsHash={}}setup(e){this.addRunners(...e.runners);let t=(e.priority??[]).filter(t=>e.systems[t]),n=[...t,...Object.keys(e.systems).filter(e=>!t.includes(e))];for(let t of n)this.addSystem(e.systems[t],t)}addRunners(...e){e.forEach(e=>{this.runners[e]=new Vn(e)})}addSystem(e,t){let n=new e(this);if(this[t])throw Error(`Whoops! The name "${t}" is already in use`);this[t]=n,this._systemsHash[t]=n;for(let e in this.runners)this.runners[e].add(n);return this}emitWithCustomOptions(e,t){let n=Object.keys(this._systemsHash);e.items.forEach(r=>{let i=n.find(e=>this._systemsHash[e]===r);r[e.name](t[i])})}destroy(){Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash={}}},Da=class e{constructor(t){this.renderer=t,this.count=0,this.checkCount=0,this.maxIdle=e.defaultMaxIdle,this.checkCountMax=e.defaultCheckCountMax,this.mode=e.defaultMode}postrender(){this.renderer.objectRenderer.renderingToScreen&&(this.count++,this.mode!==_.MANUAL&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){let e=this.renderer.texture,t=e.managedTextures,n=!1;for(let r=0;r<t.length;r++){let i=t[r];i.resource&&this.count-i.touched>this.maxIdle&&(e.destroyTexture(i,!0),t[r]=null,n=!0)}if(n){let e=0;for(let n=0;n<t.length;n++)t[n]!==null&&(t[e++]=t[n]);t.length=e}}unload(e){let t=this.renderer.texture,n=e._texture;n&&!n.framebuffer&&t.destroyTexture(n);for(let t=e.children.length-1;t>=0;t--)this.unload(e.children[t])}destroy(){this.renderer=null}};Da.defaultMode=_.AUTO,Da.defaultMaxIdle=3600,Da.defaultCheckCountMax=600,Da.extension={type:U.RendererSystem,name:`textureGC`};var Oa=Da;W.add(Oa);var ka=class{constructor(e){this.texture=e,this.width=-1,this.height=-1,this.dirtyId=-1,this.dirtyStyleId=-1,this.mipmap=!1,this.wrapMode=33071,this.type=u.UNSIGNED_BYTE,this.internalFormat=c.RGBA,this.samplerType=0}};function Aa(e){let t;return t=`WebGL2RenderingContext`in globalThis&&e instanceof globalThis.WebGL2RenderingContext?{[e.RGB]:d.FLOAT,[e.RGBA]:d.FLOAT,[e.ALPHA]:d.FLOAT,[e.LUMINANCE]:d.FLOAT,[e.LUMINANCE_ALPHA]:d.FLOAT,[e.R8]:d.FLOAT,[e.R8_SNORM]:d.FLOAT,[e.RG8]:d.FLOAT,[e.RG8_SNORM]:d.FLOAT,[e.RGB8]:d.FLOAT,[e.RGB8_SNORM]:d.FLOAT,[e.RGB565]:d.FLOAT,[e.RGBA4]:d.FLOAT,[e.RGB5_A1]:d.FLOAT,[e.RGBA8]:d.FLOAT,[e.RGBA8_SNORM]:d.FLOAT,[e.RGB10_A2]:d.FLOAT,[e.RGB10_A2UI]:d.FLOAT,[e.SRGB8]:d.FLOAT,[e.SRGB8_ALPHA8]:d.FLOAT,[e.R16F]:d.FLOAT,[e.RG16F]:d.FLOAT,[e.RGB16F]:d.FLOAT,[e.RGBA16F]:d.FLOAT,[e.R32F]:d.FLOAT,[e.RG32F]:d.FLOAT,[e.RGB32F]:d.FLOAT,[e.RGBA32F]:d.FLOAT,[e.R11F_G11F_B10F]:d.FLOAT,[e.RGB9_E5]:d.FLOAT,[e.R8I]:d.INT,[e.R8UI]:d.UINT,[e.R16I]:d.INT,[e.R16UI]:d.UINT,[e.R32I]:d.INT,[e.R32UI]:d.UINT,[e.RG8I]:d.INT,[e.RG8UI]:d.UINT,[e.RG16I]:d.INT,[e.RG16UI]:d.UINT,[e.RG32I]:d.INT,[e.RG32UI]:d.UINT,[e.RGB8I]:d.INT,[e.RGB8UI]:d.UINT,[e.RGB16I]:d.INT,[e.RGB16UI]:d.UINT,[e.RGB32I]:d.INT,[e.RGB32UI]:d.UINT,[e.RGBA8I]:d.INT,[e.RGBA8UI]:d.UINT,[e.RGBA16I]:d.INT,[e.RGBA16UI]:d.UINT,[e.RGBA32I]:d.INT,[e.RGBA32UI]:d.UINT,[e.DEPTH_COMPONENT16]:d.FLOAT,[e.DEPTH_COMPONENT24]:d.FLOAT,[e.DEPTH_COMPONENT32F]:d.FLOAT,[e.DEPTH_STENCIL]:d.FLOAT,[e.DEPTH24_STENCIL8]:d.FLOAT,[e.DEPTH32F_STENCIL8]:d.FLOAT}:{[e.RGB]:d.FLOAT,[e.RGBA]:d.FLOAT,[e.ALPHA]:d.FLOAT,[e.LUMINANCE]:d.FLOAT,[e.LUMINANCE_ALPHA]:d.FLOAT,[e.DEPTH_STENCIL]:d.FLOAT},t}function ja(e){let t;return t=`WebGL2RenderingContext`in globalThis&&e instanceof globalThis.WebGL2RenderingContext?{[u.UNSIGNED_BYTE]:{[c.RGBA]:e.RGBA8,[c.RGB]:e.RGB8,[c.RG]:e.RG8,[c.RED]:e.R8,[c.RGBA_INTEGER]:e.RGBA8UI,[c.RGB_INTEGER]:e.RGB8UI,[c.RG_INTEGER]:e.RG8UI,[c.RED_INTEGER]:e.R8UI,[c.ALPHA]:e.ALPHA,[c.LUMINANCE]:e.LUMINANCE,[c.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[u.BYTE]:{[c.RGBA]:e.RGBA8_SNORM,[c.RGB]:e.RGB8_SNORM,[c.RG]:e.RG8_SNORM,[c.RED]:e.R8_SNORM,[c.RGBA_INTEGER]:e.RGBA8I,[c.RGB_INTEGER]:e.RGB8I,[c.RG_INTEGER]:e.RG8I,[c.RED_INTEGER]:e.R8I},[u.UNSIGNED_SHORT]:{[c.RGBA_INTEGER]:e.RGBA16UI,[c.RGB_INTEGER]:e.RGB16UI,[c.RG_INTEGER]:e.RG16UI,[c.RED_INTEGER]:e.R16UI,[c.DEPTH_COMPONENT]:e.DEPTH_COMPONENT16},[u.SHORT]:{[c.RGBA_INTEGER]:e.RGBA16I,[c.RGB_INTEGER]:e.RGB16I,[c.RG_INTEGER]:e.RG16I,[c.RED_INTEGER]:e.R16I},[u.UNSIGNED_INT]:{[c.RGBA_INTEGER]:e.RGBA32UI,[c.RGB_INTEGER]:e.RGB32UI,[c.RG_INTEGER]:e.RG32UI,[c.RED_INTEGER]:e.R32UI,[c.DEPTH_COMPONENT]:e.DEPTH_COMPONENT24},[u.INT]:{[c.RGBA_INTEGER]:e.RGBA32I,[c.RGB_INTEGER]:e.RGB32I,[c.RG_INTEGER]:e.RG32I,[c.RED_INTEGER]:e.R32I},[u.FLOAT]:{[c.RGBA]:e.RGBA32F,[c.RGB]:e.RGB32F,[c.RG]:e.RG32F,[c.RED]:e.R32F,[c.DEPTH_COMPONENT]:e.DEPTH_COMPONENT32F},[u.HALF_FLOAT]:{[c.RGBA]:e.RGBA16F,[c.RGB]:e.RGB16F,[c.RG]:e.RG16F,[c.RED]:e.R16F},[u.UNSIGNED_SHORT_5_6_5]:{[c.RGB]:e.RGB565},[u.UNSIGNED_SHORT_4_4_4_4]:{[c.RGBA]:e.RGBA4},[u.UNSIGNED_SHORT_5_5_5_1]:{[c.RGBA]:e.RGB5_A1},[u.UNSIGNED_INT_2_10_10_10_REV]:{[c.RGBA]:e.RGB10_A2,[c.RGBA_INTEGER]:e.RGB10_A2UI},[u.UNSIGNED_INT_10F_11F_11F_REV]:{[c.RGB]:e.R11F_G11F_B10F},[u.UNSIGNED_INT_5_9_9_9_REV]:{[c.RGB]:e.RGB9_E5},[u.UNSIGNED_INT_24_8]:{[c.DEPTH_STENCIL]:e.DEPTH24_STENCIL8},[u.FLOAT_32_UNSIGNED_INT_24_8_REV]:{[c.DEPTH_STENCIL]:e.DEPTH32F_STENCIL8}}:{[u.UNSIGNED_BYTE]:{[c.RGBA]:e.RGBA,[c.RGB]:e.RGB,[c.ALPHA]:e.ALPHA,[c.LUMINANCE]:e.LUMINANCE,[c.LUMINANCE_ALPHA]:e.LUMINANCE_ALPHA},[u.UNSIGNED_SHORT_5_6_5]:{[c.RGB]:e.RGB},[u.UNSIGNED_SHORT_4_4_4_4]:{[c.RGBA]:e.RGBA},[u.UNSIGNED_SHORT_5_5_5_1]:{[c.RGBA]:e.RGBA}},t}var Ma=class{constructor(e){this.renderer=e,this.boundTextures=[],this.currentLocation=-1,this.managedTextures=[],this._unknownBoundTextures=!1,this.unknownTexture=new G,this.hasIntegerTextures=!1}contextChange(){let e=this.gl=this.renderer.gl;this.CONTEXT_UID=this.renderer.CONTEXT_UID,this.webGLVersion=this.renderer.context.webGLVersion,this.internalFormats=ja(e),this.samplerTypes=Aa(e);let t=e.getParameter(e.MAX_TEXTURE_IMAGE_UNITS);this.boundTextures.length=t;for(let e=0;e<t;e++)this.boundTextures[e]=null;this.emptyTextures={};let n=new ka(e.createTexture());e.bindTexture(e.TEXTURE_2D,n.texture),e.texImage2D(e.TEXTURE_2D,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,new Uint8Array(4)),this.emptyTextures[e.TEXTURE_2D]=n,this.emptyTextures[e.TEXTURE_CUBE_MAP]=new ka(e.createTexture()),e.bindTexture(e.TEXTURE_CUBE_MAP,this.emptyTextures[e.TEXTURE_CUBE_MAP].texture);for(let t=0;t<6;t++)e.texImage2D(e.TEXTURE_CUBE_MAP_POSITIVE_X+t,0,e.RGBA,1,1,0,e.RGBA,e.UNSIGNED_BYTE,null);e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_CUBE_MAP,e.TEXTURE_MIN_FILTER,e.LINEAR);for(let e=0;e<this.boundTextures.length;e++)this.bind(null,e)}bind(e,t=0){let{gl:n}=this;if(e=e?.castToBaseTexture(),e?.valid&&!e.parentTextureArray){e.touched=this.renderer.textureGC.count;let r=e._glTextures[this.CONTEXT_UID]||this.initTexture(e);this.boundTextures[t]!==e&&(this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),n.bindTexture(e.target,r.texture)),r.dirtyId===e.dirtyId?r.dirtyStyleId!==e.dirtyStyleId&&this.updateTextureStyle(e):(this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),this.updateTexture(e)),this.boundTextures[t]=e}else this.currentLocation!==t&&(this.currentLocation=t,n.activeTexture(n.TEXTURE0+t)),n.bindTexture(n.TEXTURE_2D,this.emptyTextures[n.TEXTURE_2D].texture),this.boundTextures[t]=null}reset(){this._unknownBoundTextures=!0,this.hasIntegerTextures=!1,this.currentLocation=-1;for(let e=0;e<this.boundTextures.length;e++)this.boundTextures[e]=this.unknownTexture}unbind(e){let{gl:t,boundTextures:n}=this;if(this._unknownBoundTextures){this._unknownBoundTextures=!1;for(let e=0;e<n.length;e++)n[e]===this.unknownTexture&&this.bind(null,e)}for(let r=0;r<n.length;r++)n[r]===e&&(this.currentLocation!==r&&(t.activeTexture(t.TEXTURE0+r),this.currentLocation=r),t.bindTexture(e.target,this.emptyTextures[e.target].texture),n[r]=null)}ensureSamplerType(e){let{boundTextures:t,hasIntegerTextures:n,CONTEXT_UID:r}=this;if(n)for(let n=e-1;n>=0;--n){let e=t[n];e&&e._glTextures[r].samplerType!==d.FLOAT&&this.renderer.texture.unbind(e)}}initTexture(e){let t=new ka(this.gl.createTexture());return t.dirtyId=-1,e._glTextures[this.CONTEXT_UID]=t,this.managedTextures.push(e),e.on(`dispose`,this.destroyTexture,this),t}initTextureType(e,t){t.internalFormat=this.internalFormats[e.type]?.[e.format]??e.format,t.samplerType=this.samplerTypes[t.internalFormat]??d.FLOAT,t.type=this.webGLVersion===2&&e.type===u.HALF_FLOAT?this.gl.HALF_FLOAT:e.type}updateTexture(e){let t=e._glTextures[this.CONTEXT_UID];if(!t)return;let n=this.renderer;if(this.initTextureType(e,t),e.resource?.upload(n,e,t))t.samplerType!==d.FLOAT&&(this.hasIntegerTextures=!0);else{let r=e.realWidth,i=e.realHeight,a=n.gl;(t.width!==r||t.height!==i||t.dirtyId<0)&&(t.width=r,t.height=i,a.texImage2D(e.target,0,t.internalFormat,r,i,0,e.format,t.type,null))}e.dirtyStyleId!==t.dirtyStyleId&&this.updateTextureStyle(e),t.dirtyId=e.dirtyId}destroyTexture(e,t){let{gl:n}=this;if(e=e.castToBaseTexture(),e._glTextures[this.CONTEXT_UID]&&(this.unbind(e),n.deleteTexture(e._glTextures[this.CONTEXT_UID].texture),e.off(`dispose`,this.destroyTexture,this),delete e._glTextures[this.CONTEXT_UID],!t)){let t=this.managedTextures.indexOf(e);t!==-1&&fn(this.managedTextures,t,1)}}updateTextureStyle(e){let t=e._glTextures[this.CONTEXT_UID];t&&(t.mipmap=(e.mipmap===m.POW2||this.webGLVersion!==2)&&!e.isPowerOfTwo?!1:e.mipmap>=1,t.wrapMode=this.webGLVersion!==2&&!e.isPowerOfTwo?p.CLAMP:e.wrapMode,e.resource?.style(this.renderer,e,t)||this.setStyle(e,t),t.dirtyStyleId=e.dirtyStyleId)}setStyle(e,t){let n=this.gl;if(t.mipmap&&e.mipmap!==m.ON_MANUAL&&n.generateMipmap(e.target),n.texParameteri(e.target,n.TEXTURE_WRAP_S,t.wrapMode),n.texParameteri(e.target,n.TEXTURE_WRAP_T,t.wrapMode),t.mipmap){n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===f.LINEAR?n.LINEAR_MIPMAP_LINEAR:n.NEAREST_MIPMAP_NEAREST);let t=this.renderer.context.extensions.anisotropicFiltering;if(t&&e.anisotropicLevel>0&&e.scaleMode===f.LINEAR){let r=Math.min(e.anisotropicLevel,n.getParameter(t.MAX_TEXTURE_MAX_ANISOTROPY_EXT));n.texParameterf(e.target,t.TEXTURE_MAX_ANISOTROPY_EXT,r)}}else n.texParameteri(e.target,n.TEXTURE_MIN_FILTER,e.scaleMode===f.LINEAR?n.LINEAR:n.NEAREST);n.texParameteri(e.target,n.TEXTURE_MAG_FILTER,e.scaleMode===f.LINEAR?n.LINEAR:n.NEAREST)}destroy(){this.renderer=null}};Ma.extension={type:U.RendererSystem,name:`texture`},W.add(Ma);var Na=class{constructor(e){this.renderer=e}contextChange(){this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:n}=this,r=e._glTransformFeedbacks[n]||this.createGLTransformFeedback(e);t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,r)}unbind(){let{gl:e}=this;e.bindTransformFeedback(e.TRANSFORM_FEEDBACK,null)}beginTransformFeedback(e,t){let{gl:n,renderer:r}=this;t&&r.shader.bind(t),n.beginTransformFeedback(e)}endTransformFeedback(){let{gl:e}=this;e.endTransformFeedback()}createGLTransformFeedback(e){let{gl:t,renderer:n,CONTEXT_UID:r}=this,i=t.createTransformFeedback();e._glTransformFeedbacks[r]=i,t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,i);for(let i=0;i<e.buffers.length;i++){let a=e.buffers[i];a&&(n.buffer.update(a),a._glBuffers[r].refCount++,t.bindBufferBase(t.TRANSFORM_FEEDBACK_BUFFER,i,a._glBuffers[r].buffer||null))}return t.bindTransformFeedback(t.TRANSFORM_FEEDBACK,null),e.disposeRunner.add(this),i}disposeTransformFeedback(e,t){let n=e._glTransformFeedbacks[this.CONTEXT_UID],r=this.gl;e.disposeRunner.remove(this);let i=this.renderer.buffer;if(i)for(let n=0;n<e.buffers.length;n++){let r=e.buffers[n];if(!r)continue;let a=r._glBuffers[this.CONTEXT_UID];a&&(a.refCount--,a.refCount===0&&!t&&i.dispose(r,t))}n&&(t||r.deleteTransformFeedback(n),delete e._glTransformFeedbacks[this.CONTEXT_UID])}destroy(){this.renderer=null}};Na.extension={type:U.RendererSystem,name:`transformFeedback`},W.add(Na);var Pa=class{constructor(e){this.renderer=e}init(e){this.screen=new Y(0,0,e.width,e.height),this.element=e.view||w.ADAPTER.createCanvas(),this.resolution=e.resolution||w.RESOLUTION,this.autoDensity=!!e.autoDensity}resizeView(e,t){this.element.width=Math.round(e*this.resolution),this.element.height=Math.round(t*this.resolution);let n=this.element.width/this.resolution,r=this.element.height/this.resolution;this.screen.width=n,this.screen.height=r,this.autoDensity&&(this.element.style.width=`${n}px`,this.element.style.height=`${r}px`),this.renderer.emit(`resize`,n,r),this.renderer.runners.resize.emit(this.screen.width,this.screen.height)}destroy(e){e&&this.element.parentNode?.removeChild(this.element),this.renderer=null,this.element=null,this.screen=null}};Pa.defaultOptions={width:800,height:600,resolution:void 0,autoDensity:!1},Pa.extension={type:[U.RendererSystem,U.CanvasRendererSystem],name:`_view`},W.add(Pa),w.PREFER_ENV=r.WEBGL2,w.STRICT_TEXTURE_CACHE=!1,w.RENDER_OPTIONS={...mi.defaultOptions,...di.defaultOptions,...Pa.defaultOptions,...ga.defaultOptions},Object.defineProperties(w,{WRAP_MODE:{get(){return G.defaultOptions.wrapMode},set(e){z(`7.1.0`,`settings.WRAP_MODE is deprecated, use BaseTexture.defaultOptions.wrapMode`),G.defaultOptions.wrapMode=e}},SCALE_MODE:{get(){return G.defaultOptions.scaleMode},set(e){z(`7.1.0`,`settings.SCALE_MODE is deprecated, use BaseTexture.defaultOptions.scaleMode`),G.defaultOptions.scaleMode=e}},MIPMAP_TEXTURES:{get(){return G.defaultOptions.mipmap},set(e){z(`7.1.0`,`settings.MIPMAP_TEXTURES is deprecated, use BaseTexture.defaultOptions.mipmap`),G.defaultOptions.mipmap=e}},ANISOTROPIC_LEVEL:{get(){return G.defaultOptions.anisotropicLevel},set(e){z(`7.1.0`,`settings.ANISOTROPIC_LEVEL is deprecated, use BaseTexture.defaultOptions.anisotropicLevel`),G.defaultOptions.anisotropicLevel=e}},FILTER_RESOLUTION:{get(){return z(`7.1.0`,`settings.FILTER_RESOLUTION is deprecated, use Filter.defaultResolution`),ui.defaultResolution},set(e){ui.defaultResolution=e}},FILTER_MULTISAMPLE:{get(){return z(`7.1.0`,`settings.FILTER_MULTISAMPLE is deprecated, use Filter.defaultMultisample`),ui.defaultMultisample},set(e){ui.defaultMultisample=e}},SPRITE_MAX_TEXTURES:{get(){return oi.defaultMaxTextures},set(e){z(`7.1.0`,`settings.SPRITE_MAX_TEXTURES is deprecated, use BatchRenderer.defaultMaxTextures`),oi.defaultMaxTextures=e}},SPRITE_BATCH_SIZE:{get(){return oi.defaultBatchSize},set(e){z(`7.1.0`,`settings.SPRITE_BATCH_SIZE is deprecated, use BatchRenderer.defaultBatchSize`),oi.defaultBatchSize=e}},CAN_UPLOAD_SAME_BUFFER:{get(){return oi.canUploadSameBuffer},set(e){z(`7.1.0`,`settings.CAN_UPLOAD_SAME_BUFFER is deprecated, use BatchRenderer.canUploadSameBuffer`),oi.canUploadSameBuffer=e}},GC_MODE:{get(){return Oa.defaultMode},set(e){z(`7.1.0`,`settings.GC_MODE is deprecated, use TextureGCSystem.defaultMode`),Oa.defaultMode=e}},GC_MAX_IDLE:{get(){return Oa.defaultMaxIdle},set(e){z(`7.1.0`,`settings.GC_MAX_IDLE is deprecated, use TextureGCSystem.defaultMaxIdle`),Oa.defaultMaxIdle=e}},GC_MAX_CHECK_COUNT:{get(){return Oa.defaultCheckCountMax},set(e){z(`7.1.0`,`settings.GC_MAX_CHECK_COUNT is deprecated, use TextureGCSystem.defaultCheckCountMax`),Oa.defaultCheckCountMax=e}},PRECISION_VERTEX:{get(){return Jr.defaultVertexPrecision},set(e){z(`7.1.0`,`settings.PRECISION_VERTEX is deprecated, use Program.defaultVertexPrecision`),Jr.defaultVertexPrecision=e}},PRECISION_FRAGMENT:{get(){return Jr.defaultFragmentPrecision},set(e){z(`7.1.0`,`settings.PRECISION_FRAGMENT is deprecated, use Program.defaultFragmentPrecision`),Jr.defaultFragmentPrecision=e}}});var Fa=(e=>(e[e.INTERACTION=50]=`INTERACTION`,e[e.HIGH=25]=`HIGH`,e[e.NORMAL=0]=`NORMAL`,e[e.LOW=-25]=`LOW`,e[e.UTILITY=-50]=`UTILITY`,e))(Fa||{}),Ia=class{constructor(e,t=null,n=0,r=!1){this.next=null,this.previous=null,this._destroyed=!1,this.fn=e,this.context=t,this.priority=n,this.once=r}match(e,t=null){return this.fn===e&&this.context===t}emit(e){this.fn&&(this.context?this.fn.call(this.context,e):this.fn(e));let t=this.next;return this.once&&this.destroy(!0),this._destroyed&&(this.next=null),t}connect(e){this.previous=e,e.next&&(e.next.previous=this),this.next=e.next,e.next=this}destroy(e=!1){this._destroyed=!0,this.fn=null,this.context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);let t=this.next;return this.next=e?null:t,this.previous=null,t}},La=class e{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 Ia(null,null,1/0),this.deltaMS=1/e.targetFPMS,this.elapsedMS=1/e.targetFPMS,this._tick=e=>{this._requestId=null,this.started&&(this.update(e),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(e,t,n=Fa.NORMAL){return this._addListener(new Ia(e,t,n))}addOnce(e,t,n=Fa.NORMAL){return this._addListener(new Ia(e,t,n,!0))}_addListener(e){let t=this._head.next,n=this._head;if(!t)e.connect(n);else{for(;t;){if(e.priority>t.priority){e.connect(n);break}n=t,t=t.next}e.previous||e.connect(n)}return this._startIfPossible(),this}remove(e,t){let n=this._head.next;for(;n;)n=n.match(e,t)?n.destroy():n.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let e=0,t=this._head;for(;t=t.next;)e++;return e}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let e=this._head.next;for(;e;)e=e.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let n;if(t>this.lastTime){if(n=this.elapsedMS=t-this.lastTime,n>this._maxElapsedMS&&(n=this._maxElapsedMS),n*=this.speed,this._minElapsedMS){let e=t-this._lastFrame|0;if(e<this._minElapsedMS)return;this._lastFrame=t-e%this._minElapsedMS}this.deltaMS=n,this.deltaTime=this.deltaMS*e.targetFPMS;let r=this._head,i=r.next;for(;i;)i=i.emit(this.deltaTime);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){let n=Math.min(this.maxFPS,t),r=Math.min(Math.max(0,n)/1e3,e.targetFPMS);this._maxElapsedMS=1/r}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(e){if(e===0)this._minElapsedMS=0;else{let t=Math.max(this.minFPS,e);this._minElapsedMS=1/(t/1e3)}}static get shared(){if(!e._shared){let t=e._shared=new e;t.autoStart=!0,t._protected=!0}return e._shared}static get system(){if(!e._system){let t=e._system=new e;t.autoStart=!0,t._protected=!0}return e._system}};La.targetFPMS=.06;var Ra=La;Object.defineProperties(w,{TARGET_FPMS:{get(){return Ra.targetFPMS},set(e){z(`7.1.0`,`settings.TARGET_FPMS is deprecated, use Ticker.targetFPMS`),Ra.targetFPMS=e}}});var za=class{static init(e){e=Object.assign({autoStart:!0,sharedTicker:!1},e),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,Fa.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=e.sharedTicker?Ra.shared:new Ra,e.autoStart&&this.start()}static destroy(){if(this._ticker){let e=this._ticker;this.ticker=null,e.destroy()}}};za.extension=U.Application,W.add(za);var Ba=[];W.handleByList(U.Renderer,Ba);function Va(e){for(let t of Ba)if(t.test(e))return new t(e);throw Error(`Unable to auto-detect a suitable renderer.`)}var Ha=`attribute vec2 aVertexPosition;
|
|
490
|
+
attribute vec2 aTextureCoord;
|
|
491
|
+
|
|
492
|
+
uniform mat3 projectionMatrix;
|
|
493
|
+
|
|
494
|
+
varying vec2 vTextureCoord;
|
|
495
|
+
|
|
496
|
+
void main(void)
|
|
497
|
+
{
|
|
498
|
+
gl_Position = vec4((projectionMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
499
|
+
vTextureCoord = aTextureCoord;
|
|
500
|
+
}`,Ua=`attribute vec2 aVertexPosition;
|
|
501
|
+
|
|
502
|
+
uniform mat3 projectionMatrix;
|
|
503
|
+
|
|
504
|
+
varying vec2 vTextureCoord;
|
|
505
|
+
|
|
506
|
+
uniform vec4 inputSize;
|
|
507
|
+
uniform vec4 outputFrame;
|
|
508
|
+
|
|
509
|
+
vec4 filterVertexPosition( void )
|
|
510
|
+
{
|
|
511
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
512
|
+
|
|
513
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
vec2 filterTextureCoord( void )
|
|
517
|
+
{
|
|
518
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
519
|
+
}
|
|
520
|
+
|
|
521
|
+
void main(void)
|
|
522
|
+
{
|
|
523
|
+
gl_Position = filterVertexPosition();
|
|
524
|
+
vTextureCoord = filterTextureCoord();
|
|
525
|
+
}
|
|
526
|
+
`,Wa=Ha,Ga=Ua,Ka=class{constructor(e){this.renderer=e}contextChange(e){let t;if(this.renderer.context.webGLVersion===1){let n=e.getParameter(e.FRAMEBUFFER_BINDING);e.bindFramebuffer(e.FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.FRAMEBUFFER,n)}else{let n=e.getParameter(e.DRAW_FRAMEBUFFER_BINDING);e.bindFramebuffer(e.DRAW_FRAMEBUFFER,null),t=e.getParameter(e.SAMPLES),e.bindFramebuffer(e.DRAW_FRAMEBUFFER,n)}this.multisample=t>=x.HIGH?x.HIGH:t>=x.MEDIUM?x.MEDIUM:t>=x.LOW?x.LOW:x.NONE}destroy(){}};Ka.extension={type:U.RendererSystem,name:`_multisample`},W.add(Ka);var qa=class{constructor(e){this.buffer=e||null,this.updateID=-1,this.byteLength=-1,this.refCount=0}},Ja=class{constructor(e){this.renderer=e,this.managedBuffers={},this.boundBufferBases={}}destroy(){this.renderer=null}contextChange(){this.disposeAll(!0),this.gl=this.renderer.gl,this.CONTEXT_UID=this.renderer.CONTEXT_UID}bind(e){let{gl:t,CONTEXT_UID:n}=this,r=e._glBuffers[n]||this.createGLBuffer(e);t.bindBuffer(e.type,r.buffer)}unbind(e){let{gl:t}=this;t.bindBuffer(e,null)}bindBufferBase(e,t){let{gl:n,CONTEXT_UID:r}=this;if(this.boundBufferBases[t]!==e){let i=e._glBuffers[r]||this.createGLBuffer(e);this.boundBufferBases[t]=e,n.bindBufferBase(n.UNIFORM_BUFFER,t,i.buffer)}}bindBufferRange(e,t,n){let{gl:r,CONTEXT_UID:i}=this;n||=0;let a=e._glBuffers[i]||this.createGLBuffer(e);r.bindBufferRange(r.UNIFORM_BUFFER,t||0,a.buffer,n*256,256)}update(e){let{gl:t,CONTEXT_UID:n}=this,r=e._glBuffers[n]||this.createGLBuffer(e);if(e._updateID!==r.updateID){if(r.updateID=e._updateID,t.bindBuffer(e.type,r.buffer),r.byteLength>=e.data.byteLength)t.bufferSubData(e.type,0,e.data);else{let n=e.static?t.STATIC_DRAW:t.DYNAMIC_DRAW;r.byteLength=e.data.byteLength,t.bufferData(e.type,e.data,n)}}}dispose(e,t){if(!this.managedBuffers[e.id])return;delete this.managedBuffers[e.id];let n=e._glBuffers[this.CONTEXT_UID],r=this.gl;e.disposeRunner.remove(this),n&&(t||r.deleteBuffer(n.buffer),delete e._glBuffers[this.CONTEXT_UID])}disposeAll(e){let t=Object.keys(this.managedBuffers);for(let n=0;n<t.length;n++)this.dispose(this.managedBuffers[t[n]],e)}createGLBuffer(e){let{CONTEXT_UID:t,gl:n}=this;return e._glBuffers[t]=new qa(n.createBuffer()),this.managedBuffers[e.id]=e,e.disposeRunner.add(this),e._glBuffers[t]}};Ja.extension={type:U.RendererSystem,name:`buffer`},W.add(Ja);var Ya=class{constructor(e){this.renderer=e}render(e,t){let n=this.renderer,r,i,a,o;if(t&&(r=t.renderTexture,i=t.clear,a=t.transform,o=t.skipUpdateTransform),this.renderingToScreen=!r,n.runners.prerender.emit(),n.emit(`prerender`),n.projection.transform=a,!n.context.isLost){if(r||(this.lastObjectRendered=e),!o){let t=e.enableTempParent();e.updateTransform(),e.disableTempParent(t)}n.renderTexture.bind(r),n.batch.currentRenderer.start(),(i??n.background.clearBeforeRender)&&n.renderTexture.clear(),e.render(n),n.batch.currentRenderer.flush(),r&&(t.blit&&n.framebuffer.blit(),r.baseTexture.update()),n.runners.postrender.emit(),n.projection.transform=null,n.emit(`postrender`)}}destroy(){this.renderer=null,this.lastObjectRendered=null}};Ya.extension={type:U.RendererSystem,name:`objectRenderer`},W.add(Ya);var Xa=class e extends Ea{constructor(t){super(),this.type=i.WEBGL,t=Object.assign({},w.RENDER_OPTIONS,t),this.gl=null,this.CONTEXT_UID=0,this.globalUniforms=new Xr({projectionMatrix:new X},!0);let n={runners:[`init`,`destroy`,`contextChange`,`resolutionChange`,`reset`,`update`,`postrender`,`prerender`,`resize`],systems:e.__systems,priority:[`_view`,`textureGenerator`,`background`,`_plugin`,`startup`,`context`,`state`,`texture`,`buffer`,`geometry`,`framebuffer`,`transformFeedback`,`mask`,`scissor`,`stencil`,`projection`,`textureGC`,`filter`,`renderTexture`,`batch`,`objectRenderer`,`_multisample`]};this.setup(n),`useContextAlpha`in t&&(z(`7.0.0`,`options.useContextAlpha is deprecated, use options.premultipliedAlpha and options.backgroundAlpha instead`),t.premultipliedAlpha=t.useContextAlpha&&t.useContextAlpha!==`notMultiplied`,t.backgroundAlpha=t.useContextAlpha===!1?1:t.backgroundAlpha),this._plugin.rendererPlugins=e.__plugins,this.options=t,this.startup.run(this.options)}static test(e){return!e?.forceCanvas&>()}render(e,t){this.objectRenderer.render(e,t)}resize(e,t){this._view.resizeView(e,t)}reset(){return this.runners.reset.emit(),this}clear(){this.renderTexture.bind(),this.renderTexture.clear()}destroy(e=!1){this.runners.destroy.items.reverse(),this.emitWithCustomOptions(this.runners.destroy,{_view:e}),super.destroy()}get plugins(){return this._plugin.plugins}get multisample(){return this._multisample.multisample}get width(){return this._view.element.width}get height(){return this._view.element.height}get resolution(){return this._view.resolution}set resolution(e){this._view.resolution=e,this.runners.resolutionChange.emit(e)}get autoDensity(){return this._view.autoDensity}get view(){return this._view.element}get screen(){return this._view.screen}get lastObjectRendered(){return this.objectRenderer.lastObjectRendered}get renderingToScreen(){return this.objectRenderer.renderingToScreen}get rendererLogId(){return`WebGL ${this.context.webGLVersion}`}get clearBeforeRender(){return z(`7.0.0`,`renderer.clearBeforeRender has been deprecated, please use renderer.background.clearBeforeRender instead.`),this.background.clearBeforeRender}get useContextAlpha(){return z(`7.0.0`,`renderer.useContextAlpha has been deprecated, please use renderer.context.premultipliedAlpha instead.`),this.context.useContextAlpha}get preserveDrawingBuffer(){return z(`7.0.0`,`renderer.preserveDrawingBuffer has been deprecated, we cannot truly know this unless pixi created the context`),this.context.preserveDrawingBuffer}get backgroundColor(){return z(`7.0.0`,`renderer.backgroundColor has been deprecated, use renderer.background.color instead.`),this.background.color}set backgroundColor(e){z(`7.0.0`,`renderer.backgroundColor has been deprecated, use renderer.background.color instead.`),this.background.color=e}get backgroundAlpha(){return z(`7.0.0`,`renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.`),this.background.alpha}set backgroundAlpha(e){z(`7.0.0`,`renderer.backgroundAlpha has been deprecated, use renderer.background.alpha instead.`),this.background.alpha=e}get powerPreference(){return z(`7.0.0`,`renderer.powerPreference has been deprecated, we can only know this if pixi creates the context`),this.context.powerPreference}generateTexture(e,t){return this.textureGenerator.generateTexture(e,t)}};Xa.extension={type:U.Renderer,priority:1},Xa.__plugins={},Xa.__systems={};var Za=Xa;W.handleByMap(U.RendererPlugin,Za.__plugins),W.handleByMap(U.RendererSystem,Za.__systems),W.add(Za);var Qa=class extends Hn{constructor(e,t){let{width:n,height:r}=t||{};super(n,r),this.items=[],this.itemDirtyIds=[];for(let t=0;t<e;t++){let e=new G;this.items.push(e),this.itemDirtyIds.push(-2)}this.length=e,this._load=null,this.baseTexture=null}initFromArray(e,t){for(let n=0;n<this.length;n++)e[n]&&(e[n].castToBaseTexture?this.addBaseTextureAt(e[n].castToBaseTexture(),n):e[n]instanceof Hn?this.addResourceAt(e[n],n):this.addResourceAt(Bn(e[n],t),n))}dispose(){for(let e=0,t=this.length;e<t;e++)this.items[e].destroy();this.items=null,this.itemDirtyIds=null,this._load=null}addResourceAt(e,t){if(!this.items[t])throw Error(`Index ${t} is out of bounds`);return e.valid&&!this.valid&&this.resize(e.width,e.height),this.items[t].setResource(e),this}bind(e){if(this.baseTexture!==null)throw Error(`Only one base texture per TextureArray is allowed`);super.bind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=e,this.items[t].on(`update`,e.update,e)}unbind(e){super.unbind(e);for(let t=0;t<this.length;t++)this.items[t].parentTextureArray=null,this.items[t].off(`update`,e.update,e)}load(){if(this._load)return this._load;let e=this.items.map(e=>e.resource).filter(e=>e).map(e=>e.load());return this._load=Promise.all(e).then(()=>{let{realWidth:e,realHeight:t}=this.items[0];return this.resize(e,t),this.update(),Promise.resolve(this)}),this._load}},$a=class extends Qa{constructor(e,t){let{width:n,height:r}=t||{},i,a;Array.isArray(e)?(i=e,a=e.length):a=e,super(a,{width:n,height:r}),i&&this.initFromArray(i,t)}addBaseTextureAt(e,t){if(e.resource)this.addResourceAt(e.resource,t);else throw Error(`ArrayResource does not support RenderTexture`);return this}bind(e){super.bind(e),e.target=l.TEXTURE_2D_ARRAY}upload(e,t,n){let{length:r,itemDirtyIds:i,items:a}=this,{gl:o}=e;n.dirtyId<0&&o.texImage3D(o.TEXTURE_2D_ARRAY,0,n.internalFormat,this._width,this._height,r,0,t.format,n.type,null);for(let e=0;e<r;e++){let r=a[e];i[e]<r.dirtyId&&(i[e]=r.dirtyId,r.valid&&o.texSubImage3D(o.TEXTURE_2D_ARRAY,0,0,0,e,r.resource.width,r.resource.height,1,t.format,n.type,r.resource.source))}return!0}},eo=class extends _i{constructor(e){super(e)}static test(e){let{OffscreenCanvas:t}=globalThis;return t&&e instanceof t?!0:globalThis.HTMLCanvasElement&&e instanceof HTMLCanvasElement}},to=class e extends Qa{constructor(t,n){let{width:r,height:i,autoLoad:a,linkBaseTexture:o}=n||{};if(t&&t.length!==e.SIDES)throw Error(`Invalid length. Got ${t.length}, expected 6`);super(6,{width:r,height:i});for(let t=0;t<e.SIDES;t++)this.items[t].target=l.TEXTURE_CUBE_MAP_POSITIVE_X+t;this.linkBaseTexture=o!==!1,t&&this.initFromArray(t,n),a!==!1&&this.load()}bind(e){super.bind(e),e.target=l.TEXTURE_CUBE_MAP}addBaseTextureAt(e,t,n){if(n===void 0&&(n=this.linkBaseTexture),!this.items[t])throw Error(`Index ${t} is out of bounds`);if(!this.linkBaseTexture||e.parentTextureArray||Object.keys(e._glTextures).length>0){if(e.resource)this.addResourceAt(e.resource,t);else throw Error(`CubeResource does not support copying of renderTexture.`)}else e.target=l.TEXTURE_CUBE_MAP_POSITIVE_X+t,e.parentTextureArray=this.baseTexture,this.items[t]=e;return e.valid&&!this.valid&&this.resize(e.realWidth,e.realHeight),this.items[t]=e,this}upload(t,n,r){let i=this.itemDirtyIds;for(let a=0;a<e.SIDES;a++){let e=this.items[a];(i[a]<e.dirtyId||r.dirtyId<n.dirtyId)&&(e.valid&&e.resource?(e.resource.upload(t,e,r),i[a]=e.dirtyId):i[a]<-1&&(t.gl.texImage2D(e.target,0,r.internalFormat,n.realWidth,n.realHeight,0,n.format,r.type,null),i[a]=-1))}return!0}static test(t){return Array.isArray(t)&&t.length===e.SIDES}};to.SIDES=6;var no=to,ro=class e extends _i{constructor(t,n){n||={};let r,i,a;typeof t==`string`?(r=e.EMPTY,i=t,a=!0):(r=t,i=null,a=!1),super(r),this.url=i,this.crossOrigin=n.crossOrigin??!0,this.alphaMode=typeof n.alphaMode==`number`?n.alphaMode:null,this.ownsImageBitmap=n.ownsImageBitmap??a,this._load=null,n.autoLoad!==!1&&this.load()}load(){return this._load||=new Promise(async(e,t)=>{if(this.url===null){e(this);return}try{let t=await w.ADAPTER.fetch(this.url,{mode:this.crossOrigin?`cors`:`no-cors`});if(this.destroyed)return;let n=await t.blob();if(this.destroyed)return;let r=await createImageBitmap(n,{premultiplyAlpha:this.alphaMode===null||this.alphaMode===h.UNPACK?`premultiply`:`none`});if(this.destroyed){r.close();return}this.source=r,this.update(),e(this)}catch(e){if(this.destroyed)return;t(e),this.onError.emit(e)}}),this._load}upload(e,t,n){return this.source instanceof ImageBitmap?(typeof this.alphaMode==`number`&&(t.alphaMode=this.alphaMode),super.upload(e,t,n)):(this.load(),!1)}dispose(){this.ownsImageBitmap&&this.source instanceof ImageBitmap&&this.source.close(),super.dispose(),this._load=null}static test(e){return!!globalThis.createImageBitmap&&typeof ImageBitmap<`u`&&(typeof e==`string`||e instanceof ImageBitmap)}static get EMPTY(){return e._EMPTY=e._EMPTY??w.ADAPTER.createCanvas(0,0),e._EMPTY}},io=class e extends _i{constructor(e,t){t||={},super(w.ADAPTER.createCanvas()),this._width=0,this._height=0,this.svg=e,this.scale=t.scale||1,this._overrideWidth=t.width,this._overrideHeight=t.height,this._resolve=null,this._crossorigin=t.crossorigin,this._load=null,t.autoLoad!==!1&&this.load()}load(){return this._load||=new Promise(t=>{if(this._resolve=()=>{this.update(),t(this)},e.SVG_XML.test(this.svg.trim())){if(!btoa)throw Error(`Your browser doesn't support base64 conversions.`);this.svg=`data:image/svg+xml;base64,${btoa(unescape(encodeURIComponent(this.svg)))}`}this._loadSvg()}),this._load}_loadSvg(){let e=new Image;_i.crossOrigin(e,this.svg,this._crossorigin),e.src=this.svg,e.onerror=t=>{this._resolve&&(e.onerror=null,this.onError.emit(t))},e.onload=()=>{if(!this._resolve)return;let t=e.width,n=e.height;if(!t||!n)throw Error(`The SVG image must have width and height defined (in pixels), canvas API needs them.`);let r=t*this.scale,i=n*this.scale;(this._overrideWidth||this._overrideHeight)&&(r=this._overrideWidth||this._overrideHeight/n*t,i=this._overrideHeight||this._overrideWidth/t*n),r=Math.round(r),i=Math.round(i);let a=this.source;a.width=r,a.height=i,a._pixiId=`canvas_${hn()}`,a.getContext(`2d`).drawImage(e,0,0,t,n,0,0,r,i),this._resolve(),this._resolve=null}}static getSize(t){let n=e.SVG_SIZE.exec(t),r={};return n&&(r[n[1]]=Math.round(parseFloat(n[3])),r[n[5]]=Math.round(parseFloat(n[7]))),r}dispose(){super.dispose(),this._resolve=null,this._crossorigin=null}static test(t,n){return n===`svg`||typeof t==`string`&&t.startsWith(`data:image/svg+xml`)||typeof t==`string`&&e.SVG_XML.test(t)}};io.SVG_XML=/^(<\?xml[^?]+\?>)?\s*(<!--[^(-->)]*-->)?\s*\<svg/m,io.SVG_SIZE=/<svg[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*(?:\s(width|height)=('|")(\d*(?:\.\d+)?)(?:px)?('|"))[^>]*>/i;var ao=io,oo=class extends _i{constructor(e){super(e)}static test(e){return!!globalThis.VideoFrame&&e instanceof globalThis.VideoFrame}},so=class e extends _i{constructor(t,n){if(n||={},!(t instanceof HTMLVideoElement)){let r=document.createElement(`video`);n.autoLoad!==!1&&r.setAttribute(`preload`,`auto`),n.playsinline!==!1&&(r.setAttribute(`webkit-playsinline`,``),r.setAttribute(`playsinline`,``)),n.muted===!0&&(r.setAttribute(`muted`,``),r.muted=!0),n.loop===!0&&r.setAttribute(`loop`,``),n.autoPlay!==!1&&r.setAttribute(`autoplay`,``),typeof t==`string`&&(t=[t]);let i=t[0].src||t[0];_i.crossOrigin(r,i,n.crossorigin);for(let n=0;n<t.length;++n){let i=document.createElement(`source`),{src:a,mime:o}=t[n];if(a||=t[n],a.startsWith(`data:`))o=a.slice(5,a.indexOf(`;`));else if(!a.startsWith(`blob:`)){let t=a.split(`?`).shift().toLowerCase(),n=t.slice(t.lastIndexOf(`.`)+1);o=o||e.MIME_TYPES[n]||`video/${n}`}i.src=a,o&&(i.type=o),r.appendChild(i)}t=r}super(t),this.noSubImage=!0,this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=n.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=n.autoPlay!==!1,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._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),n.autoLoad!==!1&&this.load()}update(e=0){if(!this.destroyed){if(this._updateFPS){let e=Ra.shared.elapsedMS*this.source.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-e)}(!this._updateFPS||this._msToNextUpdate<=0)&&(super.update(),this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0)}}_videoFrameRequestCallback(){this.update(),this._videoFrameRequestCallbackHandle=this.destroyed?null:this.source.requestVideoFrameCallback(this._videoFrameRequestCallback)}load(){if(this._load)return this._load;let e=this.source;return(e.readyState===e.HAVE_ENOUGH_DATA||e.readyState===e.HAVE_FUTURE_DATA)&&e.width&&e.height&&(e.complete=!0),e.addEventListener(`play`,this._onPlayStart),e.addEventListener(`pause`,this._onPlayStop),e.addEventListener(`seeked`,this._onSeeked),this._isSourceReady()?this._onCanPlay():(e.addEventListener(`canplay`,this._onCanPlay),e.addEventListener(`canplaythrough`,this._onCanPlay),e.addEventListener(`error`,this._onError,!0)),this._load=new Promise((t,n)=>{this.valid?t(this):(this._resolve=t,this._reject=n,e.load())}),this._load}_onError(e){this.source.removeEventListener(`error`,this._onError,!0),this.onError.emit(e),this._reject&&(this._reject(e),this._reject=null,this._resolve=null)}_isSourcePlaying(){let e=this.source;return!e.paused&&!e.ended}_isSourceReady(){return this.source.readyState>2}_onPlayStart(){this.valid||this._onCanPlay(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0)}_onCanPlay(){let e=this.source;e.removeEventListener(`canplay`,this._onCanPlay),e.removeEventListener(`canplaythrough`,this._onCanPlay);let t=this.valid;this._msToNextUpdate=0,this.update(),this._msToNextUpdate=0,!t&&this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&e.play()}dispose(){this._configureAutoUpdate();let e=this.source;e&&(e.removeEventListener(`play`,this._onPlayStart),e.removeEventListener(`pause`,this._onPlayStop),e.removeEventListener(`seeked`,this._onSeeked),e.removeEventListener(`canplay`,this._onCanPlay),e.removeEventListener(`canplaythrough`,this._onCanPlay),e.removeEventListener(`error`,this._onError,!0),e.pause(),e.src=``,e.load()),super.dispose()}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(e){e!==this._updateFPS&&(this._updateFPS=e,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.source.requestVideoFrameCallback?(this._isConnectedToTicker&&(Ra.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.source.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(Ra.shared.add(this.update,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.source.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(Ra.shared.remove(this.update,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t,n){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement||e.TYPES.includes(n)}};so.TYPES=[`mp4`,`m4v`,`webm`,`ogg`,`ogv`,`h264`,`avi`,`mov`],so.MIME_TYPES={ogv:`video/ogg`,mov:`video/quicktime`,m4v:`video/mp4`};var co=so;zn.push(ro,vi,eo,co,oo,ao,Un,no,$a);var lo=class{constructor(){this._glTransformFeedbacks={},this.buffers=[],this.disposeRunner=new Vn(`disposeTransformFeedback`)}bindBuffer(e,t){this.buffers[e]=t}destroy(){this.disposeRunner.emit(this,!1)}},uo=`7.4.3`,fo=class{constructor(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.rect=null,this.updateID=-1}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}clear(){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0}getRectangle(e){return this.minX>this.maxX||this.minY>this.maxY?Y.EMPTY:(e||=new Y(0,0,1,1),e.x=this.minX,e.y=this.minY,e.width=this.maxX-this.minX,e.height=this.maxY-this.minY,e)}addPoint(e){this.minX=Math.min(this.minX,e.x),this.maxX=Math.max(this.maxX,e.x),this.minY=Math.min(this.minY,e.y),this.maxY=Math.max(this.maxY,e.y)}addPointMatrix(e,t){let{a:n,b:r,c:i,d:a,tx:o,ty:s}=e,c=n*t.x+i*t.y+o,l=r*t.x+a*t.y+s;this.minX=Math.min(this.minX,c),this.maxX=Math.max(this.maxX,c),this.minY=Math.min(this.minY,l),this.maxY=Math.max(this.maxY,l)}addQuad(e){let t=this.minX,n=this.minY,r=this.maxX,i=this.maxY,a=e[0],o=e[1];t=a<t?a:t,n=o<n?o:n,r=a>r?a:r,i=o>i?o:i,a=e[2],o=e[3],t=a<t?a:t,n=o<n?o:n,r=a>r?a:r,i=o>i?o:i,a=e[4],o=e[5],t=a<t?a:t,n=o<n?o:n,r=a>r?a:r,i=o>i?o:i,a=e[6],o=e[7],t=a<t?a:t,n=o<n?o:n,r=a>r?a:r,i=o>i?o:i,this.minX=t,this.minY=n,this.maxX=r,this.maxY=i}addFrame(e,t,n,r,i){this.addFrameMatrix(e.worldTransform,t,n,r,i)}addFrameMatrix(e,t,n,r,i){let a=e.a,o=e.b,s=e.c,c=e.d,l=e.tx,u=e.ty,d=this.minX,f=this.minY,p=this.maxX,m=this.maxY,h=a*t+s*n+l,g=o*t+c*n+u;d=h<d?h:d,f=g<f?g:f,p=h>p?h:p,m=g>m?g:m,h=a*r+s*n+l,g=o*r+c*n+u,d=h<d?h:d,f=g<f?g:f,p=h>p?h:p,m=g>m?g:m,h=a*t+s*i+l,g=o*t+c*i+u,d=h<d?h:d,f=g<f?g:f,p=h>p?h:p,m=g>m?g:m,h=a*r+s*i+l,g=o*r+c*i+u,d=h<d?h:d,f=g<f?g:f,p=h>p?h:p,m=g>m?g:m,this.minX=d,this.minY=f,this.maxX=p,this.maxY=m}addVertexData(e,t,n){let r=this.minX,i=this.minY,a=this.maxX,o=this.maxY;for(let s=t;s<n;s+=2){let t=e[s],n=e[s+1];r=t<r?t:r,i=n<i?n:i,a=t>a?t:a,o=n>o?n:o}this.minX=r,this.minY=i,this.maxX=a,this.maxY=o}addVertices(e,t,n,r){this.addVerticesMatrix(e.worldTransform,t,n,r)}addVerticesMatrix(e,t,n,r,i=0,a=i){let o=e.a,s=e.b,c=e.c,l=e.d,u=e.tx,d=e.ty,f=this.minX,p=this.minY,m=this.maxX,h=this.maxY;for(let e=n;e<r;e+=2){let n=t[e],r=t[e+1],g=o*n+c*r+u,_=l*r+s*n+d;f=Math.min(f,g-i),m=Math.max(m,g+i),p=Math.min(p,_-a),h=Math.max(h,_+a)}this.minX=f,this.minY=p,this.maxX=m,this.maxY=h}addBounds(e){let t=this.minX,n=this.minY,r=this.maxX,i=this.maxY;this.minX=e.minX<t?e.minX:t,this.minY=e.minY<n?e.minY:n,this.maxX=e.maxX>r?e.maxX:r,this.maxY=e.maxY>i?e.maxY:i}addBoundsMask(e,t){let n=e.minX>t.minX?e.minX:t.minX,r=e.minY>t.minY?e.minY:t.minY,i=e.maxX<t.maxX?e.maxX:t.maxX,a=e.maxY<t.maxY?e.maxY:t.maxY;if(n<=i&&r<=a){let e=this.minX,t=this.minY,o=this.maxX,s=this.maxY;this.minX=n<e?n:e,this.minY=r<t?r:t,this.maxX=i>o?i:o,this.maxY=a>s?a:s}}addBoundsMatrix(e,t){this.addFrameMatrix(t,e.minX,e.minY,e.maxX,e.maxY)}addBoundsArea(e,t){let n=e.minX>t.x?e.minX:t.x,r=e.minY>t.y?e.minY:t.y,i=e.maxX<t.x+t.width?e.maxX:t.x+t.width,a=e.maxY<t.y+t.height?e.maxY:t.y+t.height;if(n<=i&&r<=a){let e=this.minX,t=this.minY,o=this.maxX,s=this.maxY;this.minX=n<e?n:e,this.minY=r<t?r:t,this.maxX=i>o?i:o,this.maxY=a>s?a:s}}pad(e=0,t=e){this.isEmpty()||(this.minX-=e,this.maxX+=e,this.minY-=t,this.maxY+=t)}addFramePad(e,t,n,r,i,a){e-=i,t-=a,n+=i,r+=a,this.minX=this.minX<e?this.minX:e,this.maxX=this.maxX>n?this.maxX:n,this.minY=this.minY<t?this.minY:t,this.maxY=this.maxY>r?this.maxY:r}},$=class e extends tt.default{constructor(){super(),this.tempDisplayObjectParent=null,this.transform=new br,this.alpha=1,this.visible=!0,this.renderable=!0,this.cullable=!1,this.cullArea=null,this.parent=null,this.worldAlpha=1,this._lastSortedIndex=0,this._zIndex=0,this.filterArea=null,this.filters=null,this._enabledFilters=null,this._bounds=new fo,this._localBounds=null,this._boundsID=0,this._boundsRect=null,this._localBoundsRect=null,this._mask=null,this._maskRefCount=0,this._destroyed=!1,this.isSprite=!1,this.isMask=!1}static mixin(t){let n=Object.keys(t);for(let r=0;r<n.length;++r){let i=n[r];Object.defineProperty(e.prototype,i,Object.getOwnPropertyDescriptor(t,i))}}get destroyed(){return this._destroyed}_recursivePostUpdateTransform(){this.parent?(this.parent._recursivePostUpdateTransform(),this.transform.updateTransform(this.parent.transform)):this.transform.updateTransform(this._tempDisplayObjectParent.transform)}updateTransform(){this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha}getBounds(e,t){return e||(this.parent?(this._recursivePostUpdateTransform(),this.updateTransform()):(this.parent=this._tempDisplayObjectParent,this.updateTransform(),this.parent=null)),this._bounds.updateID!==this._boundsID&&(this.calculateBounds(),this._bounds.updateID=this._boundsID),t||=(this._boundsRect||=new Y,this._boundsRect),this._bounds.getRectangle(t)}getLocalBounds(e){e||=(this._localBoundsRect||=new Y,this._localBoundsRect),this._localBounds||=new fo;let t=this.transform,n=this.parent;this.parent=null,this._tempDisplayObjectParent.worldAlpha=n?.worldAlpha??1,this.transform=this._tempDisplayObjectParent.transform;let r=this._bounds,i=this._boundsID;this._bounds=this._localBounds;let a=this.getBounds(!1,e);return this.parent=n,this.transform=t,this._bounds=r,this._bounds.updateID+=this._boundsID-i,a}toGlobal(e,t,n=!1){return n||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.apply(e,t)}toLocal(e,t,n,r){return t&&(e=t.toGlobal(e,n,r)),r||(this._recursivePostUpdateTransform(),this.parent?this.displayObjectUpdateTransform():(this.parent=this._tempDisplayObjectParent,this.displayObjectUpdateTransform(),this.parent=null)),this.worldTransform.applyInverse(e,n)}setParent(e){if(!e||!e.addChild)throw Error(`setParent: Argument must be a Container`);return e.addChild(this),e}removeFromParent(){this.parent?.removeChild(this)}setTransform(e=0,t=0,n=1,r=1,i=0,a=0,o=0,s=0,c=0){return this.position.x=e,this.position.y=t,this.scale.x=n||1,this.scale.y=r||1,this.rotation=i,this.skew.x=a,this.skew.y=o,this.pivot.x=s,this.pivot.y=c,this}destroy(e){this.removeFromParent(),this._destroyed=!0,this.transform=null,this.parent=null,this._bounds=null,this.mask=null,this.cullArea=null,this.filters=null,this.filterArea=null,this.hitArea=null,this.eventMode=`auto`,this.interactiveChildren=!1,this.emit(`destroyed`),this.removeAllListeners()}get _tempDisplayObjectParent(){return this.tempDisplayObjectParent===null&&(this.tempDisplayObjectParent=new po),this.tempDisplayObjectParent}enableTempParent(){let e=this.parent;return this.parent=this._tempDisplayObjectParent,e}disableTempParent(e){this.parent=e}get x(){return this.position.x}set x(e){this.transform.position.x=e}get y(){return this.position.y}set y(e){this.transform.position.y=e}get worldTransform(){return this.transform.worldTransform}get localTransform(){return this.transform.localTransform}get position(){return this.transform.position}set position(e){this.transform.position.copyFrom(e)}get scale(){return this.transform.scale}set scale(e){this.transform.scale.copyFrom(e)}get pivot(){return this.transform.pivot}set pivot(e){this.transform.pivot.copyFrom(e)}get skew(){return this.transform.skew}set skew(e){this.transform.skew.copyFrom(e)}get rotation(){return this.transform.rotation}set rotation(e){this.transform.rotation=e}get angle(){return this.transform.rotation*rr}set angle(e){this.transform.rotation=e*ir}get zIndex(){return this._zIndex}set zIndex(e){this._zIndex!==e&&(this._zIndex=e,this.parent&&(this.parent.sortDirty=!0))}get worldVisible(){let e=this;do{if(!e.visible)return!1;e=e.parent}while(e);return!0}get mask(){return this._mask}set mask(e){if(this._mask!==e){if(this._mask){let e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount--,e._maskRefCount===0&&(e.renderable=!0,e.isMask=!1))}if(this._mask=e,this._mask){let e=this._mask.isMaskData?this._mask.maskObject:this._mask;e&&(e._maskRefCount===0&&(e.renderable=!1,e.isMask=!0),e._maskRefCount++)}}}},po=class extends ${constructor(){super(...arguments),this.sortDirty=null}};$.prototype.displayObjectUpdateTransform=$.prototype.updateTransform;var mo=new X;function ho(e,t){return e.zIndex===t.zIndex?e._lastSortedIndex-t._lastSortedIndex:e.zIndex-t.zIndex}var go=class e extends ${constructor(){super(),this.children=[],this.sortableChildren=e.defaultSortableChildren,this.sortDirty=!1}onChildrenChange(e){}addChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.addChild(e[t]);else{let t=e[0];t.parent&&t.parent.removeChild(t),t.parent=this,this.sortDirty=!0,t.transform._parentID=-1,this.children.push(t),this._boundsID++,this.onChildrenChange(this.children.length-1),this.emit(`childAdded`,t,this,this.children.length-1),t.emit(`added`,this)}return e[0]}addChildAt(e,t){if(t<0||t>this.children.length)throw Error(`${e}addChildAt: The index ${t} supplied is out of bounds ${this.children.length}`);return e.parent&&e.parent.removeChild(e),e.parent=this,this.sortDirty=!0,e.transform._parentID=-1,this.children.splice(t,0,e),this._boundsID++,this.onChildrenChange(t),e.emit(`added`,this),this.emit(`childAdded`,e,this,t),e}swapChildren(e,t){if(e===t)return;let n=this.getChildIndex(e),r=this.getChildIndex(t);this.children[n]=t,this.children[r]=e,this.onChildrenChange(n<r?n:r)}getChildIndex(e){let t=this.children.indexOf(e);if(t===-1)throw Error(`The supplied DisplayObject must be a child of the caller`);return t}setChildIndex(e,t){if(t<0||t>=this.children.length)throw Error(`The index ${t} supplied is out of bounds ${this.children.length}`);let n=this.getChildIndex(e);fn(this.children,n,1),this.children.splice(t,0,e),this.onChildrenChange(t)}getChildAt(e){if(e<0||e>=this.children.length)throw Error(`getChildAt: Index (${e}) does not exist.`);return this.children[e]}removeChild(...e){if(e.length>1)for(let t=0;t<e.length;t++)this.removeChild(e[t]);else{let t=e[0],n=this.children.indexOf(t);if(n===-1)return null;t.parent=null,t.transform._parentID=-1,fn(this.children,n,1),this._boundsID++,this.onChildrenChange(n),t.emit(`removed`,this),this.emit(`childRemoved`,t,this,n)}return e[0]}removeChildAt(e){let t=this.getChildAt(e);return t.parent=null,t.transform._parentID=-1,fn(this.children,e,1),this._boundsID++,this.onChildrenChange(e),t.emit(`removed`,this),this.emit(`childRemoved`,t,this,e),t}removeChildren(e=0,t=this.children.length){let n=e,r=t,i=r-n,a;if(i>0&&i<=r){a=this.children.splice(n,i);for(let e=0;e<a.length;++e)a[e].parent=null,a[e].transform&&(a[e].transform._parentID=-1);this._boundsID++,this.onChildrenChange(e);for(let e=0;e<a.length;++e)a[e].emit(`removed`,this),this.emit(`childRemoved`,a[e],this,e);return a}if(i===0&&this.children.length===0)return[];throw RangeError(`removeChildren: numeric values are outside the acceptable range.`)}sortChildren(){let e=!1;for(let t=0,n=this.children.length;t<n;++t){let n=this.children[t];n._lastSortedIndex=t,!e&&n.zIndex!==0&&(e=!0)}e&&this.children.length>1&&this.children.sort(ho),this.sortDirty=!1}updateTransform(){this.sortableChildren&&this.sortDirty&&this.sortChildren(),this._boundsID++,this.transform.updateTransform(this.parent.transform),this.worldAlpha=this.alpha*this.parent.worldAlpha;for(let e=0,t=this.children.length;e<t;++e){let t=this.children[e];t.visible&&t.updateTransform()}}calculateBounds(){this._bounds.clear(),this._calculateBounds();for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.visible&&t.renderable){if(t.calculateBounds(),t._mask){let e=t._mask.isMaskData?t._mask.maskObject:t._mask;e?(e.calculateBounds(),this._bounds.addBoundsMask(t._bounds,e._bounds)):this._bounds.addBounds(t._bounds)}else t.filterArea?this._bounds.addBoundsArea(t._bounds,t.filterArea):this._bounds.addBounds(t._bounds)}}this._bounds.updateID=this._boundsID}getLocalBounds(e,t=!1){let n=super.getLocalBounds(e);if(!t)for(let e=0,t=this.children.length;e<t;++e){let t=this.children[e];t.visible&&t.updateTransform()}return n}_calculateBounds(){}_renderWithCulling(t){let n=t.renderTexture.sourceFrame;if(!(n.width>0&&n.height>0))return;let r,i;this.cullArea?(r=this.cullArea,i=this.worldTransform):this._render!==e.prototype._render&&(r=this.getBounds(!0));let a=t.projection.transform;if(a&&(i?(i=mo.copyFrom(i),i.prepend(a)):i=a),r&&n.intersects(r,i))this._render(t);else if(this.cullArea)return;for(let e=0,n=this.children.length;e<n;++e){let n=this.children[e],r=n.cullable;n.cullable=r||!this.cullArea,n.render(t),n.cullable=r}}render(e){if(!(!this.visible||this.worldAlpha<=0||!this.renderable)){if(this._mask||this.filters?.length)this.renderAdvanced(e);else if(this.cullable)this._renderWithCulling(e);else{this._render(e);for(let t=0,n=this.children.length;t<n;++t)this.children[t].render(e)}}}renderAdvanced(e){let t=this.filters,n=this._mask;if(t){this._enabledFilters||=[],this._enabledFilters.length=0;for(let e=0;e<t.length;e++)t[e].enabled&&this._enabledFilters.push(t[e])}let r=t&&this._enabledFilters?.length||n&&(!n.isMaskData||n.enabled&&(n.autoDetect||n.type!==y.NONE));if(r&&e.batch.flush(),t&&this._enabledFilters?.length&&e.filter.push(this,this._enabledFilters),n&&e.mask.push(this,this._mask),this.cullable)this._renderWithCulling(e);else{this._render(e);for(let t=0,n=this.children.length;t<n;++t)this.children[t].render(e)}r&&e.batch.flush(),n&&e.mask.pop(this),t&&this._enabledFilters?.length&&e.filter.pop()}_render(e){}destroy(e){super.destroy(),this.sortDirty=!1;let t=typeof e==`boolean`?e:e?.children,n=this.removeChildren(0,this.children.length);if(t)for(let t=0;t<n.length;++t)n[t].destroy(e)}get width(){return this.scale.x*this.getLocalBounds().width}set width(e){let t=this.getLocalBounds().width;t===0?this.scale.x=1:this.scale.x=e/t,this._width=e}get height(){return this.scale.y*this.getLocalBounds().height}set height(e){let t=this.getLocalBounds().height;t===0?this.scale.y=1:this.scale.y=e/t,this._height=e}};go.defaultSortableChildren=!1;var _o=go;_o.prototype.containerUpdateTransform=_o.prototype.updateTransform,Object.defineProperties(w,{SORTABLE_CHILDREN:{get(){return _o.defaultSortableChildren},set(e){z(`7.1.0`,`settings.SORTABLE_CHILDREN is deprecated, use Container.defaultSortableChildren`),_o.defaultSortableChildren=e}}});var vo=new J,yo=new Uint16Array([0,1,2,0,2,3]),bo=class e extends _o{constructor(e){super(),this._anchor=new vr(this._onAnchorUpdate,this,e?e.defaultAnchor.x:0,e?e.defaultAnchor.y:0),this._texture=null,this._width=0,this._height=0,this._tintColor=new H(16777215),this._tintRGB=null,this.tint=16777215,this.blendMode=o.NORMAL,this._cachedTint=16777215,this.uvs=null,this.texture=e||Q.EMPTY,this.vertexData=new Float32Array(8),this.vertexTrimmedData=null,this._transformID=-1,this._textureID=-1,this._transformTrimmedID=-1,this._textureTrimmedID=-1,this.indices=yo,this.pluginName=`batch`,this.isSprite=!0,this._roundPixels=w.ROUND_PIXELS}_onTextureUpdate(){this._textureID=-1,this._textureTrimmedID=-1,this._cachedTint=16777215,this._width&&(this.scale.x=pn(this.scale.x)*this._width/this._texture.orig.width),this._height&&(this.scale.y=pn(this.scale.y)*this._height/this._texture.orig.height)}_onAnchorUpdate(){this._transformID=-1,this._transformTrimmedID=-1}calculateVertices(){let e=this._texture;if(this._transformID===this.transform._worldID&&this._textureID===e._updateID)return;this._textureID!==e._updateID&&(this.uvs=this._texture._uvs.uvsFloat32),this._transformID=this.transform._worldID,this._textureID=e._updateID;let t=this.transform.worldTransform,n=t.a,r=t.b,i=t.c,a=t.d,o=t.tx,s=t.ty,c=this.vertexData,l=e.trim,u=e.orig,d=this._anchor,f=0,p=0,m=0,h=0;if(l?(p=l.x-d._x*u.width,f=p+l.width,h=l.y-d._y*u.height,m=h+l.height):(p=-d._x*u.width,f=p+u.width,h=-d._y*u.height,m=h+u.height),c[0]=n*p+i*h+o,c[1]=a*h+r*p+s,c[2]=n*f+i*h+o,c[3]=a*h+r*f+s,c[4]=n*f+i*m+o,c[5]=a*m+r*f+s,c[6]=n*p+i*m+o,c[7]=a*m+r*p+s,this._roundPixels){let e=w.RESOLUTION;for(let t=0;t<c.length;++t)c[t]=Math.round(c[t]*e)/e}}calculateTrimmedVertices(){if(!this.vertexTrimmedData)this.vertexTrimmedData=new Float32Array(8);else if(this._transformTrimmedID===this.transform._worldID&&this._textureTrimmedID===this._texture._updateID)return;this._transformTrimmedID=this.transform._worldID,this._textureTrimmedID=this._texture._updateID;let e=this._texture,t=this.vertexTrimmedData,n=e.orig,r=this._anchor,i=this.transform.worldTransform,a=i.a,o=i.b,s=i.c,c=i.d,l=i.tx,u=i.ty,d=-r._x*n.width,f=d+n.width,p=-r._y*n.height,m=p+n.height;if(t[0]=a*d+s*p+l,t[1]=c*p+o*d+u,t[2]=a*f+s*p+l,t[3]=c*p+o*f+u,t[4]=a*f+s*m+l,t[5]=c*m+o*f+u,t[6]=a*d+s*m+l,t[7]=c*m+o*d+u,this._roundPixels){let e=w.RESOLUTION;for(let n=0;n<t.length;++n)t[n]=Math.round(t[n]*e)/e}}_render(e){this.calculateVertices(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this)}_calculateBounds(){let e=this._texture.trim,t=this._texture.orig;!e||e.width===t.width&&e.height===t.height?(this.calculateVertices(),this._bounds.addQuad(this.vertexData)):(this.calculateTrimmedVertices(),this._bounds.addQuad(this.vertexTrimmedData))}getLocalBounds(e){return this.children.length===0?(this._localBounds||=new fo,this._localBounds.minX=this._texture.orig.width*-this._anchor._x,this._localBounds.minY=this._texture.orig.height*-this._anchor._y,this._localBounds.maxX=this._texture.orig.width*(1-this._anchor._x),this._localBounds.maxY=this._texture.orig.height*(1-this._anchor._y),e||=(this._localBoundsRect||=new Y,this._localBoundsRect),this._localBounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,vo);let t=this._texture.orig.width,n=this._texture.orig.height,r=-t*this.anchor.x,i=0;return vo.x>=r&&vo.x<r+t&&(i=-n*this.anchor.y,vo.y>=i&&vo.y<i+n)}destroy(e){if(super.destroy(e),this._texture.off(`update`,this._onTextureUpdate,this),this._anchor=null,typeof e==`boolean`?e:e?.texture){let t=typeof e==`boolean`?e:e?.baseTexture;this._texture.destroy(!!t)}this._texture=null}static from(t,n){let r=t instanceof Q?t:Q.from(t,n);return new e(r)}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1,this._transformTrimmedID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(e){let t=pn(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(e){let t=pn(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get anchor(){return this._anchor}set anchor(e){this._anchor.copyFrom(e)}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber()}get tintValue(){return this._tintColor.toNumber()}get texture(){return this._texture}set texture(e){this._texture!==e&&(this._texture&&this._texture.off(`update`,this._onTextureUpdate,this),this._texture=e||Q.EMPTY,this._cachedTint=16777215,this._textureID=-1,this._textureTrimmedID=-1,e&&(e.baseTexture.valid?this._onTextureUpdate():e.once(`update`,this._onTextureUpdate,this)))}},xo=new X;$.prototype._cacheAsBitmap=!1,$.prototype._cacheData=null,$.prototype._cacheAsBitmapResolution=null,$.prototype._cacheAsBitmapMultisample=null;var So=class{constructor(){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($.prototype,{cacheAsBitmapResolution:{get(){return this._cacheAsBitmapResolution},set(e){e!==this._cacheAsBitmapResolution&&(this._cacheAsBitmapResolution=e,this.cacheAsBitmap&&=(this.cacheAsBitmap=!1,!0))}},cacheAsBitmapMultisample:{get(){return this._cacheAsBitmapMultisample},set(e){e!==this._cacheAsBitmapMultisample&&(this._cacheAsBitmapMultisample=e,this.cacheAsBitmap&&=(this.cacheAsBitmap=!1,!0))}},cacheAsBitmap:{get(){return this._cacheAsBitmap},set(e){if(this._cacheAsBitmap===e)return;this._cacheAsBitmap=e;let t;e?(this._cacheData||=new So,t=this._cacheData,t.originalRender=this.render,t.originalRenderCanvas=this.renderCanvas,t.originalUpdateTransform=this.updateTransform,t.originalCalculateBounds=this.calculateBounds,t.originalGetLocalBounds=this.getLocalBounds,t.originalDestroy=this.destroy,t.originalContainsPoint=this.containsPoint,t.originalMask=this._mask,t.originalFilterArea=this.filterArea,this.render=this._renderCached,this.renderCanvas=this._renderCachedCanvas,this.destroy=this._cacheAsBitmapDestroy):(t=this._cacheData,t.sprite&&this._destroyCachedDisplayObject(),this.render=t.originalRender,this.renderCanvas=t.originalRenderCanvas,this.calculateBounds=t.originalCalculateBounds,this.getLocalBounds=t.originalGetLocalBounds,this.destroy=t.originalDestroy,this.updateTransform=t.originalUpdateTransform,this.containsPoint=t.originalContainsPoint,this._mask=t.originalMask,this.filterArea=t.originalFilterArea)}}}),$.prototype._renderCached=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObject(e),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._render(e))},$.prototype._initCachedDisplayObject=function(e){if(this._cacheData?.sprite)return;let t=this.alpha;this.alpha=1,e.batch.flush();let n=this.getLocalBounds(new Y,!0);if(this.filters?.length){let e=this.filters[0].padding;n.pad(e)}let r=this.cacheAsBitmapResolution||e.resolution;n.ceil(r),n.width=Math.max(n.width,1/r),n.height=Math.max(n.height,1/r);let i=e.renderTexture.current,a=e.renderTexture.sourceFrame.clone(),o=e.renderTexture.destinationFrame.clone(),s=e.projection.transform,c=Si.create({width:n.width,height:n.height,resolution:r,multisample:this.cacheAsBitmapMultisample??e.multisample}),l=`cacheAsBitmap_${hn()}`;this._cacheData.textureCacheId=l,G.addToCache(c.baseTexture,l),Q.addToCache(c,l);let u=this.transform.localTransform.copyTo(xo).invert().translate(-n.x,-n.y);this.render=this._cacheData.originalRender,e.render(this,{renderTexture:c,clear:!0,transform:u,skipUpdateTransform:!1}),e.framebuffer.blit(),e.projection.transform=s,e.renderTexture.bind(i,a,o),this.render=this._renderCached,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=t;let d=new bo(c);d.transform.worldTransform=this.transform.worldTransform,d.anchor.x=-(n.x/n.width),d.anchor.y=-(n.y/n.height),d.alpha=t,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)},$.prototype._renderCachedCanvas=function(e){!this.visible||this.worldAlpha<=0||!this.renderable||(this._initCachedDisplayObjectCanvas(e),this._cacheData.sprite.worldAlpha=this.worldAlpha,this._cacheData.sprite._renderCanvas(e))},$.prototype._initCachedDisplayObjectCanvas=function(e){if(this._cacheData?.sprite)return;let t=this.getLocalBounds(new Y,!0),n=this.alpha;this.alpha=1;let r=e.canvasContext.activeContext,i=e._projTransform,a=this.cacheAsBitmapResolution||e.resolution;t.ceil(a),t.width=Math.max(t.width,1/a),t.height=Math.max(t.height,1/a);let o=Si.create({width:t.width,height:t.height,resolution:a}),s=`cacheAsBitmap_${hn()}`;this._cacheData.textureCacheId=s,G.addToCache(o.baseTexture,s),Q.addToCache(o,s);let c=xo;this.transform.localTransform.copyTo(c),c.invert(),c.tx-=t.x,c.ty-=t.y,this.renderCanvas=this._cacheData.originalRenderCanvas,e.render(this,{renderTexture:o,clear:!0,transform:c,skipUpdateTransform:!1}),e.canvasContext.activeContext=r,e._projTransform=i,this.renderCanvas=this._renderCachedCanvas,this.updateTransform=this.displayObjectUpdateTransform,this.calculateBounds=this._calculateCachedBounds,this.getLocalBounds=this._getCachedLocalBounds,this._mask=null,this.filterArea=null,this.alpha=n;let l=new bo(o);l.transform.worldTransform=this.transform.worldTransform,l.anchor.x=-(t.x/t.width),l.anchor.y=-(t.y/t.height),l.alpha=n,l._bounds=this._bounds,this._cacheData.sprite=l,this.transform._parentID=-1,this.parent?this.updateTransform():(this.parent=e._tempDisplayObjectParent,this.updateTransform(),this.parent=null),this.containsPoint=l.containsPoint.bind(l)},$.prototype._calculateCachedBounds=function(){this._bounds.clear(),this._cacheData.sprite.transform._worldID=this.transform._worldID,this._cacheData.sprite._calculateBounds(),this._bounds.updateID=this._boundsID},$.prototype._getCachedLocalBounds=function(){return this._cacheData.sprite.getLocalBounds(null)},$.prototype._destroyCachedDisplayObject=function(){this._cacheData.sprite._texture.destroy(!0),this._cacheData.sprite=null,G.removeFromCache(this._cacheData.textureCacheId),Q.removeFromCache(this._cacheData.textureCacheId),this._cacheData.textureCacheId=null},$.prototype._cacheAsBitmapDestroy=function(e){this.cacheAsBitmap=!1,this.destroy(e)},$.prototype.name=null,_o.prototype.getChildByName=function(e,t){for(let t=0,n=this.children.length;t<n;t++)if(this.children[t].name===e)return this.children[t];if(t)for(let t=0,n=this.children.length;t<n;t++){let n=this.children[t];if(!n.getChildByName)continue;let r=n.getChildByName(e,!0);if(r)return r}return null},$.prototype.getGlobalPosition=function(e=new J,t=!1){return this.parent?this.parent.toGlobal(this.position,e,t):(e.x=this.position.x,e.y=this.position.y),e};var Co=`varying vec2 vTextureCoord;
|
|
527
|
+
|
|
528
|
+
uniform sampler2D uSampler;
|
|
529
|
+
uniform float uAlpha;
|
|
530
|
+
|
|
531
|
+
void main(void)
|
|
532
|
+
{
|
|
533
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uAlpha;
|
|
534
|
+
}
|
|
535
|
+
`,wo=class extends ui{constructor(e=1){super(Wa,Co,{uAlpha:1}),this.alpha=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}},To={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]},Eo=[`varying vec2 vBlurTexCoords[%size%];`,`uniform sampler2D uSampler;`,`void main(void)`,`{`,` gl_FragColor = vec4(0.0);`,` %blur%`,`}`].join(`
|
|
536
|
+
`);function Do(e){let t=To[e],n=t.length,r=Eo,i=``,a;for(let r=0;r<e;r++){let o=`gl_FragColor += texture2D(uSampler, vBlurTexCoords[%index%]) * %value%;`.replace(`%index%`,r.toString());a=r,r>=n&&(a=e-r-1),o=o.replace(`%value%`,t[a].toString()),i+=o,i+=`
|
|
537
|
+
`}return r=r.replace(`%blur%`,i),r=r.replace(`%size%`,e.toString()),r}var Oo=`
|
|
538
|
+
attribute vec2 aVertexPosition;
|
|
539
|
+
|
|
540
|
+
uniform mat3 projectionMatrix;
|
|
541
|
+
|
|
542
|
+
uniform float strength;
|
|
543
|
+
|
|
544
|
+
varying vec2 vBlurTexCoords[%size%];
|
|
545
|
+
|
|
546
|
+
uniform vec4 inputSize;
|
|
547
|
+
uniform vec4 outputFrame;
|
|
548
|
+
|
|
549
|
+
vec4 filterVertexPosition( void )
|
|
550
|
+
{
|
|
551
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
552
|
+
|
|
553
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
554
|
+
}
|
|
555
|
+
|
|
556
|
+
vec2 filterTextureCoord( void )
|
|
557
|
+
{
|
|
558
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
void main(void)
|
|
562
|
+
{
|
|
563
|
+
gl_Position = filterVertexPosition();
|
|
564
|
+
|
|
565
|
+
vec2 textureCoord = filterTextureCoord();
|
|
566
|
+
%blur%
|
|
567
|
+
}`;function ko(e,t){let n=Math.ceil(e/2),r=Oo,i=``,a;a=t?`vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * strength, 0.0);`:`vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * strength);`;for(let t=0;t<e;t++){let e=a.replace(`%index%`,t.toString());e=e.replace(`%sampleIndex%`,`${t-(n-1)}.0`),i+=e,i+=`
|
|
568
|
+
`}return r=r.replace(`%blur%`,i),r=r.replace(`%size%`,e.toString()),r}var Ao=class extends ui{constructor(e,t=8,n=4,r=ui.defaultResolution,i=5){let a=ko(i,e),o=Do(i);super(a,o),this.horizontal=e,this.resolution=r,this._quality=0,this.quality=n,this.blur=t}apply(e,t,n,r){if(n?this.horizontal?this.uniforms.strength=1/n.width*(n.width/t.width):this.uniforms.strength=1/n.height*(n.height/t.height):this.horizontal?this.uniforms.strength=1/e.renderer.width*(e.renderer.width/t.width):this.uniforms.strength=1/e.renderer.height*(e.renderer.height/t.height),this.uniforms.strength*=this.strength,this.uniforms.strength/=this.passes,this.passes===1)e.applyFilter(this,t,n,r);else{let i=e.getFilterTexture(),a=e.renderer,o=t,s=i;this.state.blend=!1,e.applyFilter(this,o,s,g.CLEAR);for(let t=1;t<this.passes-1;t++){e.bindAndClear(o,g.BLIT),this.uniforms.uSampler=s;let t=s;s=o,o=t,a.shader.bind(this),a.geometry.draw(5)}this.state.blend=!0,e.applyFilter(this,s,n,r),e.returnFilterTexture(i)}}get blur(){return this.strength}set blur(e){this.padding=1+Math.abs(e)*2,this.strength=e}get quality(){return this._quality}set quality(e){this._quality=e,this.passes=e}},jo=class extends ui{constructor(e=8,t=4,n=ui.defaultResolution,r=5){super(),this._repeatEdgePixels=!1,this.blurXFilter=new Ao(!0,e,t,n,r),this.blurYFilter=new Ao(!1,e,t,n,r),this.resolution=n,this.quality=t,this.blur=e,this.repeatEdgePixels=!1}apply(e,t,n,r){let i=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(i&&a){let i=e.getFilterTexture();this.blurXFilter.apply(e,t,i,g.CLEAR),this.blurYFilter.apply(e,i,n,r),e.returnFilterTexture(i)}else a?this.blurYFilter.apply(e,t,n,r):this.blurXFilter.apply(e,t,n,r)}updatePadding(){this.padding=this._repeatEdgePixels?0:Math.max(Math.abs(this.blurXFilter.strength),Math.abs(this.blurYFilter.strength))*2}get blur(){return this.blurXFilter.blur}set blur(e){this.blurXFilter.blur=this.blurYFilter.blur=e,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(e){this.blurXFilter.quality=this.blurYFilter.quality=e}get blurX(){return this.blurXFilter.blur}set blurX(e){this.blurXFilter.blur=e,this.updatePadding()}get blurY(){return this.blurYFilter.blur}set blurY(e){this.blurYFilter.blur=e,this.updatePadding()}get blendMode(){return this.blurYFilter.blendMode}set blendMode(e){this.blurYFilter.blendMode=e}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(e){this._repeatEdgePixels=e,this.updatePadding()}},Mo=`varying vec2 vTextureCoord;
|
|
569
|
+
uniform sampler2D uSampler;
|
|
570
|
+
uniform float m[20];
|
|
571
|
+
uniform float uAlpha;
|
|
572
|
+
|
|
573
|
+
void main(void)
|
|
574
|
+
{
|
|
575
|
+
vec4 c = texture2D(uSampler, vTextureCoord);
|
|
576
|
+
|
|
577
|
+
if (uAlpha == 0.0) {
|
|
578
|
+
gl_FragColor = c;
|
|
579
|
+
return;
|
|
580
|
+
}
|
|
581
|
+
|
|
582
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
583
|
+
if (c.a > 0.0) {
|
|
584
|
+
c.rgb /= c.a;
|
|
585
|
+
}
|
|
586
|
+
|
|
587
|
+
vec4 result;
|
|
588
|
+
|
|
589
|
+
result.r = (m[0] * c.r);
|
|
590
|
+
result.r += (m[1] * c.g);
|
|
591
|
+
result.r += (m[2] * c.b);
|
|
592
|
+
result.r += (m[3] * c.a);
|
|
593
|
+
result.r += m[4];
|
|
594
|
+
|
|
595
|
+
result.g = (m[5] * c.r);
|
|
596
|
+
result.g += (m[6] * c.g);
|
|
597
|
+
result.g += (m[7] * c.b);
|
|
598
|
+
result.g += (m[8] * c.a);
|
|
599
|
+
result.g += m[9];
|
|
600
|
+
|
|
601
|
+
result.b = (m[10] * c.r);
|
|
602
|
+
result.b += (m[11] * c.g);
|
|
603
|
+
result.b += (m[12] * c.b);
|
|
604
|
+
result.b += (m[13] * c.a);
|
|
605
|
+
result.b += m[14];
|
|
606
|
+
|
|
607
|
+
result.a = (m[15] * c.r);
|
|
608
|
+
result.a += (m[16] * c.g);
|
|
609
|
+
result.a += (m[17] * c.b);
|
|
610
|
+
result.a += (m[18] * c.a);
|
|
611
|
+
result.a += m[19];
|
|
612
|
+
|
|
613
|
+
vec3 rgb = mix(c.rgb, result.rgb, uAlpha);
|
|
614
|
+
|
|
615
|
+
// Premultiply alpha again.
|
|
616
|
+
rgb *= result.a;
|
|
617
|
+
|
|
618
|
+
gl_FragColor = vec4(rgb, result.a);
|
|
619
|
+
}
|
|
620
|
+
`,No=class extends ui{constructor(){let e={m:new Float32Array([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0]),uAlpha:1};super(Ga,Mo,e),this.alpha=1}_loadMatrix(e,t=!1){let n=e;t&&(this._multiply(n,this.uniforms.m,e),n=this._colorMatrix(n)),this.uniforms.m=n}_multiply(e,t,n){return e[0]=t[0]*n[0]+t[1]*n[5]+t[2]*n[10]+t[3]*n[15],e[1]=t[0]*n[1]+t[1]*n[6]+t[2]*n[11]+t[3]*n[16],e[2]=t[0]*n[2]+t[1]*n[7]+t[2]*n[12]+t[3]*n[17],e[3]=t[0]*n[3]+t[1]*n[8]+t[2]*n[13]+t[3]*n[18],e[4]=t[0]*n[4]+t[1]*n[9]+t[2]*n[14]+t[3]*n[19]+t[4],e[5]=t[5]*n[0]+t[6]*n[5]+t[7]*n[10]+t[8]*n[15],e[6]=t[5]*n[1]+t[6]*n[6]+t[7]*n[11]+t[8]*n[16],e[7]=t[5]*n[2]+t[6]*n[7]+t[7]*n[12]+t[8]*n[17],e[8]=t[5]*n[3]+t[6]*n[8]+t[7]*n[13]+t[8]*n[18],e[9]=t[5]*n[4]+t[6]*n[9]+t[7]*n[14]+t[8]*n[19]+t[9],e[10]=t[10]*n[0]+t[11]*n[5]+t[12]*n[10]+t[13]*n[15],e[11]=t[10]*n[1]+t[11]*n[6]+t[12]*n[11]+t[13]*n[16],e[12]=t[10]*n[2]+t[11]*n[7]+t[12]*n[12]+t[13]*n[17],e[13]=t[10]*n[3]+t[11]*n[8]+t[12]*n[13]+t[13]*n[18],e[14]=t[10]*n[4]+t[11]*n[9]+t[12]*n[14]+t[13]*n[19]+t[14],e[15]=t[15]*n[0]+t[16]*n[5]+t[17]*n[10]+t[18]*n[15],e[16]=t[15]*n[1]+t[16]*n[6]+t[17]*n[11]+t[18]*n[16],e[17]=t[15]*n[2]+t[16]*n[7]+t[17]*n[12]+t[18]*n[17],e[18]=t[15]*n[3]+t[16]*n[8]+t[17]*n[13]+t[18]*n[18],e[19]=t[15]*n[4]+t[16]*n[9]+t[17]*n[14]+t[18]*n[19]+t[19],e}_colorMatrix(e){let t=new Float32Array(e);return t[4]/=255,t[9]/=255,t[14]/=255,t[19]/=255,t}brightness(e,t){let n=[e,0,0,0,0,0,e,0,0,0,0,0,e,0,0,0,0,0,1,0];this._loadMatrix(n,t)}tint(e,t){let[n,r,i]=H.shared.setValue(e).toArray(),a=[n,0,0,0,0,0,r,0,0,0,0,0,i,0,0,0,0,0,1,0];this._loadMatrix(a,t)}greyscale(e,t){let n=[e,e,e,0,0,e,e,e,0,0,e,e,e,0,0,0,0,0,1,0];this._loadMatrix(n,t)}blackAndWhite(e){this._loadMatrix([.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0],e)}hue(e,t){e=(e||0)/180*Math.PI;let n=Math.cos(e),r=Math.sin(e),i=Math.sqrt,a=1/3,o=i(a),s=[n+(1-n)*a,a*(1-n)-o*r,a*(1-n)+o*r,0,0,a*(1-n)+o*r,n+a*(1-n),a*(1-n)-o*r,0,0,a*(1-n)-o*r,a*(1-n)+o*r,n+a*(1-n),0,0,0,0,0,1,0];this._loadMatrix(s,t)}contrast(e,t){let n=(e||0)+1,r=-.5*(n-1),i=[n,0,0,0,r,0,n,0,0,r,0,0,n,0,r,0,0,0,1,0];this._loadMatrix(i,t)}saturate(e=0,t){let n=e*2/3+1,r=(n-1)*-.5,i=[n,r,r,0,0,r,n,r,0,0,r,r,n,0,0,0,0,0,1,0];this._loadMatrix(i,t)}desaturate(){this.saturate(-1)}negative(e){this._loadMatrix([-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0],e)}sepia(e){this._loadMatrix([.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0],e)}technicolor(e){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],e)}polaroid(e){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],e)}toBGR(e){this._loadMatrix([0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0],e)}kodachrome(e){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],e)}browni(e){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],e)}vintage(e){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],e)}colorTone(e,t,n,r,i){e||=.2,t||=.15,n||=16770432,r||=3375104;let a=H.shared,[o,s,c]=a.setValue(n).toArray(),[l,u,d]=a.setValue(r).toArray(),f=[.3,.59,.11,0,0,o,s,c,e,0,l,u,d,t,0,o-l,s-u,c-d,0,0];this._loadMatrix(f,i)}night(e,t){e||=.1;let n=[e*-2,-e,0,0,0,-e,0,e,0,0,0,e,e*2,0,0,0,0,0,1,0];this._loadMatrix(n,t)}predator(e,t){let n=[11.224130630493164*e,-4.794486999511719*e,-2.8746118545532227*e,0*e,.40342438220977783*e,-3.6330697536468506*e,9.193157196044922*e,-2.951810836791992*e,0*e,-1.316135048866272*e,-3.2184197902679443*e,-4.2375030517578125*e,7.476448059082031*e,0*e,.8044459223747253*e,0,0,0,1,0];this._loadMatrix(n,t)}lsd(e){this._loadMatrix([2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0],e)}reset(){this._loadMatrix([1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],!1)}get matrix(){return this.uniforms.m}set matrix(e){this.uniforms.m=e}get alpha(){return this.uniforms.uAlpha}set alpha(e){this.uniforms.uAlpha=e}};No.prototype.grayscale=No.prototype.greyscale;var Po=`varying vec2 vFilterCoord;
|
|
621
|
+
varying vec2 vTextureCoord;
|
|
622
|
+
|
|
623
|
+
uniform vec2 scale;
|
|
624
|
+
uniform mat2 rotation;
|
|
625
|
+
uniform sampler2D uSampler;
|
|
626
|
+
uniform sampler2D mapSampler;
|
|
627
|
+
|
|
628
|
+
uniform highp vec4 inputSize;
|
|
629
|
+
uniform vec4 inputClamp;
|
|
630
|
+
|
|
631
|
+
void main(void)
|
|
632
|
+
{
|
|
633
|
+
vec4 map = texture2D(mapSampler, vFilterCoord);
|
|
634
|
+
|
|
635
|
+
map -= 0.5;
|
|
636
|
+
map.xy = scale * inputSize.zw * (rotation * map.xy);
|
|
637
|
+
|
|
638
|
+
gl_FragColor = texture2D(uSampler, clamp(vec2(vTextureCoord.x + map.x, vTextureCoord.y + map.y), inputClamp.xy, inputClamp.zw));
|
|
639
|
+
}
|
|
640
|
+
`,Fo=`attribute vec2 aVertexPosition;
|
|
641
|
+
|
|
642
|
+
uniform mat3 projectionMatrix;
|
|
643
|
+
uniform mat3 filterMatrix;
|
|
644
|
+
|
|
645
|
+
varying vec2 vTextureCoord;
|
|
646
|
+
varying vec2 vFilterCoord;
|
|
647
|
+
|
|
648
|
+
uniform vec4 inputSize;
|
|
649
|
+
uniform vec4 outputFrame;
|
|
650
|
+
|
|
651
|
+
vec4 filterVertexPosition( void )
|
|
652
|
+
{
|
|
653
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
654
|
+
|
|
655
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
vec2 filterTextureCoord( void )
|
|
659
|
+
{
|
|
660
|
+
return aVertexPosition * (outputFrame.zw * inputSize.zw);
|
|
661
|
+
}
|
|
662
|
+
|
|
663
|
+
void main(void)
|
|
664
|
+
{
|
|
665
|
+
gl_Position = filterVertexPosition();
|
|
666
|
+
vTextureCoord = filterTextureCoord();
|
|
667
|
+
vFilterCoord = ( filterMatrix * vec3( vTextureCoord, 1.0) ).xy;
|
|
668
|
+
}
|
|
669
|
+
`,Io=class extends ui{constructor(e,t){let n=new X;e.renderable=!1,super(Fo,Po,{mapSampler:e._texture,filterMatrix:n,scale:{x:1,y:1},rotation:new Float32Array([1,0,0,1])}),this.maskSprite=e,this.maskMatrix=n,t??=20,this.scale=new J(t,t)}apply(e,t,n,r){this.uniforms.filterMatrix=e.calculateSpriteMatrix(this.maskMatrix,this.maskSprite),this.uniforms.scale.x=this.scale.x,this.uniforms.scale.y=this.scale.y;let i=this.maskSprite.worldTransform,a=Math.sqrt(i.a*i.a+i.b*i.b),o=Math.sqrt(i.c*i.c+i.d*i.d);a!==0&&o!==0&&(this.uniforms.rotation[0]=i.a/a,this.uniforms.rotation[1]=i.b/a,this.uniforms.rotation[2]=i.c/o,this.uniforms.rotation[3]=i.d/o),e.applyFilter(this,t,n,r)}get map(){return this.uniforms.mapSampler}set map(e){this.uniforms.mapSampler=e}},Lo=`varying vec2 v_rgbNW;
|
|
670
|
+
varying vec2 v_rgbNE;
|
|
671
|
+
varying vec2 v_rgbSW;
|
|
672
|
+
varying vec2 v_rgbSE;
|
|
673
|
+
varying vec2 v_rgbM;
|
|
674
|
+
|
|
675
|
+
varying vec2 vFragCoord;
|
|
676
|
+
uniform sampler2D uSampler;
|
|
677
|
+
uniform highp vec4 inputSize;
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
/**
|
|
681
|
+
Basic FXAA implementation based on the code on geeks3d.com with the
|
|
682
|
+
modification that the texture2DLod stuff was removed since it's
|
|
683
|
+
unsupported by WebGL.
|
|
684
|
+
|
|
685
|
+
--
|
|
686
|
+
|
|
687
|
+
From:
|
|
688
|
+
https://github.com/mitsuhiko/webgl-meincraft
|
|
689
|
+
|
|
690
|
+
Copyright (c) 2011 by Armin Ronacher.
|
|
691
|
+
|
|
692
|
+
Some rights reserved.
|
|
693
|
+
|
|
694
|
+
Redistribution and use in source and binary forms, with or without
|
|
695
|
+
modification, are permitted provided that the following conditions are
|
|
696
|
+
met:
|
|
697
|
+
|
|
698
|
+
* Redistributions of source code must retain the above copyright
|
|
699
|
+
notice, this list of conditions and the following disclaimer.
|
|
700
|
+
|
|
701
|
+
* Redistributions in binary form must reproduce the above
|
|
702
|
+
copyright notice, this list of conditions and the following
|
|
703
|
+
disclaimer in the documentation and/or other materials provided
|
|
704
|
+
with the distribution.
|
|
705
|
+
|
|
706
|
+
* The names of the contributors may not be used to endorse or
|
|
707
|
+
promote products derived from this software without specific
|
|
708
|
+
prior written permission.
|
|
709
|
+
|
|
710
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
|
711
|
+
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
|
712
|
+
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
|
713
|
+
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
|
714
|
+
OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
|
715
|
+
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
|
716
|
+
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
|
717
|
+
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
|
718
|
+
THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
|
719
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
720
|
+
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
721
|
+
*/
|
|
722
|
+
|
|
723
|
+
#ifndef FXAA_REDUCE_MIN
|
|
724
|
+
#define FXAA_REDUCE_MIN (1.0/ 128.0)
|
|
725
|
+
#endif
|
|
726
|
+
#ifndef FXAA_REDUCE_MUL
|
|
727
|
+
#define FXAA_REDUCE_MUL (1.0 / 8.0)
|
|
728
|
+
#endif
|
|
729
|
+
#ifndef FXAA_SPAN_MAX
|
|
730
|
+
#define FXAA_SPAN_MAX 8.0
|
|
731
|
+
#endif
|
|
732
|
+
|
|
733
|
+
//optimized version for mobile, where dependent
|
|
734
|
+
//texture reads can be a bottleneck
|
|
735
|
+
vec4 fxaa(sampler2D tex, vec2 fragCoord, vec2 inverseVP,
|
|
736
|
+
vec2 v_rgbNW, vec2 v_rgbNE,
|
|
737
|
+
vec2 v_rgbSW, vec2 v_rgbSE,
|
|
738
|
+
vec2 v_rgbM) {
|
|
739
|
+
vec4 color;
|
|
740
|
+
vec3 rgbNW = texture2D(tex, v_rgbNW).xyz;
|
|
741
|
+
vec3 rgbNE = texture2D(tex, v_rgbNE).xyz;
|
|
742
|
+
vec3 rgbSW = texture2D(tex, v_rgbSW).xyz;
|
|
743
|
+
vec3 rgbSE = texture2D(tex, v_rgbSE).xyz;
|
|
744
|
+
vec4 texColor = texture2D(tex, v_rgbM);
|
|
745
|
+
vec3 rgbM = texColor.xyz;
|
|
746
|
+
vec3 luma = vec3(0.299, 0.587, 0.114);
|
|
747
|
+
float lumaNW = dot(rgbNW, luma);
|
|
748
|
+
float lumaNE = dot(rgbNE, luma);
|
|
749
|
+
float lumaSW = dot(rgbSW, luma);
|
|
750
|
+
float lumaSE = dot(rgbSE, luma);
|
|
751
|
+
float lumaM = dot(rgbM, luma);
|
|
752
|
+
float lumaMin = min(lumaM, min(min(lumaNW, lumaNE), min(lumaSW, lumaSE)));
|
|
753
|
+
float lumaMax = max(lumaM, max(max(lumaNW, lumaNE), max(lumaSW, lumaSE)));
|
|
754
|
+
|
|
755
|
+
mediump vec2 dir;
|
|
756
|
+
dir.x = -((lumaNW + lumaNE) - (lumaSW + lumaSE));
|
|
757
|
+
dir.y = ((lumaNW + lumaSW) - (lumaNE + lumaSE));
|
|
758
|
+
|
|
759
|
+
float dirReduce = max((lumaNW + lumaNE + lumaSW + lumaSE) *
|
|
760
|
+
(0.25 * FXAA_REDUCE_MUL), FXAA_REDUCE_MIN);
|
|
761
|
+
|
|
762
|
+
float rcpDirMin = 1.0 / (min(abs(dir.x), abs(dir.y)) + dirReduce);
|
|
763
|
+
dir = min(vec2(FXAA_SPAN_MAX, FXAA_SPAN_MAX),
|
|
764
|
+
max(vec2(-FXAA_SPAN_MAX, -FXAA_SPAN_MAX),
|
|
765
|
+
dir * rcpDirMin)) * inverseVP;
|
|
766
|
+
|
|
767
|
+
vec3 rgbA = 0.5 * (
|
|
768
|
+
texture2D(tex, fragCoord * inverseVP + dir * (1.0 / 3.0 - 0.5)).xyz +
|
|
769
|
+
texture2D(tex, fragCoord * inverseVP + dir * (2.0 / 3.0 - 0.5)).xyz);
|
|
770
|
+
vec3 rgbB = rgbA * 0.5 + 0.25 * (
|
|
771
|
+
texture2D(tex, fragCoord * inverseVP + dir * -0.5).xyz +
|
|
772
|
+
texture2D(tex, fragCoord * inverseVP + dir * 0.5).xyz);
|
|
773
|
+
|
|
774
|
+
float lumaB = dot(rgbB, luma);
|
|
775
|
+
if ((lumaB < lumaMin) || (lumaB > lumaMax))
|
|
776
|
+
color = vec4(rgbA, texColor.a);
|
|
777
|
+
else
|
|
778
|
+
color = vec4(rgbB, texColor.a);
|
|
779
|
+
return color;
|
|
780
|
+
}
|
|
781
|
+
|
|
782
|
+
void main() {
|
|
783
|
+
|
|
784
|
+
vec4 color;
|
|
785
|
+
|
|
786
|
+
color = fxaa(uSampler, vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
787
|
+
|
|
788
|
+
gl_FragColor = color;
|
|
789
|
+
}
|
|
790
|
+
`,Ro=`
|
|
791
|
+
attribute vec2 aVertexPosition;
|
|
792
|
+
|
|
793
|
+
uniform mat3 projectionMatrix;
|
|
794
|
+
|
|
795
|
+
varying vec2 v_rgbNW;
|
|
796
|
+
varying vec2 v_rgbNE;
|
|
797
|
+
varying vec2 v_rgbSW;
|
|
798
|
+
varying vec2 v_rgbSE;
|
|
799
|
+
varying vec2 v_rgbM;
|
|
800
|
+
|
|
801
|
+
varying vec2 vFragCoord;
|
|
802
|
+
|
|
803
|
+
uniform vec4 inputSize;
|
|
804
|
+
uniform vec4 outputFrame;
|
|
805
|
+
|
|
806
|
+
vec4 filterVertexPosition( void )
|
|
807
|
+
{
|
|
808
|
+
vec2 position = aVertexPosition * max(outputFrame.zw, vec2(0.)) + outputFrame.xy;
|
|
809
|
+
|
|
810
|
+
return vec4((projectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
811
|
+
}
|
|
812
|
+
|
|
813
|
+
void texcoords(vec2 fragCoord, vec2 inverseVP,
|
|
814
|
+
out vec2 v_rgbNW, out vec2 v_rgbNE,
|
|
815
|
+
out vec2 v_rgbSW, out vec2 v_rgbSE,
|
|
816
|
+
out vec2 v_rgbM) {
|
|
817
|
+
v_rgbNW = (fragCoord + vec2(-1.0, -1.0)) * inverseVP;
|
|
818
|
+
v_rgbNE = (fragCoord + vec2(1.0, -1.0)) * inverseVP;
|
|
819
|
+
v_rgbSW = (fragCoord + vec2(-1.0, 1.0)) * inverseVP;
|
|
820
|
+
v_rgbSE = (fragCoord + vec2(1.0, 1.0)) * inverseVP;
|
|
821
|
+
v_rgbM = vec2(fragCoord * inverseVP);
|
|
822
|
+
}
|
|
823
|
+
|
|
824
|
+
void main(void) {
|
|
825
|
+
|
|
826
|
+
gl_Position = filterVertexPosition();
|
|
827
|
+
|
|
828
|
+
vFragCoord = aVertexPosition * outputFrame.zw;
|
|
829
|
+
|
|
830
|
+
texcoords(vFragCoord, inputSize.zw, v_rgbNW, v_rgbNE, v_rgbSW, v_rgbSE, v_rgbM);
|
|
831
|
+
}
|
|
832
|
+
`,zo=class extends ui{constructor(){super(Ro,Lo)}},Bo=`precision highp float;
|
|
833
|
+
|
|
834
|
+
varying vec2 vTextureCoord;
|
|
835
|
+
varying vec4 vColor;
|
|
836
|
+
|
|
837
|
+
uniform float uNoise;
|
|
838
|
+
uniform float uSeed;
|
|
839
|
+
uniform sampler2D uSampler;
|
|
840
|
+
|
|
841
|
+
float rand(vec2 co)
|
|
842
|
+
{
|
|
843
|
+
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
void main()
|
|
847
|
+
{
|
|
848
|
+
vec4 color = texture2D(uSampler, vTextureCoord);
|
|
849
|
+
float randomValue = rand(gl_FragCoord.xy * uSeed);
|
|
850
|
+
float diff = (randomValue - 0.5) * uNoise;
|
|
851
|
+
|
|
852
|
+
// Un-premultiply alpha before applying the color matrix. See issue #3539.
|
|
853
|
+
if (color.a > 0.0) {
|
|
854
|
+
color.rgb /= color.a;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
color.r += diff;
|
|
858
|
+
color.g += diff;
|
|
859
|
+
color.b += diff;
|
|
860
|
+
|
|
861
|
+
// Premultiply alpha again.
|
|
862
|
+
color.rgb *= color.a;
|
|
863
|
+
|
|
864
|
+
gl_FragColor = color;
|
|
865
|
+
}
|
|
866
|
+
`,Vo=class extends ui{constructor(e=.5,t=Math.random()){super(Ga,Bo,{uNoise:0,uSeed:0}),this.noise=e,this.seed=t}get noise(){return this.uniforms.uNoise}set noise(e){this.uniforms.uNoise=e}get seed(){return this.uniforms.uSeed}set seed(e){this.uniforms.uSeed=e}},Ho={AlphaFilter:wo,BlurFilter:jo,BlurFilterPass:Ao,ColorMatrixFilter:No,DisplacementFilter:Io,FXAAFilter:zo,NoiseFilter:Vo};Object.entries(Ho).forEach(([e,t])=>{Object.defineProperty(Ho,e,{get(){return z(`7.1.0`,`filters.${e} has moved to ${e}`),t}})});var Uo=new class{constructor(){this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}init(e){this.removeTickerListener(),this.events=e,this.interactionFrequency=10,this._deltaTime=0,this._didMove=!1,this.tickerAdded=!1,this._pauseUpdate=!0}get pauseUpdate(){return this._pauseUpdate}set pauseUpdate(e){this._pauseUpdate=e}addTickerListener(){this.tickerAdded||!this.domElement||(Ra.system.add(this.tickerUpdate,this,Fa.INTERACTION),this.tickerAdded=!0)}removeTickerListener(){this.tickerAdded&&=(Ra.system.remove(this.tickerUpdate,this),!1)}pointerMoved(){this._didMove=!0}update(){if(!this.domElement||this._pauseUpdate)return;if(this._didMove){this._didMove=!1;return}let e=this.events.rootPointerEvent;this.events.supportsTouchEvents&&e.pointerType===`touch`||globalThis.document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:e.clientX,clientY:e.clientY}))}tickerUpdate(e){this._deltaTime+=e,!(this._deltaTime<this.interactionFrequency)&&(this._deltaTime=0,this.update())}},Wo=class e{constructor(t){this.bubbles=!0,this.cancelBubble=!0,this.cancelable=!1,this.composed=!1,this.defaultPrevented=!1,this.eventPhase=e.prototype.NONE,this.propagationStopped=!1,this.propagationImmediatelyStopped=!1,this.layer=new J,this.page=new J,this.NONE=0,this.CAPTURING_PHASE=1,this.AT_TARGET=2,this.BUBBLING_PHASE=3,this.manager=t}get layerX(){return this.layer.x}get layerY(){return this.layer.y}get pageX(){return this.page.x}get pageY(){return this.page.y}get data(){return this}composedPath(){return this.manager&&(!this.path||this.path[this.path.length-1]!==this.target)&&(this.path=this.target?this.manager.propagationPath(this.target):[]),this.path}initEvent(e,t,n){throw Error(`initEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}initUIEvent(e,t,n,r,i){throw Error(`initUIEvent() is a legacy DOM API. It is not implemented in the Federated Events API.`)}preventDefault(){this.nativeEvent instanceof Event&&this.nativeEvent.cancelable&&this.nativeEvent.preventDefault(),this.defaultPrevented=!0}stopImmediatePropagation(){this.propagationImmediatelyStopped=!0}stopPropagation(){this.propagationStopped=!0}},Go=class extends Wo{constructor(){super(...arguments),this.client=new J,this.movement=new J,this.offset=new J,this.global=new J,this.screen=new J}get clientX(){return this.client.x}get clientY(){return this.client.y}get x(){return this.clientX}get y(){return this.clientY}get movementX(){return this.movement.x}get movementY(){return this.movement.y}get offsetX(){return this.offset.x}get offsetY(){return this.offset.y}get globalX(){return this.global.x}get globalY(){return this.global.y}get screenX(){return this.screen.x}get screenY(){return this.screen.y}getLocalPosition(e,t,n){return e.worldTransform.applyInverse(n||this.global,t)}getModifierState(e){return`getModifierState`in this.nativeEvent&&this.nativeEvent.getModifierState(e)}initMouseEvent(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m){throw Error(`Method not implemented.`)}},Ko=class extends Go{constructor(){super(...arguments),this.width=0,this.height=0,this.isPrimary=!1}getCoalescedEvents(){return this.type===`pointermove`||this.type===`mousemove`||this.type===`touchmove`?[this]:[]}getPredictedEvents(){throw Error(`getPredictedEvents is not supported!`)}},qo=class extends Go{constructor(){super(...arguments),this.DOM_DELTA_PIXEL=0,this.DOM_DELTA_LINE=1,this.DOM_DELTA_PAGE=2}};qo.DOM_DELTA_PIXEL=0,qo.DOM_DELTA_LINE=1,qo.DOM_DELTA_PAGE=2;var Jo=2048,Yo=new J,Xo=new J,Zo=class{constructor(e){this.dispatch=new tt.default,this.moveOnAll=!1,this.enableGlobalMoveEvents=!0,this.mappingState={trackingData:{}},this.eventPool=new Map,this._allInteractiveElements=[],this._hitElements=[],this._isPointerMoveEvent=!1,this.rootTarget=e,this.hitPruneFn=this.hitPruneFn.bind(this),this.hitTestFn=this.hitTestFn.bind(this),this.mapPointerDown=this.mapPointerDown.bind(this),this.mapPointerMove=this.mapPointerMove.bind(this),this.mapPointerOut=this.mapPointerOut.bind(this),this.mapPointerOver=this.mapPointerOver.bind(this),this.mapPointerUp=this.mapPointerUp.bind(this),this.mapPointerUpOutside=this.mapPointerUpOutside.bind(this),this.mapWheel=this.mapWheel.bind(this),this.mappingTable={},this.addEventMapping(`pointerdown`,this.mapPointerDown),this.addEventMapping(`pointermove`,this.mapPointerMove),this.addEventMapping(`pointerout`,this.mapPointerOut),this.addEventMapping(`pointerleave`,this.mapPointerOut),this.addEventMapping(`pointerover`,this.mapPointerOver),this.addEventMapping(`pointerup`,this.mapPointerUp),this.addEventMapping(`pointerupoutside`,this.mapPointerUpOutside),this.addEventMapping(`wheel`,this.mapWheel)}addEventMapping(e,t){this.mappingTable[e]||(this.mappingTable[e]=[]),this.mappingTable[e].push({fn:t,priority:0}),this.mappingTable[e].sort((e,t)=>e.priority-t.priority)}dispatchEvent(e,t){e.propagationStopped=!1,e.propagationImmediatelyStopped=!1,this.propagate(e,t),this.dispatch.emit(t||e.type,e)}mapEvent(e){if(!this.rootTarget)return;let t=this.mappingTable[e.type];if(t)for(let n=0,r=t.length;n<r;n++)t[n].fn(e);else console.warn(`[EventBoundary]: Event mapping not defined for ${e.type}`)}hitTest(e,t){Uo.pauseUpdate=!0;let n=this._isPointerMoveEvent&&this.enableGlobalMoveEvents?`hitTestMoveRecursive`:`hitTestRecursive`,r=this[n](this.rootTarget,this.rootTarget.eventMode,Yo.set(e,t),this.hitTestFn,this.hitPruneFn);return r&&r[0]}propagate(e,t){if(!e.target)return;let n=e.composedPath();e.eventPhase=e.CAPTURING_PHASE;for(let r=0,i=n.length-1;r<i;r++)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return;if(e.eventPhase=e.AT_TARGET,e.currentTarget=e.target,this.notifyTarget(e,t),!(e.propagationStopped||e.propagationImmediatelyStopped)){e.eventPhase=e.BUBBLING_PHASE;for(let r=n.length-2;r>=0;r--)if(e.currentTarget=n[r],this.notifyTarget(e,t),e.propagationStopped||e.propagationImmediatelyStopped)return}}all(e,t,n=this._allInteractiveElements){if(n.length===0)return;e.eventPhase=e.BUBBLING_PHASE;let r=Array.isArray(t)?t:[t];for(let t=n.length-1;t>=0;t--)r.forEach(r=>{e.currentTarget=n[t],this.notifyTarget(e,r)})}propagationPath(e){let t=[e];for(let n=0;n<Jo&&e!==this.rootTarget;n++){if(!e.parent)throw Error(`Cannot find propagation path to disconnected target`);t.push(e.parent),e=e.parent}return t.reverse(),t}hitTestMoveRecursive(e,t,n,r,i,a=!1){let o=!1;if(this._interactivePrune(e))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(Uo.pauseUpdate=!1),e.interactiveChildren&&e.children){let s=e.children;for(let c=s.length-1;c>=0;c--){let l=s[c],u=this.hitTestMoveRecursive(l,this._isInteractive(t)?t:l.eventMode,n,r,i,a||i(e,n));if(u){if(u.length>0&&!u[u.length-1].parent)continue;let t=e.isInteractive();(u.length>0||t)&&(t&&this._allInteractiveElements.push(e),u.push(e)),this._hitElements.length===0&&(this._hitElements=u),o=!0}}}let s=this._isInteractive(t),c=e.isInteractive();return s&&c&&this._allInteractiveElements.push(e),a||this._hitElements.length>0?null:o?this._hitElements:s&&!i(e,n)&&r(e,n)?c?[e]:[]:null}hitTestRecursive(e,t,n,r,i){if(this._interactivePrune(e)||i(e,n))return null;if((e.eventMode===`dynamic`||t===`dynamic`)&&(Uo.pauseUpdate=!1),e.interactiveChildren&&e.children){let a=e.children;for(let o=a.length-1;o>=0;o--){let s=a[o],c=this.hitTestRecursive(s,this._isInteractive(t)?t:s.eventMode,n,r,i);if(c){if(c.length>0&&!c[c.length-1].parent)continue;let t=e.isInteractive();return(c.length>0||t)&&c.push(e),c}}}let a=this._isInteractive(t),o=e.isInteractive();return a&&r(e,n)?o?[e]:[]:null}_isInteractive(e){return e===`static`||e===`dynamic`}_interactivePrune(e){return!(e&&!e.isMask&&e.visible&&e.renderable&&e.eventMode!==`none`&&(e.eventMode!==`passive`||e.interactiveChildren)&&!e.isMask)}hitPruneFn(e,t){if(e.hitArea&&(e.worldTransform.applyInverse(t,Xo),!e.hitArea.contains(Xo.x,Xo.y)))return!0;if(e._mask){let n=e._mask.isMaskData?e._mask.maskObject:e._mask;if(n&&!n.containsPoint?.(t))return!0}return!1}hitTestFn(e,t){return e.eventMode===`passive`?!1:e.hitArea?!0:e.containsPoint?e.containsPoint(t):!1}notifyTarget(e,t){t??=e.type;let n=`on${t}`;e.currentTarget[n]?.(e);let r=e.eventPhase===e.CAPTURING_PHASE||e.eventPhase===e.AT_TARGET?`${t}capture`:t;this.notifyListeners(e,r),e.eventPhase===e.AT_TARGET&&this.notifyListeners(e,t)}mapPointerDown(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.createPointerEvent(e);if(this.dispatchEvent(t,`pointerdown`),t.pointerType===`touch`)this.dispatchEvent(t,`touchstart`);else if(t.pointerType===`mouse`||t.pointerType===`pen`){let e=t.button===2;this.dispatchEvent(t,e?`rightdown`:`mousedown`)}let n=this.trackingData(e.pointerId);n.pressTargetsByButton[e.button]=t.composedPath(),this.freeEvent(t)}mapPointerMove(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}this._allInteractiveElements.length=0,this._hitElements.length=0,this._isPointerMoveEvent=!0;let t=this.createPointerEvent(e);this._isPointerMoveEvent=!1;let n=t.pointerType===`mouse`||t.pointerType===`pen`,r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.overTargets);if(r.overTargets?.length>0&&i!==t.target){let r=e.type===`mousemove`?`mouseout`:`pointerout`,a=this.createPointerEvent(e,r,i);if(this.dispatchEvent(a,`pointerout`),n&&this.dispatchEvent(a,`mouseout`),!t.composedPath().includes(i)){let r=this.createPointerEvent(e,`pointerleave`,i);for(r.eventPhase=r.AT_TARGET;r.target&&!t.composedPath().includes(r.target);)r.currentTarget=r.target,this.notifyTarget(r),n&&this.notifyTarget(r,`mouseleave`),r.target=r.target.parent;this.freeEvent(r)}this.freeEvent(a)}if(i!==t.target){let r=e.type===`mousemove`?`mouseover`:`pointerover`,a=this.clonePointerEvent(t,r);this.dispatchEvent(a,`pointerover`),n&&this.dispatchEvent(a,`mouseover`);let o=i?.parent;for(;o&&o!==this.rootTarget.parent&&o!==t.target;)o=o.parent;if(!o||o===this.rootTarget.parent){let e=this.clonePointerEvent(t,`pointerenter`);for(e.eventPhase=e.AT_TARGET;e.target&&e.target!==i&&e.target!==this.rootTarget.parent;)e.currentTarget=e.target,this.notifyTarget(e),n&&this.notifyTarget(e,`mouseenter`),e.target=e.target.parent;this.freeEvent(e)}this.freeEvent(a)}let a=[],o=this.enableGlobalMoveEvents??!0;this.moveOnAll?a.push(`pointermove`):this.dispatchEvent(t,`pointermove`),o&&a.push(`globalpointermove`),t.pointerType===`touch`&&(this.moveOnAll?a.splice(1,0,`touchmove`):this.dispatchEvent(t,`touchmove`),o&&a.push(`globaltouchmove`)),n&&(this.moveOnAll?a.splice(1,0,`mousemove`):this.dispatchEvent(t,`mousemove`),o&&a.push(`globalmousemove`),this.cursor=t.target?.cursor),a.length>0&&this.all(t,a),this._allInteractiveElements.length=0,this._hitElements.length=0,r.overTargets=t.composedPath(),this.freeEvent(t)}mapPointerOver(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.createPointerEvent(e),r=n.pointerType===`mouse`||n.pointerType===`pen`;this.dispatchEvent(n,`pointerover`),r&&this.dispatchEvent(n,`mouseover`),n.pointerType===`mouse`&&(this.cursor=n.target?.cursor);let i=this.clonePointerEvent(n,`pointerenter`);for(i.eventPhase=i.AT_TARGET;i.target&&i.target!==this.rootTarget.parent;)i.currentTarget=i.target,this.notifyTarget(i),r&&this.notifyTarget(i,`mouseenter`),i.target=i.target.parent;t.overTargets=n.composedPath(),this.freeEvent(n),this.freeEvent(i)}mapPointerOut(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId);if(t.overTargets){let n=e.pointerType===`mouse`||e.pointerType===`pen`,r=this.findMountedTarget(t.overTargets),i=this.createPointerEvent(e,`pointerout`,r);this.dispatchEvent(i),n&&this.dispatchEvent(i,`mouseout`);let a=this.createPointerEvent(e,`pointerleave`,r);for(a.eventPhase=a.AT_TARGET;a.target&&a.target!==this.rootTarget.parent;)a.currentTarget=a.target,this.notifyTarget(a),n&&this.notifyTarget(a,`mouseleave`),a.target=a.target.parent;t.overTargets=null,this.freeEvent(i),this.freeEvent(a)}this.cursor=null}mapPointerUp(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=performance.now(),n=this.createPointerEvent(e);if(this.dispatchEvent(n,`pointerup`),n.pointerType===`touch`)this.dispatchEvent(n,`touchend`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.dispatchEvent(n,e?`rightup`:`mouseup`)}let r=this.trackingData(e.pointerId),i=this.findMountedTarget(r.pressTargetsByButton[e.button]),a=i;if(i&&!n.composedPath().includes(i)){let t=i;for(;t&&!n.composedPath().includes(t);){if(n.currentTarget=t,this.notifyTarget(n,`pointerupoutside`),n.pointerType===`touch`)this.notifyTarget(n,`touchendoutside`);else if(n.pointerType===`mouse`||n.pointerType===`pen`){let e=n.button===2;this.notifyTarget(n,e?`rightupoutside`:`mouseupoutside`)}t=t.parent}delete r.pressTargetsByButton[e.button],a=t}if(a){let i=this.clonePointerEvent(n,`click`);i.target=a,i.path=null,r.clicksByButton[e.button]||(r.clicksByButton[e.button]={clickCount:0,target:i.target,timeStamp:t});let o=r.clicksByButton[e.button];if(o.target===i.target&&t-o.timeStamp<200?++o.clickCount:o.clickCount=1,o.target=i.target,o.timeStamp=t,i.detail=o.clickCount,i.pointerType===`mouse`){let e=i.button===2;this.dispatchEvent(i,e?`rightclick`:`click`)}else i.pointerType===`touch`&&this.dispatchEvent(i,`tap`);this.dispatchEvent(i,`pointertap`),this.freeEvent(i)}this.freeEvent(n)}mapPointerUpOutside(e){if(!(e instanceof Ko)){console.warn(`EventBoundary cannot map a non-pointer event as a pointer event`);return}let t=this.trackingData(e.pointerId),n=this.findMountedTarget(t.pressTargetsByButton[e.button]),r=this.createPointerEvent(e);if(n){let i=n;for(;i;)r.currentTarget=i,this.notifyTarget(r,`pointerupoutside`),r.pointerType===`touch`?this.notifyTarget(r,`touchendoutside`):(r.pointerType===`mouse`||r.pointerType===`pen`)&&this.notifyTarget(r,r.button===2?`rightupoutside`:`mouseupoutside`),i=i.parent;delete t.pressTargetsByButton[e.button]}this.freeEvent(r)}mapWheel(e){if(!(e instanceof qo)){console.warn(`EventBoundary cannot map a non-wheel event as a wheel event`);return}let t=this.createWheelEvent(e);this.dispatchEvent(t),this.freeEvent(t)}findMountedTarget(e){if(!e)return null;let t=e[0];for(let n=1;n<e.length&&e[n].parent===t;n++)t=e[n];return t}createPointerEvent(e,t,n){let r=this.allocateEvent(Ko);return this.copyPointerData(e,r),this.copyMouseData(e,r),this.copyData(e,r),r.nativeEvent=e.nativeEvent,r.originalEvent=e,r.target=n??this.hitTest(r.global.x,r.global.y)??this._hitElements[0],typeof t==`string`&&(r.type=t),r}createWheelEvent(e){let t=this.allocateEvent(qo);return this.copyWheelData(e,t),this.copyMouseData(e,t),this.copyData(e,t),t.nativeEvent=e.nativeEvent,t.originalEvent=e,t.target=this.hitTest(t.global.x,t.global.y),t}clonePointerEvent(e,t){let n=this.allocateEvent(Ko);return n.nativeEvent=e.nativeEvent,n.originalEvent=e.originalEvent,this.copyPointerData(e,n),this.copyMouseData(e,n),this.copyData(e,n),n.target=e.target,n.path=e.composedPath().slice(),n.type=t??n.type,n}copyWheelData(e,t){t.deltaMode=e.deltaMode,t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ}copyPointerData(e,t){e instanceof Ko&&t instanceof Ko&&(t.pointerId=e.pointerId,t.width=e.width,t.height=e.height,t.isPrimary=e.isPrimary,t.pointerType=e.pointerType,t.pressure=e.pressure,t.tangentialPressure=e.tangentialPressure,t.tiltX=e.tiltX,t.tiltY=e.tiltY,t.twist=e.twist)}copyMouseData(e,t){e instanceof Go&&t instanceof Go&&(t.altKey=e.altKey,t.button=e.button,t.buttons=e.buttons,t.client.copyFrom(e.client),t.ctrlKey=e.ctrlKey,t.metaKey=e.metaKey,t.movement.copyFrom(e.movement),t.screen.copyFrom(e.screen),t.shiftKey=e.shiftKey,t.global.copyFrom(e.global))}copyData(e,t){t.isTrusted=e.isTrusted,t.srcElement=e.srcElement,t.timeStamp=performance.now(),t.type=e.type,t.detail=e.detail,t.view=e.view,t.which=e.which,t.layer.copyFrom(e.layer),t.page.copyFrom(e.page)}trackingData(e){return this.mappingState.trackingData[e]||(this.mappingState.trackingData[e]={pressTargetsByButton:{},clicksByButton:{},overTarget:null}),this.mappingState.trackingData[e]}allocateEvent(e){this.eventPool.has(e)||this.eventPool.set(e,[]);let t=this.eventPool.get(e).pop()||new e(this);return t.eventPhase=t.NONE,t.currentTarget=null,t.path=null,t.target=null,t}freeEvent(e){if(e.manager!==this)throw Error(`It is illegal to free an event not managed by this EventBoundary!`);let t=e.constructor;this.eventPool.has(t)||this.eventPool.set(t,[]),this.eventPool.get(t).push(e)}notifyListeners(e,t){let n=e.currentTarget._events[t];if(n&&e.currentTarget.isInteractive()){if(`fn`in n)n.once&&e.currentTarget.removeListener(t,n.fn,void 0,!0),n.fn.call(n.context,e);else for(let r=0,i=n.length;r<i&&!e.propagationImmediatelyStopped;r++)n[r].once&&e.currentTarget.removeListener(t,n[r].fn,void 0,!0),n[r].fn.call(n[r].context,e)}}},Qo=1,$o={touchstart:`pointerdown`,touchend:`pointerup`,touchendoutside:`pointerupoutside`,touchmove:`pointermove`,touchcancel:`pointercancel`},es=class e{constructor(t){this.supportsTouchEvents=`ontouchstart`in globalThis,this.supportsPointerEvents=!!globalThis.PointerEvent,this.domElement=null,this.resolution=1,this.renderer=t,this.rootBoundary=new Zo(null),Uo.init(this),this.autoPreventDefault=!0,this.eventsAdded=!1,this.rootPointerEvent=new Ko(null),this.rootWheelEvent=new qo(null),this.cursorStyles={default:`inherit`,pointer:`pointer`},this.features=new Proxy({...e.defaultEventFeatures},{set:(e,t,n)=>(t===`globalMove`&&(this.rootBoundary.enableGlobalMoveEvents=n),e[t]=n,!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){let{view:n,resolution:r}=this.renderer;this.setTargetElement(n),this.resolution=r,e._defaultEventMode=t.eventMode??`auto`,Object.assign(this.features,t.eventFeatures??{}),this.rootBoundary.enableGlobalMoveEvents=this.features.globalMove}resolutionChange(e){this.resolution=e}destroy(){this.setTargetElement(null),this.renderer=null}setCursor(e){e||=`default`;let t=!0;if(globalThis.OffscreenCanvas&&this.domElement instanceof OffscreenCanvas&&(t=!1),this.currentCursor===e)return;this.currentCursor=e;let n=this.cursorStyles[e];if(n)switch(typeof n){case`string`:t&&(this.domElement.style.cursor=n);break;case`function`:n(e);break;case`object`:t&&Object.assign(this.domElement.style,n)}else t&&typeof e==`string`&&!Object.prototype.hasOwnProperty.call(this.cursorStyles,e)&&(this.domElement.style.cursor=e)}get pointer(){return this.rootPointerEvent}onPointerDown(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this.normalizeToPointerData(e);this.autoPreventDefault&&t[0].isNormalized&&(e.cancelable||!(`cancelable`in e))&&e.preventDefault();for(let e=0,n=t.length;e<n;e++){let n=t[e],r=this.bootstrapEvent(this.rootPointerEvent,n);this.rootBoundary.mapEvent(r)}this.setCursor(this.rootBoundary.cursor)}onPointerMove(e){if(!this.features.move)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,Uo.pointerMoved();let t=this.normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this.bootstrapEvent(this.rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onPointerUp(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=e.target;e.composedPath&&e.composedPath().length>0&&(t=e.composedPath()[0]);let n=t===this.domElement?``:`outside`,r=this.normalizeToPointerData(e);for(let e=0,t=r.length;e<t;e++){let t=this.bootstrapEvent(this.rootPointerEvent,r[e]);t.type+=n,this.rootBoundary.mapEvent(t)}this.setCursor(this.rootBoundary.cursor)}onPointerOverOut(e){if(!this.features.click)return;this.rootBoundary.rootTarget=this.renderer.lastObjectRendered;let t=this.normalizeToPointerData(e);for(let e=0,n=t.length;e<n;e++){let n=this.bootstrapEvent(this.rootPointerEvent,t[e]);this.rootBoundary.mapEvent(n)}this.setCursor(this.rootBoundary.cursor)}onWheel(e){if(!this.features.wheel)return;let t=this.normalizeWheelEvent(e);this.rootBoundary.rootTarget=this.renderer.lastObjectRendered,this.rootBoundary.mapEvent(t)}setTargetElement(e){this.removeEvents(),this.domElement=e,Uo.domElement=e,this.addEvents()}addEvents(){if(this.eventsAdded||!this.domElement)return;Uo.addTickerListener();let e=this.domElement.style;e&&(globalThis.navigator.msPointerEnabled?(e.msContentZooming=`none`,e.msTouchAction=`none`):this.supportsPointerEvents&&(e.touchAction=`none`)),this.supportsPointerEvents?(globalThis.document.addEventListener(`pointermove`,this.onPointerMove,!0),this.domElement.addEventListener(`pointerdown`,this.onPointerDown,!0),this.domElement.addEventListener(`pointerleave`,this.onPointerOverOut,!0),this.domElement.addEventListener(`pointerover`,this.onPointerOverOut,!0),globalThis.addEventListener(`pointerup`,this.onPointerUp,!0)):(globalThis.document.addEventListener(`mousemove`,this.onPointerMove,!0),this.domElement.addEventListener(`mousedown`,this.onPointerDown,!0),this.domElement.addEventListener(`mouseout`,this.onPointerOverOut,!0),this.domElement.addEventListener(`mouseover`,this.onPointerOverOut,!0),globalThis.addEventListener(`mouseup`,this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.addEventListener(`touchstart`,this.onPointerDown,!0),this.domElement.addEventListener(`touchend`,this.onPointerUp,!0),this.domElement.addEventListener(`touchmove`,this.onPointerMove,!0))),this.domElement.addEventListener(`wheel`,this.onWheel,{passive:!0,capture:!0}),this.eventsAdded=!0}removeEvents(){if(!this.eventsAdded||!this.domElement)return;Uo.removeTickerListener();let e=this.domElement.style;globalThis.navigator.msPointerEnabled?(e.msContentZooming=``,e.msTouchAction=``):this.supportsPointerEvents&&(e.touchAction=``),this.supportsPointerEvents?(globalThis.document.removeEventListener(`pointermove`,this.onPointerMove,!0),this.domElement.removeEventListener(`pointerdown`,this.onPointerDown,!0),this.domElement.removeEventListener(`pointerleave`,this.onPointerOverOut,!0),this.domElement.removeEventListener(`pointerover`,this.onPointerOverOut,!0),globalThis.removeEventListener(`pointerup`,this.onPointerUp,!0)):(globalThis.document.removeEventListener(`mousemove`,this.onPointerMove,!0),this.domElement.removeEventListener(`mousedown`,this.onPointerDown,!0),this.domElement.removeEventListener(`mouseout`,this.onPointerOverOut,!0),this.domElement.removeEventListener(`mouseover`,this.onPointerOverOut,!0),globalThis.removeEventListener(`mouseup`,this.onPointerUp,!0),this.supportsTouchEvents&&(this.domElement.removeEventListener(`touchstart`,this.onPointerDown,!0),this.domElement.removeEventListener(`touchend`,this.onPointerUp,!0),this.domElement.removeEventListener(`touchmove`,this.onPointerMove,!0))),this.domElement.removeEventListener(`wheel`,this.onWheel,!0),this.domElement=null,this.eventsAdded=!1}mapPositionToPoint(e,t,n){let r=this.domElement.isConnected?this.domElement.getBoundingClientRect():{x:0,y:0,width:this.domElement.width,height:this.domElement.height,left:0,top:0},i=1/this.resolution;e.x=(t-r.left)*(this.domElement.width/r.width)*i,e.y=(n-r.top)*(this.domElement.height/r.height)*i}normalizeToPointerData(e){let t=[];if(this.supportsTouchEvents&&e instanceof TouchEvent)for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches[n];typeof r.button>`u`&&(r.button=0),typeof r.buttons>`u`&&(r.buttons=1),typeof r.isPrimary>`u`&&(r.isPrimary=e.touches.length===1&&e.type===`touchstart`),typeof r.width>`u`&&(r.width=r.radiusX||1),typeof r.height>`u`&&(r.height=r.radiusY||1),typeof r.tiltX>`u`&&(r.tiltX=0),typeof r.tiltY>`u`&&(r.tiltY=0),typeof r.pointerType>`u`&&(r.pointerType=`touch`),typeof r.pointerId>`u`&&(r.pointerId=r.identifier||0),typeof r.pressure>`u`&&(r.pressure=r.force||.5),typeof r.twist>`u`&&(r.twist=0),typeof r.tangentialPressure>`u`&&(r.tangentialPressure=0),typeof r.layerX>`u`&&(r.layerX=r.offsetX=r.clientX),typeof r.layerY>`u`&&(r.layerY=r.offsetY=r.clientY),r.isNormalized=!0,r.type=e.type,t.push(r)}else if(!globalThis.MouseEvent||e instanceof MouseEvent&&(!this.supportsPointerEvents||!(e instanceof globalThis.PointerEvent))){let n=e;typeof n.isPrimary>`u`&&(n.isPrimary=!0),typeof n.width>`u`&&(n.width=1),typeof n.height>`u`&&(n.height=1),typeof n.tiltX>`u`&&(n.tiltX=0),typeof n.tiltY>`u`&&(n.tiltY=0),typeof n.pointerType>`u`&&(n.pointerType=`mouse`),typeof n.pointerId>`u`&&(n.pointerId=Qo),typeof n.pressure>`u`&&(n.pressure=.5),typeof n.twist>`u`&&(n.twist=0),typeof n.tangentialPressure>`u`&&(n.tangentialPressure=0),n.isNormalized=!0,t.push(n)}else t.push(e);return t}normalizeWheelEvent(e){let t=this.rootWheelEvent;return this.transferMouseData(t,e),t.deltaX=e.deltaX,t.deltaY=e.deltaY,t.deltaZ=e.deltaZ,t.deltaMode=e.deltaMode,this.mapPositionToPoint(t.screen,e.clientX,e.clientY),t.global.copyFrom(t.screen),t.offset.copyFrom(t.screen),t.nativeEvent=e,t.type=e.type,t}bootstrapEvent(e,t){return e.originalEvent=null,e.nativeEvent=t,e.pointerId=t.pointerId,e.width=t.width,e.height=t.height,e.isPrimary=t.isPrimary,e.pointerType=t.pointerType,e.pressure=t.pressure,e.tangentialPressure=t.tangentialPressure,e.tiltX=t.tiltX,e.tiltY=t.tiltY,e.twist=t.twist,this.transferMouseData(e,t),this.mapPositionToPoint(e.screen,t.clientX,t.clientY),e.global.copyFrom(e.screen),e.offset.copyFrom(e.screen),e.isTrusted=t.isTrusted,e.type===`pointerleave`&&(e.type=`pointerout`),e.type.startsWith(`mouse`)&&(e.type=e.type.replace(`mouse`,`pointer`)),e.type.startsWith(`touch`)&&(e.type=$o[e.type]||e.type),e}transferMouseData(e,t){e.isTrusted=t.isTrusted,e.srcElement=t.srcElement,e.timeStamp=performance.now(),e.type=t.type,e.altKey=t.altKey,e.button=t.button,e.buttons=t.buttons,e.client.x=t.clientX,e.client.y=t.clientY,e.ctrlKey=t.ctrlKey,e.metaKey=t.metaKey,e.movement.x=t.movementX,e.movement.y=t.movementY,e.page.x=t.pageX,e.page.y=t.pageY,e.relatedTarget=null,e.shiftKey=t.shiftKey}};es.extension={name:`events`,type:[U.RendererSystem,U.CanvasRendererSystem]},es.defaultEventFeatures={move:!0,globalMove:!0,click:!0,wheel:!0};var ts=es;W.add(ts);function ns(e){return e===`dynamic`||e===`static`}var rs={onclick:null,onmousedown:null,onmouseenter:null,onmouseleave:null,onmousemove:null,onglobalmousemove:null,onmouseout:null,onmouseover:null,onmouseup:null,onmouseupoutside:null,onpointercancel:null,onpointerdown:null,onpointerenter:null,onpointerleave:null,onpointermove:null,onglobalpointermove:null,onpointerout:null,onpointerover:null,onpointertap:null,onpointerup:null,onpointerupoutside:null,onrightclick:null,onrightdown:null,onrightup:null,onrightupoutside:null,ontap:null,ontouchcancel:null,ontouchend:null,ontouchendoutside:null,ontouchmove:null,onglobaltouchmove:null,ontouchstart:null,onwheel:null,_internalInteractive:void 0,get interactive(){return this._internalInteractive??ns(ts.defaultEventMode)},set interactive(e){z(`7.2.0`,`Setting interactive is deprecated, use eventMode = 'none'/'passive'/'auto'/'static'/'dynamic' instead.`),this._internalInteractive=e,this.eventMode=e?`static`:`auto`},_internalEventMode:void 0,get eventMode(){return this._internalEventMode??ts.defaultEventMode},set eventMode(e){this._internalInteractive=ns(e),this._internalEventMode=e},isInteractive(){return this.eventMode===`static`||this.eventMode===`dynamic`},interactiveChildren:!0,hitArea:null,addEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof n==`object`?n.signal:void 0,a=typeof n==`object`&&n.once===!0,o=typeof t==`function`?void 0:t;e=r?`${e}capture`:e;let s=typeof t==`function`?t:t.handleEvent,c=this;i&&i.addEventListener(`abort`,()=>{c.off(e,s,o)}),a?c.once(e,s,o):c.on(e,s,o)},removeEventListener(e,t,n){let r=typeof n==`boolean`&&n||typeof n==`object`&&n.capture,i=typeof t==`function`?void 0:t;e=r?`${e}capture`:e,t=typeof t==`function`?t:t.handleEvent,this.off(e,t,i)},dispatchEvent(e){if(!(e instanceof Wo))throw Error(`DisplayObject cannot propagate events outside of the Federated Events API`);return e.defaultPrevented=!1,e.path=null,e.target=this,e.manager.dispatchEvent(e),!e.defaultPrevented}};$.mixin(rs);var is={accessible:!1,accessibleTitle:null,accessibleHint:null,tabIndex:0,_accessibleActive:!1,_accessibleDiv:null,accessibleType:`button`,accessiblePointerEvents:`auto`,accessibleChildren:!0,renderId:-1};$.mixin(is);var as=9,os=100,ss=0,cs=0,ls=2,us=1,ds=-1e3,fs=-1e3,ps=2,ms=class{constructor(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,(R.tablet||R.phone)&&this.createTouchHook();let t=document.createElement(`div`);t.style.width=`${os}px`,t.style.height=`${os}px`,t.style.position=`absolute`,t.style.top=`${ss}px`,t.style.left=`${cs}px`,t.style.zIndex=ls.toString(),this.div=t,this.renderer=e,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}createTouchHook(){let e=document.createElement(`button`);e.style.width=`${us}px`,e.style.height=`${us}px`,e.style.position=`absolute`,e.style.top=`${ds}px`,e.style.left=`${fs}px`,e.style.zIndex=ps.toString(),e.style.backgroundColor=`#FF0000`,e.title=`select to enable accessibility for this content`,e.addEventListener(`focus`,()=>{this._isMobileAccessibility=!0,this.activate(),this.destroyTouchHook()}),document.body.appendChild(e),this._hookDiv=e}destroyTouchHook(){this._hookDiv&&=(document.body.removeChild(this._hookDiv),null)}activate(){this._isActive||(this._isActive=!0,globalThis.document.addEventListener(`mousemove`,this._onMouseMove,!0),globalThis.removeEventListener(`keydown`,this._onKeyDown,!1),this.renderer.on(`postrender`,this.update,this),this.renderer.view.parentNode?.appendChild(this.div))}deactivate(){!this._isActive||this._isMobileAccessibility||(this._isActive=!1,globalThis.document.removeEventListener(`mousemove`,this._onMouseMove,!0),globalThis.addEventListener(`keydown`,this._onKeyDown,!1),this.renderer.off(`postrender`,this.update),this.div.parentNode?.removeChild(this.div))}updateAccessibleObjects(e){if(!e.visible||!e.accessibleChildren)return;e.accessible&&e.isInteractive()&&(e._accessibleActive||this.addChild(e),e.renderId=this.renderId);let t=e.children;if(t)for(let e=0;e<t.length;e++)this.updateAccessibleObjects(t[e])}update(){let e=performance.now();if(R.android.device&&e<this.androidUpdateCount||(this.androidUpdateCount=e+this.androidUpdateFrequency,!this.renderer.renderingToScreen))return;this.renderer.lastObjectRendered&&this.updateAccessibleObjects(this.renderer.lastObjectRendered);let{x:t,y:n,width:r,height:i}=this.renderer.view.getBoundingClientRect(),{width:a,height:o,resolution:s}=this.renderer,c=r/a*s,l=i/o*s,u=this.div;u.style.left=`${t}px`,u.style.top=`${n}px`,u.style.width=`${a}px`,u.style.height=`${o}px`;for(let e=0;e<this.children.length;e++){let t=this.children[e];if(t.renderId!==this.renderId)t._accessibleActive=!1,fn(this.children,e,1),this.div.removeChild(t._accessibleDiv),this.pool.push(t._accessibleDiv),t._accessibleDiv=null,e--;else{u=t._accessibleDiv;let e=t.hitArea,n=t.worldTransform;t.hitArea?(u.style.left=`${(n.tx+e.x*n.a)*c}px`,u.style.top=`${(n.ty+e.y*n.d)*l}px`,u.style.width=`${e.width*n.a*c}px`,u.style.height=`${e.height*n.d*l}px`):(e=t.getBounds(),this.capHitArea(e),u.style.left=`${e.x*c}px`,u.style.top=`${e.y*l}px`,u.style.width=`${e.width*c}px`,u.style.height=`${e.height*l}px`,u.title!==t.accessibleTitle&&t.accessibleTitle!==null&&(u.title=t.accessibleTitle),u.getAttribute(`aria-label`)!==t.accessibleHint&&t.accessibleHint!==null&&u.setAttribute(`aria-label`,t.accessibleHint)),(t.accessibleTitle!==u.title||t.tabIndex!==u.tabIndex)&&(u.title=t.accessibleTitle,u.tabIndex=t.tabIndex,this.debug&&this.updateDebugHTML(u))}}this.renderId++}updateDebugHTML(e){e.innerHTML=`type: ${e.type}</br> title : ${e.title}</br> tabIndex: ${e.tabIndex}`}capHitArea(e){e.x<0&&(e.width+=e.x,e.x=0),e.y<0&&(e.height+=e.y,e.y=0);let{width:t,height:n}=this.renderer;e.x+e.width>t&&(e.width=t-e.x),e.y+e.height>n&&(e.height=n-e.y)}addChild(e){let t=this.pool.pop();t||(t=document.createElement(`button`),t.style.width=`${os}px`,t.style.height=`${os}px`,t.style.backgroundColor=this.debug?`rgba(255,255,255,0.5)`:`transparent`,t.style.position=`absolute`,t.style.zIndex=ls.toString(),t.style.borderStyle=`none`,navigator.userAgent.toLowerCase().includes(`chrome`)?t.setAttribute(`aria-live`,`off`):t.setAttribute(`aria-live`,`polite`),navigator.userAgent.match(/rv:.*Gecko\//)?t.setAttribute(`aria-relevant`,`additions`):t.setAttribute(`aria-relevant`,`text`),t.addEventListener(`click`,this._onClick.bind(this)),t.addEventListener(`focus`,this._onFocus.bind(this)),t.addEventListener(`focusout`,this._onFocusOut.bind(this))),t.style.pointerEvents=e.accessiblePointerEvents,t.type=e.accessibleType,e.accessibleTitle&&e.accessibleTitle!==null?t.title=e.accessibleTitle:(!e.accessibleHint||e.accessibleHint===null)&&(t.title=`displayObject ${e.tabIndex}`),e.accessibleHint&&e.accessibleHint!==null&&t.setAttribute(`aria-label`,e.accessibleHint),this.debug&&this.updateDebugHTML(t),e._accessibleActive=!0,e._accessibleDiv=t,t.displayObject=e,this.children.push(e),this.div.appendChild(e._accessibleDiv),e._accessibleDiv.tabIndex=e.tabIndex}_dispatchEvent(e,t){let{displayObject:n}=e.target,r=this.renderer.events.rootBoundary,i=Object.assign(new Wo(r),{target:n});r.rootTarget=this.renderer.lastObjectRendered,t.forEach(e=>r.dispatchEvent(i,e))}_onClick(e){this._dispatchEvent(e,[`click`,`pointertap`,`tap`])}_onFocus(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`assertive`),this._dispatchEvent(e,[`mouseover`])}_onFocusOut(e){e.target.getAttribute(`aria-live`)||e.target.setAttribute(`aria-live`,`polite`),this._dispatchEvent(e,[`mouseout`])}_onKeyDown(e){e.keyCode===as&&this.activate()}_onMouseMove(e){e.movementX===0&&e.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}};ms.extension={name:`accessibility`,type:[U.RendererPlugin,U.CanvasRendererPlugin]},W.add(ms);var hs=class e{constructor(t){this.stage=new _o,t=Object.assign({forceCanvas:!1},t),this.renderer=Va(t),e._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render(this.stage)}get view(){return this.renderer?.view}get screen(){return this.renderer?.screen}destroy(t,n){let r=e._plugins.slice(0);r.reverse(),r.forEach(e=>{e.destroy.call(this)}),this.stage.destroy(n),this.stage=null,this.renderer.destroy(t),this.renderer=null}};hs._plugins=[];var gs=hs;W.handleByList(U.Application,gs._plugins);var _s=class{static init(e){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),null)},this.resize=()=>{if(!this._resizeTo)return;this.cancelResize();let e,t;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,t=globalThis.innerHeight;else{let{clientWidth:n,clientHeight:r}=this._resizeTo;e=n,t=r}this.renderer.resize(e,t),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=e.resizeTo||null}static destroy(){globalThis.removeEventListener(`resize`,this.queueResize),this.cancelResize(),this.cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}};_s.extension=U.Application,W.add(_s);var vs={loader:U.LoadParser,resolver:U.ResolveParser,cache:U.CacheParser,detection:U.DetectionParser};W.handle(U.Asset,e=>{let t=e.ref;Object.entries(vs).filter(([e])=>!!t[e]).forEach(([e,n])=>W.add(Object.assign(t[e],{extension:t[e].extension??n})))},e=>{let t=e.ref;Object.keys(vs).filter(e=>!!t[e]).forEach(e=>W.remove(t[e]))});var ys=class{constructor(e,t=!1){this._loader=e,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=t}add(e){e.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;let e=[],t=Math.min(this._assetList.length,this._maxConcurrent);for(let n=0;n<t;n++)e.push(this._assetList.pop());await this._loader.load(e),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(e){this._isActive!==e&&(this._isActive=e,e&&!this._isLoading&&this._next())}};function bs(e,t){if(Array.isArray(t)){for(let n of t)if(e.startsWith(`data:${n}`))return!0;return!1}return e.startsWith(`data:${t}`)}function xs(e,t){let n=e.split(`?`)[0],r=B.extname(n).toLowerCase();return Array.isArray(t)?t.includes(r):r===t}var Ss=(e,t,n=!1)=>(Array.isArray(e)||(e=[e]),t?e.map(e=>typeof e==`string`||n?t(e):e):e),Cs=(e,t)=>{let n=t.split(`?`)[1];return n&&(e+=`?${n}`),e};function ws(e,t,n,r,i){let a=t[n];for(let o=0;o<a.length;o++){let s=a[o];n<t.length-1?ws(e.replace(r[n],s),t,n+1,r,i):i.push(e.replace(r[n],s))}}function Ts(e){let t=e.match(/\{(.*?)\}/g),n=[];if(t){let r=[];t.forEach(e=>{let t=e.substring(1,e.length-1).split(`,`);r.push(t)}),ws(e,r,0,t,n)}else n.push(e);return n}var Es=e=>!Array.isArray(e),Ds=new class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(e){return this._cache.has(e)}get(e){let t=this._cache.get(e);return t||console.warn(`[Assets] Asset id ${e} was not found in the Cache`),t}set(e,t){let n=Ss(e),r;for(let e=0;e<this.parsers.length;e++){let i=this.parsers[e];if(i.test(t)){r=i.getCacheableAssets(n,t);break}}r||(r={},n.forEach(e=>{r[e]=t}));let i=Object.keys(r),a={cacheKeys:i,keys:n};if(n.forEach(e=>{this._cacheMap.set(e,a)}),i.forEach(e=>{let n=r?r[e]:t;this._cache.has(e)&&this._cache.get(e)!==n&&console.warn(`[Cache] already has key:`,e),this._cache.set(e,r[e])}),t instanceof Q){let e=t;n.forEach(t=>{e.baseTexture!==Q.EMPTY.baseTexture&&G.addToCache(e.baseTexture,t),Q.addToCache(e,t)})}}remove(e){if(!this._cacheMap.has(e)){console.warn(`[Assets] Asset id ${e} was not found in the Cache`);return}let t=this._cacheMap.get(e);t.cacheKeys.forEach(e=>{this._cache.delete(e)}),t.keys.forEach(e=>{this._cacheMap.delete(e)})}get parsers(){return this._parsers}},Os=class{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(e,t,n)=>(this._parsersValidated=!1,e[t]=n,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(e,t){let n={promise:null,parser:null};return n.promise=(async()=>{let r=null,i=null;if(t.loadParser&&(i=this._parserHash[t.loadParser],i||console.warn(`[Assets] specified load parser "${t.loadParser}" not found while loading ${e}`)),!i){for(let n=0;n<this.parsers.length;n++){let r=this.parsers[n];if(r.load&&r.test?.(e,t,this)){i=r;break}}if(!i)return console.warn(`[Assets] ${e} could not be loaded as we don't know how to parse it, ensure the correct parser has been added`),null}r=await i.load(e,t,this),n.parser=i;for(let e=0;e<this.parsers.length;e++){let i=this.parsers[e];i.parse&&i.parse&&await i.testParse?.(r,t,this)&&(r=await i.parse(r,t,this)||r,n.parser=i)}return r})(),n}async load(e,t){this._parsersValidated||this._validateParsers();let n=0,r={},i=Es(e),a=Ss(e,e=>({alias:[e],src:e})),o=a.length,s=a.map(async e=>{let i=B.toAbsolute(e.src);if(!r[e.src])try{this.promiseCache[i]||(this.promiseCache[i]=this._getLoadPromiseAndParser(i,e)),r[e.src]=await this.promiseCache[i].promise,t&&t(++n/o)}catch(t){throw delete this.promiseCache[i],delete r[e.src],Error(`[Loader.load] Failed to load ${i}.
|
|
867
|
+
${t}`)}});return await Promise.all(s),i?r[a[0].src]:r}async unload(e){let t=Ss(e,e=>({alias:[e],src:e})).map(async e=>{let t=B.toAbsolute(e.src),n=this.promiseCache[t];if(n){let r=await n.promise;delete this.promiseCache[t],n.parser?.unload?.(r,e,this)}});await Promise.all(t)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(e=>e.name).reduce((e,t)=>(e[t.name]&&console.warn(`[Assets] loadParser name conflict "${t.name}"`),{...e,[t.name]:t}),{})}},ks=(e=>(e[e.Low=0]=`Low`,e[e.Normal=1]=`Normal`,e[e.High=2]=`High`,e))(ks||{}),As=`.json`,js=`application/json`,Ms={extension:{type:U.LoadParser,priority:ks.Low},name:`loadJson`,test(e){return bs(e,js)||xs(e,As)},async load(e){return await(await w.ADAPTER.fetch(e)).json()}};W.add(Ms);var Ns=`.txt`,Ps=`text/plain`,Fs={name:`loadTxt`,extension:{type:U.LoadParser,priority:ks.Low},test(e){return bs(e,Ps)||xs(e,Ns)},async load(e){return await(await w.ADAPTER.fetch(e)).text()}};W.add(Fs);var Is=[`normal`,`bold`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`],Ls=[`.ttf`,`.otf`,`.woff`,`.woff2`],Rs=[`font/ttf`,`font/otf`,`font/woff`,`font/woff2`],zs=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function Bs(e){let t=B.extname(e),n=B.basename(e,t).replace(/(-|_)/g,` `).toLowerCase().split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1)),r=n.length>0;for(let e of n)if(!e.match(zs)){r=!1;break}let i=n.join(` `);return r||(i=`"${i.replace(/[\\"]/g,`\\$&`)}"`),i}var Vs=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function Hs(e){return Vs.test(e)?e:encodeURI(e)}var Us={extension:{type:U.LoadParser,priority:ks.Low},name:`loadWebFont`,test(e){return bs(e,Rs)||xs(e,Ls)},async load(e,t){let n=w.ADAPTER.getFontFaceSet();if(n){let r=[],i=t.data?.family??Bs(e),a=t.data?.weights?.filter(e=>Is.includes(e))??[`normal`],o=t.data??{};for(let t=0;t<a.length;t++){let s=a[t],c=new FontFace(i,`url(${Hs(e)})`,{...o,weight:s});await c.load(),n.add(c),r.push(c)}return r.length===1?r[0]:r}return console.warn(`[loadWebFont] FontFace API is not supported. Skipping loading font`),null},unload(e){(Array.isArray(e)?e:[e]).forEach(e=>w.ADAPTER.getFontFaceSet().delete(e))}};W.add(Us);var Ws=`(function() {
|
|
868
|
+
"use strict";
|
|
869
|
+
const WHITE_PNG = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";
|
|
870
|
+
async function checkImageBitmap() {
|
|
871
|
+
try {
|
|
872
|
+
if (typeof createImageBitmap != "function")
|
|
873
|
+
return !1;
|
|
874
|
+
const imageBlob = await (await fetch(WHITE_PNG)).blob(), imageBitmap = await createImageBitmap(imageBlob);
|
|
875
|
+
return imageBitmap.width === 1 && imageBitmap.height === 1;
|
|
876
|
+
} catch {
|
|
877
|
+
return !1;
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
checkImageBitmap().then((result) => {
|
|
881
|
+
self.postMessage(result);
|
|
882
|
+
});
|
|
883
|
+
})();
|
|
884
|
+
`,Gs=null,Ks=class{constructor(){Gs||=URL.createObjectURL(new Blob([Ws],{type:`application/javascript`})),this.worker=new Worker(Gs)}};Ks.revokeObjectURL=function(){Gs&&=(URL.revokeObjectURL(Gs),null)};var qs=`(function() {
|
|
885
|
+
"use strict";
|
|
886
|
+
async function loadImageBitmap(url) {
|
|
887
|
+
const response = await fetch(url);
|
|
888
|
+
if (!response.ok)
|
|
889
|
+
throw new Error(\`[WorkerManager.loadImageBitmap] Failed to fetch \${url}: \${response.status} \${response.statusText}\`);
|
|
890
|
+
const imageBlob = await response.blob();
|
|
891
|
+
return await createImageBitmap(imageBlob);
|
|
892
|
+
}
|
|
893
|
+
self.onmessage = async (event) => {
|
|
894
|
+
try {
|
|
895
|
+
const imageBitmap = await loadImageBitmap(event.data.data[0]);
|
|
896
|
+
self.postMessage({
|
|
897
|
+
data: imageBitmap,
|
|
898
|
+
uuid: event.data.uuid,
|
|
899
|
+
id: event.data.id
|
|
900
|
+
}, [imageBitmap]);
|
|
901
|
+
} catch (e) {
|
|
902
|
+
self.postMessage({
|
|
903
|
+
error: e,
|
|
904
|
+
uuid: event.data.uuid,
|
|
905
|
+
id: event.data.id
|
|
906
|
+
});
|
|
907
|
+
}
|
|
908
|
+
};
|
|
909
|
+
})();
|
|
910
|
+
`,Js=null,Ys=class{constructor(){Js||=URL.createObjectURL(new Blob([qs],{type:`application/javascript`})),this.worker=new Worker(Js)}};Ys.revokeObjectURL=function(){Js&&=(URL.revokeObjectURL(Js),null)};var Xs=0,Zs,Qs=new class{constructor(){this._initialized=!1,this._createdWorkers=0,this.workerPool=[],this.queue=[],this.resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported===void 0&&(this._isImageBitmapSupported=new Promise(e=>{let{worker:t}=new Ks;t.addEventListener(`message`,n=>{t.terminate(),Ks.revokeObjectURL(),e(n.data)})})),this._isImageBitmapSupported}loadImageBitmap(e){return this._run(`loadImageBitmap`,[e])}async _initWorkers(){this._initialized||=!0}getWorker(){Zs===void 0&&(Zs=navigator.hardwareConcurrency||4);let e=this.workerPool.pop();return!e&&this._createdWorkers<Zs&&(this._createdWorkers++,e=new Ys().worker,e.addEventListener(`message`,e=>{this.complete(e.data),this.returnWorker(e.target),this.next()})),e}returnWorker(e){this.workerPool.push(e)}complete(e){e.error===void 0?this.resolveHash[e.uuid].resolve(e.data):this.resolveHash[e.uuid].reject(e.error),this.resolveHash[e.uuid]=null}async _run(e,t){await this._initWorkers();let n=new Promise((n,r)=>{this.queue.push({id:e,arguments:t,resolve:n,reject:r})});return this.next(),n}next(){if(!this.queue.length)return;let e=this.getWorker();if(!e)return;let t=this.queue.pop(),n=t.id;this.resolveHash[Xs]={resolve:t.resolve,reject:t.reject},e.postMessage({data:t.arguments,uuid:Xs++,id:n})}};function $s(e,t,n){e.resource.internal=!0;let r=new Q(e),i=()=>{delete t.promiseCache[n],Ds.has(n)&&Ds.remove(n)};return r.baseTexture.once(`destroyed`,()=>{n in t.promiseCache&&(console.warn(`[Assets] A BaseTexture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the BaseTexture.`),i())}),r.once(`destroyed`,()=>{e.destroyed||(console.warn(`[Assets] A Texture managed by Assets was destroyed instead of unloaded! Use Assets.unload() instead of destroying the Texture.`),i())}),r}var ec=[`.jpeg`,`.jpg`,`.png`,`.webp`,`.avif`],tc=[`image/jpeg`,`image/png`,`image/webp`,`image/avif`];async function nc(e){let t=await w.ADAPTER.fetch(e);if(!t.ok)throw Error(`[loadImageBitmap] Failed to fetch ${e}: ${t.status} ${t.statusText}`);let n=await t.blob();return await createImageBitmap(n)}var rc={name:`loadTextures`,extension:{type:U.LoadParser,priority:ks.High},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:`anonymous`},test(e){return bs(e,tc)||xs(e,ec)},async load(e,t,n){let r=globalThis.createImageBitmap&&this.config.preferCreateImageBitmap,i;i=r?this.config.preferWorkers&&await Qs.isImageBitmapSupported()?await Qs.loadImageBitmap(e):await nc(e):await new Promise((t,n)=>{let r=new Image;r.crossOrigin=this.config.crossOrigin,r.src=e,r.complete?t(r):(r.onload=()=>t(r),r.onerror=e=>n(e))});let a={...t.data};a.resolution??=An(e),r&&a.resourceOptions?.ownsImageBitmap===void 0&&(a.resourceOptions={...a.resourceOptions},a.resourceOptions.ownsImageBitmap=!0);let o=new G(i,a);return o.resource.src=e,$s(o,n,e)},unload(e){e.destroy(!0)}};W.add(rc);var ic=`.svg`,ac=`image/svg+xml`,oc={extension:{type:U.LoadParser,priority:ks.High},name:`loadSVG`,test(e){return bs(e,ac)||xs(e,ic)},async testParse(e){return ao.test(e)},async parse(e,t,n){let r=new ao(e,t?.data?.resourceOptions);await r.load();let i=new G(r,{resolution:An(e),...t?.data});return i.resource.src=t.src,$s(i,n,t.src)},async load(e,t){return(await w.ADAPTER.fetch(e)).text()},unload:rc.unload};W.add(oc);var sc=[`.mp4`,`.m4v`,`.webm`,`.ogv`],cc=[`video/mp4`,`video/webm`,`video/ogg`],lc={name:`loadVideo`,extension:{type:U.LoadParser,priority:ks.High},config:{defaultAutoPlay:!0,defaultUpdateFPS:0,defaultLoop:!1,defaultMuted:!1,defaultPlaysinline:!0},test(e){return bs(e,cc)||xs(e,sc)},async load(e,t,n){let r,i=await(await w.ADAPTER.fetch(e)).blob(),a=URL.createObjectURL(i);try{let i=new co(a,{autoPlay:this.config.defaultAutoPlay,updateFPS:this.config.defaultUpdateFPS,loop:this.config.defaultLoop,muted:this.config.defaultMuted,playsinline:this.config.defaultPlaysinline,...t?.data?.resourceOptions,autoLoad:!0});await i.load();let o=new G(i,{alphaMode:await ft(),resolution:An(e),...t?.data});o.resource.src=e,r=$s(o,n,e),r.baseTexture.once(`destroyed`,()=>{URL.revokeObjectURL(a)})}catch(e){throw URL.revokeObjectURL(a),e}return r},unload(e){e.destroy(!0)}};W.add(lc);var uc=class{constructor(){this._defaultBundleIdentifierOptions={connector:`-`,createBundleAssetId:(e,t)=>`${e}${this._bundleIdConnector}${t}`,extractAssetIdFromBundle:(e,t)=>t.replace(`${e}${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(e){if(this._bundleIdConnector=e.connector??this._bundleIdConnector,this._createBundleAssetId=e.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=e.extractAssetIdFromBundle??this._extractAssetIdFromBundle,this._extractAssetIdFromBundle(`foo`,this._createBundleAssetId(`foo`,`bar`))!==`bar`)throw Error(`[Resolver] GenerateBundleAssetId are not working correctly`)}prefer(...e){e.forEach(e=>{this._preferredOrder.push(e),e.priority||=Object.keys(e.params)}),this._resolverHash={}}set basePath(e){this._basePath=e}get basePath(){return this._basePath}set rootPath(e){this._rootPath=e}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(e){if(typeof e==`string`)this._defaultSearchParams=e;else{let t=e;this._defaultSearchParams=Object.keys(t).map(e=>`${encodeURIComponent(e)}=${encodeURIComponent(t[e])}`).join(`&`)}}getAlias(e){let{alias:t,name:n,src:r,srcs:i}=e;return Ss(t||n||r||i,e=>typeof e==`string`?e:Array.isArray(e)?e.map(e=>e?.src??e?.srcs??e):e?.src||e?.srcs?e.src??e.srcs:e,!0)}addManifest(e){this._manifest&&console.warn(`[Resolver] Manifest already exists, this will be overwritten`),this._manifest=e,e.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(e,t){let n=[];Array.isArray(t)?t.forEach(t=>{let r=t.src??t.srcs,i=t.alias??t.name,a;if(typeof i==`string`){let t=this._createBundleAssetId(e,i);n.push(t),a=[i,t]}else{let t=i.map(t=>this._createBundleAssetId(e,t));n.push(...t),a=[...i,...t]}this.add({...t,alias:a,src:r})}):Object.keys(t).forEach(r=>{let i=[r,this._createBundleAssetId(e,r)];if(typeof t[r]==`string`)this.add({alias:i,src:t[r]});else if(Array.isArray(t[r]))this.add({alias:i,src:t[r]});else{let e=t[r],n=e.src??e.srcs;this.add({...e,alias:i,src:Array.isArray(n)?n:[n]})}n.push(...i)}),this._bundles[e]=n}add(e,t,n,r,i){let a=[];typeof e==`string`||Array.isArray(e)&&typeof e[0]==`string`?(z(`7.2.0`,`Assets.add now uses an object instead of individual parameters.
|
|
911
|
+
Please use Assets.add({ alias, src, data, format, loadParser }) instead.`),a.push({alias:e,src:t,data:n,format:r,loadParser:i})):Array.isArray(e)?a.push(...e):a.push(e);let o=e=>{this.hasKey(e)&&console.warn(`[Resolver] already has key: ${e} overwriting`)};Ss(a).forEach(e=>{let{src:t,srcs:n}=e,{data:r,format:i,loadParser:a}=e,s=Ss(t||n).map(e=>typeof e==`string`?Ts(e):Array.isArray(e)?e:[e]),c=this.getAlias(e);Array.isArray(c)?c.forEach(o):o(c);let l=[];s.forEach(e=>{e.forEach(e=>{let t={};if(typeof e!=`object`){t.src=e;for(let n=0;n<this._parsers.length;n++){let r=this._parsers[n];if(r.test(e)){t=r.parse(e);break}}}else r=e.data??r,i=e.format??i,a=e.loadParser??a,t={...t,...e};if(!c)throw Error(`[Resolver] alias is undefined for this asset: ${t.src}`);t=this.buildResolvedAsset(t,{aliases:c,data:r,format:i,loadParser:a}),l.push(t)})}),c.forEach(e=>{this._assetMap[e]=l})})}resolveBundle(e){let t=Es(e);e=Ss(e);let n={};return e.forEach(e=>{let t=this._bundles[e];if(t){let r=this.resolve(t),i={};for(let t in r){let n=r[t];i[this._extractAssetIdFromBundle(e,t)]=n}n[e]=i}}),t?n[e[0]]:n}resolveUrl(e){let t=this.resolve(e);if(typeof e!=`string`){let e={};for(let n in t)e[n]=t[n].src;return e}return t.src}resolve(e){let t=Es(e);e=Ss(e);let n={};return e.forEach(e=>{if(!this._resolverHash[e]){if(this._assetMap[e]){let t=this._assetMap[e],n=t[0],r=this._getPreferredOrder(t);r?.priority.forEach(e=>{r.params[e].forEach(n=>{let r=t.filter(t=>t[e]?t[e]===n:!1);r.length&&(t=r)})}),this._resolverHash[e]=t[0]??n}else this._resolverHash[e]=this.buildResolvedAsset({alias:[e],src:e},{})}n[e]=this._resolverHash[e]}),t?n[e[0]]:n}hasKey(e){return!!this._assetMap[e]}hasBundle(e){return!!this._bundles[e]}_getPreferredOrder(e){for(let t=0;t<e.length;t++){let t=e[0],n=this._preferredOrder.find(e=>e.params.format.includes(t.format));if(n)return n}return this._preferredOrder[0]}_appendDefaultSearchParams(e){return this._defaultSearchParams?`${e}${/\?/.test(e)?`&`:`?`}${this._defaultSearchParams}`:e}buildResolvedAsset(e,t){let{aliases:n,data:r,loadParser:i,format:a}=t;return(this._basePath||this._rootPath)&&(e.src=B.toAbsolute(e.src,this._basePath,this._rootPath)),e.alias=n??e.alias??[e.src],e.src=this._appendDefaultSearchParams(e.src),e.data={...r||{},...e.data},e.loadParser=i??e.loadParser,e.format=a??e.format??B.extname(e.src).slice(1),e.srcs=e.src,e.name=e.alias,e}},dc=class{constructor(){this._detections=[],this._initialized=!1,this.resolver=new uc,this.loader=new Os,this.cache=Ds,this._backgroundLoader=new ys(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(e={}){if(this._initialized){console.warn(`[Assets]AssetManager already initialized, did you load before calling this Assets.init()?`);return}if(this._initialized=!0,e.defaultSearchParams&&this.resolver.setDefaultSearchParams(e.defaultSearchParams),e.basePath&&(this.resolver.basePath=e.basePath),e.bundleIdentifier&&this.resolver.setBundleIdentifier(e.bundleIdentifier),e.manifest){let t=e.manifest;typeof t==`string`&&(t=await this.load(t)),this.resolver.addManifest(t)}let t=e.texturePreference?.resolution??1,n=typeof t==`number`?[t]:t,r=await this._detectFormats({preferredFormats:e.texturePreference?.format,skipDetections:e.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:r,resolution:n}}),e.preferences&&this.setPreferences(e.preferences)}add(e,t,n,r,i){this.resolver.add(e,t,n,r,i)}async load(e,t){this._initialized||await this.init();let n=Es(e),r=Ss(e).map(e=>{if(typeof e!=`string`){let t=this.resolver.getAlias(e);return t.some(e=>!this.resolver.hasKey(e))&&this.add(e),Array.isArray(t)?t[0]:t}return this.resolver.hasKey(e)||this.add({alias:e,src:e}),e}),i=this.resolver.resolve(r),a=await this._mapLoadToResolve(i,t);return n?a[r[0]]:a}addBundle(e,t){this.resolver.addBundle(e,t)}async loadBundle(e,t){this._initialized||await this.init();let n=!1;typeof e==`string`&&(n=!0,e=[e]);let r=this.resolver.resolveBundle(e),i={},a=Object.keys(r),o=0,s=0,c=()=>{t?.(++o/s)},l=a.map(e=>{let t=r[e];return s+=Object.keys(t).length,this._mapLoadToResolve(t,c).then(t=>{i[e]=t})});return await Promise.all(l),n?i[e[0]]:i}async backgroundLoad(e){this._initialized||await this.init(),typeof e==`string`&&(e=[e]);let t=this.resolver.resolve(e);this._backgroundLoader.add(Object.values(t))}async backgroundLoadBundle(e){this._initialized||await this.init(),typeof e==`string`&&(e=[e]);let t=this.resolver.resolveBundle(e);Object.values(t).forEach(e=>{this._backgroundLoader.add(Object.values(e))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(e){if(typeof e==`string`)return Ds.get(e);let t={};for(let n=0;n<e.length;n++)t[n]=Ds.get(e[n]);return t}async _mapLoadToResolve(e,t){let n=Object.values(e),r=Object.keys(e);this._backgroundLoader.active=!1;let i=await this.loader.load(n,t);this._backgroundLoader.active=!0;let a={};return n.forEach((e,t)=>{let n=i[e.src],o=[e.src];e.alias&&o.push(...e.alias),a[r[t]]=n,Ds.set(o,n)}),a}async unload(e){this._initialized||await this.init();let t=Ss(e).map(e=>typeof e==`string`?e:e.src),n=this.resolver.resolve(t);await this._unloadFromResolved(n)}async unloadBundle(e){this._initialized||await this.init(),e=Ss(e);let t=this.resolver.resolveBundle(e),n=Object.keys(t).map(e=>this._unloadFromResolved(t[e]));await Promise.all(n)}async _unloadFromResolved(e){let t=Object.values(e);t.forEach(e=>{Ds.remove(e.src)}),await this.loader.unload(t)}async _detectFormats(e){let t=[];e.preferredFormats&&(t=Array.isArray(e.preferredFormats)?e.preferredFormats:[e.preferredFormats]);for(let n of e.detections)e.skipDetections||await n.test()?t=await n.add(t):e.skipDetections||(t=await n.remove(t));return t=t.filter((e,n)=>t.indexOf(e)===n),t}get detections(){return this._detections}get preferWorkers(){return rc.config.preferWorkers}set preferWorkers(e){z(`7.2.0`,`Assets.prefersWorkers is deprecated, use Assets.setPreferences({ preferWorkers: true }) instead.`),this.setPreferences({preferWorkers:e})}setPreferences(e){this.loader.parsers.forEach(t=>{t.config&&Object.keys(t.config).filter(t=>t in e).forEach(n=>{t.config[n]=e[n]})})}},fc=new dc;W.handleByList(U.LoadParser,fc.loader.parsers).handleByList(U.ResolveParser,fc.resolver.parsers).handleByList(U.CacheParser,fc.cache.parsers).handleByList(U.DetectionParser,fc.detections);var pc={extension:U.CacheParser,test:e=>Array.isArray(e)&&e.every(e=>e instanceof Q),getCacheableAssets:(e,t)=>{let n={};return e.forEach(e=>{t.forEach((t,r)=>{n[e+(r===0?``:r+1)]=t})}),n}};W.add(pc);async function mc(e){if(`Image`in globalThis)return new Promise(t=>{let n=new Image;n.onload=()=>{t(!0)},n.onerror=()=>{t(!1)},n.src=e});if(`createImageBitmap`in globalThis&&`fetch`in globalThis){try{let t=await(await fetch(e)).blob();await createImageBitmap(t)}catch{return!1}return!0}return!1}var hc={extension:{type:U.DetectionParser,priority:1},test:async()=>mc(`data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A=`),add:async e=>[...e,`avif`],remove:async e=>e.filter(e=>e!==`avif`)};W.add(hc);var gc={extension:{type:U.DetectionParser,priority:0},test:async()=>mc(`data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA=`),add:async e=>[...e,`webp`],remove:async e=>e.filter(e=>e!==`webp`)};W.add(gc);var _c=[`png`,`jpg`,`jpeg`],vc={extension:{type:U.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async e=>[...e,..._c],remove:async e=>e.filter(e=>!_c.includes(e))};W.add(vc);var yc=`WorkerGlobalScope`in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function bc(e){return!yc&&document.createElement(`video`).canPlayType(e)!==``}var xc={extension:{type:U.DetectionParser,priority:0},test:async()=>bc(`video/webm`),add:async e=>[...e,`webm`],remove:async e=>e.filter(e=>e!==`webm`)};W.add(xc);var Sc={extension:{type:U.DetectionParser,priority:0},test:async()=>bc(`video/mp4`),add:async e=>[...e,`mp4`,`m4v`],remove:async e=>e.filter(e=>e!==`mp4`&&e!==`m4v`)};W.add(Sc);var Cc={extension:{type:U.DetectionParser,priority:0},test:async()=>bc(`video/ogg`),add:async e=>[...e,`ogv`],remove:async e=>e.filter(e=>e!==`ogv`)};W.add(Cc);var wc={extension:U.ResolveParser,test:rc.test,parse:e=>({resolution:parseFloat(w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:B.extname(e).slice(1),src:e})};W.add(wc);var Tc=(e=>(e[e.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]=`COMPRESSED_RGB_S3TC_DXT1_EXT`,e[e.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]=`COMPRESSED_RGBA_S3TC_DXT1_EXT`,e[e.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]=`COMPRESSED_RGBA_S3TC_DXT3_EXT`,e[e.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]=`COMPRESSED_RGBA_S3TC_DXT5_EXT`,e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]=`COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT`,e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]=`COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT`,e[e.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]=`COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT`,e[e.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]=`COMPRESSED_SRGB_S3TC_DXT1_EXT`,e[e.COMPRESSED_R11_EAC=37488]=`COMPRESSED_R11_EAC`,e[e.COMPRESSED_SIGNED_R11_EAC=37489]=`COMPRESSED_SIGNED_R11_EAC`,e[e.COMPRESSED_RG11_EAC=37490]=`COMPRESSED_RG11_EAC`,e[e.COMPRESSED_SIGNED_RG11_EAC=37491]=`COMPRESSED_SIGNED_RG11_EAC`,e[e.COMPRESSED_RGB8_ETC2=37492]=`COMPRESSED_RGB8_ETC2`,e[e.COMPRESSED_RGBA8_ETC2_EAC=37496]=`COMPRESSED_RGBA8_ETC2_EAC`,e[e.COMPRESSED_SRGB8_ETC2=37493]=`COMPRESSED_SRGB8_ETC2`,e[e.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]=`COMPRESSED_SRGB8_ALPHA8_ETC2_EAC`,e[e.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]=`COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2`,e[e.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]=`COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2`,e[e.COMPRESSED_RGB_PVRTC_4BPPV1_IMG=35840]=`COMPRESSED_RGB_PVRTC_4BPPV1_IMG`,e[e.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG=35842]=`COMPRESSED_RGBA_PVRTC_4BPPV1_IMG`,e[e.COMPRESSED_RGB_PVRTC_2BPPV1_IMG=35841]=`COMPRESSED_RGB_PVRTC_2BPPV1_IMG`,e[e.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG=35843]=`COMPRESSED_RGBA_PVRTC_2BPPV1_IMG`,e[e.COMPRESSED_RGB_ETC1_WEBGL=36196]=`COMPRESSED_RGB_ETC1_WEBGL`,e[e.COMPRESSED_RGB_ATC_WEBGL=35986]=`COMPRESSED_RGB_ATC_WEBGL`,e[e.COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL=35987]=`COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL`,e[e.COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL=34798]=`COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL`,e[e.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]=`COMPRESSED_RGBA_ASTC_4x4_KHR`,e[e.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]=`COMPRESSED_RGBA_BPTC_UNORM_EXT`,e[e.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]=`COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT`,e[e.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]=`COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT`,e[e.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]=`COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT`,e))(Tc||{}),Ec={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,35840:.5,35842:.5,35841:.25,35843:.25,36196:.5,35986:.5,35987:1,34798:1,37808:1,36492:1,36493:1,36494:1,36495:1},Dc,Oc;function kc(){Oc={bptc:Dc.getExtension(`EXT_texture_compression_bptc`),astc:Dc.getExtension(`WEBGL_compressed_texture_astc`),etc:Dc.getExtension(`WEBGL_compressed_texture_etc`),s3tc:Dc.getExtension(`WEBGL_compressed_texture_s3tc`),s3tc_sRGB:Dc.getExtension(`WEBGL_compressed_texture_s3tc_srgb`),pvrtc:Dc.getExtension(`WEBGL_compressed_texture_pvrtc`)||Dc.getExtension(`WEBKIT_WEBGL_compressed_texture_pvrtc`),etc1:Dc.getExtension(`WEBGL_compressed_texture_etc1`),atc:Dc.getExtension(`WEBGL_compressed_texture_atc`)}}var Ac={extension:{type:U.DetectionParser,priority:2},test:async()=>{let e=w.ADAPTER.createCanvas().getContext(`webgl`);return e?(Dc=e,!0):(console.warn(`WebGL not available for compressed textures.`),!1)},add:async e=>{Oc||kc();let t=[];for(let e in Oc)Oc[e]&&t.push(e);return[...t,...e]},remove:async e=>(Oc||kc(),e.filter(e=>!(e in Oc)))};W.add(Ac);var jc=class extends Un{constructor(e,t={width:1,height:1,autoLoad:!0}){let n,r;typeof e==`string`?(n=e,r=new Uint8Array):(n=null,r=e),super(r,t),this.origin=n,this.buffer=r?new Pn(r):null,this._load=null,this.loaded=!1,this.origin!==null&&t.autoLoad!==!1&&this.load(),this.origin===null&&this.buffer&&(this._load=Promise.resolve(this),this.loaded=!0,this.onBlobLoaded(this.buffer.rawBinaryData))}onBlobLoaded(e){}load(){return this._load||=fetch(this.origin).then(e=>e.blob()).then(e=>e.arrayBuffer()).then(e=>(this.data=new Uint32Array(e),this.buffer=new Pn(e),this.loaded=!0,this.onBlobLoaded(e),this.update(),this)),this._load}},Mc=class e extends jc{constructor(t,n){super(t,n),this.format=n.format,this.levels=n.levels||1,this._width=n.width,this._height=n.height,this._extension=e._formatToExtension(this.format),(n.levelBuffers||this.buffer)&&(this._levelBuffers=n.levelBuffers||e._createLevelBuffers(t instanceof Uint8Array?t:this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height))}upload(e,t,n){let r=e.gl;if(!e.context.extensions[this._extension])throw Error(`${this._extension} textures are not supported on the current machine`);if(!this._levelBuffers)return!1;r.pixelStorei(r.UNPACK_ALIGNMENT,4);for(let e=0,t=this.levels;e<t;e++){let{levelID:t,levelWidth:n,levelHeight:i,levelBuffer:a}=this._levelBuffers[e];r.compressedTexImage2D(r.TEXTURE_2D,t,this.format,n,i,0,a)}return!0}onBlobLoaded(){this._levelBuffers=e._createLevelBuffers(this.buffer.uint8View,this.format,this.levels,4,4,this.width,this.height)}static _formatToExtension(e){if(e>=33776&&e<=33779)return`s3tc`;if(e>=35916&&e<=35919)return`s3tc_sRGB`;if(e>=37488&&e<=37497)return`etc`;if(e>=35840&&e<=35843)return`pvrtc`;if(e===36196)return`etc1`;if(e===35986||e===35987||e===34798)return`atc`;if(e>=36492&&e<=36495)return`bptc`;if(e===37808)return`astc`;throw Error(`Invalid (compressed) texture format given: ${e}`)}static _createLevelBuffers(e,t,n,r,i,a,o){let s=Array(n),c=e.byteOffset,l=a,u=o,d=l+r-1&~(r-1),f=u+i-1&~(i-1),p=d*f*Ec[t];for(let a=0;a<n;a++)s[a]={levelID:a,levelWidth:n>1?l:d,levelHeight:n>1?u:f,levelBuffer:new Uint8Array(e.buffer,c,p)},c+=p,l=l>>1||1,u=u>>1||1,d=l+r-1&~(r-1),f=u+i-1&~(i-1),p=d*f*Ec[t];return s}},Nc=124,Pc=32,Fc=20,Ic=542327876,Lc={SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19},Rc={SIZE:0,FLAGS:1,FOURCC:2,RGB_BITCOUNT:3,R_BIT_MASK:4,G_BIT_MASK:5,B_BIT_MASK:6,A_BIT_MASK:7},zc={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4},Bc=1,Vc=2,Hc=4,Uc=64,Wc=512,Gc=131072,Kc=827611204,qc=861165636,Jc=894720068,Yc=808540228,Xc=4,Zc={[Kc]:Tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,[qc]:Tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,[Jc]:Tc.COMPRESSED_RGBA_S3TC_DXT5_EXT},Qc={70:Tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,71:Tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,73:Tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,74:Tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,76:Tc.COMPRESSED_RGBA_S3TC_DXT5_EXT,77:Tc.COMPRESSED_RGBA_S3TC_DXT5_EXT,72:Tc.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,75:Tc.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,78:Tc.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,96:Tc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,95:Tc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,98:Tc.COMPRESSED_RGBA_BPTC_UNORM_EXT,99:Tc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT};function $c(e){let t=new Uint32Array(e);if(t[0]!==Ic)throw Error(`Invalid DDS file magic word`);let n=new Uint32Array(e,0,Nc/Uint32Array.BYTES_PER_ELEMENT),r=n[Lc.HEIGHT],i=n[Lc.WIDTH],a=n[Lc.MIPMAP_COUNT],o=new Uint32Array(e,Lc.PIXEL_FORMAT*Uint32Array.BYTES_PER_ELEMENT,Pc/Uint32Array.BYTES_PER_ELEMENT),s=o[Bc];if(s&Hc){let n=o[Rc.FOURCC];if(n!==Yc){let t=Zc[n];return[new Mc(new Uint8Array(e,128),{format:t,width:i,height:r,levels:a})]}let s=new Uint32Array(t.buffer,128,Fc/Uint32Array.BYTES_PER_ELEMENT),c=s[zc.DXGI_FORMAT],l=s[zc.RESOURCE_DIMENSION],u=s[zc.MISC_FLAG],d=s[zc.ARRAY_SIZE],f=Qc[c];if(f===void 0)throw Error(`DDSParser cannot parse texture data with DXGI format ${c}`);if(u===Xc)throw Error(`DDSParser does not support cubemap textures`);if(l===6)throw Error(`DDSParser does not supported 3D texture data`);let p=[];if(d===1)p.push(new Uint8Array(e,148));else{let t=Ec[f],n=0,o=i,s=r;for(let e=0;e<a;e++){let e=Math.max(1,o+3&-4)*Math.max(1,s+3&-4)*t;n+=e,o>>>=1,s>>>=1}let c=148;for(let t=0;t<d;t++)p.push(new Uint8Array(e,c,n)),c+=n}return p.map(e=>new Mc(e,{format:f,width:i,height:r,levels:a}))}throw s&Uc?Error(`DDSParser does not support uncompressed texture data.`):s&Wc?Error(`DDSParser does not supported YUV uncompressed texture data.`):s&Gc?Error(`DDSParser does not support single-channel (lumninance) texture data!`):s&Vc?Error(`DDSParser does not support single-channel (alpha) texture data!`):Error(`DDSParser failed to load a texture file due to an unknown reason!`)}var el=[171,75,84,88,32,49,49,187,13,10,26,10],tl=67305985,nl={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},rl=64,il={[u.UNSIGNED_BYTE]:1,[u.UNSIGNED_SHORT]:2,[u.INT]:4,[u.UNSIGNED_INT]:4,[u.FLOAT]:4,[u.HALF_FLOAT]:8},al={[c.RGBA]:4,[c.RGB]:3,[c.RG]:2,[c.RED]:1,[c.LUMINANCE]:1,[c.LUMINANCE_ALPHA]:2,[c.ALPHA]:1},ol={[u.UNSIGNED_SHORT_4_4_4_4]:2,[u.UNSIGNED_SHORT_5_5_5_1]:2,[u.UNSIGNED_SHORT_5_6_5]:2};function sl(e,t,n=!1){let r=new DataView(t);if(!cl(e,r))return null;let i=r.getUint32(nl.ENDIANNESS,!0)===tl,a=r.getUint32(nl.GL_TYPE,i),o=r.getUint32(nl.GL_FORMAT,i),s=r.getUint32(nl.GL_INTERNAL_FORMAT,i),c=r.getUint32(nl.PIXEL_WIDTH,i),l=r.getUint32(nl.PIXEL_HEIGHT,i)||1,d=r.getUint32(nl.PIXEL_DEPTH,i)||1,f=r.getUint32(nl.NUMBER_OF_ARRAY_ELEMENTS,i)||1,p=r.getUint32(nl.NUMBER_OF_FACES,i),m=r.getUint32(nl.NUMBER_OF_MIPMAP_LEVELS,i),h=r.getUint32(nl.BYTES_OF_KEY_VALUE_DATA,i);if(l===0||d!==1)throw Error(`Only 2D textures are supported`);if(p!==1)throw Error(`CubeTextures are not supported by KTXLoader yet!`);if(f!==1)throw Error(`WebGL does not support array textures`);let g=c+3&-4,_=l+3&-4,v=Array(f),y=c*l;a===0&&(y=g*_);let b;if(b=a===0?Ec[s]:il[a]?il[a]*al[o]:ol[a],b===void 0)throw Error(`Unable to resolve the pixel format stored in the *.ktx file!`);let x=n?ul(r,h,i):null,S=y*b,C=c,w=l,T=g,E=_,D=rl+h;for(let e=0;e<m;e++){let n=r.getUint32(D,i),o=D+4;for(let n=0;n<f;n++){let r=v[n];r||=v[n]=Array(m),r[e]={levelID:e,levelWidth:m>1||a!==0?C:T,levelHeight:m>1||a!==0?w:E,levelBuffer:new Uint8Array(t,o,S)},o+=S}D+=n+4,D=D%4==0?D:D+4-D%4,C=C>>1||1,w=w>>1||1,T=C+4-1&-4,E=w+4-1&-4,S=T*E*b}return a===0?{compressed:v.map(e=>new Mc(null,{format:s,width:c,height:l,levels:m,levelBuffers:e})),kvData:x}:{uncompressed:v.map(e=>{let t=e[0].levelBuffer,n=!1;return a===u.FLOAT?t=new Float32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4):a===u.UNSIGNED_INT?(n=!0,t=new Uint32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)):a===u.INT&&(n=!0,t=new Int32Array(e[0].levelBuffer.buffer,e[0].levelBuffer.byteOffset,e[0].levelBuffer.byteLength/4)),{resource:new Un(t,{width:e[0].levelWidth,height:e[0].levelHeight}),type:a,format:n?ll(o):o}}),kvData:x}}function cl(e,t){for(let n=0;n<el.length;n++)if(t.getUint8(n)!==el[n])return console.error(`${e} is not a valid *.ktx file!`),!1;return!0}function ll(e){switch(e){case c.RGBA:return c.RGBA_INTEGER;case c.RGB:return c.RGB_INTEGER;case c.RG:return c.RG_INTEGER;case c.RED:return c.RED_INTEGER;default:return e}}function ul(e,t,n){let r=new Map,i=0;for(;i<t;){let a=e.getUint32(rl+i,n),o=rl+i+4,s=3-(a+3)%4;if(a===0||a>t-i){console.error(`KTXLoader: keyAndValueByteSize out of bounds`);break}let c=0;for(;c<a&&e.getUint8(o+c)!==0;c++);if(c===-1){console.error(`KTXLoader: Failed to find null byte terminating kvData key`);break}let l=new TextDecoder().decode(new Uint8Array(e.buffer,o,c)),u=new DataView(e.buffer,o+c+1,a-c-1);r.set(l,u),i+=4+a+s}return r}var dl={extension:{type:U.LoadParser,priority:ks.High},name:`loadDDS`,test(e){return xs(e,`.dds`)},async load(e,t,n){let r=$c(await(await w.ADAPTER.fetch(e)).arrayBuffer()).map(r=>$s(new G(r,{mipmap:m.OFF,alphaMode:h.NO_PREMULTIPLIED_ALPHA,resolution:An(e),...t.data}),n,e));return r.length===1?r[0]:r},unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}};W.add(dl);var fl={extension:{type:U.LoadParser,priority:ks.High},name:`loadKTX`,test(e){return xs(e,`.ktx`)},async load(e,t,n){let{compressed:r,uncompressed:i,kvData:a}=sl(e,await(await w.ADAPTER.fetch(e)).arrayBuffer()),o=r??i,s={mipmap:m.OFF,alphaMode:h.NO_PREMULTIPLIED_ALPHA,resolution:An(e),...t.data},c=o.map(t=>{o===i&&Object.assign(s,{type:t.type,format:t.format});let r=new G(t.resource??t,s);return r.ktxKeyValueData=a,$s(r,n,e)});return c.length===1?c[0]:c},unload(e){Array.isArray(e)?e.forEach(e=>e.destroy(!0)):e.destroy(!0)}};W.add(fl);var pl=[`s3tc`,`s3tc_sRGB`,`etc`,`etc1`,`pvrtc`,`atc`,`astc`,`bptc`],ml={extension:U.ResolveParser,test:e=>{let t=B.extname(e).slice(1);return[`basis`,`ktx`,`dds`].includes(t)},parse:e=>{let t=e.split(`.`),n=t.pop();if([`ktx`,`dds`].includes(n)){let n=t.pop();if(pl.includes(n))return{resolution:parseFloat(w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:n,src:e}}return{resolution:parseFloat(w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:n,src:e}}};W.add(ml);var hl=new Y,gl=4,_l=class e{constructor(e){this.renderer=e,this._rendererPremultipliedAlpha=!1}contextChange(){let e=this.renderer?.gl.getContextAttributes();this._rendererPremultipliedAlpha=!!(e&&e.alpha&&e.premultipliedAlpha)}async image(e,t,n,r){let i=new Image;return i.src=await this.base64(e,t,n,r),i}async base64(e,t,n,r){let i=this.canvas(e,r);if(i.toBlob!==void 0)return new Promise((e,r)=>{i.toBlob(t=>{if(!t){r(Error(`ICanvas.toBlob failed!`));return}let n=new FileReader;n.onload=()=>e(n.result),n.onerror=r,n.readAsDataURL(t)},t,n)});if(i.toDataURL!==void 0)return i.toDataURL(t,n);if(i.convertToBlob!==void 0){let e=await i.convertToBlob({type:t,quality:n});return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}throw Error(`Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented`)}canvas(t,n){let{pixels:r,width:i,height:a,flipY:o,premultipliedAlpha:s}=this._rawPixels(t,n);o&&e._flipY(r,i,a),s&&e._unpremultiplyAlpha(r);let c=new Cn(i,a,1),l=new ImageData(new Uint8ClampedArray(r.buffer),i,a);return c.context.putImageData(l,0,0),c.canvas}pixels(t,n){let{pixels:r,width:i,height:a,flipY:o,premultipliedAlpha:s}=this._rawPixels(t,n);return o&&e._flipY(r,i,a),s&&e._unpremultiplyAlpha(r),r}_rawPixels(e,t){let n=this.renderer;if(!n)throw Error(`The Extract has already been destroyed`);let r,i=!1,a=!1,o,s=!1;e&&(e instanceof Si?o=e:(o=n.generateTexture(e,{region:t,resolution:n.resolution,multisample:n.multisample}),s=!0,t&&=(hl.width=t.width,hl.height=t.height,hl)));let l=n.gl;if(o){if(r=o.baseTexture.resolution,t??=o.frame,i=!1,a=o.baseTexture.alphaMode>0&&o.baseTexture.format===c.RGBA,!s){n.renderTexture.bind(o);let e=o.framebuffer.glFramebuffers[n.CONTEXT_UID];e.blitFramebuffer&&n.framebuffer.bind(e.blitFramebuffer)}}else r=n.resolution,t||(t=hl,t.width=n.width/r,t.height=n.height/r),i=!0,a=this._rendererPremultipliedAlpha,n.renderTexture.bind();let u=Math.max(Math.round(t.width*r),1),d=Math.max(Math.round(t.height*r),1),f=new Uint8Array(gl*u*d);return l.readPixels(Math.round(t.x*r),Math.round(t.y*r),u,d,l.RGBA,l.UNSIGNED_BYTE,f),s&&o?.destroy(!0),{pixels:f,width:u,height:d,flipY:i,premultipliedAlpha:a}}destroy(){this.renderer=null}static _flipY(e,t,n){let r=t<<2,i=n>>1,a=new Uint8Array(r);for(let t=0;t<i;t++){let i=t*r,o=(n-t-1)*r;a.set(e.subarray(i,i+r)),e.copyWithin(i,o,o+r),e.set(a,o)}}static _unpremultiplyAlpha(e){e instanceof Uint8ClampedArray&&(e=new Uint8Array(e.buffer));let t=e.length;for(let n=0;n<t;n+=4){let t=e[n+3];if(t!==0){let r=255.001/t;e[n]=e[n]*r+.5,e[n+1]=e[n+1]*r+.5,e[n+2]=e[n+2]*r+.5}}}};_l.extension={name:`extract`,type:U.RendererSystem};var vl=_l;W.add(vl);var yl={build(e){let t=e.points,n,r,i,a,o,s;if(e.type===q.CIRC){let t=e.shape;n=t.x,r=t.y,o=s=t.radius,i=a=0}else if(e.type===q.ELIP){let t=e.shape;n=t.x,r=t.y,o=t.width,s=t.height,i=a=0}else{let t=e.shape,c=t.width/2,l=t.height/2;n=t.x+c,r=t.y+l,o=s=Math.max(0,Math.min(t.radius,Math.min(c,l))),i=c-o,a=l-s}if(!(o>=0&&s>=0&&i>=0&&a>=0)){t.length=0;return}let c=Math.ceil(2.3*Math.sqrt(o+s)),l=c*8+(i?4:0)+(a?4:0);if(t.length=l,l===0)return;if(c===0){t.length=8,t[0]=t[6]=n+i,t[1]=t[3]=r+a,t[2]=t[4]=n-i,t[5]=t[7]=r-a;return}let u=0,d=c*4+(i?2:0)+2,f=d,p=l;{let e=i+o,s=a,c=n+e,l=n-e,m=r+s;if(t[u++]=c,t[u++]=m,t[--d]=m,t[--d]=l,a){let e=r-s;t[f++]=l,t[f++]=e,t[--p]=e,t[--p]=c}}for(let e=1;e<c;e++){let l=Math.PI/2*(e/c),m=i+Math.cos(l)*o,h=a+Math.sin(l)*s,g=n+m,_=n-m,v=r+h,y=r-h;t[u++]=g,t[u++]=v,t[--d]=v,t[--d]=_,t[f++]=_,t[f++]=y,t[--p]=y,t[--p]=g}{let e=i,o=a+s,c=n+e,l=n-e,d=r+o,f=r-o;t[u++]=c,t[u++]=d,t[--p]=f,t[--p]=c,i&&(t[u++]=l,t[u++]=d,t[--p]=f,t[--p]=l)}},triangulate(e,t){let n=e.points,r=t.points,i=t.indices;if(n.length===0)return;let a=r.length/2,o=a,s,c;if(e.type!==q.RREC){let t=e.shape;s=t.x,c=t.y}else{let t=e.shape;s=t.x+t.width/2,c=t.y+t.height/2}let l=e.matrix;r.push(e.matrix?l.a*s+l.c*c+l.tx:s,e.matrix?l.b*s+l.d*c+l.ty:c),a++,r.push(n[0],n[1]);for(let e=2;e<n.length;e+=2)r.push(n[e],n[e+1]),i.push(a++,o,a);i.push(o+1,o,a)}};function bl(e,t=!1){let n=e.length;if(n<6)return;let r=0;for(let t=0,i=e[n-2],a=e[n-1];t<n;t+=2){let n=e[t],o=e[t+1];r+=(n-i)*(o+a),i=n,a=o}if(!t&&r>0||t&&r<=0){let t=n/2;for(let r=t+t%2;r<n;r+=2){let t=n-r-2,i=n-r-1,a=r,o=r+1;[e[t],e[a]]=[e[a],e[t]],[e[i],e[o]]=[e[o],e[i]]}}}var xl={build(e){e.points=e.shape.points.slice()},triangulate(e,t){let n=e.points,r=e.holes,i=t.points,a=t.indices;if(n.length>=6){bl(n,!1);let e=[];for(let t=0;t<r.length;t++){let i=r[t];bl(i.points,!0),e.push(n.length/2),n=n.concat(i.points)}let t=nt.default(n,e,2);if(!t)return;let o=i.length/2;for(let e=0;e<t.length;e+=3)a.push(t[e]+o),a.push(t[e+1]+o),a.push(t[e+2]+o);for(let e=0;e<n.length;e++)i.push(n[e])}}},Sl={build(e){let t=e.shape,n=t.x,r=t.y,i=t.width,a=t.height,o=e.points;o.length=0,i>=0&&a>=0&&o.push(n,r,n+i,r,n+i,r+a,n,r+a)},triangulate(e,t){let n=e.points,r=t.points;if(n.length===0)return;let i=r.length/2;r.push(n[0],n[1],n[2],n[3],n[6],n[7],n[4],n[5]),t.indices.push(i,i+1,i+2,i+1,i+2,i+3)}},Cl={build(e){yl.build(e)},triangulate(e,t){yl.triangulate(e,t)}},wl=(e=>(e.MITER=`miter`,e.BEVEL=`bevel`,e.ROUND=`round`,e))(wl||{}),Tl=(e=>(e.BUTT=`butt`,e.ROUND=`round`,e.SQUARE=`square`,e))(Tl||{}),El={adaptive:!0,maxLength:10,minSegments:8,maxSegments:2048,epsilon:1e-4,_segmentsCount(e,t=20){if(!this.adaptive||!e||isNaN(e))return t;let n=Math.ceil(e/this.maxLength);return n<this.minSegments?n=this.minSegments:n>this.maxSegments&&(n=this.maxSegments),n}},Dl=El,Ol=class{static curveTo(e,t,n,r,i,a){let o=a[a.length-2],s=a[a.length-1]-t,c=o-e,l=r-t,u=n-e,d=Math.abs(s*u-c*l);if(d<1e-8||i===0)return(a[a.length-2]!==e||a[a.length-1]!==t)&&a.push(e,t),null;let f=s*s+c*c,p=l*l+u*u,m=s*l+c*u,h=i*Math.sqrt(f)/d,g=i*Math.sqrt(p)/d,_=h*m/f,v=g*m/p,y=h*u+g*c,b=h*l+g*s,x=c*(g+_),S=s*(g+_),C=u*(h+v),w=l*(h+v),T=Math.atan2(S-b,x-y),E=Math.atan2(w-b,C-y);return{cx:y+e,cy:b+t,radius:i,startAngle:T,endAngle:E,anticlockwise:c*l>u*s}}static arc(e,t,n,r,i,a,o,s,c){let l=o-a,u=El._segmentsCount(Math.abs(l)*i,Math.ceil(Math.abs(l)/nr)*40),d=l/(u*2),f=d*2,p=Math.cos(d),m=Math.sin(d),h=u-1,g=h%1/h;for(let e=0;e<=h;++e){let t=e+g*e,o=d+a+f*t,s=Math.cos(o),l=-Math.sin(o);c.push((p*s+m*l)*i+n,(p*-l+m*s)*i+r)}}},kl=class{constructor(){this.reset()}begin(e,t,n){this.reset(),this.style=e,this.start=t,this.attribStart=n}end(e,t){this.attribSize=t-this.attribStart,this.size=e-this.start}reset(){this.style=null,this.size=0,this.start=0,this.attribStart=0,this.attribSize=0}},Al=class e{static curveLength(e,t,n,r,i,a,o,s){let c=0,l=0,u=0,d=0,f=0,p=0,m=0,h=0,g=0,_=0,v=0,y=e,b=t;for(let x=1;x<=10;++x)l=x/10,u=l*l,d=u*l,f=1-l,p=f*f,m=p*f,h=m*e+3*p*l*n+3*f*u*i+d*o,g=m*t+3*p*l*r+3*f*u*a+d*s,_=y-h,v=b-g,y=h,b=g,c+=Math.sqrt(_*_+v*v);return c}static curveTo(t,n,r,i,a,o,s){let c=s[s.length-2],l=s[s.length-1];s.length-=2;let u=El._segmentsCount(e.curveLength(c,l,t,n,r,i,a,o)),d=0,f=0,p=0,m=0,h=0;s.push(c,l);for(let e=1,g=0;e<=u;++e)g=e/u,d=1-g,f=d*d,p=f*d,m=g*g,h=m*g,s.push(p*c+3*f*g*t+3*d*m*r+h*a,p*l+3*f*g*n+3*d*m*i+h*o)}};function jl(e,t,n,r,i,a,o,s){let c=e-n*i,l=t-r*i,u=e+n*a,d=t+r*a,f,p;o?(f=r,p=-n):(f=-r,p=n);let m=c+f,h=l+p,g=u+f,_=d+p;return s.push(m,h,g,_),2}function Ml(e,t,n,r,i,a,o,s){let c=n-e,l=r-t,u=Math.atan2(c,l),d=Math.atan2(i-e,a-t);s&&u<d?u+=Math.PI*2:!s&&u>d&&(d+=Math.PI*2);let f=u,p=d-u,m=Math.abs(p),h=Math.sqrt(c*c+l*l),g=(15*m*Math.sqrt(h)/Math.PI>>0)+1,_=p/g;if(f+=_,s){o.push(e,t,n,r);for(let n=1,r=f;n<g;n++,r+=_)o.push(e,t,e+Math.sin(r)*h,t+Math.cos(r)*h);o.push(e,t,i,a)}else{o.push(n,r,e,t);for(let n=1,r=f;n<g;n++,r+=_)o.push(e+Math.sin(r)*h,t+Math.cos(r)*h,e,t);o.push(i,a,e,t)}return g*2}function Nl(e,t){let n=e.shape,r=e.points||n.points.slice(),i=t.closePointEps;if(r.length===0)return;let a=e.lineStyle,o=new J(r[0],r[1]),s=new J(r[r.length-2],r[r.length-1]),c=n.type!==q.POLY||n.closeStroke,l=Math.abs(o.x-s.x)<i&&Math.abs(o.y-s.y)<i;if(c){r=r.slice(),l&&(r.pop(),r.pop(),s.set(r[r.length-2],r[r.length-1]));let e=(o.x+s.x)*.5,t=(s.y+o.y)*.5;r.unshift(e,t),r.push(e,t)}let u=t.points,d=r.length/2,f=r.length,p=u.length/2,m=a.width/2,h=m*m,g=a.miterLimit*a.miterLimit,_=r[0],v=r[1],y=r[2],b=r[3],x=0,S=0,C=-(v-b),w=_-y,T=0,E=0,D=Math.sqrt(C*C+w*w);C/=D,w/=D,C*=m,w*=m;let O=a.alignment,k=(1-O)*2,A=O*2;c||(a.cap===Tl.ROUND?f+=Ml(_-C*(k-A)*.5,v-w*(k-A)*.5,_-C*k,v-w*k,_+C*A,v+w*A,u,!0)+2:a.cap===Tl.SQUARE&&(f+=jl(_,v,C,w,k,A,!0,u))),u.push(_-C*k,v-w*k,_+C*A,v+w*A);for(let e=1;e<d-1;++e){_=r[(e-1)*2],v=r[(e-1)*2+1],y=r[e*2],b=r[e*2+1],x=r[(e+1)*2],S=r[(e+1)*2+1],C=-(v-b),w=_-y,D=Math.sqrt(C*C+w*w),C/=D,w/=D,C*=m,w*=m,T=-(b-S),E=y-x,D=Math.sqrt(T*T+E*E),T/=D,E/=D,T*=m,E*=m;let t=y-_,n=v-b,i=y-x,o=S-b,s=t*i+n*o,c=n*i-o*t,l=c<0;if(Math.abs(c)<.001*Math.abs(s)){u.push(y-C*k,b-w*k,y+C*A,b+w*A),s>=0&&(a.join===wl.ROUND?f+=Ml(y,b,y-C*k,b-w*k,y-T*k,b-E*k,u,!1)+4:f+=2,u.push(y-T*A,b-E*A,y+T*k,b+E*k));continue}let d=(-C+_)*(-w+b)-(-C+y)*(-w+v),p=(-T+x)*(-E+b)-(-T+y)*(-E+S),O=(t*p-i*d)/c,j=(o*d-n*p)/c,M=(O-y)*(O-y)+(j-b)*(j-b),N=y+(O-y)*k,P=b+(j-b)*k,F=y-(O-y)*A,I=b-(j-b)*A,ee=Math.min(t*t+n*n,i*i+o*o),te=l?k:A,ne=M<=ee+te*te*h,re=a.join;if(re===wl.MITER&&M/h>g&&(re=wl.BEVEL),ne)switch(re){case wl.MITER:u.push(N,P,F,I);break;case wl.BEVEL:l?u.push(N,P,y+C*A,b+w*A,N,P,y+T*A,b+E*A):u.push(y-C*k,b-w*k,F,I,y-T*k,b-E*k,F,I),f+=2;break;case wl.ROUND:l?(u.push(N,P,y+C*A,b+w*A),f+=Ml(y,b,y+C*A,b+w*A,y+T*A,b+E*A,u,!0)+4,u.push(N,P,y+T*A,b+E*A)):(u.push(y-C*k,b-w*k,F,I),f+=Ml(y,b,y-C*k,b-w*k,y-T*k,b-E*k,u,!1)+4,u.push(y-T*k,b-E*k,F,I))}else{switch(u.push(y-C*k,b-w*k,y+C*A,b+w*A),re){case wl.MITER:l?u.push(F,I,F,I):u.push(N,P,N,P),f+=2;break;case wl.ROUND:f+=l?Ml(y,b,y+C*A,b+w*A,y+T*A,b+E*A,u,!0)+2:Ml(y,b,y-C*k,b-w*k,y-T*k,b-E*k,u,!1)+2}u.push(y-T*k,b-E*k,y+T*A,b+E*A),f+=2}}_=r[(d-2)*2],v=r[(d-2)*2+1],y=r[(d-1)*2],b=r[(d-1)*2+1],C=-(v-b),w=_-y,D=Math.sqrt(C*C+w*w),C/=D,w/=D,C*=m,w*=m,u.push(y-C*k,b-w*k,y+C*A,b+w*A),c||(a.cap===Tl.ROUND?f+=Ml(y-C*(k-A)*.5,b-w*(k-A)*.5,y-C*k,b-w*k,y+C*A,b+w*A,u,!1)+2:a.cap===Tl.SQUARE&&(f+=jl(y,b,C,w,k,A,!1,u)));let j=t.indices,M=El.epsilon*El.epsilon;for(let e=p;e<f+p-2;++e)_=u[e*2],v=u[e*2+1],y=u[(e+1)*2],b=u[(e+1)*2+1],x=u[(e+2)*2],S=u[(e+2)*2+1],!(Math.abs(_*(b-S)+y*(S-v)+x*(v-b))<M)&&j.push(e,e+1,e+2)}function Pl(e,t){let n=0,r=e.shape,i=e.points||r.points,a=r.type!==q.POLY||r.closeStroke;if(i.length===0)return;let o=t.points,s=t.indices,c=i.length/2,l=o.length/2,u=l;for(o.push(i[0],i[1]),n=1;n<c;n++)o.push(i[n*2],i[n*2+1]),s.push(u,u+1),u++;a&&s.push(u,l)}function Fl(e,t){e.lineStyle.native?Pl(e,t):Nl(e,t)}var Il=class e{static curveLength(e,t,n,r,i,a){let o=e-2*n+i,s=t-2*r+a,c=2*n-2*e,l=2*r-2*t,u=4*(o*o+s*s),d=4*(o*c+s*l),f=c*c+l*l,p=2*Math.sqrt(u+d+f),m=Math.sqrt(u),h=2*u*m,g=2*Math.sqrt(f),_=d/m;return(h*p+m*d*(p-g)+(4*f*u-d*d)*Math.log((2*m+_+p)/(_+g)))/(4*h)}static curveTo(t,n,r,i,a){let o=a[a.length-2],s=a[a.length-1],c=El._segmentsCount(e.curveLength(o,s,t,n,r,i)),l=0,u=0;for(let e=1;e<=c;++e){let d=e/c;l=o+(t-o)*d,u=s+(n-s)*d,a.push(l+(t+(r-t)*d-l)*d,u+(n+(i-n)*d-u)*d)}}},Ll={[q.POLY]:xl,[q.CIRC]:yl,[q.ELIP]:yl,[q.RECT]:Sl,[q.RREC]:Cl},Rl=[],zl=[],Bl=class e{constructor(e,t=null,n=null,r=null){this.points=[],this.holes=[],this.shape=e,this.lineStyle=n,this.fillStyle=t,this.matrix=r,this.type=e.type}clone(){return new e(this.shape,this.fillStyle,this.lineStyle,this.matrix)}destroy(){this.shape=null,this.holes.length=0,this.holes=null,this.points.length=0,this.points=null,this.lineStyle=null,this.fillStyle=null}},Vl=new J,Hl=class e extends tr{constructor(){super(),this.closePointEps=1e-4,this.boundsPadding=0,this.uvsFloat32=null,this.indicesUint16=null,this.batchable=!1,this.points=[],this.colors=[],this.uvs=[],this.indices=[],this.textureIds=[],this.graphicsData=[],this.drawCalls=[],this.batchDirty=-1,this.batches=[],this.dirty=0,this.cacheDirty=-1,this.clearDirty=0,this.shapeIndex=0,this._bounds=new fo,this.boundsDirty=-1}get bounds(){return this.updateBatches(),this.boundsDirty!==this.dirty&&(this.boundsDirty=this.dirty,this.calculateBounds()),this._bounds}invalidate(){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(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),zl.push(this.drawCalls[e]);this.drawCalls.length=0;for(let e=0;e<this.batches.length;e++){let t=this.batches[e];t.reset(),Rl.push(t)}this.batches.length=0}clear(){return this.graphicsData.length>0&&(this.invalidate(),this.clearDirty++,this.graphicsData.length=0),this}drawShape(e,t=null,n=null,r=null){let i=new Bl(e,t,n,r);return this.graphicsData.push(i),this.dirty++,this}drawHole(e,t=null){if(!this.graphicsData.length)return null;let n=new Bl(e,null,null,t),r=this.graphicsData[this.graphicsData.length-1];return n.lineStyle=r.lineStyle,r.holes.push(n),this.dirty++,this}destroy(){super.destroy();for(let e=0;e<this.graphicsData.length;++e)this.graphicsData[e].destroy();this.points.length=0,this.points=null,this.colors.length=0,this.colors=null,this.uvs.length=0,this.uvs=null,this.indices.length=0,this.indices=null,this.indexBuffer.destroy(),this.indexBuffer=null,this.graphicsData.length=0,this.graphicsData=null,this.drawCalls.length=0,this.drawCalls=null,this.batches.length=0,this.batches=null,this._bounds=null}containsPoint(e){let t=this.graphicsData;for(let n=0;n<t.length;++n){let r=t[n];if(r.fillStyle.visible&&r.shape&&(r.matrix?r.matrix.applyInverse(e,Vl):Vl.copyFrom(e),r.shape.contains(Vl.x,Vl.y))){let e=!1;if(r.holes){for(let t=0;t<r.holes.length;t++)if(r.holes[t].shape.contains(Vl.x,Vl.y)){e=!0;break}}if(!e)return!0}}return!1}updateBatches(){if(!this.graphicsData.length){this.batchable=!0;return}if(!this.validateBatching())return;this.cacheDirty=this.dirty;let e=this.uvs,t=this.graphicsData,n=null,r=null;this.batches.length>0&&(n=this.batches[this.batches.length-1],r=n.style);for(let i=this.shapeIndex;i<t.length;i++){this.shapeIndex++;let a=t[i],o=a.fillStyle,s=a.lineStyle;Ll[a.type].build(a),a.matrix&&this.transformPoints(a.points,a.matrix),(o.visible||s.visible)&&this.processHoles(a.holes);for(let t=0;t<2;t++){let i=t===0?o:s;if(!i.visible)continue;let c=i.texture.baseTexture,l=this.indices.length,u=this.points.length/2;c.wrapMode=p.REPEAT,t===0?this.processFill(a):this.processLine(a);let d=this.points.length/2-u;d!==0&&(n&&!this._compareStyles(r,i)&&(n.end(l,u),n=null),n||(n=Rl.pop()||new kl,n.begin(i,l,u),this.batches.push(n),r=i),this.addUvs(this.points,e,i.texture,u,d,i.matrix))}}let i=this.indices.length,a=this.points.length/2;if(n&&n.end(i,a),this.batches.length===0){this.batchable=!0;return}let o=a>65535;this.indicesUint16&&this.indices.length===this.indicesUint16.length&&o===this.indicesUint16.BYTES_PER_ELEMENT>2?this.indicesUint16.set(this.indices):this.indicesUint16=o?new Uint32Array(this.indices):new Uint16Array(this.indices),this.batchable=this.isBatchable(),this.batchable?this.packBatches():this.buildDrawCalls()}_compareStyles(e,t){return!(!e||!t||e.texture.baseTexture!==t.texture.baseTexture||e.color+e.alpha!==t.color+t.alpha||!!e.native!=!!t.native)}validateBatching(){if(this.dirty===this.cacheDirty||!this.graphicsData.length)return!1;for(let e=0,t=this.graphicsData.length;e<t;e++){let t=this.graphicsData[e],n=t.fillStyle,r=t.lineStyle;if(n&&!n.texture.baseTexture.valid||r&&!r.texture.baseTexture.valid)return!1}return!0}packBatches(){this.batchDirty++,this.uvsFloat32=new Float32Array(this.uvs);let e=this.batches;for(let t=0,n=e.length;t<n;t++){let n=e[t];for(let e=0;e<n.size;e++){let t=n.start+e;this.indicesUint16[t]=this.indicesUint16[t]-n.attribStart}}}isBatchable(){if(this.points.length>131070)return!1;let t=this.batches;for(let e=0;e<t.length;e++)if(t[e].style.native)return!1;return this.points.length<e.BATCHABLE_SIZE*2}buildDrawCalls(){let e=++G._globalBatch;for(let e=0;e<this.drawCalls.length;e++)this.drawCalls[e].texArray.clear(),zl.push(this.drawCalls[e]);this.drawCalls.length=0;let t=this.colors,n=this.textureIds,r=zl.pop();r||(r=new Kn,r.texArray=new $r),r.texArray.count=0,r.start=0,r.size=0,r.type=s.TRIANGLES;let i=0,a=null,o=0,c=!1,l=s.TRIANGLES,u=0;this.drawCalls.push(r);for(let d=0;d<this.batches.length;d++){let f=this.batches[d],m=f.style,h=m.texture.baseTexture;c!==!!m.native&&(c=!!m.native,l=c?s.LINES:s.TRIANGLES,a=null,i=8,e++),a!==h&&(a=h,h._batchEnabled!==e&&(i===8&&(e++,i=0,r.size>0&&(r=zl.pop(),r||(r=new Kn,r.texArray=new $r),this.drawCalls.push(r)),r.start=u,r.size=0,r.texArray.count=0,r.type=l),h.touched=1,h._batchEnabled=e,h._batchLocation=i,h.wrapMode=p.REPEAT,r.texArray.elements[r.texArray.count++]=h,i++)),r.size+=f.size,u+=f.size,o=h._batchLocation,this.addColors(t,m.color,m.alpha,f.attribSize,f.attribStart),this.addTextureIds(n,o,f.attribSize,f.attribStart)}G._globalBatch=e,this.packAttributes()}packAttributes(){let e=this.points,t=this.uvs,n=this.colors,r=this.textureIds,i=new ArrayBuffer(e.length*3*4),a=new Float32Array(i),o=new Uint32Array(i),s=0;for(let i=0;i<e.length/2;i++)a[s++]=e[i*2],a[s++]=e[i*2+1],a[s++]=t[i*2],a[s++]=t[i*2+1],o[s++]=n[i],a[s++]=r[i];this._buffer.update(i),this._indexBuffer.update(this.indicesUint16)}processFill(e){e.holes.length?xl.triangulate(e,this):Ll[e.type].triangulate(e,this)}processLine(e){Fl(e,this);for(let t=0;t<e.holes.length;t++)Fl(e.holes[t],this)}processHoles(e){for(let t=0;t<e.length;t++){let n=e[t];Ll[n.type].build(n),n.matrix&&this.transformPoints(n.points,n.matrix)}}calculateBounds(){let e=this._bounds;e.clear(),e.addVertexData(this.points,0,this.points.length),e.pad(this.boundsPadding,this.boundsPadding)}transformPoints(e,t){for(let n=0;n<e.length/2;n++){let r=e[n*2],i=e[n*2+1];e[n*2]=t.a*r+t.c*i+t.tx,e[n*2+1]=t.b*r+t.d*i+t.ty}}addColors(e,t,n,r,i=0){let a=H.shared.setValue(t).toLittleEndianNumber(),o=H.shared.setValue(a).toPremultiplied(n);e.length=Math.max(e.length,i+r);for(let t=0;t<r;t++)e[i+t]=o}addTextureIds(e,t,n,r=0){e.length=Math.max(e.length,r+n);for(let i=0;i<n;i++)e[r+i]=t}addUvs(e,t,n,r,i,a=null){let o=0,s=t.length,c=n.frame;for(;o<i;){let n=e[(r+o)*2],i=e[(r+o)*2+1];if(a){let e=a.a*n+a.c*i+a.tx;i=a.b*n+a.d*i+a.ty,n=e}o++,t.push(n/c.width,i/c.height)}let l=n.baseTexture;(c.width<l.width||c.height<l.height)&&this.adjustUvs(t,n,s,i)}adjustUvs(e,t,n,r){let i=t.baseTexture,a=1e-6,o=n+r*2,s=t.frame,c=s.width/i.width,l=s.height/i.height,u=s.x/s.width,d=s.y/s.height,f=Math.floor(e[n]+a),p=Math.floor(e[n+1]+a);for(let t=n+2;t<o;t+=2)f=Math.min(f,Math.floor(e[t]+a)),p=Math.min(p,Math.floor(e[t+1]+a));u-=f,d-=p;for(let t=n;t<o;t+=2)e[t]=(e[t]+u)*c,e[t+1]=(e[t+1]+d)*l}};Hl.BATCHABLE_SIZE=100;var Ul=Hl,Wl=class e{constructor(){this.color=16777215,this.alpha=1,this.texture=Q.WHITE,this.matrix=null,this.visible=!1,this.reset()}clone(){let t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t}reset(){this.color=16777215,this.alpha=1,this.texture=Q.WHITE,this.matrix=null,this.visible=!1}destroy(){this.texture=null,this.matrix=null}},Gl=class e extends Wl{constructor(){super(...arguments),this.width=0,this.alignment=.5,this.native=!1,this.cap=Tl.BUTT,this.join=wl.MITER,this.miterLimit=10}clone(){let t=new e;return t.color=this.color,t.alpha=this.alpha,t.texture=this.texture,t.matrix=this.matrix,t.visible=this.visible,t.width=this.width,t.alignment=this.alignment,t.native=this.native,t.cap=this.cap,t.join=this.join,t.miterLimit=this.miterLimit,t}reset(){super.reset(),this.color=0,this.alignment=.5,this.width=0,this.native=!1,this.cap=Tl.BUTT,this.join=wl.MITER,this.miterLimit=10}},Kl={},ql=class e extends _o{constructor(e=null){super(),this.shader=null,this.pluginName=`batch`,this.currentPath=null,this.batches=[],this.batchTint=-1,this.batchDirty=-1,this.vertexData=null,this._fillStyle=new Wl,this._lineStyle=new Gl,this._matrix=null,this._holeMode=!1,this.state=Rn.for2d(),this._geometry=e||new Ul,this._geometry.refCount++,this._transformID=-1,this._tintColor=new H(16777215),this.blendMode=o.NORMAL}get geometry(){return this._geometry}clone(){return this.finishPoly(),new e(this._geometry)}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e)}get fill(){return this._fillStyle}get line(){return this._lineStyle}lineStyle(e=null,t=0,n,r=.5,i=!1){return typeof e==`number`&&(e={width:e,color:t,alpha:n,alignment:r,native:i}),this.lineTextureStyle(e)}lineTextureStyle(e){let t={width:0,texture:Q.WHITE,color:e?.texture?16777215:0,matrix:null,alignment:.5,native:!1,cap:Tl.BUTT,join:wl.MITER,miterLimit:10};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();let n=e.width>0&&e.alpha>0;return n?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._lineStyle,{visible:n},e)):this._lineStyle.reset(),this}startPoly(){if(this.currentPath){let e=this.currentPath.points,t=this.currentPath.points.length;t>2&&(this.drawShape(this.currentPath),this.currentPath=new cr,this.currentPath.closeStroke=!1,this.currentPath.points.push(e[t-2],e[t-1]))}else this.currentPath=new cr,this.currentPath.closeStroke=!1}finishPoly(){this.currentPath&&(this.currentPath.points.length>2?(this.drawShape(this.currentPath),this.currentPath=null):this.currentPath.points.length=0)}moveTo(e,t){return this.startPoly(),this.currentPath.points[0]=e,this.currentPath.points[1]=t,this}lineTo(e,t){this.currentPath||this.moveTo(0,0);let n=this.currentPath.points,r=n[n.length-2],i=n[n.length-1];return(r!==e||i!==t)&&n.push(e,t),this}_initCurve(e=0,t=0){this.currentPath?this.currentPath.points.length===0&&(this.currentPath.points=[e,t]):this.moveTo(e,t)}quadraticCurveTo(e,t,n,r){this._initCurve();let i=this.currentPath.points;return i.length===0&&this.moveTo(0,0),Il.curveTo(e,t,n,r,i),this}bezierCurveTo(e,t,n,r,i,a){return this._initCurve(),Al.curveTo(e,t,n,r,i,a,this.currentPath.points),this}arcTo(e,t,n,r,i){this._initCurve(e,t);let a=this.currentPath.points,o=Ol.curveTo(e,t,n,r,i,a);if(o){let{cx:e,cy:t,radius:n,startAngle:r,endAngle:i,anticlockwise:a}=o;this.arc(e,t,n,r,i,a)}return this}arc(e,t,n,r,i,a=!1){if(r===i||(!a&&i<=r?i+=nr:a&&r<=i&&(r+=nr),i-r===0))return this;let o=e+Math.cos(r)*n,s=t+Math.sin(r)*n,c=this._geometry.closePointEps,l=this.currentPath?this.currentPath.points:null;if(l){let e=Math.abs(l[l.length-2]-o),t=Math.abs(l[l.length-1]-s);e<c&&t<c||l.push(o,s)}else this.moveTo(o,s),l=this.currentPath.points;return Ol.arc(o,s,e,t,n,r,i,a,l),this}beginFill(e=0,t){return this.beginTextureFill({texture:Q.WHITE,color:e,alpha:t})}normalizeColor(e){let t=H.shared.setValue(e.color??0);e.color=t.toNumber(),e.alpha??=t.alpha}beginTextureFill(e){let t={texture:Q.WHITE,color:16777215,matrix:null};e=Object.assign(t,e),this.normalizeColor(e),this.currentPath&&this.startPoly();let n=e.alpha>0;return n?(e.matrix&&(e.matrix=e.matrix.clone(),e.matrix.invert()),Object.assign(this._fillStyle,{visible:n},e)):this._fillStyle.reset(),this}endFill(){return this.finishPoly(),this._fillStyle.reset(),this}drawRect(e,t,n,r){return this.drawShape(new Y(e,t,n,r))}drawRoundedRect(e,t,n,r,i){return this.drawShape(new lr(e,t,n,r,i))}drawCircle(e,t,n){return this.drawShape(new or(e,t,n))}drawEllipse(e,t,n,r){return this.drawShape(new sr(e,t,n,r))}drawPolygon(...e){let t,n=!0,r=e[0];r.points?(n=r.closeStroke,t=r.points):t=Array.isArray(e[0])?e[0]:e;let i=new cr(t);return i.closeStroke=n,this.drawShape(i),this}drawShape(e){return this._holeMode?this._geometry.drawHole(e,this._matrix):this._geometry.drawShape(e,this._fillStyle.clone(),this._lineStyle.clone(),this._matrix),this}clear(){return this._geometry.clear(),this._lineStyle.reset(),this._fillStyle.reset(),this._boundsID++,this._matrix=null,this._holeMode=!1,this.currentPath=null,this}isFastRect(){let e=this._geometry.graphicsData;return e.length===1&&e[0].shape.type===q.RECT&&!e[0].matrix&&!e[0].holes.length&&!(e[0].lineStyle.visible&&e[0].lineStyle.width)}_render(e){this.finishPoly();let t=this._geometry;t.updateBatches(),t.batchable?(this.batchDirty!==t.batchDirty&&this._populateBatches(),this._renderBatched(e)):(e.batch.flush(),this._renderDirect(e))}_populateBatches(){let e=this._geometry,t=this.blendMode,n=e.batches.length;this.batchTint=-1,this._transformID=-1,this.batchDirty=e.batchDirty,this.batches.length=n,this.vertexData=new Float32Array(e.points);for(let r=0;r<n;r++){let n=e.batches[r],i=n.style.color,a=new Float32Array(this.vertexData.buffer,n.attribStart*4*2,n.attribSize*2),o=new Float32Array(e.uvsFloat32.buffer,n.attribStart*4*2,n.attribSize*2),s={vertexData:a,blendMode:t,indices:new Uint16Array(e.indicesUint16.buffer,n.start*2,n.size),uvs:o,_batchRGB:H.shared.setValue(i).toRgbArray(),_tintRGB:i,_texture:n.style.texture,alpha:n.style.alpha,worldAlpha:1};this.batches[r]=s}}_renderBatched(e){if(this.batches.length){e.batch.setObjectRenderer(e.plugins[this.pluginName]),this.calculateVertices(),this.calculateTints();for(let t=0,n=this.batches.length;t<n;t++){let n=this.batches[t];n.worldAlpha=this.worldAlpha*n.alpha,e.plugins[this.pluginName].render(n)}}}_renderDirect(e){let t=this._resolveDirectShader(e),n=this._geometry,r=this.worldAlpha,i=t.uniforms,a=n.drawCalls;i.translationMatrix=this.transform.worldTransform,H.shared.setValue(this._tintColor).premultiply(r).toArray(i.tint),e.shader.bind(t),e.geometry.bind(n,t),e.state.set(this.state);for(let t=0,r=a.length;t<r;t++)this._renderDrawCallDirect(e,n.drawCalls[t])}_renderDrawCallDirect(e,t){let{texArray:n,type:r,size:i,start:a}=t,o=n.count;for(let t=0;t<o;t++)e.texture.bind(n.elements[t],t);e.geometry.draw(r,i,a)}_resolveDirectShader(e){let t=this.shader,n=this.pluginName;if(!t){if(!Kl[n]){let{maxTextures:t}=e.plugins[n],r=new Int32Array(t);for(let e=0;e<t;e++)r[e]=e;let i={tint:new Float32Array([1,1,1,1]),translationMatrix:new X,default:Xr.from({uSamplers:r},!0)},a=e.plugins[n]._shader.program;Kl[n]=new Zr(a,i)}t=Kl[n]}return t}_calculateBounds(){this.finishPoly();let e=this._geometry;if(!e.graphicsData.length)return;let{minX:t,minY:n,maxX:r,maxY:i}=e.bounds;this._bounds.addFrame(this.transform,t,n,r,i)}containsPoint(t){return this.worldTransform.applyInverse(t,e._TEMP_POINT),this._geometry.containsPoint(e._TEMP_POINT)}calculateTints(){if(this.batchTint!==this.tint){this.batchTint=this._tintColor.toNumber();for(let e=0;e<this.batches.length;e++){let t=this.batches[e];t._tintRGB=H.shared.setValue(this._tintColor).multiply(t._batchRGB).toLittleEndianNumber()}}}calculateVertices(){let e=this.transform._worldID;if(this._transformID===e)return;this._transformID=e;let t=this.transform.worldTransform,n=t.a,r=t.b,i=t.c,a=t.d,o=t.tx,s=t.ty,c=this._geometry.points,l=this.vertexData,u=0;for(let e=0;e<c.length;e+=2){let t=c[e],d=c[e+1];l[u++]=n*t+i*d+o,l[u++]=a*d+r*t+s}}closePath(){let e=this.currentPath;return e&&(e.closeStroke=!0,this.finishPoly()),this}setMatrix(e){return this._matrix=e,this}beginHole(){return this.finishPoly(),this._holeMode=!0,this}endHole(){return this.finishPoly(),this._holeMode=!1,this}destroy(e){this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose(),this._matrix=null,this.currentPath=null,this._lineStyle.destroy(),this._lineStyle=null,this._fillStyle.destroy(),this._fillStyle=null,this._geometry=null,this.shader=null,this.vertexData=null,this.batches.length=0,this.batches=null,super.destroy(e)}};ql.curves=El,ql._TEMP_POINT=new J;var Jl=ql,Yl={buildPoly:xl,buildCircle:yl,buildRectangle:Sl,buildRoundedRectangle:Cl,buildLine:Fl,ArcUtils:Ol,BezierUtils:Al,QuadraticUtils:Il,BatchPart:kl,FILL_COMMANDS:Ll,BATCH_POOL:Rl,DRAW_CALL_POOL:zl},Xl=class{constructor(e,t){this.uvBuffer=e,this.uvMatrix=t,this.data=null,this._bufferUpdateId=-1,this._textureUpdateId=-1,this._updateID=0}update(e){if(!e&&this._bufferUpdateId===this.uvBuffer._updateID&&this._textureUpdateId===this.uvMatrix._updateID)return;this._bufferUpdateId=this.uvBuffer._updateID,this._textureUpdateId=this.uvMatrix._updateID;let t=this.uvBuffer.data;(!this.data||this.data.length!==t.length)&&(this.data=new Float32Array(t.length)),this.uvMatrix.multiplyUvs(t,this.data),this._updateID++}},Zl=new J,Ql=new cr,$l=class e extends _o{constructor(e,t,n,r=s.TRIANGLES){super(),this.geometry=e,this.shader=t,this.state=n||Rn.for2d(),this.drawMode=r,this.start=0,this.size=0,this.uvs=null,this.indices=null,this.vertexData=new Float32Array(1),this.vertexDirty=-1,this._transformID=-1,this._roundPixels=w.ROUND_PIXELS,this.batchUvs=null}get geometry(){return this._geometry}set geometry(e){this._geometry!==e&&(this._geometry&&(this._geometry.refCount--,this._geometry.refCount===0&&this._geometry.dispose()),this._geometry=e,this._geometry&&this._geometry.refCount++,this.vertexDirty=-1)}get uvBuffer(){return this.geometry.buffers[1]}get verticesBuffer(){return this.geometry.buffers[0]}set material(e){this.shader=e}get material(){return this.shader}set blendMode(e){this.state.blendMode=e}get blendMode(){return this.state.blendMode}set roundPixels(e){this._roundPixels!==e&&(this._transformID=-1),this._roundPixels=e}get roundPixels(){return this._roundPixels}get tint(){return`tint`in this.shader?this.shader.tint:null}set tint(e){this.shader.tint=e}get tintValue(){return this.shader.tintValue}get texture(){return`texture`in this.shader?this.shader.texture:null}set texture(e){this.shader.texture=e}_render(t){let n=this.geometry.buffers[0].data;this.shader.batchable&&this.drawMode===s.TRIANGLES&&n.length<e.BATCHABLE_SIZE*2?this._renderToBatch(t):this._renderDefault(t)}_renderDefault(e){let t=this.shader;t.alpha=this.worldAlpha,t.update&&t.update(),e.batch.flush(),t.uniforms.translationMatrix=this.transform.worldTransform.toArray(!0),e.shader.bind(t),e.state.set(this.state),e.geometry.bind(this.geometry,t),e.geometry.draw(this.drawMode,this.size,this.start,this.geometry.instanceCount)}_renderToBatch(e){let t=this.geometry,n=this.shader;n.uvMatrix&&(n.uvMatrix.update(),this.calculateUvs()),this.calculateVertices(),this.indices=t.indexBuffer.data,this._tintRGB=n._tintRGB,this._texture=n.texture;let r=this.material.pluginName;e.batch.setObjectRenderer(e.plugins[r]),e.plugins[r].render(this)}calculateVertices(){let e=this.geometry.buffers[0],t=e.data,n=e._updateID;if(n===this.vertexDirty&&this._transformID===this.transform._worldID)return;this._transformID=this.transform._worldID,this.vertexData.length!==t.length&&(this.vertexData=new Float32Array(t.length));let r=this.transform.worldTransform,i=r.a,a=r.b,o=r.c,s=r.d,c=r.tx,l=r.ty,u=this.vertexData;for(let e=0;e<u.length/2;e++){let n=t[e*2],r=t[e*2+1];u[e*2]=i*n+o*r+c,u[e*2+1]=a*n+s*r+l}if(this._roundPixels){let e=w.RESOLUTION;for(let t=0;t<u.length;++t)u[t]=Math.round(u[t]*e)/e}this.vertexDirty=n}calculateUvs(){let e=this.geometry.buffers[1],t=this.shader;t.uvMatrix.isSimple?this.uvs=e.data:(this.batchUvs||=new Xl(e,t.uvMatrix),this.batchUvs.update(),this.uvs=this.batchUvs.data)}_calculateBounds(){this.calculateVertices(),this._bounds.addVertexData(this.vertexData,0,this.vertexData.length)}containsPoint(e){if(!this.getBounds().contains(e.x,e.y))return!1;this.worldTransform.applyInverse(e,Zl);let t=this.geometry.getBuffer(`aVertexPosition`).data,n=Ql.points,r=this.geometry.getIndex().data,i=r.length,a=this.drawMode===4?3:1;for(let e=0;e+2<i;e+=a){let i=r[e]*2,a=r[e+1]*2,o=r[e+2]*2;if(n[0]=t[i],n[1]=t[i+1],n[2]=t[a],n[3]=t[a+1],n[4]=t[o],n[5]=t[o+1],Ql.contains(Zl.x,Zl.y))return!0}return!1}destroy(e){super.destroy(e),this._cachedTexture&&=(this._cachedTexture.destroy(),null),this.geometry=null,this.shader=null,this.state=null,this.uvs=null,this.indices=null,this.vertexData=null}};$l.BATCHABLE_SIZE=100;var eu=$l,tu=class extends er{constructor(e,t,n){super();let r=new K(e),i=new K(t,!0),a=new K(n,!0,!0);this.addAttribute(`aVertexPosition`,r,2,!1,u.FLOAT).addAttribute(`aTextureCoord`,i,2,!1,u.FLOAT).addIndex(a),this._updateId=-1}get vertexDirtyId(){return this.buffers[0]._updateID}},nu=`varying vec2 vTextureCoord;
|
|
912
|
+
uniform vec4 uColor;
|
|
913
|
+
|
|
914
|
+
uniform sampler2D uSampler;
|
|
915
|
+
|
|
916
|
+
void main(void)
|
|
917
|
+
{
|
|
918
|
+
gl_FragColor = texture2D(uSampler, vTextureCoord) * uColor;
|
|
919
|
+
}
|
|
920
|
+
`,ru=`attribute vec2 aVertexPosition;
|
|
921
|
+
attribute vec2 aTextureCoord;
|
|
922
|
+
|
|
923
|
+
uniform mat3 projectionMatrix;
|
|
924
|
+
uniform mat3 translationMatrix;
|
|
925
|
+
uniform mat3 uTextureMatrix;
|
|
926
|
+
|
|
927
|
+
varying vec2 vTextureCoord;
|
|
928
|
+
|
|
929
|
+
void main(void)
|
|
930
|
+
{
|
|
931
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
932
|
+
|
|
933
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;
|
|
934
|
+
}
|
|
935
|
+
`,iu=class extends Zr{constructor(e,t){let n={uSampler:e,alpha:1,uTextureMatrix:X.IDENTITY,uColor:new Float32Array([1,1,1,1])};t=Object.assign({tint:16777215,alpha:1,pluginName:`batch`},t),t.uniforms&&Object.assign(n,t.uniforms),super(t.program||Jr.from(ru,nu),n),this._colorDirty=!1,this.uvMatrix=new Ii(e),this.batchable=t.program===void 0,this.pluginName=t.pluginName,this._tintColor=new H(t.tint),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0,this.alpha=t.alpha}get texture(){return this.uniforms.uSampler}set texture(e){this.uniforms.uSampler!==e&&(!this.uniforms.uSampler.baseTexture.alphaMode!=!e.baseTexture.alphaMode&&(this._colorDirty=!0),this.uniforms.uSampler=e,this.uvMatrix.texture=e)}set alpha(e){e!==this._alpha&&(this._alpha=e,this._colorDirty=!0)}get alpha(){return this._alpha}set tint(e){e!==this.tint&&(this._tintColor.setValue(e),this._tintRGB=this._tintColor.toLittleEndianNumber(),this._colorDirty=!0)}get tint(){return this._tintColor.value}get tintValue(){return this._tintColor.toNumber()}update(){if(this._colorDirty){this._colorDirty=!1;let e=this.texture.baseTexture.alphaMode;H.shared.setValue(this._tintColor).premultiply(this._alpha,e).toArray(this.uniforms.uColor)}this.uvMatrix.update()&&(this.uniforms.uTextureMatrix=this.uvMatrix.mapCoord)}},au=class extends tu{constructor(e=100,t=100,n=10,r=10){super(),this.segWidth=n,this.segHeight=r,this.width=e,this.height=t,this.build()}build(){let e=this.segWidth*this.segHeight,t=[],n=[],r=[],i=this.segWidth-1,a=this.segHeight-1,o=this.width/i,s=this.height/a;for(let r=0;r<e;r++){let e=r%this.segWidth,c=r/this.segWidth|0;t.push(e*o,c*s),n.push(e/i,c/a)}let c=i*a;for(let e=0;e<c;e++){let t=e%i,n=e/i|0,a=n*this.segWidth+t,o=n*this.segWidth+t+1,s=(n+1)*this.segWidth+t,c=(n+1)*this.segWidth+t+1;r.push(a,o,s,o,c,s)}this.buffers[0].data=new Float32Array(t),this.buffers[1].data=new Float32Array(n),this.indexBuffer.data=new Uint16Array(r),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}},ou=class extends tu{constructor(e=200,t,n=0){super(new Float32Array(t.length*4),new Float32Array(t.length*4),new Uint16Array((t.length-1)*6)),this.points=t,this._width=e,this.textureScale=n,this.build()}get width(){return this._width}build(){let e=this.points;if(!e)return;let t=this.getBuffer(`aVertexPosition`),n=this.getBuffer(`aTextureCoord`),r=this.getIndex();if(e.length<1)return;t.data.length/4!==e.length&&(t.data=new Float32Array(e.length*4),n.data=new Float32Array(e.length*4),r.data=new Uint16Array((e.length-1)*6));let i=n.data,a=r.data;i[0]=0,i[1]=0,i[2]=0,i[3]=1;let o=0,s=e[0],c=this._width*this.textureScale,l=e.length;for(let t=0;t<l;t++){let n=t*4;if(this.textureScale>0){let n=s.x-e[t].x,r=s.y-e[t].y,i=Math.sqrt(n*n+r*r);s=e[t],o+=i/c}else o=t/(l-1);i[n]=o,i[n+1]=0,i[n+2]=o,i[n+3]=1}let u=0;for(let e=0;e<l-1;e++){let t=e*2;a[u++]=t,a[u++]=t+1,a[u++]=t+2,a[u++]=t+2,a[u++]=t+1,a[u++]=t+3}n.update(),r.update(),this.updateVertices()}updateVertices(){let e=this.points;if(e.length<1)return;let t=e[0],n,r=0,i=0,a=this.buffers[0].data,o=e.length,s=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let c=0;c<o;c++){let l=e[c],u=c*4;n=c<e.length-1?e[c+1]:l,i=-(n.x-t.x),r=n.y-t.y;let d=(1-c/(o-1))*10;d>1&&(d=1);let f=Math.sqrt(r*r+i*i);f<1e-6?(r=0,i=0):(r/=f,i/=f,r*=s,i*=s),a[u]=l.x+r,a[u+1]=l.y+i,a[u+2]=l.x-r,a[u+3]=l.y-i,t=l}this.buffers[0].update()}update(){this.textureScale>0?this.build():this.updateVertices()}},su=class extends eu{constructor(e,t,n){let r=new au(e.width,e.height,t,n),i=new iu(Q.WHITE);super(r,i),this.texture=e,this.autoResize=!0}textureUpdated(){this._textureID=this.shader.texture._updateID;let e=this.geometry,{width:t,height:n}=this.shader.texture;this.autoResize&&(e.width!==t||e.height!==n)&&(e.width=this.shader.texture.width,e.height=this.shader.texture.height,e.build())}set texture(e){this.shader.texture!==e&&(this.shader.texture=e,this._textureID=-1,e.baseTexture.valid?this.textureUpdated():e.once(`update`,this.textureUpdated,this))}get texture(){return this.shader.texture}_render(e){this._textureID!==this.shader.texture._updateID&&this.textureUpdated(),super._render(e)}destroy(e){this.shader.texture.off(`update`,this.textureUpdated,this),super.destroy(e)}},cu=10,lu=class extends su{constructor(e,t,n,r,i){super(Q.WHITE,4,4),this._origWidth=e.orig.width,this._origHeight=e.orig.height,this._width=this._origWidth,this._height=this._origHeight,this._leftWidth=t??e.defaultBorders?.left??cu,this._rightWidth=r??e.defaultBorders?.right??cu,this._topHeight=n??e.defaultBorders?.top??cu,this._bottomHeight=i??e.defaultBorders?.bottom??cu,this.texture=e}textureUpdated(){this._textureID=this.shader.texture._updateID,this._refresh()}get vertices(){return this.geometry.getBuffer(`aVertexPosition`).data}set vertices(e){this.geometry.getBuffer(`aVertexPosition`).data=e}updateHorizontalVertices(){let e=this.vertices,t=this._getMinScale();e[9]=e[11]=e[13]=e[15]=this._topHeight*t,e[17]=e[19]=e[21]=e[23]=this._height-this._bottomHeight*t,e[25]=e[27]=e[29]=e[31]=this._height}updateVerticalVertices(){let e=this.vertices,t=this._getMinScale();e[2]=e[10]=e[18]=e[26]=this._leftWidth*t,e[4]=e[12]=e[20]=e[28]=this._width-this._rightWidth*t,e[6]=e[14]=e[22]=e[30]=this._width}_getMinScale(){let e=this._leftWidth+this._rightWidth,t=this._width>e?1:this._width/e,n=this._topHeight+this._bottomHeight,r=this._height>n?1:this._height/n;return Math.min(t,r)}get width(){return this._width}set width(e){this._width=e,this._refresh()}get height(){return this._height}set height(e){this._height=e,this._refresh()}get leftWidth(){return this._leftWidth}set leftWidth(e){this._leftWidth=e,this._refresh()}get rightWidth(){return this._rightWidth}set rightWidth(e){this._rightWidth=e,this._refresh()}get topHeight(){return this._topHeight}set topHeight(e){this._topHeight=e,this._refresh()}get bottomHeight(){return this._bottomHeight}set bottomHeight(e){this._bottomHeight=e,this._refresh()}_refresh(){let e=this.texture,t=this.geometry.buffers[1].data;this._origWidth=e.orig.width,this._origHeight=e.orig.height;let n=1/this._origWidth,r=1/this._origHeight;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,t[2]=t[10]=t[18]=t[26]=n*this._leftWidth,t[4]=t[12]=t[20]=t[28]=1-n*this._rightWidth,t[9]=t[11]=t[13]=t[15]=r*this._topHeight,t[17]=t[19]=t[21]=t[23]=1-r*this._bottomHeight,this.updateHorizontalVertices(),this.updateVerticalVertices(),this.geometry.buffers[0].update(),this.geometry.buffers[1].update()}},uu=class extends eu{constructor(e=Q.EMPTY,t,n,r,i){let a=new tu(t,n,r);a.getBuffer(`aVertexPosition`).static=!1;let o=new iu(e);super(a,o,null,i),this.autoUpdate=!0}get vertices(){return this.geometry.getBuffer(`aVertexPosition`).data}set vertices(e){this.geometry.getBuffer(`aVertexPosition`).data=e}_render(e){this.autoUpdate&&this.geometry.getBuffer(`aVertexPosition`).update(),super._render(e)}},du=class extends eu{constructor(e,t,n=0){let r=new ou(e.height,t,n),i=new iu(e);n>0&&(e.baseTexture.wrapMode=p.REPEAT),super(r,i),this.autoUpdate=!0}_render(e){let t=this.geometry;(this.autoUpdate||t._width!==this.shader.texture.height)&&(t._width=this.shader.texture.height,t.update()),super._render(e)}},fu=class extends _o{constructor(e=1500,t,n=16384,r=!1){super();let i=16384;n>i&&(n=i),this._properties=[!1,!0,!1,!1,!1],this._maxSize=e,this._batchSize=n,this._buffers=null,this._bufferUpdateIDs=[],this._updateID=0,this.interactiveChildren=!1,this.blendMode=o.NORMAL,this.autoResize=r,this.roundPixels=!0,this.baseTexture=null,this.setProperties(t),this._tintColor=new H(0),this.tintRgb=new Float32Array(3),this.tint=16777215}setProperties(e){e&&(this._properties[0]=`vertices`in e||`scale`in e?!!e.vertices||!!e.scale:this._properties[0],this._properties[1]=`position`in e?!!e.position:this._properties[1],this._properties[2]=`rotation`in e?!!e.rotation:this._properties[2],this._properties[3]=`uvs`in e?!!e.uvs:this._properties[3],this._properties[4]=`tint`in e||`alpha`in e?!!e.tint||!!e.alpha:this._properties[4])}updateTransform(){this.displayObjectUpdateTransform()}get tint(){return this._tintColor.value}set tint(e){this._tintColor.setValue(e),this._tintColor.toRgbArray(this.tintRgb)}render(e){!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`,()=>this.onChildrenChange(0))),e.batch.setObjectRenderer(e.plugins.particle),e.plugins.particle.render(this))}onChildrenChange(e){let t=Math.floor(e/this._batchSize);for(;this._bufferUpdateIDs.length<t;)this._bufferUpdateIDs.push(0);this._bufferUpdateIDs[t]=++this._updateID}dispose(){if(this._buffers){for(let e=0;e<this._buffers.length;++e)this._buffers[e].destroy();this._buffers=null}}destroy(e){super.destroy(e),this.dispose(),this._properties=null,this._buffers=null,this._bufferUpdateIDs=null}},pu=class{constructor(e,t,n){this.geometry=new er,this.indexBuffer=null,this.size=n,this.dynamicProperties=[],this.staticProperties=[];for(let n=0;n<e.length;++n){let r=e[n];r={attributeName:r.attributeName,size:r.size,uploadFunction:r.uploadFunction,type:r.type||u.FLOAT,offset:r.offset},t[n]?this.dynamicProperties.push(r):this.staticProperties.push(r)}this.staticStride=0,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.dynamicStride=0,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this._updateID=0,this.initBuffers()}initBuffers(){let e=this.geometry,t=0;this.indexBuffer=new K(an(this.size),!0,!0),e.addIndex(this.indexBuffer),this.dynamicStride=0;for(let e=0;e<this.dynamicProperties.length;++e){let n=this.dynamicProperties[e];n.offset=t,t+=n.size,this.dynamicStride+=n.size}let n=new ArrayBuffer(this.size*this.dynamicStride*4*4);this.dynamicData=new Float32Array(n),this.dynamicDataUint32=new Uint32Array(n),this.dynamicBuffer=new K(this.dynamicData,!1,!1);let r=0;this.staticStride=0;for(let e=0;e<this.staticProperties.length;++e){let t=this.staticProperties[e];t.offset=r,r+=t.size,this.staticStride+=t.size}let i=new ArrayBuffer(this.size*this.staticStride*4*4);this.staticData=new Float32Array(i),this.staticDataUint32=new Uint32Array(i),this.staticBuffer=new K(this.staticData,!0,!1);for(let t=0;t<this.dynamicProperties.length;++t){let n=this.dynamicProperties[t];e.addAttribute(n.attributeName,this.dynamicBuffer,0,n.type===u.UNSIGNED_BYTE,n.type,this.dynamicStride*4,n.offset*4)}for(let t=0;t<this.staticProperties.length;++t){let n=this.staticProperties[t];e.addAttribute(n.attributeName,this.staticBuffer,0,n.type===u.UNSIGNED_BYTE,n.type,this.staticStride*4,n.offset*4)}}uploadDynamic(e,t,n){for(let r=0;r<this.dynamicProperties.length;r++){let i=this.dynamicProperties[r];i.uploadFunction(e,t,n,i.type===u.UNSIGNED_BYTE?this.dynamicDataUint32:this.dynamicData,this.dynamicStride,i.offset)}this.dynamicBuffer._updateID++}uploadStatic(e,t,n){for(let r=0;r<this.staticProperties.length;r++){let i=this.staticProperties[r];i.uploadFunction(e,t,n,i.type===u.UNSIGNED_BYTE?this.staticDataUint32:this.staticData,this.staticStride,i.offset)}this.staticBuffer._updateID++}destroy(){this.indexBuffer=null,this.dynamicProperties=null,this.dynamicBuffer=null,this.dynamicData=null,this.dynamicDataUint32=null,this.staticProperties=null,this.staticBuffer=null,this.staticData=null,this.staticDataUint32=null,this.geometry.destroy()}},mu=`varying vec2 vTextureCoord;
|
|
936
|
+
varying vec4 vColor;
|
|
937
|
+
|
|
938
|
+
uniform sampler2D uSampler;
|
|
939
|
+
|
|
940
|
+
void main(void){
|
|
941
|
+
vec4 color = texture2D(uSampler, vTextureCoord) * vColor;
|
|
942
|
+
gl_FragColor = color;
|
|
943
|
+
}`,hu=`attribute vec2 aVertexPosition;
|
|
944
|
+
attribute vec2 aTextureCoord;
|
|
945
|
+
attribute vec4 aColor;
|
|
946
|
+
|
|
947
|
+
attribute vec2 aPositionCoord;
|
|
948
|
+
attribute float aRotation;
|
|
949
|
+
|
|
950
|
+
uniform mat3 translationMatrix;
|
|
951
|
+
uniform vec4 uColor;
|
|
952
|
+
|
|
953
|
+
varying vec2 vTextureCoord;
|
|
954
|
+
varying vec4 vColor;
|
|
955
|
+
|
|
956
|
+
void main(void){
|
|
957
|
+
float x = (aVertexPosition.x) * cos(aRotation) - (aVertexPosition.y) * sin(aRotation);
|
|
958
|
+
float y = (aVertexPosition.x) * sin(aRotation) + (aVertexPosition.y) * cos(aRotation);
|
|
959
|
+
|
|
960
|
+
vec2 v = vec2(x, y);
|
|
961
|
+
v = v + aPositionCoord;
|
|
962
|
+
|
|
963
|
+
gl_Position = vec4((translationMatrix * vec3(v, 1.0)).xy, 0.0, 1.0);
|
|
964
|
+
|
|
965
|
+
vTextureCoord = aTextureCoord;
|
|
966
|
+
vColor = aColor * uColor;
|
|
967
|
+
}
|
|
968
|
+
`,gu=class extends ni{constructor(e){super(e),this.shader=null,this.properties=null,this.tempMatrix=new X,this.properties=[{attributeName:`aVertexPosition`,size:2,uploadFunction:this.uploadVertices,offset:0},{attributeName:`aPositionCoord`,size:2,uploadFunction:this.uploadPosition,offset:0},{attributeName:`aRotation`,size:1,uploadFunction:this.uploadRotation,offset:0},{attributeName:`aTextureCoord`,size:2,uploadFunction:this.uploadUvs,offset:0},{attributeName:`aColor`,size:1,type:u.UNSIGNED_BYTE,uploadFunction:this.uploadTint,offset:0}],this.shader=Zr.from(hu,mu,{}),this.state=Rn.for2d()}render(e){let t=e.children,n=e._maxSize,r=e._batchSize,i=this.renderer,a=t.length;if(a===0)return;a>n&&!e.autoResize&&(a=n);let o=e._buffers;o||=e._buffers=this.generateBuffers(e);let s=t[0]._texture.baseTexture,c=s.alphaMode>0;this.state.blendMode=$t(e.blendMode,c),i.state.set(this.state);let l=i.gl,u=e.worldTransform.copyTo(this.tempMatrix);u.prepend(i.globalUniforms.uniforms.projectionMatrix),this.shader.uniforms.translationMatrix=u.toArray(!0),this.shader.uniforms.uColor=H.shared.setValue(e.tintRgb).premultiply(e.worldAlpha,c).toArray(this.shader.uniforms.uColor),this.shader.uniforms.uSampler=s,this.renderer.shader.bind(this.shader);let d=!1;for(let n=0,s=0;n<a;n+=r,s+=1){let c=a-n;c>r&&(c=r),s>=o.length&&o.push(this._generateOneMoreBuffer(e));let u=o[s];u.uploadDynamic(t,n,c);let f=e._bufferUpdateIDs[s]||0;d||=u._updateID<f,d&&(u._updateID=e._updateID,u.uploadStatic(t,n,c)),i.geometry.bind(u.geometry),l.drawElements(l.TRIANGLES,c*6,l.UNSIGNED_SHORT,0)}}generateBuffers(e){let t=[],n=e._maxSize,r=e._batchSize,i=e._properties;for(let e=0;e<n;e+=r)t.push(new pu(this.properties,i,r));return t}_generateOneMoreBuffer(e){let t=e._batchSize,n=e._properties;return new pu(this.properties,n,t)}uploadVertices(e,t,n,r,i,a){let o=0,s=0,c=0,l=0;for(let u=0;u<n;++u){let n=e[t+u],d=n._texture,f=n.scale.x,p=n.scale.y,m=d.trim,h=d.orig;m?(s=m.x-n.anchor.x*h.width,o=s+m.width,l=m.y-n.anchor.y*h.height,c=l+m.height):(o=h.width*(1-n.anchor.x),s=h.width*-n.anchor.x,c=h.height*(1-n.anchor.y),l=h.height*-n.anchor.y),r[a]=s*f,r[a+1]=l*p,r[a+i]=o*f,r[a+i+1]=l*p,r[a+i*2]=o*f,r[a+i*2+1]=c*p,r[a+i*3]=s*f,r[a+i*3+1]=c*p,a+=i*4}}uploadPosition(e,t,n,r,i,a){for(let o=0;o<n;o++){let n=e[t+o].position;r[a]=n.x,r[a+1]=n.y,r[a+i]=n.x,r[a+i+1]=n.y,r[a+i*2]=n.x,r[a+i*2+1]=n.y,r[a+i*3]=n.x,r[a+i*3+1]=n.y,a+=i*4}}uploadRotation(e,t,n,r,i,a){for(let o=0;o<n;o++){let n=e[t+o].rotation;r[a]=n,r[a+i]=n,r[a+i*2]=n,r[a+i*3]=n,a+=i*4}}uploadUvs(e,t,n,r,i,a){for(let o=0;o<n;++o){let n=e[t+o]._texture._uvs;n?(r[a]=n.x0,r[a+1]=n.y0,r[a+i]=n.x1,r[a+i+1]=n.y1,r[a+i*2]=n.x2,r[a+i*2+1]=n.y2,r[a+i*3]=n.x3,r[a+i*3+1]=n.y3,a+=i*4):(r[a]=0,r[a+1]=0,r[a+i]=0,r[a+i+1]=0,r[a+i*2]=0,r[a+i*2+1]=0,r[a+i*3]=0,r[a+i*3+1]=0,a+=i*4)}}uploadTint(e,t,n,r,i,a){for(let o=0;o<n;++o){let n=e[t+o],s=H.shared.setValue(n._tintRGB).toPremultiplied(n.alpha,n.texture.baseTexture.alphaMode>0);r[a]=s,r[a+i]=s,r[a+i*2]=s,r[a+i*3]=s,a+=i*4}}destroy(){super.destroy(),this.shader&&=(this.shader.destroy(),null),this.tempMatrix=null}};gu.extension={name:`particle`,type:U.RendererPlugin},W.add(gu);var _u=(e=>(e[e.LINEAR_VERTICAL=0]=`LINEAR_VERTICAL`,e[e.LINEAR_HORIZONTAL=1]=`LINEAR_HORIZONTAL`,e))(_u||{}),vu={willReadFrequently:!0},yu=class e{static get experimentalLetterSpacingSupported(){let t=e._experimentalLetterSpacingSupported;if(t!==void 0){let n=w.ADAPTER.getCanvasRenderingContext2D().prototype;t=e._experimentalLetterSpacingSupported=`letterSpacing`in n||`textLetterSpacing`in n}return t}constructor(e,t,n,r,i,a,o,s,c){this.text=e,this.style=t,this.width=n,this.height=r,this.lines=i,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=s,this.fontProperties=c}static measureText(t,n,r,i=e._canvas){r??=n.wordWrap;let a=n.toFontString(),o=e.measureFont(a);o.fontSize===0&&(o.fontSize=n.fontSize,o.ascent=n.fontSize);let s=i.getContext(`2d`,vu);s.font=a;let c=(r?e.wordWrap(t,n,i):t).split(/(?:\r\n|\r|\n)/),l=Array(c.length),u=0;for(let t=0;t<c.length;t++){let r=e._measureText(c[t],n.letterSpacing,s);l[t]=r,u=Math.max(u,r)}let d=u+n.strokeThickness;n.dropShadow&&(d+=n.dropShadowDistance);let f=n.lineHeight||o.fontSize+n.strokeThickness,p=Math.max(f,o.fontSize+n.strokeThickness*2)+n.leading+(c.length-1)*(f+n.leading);return n.dropShadow&&(p+=n.dropShadowDistance),new e(t,n,d,p,c,l,f+n.leading,u,o)}static _measureText(t,n,r){let i=!1;e.experimentalLetterSpacingSupported&&(e.experimentalLetterSpacing?(r.letterSpacing=`${n}px`,r.textLetterSpacing=`${n}px`,i=!0):(r.letterSpacing=`0px`,r.textLetterSpacing=`0px`));let a=r.measureText(t).width;return a>0&&(i?a-=n:a+=(e.graphemeSegmenter(t).length-1)*n),a}static wordWrap(t,n,r=e._canvas){let i=r.getContext(`2d`,vu),a=0,o=``,s=``,c=Object.create(null),{letterSpacing:l,whiteSpace:u}=n,d=e.collapseSpaces(u),f=e.collapseNewlines(u),p=!d,m=n.wordWrapWidth+l,h=e.tokenize(t);for(let t=0;t<h.length;t++){let r=h[t];if(e.isNewline(r)){if(!f){s+=e.addLine(o),p=!d,o=``,a=0;continue}r=` `}if(d){let t=e.isBreakingSpace(r),n=e.isBreakingSpace(o[o.length-1]);if(t&&n)continue}let u=e.getFromCache(r,l,c,i);if(u>m){if(o!==``&&(s+=e.addLine(o),o=``,a=0),e.canBreakWords(r,n.breakWords)){let t=e.wordWrapSplit(r);for(let u=0;u<t.length;u++){let d=t[u],f=d,h=1;for(;t[u+h];){let i=t[u+h];if(!e.canBreakChars(f,i,r,u,n.breakWords))d+=i;else break;f=i,h++}u+=h-1;let g=e.getFromCache(d,l,c,i);g+a>m&&(s+=e.addLine(o),p=!1,o=``,a=0),o+=d,a+=g}}else{o.length>0&&(s+=e.addLine(o),o=``,a=0);let n=t===h.length-1;s+=e.addLine(r,!n),p=!1,o=``,a=0}}else u+a>m&&(p=!1,s+=e.addLine(o),o=``,a=0),(o.length>0||!e.isBreakingSpace(r)||p)&&(o+=r,a+=u)}return s+=e.addLine(o,!1),s}static addLine(t,n=!0){return t=e.trimRight(t),t=n?`${t}
|
|
969
|
+
`:t,t}static getFromCache(t,n,r,i){let a=r[t];return typeof a!=`number`&&(a=e._measureText(t,n,i)+n,r[t]=a),a}static collapseSpaces(e){return e===`normal`||e===`pre-line`}static collapseNewlines(e){return e===`normal`}static trimRight(t){if(typeof t!=`string`)return``;for(let n=t.length-1;n>=0;n--){let r=t[n];if(!e.isBreakingSpace(r))break;t=t.slice(0,-1)}return t}static isNewline(t){return typeof t==`string`&&e._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,n){return typeof t==`string`&&e._breakingSpaces.includes(t.charCodeAt(0))}static tokenize(t){let n=[],r=``;if(typeof t!=`string`)return n;for(let i=0;i<t.length;i++){let a=t[i],o=t[i+1];if(e.isBreakingSpace(a,o)||e.isNewline(a)){r!==``&&(n.push(r),r=``),n.push(a);continue}r+=a}return r!==``&&n.push(r),n}static canBreakWords(e,t){return t}static canBreakChars(e,t,n,r,i){return!0}static wordWrapSplit(t){return e.graphemeSegmenter(t)}static measureFont(t){if(e._fonts[t])return e._fonts[t];let n={ascent:0,descent:0,fontSize:0},r=e._canvas,i=e._context;i.font=t;let a=e.METRICS_STRING+e.BASELINE_SYMBOL,o=Math.ceil(i.measureText(a).width),s=Math.ceil(i.measureText(e.BASELINE_SYMBOL).width),c=Math.ceil(e.HEIGHT_MULTIPLIER*s);if(s=s*e.BASELINE_MULTIPLIER|0,o===0||c===0)return e._fonts[t]=n,n;r.width=o,r.height=c,i.fillStyle=`#f00`,i.fillRect(0,0,o,c),i.font=t,i.textBaseline=`alphabetic`,i.fillStyle=`#000`,i.fillText(a,0,s);let l=i.getImageData(0,0,o,c).data,u=l.length,d=o*4,f=0,p=0,m=!1;for(f=0;f<s;++f){for(let e=0;e<d;e+=4)if(l[p+e]!==255){m=!0;break}if(!m)p+=d;else break}for(n.ascent=s-f,p=u-d,m=!1,f=c;f>s;--f){for(let e=0;e<d;e+=4)if(l[p+e]!==255){m=!0;break}if(!m)p-=d;else break}return n.descent=f-s,n.fontSize=n.ascent+n.descent,e._fonts[t]=n,n}static clearMetrics(t=``){t?delete e._fonts[t]:e._fonts={}}static get _canvas(){if(!e.__canvas){let t;try{let n=new OffscreenCanvas(0,0);if(n.getContext(`2d`,vu)?.measureText)return e.__canvas=n,n;t=w.ADAPTER.createCanvas()}catch{t=w.ADAPTER.createCanvas()}t.width=t.height=10,e.__canvas=t}return e.__canvas}static get _context(){return e.__context||=e._canvas.getContext(`2d`,vu),e.__context}};yu.METRICS_STRING=`|ÉqÅ`,yu.BASELINE_SYMBOL=`M`,yu.BASELINE_MULTIPLIER=1.4,yu.HEIGHT_MULTIPLIER=2,yu.graphemeSegmenter=(()=>{if(typeof Intl?.Segmenter==`function`){let e=new Intl.Segmenter;return t=>[...e.segment(t)].map(e=>e.segment)}return e=>[...e]})(),yu.experimentalLetterSpacing=!1,yu._fonts={},yu._newlines=[10,13],yu._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288];var bu=yu,xu=[`serif`,`sans-serif`,`monospace`,`cursive`,`fantasy`,`system-ui`],Su=class e{constructor(e){this.styleID=0,this.reset(),Eu(this,e,e)}clone(){let t={};return Eu(t,this,e.defaultStyle),new e(t)}reset(){Eu(this,e.defaultStyle,e.defaultStyle)}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.styleID++)}get breakWords(){return this._breakWords}set breakWords(e){this._breakWords!==e&&(this._breakWords=e,this.styleID++)}get dropShadow(){return this._dropShadow}set dropShadow(e){this._dropShadow!==e&&(this._dropShadow=e,this.styleID++)}get dropShadowAlpha(){return this._dropShadowAlpha}set dropShadowAlpha(e){this._dropShadowAlpha!==e&&(this._dropShadowAlpha=e,this.styleID++)}get dropShadowAngle(){return this._dropShadowAngle}set dropShadowAngle(e){this._dropShadowAngle!==e&&(this._dropShadowAngle=e,this.styleID++)}get dropShadowBlur(){return this._dropShadowBlur}set dropShadowBlur(e){this._dropShadowBlur!==e&&(this._dropShadowBlur=e,this.styleID++)}get dropShadowColor(){return this._dropShadowColor}set dropShadowColor(e){let t=wu(e);this._dropShadowColor!==t&&(this._dropShadowColor=t,this.styleID++)}get dropShadowDistance(){return this._dropShadowDistance}set dropShadowDistance(e){this._dropShadowDistance!==e&&(this._dropShadowDistance=e,this.styleID++)}get fill(){return this._fill}set fill(e){let t=wu(e);this._fill!==t&&(this._fill=t,this.styleID++)}get fillGradientType(){return this._fillGradientType}set fillGradientType(e){this._fillGradientType!==e&&(this._fillGradientType=e,this.styleID++)}get fillGradientStops(){return this._fillGradientStops}set fillGradientStops(e){Tu(this._fillGradientStops,e)||(this._fillGradientStops=e,this.styleID++)}get fontFamily(){return this._fontFamily}set fontFamily(e){this.fontFamily!==e&&(this._fontFamily=e,this.styleID++)}get fontSize(){return this._fontSize}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.styleID++)}get fontStyle(){return this._fontStyle}set fontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.styleID++)}get fontVariant(){return this._fontVariant}set fontVariant(e){this._fontVariant!==e&&(this._fontVariant=e,this.styleID++)}get fontWeight(){return this._fontWeight}set fontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.styleID++)}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.styleID++)}get lineHeight(){return this._lineHeight}set lineHeight(e){this._lineHeight!==e&&(this._lineHeight=e,this.styleID++)}get leading(){return this._leading}set leading(e){this._leading!==e&&(this._leading=e,this.styleID++)}get lineJoin(){return this._lineJoin}set lineJoin(e){this._lineJoin!==e&&(this._lineJoin=e,this.styleID++)}get miterLimit(){return this._miterLimit}set miterLimit(e){this._miterLimit!==e&&(this._miterLimit=e,this.styleID++)}get padding(){return this._padding}set padding(e){this._padding!==e&&(this._padding=e,this.styleID++)}get stroke(){return this._stroke}set stroke(e){let t=wu(e);this._stroke!==t&&(this._stroke=t,this.styleID++)}get strokeThickness(){return this._strokeThickness}set strokeThickness(e){this._strokeThickness!==e&&(this._strokeThickness=e,this.styleID++)}get textBaseline(){return this._textBaseline}set textBaseline(e){this._textBaseline!==e&&(this._textBaseline=e,this.styleID++)}get trim(){return this._trim}set trim(e){this._trim!==e&&(this._trim=e,this.styleID++)}get whiteSpace(){return this._whiteSpace}set whiteSpace(e){this._whiteSpace!==e&&(this._whiteSpace=e,this.styleID++)}get wordWrap(){return this._wordWrap}set wordWrap(e){this._wordWrap!==e&&(this._wordWrap=e,this.styleID++)}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(e){this._wordWrapWidth!==e&&(this._wordWrapWidth=e,this.styleID++)}toFontString(){let e=typeof this.fontSize==`number`?`${this.fontSize}px`:this.fontSize,t=this.fontFamily;Array.isArray(this.fontFamily)||(t=this.fontFamily.split(`,`));for(let e=t.length-1;e>=0;e--){let n=t[e].trim();!/([\"\'])[^\'\"]+\1/.test(n)&&!xu.includes(n)&&(n=`"${n}"`),t[e]=n}return`${this.fontStyle} ${this.fontVariant} ${this.fontWeight} ${e} ${t.join(`,`)}`}};Su.defaultStyle={align:`left`,breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:`black`,dropShadowDistance:5,fill:`black`,fillGradientType:_u.LINEAR_VERTICAL,fillGradientStops:[],fontFamily:`Arial`,fontSize:26,fontStyle:`normal`,fontVariant:`normal`,fontWeight:`normal`,leading:0,letterSpacing:0,lineHeight:0,lineJoin:`miter`,miterLimit:10,padding:0,stroke:`black`,strokeThickness:0,textBaseline:`alphabetic`,trim:!1,whiteSpace:`pre`,wordWrap:!1,wordWrapWidth:100};var Cu=Su;function wu(e){let t=H.shared,n=e=>{let n=t.setValue(e);return n.alpha===1?n.toHex():n.toRgbaString()};return Array.isArray(e)?e.map(n):n(e)}function Tu(e,t){if(!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length)return!1;for(let n=0;n<e.length;++n)if(e[n]!==t[n])return!1;return!0}function Eu(e,t,n){for(let r in n)e[r]=Array.isArray(t[r])?t[r].slice():t[r]}var Du={texture:!0,children:!1,baseTexture:!0},Ou=class e extends bo{constructor(t,n,r){let i=!1;r||(r=w.ADAPTER.createCanvas(),i=!0),r.width=3,r.height=3;let a=Q.from(r);a.orig=new Y,a.trim=new Y,super(a),this._ownCanvas=i,this.canvas=r,this.context=r.getContext(`2d`,{willReadFrequently:!0}),this._resolution=e.defaultResolution??w.RESOLUTION,this._autoResolution=e.defaultAutoResolution,this._text=null,this._style=null,this._styleListener=null,this._font=``,this.text=t,this.style=n,this.localStyleID=-1}static get experimentalLetterSpacing(){return bu.experimentalLetterSpacing}static set experimentalLetterSpacing(e){z(`7.1.0`,`Text.experimentalLetterSpacing is deprecated, use TextMetrics.experimentalLetterSpacing`),bu.experimentalLetterSpacing=e}updateText(e){let t=this._style;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;this._font=this._style.toFontString();let n=this.context,r=bu.measureText(this._text||` `,this._style,this._style.wordWrap,this.canvas),i=r.width,a=r.height,o=r.lines,s=r.lineHeight,c=r.lineWidths,l=r.maxLineWidth,u=r.fontProperties;this.canvas.width=Math.ceil(Math.ceil(Math.max(1,i)+t.padding*2)*this._resolution),this.canvas.height=Math.ceil(Math.ceil(Math.max(1,a)+t.padding*2)*this._resolution),n.scale(this._resolution,this._resolution),n.clearRect(0,0,this.canvas.width,this.canvas.height),n.font=this._font,n.lineWidth=t.strokeThickness,n.textBaseline=t.textBaseline,n.lineJoin=t.lineJoin,n.miterLimit=t.miterLimit;let d,f,p=t.dropShadow?2:1;for(let e=0;e<p;++e){let i=t.dropShadow&&e===0,p=i?Math.ceil(Math.max(1,a)+t.padding*2):0,m=p*this._resolution;if(i){n.fillStyle=`black`,n.strokeStyle=`black`;let e=t.dropShadowColor,r=t.dropShadowBlur*this._resolution,i=t.dropShadowDistance*this._resolution;n.shadowColor=H.shared.setValue(e).setAlpha(t.dropShadowAlpha).toRgbaString(),n.shadowBlur=r,n.shadowOffsetX=Math.cos(t.dropShadowAngle)*i,n.shadowOffsetY=Math.sin(t.dropShadowAngle)*i+m}else n.fillStyle=this._generateFillStyle(t,o,r),n.strokeStyle=t.stroke,n.shadowColor=`black`,n.shadowBlur=0,n.shadowOffsetX=0,n.shadowOffsetY=0;let h=(s-u.fontSize)/2;s-u.fontSize<0&&(h=0);for(let e=0;e<o.length;e++)d=t.strokeThickness/2,f=t.strokeThickness/2+e*s+u.ascent+h,t.align===`right`?d+=l-c[e]:t.align===`center`&&(d+=(l-c[e])/2),t.stroke&&t.strokeThickness&&this.drawLetterSpacing(o[e],d+t.padding,f+t.padding-p,!0),t.fill&&this.drawLetterSpacing(o[e],d+t.padding,f+t.padding-p)}this.updateTexture()}drawLetterSpacing(e,t,n,r=!1){let i=this._style.letterSpacing,a=!1;if(bu.experimentalLetterSpacingSupported&&(bu.experimentalLetterSpacing?(this.context.letterSpacing=`${i}px`,this.context.textLetterSpacing=`${i}px`,a=!0):(this.context.letterSpacing=`0px`,this.context.textLetterSpacing=`0px`)),i===0||a){r?this.context.strokeText(e,t,n):this.context.fillText(e,t,n);return}let o=t,s=bu.graphemeSegmenter(e),c=this.context.measureText(e).width,l=0;for(let e=0;e<s.length;++e){let t=s[e];r?this.context.strokeText(t,o,n):this.context.fillText(t,o,n);let a=``;for(let t=e+1;t<s.length;++t)a+=s[t];l=this.context.measureText(a).width,o+=c-l+i,c=l}}updateTexture(){let e=this.canvas;if(this._style.trim){let t=Dn(e);t.data&&(e.width=t.width,e.height=t.height,this.context.putImageData(t.data,0,0))}let t=this._texture,n=this._style,r=n.trim?0:n.padding,i=t.baseTexture;t.trim.width=t._frame.width=e.width/this._resolution,t.trim.height=t._frame.height=e.height/this._resolution,t.trim.x=-r,t.trim.y=-r,t.orig.width=t._frame.width-r*2,t.orig.height=t._frame.height-r*2,this._onTextureUpdate(),i.setRealSize(e.width,e.height,this._resolution),t.updateUvs(),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}updateTransform(){this.updateText(!0),super.updateTransform()}getBounds(e,t){return this.updateText(!0),this._textureID===-1&&(e=!1),super.getBounds(e,t)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds.call(this,e)}_calculateBounds(){this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_generateFillStyle(e,t,n){let r=e.fill;if(Array.isArray(r)){if(r.length===1)return r[0]}else return r;let i,a=e.dropShadow?e.dropShadowDistance:0,o=e.padding||0,s=this.canvas.width/this._resolution-a-o*2,c=this.canvas.height/this._resolution-a-o*2,l=r.slice(),u=e.fillGradientStops.slice();if(!u.length){let e=l.length+1;for(let t=1;t<e;++t)u.push(t/e)}if(l.unshift(r[0]),u.unshift(0),l.push(r[r.length-1]),u.push(1),e.fillGradientType===_u.LINEAR_VERTICAL){i=this.context.createLinearGradient(s/2,o,s/2,c+o);let r=n.fontProperties.fontSize+e.strokeThickness;for(let e=0;e<t.length;e++){let a=n.lineHeight*(e-1)+r,o=n.lineHeight*e,s=o;e>0&&a>o&&(s=(o+a)/2);let d=o+r,f=n.lineHeight*(e+1),p=d;e+1<t.length&&f<d&&(p=(d+f)/2);let m=(p-s)/c;for(let e=0;e<l.length;e++){let t=0;t=typeof u[e]==`number`?u[e]:e/l.length;let n=Math.min(1,Math.max(0,s/c+t*m));n=Number(n.toFixed(5)),i.addColorStop(n,l[e])}}}else{i=this.context.createLinearGradient(o,c/2,s+o,c/2);let e=l.length+1,t=1;for(let n=0;n<l.length;n++){let r;r=typeof u[n]==`number`?u[n]:t/e,i.addColorStop(r,l[n]),t++}}return i}destroy(e){typeof e==`boolean`&&(e={children:e}),e=Object.assign({},Du,e),super.destroy(e),this._ownCanvas&&(this.canvas.height=this.canvas.width=0),this.context=null,this.canvas=null,this._style=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._texture.orig.width}set width(e){this.updateText(!0);let t=pn(this.scale.x)||1;this.scale.x=t*e/this._texture.orig.width,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._texture.orig.height}set height(e){this.updateText(!0);let t=pn(this.scale.y)||1;this.scale.y=t*e/this._texture.orig.height,this._height=e}get style(){return this._style}set style(e){e||={},this._style=e instanceof Cu?e:new Cu(e),this.localStyleID=-1,this.dirty=!0}get text(){return this._text}set text(e){e=String(e??``),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}};Ou.defaultAutoResolution=!0;var ku=Ou,Au=class{constructor(e){this.maxItemsPerFrame=e,this.itemsLeft=0}beginFrame(){this.itemsLeft=this.maxItemsPerFrame}allowedToUpload(){return this.itemsLeft-->0}};function ju(e,t){let n=!1;if(e?._textures?.length){for(let r=0;r<e._textures.length;r++)if(e._textures[r]instanceof Q){let i=e._textures[r].baseTexture;t.includes(i)||(t.push(i),n=!0)}}return n}function Mu(e,t){if(e.baseTexture instanceof G){let n=e.baseTexture;return t.includes(n)||t.push(n),!0}return!1}function Nu(e,t){if(e._texture&&e._texture instanceof Q){let n=e._texture.baseTexture;return t.includes(n)||t.push(n),!0}return!1}function Pu(e,t){return t instanceof ku&&(t.updateText(!0),!0)}function Fu(e,t){if(t instanceof Cu){let e=t.toFontString();return bu.measureFont(e),!0}return!1}function Iu(e,t){if(e instanceof ku){t.includes(e.style)||t.push(e.style),t.includes(e)||t.push(e);let n=e._texture.baseTexture;return t.includes(n)||t.push(n),!0}return!1}function Lu(e,t){return e instanceof Cu&&(t.includes(e)||t.push(e),!0)}var Ru=class e{constructor(t){this.limiter=new Au(e.uploadsPerFrame),this.renderer=t,this.uploadHookHelper=null,this.queue=[],this.addHooks=[],this.uploadHooks=[],this.completes=[],this.ticking=!1,this.delayedTick=()=>{this.queue&&this.prepareItems()},this.registerFindHook(Iu),this.registerFindHook(Lu),this.registerFindHook(ju),this.registerFindHook(Mu),this.registerFindHook(Nu),this.registerUploadHook(Pu),this.registerUploadHook(Fu)}upload(e){return new Promise(t=>{e&&this.add(e),this.queue.length?(this.completes.push(t),this.ticking||(this.ticking=!0,Ra.system.addOnce(this.tick,this,Fa.UTILITY))):t()})}tick(){setTimeout(this.delayedTick,0)}prepareItems(){for(this.limiter.beginFrame();this.queue.length&&this.limiter.allowedToUpload();){let e=this.queue[0],t=!1;if(e&&!e._destroyed){for(let n=0,r=this.uploadHooks.length;n<r;n++)if(this.uploadHooks[n](this.uploadHookHelper,e)){this.queue.shift(),t=!0;break}}t||this.queue.shift()}if(this.queue.length)Ra.system.addOnce(this.tick,this,Fa.UTILITY);else{this.ticking=!1;let e=this.completes.slice(0);this.completes.length=0;for(let t=0,n=e.length;t<n;t++)e[t]()}}registerFindHook(e){return e&&this.addHooks.push(e),this}registerUploadHook(e){return e&&this.uploadHooks.push(e),this}add(e){for(let t=0,n=this.addHooks.length;t<n&&!this.addHooks[t](e,this.queue);t++);if(e instanceof _o)for(let t=e.children.length-1;t>=0;t--)this.add(e.children[t]);return this}destroy(){this.ticking&&Ra.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}};Ru.uploadsPerFrame=4;var zu=Ru;Object.defineProperties(w,{UPLOADS_PER_FRAME:{get(){return zu.uploadsPerFrame},set(e){z(`7.1.0`,`settings.UPLOADS_PER_FRAME is deprecated, use prepare.BasePrepare.uploadsPerFrame`),zu.uploadsPerFrame=e}}});function Bu(e,t){return t instanceof G&&(t._glTextures[e.CONTEXT_UID]||e.texture.bind(t),!0)}function Vu(e,t){if(!(t instanceof Jl))return!1;let{geometry:n}=t;t.finishPoly(),n.updateBatches();let{batches:r}=n;for(let t=0;t<r.length;t++){let{texture:n}=r[t].style;n&&Bu(e,n.baseTexture)}return n.batchable||e.geometry.bind(n,t._resolveDirectShader(e)),!0}function Hu(e,t){return e instanceof Jl&&(t.push(e),!0)}var Uu=class extends zu{constructor(e){super(e),this.uploadHookHelper=this.renderer,this.registerFindHook(Hu),this.registerUploadHook(Bu),this.registerUploadHook(Vu)}};Uu.extension={name:`prepare`,type:U.RendererSystem},W.add(Uu);var Wu=class{constructor(e){this.maxMilliseconds=e,this.frameStart=0}beginFrame(){this.frameStart=Date.now()}allowedToUpload(){return Date.now()-this.frameStart<this.maxMilliseconds}},Gu=class e extends bo{constructor(e,t=!0){super(e[0]instanceof Q?e[0]:e[0].texture),this._textures=null,this._durations=null,this._autoUpdate=t,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=e}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(Ra.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(Ra.shared.add(this.update,this,Fa.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(e){this.stop(),this.currentFrame=e}gotoAndPlay(e){this.currentFrame=e,this.play()}update(e){if(!this._playing)return;let t=this.animationSpeed*e,n=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=t/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];let r=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*r,this._currentTime+=r;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=t;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()):n!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<n||this.animationSpeed<0&&this.currentFrame>n)&&this.onLoop(),this.updateTexture())}updateTexture(){let e=this.currentFrame;this._previousFrame!==e&&(this._previousFrame=e,this._texture=this._textures[e],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))}destroy(e){this.stop(),super.destroy(e),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){let n=[];for(let e=0;e<t.length;++e)n.push(Q.from(t[e]));return new e(n)}static fromImages(t){let n=[];for(let e=0;e<t.length;++e)n.push(Q.from(t[e]));return new e(n)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(e){if(e[0]instanceof Q)this._textures=e,this._durations=null;else{this._textures=[],this._durations=[];for(let t=0;t<e.length;t++)this._textures.push(e[t].texture),this._durations.push(e[t].time)}this._previousFrame=null,this.gotoAndStop(0),this.updateTexture()}get currentFrame(){let e=Math.floor(this._currentTime)%this._textures.length;return e<0&&(e+=this._textures.length),e}set currentFrame(e){if(e<0||e>this.totalFrames-1)throw Error(`[AnimatedSprite]: Invalid frame index value ${e}, expected to be between 0 and totalFrames ${this.totalFrames}.`);let t=this.currentFrame;this._currentTime=e,t!==this.currentFrame&&this.updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(e){e!==this._autoUpdate&&(this._autoUpdate=e,!this._autoUpdate&&this._isConnectedToTicker?(Ra.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(Ra.shared.add(this.update,this),this._isConnectedToTicker=!0))}},Ku=new J,qu=class e extends bo{constructor(e,t=100,n=100){super(e),this.tileTransform=new br,this._width=t,this._height=n,this.uvMatrix=this.texture.uvMatrix||new Ii(e),this.pluginName=`tilingSprite`,this.uvRespectAnchor=!1}get clampMargin(){return this.uvMatrix.clampMargin}set clampMargin(e){this.uvMatrix.clampMargin=e,this.uvMatrix.update(!0)}get tileScale(){return this.tileTransform.scale}set tileScale(e){this.tileTransform.scale.copyFrom(e)}get tilePosition(){return this.tileTransform.position}set tilePosition(e){this.tileTransform.position.copyFrom(e)}_onTextureUpdate(){this.uvMatrix&&(this.uvMatrix.texture=this._texture),this._cachedTint=16777215}_render(e){let t=this._texture;!t||!t.valid||(this.tileTransform.updateLocalTransform(),this.uvMatrix.update(),e.batch.setObjectRenderer(e.plugins[this.pluginName]),e.plugins[this.pluginName].render(this))}_calculateBounds(){let e=this._width*-this._anchor._x,t=this._height*-this._anchor._y,n=this._width*(1-this._anchor._x),r=this._height*(1-this._anchor._y);this._bounds.addFrame(this.transform,e,t,n,r)}getLocalBounds(e){return this.children.length===0?(this._bounds.minX=this._width*-this._anchor._x,this._bounds.minY=this._height*-this._anchor._y,this._bounds.maxX=this._width*(1-this._anchor._x),this._bounds.maxY=this._height*(1-this._anchor._y),e||=(this._localBoundsRect||=new Y,this._localBoundsRect),this._bounds.getRectangle(e)):super.getLocalBounds.call(this,e)}containsPoint(e){this.worldTransform.applyInverse(e,Ku);let t=this._width,n=this._height,r=-t*this.anchor._x;if(Ku.x>=r&&Ku.x<r+t){let e=-n*this.anchor._y;if(Ku.y>=e&&Ku.y<e+n)return!0}return!1}destroy(e){super.destroy(e),this.tileTransform=null,this.uvMatrix=null}static from(t,n){let r=t instanceof Q?t:Q.from(t,n);return new e(r,n.width,n.height)}get width(){return this._width}set width(e){this._width=e}get height(){return this._height}set height(e){this._height=e}},Ju=`#version 300 es
|
|
970
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
971
|
+
|
|
972
|
+
precision lowp float;
|
|
973
|
+
|
|
974
|
+
in vec2 vTextureCoord;
|
|
975
|
+
|
|
976
|
+
out vec4 fragmentColor;
|
|
977
|
+
|
|
978
|
+
uniform sampler2D uSampler;
|
|
979
|
+
uniform vec4 uColor;
|
|
980
|
+
uniform mat3 uMapCoord;
|
|
981
|
+
uniform vec4 uClampFrame;
|
|
982
|
+
uniform vec2 uClampOffset;
|
|
983
|
+
|
|
984
|
+
void main(void)
|
|
985
|
+
{
|
|
986
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
987
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
988
|
+
vec2 unclamped = coord;
|
|
989
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
990
|
+
|
|
991
|
+
vec4 texSample = texture(uSampler, coord, unclamped == coord ? 0.0f : -32.0f);// lod-bias very negative to force lod 0
|
|
992
|
+
|
|
993
|
+
fragmentColor = texSample * uColor;
|
|
994
|
+
}
|
|
995
|
+
`,Yu=`#version 300 es
|
|
996
|
+
#define SHADER_NAME Tiling-Sprite-300
|
|
997
|
+
|
|
998
|
+
precision lowp float;
|
|
999
|
+
|
|
1000
|
+
in vec2 aVertexPosition;
|
|
1001
|
+
in vec2 aTextureCoord;
|
|
1002
|
+
|
|
1003
|
+
uniform mat3 projectionMatrix;
|
|
1004
|
+
uniform mat3 translationMatrix;
|
|
1005
|
+
uniform mat3 uTransform;
|
|
1006
|
+
|
|
1007
|
+
out vec2 vTextureCoord;
|
|
1008
|
+
|
|
1009
|
+
void main(void)
|
|
1010
|
+
{
|
|
1011
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1012
|
+
|
|
1013
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1014
|
+
}
|
|
1015
|
+
`,Xu=`#version 100
|
|
1016
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
1017
|
+
#extension GL_EXT_shader_texture_lod : enable
|
|
1018
|
+
#endif
|
|
1019
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
1020
|
+
|
|
1021
|
+
precision lowp float;
|
|
1022
|
+
|
|
1023
|
+
varying vec2 vTextureCoord;
|
|
1024
|
+
|
|
1025
|
+
uniform sampler2D uSampler;
|
|
1026
|
+
uniform vec4 uColor;
|
|
1027
|
+
uniform mat3 uMapCoord;
|
|
1028
|
+
uniform vec4 uClampFrame;
|
|
1029
|
+
uniform vec2 uClampOffset;
|
|
1030
|
+
|
|
1031
|
+
void main(void)
|
|
1032
|
+
{
|
|
1033
|
+
vec2 coord = vTextureCoord + ceil(uClampOffset - vTextureCoord);
|
|
1034
|
+
coord = (uMapCoord * vec3(coord, 1.0)).xy;
|
|
1035
|
+
vec2 unclamped = coord;
|
|
1036
|
+
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
|
|
1037
|
+
|
|
1038
|
+
#ifdef GL_EXT_shader_texture_lod
|
|
1039
|
+
vec4 texSample = unclamped == coord
|
|
1040
|
+
? texture2D(uSampler, coord)
|
|
1041
|
+
: texture2DLodEXT(uSampler, coord, 0);
|
|
1042
|
+
#else
|
|
1043
|
+
vec4 texSample = texture2D(uSampler, coord);
|
|
1044
|
+
#endif
|
|
1045
|
+
|
|
1046
|
+
gl_FragColor = texSample * uColor;
|
|
1047
|
+
}
|
|
1048
|
+
`,Zu=`#version 100
|
|
1049
|
+
#define SHADER_NAME Tiling-Sprite-100
|
|
1050
|
+
|
|
1051
|
+
precision lowp float;
|
|
1052
|
+
|
|
1053
|
+
attribute vec2 aVertexPosition;
|
|
1054
|
+
attribute vec2 aTextureCoord;
|
|
1055
|
+
|
|
1056
|
+
uniform mat3 projectionMatrix;
|
|
1057
|
+
uniform mat3 translationMatrix;
|
|
1058
|
+
uniform mat3 uTransform;
|
|
1059
|
+
|
|
1060
|
+
varying vec2 vTextureCoord;
|
|
1061
|
+
|
|
1062
|
+
void main(void)
|
|
1063
|
+
{
|
|
1064
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);
|
|
1065
|
+
|
|
1066
|
+
vTextureCoord = (uTransform * vec3(aTextureCoord, 1.0)).xy;
|
|
1067
|
+
}
|
|
1068
|
+
`,Qu=`#version 100
|
|
1069
|
+
#define SHADER_NAME Tiling-Sprite-Simple-100
|
|
1070
|
+
|
|
1071
|
+
precision lowp float;
|
|
1072
|
+
|
|
1073
|
+
varying vec2 vTextureCoord;
|
|
1074
|
+
|
|
1075
|
+
uniform sampler2D uSampler;
|
|
1076
|
+
uniform vec4 uColor;
|
|
1077
|
+
|
|
1078
|
+
void main(void)
|
|
1079
|
+
{
|
|
1080
|
+
vec4 texSample = texture2D(uSampler, vTextureCoord);
|
|
1081
|
+
gl_FragColor = texSample * uColor;
|
|
1082
|
+
}
|
|
1083
|
+
`,$u=new X,ed=class extends ni{constructor(e){super(e),e.runners.contextChange.add(this),this.quad=new Ti,this.state=Rn.for2d()}contextChange(){let e=this.renderer,t={globals:e.globalUniforms};this.simpleShader=Zr.from(Zu,Qu,t),this.shader=e.context.webGLVersion>1?Zr.from(Yu,Ju,t):Zr.from(Zu,Xu,t)}render(e){let t=this.renderer,n=this.quad,r=n.vertices;r[0]=r[6]=e._width*-e.anchor.x,r[1]=r[3]=e._height*-e.anchor.y,r[2]=r[4]=e._width*(1-e.anchor.x),r[5]=r[7]=e._height*(1-e.anchor.y);let i=e.uvRespectAnchor?e.anchor.x:0,a=e.uvRespectAnchor?e.anchor.y:0;r=n.uvs,r[0]=r[6]=-i,r[1]=r[3]=-a,r[2]=r[4]=1-i,r[5]=r[7]=1-a,n.invalidate();let o=e._texture,s=o.baseTexture,c=s.alphaMode>0,l=e.tileTransform.localTransform,u=e.uvMatrix,d=s.isPowerOfTwo&&o.frame.width===s.width&&o.frame.height===s.height;d&&(s._glTextures[t.CONTEXT_UID]?d=s.wrapMode!==p.CLAMP:s.wrapMode===p.CLAMP&&(s.wrapMode=p.REPEAT));let f=d?this.simpleShader:this.shader,m=o.width,h=o.height,g=e._width,_=e._height;$u.set(l.a*m/g,l.b*m/_,l.c*h/g,l.d*h/_,l.tx/g,l.ty/_),$u.invert(),d?$u.prepend(u.mapCoord):(f.uniforms.uMapCoord=u.mapCoord.toArray(!0),f.uniforms.uClampFrame=u.uClampFrame,f.uniforms.uClampOffset=u.uClampOffset),f.uniforms.uTransform=$u.toArray(!0),f.uniforms.uColor=H.shared.setValue(e.tint).premultiply(e.worldAlpha,c).toArray(f.uniforms.uColor),f.uniforms.translationMatrix=e.transform.worldTransform.toArray(!0),f.uniforms.uSampler=o,t.shader.bind(f),t.geometry.bind(n),this.state.blendMode=$t(e.blendMode,c),t.state.set(this.state),t.geometry.draw(this.renderer.gl.TRIANGLES,6,0)}};ed.extension={name:`tilingSprite`,type:U.RendererPlugin},W.add(ed);var td=class e{constructor(e,t,n){this.linkedSheets=[],(e instanceof G||e instanceof Q)&&(e={texture:e,data:t,resolutionFilename:n});let{texture:r,data:i,resolutionFilename:a=null,cachePrefix:o=``}=e;this.cachePrefix=o,this._texture=r instanceof Q?r:null,this.baseTexture=r instanceof G?r:this._texture.baseTexture,this.textures={},this.animations={},this.data=i;let s=this.baseTexture.resource;this.resolution=this._updateResolution(a||(s?s.url:null)),this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}_updateResolution(e=null){let{scale:t}=this.data.meta,n=An(e,null);return n===null&&(n=typeof t==`number`?t:parseFloat(t??`1`)),n!==1&&this.baseTexture.setResolution(n),n}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=e.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let n=t,r=e.BATCH_SIZE;for(;n-t<r&&n<this._frameKeys.length;){let e=this._frameKeys[n],t=this._frames[e],r=t.frame;if(r){let n=null,i=null,a=t.trimmed!==!1&&t.sourceSize?t.sourceSize:t.frame,o=new Y(0,0,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution);n=t.rotated?new Y(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.h)/this.resolution,Math.floor(r.w)/this.resolution):new Y(Math.floor(r.x)/this.resolution,Math.floor(r.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution),t.trimmed!==!1&&t.spriteSourceSize&&(i=new Y(Math.floor(t.spriteSourceSize.x)/this.resolution,Math.floor(t.spriteSourceSize.y)/this.resolution,Math.floor(r.w)/this.resolution,Math.floor(r.h)/this.resolution)),this.textures[e]=new Q(this.baseTexture,n,o,i,t.rotated?2:0,t.anchor,t.borders),Q.addToCache(this.textures[e],this.cachePrefix+e.toString())}n++}}_processAnimations(){let e=this.data.animations||{};for(let t in e){this.animations[t]=[];for(let n=0;n<e[t].length;n++){let r=e[t][n];this.animations[t].push(this.textures[r])}}}_parseComplete(){let e=this._callback;this._callback=null,this._batchIndex=0,e.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*e.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*e.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(e=!1){for(let e in this.textures)this.textures[e].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,e&&(this._texture?.destroy(),this.baseTexture.destroy()),this._texture=null,this.baseTexture=null,this.linkedSheets=[]}};td.BATCH_SIZE=1e3;var nd=td,rd=[`jpg`,`png`,`jpeg`,`avif`,`webp`,`s3tc`,`s3tc_sRGB`,`etc`,`etc1`,`pvrtc`,`atc`,`astc`,`bptc`];function id(e,t,n){let r={};if(e.forEach(e=>{r[e]=t}),Object.keys(t.textures).forEach(e=>{r[`${t.cachePrefix}${e}`]=t.textures[e]}),!n){let n=B.dirname(e[0]);t.linkedSheets.forEach((e,i)=>{Object.assign(r,id([`${n}/${t.data.meta.related_multi_packs[i]}`],e,!0))})}return r}var ad={extension:U.Asset,cache:{test:e=>e instanceof nd,getCacheableAssets:(e,t)=>id(e,t,!1)},resolver:{test:e=>{let t=e.split(`?`)[0].split(`.`),n=t.pop(),r=t.pop();return n===`json`&&rd.includes(r)},parse:e=>{let t=e.split(`.`);return{resolution:parseFloat(w.RETINA_PREFIX.exec(e)?.[1]??`1`),format:t[t.length-2],src:e}}},loader:{name:`spritesheetLoader`,extension:{type:U.LoadParser,priority:ks.Normal},async testParse(e,t){return B.extname(t.src).toLowerCase()===`.json`&&!!e.frames},async parse(e,t,n){let{texture:r,imageFilename:i,cachePrefix:a}=t?.data??{},o=B.dirname(t.src);o&&o.lastIndexOf(`/`)!==o.length-1&&(o+=`/`);let s;if(r&&r.baseTexture)s=r;else{let r=Cs(o+(i??e.meta.image),t.src);s=(await n.load([r]))[r]}let c=new nd({texture:s.baseTexture,data:e,resolutionFilename:t.src,cachePrefix:a});await c.parse();let l=e?.meta?.related_multi_packs;if(Array.isArray(l)){let e=[];for(let r of l){if(typeof r!=`string`)continue;let i=o+r;t.data?.ignoreMultiPack||(i=Cs(i,t.src),e.push(n.load({src:i,data:{ignoreMultiPack:!0}})))}let r=await Promise.all(e);c.linkedSheets=r,r.forEach(e=>{e.linkedSheets=[c].concat(c.linkedSheets.filter(t=>t!==e))})}return c},unload(e){e.destroy(!0)}}};W.add(ad);var od=class{constructor(){this.info=[],this.common=[],this.page=[],this.char=[],this.kerning=[],this.distanceField=[]}},sd=class{static test(e){return typeof e==`string`&&e.startsWith(`info face=`)}static parse(e){let t=e.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(let e in t){let r=t[e].match(/^[a-z]+/gm)[0],i=t[e].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),a={};for(let e in i){let t=i[e].split(`=`),n=t[0],r=t[1].replace(/"/gm,``),o=parseFloat(r);a[n]=isNaN(o)?r:o}n[r].push(a)}let r=new od;return n.info.forEach(e=>r.info.push({face:e.face,size:parseInt(e.size,10)})),n.common.forEach(e=>r.common.push({lineHeight:parseInt(e.lineHeight,10)})),n.page.forEach(e=>r.page.push({id:parseInt(e.id,10),file:e.file})),n.char.forEach(e=>r.char.push({id:parseInt(e.id,10),page:parseInt(e.page,10),x:parseInt(e.x,10),y:parseInt(e.y,10),width:parseInt(e.width,10),height:parseInt(e.height,10),xoffset:parseInt(e.xoffset,10),yoffset:parseInt(e.yoffset,10),xadvance:parseInt(e.xadvance,10)})),n.kerning.forEach(e=>r.kerning.push({first:parseInt(e.first,10),second:parseInt(e.second,10),amount:parseInt(e.amount,10)})),n.distanceField.forEach(e=>r.distanceField.push({distanceRange:parseInt(e.distanceRange,10),fieldType:e.fieldType})),r}},cd=class{static test(e){let t=e;return typeof e!=`string`&&`getElementsByTagName`in e&&t.getElementsByTagName(`page`).length&&t.getElementsByTagName(`info`)[0].getAttribute(`face`)!==null}static parse(e){let t=new od,n=e.getElementsByTagName(`info`),r=e.getElementsByTagName(`common`),i=e.getElementsByTagName(`page`),a=e.getElementsByTagName(`char`),o=e.getElementsByTagName(`kerning`),s=e.getElementsByTagName(`distanceField`);for(let e=0;e<n.length;e++)t.info.push({face:n[e].getAttribute(`face`),size:parseInt(n[e].getAttribute(`size`),10)});for(let e=0;e<r.length;e++)t.common.push({lineHeight:parseInt(r[e].getAttribute(`lineHeight`),10)});for(let e=0;e<i.length;e++)t.page.push({id:parseInt(i[e].getAttribute(`id`),10)||0,file:i[e].getAttribute(`file`)});for(let e=0;e<a.length;e++){let n=a[e];t.char.push({id:parseInt(n.getAttribute(`id`),10),page:parseInt(n.getAttribute(`page`),10)||0,x:parseInt(n.getAttribute(`x`),10),y:parseInt(n.getAttribute(`y`),10),width:parseInt(n.getAttribute(`width`),10),height:parseInt(n.getAttribute(`height`),10),xoffset:parseInt(n.getAttribute(`xoffset`),10),yoffset:parseInt(n.getAttribute(`yoffset`),10),xadvance:parseInt(n.getAttribute(`xadvance`),10)})}for(let e=0;e<o.length;e++)t.kerning.push({first:parseInt(o[e].getAttribute(`first`),10),second:parseInt(o[e].getAttribute(`second`),10),amount:parseInt(o[e].getAttribute(`amount`),10)});for(let e=0;e<s.length;e++)t.distanceField.push({fieldType:s[e].getAttribute(`fieldType`),distanceRange:parseInt(s[e].getAttribute(`distanceRange`),10)});return t}},ld=class{static test(e){return typeof e==`string`&&e.includes(`<font>`)?cd.test(w.ADAPTER.parseXML(e)):!1}static parse(e){return cd.parse(w.ADAPTER.parseXML(e))}},ud=[sd,cd,ld];function dd(e){for(let t=0;t<ud.length;t++)if(ud[t].test(e))return ud[t];return null}function fd(e,t,n,r,i,a){let o=n.fill;if(Array.isArray(o)){if(o.length===1)return o[0]}else return o;let s,c=n.dropShadow?n.dropShadowDistance:0,l=n.padding||0,u=e.width/r-c-l*2,d=e.height/r-c-l*2,f=o.slice(),p=n.fillGradientStops.slice();if(!p.length){let e=f.length+1;for(let t=1;t<e;++t)p.push(t/e)}if(f.unshift(o[0]),p.unshift(0),f.push(o[o.length-1]),p.push(1),n.fillGradientType===_u.LINEAR_VERTICAL){s=t.createLinearGradient(u/2,l,u/2,d+l);let e=0,r=(a.fontProperties.fontSize+n.strokeThickness)/d;for(let t=0;t<i.length;t++){let n=a.lineHeight*t;for(let t=0;t<f.length;t++){let i=0;i=typeof p[t]==`number`?p[t]:t/f.length;let a=n/d+i*r,o=Math.max(e,a);o=Math.min(o,1),s.addColorStop(o,f[t]),e=o}}}else{s=t.createLinearGradient(l,d/2,u+l,d/2);let e=f.length+1,n=1;for(let t=0;t<f.length;t++){let r;r=typeof p[t]==`number`?p[t]:n/e,s.addColorStop(r,f[t]),n++}}return s}function pd(e,t,n,r,i,a,o){let s=n.text,c=n.fontProperties;t.translate(r,i),t.scale(a,a);let l=o.strokeThickness/2,u=-(o.strokeThickness/2);if(t.font=o.toFontString(),t.lineWidth=o.strokeThickness,t.textBaseline=o.textBaseline,t.lineJoin=o.lineJoin,t.miterLimit=o.miterLimit,t.fillStyle=fd(e,t,o,a,[s],n),t.strokeStyle=o.stroke,o.dropShadow){let e=o.dropShadowColor,n=o.dropShadowBlur*a,r=o.dropShadowDistance*a;t.shadowColor=H.shared.setValue(e).setAlpha(o.dropShadowAlpha).toRgbaString(),t.shadowBlur=n,t.shadowOffsetX=Math.cos(o.dropShadowAngle)*r,t.shadowOffsetY=Math.sin(o.dropShadowAngle)*r}else t.shadowColor=`black`,t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0;o.stroke&&o.strokeThickness&&t.strokeText(s,l,u+n.lineHeight-c.descent),o.fill&&t.fillText(s,l,u+n.lineHeight-c.descent),t.setTransform(1,0,0,1,0,0),t.fillStyle=`rgba(0, 0, 0, 0)`}function md(e){return e.codePointAt?e.codePointAt(0):e.charCodeAt(0)}function hd(e){return Array.from?Array.from(e):e.split(``)}function gd(e){typeof e==`string`&&(e=[e]);let t=[];for(let n=0,r=e.length;n<r;n++){let r=e[n];if(Array.isArray(r)){if(r.length!==2)throw Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${r.length}.`);let e=r[0].charCodeAt(0),n=r[1].charCodeAt(0);if(n<e)throw Error(`[BitmapFont]: Invalid character range.`);for(let r=e,i=n;r<=i;r++)t.push(String.fromCharCode(r))}else t.push(...hd(r))}if(t.length===0)throw Error(`[BitmapFont]: Empty set when resolving characters.`);return t}var _d=class e{constructor(e,t,n){let[r]=e.info,[i]=e.common,[a]=e.page,[o]=e.distanceField,s=An(a.file),c={};this._ownsTextures=n,this.font=r.face,this.size=r.size,this.lineHeight=i.lineHeight/s,this.chars={},this.pageTextures=c;for(let n=0;n<e.page.length;n++){let{id:r,file:i}=e.page[n];c[r]=t instanceof Array?t[n]:t[i],o?.fieldType&&o.fieldType!==`none`&&(c[r].baseTexture.alphaMode=h.NO_PREMULTIPLIED_ALPHA,c[r].baseTexture.mipmap=m.OFF)}for(let t=0;t<e.char.length;t++){let{id:n,page:r}=e.char[t],{x:i,y:a,width:o,height:l,xoffset:u,yoffset:d,xadvance:f}=e.char[t];i/=s,a/=s,o/=s,l/=s,u/=s,d/=s,f/=s;let p=new Y(i+c[r].frame.x/s,a+c[r].frame.y/s,o,l);this.chars[n]={xOffset:u,yOffset:d,xAdvance:f,kerning:{},texture:new Q(c[r].baseTexture,p),page:r}}for(let t=0;t<e.kerning.length;t++){let{first:n,second:r,amount:i}=e.kerning[t];n/=s,r/=s,i/=s,this.chars[r]&&(this.chars[r].kerning[n]=i)}this.distanceFieldRange=o?.distanceRange,this.distanceFieldType=o?.fieldType?.toLowerCase()??`none`}destroy(){for(let e in this.chars)this.chars[e].texture.destroy(),this.chars[e].texture=null;for(let e in this.pageTextures)this._ownsTextures&&this.pageTextures[e].destroy(!0),this.pageTextures[e]=null;this.chars=null,this.pageTextures=null}static install(t,n,r){let i;if(t instanceof od)i=t;else{let e=dd(t);if(!e)throw Error(`Unrecognized data format for font.`);i=e.parse(t)}n instanceof Q&&(n=[n]);let a=new e(i,n,r);return e.available[a.font]=a,a}static uninstall(t){let n=e.available[t];if(!n)throw Error(`No font found named '${t}'`);n.destroy(),delete e.available[t]}static from(t,n,r){if(!t)throw Error("[BitmapFont] Property `name` is required.");let{chars:i,padding:a,resolution:o,textureWidth:s,textureHeight:c,...l}=Object.assign({},e.defaultOptions,r),u=gd(i),d=n instanceof Cu?n:new Cu(n),f=s,p=new od;p.info[0]={face:d.fontFamily,size:d.fontSize},p.common[0]={lineHeight:d.fontSize};let m=0,h=0,g,_,v,y=0,b=[],x=[];for(let e=0;e<u.length;e++){g||(g=w.ADAPTER.createCanvas(),g.width=s,g.height=c,_=g.getContext(`2d`),v=new G(g,{resolution:o,...l}),b.push(v),x.push(new Q(v)),p.page.push({id:x.length-1,file:``}));let t=u[e],n=bu.measureText(t,d,!1,g),r=n.width,i=Math.ceil(n.height),S=Math.ceil((d.fontStyle===`italic`?2:1)*r);if(h>=c-i*o){if(h===0)throw Error(`[BitmapFont] textureHeight ${c}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${t}')`);--e,g=null,_=null,v=null,h=0,m=0,y=0;continue}if(y=Math.max(i+n.fontProperties.descent,y),S*o+m>=f){if(m===0)throw Error(`[BitmapFont] textureWidth ${s}px is too small (fontFamily: '${d.fontFamily}', fontSize: ${d.fontSize}px, char: '${t}')`);--e,h+=y*o,h=Math.ceil(h),m=0,y=0;continue}pd(g,_,n,m,h,o,d);let C=md(n.text);p.char.push({id:C,page:x.length-1,x:m/o,y:h/o,width:S,height:i,xoffset:0,yoffset:0,xadvance:r-(d.dropShadow?d.dropShadowDistance:0)-(d.stroke?d.strokeThickness:0)}),m+=(S+2*a)*o,m=Math.ceil(m)}if(!r?.skipKerning)for(let e=0,t=u.length;e<t;e++){let n=u[e];for(let e=0;e<t;e++){let t=u[e],r=_.measureText(n).width,i=_.measureText(t).width,a=_.measureText(n+t).width-(r+i);a&&p.kerning.push({first:md(n),second:md(t),amount:a})}}let S=new e(p,x,!0);return e.available[t]!==void 0&&e.uninstall(t),e.available[t]=S,S}};_d.ALPHA=[[`a`,`z`],[`A`,`Z`],` `],_d.NUMERIC=[[`0`,`9`]],_d.ALPHANUMERIC=[[`a`,`z`],[`A`,`Z`],[`0`,`9`],` `],_d.ASCII=[[` `,`~`]],_d.defaultOptions={resolution:1,textureWidth:512,textureHeight:512,padding:4,chars:_d.ALPHANUMERIC},_d.available={};var vd=_d,yd=`// Pixi texture info\r
|
|
1084
|
+
varying vec2 vTextureCoord;\r
|
|
1085
|
+
uniform sampler2D uSampler;\r
|
|
1086
|
+
\r
|
|
1087
|
+
// Tint\r
|
|
1088
|
+
uniform vec4 uColor;\r
|
|
1089
|
+
\r
|
|
1090
|
+
// on 2D applications fwidth is screenScale / glyphAtlasScale * distanceFieldRange\r
|
|
1091
|
+
uniform float uFWidth;\r
|
|
1092
|
+
\r
|
|
1093
|
+
void main(void) {\r
|
|
1094
|
+
\r
|
|
1095
|
+
// To stack MSDF and SDF we need a non-pre-multiplied-alpha texture.\r
|
|
1096
|
+
vec4 texColor = texture2D(uSampler, vTextureCoord);\r
|
|
1097
|
+
\r
|
|
1098
|
+
// MSDF\r
|
|
1099
|
+
float median = texColor.r + texColor.g + texColor.b -\r
|
|
1100
|
+
min(texColor.r, min(texColor.g, texColor.b)) -\r
|
|
1101
|
+
max(texColor.r, max(texColor.g, texColor.b));\r
|
|
1102
|
+
// SDF\r
|
|
1103
|
+
median = min(median, texColor.a);\r
|
|
1104
|
+
\r
|
|
1105
|
+
float screenPxDistance = uFWidth * (median - 0.5);\r
|
|
1106
|
+
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);\r
|
|
1107
|
+
if (median < 0.01) {\r
|
|
1108
|
+
alpha = 0.0;\r
|
|
1109
|
+
} else if (median > 0.99) {\r
|
|
1110
|
+
alpha = 1.0;\r
|
|
1111
|
+
}\r
|
|
1112
|
+
\r
|
|
1113
|
+
// Gamma correction for coverage-like alpha\r
|
|
1114
|
+
float luma = dot(uColor.rgb, vec3(0.299, 0.587, 0.114));\r
|
|
1115
|
+
float gamma = mix(1.0, 1.0 / 2.2, luma);\r
|
|
1116
|
+
float coverage = pow(uColor.a * alpha, gamma); \r
|
|
1117
|
+
\r
|
|
1118
|
+
// NPM Textures, NPM outputs\r
|
|
1119
|
+
gl_FragColor = vec4(uColor.rgb, coverage);\r
|
|
1120
|
+
}\r
|
|
1121
|
+
`,bd=`// Mesh material default fragment\r
|
|
1122
|
+
attribute vec2 aVertexPosition;\r
|
|
1123
|
+
attribute vec2 aTextureCoord;\r
|
|
1124
|
+
\r
|
|
1125
|
+
uniform mat3 projectionMatrix;\r
|
|
1126
|
+
uniform mat3 translationMatrix;\r
|
|
1127
|
+
uniform mat3 uTextureMatrix;\r
|
|
1128
|
+
\r
|
|
1129
|
+
varying vec2 vTextureCoord;\r
|
|
1130
|
+
\r
|
|
1131
|
+
void main(void)\r
|
|
1132
|
+
{\r
|
|
1133
|
+
gl_Position = vec4((projectionMatrix * translationMatrix * vec3(aVertexPosition, 1.0)).xy, 0.0, 1.0);\r
|
|
1134
|
+
\r
|
|
1135
|
+
vTextureCoord = (uTextureMatrix * vec3(aTextureCoord, 1.0)).xy;\r
|
|
1136
|
+
}\r
|
|
1137
|
+
`,xd=[],Sd=[],Cd=[],wd=class e extends _o{constructor(t,n={}){super();let{align:r,tint:i,maxWidth:a,letterSpacing:o,fontName:s,fontSize:c}=Object.assign({},e.styleDefaults,n);if(!vd.available[s])throw Error(`Missing BitmapFont "${s}"`);this._activePagesMeshData=[],this._textWidth=0,this._textHeight=0,this._align=r,this._tintColor=new H(i),this._font=void 0,this._fontName=s,this._fontSize=c,this.text=t,this._maxWidth=a,this._maxLineHeight=0,this._letterSpacing=o,this._anchor=new vr(()=>{this.dirty=!0},this,0,0),this._roundPixels=w.ROUND_PIXELS,this.dirty=!0,this._resolution=w.RESOLUTION,this._autoResolution=!0,this._textureCache={}}updateText(){let e=vd.available[this._fontName],t=this.fontSize,n=t/e.size,r=new J,i=[],a=[],s=[],c=hd(this._text.replace(/(?:\r\n|\r)/g,`
|
|
1138
|
+
`)||` `),l=this._maxWidth*e.size/t,u=e.distanceFieldType===`none`?xd:Sd,d=null,f=0,p=0,m=0,h=-1,g=0,_=0,v=0,y=0;for(let t=0;t<c.length;t++){let n=c[t],o=md(n);if(/(?:\s)/.test(n)&&(h=t,g=f,y++),n===`\r`||n===`
|
|
1139
|
+
`){a.push(f),s.push(-1),p=Math.max(p,f),++m,++_,r.x=0,r.y+=e.lineHeight,d=null,y=0;continue}let u=e.chars[o];if(!u)continue;d&&u.kerning[d]&&(r.x+=u.kerning[d]);let b=Cd.pop()||{texture:Q.EMPTY,line:0,charCode:0,prevSpaces:0,position:new J};b.texture=u.texture,b.line=m,b.charCode=o,b.position.x=Math.round(r.x+u.xOffset+this._letterSpacing/2),b.position.y=Math.round(r.y+u.yOffset),b.prevSpaces=y,i.push(b),f=b.position.x+Math.max(u.xAdvance-u.xOffset,u.texture.orig.width),r.x+=u.xAdvance+this._letterSpacing,v=Math.max(v,u.yOffset+u.texture.height),d=o,h!==-1&&l>0&&r.x>l&&(++_,fn(i,1+h-_,1+t-h),t=h,h=-1,a.push(g),s.push(i.length>0?i[i.length-1].prevSpaces:0),p=Math.max(p,g),m++,r.x=0,r.y+=e.lineHeight,d=null,y=0)}let b=c[c.length-1];b!==`\r`&&b!==`
|
|
1140
|
+
`&&(/(?:\s)/.test(b)&&(f=g),a.push(f),p=Math.max(p,f),s.push(-1));let x=[];for(let e=0;e<=m;e++){let t=0;this._align===`right`?t=p-a[e]:this._align===`center`?t=(p-a[e])/2:this._align===`justify`&&(t=s[e]<0?0:(p-a[e])/s[e]),x.push(t)}let S=i.length,C={},w=[],T=this._activePagesMeshData;u.push(...T);for(let t=0;t<S;t++){let n=i[t].texture,r=n.baseTexture.uid;if(!C[r]){let t=u.pop();if(!t){let n=new tu,r,i;e.distanceFieldType===`none`?(r=new iu(Q.EMPTY),i=o.NORMAL):(r=new iu(Q.EMPTY,{program:Jr.from(bd,yd),uniforms:{uFWidth:0}}),i=o.NORMAL_NPM);let a=new eu(n,r);a.blendMode=i,t={index:0,indexCount:0,vertexCount:0,uvsCount:0,total:0,mesh:a,vertices:null,uvs:null,indices:null}}t.index=0,t.indexCount=0,t.vertexCount=0,t.uvsCount=0,t.total=0;let{_textureCache:i}=this;i[r]=i[r]||new Q(n.baseTexture),t.mesh.texture=i[r],t.mesh.tint=this._tintColor.value,w.push(t),C[r]=t}C[r].total++}for(let e=0;e<T.length;e++)w.includes(T[e])||this.removeChild(T[e].mesh);for(let e=0;e<w.length;e++)w[e].mesh.parent!==this&&this.addChild(w[e].mesh);this._activePagesMeshData=w;for(let e in C){let t=C[e],n=t.total;if(!(t.indices?.length>6*n)||t.vertices.length<eu.BATCHABLE_SIZE*2)t.vertices=new Float32Array(8*n),t.uvs=new Float32Array(8*n),t.indices=new Uint16Array(6*n);else{let e=t.total,n=t.vertices;for(let t=e*4*2;t<n.length;t++)n[t]=0}t.mesh.size=6*n}for(let e=0;e<S;e++){let t=i[e],r=t.position.x+x[t.line]*(this._align===`justify`?t.prevSpaces:1);this._roundPixels&&(r=Math.round(r));let a=r*n,o=t.position.y*n,s=t.texture,c=C[s.baseTexture.uid],l=s.frame,u=s._uvs,d=c.index++;c.indices[d*6+0]=0+d*4,c.indices[d*6+1]=1+d*4,c.indices[d*6+2]=2+d*4,c.indices[d*6+3]=0+d*4,c.indices[d*6+4]=2+d*4,c.indices[d*6+5]=3+d*4,c.vertices[d*8+0]=a,c.vertices[d*8+1]=o,c.vertices[d*8+2]=a+l.width*n,c.vertices[d*8+3]=o,c.vertices[d*8+4]=a+l.width*n,c.vertices[d*8+5]=o+l.height*n,c.vertices[d*8+6]=a,c.vertices[d*8+7]=o+l.height*n,c.uvs[d*8+0]=u.x0,c.uvs[d*8+1]=u.y0,c.uvs[d*8+2]=u.x1,c.uvs[d*8+3]=u.y1,c.uvs[d*8+4]=u.x2,c.uvs[d*8+5]=u.y2,c.uvs[d*8+6]=u.x3,c.uvs[d*8+7]=u.y3}this._textWidth=p*n,this._textHeight=(r.y+e.lineHeight)*n;for(let e in C){let t=C[e];if(this.anchor.x!==0||this.anchor.y!==0){let e=0,n=this._textWidth*this.anchor.x,r=this._textHeight*this.anchor.y;for(let i=0;i<t.total;i++)t.vertices[e++]-=n,t.vertices[e++]-=r,t.vertices[e++]-=n,t.vertices[e++]-=r,t.vertices[e++]-=n,t.vertices[e++]-=r,t.vertices[e++]-=n,t.vertices[e++]-=r}this._maxLineHeight=v*n;let r=t.mesh.geometry.getBuffer(`aVertexPosition`),i=t.mesh.geometry.getBuffer(`aTextureCoord`),a=t.mesh.geometry.getIndex();r.data=t.vertices,i.data=t.uvs,a.data=t.indices,r.update(),i.update(),a.update()}for(let e=0;e<i.length;e++)Cd.push(i[e]);this._font=e,this.dirty=!1}updateTransform(){this.validate(),this.containerUpdateTransform()}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0);let{distanceFieldRange:t,distanceFieldType:n,size:r}=vd.available[this._fontName];if(n!==`none`){let{a:n,b:i,c:a,d:o}=this.worldTransform,s=Math.sqrt(n*n+i*i),c=Math.sqrt(a*a+o*o),l=(Math.abs(s)+Math.abs(c))/2,u=this.fontSize/r,d=e._view.resolution;for(let e of this._activePagesMeshData)e.mesh.shader.uniforms.uFWidth=l*t*u*d}super._render(e)}getLocalBounds(){return this.validate(),super.getLocalBounds()}validate(){let e=vd.available[this._fontName];if(!e)throw Error(`Missing BitmapFont "${this._fontName}"`);this._font!==e&&(this.dirty=!0),this.dirty&&this.updateText()}get tint(){return this._tintColor.value}set tint(e){if(this.tint!==e){this._tintColor.setValue(e);for(let t=0;t<this._activePagesMeshData.length;t++)this._activePagesMeshData[t].mesh.tint=e}}get align(){return this._align}set align(e){this._align!==e&&(this._align=e,this.dirty=!0)}get fontName(){return this._fontName}set fontName(e){if(!vd.available[e])throw Error(`Missing BitmapFont "${e}"`);this._fontName!==e&&(this._fontName=e,this.dirty=!0)}get fontSize(){return this._fontSize??vd.available[this._fontName].size}set fontSize(e){this._fontSize!==e&&(this._fontSize=e,this.dirty=!0)}get anchor(){return this._anchor}set anchor(e){typeof e==`number`?this._anchor.set(e):this._anchor.copyFrom(e)}get text(){return this._text}set text(e){e=String(e??``),this._text!==e&&(this._text=e,this.dirty=!0)}get maxWidth(){return this._maxWidth}set maxWidth(e){this._maxWidth!==e&&(this._maxWidth=e,this.dirty=!0)}get maxLineHeight(){return this.validate(),this._maxLineHeight}get textWidth(){return this.validate(),this._textWidth}get letterSpacing(){return this._letterSpacing}set letterSpacing(e){this._letterSpacing!==e&&(this._letterSpacing=e,this.dirty=!0)}get roundPixels(){return this._roundPixels}set roundPixels(e){e!==this._roundPixels&&(this._roundPixels=e,this.dirty=!0)}get textHeight(){return this.validate(),this._textHeight}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}destroy(e){let{_textureCache:t}=this,n=vd.available[this._fontName].distanceFieldType===`none`?xd:Sd;n.push(...this._activePagesMeshData);for(let e of this._activePagesMeshData)this.removeChild(e.mesh);this._activePagesMeshData=[],n.filter(e=>t[e.mesh.texture.baseTexture.uid]).forEach(e=>{e.mesh.texture=Q.EMPTY});for(let e in t)t[e].destroy(),delete t[e];this._font=null,this._tintColor=null,this._textureCache=null,super.destroy(e)}};wd.styleDefaults={align:`left`,tint:16777215,maxWidth:0,letterSpacing:0};var Td=wd,Ed=[`.xml`,`.fnt`],Dd={extension:{type:U.LoadParser,priority:ks.Normal},name:`loadBitmapFont`,test(e){return Ed.includes(B.extname(e).toLowerCase())},async testParse(e){return sd.test(e)||ld.test(e)},async parse(e,t,n){let r=sd.test(e)?sd.parse(e):ld.parse(e),{src:i}=t,{page:a}=r,o=[];for(let e=0;e<a.length;++e){let t=a[e].file,n=B.join(B.dirname(i),t);n=Cs(n,i),o.push(n)}let s=await n.load(o),c=o.map(e=>s[e]);return vd.install(r,c,!0)},async load(e,t){return(await w.ADAPTER.fetch(e)).text()},unload(e){e.destroy()}};W.add(Dd);var Od=class e extends Cu{constructor(){super(...arguments),this._fonts=[],this._overrides=[],this._stylesheet=``,this.fontsDirty=!1}static from(t){return new e(Object.keys(e.defaultOptions).reduce((e,n)=>({...e,[n]:t[n]}),{}))}cleanFonts(){this._fonts.length>0&&(this._fonts.forEach(t=>{URL.revokeObjectURL(t.src),t.refs--,t.refs===0&&(t.fontFace&&document.fonts.delete(t.fontFace),delete e.availableFonts[t.originalUrl])}),this.fontFamily=`Arial`,this._fonts.length=0,this.styleID++,this.fontsDirty=!0)}loadFont(t,n={}){let{availableFonts:r}=e;if(r[t]){let e=r[t];return this._fonts.push(e),e.refs++,this.styleID++,this.fontsDirty=!0,Promise.resolve()}return w.ADAPTER.fetch(t).then(e=>e.blob()).then(async e=>new Promise((t,n)=>{let r=URL.createObjectURL(e),i=new FileReader;i.onload=()=>t([r,i.result]),i.onerror=n,i.readAsDataURL(e)})).then(async([e,i])=>{let a=Object.assign({family:B.basename(t,B.extname(t)),weight:`normal`,style:`normal`,display:`auto`,src:e,dataSrc:i,refs:1,originalUrl:t,fontFace:null},n);r[t]=a,this._fonts.push(a),this.styleID++;let o=new FontFace(a.family,`url(${a.src})`,{weight:a.weight,style:a.style,display:a.display});a.fontFace=o,await o.load(),document.fonts.add(o),await document.fonts.ready,this.styleID++,this.fontsDirty=!0})}addOverride(...e){let t=e.filter(e=>!this._overrides.includes(e));t.length>0&&(this._overrides.push(...t),this.styleID++)}removeOverride(...e){let t=e.filter(e=>this._overrides.includes(e));t.length>0&&(this._overrides=this._overrides.filter(e=>!t.includes(e)),this.styleID++)}toCSS(e){return[`transform: scale(${e})`,`transform-origin: top left`,`display: inline-block`,`color: ${this.normalizeColor(this.fill)}`,`font-size: ${this.fontSize}px`,`font-family: ${this.fontFamily}`,`font-weight: ${this.fontWeight}`,`font-style: ${this.fontStyle}`,`font-variant: ${this.fontVariant}`,`letter-spacing: ${this.letterSpacing}px`,`text-align: ${this.align}`,`padding: ${this.padding}px`,`white-space: ${this.whiteSpace}`,...this.lineHeight?[`line-height: ${this.lineHeight}px`]:[],...this.wordWrap?[`word-wrap: ${this.breakWords?`break-all`:`break-word`}`,`max-width: ${this.wordWrapWidth}px`]:[],...this.strokeThickness?[`-webkit-text-stroke-width: ${this.strokeThickness}px`,`-webkit-text-stroke-color: ${this.normalizeColor(this.stroke)}`,`text-stroke-width: ${this.strokeThickness}px`,`text-stroke-color: ${this.normalizeColor(this.stroke)}`,`paint-order: stroke`]:[],...this.dropShadow?[this.dropShadowToCSS()]:[],...this._overrides].join(`;`)}toGlobalCSS(){return this._fonts.reduce((e,t)=>`${e}
|
|
1141
|
+
@font-face {
|
|
1142
|
+
font-family: "${t.family}";
|
|
1143
|
+
src: url('${t.dataSrc}');
|
|
1144
|
+
font-weight: ${t.weight};
|
|
1145
|
+
font-style: ${t.style};
|
|
1146
|
+
font-display: ${t.display};
|
|
1147
|
+
}`,this._stylesheet)}get stylesheet(){return this._stylesheet}set stylesheet(e){this._stylesheet!==e&&(this._stylesheet=e,this.styleID++)}normalizeColor(e){return Array.isArray(e)&&(e=Xt(e)),typeof e==`number`?Jt(e):e}dropShadowToCSS(){let e=this.normalizeColor(this.dropShadowColor),t=this.dropShadowAlpha,n=Math.round(Math.cos(this.dropShadowAngle)*this.dropShadowDistance),r=Math.round(Math.sin(this.dropShadowAngle)*this.dropShadowDistance);e.startsWith(`#`)&&t<1&&(e+=(t*255|0).toString(16).padStart(2,`0`));let i=`${n}px ${r}px`;return this.dropShadowBlur>0?`text-shadow: ${i} ${this.dropShadowBlur}px ${e}`:`text-shadow: ${i} ${e}`}reset(){Object.assign(this,e.defaultOptions)}onBeforeDraw(){let{fontsDirty:e}=this;return this.fontsDirty=!1,this.isSafari&&this._fonts.length>0&&e?new Promise(e=>setTimeout(e,100)):Promise.resolve()}get isSafari(){let{userAgent:e}=w.ADAPTER.getNavigator();return/^((?!chrome|android).)*safari/i.test(e)}set fillGradientStops(e){console.warn(`[HTMLTextStyle] fillGradientStops is not supported by HTMLText`)}get fillGradientStops(){return super.fillGradientStops}set fillGradientType(e){console.warn(`[HTMLTextStyle] fillGradientType is not supported by HTMLText`)}get fillGradientType(){return super.fillGradientType}set miterLimit(e){console.warn(`[HTMLTextStyle] miterLimit is not supported by HTMLText`)}get miterLimit(){return super.miterLimit}set trim(e){console.warn(`[HTMLTextStyle] trim is not supported by HTMLText`)}get trim(){return super.trim}set textBaseline(e){console.warn(`[HTMLTextStyle] textBaseline is not supported by HTMLText`)}get textBaseline(){return super.textBaseline}set leading(e){console.warn(`[HTMLTextStyle] leading is not supported by HTMLText`)}get leading(){return super.leading}set lineJoin(e){console.warn(`[HTMLTextStyle] lineJoin is not supported by HTMLText`)}get lineJoin(){return super.lineJoin}};Od.availableFonts={},Od.defaultOptions={align:`left`,breakWords:!1,dropShadow:!1,dropShadowAlpha:1,dropShadowAngle:Math.PI/6,dropShadowBlur:0,dropShadowColor:`black`,dropShadowDistance:5,fill:`black`,fontFamily:`Arial`,fontSize:26,fontStyle:`normal`,fontVariant:`normal`,fontWeight:`normal`,letterSpacing:0,lineHeight:0,padding:0,stroke:`black`,strokeThickness:0,whiteSpace:`normal`,wordWrap:!1,wordWrapWidth:100};var kd=Od,Ad=class e extends bo{constructor(t=``,n={}){super(Q.EMPTY),this._text=null,this._style=null,this._autoResolution=!0,this.localStyleID=-1,this.dirty=!1,this._updateID=0,this.ownsStyle=!1;let r=new Image,i=Q.from(r,{scaleMode:w.SCALE_MODE,resourceOptions:{autoLoad:!1}});i.orig=new Y,i.trim=new Y,this.texture=i;let a=`http://www.w3.org/2000/svg`,o=`http://www.w3.org/1999/xhtml`,s=document.createElementNS(a,`svg`),c=document.createElementNS(a,`foreignObject`),l=document.createElementNS(o,`div`),u=document.createElementNS(o,`style`);c.setAttribute(`width`,`10000`),c.setAttribute(`height`,`10000`),c.style.overflow=`hidden`,s.appendChild(c),this.maxWidth=e.defaultMaxWidth,this.maxHeight=e.defaultMaxHeight,this._domElement=l,this._styleElement=u,this._svgRoot=s,this._foreignObject=c,this._foreignObject.appendChild(u),this._foreignObject.appendChild(l),this._image=r,this._loadImage=new Image,this._autoResolution=e.defaultAutoResolution,this._resolution=e.defaultResolution??w.RESOLUTION,this.text=t,this.style=n}measureText(e){let{text:t,style:n,resolution:r}=Object.assign({text:this._text,style:this._style,resolution:this._resolution},e);Object.assign(this._domElement,{innerHTML:t,style:n.toCSS(r)}),this._styleElement.textContent=n.toGlobalCSS(),document.body.appendChild(this._svgRoot);let i=this._domElement.getBoundingClientRect();this._svgRoot.remove();let{width:a,height:o}=i;(a>this.maxWidth||o>this.maxHeight)&&console.warn(`[HTMLText] Large expanse of text, increase HTMLText.maxWidth or HTMLText.maxHeight property.`);let s=Math.min(this.maxWidth,Math.ceil(a)),c=Math.min(this.maxHeight,Math.ceil(o));return this._svgRoot.setAttribute(`width`,s.toString()),this._svgRoot.setAttribute(`height`,c.toString()),t!==this._text&&(this._domElement.innerHTML=this._text),n!==this._style&&(Object.assign(this._domElement,{style:this._style?.toCSS(r)}),this._styleElement.textContent=this._style?.toGlobalCSS()),{width:s+n.padding*2,height:c+n.padding*2}}async updateText(e=!0){let{style:t,_image:n,_loadImage:r}=this;if(this.localStyleID!==t.styleID&&(this.dirty=!0,this.localStyleID=t.styleID),!this.dirty&&e)return;let{width:i,height:a}=this.measureText();n.width=r.width=Math.ceil(Math.max(1,i)),n.height=r.height=Math.ceil(Math.max(1,a)),this._updateID++;let o=this._updateID;await new Promise(e=>{r.onload=async()=>{if(o<this._updateID){e();return}await t.onBeforeDraw(),n.src=r.src,r.onload=null,r.src=``,this.updateTexture(),e()};let i=new XMLSerializer().serializeToString(this._svgRoot);r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(i)}`})}get source(){return this._image}updateTexture(){let{style:e,texture:t,_image:n,resolution:r}=this,{padding:i}=e,{baseTexture:a}=t;t.trim.width=t._frame.width=n.width/r,t.trim.height=t._frame.height=n.height/r,t.trim.x=-i,t.trim.y=-i,t.orig.width=t._frame.width-i*2,t.orig.height=t._frame.height-i*2,this._onTextureUpdate(),a.setRealSize(n.width,n.height,r),this.dirty=!1}_render(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._render(e)}_renderCanvas(e){this._autoResolution&&this._resolution!==e.resolution&&(this._resolution=e.resolution,this.dirty=!0),this.updateText(!0),super._renderCanvas(e)}getLocalBounds(e){return this.updateText(!0),super.getLocalBounds(e)}_calculateBounds(){this.updateText(!0),this.calculateVertices(),this._bounds.addQuad(this.vertexData)}_onStyleChange(){this.dirty=!0}destroy(t){typeof t==`boolean`&&(t={children:t}),t=Object.assign({},e.defaultDestroyOptions,t),super.destroy(t),this.ownsStyle&&this._style?.cleanFonts(),this._style=null,this._svgRoot?.remove(),this._svgRoot=null,this._domElement?.remove(),this._domElement=null,this._foreignObject?.remove(),this._foreignObject=null,this._styleElement?.remove(),this._styleElement=null,this._loadImage.src=``,this._loadImage.onload=null,this._loadImage=null,this._image.src=``,this._image=null}get width(){return this.updateText(!0),Math.abs(this.scale.x)*this._image.width/this.resolution}set width(e){this.updateText(!0);let t=pn(this.scale.x)||1;this.scale.x=t*e/this._image.width/this.resolution,this._width=e}get height(){return this.updateText(!0),Math.abs(this.scale.y)*this._image.height/this.resolution}set height(e){this.updateText(!0);let t=pn(this.scale.y)||1;this.scale.y=t*e/this._image.height/this.resolution,this._height=e}get style(){return this._style}set style(e){this._style!==e&&(e||={},e instanceof kd?(this.ownsStyle=!1,this._style=e):e instanceof Cu?(console.warn(`[HTMLText] Cloning TextStyle, if this is not what you want, use HTMLTextStyle`),this.ownsStyle=!0,this._style=kd.from(e)):(this.ownsStyle=!0,this._style=new kd(e)),this.localStyleID=-1,this.dirty=!0)}get text(){return this._text}set text(e){e=String(e===``||e==null?` `:e),e=this.sanitiseText(e),this._text!==e&&(this._text=e,this.dirty=!0)}get resolution(){return this._resolution}set resolution(e){this._autoResolution=!1,this._resolution!==e&&(this._resolution=e,this.dirty=!0)}sanitiseText(e){return e.replace(/<br>/gi,`<br/>`).replace(/<hr>/gi,`<hr/>`).replace(/ /gi,` `)}};Ad.defaultDestroyOptions={texture:!0,children:!1,baseTexture:!0},Ad.defaultMaxWidth=2024,Ad.defaultMaxHeight=2024,Ad.defaultAutoResolution=!0;var jd=Ad;export{h as ALPHA_MODES,Qa as AbstractMultiResource,ms as AccessibilityManager,wo as AlphaFilter,Gu as AnimatedSprite,gs as Application,$a as ArrayResource,fc as Assets,dc as AssetsClass,Jn as Attribute,o as BLEND_MODES,a as BUFFER_BITS,S as BUFFER_TYPE,di as BackgroundSystem,_i as BaseImageResource,zu as BasePrepare,gi as BaseRenderTexture,G as BaseTexture,Kn as BatchDrawCall,tr as BatchGeometry,oi as BatchRenderer,Qr as BatchShaderGenerator,fi as BatchSystem,$r as BatchTextureArray,vd as BitmapFont,od as BitmapFontData,Td as BitmapText,jc as BlobResource,jo as BlurFilter,Ao as BlurFilterPass,fo as Bounds,C as BrowserAdapter,K as Buffer,Un as BufferResource,Ja as BufferSystem,g as CLEAR_MODES,b as COLOR_MASK_BITS,Ds as Cache,eo as CanvasResource,or as Circle,H as Color,No as ColorMatrixFilter,Mc as CompressedTextureResource,_o as Container,mi as ContextSystem,Au as CountLimiter,no as CubeResource,ir as DEG_TO_RAD,s as DRAW_MODES,Io as DisplacementFilter,$ as DisplayObject,r as ENV,sr as Ellipse,Zo as EventBoundary,ts as EventSystem,U as ExtensionType,vl as Extract,c as FORMATS,al as FORMATS_TO_COMPONENTS,zo as FXAAFilter,rs as FederatedDisplayObject,Wo as FederatedEvent,Go as FederatedMouseEvent,Ko as FederatedPointerEvent,qo as FederatedWheelEvent,Wl as FillStyle,ui as Filter,Ei as FilterState,ki as FilterSystem,hi as Framebuffer,Mi as FramebufferSystem,_ as GC_MODES,Ai as GLFramebuffer,ra as GLProgram,ka as GLTexture,Dl as GRAPHICS_CURVES,Qi as GenerateTextureSystem,er as Geometry,Pi as GeometrySystem,Jl as Graphics,Bl as GraphicsData,Ul as GraphicsGeometry,jd as HTMLText,kd as HTMLTextStyle,na as IGLUniformData,zn as INSTALLED,Tc as INTERNAL_FORMATS,Ec as INTERNAL_FORMAT_TO_BYTES_PER_PIXEL,ro as ImageBitmapResource,vi as ImageResource,Tl as LINE_CAP,wl as LINE_JOIN,Gl as LineStyle,ks as LoaderParserPriority,y as MASK_TYPES,m as MIPMAP_MODES,x as MSAA_QUALITY,Bi as MaskData,Vi as MaskSystem,X as Matrix,eu as Mesh,Xl as MeshBatchUvs,tu as MeshGeometry,iu as MeshMaterial,Ka as MultisampleSystem,lu as NineSlicePlane,Vo as NoiseFilter,ni as ObjectRenderer,Ya as ObjectRendererSystem,vr as ObservablePoint,nr as PI_2,v as PRECISION,fu as ParticleContainer,gu as ParticleRenderer,au as PlaneGeometry,Ji as PluginSystem,J as Point,cr as Polygon,Uu as Prepare,Jr as Program,Yi as ProjectionSystem,wi as Quad,Ti as QuadUv,rr as RAD_TO_DEG,i as RENDERER_TYPE,Y as Rectangle,Si as RenderTexture,Ci as RenderTexturePool,ta as RenderTextureSystem,Za as Renderer,_s as ResizePlugin,Hn as Resource,ou as RopeGeometry,lr as RoundedRectangle,Vn as Runner,d as SAMPLER_TYPES,f as SCALE_MODES,q as SHAPES,ao as SVGResource,Ki as ScissorSystem,Zr as Shader,ha as ShaderSystem,uu as SimpleMesh,su as SimplePlane,du as SimpleRope,bo as Sprite,zi as SpriteMaskFilter,nd as Spritesheet,ga as StartupSystem,Rn as State,Ta as StateSystem,qi as StencilSystem,Ea as SystemManager,l as TARGETS,_u as TEXT_GRADIENT,u as TYPES,il as TYPES_TO_BYTES_PER_COMPONENT,ol as TYPES_TO_BYTES_PER_PIXEL,po as TemporaryDisplayObject,ku as Text,sd as TextFormat,bu as TextMetrics,Cu as TextStyle,Q as Texture,Oa as TextureGCSystem,Ii as TextureMatrix,Ma as TextureSystem,yi as TextureUvs,Ra as Ticker,za as TickerPlugin,qu as TilingSprite,ed as TilingSpriteRenderer,Wu as TimeLimiter,br as Transform,lo as TransformFeedback,Na as TransformFeedbackSystem,Fa as UPDATE_PRIORITY,Xr as UniformGroup,uo as VERSION,co as VideoResource,Pa as ViewSystem,Pn as ViewableBuffer,p as WRAP_MODES,cd as XMLFormat,ld as XMLStringFormat,is as accessibleTarget,dd as autoDetectFormat,Va as autoDetectRenderer,Bn as autoDetectResource,pc as cacheTextureArray,bs as checkDataUrl,xs as checkExtension,Ln as checkMaxIfStatementsInShader,Ss as convertToList,Cs as copySearchParams,Ts as createStringVariations,$s as createTexture,ua as createUBOElements,El as curves,Ga as defaultFilterVertex,Wa as defaultVertex,hc as detectAvif,Ac as detectCompressedTextures,vc as detectDefaults,Sc as detectMp4,Cc as detectOgv,xc as detectWebm,gc as detectWebp,W as extensions,Ho as filters,oa as generateProgram,fa as generateUniformBufferSync,Bs as getFontFamilyName,Mr as getTestContext,da as getUBOData,Yl as graphicsUtils,Z as groupD8,R as isMobile,Es as isSingleItem,Dd as loadBitmapFont,dl as loadDDS,nc as loadImageBitmap,Ms as loadJson,fl as loadKTX,oc as loadSVG,rc as loadTextures,Fs as loadTxt,lc as loadVideo,Us as loadWebFont,$c as parseDDS,sl as parseKTX,ml as resolveCompressedTextureUrl,wc as resolveTextureUrl,w as settings,ad as spritesheetAsset,Er as uniformParsers,Wr as unsafeEvalSupported,jn as utils};
|