Files
nothoughts/node_modules/pixi.js/dist/webworker.min.mjs
2025-08-04 18:57:35 +02:00

2022 lines
656 KiB
JavaScript

/*!
* PixiJS - v8.4.1
* Compiled Thu, 19 Sep 2024 10:28:58 UTC
*
* PixiJS is licensed under the MIT License.
* http://www.opensource.org/licenses/mit-license
*/const $x={createCanvas:(r,t)=>{const e=document.createElement("canvas");return e.width=r,e.height=t,e},getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>{var r;return(r=document.baseURI)!=null?r:window.location.href},getFontFaceSet:()=>document.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new DOMParser().parseFromString(r,"text/xml")};let Ac=$x;const L={get(){return Ac},set(r){Ac=r}};var FR=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function ks(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function UR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function kR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function NR(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function s(){return this instanceof s?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(s){var i=Object.getOwnPropertyDescriptor(r,s);Object.defineProperty(e,s,i.get?i:{enumerable:!0,get:function(){return r[s]}})}),e}var $n={},Jt={},te={};function Hx(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var s=0;s<r.length;s++)if(Object.prototype.hasOwnProperty.call(r,s)){var i=r[s];if(t.call(void 0,i,s,r))return i}}function Hn(r,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(r):r}function Xx(r,t){if(r===null||typeof r!="object")throw new TypeError("target is not an object");for(var e in t)Object.prototype.hasOwnProperty.call(t,e)&&(r[e]=t[e]);return r}var Sc=Hn({HTML:"text/html",isHTML:function(r){return r===Sc.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Ec=Hn({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(r){return r===Ec.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),LR=te.assign=Xx,$R=te.find=Hx,HR=te.freeze=Hn,XR=te.MIME_TYPE=Sc,zR=te.NAMESPACE=Ec,wc=te,zt=wc.find,Mr=wc.NAMESPACE;function zx(r){return r!==""}function jx(r){return r?r.split(/[\t\n\f\r ]+/).filter(zx):[]}function Vx(r,t){return r.hasOwnProperty(t)||(r[t]=!0),r}function Cc(r){if(!r)return[];var t=jx(r);return Object.keys(t.reduce(Vx,{}))}function Wx(r){return function(t){return r&&r.indexOf(t)!==-1}}function Or(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function bt(r,t){var e=r.prototype;if(!(e instanceof t)){let s=function(){};s.prototype=t.prototype,s=new s,Or(e,s),r.prototype=e=s}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var xt={},kt=xt.ELEMENT_NODE=1,ze=xt.ATTRIBUTE_NODE=2,Ns=xt.TEXT_NODE=3,Rc=xt.CDATA_SECTION_NODE=4,Pc=xt.ENTITY_REFERENCE_NODE=5,Yx=xt.ENTITY_NODE=6,Dc=xt.PROCESSING_INSTRUCTION_NODE=7,Mc=xt.COMMENT_NODE=8,Oc=xt.DOCUMENT_NODE=9,Bc=xt.DOCUMENT_TYPE_NODE=10,ee=xt.DOCUMENT_FRAGMENT_NODE=11,qx=xt.NOTATION_NODE=12,ft={},ut={},jR=ft.INDEX_SIZE_ERR=(ut[1]="Index size error",1),VR=ft.DOMSTRING_SIZE_ERR=(ut[2]="DOMString size error",2),yt=ft.HIERARCHY_REQUEST_ERR=(ut[3]="Hierarchy request error",3),WR=ft.WRONG_DOCUMENT_ERR=(ut[4]="Wrong document",4),YR=ft.INVALID_CHARACTER_ERR=(ut[5]="Invalid character",5),qR=ft.NO_DATA_ALLOWED_ERR=(ut[6]="No data allowed",6),KR=ft.NO_MODIFICATION_ALLOWED_ERR=(ut[7]="No modification allowed",7),Gc=ft.NOT_FOUND_ERR=(ut[8]="Not found",8),ZR=ft.NOT_SUPPORTED_ERR=(ut[9]="Not supported",9),Ic=ft.INUSE_ATTRIBUTE_ERR=(ut[10]="Attribute in use",10),QR=ft.INVALID_STATE_ERR=(ut[11]="Invalid state",11),JR=ft.SYNTAX_ERR=(ut[12]="Syntax error",12),tP=ft.INVALID_MODIFICATION_ERR=(ut[13]="Invalid modification",13),eP=ft.NAMESPACE_ERR=(ut[14]="Invalid namespace",14),rP=ft.INVALID_ACCESS_ERR=(ut[15]="Invalid access",15);function st(r,t){if(t instanceof Error)var e=t;else e=this,Error.call(this,ut[r]),this.message=ut[r],Error.captureStackTrace&&Error.captureStackTrace(this,st);return e.code=r,t&&(this.message=this.message+": "+t),e}st.prototype=Error.prototype,Or(ft,st);function re(){}re.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r,t){for(var e=[],s=0;s<this.length;s++)Ve(this[s],e,r,t);return e.join("")},filter:function(r){return Array.prototype.filter.call(this,r)},indexOf:function(r){return Array.prototype.indexOf.call(this,r)}};function je(r,t){this._node=r,this._refresh=t,Xn(this)}function Xn(r){var t=r._node._inc||r._node.ownerDocument._inc;if(r._inc!==t){var e=r._refresh(r._node);if(Qc(r,"length",e.length),!r.$$length||e.length<r.$$length)for(var s=e.length;s in r;s++)Object.prototype.hasOwnProperty.call(r,s)&&delete r[s];Or(e,r),r._inc=t}}je.prototype.item=function(r){return Xn(this),this[r]||null},bt(je,re);function Ls(){}function Fc(r,t){for(var e=r.length;e--;)if(r[e]===t)return e}function Uc(r,t,e,s){if(s?t[Fc(t,s)]=e:t[t.length++]=e,r){e.ownerElement=r;var i=r.ownerDocument;i&&(s&&$c(i,r,s),Kx(i,r,e))}}function kc(r,t,e){var s=Fc(t,e);if(s>=0){for(var i=t.length-1;s<i;)t[s]=t[++s];if(t.length=i,r){var n=r.ownerDocument;n&&($c(n,r,e),e.ownerElement=null)}}else throw new st(Gc,new Error(r.tagName+"@"+e))}Ls.prototype={length:0,item:re.prototype.item,getNamedItem:function(r){for(var t=this.length;t--;){var e=this[t];if(e.nodeName==r)return e}},setNamedItem:function(r){var t=r.ownerElement;if(t&&t!=this._ownerElement)throw new st(Ic);var e=this.getNamedItem(r.nodeName);return Uc(this._ownerElement,this,r,e),e},setNamedItemNS:function(r){var t=r.ownerElement,e;if(t&&t!=this._ownerElement)throw new st(Ic);return e=this.getNamedItemNS(r.namespaceURI,r.localName),Uc(this._ownerElement,this,r,e),e},removeNamedItem:function(r){var t=this.getNamedItem(r);return kc(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);return kc(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){for(var e=this.length;e--;){var s=this[e];if(s.localName==t&&s.namespaceURI==r)return s}return null}};function Nc(){}Nc.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var s=new Gr;if(s.implementation=this,s.childNodes=new re,s.doctype=e||null,e&&s.appendChild(e),t){var i=s.createElementNS(r,t);s.appendChild(i)}return s},createDocumentType:function(r,t,e){var s=new Xs;return s.name=r,s.nodeName=r,s.publicId=t||"",s.systemId=e||"",s}};function Y(){}Y.prototype={firstChild:null,lastChild:null,previousSibling:null,nextSibling:null,attributes:null,parentNode:null,childNodes:null,ownerDocument:null,nodeValue:null,namespaceURI:null,prefix:null,localName:null,insertBefore:function(r,t){return $s(this,r,t)},replaceChild:function(r,t){$s(this,r,t,jc),t&&this.removeChild(t)},removeChild:function(r){return Hc(this,r)},appendChild:function(r){return this.insertBefore(r,null)},hasChildNodes:function(){return this.firstChild!=null},cloneNode:function(r){return Qn(this.ownerDocument||this,this,r)},normalize:function(){for(var r=this.firstChild;r;){var t=r.nextSibling;t&&t.nodeType==Ns&&r.nodeType==Ns?(this.removeChild(t),r.appendData(t.data)):(r.normalize(),r=t)}},isSupported:function(r,t){return this.ownerDocument.implementation.hasFeature(r,t)},hasAttributes:function(){return this.attributes.length>0},lookupPrefix:function(r){for(var t=this;t;){var e=t._nsMap;if(e){for(var s in e)if(Object.prototype.hasOwnProperty.call(e,s)&&e[s]===r)return s}t=t.nodeType==ze?t.ownerDocument:t.parentNode}return null},lookupNamespaceURI:function(r){for(var t=this;t;){var e=t._nsMap;if(e&&Object.prototype.hasOwnProperty.call(e,r))return e[r];t=t.nodeType==ze?t.ownerDocument:t.parentNode}return null},isDefaultNamespace:function(r){var t=this.lookupPrefix(r);return t==null}};function Lc(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}Or(xt,Y),Or(xt,Y.prototype);function Br(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Br(r,t))return!0;while(r=r.nextSibling)}function Gr(){this.ownerDocument=this}function Kx(r,t,e){r&&r._inc++;var s=e.namespaceURI;s===Mr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function $c(r,t,e,s){r&&r._inc++;var i=e.namespaceURI;i===Mr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function zn(r,t,e){if(r&&r._inc){r._inc++;var s=t.childNodes;if(e)s[s.length++]=e;else{for(var i=t.firstChild,n=0;i;)s[n++]=i,i=i.nextSibling;s.length=n,delete s[s.length]}}}function Hc(r,t){var e=t.previousSibling,s=t.nextSibling;return e?e.nextSibling=s:r.firstChild=s,s?s.previousSibling=e:r.lastChild=e,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,zn(r.ownerDocument,r),t}function Zx(r){return r&&(r.nodeType===Y.DOCUMENT_NODE||r.nodeType===Y.DOCUMENT_FRAGMENT_NODE||r.nodeType===Y.ELEMENT_NODE)}function Qx(r){return r&&(jt(r)||jn(r)||se(r)||r.nodeType===Y.DOCUMENT_FRAGMENT_NODE||r.nodeType===Y.COMMENT_NODE||r.nodeType===Y.PROCESSING_INSTRUCTION_NODE)}function se(r){return r&&r.nodeType===Y.DOCUMENT_TYPE_NODE}function jt(r){return r&&r.nodeType===Y.ELEMENT_NODE}function jn(r){return r&&r.nodeType===Y.TEXT_NODE}function Xc(r,t){var e=r.childNodes||[];if(zt(e,jt)||se(t))return!1;var s=zt(e,se);return!(t&&s&&e.indexOf(s)>e.indexOf(t))}function zc(r,t){var e=r.childNodes||[];function s(n){return jt(n)&&n!==t}if(zt(e,s))return!1;var i=zt(e,se);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function Jx(r,t,e){if(!Zx(r))throw new st(yt,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new st(Gc,"child not in parent");if(!Qx(t)||se(t)&&r.nodeType!==Y.DOCUMENT_NODE)throw new st(yt,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function ty(r,t,e){var s=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var n=i.filter(jt);if(n.length>1||zt(i,jn))throw new st(yt,"More than one element or text in fragment");if(n.length===1&&!Xc(r,e))throw new st(yt,"Element in fragment can not be inserted before doctype")}if(jt(t)&&!Xc(r,e))throw new st(yt,"Only one element can be added and only after doctype");if(se(t)){if(zt(s,se))throw new st(yt,"Only one doctype is allowed");var o=zt(s,jt);if(e&&s.indexOf(o)<s.indexOf(e))throw new st(yt,"Doctype can only be inserted before an element");if(!e&&o)throw new st(yt,"Doctype can not be appended since element is present")}}function jc(r,t,e){var s=r.childNodes||[],i=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var n=i.filter(jt);if(n.length>1||zt(i,jn))throw new st(yt,"More than one element or text in fragment");if(n.length===1&&!zc(r,e))throw new st(yt,"Element in fragment can not be inserted before doctype")}if(jt(t)&&!zc(r,e))throw new st(yt,"Only one element can be added and only after doctype");if(se(t)){if(zt(s,function(u){return se(u)&&u!==e}))throw new st(yt,"Only one doctype is allowed");var o=zt(s,jt);if(e&&s.indexOf(o)<s.indexOf(e))throw new st(yt,"Doctype can only be inserted before an element")}}function $s(r,t,e,s){Jx(r,t,e),r.nodeType===Y.DOCUMENT_NODE&&(s||ty)(r,t,e);var i=t.parentNode;if(i&&i.removeChild(t),t.nodeType===ee){var n=t.firstChild;if(n==null)return t;var o=t.lastChild}else n=o=t;var a=e?e.previousSibling:r.lastChild;n.previousSibling=a,o.nextSibling=e,a?a.nextSibling=n:r.firstChild=n,e==null?r.lastChild=o:e.previousSibling=o;do n.parentNode=r;while(n!==o&&(n=n.nextSibling));return zn(r.ownerDocument||r,r),t.nodeType==ee&&(t.firstChild=t.lastChild=null),t}function ey(r,t){return t.parentNode&&t.parentNode.removeChild(t),t.parentNode=r,t.previousSibling=r.lastChild,t.nextSibling=null,t.previousSibling?t.previousSibling.nextSibling=t:r.firstChild=t,r.lastChild=t,zn(r.ownerDocument,r,t),t}Gr.prototype={nodeName:"#document",nodeType:Oc,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType==ee){for(var e=r.firstChild;e;){var s=e.nextSibling;this.insertBefore(e,t),e=s}return r}return $s(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===kt&&(this.documentElement=r),r},removeChild:function(r){return this.documentElement==r&&(this.documentElement=null),Hc(this,r)},replaceChild:function(r,t){$s(this,r,t,jc),r.ownerDocument=this,t&&this.removeChild(t),jt(r)&&(this.documentElement=r)},importNode:function(r,t){return Zc(this,r,t)},getElementById:function(r){var t=null;return Br(this.documentElement,function(e){if(e.nodeType==kt&&e.getAttribute("id")==r)return t=e,!0}),t},getElementsByClassName:function(r){var t=Cc(r);return new je(this,function(e){var s=[];return t.length>0&&Br(e.documentElement,function(i){if(i!==e&&i.nodeType===kt){var n=i.getAttribute("class");if(n){var o=r===n;if(!o){var a=Cc(n);o=t.every(Wx(a))}o&&s.push(i)}}}),s})},createElement:function(r){var t=new Ce;t.ownerDocument=this,t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new re;var e=t.attributes=new Ls;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new zs;return r.ownerDocument=this,r.childNodes=new re,r},createTextNode:function(r){var t=new Vn;return t.ownerDocument=this,t.appendData(r),t},createComment:function(r){var t=new Wn;return t.ownerDocument=this,t.appendData(r),t},createCDATASection:function(r){var t=new Yn;return t.ownerDocument=this,t.appendData(r),t},createProcessingInstruction:function(r,t){var e=new Kn;return e.ownerDocument=this,e.tagName=e.nodeName=e.target=r,e.nodeValue=e.data=t,e},createAttribute:function(r){var t=new Hs;return t.ownerDocument=this,t.name=r,t.nodeName=r,t.localName=r,t.specified=!0,t},createEntityReference:function(r){var t=new qn;return t.ownerDocument=this,t.nodeName=r,t},createElementNS:function(r,t){var e=new Ce,s=t.split(":"),i=e.attributes=new Ls;return e.childNodes=new re,e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.namespaceURI=r,s.length==2?(e.prefix=s[0],e.localName=s[1]):e.localName=t,i._ownerElement=e,e},createAttributeNS:function(r,t){var e=new Hs,s=t.split(":");return e.ownerDocument=this,e.nodeName=t,e.name=t,e.namespaceURI=r,e.specified=!0,s.length==2?(e.prefix=s[0],e.localName=s[1]):e.localName=t,e}},bt(Gr,Y);function Ce(){this._nsMap={}}Ce.prototype={nodeType:kt,hasAttribute:function(r){return this.getAttributeNode(r)!=null},getAttribute:function(r){var t=this.getAttributeNode(r);return t&&t.value||""},getAttributeNode:function(r){return this.attributes.getNamedItem(r)},setAttribute:function(r,t){var e=this.ownerDocument.createAttribute(r);e.value=e.nodeValue=""+t,this.setAttributeNode(e)},removeAttribute:function(r){var t=this.getAttributeNode(r);t&&this.removeAttributeNode(t)},appendChild:function(r){return r.nodeType===ee?this.insertBefore(r,null):ey(this,r)},setAttributeNode:function(r){return this.attributes.setNamedItem(r)},setAttributeNodeNS:function(r){return this.attributes.setNamedItemNS(r)},removeAttributeNode:function(r){return this.attributes.removeNamedItem(r.nodeName)},removeAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);e&&this.removeAttributeNode(e)},hasAttributeNS:function(r,t){return this.getAttributeNodeNS(r,t)!=null},getAttributeNS:function(r,t){var e=this.getAttributeNodeNS(r,t);return e&&e.value||""},setAttributeNS:function(r,t,e){var s=this.ownerDocument.createAttributeNS(r,t);s.value=s.nodeValue=""+e,this.setAttributeNode(s)},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByTagName:function(r){return new je(this,function(t){var e=[];return Br(t,function(s){s!==t&&s.nodeType==kt&&(r==="*"||s.tagName==r)&&e.push(s)}),e})},getElementsByTagNameNS:function(r,t){return new je(this,function(e){var s=[];return Br(e,function(i){i!==e&&i.nodeType===kt&&(r==="*"||i.namespaceURI===r)&&(t==="*"||i.localName==t)&&s.push(i)}),s})}},Gr.prototype.getElementsByTagName=Ce.prototype.getElementsByTagName,Gr.prototype.getElementsByTagNameNS=Ce.prototype.getElementsByTagNameNS,bt(Ce,Y);function Hs(){}Hs.prototype.nodeType=ze,bt(Hs,Y);function Ir(){}Ir.prototype={data:"",substringData:function(r,t){return this.data.substring(r,r+t)},appendData:function(r){r=this.data+r,this.nodeValue=this.data=r,this.length=r.length},insertData:function(r,t){this.replaceData(r,0,t)},appendChild:function(r){throw new Error(ut[yt])},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var s=this.data.substring(0,r),i=this.data.substring(r+t);e=s+e+i,this.nodeValue=this.data=e,this.length=e.length}},bt(Ir,Y);function Vn(){}Vn.prototype={nodeName:"#text",nodeType:Ns,splitText:function(r){var t=this.data,e=t.substring(r);t=t.substring(0,r),this.data=this.nodeValue=t,this.length=t.length;var s=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(s,this.nextSibling),s}},bt(Vn,Ir);function Wn(){}Wn.prototype={nodeName:"#comment",nodeType:Mc},bt(Wn,Ir);function Yn(){}Yn.prototype={nodeName:"#cdata-section",nodeType:Rc},bt(Yn,Ir);function Xs(){}Xs.prototype.nodeType=Bc,bt(Xs,Y);function Vc(){}Vc.prototype.nodeType=qx,bt(Vc,Y);function Wc(){}Wc.prototype.nodeType=Yx,bt(Wc,Y);function qn(){}qn.prototype.nodeType=Pc,bt(qn,Y);function zs(){}zs.prototype.nodeName="#document-fragment",zs.prototype.nodeType=ee,bt(zs,Y);function Kn(){}Kn.prototype.nodeType=Dc,bt(Kn,Y);function Yc(){}Yc.prototype.serializeToString=function(r,t,e){return qc.call(r,t,e)},Y.prototype.toString=qc;function qc(r,t){var e=[],s=this.nodeType==9&&this.documentElement||this,i=s.prefix,n=s.namespaceURI;if(n&&i==null){var i=s.lookupPrefix(n);if(i==null)var o=[{namespace:n,prefix:null}]}return Ve(this,e,r,t,o),e.join("")}function Kc(r,t,e){var s=r.prefix||"",i=r.namespaceURI;if(!i||s==="xml"&&i===Mr.XML||i===Mr.XMLNS)return!1;for(var n=e.length;n--;){var o=e[n];if(o.prefix===s)return o.namespace!==i}return!0}function Zn(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,Lc),'"')}function Ve(r,t,e,s,i){if(i||(i=[]),s)if(r=s(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case kt:var n=r.attributes,o=n.length,_=r.firstChild,a=r.tagName;e=Mr.isHTML(r.namespaceURI)||e;var u=a;if(!e&&!r.prefix&&r.namespaceURI){for(var l,c=0;c<n.length;c++)if(n.item(c).name==="xmlns"){l=n.item(c).value;break}if(!l)for(var h=i.length-1;h>=0;h--){var d=i[h];if(d.prefix===""&&d.namespace===r.namespaceURI){l=d.namespace;break}}if(l!==r.namespaceURI)for(var h=i.length-1;h>=0;h--){var d=i[h];if(d.namespace===r.namespaceURI){d.prefix&&(u=d.prefix+":"+a);break}}}t.push("<",u);for(var p=0;p<o;p++){var f=n.item(p);f.prefix=="xmlns"?i.push({prefix:f.localName,namespace:f.value}):f.nodeName=="xmlns"&&i.push({prefix:"",namespace:f.value})}for(var p=0;p<o;p++){var f=n.item(p);if(Kc(f,e,i)){var g=f.prefix||"",m=f.namespaceURI;Zn(t,g?"xmlns:"+g:"xmlns",m),i.push({prefix:g,namespace:m})}Ve(f,t,e,s,i)}if(a===u&&Kc(r,e,i)){var g=r.prefix||"",m=r.namespaceURI;Zn(t,g?"xmlns:"+g:"xmlns",m),i.push({prefix:g,namespace:m})}if(_||e&&!/^(?:meta|link|img|br|hr|input)$/i.test(a)){if(t.push(">"),e&&/^script$/i.test(a))for(;_;)_.data?t.push(_.data):Ve(_,t,e,s,i.slice()),_=_.nextSibling;else for(;_;)Ve(_,t,e,s,i.slice()),_=_.nextSibling;t.push("</",u,">")}else t.push("/>");return;case Oc:case ee:for(var _=r.firstChild;_;)Ve(_,t,e,s,i.slice()),_=_.nextSibling;return;case ze:return Zn(t,r.name,r.value);case Ns:return t.push(r.data.replace(/[<&>]/g,Lc));case Rc:return t.push("<![CDATA[",r.data,"]]>");case Mc:return t.push("<!--",r.data,"-->");case Bc:var x=r.publicId,b=r.systemId;if(t.push("<!DOCTYPE ",r.name),x)t.push(" PUBLIC ",x),b&&b!="."&&t.push(" ",b),t.push(">");else if(b&&b!=".")t.push(" SYSTEM ",b,">");else{var v=r.internalSubset;v&&t.push(" [",v,"]"),t.push(">")}return;case Dc:return t.push("<?",r.target," ",r.data,"?>");case Pc:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function Zc(r,t,e){var s;switch(t.nodeType){case kt:s=t.cloneNode(!1),s.ownerDocument=r;case ee:break;case ze:e=!0;break}if(s||(s=t.cloneNode(!1)),s.ownerDocument=r,s.parentNode=null,e)for(var i=t.firstChild;i;)s.appendChild(Zc(r,i,e)),i=i.nextSibling;return s}function Qn(r,t,e){var s=new t.constructor;for(var i in t)if(Object.prototype.hasOwnProperty.call(t,i)){var n=t[i];typeof n!="object"&&n!=s[i]&&(s[i]=n)}switch(t.childNodes&&(s.childNodes=new re),s.ownerDocument=r,s.nodeType){case kt:var o=t.attributes,a=s.attributes=new Ls,u=o.length;a._ownerElement=s;for(var l=0;l<u;l++)s.setAttributeNode(Qn(r,o.item(l),!0));break;case ze:e=!0}if(e)for(var c=t.firstChild;c;)s.appendChild(Qn(r,c,e)),c=c.nextSibling;return s}function Qc(r,t,e){r[t]=e}try{if(Object.defineProperty){let r=function(t){switch(t.nodeType){case kt:case ee:var e=[];for(t=t.firstChild;t;)t.nodeType!==7&&t.nodeType!==8&&e.push(r(t)),t=t.nextSibling;return e.join("");default:return t.nodeValue}};Object.defineProperty(je.prototype,"length",{get:function(){return Xn(this),this.$$length}}),Object.defineProperty(Y.prototype,"textContent",{get:function(){return r(this)},set:function(t){switch(this.nodeType){case kt:case ee:for(;this.firstChild;)this.removeChild(this.firstChild);(t||String(t))&&this.appendChild(this.ownerDocument.createTextNode(t));break;default:this.data=t,this.value=t,this.nodeValue=t}}}),Qc=function(t,e,s){t["$$"+e]=s}}}catch(r){}var sP=Jt.DocumentType=Xs,iP=Jt.DOMException=st,nP=Jt.DOMImplementation=Nc,oP=Jt.Element=Ce,aP=Jt.Node=Y,uP=Jt.NodeList=re,lP=Jt.XMLSerializer=Yc,js={},Jn={};(function(r){"use strict";var t=te.freeze;r.XML_ENTITIES=t({amp:"&",apos:"'",gt:">",lt:"<",quot:'"'}),r.HTML_ENTITIES=t({Aacute:"\xC1",aacute:"\xE1",Abreve:"\u0102",abreve:"\u0103",ac:"\u223E",acd:"\u223F",acE:"\u223E\u0333",Acirc:"\xC2",acirc:"\xE2",acute:"\xB4",Acy:"\u0410",acy:"\u0430",AElig:"\xC6",aelig:"\xE6",af:"\u2061",Afr:"\u{1D504}",afr:"\u{1D51E}",Agrave:"\xC0",agrave:"\xE0",alefsym:"\u2135",aleph:"\u2135",Alpha:"\u0391",alpha:"\u03B1",Amacr:"\u0100",amacr:"\u0101",amalg:"\u2A3F",AMP:"&",amp:"&",And:"\u2A53",and:"\u2227",andand:"\u2A55",andd:"\u2A5C",andslope:"\u2A58",andv:"\u2A5A",ang:"\u2220",ange:"\u29A4",angle:"\u2220",angmsd:"\u2221",angmsdaa:"\u29A8",angmsdab:"\u29A9",angmsdac:"\u29AA",angmsdad:"\u29AB",angmsdae:"\u29AC",angmsdaf:"\u29AD",angmsdag:"\u29AE",angmsdah:"\u29AF",angrt:"\u221F",angrtvb:"\u22BE",angrtvbd:"\u299D",angsph:"\u2222",angst:"\xC5",angzarr:"\u237C",Aogon:"\u0104",aogon:"\u0105",Aopf:"\u{1D538}",aopf:"\u{1D552}",ap:"\u2248",apacir:"\u2A6F",apE:"\u2A70",ape:"\u224A",apid:"\u224B",apos:"'",ApplyFunction:"\u2061",approx:"\u2248",approxeq:"\u224A",Aring:"\xC5",aring:"\xE5",Ascr:"\u{1D49C}",ascr:"\u{1D4B6}",Assign:"\u2254",ast:"*",asymp:"\u2248",asympeq:"\u224D",Atilde:"\xC3",atilde:"\xE3",Auml:"\xC4",auml:"\xE4",awconint:"\u2233",awint:"\u2A11",backcong:"\u224C",backepsilon:"\u03F6",backprime:"\u2035",backsim:"\u223D",backsimeq:"\u22CD",Backslash:"\u2216",Barv:"\u2AE7",barvee:"\u22BD",Barwed:"\u2306",barwed:"\u2305",barwedge:"\u2305",bbrk:"\u23B5",bbrktbrk:"\u23B6",bcong:"\u224C",Bcy:"\u0411",bcy:"\u0431",bdquo:"\u201E",becaus:"\u2235",Because:"\u2235",because:"\u2235",bemptyv:"\u29B0",bepsi:"\u03F6",bernou:"\u212C",Bernoullis:"\u212C",Beta:"\u0392",beta:"\u03B2",beth:"\u2136",between:"\u226C",Bfr:"\u{1D505}",bfr:"\u{1D51F}",bigcap:"\u22C2",bigcirc:"\u25EF",bigcup:"\u22C3",bigodot:"\u2A00",bigoplus:"\u2A01",bigotimes:"\u2A02",bigsqcup:"\u2A06",bigstar:"\u2605",bigtriangledown:"\u25BD",bigtriangleup:"\u25B3",biguplus:"\u2A04",bigvee:"\u22C1",bigwedge:"\u22C0",bkarow:"\u290D",blacklozenge:"\u29EB",blacksquare:"\u25AA",blacktriangle:"\u25B4",blacktriangledown:"\u25BE",blacktriangleleft:"\u25C2",blacktriangleright:"\u25B8",blank:"\u2423",blk12:"\u2592",blk14:"\u2591",blk34:"\u2593",block:"\u2588",bne:"=\u20E5",bnequiv:"\u2261\u20E5",bNot:"\u2AED",bnot:"\u2310",Bopf:"\u{1D539}",bopf:"\u{1D553}",bot:"\u22A5",bottom:"\u22A5",bowtie:"\u22C8",boxbox:"\u29C9",boxDL:"\u2557",boxDl:"\u2556",boxdL:"\u2555",boxdl:"\u2510",boxDR:"\u2554",boxDr:"\u2553",boxdR:"\u2552",boxdr:"\u250C",boxH:"\u2550",boxh:"\u2500",boxHD:"\u2566",boxHd:"\u2564",boxhD:"\u2565",boxhd:"\u252C",boxHU:"\u2569",boxHu:"\u2567",boxhU:"\u2568",boxhu:"\u2534",boxminus:"\u229F",boxplus:"\u229E",boxtimes:"\u22A0",boxUL:"\u255D",boxUl:"\u255C",boxuL:"\u255B",boxul:"\u2518",boxUR:"\u255A",boxUr:"\u2559",boxuR:"\u2558",boxur:"\u2514",boxV:"\u2551",boxv:"\u2502",boxVH:"\u256C",boxVh:"\u256B",boxvH:"\u256A",boxvh:"\u253C",boxVL:"\u2563",boxVl:"\u2562",boxvL:"\u2561",boxvl:"\u2524",boxVR:"\u2560",boxVr:"\u255F",boxvR:"\u255E",boxvr:"\u251C",bprime:"\u2035",Breve:"\u02D8",breve:"\u02D8",brvbar:"\xA6",Bscr:"\u212C",bscr:"\u{1D4B7}",bsemi:"\u204F",bsim:"\u223D",bsime:"\u22CD",bsol:"\\",bsolb:"\u29C5",bsolhsub:"\u27C8",bull:"\u2022",bullet:"\u2022",bump:"\u224E",bumpE:"\u2AAE",bumpe:"\u224F",Bumpeq:"\u224E",bumpeq:"\u224F",Cacute:"\u0106",cacute:"\u0107",Cap:"\u22D2",cap:"\u2229",capand:"\u2A44",capbrcup:"\u2A49",capcap:"\u2A4B",capcup:"\u2A47",capdot:"\u2A40",CapitalDifferentialD:"\u2145",caps:"\u2229\uFE00",caret:"\u2041",caron:"\u02C7",Cayleys:"\u212D",ccaps:"\u2A4D",Ccaron:"\u010C",ccaron:"\u010D",Ccedil:"\xC7",ccedil:"\xE7",Ccirc:"\u0108",ccirc:"\u0109",Cconint:"\u2230",ccups:"\u2A4C",ccupssm:"\u2A50",Cdot:"\u010A",cdot:"\u010B",cedil:"\xB8",Cedilla:"\xB8",cemptyv:"\u29B2",cent:"\xA2",CenterDot:"\xB7",centerdot:"\xB7",Cfr:"\u212D",cfr:"\u{1D520}",CHcy:"\u0427",chcy:"\u0447",check:"\u2713",checkmark:"\u2713",Chi:"\u03A7",chi:"\u03C7",cir:"\u25CB",circ:"\u02C6",circeq:"\u2257",circlearrowleft:"\u21BA",circlearrowright:"\u21BB",circledast:"\u229B",circledcirc:"\u229A",circleddash:"\u229D",CircleDot:"\u2299",circledR:"\xAE",circledS:"\u24C8",CircleMinus:"\u2296",CirclePlus:"\u2295",CircleTimes:"\u2297",cirE:"\u29C3",cire:"\u2257",cirfnint:"\u2A10",cirmid:"\u2AEF",cirscir:"\u29C2",ClockwiseContourIntegral:"\u2232",CloseCurlyDoubleQuote:"\u201D",CloseCurlyQuote:"\u2019",clubs:"\u2663",clubsuit:"\u2663",Colon:"\u2237",colon:":",Colone:"\u2A74",colone:"\u2254",coloneq:"\u2254",comma:",",commat:"@",comp:"\u2201",compfn:"\u2218",complement:"\u2201",complexes:"\u2102",cong:"\u2245",congdot:"\u2A6D",Congruent:"\u2261",Conint:"\u222F",conint:"\u222E",ContourIntegral:"\u222E",Copf:"\u2102",copf:"\u{1D554}",coprod:"\u2210",Coproduct:"\u2210",COPY:"\xA9",copy:"\xA9",copysr:"\u2117",CounterClockwiseContourIntegral:"\u2233",crarr:"\u21B5",Cross:"\u2A2F",cross:"\u2717",Cscr:"\u{1D49E}",cscr:"\u{1D4B8}",csub:"\u2ACF",csube:"\u2AD1",csup:"\u2AD0",csupe:"\u2AD2",ctdot:"\u22EF",cudarrl:"\u2938",cudarrr:"\u2935",cuepr:"\u22DE",cuesc:"\u22DF",cularr:"\u21B6",cularrp:"\u293D",Cup:"\u22D3",cup:"\u222A",cupbrcap:"\u2A48",CupCap:"\u224D",cupcap:"\u2A46",cupcup:"\u2A4A",cupdot:"\u228D",cupor:"\u2A45",cups:"\u222A\uFE00",curarr:"\u21B7",curarrm:"\u293C",curlyeqprec:"\u22DE",curlyeqsucc:"\u22DF",curlyvee:"\u22CE",curlywedge:"\u22CF",curren:"\xA4",curvearrowleft:"\u21B6",curvearrowright:"\u21B7",cuvee:"\u22CE",cuwed:"\u22CF",cwconint:"\u2232",cwint:"\u2231",cylcty:"\u232D",Dagger:"\u2021",dagger:"\u2020",daleth:"\u2138",Darr:"\u21A1",dArr:"\u21D3",darr:"\u2193",dash:"\u2010",Dashv:"\u2AE4",dashv:"\u22A3",dbkarow:"\u290F",dblac:"\u02DD",Dcaron:"\u010E",dcaron:"\u010F",Dcy:"\u0414",dcy:"\u0434",DD:"\u2145",dd:"\u2146",ddagger:"\u2021",ddarr:"\u21CA",DDotrahd:"\u2911",ddotseq:"\u2A77",deg:"\xB0",Del:"\u2207",Delta:"\u0394",delta:"\u03B4",demptyv:"\u29B1",dfisht:"\u297F",Dfr:"\u{1D507}",dfr:"\u{1D521}",dHar:"\u2965",dharl:"\u21C3",dharr:"\u21C2",DiacriticalAcute:"\xB4",DiacriticalDot:"\u02D9",DiacriticalDoubleAcute:"\u02DD",DiacriticalGrave:"`",DiacriticalTilde:"\u02DC",diam:"\u22C4",Diamond:"\u22C4",diamond:"\u22C4",diamondsuit:"\u2666",diams:"\u2666",die:"\xA8",DifferentialD:"\u2146",digamma:"\u03DD",disin:"\u22F2",div:"\xF7",divide:"\xF7",divideontimes:"\u22C7",divonx:"\u22C7",DJcy:"\u0402",djcy:"\u0452",dlcorn:"\u231E",dlcrop:"\u230D",dollar:"$",Dopf:"\u{1D53B}",dopf:"\u{1D555}",Dot:"\xA8",dot:"\u02D9",DotDot:"\u20DC",doteq:"\u2250",doteqdot:"\u2251",DotEqual:"\u2250",dotminus:"\u2238",dotplus:"\u2214",dotsquare:"\u22A1",doublebarwedge:"\u2306",DoubleContourIntegral:"\u222F",DoubleDot:"\xA8",DoubleDownArrow:"\u21D3",DoubleLeftArrow:"\u21D0",DoubleLeftRightArrow:"\u21D4",DoubleLeftTee:"\u2AE4",DoubleLongLeftArrow:"\u27F8",DoubleLongLeftRightArrow:"\u27FA",DoubleLongRightArrow:"\u27F9",DoubleRightArrow:"\u21D2",DoubleRightTee:"\u22A8",DoubleUpArrow:"\u21D1",DoubleUpDownArrow:"\u21D5",DoubleVerticalBar:"\u2225",DownArrow:"\u2193",Downarrow:"\u21D3",downarrow:"\u2193",DownArrowBar:"\u2913",DownArrowUpArrow:"\u21F5",DownBreve:"\u0311",downdownarrows:"\u21CA",downharpoonleft:"\u21C3",downharpoonright:"\u21C2",DownLeftRightVector:"\u2950",DownLeftTeeVector:"\u295E",DownLeftVector:"\u21BD",DownLeftVectorBar:"\u2956",DownRightTeeVector:"\u295F",DownRightVector:"\u21C1",DownRightVectorBar:"\u2957",DownTee:"\u22A4",DownTeeArrow:"\u21A7",drbkarow:"\u2910",drcorn:"\u231F",drcrop:"\u230C",Dscr:"\u{1D49F}",dscr:"\u{1D4B9}",DScy:"\u0405",dscy:"\u0455",dsol:"\u29F6",Dstrok:"\u0110",dstrok:"\u0111",dtdot:"\u22F1",dtri:"\u25BF",dtrif:"\u25BE",duarr:"\u21F5",duhar:"\u296F",dwangle:"\u29A6",DZcy:"\u040F",dzcy:"\u045F",dzigrarr:"\u27FF",Eacute:"\xC9",eacute:"\xE9",easter:"\u2A6E",Ecaron:"\u011A",ecaron:"\u011B",ecir:"\u2256",Ecirc:"\xCA",ecirc:"\xEA",ecolon:"\u2255",Ecy:"\u042D",ecy:"\u044D",eDDot:"\u2A77",Edot:"\u0116",eDot:"\u2251",edot:"\u0117",ee:"\u2147",efDot:"\u2252",Efr:"\u{1D508}",efr:"\u{1D522}",eg:"\u2A9A",Egrave:"\xC8",egrave:"\xE8",egs:"\u2A96",egsdot:"\u2A98",el:"\u2A99",Element:"\u2208",elinters:"\u23E7",ell:"\u2113",els:"\u2A95",elsdot:"\u2A97",Emacr:"\u0112",emacr:"\u0113",empty:"\u2205",emptyset:"\u2205",EmptySmallSquare:"\u25FB",emptyv:"\u2205",EmptyVerySmallSquare:"\u25AB",emsp:"\u2003",emsp13:"\u2004",emsp14:"\u2005",ENG:"\u014A",eng:"\u014B",ensp:"\u2002",Eogon:"\u0118",eogon:"\u0119",Eopf:"\u{1D53C}",eopf:"\u{1D556}",epar:"\u22D5",eparsl:"\u29E3",eplus:"\u2A71",epsi:"\u03B5",Epsilon:"\u0395",epsilon:"\u03B5",epsiv:"\u03F5",eqcirc:"\u2256",eqcolon:"\u2255",eqsim:"\u2242",eqslantgtr:"\u2A96",eqslantless:"\u2A95",Equal:"\u2A75",equals:"=",EqualTilde:"\u2242",equest:"\u225F",Equilibrium:"\u21CC",equiv:"\u2261",equivDD:"\u2A78",eqvparsl:"\u29E5",erarr:"\u2971",erDot:"\u2253",Escr:"\u2130",escr:"\u212F",esdot:"\u2250",Esim:"\u2A73",esim:"\u2242",Eta:"\u0397",eta:"\u03B7",ETH:"\xD0",eth:"\xF0",Euml:"\xCB",euml:"\xEB",euro:"\u20AC",excl:"!",exist:"\u2203",Exists:"\u2203",expectation:"\u2130",ExponentialE:"\u2147",exponentiale:"\u2147",fallingdotseq:"\u2252",Fcy:"\u0424",fcy:"\u0444",female:"\u2640",ffilig:"\uFB03",fflig:"\uFB00",ffllig:"\uFB04",Ffr:"\u{1D509}",ffr:"\u{1D523}",filig:"\uFB01",FilledSmallSquare:"\u25FC",FilledVerySmallSquare:"\u25AA",fjlig:"fj",flat:"\u266D",fllig:"\uFB02",fltns:"\u25B1",fnof:"\u0192",Fopf:"\u{1D53D}",fopf:"\u{1D557}",ForAll:"\u2200",forall:"\u2200",fork:"\u22D4",forkv:"\u2AD9",Fouriertrf:"\u2131",fpartint:"\u2A0D",frac12:"\xBD",frac13:"\u2153",frac14:"\xBC",frac15:"\u2155",frac16:"\u2159",frac18:"\u215B",frac23:"\u2154",frac25:"\u2156",frac34:"\xBE",frac35:"\u2157",frac38:"\u215C",frac45:"\u2158",frac56:"\u215A",frac58:"\u215D",frac78:"\u215E",frasl:"\u2044",frown:"\u2322",Fscr:"\u2131",fscr:"\u{1D4BB}",gacute:"\u01F5",Gamma:"\u0393",gamma:"\u03B3",Gammad:"\u03DC",gammad:"\u03DD",gap:"\u2A86",Gbreve:"\u011E",gbreve:"\u011F",Gcedil:"\u0122",Gcirc:"\u011C",gcirc:"\u011D",Gcy:"\u0413",gcy:"\u0433",Gdot:"\u0120",gdot:"\u0121",gE:"\u2267",ge:"\u2265",gEl:"\u2A8C",gel:"\u22DB",geq:"\u2265",geqq:"\u2267",geqslant:"\u2A7E",ges:"\u2A7E",gescc:"\u2AA9",gesdot:"\u2A80",gesdoto:"\u2A82",gesdotol:"\u2A84",gesl:"\u22DB\uFE00",gesles:"\u2A94",Gfr:"\u{1D50A}",gfr:"\u{1D524}",Gg:"\u22D9",gg:"\u226B",ggg:"\u22D9",gimel:"\u2137",GJcy:"\u0403",gjcy:"\u0453",gl:"\u2277",gla:"\u2AA5",glE:"\u2A92",glj:"\u2AA4",gnap:"\u2A8A",gnapprox:"\u2A8A",gnE:"\u2269",gne:"\u2A88",gneq:"\u2A88",gneqq:"\u2269",gnsim:"\u22E7",Gopf:"\u{1D53E}",gopf:"\u{1D558}",grave:"`",GreaterEqual:"\u2265",GreaterEqualLess:"\u22DB",GreaterFullEqual:"\u2267",GreaterGreater:"\u2AA2",GreaterLess:"\u2277",GreaterSlantEqual:"\u2A7E",GreaterTilde:"\u2273",Gscr:"\u{1D4A2}",gscr:"\u210A",gsim:"\u2273",gsime:"\u2A8E",gsiml:"\u2A90",Gt:"\u226B",GT:">",gt:">",gtcc:"\u2AA7",gtcir:"\u2A7A",gtdot:"\u22D7",gtlPar:"\u2995",gtquest:"\u2A7C",gtrapprox:"\u2A86",gtrarr:"\u2978",gtrdot:"\u22D7",gtreqless:"\u22DB",gtreqqless:"\u2A8C",gtrless:"\u2277",gtrsim:"\u2273",gvertneqq:"\u2269\uFE00",gvnE:"\u2269\uFE00",Hacek:"\u02C7",hairsp:"\u200A",half:"\xBD",hamilt:"\u210B",HARDcy:"\u042A",hardcy:"\u044A",hArr:"\u21D4",harr:"\u2194",harrcir:"\u2948",harrw:"\u21AD",Hat:"^",hbar:"\u210F",Hcirc:"\u0124",hcirc:"\u0125",hearts:"\u2665",heartsuit:"\u2665",hellip:"\u2026",hercon:"\u22B9",Hfr:"\u210C",hfr:"\u{1D525}",HilbertSpace:"\u210B",hksearow:"\u2925",hkswarow:"\u2926",hoarr:"\u21FF",homtht:"\u223B",hookleftarrow:"\u21A9",hookrightarrow:"\u21AA",Hopf:"\u210D",hopf:"\u{1D559}",horbar:"\u2015",HorizontalLine:"\u2500",Hscr:"\u210B",hscr:"\u{1D4BD}",hslash:"\u210F",Hstrok:"\u0126",hstrok:"\u0127",HumpDownHump:"\u224E",HumpEqual:"\u224F",hybull:"\u2043",hyphen:"\u2010",Iacute:"\xCD",iacute:"\xED",ic:"\u2063",Icirc:"\xCE",icirc:"\xEE",Icy:"\u0418",icy:"\u0438",Idot:"\u0130",IEcy:"\u0415",iecy:"\u0435",iexcl:"\xA1",iff:"\u21D4",Ifr:"\u2111",ifr:"\u{1D526}",Igrave:"\xCC",igrave:"\xEC",ii:"\u2148",iiiint:"\u2A0C",iiint:"\u222D",iinfin:"\u29DC",iiota:"\u2129",IJlig:"\u0132",ijlig:"\u0133",Im:"\u2111",Imacr:"\u012A",imacr:"\u012B",image:"\u2111",ImaginaryI:"\u2148",imagline:"\u2110",imagpart:"\u2111",imath:"\u0131",imof:"\u22B7",imped:"\u01B5",Implies:"\u21D2",in:"\u2208",incare:"\u2105",infin:"\u221E",infintie:"\u29DD",inodot:"\u0131",Int:"\u222C",int:"\u222B",intcal:"\u22BA",integers:"\u2124",Integral:"\u222B",intercal:"\u22BA",Intersection:"\u22C2",intlarhk:"\u2A17",intprod:"\u2A3C",InvisibleComma:"\u2063",InvisibleTimes:"\u2062",IOcy:"\u0401",iocy:"\u0451",Iogon:"\u012E",iogon:"\u012F",Iopf:"\u{1D540}",iopf:"\u{1D55A}",Iota:"\u0399",iota:"\u03B9",iprod:"\u2A3C",iquest:"\xBF",Iscr:"\u2110",iscr:"\u{1D4BE}",isin:"\u2208",isindot:"\u22F5",isinE:"\u22F9",isins:"\u22F4",isinsv:"\u22F3",isinv:"\u2208",it:"\u2062",Itilde:"\u0128",itilde:"\u0129",Iukcy:"\u0406",iukcy:"\u0456",Iuml:"\xCF",iuml:"\xEF",Jcirc:"\u0134",jcirc:"\u0135",Jcy:"\u0419",jcy:"\u0439",Jfr:"\u{1D50D}",jfr:"\u{1D527}",jmath:"\u0237",Jopf:"\u{1D541}",jopf:"\u{1D55B}",Jscr:"\u{1D4A5}",jscr:"\u{1D4BF}",Jsercy:"\u0408",jsercy:"\u0458",Jukcy:"\u0404",jukcy:"\u0454",Kappa:"\u039A",kappa:"\u03BA",kappav:"\u03F0",Kcedil:"\u0136",kcedil:"\u0137",Kcy:"\u041A",kcy:"\u043A",Kfr:"\u{1D50E}",kfr:"\u{1D528}",kgreen:"\u0138",KHcy:"\u0425",khcy:"\u0445",KJcy:"\u040C",kjcy:"\u045C",Kopf:"\u{1D542}",kopf:"\u{1D55C}",Kscr:"\u{1D4A6}",kscr:"\u{1D4C0}",lAarr:"\u21DA",Lacute:"\u0139",lacute:"\u013A",laemptyv:"\u29B4",lagran:"\u2112",Lambda:"\u039B",lambda:"\u03BB",Lang:"\u27EA",lang:"\u27E8",langd:"\u2991",langle:"\u27E8",lap:"\u2A85",Laplacetrf:"\u2112",laquo:"\xAB",Larr:"\u219E",lArr:"\u21D0",larr:"\u2190",larrb:"\u21E4",larrbfs:"\u291F",larrfs:"\u291D",larrhk:"\u21A9",larrlp:"\u21AB",larrpl:"\u2939",larrsim:"\u2973",larrtl:"\u21A2",lat:"\u2AAB",lAtail:"\u291B",latail:"\u2919",late:"\u2AAD",lates:"\u2AAD\uFE00",lBarr:"\u290E",lbarr:"\u290C",lbbrk:"\u2772",lbrace:"{",lbrack:"[",lbrke:"\u298B",lbrksld:"\u298F",lbrkslu:"\u298D",Lcaron:"\u013D",lcaron:"\u013E",Lcedil:"\u013B",lcedil:"\u013C",lceil:"\u2308",lcub:"{",Lcy:"\u041B",lcy:"\u043B",ldca:"\u2936",ldquo:"\u201C",ldquor:"\u201E",ldrdhar:"\u2967",ldrushar:"\u294B",ldsh:"\u21B2",lE:"\u2266",le:"\u2264",LeftAngleBracket:"\u27E8",LeftArrow:"\u2190",Leftarrow:"\u21D0",leftarrow:"\u2190",LeftArrowBar:"\u21E4",LeftArrowRightArrow:"\u21C6",leftarrowtail:"\u21A2",LeftCeiling:"\u2308",LeftDoubleBracket:"\u27E6",LeftDownTeeVector:"\u2961",LeftDownVector:"\u21C3",LeftDownVectorBar:"\u2959",LeftFloor:"\u230A",leftharpoondown:"\u21BD",leftharpoonup:"\u21BC",leftleftarrows:"\u21C7",LeftRightArrow:"\u2194",Leftrightarrow:"\u21D4",leftrightarrow:"\u2194",leftrightarrows:"\u21C6",leftrightharpoons:"\u21CB",leftrightsquigarrow:"\u21AD",LeftRightVector:"\u294E",LeftTee:"\u22A3",LeftTeeArrow:"\u21A4",LeftTeeVector:"\u295A",leftthreetimes:"\u22CB",LeftTriangle:"\u22B2",LeftTriangleBar:"\u29CF",LeftTriangleEqual:"\u22B4",LeftUpDownVector:"\u2951",LeftUpTeeVector:"\u2960",LeftUpVector:"\u21BF",LeftUpVectorBar:"\u2958",LeftVector:"\u21BC",LeftVectorBar:"\u2952",lEg:"\u2A8B",leg:"\u22DA",leq:"\u2264",leqq:"\u2266",leqslant:"\u2A7D",les:"\u2A7D",lescc:"\u2AA8",lesdot:"\u2A7F",lesdoto:"\u2A81",lesdotor:"\u2A83",lesg:"\u22DA\uFE00",lesges:"\u2A93",lessapprox:"\u2A85",lessdot:"\u22D6",lesseqgtr:"\u22DA",lesseqqgtr:"\u2A8B",LessEqualGreater:"\u22DA",LessFullEqual:"\u2266",LessGreater:"\u2276",lessgtr:"\u2276",LessLess:"\u2AA1",lesssim:"\u2272",LessSlantEqual:"\u2A7D",LessTilde:"\u2272",lfisht:"\u297C",lfloor:"\u230A",Lfr:"\u{1D50F}",lfr:"\u{1D529}",lg:"\u2276",lgE:"\u2A91",lHar:"\u2962",lhard:"\u21BD",lharu:"\u21BC",lharul:"\u296A",lhblk:"\u2584",LJcy:"\u0409",ljcy:"\u0459",Ll:"\u22D8",ll:"\u226A",llarr:"\u21C7",llcorner:"\u231E",Lleftarrow:"\u21DA",llhard:"\u296B",lltri:"\u25FA",Lmidot:"\u013F",lmidot:"\u0140",lmoust:"\u23B0",lmoustache:"\u23B0",lnap:"\u2A89",lnapprox:"\u2A89",lnE:"\u2268",lne:"\u2A87",lneq:"\u2A87",lneqq:"\u2268",lnsim:"\u22E6",loang:"\u27EC",loarr:"\u21FD",lobrk:"\u27E6",LongLeftArrow:"\u27F5",Longleftarrow:"\u27F8",longleftarrow:"\u27F5",LongLeftRightArrow:"\u27F7",Longleftrightarrow:"\u27FA",longleftrightarrow:"\u27F7",longmapsto:"\u27FC",LongRightArrow:"\u27F6",Longrightarrow:"\u27F9",longrightarrow:"\u27F6",looparrowleft:"\u21AB",looparrowright:"\u21AC",lopar:"\u2985",Lopf:"\u{1D543}",lopf:"\u{1D55D}",loplus:"\u2A2D",lotimes:"\u2A34",lowast:"\u2217",lowbar:"_",LowerLeftArrow:"\u2199",LowerRightArrow:"\u2198",loz:"\u25CA",lozenge:"\u25CA",lozf:"\u29EB",lpar:"(",lparlt:"\u2993",lrarr:"\u21C6",lrcorner:"\u231F",lrhar:"\u21CB",lrhard:"\u296D",lrm:"\u200E",lrtri:"\u22BF",lsaquo:"\u2039",Lscr:"\u2112",lscr:"\u{1D4C1}",Lsh:"\u21B0",lsh:"\u21B0",lsim:"\u2272",lsime:"\u2A8D",lsimg:"\u2A8F",lsqb:"[",lsquo:"\u2018",lsquor:"\u201A",Lstrok:"\u0141",lstrok:"\u0142",Lt:"\u226A",LT:"<",lt:"<",ltcc:"\u2AA6",ltcir:"\u2A79",ltdot:"\u22D6",lthree:"\u22CB",ltimes:"\u22C9",ltlarr:"\u2976",ltquest:"\u2A7B",ltri:"\u25C3",ltrie:"\u22B4",ltrif:"\u25C2",ltrPar:"\u2996",lurdshar:"\u294A",luruhar:"\u2966",lvertneqq:"\u2268\uFE00",lvnE:"\u2268\uFE00",macr:"\xAF",male:"\u2642",malt:"\u2720",maltese:"\u2720",Map:"\u2905",map:"\u21A6",mapsto:"\u21A6",mapstodown:"\u21A7",mapstoleft:"\u21A4",mapstoup:"\u21A5",marker:"\u25AE",mcomma:"\u2A29",Mcy:"\u041C",mcy:"\u043C",mdash:"\u2014",mDDot:"\u223A",measuredangle:"\u2221",MediumSpace:"\u205F",Mellintrf:"\u2133",Mfr:"\u{1D510}",mfr:"\u{1D52A}",mho:"\u2127",micro:"\xB5",mid:"\u2223",midast:"*",midcir:"\u2AF0",middot:"\xB7",minus:"\u2212",minusb:"\u229F",minusd:"\u2238",minusdu:"\u2A2A",MinusPlus:"\u2213",mlcp:"\u2ADB",mldr:"\u2026",mnplus:"\u2213",models:"\u22A7",Mopf:"\u{1D544}",mopf:"\u{1D55E}",mp:"\u2213",Mscr:"\u2133",mscr:"\u{1D4C2}",mstpos:"\u223E",Mu:"\u039C",mu:"\u03BC",multimap:"\u22B8",mumap:"\u22B8",nabla:"\u2207",Nacute:"\u0143",nacute:"\u0144",nang:"\u2220\u20D2",nap:"\u2249",napE:"\u2A70\u0338",napid:"\u224B\u0338",napos:"\u0149",napprox:"\u2249",natur:"\u266E",natural:"\u266E",naturals:"\u2115",nbsp:"\xA0",nbump:"\u224E\u0338",nbumpe:"\u224F\u0338",ncap:"\u2A43",Ncaron:"\u0147",ncaron:"\u0148",Ncedil:"\u0145",ncedil:"\u0146",ncong:"\u2247",ncongdot:"\u2A6D\u0338",ncup:"\u2A42",Ncy:"\u041D",ncy:"\u043D",ndash:"\u2013",ne:"\u2260",nearhk:"\u2924",neArr:"\u21D7",nearr:"\u2197",nearrow:"\u2197",nedot:"\u2250\u0338",NegativeMediumSpace:"\u200B",NegativeThickSpace:"\u200B",NegativeThinSpace:"\u200B",NegativeVeryThinSpace:"\u200B",nequiv:"\u2262",nesear:"\u2928",nesim:"\u2242\u0338",NestedGreaterGreater:"\u226B",NestedLessLess:"\u226A",NewLine:`
`,nexist:"\u2204",nexists:"\u2204",Nfr:"\u{1D511}",nfr:"\u{1D52B}",ngE:"\u2267\u0338",nge:"\u2271",ngeq:"\u2271",ngeqq:"\u2267\u0338",ngeqslant:"\u2A7E\u0338",nges:"\u2A7E\u0338",nGg:"\u22D9\u0338",ngsim:"\u2275",nGt:"\u226B\u20D2",ngt:"\u226F",ngtr:"\u226F",nGtv:"\u226B\u0338",nhArr:"\u21CE",nharr:"\u21AE",nhpar:"\u2AF2",ni:"\u220B",nis:"\u22FC",nisd:"\u22FA",niv:"\u220B",NJcy:"\u040A",njcy:"\u045A",nlArr:"\u21CD",nlarr:"\u219A",nldr:"\u2025",nlE:"\u2266\u0338",nle:"\u2270",nLeftarrow:"\u21CD",nleftarrow:"\u219A",nLeftrightarrow:"\u21CE",nleftrightarrow:"\u21AE",nleq:"\u2270",nleqq:"\u2266\u0338",nleqslant:"\u2A7D\u0338",nles:"\u2A7D\u0338",nless:"\u226E",nLl:"\u22D8\u0338",nlsim:"\u2274",nLt:"\u226A\u20D2",nlt:"\u226E",nltri:"\u22EA",nltrie:"\u22EC",nLtv:"\u226A\u0338",nmid:"\u2224",NoBreak:"\u2060",NonBreakingSpace:"\xA0",Nopf:"\u2115",nopf:"\u{1D55F}",Not:"\u2AEC",not:"\xAC",NotCongruent:"\u2262",NotCupCap:"\u226D",NotDoubleVerticalBar:"\u2226",NotElement:"\u2209",NotEqual:"\u2260",NotEqualTilde:"\u2242\u0338",NotExists:"\u2204",NotGreater:"\u226F",NotGreaterEqual:"\u2271",NotGreaterFullEqual:"\u2267\u0338",NotGreaterGreater:"\u226B\u0338",NotGreaterLess:"\u2279",NotGreaterSlantEqual:"\u2A7E\u0338",NotGreaterTilde:"\u2275",NotHumpDownHump:"\u224E\u0338",NotHumpEqual:"\u224F\u0338",notin:"\u2209",notindot:"\u22F5\u0338",notinE:"\u22F9\u0338",notinva:"\u2209",notinvb:"\u22F7",notinvc:"\u22F6",NotLeftTriangle:"\u22EA",NotLeftTriangleBar:"\u29CF\u0338",NotLeftTriangleEqual:"\u22EC",NotLess:"\u226E",NotLessEqual:"\u2270",NotLessGreater:"\u2278",NotLessLess:"\u226A\u0338",NotLessSlantEqual:"\u2A7D\u0338",NotLessTilde:"\u2274",NotNestedGreaterGreater:"\u2AA2\u0338",NotNestedLessLess:"\u2AA1\u0338",notni:"\u220C",notniva:"\u220C",notnivb:"\u22FE",notnivc:"\u22FD",NotPrecedes:"\u2280",NotPrecedesEqual:"\u2AAF\u0338",NotPrecedesSlantEqual:"\u22E0",NotReverseElement:"\u220C",NotRightTriangle:"\u22EB",NotRightTriangleBar:"\u29D0\u0338",NotRightTriangleEqual:"\u22ED",NotSquareSubset:"\u228F\u0338",NotSquareSubsetEqual:"\u22E2",NotSquareSuperset:"\u2290\u0338",NotSquareSupersetEqual:"\u22E3",NotSubset:"\u2282\u20D2",NotSubsetEqual:"\u2288",NotSucceeds:"\u2281",NotSucceedsEqual:"\u2AB0\u0338",NotSucceedsSlantEqual:"\u22E1",NotSucceedsTilde:"\u227F\u0338",NotSuperset:"\u2283\u20D2",NotSupersetEqual:"\u2289",NotTilde:"\u2241",NotTildeEqual:"\u2244",NotTildeFullEqual:"\u2247",NotTildeTilde:"\u2249",NotVerticalBar:"\u2224",npar:"\u2226",nparallel:"\u2226",nparsl:"\u2AFD\u20E5",npart:"\u2202\u0338",npolint:"\u2A14",npr:"\u2280",nprcue:"\u22E0",npre:"\u2AAF\u0338",nprec:"\u2280",npreceq:"\u2AAF\u0338",nrArr:"\u21CF",nrarr:"\u219B",nrarrc:"\u2933\u0338",nrarrw:"\u219D\u0338",nRightarrow:"\u21CF",nrightarrow:"\u219B",nrtri:"\u22EB",nrtrie:"\u22ED",nsc:"\u2281",nsccue:"\u22E1",nsce:"\u2AB0\u0338",Nscr:"\u{1D4A9}",nscr:"\u{1D4C3}",nshortmid:"\u2224",nshortparallel:"\u2226",nsim:"\u2241",nsime:"\u2244",nsimeq:"\u2244",nsmid:"\u2224",nspar:"\u2226",nsqsube:"\u22E2",nsqsupe:"\u22E3",nsub:"\u2284",nsubE:"\u2AC5\u0338",nsube:"\u2288",nsubset:"\u2282\u20D2",nsubseteq:"\u2288",nsubseteqq:"\u2AC5\u0338",nsucc:"\u2281",nsucceq:"\u2AB0\u0338",nsup:"\u2285",nsupE:"\u2AC6\u0338",nsupe:"\u2289",nsupset:"\u2283\u20D2",nsupseteq:"\u2289",nsupseteqq:"\u2AC6\u0338",ntgl:"\u2279",Ntilde:"\xD1",ntilde:"\xF1",ntlg:"\u2278",ntriangleleft:"\u22EA",ntrianglelefteq:"\u22EC",ntriangleright:"\u22EB",ntrianglerighteq:"\u22ED",Nu:"\u039D",nu:"\u03BD",num:"#",numero:"\u2116",numsp:"\u2007",nvap:"\u224D\u20D2",nVDash:"\u22AF",nVdash:"\u22AE",nvDash:"\u22AD",nvdash:"\u22AC",nvge:"\u2265\u20D2",nvgt:">\u20D2",nvHarr:"\u2904",nvinfin:"\u29DE",nvlArr:"\u2902",nvle:"\u2264\u20D2",nvlt:"<\u20D2",nvltrie:"\u22B4\u20D2",nvrArr:"\u2903",nvrtrie:"\u22B5\u20D2",nvsim:"\u223C\u20D2",nwarhk:"\u2923",nwArr:"\u21D6",nwarr:"\u2196",nwarrow:"\u2196",nwnear:"\u2927",Oacute:"\xD3",oacute:"\xF3",oast:"\u229B",ocir:"\u229A",Ocirc:"\xD4",ocirc:"\xF4",Ocy:"\u041E",ocy:"\u043E",odash:"\u229D",Odblac:"\u0150",odblac:"\u0151",odiv:"\u2A38",odot:"\u2299",odsold:"\u29BC",OElig:"\u0152",oelig:"\u0153",ofcir:"\u29BF",Ofr:"\u{1D512}",ofr:"\u{1D52C}",ogon:"\u02DB",Ograve:"\xD2",ograve:"\xF2",ogt:"\u29C1",ohbar:"\u29B5",ohm:"\u03A9",oint:"\u222E",olarr:"\u21BA",olcir:"\u29BE",olcross:"\u29BB",oline:"\u203E",olt:"\u29C0",Omacr:"\u014C",omacr:"\u014D",Omega:"\u03A9",omega:"\u03C9",Omicron:"\u039F",omicron:"\u03BF",omid:"\u29B6",ominus:"\u2296",Oopf:"\u{1D546}",oopf:"\u{1D560}",opar:"\u29B7",OpenCurlyDoubleQuote:"\u201C",OpenCurlyQuote:"\u2018",operp:"\u29B9",oplus:"\u2295",Or:"\u2A54",or:"\u2228",orarr:"\u21BB",ord:"\u2A5D",order:"\u2134",orderof:"\u2134",ordf:"\xAA",ordm:"\xBA",origof:"\u22B6",oror:"\u2A56",orslope:"\u2A57",orv:"\u2A5B",oS:"\u24C8",Oscr:"\u{1D4AA}",oscr:"\u2134",Oslash:"\xD8",oslash:"\xF8",osol:"\u2298",Otilde:"\xD5",otilde:"\xF5",Otimes:"\u2A37",otimes:"\u2297",otimesas:"\u2A36",Ouml:"\xD6",ouml:"\xF6",ovbar:"\u233D",OverBar:"\u203E",OverBrace:"\u23DE",OverBracket:"\u23B4",OverParenthesis:"\u23DC",par:"\u2225",para:"\xB6",parallel:"\u2225",parsim:"\u2AF3",parsl:"\u2AFD",part:"\u2202",PartialD:"\u2202",Pcy:"\u041F",pcy:"\u043F",percnt:"%",period:".",permil:"\u2030",perp:"\u22A5",pertenk:"\u2031",Pfr:"\u{1D513}",pfr:"\u{1D52D}",Phi:"\u03A6",phi:"\u03C6",phiv:"\u03D5",phmmat:"\u2133",phone:"\u260E",Pi:"\u03A0",pi:"\u03C0",pitchfork:"\u22D4",piv:"\u03D6",planck:"\u210F",planckh:"\u210E",plankv:"\u210F",plus:"+",plusacir:"\u2A23",plusb:"\u229E",pluscir:"\u2A22",plusdo:"\u2214",plusdu:"\u2A25",pluse:"\u2A72",PlusMinus:"\xB1",plusmn:"\xB1",plussim:"\u2A26",plustwo:"\u2A27",pm:"\xB1",Poincareplane:"\u210C",pointint:"\u2A15",Popf:"\u2119",popf:"\u{1D561}",pound:"\xA3",Pr:"\u2ABB",pr:"\u227A",prap:"\u2AB7",prcue:"\u227C",prE:"\u2AB3",pre:"\u2AAF",prec:"\u227A",precapprox:"\u2AB7",preccurlyeq:"\u227C",Precedes:"\u227A",PrecedesEqual:"\u2AAF",PrecedesSlantEqual:"\u227C",PrecedesTilde:"\u227E",preceq:"\u2AAF",precnapprox:"\u2AB9",precneqq:"\u2AB5",precnsim:"\u22E8",precsim:"\u227E",Prime:"\u2033",prime:"\u2032",primes:"\u2119",prnap:"\u2AB9",prnE:"\u2AB5",prnsim:"\u22E8",prod:"\u220F",Product:"\u220F",profalar:"\u232E",profline:"\u2312",profsurf:"\u2313",prop:"\u221D",Proportion:"\u2237",Proportional:"\u221D",propto:"\u221D",prsim:"\u227E",prurel:"\u22B0",Pscr:"\u{1D4AB}",pscr:"\u{1D4C5}",Psi:"\u03A8",psi:"\u03C8",puncsp:"\u2008",Qfr:"\u{1D514}",qfr:"\u{1D52E}",qint:"\u2A0C",Qopf:"\u211A",qopf:"\u{1D562}",qprime:"\u2057",Qscr:"\u{1D4AC}",qscr:"\u{1D4C6}",quaternions:"\u210D",quatint:"\u2A16",quest:"?",questeq:"\u225F",QUOT:'"',quot:'"',rAarr:"\u21DB",race:"\u223D\u0331",Racute:"\u0154",racute:"\u0155",radic:"\u221A",raemptyv:"\u29B3",Rang:"\u27EB",rang:"\u27E9",rangd:"\u2992",range:"\u29A5",rangle:"\u27E9",raquo:"\xBB",Rarr:"\u21A0",rArr:"\u21D2",rarr:"\u2192",rarrap:"\u2975",rarrb:"\u21E5",rarrbfs:"\u2920",rarrc:"\u2933",rarrfs:"\u291E",rarrhk:"\u21AA",rarrlp:"\u21AC",rarrpl:"\u2945",rarrsim:"\u2974",Rarrtl:"\u2916",rarrtl:"\u21A3",rarrw:"\u219D",rAtail:"\u291C",ratail:"\u291A",ratio:"\u2236",rationals:"\u211A",RBarr:"\u2910",rBarr:"\u290F",rbarr:"\u290D",rbbrk:"\u2773",rbrace:"}",rbrack:"]",rbrke:"\u298C",rbrksld:"\u298E",rbrkslu:"\u2990",Rcaron:"\u0158",rcaron:"\u0159",Rcedil:"\u0156",rcedil:"\u0157",rceil:"\u2309",rcub:"}",Rcy:"\u0420",rcy:"\u0440",rdca:"\u2937",rdldhar:"\u2969",rdquo:"\u201D",rdquor:"\u201D",rdsh:"\u21B3",Re:"\u211C",real:"\u211C",realine:"\u211B",realpart:"\u211C",reals:"\u211D",rect:"\u25AD",REG:"\xAE",reg:"\xAE",ReverseElement:"\u220B",ReverseEquilibrium:"\u21CB",ReverseUpEquilibrium:"\u296F",rfisht:"\u297D",rfloor:"\u230B",Rfr:"\u211C",rfr:"\u{1D52F}",rHar:"\u2964",rhard:"\u21C1",rharu:"\u21C0",rharul:"\u296C",Rho:"\u03A1",rho:"\u03C1",rhov:"\u03F1",RightAngleBracket:"\u27E9",RightArrow:"\u2192",Rightarrow:"\u21D2",rightarrow:"\u2192",RightArrowBar:"\u21E5",RightArrowLeftArrow:"\u21C4",rightarrowtail:"\u21A3",RightCeiling:"\u2309",RightDoubleBracket:"\u27E7",RightDownTeeVector:"\u295D",RightDownVector:"\u21C2",RightDownVectorBar:"\u2955",RightFloor:"\u230B",rightharpoondown:"\u21C1",rightharpoonup:"\u21C0",rightleftarrows:"\u21C4",rightleftharpoons:"\u21CC",rightrightarrows:"\u21C9",rightsquigarrow:"\u219D",RightTee:"\u22A2",RightTeeArrow:"\u21A6",RightTeeVector:"\u295B",rightthreetimes:"\u22CC",RightTriangle:"\u22B3",RightTriangleBar:"\u29D0",RightTriangleEqual:"\u22B5",RightUpDownVector:"\u294F",RightUpTeeVector:"\u295C",RightUpVector:"\u21BE",RightUpVectorBar:"\u2954",RightVector:"\u21C0",RightVectorBar:"\u2953",ring:"\u02DA",risingdotseq:"\u2253",rlarr:"\u21C4",rlhar:"\u21CC",rlm:"\u200F",rmoust:"\u23B1",rmoustache:"\u23B1",rnmid:"\u2AEE",roang:"\u27ED",roarr:"\u21FE",robrk:"\u27E7",ropar:"\u2986",Ropf:"\u211D",ropf:"\u{1D563}",roplus:"\u2A2E",rotimes:"\u2A35",RoundImplies:"\u2970",rpar:")",rpargt:"\u2994",rppolint:"\u2A12",rrarr:"\u21C9",Rrightarrow:"\u21DB",rsaquo:"\u203A",Rscr:"\u211B",rscr:"\u{1D4C7}",Rsh:"\u21B1",rsh:"\u21B1",rsqb:"]",rsquo:"\u2019",rsquor:"\u2019",rthree:"\u22CC",rtimes:"\u22CA",rtri:"\u25B9",rtrie:"\u22B5",rtrif:"\u25B8",rtriltri:"\u29CE",RuleDelayed:"\u29F4",ruluhar:"\u2968",rx:"\u211E",Sacute:"\u015A",sacute:"\u015B",sbquo:"\u201A",Sc:"\u2ABC",sc:"\u227B",scap:"\u2AB8",Scaron:"\u0160",scaron:"\u0161",sccue:"\u227D",scE:"\u2AB4",sce:"\u2AB0",Scedil:"\u015E",scedil:"\u015F",Scirc:"\u015C",scirc:"\u015D",scnap:"\u2ABA",scnE:"\u2AB6",scnsim:"\u22E9",scpolint:"\u2A13",scsim:"\u227F",Scy:"\u0421",scy:"\u0441",sdot:"\u22C5",sdotb:"\u22A1",sdote:"\u2A66",searhk:"\u2925",seArr:"\u21D8",searr:"\u2198",searrow:"\u2198",sect:"\xA7",semi:";",seswar:"\u2929",setminus:"\u2216",setmn:"\u2216",sext:"\u2736",Sfr:"\u{1D516}",sfr:"\u{1D530}",sfrown:"\u2322",sharp:"\u266F",SHCHcy:"\u0429",shchcy:"\u0449",SHcy:"\u0428",shcy:"\u0448",ShortDownArrow:"\u2193",ShortLeftArrow:"\u2190",shortmid:"\u2223",shortparallel:"\u2225",ShortRightArrow:"\u2192",ShortUpArrow:"\u2191",shy:"\xAD",Sigma:"\u03A3",sigma:"\u03C3",sigmaf:"\u03C2",sigmav:"\u03C2",sim:"\u223C",simdot:"\u2A6A",sime:"\u2243",simeq:"\u2243",simg:"\u2A9E",simgE:"\u2AA0",siml:"\u2A9D",simlE:"\u2A9F",simne:"\u2246",simplus:"\u2A24",simrarr:"\u2972",slarr:"\u2190",SmallCircle:"\u2218",smallsetminus:"\u2216",smashp:"\u2A33",smeparsl:"\u29E4",smid:"\u2223",smile:"\u2323",smt:"\u2AAA",smte:"\u2AAC",smtes:"\u2AAC\uFE00",SOFTcy:"\u042C",softcy:"\u044C",sol:"/",solb:"\u29C4",solbar:"\u233F",Sopf:"\u{1D54A}",sopf:"\u{1D564}",spades:"\u2660",spadesuit:"\u2660",spar:"\u2225",sqcap:"\u2293",sqcaps:"\u2293\uFE00",sqcup:"\u2294",sqcups:"\u2294\uFE00",Sqrt:"\u221A",sqsub:"\u228F",sqsube:"\u2291",sqsubset:"\u228F",sqsubseteq:"\u2291",sqsup:"\u2290",sqsupe:"\u2292",sqsupset:"\u2290",sqsupseteq:"\u2292",squ:"\u25A1",Square:"\u25A1",square:"\u25A1",SquareIntersection:"\u2293",SquareSubset:"\u228F",SquareSubsetEqual:"\u2291",SquareSuperset:"\u2290",SquareSupersetEqual:"\u2292",SquareUnion:"\u2294",squarf:"\u25AA",squf:"\u25AA",srarr:"\u2192",Sscr:"\u{1D4AE}",sscr:"\u{1D4C8}",ssetmn:"\u2216",ssmile:"\u2323",sstarf:"\u22C6",Star:"\u22C6",star:"\u2606",starf:"\u2605",straightepsilon:"\u03F5",straightphi:"\u03D5",strns:"\xAF",Sub:"\u22D0",sub:"\u2282",subdot:"\u2ABD",subE:"\u2AC5",sube:"\u2286",subedot:"\u2AC3",submult:"\u2AC1",subnE:"\u2ACB",subne:"\u228A",subplus:"\u2ABF",subrarr:"\u2979",Subset:"\u22D0",subset:"\u2282",subseteq:"\u2286",subseteqq:"\u2AC5",SubsetEqual:"\u2286",subsetneq:"\u228A",subsetneqq:"\u2ACB",subsim:"\u2AC7",subsub:"\u2AD5",subsup:"\u2AD3",succ:"\u227B",succapprox:"\u2AB8",succcurlyeq:"\u227D",Succeeds:"\u227B",SucceedsEqual:"\u2AB0",SucceedsSlantEqual:"\u227D",SucceedsTilde:"\u227F",succeq:"\u2AB0",succnapprox:"\u2ABA",succneqq:"\u2AB6",succnsim:"\u22E9",succsim:"\u227F",SuchThat:"\u220B",Sum:"\u2211",sum:"\u2211",sung:"\u266A",Sup:"\u22D1",sup:"\u2283",sup1:"\xB9",sup2:"\xB2",sup3:"\xB3",supdot:"\u2ABE",supdsub:"\u2AD8",supE:"\u2AC6",supe:"\u2287",supedot:"\u2AC4",Superset:"\u2283",SupersetEqual:"\u2287",suphsol:"\u27C9",suphsub:"\u2AD7",suplarr:"\u297B",supmult:"\u2AC2",supnE:"\u2ACC",supne:"\u228B",supplus:"\u2AC0",Supset:"\u22D1",supset:"\u2283",supseteq:"\u2287",supseteqq:"\u2AC6",supsetneq:"\u228B",supsetneqq:"\u2ACC",supsim:"\u2AC8",supsub:"\u2AD4",supsup:"\u2AD6",swarhk:"\u2926",swArr:"\u21D9",swarr:"\u2199",swarrow:"\u2199",swnwar:"\u292A",szlig:"\xDF",Tab:" ",target:"\u2316",Tau:"\u03A4",tau:"\u03C4",tbrk:"\u23B4",Tcaron:"\u0164",tcaron:"\u0165",Tcedil:"\u0162",tcedil:"\u0163",Tcy:"\u0422",tcy:"\u0442",tdot:"\u20DB",telrec:"\u2315",Tfr:"\u{1D517}",tfr:"\u{1D531}",there4:"\u2234",Therefore:"\u2234",therefore:"\u2234",Theta:"\u0398",theta:"\u03B8",thetasym:"\u03D1",thetav:"\u03D1",thickapprox:"\u2248",thicksim:"\u223C",ThickSpace:"\u205F\u200A",thinsp:"\u2009",ThinSpace:"\u2009",thkap:"\u2248",thksim:"\u223C",THORN:"\xDE",thorn:"\xFE",Tilde:"\u223C",tilde:"\u02DC",TildeEqual:"\u2243",TildeFullEqual:"\u2245",TildeTilde:"\u2248",times:"\xD7",timesb:"\u22A0",timesbar:"\u2A31",timesd:"\u2A30",tint:"\u222D",toea:"\u2928",top:"\u22A4",topbot:"\u2336",topcir:"\u2AF1",Topf:"\u{1D54B}",topf:"\u{1D565}",topfork:"\u2ADA",tosa:"\u2929",tprime:"\u2034",TRADE:"\u2122",trade:"\u2122",triangle:"\u25B5",triangledown:"\u25BF",triangleleft:"\u25C3",trianglelefteq:"\u22B4",triangleq:"\u225C",triangleright:"\u25B9",trianglerighteq:"\u22B5",tridot:"\u25EC",trie:"\u225C",triminus:"\u2A3A",TripleDot:"\u20DB",triplus:"\u2A39",trisb:"\u29CD",tritime:"\u2A3B",trpezium:"\u23E2",Tscr:"\u{1D4AF}",tscr:"\u{1D4C9}",TScy:"\u0426",tscy:"\u0446",TSHcy:"\u040B",tshcy:"\u045B",Tstrok:"\u0166",tstrok:"\u0167",twixt:"\u226C",twoheadleftarrow:"\u219E",twoheadrightarrow:"\u21A0",Uacute:"\xDA",uacute:"\xFA",Uarr:"\u219F",uArr:"\u21D1",uarr:"\u2191",Uarrocir:"\u2949",Ubrcy:"\u040E",ubrcy:"\u045E",Ubreve:"\u016C",ubreve:"\u016D",Ucirc:"\xDB",ucirc:"\xFB",Ucy:"\u0423",ucy:"\u0443",udarr:"\u21C5",Udblac:"\u0170",udblac:"\u0171",udhar:"\u296E",ufisht:"\u297E",Ufr:"\u{1D518}",ufr:"\u{1D532}",Ugrave:"\xD9",ugrave:"\xF9",uHar:"\u2963",uharl:"\u21BF",uharr:"\u21BE",uhblk:"\u2580",ulcorn:"\u231C",ulcorner:"\u231C",ulcrop:"\u230F",ultri:"\u25F8",Umacr:"\u016A",umacr:"\u016B",uml:"\xA8",UnderBar:"_",UnderBrace:"\u23DF",UnderBracket:"\u23B5",UnderParenthesis:"\u23DD",Union:"\u22C3",UnionPlus:"\u228E",Uogon:"\u0172",uogon:"\u0173",Uopf:"\u{1D54C}",uopf:"\u{1D566}",UpArrow:"\u2191",Uparrow:"\u21D1",uparrow:"\u2191",UpArrowBar:"\u2912",UpArrowDownArrow:"\u21C5",UpDownArrow:"\u2195",Updownarrow:"\u21D5",updownarrow:"\u2195",UpEquilibrium:"\u296E",upharpoonleft:"\u21BF",upharpoonright:"\u21BE",uplus:"\u228E",UpperLeftArrow:"\u2196",UpperRightArrow:"\u2197",Upsi:"\u03D2",upsi:"\u03C5",upsih:"\u03D2",Upsilon:"\u03A5",upsilon:"\u03C5",UpTee:"\u22A5",UpTeeArrow:"\u21A5",upuparrows:"\u21C8",urcorn:"\u231D",urcorner:"\u231D",urcrop:"\u230E",Uring:"\u016E",uring:"\u016F",urtri:"\u25F9",Uscr:"\u{1D4B0}",uscr:"\u{1D4CA}",utdot:"\u22F0",Utilde:"\u0168",utilde:"\u0169",utri:"\u25B5",utrif:"\u25B4",uuarr:"\u21C8",Uuml:"\xDC",uuml:"\xFC",uwangle:"\u29A7",vangrt:"\u299C",varepsilon:"\u03F5",varkappa:"\u03F0",varnothing:"\u2205",varphi:"\u03D5",varpi:"\u03D6",varpropto:"\u221D",vArr:"\u21D5",varr:"\u2195",varrho:"\u03F1",varsigma:"\u03C2",varsubsetneq:"\u228A\uFE00",varsubsetneqq:"\u2ACB\uFE00",varsupsetneq:"\u228B\uFE00",varsupsetneqq:"\u2ACC\uFE00",vartheta:"\u03D1",vartriangleleft:"\u22B2",vartriangleright:"\u22B3",Vbar:"\u2AEB",vBar:"\u2AE8",vBarv:"\u2AE9",Vcy:"\u0412",vcy:"\u0432",VDash:"\u22AB",Vdash:"\u22A9",vDash:"\u22A8",vdash:"\u22A2",Vdashl:"\u2AE6",Vee:"\u22C1",vee:"\u2228",veebar:"\u22BB",veeeq:"\u225A",vellip:"\u22EE",Verbar:"\u2016",verbar:"|",Vert:"\u2016",vert:"|",VerticalBar:"\u2223",VerticalLine:"|",VerticalSeparator:"\u2758",VerticalTilde:"\u2240",VeryThinSpace:"\u200A",Vfr:"\u{1D519}",vfr:"\u{1D533}",vltri:"\u22B2",vnsub:"\u2282\u20D2",vnsup:"\u2283\u20D2",Vopf:"\u{1D54D}",vopf:"\u{1D567}",vprop:"\u221D",vrtri:"\u22B3",Vscr:"\u{1D4B1}",vscr:"\u{1D4CB}",vsubnE:"\u2ACB\uFE00",vsubne:"\u228A\uFE00",vsupnE:"\u2ACC\uFE00",vsupne:"\u228B\uFE00",Vvdash:"\u22AA",vzigzag:"\u299A",Wcirc:"\u0174",wcirc:"\u0175",wedbar:"\u2A5F",Wedge:"\u22C0",wedge:"\u2227",wedgeq:"\u2259",weierp:"\u2118",Wfr:"\u{1D51A}",wfr:"\u{1D534}",Wopf:"\u{1D54E}",wopf:"\u{1D568}",wp:"\u2118",wr:"\u2240",wreath:"\u2240",Wscr:"\u{1D4B2}",wscr:"\u{1D4CC}",xcap:"\u22C2",xcirc:"\u25EF",xcup:"\u22C3",xdtri:"\u25BD",Xfr:"\u{1D51B}",xfr:"\u{1D535}",xhArr:"\u27FA",xharr:"\u27F7",Xi:"\u039E",xi:"\u03BE",xlArr:"\u27F8",xlarr:"\u27F5",xmap:"\u27FC",xnis:"\u22FB",xodot:"\u2A00",Xopf:"\u{1D54F}",xopf:"\u{1D569}",xoplus:"\u2A01",xotime:"\u2A02",xrArr:"\u27F9",xrarr:"\u27F6",Xscr:"\u{1D4B3}",xscr:"\u{1D4CD}",xsqcup:"\u2A06",xuplus:"\u2A04",xutri:"\u25B3",xvee:"\u22C1",xwedge:"\u22C0",Yacute:"\xDD",yacute:"\xFD",YAcy:"\u042F",yacy:"\u044F",Ycirc:"\u0176",ycirc:"\u0177",Ycy:"\u042B",ycy:"\u044B",yen:"\xA5",Yfr:"\u{1D51C}",yfr:"\u{1D536}",YIcy:"\u0407",yicy:"\u0457",Yopf:"\u{1D550}",yopf:"\u{1D56A}",Yscr:"\u{1D4B4}",yscr:"\u{1D4CE}",YUcy:"\u042E",yucy:"\u044E",Yuml:"\u0178",yuml:"\xFF",Zacute:"\u0179",zacute:"\u017A",Zcaron:"\u017D",zcaron:"\u017E",Zcy:"\u0417",zcy:"\u0437",Zdot:"\u017B",zdot:"\u017C",zeetrf:"\u2128",ZeroWidthSpace:"\u200B",Zeta:"\u0396",zeta:"\u03B6",Zfr:"\u2128",zfr:"\u{1D537}",ZHcy:"\u0416",zhcy:"\u0436",zigrarr:"\u21DD",Zopf:"\u2124",zopf:"\u{1D56B}",Zscr:"\u{1D4B5}",zscr:"\u{1D4CF}",zwj:"\u200D",zwnj:"\u200C"}),r.entityMap=r.HTML_ENTITIES})(Jn);var cP=ks(Jn),to={},Fr=te.NAMESPACE,eo=/[A-Z_a-z\xC0-\xD6\xD8-\xF6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/,Jc=new RegExp("[\\-\\.0-9"+eo.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),th=new RegExp("^"+eo.source+Jc.source+"*(?::"+eo.source+Jc.source+"*)?$"),Ur=0,he=1,We=2,kr=3,Ye=4,qe=5,Nr=6,Vs=7;function Ke(r,t){this.message=r,this.locator=t,Error.captureStackTrace&&Error.captureStackTrace(this,Ke)}Ke.prototype=new Error,Ke.prototype.name=Ke.name;function eh(){}eh.prototype={parse:function(r,t,e){var s=this.domBuilder;s.startDocument(),ih(t,t={}),ry(r,t,e,s,this.errorHandler),s.endDocument()}};function ry(r,t,e,s,i){function n(D){if(D>65535){D-=65536;var K=55296+(D>>10),Xe=56320+(D&1023);return String.fromCharCode(K,Xe)}else return String.fromCharCode(D)}function o(D){var K=D.slice(1,-1);return Object.hasOwnProperty.call(e,K)?e[K]:K.charAt(0)==="#"?n(parseInt(K.substr(1).replace("x","0x"))):(i.error("entity not found:"+D),D)}function a(D){if(D>g){var K=r.substring(g,D).replace(/&#?\w+;/g,o);d&&u(g),s.characters(K,0,D-g),g=D}}function u(D,K){for(;D>=c&&(K=h.exec(r));)l=K.index,c=l+K[0].length,d.lineNumber++;d.columnNumber=D-l+1}for(var l=0,c=0,h=/.*(?:\r\n?|\n)|.*$/g,d=s.locator,p=[{currentNSMap:t}],f={},g=0;;){try{var m=r.indexOf("<",g);if(m<0){if(!r.substr(g).match(/^\s*$/)){var _=s.doc,x=_.createTextNode(r.substr(g));_.appendChild(x),s.currentElement=x}return}switch(m>g&&a(m),r.charAt(m+1)){case"/":var G=r.indexOf(">",m+3),b=r.substring(m+2,G).replace(/[ \t\n\r]+$/g,""),v=p.pop();G<0?(b=r.substring(m+2).replace(/[\s<].*/,""),i.error("end tag name: "+b+" is not complete:"+v.tagName),G=m+1+b.length):b.match(/\s</)&&(b=b.replace(/[\s<].*/,""),i.error("end tag name: "+b+" maybe not complete"),G=m+1+b.length);var A=v.localNSMap,C=v.tagName==b,w=C||v.tagName&&v.tagName.toLowerCase()==b.toLowerCase();if(w){if(s.endElement(v.uri,v.localName,b),A)for(var R in A)Object.prototype.hasOwnProperty.call(A,R)&&s.endPrefixMapping(R);C||i.fatalError("end tag name: "+b+" is not match the current start tagName:"+v.tagName)}else p.push(v);G++;break;case"?":d&&u(m),G=ay(r,m,s);break;case"!":d&&u(m),G=oy(r,m,s,i);break;default:d&&u(m);var T=new nh,S=p[p.length-1].currentNSMap,G=sy(r,m,T,S,o,i),N=T.length;if(!T.closed&&ny(r,G,T.tagName,f)&&(T.closed=!0,e.nbsp||i.warning("unclosed xml attribute")),d&&N){for(var M=rh(d,{}),O=0;O<N;O++){var W=T[O];u(W.offset),W.locator=rh(d,{})}s.locator=M,sh(T,s,S)&&p.push(T),s.locator=d}else sh(T,s,S)&&p.push(T);Fr.isHTML(T.uri)&&!T.closed?G=iy(r,G,T.tagName,o,s):G++}}catch(D){if(D instanceof Ke)throw D;i.error("element parse error: "+D),G=-1}G>g?g=G:a(Math.max(m,g)+1)}}function rh(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function sy(r,t,e,s,i,n){function o(p,f,g){e.attributeNames.hasOwnProperty(p)&&n.fatalError("Attribute "+p+" redefined"),e.addValue(p,f.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,i),g)}for(var a,u,l=++t,c=Ur;;){var h=r.charAt(l);switch(h){case"=":if(c===he)a=r.slice(t,l),c=kr;else if(c===We)c=kr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===kr||c===he)if(c===he&&(n.warning('attribute value must after "="'),a=r.slice(t,l)),t=l+1,l=r.indexOf(h,t),l>0)u=r.slice(t,l),o(a,u,t-1),c=qe;else throw new Error("attribute value no end '"+h+"' match");else if(c==Ye)u=r.slice(t,l),o(a,u,t),n.warning('attribute "'+a+'" missed start quot('+h+")!!"),t=l+1,c=qe;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Ur:e.setTagName(r.slice(t,l));case qe:case Nr:case Vs:c=Vs,e.closed=!0;case Ye:case he:break;case We:e.closed=!0;break;default:throw new Error("attribute invalid close char('/')")}break;case"":return n.error("unexpected end of input"),c==Ur&&e.setTagName(r.slice(t,l)),l;case">":switch(c){case Ur:e.setTagName(r.slice(t,l));case qe:case Nr:case Vs:break;case Ye:case he:u=r.slice(t,l),u.slice(-1)==="/"&&(e.closed=!0,u=u.slice(0,-1));case We:c===We&&(u=a),c==Ye?(n.warning('attribute "'+u+'" missed quot(")!'),o(a,u,t)):((!Fr.isHTML(s[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),o(u,u,t));break;case kr:throw new Error("attribute value missed!!")}return l;case"\x80":h=" ";default:if(h<=" ")switch(c){case Ur:e.setTagName(r.slice(t,l)),c=Nr;break;case he:a=r.slice(t,l),c=We;break;case Ye:var u=r.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),o(a,u,t);case qe:c=Nr;break}else switch(c){case We:var d=e.tagName;(!Fr.isHTML(s[""])||!a.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+a+'" missed value!! "'+a+'" instead2!!'),o(a,a,t),t=l,c=he;break;case qe:n.warning('attribute space is required"'+a+'"!!');case Nr:c=he,t=l;break;case kr:c=Ye,t=l;break;case Vs:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function sh(r,t,e){for(var s=r.tagName,i=null,h=r.length;h--;){var n=r[h],o=n.qName,a=n.value,d=o.indexOf(":");if(d>0)var u=n.prefix=o.slice(0,d),l=o.slice(d+1),c=u==="xmlns"&&l;else l=o,u=null,c=o==="xmlns"&&"";n.localName=l,c!==!1&&(i==null&&(i={},ih(e,e={})),e[c]=i[c]=a,n.uri=Fr.XMLNS,t.startPrefixMapping(c,a))}for(var h=r.length;h--;){n=r[h];var u=n.prefix;u&&(u==="xml"&&(n.uri=Fr.XML),u!=="xmlns"&&(n.uri=e[u||""]))}var d=s.indexOf(":");d>0?(u=r.prefix=s.slice(0,d),l=r.localName=s.slice(d+1)):(u=null,l=r.localName=s);var p=r.uri=e[u||""];if(t.startElement(p,l,s,r),r.closed){if(t.endElement(p,l,s),i)for(u in i)Object.prototype.hasOwnProperty.call(i,u)&&t.endPrefixMapping(u)}else return r.currentNSMap=e,r.localNSMap=i,!0}function iy(r,t,e,s,i){if(/^(?:script|textarea)$/i.test(e)){var n=r.indexOf("</"+e+">",t),o=r.substring(t+1,n);if(/[&<]/.test(o))return/^script$/i.test(e)?(i.characters(o,0,o.length),n):(o=o.replace(/&#?\w+;/g,s),i.characters(o,0,o.length),n)}return t+1}function ny(r,t,e,s){var i=s[e];return i==null&&(i=r.lastIndexOf("</"+e+">"),i<t&&(i=r.lastIndexOf("</"+e)),s[e]=i),i<t}function ih(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function oy(r,t,e,s){var i=r.charAt(t+2);switch(i){case"-":if(r.charAt(t+3)==="-"){var n=r.indexOf("-->",t+4);return n>t?(e.comment(r,t+4,n-t-4),n+3):(s.error("Unclosed comment"),-1)}else return-1;default:if(r.substr(t+3,6)=="CDATA["){var n=r.indexOf("]]>",t+9);return e.startCDATA(),e.characters(r,t+9,n-t-9),e.endCDATA(),n+3}var o=uy(r,t),a=o.length;if(a>1&&/!doctype/i.test(o[0][0])){var u=o[1][0],l=!1,c=!1;a>3&&(/^public$/i.test(o[2][0])?(l=o[3][0],c=a>4&&o[4][0]):/^system$/i.test(o[2][0])&&(c=o[3][0]));var h=o[a-1];return e.startDTD(u,l,c),e.endDTD(),h.index+h[0].length}}return-1}function ay(r,t,e){var s=r.indexOf("?>",t);if(s){var i=r.substring(t,s).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(i){var n=i[0].length;return e.processingInstruction(i[1],i[2]),s+2}else return-1}return-1}function nh(){this.attributeNames={}}nh.prototype={setTagName:function(r){if(!th.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!th.test(r))throw new Error("invalid attribute:"+r);this.attributeNames[r]=this.length,this[this.length++]={qName:r,value:t,offset:e}},length:0,getLocalName:function(r){return this[r].localName},getLocator:function(r){return this[r].locator},getQName:function(r){return this[r].qName},getURI:function(r){return this[r].uri},getValue:function(r){return this[r].value}};function uy(r,t){var e,s=[],i=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(i.lastIndex=t,i.exec(r);e=i.exec(r);)if(s.push(e),e[1])return s}var hP=to.XMLReader=eh,dP=to.ParseError=Ke,ly=te,cy=Jt,oh=Jn,ah=to,hy=cy.DOMImplementation,uh=ly.NAMESPACE,dy=ah.ParseError,py=ah.XMLReader;function lh(r){return r.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function ch(r){this.options=r||{locator:{}}}ch.prototype.parseFromString=function(r,t){var e=this.options,s=new py,i=e.domBuilder||new Lr,n=e.errorHandler,o=e.locator,a=e.xmlns||{},u=/\/x?html?$/.test(t),l=u?oh.HTML_ENTITIES:oh.XML_ENTITIES;o&&i.setDocumentLocator(o),s.errorHandler=fy(n,i,o),s.domBuilder=e.domBuilder||i,u&&(a[""]=uh.HTML),a.xml=a.xml||uh.XML;var c=e.normalizeLineEndings||lh;return r&&typeof r=="string"?s.parse(c(r),a,l):s.errorHandler.error("invalid doc source"),i.doc};function fy(r,t,e){if(!r){if(t instanceof Lr)return t;r=t}var s={},i=r instanceof Function;e=e||{};function n(o){var a=r[o];!a&&i&&(a=r.length==2?function(u){r(o,u)}:r),s[o]=a&&function(u){a("[xmldom "+o+"] "+u+ro(e))}||function(){}}return n("warning"),n("error"),n("fatalError"),s}function Lr(){this.cdata=!1}function Ze(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}Lr.prototype={startDocument:function(){this.doc=new hy().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,t,e,s){var i=this.doc,n=i.createElementNS(r,e||t),o=s.length;Ws(this,n),this.currentElement=n,this.locator&&Ze(this.locator,n);for(var a=0;a<o;a++){var r=s.getURI(a),u=s.getValue(a),e=s.getQName(a),l=i.createAttributeNS(r,e);this.locator&&Ze(s.getLocator(a),l),l.value=l.nodeValue=u,n.setAttributeNode(l)}},endElement:function(r,t,e){var s=this.currentElement,i=s.tagName;this.currentElement=s.parentNode},startPrefixMapping:function(r,t){},endPrefixMapping:function(r){},processingInstruction:function(r,t){var e=this.doc.createProcessingInstruction(r,t);this.locator&&Ze(this.locator,e),Ws(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=hh.apply(this,arguments),r){if(this.cdata)var s=this.doc.createCDATASection(r);else var s=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(s):/^\s*$/.test(r)&&this.doc.appendChild(s),this.locator&&Ze(this.locator,s)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,t,e){r=hh.apply(this,arguments);var s=this.doc.createComment(r);this.locator&&Ze(this.locator,s),Ws(this,s)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e){var s=this.doc.implementation;if(s&&s.createDocumentType){var i=s.createDocumentType(r,t,e);this.locator&&Ze(this.locator,i),Ws(this,i),this.doc.doctype=i}},warning:function(r){console.warn("[xmldom warning] "+r,ro(this.locator))},error:function(r){console.error("[xmldom error] "+r,ro(this.locator))},fatalError:function(r){throw new dy(r,this.locator)}};function ro(r){if(r)return`
@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function hh(r,t,e){return typeof r=="string"?r.substr(t,e):r.length>=t+e||t?new java.lang.String(r,t,e)+"":r}"endDTD,startEntity,endEntity,attributeDecl,elementDecl,externalEntityDecl,internalEntityDecl,resolveEntity,getExternalSubset,notationDecl,unparsedEntityDecl".replace(/\w+/g,function(r){Lr.prototype[r]=function(){return null}});function Ws(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}var pP=js.__DOMHandler=Lr,fP=js.normalizeLineEndings=lh,mP=js.DOMParser=ch,dh=Jt,gP=$n.DOMImplementation=dh.DOMImplementation,_P=$n.XMLSerializer=dh.XMLSerializer,my=$n.DOMParser=js.DOMParser;const ph={createCanvas:(r,t)=>new OffscreenCanvas(r!=null?r:0,t!=null?t:0),getCanvasRenderingContext2D:()=>OffscreenCanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>globalThis.location.href,getFontFaceSet:()=>globalThis.fonts,fetch:(r,t)=>fetch(r,t),parseXML:r=>new my().parseFromString(r,"text/xml")};var gy=Object.defineProperty,_y=Object.defineProperties,by=Object.getOwnPropertyDescriptors,fh=Object.getOwnPropertySymbols,xy=Object.prototype.hasOwnProperty,yy=Object.prototype.propertyIsEnumerable,mh=(r,t,e)=>t in r?gy(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gh=(r,t)=>{for(var e in t||(t={}))xy.call(t,e)&&mh(r,e,t[e]);if(fh)for(var e of fh(t))yy.call(t,e)&&mh(r,e,t[e]);return r},vy=(r,t)=>_y(r,by(t)),y=(r=>(r.Application="application",r.WebGLPipes="webgl-pipes",r.WebGLPipesAdaptor="webgl-pipes-adaptor",r.WebGLSystem="webgl-system",r.WebGPUPipes="webgpu-pipes",r.WebGPUPipesAdaptor="webgpu-pipes-adaptor",r.WebGPUSystem="webgpu-system",r.CanvasSystem="canvas-system",r.CanvasPipesAdaptor="canvas-pipes-adaptor",r.CanvasPipes="canvas-pipes",r.Asset="asset",r.LoadParser="load-parser",r.ResolveParser="resolve-parser",r.CacheParser="cache-parser",r.DetectionParser="detection-parser",r.MaskEffect="mask-effect",r.BlendMode="blend-mode",r.TextureSource="texture-source",r.Environment="environment",r.ShapeBuilder="shape-builder",r.Batcher="batcher",r))(y||{});const so=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=vy(gh({},t),{ref:r})}if(typeof r=="object")r=gh({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},$r=(r,t)=>{var e;return(e=so(r).priority)!=null?e:t},k={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(so).forEach(t=>{t.type.forEach(e=>{var s,i;return(i=(s=this._removeHandlers)[e])==null?void 0:i.call(s,t)})}),this},add(...r){return r.map(so).forEach(t=>{t.type.forEach(e=>{var s,i;const n=this._addHandlers,o=this._queue;n[e]?(i=n[e])==null||i.call(n,t):(o[e]=o[e]||[],(s=o[e])==null||s.push(t))})}),this},handle(r,t,e){var s;const i=this._addHandlers,n=this._removeHandlers;i[r]=t,n[r]=e;const o=this._queue;return o[r]&&((s=o[r])==null||s.forEach(a=>t(a)),delete o[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,s=>{t.findIndex(i=>i.name===s.name)>=0||(t.push({name:s.name,value:s.ref}),t.sort((i,n)=>$r(n.value,e)-$r(i.value,e)))},s=>{const i=t.findIndex(n=>n.name===s.name);i!==-1&&t.splice(i,1)})},handleByList(r,t,e=-1){return this.handle(r,s=>{t.includes(s.ref)||(t.push(s.ref),t.sort((i,n)=>$r(n,e)-$r(i,e)))},s=>{const i=t.indexOf(s.ref);i!==-1&&t.splice(i,1)})}};class io{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,s;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,s=globalThis.innerHeight;else{const{clientWidth:i,clientHeight:n}=this._resizeTo;e=i,s=n}this.renderer.resize(e,s),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}io.extension=y.Application;var de=(r=>(r[r.INTERACTION=50]="INTERACTION",r[r.HIGH=25]="HIGH",r[r.NORMAL=0]="NORMAL",r[r.LOW=-25]="LOW",r[r.UTILITY=-50]="UTILITY",r))(de||{});class Ys{constructor(t,e=null,s=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=s,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const _h=class Mt{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 Ys(null,null,1/0),this.deltaMS=1/Mt.targetFPMS,this.elapsedMS=1/Mt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,s=de.NORMAL){return this._addListener(new Ys(t,e,s))}addOnce(t,e,s=de.NORMAL){return this._addListener(new Ys(t,e,s,!0))}_addListener(t){let e=this._head.next,s=this._head;if(!e)t.connect(s);else{for(;e;){if(t.priority>e.priority){t.connect(s);break}s=e,e=e.next}t.previous||t.connect(s)}return this._startIfPossible(),this}remove(t,e){let s=this._head.next;for(;s;)s.match(t,e)?s=s.destroy():s=s.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Mt.targetFPMS;const s=this._head;let i=s.next;for(;i;)i=i.emit(this);s.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){const e=Math.min(this.maxFPS,t),s=Math.min(Math.max(0,e)/1e3,Mt.targetFPMS);this._maxElapsedMS=1/s}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){if(t===0)this._minElapsedMS=0;else{const e=Math.max(this.minFPS,t);this._minElapsedMS=1/(e/1e3)}}static get shared(){if(!Mt._shared){const t=Mt._shared=new Mt;t.autoStart=!0,t._protected=!0}return Mt._shared}static get system(){if(!Mt._system){const t=Mt._system=new Mt;t.autoStart=!0,t._protected=!0}return Mt._system}};_h.targetFPMS=.06;let mt=_h;class no{static init(t){t=Object.assign({autoStart:!0,sharedTicker:!1},t),Object.defineProperty(this,"ticker",{set(e){this._ticker&&this._ticker.remove(this.render,this),this._ticker=e,e&&e.add(this.render,this,de.LOW)},get(){return this._ticker}}),this.stop=()=>{this._ticker.stop()},this.start=()=>{this._ticker.start()},this._ticker=null,this.ticker=t.sharedTicker?mt.shared:new mt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}no.extension=y.Application,k.add(io),k.add(no);var wt=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(wt||{});function Nt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Hr(r){return r.split("?")[0].split("#")[0]}function Ty(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Ay(r,t,e){return r.replace(new RegExp(Ty(t),"g"),e)}function Sy(r,t){let e="",s=0,i=-1,n=0,o=-1;for(let a=0;a<=r.length;++a){if(a<r.length)o=r.charCodeAt(a);else{if(o===47)break;o=47}if(o===47){if(!(i===a-1||n===1))if(i!==a-1&&n===2){if(e.length<2||s!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const u=e.lastIndexOf("/");if(u!==e.length-1){u===-1?(e="",s=0):(e=e.slice(0,u),s=e.length-1-e.lastIndexOf("/")),i=a,n=0;continue}}else if(e.length===2||e.length===1){e="",s=0,i=a,n=0;continue}}t&&(e.length>0?e+="/..":e="..",s=2)}else e.length>0?e+=`/${r.slice(i+1,a)}`:e=r.slice(i+1,a),s=a-i-1;i=a,n=0}else o===46&&n!==-1?++n:n=-1}return e}const vt={toPosix(r){return Ay(r,"\\","/")},isUrl(r){return/^https?:/.test(this.toPosix(r))},isDataUrl(r){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(r)},isBlobUrl(r){return r.startsWith("blob:")},hasProtocol(r){return/^[^/:]+:/.test(this.toPosix(r))},getProtocol(r){Nt(r),r=this.toPosix(r);const t=/^file:\/\/\//.exec(r);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(r);return e?e[0]:""},toAbsolute(r,t,e){if(Nt(r),this.isDataUrl(r)||this.isBlobUrl(r))return r;const s=Hr(this.toPosix(t!=null?t:L.get().getBaseUrl())),i=Hr(this.toPosix(e!=null?e:this.rootname(s)));return r=this.toPosix(r),r.startsWith("/")?vt.join(i,r.slice(1)):this.isAbsolute(r)?r:this.join(s,r)},normalize(r){if(Nt(r),r.length===0)return".";if(this.isDataUrl(r)||this.isBlobUrl(r))return r;r=this.toPosix(r);let t="";const e=r.startsWith("/");this.hasProtocol(r)&&(t=this.rootname(r),r=r.slice(t.length));const s=r.endsWith("/");return r=Sy(r,!1),r.length>0&&s&&(r+="/"),e?`/${r}`:t+r},isAbsolute(r){return Nt(r),r=this.toPosix(r),this.hasProtocol(r)?!0:r.startsWith("/")},join(...r){var t;if(r.length===0)return".";let e;for(let s=0;s<r.length;++s){const i=r[s];if(Nt(i),i.length>0)if(e===void 0)e=i;else{const n=(t=r[s-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${i}`:e+=`/${i}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(Nt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let s=-1,i=!0;const n=this.getProtocol(r),o=r;r=r.slice(n.length);for(let a=r.length-1;a>=1;--a)if(t=r.charCodeAt(a),t===47){if(!i){s=a;break}}else i=!1;return s===-1?e?"/":this.isUrl(o)?n+r:n:e&&s===1?"//":n+r.slice(0,s)},rootname(r){Nt(r),r=this.toPosix(r);let t="";if(r.startsWith("/")?t="/":t=this.getProtocol(r),this.isUrl(r)){const e=r.indexOf("/",t.length);e!==-1?t=r.slice(0,e):t=r,t.endsWith("/")||(t+="/")}return t},basename(r,t){Nt(r),t&&Nt(t),r=Hr(this.toPosix(r));let e=0,s=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let o=t.length-1,a=-1;for(n=r.length-1;n>=0;--n){const u=r.charCodeAt(n);if(u===47){if(!i){e=n+1;break}}else a===-1&&(i=!1,a=n+1),o>=0&&(u===t.charCodeAt(o)?--o===-1&&(s=n):(o=-1,s=a))}return e===s?s=a:s===-1&&(s=r.length),r.slice(e,s)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!i){e=n+1;break}}else s===-1&&(i=!1,s=n+1);return s===-1?"":r.slice(e,s)},extname(r){Nt(r),r=Hr(this.toPosix(r));let t=-1,e=0,s=-1,i=!0,n=0;for(let o=r.length-1;o>=0;--o){const a=r.charCodeAt(o);if(a===47){if(!i){e=o+1;break}continue}s===-1&&(i=!1,s=o+1),a===46?t===-1?t=o:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||s===-1||n===0||n===1&&t===s-1&&t===e+1?"":r.slice(t,s)},parse(r){Nt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Hr(this.toPosix(r));let e=r.charCodeAt(0);const s=this.isAbsolute(r);let i;const n="";t.root=this.rootname(r),s||this.hasProtocol(r)?i=1:i=0;let o=-1,a=0,u=-1,l=!0,c=r.length-1,h=0;for(;c>=i;--c){if(e=r.charCodeAt(c),e===47){if(!l){a=c+1;break}continue}u===-1&&(l=!1,u=c+1),e===46?o===-1?o=c:h!==1&&(h=1):o!==-1&&(h=-1)}return o===-1||u===-1||h===0||h===1&&o===u-1&&o===a+1?u!==-1&&(a===0&&s?t.base=t.name=r.slice(1,u):t.base=t.name=r.slice(a,u)):(a===0&&s?(t.name=r.slice(1,o),t.base=r.slice(1,u)):(t.name=r.slice(a,o),t.base=r.slice(a,u)),t.ext=r.slice(o,u)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},Bt=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(s=>typeof s=="string"||e?t(s):s):r);function bh(r,t,e,s,i){const n=t[e];for(let o=0;o<n.length;o++){const a=n[o];e<t.length-1?bh(r.replace(s[e],a),t,e+1,s,i):i.push(r.replace(s[e],a))}}function xh(r){const t=/\{(.*?)\}/g,e=r.match(t),s=[];if(e){const i=[];e.forEach(n=>{const o=n.substring(1,n.length-1).split(",");i.push(o)}),bh(r,i,0,e,s)}else s.push(r);return s}const Xr=r=>!Array.isArray(r);var Ey=Object.defineProperty,wy=Object.defineProperties,Cy=Object.getOwnPropertyDescriptors,yh=Object.getOwnPropertySymbols,Ry=Object.prototype.hasOwnProperty,Py=Object.prototype.propertyIsEnumerable,vh=(r,t,e)=>t in r?Ey(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qe=(r,t)=>{for(var e in t||(t={}))Ry.call(t,e)&&vh(r,e,t[e]);if(yh)for(var e of yh(t))Py.call(t,e)&&vh(r,e,t[e]);return r},Dy=(r,t)=>wy(r,Cy(t));class pe{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,s,i;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(s=t.createBundleAssetId)!=null?s:this._createBundleAssetId,this._extractAssetIdFromBundle=(i=t.extractAssetIdFromBundle)!=null?i:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(s=>`${encodeURIComponent(s)}=${encodeURIComponent(e[s])}`).join("&")}}getAlias(t){const{alias:e,src:s}=t;return Bt(e||s,i=>typeof i=="string"?i:Array.isArray(i)?i.map(n=>{var o;return(o=n==null?void 0:n.src)!=null?o:n}):i!=null&&i.src?i.src:i,!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const s=[];let i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,o])=>typeof o=="string"||Array.isArray(o)?{alias:n,src:o}:Qe({alias:n},o))),i.forEach(n=>{const o=n.src,a=n.alias;let u;if(typeof a=="string"){const l=this._createBundleAssetId(t,a);s.push(l),u=[a,l]}else{const l=a.map(c=>this._createBundleAssetId(t,c));s.push(...l),u=[...a,...l]}this.add(Dy(Qe({},n),{alias:u,src:o}))}),this._bundles[t]=s}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let s;Bt(e).forEach(i=>{const{src:n}=i;let{data:o,format:a,loadParser:u}=i;const l=Bt(n).map(d=>typeof d=="string"?xh(d):Array.isArray(d)?d:[d]),c=this.getAlias(i),h=[];l.forEach(d=>{d.forEach(p=>{var f,g,m;let _={};if(typeof p!="object"){_.src=p;for(let x=0;x<this._parsers.length;x++){const b=this._parsers[x];if(b.test(p)){_=b.parse(p);break}}}else o=(f=p.data)!=null?f:o,a=(g=p.format)!=null?g:a,u=(m=p.loadParser)!=null?m:u,_=Qe(Qe({},_),p);if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${_.src}`);_=this._buildResolvedAsset(_,{aliases:c,data:o,format:a,loadParser:u}),h.push(_)})}),c.forEach(d=>{this._assetMap[d]=h})})}resolveBundle(t){const e=Xr(t);t=Bt(t);const s={};return t.forEach(i=>{const n=this._bundles[i];if(n){const o=this.resolve(n),a={};for(const u in o){const l=o[u];a[this._extractAssetIdFromBundle(i,u)]=l}s[i]=a}}),e?s[t[0]]:s}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const s={};for(const i in e)s[i]=e[i].src;return s}return e.src}resolve(t){const e=Xr(t);t=Bt(t);const s={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const o=this._getPreferredOrder(n);o==null||o.priority.forEach(a=>{o.params[a].forEach(u=>{const l=n.filter(c=>c[a]?c[a]===u:!1);l.length&&(n=l)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});s[i]=this._resolverHash[i]}),e?s[t[0]]:s}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const s=t[0],i=this._preferredOrder.find(n=>n.params.format.includes(s.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var s,i;const{aliases:n,data:o,loadParser:a,format:u}=e;return(this._basePath||this._rootPath)&&(t.src=vt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(s=n!=null?n:t.alias)!=null?s:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Qe(Qe({},o||{}),t.data),t.loadParser=a!=null?a:t.loadParser,t.format=(i=u!=null?u:t.format)!=null?i:Th(t.src),t}}pe.RETINA_PREFIX=/@([0-9\.]+)x/;function Th(r){return r.split(".").pop().split("?").shift().split("#").shift()}const qs=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};var oo={exports:{}},bP=oo.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function s(){}Object.create&&(s.prototype=Object.create(null),new s().__proto__||(e=!1));function i(u,l,c){this.fn=u,this.context=l,this.once=c||!1}function n(u,l,c,h,d){if(typeof c!="function")throw new TypeError("The listener must be a function");var p=new i(c,h||u,d),f=e?e+l:l;return u._events[f]?u._events[f].fn?u._events[f]=[u._events[f],p]:u._events[f].push(p):(u._events[f]=p,u._eventsCount++),u}function o(u,l){--u._eventsCount===0?u._events=new s:delete u._events[l]}function a(){this._events=new s,this._eventsCount=0}a.prototype.eventNames=function(){var l=[],c,h;if(this._eventsCount===0)return l;for(h in c=this._events)t.call(c,h)&&l.push(e?h.slice(1):h);return Object.getOwnPropertySymbols?l.concat(Object.getOwnPropertySymbols(c)):l},a.prototype.listeners=function(l){var c=e?e+l:l,h=this._events[c];if(!h)return[];if(h.fn)return[h.fn];for(var d=0,p=h.length,f=new Array(p);d<p;d++)f[d]=h[d].fn;return f},a.prototype.listenerCount=function(l){var c=e?e+l:l,h=this._events[c];return h?h.fn?1:h.length:0},a.prototype.emit=function(l,c,h,d,p,f){var g=e?e+l:l;if(!this._events[g])return!1;var m=this._events[g],_=arguments.length,x,b;if(m.fn){switch(m.once&&this.removeListener(l,m.fn,void 0,!0),_){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,h),!0;case 4:return m.fn.call(m.context,c,h,d),!0;case 5:return m.fn.call(m.context,c,h,d,p),!0;case 6:return m.fn.call(m.context,c,h,d,p,f),!0}for(b=1,x=new Array(_-1);b<_;b++)x[b-1]=arguments[b];m.fn.apply(m.context,x)}else{var v=m.length,A;for(b=0;b<v;b++)switch(m[b].once&&this.removeListener(l,m[b].fn,void 0,!0),_){case 1:m[b].fn.call(m[b].context);break;case 2:m[b].fn.call(m[b].context,c);break;case 3:m[b].fn.call(m[b].context,c,h);break;case 4:m[b].fn.call(m[b].context,c,h,d);break;default:if(!x)for(A=1,x=new Array(_-1);A<_;A++)x[A-1]=arguments[A];m[b].fn.apply(m[b].context,x)}}return!0},a.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},a.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},a.prototype.removeListener=function(l,c,h,d){var p=e?e+l:l;if(!this._events[p])return this;if(!c)return o(this,p),this;var f=this._events[p];if(f.fn)f.fn===c&&(!d||f.once)&&(!h||f.context===h)&&o(this,p);else{for(var g=0,m=[],_=f.length;g<_;g++)(f[g].fn!==c||d&&!f[g].once||h&&f[g].context!==h)&&m.push(f[g]);m.length?this._events[p]=m.length===1?m[0]:m:o(this,p)}return this},a.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&o(this,c)):(this._events=new s,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=e,a.EventEmitter=a,r.exports=a})(oo);var My=oo.exports,Ct=ks(My);const Ah=Math.PI*2,Sh=180/Math.PI,Eh=Math.PI/180;class nt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new nt(this.x,this.y)}copyFrom(t){return this.set(t.x,t.y),this}copyTo(t){return t.set(this.x,this.y),t}equals(t){return t.x===this.x&&t.y===this.y}set(t=0,e=t){return this.x=t,this.y=e,this}static get shared(){return ao.x=0,ao.y=0,ao}}const ao=new nt;class B{constructor(t=1,e=0,s=0,i=1,n=0,o=0){this.array=null,this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,s,i,n,o){return this.a=t,this.b=e,this.c=s,this.d=i,this.tx=n,this.ty=o,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const s=e||this.array;return t?(s[0]=this.a,s[1]=this.b,s[2]=0,s[3]=this.c,s[4]=this.d,s[5]=0,s[6]=this.tx,s[7]=this.ty,s[8]=1):(s[0]=this.a,s[1]=this.c,s[2]=this.tx,s[3]=this.b,s[4]=this.d,s[5]=this.ty,s[6]=0,s[7]=0,s[8]=1),s}apply(t,e){e=e||new nt;const s=t.x,i=t.y;return e.x=this.a*s+this.c*i+this.tx,e.y=this.b*s+this.d*i+this.ty,e}applyInverse(t,e){e=e||new nt;const s=this.a,i=this.b,n=this.c,o=this.d,a=this.tx,u=this.ty,l=1/(s*o+n*-i),c=t.x,h=t.y;return e.x=o*l*c+-n*l*h+(u*n-a*o)*l,e.y=s*l*h+-i*l*c+(-u*s+a*i)*l,e}translate(t,e){return this.tx+=t,this.ty+=e,this}scale(t,e){return this.a*=t,this.d*=e,this.c*=t,this.b*=e,this.tx*=t,this.ty*=e,this}rotate(t){const e=Math.cos(t),s=Math.sin(t),i=this.a,n=this.c,o=this.tx;return this.a=i*e-this.b*s,this.b=i*s+this.b*e,this.c=n*e-this.d*s,this.d=n*s+this.d*e,this.tx=o*e-this.ty*s,this.ty=o*s+this.ty*e,this}append(t){const e=this.a,s=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*s+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*s+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*s+t.ty*n+this.ty,this}appendFrom(t,e){const s=t.a,i=t.b,n=t.c,o=t.d,a=t.tx,u=t.ty,l=e.a,c=e.b,h=e.c,d=e.d;return this.a=s*l+i*h,this.b=s*c+i*d,this.c=n*l+o*h,this.d=n*c+o*d,this.tx=a*l+u*h+e.tx,this.ty=a*c+u*d+e.ty,this}setTransform(t,e,s,i,n,o,a,u,l){return this.a=Math.cos(a+l)*n,this.b=Math.sin(a+l)*n,this.c=-Math.sin(a-u)*o,this.d=Math.cos(a-u)*o,this.tx=t-(s*this.a+i*this.c),this.ty=e-(s*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const s=this.a,i=this.c;this.a=s*t.a+this.b*t.c,this.b=s*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,s=this.b,i=this.c,n=this.d,o=t.pivot,a=-Math.atan2(-i,n),u=Math.atan2(s,e),l=Math.abs(a+u);return l<1e-5||Math.abs(Ah-l)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=a,t.skew.y=u),t.scale.x=Math.sqrt(e*e+s*s),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(o.x*e+o.y*i),t.position.y=this.ty+(o.x*s+o.y*n),t}invert(){const t=this.a,e=this.b,s=this.c,i=this.d,n=this.tx,o=t*i-e*s;return this.a=i/o,this.b=-e/o,this.c=-s/o,this.d=t/o,this.tx=(s*this.ty-i*n)/o,this.ty=-(t*this.ty-e*n)/o,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new B;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}static get IDENTITY(){return By.identity()}static get shared(){return Oy.identity()}}const Oy=new B,By=new B,Re=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Pe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],De=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Me=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],uo=[],wh=[],Ks=Math.sign;function Gy(){for(let r=0;r<16;r++){const t=[];uo.push(t);for(let e=0;e<16;e++){const s=Ks(Re[r]*Re[e]+De[r]*Pe[e]),i=Ks(Pe[r]*Re[e]+Me[r]*Pe[e]),n=Ks(Re[r]*De[e]+De[r]*Me[e]),o=Ks(Pe[r]*De[e]+Me[r]*Me[e]);for(let a=0;a<16;a++)if(Re[a]===s&&Pe[a]===i&&De[a]===n&&Me[a]===o){t.push(a);break}}}for(let r=0;r<16;r++){const t=new B;t.set(Re[r],Pe[r],De[r],Me[r],0,0),wh.push(t)}}Gy();const $={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:r=>Re[r],uY:r=>Pe[r],vX:r=>De[r],vY:r=>Me[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>uo[r][t],sub:(r,t)=>uo[r][$.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?$.S:$.N:Math.abs(t)*2<=Math.abs(r)?r>0?$.E:$.W:t>0?r>0?$.SE:$.SW:r>0?$.NE:$.NW,matrixAppendRotationInv:(r,t,e=0,s=0)=>{const i=wh[$.inv(t)];i.tx=e,i.ty=s,r.append(i)}},Zs=[new nt,new nt,new nt,new nt];class V{constructor(t=0,e=0,s=0,i=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(s),this.height=Number(i)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new V(0,0,0,0)}clone(){return new V(this.x,this.y,this.width,this.height)}copyFromBounds(t){return this.x=t.minX,this.y=t.minY,this.width=t.maxX-t.minX,this.height=t.maxY-t.minY,this}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){return this.width<=0||this.height<=0?!1:t>=this.x&&t<this.x+this.width&&e>=this.y&&e<this.y+this.height}strokeContains(t,e,s){const{width:i,height:n}=this;if(i<=0||n<=0)return!1;const o=this.x,a=this.y,u=o-s/2,l=o+i+s/2,c=a-s/2,h=a+n+s/2,d=o+s/2,p=o+i-s/2,f=a+s/2,g=a+n-s/2;return t>=u&&t<=l&&e>=c&&e<=h&&!(t>d&&t<p&&e>f&&e<g)}intersects(t,e){if(!e){const R=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=R)return!1;const T=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>T}const s=this.left,i=this.right,n=this.top,o=this.bottom;if(i<=s||o<=n)return!1;const a=Zs[0].set(t.left,t.top),u=Zs[1].set(t.left,t.bottom),l=Zs[2].set(t.right,t.top),c=Zs[3].set(t.right,t.bottom);if(l.x<=a.x||u.y<=a.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(a,a),e.apply(u,u),e.apply(l,l),e.apply(c,c),Math.max(a.x,u.x,l.x,c.x)<=s||Math.min(a.x,u.x,l.x,c.x)>=i||Math.max(a.y,u.y,l.y,c.y)<=n||Math.min(a.y,u.y,l.y,c.y)>=o))return!1;const d=h*(u.y-a.y),p=h*(a.x-u.x),f=d*s+p*n,g=d*i+p*n,m=d*s+p*o,_=d*i+p*o;if(Math.max(f,g,m,_)<=d*a.x+p*a.y||Math.min(f,g,m,_)>=d*c.x+p*c.y)return!1;const x=h*(a.y-l.y),b=h*(l.x-a.x),v=x*s+b*n,A=x*i+b*n,C=x*s+b*o,w=x*i+b*o;return!(Math.max(v,A,C,w)<=x*a.x+b*a.y||Math.min(v,A,C,w)>=x*c.x+b*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),s=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(s-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const s=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=s-this.x,this.height=i-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),s=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=s-e,this.y=i,this.height=n-i,this}getBounds(t){return t=t||new V,t.copyFrom(this),t}}const zr={default:-1};function Q(r="default"){return zr[r]===void 0&&(zr[r]=-1),++zr[r]}function Iy(){for(const r in zr)delete zr[r]}const lo=()=>{};function Oe(r){return r+=r===0?1:0,--r,r|=r>>>1,r|=r>>>2,r|=r>>>4,r|=r>>>8,r|=r>>>16,r+1}function co(r){return!(r&r-1)&&!!r}function Fy(r){let t=(r>65535?1:0)<<4;r>>>=t;let e=(r>255?1:0)<<3;return r>>>=e,t|=e,e=(r>15?1:0)<<2,r>>>=e,t|=e,e=(r>3?1:0)<<1,r>>>=e,t|=e,t|r>>1}function Vt(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Uy=Object.defineProperty,Ch=Object.getOwnPropertySymbols,ky=Object.prototype.hasOwnProperty,Ny=Object.prototype.propertyIsEnumerable,Rh=(r,t,e)=>t in r?Uy(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ph=(r,t)=>{for(var e in t||(t={}))ky.call(t,e)&&Rh(r,e,t[e]);if(Ch)for(var e of Ch(t))Ny.call(t,e)&&Rh(r,e,t[e]);return r};const Dh=Object.create(null);function Ly(r){const t=Dh[r];return t===void 0&&(Dh[r]=Q("resource")),t}const Mh=class cx extends Ct{constructor(t={}){var e,s,i,n,o,a,u;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=Ph(Ph({},cx.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(s=t.addressModeV)!=null?s:this.addressModeV,this.addressModeW=(i=t.addressModeW)!=null?i:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(n=t.magFilter)!=null?n:this.magFilter,this.minFilter=(o=t.minFilter)!=null?o:this.minFilter,this.mipmapFilter=(a=t.mipmapFilter)!=null?a:this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=(u=t.maxAnisotropy)!=null?u:1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){this.addressMode=t}get wrapMode(){return this.addressMode}set scaleMode(t){this.magFilter=t,this.minFilter=t,this.mipmapFilter=t}get scaleMode(){return this.magFilter}set maxAnisotropy(t){this._maxAnisotropy=Math.min(t,16),this._maxAnisotropy>1&&(this.scaleMode="linear")}get maxAnisotropy(){return this._maxAnisotropy}get _resourceId(){return this._sharedResourceId||this._generateResourceId()}update(){this.emit("change",this),this._sharedResourceId=null}_generateResourceId(){const t=`${this.addressModeU}-${this.addressModeV}-${this.addressModeW}-${this.magFilter}-${this.minFilter}-${this.mipmapFilter}-${this.lodMinClamp}-${this.lodMaxClamp}-${this.compare}-${this._maxAnisotropy}`;return this._sharedResourceId=Ly(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Mh.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Oh=Mh;var $y=Object.defineProperty,Bh=Object.getOwnPropertySymbols,Hy=Object.prototype.hasOwnProperty,Xy=Object.prototype.propertyIsEnumerable,Gh=(r,t,e)=>t in r?$y(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ih=(r,t)=>{for(var e in t||(t={}))Hy.call(t,e)&&Gh(r,e,t[e]);if(Bh)for(var e of Bh(t))Xy.call(t,e)&&Gh(r,e,t[e]);return r};const Fh=class hx extends Ct{constructor(t={}){var e,s,i;super(),this.options=t,this.uid=Q("textureSource"),this._resourceType="textureSource",this._resourceId=Q("resource"),this.uploadMethodId="unknown",this._resolution=1,this.pixelWidth=1,this.pixelHeight=1,this.width=1,this.height=1,this.sampleCount=1,this.mipLevelCount=1,this.autoGenerateMipmaps=!1,this.format="rgba8unorm",this.dimension="2d",this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t=Ih(Ih({},hx.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(s=this.resourceWidth)!=null?s:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(i=this.resourceHeight)!=null?i:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Oh(Vt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,s;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(s=this._style)==null||s.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=Q("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,s){s=s||this._resolution,t=t||this.width,e=e||this.height;const i=Math.round(t*s),n=Math.round(e*s);return this.width=i/s,this.height=n/s,this._resolution=s,this.pixelWidth===i&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=n,this.emit("resize",this),this._resourceId=Q("resource"),this.emit("change",this),!0)}updateMipmaps(){this.autoGenerateMipmaps&&this.mipLevelCount>1&&this.emit("updateMipmaps",this)}set wrapMode(t){this._style.wrapMode=t}get wrapMode(){return this._style.wrapMode}set scaleMode(t){this._style.scaleMode=t}get scaleMode(){return this._style.scaleMode}_refreshPOT(){this.isPowerOfTwo=co(this.pixelWidth)&&co(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Fh.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let tt=Fh;var zy=Object.defineProperty,jy=Object.defineProperties,Vy=Object.getOwnPropertyDescriptors,Uh=Object.getOwnPropertySymbols,Wy=Object.prototype.hasOwnProperty,Yy=Object.prototype.propertyIsEnumerable,kh=(r,t,e)=>t in r?zy(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qy=(r,t)=>{for(var e in t||(t={}))Wy.call(t,e)&&kh(r,e,t[e]);if(Uh)for(var e of Uh(t))Yy.call(t,e)&&kh(r,e,t[e]);return r},Ky=(r,t)=>jy(r,Vy(t));class Qs extends tt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let s=t.format;s||(e instanceof Float32Array?s="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?s="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?s="rgba16uint":(e instanceof Int8Array,s="bgra8unorm")),super(Ky(qy({},t),{resource:e,format:s})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Qs.extension=y.TextureSource;const Nh=new B;class ho{constructor(t,e){this.mapCoord=new B,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const s=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],o=t[i+1];e[i]=n*s.a+o*s.c+s.tx,e[i+1]=n*s.b+o*s.d+s.ty}return e}update(){const t=this._texture;this._updateID++;const e=t.uvs;this.mapCoord.set(e.x1-e.x0,e.y1-e.y0,e.x3-e.x0,e.y3-e.y0,e.x0,e.y0);const s=t.orig,i=t.trim;i&&(Nh.set(s.width/i.width,0,0,s.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Nh));const n=t.source,o=this.uClampFrame,a=this.clampMargin/n._resolution,u=this.clampOffset/n._resolution;return o[0]=(t.frame.x+a+u)/n.width,o[1]=(t.frame.y+a+u)/n.height,o[2]=(t.frame.x+t.frame.width-a+u)/n.width,o[3]=(t.frame.y+t.frame.height-a+u)/n.height,this.uClampOffset[0]=this.clampOffset/n.pixelWidth,this.uClampOffset[1]=this.clampOffset/n.pixelHeight,this.isSimple=t.frame.width===n.width&&t.frame.height===n.height&&t.rotate===0,!0}}class E extends Ct{constructor({source:t,label:e,frame:s,orig:i,trim:n,defaultAnchor:o,defaultBorders:a,rotate:u,dynamic:l}={}){var c;if(super(),this.uid=Q("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new V,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(c=t==null?void 0:t.source)!=null?c:new tt,this.noFrame=!s,s)this.frame.copyFrom(s);else{const{width:h,height:d}=this._source;this.frame.width=h,this.frame.height=d}this.orig=i||this.frame,this.trim=n,this.rotate=u!=null?u:0,this.defaultAnchor=o,this.defaultBorders=a,this.destroyed=!1,this.dynamic=l||!1,this.updateUvs()}set source(t){this._source&&this._source.off("resize",this.update,this),this._source=t,t.on("resize",this.update,this),this.emit("update",this)}get source(){return this._source}get textureMatrix(){return this._textureMatrix||(this._textureMatrix=new ho(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:s,height:i}=this._source,n=e.x/s,o=e.y/i,a=e.width/s,u=e.height/i;let l=this.rotate;if(l){const c=a/2,h=u/2,d=n+c,p=o+h;l=$.add(l,$.NW),t.x0=d+c*$.uX(l),t.y0=p+h*$.uY(l),l=$.add(l,2),t.x1=d+c*$.uX(l),t.y1=p+h*$.uY(l),l=$.add(l,2),t.x2=d+c*$.uX(l),t.y2=p+h*$.uY(l),l=$.add(l,2),t.x3=d+c*$.uX(l),t.y3=p+h*$.uY(l)}else t.x0=n,t.y0=o,t.x1=n+a,t.y1=o,t.x2=n+a,t.y2=o+u,t.x3=n,t.y3=o+u}destroy(t=!1){this._source&&t&&(this._source.destroy(),this._source=null),this._textureMatrix=null,this.destroyed=!0,this.emit("destroy",this),this.removeAllListeners()}update(){this.noFrame&&(this.frame.width=this._source.width,this.frame.height=this._source.height),this.updateUvs(),this.emit("update",this)}get baseTexture(){return this._source}}E.EMPTY=new E({label:"EMPTY",source:new tt({label:"EMPTY"})}),E.EMPTY.destroy=lo,E.WHITE=new E({source:new Qs({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),E.WHITE.destroy=lo;const Lh=class Os{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof E?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const s=parseFloat(e.meta.scale);s?(this.resolution=s,t.source.resolution=this.resolution):this.resolution=t.source._resolution,this._frames=this.data.frames,this._frameKeys=Object.keys(this._frames),this._batchIndex=0,this._callback=null}parse(){return new Promise(t=>{this._callback=t,this._batchIndex=0,this._frameKeys.length<=Os.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const s=Os.BATCH_SIZE;for(;e-t<s&&e<this._frameKeys.length;){const i=this._frameKeys[e],n=this._frames[i],o=n.frame;if(o){let a=null,u=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new V(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):a=new V(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(u=new V(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[i]=new E({source:this.textureSource,frame:a,orig:c,trim:u,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:i.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let s=0;s<t[e].length;s++){const i=t[e][s];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Os.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Os.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const s in this.textures)this.textures[s].destroy();this._frames=null,this._frameKeys=null,this.data=null,this.textures=null,t&&((e=this._texture)==null||e.destroy(),this.textureSource.destroy()),this._texture=null,this.textureSource=null,this.linkedSheets=[]}};Lh.BATCH_SIZE=1e3;let po=Lh;const Zy=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function $h(r,t,e){const s={};if(r.forEach(i=>{s[i]=t}),Object.keys(t.textures).forEach(i=>{s[i]=t.textures[i]}),!e){const i=vt.dirname(r[0]);t.linkedSheets.forEach((n,o)=>{const a=$h([`${i}/${t.data.meta.related_multi_packs[o]}`],n,!0);Object.assign(s,a)})}return s}const Hh={extension:y.Asset,cache:{test:r=>r instanceof po,getCacheableAssets:(r,t)=>$h(r,t,!1)},resolver:{extension:{type:y.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),s=t.pop();return e==="json"&&Zy.includes(s)},parse:r=>{var t,e;const s=r.split(".");return{resolution:parseFloat((e=(t=pe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:s[s.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:y.LoadParser,priority:wt.Normal,name:"spritesheetLoader"},async testParse(r,t){return vt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var s,i,n;const{texture:o,imageFilename:a}=(s=t==null?void 0:t.data)!=null?s:{};let u=vt.dirname(t.src);u&&u.lastIndexOf("/")!==u.length-1&&(u+="/");let l;if(o instanceof E)l=o;else{const d=qs(u+(a!=null?a:r.meta.image),t.src);l=(await e.load([d]))[d]}const c=new po(l.source,r);await c.parse();const h=(i=r==null?void 0:r.meta)==null?void 0:i.related_multi_packs;if(Array.isArray(h)){const d=[];for(const f of h){if(typeof f!="string")continue;let g=u+f;(n=t.data)!=null&&n.ignoreMultiPack||(g=qs(g,t.src),d.push(e.load({src:g,data:{ignoreMultiPack:!0}})))}const p=await Promise.all(d);c.linkedSheets=p,p.forEach(f=>{f.linkedSheets=[c].concat(c.linkedSheets.filter(g=>g!==f))})}return c},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};k.add(Hh);class ot{constructor(t,e,s){this._x=e||0,this._y=s||0,this._observer=t}clone(t){return new ot(t!=null?t:this._observer,this._x,this._y)}set(t=0,e=t){return(this._x!==t||this._y!==e)&&(this._x=t,this._y=e,this._observer._onUpdate(this)),this}copyFrom(t){return(this._x!==t.x||this._y!==t.y)&&(this._x=t.x,this._y=t.y,this._observer._onUpdate(this)),this}copyTo(t){return t.set(this._x,this._y),t}equals(t){return t.x===this._x&&t.y===this._y}get x(){return this._x}set x(t){this._x!==t&&(this._x=t,this._observer._onUpdate(this))}get y(){return this._y}set y(t){this._y!==t&&(this._y=t,this._observer._onUpdate(this))}}function jr(r,t,e,s){const{width:i,height:n}=e.orig,o=e.trim;if(o){const a=o.width,u=o.height;r.minX=o.x-t._x*i-s,r.maxX=r.minX+a,r.minY=o.y-t._y*n-s,r.maxY=r.minY+u}else r.minX=-t._x*i-s,r.maxX=r.minX+i,r.minY=-t._y*n-s,r.maxY=r.minY+n}const Xh=new B;class pt{constructor(t=1/0,e=1/0,s=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Xh,this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new V);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Xh,this}set(t,e,s,i){this.minX=t,this.minY=e,this.maxX=s,this.maxY=i}addFrame(t,e,s,i,n){n||(n=this.matrix);const o=n.a,a=n.b,u=n.c,l=n.d,c=n.tx,h=n.ty;let d=this.minX,p=this.minY,f=this.maxX,g=this.maxY,m=o*t+u*e+c,_=a*t+l*e+h;m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*s+u*e+c,_=a*s+l*e+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*t+u*i+c,_=a*t+l*i+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),m=o*s+u*i+c,_=a*s+l*i+h,m<d&&(d=m),_<p&&(p=_),m>f&&(f=m),_>g&&(g=_),this.minX=d,this.minY=p,this.maxX=f,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,s=this.minY,i=this.maxX,n=this.maxY,{a:o,b:a,c:u,d:l,tx:c,ty:h}=t;let d=o*e+u*s+c,p=a*e+l*s+h;this.minX=d,this.minY=p,this.maxX=d,this.maxY=p,d=o*i+u*s+c,p=a*i+l*s+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY,d=o*e+u*n+c,p=a*e+l*n+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY,d=o*i+u*n+c,p=a*i+l*n+h,this.minX=d<this.minX?d:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=d>this.maxX?d:this.maxX,this.maxY=p>this.maxY?p:this.maxY}fit(t){return this.minX<t.left&&(this.minX=t.left),this.maxX>t.right&&(this.maxX=t.right),this.minY<t.top&&(this.minY=t.top),this.maxY>t.bottom&&(this.maxY=t.bottom),this}fitBounds(t,e,s,i){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<s&&(this.minY=s),this.maxY>i&&(this.maxY=i),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new pt(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,s,i){let n=this.minX,o=this.minY,a=this.maxX,u=this.maxY;i||(i=this.matrix);const l=i.a,c=i.b,h=i.c,d=i.d,p=i.tx,f=i.ty;for(let g=e;g<s;g+=2){const m=t[g],_=t[g+1],x=l*m+h*_+p,b=c*m+d*_+f;n=x<n?x:n,o=b<o?b:o,a=x>a?x:a,u=b>u?b:u}this.minX=n,this.minY=o,this.maxX=a,this.maxY=u}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}}var Qy={grad:.9,turn:360,rad:360/(2*Math.PI)},ie=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},lt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Gt=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},zh=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},jh=function(r){return{r:Gt(r.r,0,255),g:Gt(r.g,0,255),b:Gt(r.b,0,255),a:Gt(r.a)}},fo=function(r){return{r:lt(r.r),g:lt(r.g),b:lt(r.b),a:lt(r.a,3)}},Jy=/^#([0-9a-f]{3,8})$/i,Js=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Vh=function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=Math.max(t,e,s),o=n-Math.min(t,e,s),a=o?n===t?(e-s)/o:n===e?2+(s-t)/o:4+(t-e)/o:0;return{h:60*(a<0?a+6:a),s:n?o/n*100:0,v:n/255*100,a:i}},Wh=function(r){var t=r.h,e=r.s,s=r.v,i=r.a;t=t/360*6,e/=100,s/=100;var n=Math.floor(t),o=s*(1-e),a=s*(1-(t-n)*e),u=s*(1-(1-t+n)*e),l=n%6;return{r:255*[s,a,o,o,u,s][l],g:255*[u,s,s,a,o,o][l],b:255*[o,o,u,s,s,a][l],a:i}},Yh=function(r){return{h:zh(r.h),s:Gt(r.s,0,100),l:Gt(r.l,0,100),a:Gt(r.a)}},qh=function(r){return{h:lt(r.h),s:lt(r.s),l:lt(r.l),a:lt(r.a,3)}},Kh=function(r){return Wh((e=(t=r).s,{h:t.h,s:(e*=((s=t.l)<50?s:100-s)/100)>0?2*e/(s+e)*100:0,v:s+e,a:t.a}));var t,e,s},Vr=function(r){return{h:(t=Vh(r)).h,s:(i=(200-(e=t.s))*(s=t.v)/100)>0&&i<200?e*s/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,s,i},tv=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,ev=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,rv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,sv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,mo={string:[[function(r){var t=Jy.exec(r);return t?(r=t[1]).length<=4?{r:parseInt(r[0]+r[0],16),g:parseInt(r[1]+r[1],16),b:parseInt(r[2]+r[2],16),a:r.length===4?lt(parseInt(r[3]+r[3],16)/255,2):1}:r.length===6||r.length===8?{r:parseInt(r.substr(0,2),16),g:parseInt(r.substr(2,2),16),b:parseInt(r.substr(4,2),16),a:r.length===8?lt(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=rv.exec(r)||sv.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:jh({r:Number(t[1])/(t[2]?100/255:1),g:Number(t[3])/(t[4]?100/255:1),b:Number(t[5])/(t[6]?100/255:1),a:t[7]===void 0?1:Number(t[7])/(t[8]?100:1)}):null},"rgb"],[function(r){var t=tv.exec(r)||ev.exec(r);if(!t)return null;var e,s,i=Yh({h:(e=t[1],s=t[2],s===void 0&&(s="deg"),Number(e)*(Qy[s]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Kh(i)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,s=r.b,i=r.a,n=i===void 0?1:i;return ie(t)&&ie(e)&&ie(s)?jh({r:Number(t),g:Number(e),b:Number(s),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,s=r.l,i=r.a,n=i===void 0?1:i;if(!ie(t)||!ie(e)||!ie(s))return null;var o=Yh({h:Number(t),s:Number(e),l:Number(s),a:Number(n)});return Kh(o)},"hsl"],[function(r){var t=r.h,e=r.s,s=r.v,i=r.a,n=i===void 0?1:i;if(!ie(t)||!ie(e)||!ie(s))return null;var o=function(a){return{h:zh(a.h),s:Gt(a.s,0,100),v:Gt(a.v,0,100),a:Gt(a.a)}}({h:Number(t),s:Number(e),v:Number(s),a:Number(n)});return Wh(o)},"hsv"]]},Zh=function(r,t){for(var e=0;e<t.length;e++){var s=t[e][0](r);if(s)return[s,t[e][1]]}return[null,void 0]},Qh=function(r){return typeof r=="string"?Zh(r.trim(),mo.string):typeof r=="object"&&r!==null?Zh(r,mo.object):[null,void 0]},xP=function(r){return Qh(r)[1]},go=function(r,t){var e=Vr(r);return{h:e.h,s:Gt(e.s+100*t,0,100),l:e.l,a:e.a}},_o=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Jh=function(r,t){var e=Vr(r);return{h:e.h,s:e.s,l:Gt(e.l+100*t,0,100),a:e.a}},ti=function(){function r(t){this.parsed=Qh(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return r.prototype.isValid=function(){return this.parsed!==null},r.prototype.brightness=function(){return lt(_o(this.rgba),2)},r.prototype.isDark=function(){return _o(this.rgba)<.5},r.prototype.isLight=function(){return _o(this.rgba)>=.5},r.prototype.toHex=function(){return t=fo(this.rgba),e=t.r,s=t.g,i=t.b,o=(n=t.a)<1?Js(lt(255*n)):"","#"+Js(e)+Js(s)+Js(i)+o;var t,e,s,i,n,o},r.prototype.toRgb=function(){return fo(this.rgba)},r.prototype.toRgbString=function(){return t=fo(this.rgba),e=t.r,s=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+s+", "+i+", "+n+")":"rgb("+e+", "+s+", "+i+")";var t,e,s,i,n},r.prototype.toHsl=function(){return qh(Vr(this.rgba))},r.prototype.toHslString=function(){return t=qh(Vr(this.rgba)),e=t.h,s=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+s+"%, "+i+"%, "+n+")":"hsl("+e+", "+s+"%, "+i+"%)";var t,e,s,i,n},r.prototype.toHsv=function(){return t=Vh(this.rgba),{h:lt(t.h),s:lt(t.s),v:lt(t.v),a:lt(t.a,3)};var t},r.prototype.invert=function(){return Wt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},r.prototype.saturate=function(t){return t===void 0&&(t=.1),Wt(go(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Wt(go(this.rgba,-t))},r.prototype.grayscale=function(){return Wt(go(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Wt(Jh(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Wt(Jh(this.rgba,-t))},r.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},r.prototype.alpha=function(t){return typeof t=="number"?Wt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):lt(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Vr(this.rgba);return typeof t=="number"?Wt({h:t,s:e.s,l:e.l,a:e.a}):lt(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Wt(t).toHex()},r}(),Wt=function(r){return r instanceof ti?r:new ti(r)},td=[],iv=function(r){r.forEach(function(t){td.indexOf(t)<0&&(t(ti,mo),td.push(t))})},yP=function(){return new ti({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function nv(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},s={};for(var i in e)s[e[i]]=i;var n={};r.prototype.toName=function(o){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var a,u,l=s[this.toHex()];if(l)return l;if(o!=null&&o.closest){var c=this.toRgb(),h=1/0,d="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var f in e){var g=(a=c,u=n[f],Math.pow(a.r-u.r,2)+Math.pow(a.g-u.g,2)+Math.pow(a.b-u.b,2));g<h&&(h=g,d=f)}return d}},t.string.push([function(o){var a=o.toLowerCase(),u=a==="transparent"?"#0000":e[a];return u?new r(u).toRgb():null},"name"])}var ov=Object.defineProperty,ed=Object.getOwnPropertySymbols,av=Object.prototype.hasOwnProperty,uv=Object.prototype.propertyIsEnumerable,rd=(r,t,e)=>t in r?ov(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lv=(r,t)=>{for(var e in t||(t={}))av.call(t,e)&&rd(r,e,t[e]);if(ed)for(var e of ed(t))uv.call(t,e)&&rd(r,e,t[e]);return r};iv([nv]);const Je=class Bs{constructor(t=16777215){this._value=null,this._components=new Float32Array(4),this._components.fill(1),this._int=16777215,this.value=t}get red(){return this._components[0]}get green(){return this._components[1]}get blue(){return this._components[2]}get alpha(){return this._components[3]}setValue(t){return this.value=t,this}set value(t){if(t instanceof Bs)this._value=this._cloneSource(t._value),this._int=t._int,this._components.set(t._components);else{if(t===null)throw new Error("Cannot set Color#value to null");(this._value===null||!this._isSourceEqual(this._value,t))&&(this._value=this._cloneSource(t),this._normalize(this._value))}}get value(){return this._value}_cloneSource(t){return typeof t=="string"||typeof t=="number"||t instanceof Number||t===null?t:Array.isArray(t)||ArrayBuffer.isView(t)?t.slice(0):typeof t=="object"&&t!==null?lv({},t):t}_isSourceEqual(t,e){const s=typeof t;if(s!==typeof e)return!1;if(s==="number"||s==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((i,n)=>i===e[n]);if(t!==null&&e!==null){const i=Object.keys(t),n=Object.keys(e);return i.length!==n.length?!1:i.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,s,i]=this._components;return{r:t,g:e,b:s,a:i}}toRgb(){const[t,e,s]=this._components;return{r:t,g:e,b:s}}toRgbaString(){const[t,e,s]=this.toUint8RgbArray();return`rgba(${t},${e},${s},${this.alpha})`}toUint8RgbArray(t){const[e,s,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(s*255),t[2]=Math.round(i*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,s,i,n]=this._components;return t[0]=e,t[1]=s,t[2]=i,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,s,i]=this._components;return t[0]=e,t[1]=s,t[2]=i,t}toNumber(){return this._int}toBgrNumber(){const[t,e,s]=this.toUint8RgbArray();return(s<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,s,i,n]=Bs._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=s,this._components[2]*=i,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let s=this._int>>16&255,i=this._int>>8&255,n=this._int&255;return e&&(s=s*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(s<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,s,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const o=t;e=(o>>16&255)/255,s=(o>>8&255)/255,i=(o&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,s,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,s,i,n=255]=t,e/=255,s/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const a=Bs.HEX_PATTERN.exec(t);a&&(t=`#${a[2]}`)}const o=Wt(t);o.isValid()&&({r:e,g:s,b:i,a:n}=o.rgba,e/=255,s/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=s,this._components[2]=i,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,s]=this._components;this._int=(t*255<<16)+(e*255<<8)+(s*255|0)}_clamp(t,e=0,s=1){return typeof t=="number"?Math.min(Math.max(t,e),s):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),s)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Bs||Array.isArray(t)||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Float32Array||t.r!==void 0&&t.g!==void 0&&t.b!==void 0||t.r!==void 0&&t.g!==void 0&&t.b!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0||t.h!==void 0&&t.s!==void 0&&t.l!==void 0&&t.a!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0||t.h!==void 0&&t.s!==void 0&&t.v!==void 0&&t.a!==void 0}};Je.shared=new Je,Je._temp=new Je,Je.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let j=Je;const sd={cullArea:null,cullable:!1,cullableChildren:!0};class ei{constructor(t,e){this._pool=[],this._count=0,this._index=0,this._classType=t,e&&this.prepopulate(e)}prepopulate(t){for(let e=0;e<t;e++)this._pool[this._index++]=new this._classType;this._count+=t}get(t){var e;let s;return this._index>0?s=this._pool[--this._index]:s=new this._classType,(e=s.init)==null||e.call(s,t),s}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class id{constructor(){this._poolsByClass=new Map}prepopulate(t,e){this.getPool(t).prepopulate(e)}get(t,e){return this.getPool(t).get(e)}return(t){this.getPool(t.constructor).return(t)}getPool(t){return this._poolsByClass.has(t)||this._poolsByClass.set(t,new ei(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const s=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[s]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const H=new id;function nd(r,t,e){const s=r.length;let i;if(t>=s||e===0)return;e=t+e>s?s-t:e;const n=s-e;for(i=t;i<n;++i)r[i]=r[i+e];r.length=n}const od={allowChildren:!0,removeChildren(r=0,t){const e=t!=null?t:this.children.length,s=e-r,i=[];if(s>0&&s<=e){for(let o=e-1;o>=r;o--){const a=this.children[o];a&&(i.push(a),a.parent=null)}nd(this.children,r,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(i);for(let o=0;o<i.length;++o)this.emit("childRemoved",i[o],this,o),i[o].emit("removed",this);return i}else if(s===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(r){const t=this.getChildAt(r);return this.removeChild(t)},getChildAt(r){if(r<0||r>=this.children.length)throw new Error(`getChildAt: Index (${r}) does not exist.`);return this.children[r]},setChildIndex(r,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(r),this.addChildAt(r,t)},getChildIndex(r){const t=this.children.indexOf(r);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(r,t){const{children:e}=this;if(t<0||t>e.length)throw new Error(`${r}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);if(r.parent){const i=r.parent.children.indexOf(r);if(r.parent===this&&i===t)return r;i!==-1&&r.parent.children.splice(i,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r.didViewUpdate=!1,r._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),s=this.getChildIndex(t);this.children[e]=t,this.children[s]=r;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const s=this.worldTransform.clone();return s.invert(),e.prepend(s),r.setFromMatrix(e),r}};class Wr{constructor(){this.pipe="filter",this.priority=1}destroy(){for(let t=0;t<this.filters.length;t++)this.filters[t].destroy();this.filters=null,this.filterArea=null}}class ad{constructor(){this._effectClasses=[],this._tests=[],this._initialized=!1}init(){this._initialized||(this._initialized=!0,this._effectClasses.forEach(t=>{this.add({test:t.test,maskClass:t})}))}add(t){this._tests.push(t)}getMaskEffect(t){this._initialized||this.init();for(let e=0;e<this._tests.length;e++){const s=this._tests[e];if(s.test(t))return H.get(s.maskClass,t)}return t}returnMaskEffect(t){H.return(t)}}const ri=new ad;k.handleByList(y.MaskEffect,ri._effectClasses);const ud={_maskEffect:null,_filterEffect:null,effects:[],addEffect(r){if(this.effects.indexOf(r)!==-1)return;this.effects.push(r),this.effects.sort((e,s)=>e.priority-s.priority);const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),ri.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=ri.getMaskEffect(r),this.addEffect(this._maskEffect)))},get mask(){var r;return(r=this._maskEffect)==null?void 0:r.mask},set filters(r){var t;!Array.isArray(r)&&r&&(r=[r]);const e=this._filterEffect||(this._filterEffect=new Wr);r=r;const s=(r==null?void 0:r.length)>0,i=((t=e.filters)==null?void 0:t.length)>0,n=s!==i;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),n&&(s?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new Wr),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},ld={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let s=0;s<e.length;s++){const i=e[s];if(i.label===r||r instanceof RegExp&&r.test(i.label))return i}if(t)for(let s=0;s<e.length;s++){const i=e[s].getChildByLabel(r,!0);if(i)return i}return null},getChildrenByLabel(r,t=!1,e=[]){const s=this.children;for(let i=0;i<s.length;i++){const n=s[i];(n.label===r||r instanceof RegExp&&r.test(n.label))&&e.push(n)}if(t)for(let i=0;i<s.length;i++)s[i].getChildrenByLabel(r,!0,e);return e}},Yt=new ei(B),qt=new ei(pt);function Yr(r,t,e){e.clear();let s,i;return r.parent?t?s=r.parent.worldTransform:(i=Yt.get().identity(),s=qr(r,i)):s=B.IDENTITY,bo(r,e,s,t),i&&Yt.return(i),e.isValid||e.set(0,0,0,0),e}function bo(r,t,e,s){var i,n;if(!r.visible||!r.measurable)return;let o;s?o=r.worldTransform:(r.updateLocalTransform(),o=Yt.get(),o.appendFrom(r.localTransform,e));const a=t,u=!!r.effects.length;if(u&&(t=qt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.addBounds&&(t.matrix=o,r.addBounds(t));for(let l=0;l<r.children.length;l++)bo(r.children[l],t,o,s)}if(u){for(let l=0;l<r.effects.length;l++)(n=(i=r.effects[l]).addBounds)==null||n.call(i,t);a.addBounds(t,B.IDENTITY),qt.return(t)}s||Yt.return(o)}function qr(r,t){const e=r.parent;return e&&(qr(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function si(r,t,e){return t.clear(),e||(e=B.IDENTITY),cd(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function cd(r,t,e,s,i){var n,o;let a;if(i)a=Yt.get(),a=e.copyTo(a);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const c=r.localTransform;a=Yt.get(),a.appendFrom(c,e)}const u=t,l=!!r.effects.length;if(l&&(t=qt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{r.renderPipeId&&(t.matrix=a,r.addBounds(t));const c=r.children;for(let h=0;h<c.length;h++)cd(c[h],t,a,s,!1)}if(l){for(let c=0;c<r.effects.length;c++)(o=(n=r.effects[c]).addLocalBounds)==null||o.call(n,t,s);u.addBounds(t,B.IDENTITY),qt.return(t)}Yt.return(a)}function hd(r,t,e){const s=r.parent;s&&s!==t&&(hd(s,t,e),s.updateLocalTransform(),e.append(s.localTransform))}function xo(r,t){const e=r.children;for(let s=0;s<e.length;s++){const i=e[s],n=i.uid,o=(i._didViewChangeTick&65535)<<16|i._didContainerChangeTick&65535,a=t.index;(t.data[a]!==n||t.data[a+1]!==o)&&(t.data[t.index]=n,t.data[t.index+1]=o,t.didChange=!0),t.index=a+2,i.children.length&&xo(i,t)}return t.didChange}const cv=new B,dd={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(r,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=r/t*e:this.scale.x=e},_setHeight(r,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=r/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new pt});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),xo(this,r),r.didChange&&si(this,r.localBounds,cv),r.localBounds},getBounds(r,t){return Yr(this,r,t||new pt)}},pd={_onRender:null,set onRender(r){const t=this.renderGroup||this.parentRenderGroup;if(!r){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=r},get onRender(){return this._onRender}},fd={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(r){this._zIndex!==r&&(this._zIndex=r,this.depthOfChildModified())},depthOfChildModified(){this.parent&&(this.parent.sortableChildren=!0,this.parent.sortDirty=!0),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0)},sortChildren(){this.sortDirty&&(this.sortDirty=!1,this.children.sort(hv))}};function hv(r,t){return r._zIndex-t._zIndex}const md={getGlobalPosition(r=new nt,t=!1){return this.parent?this.parent.toGlobal(this._position,r,t):(r.x=this._position.x,r.y=this._position.y),r},toGlobal(r,t,e=!1){if(!e){this.updateLocalTransform();const s=qr(this,new B);return s.append(this.localTransform),s.apply(r,t)}return this.worldTransform.apply(r,t)},toLocal(r,t,e,s){if(t&&(r=t.toGlobal(r,e,s)),!s){this.updateLocalTransform();const i=qr(this,new B);return i.append(this.localTransform),i.applyInverse(r,e)}return this.worldTransform.applyInverse(r,e)}};let dv=0;class yo{constructor(){this.uid=Q("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=dv++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class gd{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new B,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new yo,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}reset(){this.renderGroupChildren.length=0;for(const t in this.childrenToUpdate){const e=this.childrenToUpdate[t];e.list.fill(null),e.index=0}this.childrenRenderablesToUpdate.index=0,this.childrenRenderablesToUpdate.list.fill(null),this.root=null,this.updateTick=0,this.structureDidChange=!0,this._onRenderContainers.length=0,this.renderGroupParent=null}get localTransform(){return this.root.localTransform}addRenderGroupChild(t){t.renderGroupParent&&t.renderGroupParent._removeRenderGroupChild(t),t.renderGroupParent=this,this.renderGroupChildren.push(t)}_removeRenderGroupChild(t){const e=this.renderGroupChildren.indexOf(t);e>-1&&this.renderGroupChildren.splice(e,1),t.renderGroupParent=null}addChild(t){if(this.structureDidChange=!0,t.parentRenderGroup=this,t.updateTick=-1,t.parent===this.root?t.relativeRenderGroupDepth=1:t.relativeRenderGroupDepth=t.parent.relativeRenderGroupDepth+1,t.didChange=!0,this.onChildUpdate(t),t.renderGroup){this.addRenderGroupChild(t.renderGroup);return}t._onRender&&this.addOnRender(t);const e=t.children;for(let s=0;s<e.length;s++)this.addChild(e[s])}removeChild(t){if(this.structureDidChange=!0,t._onRender&&(t.renderGroup||this.removeOnRender(t)),t.parentRenderGroup=null,t.renderGroup){this._removeRenderGroupChild(t.renderGroup);return}const e=t.children;for(let s=0;s<e.length;s++)this.removeChild(e[s])}removeChildren(t){for(let e=0;e<t.length;e++)this.removeChild(t[e])}onChildUpdate(t){let e=this.childrenToUpdate[t.relativeRenderGroupDepth];e||(e=this.childrenToUpdate[t.relativeRenderGroupDepth]={index:0,list:[]}),e.list[e.index++]=t}updateRenderable(t){t.globalDisplayStatus<7||(t.didViewUpdate=!1,this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t))}onChildViewUpdate(t){this.childrenRenderablesToUpdate.list[this.childrenRenderablesToUpdate.index++]=t}get isRenderable(){return this.root.localDisplayStatus===7&&this.worldAlpha>0}addOnRender(t){this._onRenderContainers.push(t)}removeOnRender(t){this._onRenderContainers.splice(this._onRenderContainers.indexOf(t),1)}runOnRender(){for(let t=0;t<this._onRenderContainers.length;t++)this._onRenderContainers[t]._onRender()}destroy(){this.renderGroupParent=null,this.root=null,this.childrenRenderablesToUpdate=null,this.childrenToUpdate=null,this.renderGroupChildren=null,this._onRenderContainers=null,this.instructionSet=null}getChildren(t=[]){const e=this.root.children;for(let s=0;s<e.length;s++)this._getChildren(e[s],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const s=t.children;for(let i=0;i<s.length;i++)this._getChildren(s[i],e);return e}}function _d(r,t,e={}){for(const s in t)!e[s]&&t[s]!==void 0&&(r[s]=t[s])}const vo=new ot(null),To=new ot(null),Ao=new ot(null,1,1),Kr=1,ii=2,tr=4,pv=8;class rt extends Ct{constructor(t={}){var e,s;super(),this.uid=Q("renderable"),this._updateFlags=15,this.renderGroup=null,this.parentRenderGroup=null,this.parentRenderGroupIndex=0,this.didChange=!1,this.didViewUpdate=!1,this.relativeRenderGroupDepth=0,this.children=[],this.parent=null,this.includeInBuild=!0,this.measurable=!0,this.isSimple=!0,this.updateTick=-1,this.localTransform=new B,this.relativeGroupTransform=new B,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new ot(this,0,0),this._scale=Ao,this._pivot=To,this._skew=vo,this._cx=1,this._sx=0,this._cy=0,this._sy=1,this._rotation=0,this.localColor=16777215,this.localAlpha=1,this.groupAlpha=1,this.groupColor=16777215,this.groupColorAlpha=4294967295,this.localBlendMode="inherit",this.groupBlendMode="normal",this.localDisplayStatus=7,this.globalDisplayStatus=7,this._didContainerChangeTick=0,this._didViewChangeTick=0,this._didLocalTransformChangeId=-1,this.effects=[],_d(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(i=>this.addChild(i)),(s=t.parent)==null||s.addChild(this)}static mixin(t){Object.defineProperties(rt.prototype,Object.getOwnPropertyDescriptors(t))}set _didChangeId(t){this._didViewChangeTick=t>>12&4095,this._didContainerChangeTick=t&4095}get _didChangeId(){return this._didContainerChangeTick&4095|(this._didViewChangeTick&4095)<<12}addChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.addChild(t[i]);return t[0]}const e=t[0];if(e.parent===this)return this.children.splice(this.children.indexOf(e),1),this.children.push(e),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),e;e.parent&&e.parent.removeChild(e),this.children.push(e),this.sortableChildren&&(this.sortDirty=!0),e.parent=this,e.didChange=!0,e.didViewUpdate=!1,e._updateFlags=15;const s=this.renderGroup||this.parentRenderGroup;return s&&s.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e}removeChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.removeChild(t[i]);return t[0]}const e=t[0],s=this.children.indexOf(e);return s>-1&&(this._didViewChangeTick++,this.children.splice(s,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,s),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=H.get(gd,this),this.groupTransform=B.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),H.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new B),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*Sh}set angle(t){this.rotation=t*Eh}get pivot(){return this._pivot===To&&(this._pivot=new ot(this,0,0)),this._pivot}set pivot(t){this._pivot===To&&(this._pivot=new ot(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===vo&&(this._skew=new ot(this,0,0)),this._skew}set skew(t){this._skew===vo&&(this._skew=new ot(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ao&&(this._scale=new ot(this,1,1)),this._scale}set scale(t){this._scale===Ao&&(this._scale=new ot(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var s;const i=this.getLocalBounds();typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,i.width),e!==void 0&&this._setHeight(e,i.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,s=this._scale,i=this._pivot,n=this._position,o=s._x,a=s._y,u=i._x,l=i._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*a,e.d=this._sy*a,e.tx=n._x-(u*e.a+l*e.c),e.ty=n._y-(u*e.b+l*e.d)}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=Kr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=j.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=Kr,this._onUpdate())}get tint(){const t=this.localColor;return((t&255)<<16)+(t&65280)+(t>>16&255)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=ii,this.localBlendMode=t,this._onUpdate())}get blendMode(){return this.localBlendMode}get visible(){return!!(this.localDisplayStatus&2)}set visible(t){const e=t?2:0;(this.localDisplayStatus&2)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=tr,this.localDisplayStatus^=2,this._onUpdate())}get culled(){return!(this.localDisplayStatus&4)}set culled(t){const e=t?0:4;(this.localDisplayStatus&4)!==e&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=tr,this.localDisplayStatus^=4,this._onUpdate())}get renderable(){return!!(this.localDisplayStatus&1)}set renderable(t){const e=t?1:0;(this.localDisplayStatus&1)!==e&&(this._updateFlags|=tr,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var e;if(this.destroyed)return;this.destroyed=!0;const s=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.children)for(let i=0;i<s.length;++i)s[i].destroy(t);(e=this.renderGroup)==null||e.destroy(),this.renderGroup=null}}rt.mixin(od),rt.mixin(md),rt.mixin(pd),rt.mixin(dd),rt.mixin(ud),rt.mixin(ld),rt.mixin(fd),rt.mixin(sd);class Be extends rt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new pt(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:s,y:i}=t;return s>=e.minX&&s<=e.maxX&&i>=e.minY&&i<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}var fv=Object.defineProperty,ni=Object.getOwnPropertySymbols,bd=Object.prototype.hasOwnProperty,xd=Object.prototype.propertyIsEnumerable,yd=(r,t,e)=>t in r?fv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,mv=(r,t)=>{for(var e in t||(t={}))bd.call(t,e)&&yd(r,e,t[e]);if(ni)for(var e of ni(t))xd.call(t,e)&&yd(r,e,t[e]);return r},gv=(r,t)=>{var e={};for(var s in r)bd.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&ni)for(var s of ni(r))t.indexOf(s)<0&&xd.call(r,s)&&(e[s]=r[s]);return e};class Xt extends Be{constructor(t=E.EMPTY){t instanceof E&&(t={texture:t});const e=t,{texture:s=E.EMPTY,anchor:i,roundPixels:n,width:o,height:a}=e,u=gv(e,["texture","anchor","roundPixels","width","height"]);super(mv({label:"Sprite"},u)),this.renderPipeId="sprite",this.batched=!0,this._didSpriteUpdate=!1,this._sourceBounds={minX:0,maxX:1,minY:0,maxY:0},this._sourceBoundsDirty=!0,this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),i?this.anchor=i:s.defaultAnchor&&(this.anchor=s.defaultAnchor),this.texture=s,this.allowChildren=!1,this.roundPixels=n!=null?n:!1,o!==void 0&&(this.width=o),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof E?new Xt(t):new Xt(E.from(t,e))}set texture(t){t||(t=E.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this._width&&this._setWidth(this._width,this._texture.orig.width),this._height&&this._setHeight(this._height,this._texture.orig.height),this.onViewUpdate())}get texture(){return this._texture}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get sourceBounds(){return this._sourceBoundsDirty&&(this._updateSourceBounds(),this._sourceBoundsDirty=!1),this._sourceBounds}containsPoint(t){const e=this.sourceBounds;return t.x>=e.maxX&&t.x<=e.minX&&t.y>=e.maxY&&t.y<=e.minY}addBounds(t){const e=this._texture.trim?this.sourceBounds:this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this._sourceBoundsDirty=this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_updateBounds(){jr(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,s=this._sourceBounds,{width:i,height:n}=e.orig;s.maxX=-t._x*i,s.minX=s.maxX+i,s.maxY=-t._y*n,s.minY=s.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var s;typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const _v=new pt;function oi(r,t,e){const s=_v;r.measurable=!0,Yr(r,e,s),t.addBoundsMask(s),r.measurable=!1}function ai(r,t,e){const s=qt.get();r.measurable=!0;const i=Yt.get().identity(),n=So(r,e,i);si(r,s,n),r.measurable=!1,t.addBoundsMask(s),Yt.return(i),qt.return(s)}function So(r,t,e){return r&&r!==t&&(So(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class Eo{constructor(t){this.priority=0,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Xt),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask=null}addBounds(t,e){oi(this.mask,t,e)}addLocalBounds(t,e){ai(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof Xt}}Eo.extension=y.MaskEffect;class wo{constructor(t){this.priority=0,this.pipe="colorMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t}destroy(){}static test(t){return typeof t=="number"}}wo.extension=y.MaskEffect;class Co{constructor(t){this.priority=0,this.pipe="stencilMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.mask.includeInBuild=!1,this.mask.measurable=!1}reset(){this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null}addBounds(t,e){oi(this.mask,t,e)}addLocalBounds(t,e){ai(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}destroy(){this.reset()}static test(t){return t instanceof rt}}Co.extension=y.MaskEffect;class ne extends tt{constructor(t){t.resource||(t.resource=L.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,s=this._resolution){const i=super.resize(t,e,s);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}ne.extension=y.TextureSource;class Ge extends tt{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=L.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}Ge.extension=y.TextureSource;let Ro;async function Po(){return Ro!=null||(Ro=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const a=document.createElement("video");a.onloadeddata=()=>o(a),a.onerror=()=>o(null),a.autoplay=!1,a.crossOrigin="anonymous",a.preload="auto",a.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",a.load()});if(!e)return"premultiply-alpha-on-upload";const s=t.createTexture();t.bindTexture(t.TEXTURE_2D,s);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,s,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(s),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ro}var bv=Object.defineProperty,xv=Object.defineProperties,yv=Object.getOwnPropertyDescriptors,vd=Object.getOwnPropertySymbols,vv=Object.prototype.hasOwnProperty,Tv=Object.prototype.propertyIsEnumerable,Td=(r,t,e)=>t in r?bv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Do=(r,t)=>{for(var e in t||(t={}))vv.call(t,e)&&Td(r,e,t[e]);if(vd)for(var e of vd(t))Tv.call(t,e)&&Td(r,e,t[e]);return r},Av=(r,t)=>xv(r,yv(t));const ui=class dx extends tt{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Do(Do({},dx.defaultOptions),t),this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=(e=t.alphaMode)!=null?e:"premultiply-alpha-on-upload",this._videoFrameRequestCallback=this._videoFrameRequestCallback.bind(this),this._videoFrameRequestCallbackHandle=null,this._load=null,this._resolve=null,this._reject=null,this._onCanPlay=this._onCanPlay.bind(this),this._onCanPlayThrough=this._onCanPlayThrough.bind(this),this._onError=this._onError.bind(this),this._onPlayStart=this._onPlayStart.bind(this),this._onPlayStop=this._onPlayStop.bind(this),this._onSeeked=this._onSeeked.bind(this),t.autoLoad!==!1&&this.load()}updateFrame(){if(!this.destroyed){if(this._updateFPS){const t=mt.shared.elapsedMS*this.resource.playbackRate;this._msToNextUpdate=Math.floor(this._msToNextUpdate-t)}(!this._updateFPS||this._msToNextUpdate<=0)&&(this._msToNextUpdate=this._updateFPS?Math.floor(1e3/this._updateFPS):0),this.isValid&&this.update()}}_videoFrameRequestCallback(){this.updateFrame(),this.destroyed?this._videoFrameRequestCallbackHandle=null:this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback)}get isValid(){return!!this.resource.videoWidth&&!!this.resource.videoHeight}async load(){if(this._load)return this._load;const t=this.resource,e=this.options;return(t.readyState===t.HAVE_ENOUGH_DATA||t.readyState===t.HAVE_FUTURE_DATA)&&t.width&&t.height&&(t.complete=!0),t.addEventListener("play",this._onPlayStart),t.addEventListener("pause",this._onPlayStop),t.addEventListener("seeked",this._onSeeked),this._isSourceReady()?this._mediaReady():(e.preload||t.addEventListener("canplay",this._onCanPlay),t.addEventListener("canplaythrough",this._onCanPlayThrough),t.addEventListener("error",this._onError,!0)),this.alphaMode=await Po(),this._load=new Promise((s,i)=>{this.isValid?s(this):(this._resolve=s,this._reject=i,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0),this._videoFrameRequestCallbackHandle===null&&(this._videoFrameRequestCallbackHandle=this.resource.requestVideoFrameCallback(this._videoFrameRequestCallback))):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker||(mt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(mt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};ui.extension=y.TextureSource,ui.defaultOptions=Av(Do({},tt.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),ui.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Zr=ui,Sv=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const s=Bt(t);let i;for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.test(e)){i=l.getCacheableAssets(s,e);break}}const n=new Map(Object.entries(i||{}));i||s.forEach(u=>{n.set(u,e)});const o=[...n.keys()],a={cacheKeys:o,keys:s};s.forEach(u=>{this._cacheMap.set(u,a)}),o.forEach(u=>{const l=i?i[u]:e;this._cache.has(u)&&this._cache.get(u),this._cache.set(u,n.get(u))})}remove(t){if(!this._cacheMap.has(t))return;const e=this._cacheMap.get(t);e.cacheKeys.forEach(s=>{this._cache.delete(s)}),e.keys.forEach(s=>{this._cacheMap.delete(s)})}get parsers(){return this._parsers}};const q=new Sv,Mo=[];k.handleByList(y.TextureSource,Mo);function Ev(r={}){return Oo(r)}function Oo(r={}){const t=r&&r.resource,e=t?r.resource:r,s=t?r:{resource:r};for(let i=0;i<Mo.length;i++){const n=Mo[i];if(n.test(e))return new n(s)}throw new Error(`Could not find a source type for resource: ${s.resource}`)}function Ad(r={},t=!1){const e=r&&r.resource,s=e?r.resource:r,i=e?r:{resource:r};if(!t&&q.has(s))return q.get(s);const n=new E({source:Oo(i)});return n.on("destroy",()=>{q.has(s)&&q.remove(s)}),t||q.set(s,n),n}function Sd(r,t=!1){return typeof r=="string"?q.get(r):r instanceof tt?new E({source:r}):Ad(r,t)}E.from=Sd,tt.from=Oo,k.add(Eo,wo,Co,Zr,Ge,ne,Qs);class Kt{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const s in t){const i=t[s];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const s in this.resources)t[e++]=this.resources[s]._resourceId;this._key=t.join("|")}setResource(t,e){var s,i;const n=this.resources[e];t!==n&&(n&&((s=t.off)==null||s.call(t,"change",this.onResourceChange,this)),(i=t.on)==null||i.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const s in e)e[s]._touched=t}destroy(){var t;const e=this.resources;for(const s in e){const i=e[s];(t=i.off)==null||t.call(i,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const s in e)e[s]===t&&(e[s]=null)}else this._updateKey()}}let Qr;function Bo(){return(!Qr||Qr!=null&&Qr.isContextLost())&&(Qr=L.get().createCanvas().getContext("webgl",{})),Qr}const wv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`);function Cv(r){let t="";for(let e=0;e<r;++e)e>0&&(t+=`
else `),e<r-1&&(t+=`if(test == ${e}.0){}`);return t}function Ed(r,t){if(r===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const s=wv.replace(/%forloop%/gi,Cv(r));if(t.shaderSource(e,s),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))r=r/2|0;else break}}finally{t.deleteShader(e)}return r}let er=null;function Ie(){var r;if(er)return er;const t=Bo();return er=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),er=Ed(er,t),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),er}const wd={};function li(r,t){let e=2166136261;for(let s=0;s<t;s++)e^=r[s].uid,e=Math.imul(e,16777619),e>>>=0;return wd[e]||Rv(r,t,e)}let Go=0;function Rv(r,t,e){const s={};let i=0;Go||(Go=Ie());for(let o=0;o<Go;o++){const a=o<t?r[o]:E.EMPTY.source;s[i++]=a.source,s[i++]=a.style}const n=new Kt(s);return wd[e]=n,n}class Io{constructor(t){typeof t=="number"?this.rawBinaryData=new ArrayBuffer(t):t instanceof Uint8Array?this.rawBinaryData=t.buffer:this.rawBinaryData=t,this.uint32View=new Uint32Array(this.rawBinaryData),this.float32View=new Float32Array(this.rawBinaryData),this.size=this.rawBinaryData.byteLength}get int8View(){return this._int8View||(this._int8View=new Int8Array(this.rawBinaryData)),this._int8View}get uint8View(){return this._uint8View||(this._uint8View=new Uint8Array(this.rawBinaryData)),this._uint8View}get int16View(){return this._int16View||(this._int16View=new Int16Array(this.rawBinaryData)),this._int16View}get int32View(){return this._int32View||(this._int32View=new Int32Array(this.rawBinaryData)),this._int32View}get float64View(){return this._float64Array||(this._float64Array=new Float64Array(this.rawBinaryData)),this._float64Array}get bigUint64View(){return this._bigUint64Array||(this._bigUint64Array=new BigUint64Array(this.rawBinaryData)),this._bigUint64Array}view(t){return this[`${t}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(t){switch(t){case"int8":case"uint8":return 1;case"int16":case"uint16":return 2;case"int32":case"uint32":case"float32":return 4;default:throw new Error(`${t} isn't a valid view type`)}}}function ci(r,t){const e=r.byteLength/8|0,s=new Float64Array(r,0,e);new Float64Array(t,0,e).set(s);const i=r.byteLength-e*8;if(i>0){const n=new Uint8Array(r,e*8,i);new Uint8Array(t,e*8,i).set(n)}}const Cd={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var at=(r=>(r[r.DISABLED=0]="DISABLED",r[r.RENDERING_MASK_ADD=1]="RENDERING_MASK_ADD",r[r.MASK_ACTIVE=2]="MASK_ACTIVE",r[r.RENDERING_MASK_REMOVE=3]="RENDERING_MASK_REMOVE",r[r.NONE=4]="NONE",r))(at||{});function Jr(r,t){return t.alphaMode==="no-premultiply-alpha"&&Cd[r]||r}class Rd{constructor(){this.ids=Object.create(null),this.textures=[],this.count=0}clear(){for(let t=0;t<this.count;t++){const e=this.textures[t];this.textures[t]=null,this.ids[e.uid]=null}this.count=0}}var Pv=Object.defineProperty,Pd=Object.getOwnPropertySymbols,Dv=Object.prototype.hasOwnProperty,Mv=Object.prototype.propertyIsEnumerable,Dd=(r,t,e)=>t in r?Pv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Md=(r,t)=>{for(var e in t||(t={}))Dv.call(t,e)&&Dd(r,e,t[e]);if(Pd)for(var e of Pd(t))Mv.call(t,e)&&Dd(r,e,t[e]);return r};class Od{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Rd,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const Bd=[];let Fo=0;function Gd(){return Fo>0?Bd[--Fo]:new Od}function Id(r){Bd[Fo++]=r}let ts=0;const Fd=class Gn{constructor(t={}){this.uid=Q("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[];var e;Gn.defaultOptions.maxTextures=(e=Gn.defaultOptions.maxTextures)!=null?e:Ie(),t=Md(Md({},Gn.defaultOptions),t);const{maxTextures:s,attributesInitialSize:i,indicesInitialSize:n}=t;this.attributeBuffer=new Io(i*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=s}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Id(this.batches[t]);this.batchIndex=0,this._batchIndexStart=0,this._batchIndexSize=0,this.dirty=!0}add(t){this._elements[this.elementSize++]=t,t._indexStart=this.indexSize,t._attributeStart=this.attributeSize,t._batcher=this,this.indexSize+=t.indexSize,this.attributeSize+=t.attributeSize*this.vertexSize}checkAndUpdateTexture(t,e){const s=t._batch.textures.ids[e._source.uid];return!s&&s!==0?!1:(t._textureId=s,t.texture=e,!0)}updateElement(t){this.dirty=!0;const e=this.attributeBuffer;t.packAsQuad?this.packQuadAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId):this.packAttributes(t,e.float32View,e.uint32View,t._attributeStart,t._textureId)}break(t){const e=this._elements;if(!e[this.elementStart])return;let s=Gd(),i=s.textures;i.clear();const n=e[this.elementStart];let o=Jr(n.blendMode,n.texture._source);this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const a=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,l=this.indexBuffer;let c=this._batchIndexSize,h=this._batchIndexStart,d="startBatch";const p=this.maxTextures;for(let f=this.elementStart;f<this.elementSize;++f){const g=e[f];e[f]=null;const m=g.texture._source,_=Jr(g.blendMode,m),x=o!==_;if(m._batchTick===ts&&!x){g._textureId=m._textureBindLocation,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,a,u,g._attributeStart,g._textureId),this.packQuadIndex(l,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,a,u,g._attributeStart,g._textureId),this.packIndex(g,l,g._indexStart,g._attributeStart/this.vertexSize)),g._batch=s;continue}m._batchTick=ts,(i.count>=p||x)&&(this._finishBatch(s,h,c-h,i,o,t,d),d="renderBatch",h=c,o=_,s=Gd(),i=s.textures,i.clear(),++ts),g._textureId=m._textureBindLocation=i.count,i.ids[m.uid]=i.count,i.textures[i.count++]=m,g._batch=s,c+=g.indexSize,g.packAsQuad?(this.packQuadAttributes(g,a,u,g._attributeStart,g._textureId),this.packQuadIndex(l,g._indexStart,g._attributeStart/this.vertexSize)):(this.packAttributes(g,a,u,g._attributeStart,g._textureId),this.packIndex(g,l,g._indexStart,g._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(s,h,c-h,i,o,t,d),h=c,++ts),this.elementStart=this.elementSize,this._batchIndexStart=h,this._batchIndexSize=c}_finishBatch(t,e,s,i,n,o,a){t.gpuBindGroup=null,t.bindGroup=null,t.action=a,t.batcher=this,t.textures=i,t.blendMode=n,t.start=e,t.size=s,++ts,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),s=new Io(e);ci(this.attributeBuffer.rawBinaryData,s.rawBinaryData),this.attributeBuffer=s}_resizeIndexBuffer(t){const e=this.indexBuffer;let s=Math.max(t,e.length*1.5);s+=s%2;const i=s>65535?new Uint32Array(s):new Uint16Array(s);if(i.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)i[n]=e[n];else ci(e.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(t,e,s){t[e]=s+0,t[e+1]=s+1,t[e+2]=s+2,t[e+3]=s+0,t[e+4]=s+2,t[e+5]=s+3}packIndex(t,e,s,i){const n=t.indices,o=t.indexSize,a=t.indexOffset,u=t.attributeOffset;for(let l=0;l<o;l++)e[s++]=i+n[l+a]-u}destroy(){for(let t=0;t<this.batches.length;t++)Id(this.batches[t]);this.batches=null;for(let t=0;t<this._elements.length;t++)this._elements[t]._batch=null;this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}};Fd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Ud=Fd;var X=(r=>(r[r.MAP_READ=1]="MAP_READ",r[r.MAP_WRITE=2]="MAP_WRITE",r[r.COPY_SRC=4]="COPY_SRC",r[r.COPY_DST=8]="COPY_DST",r[r.INDEX=16]="INDEX",r[r.VERTEX=32]="VERTEX",r[r.UNIFORM=64]="UNIFORM",r[r.STORAGE=128]="STORAGE",r[r.INDIRECT=256]="INDIRECT",r[r.QUERY_RESOLVE=512]="QUERY_RESOLVE",r[r.STATIC=1024]="STATIC",r))(X||{});class Rt extends Ct{constructor(t){let{data:e,size:s}=t;const{usage:i,label:n,shrinkToFit:o}=t;super(),this.uid=Q("buffer"),this._resourceType="buffer",this._resourceId=Q("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,s=s!=null?s:e==null?void 0:e.byteLength;const a=!!e;this.descriptor={size:s,usage:i,mappedAtCreation:a,label:n},this.shrinkToFit=o!=null?o:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&X.STATIC)}set static(t){t?this.descriptor.usage|=X.STATIC:this.descriptor.usage&=~X.STATIC}setDataWithSize(t,e,s){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){s&&this.emit("update",this);return}const i=this._data;if(this._data=t,i.length!==t.length){!this.shrinkToFit&&t.byteLength<i.byteLength?s&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=Q("resource"),this.emit("change",this));return}s&&this.emit("update",this)}update(t){this._updateSize=t!=null?t:this._updateSize,this._updateID++,this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function Uo(r,t){if(!(r instanceof Rt)){let e=t?X.INDEX:X.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=X.INDEX|X.COPY_DST):(r=new Float32Array(r),e=X.VERTEX|X.COPY_DST)),r=new Rt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function kd(r,t,e){const s=r.getAttribute(t);if(!s)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const i=s.buffer.data;let n=1/0,o=1/0,a=-1/0,u=-1/0;const l=i.BYTES_PER_ELEMENT,c=(s.offset||0)/l,h=(s.stride||2*4)/l;for(let d=c;d<i.length;d+=h){const p=i[d],f=i[d+1];p>a&&(a=p),f>u&&(u=f),p<n&&(n=p),f<o&&(o=f)}return e.minX=n,e.minY=o,e.maxX=a,e.maxY=u,e}function Ov(r){return(r instanceof Rt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Uo(r.buffer,!1),r}class rr extends Ct{constructor(t){const{attributes:e,indexBuffer:s,topology:i}=t;super(),this.uid=Q("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new pt,this._boundsDirty=!0,this.attributes=e,this.buffers=[],this.instanceCount=t.instanceCount||1;for(const n in e){const o=e[n]=Ov(e[n]);this.buffers.indexOf(o.buffer)===-1&&(this.buffers.push(o.buffer),o.buffer.on("update",this.onBufferUpdate,this),o.buffer.on("change",this.onBufferUpdate,this))}s&&(this.indexBuffer=Uo(s,!0),this.buffers.push(this.indexBuffer)),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,kd(this,"aPosition",this._bounds)):this._bounds}destroy(t=!1){this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(e=>e.destroy()),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Bv=new Float32Array(1),Gv=new Uint32Array(1);class Nd extends rr{constructor(){const t=new Rt({data:Bv,label:"attribute-batch-buffer",usage:X.VERTEX|X.COPY_DST,shrinkToFit:!1}),e=new Rt({data:Gv,label:"index-batch-buffer",usage:X.INDEX|X.COPY_DST,shrinkToFit:!1}),s=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:s,offset:0},aUV:{buffer:t,format:"float32x2",stride:s,offset:2*4},aColor:{buffer:t,format:"unorm8x4",stride:s,offset:4*4},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:s,offset:5*4}},indexBuffer:e})}}const ko=Object.create(null),Ld=Object.create(null);function sr(r,t){let e=Ld[r];return e===void 0&&(ko[t]===void 0&&(ko[t]=1),Ld[r]=e=ko[t]++),e}let hi;function $d(){if(!hi){hi="mediump";const r=Bo();r&&r.getShaderPrecisionFormat&&(hi=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return hi}function Hd(r,t,e){return t?r:e?(r=r.replace("out vec4 finalColor;",""),`
#ifdef GL_ES // This checks if it is WebGL1
#define in varying
#define finalColor gl_FragColor
#define texture texture2D
#endif
${r}
`):`
#ifdef GL_ES // This checks if it is WebGL1
#define in attribute
#define out varying
#endif
${r}
`}function Xd(r,t,e){const s=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let i=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return i==="highp"&&s!=="highp"&&(i="mediump"),`precision ${i} float;
${r}`}else if(s!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function zd(r,t){return t?`#version 300 es
${r}`:r}const Iv={},Fv={};function jd(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const s=e?Iv:Fv;return s[t]?(s[t]++,t+=`-${s[t]}`):s[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
${r}`}function Vd(r,t){return t?r.replace("#version 300 es",""):r}var Uv=Object.defineProperty,Wd=Object.getOwnPropertySymbols,kv=Object.prototype.hasOwnProperty,Nv=Object.prototype.propertyIsEnumerable,Yd=(r,t,e)=>t in r?Uv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qd=(r,t)=>{for(var e in t||(t={}))kv.call(t,e)&&Yd(r,e,t[e]);if(Wd)for(var e of Wd(t))Nv.call(t,e)&&Yd(r,e,t[e]);return r};const No={stripVersion:Vd,ensurePrecision:Xd,addProgramDefines:Hd,setProgramName:jd,insertVersion:zd},Lo=Object.create(null),Kd=class dc{constructor(t){t=qd(qd({},dc.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,s={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:$d()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let i=t.fragment,n=t.vertex;Object.keys(No).forEach(o=>{const a=s[o];i=No[o](i,a,!0),n=No[o](n,a,!1)}),this.fragment=i,this.vertex=n,this._key=sr(`${this.vertex}:${this.fragment}`,"gl-program")}destroy(){this.fragment=null,this.vertex=null,this._attributeData=null,this._uniformData=null,this._uniformBlockData=null,this.transformFeedbackVaryings=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return Lo[e]||(Lo[e]=new dc(t)),Lo[e]}};Kd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let It=Kd;const Zd={uint8x2:{size:2,stride:2,normalised:!1},uint8x4:{size:4,stride:4,normalised:!1},sint8x2:{size:2,stride:2,normalised:!1},sint8x4:{size:4,stride:4,normalised:!1},unorm8x2:{size:2,stride:2,normalised:!0},unorm8x4:{size:4,stride:4,normalised:!0},snorm8x2:{size:2,stride:2,normalised:!0},snorm8x4:{size:4,stride:4,normalised:!0},uint16x2:{size:2,stride:4,normalised:!1},uint16x4:{size:4,stride:8,normalised:!1},sint16x2:{size:2,stride:4,normalised:!1},sint16x4:{size:4,stride:8,normalised:!1},unorm16x2:{size:2,stride:4,normalised:!0},unorm16x4:{size:4,stride:8,normalised:!0},snorm16x2:{size:2,stride:4,normalised:!0},snorm16x4:{size:4,stride:8,normalised:!0},float16x2:{size:2,stride:4,normalised:!1},float16x4:{size:4,stride:8,normalised:!1},float32:{size:1,stride:4,normalised:!1},float32x2:{size:2,stride:8,normalised:!1},float32x3:{size:3,stride:12,normalised:!1},float32x4:{size:4,stride:16,normalised:!1},uint32:{size:1,stride:4,normalised:!1},uint32x2:{size:2,stride:8,normalised:!1},uint32x3:{size:3,stride:12,normalised:!1},uint32x4:{size:4,stride:16,normalised:!1},sint32:{size:1,stride:4,normalised:!1},sint32x2:{size:2,stride:8,normalised:!1},sint32x3:{size:3,stride:12,normalised:!1},sint32x4:{size:4,stride:16,normalised:!1}};function ir(r){var t;return(t=Zd[r])!=null?t:Zd.float32}const Lv={f32:"float32","vec2<f32>":"float32x2","vec3<f32>":"float32x3","vec4<f32>":"float32x4",vec2f:"float32x2",vec3f:"float32x3",vec4f:"float32x4",i32:"sint32","vec2<i32>":"sint32x2","vec3<i32>":"sint32x3","vec4<i32>":"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"};function Qd({source:r,entryPoint:t}){var e;const s={},i=r.indexOf(`fn ${t}`);if(i!==-1){const n=r.indexOf("->",i);if(n!==-1){const o=r.substring(i,n),a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let u;for(;(u=a.exec(o))!==null;){const l=(e=Lv[u[3]])!=null?e:"float32";s[u[2]]={location:parseInt(u[1],10),format:l,stride:ir(l).stride,offset:0,instance:!1,start:0}}}}return s}function di(r){var t,e,s;const i=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,o=/@binding\((\d+)\)/,a=/var(<[^>]+>)? (\w+)/,u=/:\s*(\w+)/,l=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,d=(t=r.match(i))==null?void 0:t.map(f=>({group:parseInt(f.match(n)[1],10),binding:parseInt(f.match(o)[1],10),name:f.match(a)[2],isUniform:f.match(a)[1]==="<uniform>",type:f.match(u)[1]}));if(!d)return{groups:[],structs:[]};const p=(s=(e=r.match(l))==null?void 0:e.map(f=>{const g=f.match(h)[1],m=f.match(c).reduce((_,x)=>{const[b,v]=x.split(":");return _[b.trim()]=v.trim(),_},{});return m?{name:g,members:m}:null}).filter(({name:f})=>d.some(g=>g.type===f)))!=null?s:[];return{groups:d,structs:p}}var nr=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(nr||{});function Jd({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]=[]),s.isUniform?t[s.group].push({binding:s.binding,visibility:nr.VERTEX|nr.FRAGMENT,buffer:{type:"uniform"}}):s.type==="sampler"?t[s.group].push({binding:s.binding,visibility:nr.FRAGMENT,sampler:{type:"filtering"}}):s.type==="texture_2d"&&t[s.group].push({binding:s.binding,visibility:nr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}function tp({groups:r}){const t=[];for(let e=0;e<r.length;e++){const s=r[e];t[s.group]||(t[s.group]={}),t[s.group][s.name]=s.binding}return t}function ep(r,t){const e=new Set,s=new Set,i=[...r.structs,...t.structs].filter(o=>e.has(o.name)?!1:(e.add(o.name),!0)),n=[...r.groups,...t.groups].filter(o=>{const a=`${o.name}-${o.binding}`;return s.has(a)?!1:(s.add(a),!0)});return{structs:i,groups:n}}const $o=Object.create(null);class Ot{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,s;const{fragment:i,vertex:n,layout:o,gpuLayout:a,name:u}=t;if(this.name=u,this.fragment=i,this.vertex=n,i.source===n.source){const l=di(i.source);this.structsAndGroups=l}else{const l=di(n.source),c=di(i.source);this.structsAndGroups=ep(l,c)}this.layout=o!=null?o:tp(this.structsAndGroups),this.gpuLayout=a!=null?a:Jd(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((s=this.layout[1])==null?void 0:s.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,s=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=sr(s,"program")}get attributeData(){var t;return(t=this._attributeData)!=null||(this._attributeData=Qd(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return $o[e]||($o[e]=new Ot(t)),$o[e]}}function Ho(r,t,e){if(r)for(const s in r){const i=s.toLocaleLowerCase(),n=t[i];if(n){let o=r[s];s==="header"&&(o=o.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(o)}}}const rp=/\{\{(.*?)\}\}/g;function Xo(r){var t,e;const s={};return((e=(t=r.match(rp))==null?void 0:t.map(i=>i.replace(/[{()}]/g,"")))!=null?e:[]).forEach(i=>{s[i]=[]}),s}function sp(r,t){let e;const s=/@in\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function zo(r,t,e=!1){const s=[];sp(t,s),r.forEach(a=>{a.header&&sp(a.header,s)});const i=s;e&&i.sort();const n=i.map((a,u)=>` @location(${u}) ${a},`).join(`
`);let o=t.replace(/@in\s+[^;]+;\s*/g,"");return o=o.replace("{{in}}",`
${n}
`),o}function ip(r,t){let e;const s=/@out\s+([^;]+);/g;for(;(e=s.exec(r))!==null;)t.push(e[1])}function $v(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function Hv(r){const t=/@.*?\s+/g;return r.replace(t,"")}function np(r,t){const e=[];ip(t,e),r.forEach(u=>{u.header&&ip(u.header,e)});let s=0;const i=e.sort().map(u=>u.indexOf("builtin")>-1?u:`@location(${s++}) ${u}`).join(`,
`),n=e.sort().map(u=>` var ${Hv(u)};`).join(`
`),o=`return VSOutput(
${e.sort().map(u=>` ${$v(u)}`).join(`,
`)});`;let a=t.replace(/@out\s+[^;]+;\s*/g,"");return a=a.replace("{{struct}}",`
${i}
`),a=a.replace("{{start}}",`
${n}
`),a=a.replace("{{return}}",`
${o}
`),a}function jo(r,t){let e=r;for(const s in t){const i=t[s];i.join(`
`).length?e=e.replace(`{{${s}}}`,`//-----${s} START-----//
${i.join(`
`)}
//----${s} FINISH----//`):e=e.replace(`{{${s}}}`,"")}return e}const Fe=Object.create(null),Vo=new Map;let Xv=0;function op({template:r,bits:t}){const e=up(r,t);if(Fe[e])return Fe[e];const{vertex:s,fragment:i}=zv(r,t);return Fe[e]=lp(s,i,t),Fe[e]}function ap({template:r,bits:t}){const e=up(r,t);return Fe[e]||(Fe[e]=lp(r.vertex,r.fragment,t)),Fe[e]}function zv(r,t){const e=t.map(o=>o.vertex).filter(o=>!!o),s=t.map(o=>o.fragment).filter(o=>!!o);let i=zo(e,r.vertex,!0);i=np(e,i);const n=zo(s,r.fragment,!0);return{vertex:i,fragment:n}}function up(r,t){return t.map(e=>(Vo.has(e)||Vo.set(e,Xv++),Vo.get(e))).sort((e,s)=>e-s).join("-")+r.vertex+r.fragment}function lp(r,t,e){const s=Xo(r),i=Xo(t);return e.forEach(n=>{Ho(n.vertex,s,n.name),Ho(n.fragment,i,n.name)}),{vertex:jo(r,s),fragment:jo(t,i)}}const cp=`
@in aPosition: vec2<f32>;
@in aUV: vec2<f32>;
@out @builtin(position) vPosition: vec4<f32>;
@out vUV : vec2<f32>;
@out vColor : vec4<f32>;
{{header}}
struct VSOutput {
{{struct}}
};
@vertex
fn main( {{in}} ) -> VSOutput {
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
var modelMatrix = mat3x3<f32>(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
var position = aPosition;
var uv = aUV;
{{start}}
vColor = vec4<f32>(1., 1., 1., 1.);
{{main}}
vUV = uv;
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
vColor *= globalUniforms.uWorldColorAlpha;
{{end}}
{{return}}
};
`,hp=`
@in vUV : vec2<f32>;
@in vColor : vec4<f32>;
{{header}}
@fragment
fn main(
{{in}}
) -> @location(0) vec4<f32> {
{{start}}
var outColor:vec4<f32>;
{{main}}
var finalColor:vec4<f32> = outColor * vColor;
{{end}}
return finalColor;
};
`,dp=`
in vec2 aPosition;
in vec2 aUV;
out vec4 vColor;
out vec2 vUV;
{{header}}
void main(void){
mat3 worldTransformMatrix = uWorldTransformMatrix;
mat3 modelMatrix = mat3(
1.0, 0.0, 0.0,
0.0, 1.0, 0.0,
0.0, 0.0, 1.0
);
vec2 position = aPosition;
vec2 uv = aUV;
{{start}}
vColor = vec4(1.);
{{main}}
vUV = uv;
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
vColor *= uWorldColorAlpha;
{{end}}
}
`,pp=`
in vec4 vColor;
in vec2 vUV;
out vec4 finalColor;
{{header}}
void main(void) {
{{start}}
vec4 outColor;
{{main}}
finalColor = outColor * vColor;
{{end}}
}
`,fp={name:"global-uniforms-bit",vertex:{header:`
struct GlobalUniforms {
uProjectionMatrix:mat3x3<f32>,
uWorldTransformMatrix:mat3x3<f32>,
uWorldColorAlpha: vec4<f32>,
uResolution: vec2<f32>,
}
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
`}},jv={name:"global-uniforms-ubo-bit",vertex:{header:`
uniform globalUniforms {
mat3 uProjectionMatrix;
mat3 uWorldTransformMatrix;
vec4 uWorldColorAlpha;
vec2 uResolution;
};
`}},mp={name:"global-uniforms-bit",vertex:{header:`
uniform mat3 uProjectionMatrix;
uniform mat3 uWorldTransformMatrix;
uniform vec4 uWorldColorAlpha;
uniform vec2 uResolution;
`}};var Vv=Object.defineProperty,gp=Object.getOwnPropertySymbols,Wv=Object.prototype.hasOwnProperty,Yv=Object.prototype.propertyIsEnumerable,_p=(r,t,e)=>t in r?Vv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,qv=(r,t)=>{for(var e in t||(t={}))Wv.call(t,e)&&_p(r,e,t[e]);if(gp)for(var e of gp(t))Yv.call(t,e)&&_p(r,e,t[e]);return r};function or({bits:r,name:t}){const e=op({template:{fragment:hp,vertex:cp},bits:[fp,...r]});return Ot.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function ar({bits:r,name:t}){return new It(qv({name:t},ap({template:{vertex:dp,fragment:pp},bits:[mp,...r]})))}const pi={name:"color-bit",vertex:{header:`
@in aColor: vec4<f32>;
`,main:`
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
`}},fi={name:"color-bit",vertex:{header:`
in vec4 aColor;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}},Wo={};function Kv(r){const t=[];if(r===1)t.push("@group(1) @binding(0) var textureSource1: texture_2d<f32>;"),t.push("@group(1) @binding(1) var textureSampler1: sampler;");else{let e=0;for(let s=0;s<r;s++)t.push(`@group(1) @binding(${e++}) var textureSource${s+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${s+1}: sampler;`)}return t.join(`
`)}function Zv(r){const t=[];if(r===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<r;e++)e===r-1?t.push(" default:{"):t.push(` case ${e}:{`),t.push(` outColor = textureSampleGrad(textureSource${e+1}, textureSampler${e+1}, vUV, uvDx, uvDy);`),t.push(" break;}");t.push("}")}return t.join(`
`)}function mi(r){return Wo[r]||(Wo[r]={name:"texture-batch-bit",vertex:{header:`
@in aTextureIdAndRound: vec2<u32>;
@out @interpolate(flat) vTextureId : u32;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1)
{
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
@in @interpolate(flat) vTextureId: u32;
${Kv(r)}
`,main:`
var uvDx = dpdx(vUV);
var uvDy = dpdy(vUV);
${Zv(r)}
`}}),Wo[r]}const Yo={};function Qv(r){const t=[];for(let e=0;e<r;e++)e>0&&t.push("else"),e<r-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
`)}function gi(r){return Yo[r]||(Yo[r]={name:"texture-batch-bit",vertex:{header:`
in vec2 aTextureIdAndRound;
out float vTextureId;
`,main:`
vTextureId = aTextureIdAndRound.y;
`,end:`
if(aTextureIdAndRound.x == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
in float vTextureId;
uniform sampler2D uTextures[${r}];
`,main:`
${Qv(r)}
`}}),Yo[r]}const ur={name:"round-pixels-bit",vertex:{header:`
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},lr={name:"round-pixels-bit",vertex:{header:`
vec2 roundPixels(vec2 position, vec2 targetSize)
{
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
}
`}},qo=["f32","i32","vec2<f32>","vec3<f32>","vec4<f32>","mat2x2<f32>","mat3x3<f32>","mat4x4<f32>","mat3x2<f32>","mat4x2<f32>","mat2x3<f32>","mat4x3<f32>","mat2x4<f32>","mat3x4<f32>"],bp=qo.reduce((r,t)=>(r[t]=!0,r),{});function xp(r,t){switch(r){case"f32":return 0;case"vec2<f32>":return new Float32Array(2*t);case"vec3<f32>":return new Float32Array(3*t);case"vec4<f32>":return new Float32Array(4*t);case"mat2x2<f32>":return new Float32Array([1,0,0,1]);case"mat3x3<f32>":return new Float32Array([1,0,0,0,1,0,0,0,1]);case"mat4x4<f32>":return new Float32Array([1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1])}return null}var Jv=Object.defineProperty,yp=Object.getOwnPropertySymbols,t1=Object.prototype.hasOwnProperty,e1=Object.prototype.propertyIsEnumerable,vp=(r,t,e)=>t in r?Jv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Tp=(r,t)=>{for(var e in t||(t={}))t1.call(t,e)&&vp(r,e,t[e]);if(yp)for(var e of yp(t))e1.call(t,e)&&vp(r,e,t[e]);return r};const Ap=class px{constructor(t,e){this._touched=0,this.uid=Q("uniform"),this._resourceType="uniformGroup",this._resourceId=Q("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var s,i;e=Tp(Tp({},px.defaultOptions),e),this.uniformStructures=t;const n={};for(const o in t){const a=t[o];if(a.name=o,a.size=(s=a.size)!=null?s:1,!bp[a.type])throw new Error(`Uniform type ${a.type} is not supported. Supported uniform types are: ${qo.join(", ")}`);(i=a.value)!=null||(a.value=xp(a.type,a.size)),n[o]=a.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=sr(Object.keys(n).map(o=>`${o}-${t[o].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};Ap.defaultOptions={ubo:!1,isStatic:!1};let it=Ap;const Sp={};function _i(r){let t=Sp[r];if(t)return t;const e=new Int32Array(r);for(let s=0;s<r;s++)e[s]=s;return t=Sp[r]=new it({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var Tt=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(Tt||{}),r1=Object.defineProperty,bi=Object.getOwnPropertySymbols,Ep=Object.prototype.hasOwnProperty,wp=Object.prototype.propertyIsEnumerable,Cp=(r,t,e)=>t in r?r1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,s1=(r,t)=>{for(var e in t||(t={}))Ep.call(t,e)&&Cp(r,e,t[e]);if(bi)for(var e of bi(t))wp.call(t,e)&&Cp(r,e,t[e]);return r},i1=(r,t)=>{var e={};for(var s in r)Ep.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&bi)for(var s of bi(r))t.indexOf(s)<0&&wp.call(r,s)&&(e[s]=r[s]);return e};class Ut extends Ct{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:s,groups:i,resources:n,compatibleRenderers:o,groupMap:a}=t;this.gpuProgram=e,this.glProgram=s,o===void 0&&(o=0,e&&(o|=Tt.WEBGPU),s&&(o|=Tt.WEBGL)),this.compatibleRenderers=o;const u={};if(!n&&!i&&(n={}),n&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&i&&!a)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&i&&a)for(const l in a)for(const c in a[l]){const h=a[l][c];u[h]={group:l,binding:c,name:h}}else if(e&&i&&!a){const l=e.structsAndGroups.groups;a={},l.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,u[c.name]=c})}else if(n){i={},a={},e&&e.structsAndGroups.groups.forEach(c=>{a[c.group]=a[c.group]||{},a[c.group][c.binding]=c.name,u[c.name]=c});let l=0;for(const c in n)u[c]||(i[99]||(i[99]=new Kt,this._ownedBindGroups.push(i[99])),u[c]={group:99,binding:l,name:c},a[99]=a[99]||{},a[99][l]=c,l++);for(const c in n){const h=c;let d=n[c];!d.source&&!d._resourceType&&(d=new it(d));const p=u[h];p&&(i[p.group]||(i[p.group]=new Kt,this._ownedBindGroups.push(i[p.group])),i[p.group].setResource(d,p.binding))}}this.groups=i,this._uniformBindMap=a,this.resources=this._buildResourceAccessor(i,u)}addResource(t,e,s){var i,n;(i=this._uniformBindMap)[e]||(i[e]={}),(n=this._uniformBindMap[e])[s]||(n[s]=t),this.groups[e]||(this.groups[e]=new Kt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const s={};for(const i in e){const n=e[i];Object.defineProperty(s,n.name,{get(){return t[n.group].getResource(n.binding)},set(o){t[n.group].setResource(o,n.binding)}})}return s}destroy(t=!1){var e,s;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(s=this.glProgram)==null||s.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:s,gl:i}=e,n=i1(e,["gpu","gl"]);let o,a;return s&&(o=Ot.from(s)),i&&(a=It.from(i)),new Ut(s1({gpuProgram:o,glProgram:a},n))}}class Rp extends Ut{constructor(t){const e=ar({name:"batch",bits:[fi,gi(t),lr]}),s=or({name:"batch",bits:[pi,mi(t),ur]});super({glProgram:e,gpuProgram:s,resources:{batchSamplers:_i(t)}})}}let Pp=null;const Dp=class fx extends Ud{constructor(){super(...arguments),this.geometry=new Nd,this.shader=Pp||(Pp=new Rp(this.maxTextures)),this.name=fx.extension.name,this.vertexSize=6}packAttributes(t,e,s,i,n){const o=n<<16|t.roundPixels&65535,a=t.transform,u=a.a,l=a.b,c=a.c,h=a.d,d=a.tx,p=a.ty,{positions:f,uvs:g}=t,m=t.color,_=t.attributeOffset,x=_+t.attributeSize;for(let b=_;b<x;b++){const v=b*2,A=f[v],C=f[v+1];e[i++]=u*A+c*C+d,e[i++]=h*C+l*A+p,e[i++]=g[v],e[i++]=g[v+1],s[i++]=m,s[i++]=o}}packQuadAttributes(t,e,s,i,n){const o=t.texture,a=t.transform,u=a.a,l=a.b,c=a.c,h=a.d,d=a.tx,p=a.ty,f=t.bounds,g=f.maxX,m=f.minX,_=f.maxY,x=f.minY,b=o.uvs,v=t.color,A=n<<16|t.roundPixels&65535;e[i+0]=u*m+c*x+d,e[i+1]=h*x+l*m+p,e[i+2]=b.x0,e[i+3]=b.y0,s[i+4]=v,s[i+5]=A,e[i+6]=u*g+c*x+d,e[i+7]=h*x+l*g+p,e[i+8]=b.x1,e[i+9]=b.y1,s[i+10]=v,s[i+11]=A,e[i+12]=u*g+c*_+d,e[i+13]=h*_+l*g+p,e[i+14]=b.x2,e[i+15]=b.y2,s[i+16]=v,s[i+17]=A,e[i+18]=u*m+c*_+d,e[i+19]=h*_+l*m+p,e[i+20]=b.x3,e[i+21]=b.y3,s[i+22]=v,s[i+23]=A}};Dp.extension={type:[y.Batcher],name:"default"};let xi=Dp;const Mp={},n1="8.0.0",Op="8.3.4";function Ko(r,t,e=3){if(Mp[t])return;let s=new Error().stack;typeof s=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`):(s=s.split(`
`).splice(e).join(`
`),console.groupCollapsed?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",`${t}
Deprecated since v${r}`),console.warn(s),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`),console.warn(s))),Mp[t]=!0}function Zo(r,t,e,s,i,n,o,a=null){let u=0;e*=t,i*=n;const l=a.a,c=a.b,h=a.c,d=a.d,p=a.tx,f=a.ty;for(;u<o;){const g=r[e],m=r[e+1];s[i]=l*g+h*m+p,s[i+1]=c*g+d*m+f,i+=n,e+=t,u++}}function Qo(r,t,e,s){let i=0;for(t*=e;i<s;)r[t]=0,r[t+1]=0,t+=e,i++}function yi(r,t,e,s,i){const n=t.a,o=t.b,a=t.c,u=t.d,l=t.tx,c=t.ty;e=e||0,s=s||2,i=i||r.length/s-e;let h=e*s;for(let d=0;d<i;d++){const p=r[h],f=r[h+1];r[h]=n*p+a*f+l,r[h+1]=o*p+u*f+c,h+=s}}function Bp(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,s=r>>8&255,i=r&255,n=t>>16&255,o=t>>8&255,a=t&255,u=e*n/255,l=s*o/255,c=i*a/255;return(u<<16)+(l<<8)+c}const o1=new B;class vi{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,s=this.renderable;return s?Bp(e,s.groupColor)+(this.alpha*s.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||o1}copyTo(t){t.indexOffset=this.indexOffset,t.indexSize=this.indexSize,t.attributeOffset=this.attributeOffset,t.attributeSize=this.attributeSize,t.baseColor=this.baseColor,t.alpha=this.alpha,t.texture=this.texture,t.geometryData=this.geometryData}reset(){this.applyTransform=!0,this.renderable=null}}var a1=Object.defineProperty,u1=Object.defineProperties,l1=Object.getOwnPropertyDescriptors,Gp=Object.getOwnPropertySymbols,c1=Object.prototype.hasOwnProperty,h1=Object.prototype.propertyIsEnumerable,Ip=(r,t,e)=>t in r?a1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ti=(r,t)=>{for(var e in t||(t={}))c1.call(t,e)&&Ip(r,e,t[e]);if(Gp)for(var e of Gp(t))h1.call(t,e)&&Ip(r,e,t[e]);return r},Ai=(r,t)=>u1(r,l1(t));const oe={extension:{type:y.ShapeBuilder,name:"circle"},build(r,t){let e,s,i,n,o,a;if(r.type==="circle"){const v=r;e=v.x,s=v.y,o=a=v.radius,i=n=0}else if(r.type==="ellipse"){const v=r;e=v.x,s=v.y,o=v.halfWidth,a=v.halfHeight,i=n=0}else{const v=r,A=v.width/2,C=v.height/2;e=v.x+A,s=v.y+C,o=a=Math.max(0,Math.min(v.radius,Math.min(A,C))),i=A-o,n=C-a}if(!(o>=0&&a>=0&&i>=0&&n>=0))return t;const u=Math.ceil(2.3*Math.sqrt(o+a)),l=u*8+(i?4:0)+(n?4:0);if(l===0)return t;if(u===0)return t[0]=t[6]=e+i,t[1]=t[3]=s+n,t[2]=t[4]=e-i,t[5]=t[7]=s-n,t;let c=0,h=u*4+(i?2:0)+2,d=h,p=l,f=i+o,g=n,m=e+f,_=e-f,x=s+g;if(t[c++]=m,t[c++]=x,t[--h]=x,t[--h]=_,n){const v=s-g;t[d++]=_,t[d++]=v,t[--p]=v,t[--p]=m}for(let v=1;v<u;v++){const A=Math.PI/2*(v/u),C=i+Math.cos(A)*o,w=n+Math.sin(A)*a,R=e+C,T=e-C,S=s+w,G=s-w;t[c++]=R,t[c++]=S,t[--h]=S,t[--h]=T,t[d++]=T,t[d++]=G,t[--p]=G,t[--p]=R}f=i,g=n+a,m=e+f,_=e-f,x=s+g;const b=s-g;return t[c++]=m,t[c++]=x,t[--p]=b,t[--p]=m,i&&(t[c++]=_,t[c++]=x,t[--p]=b,t[--p]=_),t},triangulate(r,t,e,s,i,n){if(r.length===0)return;let o=0,a=0;for(let c=0;c<r.length;c+=2)o+=r[c],a+=r[c+1];o/=r.length/2,a/=r.length/2;let u=s;t[u*e]=o,t[u*e+1]=a;const l=u++;for(let c=0;c<r.length;c+=2)t[u*e]=r[c],t[u*e+1]=r[c+1],c>0&&(i[n++]=u,i[n++]=l,i[n++]=u-1),u++;i[n++]=l+1,i[n++]=l,i[n++]=u-1}},Fp=Ai(Ti({},oe),{extension:Ai(Ti({},oe.extension),{name:"ellipse"})}),Up=Ai(Ti({},oe),{extension:Ai(Ti({},oe.extension),{name:"roundedRectangle"})}),kp=1e-4,Jo=1e-4;function Np(r){const t=r.length;if(t<6)return 1;let e=0;for(let s=0,i=r[t-2],n=r[t-1];s<t;s+=2){const o=r[s],a=r[s+1];e+=(o-i)*(a+n),i=o,n=a}return e<0?-1:1}function Lp(r,t,e,s,i,n,o,a){const u=r-e*i,l=t-s*i,c=r+e*n,h=t+s*n;let d,p;o?(d=s,p=-e):(d=-s,p=e);const f=u+d,g=l+p,m=c+d,_=h+p;return a.push(f,g),a.push(m,_),2}function Ue(r,t,e,s,i,n,o,a){const u=e-r,l=s-t;let c=Math.atan2(u,l),h=Math.atan2(i-r,n-t);a&&c<h?c+=Math.PI*2:!a&&c>h&&(h+=Math.PI*2);let d=c;const p=h-c,f=Math.abs(p),g=Math.sqrt(u*u+l*l),m=(15*f*Math.sqrt(g)/Math.PI>>0)+1,_=p/m;if(d+=_,a){o.push(r,t),o.push(e,s);for(let x=1,b=d;x<m;x++,b+=_)o.push(r,t),o.push(r+Math.sin(b)*g,t+Math.cos(b)*g);o.push(r,t),o.push(i,n)}else{o.push(e,s),o.push(r,t);for(let x=1,b=d;x<m;x++,b+=_)o.push(r+Math.sin(b)*g,t+Math.cos(b)*g),o.push(r,t);o.push(i,n),o.push(r,t)}return m*2}function $p(r,t,e,s,i,n,o,a,u){const l=kp;if(r.length===0)return;const c=t;let h=c.alignment;if(t.alignment!==.5){let Z=Np(r);e&&(Z*=-1),h=(h-.5)*Z+.5}const d=new nt(r[0],r[1]),p=new nt(r[r.length-2],r[r.length-1]),f=s,g=Math.abs(d.x-p.x)<l&&Math.abs(d.y-p.y)<l;if(f){r=r.slice(),g&&(r.pop(),r.pop(),p.set(r[r.length-2],r[r.length-1]));const Z=(d.x+p.x)*.5,ce=(p.y+d.y)*.5;r.unshift(Z,ce),r.push(Z,ce)}const m=i,_=r.length/2;let x=r.length;const b=m.length/2,v=c.width/2,A=v*v,C=c.miterLimit*c.miterLimit;let w=r[0],R=r[1],T=r[2],S=r[3],G=0,N=0,M=-(R-S),O=w-T,W=0,D=0,K=Math.sqrt(M*M+O*O);M/=K,O/=K,M*=v,O*=v;const Xe=h,I=(1-Xe)*2,U=Xe*2;f||(c.cap==="round"?x+=Ue(w-M*(I-U)*.5,R-O*(I-U)*.5,w-M*I,R-O*I,w+M*U,R+O*U,m,!0)+2:c.cap==="square"&&(x+=Lp(w,R,M,O,I,U,!0,m))),m.push(w-M*I,R-O*I),m.push(w+M*U,R+O*U);for(let Z=1;Z<_-1;++Z){w=r[(Z-1)*2],R=r[(Z-1)*2+1],T=r[Z*2],S=r[Z*2+1],G=r[(Z+1)*2],N=r[(Z+1)*2+1],M=-(R-S),O=w-T,K=Math.sqrt(M*M+O*O),M/=K,O/=K,M*=v,O*=v,W=-(S-N),D=T-G,K=Math.sqrt(W*W+D*D),W/=K,D/=K,W*=v,D*=v;const ce=T-w,Cr=R-S,Rr=T-G,Pr=N-S,xc=ce*Rr+Cr*Pr,Is=Cr*Rr-Pr*ce,Dr=Is<0;if(Math.abs(Is)<.001*Math.abs(xc)){m.push(T-M*I,S-O*I),m.push(T+M*U,S+O*U),xc>=0&&(c.join==="round"?x+=Ue(T,S,T-M*I,S-O*I,T-W*I,S-D*I,m,!1)+4:x+=2,m.push(T-W*U,S-D*U),m.push(T+W*I,S+D*I));continue}const yc=(-M+w)*(-O+S)-(-M+T)*(-O+R),vc=(-W+G)*(-D+S)-(-W+T)*(-D+N),Fs=(ce*vc-Rr*yc)/Is,Us=(Pr*yc-Cr*vc)/Is,Ln=(Fs-T)*(Fs-T)+(Us-S)*(Us-S),Ae=T+(Fs-T)*I,Se=S+(Us-S)*I,Ee=T-(Fs-T)*U,we=S-(Us-S)*U,Nx=Math.min(ce*ce+Cr*Cr,Rr*Rr+Pr*Pr),Tc=Dr?I:U,Lx=Nx+Tc*Tc*A;Ln<=Lx?c.join==="bevel"||Ln/A>C?(Dr?(m.push(Ae,Se),m.push(T+M*U,S+O*U),m.push(Ae,Se),m.push(T+W*U,S+D*U)):(m.push(T-M*I,S-O*I),m.push(Ee,we),m.push(T-W*I,S-D*I),m.push(Ee,we)),x+=2):c.join==="round"?Dr?(m.push(Ae,Se),m.push(T+M*U,S+O*U),x+=Ue(T,S,T+M*U,S+O*U,T+W*U,S+D*U,m,!0)+4,m.push(Ae,Se),m.push(T+W*U,S+D*U)):(m.push(T-M*I,S-O*I),m.push(Ee,we),x+=Ue(T,S,T-M*I,S-O*I,T-W*I,S-D*I,m,!1)+4,m.push(T-W*I,S-D*I),m.push(Ee,we)):(m.push(Ae,Se),m.push(Ee,we)):(m.push(T-M*I,S-O*I),m.push(T+M*U,S+O*U),c.join==="round"?Dr?x+=Ue(T,S,T+M*U,S+O*U,T+W*U,S+D*U,m,!0)+2:x+=Ue(T,S,T-M*I,S-O*I,T-W*I,S-D*I,m,!1)+2:c.join==="miter"&&Ln/A<=C&&(Dr?(m.push(Ee,we),m.push(Ee,we)):(m.push(Ae,Se),m.push(Ae,Se)),x+=2),m.push(T-W*I,S-D*I),m.push(T+W*U,S+D*U),x+=2)}w=r[(_-2)*2],R=r[(_-2)*2+1],T=r[(_-1)*2],S=r[(_-1)*2+1],M=-(R-S),O=w-T,K=Math.sqrt(M*M+O*O),M/=K,O/=K,M*=v,O*=v,m.push(T-M*I,S-O*I),m.push(T+M*U,S+O*U),f||(c.cap==="round"?x+=Ue(T-M*(I-U)*.5,S-O*(I-U)*.5,T-M*I,S-O*I,T+M*U,S+O*U,m,!1)+2:c.cap==="square"&&(x+=Lp(T,S,M,O,I,U,!1,m)));const kx=Jo*Jo;for(let Z=b;Z<x+b-2;++Z)w=m[Z*2],R=m[Z*2+1],T=m[(Z+1)*2],S=m[(Z+1)*2+1],G=m[(Z+2)*2],N=m[(Z+2)*2+1],!(Math.abs(w*(S-N)+T*(N-R)+G*(R-S))<kx)&&a.push(Z,Z+1,Z+2)}var Si={exports:{}},TP=Si.exports;Si.exports=Ei;var AP=Si.exports.default=Ei;function Ei(r,t,e){e=e||2;var s=t&&t.length,i=s?t[0]*e:r.length,n=Hp(r,0,i,e,!0),o=[];if(!n||n.next===n.prev)return o;var a,u,l,c,h,d,p;if(s&&(n=g1(r,t,n,e)),r.length>80*e){a=l=r[0],u=c=r[1];for(var f=e;f<i;f+=e)h=r[f],d=r[f+1],h<a&&(a=h),d<u&&(u=d),h>l&&(l=h),d>c&&(c=d);p=Math.max(l-a,c-u),p=p!==0?32767/p:0}return es(n,o,e,a,u,p,0),o}function Hp(r,t,e,s,i){var n,o;if(i===ra(r,t,e,s)>0)for(n=t;n<e;n+=s)o=jp(n,r[n],r[n+1],o);else for(n=e-s;n>=t;n-=s)o=jp(n,r[n],r[n+1],o);return o&&wi(o,o.next)&&(ss(o),o=o.next),o}function ke(r,t){if(!r)return r;t||(t=r);var e=r,s;do if(s=!1,!e.steiner&&(wi(e,e.next)||J(e.prev,e,e.next)===0)){if(ss(e),e=t=e.prev,e===e.next)break;s=!0}else e=e.next;while(s||e!==t);return t}function es(r,t,e,s,i,n,o){if(r){!o&&n&&v1(r,s,i,n);for(var a=r,u,l;r.prev!==r.next;){if(u=r.prev,l=r.next,n?p1(r,s,i,n):d1(r)){t.push(u.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),ss(r),r=l.next,a=l.next;continue}if(r=l,r===a){o?o===1?(r=f1(ke(r),t,e),es(r,t,e,s,i,n,2)):o===2&&m1(r,t,e,s,i,n):es(ke(r),t,e,s,i,n,1);break}}}}function d1(r){var t=r.prev,e=r,s=r.next;if(J(t,e,s)>=0)return!1;for(var i=t.x,n=e.x,o=s.x,a=t.y,u=e.y,l=s.y,c=i<n?i<o?i:o:n<o?n:o,h=a<u?a<l?a:l:u<l?u:l,d=i>n?i>o?i:o:n>o?n:o,p=a>u?a>l?a:l:u>l?u:l,f=s.next;f!==t;){if(f.x>=c&&f.x<=d&&f.y>=h&&f.y<=p&&cr(i,a,n,u,o,l,f.x,f.y)&&J(f.prev,f,f.next)>=0)return!1;f=f.next}return!0}function p1(r,t,e,s){var i=r.prev,n=r,o=r.next;if(J(i,n,o)>=0)return!1;for(var a=i.x,u=n.x,l=o.x,c=i.y,h=n.y,d=o.y,p=a<u?a<l?a:l:u<l?u:l,f=c<h?c<d?c:d:h<d?h:d,g=a>u?a>l?a:l:u>l?u:l,m=c>h?c>d?c:d:h>d?h:d,_=ta(p,f,t,e,s),x=ta(g,m,t,e,s),b=r.prevZ,v=r.nextZ;b&&b.z>=_&&v&&v.z<=x;){if(b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==i&&b!==o&&cr(a,c,u,h,l,d,b.x,b.y)&&J(b.prev,b,b.next)>=0||(b=b.prevZ,v.x>=p&&v.x<=g&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&cr(a,c,u,h,l,d,v.x,v.y)&&J(v.prev,v,v.next)>=0))return!1;v=v.nextZ}for(;b&&b.z>=_;){if(b.x>=p&&b.x<=g&&b.y>=f&&b.y<=m&&b!==i&&b!==o&&cr(a,c,u,h,l,d,b.x,b.y)&&J(b.prev,b,b.next)>=0)return!1;b=b.prevZ}for(;v&&v.z<=x;){if(v.x>=p&&v.x<=g&&v.y>=f&&v.y<=m&&v!==i&&v!==o&&cr(a,c,u,h,l,d,v.x,v.y)&&J(v.prev,v,v.next)>=0)return!1;v=v.nextZ}return!0}function f1(r,t,e){var s=r;do{var i=s.prev,n=s.next.next;!wi(i,n)&&Xp(i,s,s.next,n)&&rs(i,n)&&rs(n,i)&&(t.push(i.i/e|0),t.push(s.i/e|0),t.push(n.i/e|0),ss(s),ss(s.next),s=r=n),s=s.next}while(s!==r);return ke(s)}function m1(r,t,e,s,i,n){var o=r;do{for(var a=o.next.next;a!==o.prev;){if(o.i!==a.i&&S1(o,a)){var u=zp(o,a);o=ke(o,o.next),u=ke(u,u.next),es(o,t,e,s,i,n,0),es(u,t,e,s,i,n,0);return}a=a.next}o=o.next}while(o!==r)}function g1(r,t,e,s){var i=[],n,o,a,u,l;for(n=0,o=t.length;n<o;n++)a=t[n]*s,u=n<o-1?t[n+1]*s:r.length,l=Hp(r,a,u,s,!1),l===l.next&&(l.steiner=!0),i.push(A1(l));for(i.sort(_1),n=0;n<i.length;n++)e=b1(i[n],e);return e}function _1(r,t){return r.x-t.x}function b1(r,t){var e=x1(r,t);if(!e)return t;var s=zp(e,r);return ke(s,s.next),ke(e,e.next)}function x1(r,t){var e=t,s=r.x,i=r.y,n=-1/0,o;do{if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){var a=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(a<=s&&a>n&&(n=a,o=e.x<e.next.x?e:e.next,a===s))return o}e=e.next}while(e!==t);if(!o)return null;var u=o,l=o.x,c=o.y,h=1/0,d;e=o;do s>=e.x&&e.x>=l&&s!==e.x&&cr(i<c?s:n,i,l,c,i<c?n:s,i,e.x,e.y)&&(d=Math.abs(i-e.y)/(s-e.x),rs(e,r)&&(d<h||d===h&&(e.x>o.x||e.x===o.x&&y1(o,e)))&&(o=e,h=d)),e=e.next;while(e!==u);return o}function y1(r,t){return J(r.prev,r,t.prev)<0&&J(t.next,r,r.next)<0}function v1(r,t,e,s){var i=r;do i.z===0&&(i.z=ta(i.x,i.y,t,e,s)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==r);i.prevZ.nextZ=null,i.prevZ=null,T1(i)}function T1(r){var t,e,s,i,n,o,a,u,l=1;do{for(e=r,r=null,n=null,o=0;e;){for(o++,s=e,a=0,t=0;t<l&&(a++,s=s.nextZ,!!s);t++);for(u=l;a>0||u>0&&s;)a!==0&&(u===0||!s||e.z<=s.z)?(i=e,e=e.nextZ,a--):(i=s,s=s.nextZ,u--),n?n.nextZ=i:r=i,i.prevZ=n,n=i;e=s}n.nextZ=null,l*=2}while(o>1);return r}function ta(r,t,e,s,i){return r=(r-e)*i|0,t=(t-s)*i|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function A1(r){var t=r,e=r;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==r);return e}function cr(r,t,e,s,i,n,o,a){return(i-o)*(t-a)>=(r-o)*(n-a)&&(r-o)*(s-a)>=(e-o)*(t-a)&&(e-o)*(n-a)>=(i-o)*(s-a)}function S1(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!E1(r,t)&&(rs(r,t)&&rs(t,r)&&w1(r,t)&&(J(r.prev,r,t.prev)||J(r,t.prev,t))||wi(r,t)&&J(r.prev,r,r.next)>0&&J(t.prev,t,t.next)>0)}function J(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function wi(r,t){return r.x===t.x&&r.y===t.y}function Xp(r,t,e,s){var i=Ri(J(r,t,e)),n=Ri(J(r,t,s)),o=Ri(J(e,s,r)),a=Ri(J(e,s,t));return!!(i!==n&&o!==a||i===0&&Ci(r,e,t)||n===0&&Ci(r,s,t)||o===0&&Ci(e,r,s)||a===0&&Ci(e,t,s))}function Ci(r,t,e){return t.x<=Math.max(r.x,e.x)&&t.x>=Math.min(r.x,e.x)&&t.y<=Math.max(r.y,e.y)&&t.y>=Math.min(r.y,e.y)}function Ri(r){return r>0?1:r<0?-1:0}function E1(r,t){var e=r;do{if(e.i!==r.i&&e.next.i!==r.i&&e.i!==t.i&&e.next.i!==t.i&&Xp(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function rs(r,t){return J(r.prev,r,r.next)<0?J(r,t,r.next)>=0&&J(r,r.prev,t)>=0:J(r,t,r.prev)<0||J(r,r.next,t)<0}function w1(r,t){var e=r,s=!1,i=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(s=!s),e=e.next;while(e!==r);return s}function zp(r,t){var e=new ea(r.i,r.x,r.y),s=new ea(t.i,t.x,t.y),i=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=i,i.prev=e,s.next=e,e.prev=s,n.next=s,s.prev=n,s}function jp(r,t,e,s){var i=new ea(r,t,e);return s?(i.next=s.next,i.prev=s,s.next.prev=i,s.next=i):(i.prev=i,i.next=i),i}function ss(r){r.next.prev=r.prev,r.prev.next=r.next,r.prevZ&&(r.prevZ.nextZ=r.nextZ),r.nextZ&&(r.nextZ.prevZ=r.prevZ)}function ea(r,t,e){this.i=r,this.x=t,this.y=e,this.prev=null,this.next=null,this.z=0,this.prevZ=null,this.nextZ=null,this.steiner=!1}Ei.deviation=function(r,t,e,s){var i=t&&t.length,n=i?t[0]*e:r.length,o=Math.abs(ra(r,0,n,e));if(i)for(var a=0,u=t.length;a<u;a++){var l=t[a]*e,c=a<u-1?t[a+1]*e:r.length;o-=Math.abs(ra(r,l,c,e))}var h=0;for(a=0;a<s.length;a+=3){var d=s[a]*e,p=s[a+1]*e,f=s[a+2]*e;h+=Math.abs((r[d]-r[f])*(r[p+1]-r[d+1])-(r[d]-r[p])*(r[f+1]-r[d+1]))}return o===0&&h===0?0:Math.abs((h-o)/o)};function ra(r,t,e,s){for(var i=0,n=t,o=e-s;n<e;n+=s)i+=(r[o]-r[n])*(r[n+1]+r[o+1]),o=n;return i}Ei.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},s=0,i=0;i<r.length;i++){for(var n=0;n<r[i].length;n++)for(var o=0;o<t;o++)e.vertices.push(r[i][n][o]);i>0&&(s+=r[i-1].length,e.holes.push(s))}return e};var C1=Si.exports,Vp=ks(C1);function sa(r,t,e,s,i,n,o){const a=Vp(r,t,2);if(!a)return;for(let l=0;l<a.length;l+=3)n[o++]=a[l]+i,n[o++]=a[l+1]+i,n[o++]=a[l+2]+i;let u=i*s;for(let l=0;l<r.length;l+=2)e[u]=r[l],e[u+1]=r[l+1],u+=s}const R1=[],ia={extension:{type:y.ShapeBuilder,name:"polygon"},build(r,t){for(let e=0;e<r.points.length;e++)t[e]=r.points[e];return t},triangulate(r,t,e,s,i,n){sa(r,R1,t,e,s,i,n)}},na={extension:{type:y.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,s=e.x,i=e.y,n=e.width,o=e.height;return n>=0&&o>=0&&(t[0]=s,t[1]=i,t[2]=s+n,t[3]=i,t[4]=s+n,t[5]=i+o,t[6]=s,t[7]=i+o),t},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[6],t[s+o+1]=r[7],o+=e,t[s+o]=r[4],t[s+o+1]=r[5],o+=e;const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2,i[n++]=a+1,i[n++]=a+3,i[n++]=a+2}},oa={extension:{type:y.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,s,i,n){let o=0;s*=e,t[s+o]=r[0],t[s+o+1]=r[1],o+=e,t[s+o]=r[2],t[s+o+1]=r[3],o+=e,t[s+o]=r[4],t[s+o+1]=r[5];const a=s/e;i[n++]=a,i[n++]=a+1,i[n++]=a+2}},is={};k.handleByMap(y.ShapeBuilder,is),k.add(na,ia,oa,oe,Fp,Up);const P1=new V;function Wp(r,t){const{geometryData:e,batches:s}=t;s.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let i=0;i<r.instructions.length;i++){const n=r.instructions[i];if(n.action==="texture")D1(n.data,s,e);else if(n.action==="fill"||n.action==="stroke"){const o=n.action==="stroke",a=n.data.path.shapePath,u=n.data.style,l=n.data.hole;o&&l&&Yp(l.shapePath,u,null,!0,s,e),Yp(a,u,l,o,s,e)}}}function D1(r,t,e){const{vertices:s,uvs:i,indices:n}=e,o=n.length,a=s.length/2,u=[],l=is.rectangle,c=P1,h=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;const d=r.transform;l.build(c,u),d&&yi(u,d),l.triangulate(u,s,2,a,n,o);const p=h.uvs;i.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);const f=H.get(vi);f.indexOffset=o,f.indexSize=n.length-o,f.attributeOffset=a,f.attributeSize=s.length/2-a,f.baseColor=r.style,f.alpha=r.alpha,f.texture=h,f.geometryData=e,t.push(f)}function Yp(r,t,e,s,i,n){const{vertices:o,uvs:a,indices:u}=n,l=r.shapePrimitives.length-1;r.shapePrimitives.forEach(({shape:c,transform:h},d)=>{var p;const f=u.length,g=o.length/2,m=[],_=is[c.type];if(_.build(c,m),h&&yi(m,h),s){const A=(p=c.closePath)!=null?p:!0;$p(m,t,!1,A,o,2,g,u,f)}else if(e&&l===d){l!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const A=[],C=m.slice();M1(e.shapePath).forEach(w=>{A.push(C.length/2),C.push(...w)}),sa(C,A,o,2,g,u,f)}else _.triangulate(m,o,2,g,u,f);const x=a.length/2,b=t.texture;if(b!==E.WHITE){const A=t.matrix;A&&(h&&A.append(h.clone().invert()),Zo(o,2,g,a,x,2,o.length/2-g,A))}else Qo(a,x,2,o.length/2-g);const v=H.get(vi);v.indexOffset=f,v.indexSize=u.length-f,v.attributeOffset=g,v.attributeSize=o.length/2-g,v.baseColor=t.color,v.alpha=t.alpha,v.texture=b,v.geometryData=n,i.push(v)})}function M1(r){if(!r)return[];const t=r.shapePrimitives,e=[];for(let s=0;s<t.length;s++){const i=t[s].shape,n=[];is[i.type].build(i,n),e.push(n)}return e}class qp{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Kp{constructor(){this.batcher=new xi,this.instructions=new yo}init(){this.instructions.reset()}get geometry(){return Ko(Op,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}}const aa=class pc{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){var e;pc.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:pc.defaultOptions.bezierSmoothness}getContextRenderData(t){return this._graphicsDataContextHash[t.uid]||this._initContextRenderData(t)}updateGpuContext(t){let e=this._gpuContextHash[t.uid]||this._initContext(t);if(t.dirty){e?this._cleanGraphicsContextData(t):e=this._initContext(t),Wp(t,e);const s=t.batchMode;t.customShader||s==="no-batch"?e.isBatchable=!1:s==="auto"&&(e.isBatchable=e.geometryData.vertices.length<400),t.dirty=!1}return e}getGpuContext(t){return this._gpuContextHash[t.uid]||this._initContext(t)}_initContextRenderData(t){const e=H.get(Kp),{batches:s,geometryData:i}=this._gpuContextHash[t.uid],n=i.vertices.length,o=i.indices.length;for(let c=0;c<s.length;c++)s[c].applyTransform=!1;const a=e.batcher;a.ensureAttributeBuffer(n),a.ensureIndexBuffer(o),a.begin();for(let c=0;c<s.length;c++){const h=s[c];a.add(h)}a.finish(e.instructions);const u=a.geometry;u.indexBuffer.setDataWithSize(a.indexBuffer,a.indexSize,!0),u.buffers[0].setDataWithSize(a.attributeBuffer.float32View,a.attributeSize,!0);const l=a.batches;for(let c=0;c<l.length;c++){const h=l[c];h.bindGroup=li(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new qp;return e.context=t,this._gpuContextHash[t.uid]=e,t.on("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]}onGraphicsContextDestroy(t){this._cleanGraphicsContextData(t),t.off("destroy",this.onGraphicsContextDestroy,this),this._gpuContextHash[t.uid]=null}_cleanGraphicsContextData(t){const e=this._gpuContextHash[t.uid];e.isBatchable||this._graphicsDataContextHash[t.uid]&&(H.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(s=>{H.return(s)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};aa.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"graphicsContext"},aa.defaultOptions={bezierSmoothness:.5};let Pi=aa;const O1={normal:0,add:1,multiply:2,screen:3,overlay:4,erase:5,"normal-npm":6,"add-npm":7,"screen-npm":8,min:9,max:10},ua=0,la=1,ca=2,ha=3,da=4,pa=5,fa=class mx{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ua)}set blend(t){!!(this.data&1<<ua)!==t&&(this.data^=1<<ua)}get offsets(){return!!(this.data&1<<la)}set offsets(t){!!(this.data&1<<la)!==t&&(this.data^=1<<la)}set cullMode(t){if(t==="none"){this.culling=!1;return}this.culling=!0,this.clockwiseFrontFace=t==="front"}get cullMode(){return this.culling?this.clockwiseFrontFace?"front":"back":"none"}get culling(){return!!(this.data&1<<ca)}set culling(t){!!(this.data&1<<ca)!==t&&(this.data^=1<<ca)}get depthTest(){return!!(this.data&1<<ha)}set depthTest(t){!!(this.data&1<<ha)!==t&&(this.data^=1<<ha)}get depthMask(){return!!(this.data&1<<pa)}set depthMask(t){!!(this.data&1<<pa)!==t&&(this.data^=1<<pa)}get clockwiseFrontFace(){return!!(this.data&1<<da)}set clockwiseFrontFace(t){!!(this.data&1<<da)!==t&&(this.data^=1<<da)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=O1[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new mx;return t.depthTest=!1,t.blend=!0,t}};fa.default2d=fa.for2d();let Lt=fa;function B1(r,t,e,s){e[s++]=(r>>16&255)/255,e[s++]=(r>>8&255)/255,e[s++]=(r&255)/255,e[s++]=t}function ns(r,t,e){const s=(r>>24&255)/255;t[e++]=(r&255)/255*s,t[e++]=(r>>8&255)/255*s,t[e++]=(r>>16&255)/255*s,t[e++]=s}class ma{constructor(t,e){this.state=Lt.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=t.context,s=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(e);return!!(i.isBatchable||s!==i.isBatchable)}addRenderable(t,e){const s=this.renderer.graphicsContext.updateGpuContext(t.context);t._didGraphicsUpdate&&(t._didGraphicsUpdate=!1,this._rebuild(t)),s.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._graphicsBatchesHash[t.uid];if(e)for(let s=0;s<e.length;s++){const i=e[s];i._batcher.updateElement(i)}}destroyRenderable(t){this._graphicsBatchesHash[t.uid]&&this._removeBatchForRenderable(t.uid),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;const e=this.renderer,s=t.context;if(!e.graphicsContext.getGpuContext(s).batches.length)return;const i=s.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const n=i.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,ns(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),s.isBatchable&&this._initBatchesForRenderable(t),t.batched=s.isBatchable}_addToBatcher(t,e){const s=this.renderer.renderPipes.batch,i=this._getBatchesForRenderable(t);for(let n=0;n<i.length;n++){const o=i[n];s.addToBatch(o,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){const e=t.context,s=this.renderer.graphicsContext.getGpuContext(e),i=this.renderer._roundPixels|t._roundPixels,n=s.batches.map(o=>{const a=H.get(vi);return o.copyTo(a),a.renderable=t,a.roundPixels=i,a});return this._graphicsBatchesHash[t.uid]===void 0&&t.on("destroyed",this._destroyRenderableBound),this._graphicsBatchesHash[t.uid]=n,n}_removeBatchForRenderable(t){this._graphicsBatchesHash[t].forEach(e=>{H.return(e)}),this._graphicsBatchesHash[t]=null}destroy(){this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null;for(const t in this._graphicsBatchesHash)this._removeBatchForRenderable(t);this._graphicsBatchesHash=null}}ma.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"graphics"},k.add(ma),k.add(Pi);class Di{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let s=e;const i=this.texture.textureMatrix;return i.isSimple||(s=this._transformedUvs,(this._textureMatrixUpdateId!==i._updateID||this._uvUpdateId!==t._updateID)&&((!s||s.length<e.length)&&(s=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=i._updateID,this._uvUpdateId=t._updateID,i.multiplyUvs(e,s))),s}get positions(){return this.geometry.positions}get indices(){return this.geometry.indices}get color(){return this.renderable.groupColorAlpha}get groupTransform(){return this.renderable.groupTransform}get attributeSize(){return this.geometry.positions.length/2}get indexSize(){return this.geometry.indices.length}}class ga{constructor(t,e){this.localUniforms=new it({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Kt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=this._getMeshData(t),s=e.batched,i=t.batched;if(e.batched=i,s!==i)return!0;if(i){const n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;const o=this._getBatchableMesh(t),a=t.texture;if(o.texture._source!==a._source&&o.texture._source!==a._source)return!o._batcher.checkAndUpdateTexture(o,a)}return!1}addRenderable(t,e){const s=this.renderer.renderPipes.batch,{batched:i}=this._getMeshData(t);if(i){const n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,s.addToBatch(n,e)}else s.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;const e=this._gpuBatchableMeshHash[t.uid];e&&(H.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Jr(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),ns(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e,s;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:(e=t._geometry.indices)==null?void 0:e.length,vertexSize:(s=t._geometry.positions)==null?void 0:s.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=H.get(Di);return e.renderable=t,e.texture=t._texture,e.transform=t.groupTransform,e.roundPixels=this.renderer._roundPixels|t._roundPixels,this._gpuBatchableMeshHash[t.uid]=e,e}destroy(){for(const t in this._gpuBatchableMeshHash)this._gpuBatchableMeshHash[t]&&H.return(this._gpuBatchableMeshHash[t]);this._gpuBatchableMeshHash=null,this._meshDataHash=null,this.localUniforms=null,this.localUniformsBindGroup=null,this._adaptor.destroy(),this._adaptor=null,this.renderer=null}}ga.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"mesh"},k.add(ga);class Mi{constructor(){this.batcherName="default",this.attributeSize=4,this.indexSize=6,this.packAsQuad=!0,this.roundPixels=0,this._attributeStart=0,this._batcher=null,this._batch=null}get blendMode(){return this.renderable.groupBlendMode}get color(){return this.renderable.groupColorAlpha}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.bounds=null}}class _a{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const s=e.batchableSprite.renderable;s._autoResolution&&(s._resolution=this._renderer.resolution,s.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),s=t._getKey();if(e.currentKey!==s){const{width:i,height:n}=this._renderer.canvasText.getTextureSize(t.text,t.resolution,t._style);return!(this._renderer.canvasText.getReferenceCount(e.currentKey)===1&&i===e.texture._source.width&&n===e.texture._source.height)}return!1}addRenderable(t,e){const s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),H.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),s=this._getGpuText(t),i=s.batchableSprite;s.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;const n=t._style.padding;jr(i.bounds,t._anchor,i.texture,n)}_updateGpuText(t){const e=this._getGpuText(t),s=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=s.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),s.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:null,currentKey:"--",batchableSprite:H.get(Mi)};return e.batchableSprite.renderable=t,e.batchableSprite.transform=t.groupTransform,e.batchableSprite.bounds={minX:0,maxX:1,minY:0,maxY:0},e.batchableSprite.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuText[t.uid]=e,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._updateText(t),t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}_a.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"text"};class Zp{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const s=L.get().createCanvas();s.width=t,s.height=e;const i=s.getContext("2d");return{canvas:s,context:i}}getOptimalCanvasAndContext(t,e,s=1){t=Math.ceil(t*s-1e-6),e=Math.ceil(e*s-1e-6),t=Oe(t),e=Oe(e);const i=(t<<17)+(e<<1);this._canvasPool[i]||(this._canvasPool[i]=[]);let n=this._canvasPool[i].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:s,height:i}=e,n=(s<<17)+(i<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Zt=new Zp;var G1=Object.defineProperty,I1=Object.defineProperties,F1=Object.getOwnPropertyDescriptors,Qp=Object.getOwnPropertySymbols,U1=Object.prototype.hasOwnProperty,k1=Object.prototype.propertyIsEnumerable,Jp=(r,t,e)=>t in r?G1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,N1=(r,t)=>{for(var e in t||(t={}))U1.call(t,e)&&Jp(r,e,t[e]);if(Qp)for(var e of Qp(t))k1.call(t,e)&&Jp(r,e,t[e]);return r},L1=(r,t)=>I1(r,F1(t));let $1=0;class tf{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,s){const i=new tt(L1(N1({},this.textureOptions),{width:t,height:e,resolution:1,antialias:s,autoGarbageCollect:!0}));return new E({source:i,label:`texturePool_${$1++}`})}getOptimalTexture(t,e,s=1,i){let n=Math.ceil(t*s-1e-6),o=Math.ceil(e*s-1e-6);n=Oe(n),o=Oe(o);const a=(n<<17)+(o<<1)+(i?1:0);this._texturePool[a]||(this._texturePool[a]=[]);let u=this._texturePool[a].pop();return u||(u=this.createTexture(n,o,i)),u.source._resolution=s,u.source.width=n/s,u.source.height=o/s,u.source.pixelWidth=n,u.source.pixelHeight=o,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=a,u}getSameSizeTexture(t,e=!1){const s=t.source;return this.getOptimalTexture(t.width,t.height,s._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const s=this._texturePool[e];if(s)for(let i=0;i<s.length;i++)s[i].destroy(!0)}this._texturePool={}}}const dt=new tf;function ef(r,t,e){for(let s=0,i=4*e*t;s<t;++s,i+=4)if(r[i+3]!==0)return!1;return!0}function rf(r,t,e,s,i){const n=4*t;for(let o=s,a=s*n+4*e;o<=i;++o,a+=n)if(r[a+3]!==0)return!1;return!0}function sf(r,t=1){const{width:e,height:s}=r,i=r.getContext("2d",{willReadFrequently:!0});if(i===null)throw new TypeError("Failed to get canvas 2D context");const n=i.getImageData(0,0,e,s).data;let o=0,a=0,u=e-1,l=s-1;for(;a<s&&ef(n,e,a);)++a;if(a===s)return V.EMPTY;for(;ef(n,e,l);)--l;for(;rf(n,e,o,a,l);)++o;for(;rf(n,e,u,a,l);)--u;return++u,++l,new V(o/t,a/t,(u-o)/t,(l-a)/t)}const nf=class fc{constructor(t,e,s,i){this.uid=Q("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=s,this.y1=i}addColorStop(t,e){return this.gradientStops.push({offset:t,color:j.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const t=fc.defaultTextureSize,{gradientStops:e}=this,s=L.get().createCanvas();s.width=t,s.height=t;const i=s.getContext("2d"),n=i.createLinearGradient(0,0,fc.defaultTextureSize,1);for(let g=0;g<e.length;g++){const m=e[g];n.addColorStop(m.offset,m.color)}i.fillStyle=n,i.fillRect(0,0,t,t),this.texture=new E({source:new Ge({resource:s,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:o,y0:a,x1:u,y1:l}=this,c=new B,h=u-o,d=l-a,p=Math.sqrt(h*h+d*d),f=Math.atan2(d,h);c.translate(-o,-a),c.scale(1/t,1/t),c.rotate(-f),c.scale(256/p,1),this.transform=c,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map(i=>`${i.offset}-${i.color}`).join("-"),e=this.texture.uid,s=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${s}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};nf.defaultTextureSize=256;let hr=nf;const of={repeat:{addressModeU:"repeat",addressModeV:"repeat"},"repeat-x":{addressModeU:"repeat",addressModeV:"clamp-to-edge"},"repeat-y":{addressModeU:"clamp-to-edge",addressModeV:"repeat"},"no-repeat":{addressModeU:"clamp-to-edge",addressModeV:"clamp-to-edge"}};class os{constructor(t,e){this.uid=Q("fillPattern"),this.transform=new B,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=of[e].addressModeU,t.source.style.addressModeV=of[e].addressModeV)}setTransform(t){const e=this.texture;this.transform.copyFrom(t),this.transform.invert(),this.transform.scale(1/e.frame.width,1/e.frame.height),this._styleKey=null}get styleKey(){return this._styleKey?this._styleKey:(this._styleKey=`fill-pattern-${this.uid}-${this.texture.uid}-${this.transform.toArray().join("-")}`,this._styleKey)}}var H1=z1,ba={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},X1=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function z1(r){var t=[];return r.replace(X1,function(e,s,i){var n=s.toLowerCase();for(i=V1(i),n=="m"&&i.length>2&&(t.push([s].concat(i.splice(0,2))),n="l",s=s=="m"?"l":"L");;){if(i.length==ba[n])return i.unshift(s),t.push(i);if(i.length<ba[n])throw new Error("malformed path data");t.push([s].concat(i.splice(0,ba[n])))}}),t}var j1=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function V1(r){var t=r.match(j1);return t?t.map(Number):[]}var W1=ks(H1);function af(r,t){const e=W1(r),s=[];let i=null,n=0,o=0;for(let a=0;a<e.length;a++){const u=e[a],l=u[0],c=u;switch(l){case"M":n=c[1],o=c[2],t.moveTo(n,o);break;case"m":n+=c[1],o+=c[2],t.moveTo(n,o);break;case"H":n=c[1],t.lineTo(n,o);break;case"h":n+=c[1],t.lineTo(n,o);break;case"V":o=c[1],t.lineTo(n,o);break;case"v":o+=c[1],t.lineTo(n,o);break;case"L":n=c[1],o=c[2],t.lineTo(n,o);break;case"l":n+=c[1],o+=c[2],t.lineTo(n,o);break;case"C":n=c[5],o=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,o);break;case"c":t.bezierCurveTo(n+c[1],o+c[2],n+c[3],o+c[4],n+c[5],o+c[6]),n+=c[5],o+=c[6];break;case"S":n=c[3],o=c[4],t.bezierCurveToShort(c[1],c[2],n,o);break;case"s":t.bezierCurveToShort(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"Q":n=c[3],o=c[4],t.quadraticCurveTo(c[1],c[2],n,o);break;case"q":t.quadraticCurveTo(n+c[1],o+c[2],n+c[3],o+c[4]),n+=c[3],o+=c[4];break;case"T":n=c[1],o=c[2],t.quadraticCurveToShort(n,o);break;case"t":n+=c[1],o+=c[2],t.quadraticCurveToShort(n,o);break;case"A":n=c[6],o=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"a":n+=c[6],o+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,o);break;case"Z":case"z":t.closePath(),s.length>0&&(i=s.pop(),i?(n=i.startX,o=i.startY):(n=0,o=0)),i=null;break;default:}l!=="Z"&&l!=="z"&&i===null&&(i={startX:n,startY:o},s.push(i))}return t}class Fn{constructor(t=0,e=0,s=0){this.type="circle",this.x=t,this.y=e,this.radius=s}clone(){return new Fn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const s=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=s}strokeContains(t,e,s){if(this.radius===0)return!1;const i=this.x-t,n=this.y-e,o=this.radius,a=s/2,u=Math.sqrt(i*i+n*n);return u<o+a&&u>o-a}getBounds(t){return t=t||new V,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class Un{constructor(t=0,e=0,s=0,i=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=s,this.halfHeight=i}clone(){return new Un(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let s=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return s*=s,i*=i,s+i<=1}strokeContains(t,e,s){const{halfWidth:i,halfHeight:n}=this;if(i<=0||n<=0)return!1;const o=s/2,a=i-o,u=n-o,l=i+o,c=n+o,h=t-this.x,d=e-this.y,p=h*h/(a*a)+d*d/(u*u),f=h*h/(l*l)+d*d/(c*c);return p>1&&f<=1}getBounds(t){return t=t||new V,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}function as(r,t,e,s,i,n){const o=r-e,a=t-s,u=i-e,l=n-s,c=o*u+a*l,h=u*u+l*l;let d=-1;h!==0&&(d=c/h);let p,f;d<0?(p=e,f=s):d>1?(p=i,f=n):(p=e+d*u,f=s+d*l);const g=r-p,m=t-f;return g*g+m*m}class Er{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const s=[];for(let i=0,n=e.length;i<n;i++)s.push(e[i].x,e[i].y);e=s}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new Er(t);return e.closePath=this.closePath,e}contains(t,e){let s=!1;const i=this.points.length/2;for(let n=0,o=i-1;n<i;o=n++){const a=this.points[n*2],u=this.points[n*2+1],l=this.points[o*2],c=this.points[o*2+1];u>e!=c>e&&t<(l-a)*((e-u)/(c-u))+a&&(s=!s)}return s}strokeContains(t,e,s){const i=s/2,n=i*i,{points:o}=this,a=o.length-(this.closePath?0:2);for(let u=0;u<a;u+=2){const l=o[u],c=o[u+1],h=o[(u+2)%o.length],d=o[(u+3)%o.length];if(as(t,e,l,c,h,d)<=n)return!0}return!1}getBounds(t){t=t||new V;const e=this.points;let s=1/0,i=-1/0,n=1/0,o=-1/0;for(let a=0,u=e.length;a<u;a+=2){const l=e[a],c=e[a+1];s=l<s?l:s,i=l>i?l:i,n=c<n?c:n,o=c>o?c:o}return t.x=s,t.width=i-s,t.y=n,t.height=o-n,t}copyFrom(t){return this.points=t.points.slice(),this.closePath=t.closePath,this}copyTo(t){return t.copyFrom(this),t}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return this.points[this.points.length-2]}get y(){return this.points[this.points.length-1]}}const Oi=(r,t,e,s,i,n)=>{const o=r-e,a=t-s,u=Math.sqrt(o*o+a*a);return u>=i-n&&u<=i+n};class kn{constructor(t=0,e=0,s=0,i=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=s,this.height=i,this.radius=n}getBounds(t){return t=t||new V,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new kn(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const s=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+s&&e<=this.y+this.height-s||t>=this.x+s&&t<=this.x+this.width-s)return!0;let i=t-(this.x+s),n=e-(this.y+s);const o=s*s;if(i*i+n*n<=o||(i=t-(this.x+this.width-s),i*i+n*n<=o)||(n=e-(this.y+this.height-s),i*i+n*n<=o)||(i=t-(this.x+s),i*i+n*n<=o))return!0}return!1}strokeContains(t,e,s){const{x:i,y:n,width:o,height:a,radius:u}=this,l=s/2,c=i+u,h=n+u,d=o-u*2,p=a-u*2,f=i+o,g=n+a;return(t>=i-l&&t<=i+l||t>=f-l&&t<=f+l)&&e>=h&&e<=h+p||(e>=n-l&&e<=n+l||e>=g-l&&e<=g+l)&&t>=c&&t<=c+d?!0:t<c&&e<h&&Oi(t,e,c,h,u,l)||t>f-u&&e<h&&Oi(t,e,f-u,h,u,l)||t>f-u&&e>g-u&&Oi(t,e,f-u,g-u,u,l)||t<c&&e>g-u&&Oi(t,e,c,g-u,u,l)}}const Y1=8,Bi=11920929e-14,q1=1,xa=.01,dr=0,Ne=0;function ya(r,t,e,s,i,n,o,a,u,l){const c=Math.min(.99,Math.max(0,l!=null?l:Pi.defaultOptions.bezierSmoothness));let h=(q1-c)/1;return h*=h,K1(t,e,s,i,n,o,a,u,r,h),r}function K1(r,t,e,s,i,n,o,a,u,l){va(r,t,e,s,i,n,o,a,u,l,0),u.push(o,a)}function va(r,t,e,s,i,n,o,a,u,l,c){if(c>Y1)return;const h=Math.PI,d=(r+e)/2,p=(t+s)/2,f=(e+i)/2,g=(s+n)/2,m=(i+o)/2,_=(n+a)/2,x=(d+f)/2,b=(p+g)/2,v=(f+m)/2,A=(g+_)/2,C=(x+v)/2,w=(b+A)/2;if(c>0){let R=o-r,T=a-t;const S=Math.abs((e-o)*T-(s-a)*R),G=Math.abs((i-o)*T-(n-a)*R);let N,M;if(S>Bi&&G>Bi){if((S+G)*(S+G)<=l*(R*R+T*T)){if(dr<xa){u.push(C,w);return}const O=Math.atan2(n-s,i-e);if(N=Math.abs(O-Math.atan2(s-t,e-r)),M=Math.abs(Math.atan2(a-n,o-i)-O),N>=h&&(N=2*h-N),M>=h&&(M=2*h-M),N+M<dr){u.push(C,w);return}if(Ne!==0){if(N>Ne){u.push(e,s);return}if(M>Ne){u.push(i,n);return}}}}else if(S>Bi){if(S*S<=l*(R*R+T*T)){if(dr<xa){u.push(C,w);return}if(N=Math.abs(Math.atan2(n-s,i-e)-Math.atan2(s-t,e-r)),N>=h&&(N=2*h-N),N<dr){u.push(e,s),u.push(i,n);return}if(Ne!==0&&N>Ne){u.push(e,s);return}}}else if(G>Bi){if(G*G<=l*(R*R+T*T)){if(dr<xa){u.push(C,w);return}if(N=Math.abs(Math.atan2(a-n,o-i)-Math.atan2(n-s,i-e)),N>=h&&(N=2*h-N),N<dr){u.push(e,s),u.push(i,n);return}if(Ne!==0&&N>Ne){u.push(i,n);return}}}else if(R=C-(r+o)/2,T=w-(t+a)/2,R*R+T*T<=l){u.push(C,w);return}}va(r,t,d,p,x,b,C,w,u,l,c+1),va(C,w,v,A,m,_,o,a,u,l,c+1)}const Z1=8,Q1=11920929e-14,J1=1,tT=.01,uf=0;function lf(r,t,e,s,i,n,o,a){const u=Math.min(.99,Math.max(0,a!=null?a:Pi.defaultOptions.bezierSmoothness));let l=(J1-u)/1;return l*=l,eT(t,e,s,i,n,o,r,l),r}function eT(r,t,e,s,i,n,o,a){Ta(o,r,t,e,s,i,n,a,0),o.push(i,n)}function Ta(r,t,e,s,i,n,o,a,u){if(u>Z1)return;const l=Math.PI,c=(t+s)/2,h=(e+i)/2,d=(s+n)/2,p=(i+o)/2,f=(c+d)/2,g=(h+p)/2;let m=n-t,_=o-e;const x=Math.abs((s-n)*_-(i-o)*m);if(x>Q1){if(x*x<=a*(m*m+_*_)){if(uf<tT){r.push(f,g);return}let b=Math.abs(Math.atan2(o-i,n-s)-Math.atan2(i-e,s-t));if(b>=l&&(b=2*l-b),b<uf){r.push(f,g);return}}}else if(m=f-(t+n)/2,_=g-(e+o)/2,m*m+_*_<=a){r.push(f,g);return}Ta(r,t,e,c,h,f,g,a,u+1),Ta(r,f,g,d,p,n,o,a,u+1)}function Aa(r,t,e,s,i,n,o,a){let u=Math.abs(i-n);(!o&&i>n||o&&n>i)&&(u=2*Math.PI-u),a=a||Math.max(6,Math.floor(6*Math.pow(s,1/3)*(u/Math.PI))),a=Math.max(a,3);let l=u/a,c=i;l*=o?-1:1;for(let h=0;h<a+1;h++){const d=Math.cos(c),p=Math.sin(c),f=t+d*s,g=e+p*s;r.push(f,g),c+=l}}function cf(r,t,e,s,i,n){const o=r[r.length-2],a=r[r.length-1]-e,u=o-t,l=i-e,c=s-t,h=Math.abs(a*c-u*l);if(h<1e-8||n===0){(r[r.length-2]!==t||r[r.length-1]!==e)&&r.push(t,e);return}const d=a*a+u*u,p=l*l+c*c,f=a*l+u*c,g=n*Math.sqrt(d)/h,m=n*Math.sqrt(p)/h,_=g*f/d,x=m*f/p,b=g*c+m*u,v=g*l+m*a,A=u*(m+_),C=a*(m+_),w=c*(g+x),R=l*(g+x),T=Math.atan2(C-v,A-b),S=Math.atan2(R-v,w-b);Aa(r,b+t,v+e,n,T,S,u*l>c*a)}const us=Math.PI*2,Sa={centerX:0,centerY:0,ang1:0,ang2:0},Ea=({x:r,y:t},e,s,i,n,o,a,u)=>{r*=e,t*=s;const l=i*r-n*t,c=n*r+i*t;return u.x=l+o,u.y=c+a,u};function rT(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),s=t===1.5707963267948966?.551915024494:e,i=Math.cos(r),n=Math.sin(r),o=Math.cos(r+t),a=Math.sin(r+t);return[{x:i-n*s,y:n+i*s},{x:o+a*s,y:a-o*s},{x:o,y:a}]}const hf=(r,t,e,s)=>{const i=r*s-t*e<0?-1:1;let n=r*e+t*s;return n>1&&(n=1),n<-1&&(n=-1),i*Math.acos(n)},sT=(r,t,e,s,i,n,o,a,u,l,c,h,d)=>{const p=Math.pow(i,2),f=Math.pow(n,2),g=Math.pow(c,2),m=Math.pow(h,2);let _=p*f-p*m-f*g;_<0&&(_=0),_/=p*m+f*g,_=Math.sqrt(_)*(o===a?-1:1);const x=_*i/n*h,b=_*-n/i*c,v=l*x-u*b+(r+e)/2,A=u*x+l*b+(t+s)/2,C=(c-x)/i,w=(h-b)/n,R=(-c-x)/i,T=(-h-b)/n,S=hf(1,0,C,w);let G=hf(C,w,R,T);a===0&&G>0&&(G-=us),a===1&&G<0&&(G+=us),d.centerX=v,d.centerY=A,d.ang1=S,d.ang2=G};function df(r,t,e,s,i,n,o,a=0,u=0,l=0){if(n===0||o===0)return;const c=Math.sin(a*us/360),h=Math.cos(a*us/360),d=h*(t-s)/2+c*(e-i)/2,p=-c*(t-s)/2+h*(e-i)/2;if(d===0&&p===0)return;n=Math.abs(n),o=Math.abs(o);const f=Math.pow(d,2)/Math.pow(n,2)+Math.pow(p,2)/Math.pow(o,2);f>1&&(n*=Math.sqrt(f),o*=Math.sqrt(f)),sT(t,e,s,i,n,o,u,l,c,h,d,p,Sa);let{ang1:g,ang2:m}=Sa;const{centerX:_,centerY:x}=Sa;let b=Math.abs(m)/(us/4);Math.abs(1-b)<1e-7&&(b=1);const v=Math.max(Math.ceil(b),1);m/=v;let A=r[r.length-2],C=r[r.length-1];const w={x:0,y:0};for(let R=0;R<v;R++){const T=rT(g,m),{x:S,y:G}=Ea(T[0],n,o,h,c,_,x,w),{x:N,y:M}=Ea(T[1],n,o,h,c,_,x,w),{x:O,y:W}=Ea(T[2],n,o,h,c,_,x,w);ya(r,A,C,S,G,N,M,O,W),A=O,C=W,g+=m}}function pf(r,t,e){var s;const i=(a,u)=>{const l=u.x-a.x,c=u.y-a.y,h=Math.sqrt(l*l+c*c),d=l/h,p=c/h;return{len:h,nx:d,ny:p}},n=(a,u)=>{a===0?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y)};let o=t[t.length-1];for(let a=0;a<t.length;a++){const u=t[a%t.length],l=(s=u.radius)!=null?s:e;if(l<=0){n(a,u),o=u;continue}const c=t[(a+1)%t.length],h=i(u,o),d=i(u,c);if(h.len<1e-4||d.len<1e-4){n(a,u),o=u;continue}let p=Math.asin(h.nx*d.ny-h.ny*d.nx),f=1,g=!1;h.nx*d.nx-h.ny*-d.ny<0?p<0?p=Math.PI+p:(p=Math.PI-p,f=-1,g=!0):p>0&&(f=-1,g=!0);const m=p/2;let _,x=Math.abs(Math.cos(m)*l/Math.sin(m));x>Math.min(h.len/2,d.len/2)?(x=Math.min(h.len/2,d.len/2),_=Math.abs(x*Math.sin(m)/Math.cos(m))):_=l;const b=u.x+d.nx*x+-d.ny*_*f,v=u.y+d.ny*x+d.nx*_*f,A=Math.atan2(h.ny,h.nx)+Math.PI/2*f,C=Math.atan2(d.ny,d.nx)-Math.PI/2*f;a===0&&r.moveTo(b+Math.cos(A)*_,v+Math.sin(A)*_),r.arc(b,v,_,A,C,g),o=u}}function ff(r,t,e,s){var i;const n=(u,l)=>Math.sqrt((u.x-l.x)**2+(u.y-l.y)**2),o=(u,l,c)=>({x:u.x+(l.x-u.x)*c,y:u.y+(l.y-u.y)*c}),a=t.length;for(let u=0;u<a;u++){const l=t[(u+1)%a],c=(i=l.radius)!=null?i:e;if(c<=0){u===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}const h=t[u],d=t[(u+2)%a],p=n(h,l);let f;if(p<1e-4)f=l;else{const _=Math.min(p/2,c);f=o(l,h,_/p)}const g=n(d,l);let m;if(g<1e-4)m=l;else{const _=Math.min(g/2,c);m=o(l,d,_/g)}u===0?r.moveTo(f.x,f.y):r.lineTo(f.x,f.y),r.quadraticCurveTo(l.x,l.y,m.x,m.y,s)}}const iT=new V;class mf{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new pt,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const s=this._currentPoly.points,i=s[s.length-2],n=s[s.length-1];return(i!==t||n!==e)&&s.push(t,e),this}arc(t,e,s,i,n,o){this._ensurePoly(!1);const a=this._currentPoly.points;return Aa(a,t,e,s,i,n,o),this}arcTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly.points;return cf(o,t,e,s,i,n),this}arcToSvg(t,e,s,i,n,o,a){const u=this._currentPoly.points;return df(u,this._currentPoly.lastX,this._currentPoly.lastY,o,a,t,e,s,i,n),this}bezierCurveTo(t,e,s,i,n,o,a){this._ensurePoly();const u=this._currentPoly;return ya(this._currentPoly.points,u.lastX,u.lastY,t,e,s,i,n,o,a),this}quadraticCurveTo(t,e,s,i,n){this._ensurePoly();const o=this._currentPoly;return lf(this._currentPoly.points,o.lastX,o.lastY,t,e,s,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));for(let s=0;s<t.instructions.length;s++){const i=t.instructions[s];this[i.action](...i.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,s,i,n){return this.drawShape(new V(t,e,s,i),n),this}circle(t,e,s,i){return this.drawShape(new Fn(t,e,s),i),this}poly(t,e,s){const i=new Er(t);return i.closePath=e,this.drawShape(i,s),this}regularPoly(t,e,s,i,n=0,o){i=Math.max(i|0,3);const a=-1*Math.PI/2+n,u=Math.PI*2/i,l=[];for(let c=0;c<i;c++){const h=c*u+a;l.push(t+s*Math.cos(h),e+s*Math.sin(h))}return this.poly(l,!0,o),this}roundPoly(t,e,s,i,n,o=0,a){if(i=Math.max(i|0,3),n<=0)return this.regularPoly(t,e,s,i,o);const u=s*Math.sin(Math.PI/i)-.001;n=Math.min(n,u);const l=-1*Math.PI/2+o,c=Math.PI*2/i,h=(i-2)*Math.PI/i/2;for(let d=0;d<i;d++){const p=d*c+l,f=t+s*Math.cos(p),g=e+s*Math.sin(p),m=p+Math.PI+h,_=p-Math.PI-h,x=f+n*Math.cos(m),b=g+n*Math.sin(m),v=f+n*Math.cos(_),A=g+n*Math.sin(_);d===0?this.moveTo(x,b):this.lineTo(x,b),this.quadraticCurveTo(f,g,v,A,a)}return this.closePath()}roundShape(t,e,s=!1,i){return t.length<3?this:(s?ff(this,t,e,i):pf(this,t,e),this.closePath())}filletRect(t,e,s,i,n){if(n===0)return this.rect(t,e,s,i);const o=Math.min(s,i)/2,a=Math.min(o,Math.max(-o,n)),u=t+s,l=e+i,c=a<0?-a:0,h=Math.abs(a);return this.moveTo(t,e+h).arcTo(t+c,e+c,t+h,e,h).lineTo(u-h,e).arcTo(u-c,e+c,u,e+h,h).lineTo(u,l-h).arcTo(u-c,l-c,t+s-h,l,h).lineTo(t+h,l).arcTo(t+c,l-c,t,l-h,h).closePath()}chamferRect(t,e,s,i,n,o){if(n<=0)return this.rect(t,e,s,i);const a=Math.min(n,Math.min(s,i)/2),u=t+s,l=e+i,c=[t+a,e,u-a,e,u,e+a,u,l-a,u-a,l,t+a,l,t,l-a,t,e+a];for(let h=c.length-1;h>=2;h-=2)c[h]===c[h-2]&&c[h-1]===c[h-3]&&c.splice(h-1,2);return this.poly(c,!0,o)}ellipse(t,e,s,i,n){return this.drawShape(new Un(t,e,s,i),n),this}roundRect(t,e,s,i,n,o){return this.drawShape(new kn(t,e,s,i,n),o),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let s=this._currentPoly;return s&&this.endPoly(),s=new Er,s.points.push(t,e),this._currentPoly=s,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new Er,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let s=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,o=s;s=n.a*s+n.c*i+n.tx,i=n.b*o+n.d*i+n.ty}this._currentPoly.points.push(s,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const s=t.instructions[e];this[s.action](...s.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let s=0;s<e.length;s++){const i=e[s],n=i.shape.getBounds(iT);i.transform?t.addRect(n,i.transform):t.addRect(n)}return t}}class Te{constructor(t){this.instructions=[],this.uid=Q("graphicsPath"),this._dirty=!0;var e;typeof t=="string"?af(t,this):this.instructions=(e=t==null?void 0:t.slice())!=null?e:[]}get shapePath(){return this._shapePath||(this._shapePath=new mf(this)),this._dirty&&(this._dirty=!1,this._shapePath.buildPath()),this._shapePath}addPath(t,e){return t=t.clone(),this.instructions.push({action:"addPath",data:[t,e]}),this._dirty=!0,this}arc(...t){return this.instructions.push({action:"arc",data:t}),this._dirty=!0,this}arcTo(...t){return this.instructions.push({action:"arcTo",data:t}),this._dirty=!0,this}arcToSvg(...t){return this.instructions.push({action:"arcToSvg",data:t}),this._dirty=!0,this}bezierCurveTo(...t){return this.instructions.push({action:"bezierCurveTo",data:t}),this._dirty=!0,this}bezierCurveToShort(t,e,s,i,n){const o=this.instructions[this.instructions.length-1],a=this.getLastPoint(nt.shared);let u=0,l=0;if(!o||o.action!=="bezierCurveTo")u=a.x,l=a.y;else{u=o.data[2],l=o.data[3];const c=a.x,h=a.y;u=c+(c-u),l=h+(h-l)}return this.instructions.push({action:"bezierCurveTo",data:[u,l,t,e,s,i,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,s){const i=this.instructions[this.instructions.length-1],n=this.getLastPoint(nt.shared);let o=0,a=0;if(!i||i.action!=="quadraticCurveTo")o=n.x,a=n.y;else{o=i.data[0],a=i.data[1];const u=n.x,l=n.y;o=u+(u-o),a=l+(l-a)}return this.instructions.push({action:"quadraticCurveTo",data:[o,a,t,e,s]}),this._dirty=!0,this}rect(t,e,s,i,n){return this.instructions.push({action:"rect",data:[t,e,s,i,n]}),this._dirty=!0,this}circle(t,e,s,i){return this.instructions.push({action:"circle",data:[t,e,s,i]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,s,i,n,o,a){n=n||i/2;const u=-1*Math.PI/2+o,l=s*2,c=Math.PI*2/l,h=[];for(let d=0;d<l;d++){const p=d%2?n:i,f=d*c+u;h.push(t+p*Math.cos(f),e+p*Math.sin(f))}return this.poly(h,!0,a),this}clone(t=!1){const e=new Te;if(!t)e.instructions=this.instructions.slice();else for(let s=0;s<this.instructions.length;s++){const i=this.instructions[s];e.instructions.push({action:i.action,data:i.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,s=t.b,i=t.c,n=t.d,o=t.tx,a=t.ty;let u=0,l=0,c=0,h=0,d=0,p=0,f=0,g=0;for(let m=0;m<this.instructions.length;m++){const _=this.instructions[m],x=_.data;switch(_.action){case"moveTo":case"lineTo":u=x[0],l=x[1],x[0]=e*u+i*l+o,x[1]=s*u+n*l+a;break;case"bezierCurveTo":c=x[0],h=x[1],d=x[2],p=x[3],u=x[4],l=x[5],x[0]=e*c+i*h+o,x[1]=s*c+n*h+a,x[2]=e*d+i*p+o,x[3]=s*d+n*p+a,x[4]=e*u+i*l+o,x[5]=s*u+n*l+a;break;case"quadraticCurveTo":c=x[0],h=x[1],u=x[2],l=x[3],x[0]=e*c+i*h+o,x[1]=s*c+n*h+a,x[2]=e*u+i*l+o,x[3]=s*u+n*l+a;break;case"arcToSvg":u=x[5],l=x[6],f=x[0],g=x[1],x[0]=e*f+i*g,x[1]=s*f+n*g,x[5]=e*u+i*l+o,x[6]=s*u+n*l+a;break;case"circle":x[4]=ls(x[3],t);break;case"rect":x[4]=ls(x[4],t);break;case"ellipse":x[8]=ls(x[8],t);break;case"roundRect":x[5]=ls(x[5],t);break;case"addPath":x[0].transform(t);break;case"poly":x[2]=ls(x[2],t);break;default:break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,s=this.instructions[e];if(!s)return t.x=0,t.y=0,t;for(;s.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;s=this.instructions[e]}switch(s.action){case"moveTo":case"lineTo":t.x=s.data[0],t.y=s.data[1];break;case"quadraticCurveTo":t.x=s.data[2],t.y=s.data[3];break;case"bezierCurveTo":t.x=s.data[4],t.y=s.data[5];break;case"arc":case"arcToSvg":t.x=s.data[5],t.y=s.data[6];break;case"addPath":s.data[0].getLastPoint(t);break}return t}}function ls(r,t){return r?r.prepend(t):t.clone()}var nT=Object.defineProperty,gf=Object.getOwnPropertySymbols,oT=Object.prototype.hasOwnProperty,aT=Object.prototype.propertyIsEnumerable,_f=(r,t,e)=>t in r?nT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gi=(r,t)=>{for(var e in t||(t={}))oT.call(t,e)&&_f(r,e,t[e]);if(gf)for(var e of gf(t))aT.call(t,e)&&_f(r,e,t[e]);return r};function bf(r,t){if(typeof r=="string"){const s=document.createElement("div");s.innerHTML=r.trim(),r=s.querySelector("svg")}const e={context:t,path:new Te};return xf(r,e,null,null),t}function xf(r,t,e,s){const i=r.children,{fillStyle:n,strokeStyle:o}=uT(r);n&&e?e=Gi(Gi({},e),n):n&&(e=n),o&&s?s=Gi(Gi({},s),o):o&&(s=o),t.context.fillStyle=e,t.context.strokeStyle=s;let a,u,l,c,h,d,p,f,g,m,_,x,b,v,A,C,w;switch(r.nodeName.toLowerCase()){case"path":v=r.getAttribute("d"),A=new Te(v),t.context.path(A),e&&t.context.fill(),s&&t.context.stroke();break;case"circle":p=ct(r,"cx",0),f=ct(r,"cy",0),g=ct(r,"r",0),t.context.ellipse(p,f,g,g),e&&t.context.fill(),s&&t.context.stroke();break;case"rect":a=ct(r,"x",0),u=ct(r,"y",0),C=ct(r,"width",0),w=ct(r,"height",0),m=ct(r,"rx",0),_=ct(r,"ry",0),m||_?t.context.roundRect(a,u,C,w,m||_):t.context.rect(a,u,C,w),e&&t.context.fill(),s&&t.context.stroke();break;case"ellipse":p=ct(r,"cx",0),f=ct(r,"cy",0),m=ct(r,"rx",0),_=ct(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,f,m,_),e&&t.context.fill(),s&&t.context.stroke();break;case"line":l=ct(r,"x1",0),c=ct(r,"y1",0),h=ct(r,"x2",0),d=ct(r,"y2",0),t.context.beginPath(),t.context.moveTo(l,c),t.context.lineTo(h,d),s&&t.context.stroke();break;case"polygon":b=r.getAttribute("points"),x=b.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(x,!0),e&&t.context.fill(),s&&t.context.stroke();break;case"polyline":b=r.getAttribute("points"),x=b.match(/\d+/g).map(R=>parseInt(R,10)),t.context.poly(x,!1),s&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}for(let R=0;R<i.length;R++)xf(i[R],t,e,s)}function ct(r,t,e){const s=r.getAttribute(t);return s?Number(s):e}function uT(r){const t=r.getAttribute("style"),e={},s={};let i=!1,n=!1;if(t){const o=t.split(";");for(let a=0;a<o.length;a++){const u=o[a],[l,c]=u.split(":");switch(l){case"stroke":c!=="none"&&(e.color=j.shared.setValue(c).toNumber(),n=!0);break;case"stroke-width":e.width=Number(c);break;case"fill":c!=="none"&&(i=!0,s.color=j.shared.setValue(c).toNumber());break;case"fill-opacity":s.alpha=Number(c);break;case"stroke-opacity":e.alpha=Number(c);break;case"opacity":s.alpha=Number(c),e.alpha=Number(c);break}}}else{const o=r.getAttribute("stroke");o&&o!=="none"&&(n=!0,e.color=j.shared.setValue(o).toNumber(),e.width=ct(r,"stroke-width",1));const a=r.getAttribute("fill");a&&a!=="none"&&(i=!0,s.color=j.shared.setValue(a).toNumber())}return{strokeStyle:n?e:null,fillStyle:i?s:null}}var lT=Object.defineProperty,Ii=Object.getOwnPropertySymbols,yf=Object.prototype.hasOwnProperty,vf=Object.prototype.propertyIsEnumerable,Tf=(r,t,e)=>t in r?lT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ae=(r,t)=>{for(var e in t||(t={}))yf.call(t,e)&&Tf(r,e,t[e]);if(Ii)for(var e of Ii(t))vf.call(t,e)&&Tf(r,e,t[e]);return r},cT=(r,t)=>{var e={};for(var s in r)yf.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Ii)for(var s of Ii(r))t.indexOf(s)<0&&vf.call(r,s)&&(e[s]=r[s]);return e};function hT(r){return j.isColorLike(r)}function Af(r){return r instanceof os}function Sf(r){return r instanceof hr}function dT(r,t,e){const s=j.shared.setValue(t!=null?t:0);return r.color=s.toNumber(),r.alpha=s.alpha===1?e.alpha:s.alpha,r.texture=E.WHITE,ae(ae({},e),r)}function Ef(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,ae(ae({},e),r)}function wf(r,t,e){return t.buildLinearGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,ae(ae({},e),r)}function pT(r,t){var e;const s=ae(ae({},t),r);if(s.texture){if(s.texture!==E.WHITE){const o=((e=s.matrix)==null?void 0:e.invert())||new B;o.translate(s.texture.frame.x,s.texture.frame.y),o.scale(1/s.texture.source.width,1/s.texture.source.height),s.matrix=o}const n=s.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}const i=j.shared.setValue(s.color);return s.alpha*=i.alpha,s.color=i.toNumber(),s.matrix=s.matrix?s.matrix.clone():null,s}function fe(r,t){if(r==null)return null;const e={},s=r;return hT(r)?dT(e,r,t):Af(r)?Ef(e,r,t):Sf(r)?wf(e,r,t):s.fill&&Af(s.fill)?Ef(s,s.fill,t):s.fill&&Sf(s.fill)?wf(s,s.fill,t):pT(s,t)}function cs(r,t){const e=t,{width:s,alignment:i,miterLimit:n,cap:o,join:a}=e,u=cT(e,["width","alignment","miterLimit","cap","join"]),l=fe(r,u);return l?ae({width:s,alignment:i,miterLimit:n,cap:o,join:a},l):null}var fT=Object.defineProperty,Cf=Object.getOwnPropertySymbols,mT=Object.prototype.hasOwnProperty,gT=Object.prototype.propertyIsEnumerable,Rf=(r,t,e)=>t in r?fT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pr=(r,t)=>{for(var e in t||(t={}))mT.call(t,e)&&Rf(r,e,t[e]);if(Cf)for(var e of Cf(t))gT.call(t,e)&&Rf(r,e,t[e]);return r};const _T=new nt,Pf=new B,wa=class Qt extends Ct{constructor(){super(...arguments),this.uid=Q("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new Te,this._transform=new B,this._fillStyle=pr({},Qt.defaultFillStyle),this._strokeStyle=pr({},Qt.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new pt,this._boundsDirty=!0}clone(){const t=new Qt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=pr({},this._fillStyle),t._strokeStyle=pr({},this._strokeStyle),t._stateStack=this._stateStack.slice(),t._bounds=this._bounds.clone(),t._boundsDirty=!0,t}get fillStyle(){return this._fillStyle}set fillStyle(t){this._fillStyle=fe(t,Qt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=cs(t,Qt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=fe(t,Qt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=fe(t,Qt.defaultStrokeStyle),this}texture(t,e,s,i,n,o){return this.instructions.push({action:"texture",data:{image:t,dx:s||0,dy:i||0,dw:n||t.frame.width,dh:o||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?j.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new Te,this}fill(t,e){let s;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="stroke"?s=i.data.path:s=this._activePath.clone(),s?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=fe(t,Qt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:s}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(nt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="fill"?e=s.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=cs(t,Qt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],s=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(s);else{e.data.hole=s;break}}return this._initNextPathLocation(),this}arc(t,e,s,i,n,o){this._tick++;const a=this._transform;return this._activePath.arc(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,s,i,n,o),this}arcTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.arcTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}arcToSvg(t,e,s,i,n,o,a){this._tick++;const u=this._transform;return this._activePath.arcToSvg(t,e,s,i,n,u.a*o+u.c*a+u.tx,u.b*o+u.d*a+u.ty),this}bezierCurveTo(t,e,s,i,n,o,a){this._tick++;const u=this._transform;return this._activePath.bezierCurveTo(u.a*t+u.c*e+u.tx,u.b*t+u.d*e+u.ty,u.a*s+u.c*i+u.tx,u.b*s+u.d*i+u.ty,u.a*n+u.c*o+u.tx,u.b*n+u.d*o+u.ty,a),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,s,i){return this._tick++,this._activePath.ellipse(t,e,s,i,this._transform.clone()),this}circle(t,e,s){return this._tick++,this._activePath.circle(t,e,s,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const s=this._transform;return this._activePath.lineTo(s.a*t+s.c*e+s.tx,s.b*t+s.d*e+s.ty),this}moveTo(t,e){this._tick++;const s=this._transform,i=this._activePath.instructions,n=s.a*t+s.c*e+s.tx,o=s.b*t+s.d*e+s.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=n,i[0].data[1]=o,this):(this._activePath.moveTo(n,o),this)}quadraticCurveTo(t,e,s,i,n){this._tick++;const o=this._transform;return this._activePath.quadraticCurveTo(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,o.a*s+o.c*i+o.tx,o.b*s+o.d*i+o.ty,n),this}rect(t,e,s,i){return this._tick++,this._activePath.rect(t,e,s,i,this._transform.clone()),this}roundRect(t,e,s,i,n){return this._tick++,this._activePath.roundRect(t,e,s,i,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,s,i,n=0,o){return this._tick++,this._activePath.regularPoly(t,e,s,i,n,o),this}roundPoly(t,e,s,i,n,o){return this._tick++,this._activePath.roundPoly(t,e,s,i,n,o),this}roundShape(t,e,s,i){return this._tick++,this._activePath.roundShape(t,e,s,i),this}filletRect(t,e,s,i,n){return this._tick++,this._activePath.filletRect(t,e,s,i,n),this}chamferRect(t,e,s,i,n,o){return this._tick++,this._activePath.chamferRect(t,e,s,i,n,o),this}star(t,e,s,i,n=0,o=0){return this._tick++,this._activePath.star(t,e,s,i,n,o,this._transform.clone()),this}svg(t){return this._tick++,bf(t,this),this}restore(){const t=this._stateStack.pop();return t&&(this._transform=t.transform,this._fillStyle=t.fillStyle,this._strokeStyle=t.strokeStyle),this}save(){return this._stateStack.push({transform:this._transform.clone(),fillStyle:pr({},this._fillStyle),strokeStyle:pr({},this._strokeStyle)}),this}getTransform(){return this._transform}resetTransform(){return this._transform.identity(),this}rotate(t){return this._transform.rotate(t),this}scale(t,e=t){return this._transform.scale(t,e),this}setTransform(t,e,s,i,n,o){return t instanceof B?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,s,i,n,o),this)}transform(t,e,s,i,n,o){return t instanceof B?(this._transform.append(t),this):(Pf.set(t,e,s,i,n,o),this._transform.append(Pf),this)}translate(t,e=t){return this._transform.translate(t,e),this}clear(){return this._activePath.clear(),this.instructions.length=0,this.resetTransform(),this.onUpdate(),this}onUpdate(){this.dirty||(this.emit("update",this,16),this.dirty=!0,this._boundsDirty=!0)}get bounds(){if(!this._boundsDirty)return this._bounds;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const s=this.instructions[e],i=s.action;if(i==="fill"){const n=s.data;t.addBounds(n.path.bounds)}else if(i==="texture"){const n=s.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(i==="stroke"){const n=s.data,o=n.style.width/2,a=n.path.bounds;t.addFrame(a.minX-o,a.minY-o,a.maxX+o,a.maxY+o)}}return t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const s=this.instructions;let i=!1;for(let n=0;n<s.length;n++){const o=s[n],a=o.data,u=a.path;if(!o.action||!u)continue;const l=a.style,c=u.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const d=c[h].shape;if(!l||!d)continue;const p=c[h].transform,f=p?p.applyInverse(t,_T):t;o.action==="fill"?i=d.contains(f.x,f.y):i=d.strokeContains(f.x,f.y,l.width);const g=a.hole;if(g){const m=(e=g.shapePath)==null?void 0:e.shapePrimitives;if(m)for(let _=0;_<m.length;_++)m[_].shape.contains(f.x,f.y)&&(i=!1)}if(i)return!0}}return i}destroy(t=!1){if(this._stateStack.length=0,this._transform=null,this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&this._fillStyle.texture.destroy(e),this._strokeStyle.texture&&this._strokeStyle.texture.destroy(e)}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};wa.defaultFillStyle={color:16777215,alpha:1,texture:E.WHITE,matrix:null,fill:null},wa.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:E.WHITE,matrix:null,fill:null};let gt=wa;const Df=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function Ca(r){const t=[];let e=0;for(let s=0;s<Df.length;s++){const i=`_${Df[s]}`;t[e++]=r[i]}return e=Mf(r._fill,t,e),e=bT(r._stroke,t,e),e=xT(r.dropShadow,t,e),t.join("-")}function Mf(r,t,e){var s;return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=(s=r.fill)==null?void 0:s.styleKey),e}function bT(r,t,e){return r&&(e=Mf(r,t,e),t[e++]=r.width,t[e++]=r.alignment,t[e++]=r.cap,t[e++]=r.join,t[e++]=r.miterLimit),e}function xT(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=j.shared.setValue(r.color).toNumber()),e}var yT=Object.defineProperty,vT=Object.defineProperties,TT=Object.getOwnPropertyDescriptors,Of=Object.getOwnPropertySymbols,AT=Object.prototype.hasOwnProperty,ST=Object.prototype.propertyIsEnumerable,Bf=(r,t,e)=>t in r?yT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pt=(r,t)=>{for(var e in t||(t={}))AT.call(t,e)&&Bf(r,e,t[e]);if(Of)for(var e of Of(t))ST.call(t,e)&&Bf(r,e,t[e]);return r},ET=(r,t)=>vT(r,TT(t));const Ra=class Sr extends Ct{constructor(t={}){super(),wT(t);const e=Pt(Pt({},Sr.defaultTextStyle),t);for(const s in e){const i=s;this[i]=e[s]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(Pt(Pt({},Sr.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(Pt({},Sr.defaultDropShadow)):null,this.update()}get fontFamily(){return this._fontFamily}set fontFamily(t){this._fontFamily=t,this.update()}get fontSize(){return this._fontSize}set fontSize(t){typeof t=="string"?this._fontSize=parseInt(t,10):this._fontSize=t,this.update()}get fontStyle(){return this._fontStyle}set fontStyle(t){this._fontStyle=t,this.update()}get fontVariant(){return this._fontVariant}set fontVariant(t){this._fontVariant=t,this.update()}get fontWeight(){return this._fontWeight}set fontWeight(t){this._fontWeight=t,this.update()}get leading(){return this._leading}set leading(t){this._leading=t,this.update()}get letterSpacing(){return this._letterSpacing}set letterSpacing(t){this._letterSpacing=t,this.update()}get lineHeight(){return this._lineHeight}set lineHeight(t){this._lineHeight=t,this.update()}get padding(){return this._padding}set padding(t){this._padding=t,this.update()}get trim(){return this._trim}set trim(t){this._trim=t,this.update()}get textBaseline(){return this._textBaseline}set textBaseline(t){this._textBaseline=t,this.update()}get whiteSpace(){return this._whiteSpace}set whiteSpace(t){this._whiteSpace=t,this.update()}get wordWrap(){return this._wordWrap}set wordWrap(t){this._wordWrap=t,this.update()}get wordWrapWidth(){return this._wordWrapWidth}set wordWrapWidth(t){this._wordWrapWidth=t,this.update()}get fill(){return this._originalFill}set fill(t){t!==this._originalFill&&(this._originalFill=t,this._isFillStyle(t)&&(this._originalFill=this._createProxy(Pt(Pt({},gt.defaultFillStyle),t),()=>{this._fill=fe(Pt({},this._originalFill),gt.defaultFillStyle)})),this._fill=fe(t===0?"black":t,gt.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(Pt(Pt({},gt.defaultStrokeStyle),t),()=>{this._stroke=cs(Pt({},this._originalStroke),gt.defaultStrokeStyle)})),this._stroke=cs(t,gt.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Ca(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=Sr.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Sr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?Pt({},this._dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var e,s,i,n;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const o=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(o),(s=this._originalFill)!=null&&s.texture&&this._originalFill.texture.destroy(o),(i=this._stroke)!=null&&i.texture&&this._stroke.texture.destroy(o),(n=this._originalStroke)!=null&&n.texture&&this._originalStroke.texture.destroy(o)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(s,i,n)=>(s[i]=n,e==null||e(i,n),this.update(),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(j.isColorLike(t)||t instanceof hr||t instanceof os)}};Ra.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Ra.defaultTextStyle={align:"left",breakWords:!1,dropShadow:null,fill:"black",fontFamily:"Arial",fontSize:26,fontStyle:"normal",fontVariant:"normal",fontWeight:"normal",leading:0,letterSpacing:0,lineHeight:0,padding:0,stroke:null,textBaseline:"alphabetic",trim:!1,whiteSpace:"pre",wordWrap:!1,wordWrapWidth:100};let Dt=Ra;function wT(r){var t,e,s,i,n;const o=r;if(typeof o.dropShadow=="boolean"&&o.dropShadow){const a=Dt.defaultDropShadow;r.dropShadow={alpha:(t=o.dropShadowAlpha)!=null?t:a.alpha,angle:(e=o.dropShadowAngle)!=null?e:a.angle,blur:(s=o.dropShadowBlur)!=null?s:a.blur,color:(i=o.dropShadowColor)!=null?i:a.color,distance:(n=o.dropShadowDistance)!=null?n:a.distance}}if(o.strokeThickness!==void 0){const a=o.stroke;let u={};if(j.isColorLike(a))u.color=a;else if(a instanceof hr||a instanceof os)u.fill=a;else if(Object.hasOwnProperty.call(a,"color")||Object.hasOwnProperty.call(a,"fill"))u=a;else throw new Error("Invalid stroke value.");r.stroke=ET(Pt({},u),{width:o.strokeThickness})}if(Array.isArray(o.fillGradientStops)){let a;r.fontSize==null?r.fontSize=Dt.defaultTextStyle.fontSize:typeof r.fontSize=="string"?a=parseInt(r.fontSize,10):a=r.fontSize;const u=new hr(0,0,0,a*1.7),l=o.fillGradientStops.map(c=>j.shared.setValue(c).toNumber());l.forEach((c,h)=>{const d=h/(l.length-1);u.addColorStop(d,c)}),r.fill={fill:u}}}const CT=new pt;function Pa(r,t,e,s){const i=CT;i.minX=0,i.minY=0,i.maxX=r.width/s|0,i.maxY=r.height/s|0;const n=dt.getOptimalTexture(i.width,i.height,s,!1);return n.source.uploadMethodId="image",n.source.resource=r,n.source.alphaMode="premultiply-alpha-on-upload",n.frame.width=t/s,n.frame.height=e/s,n.source.emit("update",n.source),n.updateUvs(),n}const RT=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function hs(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let s=e.length-1;s>=0;s--){let i=e[s].trim();!/([\"\'])[^\'\"]+\1/.test(i)&&!RT.includes(i)&&(i=`"${i}"`),e[s]=i}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const Da={willReadFrequently:!0},$t=class P{static get experimentalLetterSpacingSupported(){let t=P._experimentalLetterSpacingSupported;if(t!==void 0){const e=L.get().getCanvasRenderingContext2D().prototype;t=P._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,s,i,n,o,a,u,l){this.text=t,this.style=e,this.width=s,this.height=i,this.lines=n,this.lineWidths=o,this.lineHeight=a,this.maxLineWidth=u,this.fontProperties=l}static measureText(t=" ",e,s=P._canvas,i=e.wordWrap){var n;const o=`${t}:${e.styleKey}`;if(P._measurementCache[o])return P._measurementCache[o];const a=hs(e),u=P.measureFont(a);u.fontSize===0&&(u.fontSize=e.fontSize,u.ascent=e.fontSize);const l=P.__context;l.font=a;const c=(i?P._wordWrap(t,e,s):t).split(/(?:\r\n|\r|\n)/),h=new Array(c.length);let d=0;for(let _=0;_<c.length;_++){const x=P._measureText(c[_],e.letterSpacing,l);h[_]=x,d=Math.max(d,x)}const p=((n=e._stroke)==null?void 0:n.width)||0;let f=d+p;e.dropShadow&&(f+=e.dropShadow.distance);const g=e.lineHeight||u.fontSize;let m=Math.max(g,u.fontSize+p)+(c.length-1)*(g+e.leading);return e.dropShadow&&(m+=e.dropShadow.distance),new P(t,e,f,m,c,h,g+e.leading,d,u)}static _measureText(t,e,s){let i=!1;P.experimentalLetterSpacingSupported&&(P.experimentalLetterSpacing?(s.letterSpacing=`${e}px`,s.textLetterSpacing=`${e}px`,i=!0):(s.letterSpacing="0px",s.textLetterSpacing="0px"));let n=s.measureText(t).width;return n>0&&(i?n-=e:n+=(P.graphemeSegmenter(t).length-1)*e),n}static _wordWrap(t,e,s=P._canvas){const i=s.getContext("2d",Da);let n=0,o="",a="";const u=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,h=P._collapseSpaces(c),d=P._collapseNewlines(c);let p=!h;const f=e.wordWrapWidth+l,g=P._tokenize(t);for(let m=0;m<g.length;m++){let _=g[m];if(P._isNewline(_)){if(!d){a+=P._addLine(o),p=!h,o="",n=0;continue}_=" "}if(h){const b=P.isBreakingSpace(_),v=P.isBreakingSpace(o[o.length-1]);if(b&&v)continue}const x=P._getFromCache(_,l,u,i);if(x>f)if(o!==""&&(a+=P._addLine(o),o="",n=0),P.canBreakWords(_,e.breakWords)){const b=P.wordWrapSplit(_);for(let v=0;v<b.length;v++){let A=b[v],C=A,w=1;for(;b[v+w];){const T=b[v+w];if(!P.canBreakChars(C,T,_,v,e.breakWords))A+=T;else break;C=T,w++}v+=w-1;const R=P._getFromCache(A,l,u,i);R+n>f&&(a+=P._addLine(o),p=!1,o="",n=0),o+=A,n+=R}}else{o.length>0&&(a+=P._addLine(o),o="",n=0);const b=m===g.length-1;a+=P._addLine(_,!b),p=!1,o="",n=0}else x+n>f&&(p=!1,a+=P._addLine(o),o="",n=0),(o.length>0||!P.isBreakingSpace(_)||p)&&(o+=_,n+=x)}return a+=P._addLine(o,!1),a}static _addLine(t,e=!0){return t=P._trimRight(t),t=e?`${t}
`:t,t}static _getFromCache(t,e,s,i){let n=s[t];return typeof n!="number"&&(n=P._measureText(t,e,i)+e,s[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const s=t[e];if(!P.isBreakingSpace(s))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:P._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:P._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let s="";if(typeof t!="string")return e;for(let i=0;i<t.length;i++){const n=t[i],o=t[i+1];if(P.isBreakingSpace(n,o)||P._isNewline(n)){s!==""&&(e.push(s),s=""),e.push(n);continue}s+=n}return s!==""&&e.push(s),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,s,i,n){return!0}static wordWrapSplit(t){return P.graphemeSegmenter(t)}static measureFont(t){if(P._fonts[t])return P._fonts[t];const e=P._context;e.font=t;const s=e.measureText(P.METRICS_STRING+P.BASELINE_SYMBOL),i={ascent:s.actualBoundingBoxAscent,descent:s.actualBoundingBoxDescent,fontSize:s.actualBoundingBoxAscent+s.actualBoundingBoxDescent};return P._fonts[t]=i,i}static clearMetrics(t=""){t?delete P._fonts[t]:P._fonts={}}static get _canvas(){if(!P.__canvas){let t;try{const e=new OffscreenCanvas(0,0),s=e.getContext("2d",Da);if(s!=null&&s.measureText)return P.__canvas=e,e;t=L.get().createCanvas()}catch(e){t=L.get().createCanvas()}t.width=t.height=10,P.__canvas=t}return P.__canvas}static get _context(){return P.__context||(P.__context=P._canvas.getContext("2d",Da)),P.__context}};$t.METRICS_STRING="|\xC9q\xC5",$t.BASELINE_SYMBOL="M",$t.BASELINE_MULTIPLIER=1.4,$t.HEIGHT_MULTIPLIER=2,$t.graphemeSegmenter=(()=>{if(typeof(Intl==null?void 0:Intl.Segmenter)=="function"){const r=new Intl.Segmenter;return t=>[...r.segment(t)].map(e=>e.segment)}return r=>[...r]})(),$t.experimentalLetterSpacing=!1,$t._fonts={},$t._newlines=[10,13],$t._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],$t._measurementCache={};let Ht=$t;function ds(r,t){var e;if(r.texture===E.WHITE&&!r.fill)return j.shared.setValue(r.color).setAlpha((e=r.alpha)!=null?e:1).toHexa();if(r.fill){if(r.fill instanceof os){const s=r.fill,i=t.createPattern(s.texture.source.resource,"repeat"),n=s.transform.copyTo(B.shared);return n.scale(s.texture.frame.width,s.texture.frame.height),i.setTransform(n),i}else if(r.fill instanceof hr){const s=r.fill;if(s.type==="linear"){const i=t.createLinearGradient(s.x0,s.y0,s.x1,s.y1);return s.gradientStops.forEach(n=>{i.addColorStop(n.offset,j.shared.setValue(n.color).toHex())}),i}}}else{const s=t.createPattern(r.texture.source.resource,"repeat"),i=r.matrix.copyTo(B.shared);return i.scale(r.texture.frame.width,r.texture.frame.height),s.setTransform(i),s}return"red"}class Ma{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,s){const i=Ht.measureText(t||" ",s);let n=Math.ceil(Math.ceil(Math.max(1,i.width)+s.padding*2)*e),o=Math.ceil(Math.ceil(Math.max(1,i.height)+s.padding*2)*e);return n=Math.ceil(n-1e-6),o=Math.ceil(o-1e-6),n=Oe(n),o=Oe(o),{width:n,height:o}}getTexture(t,e,s,i){typeof t=="string"&&(Ko("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:s,resolution:e}),t.style instanceof Dt||(t.style=new Dt(t.style));const{texture:n,canvasAndContext:o}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Zt.returnCanvasAndContext(o),n}createTextureAndCanvas(t){var e;const{text:s,style:i}=t,n=(e=t.resolution)!=null?e:this._renderer.resolution,o=Ht.measureText(s||" ",i),a=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*n),u=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*n),l=Zt.getOptimalCanvasAndContext(a,u),{canvas:c}=l;this.renderTextToCanvas(s,i,n,l);const h=Pa(c,a,u,n);if(i.trim){const d=sf(c,n);h.frame.copyFrom(d),h.updateUvs()}return{texture:h,canvasAndContext:l}}getManagedTexture(t){t._resolution=t._autoResolution?this._renderer.resolution:t.resolution;const e=t._getKey();if(this._activeTextures[e])return this._increaseReferenceCount(e),this._activeTextures[e].texture;const{texture:s,canvasAndContext:i}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:i,texture:s,usageCount:1},s}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Zt.returnCanvasAndContext(e.canvasAndContext),dt.returnTexture(e.texture);const s=e.texture.source;s.resource=null,s.uploadMethodId="unknown",s.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,s,i){var n,o,a,u,l,c,h;const{canvas:d,context:p}=i,f=hs(e),g=Ht.measureText(t||" ",e),m=g.lines,_=g.lineHeight,x=g.lineWidths,b=g.maxLineWidth,v=g.fontProperties,A=d.height;p.resetTransform(),p.scale(s,s);const C=e.padding*2;if(p.clearRect(0,0,g.width+4+C,g.height+4+C),(n=e._stroke)!=null&&n.width){const S=e._stroke;p.lineWidth=S.width,p.miterLimit=S.miterLimit,p.lineJoin=S.join,p.lineCap=S.cap}p.font=f;let w,R;const T=e.dropShadow?2:1;for(let S=0;S<T;++S){const G=e.dropShadow&&S===0,N=G?Math.ceil(Math.max(1,A)+e.padding*2):0,M=N*s;if(G){p.fillStyle="black",p.strokeStyle="black";const D=e.dropShadow,K=D.color,Xe=D.alpha;p.shadowColor=j.shared.setValue(K).setAlpha(Xe).toRgbaString();const I=D.blur*s,U=D.distance*s;p.shadowBlur=I,p.shadowOffsetX=Math.cos(D.angle)*U,p.shadowOffsetY=Math.sin(D.angle)*U+M}else p.globalAlpha=(a=(o=e._fill)==null?void 0:o.alpha)!=null?a:1,p.fillStyle=e._fill?ds(e._fill,p):null,(u=e._stroke)!=null&&u.width&&(p.strokeStyle=ds(e._stroke,p)),p.shadowColor="black";let O=(_-v.fontSize)/2;_-v.fontSize<0&&(O=0);const W=(c=(l=e._stroke)==null?void 0:l.width)!=null?c:0;for(let D=0;D<m.length;D++)w=W/2,R=W/2+D*_+v.ascent+O,e.align==="right"?w+=b-x[D]:e.align==="center"&&(w+=(b-x[D])/2),(h=e._stroke)!=null&&h.width&&this._drawLetterSpacing(m[D],e,i,w+e.padding,R+e.padding-N,!0),e._fill!==void 0&&this._drawLetterSpacing(m[D],e,i,w+e.padding,R+e.padding-N)}}_drawLetterSpacing(t,e,s,i,n,o=!1){const{context:a}=s,u=e.letterSpacing;let l=!1;if(Ht.experimentalLetterSpacingSupported&&(Ht.experimentalLetterSpacing?(a.letterSpacing=`${u}px`,a.textLetterSpacing=`${u}px`,l=!0):(a.letterSpacing="0px",a.textLetterSpacing="0px")),u===0||l){o?a.strokeText(t,i,n):a.fillText(t,i,n);return}let c=i;const h=Ht.graphemeSegmenter(t);let d=a.measureText(t).width,p=0;for(let f=0;f<h.length;++f){const g=h[f];o?a.strokeText(g,c,n):a.fillText(g,c,n);let m="";for(let _=f+1;_<h.length;++_)m+=h[_];p=a.measureText(m).width,c+=d-p+u,d=p}}destroy(){this._activeTextures=null}}Ma.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"canvasText"},k.add(Ma),k.add(_a);var PT=Object.defineProperty,Fi=Object.getOwnPropertySymbols,Gf=Object.prototype.hasOwnProperty,If=Object.prototype.propertyIsEnumerable,Ff=(r,t,e)=>t in r?PT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,DT=(r,t)=>{for(var e in t||(t={}))Gf.call(t,e)&&Ff(r,e,t[e]);if(Fi)for(var e of Fi(t))If.call(t,e)&&Ff(r,e,t[e]);return r},MT=(r,t)=>{var e={};for(var s in r)Gf.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Fi)for(var s of Fi(r))t.indexOf(s)<0&&If.call(r,s)&&(e[s]=r[s]);return e};class wr extends Be{constructor(t){t instanceof gt&&(t={context:t});const e=t||{},{context:s,roundPixels:i}=e,n=MT(e,["context","roundPixels"]);super(DT({label:"Graphics"},n)),this.renderPipeId="graphics",s?this._context=s:this._context=this._ownedContext=new gt,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=i!=null?i:!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new wr(this._context.clone()):(this._ownedContext=null,new wr(this._context))}lineStyle(t,e,s){const i={};return t&&(i.width=t),e&&(i.color=e),s&&(i.alpha=s),this.context.strokeStyle=i,this}beginFill(t,e){const s={};return t&&(s.color=t),e&&(s.alpha=e),this.context.fillStyle=s,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==gt.defaultStrokeStyle.width||t.color!==gt.defaultStrokeStyle.color||t.alpha!==gt.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const Uf={name:"local-uniform-msdf-bit",vertex:{header:`
struct LocalUniforms {
uColor:vec4<f32>,
uTransformMatrix:mat3x3<f32>,
uDistance: f32,
uRound:f32,
}
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`},fragment:{header:`
struct LocalUniforms {
uColor:vec4<f32>,
uTransformMatrix:mat3x3<f32>,
uDistance: f32
}
@group(2) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
outColor = vec4<f32>(calculateMSDFAlpha(outColor, localUniforms.uColor, localUniforms.uDistance));
`}},kf={name:"local-uniform-msdf-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix *= uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`},fragment:{header:`
uniform float uDistance;
`,main:`
outColor = vec4(calculateMSDFAlpha(outColor, vColor, uDistance));
`}},Nf={name:"msdf-bit",fragment:{header:`
fn calculateMSDFAlpha(msdfColor:vec4<f32>, shapeColor:vec4<f32>, distance:f32) -> f32 {
// MSDF
var median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
var screenPxDistance = distance * (median - 0.5);
var alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
var luma: f32 = dot(shapeColor.rgb, vec3<f32>(0.299, 0.587, 0.114));
var gamma: f32 = mix(1.0, 1.0 / 2.2, luma);
var coverage: f32 = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}},Lf={name:"msdf-bit",fragment:{header:`
float calculateMSDFAlpha(vec4 msdfColor, vec4 shapeColor, float distance) {
// MSDF
float median = msdfColor.r + msdfColor.g + msdfColor.b -
min(msdfColor.r, min(msdfColor.g, msdfColor.b)) -
max(msdfColor.r, max(msdfColor.g, msdfColor.b));
// SDF
median = min(median, msdfColor.a);
float screenPxDistance = distance * (median - 0.5);
float alpha = clamp(screenPxDistance + 0.5, 0.0, 1.0);
if (median < 0.01) {
alpha = 0.0;
} else if (median > 0.99) {
alpha = 1.0;
}
// Gamma correction for coverage-like alpha
float luma = dot(shapeColor.rgb, vec3(0.299, 0.587, 0.114));
float gamma = mix(1.0, 1.0 / 2.2, luma);
float coverage = pow(shapeColor.a * alpha, gamma);
return coverage;
}
`}};let Oa,Ba;class $f extends Ut{constructor(){const t=new it({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Ie();Oa!=null||(Oa=or({name:"sdf-shader",bits:[pi,mi(e),Uf,Nf,ur]})),Ba!=null||(Ba=ar({name:"sdf-shader",bits:[fi,gi(e),kf,Lf,lr]})),super({glProgram:Ba,gpuProgram:Oa,resources:{localUniforms:t,batchSamplers:_i(e)}})}}let Ga=0;const Hf=500;function me(...r){Ga!==Hf&&(Ga++,Ga===Hf?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}class Ia extends Ct{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const s in this.chars)(e=this.chars[s].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(s=>s.texture.destroy(!0)),this.pages=null)}}function Fa(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,s=r.length;e<s;e++){const i=r[e];if(Array.isArray(i)){if(i.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${i.length}.`);if(i[0].length===0||i[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const n=i[0].charCodeAt(0),o=i[1].charCodeAt(0);if(o<n)throw new Error("[BitmapFont]: Invalid character range.");for(let a=n,u=o;a<=u;a++)t.push(String.fromCharCode(a))}else t.push(...Array.from(i))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var OT=Object.defineProperty,Xf=Object.getOwnPropertySymbols,BT=Object.prototype.hasOwnProperty,GT=Object.prototype.propertyIsEnumerable,zf=(r,t,e)=>t in r?OT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jf=(r,t)=>{for(var e in t||(t={}))BT.call(t,e)&&zf(r,e,t[e]);if(Xf)for(var e of Xf(t))GT.call(t,e)&&zf(r,e,t[e]);return r};const Vf=class gx extends Ia{constructor(t){var e,s,i;super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;const n=jf(jf({},gx.defaultOptions),t);this._textureSize=n.textureSize,this._mipmap=n.mipmap;const o=n.style.clone();n.overrideFill&&(o._fill.color=16777215,o._fill.alpha=1,o._fill.texture=E.WHITE,o._fill.fill=null),this.applyFillAsTint=n.overrideFill;const a=o.fontSize;o.fontSize=this.baseMeasurementFontSize;const u=hs(o);n.overrideSize?o._stroke&&(o._stroke.width*=this.baseRenderedFontSize/a):o.fontSize=this.baseRenderedFontSize=a,this._style=o,this._skipKerning=(e=n.skipKerning)!=null?e:!1,this.resolution=(s=n.resolution)!=null?s:1,this._padding=(i=n.padding)!=null?i:4,this.fontMetrics=Ht.measureFont(u),this.lineHeight=o.lineHeight||this.fontMetrics.fontSize||o.fontSize}ensureCharacters(t){var e,s,i,n;const o=Fa(t).filter(b=>!this._currentChars.includes(b)).filter((b,v,A)=>A.indexOf(b)===v);if(!o.length)return;this._currentChars=[...this._currentChars,...o];let a;this._currentPageIndex===-1?a=this._nextPage():a=this.pages[this._currentPageIndex];let{canvas:u,context:l}=a.canvasAndContext,c=a.texture.source;const h=this._style;let d=this._currentX,p=this._currentY;const f=this.baseRenderedFontSize/this.baseMeasurementFontSize,g=this._padding*f,m=h.fontStyle==="italic"?2:1;let _=0,x=!1;for(let b=0;b<o.length;b++){const v=o[b],A=Ht.measureText(v,h,u,!1);A.lineHeight=A.height;const C=m*A.width*f,w=A.height*f,R=C+g*2,T=w+g*2;if(x=!1,v!==`
`&&v!=="\r"&&v!==" "&&v!==" "&&(x=!0,_=Math.ceil(Math.max(T,_))),d+R>this._textureSize&&(p+=_,_=T,d=0,p+_>this._textureSize)){c.update();const G=this._nextPage();u=G.canvasAndContext.canvas,l=G.canvasAndContext.context,c=G.texture.source,p=0}const S=C/f-((s=(e=h.dropShadow)==null?void 0:e.distance)!=null?s:0)-((n=(i=h._stroke)==null?void 0:i.width)!=null?n:0);if(this.chars[v]={id:v.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:S,kerning:{}},x){this._drawGlyph(l,A,d+g,p+g,f,h);const G=c.width*f,N=c.height*f,M=new V(d/G*c.width,p/N*c.height,R/G*c.width,T/N*c.height);this.chars[v].texture=new E({source:c,frame:M}),d+=Math.ceil(R)}}c.update(),this._currentX=d,this._currentY=p,this._skipKerning&&this._applyKerning(o,l)}get pageTextures(){return this.pages}_applyKerning(t,e){const s=this._measureCache;for(let i=0;i<t.length;i++){const n=t[i];for(let o=0;o<this._currentChars.length;o++){const a=this._currentChars[o];let u=s[n];u||(u=s[n]=e.measureText(n).width);let l=s[a];l||(l=s[a]=e.measureText(a).width);let c=e.measureText(n+a).width,h=c-(u+l);h&&(this.chars[n].kerning[a]=h),c=e.measureText(n+a).width,h=c-(u+l),h&&(this.chars[a].kerning[n]=h)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=Zt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const s=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),i=new E({source:new Ge({resource:e.canvas,resolution:s,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),n={canvasAndContext:e,texture:i};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,s){var i;e.fontSize=this.baseRenderedFontSize,t.scale(s,s),t.font=hs(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const n=e._stroke,o=(i=n==null?void 0:n.width)!=null?i:0;if(n&&(t.lineWidth=o,t.lineJoin=n.join,t.miterLimit=n.miterLimit,t.strokeStyle=ds(n,t)),e._fill&&(t.fillStyle=ds(e._fill,t)),e.dropShadow){const a=e.dropShadow,u=j.shared.setValue(a.color).toArray(),l=a.blur*s,c=a.distance*s;t.shadowColor=`rgba(${u[0]*255},${u[1]*255},${u[2]*255},${a.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(a.angle)*c,t.shadowOffsetY=Math.sin(a.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,s,i,n,o){var a;const u=e.text,l=e.fontProperties,c=o._stroke,h=((a=c==null?void 0:c.width)!=null?a:0)*n,d=s+h/2,p=i-h/2,f=l.descent*n,g=e.lineHeight*n;o.stroke&&h&&t.strokeText(u,d,p+g-f),o._fill&&t.fillText(u,d,p+g-f)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:s}=this.pages[t];e.canvas.width=e.canvas.width,Zt.returnCanvasAndContext(e),s.destroy(!0)}this.pages=null}};Vf.defaultOptions={textureSize:512,style:new Dt,mipmap:!0};let Ua=Vf;function ka(r,t,e,s){const i={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};i.offsetY=e.baseLineOffset;let n=i.lines[0],o=null,a=!0;const u={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=f=>{const g=n.width;for(let m=0;m<u.index;m++){const _=f.positions[m];n.chars.push(f.chars[m]),n.charPositions.push(_+g)}n.width+=f.width,a=!1,u.width=0,u.index=0,u.chars.length=0},c=()=>{let f=n.chars.length-1;if(s){let g=n.chars[f];for(;g===" ";)n.width-=e.chars[g].xAdvance,g=n.chars[--f]}i.width=Math.max(i.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},a=!0,i.lines.push(n),i.height+=e.lineHeight},h=e.baseMeasurementFontSize/t.fontSize,d=t.letterSpacing*h,p=t.wordWrapWidth*h;for(let f=0;f<r.length+1;f++){let g;const m=f===r.length;m||(g=r[f]);const _=e.chars[g]||e.chars[" "];if(/(?:\s)/.test(g)||g==="\r"||g===`
`||m){if(!a&&t.wordWrap&&n.width+u.width-d>p?(c(),l(u),m||n.charPositions.push(0)):(u.start=n.width,l(u),m||n.charPositions.push(0)),g==="\r"||g===`
`)n.width!==0&&c();else if(!m){const x=_.xAdvance+(_.kerning[o]||0)+d;n.width+=x,n.spaceWidth=x,n.spacesIndex.push(n.charPositions.length),n.chars.push(g)}}else{const x=_.kerning[o]||0,b=_.xAdvance+x+d;u.positions[u.index++]=u.width+x,u.chars.push(g),u.width+=b}o=g}return c(),t.align==="center"?IT(i):t.align==="right"?FT(i):t.align==="justify"&&UT(i),i}function IT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],s=r.width/2-e.width/2;for(let i=0;i<e.charPositions.length;i++)e.charPositions[i]+=s}}function FT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],s=r.width-e.width;for(let i=0;i<e.charPositions.length;i++)e.charPositions[i]+=s}}function UT(r){const t=r.width;for(let e=0;e<r.lines.length;e++){const s=r.lines[e];let i=0,n=s.spacesIndex[i++],o=0;const a=s.spacesIndex.length,u=(t-s.width)/a;for(let l=0;l<s.charPositions.length;l++)l===n&&(n=s.spacesIndex[i++],o+=u),s.charPositions[l]+=o}}var kT=Object.defineProperty,Wf=Object.getOwnPropertySymbols,NT=Object.prototype.hasOwnProperty,LT=Object.prototype.propertyIsEnumerable,Yf=(r,t,e)=>t in r?kT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Na=(r,t)=>{for(var e in t||(t={}))NT.call(t,e)&&Yf(r,e,t[e]);if(Wf)for(var e of Wf(t))LT.call(t,e)&&Yf(r,e,t[e]);return r};let Ui=0,$T=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){var s;let i=`${e.fontFamily}-bitmap`,n=!0;if(e._fill.fill&&!e._stroke)i+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let a=e.styleKey;a=a.substring(0,a.lastIndexOf("-")),i=`${a}-bitmap`,n=!1}if(!q.has(i)){const a=new Ua(Na({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions));Ui++,Ui>50&&me("BitmapText",`You have dynamically created ${Ui} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),a.once("destroy",()=>{Ui--,q.remove(i)}),q.set(i,a)}const o=q.get(i);return(s=o.ensureCharacters)==null||s.call(o,t),o}getLayout(t,e,s=!0){const i=this.getFont(t,e);return ka([...t],e,i,s)}measureText(t,e,s=!0){return this.getLayout(t,e,s)}install(...t){var e,s,i,n;let o=t[0];typeof o=="string"&&(o={name:o,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(s=t[2])==null?void 0:s.resolution,padding:(i=t[2])==null?void 0:i.padding,skipKerning:(n=t[2])==null?void 0:n.skipKerning});const a=o==null?void 0:o.name;if(!a)throw new Error("[BitmapFontManager] Property `name` is required.");o=Na(Na({},this.defaultOptions),o);const u=o.style,l=u instanceof Dt?u:new Dt(u),c=l._fill.fill!==null&&l._fill.fill!==void 0,h=new Ua({style:l,overrideFill:c,skipKerning:o.skipKerning,padding:o.padding,resolution:o.resolution,overrideSize:!1}),d=Fa(o.chars);return h.ensureCharacters(d.join("")),q.set(`${a}-bitmap`,h),h.once("destroy",()=>q.remove(`${a}-bitmap`)),h}uninstall(t){const e=`${t}-bitmap`,s=q.get(e);s&&(q.remove(e),s.destroy())}};const ps=new $T;class La{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const s=this._getGpuBitmapText(t);qf(t,s),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,s)),this._renderer.renderPipes.graphics.addRenderable(s,e),s.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){const e=this._gpuBitmapText[t].context;e.customShader&&(H.return(e.customShader),e.customShader=null),H.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){const e=this._getGpuBitmapText(t);qf(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:s}=e,i=ps.getFont(t.text,t._style);s.clear(),i.distanceField.type!=="none"&&(s.customShader||(s.customShader=H.get($f)));const n=Array.from(t.text),o=t._style;let a=i.baseLineOffset;const u=ka(n,o,i,!0);let l=0;const c=o.padding,h=u.scale;let d=u.width,p=u.height+u.offsetY;o._stroke&&(d+=o._stroke.width/h,p+=o._stroke.width/h),s.translate(-t._anchor._x*d-c,-t._anchor._y*p-c).scale(h,h);const f=i.applyFillAsTint?o._fill.color:16777215;for(let g=0;g<u.lines.length;g++){const m=u.lines[g];for(let _=0;_<m.charPositions.length;_++){const x=n[l++],b=i.chars[x];b!=null&&b.texture&&s.texture(b.texture,f||"black",Math.round(m.charPositions[_]+b.xOffset),Math.round(a+b.yOffset))}a+=i.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){const e=H.get(wr);return this._gpuBitmapText[t.uid]=e,this._updateContext(t,e),t.on("destroyed",this._destroyRenderableBound),this._gpuBitmapText[t.uid]}_updateDistanceField(t){const e=this._getGpuBitmapText(t).context,s=t._style.fontFamily,i=q.get(`${s}-bitmap`),{a:n,b:o,c:a,d:u}=t.groupTransform,l=Math.sqrt(n*n+o*o),c=Math.sqrt(a*a+u*u),h=(Math.abs(l)+Math.abs(c))/2,d=i.baseRenderedFontSize/t._style.fontSize,p=h*i.distanceField.range*(1/d);e.customShader.resources.localUniforms.uniforms.uDistance=p}destroy(){for(const t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}}La.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"bitmapText"};function qf(r,t){t.groupTransform=r.groupTransform,t.groupColorAlpha=r.groupColorAlpha,t.groupColor=r.groupColor,t.groupBlendMode=r.groupBlendMode,t.globalDisplayStatus=r.globalDisplayStatus,t.groupTransform=r.groupTransform,t.localDisplayStatus=r.localDisplayStatus,t.groupAlpha=r.groupAlpha,t._roundPixels=r._roundPixels}k.add(La);class $a{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const s=e.batchableSprite.renderable;s._autoResolution&&(s._resolution=this._renderer.resolution,s.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),s=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==s}addRenderable(t,e){const s=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),H.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),s=this._getGpuText(t),i=s.batchableSprite;s.currentKey!==e&&this._updateGpuText(t).catch(o=>{console.error(o)}),t._didTextUpdate=!1;const n=t._style.padding;jr(i.bounds,t._anchor,i.texture,n)}async _updateGpuText(t){var e;t._didTextUpdate=!1;const s=this._getGpuText(t);if(s.generatingTexture)return;const i=t._getKey();this._renderer.htmlText.decreaseReferenceCount(s.currentKey),s.generatingTexture=!0,s.currentKey=i;const n=(e=t.resolution)!=null?e:this._renderer.resolution,o=await this._renderer.htmlText.getManagedTexture(t.text,n,t._style,t._getKey()),a=s.batchableSprite;a.texture=s.texture=o,s.generatingTexture=!1,s.textureNeedsUploading=!0,t.onViewUpdate();const u=t._style.padding;jr(a.bounds,t._anchor,a.texture,u)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:E.EMPTY,currentKey:"--",batchableSprite:H.get(Mi),textureNeedsUploading:!1,generatingTexture:!1},s=e.batchableSprite;return s.renderable=t,s.transform=t.groupTransform,s.texture=E.EMPTY,s.bounds={minX:0,maxX:1,minY:0,maxY:0},s.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}$a.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"htmlText"};function Kf(){const{userAgent:r}=L.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}const Ha="http://www.w3.org/2000/svg",Xa="http://www.w3.org/1999/xhtml";class za{constructor(){this.svgRoot=document.createElementNS(Ha,"svg"),this.foreignObject=document.createElementNS(Ha,"foreignObject"),this.domElement=document.createElementNS(Xa,"div"),this.styleElement=document.createElementNS(Xa,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:s,domElement:i}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(s),t.appendChild(i)}}function Zf(r){const t=r._stroke,e=r._fill,s=[`div { ${[`color: ${j.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Jf(t)]:[],...r.dropShadow?[Qf(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return HT(r.tagStyles,s),s.join(" ")}function Qf(r){const t=j.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),s=Math.round(Math.sin(r.angle)*r.distance),i=`${e}px ${s}px`;return r.blur>0?`text-shadow: ${i} ${r.blur}px ${t}`:`text-shadow: ${i} ${t}`}function Jf(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${j.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${j.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}const tm={fontSize:"font-size: {{VALUE}}px",fontFamily:"font-family: {{VALUE}}",fontWeight:"font-weight: {{VALUE}}",fontStyle:"font-style: {{VALUE}}",fontVariant:"font-variant: {{VALUE}}",letterSpacing:"letter-spacing: {{VALUE}}px",align:"text-align: {{VALUE}}",padding:"padding: {{VALUE}}px",whiteSpace:"white-space: {{VALUE}}",lineHeight:"line-height: {{VALUE}}px",wordWrapWidth:"max-width: {{VALUE}}px"},em={fill:r=>`color: ${j.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Jf,dropShadow:Qf};function HT(r,t){for(const e in r){const s=r[e],i=[];for(const n in s)em[n]?i.push(em[n](s[n])):tm[n]&&i.push(tm[n].replace("{{VALUE}}",s[n]));t.push(`${e} { ${i.join(";")} }`)}}var XT=Object.defineProperty,rm=Object.getOwnPropertySymbols,zT=Object.prototype.hasOwnProperty,jT=Object.prototype.propertyIsEnumerable,sm=(r,t,e)=>t in r?XT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,VT=(r,t)=>{for(var e in t||(t={}))zT.call(t,e)&&sm(r,e,t[e]);if(rm)for(var e of rm(t))jT.call(t,e)&&sm(r,e,t[e]);return r};class He extends Dt{constructor(t={}){var e,s;super(t),this._cssOverrides=[],(e=this.cssOverrides)!=null||(this.cssOverrides=t.cssOverrides),this.tagStyles=(s=t.tagStyles)!=null?s:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Ca(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new He({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?VT({},this.dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth,cssOverrides:this.cssOverrides})}get cssStyle(){return this._cssStyle||(this._cssStyle=Zf(this)),this._cssStyle}addOverride(...t){const e=t.filter(s=>!this.cssOverrides.includes(s));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(s=>this.cssOverrides.includes(s));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(s=>!e.includes(s)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function im(r,t){const e=t.fontFamily,s=[],i={},n=/font-family:([^;"\s]+)/g,o=r.match(n);function a(u){i[u]||(s.push(u),i[u]=!0)}if(Array.isArray(e))for(let u=0;u<e.length;u++)a(e[u]);else a(e);o&&o.forEach(u=>{const l=u.split(":")[1].trim();a(l)});for(const u in t.tagStyles){const l=t.tagStyles[u].fontFamily;a(l)}return s}async function nm(r){const t=await(await L.get().fetch(r)).blob(),e=new FileReader;return await new Promise((s,i)=>{e.onloadend=()=>s(e.result),e.onerror=i,e.readAsDataURL(t)})}async function ja(r,t){const e=await nm(t);return`@font-face {
font-family: "${r.fontFamily}";
src: url('${e}');
font-weight: ${r.fontWeight};
font-style: ${r.fontStyle};
}`}const fs=new Map;async function om(r,t,e){const s=r.filter(i=>q.has(`${i}-and-url`)).map((i,n)=>{if(!fs.has(i)){const{url:o}=q.get(`${i}-and-url`);n===0?fs.set(i,ja({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:i},o)):fs.set(i,ja({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:i},o))}return fs.get(i)});return(await Promise.all(s)).join(`
`)}function am(r,t,e,s,i){const{domElement:n,styleElement:o,svgRoot:a}=i;n.innerHTML=`<style>${t.cssStyle}</style><div style='padding:0;'>${r}</div>`,n.setAttribute("style",`transform: scale(${e});transform-origin: top left; display: inline-block`),o.textContent=s;const{width:u,height:l}=i.image;return a.setAttribute("width",u.toString()),a.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(a)}function um(r,t){const e=Zt.getOptimalCanvasAndContext(r.width,r.height,t),{context:s}=e;return s.clearRect(0,0,r.width,r.height),s.drawImage(r,0,0),Zt.returnCanvasAndContext(e),e.canvas}function lm(r,t,e){return new Promise(async s=>{e&&await new Promise(i=>setTimeout(i,100)),r.onload=()=>{s()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}let cm;function Va(r,t,e,s){s=s||cm||(cm=new za);const{domElement:i,styleElement:n,svgRoot:o}=s;i.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,i.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(o);const a=i.getBoundingClientRect();o.remove();const u=Ht.measureFont(t.fontStyle).descent,l=t.padding*2;return{width:a.width-l,height:a.height+u-l}}class ki{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===Tt.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,s,i){if(this._activeTextures[i])return this._increaseReferenceCount(i),this._activeTextures[i].promise;const n=this._buildTexturePromise(t,e,s).then(o=>(this._activeTextures[i].texture=o,o));return this._activeTextures[i]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,s){const i=H.get(za),n=im(t,s),o=await om(n,s,He.defaultTextStyle),a=Va(t,s,o,i),u=Math.ceil(Math.ceil(Math.max(1,a.width)+s.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,a.height)+s.padding*2)*e),c=i.image,h=2;c.width=(u|0)+h,c.height=(l|0)+h;const d=am(t,s,e,o,i);await lm(c,d,Kf()&&n.length>0);let p=c;this._createCanvas&&(p=um(c,e));const f=Pa(p,c.width-h,c.height-h,e);return this._createCanvas&&this._renderer.texture.initSource(f.source),H.return(i),f}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(s=>{e.texture=s,this._cleanUp(e)}).catch(()=>{}),this._activeTextures[t]=null))}_cleanUp(t){dt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}ki.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"htmlText"},ki.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},k.add(ki),k.add($a);var WT=Object.defineProperty,hm=Object.getOwnPropertySymbols,YT=Object.prototype.hasOwnProperty,qT=Object.prototype.propertyIsEnumerable,dm=(r,t,e)=>t in r?WT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pm=(r,t)=>{for(var e in t||(t={}))YT.call(t,e)&&dm(r,e,t[e]);if(hm)for(var e of hm(t))qT.call(t,e)&&dm(r,e,t[e]);return r};const fm=class _x extends rr{constructor(...t){var e;let s=(e=t[0])!=null?e:{};s instanceof Float32Array&&(s={positions:s,uvs:t[1],indices:t[2]}),s=pm(pm({},_x.defaultOptions),s);const i=s.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=s.uvs||new Float32Array([0,0,1,0,1,1,0,1]),o=s.indices||new Uint32Array([0,1,2,0,2,3]),a=s.shrinkBuffersToFit,u=new Rt({data:i,label:"attribute-mesh-positions",shrinkToFit:a,usage:X.VERTEX|X.COPY_DST}),l=new Rt({data:n,label:"attribute-mesh-uvs",shrinkToFit:a,usage:X.VERTEX|X.COPY_DST}),c=new Rt({data:o,label:"index-mesh-buffer",shrinkToFit:a,usage:X.INDEX|X.COPY_DST});super({attributes:{aPosition:{buffer:u,format:"float32x2",stride:2*4,offset:0},aUV:{buffer:l,format:"float32x2",stride:2*4,offset:0}},indexBuffer:c,topology:s.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};fm.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let ge=fm;var KT=Object.defineProperty,ZT=Object.defineProperties,QT=Object.getOwnPropertyDescriptors,mm=Object.getOwnPropertySymbols,JT=Object.prototype.hasOwnProperty,tA=Object.prototype.propertyIsEnumerable,gm=(r,t,e)=>t in r?KT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_m=(r,t)=>{for(var e in t||(t={}))JT.call(t,e)&&gm(r,e,t[e]);if(mm)for(var e of mm(t))tA.call(t,e)&&gm(r,e,t[e]);return r},bm=(r,t)=>ZT(r,QT(t));const fr={name:"local-uniform-bit",vertex:{header:`
struct LocalUniforms {
uTransformMatrix:mat3x3<f32>,
uColor:vec4<f32>,
uRound:f32,
}
@group(1) @binding(0) var<uniform> localUniforms : LocalUniforms;
`,main:`
vColor *= localUniforms.uColor;
modelMatrix *= localUniforms.uTransformMatrix;
`,end:`
if(localUniforms.uRound == 1)
{
vPosition = vec4(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
}
`}},xm=bm(_m({},fr),{vertex:bm(_m({},fr.vertex),{header:fr.vertex.header.replace("group(1)","group(2)")})}),Ni={name:"local-uniform-bit",vertex:{header:`
uniform mat3 uTransformMatrix;
uniform vec4 uColor;
uniform float uRound;
`,main:`
vColor *= uColor;
modelMatrix = uTransformMatrix;
`,end:`
if(uRound == 1.)
{
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
}
`}},ym={name:"tiling-bit",vertex:{header:`
struct TilingUniforms {
uMapCoord:mat3x3<f32>,
uClampFrame:vec4<f32>,
uClampOffset:vec2<f32>,
uTextureTransform:mat3x3<f32>,
uSizeAnchor:vec4<f32>
};
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d<f32>;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
uv = (tilingUniforms.uTextureTransform * vec3(uv, 1.0)).xy;
position = (position - tilingUniforms.uSizeAnchor.zw) * tilingUniforms.uSizeAnchor.xy;
`},fragment:{header:`
struct TilingUniforms {
uMapCoord:mat3x3<f32>,
uClampFrame:vec4<f32>,
uClampOffset:vec2<f32>,
uTextureTransform:mat3x3<f32>,
uSizeAnchor:vec4<f32>
};
@group(2) @binding(0) var<uniform> tilingUniforms: TilingUniforms;
@group(2) @binding(1) var uTexture: texture_2d<f32>;
@group(2) @binding(2) var uSampler: sampler;
`,main:`
var coord = vUV + ceil(tilingUniforms.uClampOffset - vUV);
coord = (tilingUniforms.uMapCoord * vec3(coord, 1.0)).xy;
var unclamped = coord;
coord = clamp(coord, tilingUniforms.uClampFrame.xy, tilingUniforms.uClampFrame.zw);
var bias = 0.;
if(unclamped.x == coord.x && unclamped.y == coord.y)
{
bias = -32.;
}
outColor = textureSampleBias(uTexture, uSampler, coord, bias);
`}},vm={name:"tiling-bit",vertex:{header:`
uniform mat3 uTextureTransform;
uniform vec4 uSizeAnchor;
`,main:`
uv = (uTextureTransform * vec3(aUV, 1.0)).xy;
position = (position - uSizeAnchor.zw) * uSizeAnchor.xy;
`},fragment:{header:`
uniform sampler2D uTexture;
uniform mat3 uMapCoord;
uniform vec4 uClampFrame;
uniform vec2 uClampOffset;
`,main:`
vec2 coord = vUV + ceil(uClampOffset - vUV);
coord = (uMapCoord * vec3(coord, 1.0)).xy;
vec2 unclamped = coord;
coord = clamp(coord, uClampFrame.xy, uClampFrame.zw);
outColor = texture(uTexture, coord, unclamped == coord ? 0.0 : -32.0);// lod-bias very negative to force lod 0
`}};let Wa,Ya;class Tm extends Ut{constructor(){Wa!=null||(Wa=or({name:"tiling-sprite-shader",bits:[fr,ym,ur]})),Ya!=null||(Ya=ar({name:"tiling-sprite-shader",bits:[Ni,vm,lr]}));const t=new it({uMapCoord:{value:new B,type:"mat3x3<f32>"},uClampFrame:{value:new Float32Array([0,0,1,1]),type:"vec4<f32>"},uClampOffset:{value:new Float32Array([0,0]),type:"vec2<f32>"},uTextureTransform:{value:new B,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Ya,gpuProgram:Wa,resources:{localUniforms:new it({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:E.EMPTY.source,uSampler:E.EMPTY.source.style}})}updateUniforms(t,e,s,i,n,o){const a=this.resources.tilingUniforms,u=o.width,l=o.height,c=o.textureMatrix,h=a.uniforms.uTextureTransform;h.set(s.a*u/t,s.b*u/e,s.c*l/t,s.d*l/e,s.tx/t,s.ty/e),h.invert(),a.uniforms.uMapCoord=c.mapCoord,a.uniforms.uClampFrame=c.uClampFrame,a.uniforms.uClampOffset=c.uClampOffset,a.uniforms.uTextureTransform=h,a.uniforms.uSizeAnchor[0]=t,a.uniforms.uSizeAnchor[1]=e,a.uniforms.uSizeAnchor[2]=i,a.uniforms.uSizeAnchor[3]=n,o&&(this.resources.uTexture=o.source,this.resources.uSampler=o.source.style)}}class Am extends ge{constructor(){super({positions:new Float32Array([0,0,1,0,1,1,0,1]),uvs:new Float32Array([0,0,1,0,1,1,0,1]),indices:new Uint32Array([0,1,2,0,2,3])})}}function Sm(r,t){const e=r.anchor.x,s=r.anchor.y;t[0]=-e*r.width,t[1]=-s*r.height,t[2]=(1-e)*r.width,t[3]=-s*r.height,t[4]=(1-e)*r.width,t[5]=(1-s)*r.height,t[6]=-e*r.width,t[7]=(1-s)*r.height}function Em(r,t,e,s){let i=0;const n=r.length/(t||2),o=s.a,a=s.b,u=s.c,l=s.d,c=s.tx,h=s.ty;for(e*=t;i<n;){const d=r[e],p=r[e+1];r[e]=o*d+u*p+c,r[e+1]=a*d+l*p+h,e+=t,i++}}function wm(r,t){const e=r.texture,s=e.frame.width,i=e.frame.height;let n=0,o=0;r._applyAnchorToTexture&&(n=r.anchor.x,o=r.anchor.y),t[0]=t[6]=-n,t[2]=t[4]=1-n,t[1]=t[3]=-o,t[5]=t[7]=1-o;const a=B.shared;a.copyFrom(r._tileTransform.matrix),a.tx/=r.width,a.ty/=r.height,a.invert(),a.scale(r.width/s,r.height/i),Em(t,2,0,a)}const Li=new Am;class qa{constructor(t){this._state=Lt.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){const e=this._getTilingSpriteData(t),s=e.canBatch;this._updateCanBatch(t);const i=e.canBatch;if(i&&i===s){const{batchableMesh:n}=e;if(n&&n.texture._source!==t.texture._source)return!n._batcher.checkAndUpdateTexture(n,t.texture)}return s!==i}addRenderable(t,e){const s=this._renderer.renderPipes.batch;this._updateCanBatch(t);const i=this._getTilingSpriteData(t),{geometry:n,canBatch:o}=i;if(o){i.batchableMesh||(i.batchableMesh=new Di);const a=i.batchableMesh;t._didTilingSpriteUpdate&&(t._didTilingSpriteUpdate=!1,this._updateBatchableMesh(t),a.geometry=n,a.renderable=t,a.transform=t.groupTransform,a.texture=t._texture),a.roundPixels=this._renderer._roundPixels|t._roundPixels,s.addToBatch(a,e)}else s.break(e),i.shader||(i.shader=new Tm),this.updateRenderable(t),e.add(t)}execute(t){const{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;const s=e.resources.localUniforms.uniforms;s.uTransformMatrix=t.groupTransform,s.uRound=this._renderer._roundPixels|t._roundPixels,ns(t.groupColorAlpha,s.uColor,0),this._state.blendMode=Jr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:Li,shader:e,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:s}=e;if(s){const{batchableMesh:i}=e;t._didTilingSpriteUpdate&&this._updateBatchableMesh(t),i._batcher.updateElement(i)}else if(t._didTilingSpriteUpdate){const{shader:i}=e;i.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}t._didTilingSpriteUpdate=!1}destroyRenderable(t){var e;const s=this._getTilingSpriteData(t);s.batchableMesh=null,(e=s.shader)==null||e.destroy(),this._tilingSpriteDataHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_getTilingSpriteData(t){return this._tilingSpriteDataHash[t.uid]||this._initTilingSpriteData(t)}_initTilingSpriteData(t){const e=new ge({indices:Li.indices,positions:Li.positions.slice(),uvs:Li.uvs.slice()});return this._tilingSpriteDataHash[t.uid]={canBatch:!0,renderable:t,geometry:e},t.on("destroyed",this._destroyRenderableBound),this._tilingSpriteDataHash[t.uid]}_updateBatchableMesh(t){const e=this._getTilingSpriteData(t),{geometry:s}=e,i=t.texture.source.style;i.addressMode!=="repeat"&&(i.addressMode="repeat",i.update()),wm(t,s.uvs),Sm(t,s.positions)}destroy(){for(const t in this._tilingSpriteDataHash)this.destroyRenderable(this._tilingSpriteDataHash[t].renderable);this._tilingSpriteDataHash=null,this._renderer=null}_updateCanBatch(t){const e=this._getTilingSpriteData(t),s=t.texture;let i=!0;return this._renderer.type===Tt.WEBGL&&(i=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=s.textureMatrix.isSimple&&(i||s.source.isPowerOfTwo),e.canBatch}}qa.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"tilingSprite"},k.add(qa);var eA=Object.defineProperty,Cm=Object.getOwnPropertySymbols,rA=Object.prototype.hasOwnProperty,sA=Object.prototype.propertyIsEnumerable,Rm=(r,t,e)=>t in r?eA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pm=(r,t)=>{for(var e in t||(t={}))rA.call(t,e)&&Rm(r,e,t[e]);if(Cm)for(var e of Cm(t))sA.call(t,e)&&Rm(r,e,t[e]);return r};const Dm=class bx extends ge{constructor(...t){var e;super({});let s=(e=t[0])!=null?e:{};typeof s=="number"&&(s={width:s,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(s)}build(t){var e,s,i,n;t=Pm(Pm({},bx.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(s=this.verticesY)!=null?s:t.verticesY,this.width=(i=this.width)!=null?i:t.width,this.height=(n=this.height)!=null?n:t.height;const o=this.verticesX*this.verticesY,a=[],u=[],l=[],c=this.verticesX-1,h=this.verticesY-1,d=this.width/c,p=this.height/h;for(let g=0;g<o;g++){const m=g%this.verticesX,_=g/this.verticesX|0;a.push(m*d,_*p),u.push(m/c,_/h)}const f=c*h;for(let g=0;g<f;g++){const m=g%c,_=g/c|0,x=_*this.verticesX+m,b=_*this.verticesX+m+1,v=(_+1)*this.verticesX+m,A=(_+1)*this.verticesX+m+1;l.push(x,b,v,b,A,v)}this.buffers[0].data=new Float32Array(a),this.buffers[1].data=new Float32Array(u),this.indexBuffer.data=new Uint32Array(l),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Dm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let $i=Dm;var iA=Object.defineProperty,Mm=Object.getOwnPropertySymbols,nA=Object.prototype.hasOwnProperty,oA=Object.prototype.propertyIsEnumerable,Om=(r,t,e)=>t in r?iA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bm=(r,t)=>{for(var e in t||(t={}))nA.call(t,e)&&Om(r,e,t[e]);if(Mm)for(var e of Mm(t))oA.call(t,e)&&Om(r,e,t[e]);return r};const Gm=class xx extends $i{constructor(t={}){t=Bm(Bm({},xx.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e,s,i,n,o,a,u,l;this.width=(e=t.width)!=null?e:this.width,this.height=(s=t.height)!=null?s:this.height,this._originalWidth=(i=t.originalWidth)!=null?i:this._originalWidth,this._originalHeight=(n=t.originalHeight)!=null?n:this._originalHeight,this._leftWidth=(o=t.leftWidth)!=null?o:this._leftWidth,this._rightWidth=(a=t.rightWidth)!=null?a:this._rightWidth,this._topHeight=(u=t.topHeight)!=null?u:this._topHeight,this._bottomHeight=(l=t.bottomHeight)!=null?l:this._bottomHeight,this.updateUvs(),this.updatePositions()}updatePositions(){const t=this.positions,e=this._leftWidth+this._rightWidth,s=this.width>e?1:this.width/e,i=this._topHeight+this._bottomHeight,n=this.height>i?1:this.height/i,o=Math.min(s,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*o,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*o,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*o,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*o,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,s=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=s*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-s*this._bottomHeight,this.getBuffer("aUV").update()}};Gm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let _e=Gm;class Ka{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s._batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e.geometry),H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.geometry.update(t),e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(Di);return e.geometry=H.get(_e),e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.roundPixels=this._renderer._roundPixels|t._roundPixels,t._didSpriteUpdate=!0,this._gpuSpriteHash[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)this._gpuSpriteHash[t].geometry.destroy();this._gpuSpriteHash=null,this._renderer=null}}Ka.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"nineSliceSprite"},k.add(Ka);class Za{constructor(t){this._renderer=t}push(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Za.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"filter"};const aA=new B;function Im(r,t){return t.clear(),Qa(r,t),t.isValid||t.set(0,0,0,0),r.renderGroup?t.applyMatrix(r.renderGroup.localTransform):t.applyMatrix(r.parentRenderGroup.worldTransform),t}function Qa(r,t){if(r.localDisplayStatus!==7||!r.measurable)return;const e=!!r.effects.length;let s=t;if((r.renderGroup||e)&&(s=qt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,r.worldTransform);else{if(r.renderPipeId){const n=r.bounds;s.addFrame(n.minX,n.minY,n.maxX,n.maxY,r.groupTransform)}const i=r.children;for(let n=0;n<i.length;n++)Qa(i[n],s)}if(e){let i=!1;for(let n=0;n<r.effects.length;n++)r.effects[n].addBounds&&(i||(i=!0,s.applyMatrix(r.parentRenderGroup.worldTransform)),r.effects[n].addBounds(s,!0));i&&(s.applyMatrix(r.parentRenderGroup.worldTransform.copyTo(aA).invert()),t.addBounds(s,r.relativeGroupTransform)),t.addBounds(s),qt.return(s)}else r.renderGroup&&(t.addBounds(s,r.relativeGroupTransform),qt.return(s))}function Fm(r,t){t.clear();const e=t.matrix;for(let s=0;s<r.length;s++){const i=r[s];i.globalDisplayStatus<7||(t.matrix=i.worldTransform,i.addBounds(t))}return t.matrix=e,t}const uA=new rr({attributes:{aPosition:{buffer:new Float32Array([0,0,1,0,1,1,0,1]),format:"float32x2",stride:2*4,offset:0}},indexBuffer:new Uint32Array([0,1,2,0,2,3])});class Ja{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new it({uInputSize:{value:new Float32Array(4),type:"vec4<f32>"},uInputPixel:{value:new Float32Array(4),type:"vec4<f32>"},uInputClamp:{value:new Float32Array(4),type:"vec4<f32>"},uOutputFrame:{value:new Float32Array(4),type:"vec4<f32>"},uGlobalFrame:{value:new Float32Array(4),type:"vec4<f32>"},uOutputTexture:{value:new Float32Array(4),type:"vec4<f32>"}}),this._globalFilterBindGroup=new Kt({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){var e,s;const i=this.renderer,n=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const o=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,n.length===0){o.skip=!0;return}const a=o.bounds;t.renderables?Fm(t.renderables,a):t.filterEffect.filterArea?(a.clear(),a.addRect(t.filterEffect.filterArea),a.applyMatrix(t.container.worldTransform)):Im(t.container,a);const u=i.renderTarget.renderTarget.colorTexture.source;let l=1/0,c=0,h=!0,d=!1,p=!1;for(let g=0;g<n.length;g++){const m=n[g];if(l=Math.min(l,m.resolution==="inherit"?u._resolution:m.resolution),c+=m.padding,m.antialias==="off"?h=!1:m.antialias==="inherit"&&h&&(h=u.antialias),!(m.compatibleRenderers&i.type)){p=!1;break}if(m.blendRequired&&!((s=(e=i.backBuffer)==null?void 0:e.useBackBuffer)==null||s)){p=!1;break}p=m.enabled||p,d=d||m.blendRequired}if(!p){o.skip=!0;return}const f=i.renderTarget.rootViewPort;if(a.scale(l).fitBounds(0,f.width,0,f.height).ceil().scale(1/l).pad(c|0),!a.isPositive){o.skip=!0;return}o.skip=!1,o.bounds=a,o.blendRequired=d,o.container=t.container,o.filterEffect=t.filterEffect,o.previousRenderSurface=i.renderTarget.renderSurface,o.inputTexture=dt.getOptimalTexture(a.width,a.height,l,h),i.renderTarget.bind(o.inputTexture,!0),i.globalUniforms.push({offset:a})}pop(){const t=this.renderer;this._filterStackIndex--;const e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;const s=e.inputTexture,i=e.bounds;let n=E.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){const a=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,u=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(u,i,a)}e.backTexture=n;const o=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(s.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),o.length===1)o[0].apply(this,s,e.previousRenderSurface,!1),dt.returnTexture(s);else{let a=e.inputTexture,u=dt.getOptimalTexture(i.width,i.height,a.source._resolution,!1),l=0;for(l=0;l<o.length-1;++l){o[l].apply(this,a,u,!0);const c=a;a=u,u=c}o[l].apply(this,a,e.previousRenderSurface,!1),dt.returnTexture(a),dt.returnTexture(u)}e.blendRequired&&dt.returnTexture(n)}getBackTexture(t,e,s){const i=t.colorTexture.source._resolution,n=dt.getOptimalTexture(e.width,e.height,i,!1);let o=e.minX,a=e.minY;s&&(o-=s.minX,a-=s.minY),o=Math.floor(o*i),a=Math.floor(a*i);const u=Math.ceil(e.width*i),l=Math.ceil(e.height*i);return this.renderer.renderTarget.copyToTexture(t,n,{x:o,y:a},{width:u,height:l},{x:0,y:0}),n}applyFilter(t,e,s,i){const n=this.renderer,o=this._filterStack[this._filterStackIndex],a=o.bounds,u=nt.shared,l=o.previousRenderSurface===s;let c=this.renderer.renderTarget.rootRenderTarget.colorTexture.source._resolution,h=this._filterStackIndex-1;for(;h>0&&this._filterStack[h].skip;)--h;h>0&&(c=this._filterStack[h].inputTexture.source._resolution);const d=this._filterGlobalUniforms,p=d.uniforms,f=p.uOutputFrame,g=p.uInputSize,m=p.uInputPixel,_=p.uInputClamp,x=p.uGlobalFrame,b=p.uOutputTexture;if(l){let C=this._filterStackIndex;for(;C>0;){C--;const w=this._filterStack[this._filterStackIndex-1];if(!w.skip){u.x=w.bounds.minX,u.y=w.bounds.minY;break}}f[0]=a.minX-u.x,f[1]=a.minY-u.y}else f[0]=0,f[1]=0;f[2]=e.frame.width,f[3]=e.frame.height,g[0]=e.source.width,g[1]=e.source.height,g[2]=1/g[0],g[3]=1/g[1],m[0]=e.source.pixelWidth,m[1]=e.source.pixelHeight,m[2]=1/m[0],m[3]=1/m[1],_[0]=.5*m[2],_[1]=.5*m[3],_[2]=e.frame.width*g[2]-.5*m[2],_[3]=e.frame.height*g[3]-.5*m[3];const v=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=u.x*c,x[1]=u.y*c,x[2]=v.source.width*c,x[3]=v.source.height*c;const A=this.renderer.renderTarget.getRenderTarget(s);if(n.renderTarget.bind(s,!!i),s instanceof E?(b[0]=s.frame.width,b[1]=s.frame.height):(b[0]=A.width,b[1]=A.height),b[2]=A.isRoot?-1:1,d.update(),n.renderPipes.uniformBatch){const C=n.renderPipes.uniformBatch.getUboResource(d);this._globalFilterBindGroup.setResource(C,0)}else this._globalFilterBindGroup.setResource(d,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:uA,shader:t,state:t._state,topology:"triangle-list"}),n.type===Tt.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new pt,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){const s=this._activeFilterData,i=t.set(s.inputTexture._source.width,0,0,s.inputTexture._source.height,s.bounds.minX,s.bounds.minY),n=e.worldTransform.copyTo(B.shared);return n.invert(),i.prepend(n),i.scale(1/e.texture.frame.width,1/e.texture.frame.height),i.translate(e.anchor.x,e.anchor.y),i}}Ja.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"filter"},k.add(Ja),k.add(Za);var lA={__proto__:null};const tu=[];k.handleByNamedList(y.Environment,tu);async function eu(r){if(!r)for(let t=0;t<tu.length;t++){const e=tu[t];if(e.value.test()){await e.value.load();return}}}async function cA(r){return eu(!r)}let ms;function ru(){if(typeof ms=="boolean")return ms;try{ms=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){ms=!1}return ms}var At=(r=>(r[r.NONE=0]="NONE",r[r.COLOR=16384]="COLOR",r[r.STENCIL=1024]="STENCIL",r[r.DEPTH=256]="DEPTH",r[r.COLOR_DEPTH=16640]="COLOR_DEPTH",r[r.COLOR_STENCIL=17408]="COLOR_STENCIL",r[r.DEPTH_STENCIL=1280]="DEPTH_STENCIL",r[r.ALL=17664]="ALL",r))(At||{});class su{constructor(t){this.items=[],this._name=t}emit(t,e,s,i,n,o,a,u){const{name:l,items:c}=this;for(let h=0,d=c.length;h<d;h++)c[h][l](t,e,s,i,n,o,a,u);return this}add(t){return t[this._name]&&(this.remove(t),this.items.push(t)),this}remove(t){const e=this.items.indexOf(t);return e!==-1&&this.items.splice(e,1),this}contains(t){return this.items.indexOf(t)!==-1}removeAll(){return this.items.length=0,this}destroy(){this.removeAll(),this.items=null,this._name=null}get empty(){return this.items.length===0}get name(){return this._name}}var hA=Object.defineProperty,Um=Object.getOwnPropertySymbols,dA=Object.prototype.hasOwnProperty,pA=Object.prototype.propertyIsEnumerable,km=(r,t,e)=>t in r?hA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hi=(r,t)=>{for(var e in t||(t={}))dA.call(t,e)&&km(r,e,t[e]);if(Um)for(var e of Um(t))pA.call(t,e)&&km(r,e,t[e]);return r};const fA=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],Nm=class yx extends Ct{constructor(t){var e;super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const s=[...fA,...(e=this.config.runners)!=null?e:[]];this._addRunners(...s),this._unsafeEvalCheck()}async init(t={}){const e=t.skipExtensionImports===!0?!0:t.manageImports===!1;await eu(e),this._addSystems(this.config.systems),this._addPipes(this.config.renderPipes,this.config.renderPipeAdaptors);for(const s in this._systemsHash){const i=this._systemsHash[s].constructor.defaultOptions;t=Hi(Hi({},i),t)}t=Hi(Hi({},yx.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let s=0;s<this.runners.init.items.length;s++)await this.runners.init.items[s].init(t);this._initOptions=t}render(t,e){let s=t;if(s instanceof rt&&(s={container:s},e&&(s.target=e.renderTexture)),s.target||(s.target=this.view.renderTarget),s.target===this.view.renderTarget&&(this._lastObjectRendered=s.container,s.clearColor=this.background.colorRgba),s.clearColor){const i=Array.isArray(s.clearColor)&&s.clearColor.length===4;s.clearColor=i?s.clearColor:j.shared.setValue(s.clearColor).toArray()}s.transform||(s.container.updateLocalTransform(),s.transform=s.container.localTransform),this.runners.prerender.emit(s),this.runners.renderStart.emit(s),this.runners.render.emit(s),this.runners.renderEnd.emit(s),this.runners.postrender.emit(s)}resize(t,e,s){const i=this.view.resolution;this.view.resize(t,e,s),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),s!==void 0&&s!==i&&this.runners.resolutionChange.emit(s)}clear(t={}){var e;const s=this;t.target||(t.target=s.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),(e=t.clear)!=null||(t.clear=At.ALL);const{clear:i,clearColor:n,target:o}=t;j.shared.setValue(n!=null?n:this.background.colorRgba),s.renderTarget.clear(o,i,j.shared.toArray())}get resolution(){return this.view.resolution}set resolution(t){this.view.resolution=t,this.runners.resolutionChange.emit(t)}get width(){return this.view.texture.frame.width}get height(){return this.view.texture.frame.height}get canvas(){return this.view.canvas}get lastObjectRendered(){return this._lastObjectRendered}get renderingToScreen(){return this.renderTarget.renderingToScreen}get screen(){return this.view.screen}_addRunners(...t){t.forEach(e=>{this.runners[e]=new su(e)})}_addSystems(t){let e;for(e in t){const s=t[e];this._addSystem(s.value,s.name)}}_addSystem(t,e){const s=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=s,this._systemsHash[e]=s;for(const i in this.runners)this.runners[i].add(s);return this}_addPipes(t,e){const s=e.reduce((i,n)=>(i[n.name]=n.value,i),{});t.forEach(i=>{const n=i.value,o=i.name,a=s[o];this.renderPipes[o]=new n(this,a?new a:null)})}destroy(t=!1){this.runners.destroy.items.reverse(),this.runners.destroy.emit(t),Object.values(this.runners).forEach(e=>{e.destroy()}),this._systemsHash=null,this.renderPipes=null}generateTexture(t){return this.textureGenerator.generateTexture(t)}get roundPixels(){return!!this._roundPixels}_unsafeEvalCheck(){if(!ru())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}};Nm.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let gs=Nm,iu;function _s(r){return iu!==void 0||(iu=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:gs.defaultOptions.failIfMajorPerformanceCaveat};try{if(!L.get().getWebGLRenderingContext())return!1;let s=L.get().createCanvas().getContext("webgl",e);const i=!!((t=s==null?void 0:s.getContextAttributes())!=null&&t.stencil);if(s){const n=s.getExtension("WEBGL_lose_context");n&&n.loseContext()}return s=null,i}catch(s){return!1}})()),iu}let nu;async function bs(r={}){return nu!==void 0||(nu=await(async()=>{const t=L.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),nu}var mA=Object.defineProperty,Lm=Object.getOwnPropertySymbols,gA=Object.prototype.hasOwnProperty,_A=Object.prototype.propertyIsEnumerable,$m=(r,t,e)=>t in r?mA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xs=(r,t)=>{for(var e in t||(t={}))gA.call(t,e)&&$m(r,e,t[e]);if(Lm)for(var e of Lm(t))_A.call(t,e)&&$m(r,e,t[e]);return r};const Hm=["webgl","webgpu","canvas"];async function Xm(r){var t;let e=[];r.preference?(e.push(r.preference),Hm.forEach(o=>{o!==r.preference&&e.push(o)})):e=Hm.slice();let s,i={};for(let o=0;o<e.length;o++){const a=e[o];if(a==="webgpu"&&await bs()){const{WebGPURenderer:u}=await Promise.resolve().then(function(){return xC});s=u,i=xs(xs({},r),r.webgpu);break}else if(a==="webgl"&&_s((t=r.failIfMajorPerformanceCaveat)!=null?t:gs.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:u}=await Promise.resolve().then(function(){return tC});s=u,i=xs(xs({},r),r.webgl);break}else if(a==="canvas")throw i=xs({},r),new Error("CanvasRenderer is not yet implemented")}if(delete i.webgpu,delete i.webgl,!s)throw new Error("No available renderer for the current environment");const n=new s;return await n.init(i),n}const bA=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,ys="8.4.1";class ou{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,ys)}static destroy(){}}ou.extension=y.Application;class au{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,ys)}destroy(){this._renderer=null}}au.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"initHook",priority:-10};var xA=Object.defineProperty,zm=Object.getOwnPropertySymbols,yA=Object.prototype.hasOwnProperty,vA=Object.prototype.propertyIsEnumerable,jm=(r,t,e)=>t in r?xA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,TA=(r,t)=>{for(var e in t||(t={}))yA.call(t,e)&&jm(r,e,t[e]);if(zm)for(var e of zm(t))vA.call(t,e)&&jm(r,e,t[e]);return r};const Vm=class mc{constructor(...t){this.stage=new rt}async init(t){t=TA({},t),this.renderer=await Xm(t),mc._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const s=mc._plugins.slice(0);s.reverse(),s.forEach(i=>{i.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Vm._plugins=[];let Wm=Vm;k.handleByList(y.Application,Wm._plugins),k.add(ou);class uu extends Ia{constructor(t,e){var s;super();const{textures:i,data:n}=t;Object.keys(n.pages).forEach(o=>{const a=n.pages[parseInt(o,10)],u=i[a.id];this.pages.push({texture:u})}),Object.keys(n.chars).forEach(o=>{var a;const u=n.chars[o],{frame:l,source:c}=i[u.page],h=new V(u.x+l.x,u.y+l.y,u.width,u.height),d=new E({source:c,frame:h});this.chars[o]={id:o.codePointAt(0),xOffset:u.xOffset,yOffset:u.yOffset,xAdvance:u.xAdvance,kerning:(a=u.kerning)!=null?a:{},texture:d}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=(s=n.distanceField)!=null?s:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ps.install(t)}static uninstall(t){ps.uninstall(t)}}const Xi={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){var t,e,s;const i=r.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const f in i){const g=i[f].match(/^[a-z]+/gm)[0],m=i[f].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),_={};for(const x in m){const b=m[x].split("="),v=b[0],A=b[1].replace(/"/gm,""),C=parseFloat(A),w=isNaN(C)?A:C;_[v]=w}n[g].push(_)}const o={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[a]=n.info,[u]=n.common,[l]=(t=n.distanceField)!=null?t:[];l&&(o.distanceField={range:parseInt(l.distanceRange,10),type:l.fieldType}),o.fontSize=parseInt(a.size,10),o.fontFamily=a.face,o.lineHeight=parseInt(u.lineHeight,10);const c=n.page;for(let f=0;f<c.length;f++)o.pages.push({id:parseInt(c[f].id,10)||0,file:c[f].file});const h={};o.baseLineOffset=o.lineHeight-parseInt(u.base,10);const d=n.char;for(let f=0;f<d.length;f++){const g=d[f],m=parseInt(g.id,10);let _=(s=(e=g.letter)!=null?e:g.char)!=null?s:String.fromCharCode(m);_==="space"&&(_=" "),h[m]=_,o.chars[_]={id:m,page:parseInt(g.page,10)||0,x:parseInt(g.x,10),y:parseInt(g.y,10),width:parseInt(g.width,10),height:parseInt(g.height,10),xOffset:parseInt(g.xoffset,10),yOffset:parseInt(g.yoffset,10),xAdvance:parseInt(g.xadvance,10),kerning:{}}}const p=n.kerning||[];for(let f=0;f<p.length;f++){const g=parseInt(p[f].first,10),m=parseInt(p[f].second,10),_=parseInt(p[f].amount,10);o.chars[h[m]].kerning[h[g]]=_}return o}},lu={test(r){const t=r;return typeof t!="string"&&"getElementsByTagName"in t&&t.getElementsByTagName("page").length&&t.getElementsByTagName("info")[0].getAttribute("face")!==null},parse(r){var t,e;const s={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},i=r.getElementsByTagName("info")[0],n=r.getElementsByTagName("common")[0],o=r.getElementsByTagName("distanceField")[0];o&&(s.distanceField={type:o.getAttribute("fieldType"),range:parseInt(o.getAttribute("distanceRange"),10)});const a=r.getElementsByTagName("page"),u=r.getElementsByTagName("char"),l=r.getElementsByTagName("kerning");s.fontSize=parseInt(i.getAttribute("size"),10),s.fontFamily=i.getAttribute("face"),s.lineHeight=parseInt(n.getAttribute("lineHeight"),10);for(let h=0;h<a.length;h++)s.pages.push({id:parseInt(a[h].getAttribute("id"),10)||0,file:a[h].getAttribute("file")});const c={};s.baseLineOffset=s.lineHeight-parseInt(n.getAttribute("base"),10);for(let h=0;h<u.length;h++){const d=u[h],p=parseInt(d.getAttribute("id"),10);let f=(e=(t=d.getAttribute("letter"))!=null?t:d.getAttribute("char"))!=null?e:String.fromCharCode(p);f==="space"&&(f=" "),c[p]=f,s.chars[f]={id:p,page:parseInt(d.getAttribute("page"),10)||0,x:parseInt(d.getAttribute("x"),10),y:parseInt(d.getAttribute("y"),10),width:parseInt(d.getAttribute("width"),10),height:parseInt(d.getAttribute("height"),10),xOffset:parseInt(d.getAttribute("xoffset"),10),yOffset:parseInt(d.getAttribute("yoffset"),10),xAdvance:parseInt(d.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<l.length;h++){const d=parseInt(l[h].getAttribute("first"),10),p=parseInt(l[h].getAttribute("second"),10),f=parseInt(l[h].getAttribute("amount"),10);s.chars[c[p]].kerning[c[d]]=f}return s}},cu={test(r){return typeof r=="string"&&r.includes("<font>")?lu.test(L.get().parseXML(r)):!1},parse(r){return lu.parse(L.get().parseXML(r))}},AA=[".xml",".fnt"],Ym={extension:{type:y.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof uu,getCacheableAssets(r,t){const e={};return r.forEach(s=>{e[s]=t,e[`${s}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},qm={extension:{type:y.LoadParser,priority:wt.Normal},name:"loadBitmapFont",test(r){return AA.includes(vt.extname(r).toLowerCase())},async testParse(r){return Xi.test(r)||cu.test(r)},async parse(r,t,e){const s=Xi.test(r)?Xi.parse(r):cu.parse(r),{src:i}=t,{pages:n}=s,o=[],a=s.distanceField?{scaleMode:"linear",alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:!1,resolution:1}:{};for(let c=0;c<n.length;++c){const h=n[c].file;let d=vt.join(vt.dirname(i),h);d=qs(d,i),o.push({src:d,data:a})}const u=await e.load(o),l=o.map(c=>u[c.src]);return new uu({data:s,textures:l},i)},async load(r,t){return await(await L.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(s=>e.unload(s.texture.source._sourceOrigin))),r.destroy()}};class Km{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let s=0;s<e;s++)t.push(this._assetList.pop());await this._loader.load(t),this._isLoading=!1,this._next()}}get active(){return this._isActive}set active(t){this._isActive!==t&&(this._isActive=t,t&&!this._isLoading&&this._next())}}const Zm={extension:{type:y.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof E),getCacheableAssets:(r,t)=>{const e={};return r.forEach(s=>{t.forEach((i,n)=>{e[s+(n===0?"":n+1)]=i})}),e}};async function hu(r){if("Image"in globalThis)return new Promise(t=>{const e=new Image;e.onload=()=>{t(!0)},e.onerror=()=>{t(!1)},e.src=r});if("createImageBitmap"in globalThis&&"fetch"in globalThis){try{const t=await(await fetch(r)).blob();await createImageBitmap(t)}catch(t){return!1}return!0}return!1}const Qm={extension:{type:y.DetectionParser,priority:1},test:async()=>hu("data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAAB0AAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAIAAAACAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQ0MAAAAABNjb2xybmNseAACAAIAAYAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAACVtZGF0EgAKCBgANogQEAwgMg8f8D///8WfhwB8+ErK42A="),add:async r=>[...r,"avif"],remove:async r=>r.filter(t=>t!=="avif")},Jm=["png","jpg","jpeg"],tg={extension:{type:y.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Jm],remove:async r=>r.filter(t=>!Jm.includes(t))},SA="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function zi(r){return SA?!1:document.createElement("video").canPlayType(r)!==""}const eg={extension:{type:y.DetectionParser,priority:0},test:async()=>zi("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},rg={extension:{type:y.DetectionParser,priority:0},test:async()=>zi("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},sg={extension:{type:y.DetectionParser,priority:0},test:async()=>zi("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},ig={extension:{type:y.DetectionParser,priority:0},test:async()=>hu("data:image/webp;base64,UklGRh4AAABXRUJQVlA4TBEAAAAvAAAAAAfQ//73v/+BiOh/AAA="),add:async r=>[...r,"webp"],remove:async r=>r.filter(t=>t!=="webp")};var EA=Object.defineProperty,wA=Object.defineProperties,CA=Object.getOwnPropertyDescriptors,ng=Object.getOwnPropertySymbols,RA=Object.prototype.hasOwnProperty,PA=Object.prototype.propertyIsEnumerable,og=(r,t,e)=>t in r?EA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,DA=(r,t)=>{for(var e in t||(t={}))RA.call(t,e)&&og(r,e,t[e]);if(ng)for(var e of ng(t))PA.call(t,e)&&og(r,e,t[e]);return r},MA=(r,t)=>wA(r,CA(t));class ag{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,s)=>(this._parsersValidated=!1,t[e]=s,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const s={promise:null,parser:null};return s.promise=(async()=>{var i,n;let o=null,a=null;if(e.loadParser&&(a=this._parserHash[e.loadParser]),!a){for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.load&&(i=l.test)!=null&&i.call(l,t,e,this)){a=l;break}}if(!a)return null}o=await a.load(t,e,this),s.parser=a;for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];l.parse&&l.parse&&await((n=l.testParse)==null?void 0:n.call(l,o,e,this))&&(o=await l.parse(o,e,this)||o,s.parser=l)}return o})(),s}async load(t,e){this._parsersValidated||this._validateParsers();let s=0;const i={},n=Xr(t),o=Bt(t,l=>({alias:[l],src:l,data:{}})),a=o.length,u=o.map(async l=>{const c=vt.toAbsolute(l.src);if(!i[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),i[l.src]=await this.promiseCache[c].promise,e&&e(++s/a)}catch(h){throw delete this.promiseCache[c],delete i[l.src],new Error(`[Loader.load] Failed to load ${c}.
${h}`)}});return await Promise.all(u),n?i[o[0].src]:i}async unload(t){const e=Bt(t,s=>({alias:[s],src:s})).map(async s=>{var i,n;const o=vt.toAbsolute(s.src),a=this.promiseCache[o];if(a){const u=await a.promise;delete this.promiseCache[o],await((n=(i=a.parser)==null?void 0:i.unload)==null?void 0:n.call(i,u,s,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],MA(DA({},t),{[e.name]:e})),{})}}function Le(r,t){if(Array.isArray(t)){for(const e of t)if(r.startsWith(`data:${e}`))return!0;return!1}return r.startsWith(`data:${t}`)}function Ft(r,t){const e=r.split("?")[0],s=vt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(s):s===t}const OA=".json",BA="application/json",ug={extension:{type:y.LoadParser,priority:wt.Low},name:"loadJson",test(r){return Le(r,BA)||Ft(r,OA)},async load(r){return await(await L.get().fetch(r)).json()}},GA=".txt",IA="text/plain",lg={name:"loadTxt",extension:{type:y.LoadParser,priority:wt.Low,name:"loadTxt"},test(r){return Le(r,IA)||Ft(r,GA)},async load(r){return await(await L.get().fetch(r)).text()}};var FA=Object.defineProperty,UA=Object.defineProperties,kA=Object.getOwnPropertyDescriptors,cg=Object.getOwnPropertySymbols,NA=Object.prototype.hasOwnProperty,LA=Object.prototype.propertyIsEnumerable,hg=(r,t,e)=>t in r?FA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$A=(r,t)=>{for(var e in t||(t={}))NA.call(t,e)&&hg(r,e,t[e]);if(cg)for(var e of cg(t))LA.call(t,e)&&hg(r,e,t[e]);return r},HA=(r,t)=>UA(r,kA(t));const XA=["normal","bold","100","200","300","400","500","600","700","800","900"],zA=[".ttf",".otf",".woff",".woff2"],jA=["font/ttf","font/otf","font/woff","font/woff2"],VA=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function dg(r){const t=vt.extname(r),e=vt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let s=e.length>0;for(const n of e)if(!n.match(VA)){s=!1;break}let i=e.join(" ");return s||(i=`"${i.replace(/[\\"]/g,"\\$&")}"`),i}const WA=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function YA(r){return WA.test(r)?r:encodeURI(r)}const pg={extension:{type:y.LoadParser,priority:wt.Low},name:"loadWebFont",test(r){return Le(r,jA)||Ft(r,zA)},async load(r,t){var e,s,i,n,o,a;const u=L.get().getFontFaceSet();if(u){const l=[],c=(s=(e=t.data)==null?void 0:e.family)!=null?s:dg(r),h=(o=(n=(i=t.data)==null?void 0:i.weights)==null?void 0:n.filter(p=>XA.includes(p)))!=null?o:["normal"],d=(a=t.data)!=null?a:{};for(let p=0;p<h.length;p++){const f=h[p],g=new FontFace(c,`url(${YA(r)})`,HA($A({},d),{weight:f}));await g.load(),u.add(g),l.push(g)}return q.set(`${c}-and-url`,{url:r,fontFaces:l}),l.length===1?l[0]:l}return null},unload(r){(Array.isArray(r)?r:[r]).forEach(t=>{q.remove(t.family),L.get().getFontFaceSet().delete(t)})}};function ji(r,t=1){var e;const s=(e=pe.RETINA_PREFIX)==null?void 0:e.exec(r);return s?parseFloat(s[1]):t}function be(r,t,e){r.label=e,r._sourceOrigin=e;const s=new E({source:r,label:e}),i=()=>{delete t.promiseCache[e],q.has(e)&&q.remove(e)};return s.source.once("destroy",()=>{t.promiseCache[e]&&i()}),s.once("destroy",()=>{r.destroyed||i()}),s}var qA=Object.defineProperty,Vi=Object.getOwnPropertySymbols,fg=Object.prototype.hasOwnProperty,mg=Object.prototype.propertyIsEnumerable,gg=(r,t,e)=>t in r?qA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,KA=(r,t)=>{for(var e in t||(t={}))fg.call(t,e)&&gg(r,e,t[e]);if(Vi)for(var e of Vi(t))mg.call(t,e)&&gg(r,e,t[e]);return r},ZA=(r,t)=>{var e={};for(var s in r)fg.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Vi)for(var s of Vi(r))t.indexOf(s)<0&&mg.call(r,s)&&(e[s]=r[s]);return e};const QA=".svg",JA="image/svg+xml",_g={extension:{type:y.LoadParser,priority:wt.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return Le(r,JA)||Ft(r,QA)},async load(r,t,e){var s;return((s=t.data.parseAsGraphicsContext)!=null?s:this.config.parseAsGraphicsContext)?eS(r):tS(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function tS(r,t,e,s){var i,n,o,a,u;const l=await(await L.get().fetch(r)).blob(),c=URL.createObjectURL(l),h=new Image;h.src=c,h.crossOrigin=s,await h.decode(),URL.revokeObjectURL(c);const d=document.createElement("canvas"),p=d.getContext("2d"),f=((i=t.data)==null?void 0:i.resolution)||ji(r),g=(o=(n=t.data)==null?void 0:n.width)!=null?o:h.width,m=(u=(a=t.data)==null?void 0:a.height)!=null?u:h.height;d.width=g*f,d.height=m*f,p.drawImage(h,0,0,g*f,m*f);const _=t.data,{parseAsGraphicsContext:x}=_,b=ZA(_,["parseAsGraphicsContext"]),v=new Ge(KA({resource:d,alphaMode:"premultiply-alpha-on-upload",resolution:f},b));return be(v,e,r)}async function eS(r){const t=await(await L.get().fetch(r)).text(),e=new gt;return e.svg(t),e}const rS=`(function(){"use strict";const e="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mP8/x8AAwMCAO+ip1sAAAAASUVORK5CYII=";async function a(){try{if(typeof createImageBitmap!="function")return!1;const A=await(await fetch(e)).blob(),t=await createImageBitmap(A);return t.width===1&&t.height===1}catch(A){return!1}}a().then(A=>{self.postMessage(A)})})();
`;let mr=null,du=class{constructor(){mr||(mr=URL.createObjectURL(new Blob([rS],{type:"application/javascript"}))),this.worker=new Worker(mr)}};du.revokeObjectURL=function(){mr&&(URL.revokeObjectURL(mr),mr=null)};const sS='(function(){"use strict";async function s(a,t){const e=await fetch(a);if(!e.ok)throw new Error(`[WorkerManager.loadImageBitmap] Failed to fetch ${a}: ${e.status} ${e.statusText}`);const i=await e.blob();return t==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}self.onmessage=async a=>{try{const t=await s(a.data.data[0],a.data.data[1]);self.postMessage({data:t,uuid:a.data.uuid,id:a.data.id},[t])}catch(t){self.postMessage({error:t,uuid:a.data.uuid,id:a.data.id})}}})();\n';let gr=null,bg=class{constructor(){gr||(gr=URL.createObjectURL(new Blob([sS],{type:"application/javascript"}))),this.worker=new Worker(gr)}};bg.revokeObjectURL=function(){gr&&(URL.revokeObjectURL(gr),gr=null)};let xg=0,pu,iS=class{constructor(){this._initialized=!1,this._createdWorkers=0,this._workerPool=[],this._queue=[],this._resolveHash={}}isImageBitmapSupported(){return this._isImageBitmapSupported!==void 0?this._isImageBitmapSupported:(this._isImageBitmapSupported=new Promise(t=>{const{worker:e}=new du;e.addEventListener("message",s=>{e.terminate(),du.revokeObjectURL(),t(s.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var s;return this._run("loadImageBitmap",[t,(s=e==null?void 0:e.data)==null?void 0:s.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){pu===void 0&&(pu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<pu&&(this._createdWorkers++,t=new bg().worker,t.addEventListener("message",e=>{this._complete(e.data),this._returnWorker(e.target),this._next()})),t}_returnWorker(t){this._workerPool.push(t)}_complete(t){t.error!==void 0?this._resolveHash[t.uuid].reject(t.error):this._resolveHash[t.uuid].resolve(t.data),this._resolveHash[t.uuid]=null}async _run(t,e){await this._initWorkers();const s=new Promise((i,n)=>{this._queue.push({id:t,arguments:e,resolve:i,reject:n})});return this._next(),s}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),s=e.id;this._resolveHash[xg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:xg++,id:s})}};const fu=new iS;var nS=Object.defineProperty,yg=Object.getOwnPropertySymbols,oS=Object.prototype.hasOwnProperty,aS=Object.prototype.propertyIsEnumerable,vg=(r,t,e)=>t in r?nS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uS=(r,t)=>{for(var e in t||(t={}))oS.call(t,e)&&vg(r,e,t[e]);if(yg)for(var e of yg(t))aS.call(t,e)&&vg(r,e,t[e]);return r};const lS=[".jpeg",".jpg",".png",".webp",".avif"],cS=["image/jpeg","image/png","image/webp","image/avif"];async function Tg(r,t){var e;const s=await L.get().fetch(r);if(!s.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${s.status} ${s.statusText}`);const i=await s.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(i,{premultiplyAlpha:"none"}):createImageBitmap(i)}const mu={name:"loadTextures",extension:{type:y.LoadParser,priority:wt.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return Le(r,cS)||Ft(r,lS)},async load(r,t,e){var s;let i=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await fu.isImageBitmapSupported()?i=await fu.loadImageBitmap(r,t):i=await Tg(r,t):i=await new Promise(o=>{i=new Image,i.crossOrigin=this.config.crossOrigin,i.src=r,i.complete?o(i):i.onload=()=>{o(i)}});const n=new Ge(uS({resource:i,alphaMode:"premultiply-alpha-on-upload",resolution:((s=t.data)==null?void 0:s.resolution)||ji(r)},t.data));return be(n,e,r)},unload(r){r.destroy(!0)}};var hS=Object.defineProperty,dS=Object.defineProperties,pS=Object.getOwnPropertyDescriptors,Ag=Object.getOwnPropertySymbols,fS=Object.prototype.hasOwnProperty,mS=Object.prototype.propertyIsEnumerable,Sg=(r,t,e)=>t in r?hS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gu=(r,t)=>{for(var e in t||(t={}))fS.call(t,e)&&Sg(r,e,t[e]);if(Ag)for(var e of Ag(t))mS.call(t,e)&&Sg(r,e,t[e]);return r},Eg=(r,t)=>dS(r,pS(t));const wg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],gS=wg.map(r=>`video/${r.substring(1)}`);function Cg(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=Pg(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Rg(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",s),r.addEventListener("error",i),r.load();function s(){n(),t()}function i(o){n(),e(o)}function n(){r.removeEventListener("canplaythrough",s),r.removeEventListener("error",i)}})}function Pg(r,t=globalThis.location){if(r.startsWith("data:"))return"";t=t||globalThis.location;const e=new URL(r,document.baseURI);return e.hostname!==t.hostname||e.port!==t.port||e.protocol!==t.protocol?"anonymous":""}const Dg={name:"loadVideo",extension:{type:y.LoadParser,name:"loadVideo"},test(r){const t=Le(r,gS),e=Ft(r,wg);return t||e},async load(r,t,e){var s,i;const n=gu(Eg(gu({},Zr.defaultOptions),{resolution:((s=t.data)==null?void 0:s.resolution)||ji(r),alphaMode:((i=t.data)==null?void 0:i.alphaMode)||await Po()}),t.data),o=document.createElement("video"),a={preload:n.autoLoad!==!1?"auto":void 0,"webkit-playsinline":n.playsinline!==!1?"":void 0,playsinline:n.playsinline!==!1?"":void 0,muted:n.muted===!0?"":void 0,loop:n.loop===!0?"":void 0,autoplay:n.autoPlay!==!1?"":void 0};Object.keys(a).forEach(c=>{const h=a[c];h!==void 0&&o.setAttribute(c,h)}),n.muted===!0&&(o.muted=!0),Cg(o,r,n.crossorigin);const u=document.createElement("source");let l;if(r.startsWith("data:"))l=r.slice(5,r.indexOf(";"));else if(!r.startsWith("blob:")){const c=r.split("?")[0].slice(r.lastIndexOf(".")+1).toLowerCase();l=Zr.MIME_TYPES[c]||`video/${c}`}return u.src=r,l&&(u.type=l),new Promise(c=>{const h=async()=>{const d=new Zr(Eg(gu({},n),{resource:o}));o.removeEventListener("canplay",h),t.data.preload&&await Rg(o),c(be(d,e,r))};o.addEventListener("canplay",h),o.appendChild(u)})},unload(r){r.destroy(!0)}},_u={extension:{type:y.ResolveParser,name:"resolveTexture"},test:mu.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=pe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},Mg={extension:{type:y.ResolveParser,priority:-2,name:"resolveJson"},test:r=>pe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:_u.parse};class Og{constructor(){this._detections=[],this._initialized=!1,this.resolver=new pe,this.loader=new ag,this.cache=q,this._backgroundLoader=new Km(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,s,i;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let u=t.manifest;typeof u=="string"&&(u=await this.load(u)),this.resolver.addManifest(u)}const n=(s=(e=t.texturePreference)==null?void 0:e.resolution)!=null?s:1,o=typeof n=="number"?[n]:n,a=await this._detectFormats({preferredFormats:(i=t.texturePreference)==null?void 0:i.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:a,resolution:o}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const s=Xr(t),i=Bt(t).map(a=>{if(typeof a!="string"){const u=this.resolver.getAlias(a);return u.some(l=>!this.resolver.hasKey(l))&&this.add(a),Array.isArray(u)?u[0]:u}return this.resolver.hasKey(a)||this.add({alias:a,src:a}),a}),n=this.resolver.resolve(i),o=await this._mapLoadToResolve(n,e);return s?o[i[0]]:o}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let s=!1;typeof t=="string"&&(s=!0,t=[t]);const i=this.resolver.resolveBundle(t),n={},o=Object.keys(i);let a=0,u=0;const l=()=>{e==null||e(++a/u)},c=o.map(h=>{const d=i[h];return u+=Object.keys(d).length,this._mapLoadToResolve(d,l).then(p=>{n[h]=p})});return await Promise.all(c),s?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(s=>{this._backgroundLoader.add(Object.values(s))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return q.get(t);const e={};for(let s=0;s<t.length;s++)e[s]=q.get(t[s]);return e}async _mapLoadToResolve(t,e){const s=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const i=await this.loader.load(s,e);this._backgroundLoader.active=!0;const n={};return s.forEach(o=>{const a=i[o.src],u=[o.src];o.alias&&u.push(...o.alias),u.forEach(l=>{n[l]=a}),q.set(u,a)}),n}async unload(t){this._initialized||await this.init();const e=Bt(t).map(i=>typeof i!="string"?i.src:i),s=this.resolver.resolve(e);await this._unloadFromResolved(s)}async unloadBundle(t){this._initialized||await this.init(),t=Bt(t);const e=this.resolver.resolveBundle(t),s=Object.keys(e).map(i=>this._unloadFromResolved(e[i]));await Promise.all(s)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(s=>{q.remove(s.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const s of t.detections)t.skipDetections||await s.test()?e=await s.add(e):t.skipDetections||(e=await s.remove(e));return e=e.filter((s,i)=>e.indexOf(s)===i),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(s=>s in t).forEach(s=>{e.config[s]=t[s]})})}}const vs=new Og;k.handleByList(y.LoadParser,vs.loader.parsers).handleByList(y.ResolveParser,vs.resolver.parsers).handleByList(y.CacheParser,vs.cache.parsers).handleByList(y.DetectionParser,vs.detections),k.add(Zm,tg,Qm,ig,eg,rg,sg,ug,lg,pg,_g,mu,Dg,qm,Ym,_u,Mg);const Bg={loader:y.LoadParser,resolver:y.ResolveParser,cache:y.CacheParser,detection:y.DetectionParser};k.handle(y.Asset,r=>{const t=r.ref;Object.entries(Bg).filter(([e])=>!!t[e]).forEach(([e,s])=>{var i;return k.add(Object.assign(t[e],{extension:(i=t[e].extension)!=null?i:s}))})},r=>{const t=r.ref;Object.keys(Bg).filter(e=>!!t[e]).forEach(e=>k.remove(t[e]))});const _S={extension:{type:y.DetectionParser,priority:3},test:async()=>!!(await bs()||_s()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};class Ts extends tt{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let Wi;function bu(){if(Wi)return Wi;const r=document.createElement("canvas").getContext("webgl");return r?(Wi=[...r.getExtension("EXT_texture_compression_bptc")?["bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc")?["bc1-rgba-unorm","bc2-rgba-unorm","bc3-rgba-unorm"]:[],...r.getExtension("WEBGL_compressed_texture_s3tc_srgb")?["bc1-rgba-unorm-srgb","bc2-rgba-unorm-srgb","bc3-rgba-unorm-srgb"]:[],...r.getExtension("EXT_texture_compression_rgtc")?["bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm"]:[],...r.getExtension("WEBGL_compressed_texture_etc")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","eac-r11unorm","eac-rg11unorm"]:[],...r.getExtension("WEBGL_compressed_texture_astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Wi):[]}let Yi;async function xu(){if(Yi)return Yi;const r=await L.get().getNavigator().gpu.requestAdapter();return Yi=[...r.features.has("texture-compression-bc")?["bc1-rgba-unorm","bc1-rgba-unorm-srgb","bc2-rgba-unorm","bc2-rgba-unorm-srgb","bc3-rgba-unorm","bc3-rgba-unorm-srgb","bc4-r-unorm","bc4-r-snorm","bc5-rg-unorm","bc5-rg-snorm","bc6h-rgb-ufloat","bc6h-rgb-float","bc7-rgba-unorm","bc7-rgba-unorm-srgb"]:[],...r.features.has("texture-compression-etc2")?["etc2-rgb8unorm","etc2-rgb8unorm-srgb","etc2-rgb8a1unorm","etc2-rgb8a1unorm-srgb","etc2-rgba8unorm","etc2-rgba8unorm-srgb","eac-r11unorm","eac-r11snorm","eac-rg11unorm","eac-rg11snorm"]:[],...r.features.has("texture-compression-astc")?["astc-4x4-unorm","astc-4x4-unorm-srgb","astc-5x4-unorm","astc-5x4-unorm-srgb","astc-5x5-unorm","astc-5x5-unorm-srgb","astc-6x5-unorm","astc-6x5-unorm-srgb","astc-6x6-unorm","astc-6x6-unorm-srgb","astc-8x5-unorm","astc-8x5-unorm-srgb","astc-8x6-unorm","astc-8x6-unorm-srgb","astc-8x8-unorm","astc-8x8-unorm-srgb","astc-10x5-unorm","astc-10x5-unorm-srgb","astc-10x6-unorm","astc-10x6-unorm-srgb","astc-10x8-unorm","astc-10x8-unorm-srgb","astc-10x10-unorm","astc-10x10-unorm-srgb","astc-12x10-unorm","astc-12x10-unorm-srgb","astc-12x12-unorm","astc-12x12-unorm-srgb"]:[]],Yi}let yu;async function vu(){return yu!==void 0||(yu=await(async()=>{const r=await bs(),t=_s();if(r&&t){const e=await xu(),s=bu();return e.filter(i=>s.includes(i))}else{if(r)return await xu();if(t)return bu()}return[]})()),yu}const Gg=["r8unorm","r8snorm","r8uint","r8sint","r16uint","r16sint","r16float","rg8unorm","rg8snorm","rg8uint","rg8sint","r32uint","r32sint","r32float","rg16uint","rg16sint","rg16float","rgba8unorm","rgba8unorm-srgb","rgba8snorm","rgba8uint","rgba8sint","bgra8unorm","bgra8unorm-srgb","rgb9e5ufloat","rgb10a2unorm","rg11b10ufloat","rg32uint","rg32sint","rg32float","rgba16uint","rgba16sint","rgba16float","rgba32uint","rgba32sint","rgba32float","stencil8","depth16unorm","depth24plus","depth24plus-stencil8","depth32float","depth32float-stencil8"];let qi;async function As(){if(qi!==void 0)return qi;const r=await vu();return qi=[...Gg,...r],qi}const bS='(function(){"use strict";function g(r,a){const t=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const m=[];for(let e=0;e<s;++e)for(let o=0;o<t;++o){const B=r.getImageTranscodedSizeInBytes(o,e,a),f=new Uint8Array(B);if(!r.transcodeImage(f,o,e,a,1,0))throw new Error("transcodeImage failed");m.push(f)}return m}const w={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function d(r){const a=w[r];if(a)return a;throw new Error(`Unsupported transcoderFormat: ${r}`)}const n={jsUrl:"basis/basis_transcoder.js",wasmUrl:"basis/basis_transcoder.wasm"};let u,i,c;async function l(){if(!c){const r=new URL(n.jsUrl,location.origin).href,a=new URL(n.wasmUrl,location.origin).href;importScripts(r),c=new Promise(t=>{BASIS({locateFile:s=>a}).then(s=>{s.initializeBasis(),t(s.BasisFile)})})}return c}async function b(r,a){const t=await fetch(r);if(t.ok){const s=await t.arrayBuffer();return new a(new Uint8Array(s))}throw new Error(`Failed to load Basis texture: ${r}`)}const h=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function p(r){const a=await l(),t=await b(r,a),s=g(t,u);return{width:t.getImageWidth(0,0),height:t.getImageHeight(0,0),format:i,resource:s,alphaMode:"no-premultiply-alpha"}}async function y(r,a,t){r&&(n.jsUrl=r),a&&(n.wasmUrl=a),i=h.filter(s=>t.includes(s))[0],u=d(i),await l()}const U={init:async r=>{const{jsUrl:a,wasmUrl:t,supportedTextures:s}=r;await y(a,t,s)},load:async r=>{var a;try{const t=await p(r.url);return{type:"load",url:r.url,success:!0,textureOptions:t,transferables:(a=t.resource)==null?void 0:a.map(s=>s.buffer)}}catch(t){throw t}}};self.onmessage=async r=>{const a=r.data,t=await U[a.type](a);t&&self.postMessage(t,t.transferables)}})();\n';let _r=null,Ig=class{constructor(){_r||(_r=URL.createObjectURL(new Blob([bS],{type:"application/javascript"}))),this.worker=new Worker(_r)}};Ig.revokeObjectURL=function(){_r&&(URL.revokeObjectURL(_r),_r=null)};const Ki={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};function xS(r){Object.assign(Ki,r)}let Ss;const Fg={};function yS(r){return Ss||(Ss=new Ig().worker,Ss.onmessage=t=>{const{success:e,url:s,textureOptions:i}=t.data;e||console.warn("Failed to load Basis texture",s),Fg[s](i)},Ss.postMessage({type:"init",jsUrl:Ki.jsUrl,wasmUrl:Ki.wasmUrl,supportedTextures:r})),Ss}function Ug(r,t){const e=yS(t);return new Promise(s=>{Fg[r]=s,e.postMessage({type:"load",url:r})})}const vS={extension:{type:y.LoadParser,priority:wt.High,name:"loadBasis"},name:"loadBasis",test(r){return Ft(r,[".basis"])},async load(r,t,e){const s=await As(),i=await Ug(r,s),n=new Ts(i);return be(n,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function TS(r,t){const e=r.getNumImages(),s=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const i=[];for(let n=0;n<s;++n)for(let o=0;o<e;++o){const a=r.getImageTranscodedSizeInBytes(o,n,t),u=new Uint8Array(a);if(!r.transcodeImage(u,o,n,t,1,0))throw new Error("transcodeImage failed");i.push(u)}return i}const AS={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function SS(r){const t=AS[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const ES={MAGIC:0,SIZE:1,FLAGS:2,HEIGHT:3,WIDTH:4,MIPMAP_COUNT:7,PIXEL_FORMAT:19,PF_FLAGS:20,FOURCC:21,RGB_BITCOUNT:22,R_BIT_MASK:23,G_BIT_MASK:24,B_BIT_MASK:25,A_BIT_MASK:26},wS={DXGI_FORMAT:0,RESOURCE_DIMENSION:1,MISC_FLAG:2,ARRAY_SIZE:3,MISC_FLAGS2:4};var Tu=(r=>(r[r.DXGI_FORMAT_UNKNOWN=0]="DXGI_FORMAT_UNKNOWN",r[r.DXGI_FORMAT_R32G32B32A32_TYPELESS=1]="DXGI_FORMAT_R32G32B32A32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32A32_FLOAT=2]="DXGI_FORMAT_R32G32B32A32_FLOAT",r[r.DXGI_FORMAT_R32G32B32A32_UINT=3]="DXGI_FORMAT_R32G32B32A32_UINT",r[r.DXGI_FORMAT_R32G32B32A32_SINT=4]="DXGI_FORMAT_R32G32B32A32_SINT",r[r.DXGI_FORMAT_R32G32B32_TYPELESS=5]="DXGI_FORMAT_R32G32B32_TYPELESS",r[r.DXGI_FORMAT_R32G32B32_FLOAT=6]="DXGI_FORMAT_R32G32B32_FLOAT",r[r.DXGI_FORMAT_R32G32B32_UINT=7]="DXGI_FORMAT_R32G32B32_UINT",r[r.DXGI_FORMAT_R32G32B32_SINT=8]="DXGI_FORMAT_R32G32B32_SINT",r[r.DXGI_FORMAT_R16G16B16A16_TYPELESS=9]="DXGI_FORMAT_R16G16B16A16_TYPELESS",r[r.DXGI_FORMAT_R16G16B16A16_FLOAT=10]="DXGI_FORMAT_R16G16B16A16_FLOAT",r[r.DXGI_FORMAT_R16G16B16A16_UNORM=11]="DXGI_FORMAT_R16G16B16A16_UNORM",r[r.DXGI_FORMAT_R16G16B16A16_UINT=12]="DXGI_FORMAT_R16G16B16A16_UINT",r[r.DXGI_FORMAT_R16G16B16A16_SNORM=13]="DXGI_FORMAT_R16G16B16A16_SNORM",r[r.DXGI_FORMAT_R16G16B16A16_SINT=14]="DXGI_FORMAT_R16G16B16A16_SINT",r[r.DXGI_FORMAT_R32G32_TYPELESS=15]="DXGI_FORMAT_R32G32_TYPELESS",r[r.DXGI_FORMAT_R32G32_FLOAT=16]="DXGI_FORMAT_R32G32_FLOAT",r[r.DXGI_FORMAT_R32G32_UINT=17]="DXGI_FORMAT_R32G32_UINT",r[r.DXGI_FORMAT_R32G32_SINT=18]="DXGI_FORMAT_R32G32_SINT",r[r.DXGI_FORMAT_R32G8X24_TYPELESS=19]="DXGI_FORMAT_R32G8X24_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT_S8X24_UINT=20]="DXGI_FORMAT_D32_FLOAT_S8X24_UINT",r[r.DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS=21]="DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS",r[r.DXGI_FORMAT_X32_TYPELESS_G8X24_UINT=22]="DXGI_FORMAT_X32_TYPELESS_G8X24_UINT",r[r.DXGI_FORMAT_R10G10B10A2_TYPELESS=23]="DXGI_FORMAT_R10G10B10A2_TYPELESS",r[r.DXGI_FORMAT_R10G10B10A2_UNORM=24]="DXGI_FORMAT_R10G10B10A2_UNORM",r[r.DXGI_FORMAT_R10G10B10A2_UINT=25]="DXGI_FORMAT_R10G10B10A2_UINT",r[r.DXGI_FORMAT_R11G11B10_FLOAT=26]="DXGI_FORMAT_R11G11B10_FLOAT",r[r.DXGI_FORMAT_R8G8B8A8_TYPELESS=27]="DXGI_FORMAT_R8G8B8A8_TYPELESS",r[r.DXGI_FORMAT_R8G8B8A8_UNORM=28]="DXGI_FORMAT_R8G8B8A8_UNORM",r[r.DXGI_FORMAT_R8G8B8A8_UNORM_SRGB=29]="DXGI_FORMAT_R8G8B8A8_UNORM_SRGB",r[r.DXGI_FORMAT_R8G8B8A8_UINT=30]="DXGI_FORMAT_R8G8B8A8_UINT",r[r.DXGI_FORMAT_R8G8B8A8_SNORM=31]="DXGI_FORMAT_R8G8B8A8_SNORM",r[r.DXGI_FORMAT_R8G8B8A8_SINT=32]="DXGI_FORMAT_R8G8B8A8_SINT",r[r.DXGI_FORMAT_R16G16_TYPELESS=33]="DXGI_FORMAT_R16G16_TYPELESS",r[r.DXGI_FORMAT_R16G16_FLOAT=34]="DXGI_FORMAT_R16G16_FLOAT",r[r.DXGI_FORMAT_R16G16_UNORM=35]="DXGI_FORMAT_R16G16_UNORM",r[r.DXGI_FORMAT_R16G16_UINT=36]="DXGI_FORMAT_R16G16_UINT",r[r.DXGI_FORMAT_R16G16_SNORM=37]="DXGI_FORMAT_R16G16_SNORM",r[r.DXGI_FORMAT_R16G16_SINT=38]="DXGI_FORMAT_R16G16_SINT",r[r.DXGI_FORMAT_R32_TYPELESS=39]="DXGI_FORMAT_R32_TYPELESS",r[r.DXGI_FORMAT_D32_FLOAT=40]="DXGI_FORMAT_D32_FLOAT",r[r.DXGI_FORMAT_R32_FLOAT=41]="DXGI_FORMAT_R32_FLOAT",r[r.DXGI_FORMAT_R32_UINT=42]="DXGI_FORMAT_R32_UINT",r[r.DXGI_FORMAT_R32_SINT=43]="DXGI_FORMAT_R32_SINT",r[r.DXGI_FORMAT_R24G8_TYPELESS=44]="DXGI_FORMAT_R24G8_TYPELESS",r[r.DXGI_FORMAT_D24_UNORM_S8_UINT=45]="DXGI_FORMAT_D24_UNORM_S8_UINT",r[r.DXGI_FORMAT_R24_UNORM_X8_TYPELESS=46]="DXGI_FORMAT_R24_UNORM_X8_TYPELESS",r[r.DXGI_FORMAT_X24_TYPELESS_G8_UINT=47]="DXGI_FORMAT_X24_TYPELESS_G8_UINT",r[r.DXGI_FORMAT_R8G8_TYPELESS=48]="DXGI_FORMAT_R8G8_TYPELESS",r[r.DXGI_FORMAT_R8G8_UNORM=49]="DXGI_FORMAT_R8G8_UNORM",r[r.DXGI_FORMAT_R8G8_UINT=50]="DXGI_FORMAT_R8G8_UINT",r[r.DXGI_FORMAT_R8G8_SNORM=51]="DXGI_FORMAT_R8G8_SNORM",r[r.DXGI_FORMAT_R8G8_SINT=52]="DXGI_FORMAT_R8G8_SINT",r[r.DXGI_FORMAT_R16_TYPELESS=53]="DXGI_FORMAT_R16_TYPELESS",r[r.DXGI_FORMAT_R16_FLOAT=54]="DXGI_FORMAT_R16_FLOAT",r[r.DXGI_FORMAT_D16_UNORM=55]="DXGI_FORMAT_D16_UNORM",r[r.DXGI_FORMAT_R16_UNORM=56]="DXGI_FORMAT_R16_UNORM",r[r.DXGI_FORMAT_R16_UINT=57]="DXGI_FORMAT_R16_UINT",r[r.DXGI_FORMAT_R16_SNORM=58]="DXGI_FORMAT_R16_SNORM",r[r.DXGI_FORMAT_R16_SINT=59]="DXGI_FORMAT_R16_SINT",r[r.DXGI_FORMAT_R8_TYPELESS=60]="DXGI_FORMAT_R8_TYPELESS",r[r.DXGI_FORMAT_R8_UNORM=61]="DXGI_FORMAT_R8_UNORM",r[r.DXGI_FORMAT_R8_UINT=62]="DXGI_FORMAT_R8_UINT",r[r.DXGI_FORMAT_R8_SNORM=63]="DXGI_FORMAT_R8_SNORM",r[r.DXGI_FORMAT_R8_SINT=64]="DXGI_FORMAT_R8_SINT",r[r.DXGI_FORMAT_A8_UNORM=65]="DXGI_FORMAT_A8_UNORM",r[r.DXGI_FORMAT_R1_UNORM=66]="DXGI_FORMAT_R1_UNORM",r[r.DXGI_FORMAT_R9G9B9E5_SHAREDEXP=67]="DXGI_FORMAT_R9G9B9E5_SHAREDEXP",r[r.DXGI_FORMAT_R8G8_B8G8_UNORM=68]="DXGI_FORMAT_R8G8_B8G8_UNORM",r[r.DXGI_FORMAT_G8R8_G8B8_UNORM=69]="DXGI_FORMAT_G8R8_G8B8_UNORM",r[r.DXGI_FORMAT_BC1_TYPELESS=70]="DXGI_FORMAT_BC1_TYPELESS",r[r.DXGI_FORMAT_BC1_UNORM=71]="DXGI_FORMAT_BC1_UNORM",r[r.DXGI_FORMAT_BC1_UNORM_SRGB=72]="DXGI_FORMAT_BC1_UNORM_SRGB",r[r.DXGI_FORMAT_BC2_TYPELESS=73]="DXGI_FORMAT_BC2_TYPELESS",r[r.DXGI_FORMAT_BC2_UNORM=74]="DXGI_FORMAT_BC2_UNORM",r[r.DXGI_FORMAT_BC2_UNORM_SRGB=75]="DXGI_FORMAT_BC2_UNORM_SRGB",r[r.DXGI_FORMAT_BC3_TYPELESS=76]="DXGI_FORMAT_BC3_TYPELESS",r[r.DXGI_FORMAT_BC3_UNORM=77]="DXGI_FORMAT_BC3_UNORM",r[r.DXGI_FORMAT_BC3_UNORM_SRGB=78]="DXGI_FORMAT_BC3_UNORM_SRGB",r[r.DXGI_FORMAT_BC4_TYPELESS=79]="DXGI_FORMAT_BC4_TYPELESS",r[r.DXGI_FORMAT_BC4_UNORM=80]="DXGI_FORMAT_BC4_UNORM",r[r.DXGI_FORMAT_BC4_SNORM=81]="DXGI_FORMAT_BC4_SNORM",r[r.DXGI_FORMAT_BC5_TYPELESS=82]="DXGI_FORMAT_BC5_TYPELESS",r[r.DXGI_FORMAT_BC5_UNORM=83]="DXGI_FORMAT_BC5_UNORM",r[r.DXGI_FORMAT_BC5_SNORM=84]="DXGI_FORMAT_BC5_SNORM",r[r.DXGI_FORMAT_B5G6R5_UNORM=85]="DXGI_FORMAT_B5G6R5_UNORM",r[r.DXGI_FORMAT_B5G5R5A1_UNORM=86]="DXGI_FORMAT_B5G5R5A1_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_UNORM=87]="DXGI_FORMAT_B8G8R8A8_UNORM",r[r.DXGI_FORMAT_B8G8R8X8_UNORM=88]="DXGI_FORMAT_B8G8R8X8_UNORM",r[r.DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM=89]="DXGI_FORMAT_R10G10B10_XR_BIAS_A2_UNORM",r[r.DXGI_FORMAT_B8G8R8A8_TYPELESS=90]="DXGI_FORMAT_B8G8R8A8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8A8_UNORM_SRGB=91]="DXGI_FORMAT_B8G8R8A8_UNORM_SRGB",r[r.DXGI_FORMAT_B8G8R8X8_TYPELESS=92]="DXGI_FORMAT_B8G8R8X8_TYPELESS",r[r.DXGI_FORMAT_B8G8R8X8_UNORM_SRGB=93]="DXGI_FORMAT_B8G8R8X8_UNORM_SRGB",r[r.DXGI_FORMAT_BC6H_TYPELESS=94]="DXGI_FORMAT_BC6H_TYPELESS",r[r.DXGI_FORMAT_BC6H_UF16=95]="DXGI_FORMAT_BC6H_UF16",r[r.DXGI_FORMAT_BC6H_SF16=96]="DXGI_FORMAT_BC6H_SF16",r[r.DXGI_FORMAT_BC7_TYPELESS=97]="DXGI_FORMAT_BC7_TYPELESS",r[r.DXGI_FORMAT_BC7_UNORM=98]="DXGI_FORMAT_BC7_UNORM",r[r.DXGI_FORMAT_BC7_UNORM_SRGB=99]="DXGI_FORMAT_BC7_UNORM_SRGB",r[r.DXGI_FORMAT_AYUV=100]="DXGI_FORMAT_AYUV",r[r.DXGI_FORMAT_Y410=101]="DXGI_FORMAT_Y410",r[r.DXGI_FORMAT_Y416=102]="DXGI_FORMAT_Y416",r[r.DXGI_FORMAT_NV12=103]="DXGI_FORMAT_NV12",r[r.DXGI_FORMAT_P010=104]="DXGI_FORMAT_P010",r[r.DXGI_FORMAT_P016=105]="DXGI_FORMAT_P016",r[r.DXGI_FORMAT_420_OPAQUE=106]="DXGI_FORMAT_420_OPAQUE",r[r.DXGI_FORMAT_YUY2=107]="DXGI_FORMAT_YUY2",r[r.DXGI_FORMAT_Y210=108]="DXGI_FORMAT_Y210",r[r.DXGI_FORMAT_Y216=109]="DXGI_FORMAT_Y216",r[r.DXGI_FORMAT_NV11=110]="DXGI_FORMAT_NV11",r[r.DXGI_FORMAT_AI44=111]="DXGI_FORMAT_AI44",r[r.DXGI_FORMAT_IA44=112]="DXGI_FORMAT_IA44",r[r.DXGI_FORMAT_P8=113]="DXGI_FORMAT_P8",r[r.DXGI_FORMAT_A8P8=114]="DXGI_FORMAT_A8P8",r[r.DXGI_FORMAT_B4G4R4A4_UNORM=115]="DXGI_FORMAT_B4G4R4A4_UNORM",r[r.DXGI_FORMAT_P208=116]="DXGI_FORMAT_P208",r[r.DXGI_FORMAT_V208=117]="DXGI_FORMAT_V208",r[r.DXGI_FORMAT_V408=118]="DXGI_FORMAT_V408",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE=119]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIN_MIP_OPAQUE",r[r.DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE=120]="DXGI_FORMAT_SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUE",r[r.DXGI_FORMAT_FORCE_UINT=121]="DXGI_FORMAT_FORCE_UINT",r))(Tu||{}),Au=(r=>(r[r.DDS_DIMENSION_TEXTURE1D=2]="DDS_DIMENSION_TEXTURE1D",r[r.DDS_DIMENSION_TEXTURE2D=3]="DDS_DIMENSION_TEXTURE2D",r[r.DDS_DIMENSION_TEXTURE3D=6]="DDS_DIMENSION_TEXTURE3D",r))(Au||{});function ht(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var St=(r=>(r[r.UNKNOWN=0]="UNKNOWN",r[r.R8G8B8=20]="R8G8B8",r[r.A8R8G8B8=21]="A8R8G8B8",r[r.X8R8G8B8=22]="X8R8G8B8",r[r.R5G6B5=23]="R5G6B5",r[r.X1R5G5B5=24]="X1R5G5B5",r[r.A1R5G5B5=25]="A1R5G5B5",r[r.A4R4G4B4=26]="A4R4G4B4",r[r.R3G3B2=27]="R3G3B2",r[r.A8=28]="A8",r[r.A8R3G3B2=29]="A8R3G3B2",r[r.X4R4G4B4=30]="X4R4G4B4",r[r.A2B10G10R10=31]="A2B10G10R10",r[r.A8B8G8R8=32]="A8B8G8R8",r[r.X8B8G8R8=33]="X8B8G8R8",r[r.G16R16=34]="G16R16",r[r.A2R10G10B10=35]="A2R10G10B10",r[r.A16B16G16R16=36]="A16B16G16R16",r[r.A8P8=40]="A8P8",r[r.P8=41]="P8",r[r.L8=50]="L8",r[r.A8L8=51]="A8L8",r[r.A4L4=52]="A4L4",r[r.V8U8=60]="V8U8",r[r.L6V5U5=61]="L6V5U5",r[r.X8L8V8U8=62]="X8L8V8U8",r[r.Q8W8V8U8=63]="Q8W8V8U8",r[r.V16U16=64]="V16U16",r[r.A2W10V10U10=67]="A2W10V10U10",r[r.Q16W16V16U16=110]="Q16W16V16U16",r[r.R16F=111]="R16F",r[r.G16R16F=112]="G16R16F",r[r.A16B16G16R16F=113]="A16B16G16R16F",r[r.R32F=114]="R32F",r[r.G32R32F=115]="G32R32F",r[r.A32B32G32R32F=116]="A32B32G32R32F",r[r.UYVY=ht("UYVY")]="UYVY",r[r.R8G8_B8G8=ht("RGBG")]="R8G8_B8G8",r[r.YUY2=ht("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=ht("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=ht("DXT1")]="DXT1",r[r.DXT2=ht("DXT2")]="DXT2",r[r.DXT3=ht("DXT3")]="DXT3",r[r.DXT4=ht("DXT4")]="DXT4",r[r.DXT5=ht("DXT5")]="DXT5",r[r.ATI1=ht("ATI1")]="ATI1",r[r.AT1N=ht("AT1N")]="AT1N",r[r.ATI2=ht("ATI2")]="ATI2",r[r.AT2N=ht("AT2N")]="AT2N",r[r.BC4U=ht("BC4U")]="BC4U",r[r.BC4S=ht("BC4S")]="BC4S",r[r.BC5U=ht("BC5U")]="BC5U",r[r.BC5S=ht("BC5S")]="BC5S",r[r.DX10=ht("DX10")]="DX10",r))(St||{});const Su={[St.DXT1]:"bc1-rgba-unorm",[St.DXT2]:"bc2-rgba-unorm",[St.DXT3]:"bc2-rgba-unorm",[St.DXT4]:"bc3-rgba-unorm",[St.DXT5]:"bc3-rgba-unorm",[St.ATI1]:"bc4-r-unorm",[St.BC4U]:"bc4-r-unorm",[St.BC4S]:"bc4-r-snorm",[St.ATI2]:"bc5-rg-unorm",[St.BC5U]:"bc5-rg-unorm",[St.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},Et={70:"bc1-rgba-unorm",71:"bc1-rgba-unorm",72:"bc1-rgba-unorm-srgb",73:"bc2-rgba-unorm",74:"bc2-rgba-unorm",75:"bc2-rgba-unorm-srgb",76:"bc3-rgba-unorm",77:"bc3-rgba-unorm",78:"bc3-rgba-unorm-srgb",79:"bc4-r-unorm",80:"bc4-r-unorm",81:"bc4-r-snorm",82:"bc5-rg-unorm",83:"bc5-rg-unorm",84:"bc5-rg-snorm",94:"bc6h-rgb-ufloat",95:"bc6h-rgb-ufloat",96:"bc6h-rgb-float",97:"bc7-rgba-unorm",98:"bc7-rgba-unorm",99:"bc7-rgba-unorm-srgb",28:"rgba8unorm",29:"rgba8unorm-srgb",87:"bgra8unorm",91:"bgra8unorm-srgb",41:"r32float",49:"rg8unorm",56:"r16uint",61:"r8unorm",24:"rgb10a2unorm",11:"rgba16uint",13:"rgba16sint",10:"rgba16float",54:"r16float",34:"rg16float",16:"rg32float",2:"rgba32float"},F={MAGIC_VALUE:542327876,MAGIC_SIZE:4,HEADER_SIZE:124,HEADER_DX10_SIZE:20,PIXEL_FORMAT_FLAGS:{ALPHAPIXELS:1,ALPHA:2,FOURCC:4,RGB:64,RGBA:65,YUV:512,LUMINANCE:131072,LUMINANCEA:131073},RESOURCE_MISC_TEXTURECUBE:4,HEADER_FIELDS:ES,HEADER_DX10_FIELDS:wS,DXGI_FORMAT:Tu,D3D10_RESOURCE_DIMENSION:Au,D3DFMT:St},kg={"bc1-rgba-unorm":8,"bc1-rgba-unorm-srgb":8,"bc2-rgba-unorm":16,"bc2-rgba-unorm-srgb":16,"bc3-rgba-unorm":16,"bc3-rgba-unorm-srgb":16,"bc4-r-unorm":8,"bc4-r-snorm":8,"bc5-rg-unorm":16,"bc5-rg-snorm":16,"bc6h-rgb-ufloat":16,"bc6h-rgb-float":16,"bc7-rgba-unorm":16,"bc7-rgba-unorm-srgb":16};function Ng(r,t){const{format:e,fourCC:s,width:i,height:n,dataOffset:o,mipmapCount:a}=RS(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${s} ${e}, supported: ${t}`);if(a<=1)return{format:e,width:i,height:n,resource:[new Uint8Array(r,o)],alphaMode:"no-premultiply-alpha"};const u=CS(e,i,n,o,a,r);return{format:e,width:i,height:n,resource:u,alphaMode:"no-premultiply-alpha"}}function CS(r,t,e,s,i,n){const o=[],a=kg[r];let u=t,l=e,c=s;for(let h=0;h<i;++h){const d=a?Math.max(4,u)/4*Math.max(4,l)/4*a:u*l*4,p=new Uint8Array(n,c,d);o.push(p),c+=d,u=Math.max(u>>1,1),l=Math.max(l>>1,1)}return o}function RS(r){const t=new Uint32Array(r,0,F.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[F.HEADER_FIELDS.MAGIC]!==F.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[F.HEADER_FIELDS.HEIGHT],s=t[F.HEADER_FIELDS.WIDTH],i=Math.max(1,t[F.HEADER_FIELDS.MIPMAP_COUNT]),n=t[F.HEADER_FIELDS.PF_FLAGS],o=t[F.HEADER_FIELDS.FOURCC],a=PS(t,n,o,r),u=F.MAGIC_SIZE+F.HEADER_SIZE+(o===F.D3DFMT.DX10?F.HEADER_DX10_SIZE:0);return{format:a,fourCC:o,width:s,height:e,dataOffset:u,mipmapCount:i}}function PS(r,t,e,s){if(t&F.PIXEL_FORMAT_FLAGS.FOURCC){if(e===F.D3DFMT.DX10){const i=new Uint32Array(s,F.MAGIC_SIZE+F.HEADER_SIZE,F.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(i[F.HEADER_DX10_FIELDS.MISC_FLAG]===F.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(i[F.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===F.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const n=i[F.HEADER_DX10_FIELDS.DXGI_FORMAT];if(n in Et)return Et[n];throw new Error(`DDSParser cannot parse texture data with DXGI format ${n}`)}if(e in Su)return Su[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&F.PIXEL_FORMAT_FLAGS.RGB||t&F.PIXEL_FORMAT_FLAGS.RGBA)return DS(r);throw t&F.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&F.PIXEL_FORMAT_FLAGS.LUMINANCE||t&F.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&F.PIXEL_FORMAT_FLAGS.ALPHA||t&F.PIXEL_FORMAT_FLAGS.ALPHAPIXELS?new Error("DDSParser does not support single-channel (alpha) texture data!"):new Error("DDSParser failed to load a texture file due to an unknown reason!")}function DS(r){const t=r[F.HEADER_FIELDS.RGB_BITCOUNT],e=r[F.HEADER_FIELDS.R_BIT_MASK],s=r[F.HEADER_FIELDS.G_BIT_MASK],i=r[F.HEADER_FIELDS.B_BIT_MASK],n=r[F.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&s===65280&&i===16711680&&n===4278190080)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&s===65280&&i===255&&n===4278190080)return Et[F.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&s===1047552&&i===1023&&n===3221225472)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&s===4294901760&&i===0&&n===0)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&s===0&&i===0&&n===0)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&s===992&&i===31&&n===32768)return Et[F.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&s===2016&&i===31&&n===0)return Et[F.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&s===240&&i===15&&n===61440)return Et[F.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&s===0&&i===0&&n===65280)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&s===0&&i===0&&n===0)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&s===0&&i===0&&n===0)return Et[F.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration:
bitCount = ${t}, rBitMask = ${e}, gBitMask = ${s}, aBitMask = ${n}`)}const MS={extension:{type:y.LoadParser,priority:wt.High,name:"loadDDS"},name:"loadDDS",test(r){return Ft(r,[".dds"])},async load(r,t,e){const s=await As(),i=await(await fetch(r)).arrayBuffer(),n=Ng(i,s),o=new Ts(n);return be(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var Lg=(r=>(r[r.RGBA8_SNORM=36759]="RGBA8_SNORM",r[r.RGBA=6408]="RGBA",r[r.RGBA8UI=36220]="RGBA8UI",r[r.SRGB8_ALPHA8=35907]="SRGB8_ALPHA8",r[r.RGBA8I=36238]="RGBA8I",r[r.RGBA8=32856]="RGBA8",r[r.COMPRESSED_RGB_S3TC_DXT1_EXT=33776]="COMPRESSED_RGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT1_EXT=33777]="COMPRESSED_RGBA_S3TC_DXT1_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT3_EXT=33778]="COMPRESSED_RGBA_S3TC_DXT3_EXT",r[r.COMPRESSED_RGBA_S3TC_DXT5_EXT=33779]="COMPRESSED_RGBA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT=35917]="COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT=35918]="COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT",r[r.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT=35919]="COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT",r[r.COMPRESSED_SRGB_S3TC_DXT1_EXT=35916]="COMPRESSED_SRGB_S3TC_DXT1_EXT",r[r.COMPRESSED_RED_RGTC1_EXT=36283]="COMPRESSED_RED_RGTC1_EXT",r[r.COMPRESSED_SIGNED_RED_RGTC1_EXT=36284]="COMPRESSED_SIGNED_RED_RGTC1_EXT",r[r.COMPRESSED_RED_GREEN_RGTC2_EXT=36285]="COMPRESSED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT=36286]="COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT",r[r.COMPRESSED_R11_EAC=37488]="COMPRESSED_R11_EAC",r[r.COMPRESSED_SIGNED_R11_EAC=37489]="COMPRESSED_SIGNED_R11_EAC",r[r.COMPRESSED_RG11_EAC=37490]="COMPRESSED_RG11_EAC",r[r.COMPRESSED_SIGNED_RG11_EAC=37491]="COMPRESSED_SIGNED_RG11_EAC",r[r.COMPRESSED_RGB8_ETC2=37492]="COMPRESSED_RGB8_ETC2",r[r.COMPRESSED_RGBA8_ETC2_EAC=37496]="COMPRESSED_RGBA8_ETC2_EAC",r[r.COMPRESSED_SRGB8_ETC2=37493]="COMPRESSED_SRGB8_ETC2",r[r.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC=37497]="COMPRESSED_SRGB8_ALPHA8_ETC2_EAC",r[r.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2=37494]="COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2=37495]="COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2",r[r.COMPRESSED_RGBA_ASTC_4x4_KHR=37808]="COMPRESSED_RGBA_ASTC_4x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x4_KHR=37809]="COMPRESSED_RGBA_ASTC_5x4_KHR",r[r.COMPRESSED_RGBA_ASTC_5x5_KHR=37810]="COMPRESSED_RGBA_ASTC_5x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x5_KHR=37811]="COMPRESSED_RGBA_ASTC_6x5_KHR",r[r.COMPRESSED_RGBA_ASTC_6x6_KHR=37812]="COMPRESSED_RGBA_ASTC_6x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x5_KHR=37813]="COMPRESSED_RGBA_ASTC_8x5_KHR",r[r.COMPRESSED_RGBA_ASTC_8x6_KHR=37814]="COMPRESSED_RGBA_ASTC_8x6_KHR",r[r.COMPRESSED_RGBA_ASTC_8x8_KHR=37815]="COMPRESSED_RGBA_ASTC_8x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x5_KHR=37816]="COMPRESSED_RGBA_ASTC_10x5_KHR",r[r.COMPRESSED_RGBA_ASTC_10x6_KHR=37817]="COMPRESSED_RGBA_ASTC_10x6_KHR",r[r.COMPRESSED_RGBA_ASTC_10x8_KHR=37818]="COMPRESSED_RGBA_ASTC_10x8_KHR",r[r.COMPRESSED_RGBA_ASTC_10x10_KHR=37819]="COMPRESSED_RGBA_ASTC_10x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x10_KHR=37820]="COMPRESSED_RGBA_ASTC_12x10_KHR",r[r.COMPRESSED_RGBA_ASTC_12x12_KHR=37821]="COMPRESSED_RGBA_ASTC_12x12_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR=37840]="COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR=37841]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR=37842]="COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR=37843]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR=37844]="COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR=37845]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR=37846]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR=37847]="COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR=37848]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR=37849]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR=37850]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR=37851]="COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR=37852]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR",r[r.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR=37853]="COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR",r[r.COMPRESSED_RGBA_BPTC_UNORM_EXT=36492]="COMPRESSED_RGBA_BPTC_UNORM_EXT",r[r.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT=36493]="COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT",r[r.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT=36494]="COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT",r[r.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT=36495]="COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT",r))(Lg||{}),OS=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(OS||{}),BS=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(BS||{});const GS={33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},IS=[171,75,84,88,32,49,49,187,13,10,26,10],FS={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},US=64,kS=67305985,NS={5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},LS={6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},$S={32819:2,32820:2,33635:2},HS={33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},et={FILE_HEADER_SIZE:US,FILE_IDENTIFIER:IS,FORMATS_TO_COMPONENTS:LS,INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:HS,INTERNAL_FORMAT_TO_TEXTURE_FORMATS:GS,FIELDS:FS,TYPES_TO_BYTES_PER_COMPONENT:NS,TYPES_TO_BYTES_PER_PIXEL:$S,ENDIANNESS:kS};function $g(r,t){const e=new DataView(r);if(!VS(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:s,glType:i,glFormat:n,glInternalFormat:o,pixelWidth:a,pixelHeight:u,numberOfMipmapLevels:l,offset:c}=jS(e),h=et.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[o];if(!h)throw new Error(`Unknown texture format ${o}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const d=zS(i,n,o),p=XS(e,i,d,a,u,c,l,s);return{format:h,width:a,height:u,resource:p,alphaMode:"no-premultiply-alpha"}}function XS(r,t,e,s,i,n,o,a){const u=s+3&-4,l=i+3&-4;let c=s*i;t===0&&(c=u*l);let h=c*e,d=s,p=i,f=u,g=l,m=n;const _=new Array(o);for(let x=0;x<o;x++){const b=r.getUint32(m,a);let v=m+4;_[x]=new Uint8Array(r.buffer,v,h),v+=h,m+=b+4,m=m%4!==0?m+4-m%4:m,d=d>>1||1,p=p>>1||1,f=d+4-1&-4,g=p+4-1&-4,h=f*g*e}return _}function zS(r,t,e){let s=et.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(et.TYPES_TO_BYTES_PER_COMPONENT[r]?s=et.TYPES_TO_BYTES_PER_COMPONENT[r]*et.FORMATS_TO_COMPONENTS[t]:s=et.TYPES_TO_BYTES_PER_PIXEL[r]),s===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return s}function jS(r){const t=r.getUint32(et.FIELDS.ENDIANNESS,!0)===et.ENDIANNESS,e=r.getUint32(et.FIELDS.GL_TYPE,t),s=r.getUint32(et.FIELDS.GL_FORMAT,t),i=r.getUint32(et.FIELDS.GL_INTERNAL_FORMAT,t),n=r.getUint32(et.FIELDS.PIXEL_WIDTH,t),o=r.getUint32(et.FIELDS.PIXEL_HEIGHT,t)||1,a=r.getUint32(et.FIELDS.PIXEL_DEPTH,t)||1,u=r.getUint32(et.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,l=r.getUint32(et.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(et.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(et.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(o===0||a!==1)throw new Error("Only 2D textures are supported");if(l!==1)throw new Error("CubeTextures are not supported by KTXLoader yet!");if(u!==1)throw new Error("WebGL does not support array textures");return{littleEndian:t,glType:e,glFormat:s,glInternalFormat:i,pixelWidth:n,pixelHeight:o,numberOfMipmapLevels:c,offset:et.FILE_HEADER_SIZE+h}}function VS(r){for(let t=0;t<et.FILE_IDENTIFIER.length;t++)if(r.getUint8(t)!==et.FILE_IDENTIFIER[t])return!1;return!0}const WS={extension:{type:y.LoadParser,priority:wt.High,name:"loadKTX"},name:"loadKTX",test(r){return Ft(r,".ktx")},async load(r,t,e){const s=await As(),i=await(await fetch(r)).arrayBuffer(),n=$g(i,s),o=new Ts(n);return be(o,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},YS='(function(){"use strict";const s={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:i},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:i}};function f(r){const t=r.format;if(s[t]){const n=s[t].convertFunction,o=r.resource;for(let e=0;e<o.length;e++)o[e]=n(o[e]);r.format=s[t].convertedFormat}}function i(r){const t=r.byteLength/3,n=new Uint32Array(t);for(let o=0;o<t;++o)n[o]=r[o*3]+(r[o*3+1]<<8)+(r[o*3+2]<<16)+4278190080;return new Uint8Array(n.buffer)}function d(r){const t=[];for(let n=0;n<r.numLevels;n++){const o=r.getImageData(n,0,0),e=new Uint8Array(o.byteLength);e.set(o),t.push(e)}return t}const w={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function p(r){const t=w[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const h={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function F(r){const t=h[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function U(r){return r.classId===2?F(r.vkFormat):p(r.glInternalformat)}const T={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function y(r){const t=T[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const a={jsUrl:"",wasmUrl:""};let l,u,c;async function g(){if(!c){const r=new URL(a.jsUrl,location.origin).href,t=new URL(a.wasmUrl,location.origin).href;importScripts(r),c=new Promise(n=>{LIBKTX({locateFile:o=>t}).then(o=>{n(o)})})}return c}async function v(r,t){const n=await fetch(r);if(n.ok){const o=await n.arrayBuffer();return new t.ktxTexture(new Uint8Array(o))}throw new Error(`Failed to load KTX(2) texture: ${r}`)}const x=["bc7-rgba-unorm","astc-4x4-unorm","etc2-rgba8unorm","bc3-rgba-unorm","rgba8unorm"];async function B(r){const t=await g(),n=await v(r,t);let o;if(n.needsTranscoding){o=u;const R=t.TranscodeTarget[l];if(n.transcodeBasis(R,0)!==t.ErrorCode.SUCCESS)throw new Error("Unable to transcode basis texture.")}else o=U(n);const e=d(n),b={width:n.baseWidth,height:n.baseHeight,format:o,mipLevelCount:n.numLevels,resource:e,alphaMode:"no-premultiply-alpha"};return f(b),b}async function A(r,t,n){r&&(a.jsUrl=r),t&&(a.wasmUrl=t),u=x.filter(o=>n.includes(o))[0],l=y(u),await g()}const m={init:async r=>{const{jsUrl:t,wasmUrl:n,supportedTextures:o}=r;await A(t,n,o)},load:async r=>{var t;try{const n=await B(r.url);return{type:"load",url:r.url,success:!0,textureOptions:n,transferables:(t=n.resource)==null?void 0:t.map(o=>o.buffer)}}catch(n){throw n}}};self.onmessage=async r=>{var t;const n=r.data,o=await((t=m[n.type])==null?void 0:t.call(m,n));o&&self.postMessage(o,o.transferables)}})();\n';let br=null;class Hg{constructor(){br||(br=URL.createObjectURL(new Blob([YS],{type:"application/javascript"}))),this.worker=new Worker(br)}}Hg.revokeObjectURL=function(){br&&(URL.revokeObjectURL(br),br=null)};const Zi={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};function qS(r){Object.assign(Zi,r)}let Es;const Xg={};function KS(r){return Es||(Es=new Hg().worker,Es.onmessage=t=>{const{success:e,url:s,textureOptions:i}=t.data;e||console.warn("Failed to load KTX texture",s),Xg[s](i)},Es.postMessage({type:"init",jsUrl:Zi.jsUrl,wasmUrl:Zi.wasmUrl,supportedTextures:r})),Es}function zg(r,t){const e=KS(t);return new Promise(s=>{Xg[r]=s,e.postMessage({type:"load",url:r})})}const ZS={extension:{type:y.LoadParser,priority:wt.High,name:"loadKTX2"},name:"loadKTX2",test(r){return Ft(r,".ktx2")},async load(r,t,e){const s=await As(),i=await zg(r,s),n=new Ts(i);return be(n,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},Eu={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:jg},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:jg}};function QS(r){const t=r.format;if(Eu[t]){const e=Eu[t].convertFunction,s=r.resource;for(let i=0;i<s.length;i++)s[i]=e(s[i]);r.format=Eu[t].convertedFormat}}function jg(r){const t=r.byteLength/3,e=new Uint32Array(t);for(let s=0;s<t;++s)e[s]=r[s*3]+(r[s*3+1]<<8)+(r[s*3+2]<<16)+4278190080;return new Uint8Array(e.buffer)}function JS(r){const t=[];for(let e=0;e<r.numLevels;e++){const s=r.getImageData(e,0,0),i=new Uint8Array(s.byteLength);i.set(s),t.push(i)}return t}const tE={6408:"rgba8unorm",32856:"bgra8unorm",32857:"rgb10a2unorm",33189:"depth16unorm",33190:"depth24plus",33321:"r8unorm",33323:"rg8unorm",33325:"r16float",33326:"r32float",33327:"rg16float",33328:"rg32float",33329:"r8sint",33330:"r8uint",33331:"r16sint",33332:"r16uint",33333:"r32sint",33334:"r32uint",33335:"rg8sint",33336:"rg8uint",33337:"rg16sint",33338:"rg16uint",33339:"rg32sint",33340:"rg32uint",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",34836:"rgba32float",34842:"rgba16float",35056:"depth24plus-stencil8",35898:"rg11b10ufloat",35901:"rgb9e5ufloat",35907:"rgba8unorm-srgb",36012:"depth32float",36013:"depth32float-stencil8",36168:"stencil8",36208:"rgba32uint",36214:"rgba16uint",36220:"rgba8uint",36226:"rgba32sint",36232:"rgba16sint",36238:"rgba8sint",36492:"bc7-rgba-unorm",36756:"r8snorm",36757:"rg8snorm",36759:"rgba8snorm",37496:"etc2-rgba8unorm",37808:"astc-4x4-unorm"};function Vg(r){const t=tE[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const eE={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function Wg(r){const t=eE[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function rE(r){return r.classId===2?Wg(r.vkFormat):Vg(r.glInternalformat)}const sE={"bc3-rgba-unorm":"BC3_RGBA","bc7-rgba-unorm":"BC7_M5_RGBA","etc2-rgba8unorm":"ETC2_RGBA","astc-4x4-unorm":"ASTC_4x4_RGBA",rgba8unorm:"RGBA32",rg11b10ufloat:"R11F_G11F_B10F"};function iE(r){const t=sE[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const Qi=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],nE={extension:y.ResolveParser,test:r=>Ft(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let s;const i=r.split(".");if(i.length>2){const n=i[i.length-2];Qi.includes(n)&&(s=n)}else s=i[i.length-1];return{resolution:parseFloat((e=(t=pe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:s,src:r}}};let Ji;const oE={extension:{type:y.DetectionParser,priority:2},test:async()=>!!(await bs()||_s()),add:async r=>{const t=await vu();return Ji=aE(t),[...Ji,...r]},remove:async r=>Ji?r.filter(t=>!(t in Ji)):r};function aE(r){const t=["basis"],e={};return r.forEach(s=>{const i=s.split("-")[0];i&&!e[i]&&(e[i]=!0,t.push(i))}),t.sort((s,i)=>{const n=Qi.indexOf(s),o=Qi.indexOf(i);return n===-1?1:o===-1?-1:n-o}),t}const uE=new pt,wu=class{cull(t,e,s=!0){this._cullRecursive(t,e,s)}_cullRecursive(t,e,s=!0){var i;if(t.cullable&&t.measurable&&t.includeInBuild){const n=(i=t.cullArea)!=null?i:Yr(t,s,uE);t.culled=n.x>=e.x+e.width||n.y>=e.y+e.height||n.x+n.width<=e.x||n.y+n.height<=e.y}else t.culled=!1;if(!(!t.cullableChildren||t.culled||!t.renderable||!t.measurable||!t.includeInBuild))for(let n=0;n<t.children.length;n++)this._cullRecursive(t.children[n],e,s)}};wu.shared=new wu;let Yg=wu;class qg{static init(){this._renderRef=this.render.bind(this),this.render=()=>{Yg.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}qg.extension={priority:10,type:y.Application,name:"culler"};const lE={extension:{type:y.Environment,name:"webworker",priority:0},test:()=>typeof self!="undefined"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(function(){return lA})}};var cE=Object.defineProperty,tn=Object.getOwnPropertySymbols,Kg=Object.prototype.hasOwnProperty,Zg=Object.prototype.propertyIsEnumerable,Qg=(r,t,e)=>t in r?cE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cu=(r,t)=>{for(var e in t||(t={}))Kg.call(t,e)&&Qg(r,e,t[e]);if(tn)for(var e of tn(t))Zg.call(t,e)&&Qg(r,e,t[e]);return r},hE=(r,t)=>{var e={};for(var s in r)Kg.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&tn)for(var s of tn(r))t.indexOf(s)<0&&Zg.call(r,s)&&(e[s]=r[s]);return e};const Jg=class gc extends Ut{constructor(t){t=Cu(Cu({},gc.defaultOptions),t),super(t),this.enabled=!0,this._state=Lt.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.addResource("uTexture",0,1)}apply(t,e,s,i){t.applyFilter(this,e,s,i)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:s,gl:i}=e,n=hE(e,["gpu","gl"]);let o,a;return s&&(o=Ot.from(s)),i&&(a=It.from(i)),new gc(Cu({gpuProgram:o,glProgram:a},n))}};Jg.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1};let ue=Jg;var t_=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uBlend;
uniform sampler2D uTexture;
uniform sampler2D uBackTexture;
{FUNCTIONS}
void main()
{
vec4 back = texture(uBackTexture, vTextureCoord);
vec4 front = texture(uTexture, vTextureCoord);
float blendedAlpha = front.a + back.a * (1.0 - front.a);
{MAIN}
}
`,e_=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 backgroundUv;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`,r_=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct BlendUniforms {
uBlend:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(0) @binding(3) var uBackTexture: texture_2d<f32>;
@group(1) @binding(0) var<uniform> blendUniforms : BlendUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
{FUNCTIONS}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>
) -> @location(0) vec4<f32> {
var back = textureSample(uBackTexture, uSampler, uv);
var front = textureSample(uTexture, uSampler, uv);
var blendedAlpha = front.a + back.a * (1.0 - front.a);
var out = vec4<f32>(0.0,0.0,0.0,0.0);
{MAIN}
return out;
}`,dE=Object.defineProperty,s_=Object.getOwnPropertySymbols,pE=Object.prototype.hasOwnProperty,fE=Object.prototype.propertyIsEnumerable,i_=(r,t,e)=>t in r?dE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,n_=(r,t)=>{for(var e in t||(t={}))pE.call(t,e)&&i_(r,e,t[e]);if(s_)for(var e of s_(t))fE.call(t,e)&&i_(r,e,t[e]);return r};class mE extends ue{constructor(t){const e=t.gpu,s=o_(n_({source:r_},e)),i=Ot.from({vertex:{source:s,entryPoint:"mainVertex"},fragment:{source:s,entryPoint:"mainFragment"}}),n=t.gl,o=o_(n_({source:t_},n)),a=It.from({vertex:e_,fragment:o}),u=new it({uBlend:{value:1,type:"f32"}});super({gpuProgram:i,glProgram:a,blendRequired:!0,resources:{blendUniforms:u,uBackTexture:E.EMPTY}})}}function o_(r){const{source:t,functions:e,main:s}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",s)}const gE=`
float getLuminosity(vec3 c) {
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
}
vec3 setLuminosity(vec3 c, float lum) {
float modLum = lum - getLuminosity(c);
vec3 color = c.rgb + vec3(modLum);
// clip back into legal range
modLum = getLuminosity(color);
vec3 modLumVec = vec3(modLum);
float cMin = min(color.r, min(color.g, color.b));
float cMax = max(color.r, max(color.g, color.b));
if(cMin < 0.0) {
color = mix(modLumVec, color, modLum / (modLum - cMin));
}
if(cMax > 1.0) {
color = mix(modLumVec, color, (1.0 - modLum) / (cMax - modLum));
}
return color;
}
float getSaturation(vec3 c) {
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
vec3 setSaturationMinMidMax(vec3 cSorted, float s) {
vec3 colorSorted = cSorted;
if(colorSorted.z > colorSorted.x) {
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
colorSorted.z = s;
}
else {
colorSorted.y = 0.0;
colorSorted.z = 0.0;
}
colorSorted.x = 0.0;
return colorSorted;
}
vec3 setSaturation(vec3 c, float s) {
vec3 color = c;
if(color.r <= color.g && color.r <= color.b) {
if(color.g <= color.b) {
color = setSaturationMinMidMax(color.rgb, s).rgb;
}
else {
color = setSaturationMinMidMax(color.rbg, s).rbg;
}
}
else if(color.g <= color.r && color.g <= color.b) {
if(color.r <= color.b) {
color = setSaturationMinMidMax(color.grb, s).grb;
}
else {
color = setSaturationMinMidMax(color.gbr, s).gbr;
}
}
else {
// Using bgr for both fixes part of hue
if(color.r <= color.g) {
color = setSaturationMinMidMax(color.brg, s).brg;
}
else {
color = setSaturationMinMidMax(color.bgr, s).bgr;
}
}
return color;
}
`,_E=`
fn getLuminosity(c: vec3<f32>) -> f32
{
return 0.3*c.r + 0.59*c.g + 0.11*c.b;
}
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32>
{
var modLum: f32 = lum - getLuminosity(c);
var color: vec3<f32> = c.rgb + modLum;
// clip back into legal range
modLum = getLuminosity(color);
let modLumVec = vec3<f32>(modLum);
let cMin: f32 = min(color.r, min(color.g, color.b));
let cMax: f32 = max(color.r, max(color.g, color.b));
if(cMin < 0.0)
{
color = mix(modLumVec, color, modLum / (modLum - cMin));
}
if(cMax > 1.0)
{
color = mix(modLumVec, color, (1 - modLum) / (cMax - modLum));
}
return color;
}
fn getSaturation(c: vec3<f32>) -> f32
{
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32>
{
var colorSorted = cSorted;
if(colorSorted.z > colorSorted.x)
{
colorSorted.y = (((colorSorted.y - colorSorted.x) * s) / (colorSorted.z - colorSorted.x));
colorSorted.z = s;
}
else
{
colorSorted.y = 0;
colorSorted.z = 0;
}
colorSorted.x = 0;
return colorSorted;
}
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32>
{
var color = c;
if (color.r <= color.g && color.r <= color.b)
{
if (color.g <= color.b)
{
color = vec3<f32>(setSaturationMinMidMax(color.rgb, s)).rgb;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.rbg, s)).rbg;
}
}
else if (color.g <= color.r && color.g <= color.b)
{
if (color.r <= color.b)
{
color = vec3<f32>(setSaturationMinMidMax(color.grb, s)).grb;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.gbr, s)).gbr;
}
}
else
{
// Using bgr for both fixes part of hue
if (color.r <= color.g)
{
color = vec3<f32>(setSaturationMinMidMax(color.brg, s)).brg;
}
else
{
color = vec3<f32>(setSaturationMinMidMax(color.bgr, s)).bgr;
}
}
return color;
}
`;var en=`in vec2 aPosition;
out vec2 vTextureCoord;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
}
`,a_=`
in vec2 vTextureCoord;
out vec4 finalColor;
uniform float uAlpha;
uniform sampler2D uTexture;
void main()
{
finalColor = texture(uTexture, vTextureCoord) * uAlpha;
}
`,Ru=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct AlphaUniforms {
uAlpha:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> alphaUniforms : AlphaUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var sample = textureSample(uTexture, uSampler, uv);
return sample * alphaUniforms.uAlpha;
}`,bE=Object.defineProperty,xE=Object.defineProperties,yE=Object.getOwnPropertyDescriptors,rn=Object.getOwnPropertySymbols,u_=Object.prototype.hasOwnProperty,l_=Object.prototype.propertyIsEnumerable,c_=(r,t,e)=>t in r?bE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pu=(r,t)=>{for(var e in t||(t={}))u_.call(t,e)&&c_(r,e,t[e]);if(rn)for(var e of rn(t))l_.call(t,e)&&c_(r,e,t[e]);return r},vE=(r,t)=>xE(r,yE(t)),TE=(r,t)=>{var e={};for(var s in r)u_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&rn)for(var s of rn(r))t.indexOf(s)<0&&l_.call(r,s)&&(e[s]=r[s]);return e};const h_=class vx extends ue{constructor(t){t=Pu(Pu({},vx.defaultOptions),t);const e=Ot.from({vertex:{source:Ru,entryPoint:"mainVertex"},fragment:{source:Ru,entryPoint:"mainFragment"}}),s=It.from({vertex:en,fragment:a_,name:"alpha-filter"}),i=t,{alpha:n}=i,o=TE(i,["alpha"]),a=new it({uAlpha:{value:n,type:"f32"}});super(vE(Pu({},o),{gpuProgram:e,glProgram:s,resources:{alphaUniforms:a}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};h_.defaultOptions={alpha:1};let AE=h_;const Du={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]},SE=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(`
`);function d_(r){const t=Du[r],e=t.length;let s=SE,i="";const n="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;";let o;for(let a=0;a<r;a++){let u=n.replace("%index%",a.toString());o=a,a>=e&&(o=r-a-1),u=u.replace("%value%",t[o].toString()),i+=u,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s}const EE=`
in vec2 aPosition;
uniform float uStrength;
out vec2 vBlurTexCoords[%size%];
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
void main(void)
{
gl_Position = filterVertexPosition();
float pixelStrength = uInputSize.%dimension% * uStrength;
vec2 textureCoord = filterTextureCoord();
%blur%
}`;function p_(r,t){const e=Math.ceil(r/2);let s=EE,i="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let o=0;o<r;o++){let a=n.replace("%index%",o.toString());a=a.replace("%sampleIndex%",`${o-(e-1)}.0`),i+=a,i+=`
`}return s=s.replace("%blur%",i),s=s.replace("%size%",r.toString()),s=s.replace("%dimension%",t?"z":"w"),s}function f_(r,t){const e=p_(t,r),s=d_(t);return It.from({vertex:e,fragment:s,name:`blur-${r?"horizontal":"vertical"}-pass-filter`})}var m_=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct BlurUniforms {
uStrength:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> blurUniforms : BlurUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
%blur-struct%
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
let filteredCord = filterTextureCoord(aPosition);
let pixelStrength = gfu.uInputSize.%dimension% * blurUniforms.uStrength;
return VSOutput(
filterVertexPosition(aPosition),
%blur-vertex-out%
);
}
@fragment
fn mainFragment(
@builtin(position) position: vec4<f32>,
%blur-fragment-in%
) -> @location(0) vec4<f32> {
var finalColor = vec4(0.0);
%blur-sampling%
return finalColor;
}`;function g_(r,t){const e=Du[t],s=e.length,i=[],n=[],o=[];for(let h=0;h<t;h++){i[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?n[h]=`filteredCord + vec2(${h-s+1} * pixelStrength, 0.0),`:n[h]=`filteredCord + vec2(0.0, ${h-s+1} * pixelStrength),`;const d=h<s?h:t-h-1,p=e[d].toString();o[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${p};`}const a=i.join(`
`),u=n.join(`
`),l=o.join(`
`),c=m_.replace("%blur-struct%",a).replace("%blur-vertex-out%",u).replace("%blur-fragment-in%",a).replace("%blur-sampling%",l).replace("%dimension%",r?"z":"w");return Ot.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}})}var wE=Object.defineProperty,__=Object.getOwnPropertySymbols,CE=Object.prototype.hasOwnProperty,RE=Object.prototype.propertyIsEnumerable,b_=(r,t,e)=>t in r?wE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mu=(r,t)=>{for(var e in t||(t={}))CE.call(t,e)&&b_(r,e,t[e]);if(__)for(var e of __(t))RE.call(t,e)&&b_(r,e,t[e]);return r};const x_=class Tx extends ue{constructor(t){t=Mu(Mu({},Tx.defaultOptions),t);const e=f_(t.horizontal,t.kernelSize),s=g_(t.horizontal,t.kernelSize);super(Mu({glProgram:e,gpuProgram:s,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,s,i){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,s,i);else{const n=dt.getSameSizeTexture(e);let o=e,a=n;this._state.blend=!1;const u=t.renderer.type===Tt.WEBGPU;for(let l=0;l<this.passes-1;l++){t.applyFilter(this,o,a,l===0?!0:u);const c=a;a=o,o=c}this._state.blend=!0,t.applyFilter(this,o,s,i),dt.returnTexture(n)}}get blur(){return this.strength}set blur(t){this.padding=1+Math.abs(t)*2,this.strength=t}get quality(){return this._quality}set quality(t){this._quality=t,this.passes=t}};x_.defaultOptions={strength:8,quality:4,kernelSize:5};let sn=x_;var PE=Object.defineProperty,DE=Object.defineProperties,ME=Object.getOwnPropertyDescriptors,nn=Object.getOwnPropertySymbols,y_=Object.prototype.hasOwnProperty,v_=Object.prototype.propertyIsEnumerable,T_=(r,t,e)=>t in r?PE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ws=(r,t)=>{for(var e in t||(t={}))y_.call(t,e)&&T_(r,e,t[e]);if(nn)for(var e of nn(t))v_.call(t,e)&&T_(r,e,t[e]);return r},OE=(r,t)=>DE(r,ME(t)),BE=(r,t)=>{var e={};for(var s in r)y_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&nn)for(var s of nn(r))t.indexOf(s)<0&&v_.call(r,s)&&(e[s]=r[s]);return e};class A_ extends ue{constructor(...t){var e;let s=(e=t[0])!=null?e:{};typeof s=="number"&&(s={strength:s},t[1]!==void 0&&(s.quality=t[1]),t[2]!==void 0&&(s.resolution=t[2]||"inherit"),t[3]!==void 0&&(s.kernelSize=t[3])),s=ws(ws({},sn.defaultOptions),s);const i=s,{strength:n,strengthX:o,strengthY:a,quality:u}=i,l=BE(i,["strength","strengthX","strengthY","quality"]);super(OE(ws({},l),{compatibleRenderers:Tt.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new sn(ws({horizontal:!0},s)),this.blurYFilter=new sn(ws({horizontal:!1},s)),this.quality=u,this.strengthX=o!=null?o:n,this.strengthY=a!=null?a:n,this.repeatEdgePixels=!1}apply(t,e,s,i){const n=Math.abs(this.blurXFilter.strength),o=Math.abs(this.blurYFilter.strength);if(n&&o){const a=dt.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,a,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,a,s,i),dt.returnTexture(a)}else o?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,s,i)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,s,i))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}A_.defaultOptions={strength:8,quality:4,kernelSize:5};var S_=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uColorMatrix[20];
uniform float uAlpha;
uniform sampler2D uTexture;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture(uTexture, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * 0.2);
float diff = (randomValue - 0.5) * 0.5;
if (uAlpha == 0.0) {
finalColor = color;
return;
}
if (color.a > 0.0) {
color.rgb /= color.a;
}
vec4 result;
result.r = (uColorMatrix[0] * color.r);
result.r += (uColorMatrix[1] * color.g);
result.r += (uColorMatrix[2] * color.b);
result.r += (uColorMatrix[3] * color.a);
result.r += uColorMatrix[4];
result.g = (uColorMatrix[5] * color.r);
result.g += (uColorMatrix[6] * color.g);
result.g += (uColorMatrix[7] * color.b);
result.g += (uColorMatrix[8] * color.a);
result.g += uColorMatrix[9];
result.b = (uColorMatrix[10] * color.r);
result.b += (uColorMatrix[11] * color.g);
result.b += (uColorMatrix[12] * color.b);
result.b += (uColorMatrix[13] * color.a);
result.b += uColorMatrix[14];
result.a = (uColorMatrix[15] * color.r);
result.a += (uColorMatrix[16] * color.g);
result.a += (uColorMatrix[17] * color.b);
result.a += (uColorMatrix[18] * color.a);
result.a += uColorMatrix[19];
vec3 rgb = mix(color.rgb, result.rgb, uAlpha);
// Premultiply alpha again.
rgb *= result.a;
finalColor = vec4(rgb, result.a);
}
`,Ou=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct ColorMatrixUniforms {
uColorMatrix:array<vec4<f32>, 5>,
uAlpha:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> colorMatrixUniforms : ColorMatrixUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
) -> @location(0) vec4<f32> {
var c = textureSample(uTexture, uSampler, uv);
if (colorMatrixUniforms.uAlpha == 0.0) {
return c;
}
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (c.a > 0.0) {
c.r /= c.a;
c.g /= c.a;
c.b /= c.a;
}
var cm = colorMatrixUniforms.uColorMatrix;
var result = vec4<f32>(0.);
result.r = (cm[0][0] * c.r);
result.r += (cm[0][1] * c.g);
result.r += (cm[0][2] * c.b);
result.r += (cm[0][3] * c.a);
result.r += cm[1][0];
result.g = (cm[1][1] * c.r);
result.g += (cm[1][2] * c.g);
result.g += (cm[1][3] * c.b);
result.g += (cm[2][0] * c.a);
result.g += cm[2][1];
result.b = (cm[2][2] * c.r);
result.b += (cm[2][3] * c.g);
result.b += (cm[3][0] * c.b);
result.b += (cm[3][1] * c.a);
result.b += cm[3][2];
result.a = (cm[3][3] * c.r);
result.a += (cm[4][0] * c.g);
result.a += (cm[4][1] * c.b);
result.a += (cm[4][2] * c.a);
result.a += cm[4][3];
var rgb = mix(c.rgb, result.rgb, colorMatrixUniforms.uAlpha);
rgb.r *= result.a;
rgb.g *= result.a;
rgb.b *= result.a;
return vec4(rgb, result.a);
}`,GE=Object.defineProperty,IE=Object.defineProperties,FE=Object.getOwnPropertyDescriptors,E_=Object.getOwnPropertySymbols,UE=Object.prototype.hasOwnProperty,kE=Object.prototype.propertyIsEnumerable,w_=(r,t,e)=>t in r?GE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,NE=(r,t)=>{for(var e in t||(t={}))UE.call(t,e)&&w_(r,e,t[e]);if(E_)for(var e of E_(t))kE.call(t,e)&&w_(r,e,t[e]);return r},LE=(r,t)=>IE(r,FE(t));class $E extends ue{constructor(t={}){const e=new it({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),s=Ot.from({vertex:{source:Ou,entryPoint:"mainVertex"},fragment:{source:Ou,entryPoint:"mainFragment"}}),i=It.from({vertex:en,fragment:S_,name:"color-matrix-filter"});super(LE(NE({},t),{gpuProgram:s,glProgram:i,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let s=t;e&&(this._multiply(s,this.matrix,t),s=this._colorMatrix(s)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=s,this.resources.colorMatrixUniforms.update()}_multiply(t,e,s){return t[0]=e[0]*s[0]+e[1]*s[5]+e[2]*s[10]+e[3]*s[15],t[1]=e[0]*s[1]+e[1]*s[6]+e[2]*s[11]+e[3]*s[16],t[2]=e[0]*s[2]+e[1]*s[7]+e[2]*s[12]+e[3]*s[17],t[3]=e[0]*s[3]+e[1]*s[8]+e[2]*s[13]+e[3]*s[18],t[4]=e[0]*s[4]+e[1]*s[9]+e[2]*s[14]+e[3]*s[19]+e[4],t[5]=e[5]*s[0]+e[6]*s[5]+e[7]*s[10]+e[8]*s[15],t[6]=e[5]*s[1]+e[6]*s[6]+e[7]*s[11]+e[8]*s[16],t[7]=e[5]*s[2]+e[6]*s[7]+e[7]*s[12]+e[8]*s[17],t[8]=e[5]*s[3]+e[6]*s[8]+e[7]*s[13]+e[8]*s[18],t[9]=e[5]*s[4]+e[6]*s[9]+e[7]*s[14]+e[8]*s[19]+e[9],t[10]=e[10]*s[0]+e[11]*s[5]+e[12]*s[10]+e[13]*s[15],t[11]=e[10]*s[1]+e[11]*s[6]+e[12]*s[11]+e[13]*s[16],t[12]=e[10]*s[2]+e[11]*s[7]+e[12]*s[12]+e[13]*s[17],t[13]=e[10]*s[3]+e[11]*s[8]+e[12]*s[13]+e[13]*s[18],t[14]=e[10]*s[4]+e[11]*s[9]+e[12]*s[14]+e[13]*s[19]+e[14],t[15]=e[15]*s[0]+e[16]*s[5]+e[17]*s[10]+e[18]*s[15],t[16]=e[15]*s[1]+e[16]*s[6]+e[17]*s[11]+e[18]*s[16],t[17]=e[15]*s[2]+e[16]*s[7]+e[17]*s[12]+e[18]*s[17],t[18]=e[15]*s[3]+e[16]*s[8]+e[17]*s[13]+e[18]*s[18],t[19]=e[15]*s[4]+e[16]*s[9]+e[17]*s[14]+e[18]*s[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const s=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}tint(t,e){const[s,i,n]=j.shared.setValue(t).toArray(),o=[s,0,0,0,0,0,i,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(o,e)}greyscale(t,e){const s=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(s,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const s=Math.cos(t),i=Math.sin(t),n=Math.sqrt,o=1/3,a=n(o),u=s+(1-s)*o,l=o*(1-s)-a*i,c=o*(1-s)+a*i,h=o*(1-s)+a*i,d=s+o*(1-s),p=o*(1-s)-a*i,f=o*(1-s)-a*i,g=o*(1-s)+a*i,m=s+o*(1-s),_=[u,l,c,0,0,h,d,p,0,0,f,g,m,0,0,0,0,0,1,0];this._loadMatrix(_,e)}contrast(t,e){const s=(t||0)+1,i=-.5*(s-1),n=[s,0,0,0,i,0,s,0,0,i,0,0,s,0,i,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const s=t*2/3+1,i=(s-1)*-.5,n=[s,i,i,0,0,i,s,i,0,0,i,i,s,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,s,i,n){t=t||.2,e=e||.15,s=s||16770432,i=i||3375104;const o=j.shared,[a,u,l]=o.setValue(s).toArray(),[c,h,d]=o.setValue(i).toArray(),p=[.3,.59,.11,0,0,a,u,l,t,0,c,h,d,e,0,a-c,u-h,l-d,0,0];this._loadMatrix(p,n)}night(t,e){t=t||.1;const s=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(s,e)}predator(t,e){const s=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(s,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var C_=`
in vec2 vTextureCoord;
in vec2 vFilterUv;
out vec4 finalColor;
uniform sampler2D uTexture;
uniform sampler2D uMapTexture;
uniform vec4 uInputClamp;
uniform highp vec4 uInputSize;
uniform mat2 uRotation;
uniform vec2 uScale;
void main()
{
vec4 map = texture(uMapTexture, vFilterUv);
vec2 offset = uInputSize.zw * (uRotation * (map.xy - 0.5)) * uScale;
finalColor = texture(uTexture, clamp(vTextureCoord + offset, uInputClamp.xy, uInputClamp.zw));
}
`,R_=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 vFilterUv;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
uniform mat3 uFilterMatrix;
vec4 filterVertexPosition( void )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( void )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
vec2 getFilterCoord( void )
{
return ( uFilterMatrix * vec3( filterTextureCoord(), 1.0) ).xy;
}
void main(void)
{
gl_Position = filterVertexPosition();
vTextureCoord = filterTextureCoord();
vFilterUv = getFilterCoord();
}
`,Bu=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct DisplacementUniforms {
uFilterMatrix:mat3x3<f32>,
uScale:vec2<f32>,
uRotation:mat2x2<f32>
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> filterUniforms : DisplacementUniforms;
@group(1) @binding(1) var uMapTexture: texture_2d<f32>;
@group(1) @binding(2) var uMapSampler : sampler;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
@location(1) filterUv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
{
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
getFilterCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@location(1) filterUv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var map = textureSample(uMapTexture, uMapSampler, filterUv);
var offset = gfu.uInputSize.zw * (filterUniforms.uRotation * (map.xy - 0.5)) * filterUniforms.uScale;
return textureSample(uTexture, uSampler, clamp(uv + offset, gfu.uInputClamp.xy, gfu.uInputClamp.zw));
}`,HE=Object.defineProperty,XE=Object.defineProperties,zE=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,P_=Object.prototype.hasOwnProperty,D_=Object.prototype.propertyIsEnumerable,M_=(r,t,e)=>t in r?HE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,jE=(r,t)=>{for(var e in t||(t={}))P_.call(t,e)&&M_(r,e,t[e]);if(on)for(var e of on(t))D_.call(t,e)&&M_(r,e,t[e]);return r},VE=(r,t)=>XE(r,zE(t)),WE=(r,t)=>{var e={};for(var s in r)P_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&on)for(var s of on(r))t.indexOf(s)<0&&D_.call(r,s)&&(e[s]=r[s]);return e};class YE extends ue{constructor(...t){let e=t[0];e instanceof Xt&&(e={sprite:e,scale:t[1]});const s=e,{sprite:i,scale:n}=s,o=WE(s,["sprite","scale"]);let a=n!=null?n:20;typeof a=="number"&&(a=new nt(a,a));const u=new it({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uScale:{value:a,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),l=It.from({vertex:R_,fragment:C_,name:"displacement-filter"}),c=Ot.from({vertex:{source:Bu,entryPoint:"mainVertex"},fragment:{source:Bu,entryPoint:"mainFragment"}}),h=i.texture.source;super(VE(jE({},o),{gpuProgram:c,glProgram:l,resources:{filterUniforms:u,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,s,i){const n=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite);const o=this._sprite.worldTransform,a=Math.sqrt(o.a*o.a+o.b*o.b),u=Math.sqrt(o.c*o.c+o.d*o.d);a!==0&&u!==0&&(n.uRotation[0]=o.a/a,n.uRotation[1]=o.b/a,n.uRotation[2]=o.c/u,n.uRotation[3]=o.d/u),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,s,i)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var O_=`
in vec2 vTextureCoord;
in vec4 vColor;
out vec4 finalColor;
uniform float uNoise;
uniform float uSeed;
uniform sampler2D uTexture;
float rand(vec2 co)
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
void main()
{
vec4 color = texture(uTexture, vTextureCoord);
float randomValue = rand(gl_FragCoord.xy * uSeed);
float diff = (randomValue - 0.5) * uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (color.a > 0.0) {
color.rgb /= color.a;
}
color.r += diff;
color.g += diff;
color.b += diff;
// Premultiply alpha again.
color.rgb *= color.a;
finalColor = color;
}
`,Gu=`
struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct NoiseUniforms {
uNoise:f32,
uSeed:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> noiseUniforms : NoiseUniforms;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition)
);
}
fn rand(co:vec2<f32>) -> f32
{
return fract(sin(dot(co.xy, vec2(12.9898, 78.233))) * 43758.5453);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var pixelPosition = globalTextureCoord(position.xy);// / (getSize());//- gfu.uOutputFrame.xy);
var sample = textureSample(uTexture, uSampler, uv);
var randomValue = rand(pixelPosition.xy * noiseUniforms.uSeed);
var diff = (randomValue - 0.5) * noiseUniforms.uNoise;
// Un-premultiply alpha before applying the color matrix. See issue #3539.
if (sample.a > 0.0) {
sample.r /= sample.a;
sample.g /= sample.a;
sample.b /= sample.a;
}
sample.r += diff;
sample.g += diff;
sample.b += diff;
// Premultiply alpha again.
sample.r *= sample.a;
sample.g *= sample.a;
sample.b *= sample.a;
return sample;
}`,qE=Object.defineProperty,KE=Object.defineProperties,ZE=Object.getOwnPropertyDescriptors,an=Object.getOwnPropertySymbols,B_=Object.prototype.hasOwnProperty,G_=Object.prototype.propertyIsEnumerable,I_=(r,t,e)=>t in r?qE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Iu=(r,t)=>{for(var e in t||(t={}))B_.call(t,e)&&I_(r,e,t[e]);if(an)for(var e of an(t))G_.call(t,e)&&I_(r,e,t[e]);return r},QE=(r,t)=>KE(r,ZE(t)),JE=(r,t)=>{var e={};for(var s in r)B_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&an)for(var s of an(r))t.indexOf(s)<0&&G_.call(r,s)&&(e[s]=r[s]);return e};const F_=class Ax extends ue{constructor(t={}){t=Iu(Iu({},Ax.defaultOptions),t);const e=Ot.from({vertex:{source:Gu,entryPoint:"mainVertex"},fragment:{source:Gu,entryPoint:"mainFragment"}}),s=It.from({vertex:en,fragment:O_,name:"noise-filter"}),i=t,{noise:n,seed:o}=i,a=JE(i,["noise","seed"]);super(QE(Iu({},a),{gpuProgram:e,glProgram:s,resources:{noiseUniforms:new it({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=o!=null?o:Math.random()}get noise(){return this.resources.noiseUniforms.uniforms.uNoise}set noise(t){this.resources.noiseUniforms.uniforms.uNoise=t}get seed(){return this.resources.noiseUniforms.uniforms.uSeed}set seed(t){this.resources.noiseUniforms.uniforms.uSeed=t}};F_.defaultOptions={noise:.5};let t3=F_;var U_=`in vec2 vMaskCoord;
in vec2 vTextureCoord;
uniform sampler2D uTexture;
uniform sampler2D uMaskTexture;
uniform float uAlpha;
uniform vec4 uMaskClamp;
out vec4 finalColor;
void main(void)
{
float clip = step(3.5,
step(uMaskClamp.x, vMaskCoord.x) +
step(uMaskClamp.y, vMaskCoord.y) +
step(vMaskCoord.x, uMaskClamp.z) +
step(vMaskCoord.y, uMaskClamp.w));
// TODO look into why this is needed
float npmAlpha = uAlpha;
vec4 original = texture(uTexture, vTextureCoord);
vec4 masky = texture(uMaskTexture, vMaskCoord);
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
original *= (alphaMul * masky.r * uAlpha * clip);
finalColor = original;
}
`,k_=`in vec2 aPosition;
out vec2 vTextureCoord;
out vec2 vMaskCoord;
uniform vec4 uInputSize;
uniform vec4 uOutputFrame;
uniform vec4 uOutputTexture;
uniform mat3 uFilterMatrix;
vec4 filterVertexPosition( vec2 aPosition )
{
vec2 position = aPosition * uOutputFrame.zw + uOutputFrame.xy;
position.x = position.x * (2.0 / uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*uOutputTexture.z / uOutputTexture.y) - uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
vec2 filterTextureCoord( vec2 aPosition )
{
return aPosition * (uOutputFrame.zw * uInputSize.zw);
}
vec2 getFilterCoord( vec2 aPosition )
{
return ( uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
void main(void)
{
gl_Position = filterVertexPosition(aPosition);
vTextureCoord = filterTextureCoord(aPosition);
vMaskCoord = getFilterCoord(aPosition);
}
`,Fu=`struct GlobalFilterUniforms {
uInputSize:vec4<f32>,
uInputPixel:vec4<f32>,
uInputClamp:vec4<f32>,
uOutputFrame:vec4<f32>,
uGlobalFrame:vec4<f32>,
uOutputTexture:vec4<f32>,
};
struct MaskUniforms {
uFilterMatrix:mat3x3<f32>,
uMaskClamp:vec4<f32>,
uAlpha:f32,
};
@group(0) @binding(0) var<uniform> gfu: GlobalFilterUniforms;
@group(0) @binding(1) var uTexture: texture_2d<f32>;
@group(0) @binding(2) var uSampler : sampler;
@group(1) @binding(0) var<uniform> filterUniforms : MaskUniforms;
@group(1) @binding(1) var uMaskTexture: texture_2d<f32>;
struct VSOutput {
@builtin(position) position: vec4<f32>,
@location(0) uv : vec2<f32>,
@location(1) filterUv : vec2<f32>,
};
fn filterVertexPosition(aPosition:vec2<f32>) -> vec4<f32>
{
var position = aPosition * gfu.uOutputFrame.zw + gfu.uOutputFrame.xy;
position.x = position.x * (2.0 / gfu.uOutputTexture.x) - 1.0;
position.y = position.y * (2.0*gfu.uOutputTexture.z / gfu.uOutputTexture.y) - gfu.uOutputTexture.z;
return vec4(position, 0.0, 1.0);
}
fn filterTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return aPosition * (gfu.uOutputFrame.zw * gfu.uInputSize.zw);
}
fn globalTextureCoord( aPosition:vec2<f32> ) -> vec2<f32>
{
return (aPosition.xy / gfu.uGlobalFrame.zw) + (gfu.uGlobalFrame.xy / gfu.uGlobalFrame.zw);
}
fn getFilterCoord(aPosition:vec2<f32> ) -> vec2<f32>
{
return ( filterUniforms.uFilterMatrix * vec3( filterTextureCoord(aPosition), 1.0) ).xy;
}
fn getSize() -> vec2<f32>
{
return gfu.uGlobalFrame.zw;
}
@vertex
fn mainVertex(
@location(0) aPosition : vec2<f32>,
) -> VSOutput {
return VSOutput(
filterVertexPosition(aPosition),
filterTextureCoord(aPosition),
getFilterCoord(aPosition)
);
}
@fragment
fn mainFragment(
@location(0) uv: vec2<f32>,
@location(1) filterUv: vec2<f32>,
@builtin(position) position: vec4<f32>
) -> @location(0) vec4<f32> {
var maskClamp = filterUniforms.uMaskClamp;
var clip = step(3.5,
step(maskClamp.x, filterUv.x) +
step(maskClamp.y, filterUv.y) +
step(filterUv.x, maskClamp.z) +
step(filterUv.y, maskClamp.w));
var mask = textureSample(uMaskTexture, uSampler, filterUv);
var source = textureSample(uTexture, uSampler, uv);
var npmAlpha = 0.0;
var alphaMul = 1.0 - npmAlpha * (1.0 - mask.a);
var a = (alphaMul * mask.r) * clip;
return vec4(source.rgb, source.a) * a;
}`,e3=Object.defineProperty,r3=Object.defineProperties,s3=Object.getOwnPropertyDescriptors,un=Object.getOwnPropertySymbols,N_=Object.prototype.hasOwnProperty,L_=Object.prototype.propertyIsEnumerable,$_=(r,t,e)=>t in r?e3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,i3=(r,t)=>{for(var e in t||(t={}))N_.call(t,e)&&$_(r,e,t[e]);if(un)for(var e of un(t))L_.call(t,e)&&$_(r,e,t[e]);return r},n3=(r,t)=>r3(r,s3(t)),o3=(r,t)=>{var e={};for(var s in r)N_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&un)for(var s of un(r))t.indexOf(s)<0&&L_.call(r,s)&&(e[s]=r[s]);return e};class H_ extends ue{constructor(t){const e=t,{sprite:s}=e,i=o3(e,["sprite"]),n=new ho(s.texture),o=new it({uFilterMatrix:{value:new B,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"}}),a=Ot.from({vertex:{source:Fu,entryPoint:"mainVertex"},fragment:{source:Fu,entryPoint:"mainFragment"}}),u=It.from({vertex:k_,fragment:U_,name:"mask-filter"});super(n3(i3({},i),{gpuProgram:a,glProgram:u,resources:{filterUniforms:o,uMaskTexture:s.texture.source}})),this.sprite=s,this._textureMatrix=n}apply(t,e,s,i){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,s,i)}}var a3=`fn getLuminosity(c: vec3<f32>) -> f32 {
return 0.3 * c.r + 0.59 * c.g + 0.11 * c.b;
}
fn setLuminosity(c: vec3<f32>, lum: f32) -> vec3<f32> {
let d: f32 = lum - getLuminosity(c);
let newColor: vec3<f32> = c.rgb + vec3<f32>(d, d, d);
// clip back into legal range
let newLum: f32 = getLuminosity(newColor);
let cMin: f32 = min(newColor.r, min(newColor.g, newColor.b));
let cMax: f32 = max(newColor.r, max(newColor.g, newColor.b));
let t1: f32 = newLum / (newLum - cMin);
let t2: f32 = (1.0 - newLum) / (cMax - newLum);
let finalColor = mix(vec3<f32>(newLum, newLum, newLum), newColor, select(select(1.0, t2, cMax > 1.0), t1, cMin < 0.0));
return finalColor;
}
fn getSaturation(c: vec3<f32>) -> f32 {
return max(c.r, max(c.g, c.b)) - min(c.r, min(c.g, c.b));
}
// Set saturation if color components are sorted in ascending order.
fn setSaturationMinMidMax(cSorted: vec3<f32>, s: f32) -> vec3<f32> {
var result: vec3<f32>;
if (cSorted.z > cSorted.x) {
let newY = (((cSorted.y - cSorted.x) * s) / (cSorted.z - cSorted.x));
result = vec3<f32>(0.0, newY, s);
} else {
result = vec3<f32>(0.0, 0.0, 0.0);
}
return vec3<f32>(result.x, result.y, result.z);
}
fn setSaturation(c: vec3<f32>, s: f32) -> vec3<f32> {
var result: vec3<f32> = c;
if (c.r <= c.g && c.r <= c.b) {
if (c.g <= c.b) {
result = setSaturationMinMidMax(result, s);
} else {
var temp: vec3<f32> = vec3<f32>(result.r, result.b, result.g);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.r, temp.b, temp.g);
}
} else if (c.g <= c.r && c.g <= c.b) {
if (c.r <= c.b) {
var temp: vec3<f32> = vec3<f32>(result.g, result.r, result.b);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.g, temp.r, temp.b);
} else {
var temp: vec3<f32> = vec3<f32>(result.g, result.b, result.r);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.g, temp.b, temp.r);
}
} else {
if (c.r <= c.g) {
var temp: vec3<f32> = vec3<f32>(result.b, result.r, result.g);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.b, temp.r, temp.g);
} else {
var temp: vec3<f32> = vec3<f32>(result.b, result.g, result.r);
temp = setSaturationMinMidMax(temp, s);
result = vec3<f32>(temp.b, temp.g, temp.r);
}
}
return result;
}`;function Uu(r,t,e,s,i,n,o,a){const u=o-e,l=a-s,c=i-e,h=n-s,d=r-e,p=t-s,f=u*u+l*l,g=u*c+l*h,m=u*d+l*p,_=c*c+h*h,x=c*d+h*p,b=1/(f*_-g*g),v=(_*m-g*x)*b,A=(f*x-g*m)*b;return v>=0&&A>=0&&v+A<1}class bc{constructor(t=0,e=0,s=0,i=0,n=0,o=0){this.type="triangle",this.x=t,this.y=e,this.x2=s,this.y2=i,this.x3=n,this.y3=o}contains(t,e){const s=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),i=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(s<0!=i<0&&s!==0&&i!==0)return!1;const n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return n===0||n<0==s+i<=0}strokeContains(t,e,s){const i=s/2,n=i*i,{x:o,x2:a,x3:u,y:l,y2:c,y3:h}=this;return as(t,e,o,l,a,h)<=n||as(t,e,a,c,u,h)<=n||as(t,e,u,h,o,l)<=n}clone(){return new bc(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new V;const e=Math.min(this.x,this.x2,this.x3),s=Math.max(this.x,this.x2,this.x3),i=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=i,t.width=s-e,t.height=n-i,t}}const X_=class Sx{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let s=0;for(;e.length&&s<Sx.uploadsPerFrame;){const i=e.shift();this.uploadQueueItem(i),s++}e.length?mt.system.addOnce(this._tick,this,de.UTILITY):this._resolve()},this.renderer=t,this.queue=[],this.resolves=[]}getQueue(){return[...this.queue]}add(t){const e=Array.isArray(t)?t:[t];for(const s of e)s instanceof rt?this._addContainer(s):this.resolveQueueItem(s,this.queue);return this}_addContainer(t){this.resolveQueueItem(t,this.queue);for(const e of t.children)this._addContainer(e)}upload(t){return t&&this.add(t),new Promise(e=>{this.queue.length?(this.resolves.push(e),this.dedupeQueue(),mt.system.addOnce(this._tick,this,de.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let s=0;s<this.queue.length;s++){const i=this.queue[s];t[i.uid]||(t[i.uid]=!0,this.queue[e++]=i)}this.queue.length=e}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const s of e)s()}};X_.uploadsPerFrame=4;let z_=X_;var u3=Object.defineProperty,ln=Object.getOwnPropertySymbols,j_=Object.prototype.hasOwnProperty,V_=Object.prototype.propertyIsEnumerable,W_=(r,t,e)=>t in r?u3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,l3=(r,t)=>{for(var e in t||(t={}))j_.call(t,e)&&W_(r,e,t[e]);if(ln)for(var e of ln(t))V_.call(t,e)&&W_(r,e,t[e]);return r},c3=(r,t)=>{var e={};for(var s in r)j_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&ln)for(var s of ln(r))t.indexOf(s)<0&&V_.call(r,s)&&(e[s]=r[s]);return e};class xr extends Be{constructor(...t){var e;let s=t[0];s instanceof rr&&(s={geometry:s,shader:t[1]},t[3]&&(s.geometry.topology=t[3]));const i=s,{geometry:n,shader:o,texture:a,roundPixels:u,state:l}=i,c=c3(i,["geometry","shader","texture","roundPixels","state"]);super(l3({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=o!=null?o:null,this.texture=(e=a!=null?a:o==null?void 0:o.texture)!=null?e:E.WHITE,this.state=l!=null?l:Lt.for2d(),this._geometry=n,this._geometry.on("update",this.onViewUpdate,this),this.roundPixels=u!=null?u:!1}get material(){return this._shader}set shader(t){this._shader!==t&&(this._shader=t,this.onViewUpdate())}get shader(){return this._shader}set geometry(t){var e;this._geometry!==t&&((e=this._geometry)==null||e.off("update",this.onViewUpdate,this),t.on("update",this.onViewUpdate,this),this._geometry=t,this.onViewUpdate())}get geometry(){return this._geometry}set texture(t){t||(t=E.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this.shader&&(this.shader.texture=t),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}get batched(){return this._shader||this.state.data&12?!1:this._geometry instanceof ge?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}addBounds(t){t.addBounds(this.geometry.bounds)}containsPoint(t){const{x:e,y:s}=t;if(!this.bounds.containsPoint(e,s))return!1;const i=this.geometry.getBuffer("aPosition").data,n=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const o=this.geometry.getIndex().data,a=o.length;for(let u=0;u+2<a;u+=n){const l=o[u]*2,c=o[u+1]*2,h=o[u+2]*2;if(Uu(e,s,i[l],i[l+1],i[c],i[c+1],i[h],i[h+1]))return!0}}else{const o=i.length/2;for(let a=0;a+2<o;a+=n){const u=a*2,l=(a+1)*2,c=(a+2)*2;if(Uu(e,s,i[u],i[u+1],i[l],i[l+1],i[c],i[c+1]))return!0}}return!1}onViewUpdate(){if(this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){var e;if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const s=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(s)}(e=this._geometry)==null||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}}var h3=Object.defineProperty,d3=Object.defineProperties,p3=Object.getOwnPropertyDescriptors,cn=Object.getOwnPropertySymbols,Y_=Object.prototype.hasOwnProperty,q_=Object.prototype.propertyIsEnumerable,K_=(r,t,e)=>t in r?h3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,f3=(r,t)=>{for(var e in t||(t={}))Y_.call(t,e)&&K_(r,e,t[e]);if(cn)for(var e of cn(t))q_.call(t,e)&&K_(r,e,t[e]);return r},m3=(r,t)=>d3(r,p3(t)),g3=(r,t)=>{var e={};for(var s in r)Y_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&cn)for(var s of cn(r))t.indexOf(s)<0&&q_.call(r,s)&&(e[s]=r[s]);return e};class Gs extends Xt{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const s=e,{textures:i,autoUpdate:n}=s,o=g3(s,["textures","autoUpdate"]),[a]=i;super(m3(f3({},o),{texture:a instanceof E?a:a.texture})),this._textures=null,this._durations=null,this._autoUpdate=n!=null?n:!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=i}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(mt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(mt.shared.add(this.update,this,de.HIGH),this._isConnectedToTicker=!0))}gotoAndStop(t){this.stop(),this.currentFrame=t}gotoAndPlay(t){this.currentFrame=t,this.play()}update(t){if(!this._playing)return;const e=t.deltaTime,s=this.animationSpeed*e,i=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=s/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const o=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*o,this._currentTime+=o;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=s;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()):i!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<i||this.animationSpeed<0&&this.currentFrame>i)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let s=0;s<t.length;++s)e.push(E.from(t[s]));return new Gs(e)}static fromImages(t){const e=[];for(let s=0;s<t.length;++s)e.push(E.from(t[s]));return new Gs(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof E)this._textures=t,this._durations=null;else{this._textures=[],this._durations=[];for(let e=0;e<t.length;e++)this._textures.push(t[e].texture),this._durations.push(t[e].time)}this._previousFrame=null,this.gotoAndStop(0),this._updateTexture()}get currentFrame(){let t=Math.floor(this._currentTime)%this._textures.length;return t<0&&(t+=this._textures.length),t}set currentFrame(t){if(t<0||t>this.totalFrames-1)throw new Error(`[AnimatedSprite]: Invalid frame index value ${t}, expected to be between 0 and totalFrames ${this.totalFrames}.`);const e=this.currentFrame;this._currentTime=t,e!==this.currentFrame&&this._updateTexture()}get playing(){return this._playing}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,!this._autoUpdate&&this._isConnectedToTicker?(mt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(mt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Z_{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new B,this.observer=e,this.position=new ot(this,0,0),this.scale=new ot(this,1,1),this.pivot=new ot(this,0,0),this.skew=new ot(this,0,0),this._rotation=0,this._cx=1,this._sx=0,this._cy=0,this._sy=1}get matrix(){const t=this._matrix;return this.dirty&&(t.a=this._cx*this.scale.x,t.b=this._sx*this.scale.x,t.c=this._cy*this.scale.y,t.d=this._sy*this.scale.y,t.tx=this.position.x-(this.pivot.x*t.a+this.pivot.y*t.c),t.ty=this.position.y-(this.pivot.x*t.b+this.pivot.y*t.d),this.dirty=!1),t}_onUpdate(t){var e;this.dirty=!0,t===this.skew&&this.updateSkew(),(e=this.observer)==null||e._onUpdate(this)}updateSkew(){this._cx=Math.cos(this._rotation+this.skew.y),this._sx=Math.sin(this._rotation+this.skew.y),this._cy=-Math.sin(this._rotation-this.skew.x),this._sy=Math.cos(this._rotation-this.skew.x),this.dirty=!0}setFromMatrix(t){t.decompose(this),this.dirty=!0}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this.skew))}}var _3=Object.defineProperty,hn=Object.getOwnPropertySymbols,Q_=Object.prototype.hasOwnProperty,J_=Object.prototype.propertyIsEnumerable,t0=(r,t,e)=>t in r?_3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cs=(r,t)=>{for(var e in t||(t={}))Q_.call(t,e)&&t0(r,e,t[e]);if(hn)for(var e of hn(t))J_.call(t,e)&&t0(r,e,t[e]);return r},b3=(r,t)=>{var e={};for(var s in r)Q_.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&hn)for(var s of hn(r))t.indexOf(s)<0&&J_.call(r,s)&&(e[s]=r[s]);return e};const e0=class In extends Be{constructor(...t){let e=t[0]||{};e instanceof E&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=Cs(Cs({},In.defaultOptions),e);const s=e!=null?e:{},{texture:i,anchor:n,tilePosition:o,tileScale:a,tileRotation:u,width:l,height:c,applyAnchorToTexture:h,roundPixels:d}=s,p=b3(s,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Cs({label:"TilingSprite"},p)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),this._applyAnchorToTexture=h,this.texture=i,this._width=l!=null?l:i.width,this._height=c!=null?c:i.height,this._tileTransform=new Z_({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=o,this.tileScale=a,this.tileRotation=u,this.roundPixels=d!=null?d:!1}static from(t,e={}){return typeof t=="string"?new In(Cs({texture:q.get(t)},e)):new In(Cs({texture:t},e))}get clampMargin(){return this._texture.textureMatrix.clampMargin}set clampMargin(t){this._texture.textureMatrix.clampMargin=t}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get tilePosition(){return this._tileTransform.position}set tilePosition(t){this._tileTransform.position.copyFrom(t)}get tileScale(){return this._tileTransform.scale}set tileScale(t){typeof t=="number"?this._tileTransform.scale.set(t):this._tileTransform.scale.copyFrom(t)}set tileRotation(t){this._tileTransform.rotation=t}get tileRotation(){return this._tileTransform.rotation}get tileTransform(){return this._tileTransform}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}set texture(t){t||(t=E.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var s;typeof t=="object"&&(e=(s=t.height)!=null?s:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}_updateBounds(){const t=this._bounds,e=this._anchor,s=this._width,i=this._height;t.maxX=-e._x*s,t.minX=t.maxX+s,t.maxY=-e._y*i,t.minY=t.maxY+i}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this._width,s=this._height,i=-e*this._anchor._x;let n=0;return t.x>=i&&t.x<=i+e&&(n=-s*this._anchor._y,t.y>=n&&t.y<=n+s)}onViewUpdate(){if(this._boundsDirty=!0,this._didTilingSpriteUpdate=!0,this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};e0.defaultOptions={texture:E.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let r0=e0;var x3=Object.defineProperty,dn=Object.getOwnPropertySymbols,s0=Object.prototype.hasOwnProperty,i0=Object.prototype.propertyIsEnumerable,n0=(r,t,e)=>t in r?x3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,y3=(r,t)=>{for(var e in t||(t={}))s0.call(t,e)&&n0(r,e,t[e]);if(dn)for(var e of dn(t))i0.call(t,e)&&n0(r,e,t[e]);return r},v3=(r,t)=>{var e={};for(var s in r)s0.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&dn)for(var s of dn(r))t.indexOf(s)<0&&i0.call(r,s)&&(e[s]=r[s]);return e};class pn extends Be{constructor(t,e){const s=t,{text:i,resolution:n,style:o,anchor:a,width:u,height:l,roundPixels:c}=s,h=v3(s,["text","resolution","style","anchor","width","height","roundPixels"]);super(y3({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=i!=null?i:"",this.style=o,this.resolution=n!=null?n:null,this.allowChildren=!1,this._anchor=new ot({_onUpdate:()=>{this.onViewUpdate()}}),a&&(this.anchor=a),this.roundPixels=c!=null?c:!1,u!==void 0&&(this.width=u),l!==void 0&&(this.height=l)}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}set text(t){t=t.toString(),this._text!==t&&(this._text=t,this.onViewUpdate())}get text(){return this._text}set resolution(t){this._autoResolution=t===null,this._resolution=t,this.onViewUpdate()}get resolution(){return this._resolution}get style(){return this._style}set style(t){var e;t=t||{},(e=this._style)==null||e.off("update",this.onViewUpdate,this),t instanceof this._styleClass?this._style=t:this._style=new this._styleClass(t),this._style.on("update",this.onViewUpdate,this),this.onViewUpdate()}get bounds(){return this._boundsDirty&&(this._updateBounds(),this._boundsDirty=!1),this._bounds}get width(){return Math.abs(this.scale.x)*this.bounds.width}set width(t){this._setWidth(t,this.bounds.width)}get height(){return Math.abs(this.scale.y)*this.bounds.height}set height(t){this._setHeight(t,this.bounds.height)}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this.bounds.width,t.height=Math.abs(this.scale.y)*this.bounds.height,t}setSize(t,e){var s;typeof t=="object"?(e=(s=t.height)!=null?s:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,s=this.bounds.height,i=-e*this.anchor.x;let n=0;return t.x>=i&&t.x<=i+e&&(n=-s*this.anchor.y,t.y>=n&&t.y<=n+s)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function fn(r,t){var e;let s=(e=r[0])!=null?e:{};return(typeof s=="string"||r[1])&&(s={text:s,style:r[1]}),s}class ku extends pn{constructor(...t){const e=fn(t,"Text");super(e,Dt),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,s=Ht.measureText(this._text,this._style),{width:i,height:n}=s;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}class o0 extends z_{resolveQueueItem(t,e){return t instanceof rt?this.resolveContainerQueueItem(t,e):t instanceof tt||t instanceof E?e.push(t.source):t instanceof gt&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof Xt||t instanceof r0||t instanceof xr?e.push(t.texture.source):t instanceof ku?e.push(t):t instanceof wr?e.push(t.context):t instanceof Gs&&t.textures.forEach(s=>{s.source?e.push(s.source):e.push(s.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const s of e)if(s.action==="texture"){const{image:i}=s.data;return i.source}else if(s.action==="fill"){const{texture:i}=s.data.style;return i.source}return null}}class a0 extends pn{constructor(...t){var e,s,i;const n=fn(t,"BitmapText");(e=n.style)!=null||(n.style=n.style||{}),(i=(s=n.style).fill)!=null||(s.fill=16777215),super(n,Dt),this.renderPipeId="bitmapText"}_updateBounds(){const t=this._bounds,e=this._anchor,s=ps.measureText(this.text,this._style),i=s.scale,n=s.offsetY*i;let o=s.width*i,a=s.height*i;const u=this._style._stroke;u&&(o+=u.width,a+=u.width),t.minX=-e._x*o,t.maxX=t.minX+o,t.minY=-e._y*(a+n),t.maxY=t.minY+a}}class u0 extends pn{constructor(...t){const e=fn(t,"HtmlText");super(e,He),this.renderPipeId="htmlText"}_updateBounds(){const t=this._bounds,e=this._anchor,s=Va(this.text,this._style),{width:i,height:n}=s;t.minX=-e._x*i,t.maxX=t.minX+i,t.minY=-e._y*n,t.maxY=t.minY+n}}class l0 extends o0{uploadQueueItem(t){t instanceof tt?this.uploadTextureSource(t):t instanceof ku?this.uploadText(t):t instanceof u0?this.uploadHTMLText(t):t instanceof a0?this.uploadBitmapText(t):t instanceof gt&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const s of e)if(s.action==="texture"){const{image:i}=s.data;this.uploadTextureSource(i.source)}else if(s.action==="fill"){const{texture:i}=s.data.style;this.uploadTextureSource(i.source)}return null}}class c0 extends l0{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}c0.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"prepare"};class Nu{constructor(){this._didUpload=!1,this._tempState=Lt.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,s){const i=t.renderer;i.shader.bind(s,this._didUpload),i.shader.updateUniformGroup(i.globalUniforms.uniformGroup),i.geometry.bind(e,s.glProgram)}execute(t,e){const s=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,s.state.set(this._tempState);const i=e.textures.textures;for(let n=0;n<e.textures.count;n++)s.texture.bind(i[n],n);s.geometry.draw("triangle-list",e.size,e.start)}}Nu.extension={type:[y.WebGLPipesAdaptor],name:"batch"};function T3(r){const t=[];let e=0;for(let s=0;s<r;s++)t[e]={texture:{sampleType:"float",viewDimension:"2d",multisampled:!1},binding:e,visibility:GPUShaderStage.FRAGMENT},e++,t[e]={sampler:{type:"filtering"},binding:e,visibility:GPUShaderStage.FRAGMENT},e++;return t}function A3(r){const t={};let e=0;for(let s=0;s<r;s++)t[`textureSource${s+1}`]=e++,t[`textureSampler${s+1}`]=e++;return t}const mn=Lt.for2d();class Lu{start(t,e,s){const i=t.renderer,n=i.encoder,o=s.gpuProgram;this._shader=s,this._geometry=e,n.setGeometry(e,o),mn.blendMode="normal",i.pipeline.getPipeline(e,o,mn);const a=i.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,a,o)}execute(t,e){const s=this._shader.gpuProgram,i=t.renderer,n=i.encoder;if(!e.bindGroup){const u=e.textures;e.bindGroup=li(u.textures,u.count)}mn.blendMode=e.blendMode;const o=i.bindGroup.getBindGroup(e.bindGroup,s,1),a=i.pipeline.getPipeline(this._geometry,s,mn);e.bindGroup._touch(i.textureGC.count),n.setPipeline(a),n.renderPassEncoder.setBindGroup(1,o),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}}Lu.extension={type:[y.WebGPUPipesAdaptor],name:"batch"};const $u=class Ex{constructor(t,e){this.state=Lt.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null);var s,i;this.renderer=t,this._adaptor=e,(i=(s=this._adaptor).init)==null||i.call(s,this)}static getBatcher(t){return new this._availableBatchers[t]}buildStart(t){let e=this._batchersByInstructionSet[t.uid];e||(e=this._batchersByInstructionSet[t.uid]=Object.create(null),e.default||(e.default=new xi)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const s in this._activeBatches)this._activeBatches[s].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let s=this._activeBatches[t.batcherName];s||(s=this._activeBatches[t.batcherName]=Ex.getBatcher(t.batcherName),s.begin()),this._activeBatch=s}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const s in e){const i=e[s],n=i.geometry;n.indexBuffer.setDataWithSize(i.indexBuffer,i.indexSize,!0),n.buffers[0].setDataWithSize(i.attributeBuffer.float32View,i.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const s in e){const i=e[s],n=i.geometry;i.dirty&&(i.dirty=!1,n.buffers[0].update(i.attributeSize*4))}}execute(t){if(t.action==="startBatch"){const e=t.batcher,s=e.geometry,i=e.shader;this._adaptor.start(this,s,i)}this._adaptor.execute(this,t)}destroy(){this.state=null,this.renderer=null,this._adaptor=null;for(const t in this._activeBatches)this._activeBatches[t].destroy();this._activeBatches=null}};$u.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"batch"},$u._availableBatchers=Object.create(null);let Hu=$u;k.handleByMap(y.Batcher,Hu._availableBatchers),k.add(xi);function S3(r){const t=r.split(/([\n{}])/g).map(s=>s.trim()).filter(s=>s.length);let e="";return t.map(s=>{let i=e+s;return s==="{"?e+=" ":s==="}"&&(e=e.substr(0,e.length-4),i=e+s),i}).join(`
`)}const h0={name:"texture-bit",vertex:{header:`
struct TextureUniforms {
uTextureMatrix:mat3x3<f32>,
}
@group(2) @binding(2) var<uniform> textureUniforms : TextureUniforms;
`,main:`
uv = (textureUniforms.uTextureMatrix * vec3(uv, 1.0)).xy;
`},fragment:{header:`
@group(2) @binding(0) var uTexture: texture_2d<f32>;
@group(2) @binding(1) var uSampler: sampler;
`,main:`
outColor = textureSample(uTexture, uSampler, vUV);
`}},d0={name:"texture-bit",vertex:{header:`
uniform mat3 uTextureMatrix;
`,main:`
uv = (uTextureMatrix * vec3(uv, 1.0)).xy;
`},fragment:{header:`
uniform sampler2D uTexture;
`,main:`
outColor = texture(uTexture, vUV);
`}};function p0(r,t){const e=r.root,s=r.instructionSet;s.reset();const i=t.renderPipes?t:t.batch.renderer,n=i.renderPipes;n.batch.buildStart(s),n.blendMode.buildStart(),n.colorMask.buildStart(),e.sortableChildren&&e.sortChildren(),f0(e,s,i,!0),n.batch.buildEnd(s),n.blendMode.buildEnd(s)}function Rs(r,t,e){const s=e.renderPipes?e:e.batch.renderer;r.globalDisplayStatus<7||!r.includeInBuild||(r.sortableChildren&&r.sortChildren(),r.isSimple?E3(r,t,s):f0(r,t,s,!1))}function E3(r,t,e){if(r.renderPipeId){const{renderPipes:s,renderableGC:i}=e;s.blendMode.setBlendMode(r,r.groupBlendMode,t),r.didViewUpdate=!1,s[r.renderPipeId].addRenderable(r,t),i.addRenderable(r,t)}if(!r.renderGroup){const s=r.children,i=s.length;for(let n=0;n<i;n++)Rs(s[n],t,e)}}function f0(r,t,e,s){const{renderPipes:i,renderableGC:n}=e;if(!s&&r.renderGroup)i.renderGroup.addRenderGroup(r.renderGroup,t);else{for(let u=0;u<r.effects.length;u++){const l=r.effects[u];i[l.pipe].push(l,r,t)}const o=r.renderPipeId;o&&(i.blendMode.setBlendMode(r,r.groupBlendMode,t),r.didViewUpdate=!1,i[o].addRenderable(r,t),n.addRenderable(r,t));const a=r.children;if(a.length)for(let u=0;u<a.length;u++)Rs(a[u],t,e);for(let u=r.effects.length-1;u>=0;u--){const l=r.effects[u];i[l.pipe].pop(l,r,t)}}}const w3=new pt;let C3=class extends Wr{constructor(){super(),this.filters=[new H_({sprite:new Xt(E.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}};class Xu{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,s){const i=this._renderer;if(i.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,canBundle:!1,maskedContainer:e}),t.renderMaskToTexture){const n=t.mask;n.includeInBuild=!0,Rs(n,s,i),n.includeInBuild=!1}i.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,canBundle:!1})}pop(t,e,s){this._renderer.renderPipes.batch.break(s),s.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,canBundle:!1})}execute(t){const e=this._renderer,s=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const i=H.get(C3);if(s){t.mask.mask.measurable=!0;const n=Yr(t.mask.mask,!0,w3);t.mask.mask.measurable=!1,n.ceil();const o=e.renderTarget.renderTarget.colorTexture.source,a=dt.getOptimalTexture(n.width,n.height,o._resolution,o.antialias);e.renderTarget.push(a,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});const u=i.sprite;u.texture=a,u.worldTransform.tx=n.minX,u.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer,filterTexture:a})}else i.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:i,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){const i=this._activeMaskStage[this._activeMaskStage.length-1];s&&(e.type===Tt.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:i.maskedContainer,filterEffect:i.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();const i=this._activeMaskStage.pop();s&&dt.returnTexture(i.filterTexture),H.return(i.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}Xu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"alphaMask"};class zu{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,s){this._renderer.renderPipes.batch.break(s);const i=this._colorStack;i[this._colorStackIndex]=i[this._colorStackIndex-1]&t.mask;const n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,s.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,s){this._renderer.renderPipes.batch.break(s);const i=this._colorStack;this._colorStackIndex--;const n=i[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,s.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}zu.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"colorMask"};class R3{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){oi(this.mask,t,e)}addLocalBounds(t,e){ai(this.mask,t,e)}containsPoint(t,e){const s=this.mask;return e(s,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}}class ju{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,s){var i,n;const o=t,a=this._renderer;a.renderPipes.batch.break(s),a.renderPipes.blendMode.setBlendMode(o.mask,"none",s),s.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,canBundle:!1});const u=o.mask;u.includeInBuild=!0,this._maskHash.has(o)||this._maskHash.set(o,{instructionsStart:0,instructionsLength:0});const l=this._maskHash.get(o);l.instructionsStart=s.instructionSize,Rs(u,s,a),u.includeInBuild=!1,a.renderPipes.batch.break(s),s.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,canBundle:!1});const c=s.instructionSize-l.instructionsStart-1;l.instructionsLength=c;const h=a.renderTarget.renderTarget.uid;(n=(i=this._maskStackHash)[h])!=null||(i[h]=0)}pop(t,e,s){const i=t,n=this._renderer;n.renderPipes.batch.break(s),n.renderPipes.blendMode.setBlendMode(i.mask,"none",s),s.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});const o=this._maskHash.get(t);for(let a=0;a<o.instructionsLength;a++)s.instructions[s.instructionSize++]=s.instructions[o.instructionsStart++];s.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,s;const i=this._renderer,n=i.renderTarget.renderTarget.uid;let o=(s=(e=this._maskStackHash)[n])!=null?s:e[n]=0;t.action==="pushMaskBegin"?(i.renderTarget.ensureDepthStencil(),i.stencil.setStencilMode(at.RENDERING_MASK_ADD,o),o++,i.colorMask.setMask(0)):t.action==="pushMaskEnd"?(i.stencil.setStencilMode(at.MASK_ACTIVE,o),i.colorMask.setMask(15)):t.action==="popMaskBegin"?(i.colorMask.setMask(0),o!==0?i.stencil.setStencilMode(at.RENDERING_MASK_REMOVE,o):(i.renderTarget.clear(null,At.STENCIL),i.stencil.setStencilMode(at.DISABLED,o)),o--):t.action==="popMaskEnd"&&(i.stencil.setStencilMode(at.MASK_ACTIVE,o),i.colorMask.setMask(15)),this._maskStackHash[n]=o}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}ju.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"stencilMask"};var Ps=(r=>(r[r.ELEMENT_ARRAY_BUFFER=34963]="ELEMENT_ARRAY_BUFFER",r[r.ARRAY_BUFFER=34962]="ARRAY_BUFFER",r[r.UNIFORM_BUFFER=35345]="UNIFORM_BUFFER",r))(Ps||{});class m0{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class Vu{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,s=this.getGlBuffer(t);e.bindBuffer(s.type,s.buffer)}bindBufferBase(t,e){const{_gl:s}=this;if(this._boundBufferBases[e]!==t){const i=this.getGlBuffer(t);this._boundBufferBases[e]=t,s.bindBufferBase(s.UNIFORM_BUFFER,e,i.buffer)}}bindBufferRange(t,e,s){const{_gl:i}=this;s=s||0;const n=this.getGlBuffer(t);i.bindBufferRange(i.UNIFORM_BUFFER,e||0,n.buffer,s*256,256)}updateBuffer(t){const{_gl:e}=this,s=this.getGlBuffer(t);if(t._updateID===s.updateID)return s;s.updateID=t._updateID,e.bindBuffer(s.type,s.buffer);const i=t.data;if(s.byteLength>=t.data.byteLength)e.bufferSubData(s.type,0,i,0,t._updateSize/i.BYTES_PER_ELEMENT);else{const n=t.descriptor.usage&X.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;s.byteLength=i.byteLength,e.bufferData(s.type,i,n)}return s}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const s=this._gpuBuffers[t.uid],i=this._gl;e||i.deleteBuffer(s.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let s=Ps.ARRAY_BUFFER;t.descriptor.usage&X.INDEX?s=Ps.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&X.UNIFORM&&(s=Ps.UNIFORM_BUFFER);const i=new m0(e.createBuffer(),s);return this._gpuBuffers[t.uid]=i,t.on("destroy",this.onBufferDestroy,this),i}}Vu.extension={type:[y.WebGLSystem],name:"buffer"};var P3=Object.defineProperty,D3=Object.defineProperties,M3=Object.getOwnPropertyDescriptors,g0=Object.getOwnPropertySymbols,O3=Object.prototype.hasOwnProperty,B3=Object.prototype.propertyIsEnumerable,_0=(r,t,e)=>t in r?P3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gn=(r,t)=>{for(var e in t||(t={}))O3.call(t,e)&&_0(r,e,t[e]);if(g0)for(var e of g0(t))B3.call(t,e)&&_0(r,e,t[e]);return r},b0=(r,t)=>D3(r,M3(t));const Wu=class wx{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){var e,s;t=gn(gn({},wx.defaultOptions),t);let i=this.multiView=t.multiView;if(t.context&&i&&(me("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),i=!1),i?this.canvas=L.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const n=this._renderer.background.alpha<1,o=(e=t.premultipliedAlpha)!=null?e:!0,a=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:o,antialias:a,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(s=t.powerPreference)!=null?s:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&me("multiView is disabled, but targetCanvas is not the main canvas");return}const{canvas:e}=this;(e.width<t.width||e.height<t.height)&&(e.width=Math.max(t.width,t.width),e.height=Math.max(t.height,t.height))}initFromContext(t){this.gl=t,this.webGLVersion=t instanceof L.get().getWebGLRenderingContext()?1:2,this.getExtensions(),this.validateContext(t),this._renderer.runners.contextChange.emit(t);const e=this._renderer.view.canvas;e.addEventListener("webglcontextlost",this.handleContextLost,!1),e.addEventListener("webglcontextrestored",this.handleContextRestored,!1)}createContext(t,e){let s;const i=this.canvas;if(t===2&&(s=i.getContext("webgl2",e)),!s&&(s=i.getContext("webgl",e),!s))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=s,this.initFromContext(this.gl)}getExtensions(){const{gl:t}=this,e={anisotropicFiltering:t.getExtension("EXT_texture_filter_anisotropic"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),s3tc:t.getExtension("WEBGL_compressed_texture_s3tc"),s3tc_sRGB:t.getExtension("WEBGL_compressed_texture_s3tc_srgb"),etc:t.getExtension("WEBGL_compressed_texture_etc"),etc1:t.getExtension("WEBGL_compressed_texture_etc1"),pvrtc:t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),atc:t.getExtension("WEBGL_compressed_texture_atc"),astc:t.getExtension("WEBGL_compressed_texture_astc"),bptc:t.getExtension("EXT_texture_compression_bptc"),rgtc:t.getExtension("EXT_texture_compression_rgtc"),loseContext:t.getExtension("WEBGL_lose_context")};if(this.webGLVersion===1)this.extensions=b0(gn({},e),{drawBuffers:t.getExtension("WEBGL_draw_buffers"),depthTexture:t.getExtension("WEBGL_depth_texture"),vertexArrayObject:t.getExtension("OES_vertex_array_object")||t.getExtension("MOZ_OES_vertex_array_object")||t.getExtension("WEBKIT_OES_vertex_array_object"),uint32ElementIndex:t.getExtension("OES_element_index_uint"),floatTexture:t.getExtension("OES_texture_float"),floatTextureLinear:t.getExtension("OES_texture_float_linear"),textureHalfFloat:t.getExtension("OES_texture_half_float"),textureHalfFloatLinear:t.getExtension("OES_texture_half_float_linear"),vertexAttribDivisorANGLE:t.getExtension("ANGLE_instanced_arrays"),srgb:t.getExtension("EXT_sRGB")});else{this.extensions=b0(gn({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const s=t.getExtension("WEBGL_provoking_vertex");s&&s.provokingVertexWEBGL(s.FIRST_VERTEX_CONVENTION_WEBGL)}}handleContextLost(t){t.preventDefault(),this._contextLossForced&&(this._contextLossForced=!1,setTimeout(()=>{var e;this.gl.isContextLost()&&((e=this.extensions.loseContext)==null||e.restoreContext())},0))}handleContextRestored(){this._renderer.runners.contextChange.emit(this.gl)}destroy(){var t;const e=this._renderer.view.canvas;this._renderer=null,e.removeEventListener("webglcontextlost",this.handleContextLost),e.removeEventListener("webglcontextrestored",this.handleContextRestored),this.gl.useProgram(null),(t=this.extensions.loseContext)==null||t.loseContext()}forceContextLoss(){var t;(t=this.extensions.loseContext)==null||t.loseContext(),this._contextLossForced=!0}validateContext(t){const e=t.getContextAttributes();e&&e.stencil;const s=this.supports,i=this.webGLVersion===2,n=this.extensions;s.uint32Indices=i||!!n.uint32ElementIndex,s.uniformBufferObject=i,s.vertexArrayObject=i||!!n.vertexArrayObject,s.srgbTextures=i||!!n.srgb,s.nonPowOf2wrapping=i,s.nonPowOf2mipmaps=i,s.msaa=i,s.uint32Indices}};Wu.extension={type:[y.WebGLSystem],name:"context"},Wu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let x0=Wu;function Yu(r,t){var e,s,i;for(const n in r.attributes){const o=r.attributes[n],a=t[n];a?((e=o.format)!=null||(o.format=a.format),(s=o.offset)!=null||(o.offset=a.offset),(i=o.instance)!=null||(o.instance=a.instance)):me(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}G3(r)}function G3(r){var t,e;const{buffers:s,attributes:i}=r,n={},o={};for(const a in s){const u=s[a];n[u.uid]=0,o[u.uid]=0}for(const a in i){const u=i[a];n[u.buffer.uid]+=ir(u.format).stride}for(const a in i){const u=i[a];(t=u.stride)!=null||(u.stride=n[u.buffer.uid]),(e=u.start)!=null||(u.start=o[u.buffer.uid]),o[u.buffer.uid]+=ir(u.format).stride}}var _n=(r=>(r[r.RGBA=6408]="RGBA",r[r.RGB=6407]="RGB",r[r.RG=33319]="RG",r[r.RED=6403]="RED",r[r.RGBA_INTEGER=36249]="RGBA_INTEGER",r[r.RGB_INTEGER=36248]="RGB_INTEGER",r[r.RG_INTEGER=33320]="RG_INTEGER",r[r.RED_INTEGER=36244]="RED_INTEGER",r[r.ALPHA=6406]="ALPHA",r[r.LUMINANCE=6409]="LUMINANCE",r[r.LUMINANCE_ALPHA=6410]="LUMINANCE_ALPHA",r[r.DEPTH_COMPONENT=6402]="DEPTH_COMPONENT",r[r.DEPTH_STENCIL=34041]="DEPTH_STENCIL",r))(_n||{}),qu=(r=>(r[r.TEXTURE_2D=3553]="TEXTURE_2D",r[r.TEXTURE_CUBE_MAP=34067]="TEXTURE_CUBE_MAP",r[r.TEXTURE_2D_ARRAY=35866]="TEXTURE_2D_ARRAY",r[r.TEXTURE_CUBE_MAP_POSITIVE_X=34069]="TEXTURE_CUBE_MAP_POSITIVE_X",r[r.TEXTURE_CUBE_MAP_NEGATIVE_X=34070]="TEXTURE_CUBE_MAP_NEGATIVE_X",r[r.TEXTURE_CUBE_MAP_POSITIVE_Y=34071]="TEXTURE_CUBE_MAP_POSITIVE_Y",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Y=34072]="TEXTURE_CUBE_MAP_NEGATIVE_Y",r[r.TEXTURE_CUBE_MAP_POSITIVE_Z=34073]="TEXTURE_CUBE_MAP_POSITIVE_Z",r[r.TEXTURE_CUBE_MAP_NEGATIVE_Z=34074]="TEXTURE_CUBE_MAP_NEGATIVE_Z",r))(qu||{}),y0=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(y0||{}),z=(r=>(r[r.UNSIGNED_BYTE=5121]="UNSIGNED_BYTE",r[r.UNSIGNED_SHORT=5123]="UNSIGNED_SHORT",r[r.UNSIGNED_SHORT_5_6_5=33635]="UNSIGNED_SHORT_5_6_5",r[r.UNSIGNED_SHORT_4_4_4_4=32819]="UNSIGNED_SHORT_4_4_4_4",r[r.UNSIGNED_SHORT_5_5_5_1=32820]="UNSIGNED_SHORT_5_5_5_1",r[r.UNSIGNED_INT=5125]="UNSIGNED_INT",r[r.UNSIGNED_INT_10F_11F_11F_REV=35899]="UNSIGNED_INT_10F_11F_11F_REV",r[r.UNSIGNED_INT_2_10_10_10_REV=33640]="UNSIGNED_INT_2_10_10_10_REV",r[r.UNSIGNED_INT_24_8=34042]="UNSIGNED_INT_24_8",r[r.UNSIGNED_INT_5_9_9_9_REV=35902]="UNSIGNED_INT_5_9_9_9_REV",r[r.BYTE=5120]="BYTE",r[r.SHORT=5122]="SHORT",r[r.INT=5124]="INT",r[r.FLOAT=5126]="FLOAT",r[r.FLOAT_32_UNSIGNED_INT_24_8_REV=36269]="FLOAT_32_UNSIGNED_INT_24_8_REV",r[r.HALF_FLOAT=36193]="HALF_FLOAT",r))(z||{});const v0={uint8x2:z.UNSIGNED_BYTE,uint8x4:z.UNSIGNED_BYTE,sint8x2:z.BYTE,sint8x4:z.BYTE,unorm8x2:z.UNSIGNED_BYTE,unorm8x4:z.UNSIGNED_BYTE,snorm8x2:z.BYTE,snorm8x4:z.BYTE,uint16x2:z.UNSIGNED_SHORT,uint16x4:z.UNSIGNED_SHORT,sint16x2:z.SHORT,sint16x4:z.SHORT,unorm16x2:z.UNSIGNED_SHORT,unorm16x4:z.UNSIGNED_SHORT,snorm16x2:z.SHORT,snorm16x4:z.SHORT,float16x2:z.HALF_FLOAT,float16x4:z.HALF_FLOAT,float32:z.FLOAT,float32x2:z.FLOAT,float32x3:z.FLOAT,float32x4:z.FLOAT,uint32:z.UNSIGNED_INT,uint32x2:z.UNSIGNED_INT,uint32x3:z.UNSIGNED_INT,uint32x4:z.UNSIGNED_INT,sint32:z.INT,sint32x2:z.INT,sint32x3:z.INT,sint32x4:z.INT};function T0(r){var t;return(t=v0[r])!=null?t:v0.float32}const I3={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Ku{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){const t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=i=>e.bindVertexArrayOES(i),t.deleteVertexArray=i=>e.deleteVertexArrayOES(i));const s=this._renderer.context.extensions.vertexAttribDivisorANGLE;s&&(t.drawArraysInstanced=(i,n,o,a)=>{s.drawArraysInstancedANGLE(i,n,o,a)},t.drawElementsInstanced=(i,n,o,a,u)=>{s.drawElementsInstancedANGLE(i,n,o,a,u)},t.vertexAttribDivisor=(i,n)=>s.vertexAttribDivisorANGLE(i,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const s=this.gl;this._activeGeometry=t;const i=this.getVao(t,e);this._activeVao!==i&&(this._activeVao=i,s.bindVertexArray(i)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let s=0;s<t.buffers.length;s++){const i=t.buffers[s];e.updateBuffer(i)}}checkCompatibility(t,e){const s=t.attributes,i=e._attributeData;for(const n in i)if(!s[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const s=t.attributes,i=e._attributeData,n=["g",t.uid];for(const o in s)i[o]&&n.push(o,i[o].location);return n.join("-")}getVao(t,e){var s;return((s=this._geometryVaoHash[t.uid])==null?void 0:s[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,s=!0){const i=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const o=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));const a=this._geometryVaoHash[t.uid];let u=a[o];if(u)return a[e._key]=u,u;Yu(t,e._attributeData);const l=t.buffers;u=i.createVertexArray(),i.bindVertexArray(u);for(let c=0;c<l.length;c++){const h=l[c];n.bind(h)}return this.activateVao(t,e),a[e._key]=u,a[o]=u,i.bindVertexArray(null),u}onGeometryDestroy(t,e){const s=this._geometryVaoHash[t.uid],i=this.gl;if(s){if(e)for(const n in s)this._activeVao!==s[n]&&this.unbind(),i.deleteVertexArray(s[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){const e=this.gl;for(const s in this._geometryVaoHash){if(t)for(const i in this._geometryVaoHash[s]){const n=this._geometryVaoHash[s];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[i])}this._geometryVaoHash[s]=null}}activateVao(t,e){var s,i;const n=this._renderer.gl,o=this._renderer.buffer,a=t.attributes;t.indexBuffer&&o.bind(t.indexBuffer);let u=null;for(const l in a){const c=a[l],h=c.buffer,d=o.getGlBuffer(h),p=e._attributeData[l];if(p){u!==d&&(o.bind(h),u=d);const f=p.location;n.enableVertexAttribArray(f);const g=ir(c.format),m=T0(c.format);if(((s=p.format)==null?void 0:s.substring(1,4))==="int"?n.vertexAttribIPointer(f,g.size,m,c.stride,c.offset):n.vertexAttribPointer(f,g.size,m,g.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const _=(i=c.divisor)!=null?i:1;n.vertexAttribDivisor(f,_)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,s,i){const{gl:n}=this._renderer,o=this._activeGeometry,a=I3[o.topology||t];if(i||(i=o.instanceCount),o.indexBuffer){const u=o.indexBuffer.data.BYTES_PER_ELEMENT,l=u===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;i>1?n.drawElementsInstanced(a,e||o.indexBuffer.data.length,l,(s||0)*u,i):n.drawElements(a,e||o.indexBuffer.data.length,l,(s||0)*u)}else i>1?n.drawArraysInstanced(a,s||0,e||o.getSize(),i):n.drawArrays(a,s||0,e||o.getSize());return this}unbind(){this.gl.bindVertexArray(null),this._activeVao=null,this._activeGeometry=null}destroy(){this._renderer=null,this.gl=null,this._activeVao=null,this._activeGeometry=null}}Ku.extension={type:[y.WebGLSystem],name:"geometry"};var F3=Object.defineProperty,A0=Object.getOwnPropertySymbols,U3=Object.prototype.hasOwnProperty,k3=Object.prototype.propertyIsEnumerable,S0=(r,t,e)=>t in r?F3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,E0=(r,t)=>{for(var e in t||(t={}))U3.call(t,e)&&S0(r,e,t[e]);if(A0)for(var e of A0(t))k3.call(t,e)&&S0(r,e,t[e]);return r};const N3=new rr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Zu=class Cx{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:s}=E0(E0({},Cx.defaultOptions),t);this.useBackBuffer=e,this._antialias=s,this._renderer.context.supports.msaa||(me("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Lt.for2d();const i=new It({vertex:`
attribute vec2 aPosition;
out vec2 vUv;
void main() {
gl_Position = vec4(aPosition, 0.0, 1.0);
vUv = (aPosition + 1.0) / 2.0;
// flip dem UVs
vUv.y = 1.0 - vUv.y;
}`,fragment:`
in vec2 vUv;
out vec4 finalColor;
uniform sampler2D uTexture;
void main() {
finalColor = texture(uTexture, vUv);
}`,name:"big-triangle"});this._bigTriangleShader=new Ut({glProgram:i,resources:{uTexture:E.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const s=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=s.colorTexture,t.target=this._getBackBufferTexture(s.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:N3,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new E({source:new tt({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Zu.extension={type:[y.WebGLSystem],name:"backBuffer",priority:1},Zu.defaultOptions={useBackBuffer:!1};let w0=Zu;class Qu{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.gl.colorMask(!!(t&8),!!(t&4),!!(t&2),!!(t&1)))}}Qu.extension={type:[y.WebGLSystem],name:"colorMask"};class Ju{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:s,shader:i,state:n,skipSync:o,topology:a,size:u,start:l,instanceCount:c}=t;e.shader.bind(i,o),e.geometry.bind(s,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(a,u,l,c!=null?c:s.instanceCount)}destroy(){this._renderer=null}}Ju.extension={type:[y.WebGLSystem],name:"encoder"};class C0{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const xe=[];xe[at.NONE]=void 0,xe[at.DISABLED]={stencilWriteMask:0,stencilReadMask:0},xe[at.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},xe[at.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},xe[at.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};class tl{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:at.NONE},this._renderTargetStencilState=Object.create(null),t.renderTarget.onRenderTargetChange.add(this)}contextChange(t){this._gl=t,this._comparisonFuncMapping={always:t.ALWAYS,never:t.NEVER,equal:t.EQUAL,"not-equal":t.NOTEQUAL,less:t.LESS,"less-equal":t.LEQUAL,greater:t.GREATER,"greater-equal":t.GEQUAL},this._stencilOpsMapping={keep:t.KEEP,zero:t.ZERO,replace:t.REPLACE,invert:t.INVERT,"increment-clamp":t.INCR,"decrement-clamp":t.DECR,"increment-wrap":t.INCR_WRAP,"decrement-wrap":t.DECR_WRAP},this._stencilCache.enabled=!1,this._stencilCache.stencilMode=at.NONE,this._stencilCache.stencilReference=0}onRenderTargetChange(t){if(this._activeRenderTarget===t)return;this._activeRenderTarget=t;let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:at.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid],i=this._gl,n=xe[t],o=this._stencilCache;if(s.stencilMode=t,s.stencilReference=e,t===at.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,i.disable(i.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,i.enable(i.STENCIL_TEST)),(t!==o.stencilMode||o.stencilReference!==e)&&(o.stencilMode=t,o.stencilReference=e,i.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),i.stencilOp(i.KEEP,i.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}tl.extension={type:[y.WebGLSystem],name:"stencil"};class el{constructor(t){this._syncFunctionHash=Object.create(null),this._adaptor=t,this._systemCheck()}_systemCheck(){if(!ru())throw new Error("Current environment does not allow unsafe-eval, please use pixi.js/unsafe-eval module to enable support.")}ensureUniformGroup(t){const e=this.getUniformGroupData(t);t.buffer||(t.buffer=new Rt({data:new Float32Array(e.layout.size/4),usage:X.UNIFORM|X.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let s=this._syncFunctionHash[e];if(!s){const i=Object.keys(t.uniformStructures).map(a=>t.uniformStructures[a]),n=this._adaptor.createUboElements(i),o=this._generateUboSync(n.uboElements);s=this._syncFunctionHash[e]={layout:n,syncFunction:o}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,s){const i=this.getUniformGroupData(t);return t.buffer||(t.buffer=new Rt({data:new Float32Array(i.layout.size/4),usage:X.UNIFORM|X.COPY_DST})),e||(e=t.buffer.data),s||(s=0),i.syncFunction(t.uniforms,e,s),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const rl={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function R0(r){const t=r.map(n=>({data:n,offset:0,size:0}));let e=0,s=0,i=0;for(let n=0;n<t.length;n++){const o=t[n];if(e=rl[o.data.type],!e)throw new Error(`Unknown type ${o.data.type}`);if(o.data.size>1&&(e=Math.max(e,16)*o.data.size),o.size=e,s%e!==0&&s<16){const a=s%e%16;s+=a,i+=a}s+e>16?(i=Math.ceil(i/16)*16,o.offset=i,i+=e,s=e):(o.offset=i,s+=e,i+=e)}return i=Math.ceil(i/16)*16,{uboElements:t,size:i}}const ye=[{type:"mat3x3<f32>",test:r=>r.value.a!==void 0,ubo:`
var matrix = uv[name].toArray(true);
data[offset] = matrix[0];
data[offset + 1] = matrix[1];
data[offset + 2] = matrix[2];
data[offset + 4] = matrix[3];
data[offset + 5] = matrix[4];
data[offset + 6] = matrix[5];
data[offset + 8] = matrix[6];
data[offset + 9] = matrix[7];
data[offset + 10] = matrix[8];
`,uniform:`
gl.uniformMatrix3fv(ud[name].location, false, uv[name].toArray(true));
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.width!==void 0,ubo:`
v = uv[name];
data[offset] = v.x;
data[offset + 1] = v.y;
data[offset + 2] = v.width;
data[offset + 3] = v.height;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.x || cv[1] !== v.y || cv[2] !== v.width || cv[3] !== v.height) {
cv[0] = v.x;
cv[1] = v.y;
cv[2] = v.width;
cv[3] = v.height;
gl.uniform4f(ud[name].location, v.x, v.y, v.width, v.height);
}
`},{type:"vec2<f32>",test:r=>r.type==="vec2<f32>"&&r.size===1&&r.value.x!==void 0,ubo:`
v = uv[name];
data[offset] = v.x;
data[offset + 1] = v.y;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.x || cv[1] !== v.y) {
cv[0] = v.x;
cv[1] = v.y;
gl.uniform2f(ud[name].location, v.x, v.y);
}
`},{type:"vec4<f32>",test:r=>r.type==="vec4<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
v = uv[name];
data[offset] = v.red;
data[offset + 1] = v.green;
data[offset + 2] = v.blue;
data[offset + 3] = v.alpha;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue || cv[3] !== v.alpha) {
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
cv[3] = v.alpha;
gl.uniform4f(ud[name].location, v.red, v.green, v.blue, v.alpha);
}
`},{type:"vec3<f32>",test:r=>r.type==="vec3<f32>"&&r.size===1&&r.value.red!==void 0,ubo:`
v = uv[name];
data[offset] = v.red;
data[offset + 1] = v.green;
data[offset + 2] = v.blue;
`,uniform:`
cv = ud[name].value;
v = uv[name];
if (cv[0] !== v.red || cv[1] !== v.green || cv[2] !== v.blue) {
cv[0] = v.red;
cv[1] = v.green;
cv[2] = v.blue;
gl.uniform3f(ud[name].location, v.red, v.green, v.blue);
}
`}];function sl(r,t,e,s){const i=[`
var v = null;
var v2 = null;
var t = 0;
var index = 0;
var name = null;
var arrayOffset = null;
`];let n=0;for(let a=0;a<r.length;a++){const u=r[a],l=u.data.name;let c=!1,h=0;for(let d=0;d<ye.length;d++)if(ye[d].test(u.data)){h=u.offset/4,i.push(`name = "${l}";`,`offset += ${h-n};`,ye[d][t]||ye[d].ubo),c=!0;break}if(!c)if(u.data.size>1)h=u.offset/4,i.push(e(u,h-n));else{const d=s[u.data.type];h=u.offset/4,i.push(`
v = uv.${l};
offset += ${h-n};
${d};
`)}n=h}const o=i.join(`
`);return new Function("uv","data","offset",o)}var L3=Object.defineProperty,$3=Object.defineProperties,H3=Object.getOwnPropertyDescriptors,P0=Object.getOwnPropertySymbols,X3=Object.prototype.hasOwnProperty,z3=Object.prototype.propertyIsEnumerable,D0=(r,t,e)=>t in r?L3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,j3=(r,t)=>{for(var e in t||(t={}))X3.call(t,e)&&D0(r,e,t[e]);if(P0)for(var e of P0(t))z3.call(t,e)&&D0(r,e,t[e]);return r},V3=(r,t)=>$3(r,H3(t));function yr(r,t){return`
for (let i = 0; i < ${r*t}; i++) {
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
}
`}const il={f32:`
data[offset] = v;`,i32:`
data[offset] = v;`,"vec2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];`,"vec3<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];`,"vec4<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 3] = v[3];`,"mat2x2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 4] = v[2];
data[offset + 5] = v[3];`,"mat3x3<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 4] = v[3];
data[offset + 5] = v[4];
data[offset + 6] = v[5];
data[offset + 8] = v[6];
data[offset + 9] = v[7];
data[offset + 10] = v[8];`,"mat4x4<f32>":`
for (let i = 0; i < 16; i++) {
data[offset + i] = v[i];
}`,"mat3x2<f32>":yr(3,2),"mat4x2<f32>":yr(4,2),"mat2x3<f32>":yr(2,3),"mat4x3<f32>":yr(4,3),"mat2x4<f32>":yr(2,4),"mat3x4<f32>":yr(3,4)},M0=V3(j3({},il),{"mat2x2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 3] = v[3];
`});function O0(r,t){const e=Math.max(rl[r.data.type]/16,1),s=r.data.value.length/r.data.size,i=(4-s%4)%4;return`
v = uv.${r.data.name};
offset += ${t};
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*e}; i++)
{
for(var j = 0; j < ${s}; j++)
{
data[arrayOffset++] = v[t++];
}
${i!==0?`arrayOffset += ${i};`:""}
}
`}function B0(r){return sl(r,"uboStd40",O0,il)}class nl extends el{constructor(){super({createUboElements:R0,generateUboSync:B0})}}nl.extension={type:[y.WebGLSystem],name:"ubo"};class G0{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new V}copyToTexture(t,e,s,i,n){const o=this._renderTargetSystem,a=this._renderer,u=o.getGpuRenderTarget(t),l=a.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,u.resolveTargetFramebuffer),a.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,s.x,s.y,i.width,i.height),e}startRenderPass(t,e=!0,s,i){const n=this._renderTargetSystem,o=t.colorTexture,a=n.getGpuRenderTarget(t);let u=i.y;t.isRoot&&(u=o.pixelHeight-i.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,a.framebuffer);const c=this._viewPortCache;(c.x!==i.x||c.y!==u||c.width!==i.width||c.height!==i.height)&&(c.x=i.x,c.y=u,c.width=i.width,c.height=i.height,l.viewport(i.x,u,i.width,i.height)),!a.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(a),this.clear(t,e,s)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const s=this._renderer.gl;s.bindFramebuffer(s.FRAMEBUFFER,e.resolveTargetFramebuffer),s.bindFramebuffer(s.READ_FRAMEBUFFER,e.framebuffer),s.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,s.COLOR_BUFFER_BIT,s.NEAREST),s.bindFramebuffer(s.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer.gl,s=new C0,i=t.colorTexture;return ne.test(i.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),s.framebuffer=null,s):(this._initColor(t,s),e.bindFramebuffer(e.FRAMEBUFFER,null),s)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(s=>{e.deleteRenderbuffer(s)}),t.msaaRenderBuffer=null}clear(t,e,s){if(!e)return;const i=this._renderTargetSystem;typeof e=="boolean"&&(e=e?At.ALL:At.NONE);const n=this._renderer.gl;if(e&At.COLOR){s!=null||(s=i.defaultClearColor);const o=this._clearColorCache,a=s;(o[0]!==a[0]||o[1]!==a[1]||o[2]!==a[2]||o[3]!==a[3])&&(o[0]=a[0],o[1]=a[1],o[2]=a[2],o[3]=a[3],n.clearColor(a[0],a[1],a[2],a[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const s=this._renderer,i=s.gl,n=i.createFramebuffer();if(e.resolveTargetFramebuffer=n,i.bindFramebuffer(i.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((o,a)=>{const u=o.source;u.antialias&&(s.context.supports.msaa?e.msaa=!0:me("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),s.texture.bindSource(u,0);const l=s.texture.getGlSource(u).texture;i.framebufferTexture2D(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0+a,3553,l,0)}),e.msaa){const o=i.createFramebuffer();e.framebuffer=o,i.bindFramebuffer(i.FRAMEBUFFER,o),t.colorTextures.forEach((a,u)=>{const l=i.createRenderbuffer();e.msaaRenderBuffer[u]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){const s=t.colorTexture.source;if(e.width=s.pixelWidth,e.height=s.pixelHeight,t.colorTextures.forEach((i,n)=>{n!==0&&i.source.resize(s.width,s.height,s._resolution)}),e.msaa){const i=this._renderer,n=i.gl,o=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,o),t.colorTextures.forEach((a,u)=>{const l=a.source;i.texture.bindSource(l,0);const c=i.texture.getGlSource(l).internalFormat,h=e.msaaRenderBuffer[u];n.bindRenderbuffer(n.RENDERBUFFER,h),n.renderbufferStorageMultisample(n.RENDERBUFFER,4,c,l.pixelWidth,l.pixelHeight),n.framebufferRenderbuffer(n.FRAMEBUFFER,n.COLOR_ATTACHMENT0+u,n.RENDERBUFFER,h)})}}_initStencil(t){if(t.framebuffer===null)return;const e=this._renderer.gl,s=e.createRenderbuffer();t.depthStencilRenderBuffer=s,e.bindRenderbuffer(e.RENDERBUFFER,s),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,s),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}postrender(t){if(this._renderer.context.multiView&&ne.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,s=t.colorTexture;s.context2D.drawImage(e,0,s.pixelHeight-e.height)}}}function I0(r,t,e,s,i,n){const o=n?1:-1;return r.identity(),r.a=1/s*2,r.d=o*(1/i*2),r.tx=-1-t*r.a,r.ty=-o-e*r.d,r}var W3=Object.defineProperty,F0=Object.getOwnPropertySymbols,Y3=Object.prototype.hasOwnProperty,q3=Object.prototype.propertyIsEnumerable,U0=(r,t,e)=>t in r?W3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,K3=(r,t)=>{for(var e in t||(t={}))Y3.call(t,e)&&U0(r,e,t[e]);if(F0)for(var e of F0(t))q3.call(t,e)&&U0(r,e,t[e]);return r};const vr=new Map;function ol(r,t){if(!vr.has(r)){const e=new E({source:new ne(K3({resource:r},t))}),s=()=>{vr.get(r)===e&&vr.delete(r)};e.once("destroy",s),e.source.once("destroy",s),vr.set(r,e)}return vr.get(r)}function Z3(r){return vr.has(r)}function k0(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var Q3=Object.defineProperty,N0=Object.getOwnPropertySymbols,J3=Object.prototype.hasOwnProperty,tw=Object.prototype.propertyIsEnumerable,L0=(r,t,e)=>t in r?Q3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$0=(r,t)=>{for(var e in t||(t={}))J3.call(t,e)&&L0(r,e,t[e]);if(N0)for(var e of N0(t))tw.call(t,e)&&L0(r,e,t[e]);return r};const H0=class Rx{constructor(t={}){if(this.uid=Q("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=$0($0({},Rx.defaultOptions),t),this.stencil=t.stencil,this.depth=t.depth,this.isRoot=t.isRoot,typeof t.colorTextures=="number"){this._managedColorTextures=!0;for(let e=0;e<t.colorTextures;e++)this.colorTextures.push(new tt({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(s=>s.source)];const e=this.colorTexture.source;this.resize(e.width,e.height,e._resolution)}this.colorTexture.source.on("resize",this.onSourceResize,this),(t.depthStencilTexture||this.stencil)&&(t.depthStencilTexture instanceof E||t.depthStencilTexture instanceof tt?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new tt({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,s=this.resolution,i=!1){this.dirtyId++,this.colorTextures.forEach((n,o)=>{i&&o===0||n.source.resize(t,e,s)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,s)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};H0.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let bn=H0;class al{constructor(t){this.rootViewPort=new V,this.viewport=new V,this.onRenderTargetChange=new su("onRenderTargetChange"),this.projectionMatrix=new B,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:s,frame:i}){this._renderTargetStack.length=0,this.push(t,e,s,i),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=k0(this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,s,i){const n=this.getRenderTarget(t),o=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;const a=this.getGpuRenderTarget(n);(n.pixelWidth!==a.width||n.pixelHeight!==a.height)&&(this.adaptor.resizeGpuRenderTarget(n),a.width=n.pixelWidth,a.height=n.pixelHeight);const u=n.colorTexture,l=this.viewport,c=u.pixelWidth,h=u.pixelHeight;if(!i&&t instanceof E&&(i=t.frame),i){const d=u._resolution;l.x=i.x*d+.5|0,l.y=i.y*d+.5|0,l.width=i.width*d+.5|0,l.height=i.height*d+.5|0}else l.x=0,l.y=0,l.width=c,l.height=h;return I0(this.projectionMatrix,0,0,l.width/u.resolution,l.height/u.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,s,l),o&&this.onRenderTargetChange.emit(n),n}clear(t,e=At.ALL,s){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,s,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=At.ALL,s,i){const n=this.bind(t,e,s,i);return this._renderTargetStack.push({renderTarget:n,frame:i}),n}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,s,i,n){s.x<0&&(i.width+=s.x,n.x-=s.x,s.x=0),s.y<0&&(i.height+=s.y,n.y-=s.y,s.y=0);const{pixelWidth:o,pixelHeight:a}=t;return i.width=Math.min(i.width,o-s.x),i.height=Math.min(i.height,a-s.y),this.adaptor.copyToTexture(t,e,s,i,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return ne.test(t)&&(t=ol(t).source),t instanceof bn?e=t:t instanceof tt&&(e=new bn({colorTextures:[t]}),ne.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const s=this._gpuRenderTargetHash[e.uid];s&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(s))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}class ul extends al{constructor(t){super(t),this.adaptor=new G0,this.adaptor.init(t,this)}}ul.extension={type:[y.WebGLSystem],name:"renderTarget"};class xn extends Ct{constructor({buffer:t,offset:e,size:s}){super(),this.uid=Q("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=Q("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=s,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=Q("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function X0(r,t){const e=[],s=[`
var g = s.groups;
var sS = r.shader;
var p = s.glProgram;
var ugS = r.uniformGroup;
var resources;
`];let i=!1,n=0,o=0;const a=t._getProgramData(r.glProgram);for(const l in r.groups){const c=r.groups[l];e.push(`
resources = g[${l}].resources;
`);for(const h in c.resources){const d=c.resources[h];if(d instanceof it)d.ubo?e.push(`
sS.bindUniformBlock(
resources[${h}],
sS._uniformBindMap[${l}[${h}],
${n++}
);
`):e.push(`
ugS.updateUniformGroup(resources[${h}], p, sD);
`);else if(d instanceof xn)e.push(`
sS.bindUniformBlock(
resources[${h}],
sS._uniformBindMap[${l}[${h}],
${n++}
);
`);else if(d instanceof tt){const p=r._uniformBindMap[l][h],f=a.uniformData[p];f&&(i||(i=!0,s.push(`
var tS = r.texture;
`)),t._gl.uniform1i(f.location,o),e.push(`
tS.bind(resources[${h}], ${o});
`),o++)}}}const u=[...s,...e].join(`
`);return new Function("r","s","sD",u)}class ew{}class z0{constructor(t,e){this.program=t,this.uniformData=e,this.uniformGroups={},this.uniformDirtyGroups={},this.uniformBlockBindings={}}destroy(){this.uniformData=null,this.uniformGroups=null,this.uniformDirtyGroups=null,this.uniformBlockBindings=null,this.program=null}}function ll(r,t,e){const s=r.createShader(t);return r.shaderSource(s,e),r.compileShader(s),s}function cl(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function hl(r,t){switch(r){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 cl(2*t);case"bvec3":return cl(3*t);case"bvec4":return cl(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}let yn=null;const j0={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"},rw={float:"float32",vec2:"float32x2",vec3:"float32x3",vec4:"float32x4",int:"sint32",ivec2:"sint32x2",ivec3:"sint32x3",ivec4:"sint32x4",uint:"uint32",uvec2:"uint32x2",uvec3:"uint32x3",uvec4:"uint32x4",bool:"uint32",bvec2:"uint32x2",bvec3:"uint32x3",bvec4:"uint32x4"};function dl(r,t){if(!yn){const e=Object.keys(j0);yn={};for(let s=0;s<e.length;++s){const i=e[s];yn[r[i]]=j0[i]}}return yn[t]}function V0(r,t){const e=dl(r,t);return rw[e]||"float32"}function W0(r,t,e=!1){const s={},i=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let o=0;o<i;o++){const a=t.getActiveAttrib(r,o);if(a.name.startsWith("gl_"))continue;const u=V0(t,a.type);s[a.name]={location:0,format:u,stride:ir(u).stride,offset:0,instance:!1,start:0}}const n=Object.keys(s);if(e){n.sort((o,a)=>o>a?1:-1);for(let o=0;o<n.length;o++)s[n[o]].location=o,t.bindAttribLocation(r,o,n[o]);t.linkProgram(r)}else for(let o=0;o<n.length;o++)s[n[o]].location=t.getAttribLocation(r,n[o]);return s}function Y0(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let i=0;i<s;i++){const n=t.getActiveUniformBlockName(r,i),o=t.getUniformBlockIndex(r,n),a=t.getActiveUniformBlockParameter(r,i,t.UNIFORM_BLOCK_DATA_SIZE);e[n]={name:n,index:o,size:a}}return e}function q0(r,t){const e={},s=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let i=0;i<s;i++){const n=t.getActiveUniform(r,i),o=n.name.replace(/\[.*?\]$/,""),a=!!n.name.match(/\[.*?\]$/),u=dl(t,n.type);e[o]={name:o,index:i,type:u,size:n.size,isArray:a,value:hl(u,n.size)}}return e}function K0(r,t){const e=r.getShaderSource(t).split(`
`).map((l,c)=>`${c}: ${l}`),s=r.getShaderInfoLog(t),i=s.split(`
`),n={},o=i.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),a=[""];o.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,a.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=e.join(`
`);a[0]=u,console.error(s),console.groupCollapsed("click to view full shader code"),console.warn(...a),console.groupEnd()}function Z0(r,t,e,s){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||K0(r,e),r.getShaderParameter(s,r.COMPILE_STATUS)||K0(r,s),console.error("PixiJS Error: Could not initialize shader."),r.getProgramInfoLog(t)!==""&&console.warn("PixiJS Warning: gl.getProgramInfoLog()",r.getProgramInfoLog(t)))}function Q0(r,t){const e=ll(r,r.VERTEX_SHADER,t.vertex),s=ll(r,r.FRAGMENT_SHADER,t.fragment),i=r.createProgram();r.attachShader(i,e),r.attachShader(i,s);const n=t.transformFeedbackVaryings;n&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(i,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(i),r.getProgramParameter(i,r.LINK_STATUS)||Z0(r,i,e,s),t._attributeData=W0(i,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=q0(i,r),t._uniformBlockData=Y0(i,r),r.deleteShader(e),r.deleteShader(s);const o={};for(const a in t._uniformData){const u=t._uniformData[a];o[a]={location:r.getUniformLocation(i,a),value:hl(u.type,u.size)}}return new z0(i,o)}const vn={textureCount:0,blockIndex:0};class pl{constructor(t){this._activeProgram=null,this._programDataHash=Object.create(null),this._nextIndex=0,this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._renderer=t}contextChange(t){this._gl=t,this._maxBindings=t.MAX_UNIFORM_BUFFER_BINDINGS?t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS):0,this._programDataHash=Object.create(null),this._boundUniformsIdsToIndexHash=Object.create(null),this._boundIndexToUniformsHash=Object.create(null),this._shaderSyncFunctions=Object.create(null),this._activeProgram=null,this.maxTextures=Ie()}bind(t,e){if(this._setProgram(t.glProgram),e)return;vn.textureCount=0,vn.blockIndex=0;let s=this._shaderSyncFunctions[t.glProgram._key];s||(s=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),s(this._renderer,t,vn)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,vn)}bindUniformBlock(t,e,s=0){const i=this._renderer.buffer,n=this._getProgramData(this._activeProgram),o=t._bufferResource;o&&this._renderer.ubo.updateUniformGroup(t),i.updateBuffer(t.buffer);let a=this._boundUniformsIdsToIndexHash[t.uid];if(a===void 0){const c=this._nextIndex++%this._maxBindings,h=this._boundIndexToUniformsHash[c];h&&(this._boundUniformsIdsToIndexHash[h.uid]=void 0),a=this._boundUniformsIdsToIndexHash[t.uid]=c,this._boundIndexToUniformsHash[c]=t,o?i.bindBufferRange(t.buffer,c,t.offset):i.bindBufferBase(t.buffer,c)}const u=this._gl,l=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[s]!==a&&(n.uniformBlockBindings[s]=a,u.uniformBlockBinding(n.program,l,a))}_setProgram(t){if(this._activeProgram===t)return;this._activeProgram=t;const e=this._getProgramData(t);this._gl.useProgram(e.program)}_getProgramData(t){return this._programDataHash[t._key]||this._createProgramData(t)}_createProgramData(t){const e=t._key;return this._programDataHash[e]=Q0(this._gl,t),this._programDataHash[e]}destroy(){for(const t of Object.keys(this._programDataHash))this._programDataHash[t].destroy(),this._programDataHash[t]=null;this._programDataHash=null,this._boundUniformsIdsToIndexHash=null}_generateShaderSync(t,e){return X0(t,e)}}pl.extension={type:[y.WebGLSystem],name:"shader"};const J0={f32:`if (cv !== v) {
cu.value = v;
gl.uniform1f(location, v);
}`,"vec2<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2f(location, v[0], v[1]);
}`,"vec3<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3f(location, v[0], v[1], v[2]);
}`,"vec4<f32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4f(location, v[0], v[1], v[2], v[3]);
}`,i32:`if (cv !== v) {
cu.value = v;
gl.uniform1i(location, v);
}`,"vec2<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,"vec3<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,"vec4<i32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,u32:`if (cv !== v) {
cu.value = v;
gl.uniform1ui(location, v);
}`,"vec2<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2ui(location, v[0], v[1]);
}`,"vec3<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3ui(location, v[0], v[1], v[2]);
}`,"vec4<u32>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4ui(location, v[0], v[1], v[2], v[3]);
}`,bool:`if (cv !== v) {
cu.value = v;
gl.uniform1i(location, v);
}`,"vec2<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1]) {
cv[0] = v[0];
cv[1] = v[1];
gl.uniform2i(location, v[0], v[1]);
}`,"vec3<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
gl.uniform3i(location, v[0], v[1], v[2]);
}`,"vec4<bool>":`if (cv[0] !== v[0] || cv[1] !== v[1] || cv[2] !== v[2] || cv[3] !== v[3]) {
cv[0] = v[0];
cv[1] = v[1];
cv[2] = v[2];
cv[3] = v[3];
gl.uniform4i(location, v[0], v[1], v[2], v[3]);
}`,"mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);"},t2={f32:"gl.uniform1fv(location, v);","vec2<f32>":"gl.uniform2fv(location, v);","vec3<f32>":"gl.uniform3fv(location, v);","vec4<f32>":"gl.uniform4fv(location, v);","mat2x2<f32>":"gl.uniformMatrix2fv(location, false, v);","mat3x3<f32>":"gl.uniformMatrix3fv(location, false, v);","mat4x4<f32>":"gl.uniformMatrix4fv(location, false, v);",i32:"gl.uniform1iv(location, v);","vec2<i32>":"gl.uniform2iv(location, v);","vec3<i32>":"gl.uniform3iv(location, v);","vec4<i32>":"gl.uniform4iv(location, v);",u32:"gl.uniform1iv(location, v);","vec2<u32>":"gl.uniform2iv(location, v);","vec3<u32>":"gl.uniform3iv(location, v);","vec4<u32>":"gl.uniform4iv(location, v);",bool:"gl.uniform1iv(location, v);","vec2<bool>":"gl.uniform2iv(location, v);","vec3<bool>":"gl.uniform3iv(location, v);","vec4<bool>":"gl.uniform4iv(location, v);"};function e2(r,t){const e=[`
var v = null;
var cv = null;
var cu = null;
var t = 0;
var gl = renderer.gl;
var name = null;
`];for(const s in r.uniforms){if(!t[s]){r.uniforms[s]instanceof it?r.uniforms[s].ubo?e.push(`
renderer.shader.bindUniformBlock(uv.${s}, "${s}");
`):e.push(`
renderer.shader.updateUniformGroup(uv.${s});
`):r.uniforms[s]instanceof xn&&e.push(`
renderer.shader.bindBufferResource(uv.${s}, "${s}");
`);continue}const i=r.uniformStructures[s];let n=!1;for(let o=0;o<ye.length;o++){const a=ye[o];if(i.type===a.type&&a.test(i)){e.push(`name = "${s}";`,ye[o].uniform),n=!0;break}}if(!n){const o=(i.size===1?J0:t2)[i.type].replace("location",`ud["${s}"].location`);e.push(`
cu = ud["${s}"];
cv = cu.value;
v = uv["${s}"];
${o};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
`))}class fl{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,s){const i=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==i.uniformDirtyGroups[t.uid])&&(i.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(i.uniformData,t.uniforms,this._renderer,s))}_getUniformSyncFunction(t,e){var s;return((s=this._uniformGroupSyncHash[t._signature])==null?void 0:s[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const s=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),i=this._getSignature(t,e._uniformData,"u");return this._cache[i]||(this._cache[i]=this._generateUniformsSync(t,e._uniformData)),s[e._key]=this._cache[i],s[e._key]}_generateUniformsSync(t,e){return e2(t,e)}_getSignature(t,e,s){const i=t.uniforms,n=[`${s}-`];for(const o in i)n.push(o),e[o]&&n.push(e[o].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}fl.extension={type:[y.WebGLSystem],name:"uniformGroup"};function sw(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
out vec4 finalColor;
${r}
`,r}const iw={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 nw(r){return iw[r]}function r2(r){const t={};if(t.normal=[r.ONE,r.ONE_MINUS_SRC_ALPHA],t.add=[r.ONE,r.ONE],t.multiply=[r.DST_COLOR,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.screen=[r.ONE,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.none=[0,0],t["normal-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_ALPHA,r.ONE,r.ONE_MINUS_SRC_ALPHA],t["add-npm"]=[r.SRC_ALPHA,r.ONE,r.ONE,r.ONE],t["screen-npm"]=[r.SRC_ALPHA,r.ONE_MINUS_SRC_COLOR,r.ONE,r.ONE_MINUS_SRC_ALPHA],t.erase=[r.ZERO,r.ONE_MINUS_SRC_ALPHA],!(r instanceof L.get().getWebGLRenderingContext()))t.min=[r.ONE,r.ONE,r.ONE,r.ONE,r.MIN,r.MIN],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,r.MAX,r.MAX];else{const e=r.getExtension("EXT_blend_minmax");e&&(t.min=[r.ONE,r.ONE,r.ONE,r.ONE,e.MIN_EXT,e.MIN_EXT],t.max=[r.ONE,r.ONE,r.ONE,r.ONE,e.MAX_EXT,e.MAX_EXT])}return t}const ow=0,aw=1,uw=2,lw=3,cw=4,hw=5,s2=class _c{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[ow]=this.setBlend,this.map[aw]=this.setOffset,this.map[uw]=this.setCullFace,this.map[lw]=this.setDepthTest,this.map[cw]=this.setFrontFace,this.map[hw]=this.setDepthMask,this.checks=[],this.defaultState=Lt.for2d()}contextChange(t){this.gl=t,this.blendModesMap=r2(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,s=0;for(;e;)e&1&&this.map[s].call(this,!!(t.data&1<<s)),e=e>>1,s++;this.stateId=t.data}for(let e=0;e<this.checks.length;e++)this.checks[e](this,t)}forceState(t){t=t||this.defaultState;for(let e=0;e<this.map.length;e++)this.map[e].call(this,!!(t.data&1<<e));for(let e=0;e<this.checks.length;e++)this.checks[e](this,t);this.stateId=t.data}setBlend(t){this._updateCheck(_c._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(_c._checkPolygonOffset,t),this.gl[t?"enable":"disable"](this.gl.POLYGON_OFFSET_FILL)}setDepthTest(t){this.gl[t?"enable":"disable"](this.gl.DEPTH_TEST)}setDepthMask(t){this.gl.depthMask(t)}setCullFace(t){this.gl[t?"enable":"disable"](this.gl.CULL_FACE)}setFrontFace(t){this.gl.frontFace(this.gl[t?"CW":"CCW"])}setBlendMode(t){if(this.blendModesMap[t]||(t="normal"),t===this.blendMode)return;this.blendMode=t;const e=this.blendModesMap[t],s=this.gl;e.length===2?s.blendFunc(e[0],e[1]):s.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,s.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,s.blendEquationSeparate(s.FUNC_ADD,s.FUNC_ADD))}setPolygonOffset(t,e){this.gl.polygonOffset(t,e)}reset(){this.gl.pixelStorei(this.gl.UNPACK_FLIP_Y_WEBGL,!1),this.forceState(this.defaultState),this._blendEq=!0,this.blendMode="",this.setBlendMode("normal")}_updateCheck(t,e){const s=this.checks.indexOf(t);e&&s===-1?this.checks.push(t):!e&&s!==-1&&this.checks.splice(s,1)}static _checkBlendMode(t,e){t.setBlendMode(e.blendMode)}static _checkPolygonOffset(t,e){t.setPolygonOffset(1,e.polygonOffset)}destroy(){this.gl=null,this.checks.length=0}};s2.extension={type:[y.WebGLSystem],name:"state"};let i2=s2;class n2{constructor(t){this.target=qu.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=z.UNSIGNED_BYTE,this.internalFormat=_n.RGBA,this.format=_n.RGBA,this.samplerType=0}}const o2={id:"buffer",upload(r,t,e){t.width===r.width||t.height===r.height?e.texSubImage2D(e.TEXTURE_2D,0,0,0,r.width,r.height,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,r.width,r.height,0,t.format,t.type,r.resource),t.width=r.width,t.height=r.height}},dw={"bc1-rgba-unorm":!0,"bc1-rgba-unorm-srgb":!0,"bc2-rgba-unorm":!0,"bc2-rgba-unorm-srgb":!0,"bc3-rgba-unorm":!0,"bc3-rgba-unorm-srgb":!0,"bc4-r-unorm":!0,"bc4-r-snorm":!0,"bc5-rg-unorm":!0,"bc5-rg-snorm":!0,"bc6h-rgb-ufloat":!0,"bc6h-rgb-float":!0,"bc7-rgba-unorm":!0,"bc7-rgba-unorm-srgb":!0,"etc2-rgb8unorm":!0,"etc2-rgb8unorm-srgb":!0,"etc2-rgb8a1unorm":!0,"etc2-rgb8a1unorm-srgb":!0,"etc2-rgba8unorm":!0,"etc2-rgba8unorm-srgb":!0,"eac-r11unorm":!0,"eac-r11snorm":!0,"eac-rg11unorm":!0,"eac-rg11snorm":!0,"astc-4x4-unorm":!0,"astc-4x4-unorm-srgb":!0,"astc-5x4-unorm":!0,"astc-5x4-unorm-srgb":!0,"astc-5x5-unorm":!0,"astc-5x5-unorm-srgb":!0,"astc-6x5-unorm":!0,"astc-6x5-unorm-srgb":!0,"astc-6x6-unorm":!0,"astc-6x6-unorm-srgb":!0,"astc-8x5-unorm":!0,"astc-8x5-unorm-srgb":!0,"astc-8x6-unorm":!0,"astc-8x6-unorm-srgb":!0,"astc-8x8-unorm":!0,"astc-8x8-unorm-srgb":!0,"astc-10x5-unorm":!0,"astc-10x5-unorm-srgb":!0,"astc-10x6-unorm":!0,"astc-10x6-unorm-srgb":!0,"astc-10x8-unorm":!0,"astc-10x8-unorm-srgb":!0,"astc-10x10-unorm":!0,"astc-10x10-unorm-srgb":!0,"astc-12x10-unorm":!0,"astc-12x10-unorm-srgb":!0,"astc-12x12-unorm":!0,"astc-12x12-unorm-srgb":!0},a2={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let s=r.pixelWidth,i=r.pixelHeight;const n=!!dw[r.format];for(let o=0;o<r.resource.length;o++){const a=r.resource[o];n?e.compressedTexImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,a):e.texImage2D(e.TEXTURE_2D,o,t.internalFormat,s,i,0,t.format,t.type,a),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},ml={id:"image",upload(r,t,e,s){const i=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,i);const n=t.width,o=t.height,a=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<a||c<u?((n!==a||o!==u)&&e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,null),s===2?e.texSubImage2D(e.TEXTURE_2D,0,0,0,l,c,t.format,t.type,r.resource):e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource)):n===a||o===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):s===2?e.texImage2D(t.target,0,t.internalFormat,a,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=a,t.height=u}},u2={id:"video",upload(r,t,e,s){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}ml.upload(r,t,e,s)}},gl={linear:9729,nearest:9728},l2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Tn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},c2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function _l(r,t,e,s,i,n,o,a){const u=n;if(!a||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=Tn[o?"clamp-to-edge":r.addressModeU],c=Tn[o?"clamp-to-edge":r.addressModeV],h=Tn[o?"clamp-to-edge":r.addressModeW];t[i](u,t.TEXTURE_WRAP_S,l),t[i](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[i](u,t.TEXTURE_WRAP_R,h)}if((!a||r.magFilter!=="linear")&&t[i](u,t.TEXTURE_MAG_FILTER,gl[r.magFilter]),e){if(!a||r.mipmapFilter!=="linear"){const l=l2[r.minFilter][r.mipmapFilter];t[i](u,t.TEXTURE_MIN_FILTER,l)}}else t[i](u,t.TEXTURE_MIN_FILTER,gl[r.minFilter]);if(s&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(s.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[i](u,s.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[i](u,t.TEXTURE_COMPARE_FUNC,c2[r.compare])}function h2(r){return{r8unorm:r.RED,r8snorm:r.RED,r8uint:r.RED,r8sint:r.RED,r16uint:r.RED,r16sint:r.RED,r16float:r.RED,rg8unorm:r.RG,rg8snorm:r.RG,rg8uint:r.RG,rg8sint:r.RG,r32uint:r.RED,r32sint:r.RED,r32float:r.RED,rg16uint:r.RG,rg16sint:r.RG,rg16float:r.RG,rgba8unorm:r.RGBA,"rgba8unorm-srgb":r.RGBA,rgba8snorm:r.RGBA,rgba8uint:r.RGBA,rgba8sint:r.RGBA,bgra8unorm:r.RGBA,"bgra8unorm-srgb":r.RGBA,rgb9e5ufloat:r.RGB,rgb10a2unorm:r.RGBA,rg11b10ufloat:r.RGB,rg32uint:r.RG,rg32sint:r.RG,rg32float:r.RG,rgba16uint:r.RGBA,rgba16sint:r.RGBA,rgba16float:r.RGBA,rgba32uint:r.RGBA,rgba32sint:r.RGBA,rgba32float:r.RGBA,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT,depth24plus:r.DEPTH_COMPONENT,"depth24plus-stencil8":r.DEPTH_STENCIL,depth32float:r.DEPTH_COMPONENT,"depth32float-stencil8":r.DEPTH_STENCIL}}var pw=Object.defineProperty,fw=Object.defineProperties,mw=Object.getOwnPropertyDescriptors,d2=Object.getOwnPropertySymbols,gw=Object.prototype.hasOwnProperty,_w=Object.prototype.propertyIsEnumerable,p2=(r,t,e)=>t in r?pw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$e=(r,t)=>{for(var e in t||(t={}))gw.call(t,e)&&p2(r,e,t[e]);if(d2)for(var e of d2(t))_w.call(t,e)&&p2(r,e,t[e]);return r},bw=(r,t)=>fw(r,mw(t));function f2(r,t){let e={},s=r.RGBA;return r instanceof L.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},s=r.RGBA8),$e($e($e($e($e($e(bw($e({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:s,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function m2(r){return{r8unorm:r.UNSIGNED_BYTE,r8snorm:r.BYTE,r8uint:r.UNSIGNED_BYTE,r8sint:r.BYTE,r16uint:r.UNSIGNED_SHORT,r16sint:r.SHORT,r16float:r.HALF_FLOAT,rg8unorm:r.UNSIGNED_BYTE,rg8snorm:r.BYTE,rg8uint:r.UNSIGNED_BYTE,rg8sint:r.BYTE,r32uint:r.UNSIGNED_INT,r32sint:r.INT,r32float:r.FLOAT,rg16uint:r.UNSIGNED_SHORT,rg16sint:r.SHORT,rg16float:r.HALF_FLOAT,rgba8unorm:r.UNSIGNED_BYTE,"rgba8unorm-srgb":r.UNSIGNED_BYTE,rgba8snorm:r.BYTE,rgba8uint:r.UNSIGNED_BYTE,rgba8sint:r.BYTE,bgra8unorm:r.UNSIGNED_BYTE,"bgra8unorm-srgb":r.UNSIGNED_BYTE,rgb9e5ufloat:r.UNSIGNED_INT_5_9_9_9_REV,rgb10a2unorm:r.UNSIGNED_INT_2_10_10_10_REV,rg11b10ufloat:r.UNSIGNED_INT_10F_11F_11F_REV,rg32uint:r.UNSIGNED_INT,rg32sint:r.INT,rg32float:r.FLOAT,rgba16uint:r.UNSIGNED_SHORT,rgba16sint:r.SHORT,rgba16float:r.HALF_FLOAT,rgba32uint:r.UNSIGNED_INT,rgba32sint:r.INT,rgba32float:r.FLOAT,stencil8:r.UNSIGNED_BYTE,depth16unorm:r.UNSIGNED_SHORT,depth24plus:r.UNSIGNED_INT,"depth24plus-stencil8":r.UNSIGNED_INT_24_8,depth32float:r.FLOAT,"depth32float-stencil8":r.FLOAT_32_UNSIGNED_INT_24_8_REV}}function xw(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const s=r[e+3];if(s!==0){const i=255.001/s;r[e]=r[e]*i+.5,r[e+1]=r[e+1]*i+.5,r[e+2]=r[e+2]*i+.5}}}const yw=4;class bl{constructor(t){this.managedTextures=[],this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundTextures=[],this._activeTextureLocation=-1,this._boundSamplers=Object.create(null),this._uploads={image:ml,buffer:o2,video:u2,compressed:a2},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=f2(t,this._renderer.context.extensions),this._mapFormatToType=m2(t),this._mapFormatToFormat=h2(t)),this._glTextures=Object.create(null),this._glSamplers=Object.create(null),this._boundSamplers=Object.create(null);for(let e=0;e<16;e++)this.bind(E.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const s=t.source;t?(this.bindSource(s,e),this._useSeparateSamplers&&this._bindSampler(s.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const s=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||E.EMPTY.source;const i=this.getGlSource(t);s.bindTexture(i.target,i.texture)}}_bindSampler(t,e=0){const s=this._gl;if(!t){this._boundSamplers[e]=null,s.bindSampler(e,null);return}const i=this._getGlSampler(t);this._boundSamplers[e]!==i&&(this._boundSamplers[e]=i,s.bindSampler(e,i))}unbind(t){const e=t.source,s=this._boundTextures,i=this._gl;for(let n=0;n<s.length;n++)if(s[n]===e){this._activateLocation(n);const o=this.getGlSource(e);i.bindTexture(o.target,null),s[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,s=new n2(e.createTexture());if(s.type=this._mapFormatToType[t.format],s.internalFormat=this._mapFormatToInternalFormat[t.format],s.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const i=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(i))+1}return this._glTextures[t.uid]=s,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceUpdate,this),t.on("styleChange",this.onStyleChange,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),this.updateStyle(t,!1),s}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const s=this._gl,i=this.getGlSource(t);s.bindTexture(s.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,_l(t.style,s,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",s.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,s=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,s,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const s=this.getGlSource(t);this._gl.generateMipmap(s.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,s=this._gl.createSampler();return this._glSamplers[t._resourceId]=s,_l(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",s,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:s,height:i}=this.getPixels(t),n=L.get().createCanvas();n.width=s,n.height=i;const o=n.getContext("2d");if(o){const a=o.createImageData(s,i);a.data.set(e),o.putImageData(a,0,0)}return n}getPixels(t){const e=t.source.resolution,s=t.frame,i=Math.max(Math.round(s.width*e),1),n=Math.max(Math.round(s.height*e),1),o=new Uint8Array(yw*i*n),a=this._renderer,u=a.renderTarget.getRenderTarget(t),l=a.renderTarget.getGpuRenderTarget(u),c=a.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(s.x*e),Math.round(s.y*e),i,n,c.RGBA,c.UNSIGNED_BYTE,o),{pixels:new Uint8ClampedArray(o.buffer),width:i,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}bl.extension={type:[y.WebGLSystem],name:"texture"};class xl{init(){const t=new it({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Ie(),s=ar({name:"graphics",bits:[fi,gi(e),Ni,lr]});this.shader=new Ut({glProgram:s,resources:{localUniforms:t,batchSamplers:_i(e)}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:u}=o.getContextRenderData(s);i.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(i),n.geometry.bind(a.geometry,i.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let d=0;d<h.textures.count;d++)n.texture.bind(h.textures.textures[d],d);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}xl.extension={type:[y.WebGLPipesAdaptor],name:"graphics"};class yl{init(){const t=ar({name:"mesh",bits:[Ni,d0,lr]});this._shader=new Ut({glProgram:t,resources:{uTexture:E.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(i){if(!i.glProgram)return}else{i=this._shader;const n=e.texture,o=n.source;i.resources.uTexture=o,i.resources.uSampler=o.style,i.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}i.groups[100]=s.globalUniforms.bindGroup,i.groups[101]=t.localUniformsBindGroup,s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}yl.extension={type:[y.WebGLPipesAdaptor],name:"mesh"};class vl{constructor(t){this._renderer=t}addRenderable(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&t.render(this._renderer)}destroy(){this._renderer=null}}vl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"customRender"};function Tl(r,t){const e=r.instructionSet,s=e.instructions;for(let i=0;i<e.instructionSize;i++){const n=s[i];t[n.renderPipeId].execute(n)}}class Al{constructor(t){this._renderer=t}addRenderGroup(t,e){this._renderer.renderPipes.batch.break(e),e.add(t)}execute(t){t.isRenderable&&(this._renderer.globalUniforms.push({worldTransformMatrix:t.worldTransform,worldColor:t.worldColorAlpha}),Tl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Al.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"renderGroup"};function An(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function Sl(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)Sl(r.renderGroupChildren[e],t);return t}function El(r,t,e){const s=r>>16&255,i=r>>8&255,n=r&255,o=t>>16&255,a=t>>8&255,u=t&255,l=s+(o-s)*e,c=i+(a-i)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Tr=16777215;function wl(r,t){return r===Tr||t===Tr?r+t-Tr:El(r,t,.5)}function vw(r,t,e){const s=(e>>24&255)/255,i=t*s*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),o=e&16777215;let a;return n===Tr||o===Tr?a=n+o-Tr:a=El(n,o,.5),a+(i<<24)}const Tw=new rt,g2=tr|Kr|ii;function Cl(r,t=!1){_2(r);const e=r.childrenToUpdate,s=r.updateTick++;for(const i in e){const n=Number(i),o=e[i],a=o.list,u=o.index;for(let l=0;l<u;l++){const c=a[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Rl(c,s,0)}An(a,u),o.index=0}if(t)for(let i=0;i<r.renderGroupChildren.length;i++)Cl(r.renderGroupChildren[i],t)}function _2(r){const t=r.root;let e;if(r.renderGroupParent){const s=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,s.worldTransform),r.worldColor=wl(t.groupColor,s.worldColor),e=t.groupAlpha*s.worldAlpha}else r.worldTransform.copyFrom(t.localTransform),r.worldColor=t.localColor,e=t.localAlpha;e=e<0?0:e>1?1:e,r.worldAlpha=e,r.worldColorAlpha=r.worldColor+((e*255|0)<<24)}function Rl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const s=r.localTransform;r.updateLocalTransform();const i=r.parent;if(i&&!i.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(s,i.relativeGroupTransform),e&g2&&b2(r,i,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(s),e&g2&&b2(r,Tw,e)),!r.renderGroup){const n=r.children,o=n.length;for(let u=0;u<o;u++)Rl(n[u],t,e);const a=r.parentRenderGroup;r.renderPipeId&&!a.structureDidChange&&a.updateRenderable(r)}}function b2(r,t,e){if(e&Kr){r.groupColor=wl(r.localColor,t.groupColor);let s=r.localAlpha*t.groupAlpha;s=s<0?0:s>1?1:s,r.groupAlpha=s,r.groupColorAlpha=r.groupColor+((s*255|0)<<24)}e&ii&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&tr&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function x2(r,t){const{list:e,index:s}=r.childrenRenderablesToUpdate;let i=!1;for(let n=0;n<s;n++){const o=e[n];if(i=t[o.renderPipeId].validateRenderable(o),i)break}return r.structureDidChange=i,i}const Aw=new B;class Pl{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const s=t.parent,i=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,o=Sl(t.renderGroup,[]);let a=Aw;e&&(a=a.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<o.length;l++){const c=o[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?An(c.childrenRenderablesToUpdate.list,0):x2(c,u),Cl(c),c.structureDidChange?(c.structureDidChange=!1,p0(c,n)):Sw(c),c.childrenRenderablesToUpdate.index=0,n.renderPipes.batch.upload(c.instructionSet)}n.globalUniforms.start({worldTransformMatrix:e?t.renderGroup.localTransform:t.renderGroup.worldTransform,worldColor:t.renderGroup.worldColorAlpha}),Tl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(a),t.parent=s,t.renderGroup.renderGroupParent=i}destroy(){this._renderer=null}}Pl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"renderGroup"};function Sw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let s=0;s<e;s++){const i=t[s];i.didViewUpdate&&r.updateRenderable(i)}An(t,e)}class Dl{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const s=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,s),this._renderer.renderPipes.batch.addToBatch(s,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,s=this._getGpuSprite(t);return s.texture._source!==e._source?!s._batcher.checkAndUpdateTexture(s,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];H.return(e),this._gpuSpriteHash[t.uid]=null,t.off("destroyed",this._destroyRenderableBound)}_updateBatchableSprite(t,e){t._didSpriteUpdate=!1,e.bounds=t.bounds,e.texture=t._texture}_getGpuSprite(t){return this._gpuSpriteHash[t.uid]||this._initGPUSprite(t)}_initGPUSprite(t){const e=H.get(Mi);return e.renderable=t,e.transform=t.groupTransform,e.texture=t._texture,e.bounds=t.bounds,e.roundPixels=this._renderer._roundPixels|t._roundPixels,this._gpuSpriteHash[t.uid]=e,t._didSpriteUpdate=!1,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuSpriteHash)H.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Dl.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"sprite"};var Ew=Object.defineProperty,y2=Object.getOwnPropertySymbols,ww=Object.prototype.hasOwnProperty,Cw=Object.prototype.propertyIsEnumerable,v2=(r,t,e)=>t in r?Ew(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,T2=(r,t)=>{for(var e in t||(t={}))ww.call(t,e)&&v2(r,e,t[e]);if(y2)for(var e of y2(t))Cw.call(t,e)&&v2(r,e,t[e]);return r};const Ml=class Px{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new j(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=T2(T2({},Px.defaultOptions),t),this.clearBeforeRender=t.clearBeforeRender,this.color=t.background||t.backgroundColor||this._backgroundColor,this.alpha=t.backgroundAlpha,this._backgroundColor.setAlpha(t.backgroundAlpha)}get color(){return this._backgroundColor}set color(t){this._backgroundColor.setValue(t)}get alpha(){return this._backgroundColor.alpha}set alpha(t){this._backgroundColor.setAlpha(t)}get colorRgba(){return this._backgroundColor.toArray()}destroy(){}};Ml.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"background",priority:0},Ml.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let A2=Ml;const Ds={};k.handle(y.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ds[r.name]=r.ref},r=>{delete Ds[r.name]});class Ol{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,s){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(s),this._isAdvanced=!!Ds[e],this._isAdvanced&&(this._beginAdvancedBlendMode(s),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ds[e])return;let s=this._filterHash[e];s||(s=this._filterHash[e]=new Wr,s.filters=[new Ds[e]]);const i={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:s,canBundle:!1};this._renderableList=i.renderables,t.add(i)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Ol.extension={type:[y.WebGLPipes,y.WebGPUPipes,y.CanvasPipes],name:"blendMode"};var Rw=Object.defineProperty,S2=Object.getOwnPropertySymbols,Pw=Object.prototype.hasOwnProperty,Dw=Object.prototype.propertyIsEnumerable,E2=(r,t,e)=>t in r?Rw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Bl=(r,t)=>{for(var e in t||(t={}))Pw.call(t,e)&&E2(r,e,t[e]);if(S2)for(var e of S2(t))Dw.call(t,e)&&E2(r,e,t[e]);return r};const Gl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Il=class Dx{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof E?Bl({target:t},e):Bl(Bl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Dx.defaultImageOptions);const{format:e,quality:s}=t,i=this.canvas(t);if(i.toBlob!==void 0)return new Promise((n,o)=>{i.toBlob(a=>{if(!a){o(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=o,u.readAsDataURL(a)},Gl[e],s)});if(i.toDataURL!==void 0)return i.toDataURL(Gl[e],s);if(i.convertToBlob!==void 0){const n=await i.convertToBlob({type:Gl[e],quality:s});return new Promise((o,a)=>{const u=new FileReader;u.onload=()=>o(u.result),u.onerror=a,u.readAsDataURL(n)})}throw new Error("Extract.base64() requires ICanvas.toDataURL, ICanvas.toBlob, or ICanvas.convertToBlob to be implemented")}canvas(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer;if(e instanceof E)return s.texture.generateCanvas(e);const i=s.textureGenerator.generateTexture(t),n=s.texture.generateCanvas(i);return i.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,s=this._renderer,i=e instanceof E?e:s.textureGenerator.generateTexture(t),n=s.texture.getPixels(i);return e instanceof rt&&i.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof E?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const s=this.canvas(t),i=document.createElement("a");i.download=(e=t.filename)!=null?e:"image.png",i.href=s.toDataURL("image/png"),document.body.appendChild(i),i.click(),document.body.removeChild(i)}log(t){var e;const s=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const i=this.canvas(t),n=i.toDataURL();console.log(`[Pixi Texture] ${i.width}px ${i.height}px`);const o=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",o)}destroy(){this._renderer=null}};Il.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"extract"},Il.defaultImageOptions={format:"png",quality:1};let w2=Il;class Nn extends E{static create(t){return new Nn({source:new tt(t)})}resize(t,e,s){return this.source.resize(t,e,s),this}}var Mw=Object.defineProperty,Ow=Object.defineProperties,Bw=Object.getOwnPropertyDescriptors,C2=Object.getOwnPropertySymbols,Gw=Object.prototype.hasOwnProperty,Iw=Object.prototype.propertyIsEnumerable,R2=(r,t,e)=>t in r?Mw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fw=(r,t)=>{for(var e in t||(t={}))Gw.call(t,e)&&R2(r,e,t[e]);if(C2)for(var e of C2(t))Iw.call(t,e)&&R2(r,e,t[e]);return r},Uw=(r,t)=>Ow(r,Bw(t));const kw=new V,Nw=new pt,Lw=[0,0,0,0];class Fl{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const s=t.resolution||this._renderer.resolution,i=t.antialias||this._renderer.view.antialias,n=t.target;let o=t.clearColor;o?o=Array.isArray(o)&&o.length===4?o:j.shared.setValue(o).toArray():o=Lw;const a=((e=t.frame)==null?void 0:e.copyTo(kw))||si(n,Nw).rectangle;a.width=Math.max(a.width,1/s)|0,a.height=Math.max(a.height,1/s)|0;const u=Nn.create(Uw(Fw({},t.textureSourceOptions),{width:a.width,height:a.height,resolution:s,antialias:i})),l=B.shared.translate(-a.x,-a.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:o}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Fl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGenerator"};class Ul{constructor(t){this._stackIndex=0,this._globalUniformDataStack=[],this._uniformsPool=[],this._activeUniforms=[],this._bindGroupPool=[],this._activeBindGroups=[],this._renderer=t}reset(){this._stackIndex=0;for(let t=0;t<this._activeUniforms.length;t++)this._uniformsPool.push(this._activeUniforms[t]);for(let t=0;t<this._activeBindGroups.length;t++)this._bindGroupPool.push(this._activeBindGroups[t]);this._activeUniforms.length=0,this._activeBindGroups.length=0}start(t){this.reset(),this.push(t)}bind({size:t,projectionMatrix:e,worldTransformMatrix:s,worldColor:i,offset:n}){const o=this._renderer.renderTarget.renderTarget,a=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:o,worldTransformMatrix:new B,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||o.size,worldTransformMatrix:s||a.worldTransformMatrix,worldColor:i||a.worldColor,offset:n||a.offset,bindGroup:null},l=this._uniformsPool.pop()||this._createUniforms();this._activeUniforms.push(l);const c=l.uniforms;c.uProjectionMatrix=u.projectionMatrix,c.uResolution=u.resolution,c.uWorldTransformMatrix.copyFrom(u.worldTransformMatrix),c.uWorldTransformMatrix.tx-=u.offset.x,c.uWorldTransformMatrix.ty-=u.offset.y,ns(u.worldColor,c.uWorldColorAlpha,0),l.update();let h;this._renderer.renderPipes.uniformBatch?h=this._renderer.renderPipes.uniformBatch.getUniformBindGroup(l,!1):(h=this._bindGroupPool.pop()||new Kt,this._activeBindGroups.push(h),h.setResource(l,0)),u.bindGroup=h,this._currentGlobalUniformData=u}push(t){this.bind(t),this._globalUniformDataStack[this._stackIndex++]=this._currentGlobalUniformData}pop(){this._currentGlobalUniformData=this._globalUniformDataStack[--this._stackIndex-1],this._renderer.type===Tt.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new it({uProjectionMatrix:{value:new B,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new B,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}Ul.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"globalUniforms"};let $w=1;class kl{constructor(){this._tasks=[]}init(){mt.system.add(this._update,this)}repeat(t,e){const s=$w++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:s}),s}cancel(t){for(let e=0;e<this._tasks.length;e++)if(this._tasks[e].id===t){this._tasks.splice(e,1);return}}_update(){const t=performance.now();for(let e=0;e<this._tasks.length;e++){const s=this._tasks[e];if(t-s.last>=s.duration){const i=t-s.start;s.func(i),s.last=t}}}destroy(){mt.system.remove(this._update,this),this._tasks.length=0}}kl.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"scheduler",priority:0};let P2=!1;function D2(r){if(!P2){if(L.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${ys} (${r}) http://www.pixijs.com/
`,"background: #E72264; padding:5px 0;","background: #6CA2EA; padding:5px 0;","background: #B5D33D; padding:5px 0;","background: #FED23F; padding:5px 0;","color: #FFFFFF; background: #E72264; padding:5px 0;","color: #E72264; background: #FFFFFF; padding:5px 0;"];globalThis.console.log(...t)}else globalThis.console&&globalThis.console.log(`PixiJS ${ys} - ${r} - http://www.pixijs.com/`);P2=!0}}class Sn{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===Tt.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),D2(e)}}}Sn.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"hello",priority:-2},Sn.defaultOptions={hello:!1};var Hw=Object.defineProperty,M2=Object.getOwnPropertySymbols,Xw=Object.prototype.hasOwnProperty,zw=Object.prototype.propertyIsEnumerable,O2=(r,t,e)=>t in r?Hw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,B2=(r,t)=>{for(var e in t||(t={}))Xw.call(t,e)&&O2(r,e,t[e]);if(M2)for(var e of M2(t))zw.call(t,e)&&O2(r,e,t[e]);return r};const Nl=class Mx{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=B2(B2({},Mx.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){this.enabled&&(t._lastUsed=this._now,t._lastInstructionTick===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastInstructionTick=e.tick)}run(){var t,e,s;const i=performance.now(),n=this._managedRenderables,o=this._renderer.renderPipes;let a=0;for(let u=0;u<n.length;u++){const l=n[u];if(l===null){a++;continue}const c=(t=l.renderGroup)!=null?t:l.parentRenderGroup,h=(s=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?s:-1;l._lastInstructionTick!==h&&i-l._lastUsed>this.maxUnusedTime?(l.destroyed||o[l.renderPipeId].destroyRenderable(l),l._lastInstructionTick=-1,a++,l.off("destroyed",this._removeRenderable,this)):n[u-a]=l}n.length=n.length-a}destroy(){this.enabled=!1,this._renderer=null,this._managedRenderables.length=0}_removeRenderable(t){const e=this._managedRenderables.indexOf(t);e>=0&&(t.off("destroyed",this._removeRenderable,this),this._managedRenderables[e]=null)}};Nl.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"renderableGC"},Nl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let G2=Nl;var jw=Object.defineProperty,I2=Object.getOwnPropertySymbols,Vw=Object.prototype.hasOwnProperty,Ww=Object.prototype.propertyIsEnumerable,F2=(r,t,e)=>t in r?jw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,U2=(r,t)=>{for(var e in t||(t={}))Vw.call(t,e)&&F2(r,e,t[e]);if(I2)for(var e of I2(t))Ww.call(t,e)&&F2(r,e,t[e]);return r};const Ll=class Ox{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=U2(U2({},Ox.defaultOptions),t),this.checkCountMax=t.textureGCCheckCountMax,this.maxIdle=(e=t.textureGCAMaxIdle)!=null?e:t.textureGCMaxIdle,this.active=t.textureGCActive}postrender(){this._renderer.renderingToScreen&&(this.count++,this.active&&(this.checkCount++,this.checkCount>this.checkCountMax&&(this.checkCount=0,this.run())))}run(){const t=this._renderer.texture.managedTextures;for(let e=0;e<t.length;e++){const s=t[e];s.autoGarbageCollect&&s.resource&&s._touched>-1&&this.count-s._touched>this.maxIdle&&(s._touched=-1,s.unload())}}destroy(){this._renderer=null}};Ll.extension={type:[y.WebGLSystem,y.WebGPUSystem],name:"textureGC"},Ll.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:60*60,textureGCCheckCountMax:600};let k2=Ll;var Yw=Object.defineProperty,N2=Object.getOwnPropertySymbols,qw=Object.prototype.hasOwnProperty,Kw=Object.prototype.propertyIsEnumerable,L2=(r,t,e)=>t in r?Yw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,$2=(r,t)=>{for(var e in t||(t={}))qw.call(t,e)&&L2(r,e,t[e]);if(N2)for(var e of N2(t))Kw.call(t,e)&&L2(r,e,t[e]);return r};const $l=class Bx{get autoDensity(){return this.texture.source.autoDensity}set autoDensity(t){this.texture.source.autoDensity=t}get resolution(){return this.texture.source._resolution}set resolution(t){this.texture.source.resize(this.texture.source.width,this.texture.source.height,t)}init(t){t=$2($2({},Bx.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new V(0,0,t.width,t.height),this.canvas=t.canvas||L.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ol(this.canvas,t),this.renderTarget=new bn({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,s){this.texture.source.resize(t,e,s),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};$l.extension={type:[y.WebGLSystem,y.WebGPUSystem,y.CanvasSystem],name:"view",priority:0},$l.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let H2=$l;const Hl=[A2,Ul,Sn,H2,Pl,k2,Fl,w2,au,G2,kl],Xl=[Ol,Hu,Dl,Al,Xu,ju,zu,vl],Zw=[...Hl,nl,w0,x0,Vu,bl,ul,Ku,fl,pl,Ju,i2,tl,Qu],Qw=[...Xl],Jw=[Nu,yl,xl],X2=[],z2=[],j2=[];k.handleByNamedList(y.WebGLSystem,X2),k.handleByNamedList(y.WebGLPipes,z2),k.handleByNamedList(y.WebGLPipesAdaptor,j2),k.add(...Zw,...Qw,...Jw);class V2 extends gs{constructor(){const t={name:"webgl",type:Tt.WEBGL,systems:X2,renderPipes:z2,renderPipeAdaptors:j2};super(t)}}var tC={__proto__:null,WebGLRenderer:V2};class zl{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,s){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,s)}_createBindGroup(t,e,s){var i;const n=this._gpu.device,o=e.layout[s],a=[],u=this._renderer;for(const h in o){const d=(i=t.resources[h])!=null?i:t.resources[o[h]];let p;if(d._resourceType==="uniformGroup"){const f=d;u.ubo.updateUniformGroup(f);const g=f.buffer;p={buffer:u.buffer.getGPUBuffer(g),offset:0,size:g.descriptor.size}}else if(d._resourceType==="buffer"){const f=d;p={buffer:u.buffer.getGPUBuffer(f),offset:0,size:f.descriptor.size}}else if(d._resourceType==="bufferResource"){const f=d;p={buffer:u.buffer.getGPUBuffer(f.buffer),offset:f.offset,size:f.size}}else if(d._resourceType==="textureSampler"){const f=d;p=u.texture.getGpuSampler(f)}else if(d._resourceType==="textureSource"){const f=d;p=u.texture.getGpuSource(f).createView({})}a.push({binding:o[h],resource:p})}const l=u.shader.getProgramData(e).bindGroups[s],c=n.createBindGroup({layout:l,entries:a});return this._hash[t._key]=c,c}destroy(){for(const t of Object.keys(this._hash))this._hash[t]=null;this._hash=null,this._renderer=null}}zl.extension={type:[y.WebGPUSystem],name:"bindGroup"};class jl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),s=t.data;return t._updateID&&s&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,s.buffer,0,(t._updateSize||s.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(ci(t.data.buffer,e.getMappedRange()),e.unmap()),this._gpuBuffers[t.uid]=e,e}onBufferChange(t){this._gpuBuffers[t.uid].destroy(),t._updateID=0,this._gpuBuffers[t.uid]=this.createGPUBuffer(t)}onBufferDestroy(t){this._managedBuffers.splice(this._managedBuffers.indexOf(t),1),this._destroyBuffer(t)}destroy(){this._managedBuffers.forEach(t=>this._destroyBuffer(t)),this._managedBuffers=null,this._gpuBuffers=null}_destroyBuffer(t){this._gpuBuffers[t.uid].destroy(),t.off("update",this.updateBuffer,this),t.off("change",this.onBufferChange,this),t.off("destroy",this.onBufferDestroy,this),this._gpuBuffers[t.uid]=null}}jl.extension={type:[y.WebGPUSystem],name:"buffer"};function eC(r,t){const e=r.descriptor.size,s=t.gpu.device,i=new Rt({data:new Float32Array(24e5),usage:X.MAP_READ|X.COPY_DST}),n=t.buffer.createGPUBuffer(i),o=s.createCommandEncoder();o.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),s.queue.submit([o.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class W2{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let s=e+t*4;if(s=Math.ceil(s/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,s>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=s,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let s=0;s<t.length;s++)this.data[e/4+s]=t[s];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class Vl{constructor(t){this._colorMaskCache=15,this._renderer=t}setMask(t){this._colorMaskCache!==t&&(this._colorMaskCache=t,this._renderer.pipeline.setColorMask(t))}destroy(){this._renderer=null,this._colorMaskCache=null}}Vl.extension={type:[y.WebGPUSystem],name:"colorMask"};class En{constructor(t){this._renderer=t}async init(t){return this._initPromise?this._initPromise:(this._initPromise=this._createDeviceAndAdaptor(t).then(e=>{this.gpu=e,this._renderer.runners.contextChange.emit(this.gpu)}),this._initPromise)}contextChange(t){this._renderer.gpu=t}async _createDeviceAndAdaptor(t){const e=await L.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),s=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),i=await e.requestDevice({requiredFeatures:s});return{adapter:e,device:i}}destroy(){this.gpu=null,this._renderer=null}}En.extension={type:[y.WebGPUSystem],name:"device"},En.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var rC=Object.defineProperty,Y2=Object.getOwnPropertySymbols,sC=Object.prototype.hasOwnProperty,iC=Object.prototype.propertyIsEnumerable,q2=(r,t,e)=>t in r?rC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,K2=(r,t)=>{for(var e in t||(t={}))sC.call(t,e)&&q2(r,e,t[e]);if(Y2)for(var e of Y2(t))iC.call(t,e)&&q2(r,e,t[e]);return r};class Wl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,s,i){const n=this._renderer.pipeline.getPipeline(t,e,s,i);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,s){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const i=this._renderer.bindGroup.getBindGroup(e,s,t);this.renderPassEncoder.setBindGroup(t,i)}setGeometry(t,e){const s=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const i in s)this._setVertexBuffer(i,t.attributes[s[i]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const s in t.groups){const i=t.groups[s];e||this._syncBindGroup(i),this.setBindGroup(s,i,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const s=t.resources[e];s.isUniformGroup&&this._renderer.ubo.updateUniformGroup(s)}}draw(t){const{geometry:e,shader:s,state:i,topology:n,size:o,start:a,instanceCount:u,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,s.gpuProgram,i,n),this.setGeometry(e,s.gpuProgram),this._setShaderBindGroups(s,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(o||e.indexBuffer.data.length,u||e.instanceCount,a||0):this.renderPassEncoder.draw(o||e.getSize(),u||e.instanceCount,a||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,s=K2({},this._boundVertexBuffer),i=this._boundIndexBuffer,n=K2({},this._boundBindGroup);this._clearCache();const o=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(o.x,o.y,o.width,o.height,0,1),this.setPipeline(e);for(const a in s)this._setVertexBuffer(a,s[a]);for(const a in n)this.setBindGroup(a,n[a],null);this._setIndexBuffer(i)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Wl.extension={type:[y.WebGPUSystem],name:"encoder",priority:1};class Yl{constructor(t){this._renderTargetStencilState=Object.create(null),this._renderer=t,t.renderTarget.onRenderTargetChange.add(this)}onRenderTargetChange(t){let e=this._renderTargetStencilState[t.uid];e||(e=this._renderTargetStencilState[t.uid]={stencilMode:at.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const s=this._renderTargetStencilState[this._activeRenderTarget.uid];s.stencilMode=t,s.stencilReference=e;const i=this._renderer;i.pipeline.setStencilMode(t),i.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}Yl.extension={type:[y.WebGPUSystem],name:"stencil"};const Ms={i32:{align:4,size:4},u32:{align:4,size:4},f32:{align:4,size:4},f16:{align:2,size:2},"vec2<i32>":{align:8,size:8},"vec2<u32>":{align:8,size:8},"vec2<f32>":{align:8,size:8},"vec2<f16>":{align:4,size:4},"vec3<i32>":{align:16,size:12},"vec3<u32>":{align:16,size:12},"vec3<f32>":{align:16,size:12},"vec3<f16>":{align:8,size:6},"vec4<i32>":{align:16,size:16},"vec4<u32>":{align:16,size:16},"vec4<f32>":{align:16,size:16},"vec4<f16>":{align:8,size:8},"mat2x2<f32>":{align:8,size:16},"mat2x2<f16>":{align:4,size:8},"mat3x2<f32>":{align:8,size:24},"mat3x2<f16>":{align:4,size:12},"mat4x2<f32>":{align:8,size:32},"mat4x2<f16>":{align:4,size:16},"mat2x3<f32>":{align:16,size:32},"mat2x3<f16>":{align:8,size:16},"mat3x3<f32>":{align:16,size:48},"mat3x3<f16>":{align:8,size:24},"mat4x3<f32>":{align:16,size:64},"mat4x3<f16>":{align:8,size:32},"mat2x4<f32>":{align:16,size:32},"mat2x4<f16>":{align:8,size:16},"mat3x4<f32>":{align:16,size:48},"mat3x4<f16>":{align:8,size:24},"mat4x4<f32>":{align:16,size:64},"mat4x4<f16>":{align:8,size:32}};function Z2(r){const t=r.map(s=>({data:s,offset:0,size:0}));let e=0;for(let s=0;s<t.length;s++){const i=t[s];let n=Ms[i.data.type].size;const o=Ms[i.data.type].align;if(!Ms[i.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${i.data.type}`);i.data.size>1&&(n=Math.max(n,o)*i.data.size),e=Math.ceil(e/o)*o,i.size=n,i.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function Q2(r,t){const{size:e,align:s}=Ms[r.data.type],i=(s-e)/4;return`
v = uv.${r.data.name};
${t!==0?`offset += ${t};`:""}
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*(e/4)}; i++)
{
for(var j = 0; j < ${e/4}; j++)
{
data[arrayOffset++] = v[t++];
}
${i!==0?`arrayOffset += ${i};`:""}
}
`}function J2(r){return sl(r,"uboWgsl",Q2,M0)}class ql extends el{constructor(){super({createUboElements:Z2,generateUboSync:J2})}}ql.extension={type:[y.WebGPUSystem],name:"ubo"};const ve=128;class Kl{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new W2({minUniformOffsetAlignment:ve});const e=256/ve;for(let s=0;s<e;s++){let i=X.UNIFORM|X.COPY_DST;s===0&&(i|=X.COPY_SRC),this._buffers.push(new Rt({data:this._batchBuffer.data,usage:i}))}}renderEnd(){this._uploadBindGroups(),this._resetBindGroups()}_resetBindGroups(){for(const t in this._bindGroupHash)this._bindGroupHash[t]=null;this._batchBuffer.clear()}getUniformBindGroup(t,e){if(!e&&this._bindGroupHash[t.uid])return this._bindGroupHash[t.uid];this._renderer.ubo.ensureUniformGroup(t);const s=t.buffer.data,i=this._batchBuffer.addEmptyGroup(s.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,i/4),this._bindGroupHash[t.uid]=this._getBindGroup(i/ve),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,s=this._batchBuffer.addGroup(e);return this._getBufferResource(s/ve)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/ve)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/ve;return this._getBufferResource(e)}_getBufferResource(t){if(!this._bufferResources[t]){const e=this._buffers[t%2];this._bufferResources[t]=new xn({buffer:e,offset:(t/2|0)*256,size:ve})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Kt({0:this._getBufferResource(t)});this._bindGroups[t]=e}return this._bindGroups[t]}_uploadBindGroups(){const t=this._renderer.buffer,e=this._buffers[0];e.update(this._batchBuffer.byteIndex),t.updateBuffer(e);const s=this._renderer.gpu.device.createCommandEncoder();for(let i=1;i<this._buffers.length;i++){const n=this._buffers[i];s.copyBufferToBuffer(t.getGPUBuffer(e),ve,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([s.finish()])}destroy(){for(let t=0;t<this._bindGroups.length;t++)this._bindGroups[t].destroy();this._bindGroups=null,this._bindGroupHash=null;for(let t=0;t<this._buffers.length;t++)this._buffers[t].destroy();this._buffers=null;for(let t=0;t<this._bufferResources.length;t++)this._bufferResources[t].destroy();this._bufferResources=null,this._batchBuffer.destroy(),this._bindGroupHash=null,this._renderer=null}}Kl.extension={type:[y.WebGPUPipes],name:"uniformBatch"};var nC=Object.defineProperty,oC=Object.defineProperties,aC=Object.getOwnPropertyDescriptors,tb=Object.getOwnPropertySymbols,uC=Object.prototype.hasOwnProperty,lC=Object.prototype.propertyIsEnumerable,eb=(r,t,e)=>t in r?nC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,cC=(r,t)=>{for(var e in t||(t={}))uC.call(t,e)&&eb(r,e,t[e]);if(tb)for(var e of tb(t))lC.call(t,e)&&eb(r,e,t[e]);return r},hC=(r,t)=>oC(r,aC(t));const dC={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function pC(r,t,e,s,i){return r<<24|t<<16|e<<10|s<<5|i}function fC(r,t,e,s){return e<<6|r<<3|s<<1|t}class Zl{constructor(t){this._moduleCache=Object.create(null),this._bufferLayoutsCache=Object.create(null),this._bindingNamesCache=Object.create(null),this._pipeCache=Object.create(null),this._pipeStateCaches=Object.create(null),this._colorMask=15,this._multisampleCount=1,this._renderer=t}contextChange(t){this._gpu=t,this.setStencilMode(at.DISABLED),this._updatePipeHash()}setMultisampleCount(t){this._multisampleCount!==t&&(this._multisampleCount=t,this._updatePipeHash())}setRenderTarget(t){this._multisampleCount=t.msaaSamples,this._depthStencilAttachment=t.descriptor.depthStencilAttachment?1:0,this._updatePipeHash()}setColorMask(t){this._colorMask!==t&&(this._colorMask=t,this._updatePipeHash())}setStencilMode(t){this._stencilMode!==t&&(this._stencilMode=t,this._stencilState=xe[t],this._updatePipeHash())}setPipeline(t,e,s,i){const n=this.getPipeline(t,e,s);i.setPipeline(n)}getPipeline(t,e,s,i){t._layoutKey||(Yu(t,e.attributeData),this._generateBufferKey(t)),i=i||t.topology;const n=pC(t._layoutKey,e._layoutKey,s.data,s._blendModeId,dC[i]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,s,i),this._pipeCache[n])}_createPipeline(t,e,s,i){const n=this._gpu.device,o=this._createVertexBufferLayouts(t,e),a=this._renderer.state.getColorTargets(s);a[0].writeMask=this._stencilMode===at.RENDERING_MASK_ADD?0:this._colorMask;const u=this._renderer.shader.getProgramData(e).pipeline,l={vertex:{module:this._getModule(e.vertex.source),entryPoint:e.vertex.entryPoint,buffers:o},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:a},primitive:{topology:i,cullMode:s.cullMode},layout:u,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil=hC(cC({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:s.depthTest,depthCompare:s.depthTest?"less":"always"})),n.createRenderPipeline(l)}_getModule(t){return this._moduleCache[t]||this._createModule(t)}_createModule(t){const e=this._gpu.device;return this._moduleCache[t]=e.createShaderModule({code:t}),this._moduleCache[t]}_generateBufferKey(t){const e=[];let s=0;const i=Object.keys(t.attributes).sort();for(let o=0;o<i.length;o++){const a=t.attributes[i[o]];e[s++]=a.offset,e[s++]=a.format,e[s++]=a.stride,e[s++]=a.instance}const n=e.join("|");return t._layoutKey=sr(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let s=0;const i=Object.keys(t.attributeData).sort();for(let o=0;o<i.length;o++){const a=t.attributeData[i[o]];e[s++]=a.location}const n=e.join("|");return t._attributeLocationsKey=sr(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const s=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[s])return this._bindingNamesCache[s];const i=this._createVertexBufferLayouts(t,e),n=Object.create(null),o=e.attributeData;for(let a=0;a<i.length;a++)for(const u in o)if(o[u].location===a){n[a]=u;break}return this._bindingNamesCache[s]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const s=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[s])return this._bufferLayoutsCache[s];const i=[];return t.buffers.forEach(n=>{var o;const a={arrayStride:0,stepMode:"vertex",attributes:[]},u=a.attributes;for(const l in e.attributeData){const c=t.attributes[l];((o=c.divisor)!=null?o:1)!==1&&me(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(a.arrayStride=c.stride,a.stepMode=c.instance?"instance":"vertex",u.push({shaderLocation:e.attributeData[l].location,offset:c.offset,format:c.format}))}u.length&&i.push(a)}),this._bufferLayoutsCache[s]=i,i}_updatePipeHash(){const t=fC(this._stencilMode,this._multisampleCount,this._colorMask,this._depthStencilAttachment);this._pipeStateCaches[t]||(this._pipeStateCaches[t]=Object.create(null)),this._pipeCache=this._pipeStateCaches[t]}destroy(){this._renderer=null,this._bufferLayoutsCache=null}}Zl.extension={type:[y.WebGPUSystem],name:"pipeline"};class rb{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class sb{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,s,i,n){const o=this._renderer,a=this._getGpuColorTexture(t),u=o.texture.getGpuSource(e.source);return o.encoder.commandEncoder.copyTextureToTexture({texture:a,origin:s},{texture:u,origin:n},i),e}startRenderPass(t,e=!0,s,i){const n=this._renderTargetSystem.getGpuRenderTarget(t),o=this.getDescriptor(t,e,s);n.descriptor=o,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(i)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,s){typeof e=="boolean"&&(e=e?At.ALL:At.NONE);const i=this._renderTargetSystem,n=i.getGpuRenderTarget(t),o=t.colorTextures.map((u,l)=>{const c=n.contexts[l];let h,d;c?h=c.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(u).createView({mipLevelCount:1}),n.msaaTextures[l]&&(d=h,h=this._renderer.texture.getTextureView(n.msaaTextures[l]));const p=e&At.COLOR?"clear":"load";return s!=null||(s=i.defaultClearColor),{view:h,resolveTarget:d,clearValue:s,storeOp:"store",loadOp:p}});let a;if((t.stencil||t.depth)&&!t.depthStencilTexture&&(t.ensureDepthStencilTexture(),t.depthStencilTexture.source.sampleCount=n.msaa?4:1),t.depthStencilTexture){const u=e&At.STENCIL?"clear":"load",l=e&At.DEPTH?"clear":"load";a={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:u,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:o,depthStencilAttachment:a}}clear(t,e=!0,s,i){if(!e)return;const{gpu:n,encoder:o}=this._renderer,a=n.device;if(o.commandEncoder===null){const u=a.createCommandEncoder(),l=this.getDescriptor(t,e,s),c=u.beginRenderPass(l);c.setViewport(i.x,i.y,i.width,i.height,0,1),c.end();const h=u.finish();a.queue.submit([h])}else this.startRenderPass(t,e,s,i)}initGpuRenderTarget(t){t.isRoot=!0;const e=new rb;return t.colorTextures.forEach((s,i)=>{if(ne.test(s.resource)){const n=s.resource.getContext("webgpu"),o=s.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:o})}catch(a){console.error(a)}e.contexts[i]=n}if(e.msaa=s.source.antialias,s.source.antialias){const n=new tt({width:0,height:0,sampleCount:4});e.msaaTextures[i]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((s,i)=>{const n=e.msaaTextures[i];n==null||n.resize(s.source.width,s.source.height,s.source._resolution)})}}class Ql extends al{constructor(t){super(t),this.adaptor=new sb,this.adaptor.init(t,this)}}Ql.extension={type:[y.WebGPUSystem],name:"renderTarget"};class Jl{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,s=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),i={bindGroupLayouts:s};return this._gpuProgramData[t._layoutKey]={bindGroups:s,pipeline:e.createPipelineLayout(i)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}Jl.extension={type:[y.WebGPUSystem],name:"shader"};const _t={};_t.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},_t.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},_t.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},_t.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},_t.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},_t.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},_t["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},_t["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},_t["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},_t.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},_t.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},_t.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class tc{constructor(){this.defaultState=new Lt,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:_t[t.blendMode]||_t.normal}]}destroy(){this.gpu=null}}tc.extension={type:[y.WebGPUSystem],name:"state"};const ib={type:"image",upload(r,t,e){const s=r.resource,i=(r.pixelWidth|0)*(r.pixelHeight|0),n=s.byteLength/i;e.device.queue.writeTexture({texture:t},s,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*n},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},ec={"bc1-rgba-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"bc2-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc3-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"bc7-rgba-unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"etc1-rgb-unorm":{blockBytes:8,blockWidth:4,blockHeight:4},"etc2-rgba8unorm":{blockBytes:16,blockWidth:4,blockHeight:4},"astc-4x4-unorm":{blockBytes:16,blockWidth:4,blockHeight:4}},mC={blockBytes:4,blockWidth:1,blockHeight:1},nb={type:"compressed",upload(r,t,e){let s=r.pixelWidth,i=r.pixelHeight;const n=ec[r.format]||mC;for(let o=0;o<r.resource.length;o++){const a=r.resource[o],u=Math.ceil(s/n.blockWidth)*n.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:o},a,{offset:0,bytesPerRow:u},{width:Math.ceil(s/n.blockWidth)*n.blockWidth,height:Math.ceil(i/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),s=Math.max(s>>1,1),i=Math.max(i>>1,1)}}},rc={type:"image",upload(r,t,e){const s=r.resource;if(!s)return;const i=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),o=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:s},{texture:t,premultipliedAlpha:o},{width:i,height:n})}},ob={type:"video",upload(r,t,e){rc.upload(r,t,e)}};class ab{constructor(t){this.device=t,this.sampler=t.createSampler({minFilter:"linear"}),this.pipelines={}}_getMipmapPipeline(t){let e=this.pipelines[t];return e||(this.mipmapShaderModule||(this.mipmapShaderModule=this.device.createShaderModule({code:`
var<private> pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
vec2<f32>(-1.0, -1.0), vec2<f32>(-1.0, 3.0), vec2<f32>(3.0, -1.0));
struct VertexOutput {
@builtin(position) position : vec4<f32>,
@location(0) texCoord : vec2<f32>,
};
@vertex
fn vertexMain(@builtin(vertex_index) vertexIndex : u32) -> VertexOutput {
var output : VertexOutput;
output.texCoord = pos[vertexIndex] * vec2<f32>(0.5, -0.5) + vec2<f32>(0.5);
output.position = vec4<f32>(pos[vertexIndex], 0.0, 1.0);
return output;
}
@group(0) @binding(0) var imgSampler : sampler;
@group(0) @binding(1) var img : texture_2d<f32>;
@fragment
fn fragmentMain(@location(0) texCoord : vec2<f32>) -> @location(0) vec4<f32> {
return textureSample(img, imgSampler, texCoord);
}
`})),e=this.device.createRenderPipeline({layout:"auto",vertex:{module:this.mipmapShaderModule,entryPoint:"vertexMain"},fragment:{module:this.mipmapShaderModule,entryPoint:"fragmentMain",targets:[{format:t}]}}),this.pipelines[t]=e),e}generateMipmap(t){const e=this._getMipmapPipeline(t.format);if(t.dimension==="3d"||t.dimension==="1d")throw new Error("Generating mipmaps for non-2d textures is currently unsupported!");let s=t;const i=t.depthOrArrayLayers||1,n=t.usage&GPUTextureUsage.RENDER_ATTACHMENT;if(!n){const u={size:{width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};s=this.device.createTexture(u)}const o=this.device.createCommandEncoder({}),a=e.getBindGroupLayout(0);for(let u=0;u<i;++u){let l=t.createView({baseMipLevel:0,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),c=n?1:0;for(let h=1;h<t.mipLevelCount;++h){const d=s.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),p=o.beginRenderPass({colorAttachments:[{view:d,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),f=this.device.createBindGroup({layout:a,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});p.setPipeline(e),p.setBindGroup(0,f),p.draw(3,1,0,0),p.end(),l=d}}if(!n){const u={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:i};for(let l=1;l<t.mipLevelCount;++l)o.copyTextureToTexture({texture:s,mipLevel:l-1},{texture:t,mipLevel:l},u),u.width=Math.ceil(u.width/2),u.height=Math.ceil(u.height/2)}return this.device.queue.submit([o.finish()]),n||s.destroy(),t}}class sc{constructor(t){this.managedTextures=[],this._gpuSources=Object.create(null),this._gpuSamplers=Object.create(null),this._bindGroupHash=Object.create(null),this._textureViewHash=Object.create(null),this._uploads={image:rc,buffer:ib,video:ob,compressed:nb},this._renderer=t}contextChange(t){this._gpu=t}initSource(t){if(t.autoGenerateMipmaps){const u=Math.max(t.pixelWidth,t.pixelHeight);t.mipLevelCount=Math.floor(Math.log2(u))+1}let e=GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST;t.uploadMethodId!=="compressed"&&(e|=GPUTextureUsage.RENDER_ATTACHMENT,e|=GPUTextureUsage.COPY_SRC);const s=ec[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},i=Math.ceil(t.pixelWidth/s.blockWidth)*s.blockWidth,n=Math.ceil(t.pixelHeight/s.blockHeight)*s.blockHeight,o={label:t.label,size:{width:i,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},a=this._gpu.device.createTexture(o);return this._gpuSources[t.uid]=a,this.managedTextures.includes(t)||(t.on("update",this.onSourceUpdate,this),t.on("resize",this.onSourceResize,this),t.on("destroy",this.onSourceDestroy,this),t.on("unload",this.onSourceUnload,this),t.on("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.push(t)),this.onSourceUpdate(t),a}onSourceUpdate(t){const e=this.getGpuSource(t);e&&(this._uploads[t.uploadMethodId]&&this._uploads[t.uploadMethodId].upload(t,e,this._gpu),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t))}onSourceUnload(t){const e=this._gpuSources[t.uid];e&&(this._gpuSources[t.uid]=null,e.destroy())}onUpdateMipmaps(t){this._mipmapGenerator||(this._mipmapGenerator=new ab(this._gpu.device));const e=this.getGpuSource(t);this._mipmapGenerator.generateMipmap(e)}onSourceDestroy(t){t.off("update",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("destroy",this.onSourceDestroy,this),t.off("resize",this.onSourceResize,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}onSourceResize(t){const e=this._gpuSources[t.uid];e?(e.width!==t.pixelWidth||e.height!==t.pixelHeight)&&(this._textureViewHash[t.uid]=null,this._bindGroupHash[t.uid]=null,this.onSourceUnload(t),this.initSource(t)):this.initSource(t)}_initSampler(t){return this._gpuSamplers[t._resourceId]=this._gpu.device.createSampler(t),this._gpuSamplers[t._resourceId]}getGpuSampler(t){return this._gpuSamplers[t._resourceId]||this._initSampler(t)}getGpuSource(t){return this._gpuSources[t.uid]||this.initSource(t)}getTextureBindGroup(t){var e;return(e=this._bindGroupHash[t.uid])!=null?e:this._createTextureBindGroup(t)}_createTextureBindGroup(t){const e=t.source;return this._bindGroupHash[t.uid]=new Kt({0:e,1:e.style,2:new it({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const s=t.source;return(e=this._textureViewHash[s.uid])!=null?e:this._createTextureView(s)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,s=e.gpu.device.createCommandEncoder(),i=L.get().createCanvas();i.width=t.source.pixelWidth,i.height=t.source.pixelHeight;const n=i.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:L.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),s.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:i.width,height:i.height}),e.gpu.device.queue.submit([s.finish()]),i}getPixels(t){const e=this.generateCanvas(t),s=Zt.getOptimalCanvasAndContext(e.width,e.height),i=s.context;i.drawImage(e,0,0);const{width:n,height:o}=e,a=i.getImageData(0,0,n,o),u=new Uint8ClampedArray(a.data.buffer);return Zt.returnCanvasAndContext(s),{pixels:u,width:n,height:o}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),s=this._bindGroupHash[e];s==null||s.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}sc.extension={type:[y.WebGPUSystem],name:"texture"};class ic{init(){const t=new it({uTransformMatrix:{value:new B,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=or({name:"graphics",bits:[pi,mi(Ie()),xm,ur]});this.shader=new Ut({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){const s=e.context,i=s.customShader||this.shader,n=t.renderer,o=n.graphicsContext,{batcher:a,instructions:u}=o.getContextRenderData(s),l=n.encoder;l.setPipelineFromGeometryProgramAndState(a.geometry,i.gpuProgram,t.state),l.setGeometry(a.geometry,i.gpuProgram);const c=n.globalUniforms.bindGroup;l.setBindGroup(0,c,i.gpuProgram);const h=n.renderPipes.uniformBatch.getUniformBindGroup(i.resources.localUniforms,!0);l.setBindGroup(2,h,i.gpuProgram);const d=u.instructions;for(let p=0;p<u.instructionSize;p++){const f=d[p];if(i.groups[1]=f.bindGroup,!f.gpuBindGroup){const g=f.textures;f.bindGroup=li(g.textures,g.count),f.gpuBindGroup=n.bindGroup.getBindGroup(f.bindGroup,i.gpuProgram,1)}l.setBindGroup(1,f.bindGroup,i.gpuProgram),l.renderPassEncoder.drawIndexed(f.size,1,f.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}ic.extension={type:[y.WebGPUPipesAdaptor],name:"graphics"};class nc{init(){const t=or({name:"mesh",bits:[fr,h0,ur]});this._shader=new Ut({gpuProgram:t,resources:{uTexture:E.EMPTY._source,uSampler:E.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new B}}}})}execute(t,e){const s=t.renderer;let i=e._shader;if(!i)i=this._shader,i.groups[2]=s.texture.getTextureBindGroup(e.texture);else if(!i.gpuProgram)return;const n=i.gpuProgram;if(n.autoAssignGlobalUniforms&&(i.groups[0]=s.globalUniforms.bindGroup),n.autoAssignLocalUniforms){const o=t.localUniforms;i.groups[1]=s.renderPipes.uniformBatch.getUniformBindGroup(o,!0)}s.encoder.draw({geometry:e._geometry,shader:i,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}nc.extension={type:[y.WebGPUPipesAdaptor],name:"mesh"};const gC=[...Hl,ql,Wl,En,jl,sc,Ql,Jl,tc,Zl,Vl,Yl,zl],_C=[...Xl,Kl],bC=[Lu,nc,ic],ub=[],lb=[],cb=[];k.handleByNamedList(y.WebGPUSystem,ub),k.handleByNamedList(y.WebGPUPipes,lb),k.handleByNamedList(y.WebGPUPipesAdaptor,cb),k.add(...gC,..._C,...bC);class hb extends gs{constructor(){const t={name:"webgpu",type:Tt.WEBGPU,systems:ub,renderPipes:lb,renderPipeAdaptors:cb};super(t)}}var xC={__proto__:null,WebGPURenderer:hb};const yC={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},vC=new Proxy(yC,{get(r,t){return r[t]}}),TC=new V(0,0,1,1);function AC(r,t,e){e||(e=TC);const s=t.pixelWidth,i=t.pixelHeight;return r.x=e.x*s|0,r.y=e.y*i|0,r.width=e.width*s|0,r.height=e.height*i|0,r}var db=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(db||{}),oc=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(oc||{});const SC=new Proxy(oc,{get(r,t){return r[t]}});var ac=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(ac||{});const EC=new Proxy(ac,{get(r,t){return r[t]}});class wC{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,s){const i=e.width,n=e.height;if(s){const o=t.width/2/i,a=t.height/2/n,u=t.x/i+o,l=t.y/n+a;s=$.add(s,$.NW),this.x0=u+o*$.uX(s),this.y0=l+a*$.uY(s),s=$.add(s,2),this.x1=u+o*$.uX(s),this.y1=l+a*$.uY(s),s=$.add(s,2),this.x2=u+o*$.uX(s),this.y2=l+a*$.uY(s),s=$.add(s,2),this.x3=u+o*$.uX(s),this.y3=l+a*$.uY(s)}else this.x0=t.x/i,this.y0=t.y/n,this.x1=(t.x+t.width)/i,this.y1=t.y/n,this.x2=(t.x+t.width)/i,this.y2=(t.y+t.height)/n,this.x3=t.x/i,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}let CC=0;function RC(){return CC++}function PC(r){const t=r.toString(),e=t.indexOf("{"),s=t.lastIndexOf("}");if(e===-1||s===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,s).trim()}var DC=Object.defineProperty,wn=Object.getOwnPropertySymbols,pb=Object.prototype.hasOwnProperty,fb=Object.prototype.propertyIsEnumerable,mb=(r,t,e)=>t in r?DC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,MC=(r,t)=>{for(var e in t||(t={}))pb.call(t,e)&&mb(r,e,t[e]);if(wn)for(var e of wn(t))fb.call(t,e)&&mb(r,e,t[e]);return r},OC=(r,t)=>{var e={};for(var s in r)pb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&wn)for(var s of wn(r))t.indexOf(s)<0&&fb.call(r,s)&&(e[s]=r[s]);return e};class BC extends rt{constructor(t){var e,s;typeof t=="function"&&(t={render:t});const i=t,{render:n}=i,o=OC(i,["render"]);super(MC({label:"RenderContainer"},o)),this.batched=!1,this._lastUsed=0,this._lastInstructionTick=-1,this.bounds=new pt,this.canBundle=!1,this.renderPipeId="customRender",n&&(this.render=n),this.containsPoint=(e=t.containsPoint)!=null?e:()=>!1,this.addBounds=(s=t.addBounds)!=null?s:()=>!1}render(t){}}function GC(r,t){const e=t._scale,s=t._pivot,i=t._position,n=e._x,o=e._y,a=s._x,u=s._y;r.a=t._cx*n,r.b=t._sx*n,r.c=t._cy*o,r.d=t._sy*o,r.tx=i._x-(a*r.a+u*r.c),r.ty=i._y-(a*r.b+u*r.d)}function IC(r,t,e){const s=r.a,i=r.b,n=r.c,o=r.d,a=r.tx,u=r.ty,l=t.a,c=t.b,h=t.c,d=t.d;e.a=s*l+i*h,e.b=s*c+i*d,e.c=n*l+o*h,e.d=n*c+o*d,e.tx=a*l+u*h+t.tx,e.ty=a*c+u*d+t.ty}const FC={rectangle:na,polygon:ia,triangle:oa,circle:oe,ellipse:oe,roundedRectangle:oe};function UC(r){r instanceof Te&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],s=[],i=r.path.shapePath,n=r.textureMatrix;i.shapePrimitives.forEach(({shape:a,transform:u})=>{const l=s.length,c=t.length/2,h=[],d=FC[a.type];d.build(a,h),u&&yi(h,u),d.triangulate(h,t,2,c,s,l);const p=e.length/2;n?(u&&n.append(u.clone().invert()),Zo(t,2,c,e,p,2,t.length/2-c,n)):Qo(e,p,2,t.length/2-c)});const o=r.out;return o?(o.positions=new Float32Array(t),o.uvs=new Float32Array(e),o.indices=new Uint32Array(s),o):new ge({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(s)})}function gb(r,t,e,s){const i=e.buffers[0],n=i.data,{verticesX:o,verticesY:a}=e,u=r/(o-1),l=t/(a-1);let c=0;const h=s[0],d=s[1],p=s[2],f=s[3],g=s[4],m=s[5],_=s[6],x=s[7],b=s[8];for(let v=0;v<n.length;v+=2){const A=c%o*u,C=(c/o|0)*l,w=h*A+d*C+p,R=f*A+g*C+m,T=_*A+x*C+b;n[v]=w/T,n[v+1]=R/T,c++}i.update()}function _b(r,t){const e=t[0],s=t[1],i=t[2],n=t[3],o=t[4],a=t[5],u=t[6],l=t[7],c=t[8];return r[0]=o*c-a*l,r[1]=i*l-s*c,r[2]=s*a-i*o,r[3]=a*u-n*c,r[4]=e*c-i*u,r[5]=i*n-e*a,r[6]=n*l-o*u,r[7]=s*u-e*l,r[8]=e*o-s*n,r}function bb(r,t,e){const s=t[0],i=t[1],n=t[2],o=t[3],a=t[4],u=t[5],l=t[6],c=t[7],h=t[8],d=e[0],p=e[1],f=e[2],g=e[3],m=e[4],_=e[5],x=e[6],b=e[7],v=e[8];return r[0]=d*s+p*o+f*l,r[1]=d*i+p*a+f*c,r[2]=d*n+p*u+f*h,r[3]=g*s+m*o+_*l,r[4]=g*i+m*a+_*c,r[5]=g*n+m*u+_*h,r[6]=x*s+b*o+v*l,r[7]=x*i+b*a+v*c,r[8]=x*n+b*u+v*h,r}function kC(r,t,e){const s=e[0],i=e[1],n=e[2];return r[0]=t[0]*s+t[1]*i+t[2]*n,r[1]=t[3]*s+t[4]*i+t[5]*n,r[2]=t[6]*s+t[7]*i+t[8]*n,r}const NC=[0,0,0,0,0,0,0,0,0],LC=[0,0,0],Cn=[0,0,0];function xb(r,t,e,s,i,n,o,a,u){const l=NC;l[0]=t,l[1]=s,l[2]=n,l[3]=e,l[4]=i,l[5]=o,l[6]=1,l[7]=1,l[8]=1;const c=_b(r,l);Cn[0]=a,Cn[1]=u,Cn[2]=1;const h=kC(LC,c,Cn),d=r;return r[0]=h[0],r[1]=0,r[2]=0,r[3]=0,r[4]=h[1],r[5]=0,r[6]=0,r[7]=0,r[8]=h[2],bb(r,d,l)}const $C=[0,0,0,0,0,0,0,0,0],HC=[0,0,0,0,0,0,0,0,0];function yb(r,t,e,s,i,n,o,a,u,l,c,h,d,p,f,g,m){const _=xb($C,t,e,n,o,l,c,p,f),x=xb(HC,s,i,a,u,h,d,g,m);return bb(r,_b(_,_),x)}class vb extends $i{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:s}=t;this.corners=[0,0,e,0,e,s,0,s]}setCorners(t,e,s,i,n,o,a,u){const l=this.corners;l[0]=t,l[1]=e,l[2]=s,l[3]=i,l[4]=n,l[5]=o,l[6]=a,l[7]=u,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,s=this.corners,i=yb(this._projectionMatrix,0,0,s[0],s[1],t,0,s[2],s[3],t,e,s[4],s[5],0,e,s[6],s[7]);gb(t,e,this,i)}}var XC=Object.defineProperty,zC=Object.defineProperties,jC=Object.getOwnPropertyDescriptors,Rn=Object.getOwnPropertySymbols,Tb=Object.prototype.hasOwnProperty,Ab=Object.prototype.propertyIsEnumerable,Sb=(r,t,e)=>t in r?XC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uc=(r,t)=>{for(var e in t||(t={}))Tb.call(t,e)&&Sb(r,e,t[e]);if(Rn)for(var e of Rn(t))Ab.call(t,e)&&Sb(r,e,t[e]);return r},VC=(r,t)=>zC(r,jC(t)),WC=(r,t)=>{var e={};for(var s in r)Tb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Rn)for(var s of Rn(r))t.indexOf(s)<0&&Ab.call(r,s)&&(e[s]=r[s]);return e};const Eb=class Gx extends xr{constructor(t){t=uc(uc({},Gx.defaultOptions),t);const e=t,{texture:s,verticesX:i,verticesY:n}=e,o=WC(e,["texture","verticesX","verticesY"]),a=new vb(Vt({width:s.width,height:s.height,verticesX:i,verticesY:n}));super(Vt(VC(uc({},o),{geometry:a}))),this._texture=s,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:s}=this.texture;(t.width!==e||t.height!==s)&&(t.width=e,t.height=s,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,s,i,n,o,a,u){this.geometry.setCorners(t,e,s,i,n,o,a,u)}};Eb.defaultOptions={texture:E.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let YC=Eb;var qC=Object.defineProperty,KC=Object.defineProperties,ZC=Object.getOwnPropertyDescriptors,Pn=Object.getOwnPropertySymbols,wb=Object.prototype.hasOwnProperty,Cb=Object.prototype.propertyIsEnumerable,Rb=(r,t,e)=>t in r?qC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,QC=(r,t)=>{for(var e in t||(t={}))wb.call(t,e)&&Rb(r,e,t[e]);if(Pn)for(var e of Pn(t))Cb.call(t,e)&&Rb(r,e,t[e]);return r},JC=(r,t)=>KC(r,ZC(t)),tR=(r,t)=>{var e={};for(var s in r)wb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Pn)for(var s of Pn(r))t.indexOf(s)<0&&Cb.call(r,s)&&(e[s]=r[s]);return e};class eR extends xr{constructor(t){const e=t,{texture:s,verticesX:i,verticesY:n}=e,o=tR(e,["texture","verticesX","verticesY"]),a=new $i(Vt({width:s.width,height:s.height,verticesX:i,verticesY:n}));super(Vt(JC(QC({},o),{geometry:a,texture:s}))),this.texture=s,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:s}=this.texture;this.autoResize&&(t.width!==e||t.height!==s)&&(t.width=e,t.height=s,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var rR=Object.defineProperty,Pb=Object.getOwnPropertySymbols,sR=Object.prototype.hasOwnProperty,iR=Object.prototype.propertyIsEnumerable,Db=(r,t,e)=>t in r?rR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mb=(r,t)=>{for(var e in t||(t={}))sR.call(t,e)&&Db(r,e,t[e]);if(Pb)for(var e of Pb(t))iR.call(t,e)&&Db(r,e,t[e]);return r};const Ob=class Ix extends ge{constructor(t){const{width:e,points:s,textureScale:i}=Mb(Mb({},Ix.defaultOptions),t);super({positions:new Float32Array(s.length*4),uvs:new Float32Array(s.length*4),indices:new Uint32Array((s.length-1)*6)}),this.points=s,this._width=e,this.textureScale=i,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),s=this.getBuffer("aUV"),i=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),s.data=new Float32Array(t.length*4),i.data=new Uint16Array((t.length-1)*6));const n=s.data,o=i.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let a=0,u=t[0];const l=this._width*this.textureScale,c=t.length;for(let d=0;d<c;d++){const p=d*4;if(this.textureScale>0){const f=u.x-t[d].x,g=u.y-t[d].y,m=Math.sqrt(f*f+g*g);u=t[d],a+=m/l}else a=d/(c-1);n[p]=a,n[p+1]=0,n[p+2]=a,n[p+3]=1}let h=0;for(let d=0;d<c-1;d++){const p=d*2;o[h++]=p,o[h++]=p+1,o[h++]=p+2,o[h++]=p+2,o[h++]=p+1,o[h++]=p+3}s.update(),i.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],s,i=0,n=0;const o=this.buffers[0].data,a=t.length,u=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<a;l++){const c=t[l],h=l*4;l<t.length-1?s=t[l+1]:s=c,n=-(s.x-e.x),i=s.y-e.y;let d=(1-l/(a-1))*10;d>1&&(d=1);const p=Math.sqrt(i*i+n*n);p<1e-6?(i=0,n=0):(i/=p,n/=p,i*=u,n*=u),o[h]=c.x+i,o[h+1]=c.y+n,o[h+2]=c.x-i,o[h+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};Ob.defaultOptions={width:200,points:[],textureScale:0};let Bb=Ob;var nR=Object.defineProperty,oR=Object.defineProperties,aR=Object.getOwnPropertyDescriptors,Dn=Object.getOwnPropertySymbols,Gb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,Fb=(r,t,e)=>t in r?nR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lc=(r,t)=>{for(var e in t||(t={}))Gb.call(t,e)&&Fb(r,e,t[e]);if(Dn)for(var e of Dn(t))Ib.call(t,e)&&Fb(r,e,t[e]);return r},uR=(r,t)=>oR(r,aR(t)),lR=(r,t)=>{var e={};for(var s in r)Gb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Dn)for(var s of Dn(r))t.indexOf(s)<0&&Ib.call(r,s)&&(e[s]=r[s]);return e};const Ub=class Fx extends xr{constructor(t){const e=lc(lc({},Fx.defaultOptions),t),{texture:s,points:i,textureScale:n}=e,o=lR(e,["texture","points","textureScale"]),a=new Bb(Vt({width:s.height,points:i,textureScale:n}));n>0&&(s.source.style.addressMode="repeat"),super(Vt(uR(lc({},o),{texture:s,geometry:a}))),this.autoUpdate=!0,this.onRender=this._render}_render(){const t=this.geometry;(this.autoUpdate||t._width!==this.texture.height)&&(t._width=this.texture.height,t.update())}};Ub.defaultOptions={textureScale:0};let cR=Ub;var hR=Object.defineProperty,dR=Object.defineProperties,pR=Object.getOwnPropertyDescriptors,Mn=Object.getOwnPropertySymbols,kb=Object.prototype.hasOwnProperty,Nb=Object.prototype.propertyIsEnumerable,Lb=(r,t,e)=>t in r?hR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fR=(r,t)=>{for(var e in t||(t={}))kb.call(t,e)&&Lb(r,e,t[e]);if(Mn)for(var e of Mn(t))Nb.call(t,e)&&Lb(r,e,t[e]);return r},mR=(r,t)=>dR(r,pR(t)),gR=(r,t)=>{var e={};for(var s in r)kb.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&Mn)for(var s of Mn(r))t.indexOf(s)<0&&Nb.call(r,s)&&(e[s]=r[s]);return e};class _R extends xr{constructor(t){const e=t,{texture:s,vertices:i,uvs:n,indices:o,topology:a}=e,u=gR(e,["texture","vertices","uvs","indices","topology"]),l=new ge(Vt({positions:i,uvs:n,indices:o,topology:a}));super(Vt(mR(fR({},u),{texture:s,geometry:l}))),this.autoUpdate=!0,this.onRender=this._render}get vertices(){return this.geometry.getBuffer("aPosition").data}set vertices(t){this.geometry.getBuffer("aPosition").data=t}_render(){this.autoUpdate&&this.geometry.getBuffer("aPosition").update()}}function bR(r,t){const{width:e,height:s}=r.frame;return t.scale(1/e,1/s),t}var xR=Object.defineProperty,On=Object.getOwnPropertySymbols,$b=Object.prototype.hasOwnProperty,Hb=Object.prototype.propertyIsEnumerable,Xb=(r,t,e)=>t in r?xR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yR=(r,t)=>{for(var e in t||(t={}))$b.call(t,e)&&Xb(r,e,t[e]);if(On)for(var e of On(t))Hb.call(t,e)&&Xb(r,e,t[e]);return r},vR=(r,t)=>{var e={};for(var s in r)$b.call(r,s)&&t.indexOf(s)<0&&(e[s]=r[s]);if(r!=null&&On)for(var s of On(r))t.indexOf(s)<0&&Hb.call(r,s)&&(e[s]=r[s]);return e};const zb=class Ux extends Be{constructor(t){var e,s,i,n,o,a,u,l,c,h;t instanceof E&&(t={texture:t});const d=t,{width:p,height:f,leftWidth:g,rightWidth:m,topHeight:_,bottomHeight:x,texture:b,roundPixels:v}=d,A=vR(d,["width","height","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(yR({label:"NineSliceSprite"},A)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._didSpriteUpdate=!0,this._leftWidth=(s=g!=null?g:(e=b==null?void 0:b.defaultBorders)==null?void 0:e.left)!=null?s:_e.defaultOptions.leftWidth,this._topHeight=(n=_!=null?_:(i=b==null?void 0:b.defaultBorders)==null?void 0:i.top)!=null?n:_e.defaultOptions.topHeight,this._rightWidth=(a=m!=null?m:(o=b==null?void 0:b.defaultBorders)==null?void 0:o.right)!=null?a:_e.defaultOptions.rightWidth,this._bottomHeight=(l=x!=null?x:(u=b==null?void 0:b.defaultBorders)==null?void 0:u.bottom)!=null?l:_e.defaultOptions.bottomHeight,this.bounds.maxX=this._width=(c=p!=null?p:b.width)!=null?c:_e.defaultOptions.width,this.bounds.maxY=this._height=(h=f!=null?f:b.height)!=null?h:_e.defaultOptions.height,this.allowChildren=!1,this.texture=b!=null?b:Ux.defaultOptions.texture,this.roundPixels=v!=null?v:!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){var s;typeof t=="object"&&(e=(s=t.height)!=null?s:t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=E.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get originalWidth(){return this._texture.width}get originalHeight(){return this._texture.height}onViewUpdate(){if(this._didViewChangeTick++,this._didSpriteUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}destroy(t){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};zb.defaultOptions={texture:E.EMPTY};let jb=zb;class TR extends jb{constructor(...t){let e=t[0];e instanceof E&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}function AR(r,t){return t instanceof Dt||t instanceof He?t:r==="html"?new He(t):new Dt(t)}var cc=/iPhone/i,Vb=/iPod/i,Wb=/iPad/i,Yb=/\biOS-universal(?:.+)Mac\b/i,hc=/\bAndroid(?:.+)Mobile\b/i,qb=/Android/i,Ar=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Bn=/Silk/i,le=/Windows Phone/i,Kb=/\bWindows(?:.+)ARM\b/i,Zb=/BlackBerry/i,Qb=/BB10/i,Jb=/Opera Mini/i,tx=/\b(CriOS|Chrome)(?:.+)Mobile/i,ex=/Mobile(?:.+)Firefox\b/i,rx=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function SR(r){return function(t){return t.test(r)}}function sx(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,s=e.split("[FBAN");typeof s[1]!="undefined"&&(e=s[0]),s=e.split("Twitter"),typeof s[1]!="undefined"&&(e=s[0]);var i=SR(e),n={apple:{phone:i(cc)&&!i(le),ipod:i(Vb),tablet:!i(cc)&&(i(Wb)||rx(t))&&!i(le),universal:i(Yb),device:(i(cc)||i(Vb)||i(Wb)||i(Yb)||rx(t))&&!i(le)},amazon:{phone:i(Ar),tablet:!i(Ar)&&i(Bn),device:i(Ar)||i(Bn)},android:{phone:!i(le)&&i(Ar)||!i(le)&&i(hc),tablet:!i(le)&&!i(Ar)&&!i(hc)&&(i(Bn)||i(qb)),device:!i(le)&&(i(Ar)||i(Bn)||i(hc)||i(qb))||i(/\bokhttp\b/i)},windows:{phone:i(le),tablet:i(Kb),device:i(le)||i(Kb)},other:{blackberry:i(Zb),blackberry10:i(Qb),opera:i(Jb),firefox:i(ex),chrome:i(tx),device:i(Zb)||i(Qb)||i(Jb)||i(ex)||i(tx)},any:!1,phone:!1,tablet:!1};return n.any=n.apple.device||n.android.device||n.windows.device||n.other.device,n.phone=n.apple.phone||n.android.phone||n.windows.phone,n.tablet=n.apple.tablet||n.android.tablet||n.windows.tablet,n}var ix;const ER=(ix=sx.default)!=null?ix:sx,wR=ER(globalThis.navigator);async function CR(r,t,e=200){const s=await t.extract.base64(r);await t.encoder.commandFinished;const i=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const n=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${s}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}var RR=Object.defineProperty,PR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,nx=Object.getOwnPropertySymbols,MR=Object.prototype.hasOwnProperty,OR=Object.prototype.propertyIsEnumerable,ox=(r,t,e)=>t in r?RR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ax=(r,t)=>{for(var e in t||(t={}))MR.call(t,e)&&ox(r,e,t[e]);if(nx)for(var e of nx(t))OR.call(t,e)&&ox(r,e,t[e]);return r},BR=(r,t)=>PR(r,DR(t));const GR=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let IR=0;function ux(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=GR[IR++]);let s="";for(let o=0;o<t;o++)s+=" ";let i=r.label;!i&&r instanceof Xt&&(i=`sprite:${r.texture.label}`);let n=`%c ${s}|- ${i} (worldX:${r.worldTransform.tx}, relativeRenderX:${r.relativeGroupTransform.tx}, renderX:${r.groupTransform.tx}, localX:${r.x})`;r.renderGroup&&(n+=" (RenderGroup)"),r.filters&&(n+="(*filters)"),console.log(n,`color:${e.color}; font-weight:bold;`),t++;for(let o=0;o<r.children.length;o++){const a=r.children[o];ux(a,t,ax({},e))}}function lx(r,t=0,e={index:0,color:"#000000"}){let s="";for(let n=0;n<t;n++)s+=" ";const i=`%c ${s}- ${e.index}: ${r.root.label} worldX:${r.worldTransform.tx}`;console.log(i,`color:${e.color}; font-weight:bold;`),t++;for(let n=0;n<r.renderGroupChildren.length;n++){const o=r.renderGroupChildren[n];lx(o,t,BR(ax({},e),{index:n}))}}L.set(ph);export{Ia as AbstractBitmapFont,gs as AbstractRenderer,pn as AbstractText,AE as AlphaFilter,Eo as AlphaMask,Xu as AlphaMaskPipe,Gs as AnimatedSprite,Wm as Application,ou as ApplicationInitHook,vs as Assets,Og as AssetsClass,Cd as BLEND_TO_NPM,Ps as BUFFER_TYPE,Km as BackgroundLoader,A2 as BackgroundSystem,Od as Batch,Nd as BatchGeometry,Rd as BatchTextureArray,vi as BatchableGraphics,Di as BatchableMesh,Mi as BatchableSprite,Ud as Batcher,Hu as BatcherPipe,H as BigPool,Kt as BindGroup,zl as BindGroupSystem,uu as BitmapFont,ps as BitmapFontManager,a0 as BitmapText,La as BitmapTextPipe,mE as BlendModeFilter,Ol as BlendModePipe,A_ as BlurFilter,sn as BlurFilterPass,pt as Bounds,Rt as Buffer,Qs as BufferImageSource,xn as BufferResource,X as BufferUsage,At as CLEAR,q as Cache,Zt as CanvasPool,Zp as CanvasPoolClass,ne as CanvasSource,Ht as CanvasTextMetrics,_a as CanvasTextPipe,Ma as CanvasTextSystem,Fn as Circle,j as Color,wo as ColorMask,zu as ColorMaskPipe,$E as ColorMatrixFilter,Ts as CompressedSource,rt as Container,Yg as Culler,qg as CullerPlugin,vl as CustomRenderPipe,Au as D3D10_RESOURCE_DIMENSION,St as D3DFMT,bA as DATA_URI,F as DDS,Eh as DEG_TO_RAD,ac as DEPRECATED_SCALE_MODES,oc as DEPRECATED_WRAP_MODES,L as DOMAdapter,vC as DRAW_MODES,Tu as DXGI_FORMAT,Et as DXGI_TO_TEXTURE_FORMAT,xi as DefaultBatcher,Rp as DefaultShader,YE as DisplacementFilter,Ua as DynamicBitmapFont,Un as Ellipse,Ct as EventEmitter,y as ExtensionType,w2 as ExtractSystem,Su as FOURCC_TO_TEXTURE_FORMAT,hr as FillGradient,os as FillPattern,ue as Filter,Wr as FilterEffect,Za as FilterPipe,Ja as FilterSystem,fs as FontStylePromiseCache,Du as GAUSSIAN_VALUES,_n as GL_FORMATS,Lg as GL_INTERNAL_FORMAT,qu as GL_TARGETS,z as GL_TYPES,y0 as GL_WRAP_MODES,Fl as GenerateTextureSystem,rr as Geometry,w0 as GlBackBufferSystem,Nu as GlBatchAdaptor,m0 as GlBuffer,Vu as GlBufferSystem,Qu as GlColorMaskSystem,x0 as GlContextSystem,Ju as GlEncoderSystem,Ku as GlGeometrySystem,xl as GlGraphicsAdaptor,yl as GlMeshAdaptor,It as GlProgram,z0 as GlProgramData,C0 as GlRenderTarget,G0 as GlRenderTargetAdaptor,ul as GlRenderTargetSystem,pl as GlShaderSystem,i2 as GlStateSystem,tl as GlStencilSystem,n2 as GlTexture,bl as GlTextureSystem,nl as GlUboSystem,fl as GlUniformGroupSystem,Ul as GlobalUniformSystem,Lu as GpuBatchAdaptor,_t as GpuBlendModesToPixi,jl as GpuBufferSystem,Vl as GpuColorMaskSystem,En as GpuDeviceSystem,Wl as GpuEncoderSystem,ic as GpuGraphicsAdaptor,qp as GpuGraphicsContext,nc as GpuMeshAdapter,ab as GpuMipmapGenerator,Ot as GpuProgram,eC as GpuReadBuffer,rb as GpuRenderTarget,sb as GpuRenderTargetAdaptor,Ql as GpuRenderTargetSystem,Jl as GpuShaderSystem,tc as GpuStateSystem,xe as GpuStencilModesToPixi,Yl as GpuStencilSystem,sc as GpuTextureSystem,ql as GpuUboSystem,Kl as GpuUniformBatchPipe,wr as Graphics,gt as GraphicsContext,Kp as GraphicsContextRenderData,Pi as GraphicsContextSystem,Te as GraphicsPath,ma as GraphicsPipe,u0 as HTMLText,$a as HTMLTextPipe,za as HTMLTextRenderData,He as HTMLTextStyle,ki as HTMLTextSystem,Sn as HelloSystem,ew as IGLUniformData,Ge as ImageSource,yo as InstructionSet,et as KTX,ag as Loader,wt as LoaderParserPriority,db as MSAA_QUALITY,ri as MaskEffectManager,ad as MaskEffectManagerClass,H_ as MaskFilter,B as Matrix,xr as Mesh,ge as MeshGeometry,ga as MeshPipe,eR as MeshPlane,cR as MeshRope,_R as MeshSimple,lo as NOOP,_e as NineSliceGeometry,TR as NineSlicePlane,jb as NineSliceSprite,Ka as NineSliceSpritePipe,t3 as NoiseFilter,ot as ObservablePoint,Ah as PI_2,YC as PerspectiveMesh,vb as PerspectivePlaneGeometry,Zl as PipelineSystem,$i as PlaneGeometry,nt as Point,Er as Polygon,ei as Pool,id as PoolGroupClass,z_ as PrepareBase,o0 as PrepareQueue,c0 as PrepareSystem,l0 as PrepareUpload,Am as QuadGeometry,Sh as RAD_TO_DEG,V as Rectangle,BC as RenderContainer,gd as RenderGroup,Al as RenderGroupPipe,Pl as RenderGroupSystem,bn as RenderTarget,al as RenderTargetSystem,Nn as RenderTexture,G2 as RenderableGCSystem,au as RendererInitHook,Tt as RendererType,io as ResizePlugin,pe as Resolver,Bb as RopeGeometry,kn as RoundedRectangle,EC as SCALE_MODES,at as STENCIL_MODES,bf as SVGParser,af as SVGToGraphicsPath,kl as SchedulerSystem,R3 as ScissorMask,$f as SdfShader,Ut as Shader,nr as ShaderStage,mf as ShapePath,Xl as SharedRenderPipes,Hl as SharedSystems,Xt as Sprite,Dl as SpritePipe,po as Spritesheet,Lt as State,Co as StencilMask,ju as StencilMaskPipe,su as SystemRunner,kg as TEXTURE_FORMAT_BLOCK_SIZE,ku as Text,Dt as TextStyle,E as Texture,k2 as TextureGCSystem,ho as TextureMatrix,dt as TexturePool,tf as TexturePoolClass,tt as TextureSource,Oh as TextureStyle,wC as TextureUvs,mt as Ticker,Ys as TickerListener,no as TickerPlugin,r0 as TilingSprite,qa as TilingSpritePipe,Tm as TilingSpriteShader,Z_ as Transform,bc as Triangle,t2 as UNIFORM_TO_ARRAY_SETTERS,J0 as UNIFORM_TO_SINGLE_SETTERS,bp as UNIFORM_TYPES_MAP,qo as UNIFORM_TYPES_VALUES,ii as UPDATE_BLEND,Kr as UPDATE_COLOR,de as UPDATE_PRIORITY,pv as UPDATE_TRANSFORM,tr as UPDATE_VISIBLE,W2 as UboBatch,el as UboSystem,it as UniformGroup,ys as VERSION,Zr as VideoSource,Be as ViewContainer,H2 as ViewSystem,Io as ViewableBuffer,Ms as WGSL_ALIGN_SIZE_DATA,rl as WGSL_TO_STD40_SIZE,SC as WRAP_MODES,V2 as WebGLRenderer,hb as WebGPURenderer,ph as WebWorkerAdapter,fu as WorkerManager,bo as _getGlobalBounds,Qa as _getGlobalBoundsRecursive,Ho as addBits,oi as addMaskBounds,ai as addMaskLocalBounds,Hd as addProgramDefines,a_ as alphaFrag,Ru as alphaWgsl,Em as applyMatrix,gb as applyProjectiveTransformationToPlane,_l as applyStyleParams,_d as assignWithIgnore,cA as autoDetectEnvironment,Xm as autoDetectRenderer,Ev as autoDetectSource,Ki as basisTranscoderUrls,Ym as bitmapFontCachePlugin,Xi as bitmapFontTextParser,lu as bitmapFontXMLParser,cu as bitmapFontXMLStringParser,t_ as blendTemplateFrag,e_ as blendTemplateVert,r_ as blendTemplateWgsl,ec as blockDataMap,m_ as blurTemplateWgsl,qt as boundsPool,ya as buildAdaptiveBezier,lf as buildAdaptiveQuadratic,Aa as buildArc,cf as buildArcTo,df as buildArcToSvg,oe as buildCircle,Wp as buildContextBatches,Fp as buildEllipse,UC as buildGeometryFromPath,p0 as buildInstructions,$p as buildLine,ia as buildPolygon,na as buildRectangle,Up as buildRoundedRectangle,Qo as buildSimpleUvs,oa as buildTriangle,Zo as buildUvs,Zm as cacheTextureArray,I0 as calculateProjection,xo as checkChildrenDidChange,Le as checkDataUrl,Ft as checkExtension,Ed as checkMaxIfStatementsInShader,od as childrenHelperMixin,An as clearList,kp as closePointEps,Rs as collectAllRenderables,Sl as collectRenderGroups,ns as color32BitToUniform,pi as colorBit,fi as colorBitGl,S_ as colorMatrixFilterFrag,Ou as colorMatrixFilterWgsl,B1 as colorToUniform,c2 as compareModeToGlCompare,op as compileHighShader,ap as compileHighShaderGl,ar as compileHighShaderGlProgram,or as compileHighShaderGpuProgram,Xo as compileHooks,zo as compileInputs,np as compileOutputs,ll as compileShader,yb as compute2DProjection,QS as convertFormatIfRequired,Bt as convertToList,qs as copySearchParams,sr as createIdFromString,TS as createLevelBuffers,JS as createLevelBuffersFromKTX,xh as createStringVariations,be as createTexture,R0 as createUboElementsSTD40,Z2 as createUboElementsWGSL,sl as createUboSyncFunction,B0 as createUboSyncFunctionSTD40,J2 as createUboSyncFunctionWGSL,Cg as crossOrigin,sd as cullingMixin,Jo as curveEps,en as defaultFilterVert,hl as defaultValue,Vt as definedProps,Ko as deprecation,Qm as detectAvif,_S as detectBasis,oE as detectCompressed,tg as detectDefaults,eg as detectMp4,rg as detectOgv,Po as detectVideoAlphaMode,sg as detectWebm,ig as detectWebp,Pg as determineCrossOrigin,C_ as displacementFrag,R_ as displacementVert,Bu as displacementWgsl,Vp as earcut,ud as effectsMixin,Yu as ensureAttributes,Uo as ensureIsBuffer,fn as ensureOptions,Xd as ensurePrecision,AR as ensureTextStyle,Tl as executeInstructions,k as extensions,W0 as extractAttributesFromGlProgram,Qd as extractAttributesFromGpuProgram,im as extractFontFamilies,di as extractStructAndGroups,ci as fastCopy,rp as findHooksRx,ld as findMixin,hs as fontStringFromTextStyle,S3 as formatShader,hp as fragmentGPUTemplate,pp as fragmentGlTemplate,O0 as generateArraySyncSTD40,Q2 as generateArraySyncWGSL,d_ as generateBlurFragSource,f_ as generateBlurGlProgram,g_ as generateBlurProgram,p_ as generateBlurVertSource,T3 as generateGPULayout,Jd as generateGpuLayoutGroups,A3 as generateLayout,tp as generateLayoutHash,Q0 as generateProgram,X0 as generateShaderSyncCode,Ca as generateTextStyleKey,mi as generateTextureBatchBit,gi as generateTextureBatchBitGl,RC as generateUID,e2 as generateUniformsSync,Jr as getAdjustedBlendModeBlend,ir as getAttributeInfoFromFormat,_i as getBatchSamplersUniformGroup,ka as getBitmapTextLayout,sf as getCanvasBoundingBox,ds as getCanvasFillStyle,ol as getCanvasTexture,xp as getDefaultUniformValue,Im as getFastGlobalBounds,om as getFontCss,dg as getFontFamilyName,kd as getGeometryBounds,T0 as getGlTypeFromFormat,Yr as getGlobalBounds,Fm as getGlobalRenderableBounds,si as getLocalBounds,So as getMatrixRelativeToParent,$d as getMaxFragmentPrecision,Ie as getMaxTexturesPerBatch,Np as getOrientationOfPoints,hd as getParent,Pa as getPo2TextureFromSource,ji as getResolutionOfUrl,am as getSVGUrl,vu as getSupportedCompressedTextureFormats,xu as getSupportedGPUCompressedTextureFormats,bu as getSupportedGlCompressedTextureFormats,As as getSupportedTextureFormats,um as getTemporaryCanvasFromImage,Bo as getTestContext,li as getTextureBatchBindGroup,bR as getTextureDefaultMatrix,rE as getTextureFormatFromKTXTexture,Y0 as getUboData,q0 as getUniformData,Th as getUrlExtension,Vg as glFormatToGPUFormat,o2 as glUploadBufferImageResource,a2 as glUploadCompressedTextureResource,ml as glUploadImageResource,u2 as glUploadVideoResource,fp as globalUniformsBit,mp as globalUniformsBitGl,jv as globalUniformsUBOBitGl,SS as gpuFormatToBasisTranscoderFormat,iE as gpuFormatToKTXBasisTranscoderFormat,ib as gpuUploadBufferImageResource,nb as gpuUploadCompressedTextureResource,rc as gpuUploadImageResource,ob as gpuUploadVideoResource,$ as groupD8,Z3 as hasCachedCanvasTexture,a3 as hslWgsl,gE as hslgl,_E as hslgpu,jo as injectBits,zd as insertVersion,wR as isMobile,co as isPow2,k0 as isRenderingToScreen,Kf as isSafari,Xr as isSingleItem,_s as isWebGLSupported,bs as isWebGPUSupported,Zi as ktxTranscoderUrls,vS as loadBasis,Ug as loadBasisOnWorker,qm as loadBitmapFont,MS as loadDDS,eu as loadEnvironmentExtensions,nm as loadFontAsBase64,ja as loadFontCSS,Tg as loadImageBitmap,ug as loadJson,WS as loadKTX,ZS as loadKTX2,zg as loadKTX2onWorker,lm as loadSVGImage,_g as loadSvg,mu as loadTextures,lg as loadTxt,Dg as loadVideoTextures,pg as loadWebFont,fr as localUniformBit,Ni as localUniformBitGl,xm as localUniformBitGroup2,Uf as localUniformMSDFBit,kf as localUniformMSDFBitGl,Fy as log2,CR as logDebugTexture,Z0 as logProgramError,lx as logRenderGroupScene,ux as logScene,Nf as mSDFBit,Lf as mSDFBitGl,h2 as mapFormatToGlFormat,f2 as mapFormatToGlInternalFormat,m2 as mapFormatToGlType,V0 as mapGlToVertexFormat,nw as mapSize,dl as mapType,r2 as mapWebGLBlendModesToPixi,U_ as maskFrag,k_ as maskVert,Fu as maskWgsl,Yt as matrixPool,Va as measureHtmlText,dd as measureMixin,sw as migrateFragmentFromV7toV8,l2 as mipmapScaleModeToGlFilter,wl as mixColors,El as mixHexColors,vw as mixStandardAnd32BitColors,Bp as multiplyHexColors,Oe as nextPow2,O_ as noiseFrag,Gu as noiseWgsl,Gg as nonCompressedFormats,$r as normalizeExtensionPriority,Ha as nssvg,Xa as nsxhtml,pd as onRenderMixin,Ng as parseDDS,PC as parseFunctionBody,$g as parseKTX,vt as path,Uu as pointInTriangle,Rg as preloadVideo,nd as removeItems,ep as removeStructAndGroupDuplicates,Iy as resetUids,Fa as resolveCharacters,nE as resolveCompressedTextureUrl,Mg as resolveJsonUrl,_u as resolveTextureUrl,Ad as resourceToTexture,ur as roundPixelsBit,lr as roundPixelsBitGl,pf as roundedShapeArc,ff as roundedShapeQuadraticCurve,D2 as sayHello,gl as scaleModeToGlFilter,xS as setBasisTranscoderPath,qS as setKTXTranscoderPath,Sm as setPositions,jd as setProgramName,wm as setUvs,is as shapeBuilders,fd as sortMixin,Hh as spritesheetAsset,as as squaredDistanceToLineSegment,Vd as stripVersion,hu as testImageFormat,zi as testVideoFormat,Zf as textStyleToCSS,h0 as textureBit,d0 as textureBitGl,Sd as textureFrom,ym as tilingBit,vm as tilingBitGl,fe as toFillStyle,md as toLocalGlobalMixin,cs as toStrokeStyle,yi as transformVertices,sa as triangulateWithHoles,il as uboSyncFunctionsSTD40,M0 as uboSyncFunctionsWGSL,Q as uid,ye as uniformParsers,xw as unpremultiplyAlpha,ru as unsafeEvalSupported,GC as updateLocalTransform,jr as updateQuadBounds,_2 as updateRenderGroupTransform,Cl as updateRenderGroupTransforms,Rl as updateTransformAndChildren,qr as updateTransformBackwards,IC as updateWorldTransform,n1 as v8_0_0,Op as v8_3_4,Qi as validFormats,x2 as validateRenderables,cp as vertexGPUTemplate,dp as vertexGlTemplate,AC as viewportFromFrame,Wg as vkFormatToGPUFormat,me as warn,lE as webworkerExt,Tn as wrapModeToGlAddress};
//# sourceMappingURL=webworker.min.mjs.map