Files
nothoughts/node_modules/pixi.js/dist/webworker.min.js
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
*/var PIXI=function(d){"use strict";"use strict";let xc={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")};const $={get(){return xc},set(r){xc=r}};var CR=typeof globalThis!="undefined"?globalThis:typeof window!="undefined"?window:typeof global!="undefined"?global:typeof self!="undefined"?self:{};function Ii(r){return r&&r.__esModule&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function RR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")?r.default:r}function PR(r){return r&&Object.prototype.hasOwnProperty.call(r,"default")&&Object.keys(r).length===1?r.default:r}function MR(r){if(r.__esModule)return r;var t=r.default;if(typeof t=="function"){var e=function i(){return this instanceof i?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};e.prototype=t.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(r).forEach(function(i){var s=Object.getOwnPropertyDescriptor(r,i);Object.defineProperty(e,i,s.get?s:{enumerable:!0,get:function(){return r[i]}})}),e}var $n={},te={},ee={};function Ly(r,t,e){if(e===void 0&&(e=Array.prototype),r&&typeof e.find=="function")return e.find.call(r,t);for(var i=0;i<r.length;i++)if(Object.prototype.hasOwnProperty.call(r,i)){var s=r[i];if(t.call(void 0,s,i,r))return s}}function Hn(r,t){return t===void 0&&(t=Object),t&&typeof t.freeze=="function"?t.freeze(r):r}function Ny(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 vc=Hn({HTML:"text/html",isHTML:function(r){return r===vc.HTML},XML_APPLICATION:"application/xml",XML_TEXT:"text/xml",XML_XHTML_APPLICATION:"application/xhtml+xml",XML_SVG_IMAGE:"image/svg+xml"}),Tc=Hn({HTML:"http://www.w3.org/1999/xhtml",isHTML:function(r){return r===Tc.HTML},SVG:"http://www.w3.org/2000/svg",XML:"http://www.w3.org/XML/1998/namespace",XMLNS:"http://www.w3.org/2000/xmlns/"}),DR=ee.assign=Ny,OR=ee.find=Ly,BR=ee.freeze=Hn,GR=ee.MIME_TYPE=vc,FR=ee.NAMESPACE=Tc,Sc=ee,jt=Sc.find,Rr=Sc.NAMESPACE;function $y(r){return r!==""}function Hy(r){return r?r.split(/[\t\n\f\r ]+/).filter($y):[]}function Xy(r,t){return r.hasOwnProperty(t)||(r[t]=!0),r}function Ac(r){if(!r)return[];var t=Hy(r);return Object.keys(t.reduce(Xy,{}))}function zy(r){return function(t){return r&&r.indexOf(t)!==-1}}function Pr(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function yt(r,t){var e=r.prototype;if(!(e instanceof t)){let i=function(){};i.prototype=t.prototype,i=new i,Pr(e,i),r.prototype=e=i}e.constructor!=r&&(typeof r!="function"&&console.error("unknown Class:"+r),e.constructor=r)}var xt={},Lt=xt.ELEMENT_NODE=1,ze=xt.ATTRIBUTE_NODE=2,Ui=xt.TEXT_NODE=3,Ec=xt.CDATA_SECTION_NODE=4,wc=xt.ENTITY_REFERENCE_NODE=5,jy=xt.ENTITY_NODE=6,Cc=xt.PROCESSING_INSTRUCTION_NODE=7,Rc=xt.COMMENT_NODE=8,Pc=xt.DOCUMENT_NODE=9,Mc=xt.DOCUMENT_TYPE_NODE=10,re=xt.DOCUMENT_FRAGMENT_NODE=11,Vy=xt.NOTATION_NODE=12,mt={},lt={},IR=mt.INDEX_SIZE_ERR=(lt[1]="Index size error",1),UR=mt.DOMSTRING_SIZE_ERR=(lt[2]="DOMString size error",2),vt=mt.HIERARCHY_REQUEST_ERR=(lt[3]="Hierarchy request error",3),kR=mt.WRONG_DOCUMENT_ERR=(lt[4]="Wrong document",4),LR=mt.INVALID_CHARACTER_ERR=(lt[5]="Invalid character",5),NR=mt.NO_DATA_ALLOWED_ERR=(lt[6]="No data allowed",6),$R=mt.NO_MODIFICATION_ALLOWED_ERR=(lt[7]="No modification allowed",7),Dc=mt.NOT_FOUND_ERR=(lt[8]="Not found",8),HR=mt.NOT_SUPPORTED_ERR=(lt[9]="Not supported",9),Oc=mt.INUSE_ATTRIBUTE_ERR=(lt[10]="Attribute in use",10),XR=mt.INVALID_STATE_ERR=(lt[11]="Invalid state",11),zR=mt.SYNTAX_ERR=(lt[12]="Syntax error",12),jR=mt.INVALID_MODIFICATION_ERR=(lt[13]="Invalid modification",13),VR=mt.NAMESPACE_ERR=(lt[14]="Invalid namespace",14),WR=mt.INVALID_ACCESS_ERR=(lt[15]="Invalid access",15);function st(r,t){if(t instanceof Error)var e=t;else e=this,Error.call(this,lt[r]),this.message=lt[r],Error.captureStackTrace&&Error.captureStackTrace(this,st);return e.code=r,t&&(this.message=this.message+": "+t),e}st.prototype=Error.prototype,Pr(mt,st);function ie(){}ie.prototype={length:0,item:function(r){return r>=0&&r<this.length?this[r]:null},toString:function(r,t){for(var e=[],i=0;i<this.length;i++)Ve(this[i],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 i=e.length;i in r;i++)Object.prototype.hasOwnProperty.call(r,i)&&delete r[i];Pr(e,r),r._inc=t}}je.prototype.item=function(r){return Xn(this),this[r]||null},yt(je,ie);function ki(){}function Bc(r,t){for(var e=r.length;e--;)if(r[e]===t)return e}function Gc(r,t,e,i){if(i?t[Bc(t,i)]=e:t[t.length++]=e,r){e.ownerElement=r;var s=r.ownerDocument;s&&(i&&kc(s,r,i),Wy(s,r,e))}}function Fc(r,t,e){var i=Bc(t,e);if(i>=0){for(var s=t.length-1;i<s;)t[i]=t[++i];if(t.length=s,r){var n=r.ownerDocument;n&&(kc(n,r,e),e.ownerElement=null)}}else throw new st(Dc,new Error(r.tagName+"@"+e))}ki.prototype={length:0,item:ie.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(Oc);var e=this.getNamedItem(r.nodeName);return Gc(this._ownerElement,this,r,e),e},setNamedItemNS:function(r){var t=r.ownerElement,e;if(t&&t!=this._ownerElement)throw new st(Oc);return e=this.getNamedItemNS(r.namespaceURI,r.localName),Gc(this._ownerElement,this,r,e),e},removeNamedItem:function(r){var t=this.getNamedItem(r);return Fc(this._ownerElement,this,t),t},removeNamedItemNS:function(r,t){var e=this.getNamedItemNS(r,t);return Fc(this._ownerElement,this,e),e},getNamedItemNS:function(r,t){for(var e=this.length;e--;){var i=this[e];if(i.localName==t&&i.namespaceURI==r)return i}return null}};function Ic(){}Ic.prototype={hasFeature:function(r,t){return!0},createDocument:function(r,t,e){var i=new Dr;if(i.implementation=this,i.childNodes=new ie,i.doctype=e||null,e&&i.appendChild(e),t){var s=i.createElementNS(r,t);i.appendChild(s)}return i},createDocumentType:function(r,t,e){var i=new $i;return i.name=r,i.nodeName=r,i.publicId=t||"",i.systemId=e||"",i}};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 Li(this,r,t)},replaceChild:function(r,t){Li(this,r,t,Hc),t&&this.removeChild(t)},removeChild:function(r){return Lc(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==Ui&&r.nodeType==Ui?(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 i in e)if(Object.prototype.hasOwnProperty.call(e,i)&&e[i]===r)return i}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 Uc(r){return r=="<"&&"&lt;"||r==">"&&"&gt;"||r=="&"&&"&amp;"||r=='"'&&"&quot;"||"&#"+r.charCodeAt()+";"}Pr(xt,Y),Pr(xt,Y.prototype);function Mr(r,t){if(t(r))return!0;if(r=r.firstChild)do if(Mr(r,t))return!0;while(r=r.nextSibling)}function Dr(){this.ownerDocument=this}function Wy(r,t,e){r&&r._inc++;var i=e.namespaceURI;i===Rr.XMLNS&&(t._nsMap[e.prefix?e.localName:""]=e.value)}function kc(r,t,e,i){r&&r._inc++;var s=e.namespaceURI;s===Rr.XMLNS&&delete t._nsMap[e.prefix?e.localName:""]}function zn(r,t,e){if(r&&r._inc){r._inc++;var i=t.childNodes;if(e)i[i.length++]=e;else{for(var s=t.firstChild,n=0;s;)i[n++]=s,s=s.nextSibling;i.length=n,delete i[i.length]}}}function Lc(r,t){var e=t.previousSibling,i=t.nextSibling;return e?e.nextSibling=i:r.firstChild=i,i?i.previousSibling=e:r.lastChild=e,t.parentNode=null,t.previousSibling=null,t.nextSibling=null,zn(r.ownerDocument,r),t}function Yy(r){return r&&(r.nodeType===Y.DOCUMENT_NODE||r.nodeType===Y.DOCUMENT_FRAGMENT_NODE||r.nodeType===Y.ELEMENT_NODE)}function qy(r){return r&&(Vt(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 Vt(r){return r&&r.nodeType===Y.ELEMENT_NODE}function jn(r){return r&&r.nodeType===Y.TEXT_NODE}function Nc(r,t){var e=r.childNodes||[];if(jt(e,Vt)||se(t))return!1;var i=jt(e,se);return!(t&&i&&e.indexOf(i)>e.indexOf(t))}function $c(r,t){var e=r.childNodes||[];function i(n){return Vt(n)&&n!==t}if(jt(e,i))return!1;var s=jt(e,se);return!(t&&s&&e.indexOf(s)>e.indexOf(t))}function Ky(r,t,e){if(!Yy(r))throw new st(vt,"Unexpected parent node type "+r.nodeType);if(e&&e.parentNode!==r)throw new st(Dc,"child not in parent");if(!qy(t)||se(t)&&r.nodeType!==Y.DOCUMENT_NODE)throw new st(vt,"Unexpected node type "+t.nodeType+" for parent node type "+r.nodeType)}function Zy(r,t,e){var i=r.childNodes||[],s=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var n=s.filter(Vt);if(n.length>1||jt(s,jn))throw new st(vt,"More than one element or text in fragment");if(n.length===1&&!Nc(r,e))throw new st(vt,"Element in fragment can not be inserted before doctype")}if(Vt(t)&&!Nc(r,e))throw new st(vt,"Only one element can be added and only after doctype");if(se(t)){if(jt(i,se))throw new st(vt,"Only one doctype is allowed");var a=jt(i,Vt);if(e&&i.indexOf(a)<i.indexOf(e))throw new st(vt,"Doctype can only be inserted before an element");if(!e&&a)throw new st(vt,"Doctype can not be appended since element is present")}}function Hc(r,t,e){var i=r.childNodes||[],s=t.childNodes||[];if(t.nodeType===Y.DOCUMENT_FRAGMENT_NODE){var n=s.filter(Vt);if(n.length>1||jt(s,jn))throw new st(vt,"More than one element or text in fragment");if(n.length===1&&!$c(r,e))throw new st(vt,"Element in fragment can not be inserted before doctype")}if(Vt(t)&&!$c(r,e))throw new st(vt,"Only one element can be added and only after doctype");if(se(t)){if(jt(i,function(u){return se(u)&&u!==e}))throw new st(vt,"Only one doctype is allowed");var a=jt(i,Vt);if(e&&i.indexOf(a)<i.indexOf(e))throw new st(vt,"Doctype can only be inserted before an element")}}function Li(r,t,e,i){Ky(r,t,e),r.nodeType===Y.DOCUMENT_NODE&&(i||Zy)(r,t,e);var s=t.parentNode;if(s&&s.removeChild(t),t.nodeType===re){var n=t.firstChild;if(n==null)return t;var a=t.lastChild}else n=a=t;var o=e?e.previousSibling:r.lastChild;n.previousSibling=o,a.nextSibling=e,o?o.nextSibling=n:r.firstChild=n,e==null?r.lastChild=a:e.previousSibling=a;do n.parentNode=r;while(n!==a&&(n=n.nextSibling));return zn(r.ownerDocument||r,r),t.nodeType==re&&(t.firstChild=t.lastChild=null),t}function Qy(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}Dr.prototype={nodeName:"#document",nodeType:Pc,doctype:null,documentElement:null,_inc:1,insertBefore:function(r,t){if(r.nodeType==re){for(var e=r.firstChild;e;){var i=e.nextSibling;this.insertBefore(e,t),e=i}return r}return Li(this,r,t),r.ownerDocument=this,this.documentElement===null&&r.nodeType===Lt&&(this.documentElement=r),r},removeChild:function(r){return this.documentElement==r&&(this.documentElement=null),Lc(this,r)},replaceChild:function(r,t){Li(this,r,t,Hc),r.ownerDocument=this,t&&this.removeChild(t),Vt(r)&&(this.documentElement=r)},importNode:function(r,t){return Yc(this,r,t)},getElementById:function(r){var t=null;return Mr(this.documentElement,function(e){if(e.nodeType==Lt&&e.getAttribute("id")==r)return t=e,!0}),t},getElementsByClassName:function(r){var t=Ac(r);return new je(this,function(e){var i=[];return t.length>0&&Mr(e.documentElement,function(s){if(s!==e&&s.nodeType===Lt){var n=s.getAttribute("class");if(n){var a=r===n;if(!a){var o=Ac(n);a=t.every(zy(o))}a&&i.push(s)}}}),i})},createElement:function(r){var t=new Ae;t.ownerDocument=this,t.nodeName=r,t.tagName=r,t.localName=r,t.childNodes=new ie;var e=t.attributes=new ki;return e._ownerElement=t,t},createDocumentFragment:function(){var r=new Hi;return r.ownerDocument=this,r.childNodes=new ie,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 Ni;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 Ae,i=t.split(":"),s=e.attributes=new ki;return e.childNodes=new ie,e.ownerDocument=this,e.nodeName=t,e.tagName=t,e.namespaceURI=r,i.length==2?(e.prefix=i[0],e.localName=i[1]):e.localName=t,s._ownerElement=e,e},createAttributeNS:function(r,t){var e=new Ni,i=t.split(":");return e.ownerDocument=this,e.nodeName=t,e.name=t,e.namespaceURI=r,e.specified=!0,i.length==2?(e.prefix=i[0],e.localName=i[1]):e.localName=t,e}},yt(Dr,Y);function Ae(){this._nsMap={}}Ae.prototype={nodeType:Lt,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===re?this.insertBefore(r,null):Qy(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 i=this.ownerDocument.createAttributeNS(r,t);i.value=i.nodeValue=""+e,this.setAttributeNode(i)},getAttributeNodeNS:function(r,t){return this.attributes.getNamedItemNS(r,t)},getElementsByTagName:function(r){return new je(this,function(t){var e=[];return Mr(t,function(i){i!==t&&i.nodeType==Lt&&(r==="*"||i.tagName==r)&&e.push(i)}),e})},getElementsByTagNameNS:function(r,t){return new je(this,function(e){var i=[];return Mr(e,function(s){s!==e&&s.nodeType===Lt&&(r==="*"||s.namespaceURI===r)&&(t==="*"||s.localName==t)&&i.push(s)}),i})}},Dr.prototype.getElementsByTagName=Ae.prototype.getElementsByTagName,Dr.prototype.getElementsByTagNameNS=Ae.prototype.getElementsByTagNameNS,yt(Ae,Y);function Ni(){}Ni.prototype.nodeType=ze,yt(Ni,Y);function Or(){}Or.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(lt[vt])},deleteData:function(r,t){this.replaceData(r,t,"")},replaceData:function(r,t,e){var i=this.data.substring(0,r),s=this.data.substring(r+t);e=i+e+s,this.nodeValue=this.data=e,this.length=e.length}},yt(Or,Y);function Vn(){}Vn.prototype={nodeName:"#text",nodeType:Ui,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 i=this.ownerDocument.createTextNode(e);return this.parentNode&&this.parentNode.insertBefore(i,this.nextSibling),i}},yt(Vn,Or);function Wn(){}Wn.prototype={nodeName:"#comment",nodeType:Rc},yt(Wn,Or);function Yn(){}Yn.prototype={nodeName:"#cdata-section",nodeType:Ec},yt(Yn,Or);function $i(){}$i.prototype.nodeType=Mc,yt($i,Y);function Xc(){}Xc.prototype.nodeType=Vy,yt(Xc,Y);function zc(){}zc.prototype.nodeType=jy,yt(zc,Y);function qn(){}qn.prototype.nodeType=wc,yt(qn,Y);function Hi(){}Hi.prototype.nodeName="#document-fragment",Hi.prototype.nodeType=re,yt(Hi,Y);function Kn(){}Kn.prototype.nodeType=Cc,yt(Kn,Y);function jc(){}jc.prototype.serializeToString=function(r,t,e){return Vc.call(r,t,e)},Y.prototype.toString=Vc;function Vc(r,t){var e=[],i=this.nodeType==9&&this.documentElement||this,s=i.prefix,n=i.namespaceURI;if(n&&s==null){var s=i.lookupPrefix(n);if(s==null)var a=[{namespace:n,prefix:null}]}return Ve(this,e,r,t,a),e.join("")}function Wc(r,t,e){var i=r.prefix||"",s=r.namespaceURI;if(!s||i==="xml"&&s===Rr.XML||s===Rr.XMLNS)return!1;for(var n=e.length;n--;){var a=e[n];if(a.prefix===i)return a.namespace!==s}return!0}function Zn(r,t,e){r.push(" ",t,'="',e.replace(/[<>&"\t\n\r]/g,Uc),'"')}function Ve(r,t,e,i,s){if(s||(s=[]),i)if(r=i(r),r){if(typeof r=="string"){t.push(r);return}}else return;switch(r.nodeType){case Lt:var n=r.attributes,a=n.length,b=r.firstChild,o=r.tagName;e=Rr.isHTML(r.namespaceURI)||e;var u=o;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=s.length-1;h>=0;h--){var f=s[h];if(f.prefix===""&&f.namespace===r.namespaceURI){l=f.namespace;break}}if(l!==r.namespaceURI)for(var h=s.length-1;h>=0;h--){var f=s[h];if(f.namespace===r.namespaceURI){f.prefix&&(u=f.prefix+":"+o);break}}}t.push("<",u);for(var p=0;p<a;p++){var m=n.item(p);m.prefix=="xmlns"?s.push({prefix:m.localName,namespace:m.value}):m.nodeName=="xmlns"&&s.push({prefix:"",namespace:m.value})}for(var p=0;p<a;p++){var m=n.item(p);if(Wc(m,e,s)){var _=m.prefix||"",g=m.namespaceURI;Zn(t,_?"xmlns:"+_:"xmlns",g),s.push({prefix:_,namespace:g})}Ve(m,t,e,i,s)}if(o===u&&Wc(r,e,s)){var _=r.prefix||"",g=r.namespaceURI;Zn(t,_?"xmlns:"+_:"xmlns",g),s.push({prefix:_,namespace:g})}if(b||e&&!/^(?:meta|link|img|br|hr|input)$/i.test(o)){if(t.push(">"),e&&/^script$/i.test(o))for(;b;)b.data?t.push(b.data):Ve(b,t,e,i,s.slice()),b=b.nextSibling;else for(;b;)Ve(b,t,e,i,s.slice()),b=b.nextSibling;t.push("</",u,">")}else t.push("/>");return;case Pc:case re:for(var b=r.firstChild;b;)Ve(b,t,e,i,s.slice()),b=b.nextSibling;return;case ze:return Zn(t,r.name,r.value);case Ui:return t.push(r.data.replace(/[<&>]/g,Uc));case Ec:return t.push("<![CDATA[",r.data,"]]>");case Rc:return t.push("<!--",r.data,"-->");case Mc:var x=r.publicId,y=r.systemId;if(t.push("<!DOCTYPE ",r.name),x)t.push(" PUBLIC ",x),y&&y!="."&&t.push(" ",y),t.push(">");else if(y&&y!=".")t.push(" SYSTEM ",y,">");else{var T=r.internalSubset;T&&t.push(" [",T,"]"),t.push(">")}return;case Cc:return t.push("<?",r.target," ",r.data,"?>");case wc:return t.push("&",r.nodeName,";");default:t.push("??",r.nodeName)}}function Yc(r,t,e){var i;switch(t.nodeType){case Lt:i=t.cloneNode(!1),i.ownerDocument=r;case re:break;case ze:e=!0;break}if(i||(i=t.cloneNode(!1)),i.ownerDocument=r,i.parentNode=null,e)for(var s=t.firstChild;s;)i.appendChild(Yc(r,s,e)),s=s.nextSibling;return i}function Qn(r,t,e){var i=new t.constructor;for(var s in t)if(Object.prototype.hasOwnProperty.call(t,s)){var n=t[s];typeof n!="object"&&n!=i[s]&&(i[s]=n)}switch(t.childNodes&&(i.childNodes=new ie),i.ownerDocument=r,i.nodeType){case Lt:var a=t.attributes,o=i.attributes=new ki,u=a.length;o._ownerElement=i;for(var l=0;l<u;l++)i.setAttributeNode(Qn(r,a.item(l),!0));break;case ze:e=!0}if(e)for(var c=t.firstChild;c;)i.appendChild(Qn(r,c,e)),c=c.nextSibling;return i}function qc(r,t,e){r[t]=e}try{if(Object.defineProperty){let r=function(t){switch(t.nodeType){case Lt:case re: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 Lt:case re: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,i){t["$$"+e]=i}}}catch(r){}var YR=te.DocumentType=$i,qR=te.DOMException=st,KR=te.DOMImplementation=Ic,ZR=te.Element=Ae,QR=te.Node=Y,JR=te.NodeList=ie,tP=te.XMLSerializer=jc,Xi={},Jn={};(function(r){"use strict";var t=ee.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 eP=Ii(Jn),ta={},Br=ee.NAMESPACE,ea=/[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]/,Kc=new RegExp("[\\-\\.0-9"+ea.source.slice(1,-1)+"\\u00B7\\u0300-\\u036F\\u203F-\\u2040]"),Zc=new RegExp("^"+ea.source+Kc.source+"*(?::"+ea.source+Kc.source+"*)?$"),Gr=0,he=1,We=2,Fr=3,Ye=4,qe=5,Ir=6,zi=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 Qc(){}Qc.prototype={parse:function(r,t,e){var i=this.domBuilder;i.startDocument(),eh(t,t={}),Jy(r,t,e,i,this.errorHandler),i.endDocument()}};function Jy(r,t,e,i,s){function n(D){if(D>65535){D-=65536;var Z=55296+(D>>10),wr=56320+(D&1023);return String.fromCharCode(Z,wr)}else return String.fromCharCode(D)}function a(D){var Z=D.slice(1,-1);return Object.hasOwnProperty.call(e,Z)?e[Z]:Z.charAt(0)==="#"?n(parseInt(Z.substr(1).replace("x","0x"))):(s.error("entity not found:"+D),D)}function o(D){if(D>_){var Z=r.substring(_,D).replace(/&#?\w+;/g,a);f&&u(_),i.characters(Z,0,D-_),_=D}}function u(D,Z){for(;D>=c&&(Z=h.exec(r));)l=Z.index,c=l+Z[0].length,f.lineNumber++;f.columnNumber=D-l+1}for(var l=0,c=0,h=/.*(?:\r\n?|\n)|.*$/g,f=i.locator,p=[{currentNSMap:t}],m={},_=0;;){try{var g=r.indexOf("<",_);if(g<0){if(!r.substr(_).match(/^\s*$/)){var b=i.doc,x=b.createTextNode(r.substr(_));b.appendChild(x),i.currentElement=x}return}switch(g>_&&o(g),r.charAt(g+1)){case"/":var F=r.indexOf(">",g+3),y=r.substring(g+2,F).replace(/[ \t\n\r]+$/g,""),T=p.pop();F<0?(y=r.substring(g+2).replace(/[\s<].*/,""),s.error("end tag name: "+y+" is not complete:"+T.tagName),F=g+1+y.length):y.match(/\s</)&&(y=y.replace(/[\s<].*/,""),s.error("end tag name: "+y+" maybe not complete"),F=g+1+y.length);var A=T.localNSMap,R=T.tagName==y,C=R||T.tagName&&T.tagName.toLowerCase()==y.toLowerCase();if(C){if(i.endElement(T.uri,T.localName,y),A)for(var P in A)Object.prototype.hasOwnProperty.call(A,P)&&i.endPrefixMapping(P);R||s.fatalError("end tag name: "+y+" is not match the current start tagName:"+T.tagName)}else p.push(T);F++;break;case"?":f&&u(g),F=sx(r,g,i);break;case"!":f&&u(g),F=ix(r,g,i,s);break;default:f&&u(g);var S=new rh,E=p[p.length-1].currentNSMap,F=tx(r,g,S,E,a,s),N=S.length;if(!S.closed&&rx(r,F,S.tagName,m)&&(S.closed=!0,e.nbsp||s.warning("unclosed xml attribute")),f&&N){for(var O=Jc(f,{}),B=0;B<N;B++){var q=S[B];u(q.offset),q.locator=Jc(f,{})}i.locator=O,th(S,i,E)&&p.push(S),i.locator=f}else th(S,i,E)&&p.push(S);Br.isHTML(S.uri)&&!S.closed?F=ex(r,F,S.tagName,a,i):F++}}catch(D){if(D instanceof Ke)throw D;s.error("element parse error: "+D),F=-1}F>_?_=F:o(Math.max(g,_)+1)}}function Jc(r,t){return t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber,t}function tx(r,t,e,i,s,n){function a(p,m,_){e.attributeNames.hasOwnProperty(p)&&n.fatalError("Attribute "+p+" redefined"),e.addValue(p,m.replace(/[\t\n\r]/g," ").replace(/&#?\w+;/g,s),_)}for(var o,u,l=++t,c=Gr;;){var h=r.charAt(l);switch(h){case"=":if(c===he)o=r.slice(t,l),c=Fr;else if(c===We)c=Fr;else throw new Error("attribute equal must after attrName");break;case"'":case'"':if(c===Fr||c===he)if(c===he&&(n.warning('attribute value must after "="'),o=r.slice(t,l)),t=l+1,l=r.indexOf(h,t),l>0)u=r.slice(t,l),a(o,u,t-1),c=qe;else throw new Error("attribute value no end '"+h+"' match");else if(c==Ye)u=r.slice(t,l),a(o,u,t),n.warning('attribute "'+o+'" missed start quot('+h+")!!"),t=l+1,c=qe;else throw new Error('attribute value must after "="');break;case"/":switch(c){case Gr:e.setTagName(r.slice(t,l));case qe:case Ir:case zi:c=zi,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==Gr&&e.setTagName(r.slice(t,l)),l;case">":switch(c){case Gr:e.setTagName(r.slice(t,l));case qe:case Ir:case zi: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=o),c==Ye?(n.warning('attribute "'+u+'" missed quot(")!'),a(o,u,t)):((!Br.isHTML(i[""])||!u.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+u+'" missed value!! "'+u+'" instead!!'),a(u,u,t));break;case Fr:throw new Error("attribute value missed!!")}return l;case"\x80":h=" ";default:if(h<=" ")switch(c){case Gr:e.setTagName(r.slice(t,l)),c=Ir;break;case he:o=r.slice(t,l),c=We;break;case Ye:var u=r.slice(t,l);n.warning('attribute "'+u+'" missed quot(")!!'),a(o,u,t);case qe:c=Ir;break}else switch(c){case We:var f=e.tagName;(!Br.isHTML(i[""])||!o.match(/^(?:disabled|checked|selected)$/i))&&n.warning('attribute "'+o+'" missed value!! "'+o+'" instead2!!'),a(o,o,t),t=l,c=he;break;case qe:n.warning('attribute space is required"'+o+'"!!');case Ir:c=he,t=l;break;case Fr:c=Ye,t=l;break;case zi:throw new Error("elements closed character '/' and '>' must be connected to")}}l++}}function th(r,t,e){for(var i=r.tagName,s=null,h=r.length;h--;){var n=r[h],a=n.qName,o=n.value,f=a.indexOf(":");if(f>0)var u=n.prefix=a.slice(0,f),l=a.slice(f+1),c=u==="xmlns"&&l;else l=a,u=null,c=a==="xmlns"&&"";n.localName=l,c!==!1&&(s==null&&(s={},eh(e,e={})),e[c]=s[c]=o,n.uri=Br.XMLNS,t.startPrefixMapping(c,o))}for(var h=r.length;h--;){n=r[h];var u=n.prefix;u&&(u==="xml"&&(n.uri=Br.XML),u!=="xmlns"&&(n.uri=e[u||""]))}var f=i.indexOf(":");f>0?(u=r.prefix=i.slice(0,f),l=r.localName=i.slice(f+1)):(u=null,l=r.localName=i);var p=r.uri=e[u||""];if(t.startElement(p,l,i,r),r.closed){if(t.endElement(p,l,i),s)for(u in s)Object.prototype.hasOwnProperty.call(s,u)&&t.endPrefixMapping(u)}else return r.currentNSMap=e,r.localNSMap=s,!0}function ex(r,t,e,i,s){if(/^(?:script|textarea)$/i.test(e)){var n=r.indexOf("</"+e+">",t),a=r.substring(t+1,n);if(/[&<]/.test(a))return/^script$/i.test(e)?(s.characters(a,0,a.length),n):(a=a.replace(/&#?\w+;/g,i),s.characters(a,0,a.length),n)}return t+1}function rx(r,t,e,i){var s=i[e];return s==null&&(s=r.lastIndexOf("</"+e+">"),s<t&&(s=r.lastIndexOf("</"+e)),i[e]=s),s<t}function eh(r,t){for(var e in r)Object.prototype.hasOwnProperty.call(r,e)&&(t[e]=r[e])}function ix(r,t,e,i){var s=r.charAt(t+2);switch(s){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):(i.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 a=nx(r,t),o=a.length;if(o>1&&/!doctype/i.test(a[0][0])){var u=a[1][0],l=!1,c=!1;o>3&&(/^public$/i.test(a[2][0])?(l=a[3][0],c=o>4&&a[4][0]):/^system$/i.test(a[2][0])&&(c=a[3][0]));var h=a[o-1];return e.startDTD(u,l,c),e.endDTD(),h.index+h[0].length}}return-1}function sx(r,t,e){var i=r.indexOf("?>",t);if(i){var s=r.substring(t,i).match(/^<\?(\S*)\s*([\s\S]*?)\s*$/);if(s){var n=s[0].length;return e.processingInstruction(s[1],s[2]),i+2}else return-1}return-1}function rh(){this.attributeNames={}}rh.prototype={setTagName:function(r){if(!Zc.test(r))throw new Error("invalid tagName:"+r);this.tagName=r},addValue:function(r,t,e){if(!Zc.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 nx(r,t){var e,i=[],s=/'[^']+'|"[^"]+"|[^\s<>\/=]+=?|(\/?\s*>|<)/g;for(s.lastIndex=t,s.exec(r);e=s.exec(r);)if(i.push(e),e[1])return i}var rP=ta.XMLReader=Qc,iP=ta.ParseError=Ke,ax=ee,ox=te,ih=Jn,sh=ta,ux=ox.DOMImplementation,nh=ax.NAMESPACE,lx=sh.ParseError,cx=sh.XMLReader;function ah(r){return r.replace(/\r[\n\u0085]/g,`
`).replace(/[\r\u0085\u2028]/g,`
`)}function oh(r){this.options=r||{locator:{}}}oh.prototype.parseFromString=function(r,t){var e=this.options,i=new cx,s=e.domBuilder||new Ur,n=e.errorHandler,a=e.locator,o=e.xmlns||{},u=/\/x?html?$/.test(t),l=u?ih.HTML_ENTITIES:ih.XML_ENTITIES;a&&s.setDocumentLocator(a),i.errorHandler=hx(n,s,a),i.domBuilder=e.domBuilder||s,u&&(o[""]=nh.HTML),o.xml=o.xml||nh.XML;var c=e.normalizeLineEndings||ah;return r&&typeof r=="string"?i.parse(c(r),o,l):i.errorHandler.error("invalid doc source"),s.doc};function hx(r,t,e){if(!r){if(t instanceof Ur)return t;r=t}var i={},s=r instanceof Function;e=e||{};function n(a){var o=r[a];!o&&s&&(o=r.length==2?function(u){r(a,u)}:r),i[a]=o&&function(u){o("[xmldom "+a+"] "+u+ra(e))}||function(){}}return n("warning"),n("error"),n("fatalError"),i}function Ur(){this.cdata=!1}function Ze(r,t){t.lineNumber=r.lineNumber,t.columnNumber=r.columnNumber}Ur.prototype={startDocument:function(){this.doc=new ux().createDocument(null,null,null),this.locator&&(this.doc.documentURI=this.locator.systemId)},startElement:function(r,t,e,i){var s=this.doc,n=s.createElementNS(r,e||t),a=i.length;ji(this,n),this.currentElement=n,this.locator&&Ze(this.locator,n);for(var o=0;o<a;o++){var r=i.getURI(o),u=i.getValue(o),e=i.getQName(o),l=s.createAttributeNS(r,e);this.locator&&Ze(i.getLocator(o),l),l.value=l.nodeValue=u,n.setAttributeNode(l)}},endElement:function(r,t,e){var i=this.currentElement,s=i.tagName;this.currentElement=i.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),ji(this,e)},ignorableWhitespace:function(r,t,e){},characters:function(r,t,e){if(r=uh.apply(this,arguments),r){if(this.cdata)var i=this.doc.createCDATASection(r);else var i=this.doc.createTextNode(r);this.currentElement?this.currentElement.appendChild(i):/^\s*$/.test(r)&&this.doc.appendChild(i),this.locator&&Ze(this.locator,i)}},skippedEntity:function(r){},endDocument:function(){this.doc.normalize()},setDocumentLocator:function(r){(this.locator=r)&&(r.lineNumber=0)},comment:function(r,t,e){r=uh.apply(this,arguments);var i=this.doc.createComment(r);this.locator&&Ze(this.locator,i),ji(this,i)},startCDATA:function(){this.cdata=!0},endCDATA:function(){this.cdata=!1},startDTD:function(r,t,e){var i=this.doc.implementation;if(i&&i.createDocumentType){var s=i.createDocumentType(r,t,e);this.locator&&Ze(this.locator,s),ji(this,s),this.doc.doctype=s}},warning:function(r){console.warn("[xmldom warning] "+r,ra(this.locator))},error:function(r){console.error("[xmldom error] "+r,ra(this.locator))},fatalError:function(r){throw new lx(r,this.locator)}};function ra(r){if(r)return`
@`+(r.systemId||"")+"#[line:"+r.lineNumber+",col:"+r.columnNumber+"]"}function uh(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){Ur.prototype[r]=function(){return null}});function ji(r,t){r.currentElement?r.currentElement.appendChild(t):r.doc.appendChild(t)}var sP=Xi.__DOMHandler=Ur,nP=Xi.normalizeLineEndings=ah,aP=Xi.DOMParser=oh,lh=te,oP=$n.DOMImplementation=lh.DOMImplementation,uP=$n.XMLSerializer=lh.XMLSerializer,dx=$n.DOMParser=Xi.DOMParser;const ch={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 dx().parseFromString(r,"text/xml")};var fx=Object.defineProperty,px=Object.defineProperties,mx=Object.getOwnPropertyDescriptors,hh=Object.getOwnPropertySymbols,gx=Object.prototype.hasOwnProperty,_x=Object.prototype.propertyIsEnumerable,dh=(r,t,e)=>t in r?fx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,fh=(r,t)=>{for(var e in t||(t={}))gx.call(t,e)&&dh(r,e,t[e]);if(hh)for(var e of hh(t))_x.call(t,e)&&dh(r,e,t[e]);return r},bx=(r,t)=>px(r,mx(t)),v=(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))(v||{});const ia=r=>{if(typeof r=="function"||typeof r=="object"&&r.extension){const t=typeof r.extension!="object"?{type:r.extension}:r.extension;r=bx(fh({},t),{ref:r})}if(typeof r=="object")r=fh({},r);else throw new Error("Invalid extension type");return typeof r.type=="string"&&(r.type=[r.type]),r},kr=(r,t)=>{var e;return(e=ia(r).priority)!=null?e:t},L={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...r){return r.map(ia).forEach(t=>{t.type.forEach(e=>{var i,s;return(s=(i=this._removeHandlers)[e])==null?void 0:s.call(i,t)})}),this},add(...r){return r.map(ia).forEach(t=>{t.type.forEach(e=>{var i,s;const n=this._addHandlers,a=this._queue;n[e]?(s=n[e])==null||s.call(n,t):(a[e]=a[e]||[],(i=a[e])==null||i.push(t))})}),this},handle(r,t,e){var i;const s=this._addHandlers,n=this._removeHandlers;s[r]=t,n[r]=e;const a=this._queue;return a[r]&&((i=a[r])==null||i.forEach(o=>t(o)),delete a[r]),this},handleByMap(r,t){return this.handle(r,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(r,t,e=-1){return this.handle(r,i=>{t.findIndex(s=>s.name===i.name)>=0||(t.push({name:i.name,value:i.ref}),t.sort((s,n)=>kr(n.value,e)-kr(s.value,e)))},i=>{const s=t.findIndex(n=>n.name===i.name);s!==-1&&t.splice(s,1)})},handleByList(r,t,e=-1){return this.handle(r,i=>{t.includes(i.ref)||(t.push(i.ref),t.sort((s,n)=>kr(n,e)-kr(s,e)))},i=>{const s=t.indexOf(i.ref);s!==-1&&t.splice(s,1)})}};class sa{static init(t){Object.defineProperty(this,"resizeTo",{set(e){globalThis.removeEventListener("resize",this.queueResize),this._resizeTo=e,e&&(globalThis.addEventListener("resize",this.queueResize),this.resize())},get(){return this._resizeTo}}),this.queueResize=()=>{this._resizeTo&&(this._cancelResize(),this._resizeId=requestAnimationFrame(()=>this.resize()))},this._cancelResize=()=>{this._resizeId&&(cancelAnimationFrame(this._resizeId),this._resizeId=null)},this.resize=()=>{if(!this._resizeTo)return;this._cancelResize();let e,i;if(this._resizeTo===globalThis.window)e=globalThis.innerWidth,i=globalThis.innerHeight;else{const{clientWidth:s,clientHeight:n}=this._resizeTo;e=s,i=n}this.renderer.resize(e,i),this.render()},this._resizeId=null,this._resizeTo=null,this.resizeTo=t.resizeTo||null}static destroy(){globalThis.removeEventListener("resize",this.queueResize),this._cancelResize(),this._cancelResize=null,this.queueResize=null,this.resizeTo=null,this.resize=null}}sa.extension=v.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 Vi{constructor(t,e=null,i=0,s=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=i,this._once=s}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const ph=class Bt{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 Vi(null,null,1/0),this.deltaMS=1/Bt.targetFPMS,this.elapsedMS=1/Bt.targetFPMS,this._tick=t=>{this._requestId=null,this.started&&(this.update(t),this.started&&this._requestId===null&&this._head.next&&(this._requestId=requestAnimationFrame(this._tick)))}}_requestIfNeeded(){this._requestId===null&&this._head.next&&(this.lastTime=performance.now(),this._lastFrame=this.lastTime,this._requestId=requestAnimationFrame(this._tick))}_cancelIfNeeded(){this._requestId!==null&&(cancelAnimationFrame(this._requestId),this._requestId=null)}_startIfPossible(){this.started?this._requestIfNeeded():this.autoStart&&this.start()}add(t,e,i=de.NORMAL){return this._addListener(new Vi(t,e,i))}addOnce(t,e,i=de.NORMAL){return this._addListener(new Vi(t,e,i,!0))}_addListener(t){let e=this._head.next,i=this._head;if(!e)t.connect(i);else{for(;e;){if(t.priority>e.priority){t.connect(i);break}i=e,e=e.next}t.previous||t.connect(i)}return this._startIfPossible(),this}remove(t,e){let i=this._head.next;for(;i;)i.match(t,e)?i=i.destroy():i=i.next;return this._head.next||this._cancelIfNeeded(),this}get count(){if(!this._head)return 0;let t=0,e=this._head;for(;e=e.next;)t++;return t}start(){this.started||(this.started=!0,this._requestIfNeeded())}stop(){this.started&&(this.started=!1,this._cancelIfNeeded())}destroy(){if(!this._protected){this.stop();let t=this._head.next;for(;t;)t=t.destroy(!0);this._head.destroy(),this._head=null}}update(t=performance.now()){let e;if(t>this.lastTime){if(e=this.elapsedMS=t-this.lastTime,e>this._maxElapsedMS&&(e=this._maxElapsedMS),e*=this.speed,this._minElapsedMS){const n=t-this._lastFrame|0;if(n<this._minElapsedMS)return;this._lastFrame=t-n%this._minElapsedMS}this.deltaMS=e,this.deltaTime=this.deltaMS*Bt.targetFPMS;const i=this._head;let s=i.next;for(;s;)s=s.emit(this);i.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),i=Math.min(Math.max(0,e)/1e3,Bt.targetFPMS);this._maxElapsedMS=1/i}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(!Bt._shared){const t=Bt._shared=new Bt;t.autoStart=!0,t._protected=!0}return Bt._shared}static get system(){if(!Bt._system){const t=Bt._system=new Bt;t.autoStart=!0,t._protected=!0}return Bt._system}};ph.targetFPMS=.06;let gt=ph;class na{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?gt.shared:new gt,t.autoStart&&this.start()}static destroy(){if(this._ticker){const t=this._ticker;this.ticker=null,t.destroy()}}}na.extension=v.Application,L.add(sa),L.add(na);var Ct=(r=>(r[r.Low=0]="Low",r[r.Normal=1]="Normal",r[r.High=2]="High",r))(Ct||{});function Nt(r){if(typeof r!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(r)}`)}function Lr(r){return r.split("?")[0].split("#")[0]}function yx(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function xx(r,t,e){return r.replace(new RegExp(yx(t),"g"),e)}function vx(r,t){let e="",i=0,s=-1,n=0,a=-1;for(let o=0;o<=r.length;++o){if(o<r.length)a=r.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(s===o-1||n===1))if(s!==o-1&&n===2){if(e.length<2||i!==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="",i=0):(e=e.slice(0,u),i=e.length-1-e.lastIndexOf("/")),s=o,n=0;continue}}else if(e.length===2||e.length===1){e="",i=0,s=o,n=0;continue}}t&&(e.length>0?e+="/..":e="..",i=2)}else e.length>0?e+=`/${r.slice(s+1,o)}`:e=r.slice(s+1,o),i=o-s-1;s=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const Tt={toPosix(r){return xx(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 i=Lr(this.toPosix(t!=null?t:$.get().getBaseUrl())),s=Lr(this.toPosix(e!=null?e:this.rootname(i)));return r=this.toPosix(r),r.startsWith("/")?Tt.join(s,r.slice(1)):this.isAbsolute(r)?r:this.join(i,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 i=r.endsWith("/");return r=vx(r,!1),r.length>0&&i&&(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 i=0;i<r.length;++i){const s=r[i];if(Nt(s),s.length>0)if(e===void 0)e=s;else{const n=(t=r[i-1])!=null?t:"";this.joinExtensions.includes(this.extname(n).toLowerCase())?e+=`/../${s}`:e+=`/${s}`}}return e===void 0?".":this.normalize(e)},dirname(r){if(Nt(r),r.length===0)return".";r=this.toPosix(r);let t=r.charCodeAt(0);const e=t===47;let i=-1,s=!0;const n=this.getProtocol(r),a=r;r=r.slice(n.length);for(let o=r.length-1;o>=1;--o)if(t=r.charCodeAt(o),t===47){if(!s){i=o;break}}else s=!1;return i===-1?e?"/":this.isUrl(a)?n+r:n:e&&i===1?"//":n+r.slice(0,i)},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=Lr(this.toPosix(r));let e=0,i=-1,s=!0,n;if(t!==void 0&&t.length>0&&t.length<=r.length){if(t.length===r.length&&t===r)return"";let a=t.length-1,o=-1;for(n=r.length-1;n>=0;--n){const u=r.charCodeAt(n);if(u===47){if(!s){e=n+1;break}}else o===-1&&(s=!1,o=n+1),a>=0&&(u===t.charCodeAt(a)?--a===-1&&(i=n):(a=-1,i=o))}return e===i?i=o:i===-1&&(i=r.length),r.slice(e,i)}for(n=r.length-1;n>=0;--n)if(r.charCodeAt(n)===47){if(!s){e=n+1;break}}else i===-1&&(s=!1,i=n+1);return i===-1?"":r.slice(e,i)},extname(r){Nt(r),r=Lr(this.toPosix(r));let t=-1,e=0,i=-1,s=!0,n=0;for(let a=r.length-1;a>=0;--a){const o=r.charCodeAt(a);if(o===47){if(!s){e=a+1;break}continue}i===-1&&(s=!1,i=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||i===-1||n===0||n===1&&t===i-1&&t===e+1?"":r.slice(t,i)},parse(r){Nt(r);const t={root:"",dir:"",base:"",ext:"",name:""};if(r.length===0)return t;r=Lr(this.toPosix(r));let e=r.charCodeAt(0);const i=this.isAbsolute(r);let s;const n="";t.root=this.rootname(r),i||this.hasProtocol(r)?s=1:s=0;let a=-1,o=0,u=-1,l=!0,c=r.length-1,h=0;for(;c>=s;--c){if(e=r.charCodeAt(c),e===47){if(!l){o=c+1;break}continue}u===-1&&(l=!1,u=c+1),e===46?a===-1?a=c:h!==1&&(h=1):a!==-1&&(h=-1)}return a===-1||u===-1||h===0||h===1&&a===u-1&&a===o+1?u!==-1&&(o===0&&i?t.base=t.name=r.slice(1,u):t.base=t.name=r.slice(o,u)):(o===0&&i?(t.name=r.slice(1,a),t.base=r.slice(1,u)):(t.name=r.slice(o,a),t.base=r.slice(o,u)),t.ext=r.slice(a,u)),t.dir=this.dirname(r),n&&(t.dir=n+t.dir),t},sep:"/",delimiter:":",joinExtensions:[".html"]},Gt=(r,t,e=!1)=>(Array.isArray(r)||(r=[r]),t?r.map(i=>typeof i=="string"||e?t(i):i):r);function mh(r,t,e,i,s){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?mh(r.replace(i[e],o),t,e+1,i,s):s.push(r.replace(i[e],o))}}function gh(r){const t=/\{(.*?)\}/g,e=r.match(t),i=[];if(e){const s=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");s.push(a)}),mh(r,s,0,e,i)}else i.push(r);return i}const Nr=r=>!Array.isArray(r);var Tx=Object.defineProperty,Sx=Object.defineProperties,Ax=Object.getOwnPropertyDescriptors,_h=Object.getOwnPropertySymbols,Ex=Object.prototype.hasOwnProperty,wx=Object.prototype.propertyIsEnumerable,bh=(r,t,e)=>t in r?Tx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qe=(r,t)=>{for(var e in t||(t={}))Ex.call(t,e)&&bh(r,e,t[e]);if(_h)for(var e of _h(t))wx.call(t,e)&&bh(r,e,t[e]);return r},Cx=(r,t)=>Sx(r,Ax(t));class fe{constructor(){this._defaultBundleIdentifierOptions={connector:"-",createBundleAssetId:(t,e)=>`${t}${this._bundleIdConnector}${e}`,extractAssetIdFromBundle:(t,e)=>e.replace(`${t}${this._bundleIdConnector}`,"")},this._bundleIdConnector=this._defaultBundleIdentifierOptions.connector,this._createBundleAssetId=this._defaultBundleIdentifierOptions.createBundleAssetId,this._extractAssetIdFromBundle=this._defaultBundleIdentifierOptions.extractAssetIdFromBundle,this._assetMap={},this._preferredOrder=[],this._parsers=[],this._resolverHash={},this._bundles={}}setBundleIdentifier(t){var e,i,s;if(this._bundleIdConnector=(e=t.connector)!=null?e:this._bundleIdConnector,this._createBundleAssetId=(i=t.createBundleAssetId)!=null?i:this._createBundleAssetId,this._extractAssetIdFromBundle=(s=t.extractAssetIdFromBundle)!=null?s:this._extractAssetIdFromBundle,this._extractAssetIdFromBundle("foo",this._createBundleAssetId("foo","bar"))!=="bar")throw new Error("[Resolver] GenerateBundleAssetId are not working correctly")}prefer(...t){t.forEach(e=>{this._preferredOrder.push(e),e.priority||(e.priority=Object.keys(e.params))}),this._resolverHash={}}set basePath(t){this._basePath=t}get basePath(){return this._basePath}set rootPath(t){this._rootPath=t}get rootPath(){return this._rootPath}get parsers(){return this._parsers}reset(){this.setBundleIdentifier(this._defaultBundleIdentifierOptions),this._assetMap={},this._preferredOrder=[],this._resolverHash={},this._rootPath=null,this._basePath=null,this._manifest=null,this._bundles={},this._defaultSearchParams=null}setDefaultSearchParams(t){if(typeof t=="string")this._defaultSearchParams=t;else{const e=t;this._defaultSearchParams=Object.keys(e).map(i=>`${encodeURIComponent(i)}=${encodeURIComponent(e[i])}`).join("&")}}getAlias(t){const{alias:e,src:i}=t;return Gt(e||i,s=>typeof s=="string"?s:Array.isArray(s)?s.map(n=>{var a;return(a=n==null?void 0:n.src)!=null?a:n}):s!=null&&s.src?s.src:s,!0)}addManifest(t){this._manifest,this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const i=[];let s=e;Array.isArray(e)||(s=Object.entries(e).map(([n,a])=>typeof a=="string"||Array.isArray(a)?{alias:n,src:a}:Qe({alias:n},a))),s.forEach(n=>{const a=n.src,o=n.alias;let u;if(typeof o=="string"){const l=this._createBundleAssetId(t,o);i.push(l),u=[o,l]}else{const l=o.map(c=>this._createBundleAssetId(t,c));i.push(...l),u=[...o,...l]}this.add(Cx(Qe({},n),{alias:u,src:a}))}),this._bundles[t]=i}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let i;Gt(e).forEach(s=>{const{src:n}=s;let{data:a,format:o,loadParser:u}=s;const l=Gt(n).map(f=>typeof f=="string"?gh(f):Array.isArray(f)?f:[f]),c=this.getAlias(s),h=[];l.forEach(f=>{f.forEach(p=>{var m,_,g;let b={};if(typeof p!="object"){b.src=p;for(let x=0;x<this._parsers.length;x++){const y=this._parsers[x];if(y.test(p)){b=y.parse(p);break}}}else a=(m=p.data)!=null?m:a,o=(_=p.format)!=null?_:o,u=(g=p.loadParser)!=null?g:u,b=Qe(Qe({},b),p);if(!c)throw new Error(`[Resolver] alias is undefined for this asset: ${b.src}`);b=this._buildResolvedAsset(b,{aliases:c,data:a,format:o,loadParser:u}),h.push(b)})}),c.forEach(f=>{this._assetMap[f]=h})})}resolveBundle(t){const e=Nr(t);t=Gt(t);const i={};return t.forEach(s=>{const n=this._bundles[s];if(n){const a=this.resolve(n),o={};for(const u in a){const l=a[u];o[this._extractAssetIdFromBundle(s,u)]=l}i[s]=o}}),e?i[t[0]]:i}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const i={};for(const s in e)i[s]=e[s].src;return i}return e.src}resolve(t){const e=Nr(t);t=Gt(t);const i={};return t.forEach(s=>{if(!this._resolverHash[s])if(this._assetMap[s]){let n=this._assetMap[s];const a=this._getPreferredOrder(n);a==null||a.priority.forEach(o=>{a.params[o].forEach(u=>{const l=n.filter(c=>c[o]?c[o]===u:!1);l.length&&(n=l)})}),this._resolverHash[s]=n[0]}else this._resolverHash[s]=this._buildResolvedAsset({alias:[s],src:s},{});i[s]=this._resolverHash[s]}),e?i[t[0]]:i}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const i=t[0],s=this._preferredOrder.find(n=>n.params.format.includes(i.format));if(s)return s}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){var i,s;const{aliases:n,data:a,loadParser:o,format:u}=e;return(this._basePath||this._rootPath)&&(t.src=Tt.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=(i=n!=null?n:t.alias)!=null?i:[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data=Qe(Qe({},a||{}),t.data),t.loadParser=o!=null?o:t.loadParser,t.format=(s=u!=null?u:t.format)!=null?s:yh(t.src),t}}fe.RETINA_PREFIX=/@([0-9\.]+)x/;function yh(r){return r.split(".").pop().split("?").shift().split("#").shift()}const Wi=(r,t)=>{const e=t.split("?")[1];return e&&(r+=`?${e}`),r};var aa={exports:{}},lP=aa.exports;(function(r){"use strict";var t=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function s(u,l,c){this.fn=u,this.context=l,this.once=c||!1}function n(u,l,c,h,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var p=new s(c,h||u,f),m=e?e+l:l;return u._events[m]?u._events[m].fn?u._events[m]=[u._events[m],p]:u._events[m].push(p):(u._events[m]=p,u._eventsCount++),u}function a(u,l){--u._eventsCount===0?u._events=new i:delete u._events[l]}function o(){this._events=new i,this._eventsCount=0}o.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},o.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 f=0,p=h.length,m=new Array(p);f<p;f++)m[f]=h[f].fn;return m},o.prototype.listenerCount=function(l){var c=e?e+l:l,h=this._events[c];return h?h.fn?1:h.length:0},o.prototype.emit=function(l,c,h,f,p,m){var _=e?e+l:l;if(!this._events[_])return!1;var g=this._events[_],b=arguments.length,x,y;if(g.fn){switch(g.once&&this.removeListener(l,g.fn,void 0,!0),b){case 1:return g.fn.call(g.context),!0;case 2:return g.fn.call(g.context,c),!0;case 3:return g.fn.call(g.context,c,h),!0;case 4:return g.fn.call(g.context,c,h,f),!0;case 5:return g.fn.call(g.context,c,h,f,p),!0;case 6:return g.fn.call(g.context,c,h,f,p,m),!0}for(y=1,x=new Array(b-1);y<b;y++)x[y-1]=arguments[y];g.fn.apply(g.context,x)}else{var T=g.length,A;for(y=0;y<T;y++)switch(g[y].once&&this.removeListener(l,g[y].fn,void 0,!0),b){case 1:g[y].fn.call(g[y].context);break;case 2:g[y].fn.call(g[y].context,c);break;case 3:g[y].fn.call(g[y].context,c,h);break;case 4:g[y].fn.call(g[y].context,c,h,f);break;default:if(!x)for(A=1,x=new Array(b-1);A<b;A++)x[A-1]=arguments[A];g[y].fn.apply(g[y].context,x)}}return!0},o.prototype.on=function(l,c,h){return n(this,l,c,h,!1)},o.prototype.once=function(l,c,h){return n(this,l,c,h,!0)},o.prototype.removeListener=function(l,c,h,f){var p=e?e+l:l;if(!this._events[p])return this;if(!c)return a(this,p),this;var m=this._events[p];if(m.fn)m.fn===c&&(!f||m.once)&&(!h||m.context===h)&&a(this,p);else{for(var _=0,g=[],b=m.length;_<b;_++)(m[_].fn!==c||f&&!m[_].once||h&&m[_].context!==h)&&g.push(m[_]);g.length?this._events[p]=g.length===1?g[0]:g:a(this,p)}return this},o.prototype.removeAllListeners=function(l){var c;return l?(c=e?e+l:l,this._events[c]&&a(this,c)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,r.exports=o})(aa);var Rx=aa.exports,Rt=Ii(Rx);const xh=Math.PI*2,vh=180/Math.PI,Th=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 oa.x=0,oa.y=0,oa}}const oa=new nt;class G{constructor(t=1,e=0,i=0,s=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=a}fromArray(t){this.a=t[0],this.b=t[1],this.c=t[3],this.d=t[4],this.tx=t[2],this.ty=t[5]}set(t,e,i,s,n,a){return this.a=t,this.b=e,this.c=i,this.d=s,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const i=e||this.array;return t?(i[0]=this.a,i[1]=this.b,i[2]=0,i[3]=this.c,i[4]=this.d,i[5]=0,i[6]=this.tx,i[7]=this.ty,i[8]=1):(i[0]=this.a,i[1]=this.c,i[2]=this.tx,i[3]=this.b,i[4]=this.d,i[5]=this.ty,i[6]=0,i[7]=0,i[8]=1),i}apply(t,e){e=e||new nt;const i=t.x,s=t.y;return e.x=this.a*i+this.c*s+this.tx,e.y=this.b*i+this.d*s+this.ty,e}applyInverse(t,e){e=e||new nt;const i=this.a,s=this.b,n=this.c,a=this.d,o=this.tx,u=this.ty,l=1/(i*a+n*-s),c=t.x,h=t.y;return e.x=a*l*c+-n*l*h+(u*n-o*a)*l,e.y=i*l*h+-s*l*c+(-u*i+o*s)*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),i=Math.sin(t),s=this.a,n=this.c,a=this.tx;return this.a=s*e-this.b*i,this.b=s*i+this.b*e,this.c=n*e-this.d*i,this.d=n*i+this.d*e,this.tx=a*e-this.ty*i,this.ty=a*i+this.ty*e,this}append(t){const e=this.a,i=this.b,s=this.c,n=this.d;return this.a=t.a*e+t.b*s,this.b=t.a*i+t.b*n,this.c=t.c*e+t.d*s,this.d=t.c*i+t.d*n,this.tx=t.tx*e+t.ty*s+this.tx,this.ty=t.tx*i+t.ty*n+this.ty,this}appendFrom(t,e){const i=t.a,s=t.b,n=t.c,a=t.d,o=t.tx,u=t.ty,l=e.a,c=e.b,h=e.c,f=e.d;return this.a=i*l+s*h,this.b=i*c+s*f,this.c=n*l+a*h,this.d=n*c+a*f,this.tx=o*l+u*h+e.tx,this.ty=o*c+u*f+e.ty,this}setTransform(t,e,i,s,n,a,o,u,l){return this.a=Math.cos(o+l)*n,this.b=Math.sin(o+l)*n,this.c=-Math.sin(o-u)*a,this.d=Math.cos(o-u)*a,this.tx=t-(i*this.a+s*this.c),this.ty=e-(i*this.b+s*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const i=this.a,s=this.c;this.a=i*t.a+this.b*t.c,this.b=i*t.b+this.b*t.d,this.c=s*t.a+this.d*t.c,this.d=s*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,i=this.b,s=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-s,n),u=Math.atan2(i,e),l=Math.abs(o+u);return l<1e-5||Math.abs(xh-l)<1e-5?(t.rotation=u,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=u),t.scale.x=Math.sqrt(e*e+i*i),t.scale.y=Math.sqrt(s*s+n*n),t.position.x=this.tx+(a.x*e+a.y*s),t.position.y=this.ty+(a.x*i+a.y*n),t}invert(){const t=this.a,e=this.b,i=this.c,s=this.d,n=this.tx,a=t*s-e*i;return this.a=s/a,this.b=-e/a,this.c=-i/a,this.d=t/a,this.tx=(i*this.ty-s*n)/a,this.ty=-(t*this.ty-e*n)/a,this}isIdentity(){return this.a===1&&this.b===0&&this.c===0&&this.d===1&&this.tx===0&&this.ty===0}identity(){return this.a=1,this.b=0,this.c=0,this.d=1,this.tx=0,this.ty=0,this}clone(){const t=new G;return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyTo(t){return t.a=this.a,t.b=this.b,t.c=this.c,t.d=this.d,t.tx=this.tx,t.ty=this.ty,t}copyFrom(t){return this.a=t.a,this.b=t.b,this.c=t.c,this.d=t.d,this.tx=t.tx,this.ty=t.ty,this}equals(t){return t.a===this.a&&t.b===this.b&&t.c===this.c&&t.d===this.d&&t.tx===this.tx&&t.ty===this.ty}static get IDENTITY(){return Mx.identity()}static get shared(){return Px.identity()}}const Px=new G,Mx=new G,Ee=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],we=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ce=[0,-1,-1,-1,0,1,1,1,0,1,1,1,0,-1,-1,-1],Re=[1,1,0,-1,-1,-1,0,1,-1,-1,0,1,1,1,0,-1],ua=[],Sh=[],Yi=Math.sign;function Dx(){for(let r=0;r<16;r++){const t=[];ua.push(t);for(let e=0;e<16;e++){const i=Yi(Ee[r]*Ee[e]+Ce[r]*we[e]),s=Yi(we[r]*Ee[e]+Re[r]*we[e]),n=Yi(Ee[r]*Ce[e]+Ce[r]*Re[e]),a=Yi(we[r]*Ce[e]+Re[r]*Re[e]);for(let o=0;o<16;o++)if(Ee[o]===i&&we[o]===s&&Ce[o]===n&&Re[o]===a){t.push(o);break}}}for(let r=0;r<16;r++){const t=new G;t.set(Ee[r],we[r],Ce[r],Re[r],0,0),Sh.push(t)}}Dx();const H={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=>Ee[r],uY:r=>we[r],vX:r=>Ce[r],vY:r=>Re[r],inv:r=>r&8?r&15:-r&7,add:(r,t)=>ua[r][t],sub:(r,t)=>ua[r][H.inv(t)],rotate180:r=>r^4,isVertical:r=>(r&3)===2,byDirection:(r,t)=>Math.abs(r)*2<=Math.abs(t)?t>=0?H.S:H.N:Math.abs(t)*2<=Math.abs(r)?r>0?H.E:H.W:t>0?r>0?H.SE:H.SW:r>0?H.NE:H.NW,matrixAppendRotationInv:(r,t,e=0,i=0)=>{const s=Sh[H.inv(t)];s.tx=e,s.ty=i,r.append(s)}},qi=[new nt,new nt,new nt,new nt];class W{constructor(t=0,e=0,i=0,s=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(i),this.height=Number(s)}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 W(0,0,0,0)}clone(){return new W(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,i){const{width:s,height:n}=this;if(s<=0||n<=0)return!1;const a=this.x,o=this.y,u=a-i/2,l=a+s+i/2,c=o-i/2,h=o+n+i/2,f=a+i/2,p=a+s-i/2,m=o+i/2,_=o+n-i/2;return t>=u&&t<=l&&e>=c&&e<=h&&!(t>f&&t<p&&e>m&&e<_)}intersects(t,e){if(!e){const P=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=P)return!1;const S=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>S}const i=this.left,s=this.right,n=this.top,a=this.bottom;if(s<=i||a<=n)return!1;const o=qi[0].set(t.left,t.top),u=qi[1].set(t.left,t.bottom),l=qi[2].set(t.right,t.top),c=qi[3].set(t.right,t.bottom);if(l.x<=o.x||u.y<=o.y)return!1;const h=Math.sign(e.a*e.d-e.b*e.c);if(h===0||(e.apply(o,o),e.apply(u,u),e.apply(l,l),e.apply(c,c),Math.max(o.x,u.x,l.x,c.x)<=i||Math.min(o.x,u.x,l.x,c.x)>=s||Math.max(o.y,u.y,l.y,c.y)<=n||Math.min(o.y,u.y,l.y,c.y)>=a))return!1;const f=h*(u.y-o.y),p=h*(o.x-u.x),m=f*i+p*n,_=f*s+p*n,g=f*i+p*a,b=f*s+p*a;if(Math.max(m,_,g,b)<=f*o.x+p*o.y||Math.min(m,_,g,b)>=f*c.x+p*c.y)return!1;const x=h*(o.y-l.y),y=h*(l.x-o.x),T=x*i+y*n,A=x*s+y*n,R=x*i+y*a,C=x*s+y*a;return!(Math.max(T,A,R,C)<=x*o.x+y*o.y||Math.min(T,A,R,C)>=x*c.x+y*c.y)}pad(t=0,e=t){return this.x-=t,this.y-=e,this.width+=t*2,this.height+=e*2,this}fit(t){const e=Math.max(this.x,t.x),i=Math.min(this.x+this.width,t.x+t.width),s=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(i-e,0),this.y=s,this.height=Math.max(n-s,0),this}ceil(t=1,e=.001){const i=Math.ceil((this.x+this.width-e)*t)/t,s=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=i-this.x,this.height=s-this.y,this}enlarge(t){const e=Math.min(this.x,t.x),i=Math.max(this.x+this.width,t.x+t.width),s=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=i-e,this.y=s,this.height=n-s,this}getBounds(t){return t=t||new W,t.copyFrom(this),t}}const $r={default:-1};function J(r="default"){return $r[r]===void 0&&($r[r]=-1),++$r[r]}function Ox(){for(const r in $r)delete $r[r]}const la=()=>{};function Pe(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 ca(r){return!(r&r-1)&&!!r}function Bx(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 Wt(r){const t={};for(const e in r)r[e]!==void 0&&(t[e]=r[e]);return t}var Gx=Object.defineProperty,Ah=Object.getOwnPropertySymbols,Fx=Object.prototype.hasOwnProperty,Ix=Object.prototype.propertyIsEnumerable,Eh=(r,t,e)=>t in r?Gx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wh=(r,t)=>{for(var e in t||(t={}))Fx.call(t,e)&&Eh(r,e,t[e]);if(Ah)for(var e of Ah(t))Ix.call(t,e)&&Eh(r,e,t[e]);return r};const Ch=Object.create(null);function Ux(r){const t=Ch[r];return t===void 0&&(Ch[r]=J("resource")),t}const Rh=class hy extends Rt{constructor(t={}){var e,i,s,n,a,o,u;super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t=wh(wh({},hy.defaultOptions),t),this.addressMode=t.addressMode,this.addressModeU=(e=t.addressModeU)!=null?e:this.addressModeU,this.addressModeV=(i=t.addressModeV)!=null?i:this.addressModeV,this.addressModeW=(s=t.addressModeW)!=null?s:this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=(n=t.magFilter)!=null?n:this.magFilter,this.minFilter=(a=t.minFilter)!=null?a:this.minFilter,this.mipmapFilter=(o=t.mipmapFilter)!=null?o: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=Ux(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Rh.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Ph=Rh;var kx=Object.defineProperty,Mh=Object.getOwnPropertySymbols,Lx=Object.prototype.hasOwnProperty,Nx=Object.prototype.propertyIsEnumerable,Dh=(r,t,e)=>t in r?kx(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Oh=(r,t)=>{for(var e in t||(t={}))Lx.call(t,e)&&Dh(r,e,t[e]);if(Mh)for(var e of Mh(t))Nx.call(t,e)&&Dh(r,e,t[e]);return r};const Bh=class dy extends Rt{constructor(t={}){var e,i,s;super(),this.options=t,this.uid=J("textureSource"),this._resourceType="textureSource",this._resourceId=J("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=Oh(Oh({},dy.defaultOptions),t),this.label=(e=t.label)!=null?e:"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource&&(i=this.resourceWidth)!=null?i:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource&&(s=this.resourceHeight)!=null?s:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Ph(Wt(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,i;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(i=this._style)==null||i.on("change",this._onStyleChange,this),this._onStyleChange())}get addressMode(){return this._style.addressMode}set addressMode(t){this._style.addressMode=t}get repeatMode(){return this._style.addressMode}set repeatMode(t){this._style.addressMode=t}get magFilter(){return this._style.magFilter}set magFilter(t){this._style.magFilter=t}get minFilter(){return this._style.minFilter}set minFilter(t){this._style.minFilter=t}get mipmapFilter(){return this._style.mipmapFilter}set mipmapFilter(t){this._style.mipmapFilter=t}get lodMinClamp(){return this._style.lodMinClamp}set lodMinClamp(t){this._style.lodMinClamp=t}get lodMaxClamp(){return this._style.lodMaxClamp}set lodMaxClamp(t){this._style.lodMaxClamp=t}_onStyleChange(){this.emit("styleChange",this)}update(){if(this.resource){const t=this._resolution;if(this.resize(this.resourceWidth/t,this.resourceHeight/t))return}this.emit("update",this)}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){this._resourceId=J("resource"),this.emit("change",this),this.emit("unload",this)}get resourceWidth(){const{resource:t}=this;return t.naturalWidth||t.videoWidth||t.displayWidth||t.width}get resourceHeight(){const{resource:t}=this;return t.naturalHeight||t.videoHeight||t.displayHeight||t.height}get resolution(){return this._resolution}set resolution(t){this._resolution!==t&&(this._resolution=t,this.width=this.pixelWidth/t,this.height=this.pixelHeight/t)}resize(t,e,i){i=i||this._resolution,t=t||this.width,e=e||this.height;const s=Math.round(t*i),n=Math.round(e*i);return this.width=s/i,this.height=n/i,this._resolution=i,this.pixelWidth===s&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=s,this.pixelHeight=n,this.emit("resize",this),this._resourceId=J("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=ca(this.pixelWidth)&&ca(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};Bh.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let et=Bh;var $x=Object.defineProperty,Hx=Object.defineProperties,Xx=Object.getOwnPropertyDescriptors,Gh=Object.getOwnPropertySymbols,zx=Object.prototype.hasOwnProperty,jx=Object.prototype.propertyIsEnumerable,Fh=(r,t,e)=>t in r?$x(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vx=(r,t)=>{for(var e in t||(t={}))zx.call(t,e)&&Fh(r,e,t[e]);if(Gh)for(var e of Gh(t))jx.call(t,e)&&Fh(r,e,t[e]);return r},Wx=(r,t)=>Hx(r,Xx(t));class Ki extends et{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let i=t.format;i||(e instanceof Float32Array?i="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?i="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?i="rgba16uint":(e instanceof Int8Array,i="bgra8unorm")),super(Wx(Vx({},t),{resource:e,format:i})),this.uploadMethodId="buffer"}static test(t){return t instanceof Int8Array||t instanceof Uint8Array||t instanceof Uint8ClampedArray||t instanceof Int16Array||t instanceof Uint16Array||t instanceof Int32Array||t instanceof Uint32Array||t instanceof Float32Array}}Ki.extension=v.TextureSource;const Ih=new G;class ha{constructor(t,e){this.mapCoord=new G,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e=="undefined"?this.clampMargin=t.width<10?0:.5:this.clampMargin=e,this.isSimple=!1,this.texture=t}get texture(){return this._texture}set texture(t){var e;this.texture!==t&&((e=this._texture)==null||e.removeListener("update",this.update,this),this._texture=t,this._texture.addListener("update",this.update,this),this.update())}multiplyUvs(t,e){e===void 0&&(e=t);const i=this.mapCoord;for(let s=0;s<t.length;s+=2){const n=t[s],a=t[s+1];e[s]=n*i.a+a*i.c+i.tx,e[s+1]=n*i.b+a*i.d+i.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 i=t.orig,s=t.trim;s&&(Ih.set(i.width/s.width,0,0,i.height/s.height,-s.x/s.width,-s.y/s.height),this.mapCoord.append(Ih));const n=t.source,a=this.uClampFrame,o=this.clampMargin/n._resolution,u=this.clampOffset/n._resolution;return a[0]=(t.frame.x+o+u)/n.width,a[1]=(t.frame.y+o+u)/n.height,a[2]=(t.frame.x+t.frame.width-o+u)/n.width,a[3]=(t.frame.y+t.frame.height-o+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 w extends Rt{constructor({source:t,label:e,frame:i,orig:s,trim:n,defaultAnchor:a,defaultBorders:o,rotate:u,dynamic:l}={}){var c;if(super(),this.uid=J("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new W,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(c=t==null?void 0:t.source)!=null?c:new et,this.noFrame=!i,i)this.frame.copyFrom(i);else{const{width:h,height:f}=this._source;this.frame.width=h,this.frame.height=f}this.orig=s||this.frame,this.trim=n,this.rotate=u!=null?u:0,this.defaultAnchor=a,this.defaultBorders=o,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 ha(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:i,height:s}=this._source,n=e.x/i,a=e.y/s,o=e.width/i,u=e.height/s;let l=this.rotate;if(l){const c=o/2,h=u/2,f=n+c,p=a+h;l=H.add(l,H.NW),t.x0=f+c*H.uX(l),t.y0=p+h*H.uY(l),l=H.add(l,2),t.x1=f+c*H.uX(l),t.y1=p+h*H.uY(l),l=H.add(l,2),t.x2=f+c*H.uX(l),t.y2=p+h*H.uY(l),l=H.add(l,2),t.x3=f+c*H.uX(l),t.y3=p+h*H.uY(l)}else t.x0=n,t.y0=a,t.x1=n+o,t.y1=a,t.x2=n+o,t.y2=a+u,t.x3=n,t.y3=a+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}}w.EMPTY=new w({label:"EMPTY",source:new et({label:"EMPTY"})}),w.EMPTY.destroy=la,w.WHITE=new w({source:new Ki({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"}),w.WHITE.destroy=la;const Uh=class Gi{constructor(t,e){this.linkedSheets=[],this._texture=t instanceof w?t:null,this.textureSource=t.source,this.textures={},this.animations={},this.data=e;const i=parseFloat(e.meta.scale);i?(this.resolution=i,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<=Gi.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}_processFrames(t){let e=t;const i=Gi.BATCH_SIZE;for(;e-t<i&&e<this._frameKeys.length;){const s=this._frameKeys[e],n=this._frames[s],a=n.frame;if(a){let o=null,u=null;const l=n.trimmed!==!1&&n.sourceSize?n.sourceSize:n.frame,c=new W(0,0,Math.floor(l.w)/this.resolution,Math.floor(l.h)/this.resolution);n.rotated?o=new W(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.h)/this.resolution,Math.floor(a.w)/this.resolution):o=new W(Math.floor(a.x)/this.resolution,Math.floor(a.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution),n.trimmed!==!1&&n.spriteSourceSize&&(u=new W(Math.floor(n.spriteSourceSize.x)/this.resolution,Math.floor(n.spriteSourceSize.y)/this.resolution,Math.floor(a.w)/this.resolution,Math.floor(a.h)/this.resolution)),this.textures[s]=new w({source:this.textureSource,frame:o,orig:c,trim:u,rotate:n.rotated?2:0,defaultAnchor:n.anchor,defaultBorders:n.borders,label:s.toString()})}e++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let i=0;i<t[e].length;i++){const s=t[e][i];this.animations[e].push(this.textures[s])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*Gi.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*Gi.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const i in this.textures)this.textures[i].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=[]}};Uh.BATCH_SIZE=1e3;let da=Uh;const Yx=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function kh(r,t,e){const i={};if(r.forEach(s=>{i[s]=t}),Object.keys(t.textures).forEach(s=>{i[s]=t.textures[s]}),!e){const s=Tt.dirname(r[0]);t.linkedSheets.forEach((n,a)=>{const o=kh([`${s}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(i,o)})}return i}const Lh={extension:v.Asset,cache:{test:r=>r instanceof da,getCacheableAssets:(r,t)=>kh(r,t,!1)},resolver:{extension:{type:v.ResolveParser,name:"resolveSpritesheet"},test:r=>{const t=r.split("?")[0].split("."),e=t.pop(),i=t.pop();return e==="json"&&Yx.includes(i)},parse:r=>{var t,e;const i=r.split(".");return{resolution:parseFloat((e=(t=fe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i[i.length-2],src:r}}},loader:{name:"spritesheetLoader",extension:{type:v.LoadParser,priority:Ct.Normal,name:"spritesheetLoader"},async testParse(r,t){return Tt.extname(t.src).toLowerCase()===".json"&&!!r.frames},async parse(r,t,e){var i,s,n;const{texture:a,imageFilename:o}=(i=t==null?void 0:t.data)!=null?i:{};let u=Tt.dirname(t.src);u&&u.lastIndexOf("/")!==u.length-1&&(u+="/");let l;if(a instanceof w)l=a;else{const f=Wi(u+(o!=null?o:r.meta.image),t.src);l=(await e.load([f]))[f]}const c=new da(l.source,r);await c.parse();const h=(s=r==null?void 0:r.meta)==null?void 0:s.related_multi_packs;if(Array.isArray(h)){const f=[];for(const m of h){if(typeof m!="string")continue;let _=u+m;(n=t.data)!=null&&n.ignoreMultiPack||(_=Wi(_,t.src),f.push(e.load({src:_,data:{ignoreMultiPack:!0}})))}const p=await Promise.all(f);c.linkedSheets=p,p.forEach(m=>{m.linkedSheets=[c].concat(c.linkedSheets.filter(_=>_!==m))})}return c},async unload(r,t,e){await e.unload(r.textureSource._sourceOrigin),r.destroy(!1)}}};L.add(Lh);class at{constructor(t,e,i){this._x=e||0,this._y=i||0,this._observer=t}clone(t){return new at(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 Hr(r,t,e,i){const{width:s,height:n}=e.orig,a=e.trim;if(a){const o=a.width,u=a.height;r.minX=a.x-t._x*s-i,r.maxX=r.minX+o,r.minY=a.y-t._y*n-i,r.maxY=r.minY+u}else r.minX=-t._x*s-i,r.maxX=r.minX+s,r.minY=-t._y*n-i,r.maxY=r.minY+n}const Nh=new G;class ft{constructor(t=1/0,e=1/0,i=-1/0,s=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Nh,this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new W);const t=this._rectangle;return this.minX>this.maxX||this.minY>this.maxY?(t.x=0,t.y=0,t.width=0,t.height=0):t.copyFromBounds(this),t}clear(){return this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=Nh,this}set(t,e,i,s){this.minX=t,this.minY=e,this.maxX=i,this.maxY=s}addFrame(t,e,i,s,n){n||(n=this.matrix);const a=n.a,o=n.b,u=n.c,l=n.d,c=n.tx,h=n.ty;let f=this.minX,p=this.minY,m=this.maxX,_=this.maxY,g=a*t+u*e+c,b=o*t+l*e+h;g<f&&(f=g),b<p&&(p=b),g>m&&(m=g),b>_&&(_=b),g=a*i+u*e+c,b=o*i+l*e+h,g<f&&(f=g),b<p&&(p=b),g>m&&(m=g),b>_&&(_=b),g=a*t+u*s+c,b=o*t+l*s+h,g<f&&(f=g),b<p&&(p=b),g>m&&(m=g),b>_&&(_=b),g=a*i+u*s+c,b=o*i+l*s+h,g<f&&(f=g),b<p&&(p=b),g>m&&(m=g),b>_&&(_=b),this.minX=f,this.minY=p,this.maxX=m,this.maxY=_}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,i=this.minY,s=this.maxX,n=this.maxY,{a,b:o,c:u,d:l,tx:c,ty:h}=t;let f=a*e+u*i+c,p=o*e+l*i+h;this.minX=f,this.minY=p,this.maxX=f,this.maxY=p,f=a*s+u*i+c,p=o*s+l*i+h,this.minX=f<this.minX?f:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=p>this.maxY?p:this.maxY,f=a*e+u*n+c,p=o*e+l*n+h,this.minX=f<this.minX?f:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=p>this.maxY?p:this.maxY,f=a*s+u*n+c,p=o*s+l*n+h,this.minX=f<this.minX?f:this.minX,this.minY=p<this.minY?p:this.minY,this.maxX=f>this.maxX?f: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,i,s){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<i&&(this.minY=i),this.maxY>s&&(this.maxY=s),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new ft(this.minX,this.minY,this.maxX,this.maxY)}scale(t,e=t){return this.minX*=t,this.minY*=e,this.maxX*=t,this.maxY*=e,this}get x(){return this.minX}set x(t){const e=this.maxX-this.minX;this.minX=t,this.maxX=t+e}get y(){return this.minY}set y(t){const e=this.maxY-this.minY;this.minY=t,this.maxY=t+e}get width(){return this.maxX-this.minX}set width(t){this.maxX=this.minX+t}get height(){return this.maxY-this.minY}set height(t){this.maxY=this.minY+t}get left(){return this.minX}get right(){return this.maxX}get top(){return this.minY}get bottom(){return this.maxY}get isPositive(){return this.maxX-this.minX>0&&this.maxY-this.minY>0}get isValid(){return this.minX+this.minY!==1/0}addVertexData(t,e,i,s){let n=this.minX,a=this.minY,o=this.maxX,u=this.maxY;s||(s=this.matrix);const l=s.a,c=s.b,h=s.c,f=s.d,p=s.tx,m=s.ty;for(let _=e;_<i;_+=2){const g=t[_],b=t[_+1],x=l*g+h*b+p,y=c*g+f*b+m;n=x<n?x:n,a=y<a?y:a,o=x>o?x:o,u=y>u?y:u}this.minX=n,this.minY=a,this.maxX=o,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 qx={grad:.9,turn:360,rad:360/(2*Math.PI)},ne=function(r){return typeof r=="string"?r.length>0:typeof r=="number"},ct=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*r)/e+0},Ft=function(r,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),r>e?e:r>t?r:t},$h=function(r){return(r=isFinite(r)?r%360:0)>0?r:r+360},Hh=function(r){return{r:Ft(r.r,0,255),g:Ft(r.g,0,255),b:Ft(r.b,0,255),a:Ft(r.a)}},fa=function(r){return{r:ct(r.r),g:ct(r.g),b:ct(r.b),a:ct(r.a,3)}},Kx=/^#([0-9a-f]{3,8})$/i,Zi=function(r){var t=r.toString(16);return t.length<2?"0"+t:t},Xh=function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=Math.max(t,e,i),a=n-Math.min(t,e,i),o=a?n===t?(e-i)/a:n===e?2+(i-t)/a:4+(t-e)/a:0;return{h:60*(o<0?o+6:o),s:n?a/n*100:0,v:n/255*100,a:s}},zh=function(r){var t=r.h,e=r.s,i=r.v,s=r.a;t=t/360*6,e/=100,i/=100;var n=Math.floor(t),a=i*(1-e),o=i*(1-(t-n)*e),u=i*(1-(1-t+n)*e),l=n%6;return{r:255*[i,o,a,a,u,i][l],g:255*[u,i,i,o,a,a][l],b:255*[a,a,u,i,i,o][l],a:s}},jh=function(r){return{h:$h(r.h),s:Ft(r.s,0,100),l:Ft(r.l,0,100),a:Ft(r.a)}},Vh=function(r){return{h:ct(r.h),s:ct(r.s),l:ct(r.l),a:ct(r.a,3)}},Wh=function(r){return zh((e=(t=r).s,{h:t.h,s:(e*=((i=t.l)<50?i:100-i)/100)>0?2*e/(i+e)*100:0,v:i+e,a:t.a}));var t,e,i},Xr=function(r){return{h:(t=Xh(r)).h,s:(s=(200-(e=t.s))*(i=t.v)/100)>0&&s<200?e*i/100/(s<=100?s:200-s)*100:0,l:s/2,a:t.a};var t,e,i,s},Zx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Qx=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Jx=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,tv=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,pa={string:[[function(r){var t=Kx.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?ct(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?ct(parseInt(r.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(r){var t=Jx.exec(r)||tv.exec(r);return t?t[2]!==t[4]||t[4]!==t[6]?null:Hh({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=Zx.exec(r)||Qx.exec(r);if(!t)return null;var e,i,s=jh({h:(e=t[1],i=t[2],i===void 0&&(i="deg"),Number(e)*(qx[i]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return Wh(s)},"hsl"]],object:[[function(r){var t=r.r,e=r.g,i=r.b,s=r.a,n=s===void 0?1:s;return ne(t)&&ne(e)&&ne(i)?Hh({r:Number(t),g:Number(e),b:Number(i),a:Number(n)}):null},"rgb"],[function(r){var t=r.h,e=r.s,i=r.l,s=r.a,n=s===void 0?1:s;if(!ne(t)||!ne(e)||!ne(i))return null;var a=jh({h:Number(t),s:Number(e),l:Number(i),a:Number(n)});return Wh(a)},"hsl"],[function(r){var t=r.h,e=r.s,i=r.v,s=r.a,n=s===void 0?1:s;if(!ne(t)||!ne(e)||!ne(i))return null;var a=function(o){return{h:$h(o.h),s:Ft(o.s,0,100),v:Ft(o.v,0,100),a:Ft(o.a)}}({h:Number(t),s:Number(e),v:Number(i),a:Number(n)});return zh(a)},"hsv"]]},Yh=function(r,t){for(var e=0;e<t.length;e++){var i=t[e][0](r);if(i)return[i,t[e][1]]}return[null,void 0]},qh=function(r){return typeof r=="string"?Yh(r.trim(),pa.string):typeof r=="object"&&r!==null?Yh(r,pa.object):[null,void 0]},cP=function(r){return qh(r)[1]},ma=function(r,t){var e=Xr(r);return{h:e.h,s:Ft(e.s+100*t,0,100),l:e.l,a:e.a}},ga=function(r){return(299*r.r+587*r.g+114*r.b)/1e3/255},Kh=function(r,t){var e=Xr(r);return{h:e.h,s:e.s,l:Ft(e.l+100*t,0,100),a:e.a}},Qi=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 ct(ga(this.rgba),2)},r.prototype.isDark=function(){return ga(this.rgba)<.5},r.prototype.isLight=function(){return ga(this.rgba)>=.5},r.prototype.toHex=function(){return t=fa(this.rgba),e=t.r,i=t.g,s=t.b,a=(n=t.a)<1?Zi(ct(255*n)):"","#"+Zi(e)+Zi(i)+Zi(s)+a;var t,e,i,s,n,a},r.prototype.toRgb=function(){return fa(this.rgba)},r.prototype.toRgbString=function(){return t=fa(this.rgba),e=t.r,i=t.g,s=t.b,(n=t.a)<1?"rgba("+e+", "+i+", "+s+", "+n+")":"rgb("+e+", "+i+", "+s+")";var t,e,i,s,n},r.prototype.toHsl=function(){return Vh(Xr(this.rgba))},r.prototype.toHslString=function(){return t=Vh(Xr(this.rgba)),e=t.h,i=t.s,s=t.l,(n=t.a)<1?"hsla("+e+", "+i+"%, "+s+"%, "+n+")":"hsl("+e+", "+i+"%, "+s+"%)";var t,e,i,s,n},r.prototype.toHsv=function(){return t=Xh(this.rgba),{h:ct(t.h),s:ct(t.s),v:ct(t.v),a:ct(t.a,3)};var t},r.prototype.invert=function(){return Yt({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),Yt(ma(this.rgba,t))},r.prototype.desaturate=function(t){return t===void 0&&(t=.1),Yt(ma(this.rgba,-t))},r.prototype.grayscale=function(){return Yt(ma(this.rgba,-1))},r.prototype.lighten=function(t){return t===void 0&&(t=.1),Yt(Kh(this.rgba,t))},r.prototype.darken=function(t){return t===void 0&&(t=.1),Yt(Kh(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"?Yt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):ct(this.rgba.a,3);var e},r.prototype.hue=function(t){var e=Xr(this.rgba);return typeof t=="number"?Yt({h:t,s:e.s,l:e.l,a:e.a}):ct(e.h)},r.prototype.isEqual=function(t){return this.toHex()===Yt(t).toHex()},r}(),Yt=function(r){return r instanceof Qi?r:new Qi(r)},Zh=[],ev=function(r){r.forEach(function(t){Zh.indexOf(t)<0&&(t(Qi,pa),Zh.push(t))})},hP=function(){return new Qi({r:255*Math.random(),g:255*Math.random(),b:255*Math.random()})};function rv(r,t){var e={white:"#ffffff",bisque:"#ffe4c4",blue:"#0000ff",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",antiquewhite:"#faebd7",aqua:"#00ffff",azure:"#f0ffff",whitesmoke:"#f5f5f5",papayawhip:"#ffefd5",plum:"#dda0dd",blanchedalmond:"#ffebcd",black:"#000000",gold:"#ffd700",goldenrod:"#daa520",gainsboro:"#dcdcdc",cornsilk:"#fff8dc",cornflowerblue:"#6495ed",burlywood:"#deb887",aquamarine:"#7fffd4",beige:"#f5f5dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkkhaki:"#bdb76b",darkgray:"#a9a9a9",darkgreen:"#006400",darkgrey:"#a9a9a9",peachpuff:"#ffdab9",darkmagenta:"#8b008b",darkred:"#8b0000",darkorchid:"#9932cc",darkorange:"#ff8c00",darkslateblue:"#483d8b",gray:"#808080",darkslategray:"#2f4f4f",darkslategrey:"#2f4f4f",deeppink:"#ff1493",deepskyblue:"#00bfff",wheat:"#f5deb3",firebrick:"#b22222",floralwhite:"#fffaf0",ghostwhite:"#f8f8ff",darkviolet:"#9400d3",magenta:"#ff00ff",green:"#008000",dodgerblue:"#1e90ff",grey:"#808080",honeydew:"#f0fff0",hotpink:"#ff69b4",blueviolet:"#8a2be2",forestgreen:"#228b22",lawngreen:"#7cfc00",indianred:"#cd5c5c",indigo:"#4b0082",fuchsia:"#ff00ff",brown:"#a52a2a",maroon:"#800000",mediumblue:"#0000cd",lightcoral:"#f08080",darkturquoise:"#00ced1",lightcyan:"#e0ffff",ivory:"#fffff0",lightyellow:"#ffffe0",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",linen:"#faf0e6",mediumaquamarine:"#66cdaa",lemonchiffon:"#fffacd",lime:"#00ff00",khaki:"#f0e68c",mediumseagreen:"#3cb371",limegreen:"#32cd32",mediumspringgreen:"#00fa9a",lightskyblue:"#87cefa",lightblue:"#add8e6",midnightblue:"#191970",lightpink:"#ffb6c1",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",mintcream:"#f5fffa",lightslategray:"#778899",lightslategrey:"#778899",navajowhite:"#ffdead",navy:"#000080",mediumvioletred:"#c71585",powderblue:"#b0e0e6",palegoldenrod:"#eee8aa",oldlace:"#fdf5e6",paleturquoise:"#afeeee",mediumturquoise:"#48d1cc",mediumorchid:"#ba55d3",rebeccapurple:"#663399",lightsteelblue:"#b0c4de",mediumslateblue:"#7b68ee",thistle:"#d8bfd8",tan:"#d2b48c",orchid:"#da70d6",mediumpurple:"#9370db",purple:"#800080",pink:"#ffc0cb",skyblue:"#87ceeb",springgreen:"#00ff7f",palegreen:"#98fb98",red:"#ff0000",yellow:"#ffff00",slateblue:"#6a5acd",lavenderblush:"#fff0f5",peru:"#cd853f",palevioletred:"#db7093",violet:"#ee82ee",teal:"#008080",slategray:"#708090",slategrey:"#708090",aliceblue:"#f0f8ff",darkseagreen:"#8fbc8f",darkolivegreen:"#556b2f",greenyellow:"#adff2f",seagreen:"#2e8b57",seashell:"#fff5ee",tomato:"#ff6347",silver:"#c0c0c0",sienna:"#a0522d",lavender:"#e6e6fa",lightgreen:"#90ee90",orange:"#ffa500",orangered:"#ff4500",steelblue:"#4682b4",royalblue:"#4169e1",turquoise:"#40e0d0",yellowgreen:"#9acd32",salmon:"#fa8072",saddlebrown:"#8b4513",sandybrown:"#f4a460",rosybrown:"#bc8f8f",darksalmon:"#e9967a",lightgoldenrodyellow:"#fafad2",snow:"#fffafa",lightgrey:"#d3d3d3",lightgray:"#d3d3d3",dimgray:"#696969",dimgrey:"#696969",olivedrab:"#6b8e23",olive:"#808000"},i={};for(var s in e)i[e[s]]=s;var n={};r.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,u,l=i[this.toHex()];if(l)return l;if(a!=null&&a.closest){var c=this.toRgb(),h=1/0,f="black";if(!n.length)for(var p in e)n[p]=new r(e[p]).toRgb();for(var m in e){var _=(o=c,u=n[m],Math.pow(o.r-u.r,2)+Math.pow(o.g-u.g,2)+Math.pow(o.b-u.b,2));_<h&&(h=_,f=m)}return f}},t.string.push([function(a){var o=a.toLowerCase(),u=o==="transparent"?"#0000":e[o];return u?new r(u).toRgb():null},"name"])}var iv=Object.defineProperty,Qh=Object.getOwnPropertySymbols,sv=Object.prototype.hasOwnProperty,nv=Object.prototype.propertyIsEnumerable,Jh=(r,t,e)=>t in r?iv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,av=(r,t)=>{for(var e in t||(t={}))sv.call(t,e)&&Jh(r,e,t[e]);if(Qh)for(var e of Qh(t))nv.call(t,e)&&Jh(r,e,t[e]);return r};ev([rv]);const Je=class Fi{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 Fi)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?av({},t):t}_isSourceEqual(t,e){const i=typeof t;if(i!==typeof e)return!1;if(i==="number"||i==="string"||t instanceof Number)return t===e;if(Array.isArray(t)&&Array.isArray(e)||ArrayBuffer.isView(t)&&ArrayBuffer.isView(e))return t.length!==e.length?!1:t.every((s,n)=>s===e[n]);if(t!==null&&e!==null){const s=Object.keys(t),n=Object.keys(e);return s.length!==n.length?!1:s.every(a=>t[a]===e[a])}return t===e}toRgba(){const[t,e,i,s]=this._components;return{r:t,g:e,b:i,a:s}}toRgb(){const[t,e,i]=this._components;return{r:t,g:e,b:i}}toRgbaString(){const[t,e,i]=this.toUint8RgbArray();return`rgba(${t},${e},${i},${this.alpha})`}toUint8RgbArray(t){const[e,i,s]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb,t[0]=Math.round(e*255),t[1]=Math.round(i*255),t[2]=Math.round(s*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t=t||this._arrayRgba;const[e,i,s,n]=this._components;return t[0]=e,t[1]=i,t[2]=s,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t=t||this._arrayRgb;const[e,i,s]=this._components;return t[0]=e,t[1]=i,t[2]=s,t}toNumber(){return this._int}toBgrNumber(){const[t,e,i]=this.toUint8RgbArray();return(i<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,i,s,n]=Fi._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=i,this._components[2]*=s,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let i=this._int>>16&255,s=this._int>>8&255,n=this._int&255;return e&&(i=i*t+.5|0,s=s*t+.5|0,n=n*t+.5|0),(t*255<<24)+(i<<16)+(s<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const t=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-t.length)+t}setAlpha(t){return this._components[3]=this._clamp(t),this}_normalize(t){let e,i,s,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,i=(a>>8&255)/255,s=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,i,s,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,i,s,n=255]=t,e/=255,i/=255,s/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=Fi.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=Yt(t);a.isValid()&&({r:e,g:i,b:s,a:n}=a.rgba,e/=255,i/=255,s/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=i,this._components[2]=s,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,i]=this._components;this._int=(t*255<<16)+(e*255<<8)+(i*255|0)}_clamp(t,e=0,i=1){return typeof t=="number"?Math.min(Math.max(t,e),i):(t.forEach((s,n)=>{t[n]=Math.min(Math.max(s,e),i)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof Fi||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 V=Je;const td={cullArea:null,cullable:!1,cullableChildren:!0};class Ji{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 i;return this._index>0?i=this._pool[--this._index]:i=new this._classType,(e=i.init)==null||e.call(i,t),i}return(t){var e;(e=t.reset)==null||e.call(t),this._pool[this._index++]=t}get totalSize(){return this._count}get totalFree(){return this._index}get totalUsed(){return this._count-this._index}clear(){this._pool.length=0,this._index=0}}class ed{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 Ji(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const i=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[i]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}}const X=new ed;function rd(r,t,e){const i=r.length;let s;if(t>=i||e===0)return;e=t+e>i?i-t:e;const n=i-e;for(s=t;s<n;++s)r[s]=r[s+e];r.length=n}const id={allowChildren:!0,removeChildren(r=0,t){const e=t!=null?t:this.children.length,i=e-r,s=[];if(i>0&&i<=e){for(let a=e-1;a>=r;a--){const o=this.children[a];o&&(s.push(o),o.parent=null)}rd(this.children,r,e);const n=this.renderGroup||this.parentRenderGroup;n&&n.removeChildren(s);for(let a=0;a<s.length;++a)this.emit("childRemoved",s[a],this,a),s[a].emit("removed",this);return s}else if(i===0&&this.children.length===0)return s;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 s=r.parent.children.indexOf(r);if(r.parent===this&&s===t)return r;s!==-1&&r.parent.children.splice(s,1)}t===e.length?e.push(r):e.splice(t,0,r),r.parent=this,r.didChange=!0,r.didViewUpdate=!1,r._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(r),this.sortableChildren&&(this.sortDirty=!0),this.emit("childAdded",r,this,t),r.emit("added",this),r},swapChildren(r,t){if(r===t)return;const e=this.getChildIndex(r),i=this.getChildIndex(t);this.children[e]=t,this.children[i]=r;const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var r;(r=this.parent)==null||r.removeChild(this)},reparentChild(...r){return r.length===1?this.reparentChildAt(r[0],this.children.length):(r.forEach(t=>this.reparentChildAt(t,this.children.length)),r[0])},reparentChildAt(r,t){if(r.parent===this)return this.setChildIndex(r,t),r;const e=r.worldTransform.clone();r.removeFromParent(),this.addChildAt(r,t);const i=this.worldTransform.clone();return i.invert(),e.prepend(i),r.setFromMatrix(e),r}};class zr{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 sd{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 i=this._tests[e];if(i.test(t))return X.get(i.maskClass,t)}return t}returnMaskEffect(t){X.return(t)}}const ts=new sd;L.handleByList(v.MaskEffect,ts._effectClasses);const nd={_maskEffect:null,_filterEffect:null,effects:[],addEffect(r){if(this.effects.indexOf(r)!==-1)return;this.effects.push(r),this.effects.sort((e,i)=>e.priority-i.priority);const t=this.renderGroup||this.parentRenderGroup;t&&(t.structureDidChange=!0),this._updateIsSimple()},removeEffect(r){const t=this.effects.indexOf(r);t!==-1&&(this.effects.splice(t,1),this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateIsSimple())},set mask(r){const t=this._maskEffect;(t==null?void 0:t.mask)!==r&&(t&&(this.removeEffect(t),ts.returnMaskEffect(t),this._maskEffect=null),r!=null&&(this._maskEffect=ts.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 zr);r=r;const i=(r==null?void 0:r.length)>0,s=((t=e.filters)==null?void 0:t.length)>0,n=i!==s;r=Array.isArray(r)?r.slice(0):r,e.filters=Object.freeze(r),n&&(i?this.addEffect(e):(this.removeEffect(e),e.filters=r!=null?r:null))},get filters(){var r;return(r=this._filterEffect)==null?void 0:r.filters},set filterArea(r){this._filterEffect||(this._filterEffect=new zr),this._filterEffect.filterArea=r},get filterArea(){var r;return(r=this._filterEffect)==null?void 0:r.filterArea}},ad={label:null,get name(){return this.label},set name(r){this.label=r},getChildByName(r,t=!1){return this.getChildByLabel(r,t)},getChildByLabel(r,t=!1){const e=this.children;for(let i=0;i<e.length;i++){const s=e[i];if(s.label===r||r instanceof RegExp&&r.test(s.label))return s}if(t)for(let i=0;i<e.length;i++){const s=e[i].getChildByLabel(r,!0);if(s)return s}return null},getChildrenByLabel(r,t=!1,e=[]){const i=this.children;for(let s=0;s<i.length;s++){const n=i[s];(n.label===r||r instanceof RegExp&&r.test(n.label))&&e.push(n)}if(t)for(let s=0;s<i.length;s++)i[s].getChildrenByLabel(r,!0,e);return e}},qt=new Ji(G),Kt=new Ji(ft);function jr(r,t,e){e.clear();let i,s;return r.parent?t?i=r.parent.worldTransform:(s=qt.get().identity(),i=Vr(r,s)):i=G.IDENTITY,_a(r,e,i,t),s&&qt.return(s),e.isValid||e.set(0,0,0,0),e}function _a(r,t,e,i){var s,n;if(!r.visible||!r.measurable)return;let a;i?a=r.worldTransform:(r.updateLocalTransform(),a=qt.get(),a.appendFrom(r.localTransform,e));const o=t,u=!!r.effects.length;if(u&&(t=Kt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,a);else{r.addBounds&&(t.matrix=a,r.addBounds(t));for(let l=0;l<r.children.length;l++)_a(r.children[l],t,a,i)}if(u){for(let l=0;l<r.effects.length;l++)(n=(s=r.effects[l]).addBounds)==null||n.call(s,t);o.addBounds(t,G.IDENTITY),Kt.return(t)}i||qt.return(a)}function Vr(r,t){const e=r.parent;return e&&(Vr(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function es(r,t,e){return t.clear(),e||(e=G.IDENTITY),od(r,t,e,r,!0),t.isValid||t.set(0,0,0,0),t}function od(r,t,e,i,s){var n,a;let o;if(s)o=qt.get(),o=e.copyTo(o);else{if(!r.visible||!r.measurable)return;r.updateLocalTransform();const c=r.localTransform;o=qt.get(),o.appendFrom(c,e)}const u=t,l=!!r.effects.length;if(l&&(t=Kt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,o);else{r.renderPipeId&&(t.matrix=o,r.addBounds(t));const c=r.children;for(let h=0;h<c.length;h++)od(c[h],t,o,i,!1)}if(l){for(let c=0;c<r.effects.length;c++)(a=(n=r.effects[c]).addLocalBounds)==null||a.call(n,t,i);u.addBounds(t,G.IDENTITY),Kt.return(t)}qt.return(o)}function ud(r,t,e){const i=r.parent;i&&i!==t&&(ud(i,t,e),i.updateLocalTransform(),e.append(i.localTransform))}function ba(r,t){const e=r.children;for(let i=0;i<e.length;i++){const s=e[i],n=s.uid,a=(s._didViewChangeTick&65535)<<16|s._didContainerChangeTick&65535,o=t.index;(t.data[o]!==n||t.data[o+1]!==a)&&(t.data[t.index]=n,t.data[t.index+1]=a,t.didChange=!0),t.index=o+2,s.children.length&&ba(s,t)}return t.didChange}const ov=new G,ld={_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 ft});const r=this._localBoundsCacheData;return r.index=1,r.didChange=!1,r.data[0]!==this._didViewChangeTick&&(r.didChange=!0,r.data[0]=this._didViewChangeTick),ba(this,r),r.didChange&&es(this,r.localBounds,ov),r.localBounds},getBounds(r,t){return jr(this,r,t||new ft)}},cd={_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}},hd={_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(uv))}};function uv(r,t){return r._zIndex-t._zIndex}const dd={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 i=Vr(this,new G);return i.append(this.localTransform),i.apply(r,t)}return this.worldTransform.apply(r,t)},toLocal(r,t,e,i){if(t&&(r=t.toGlobal(r,e,i)),!i){this.updateLocalTransform();const s=Vr(this,new G);return s.append(this.localTransform),s.applyInverse(r,e)}return this.worldTransform.applyInverse(r,e)}};let lv=0;class ya{constructor(){this.uid=J("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.tick=0}reset(){this.instructionSize=0,this.tick=lv++}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}class fd{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new G,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 ya,this._onRenderContainers=[]}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let i=0;i<e.length;i++)this.addChild(e[i])}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 i=0;i<e.length;i++)this.addChild(e[i])}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 i=0;i<e.length;i++)this.removeChild(e[i])}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 i=0;i<e.length;i++)this._getChildren(e[i],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const i=t.children;for(let s=0;s<i.length;s++)this._getChildren(i[s],e);return e}}function pd(r,t,e={}){for(const i in t)!e[i]&&t[i]!==void 0&&(r[i]=t[i])}const xa=new at(null),va=new at(null),Ta=new at(null,1,1),Wr=1,rs=2,tr=4,cv=8;class rt extends Rt{constructor(t={}){var e,i;super(),this.uid=J("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 G,this.relativeGroupTransform=new G,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new at(this,0,0),this._scale=Ta,this._pivot=va,this._skew=xa,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=[],pd(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(s=>this.addChild(s)),(i=t.parent)==null||i.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 s=0;s<t.length;s++)this.addChild(t[s]);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 i=this.renderGroup||this.parentRenderGroup;return i&&i.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 s=0;s<t.length;s++)this.removeChild(t[s]);return t[0]}const e=t[0],i=this.children.indexOf(e);return i>-1&&(this._didViewChangeTick++,this.children.splice(i,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parent=null,this.emit("childRemoved",e,this,i),e.emit("removed",this)),e}_onUpdate(t){t&&t===this._skew&&this._updateSkew(),this._didContainerChangeTick++,!this.didChange&&(this.didChange=!0,this.parentRenderGroup&&this.parentRenderGroup.onChildUpdate(this))}set isRenderGroup(t){!!this.renderGroup!==t&&(t?this.enableRenderGroup():this.disableRenderGroup())}get isRenderGroup(){return!!this.renderGroup}enableRenderGroup(){if(this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),this.renderGroup=X.get(fd,this),this.groupTransform=G.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),X.return(this.renderGroup),this.renderGroup=null,this.groupTransform=this.relativeGroupTransform,t==null||t.addChild(this),this._updateIsSimple()}_updateIsSimple(){this.isSimple=!this.renderGroup&&this.effects.length===0}get worldTransform(){return this._worldTransform||(this._worldTransform=new G),this.renderGroup?this._worldTransform.copyFrom(this.renderGroup.worldTransform):this.parentRenderGroup&&this._worldTransform.appendFrom(this.relativeGroupTransform,this.parentRenderGroup.worldTransform),this._worldTransform}get x(){return this._position.x}set x(t){this._position.x=t}get y(){return this._position.y}set y(t){this._position.y=t}get position(){return this._position}set position(t){this._position.copyFrom(t)}get rotation(){return this._rotation}set rotation(t){this._rotation!==t&&(this._rotation=t,this._onUpdate(this._skew))}get angle(){return this.rotation*vh}set angle(t){this.rotation=t*Th}get pivot(){return this._pivot===va&&(this._pivot=new at(this,0,0)),this._pivot}set pivot(t){this._pivot===va&&(this._pivot=new at(this,0,0)),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===xa&&(this._skew=new at(this,0,0)),this._skew}set skew(t){this._skew===xa&&(this._skew=new at(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Ta&&(this._scale=new at(this,1,1)),this._scale}set scale(t){this._scale===Ta&&(this._scale=new at(this,0,0)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get width(){return Math.abs(this.scale.x*this.getLocalBounds().width)}set width(t){const e=this.getLocalBounds().width;this._setWidth(t,e)}get height(){return Math.abs(this.scale.y*this.getLocalBounds().height)}set height(t){const e=this.getLocalBounds().height;this._setHeight(t,e)}getSize(t){t||(t={});const e=this.getLocalBounds();return t.width=Math.abs(this.scale.x*e.width),t.height=Math.abs(this.scale.y*e.height),t}setSize(t,e){var i;const s=this.getLocalBounds();typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,s.width),e!==void 0&&this._setHeight(e,s.height)}_updateSkew(){const t=this._rotation,e=this._skew;this._cx=Math.cos(t+e._y),this._sx=Math.sin(t+e._y),this._cy=-Math.sin(t-e._x),this._sy=Math.cos(t-e._x)}updateTransform(t){return this.position.set(typeof t.x=="number"?t.x:this.position.x,typeof t.y=="number"?t.y:this.position.y),this.scale.set(typeof t.scaleX=="number"?t.scaleX||1:this.scale.x,typeof t.scaleY=="number"?t.scaleY||1:this.scale.y),this.rotation=typeof t.rotation=="number"?t.rotation:this.rotation,this.skew.set(typeof t.skewX=="number"?t.skewX:this.skew.x,typeof t.skewY=="number"?t.skewY:this.skew.y),this.pivot.set(typeof t.pivotX=="number"?t.pivotX:this.pivot.x,typeof t.pivotY=="number"?t.pivotY:this.pivot.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,i=this._scale,s=this._pivot,n=this._position,a=i._x,o=i._y,u=s._x,l=s._y;e.a=this._cx*a,e.b=this._sx*a,e.c=this._cy*o,e.d=this._sy*o,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|=Wr,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const e=V.shared.setValue(t!=null?t:16777215).toBgrNumber();e!==this.localColor&&(this.localColor=e,this._updateFlags|=Wr,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|=rs,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 i=this.removeChildren(0,this.children.length);if(this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.children)for(let s=0;s<i.length;++s)i[s].destroy(t);(e=this.renderGroup)==null||e.destroy(),this.renderGroup=null}}rt.mixin(id),rt.mixin(dd),rt.mixin(cd),rt.mixin(ld),rt.mixin(nd),rt.mixin(ad),rt.mixin(hd),rt.mixin(td);class Me extends rt{constructor(){super(...arguments),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=0,this._lastInstructionTick=-1,this._bounds=new ft(0,1,0,0),this._boundsDirty=!0}_updateBounds(){}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:i,y:s}=t;return i>=e.minX&&i<=e.maxX&&s>=e.minY&&s<=e.maxY}destroy(t){super.destroy(t),this._bounds=null}}var hv=Object.defineProperty,is=Object.getOwnPropertySymbols,md=Object.prototype.hasOwnProperty,gd=Object.prototype.propertyIsEnumerable,_d=(r,t,e)=>t in r?hv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,dv=(r,t)=>{for(var e in t||(t={}))md.call(t,e)&&_d(r,e,t[e]);if(is)for(var e of is(t))gd.call(t,e)&&_d(r,e,t[e]);return r},fv=(r,t)=>{var e={};for(var i in r)md.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&is)for(var i of is(r))t.indexOf(i)<0&&gd.call(r,i)&&(e[i]=r[i]);return e};class $t extends Me{constructor(t=w.EMPTY){t instanceof w&&(t={texture:t});const e=t,{texture:i=w.EMPTY,anchor:s,roundPixels:n,width:a,height:o}=e,u=fv(e,["texture","anchor","roundPixels","width","height"]);super(dv({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 at({_onUpdate:()=>{this.onViewUpdate()}}),s?this.anchor=s:i.defaultAnchor&&(this.anchor=i.defaultAnchor),this.texture=i,this.allowChildren=!1,this.roundPixels=n!=null?n:!1,a!==void 0&&(this.width=a),o!==void 0&&(this.height=o)}static from(t,e=!1){return t instanceof w?new $t(t):new $t(w.from(t,e))}set texture(t){t||(t=w.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(){Hr(this._bounds,this._anchor,this._texture,0)}_updateSourceBounds(){const t=this._anchor,e=this._texture,i=this._sourceBounds,{width:s,height:n}=e.orig;i.maxX=-t._x*s,i.minX=i.maxX+s,i.maxY=-t._y*n,i.minY=i.maxY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null,this._bounds=null,this._sourceBounds=null,this._anchor=null}get anchor(){return this._anchor}set anchor(t){typeof t=="number"?this._anchor.set(t):this._anchor.copyFrom(t)}get width(){return Math.abs(this.scale.x)*this._texture.orig.width}set width(t){this._setWidth(t,this._texture.orig.width),this._width=t}get height(){return Math.abs(this.scale.y)*this._texture.orig.height}set height(t){this._setHeight(t,this._texture.orig.height),this._height=t}getSize(t){return t||(t={}),t.width=Math.abs(this.scale.x)*this._texture.orig.width,t.height=Math.abs(this.scale.y)*this._texture.orig.height,t}setSize(t,e){var i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const pv=new ft;function ss(r,t,e){const i=pv;r.measurable=!0,jr(r,e,i),t.addBoundsMask(i),r.measurable=!1}function ns(r,t,e){const i=Kt.get();r.measurable=!0;const s=qt.get().identity(),n=Sa(r,e,s);es(r,i,n),r.measurable=!1,t.addBoundsMask(i),qt.return(s),Kt.return(i)}function Sa(r,t,e){return r&&r!==t&&(Sa(r.parent,t,e),r.updateLocalTransform(),e.append(r.localTransform)),e}class Aa{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 $t),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){ss(this.mask,t,e)}addLocalBounds(t,e){ns(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof $t}}Aa.extension=v.MaskEffect;class Ea{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"}}Ea.extension=v.MaskEffect;class wa{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){ss(this.mask,t,e)}addLocalBounds(t,e){ns(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}destroy(){this.reset()}static test(t){return t instanceof rt}}wa.extension=v.MaskEffect;class ae extends et{constructor(t){t.resource||(t.resource=$.get().createCanvas()),t.width||(t.width=t.resource.width,t.autoDensity||(t.width/=t.resolution)),t.height||(t.height=t.resource.height,t.autoDensity||(t.height/=t.resolution)),super(t),this.uploadMethodId="image",this.autoDensity=t.autoDensity;const e=t.resource;(this.pixelWidth!==e.width||this.pixelWidth!==e.height)&&this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&(this.resource.style.width=`${this.width}px`,this.resource.style.height=`${this.height}px`),(this.resource.width!==this.pixelWidth||this.resource.height!==this.pixelHeight)&&(this.resource.width=this.pixelWidth,this.resource.height=this.pixelHeight)}resize(t=this.width,e=this.height,i=this._resolution){const s=super.resize(t,e,i);return s&&this.resizeCanvas(),s}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}ae.extension=v.TextureSource;class De extends et{constructor(t){if(t.resource&&globalThis.HTMLImageElement&&t.resource instanceof HTMLImageElement){const e=$.get().createCanvas(t.resource.width,t.resource.height);e.getContext("2d").drawImage(t.resource,0,0,t.resource.width,t.resource.height),t.resource=e}super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap!="undefined"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}De.extension=v.TextureSource;let Ca;async function Ra(){return Ca!=null||(Ca=(async()=>{var r;const t=document.createElement("canvas").getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(a=>{const o=document.createElement("video");o.onloadeddata=()=>a(o),o.onerror=()=>a(null),o.autoplay=!1,o.crossOrigin="anonymous",o.preload="auto",o.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",o.load()});if(!e)return"premultiply-alpha-on-upload";const i=t.createTexture();t.bindTexture(t.TEXTURE_2D,i);const s=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,s),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,i,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(s),t.deleteTexture(i),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),Ca}var mv=Object.defineProperty,gv=Object.defineProperties,_v=Object.getOwnPropertyDescriptors,bd=Object.getOwnPropertySymbols,bv=Object.prototype.hasOwnProperty,yv=Object.prototype.propertyIsEnumerable,yd=(r,t,e)=>t in r?mv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pa=(r,t)=>{for(var e in t||(t={}))bv.call(t,e)&&yd(r,e,t[e]);if(bd)for(var e of bd(t))yv.call(t,e)&&yd(r,e,t[e]);return r},xv=(r,t)=>gv(r,_v(t));const as=class fy extends et{constructor(t){var e;super(t),this.isReady=!1,this.uploadMethodId="video",t=Pa(Pa({},fy.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=gt.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 Ra(),this._load=new Promise((i,s)=>{this.isValid?i(this):(this._resolve=i,this._reject=s,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(gt.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||(gt.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(gt.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};as.extension=v.TextureSource,as.defaultOptions=xv(Pa({},et.defaultOptions),{autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1}),as.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let Yr=as,vv=class{constructor(){this._parsers=[],this._cache=new Map,this._cacheMap=new Map}reset(){this._cacheMap.clear(),this._cache.clear()}has(t){return this._cache.has(t)}get(t){return this._cache.get(t)}set(t,e){const i=Gt(t);let s;for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.test(e)){s=l.getCacheableAssets(i,e);break}}const n=new Map(Object.entries(s||{}));s||i.forEach(u=>{n.set(u,e)});const a=[...n.keys()],o={cacheKeys:a,keys:i};i.forEach(u=>{this._cacheMap.set(u,o)}),a.forEach(u=>{const l=s?s[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(i=>{this._cache.delete(i)}),e.keys.forEach(i=>{this._cacheMap.delete(i)})}get parsers(){return this._parsers}};const K=new vv,Ma=[];L.handleByList(v.TextureSource,Ma);function Tv(r={}){return Da(r)}function Da(r={}){const t=r&&r.resource,e=t?r.resource:r,i=t?r:{resource:r};for(let s=0;s<Ma.length;s++){const n=Ma[s];if(n.test(e))return new n(i)}throw new Error(`Could not find a source type for resource: ${i.resource}`)}function xd(r={},t=!1){const e=r&&r.resource,i=e?r.resource:r,s=e?r:{resource:r};if(!t&&K.has(i))return K.get(i);const n=new w({source:Da(s)});return n.on("destroy",()=>{K.has(i)&&K.remove(i)}),t||K.set(i,n),n}function vd(r,t=!1){return typeof r=="string"?K.get(r):r instanceof et?new w({source:r}):xd(r,t)}w.from=vd,et.from=Da,L.add(Aa,Ea,wa,Yr,De,ae,Ki);class Zt{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const i in t){const s=t[i];this.setResource(s,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const i in this.resources)t[e++]=this.resources[i]._resourceId;this._key=t.join("|")}setResource(t,e){var i,s;const n=this.resources[e];t!==n&&(n&&((i=t.off)==null||i.call(t,"change",this.onResourceChange,this)),(s=t.on)==null||s.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t){const e=this.resources;for(const i in e)e[i]._touched=t}destroy(){var t;const e=this.resources;for(const i in e){const s=e[i];(t=s.off)==null||t.call(s,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){if(this._dirty=!0,t.destroyed){const e=this.resources;for(const i in e)e[i]===t&&(e[i]=null)}else this._updateKey()}}let qr;function Oa(){return(!qr||qr!=null&&qr.isContextLost())&&(qr=$.get().createCanvas().getContext("webgl",{})),qr}const Sv=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
`);function Av(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 Td(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 i=Sv.replace(/%forloop%/gi,Av(r));if(t.shaderSource(e,i),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 Oe(){var r;if(er)return er;const t=Oa();return er=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),er=Td(er,t),(r=t.getExtension("WEBGL_lose_context"))==null||r.loseContext(),er}const Sd={};function os(r,t){let e=2166136261;for(let i=0;i<t;i++)e^=r[i].uid,e=Math.imul(e,16777619),e>>>=0;return Sd[e]||Ev(r,t,e)}let Ba=0;function Ev(r,t,e){const i={};let s=0;Ba||(Ba=Oe());for(let a=0;a<Ba;a++){const o=a<t?r[a]:w.EMPTY.source;i[s++]=o.source,i[s++]=o.style}const n=new Zt(i);return Sd[e]=n,n}class Ga{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 us(r,t){const e=r.byteLength/8|0,i=new Float64Array(r,0,e);new Float64Array(t,0,e).set(i);const s=r.byteLength-e*8;if(s>0){const n=new Uint8Array(r,e*8,s);new Uint8Array(t,e*8,s).set(n)}}const Ad={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};var ut=(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))(ut||{});function Kr(r,t){return t.alphaMode==="no-premultiply-alpha"&&Ad[r]||r}class Ed{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 wv=Object.defineProperty,wd=Object.getOwnPropertySymbols,Cv=Object.prototype.hasOwnProperty,Rv=Object.prototype.propertyIsEnumerable,Cd=(r,t,e)=>t in r?wv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rd=(r,t)=>{for(var e in t||(t={}))Cv.call(t,e)&&Cd(r,e,t[e]);if(wd)for(var e of wd(t))Rv.call(t,e)&&Cd(r,e,t[e]);return r};class Pd{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Ed,this.blendMode="normal",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null}}const Md=[];let Fa=0;function Dd(){return Fa>0?Md[--Fa]:new Pd}function Od(r){Md[Fa++]=r}let Zr=0;const Bd=class Ln{constructor(t={}){this.uid=J("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[];var e;Ln.defaultOptions.maxTextures=(e=Ln.defaultOptions.maxTextures)!=null?e:Oe(),t=Rd(Rd({},Ln.defaultOptions),t);const{maxTextures:i,attributesInitialSize:s,indicesInitialSize:n}=t;this.attributeBuffer=new Ga(s*4),this.indexBuffer=new Uint16Array(n),this.maxTextures=i}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Od(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 i=t._batch.textures.ids[e._source.uid];return!i&&i!==0?!1:(t._textureId=i,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 i=Dd(),s=i.textures;s.clear();const n=e[this.elementStart];let a=Kr(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 o=this.attributeBuffer.float32View,u=this.attributeBuffer.uint32View,l=this.indexBuffer;let c=this._batchIndexSize,h=this._batchIndexStart,f="startBatch";const p=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const _=e[m];e[m]=null;const g=_.texture._source,b=Kr(_.blendMode,g),x=a!==b;if(g._batchTick===Zr&&!x){_._textureId=g._textureBindLocation,c+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,o,u,_._attributeStart,_._textureId),this.packQuadIndex(l,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,o,u,_._attributeStart,_._textureId),this.packIndex(_,l,_._indexStart,_._attributeStart/this.vertexSize)),_._batch=i;continue}g._batchTick=Zr,(s.count>=p||x)&&(this._finishBatch(i,h,c-h,s,a,t,f),f="renderBatch",h=c,a=b,i=Dd(),s=i.textures,s.clear(),++Zr),_._textureId=g._textureBindLocation=s.count,s.ids[g.uid]=s.count,s.textures[s.count++]=g,_._batch=i,c+=_.indexSize,_.packAsQuad?(this.packQuadAttributes(_,o,u,_._attributeStart,_._textureId),this.packQuadIndex(l,_._indexStart,_._attributeStart/this.vertexSize)):(this.packAttributes(_,o,u,_._attributeStart,_._textureId),this.packIndex(_,l,_._indexStart,_._attributeStart/this.vertexSize))}s.count>0&&(this._finishBatch(i,h,c-h,s,a,t,f),h=c,++Zr),this.elementStart=this.elementSize,this._batchIndexStart=h,this._batchIndexSize=c}_finishBatch(t,e,i,s,n,a,o){t.gpuBindGroup=null,t.bindGroup=null,t.action=o,t.batcher=this,t.textures=s,t.blendMode=n,t.start=e,t.size=i,++Zr,this.batches[this.batchIndex++]=t,a.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),i=new Ga(e);us(this.attributeBuffer.rawBinaryData,i.rawBinaryData),this.attributeBuffer=i}_resizeIndexBuffer(t){const e=this.indexBuffer;let i=Math.max(t,e.length*1.5);i+=i%2;const s=i>65535?new Uint32Array(i):new Uint16Array(i);if(s.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)s[n]=e[n];else us(e.buffer,s.buffer);this.indexBuffer=s}packQuadIndex(t,e,i){t[e]=i+0,t[e+1]=i+1,t[e+2]=i+2,t[e+3]=i+0,t[e+4]=i+2,t[e+5]=i+3}packIndex(t,e,i,s){const n=t.indices,a=t.indexSize,o=t.indexOffset,u=t.attributeOffset;for(let l=0;l<a;l++)e[i++]=s+n[l+o]-u}destroy(){for(let t=0;t<this.batches.length;t++)Od(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}};Bd.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Gd=Bd;var z=(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))(z||{});class Pt extends Rt{constructor(t){let{data:e,size:i}=t;const{usage:s,label:n,shrinkToFit:a}=t;super(),this.uid=J("buffer"),this._resourceType="buffer",this._resourceId=J("resource"),this._touched=0,this._updateID=1,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,i=i!=null?i:e==null?void 0:e.byteLength;const o=!!e;this.descriptor={size:i,usage:s,mappedAtCreation:o,label:n},this.shrinkToFit=a!=null?a:!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get static(){return!!(this.descriptor.usage&z.STATIC)}set static(t){t?this.descriptor.usage|=z.STATIC:this.descriptor.usage&=~z.STATIC}setDataWithSize(t,e,i){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){i&&this.emit("update",this);return}const s=this._data;if(this._data=t,s.length!==t.length){!this.shrinkToFit&&t.byteLength<s.byteLength?i&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=J("resource"),this.emit("change",this));return}i&&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 Ia(r,t){if(!(r instanceof Pt)){let e=t?z.INDEX:z.VERTEX;r instanceof Array&&(t?(r=new Uint32Array(r),e=z.INDEX|z.COPY_DST):(r=new Float32Array(r),e=z.VERTEX|z.COPY_DST)),r=new Pt({data:r,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return r}function Fd(r,t,e){const i=r.getAttribute(t);if(!i)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const s=i.buffer.data;let n=1/0,a=1/0,o=-1/0,u=-1/0;const l=s.BYTES_PER_ELEMENT,c=(i.offset||0)/l,h=(i.stride||2*4)/l;for(let f=c;f<s.length;f+=h){const p=s[f],m=s[f+1];p>o&&(o=p),m>u&&(u=m),p<n&&(n=p),m<a&&(a=m)}return e.minX=n,e.minY=a,e.maxX=o,e.maxY=u,e}function Pv(r){return(r instanceof Pt||Array.isArray(r)||r.BYTES_PER_ELEMENT)&&(r={buffer:r}),r.buffer=Ia(r.buffer,!1),r}class rr extends Rt{constructor(t){const{attributes:e,indexBuffer:i,topology:s}=t;super(),this.uid=J("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new ft,this._boundsDirty=!0,this.attributes=e,this.buffers=[],this.instanceCount=t.instanceCount||1;for(const n in e){const a=e[n]=Pv(e[n]);this.buffers.indexOf(a.buffer)===-1&&(this.buffers.push(a.buffer),a.buffer.on("update",this.onBufferUpdate,this),a.buffer.on("change",this.onBufferUpdate,this))}i&&(this.indexBuffer=Ia(i,!0),this.buffers.push(this.indexBuffer)),this.topology=s||"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,Fd(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 Mv=new Float32Array(1),Dv=new Uint32Array(1);class Id extends rr{constructor(){const t=new Pt({data:Mv,label:"attribute-batch-buffer",usage:z.VERTEX|z.COPY_DST,shrinkToFit:!1}),e=new Pt({data:Dv,label:"index-batch-buffer",usage:z.INDEX|z.COPY_DST,shrinkToFit:!1}),i=6*4;super({attributes:{aPosition:{buffer:t,format:"float32x2",stride:i,offset:0},aUV:{buffer:t,format:"float32x2",stride:i,offset:8},aColor:{buffer:t,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:t,format:"uint16x2",stride:i,offset:20}},indexBuffer:e})}}const Ua=Object.create(null),Ud=Object.create(null);function ir(r,t){let e=Ud[r];return e===void 0&&(Ua[t]===void 0&&(Ua[t]=1),Ud[r]=e=Ua[t]++),e}let ls;function kd(){if(!ls){ls="mediump";const r=Oa();r&&r.getShaderPrecisionFormat&&(ls=r.getShaderPrecisionFormat(r.FRAGMENT_SHADER,r.HIGH_FLOAT).precision?"highp":"mediump")}return ls}function Ld(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 Nd(r,t,e){const i=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(r.substring(0,9)!=="precision"){let s=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return s==="highp"&&i!=="highp"&&(s="mediump"),`precision ${s} float;
${r}`}else if(i!=="highp"&&r.substring(0,15)==="precision highp")return r.replace("precision highp","precision mediump");return r}function $d(r,t){return t?`#version 300 es
${r}`:r}const Ov={},Bv={};function Hd(r,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const i=e?Ov:Bv;return i[t]?(i[t]++,t+=`-${i[t]}`):i[t]=1,r.indexOf("#define SHADER_NAME")!==-1?r:`${`#define SHADER_NAME ${t}`}
${r}`}function Xd(r,t){return t?r.replace("#version 300 es",""):r}var Gv=Object.defineProperty,zd=Object.getOwnPropertySymbols,Fv=Object.prototype.hasOwnProperty,Iv=Object.prototype.propertyIsEnumerable,jd=(r,t,e)=>t in r?Gv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vd=(r,t)=>{for(var e in t||(t={}))Fv.call(t,e)&&jd(r,e,t[e]);if(zd)for(var e of zd(t))Iv.call(t,e)&&jd(r,e,t[e]);return r};const ka={stripVersion:Xd,ensurePrecision:Nd,addProgramDefines:Ld,setProgramName:Hd,insertVersion:$d},La=Object.create(null),Wd=class pc{constructor(t){t=Vd(Vd({},pc.defaultOptions),t);const e=t.fragment.indexOf("#version 300 es")!==-1,i={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:kd()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let s=t.fragment,n=t.vertex;Object.keys(ka).forEach(a=>{const o=i[a];s=ka[a](s,o,!0),n=ka[a](n,o,!1)}),this.fragment=s,this.vertex=n,this._key=ir(`${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 La[e]||(La[e]=new pc(t)),La[e]}};Wd.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let It=Wd;const Yd={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 sr(r){var t;return(t=Yd[r])!=null?t:Yd.float32}const Uv={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 i={},s=r.indexOf(`fn ${t}`);if(s!==-1){const n=r.indexOf("->",s);if(n!==-1){const a=r.substring(s,n),o=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|$)/g;let u;for(;(u=o.exec(a))!==null;){const l=(e=Uv[u[3]])!=null?e:"float32";i[u[2]]={location:parseInt(u[1],10),format:l,stride:sr(l).stride,offset:0,instance:!1,start:0}}}}return i}function cs(r){var t,e,i;const s=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,n=/@group\((\d+)\)/,a=/@binding\((\d+)\)/,o=/var(<[^>]+>)? (\w+)/,u=/:\s*(\w+)/,l=/struct\s+(\w+)\s*{([^}]+)}/g,c=/(\w+)\s*:\s*([\w\<\>]+)/g,h=/struct\s+(\w+)/,f=(t=r.match(s))==null?void 0:t.map(m=>({group:parseInt(m.match(n)[1],10),binding:parseInt(m.match(a)[1],10),name:m.match(o)[2],isUniform:m.match(o)[1]==="<uniform>",type:m.match(u)[1]}));if(!f)return{groups:[],structs:[]};const p=(i=(e=r.match(l))==null?void 0:e.map(m=>{const _=m.match(h)[1],g=m.match(c).reduce((b,x)=>{const[y,T]=x.split(":");return b[y.trim()]=T.trim(),b},{});return g?{name:_,members:g}:null}).filter(({name:m})=>f.some(_=>_.type===m)))!=null?i:[];return{groups:f,structs:p}}var nr=(r=>(r[r.VERTEX=1]="VERTEX",r[r.FRAGMENT=2]="FRAGMENT",r[r.COMPUTE=4]="COMPUTE",r))(nr||{});function Kd({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]=[]),i.isUniform?t[i.group].push({binding:i.binding,visibility:nr.VERTEX|nr.FRAGMENT,buffer:{type:"uniform"}}):i.type==="sampler"?t[i.group].push({binding:i.binding,visibility:nr.FRAGMENT,sampler:{type:"filtering"}}):i.type==="texture_2d"&&t[i.group].push({binding:i.binding,visibility:nr.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}})}return t}function Zd({groups:r}){const t=[];for(let e=0;e<r.length;e++){const i=r[e];t[i.group]||(t[i.group]={}),t[i.group][i.name]=i.binding}return t}function Qd(r,t){const e=new Set,i=new Set,s=[...r.structs,...t.structs].filter(a=>e.has(a.name)?!1:(e.add(a.name),!0)),n=[...r.groups,...t.groups].filter(a=>{const o=`${a.name}-${a.binding}`;return i.has(o)?!1:(i.add(o),!0)});return{structs:s,groups:n}}const Na=Object.create(null);class Mt{constructor(t){this._layoutKey=0,this._attributeLocationsKey=0;var e,i;const{fragment:s,vertex:n,layout:a,gpuLayout:o,name:u}=t;if(this.name=u,this.fragment=s,this.vertex=n,s.source===n.source){const l=cs(s.source);this.structsAndGroups=l}else{const l=cs(n.source),c=cs(s.source);this.structsAndGroups=Qd(l,c)}this.layout=a!=null?a:Zd(this.structsAndGroups),this.gpuLayout=o!=null?o:Kd(this.structsAndGroups),this.autoAssignGlobalUniforms=((e=this.layout[0])==null?void 0:e.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((i=this.layout[1])==null?void 0:i.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,i=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=ir(i,"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 Na[e]||(Na[e]=new Mt(t)),Na[e]}}function $a(r,t,e){if(r)for(const i in r){const s=i.toLocaleLowerCase(),n=t[s];if(n){let a=r[i];i==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(a)}}}const Jd=/\{\{(.*?)\}\}/g;function Ha(r){var t,e;const i={};return((e=(t=r.match(Jd))==null?void 0:t.map(s=>s.replace(/[{()}]/g,"")))!=null?e:[]).forEach(s=>{i[s]=[]}),i}function tf(r,t){let e;const i=/@in\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function Xa(r,t,e=!1){const i=[];tf(t,i),r.forEach(o=>{o.header&&tf(o.header,i)});const s=i;e&&s.sort();const n=s.map((o,u)=>` @location(${u}) ${o},`).join(`
`);let a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
${n}
`),a}function ef(r,t){let e;const i=/@out\s+([^;]+);/g;for(;(e=i.exec(r))!==null;)t.push(e[1])}function kv(r){const t=/\b(\w+)\s*:/g.exec(r);return t?t[1]:""}function Lv(r){const t=/@.*?\s+/g;return r.replace(t,"")}function rf(r,t){const e=[];ef(t,e),r.forEach(u=>{u.header&&ef(u.header,e)});let i=0;const s=e.sort().map(u=>u.indexOf("builtin")>-1?u:`@location(${i++}) ${u}`).join(`,
`),n=e.sort().map(u=>` var ${Lv(u)};`).join(`
`),a=`return VSOutput(
${e.sort().map(u=>` ${kv(u)}`).join(`,
`)});`;let o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
${s}
`),o=o.replace("{{start}}",`
${n}
`),o=o.replace("{{return}}",`
${a}
`),o}function za(r,t){let e=r;for(const i in t){const s=t[i];s.join(`
`).length?e=e.replace(`{{${i}}}`,`//-----${i} START-----//
${s.join(`
`)}
//----${i} FINISH----//`):e=e.replace(`{{${i}}}`,"")}return e}const Be=Object.create(null),ja=new Map;let Nv=0;function sf({template:r,bits:t}){const e=af(r,t);if(Be[e])return Be[e];const{vertex:i,fragment:s}=$v(r,t);return Be[e]=of(i,s,t),Be[e]}function nf({template:r,bits:t}){const e=af(r,t);return Be[e]||(Be[e]=of(r.vertex,r.fragment,t)),Be[e]}function $v(r,t){const e=t.map(a=>a.vertex).filter(a=>!!a),i=t.map(a=>a.fragment).filter(a=>!!a);let s=Xa(e,r.vertex,!0);s=rf(e,s);const n=Xa(i,r.fragment,!0);return{vertex:s,fragment:n}}function af(r,t){return t.map(e=>(ja.has(e)||ja.set(e,Nv++),ja.get(e))).sort((e,i)=>e-i).join("-")+r.vertex+r.fragment}function of(r,t,e){const i=Ha(r),s=Ha(t);return e.forEach(n=>{$a(n.vertex,i,n.name),$a(n.fragment,s,n.name)}),{vertex:za(r,i),fragment:za(t,s)}}const uf=`
@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}}
};
`,lf=`
@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;
};
`,cf=`
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}}
}
`,hf=`
in vec4 vColor;
in vec2 vUV;
out vec4 finalColor;
{{header}}
void main(void) {
{{start}}
vec4 outColor;
{{main}}
finalColor = outColor * vColor;
{{end}}
}
`,df={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;
`}},Hv={name:"global-uniforms-ubo-bit",vertex:{header:`
uniform globalUniforms {
mat3 uProjectionMatrix;
mat3 uWorldTransformMatrix;
vec4 uWorldColorAlpha;
vec2 uResolution;
};
`}},ff={name:"global-uniforms-bit",vertex:{header:`
uniform mat3 uProjectionMatrix;
uniform mat3 uWorldTransformMatrix;
uniform vec4 uWorldColorAlpha;
uniform vec2 uResolution;
`}};var Xv=Object.defineProperty,pf=Object.getOwnPropertySymbols,zv=Object.prototype.hasOwnProperty,jv=Object.prototype.propertyIsEnumerable,mf=(r,t,e)=>t in r?Xv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Vv=(r,t)=>{for(var e in t||(t={}))zv.call(t,e)&&mf(r,e,t[e]);if(pf)for(var e of pf(t))jv.call(t,e)&&mf(r,e,t[e]);return r};function ar({bits:r,name:t}){const e=sf({template:{fragment:lf,vertex:uf},bits:[df,...r]});return Mt.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function or({bits:r,name:t}){return new It(Vv({name:t},nf({template:{vertex:cf,fragment:hf},bits:[ff,...r]})))}const hs={name:"color-bit",vertex:{header:`
@in aColor: vec4<f32>;
`,main:`
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
`}},ds={name:"color-bit",vertex:{header:`
in vec4 aColor;
`,main:`
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
`}},Va={};function Wv(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 i=0;i<r;i++)t.push(`@group(1) @binding(${e++}) var textureSource${i+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${i+1}: sampler;`)}return t.join(`
`)}function Yv(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 fs(r){return Va[r]||(Va[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;
${Wv(r)}
`,main:`
var uvDx = dpdx(vUV);
var uvDy = dpdy(vUV);
${Yv(r)}
`}}),Va[r]}const Wa={};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 ps(r){return Wa[r]||(Wa[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)}
`}}),Wa[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;
}
`}},Ya=["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>"],gf=Ya.reduce((r,t)=>(r[t]=!0,r),{});function _f(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 Kv=Object.defineProperty,bf=Object.getOwnPropertySymbols,Zv=Object.prototype.hasOwnProperty,Qv=Object.prototype.propertyIsEnumerable,yf=(r,t,e)=>t in r?Kv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xf=(r,t)=>{for(var e in t||(t={}))Zv.call(t,e)&&yf(r,e,t[e]);if(bf)for(var e of bf(t))Qv.call(t,e)&&yf(r,e,t[e]);return r};const vf=class py{constructor(t,e){this._touched=0,this.uid=J("uniform"),this._resourceType="uniformGroup",this._resourceId=J("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1;var i,s;e=xf(xf({},py.defaultOptions),e),this.uniformStructures=t;const n={};for(const a in t){const o=t[a];if(o.name=a,o.size=(i=o.size)!=null?i:1,!gf[o.type])throw new Error(`Uniform type ${o.type} is not supported. Supported uniform types are: ${Ya.join(", ")}`);(s=o.value)!=null||(o.value=_f(o.type,o.size)),n[a]=o.value}this.uniforms=n,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=ir(Object.keys(n).map(a=>`${a}-${t[a].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};vf.defaultOptions={ubo:!1,isStatic:!1};let ot=vf;const Tf={};function ms(r){let t=Tf[r];if(t)return t;const e=new Int32Array(r);for(let i=0;i<r;i++)e[i]=i;return t=Tf[r]=new ot({uTextures:{value:e,type:"i32",size:r}},{isStatic:!0}),t}var St=(r=>(r[r.WEBGL=1]="WEBGL",r[r.WEBGPU=2]="WEBGPU",r[r.BOTH=3]="BOTH",r))(St||{}),Jv=Object.defineProperty,gs=Object.getOwnPropertySymbols,Sf=Object.prototype.hasOwnProperty,Af=Object.prototype.propertyIsEnumerable,Ef=(r,t,e)=>t in r?Jv(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,t1=(r,t)=>{for(var e in t||(t={}))Sf.call(t,e)&&Ef(r,e,t[e]);if(gs)for(var e of gs(t))Af.call(t,e)&&Ef(r,e,t[e]);return r},e1=(r,t)=>{var e={};for(var i in r)Sf.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&gs)for(var i of gs(r))t.indexOf(i)<0&&Af.call(r,i)&&(e[i]=r[i]);return e};class Ut extends Rt{constructor(t){super(),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[];let{gpuProgram:e,glProgram:i,groups:s,resources:n,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=e,this.glProgram=i,a===void 0&&(a=0,e&&(a|=St.WEBGPU),i&&(a|=St.WEBGL)),this.compatibleRenderers=a;const u={};if(!n&&!s&&(n={}),n&&s)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&s&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&s&&o)for(const l in o)for(const c in o[l]){const h=o[l][c];u[h]={group:l,binding:c,name:h}}else if(e&&s&&!o){const l=e.structsAndGroups.groups;o={},l.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,u[c.name]=c})}else if(n){s={},o={},e&&e.structsAndGroups.groups.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,u[c.name]=c});let l=0;for(const c in n)u[c]||(s[99]||(s[99]=new Zt,this._ownedBindGroups.push(s[99])),u[c]={group:99,binding:l,name:c},o[99]=o[99]||{},o[99][l]=c,l++);for(const c in n){const h=c;let f=n[c];!f.source&&!f._resourceType&&(f=new ot(f));const p=u[h];p&&(s[p.group]||(s[p.group]=new Zt,this._ownedBindGroups.push(s[p.group])),s[p.group].setResource(f,p.binding))}}this.groups=s,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(s,u)}addResource(t,e,i){var s,n;(s=this._uniformBindMap)[e]||(s[e]={}),(n=this._uniformBindMap[e])[i]||(n[i]=t),this.groups[e]||(this.groups[e]=new Zt,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const i={};for(const s in e){const n=e[s];Object.defineProperty(i,n.name,{get(){return t[n.group].getResource(n.binding)},set(a){t[n.group].setResource(a,n.binding)}})}return i}destroy(t=!1){var e,i;this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(i=this.glProgram)==null||i.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(s=>{s.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null}static from(t){const e=t,{gpu:i,gl:s}=e,n=e1(e,["gpu","gl"]);let a,o;return i&&(a=Mt.from(i)),s&&(o=It.from(s)),new Ut(t1({gpuProgram:a,glProgram:o},n))}}class wf extends Ut{constructor(t){const e=or({name:"batch",bits:[ds,ps(t),lr]}),i=ar({name:"batch",bits:[hs,fs(t),ur]});super({glProgram:e,gpuProgram:i,resources:{batchSamplers:ms(t)}})}}let Cf=null;const Rf=class my extends Gd{constructor(){super(...arguments),this.geometry=new Id,this.shader=Cf||(Cf=new wf(this.maxTextures)),this.name=my.extension.name,this.vertexSize=6}packAttributes(t,e,i,s,n){const a=n<<16|t.roundPixels&65535,o=t.transform,u=o.a,l=o.b,c=o.c,h=o.d,f=o.tx,p=o.ty,{positions:m,uvs:_}=t,g=t.color,b=t.attributeOffset,x=b+t.attributeSize;for(let y=b;y<x;y++){const T=y*2,A=m[T],R=m[T+1];e[s++]=u*A+c*R+f,e[s++]=h*R+l*A+p,e[s++]=_[T],e[s++]=_[T+1],i[s++]=g,i[s++]=a}}packQuadAttributes(t,e,i,s,n){const a=t.texture,o=t.transform,u=o.a,l=o.b,c=o.c,h=o.d,f=o.tx,p=o.ty,m=t.bounds,_=m.maxX,g=m.minX,b=m.maxY,x=m.minY,y=a.uvs,T=t.color,A=n<<16|t.roundPixels&65535;e[s+0]=u*g+c*x+f,e[s+1]=h*x+l*g+p,e[s+2]=y.x0,e[s+3]=y.y0,i[s+4]=T,i[s+5]=A,e[s+6]=u*_+c*x+f,e[s+7]=h*x+l*_+p,e[s+8]=y.x1,e[s+9]=y.y1,i[s+10]=T,i[s+11]=A,e[s+12]=u*_+c*b+f,e[s+13]=h*b+l*_+p,e[s+14]=y.x2,e[s+15]=y.y2,i[s+16]=T,i[s+17]=A,e[s+18]=u*g+c*b+f,e[s+19]=h*b+l*g+p,e[s+20]=y.x3,e[s+21]=y.y3,i[s+22]=T,i[s+23]=A}};Rf.extension={type:[v.Batcher],name:"default"};let _s=Rf;const Pf={},r1="8.0.0",Mf="8.3.4";function qa(r,t,e=3){if(Pf[t])return;let i=new Error().stack;typeof i=="undefined"?console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`):(i=i.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(i),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",`${t}
Deprecated since v${r}`),console.warn(i))),Pf[t]=!0}function Ka(r,t,e,i,s,n,a,o=null){let u=0;e*=t,s*=n;const l=o.a,c=o.b,h=o.c,f=o.d,p=o.tx,m=o.ty;for(;u<a;){const _=r[e],g=r[e+1];i[s]=l*_+h*g+p,i[s+1]=c*_+f*g+m,s+=n,e+=t,u++}}function Za(r,t,e,i){let s=0;for(t*=e;s<i;)r[t]=0,r[t+1]=0,t+=e,s++}function bs(r,t,e,i,s){const n=t.a,a=t.b,o=t.c,u=t.d,l=t.tx,c=t.ty;e=e||0,i=i||2,s=s||r.length/i-e;let h=e*i;for(let f=0;f<s;f++){const p=r[h],m=r[h+1];r[h]=n*p+o*m+l,r[h+1]=a*p+u*m+c,h+=i}}function Df(r,t){if(r===16777215||!t)return t;if(t===16777215||!r)return r;const e=r>>16&255,i=r>>8&255,s=r&255,n=t>>16&255,a=t>>8&255,o=t&255,u=e*n/255,l=i*a/255,c=s*o/255;return(u<<16)+(l<<8)+c}const i1=new G;class ys{constructor(){this.packAsQuad=!1,this.batcherName="default",this.applyTransform=!0,this.roundPixels=0,this._batcher=null,this._batch=null}get uvs(){return this.geometryData.uvs}get positions(){return this.geometryData.vertices}get indices(){return this.geometryData.indices}get blendMode(){return this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,i=this.renderable;return i?Df(e,i.groupColor)+(this.alpha*i.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||i1}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 s1=Object.defineProperty,n1=Object.defineProperties,a1=Object.getOwnPropertyDescriptors,Of=Object.getOwnPropertySymbols,o1=Object.prototype.hasOwnProperty,u1=Object.prototype.propertyIsEnumerable,Bf=(r,t,e)=>t in r?s1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,xs=(r,t)=>{for(var e in t||(t={}))o1.call(t,e)&&Bf(r,e,t[e]);if(Of)for(var e of Of(t))u1.call(t,e)&&Bf(r,e,t[e]);return r},vs=(r,t)=>n1(r,a1(t));const oe={extension:{type:v.ShapeBuilder,name:"circle"},build(r,t){let e,i,s,n,a,o;if(r.type==="circle"){const T=r;e=T.x,i=T.y,a=o=T.radius,s=n=0}else if(r.type==="ellipse"){const T=r;e=T.x,i=T.y,a=T.halfWidth,o=T.halfHeight,s=n=0}else{const T=r,A=T.width/2,R=T.height/2;e=T.x+A,i=T.y+R,a=o=Math.max(0,Math.min(T.radius,Math.min(A,R))),s=A-a,n=R-o}if(!(a>=0&&o>=0&&s>=0&&n>=0))return t;const u=Math.ceil(2.3*Math.sqrt(a+o)),l=u*8+(s?4:0)+(n?4:0);if(l===0)return t;if(u===0)return t[0]=t[6]=e+s,t[1]=t[3]=i+n,t[2]=t[4]=e-s,t[5]=t[7]=i-n,t;let c=0,h=u*4+(s?2:0)+2,f=h,p=l,m=s+a,_=n,g=e+m,b=e-m,x=i+_;if(t[c++]=g,t[c++]=x,t[--h]=x,t[--h]=b,n){const T=i-_;t[f++]=b,t[f++]=T,t[--p]=T,t[--p]=g}for(let T=1;T<u;T++){const A=Math.PI/2*(T/u),R=s+Math.cos(A)*a,C=n+Math.sin(A)*o,P=e+R,S=e-R,E=i+C,F=i-C;t[c++]=P,t[c++]=E,t[--h]=E,t[--h]=S,t[f++]=S,t[f++]=F,t[--p]=F,t[--p]=P}m=s,_=n+o,g=e+m,b=e-m,x=i+_;const y=i-_;return t[c++]=g,t[c++]=x,t[--p]=y,t[--p]=g,s&&(t[c++]=b,t[c++]=x,t[--p]=y,t[--p]=b),t},triangulate(r,t,e,i,s,n){if(r.length===0)return;let a=0,o=0;for(let c=0;c<r.length;c+=2)a+=r[c],o+=r[c+1];a/=r.length/2,o/=r.length/2;let u=i;t[u*e]=a,t[u*e+1]=o;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&&(s[n++]=u,s[n++]=l,s[n++]=u-1),u++;s[n++]=l+1,s[n++]=l,s[n++]=u-1}},Gf=vs(xs({},oe),{extension:vs(xs({},oe.extension),{name:"ellipse"})}),Ff=vs(xs({},oe),{extension:vs(xs({},oe.extension),{name:"roundedRectangle"})}),If=1e-4,Qa=1e-4;function Uf(r){const t=r.length;if(t<6)return 1;let e=0;for(let i=0,s=r[t-2],n=r[t-1];i<t;i+=2){const a=r[i],o=r[i+1];e+=(a-s)*(o+n),s=a,n=o}return e<0?-1:1}function kf(r,t,e,i,s,n,a,o){const u=r-e*s,l=t-i*s,c=r+e*n,h=t+i*n;let f,p;a?(f=i,p=-e):(f=-i,p=e);const m=u+f,_=l+p,g=c+f,b=h+p;return o.push(m,_),o.push(g,b),2}function Ge(r,t,e,i,s,n,a,o){const u=e-r,l=i-t;let c=Math.atan2(u,l),h=Math.atan2(s-r,n-t);o&&c<h?c+=Math.PI*2:!o&&c>h&&(h+=Math.PI*2);let f=c;const p=h-c,m=Math.abs(p),_=Math.sqrt(u*u+l*l),g=(15*m*Math.sqrt(_)/Math.PI>>0)+1,b=p/g;if(f+=b,o){a.push(r,t),a.push(e,i);for(let x=1,y=f;x<g;x++,y+=b)a.push(r,t),a.push(r+Math.sin(y)*_,t+Math.cos(y)*_);a.push(r,t),a.push(s,n)}else{a.push(e,i),a.push(r,t);for(let x=1,y=f;x<g;x++,y+=b)a.push(r+Math.sin(y)*_,t+Math.cos(y)*_),a.push(r,t);a.push(s,n),a.push(r,t)}return g*2}function Lf(r,t,e,i,s,n,a,o,u){const l=If;if(r.length===0)return;const c=t;let h=c.alignment;if(t.alignment!==.5){let Q=Uf(r);e&&(Q*=-1),h=(h-.5)*Q+.5}const f=new nt(r[0],r[1]),p=new nt(r[r.length-2],r[r.length-1]),m=i,_=Math.abs(f.x-p.x)<l&&Math.abs(f.y-p.y)<l;if(m){r=r.slice(),_&&(r.pop(),r.pop(),p.set(r[r.length-2],r[r.length-1]));const Q=(f.x+p.x)*.5,Se=(p.y+f.y)*.5;r.unshift(Q,Se),r.push(Q,Se)}const g=s,b=r.length/2;let x=r.length;const y=g.length/2,T=c.width/2,A=T*T,R=c.miterLimit*c.miterLimit;let C=r[0],P=r[1],S=r[2],E=r[3],F=0,N=0,O=-(P-E),B=C-S,q=0,D=0,Z=Math.sqrt(O*O+B*B);O/=Z,B/=Z,O*=T,B*=T;const wr=h,I=(1-wr)*2,k=wr*2;m||(c.cap==="round"?x+=Ge(C-O*(I-k)*.5,P-B*(I-k)*.5,C-O*I,P-B*I,C+O*k,P+B*k,g,!0)+2:c.cap==="square"&&(x+=kf(C,P,O,B,I,k,!0,g))),g.push(C-O*I,P-B*I),g.push(C+O*k,P+B*k);for(let Q=1;Q<b-1;++Q){C=r[(Q-1)*2],P=r[(Q-1)*2+1],S=r[Q*2],E=r[Q*2+1],F=r[(Q+1)*2],N=r[(Q+1)*2+1],O=-(P-E),B=C-S,Z=Math.sqrt(O*O+B*B),O/=Z,B/=Z,O*=T,B*=T,q=-(E-N),D=S-F,Z=Math.sqrt(q*q+D*D),q/=Z,D/=Z,q*=T,D*=T;const Se=S-C,Mi=P-E,Di=S-F,Oi=N-E,oy=Se*Di+Mi*Oi,In=Mi*Di-Oi*Se,Bi=In<0;if(Math.abs(In)<.001*Math.abs(oy)){g.push(S-O*I,E-B*I),g.push(S+O*k,E+B*k),oy>=0&&(c.join==="round"?x+=Ge(S,E,S-O*I,E-B*I,S-q*I,E-D*I,g,!1)+4:x+=2,g.push(S-q*k,E-D*k),g.push(S+q*I,E+D*I));continue}const uy=(-O+C)*(-B+E)-(-O+S)*(-B+P),ly=(-q+F)*(-D+E)-(-q+S)*(-D+N),Un=(Se*ly-Di*uy)/In,kn=(Oi*uy-Mi*ly)/In,fc=(Un-S)*(Un-S)+(kn-E)*(kn-E),Ne=S+(Un-S)*I,$e=E+(kn-E)*I,He=S-(Un-S)*k,Xe=E-(kn-E)*k,AR=Math.min(Se*Se+Mi*Mi,Di*Di+Oi*Oi),cy=Bi?I:k,ER=AR+cy*cy*A;fc<=ER?c.join==="bevel"||fc/A>R?(Bi?(g.push(Ne,$e),g.push(S+O*k,E+B*k),g.push(Ne,$e),g.push(S+q*k,E+D*k)):(g.push(S-O*I,E-B*I),g.push(He,Xe),g.push(S-q*I,E-D*I),g.push(He,Xe)),x+=2):c.join==="round"?Bi?(g.push(Ne,$e),g.push(S+O*k,E+B*k),x+=Ge(S,E,S+O*k,E+B*k,S+q*k,E+D*k,g,!0)+4,g.push(Ne,$e),g.push(S+q*k,E+D*k)):(g.push(S-O*I,E-B*I),g.push(He,Xe),x+=Ge(S,E,S-O*I,E-B*I,S-q*I,E-D*I,g,!1)+4,g.push(S-q*I,E-D*I),g.push(He,Xe)):(g.push(Ne,$e),g.push(He,Xe)):(g.push(S-O*I,E-B*I),g.push(S+O*k,E+B*k),c.join==="round"?Bi?x+=Ge(S,E,S+O*k,E+B*k,S+q*k,E+D*k,g,!0)+2:x+=Ge(S,E,S-O*I,E-B*I,S-q*I,E-D*I,g,!1)+2:c.join==="miter"&&fc/A<=R&&(Bi?(g.push(He,Xe),g.push(He,Xe)):(g.push(Ne,$e),g.push(Ne,$e)),x+=2),g.push(S-q*I,E-D*I),g.push(S+q*k,E+D*k),x+=2)}C=r[(b-2)*2],P=r[(b-2)*2+1],S=r[(b-1)*2],E=r[(b-1)*2+1],O=-(P-E),B=C-S,Z=Math.sqrt(O*O+B*B),O/=Z,B/=Z,O*=T,B*=T,g.push(S-O*I,E-B*I),g.push(S+O*k,E+B*k),m||(c.cap==="round"?x+=Ge(S-O*(I-k)*.5,E-B*(I-k)*.5,S-O*I,E-B*I,S+O*k,E+B*k,g,!1)+2:c.cap==="square"&&(x+=kf(S,E,O,B,I,k,!1,g)));const SR=Qa*Qa;for(let Q=y;Q<x+y-2;++Q)C=g[Q*2],P=g[Q*2+1],S=g[(Q+1)*2],E=g[(Q+1)*2+1],F=g[(Q+2)*2],N=g[(Q+2)*2+1],!(Math.abs(C*(E-N)+S*(N-P)+F*(P-E))<SR)&&o.push(Q,Q+1,Q+2)}var Ts={exports:{}},dP=Ts.exports;Ts.exports=Ss;var fP=Ts.exports.default=Ss;function Ss(r,t,e){e=e||2;var i=t&&t.length,s=i?t[0]*e:r.length,n=Nf(r,0,s,e,!0),a=[];if(!n||n.next===n.prev)return a;var o,u,l,c,h,f,p;if(i&&(n=f1(r,t,n,e)),r.length>80*e){o=l=r[0],u=c=r[1];for(var m=e;m<s;m+=e)h=r[m],f=r[m+1],h<o&&(o=h),f<u&&(u=f),h>l&&(l=h),f>c&&(c=f);p=Math.max(l-o,c-u),p=p!==0?32767/p:0}return Qr(n,a,e,o,u,p,0),a}function Nf(r,t,e,i,s){var n,a;if(s===eo(r,t,e,i)>0)for(n=t;n<e;n+=i)a=Xf(n,r[n],r[n+1],a);else for(n=e-i;n>=t;n-=i)a=Xf(n,r[n],r[n+1],a);return a&&As(a,a.next)&&(ti(a),a=a.next),a}function Fe(r,t){if(!r)return r;t||(t=r);var e=r,i;do if(i=!1,!e.steiner&&(As(e,e.next)||tt(e.prev,e,e.next)===0)){if(ti(e),e=t=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==t);return t}function Qr(r,t,e,i,s,n,a){if(r){!a&&n&&b1(r,i,s,n);for(var o=r,u,l;r.prev!==r.next;){if(u=r.prev,l=r.next,n?c1(r,i,s,n):l1(r)){t.push(u.i/e|0),t.push(r.i/e|0),t.push(l.i/e|0),ti(r),r=l.next,o=l.next;continue}if(r=l,r===o){a?a===1?(r=h1(Fe(r),t,e),Qr(r,t,e,i,s,n,2)):a===2&&d1(r,t,e,i,s,n):Qr(Fe(r),t,e,i,s,n,1);break}}}}function l1(r){var t=r.prev,e=r,i=r.next;if(tt(t,e,i)>=0)return!1;for(var s=t.x,n=e.x,a=i.x,o=t.y,u=e.y,l=i.y,c=s<n?s<a?s:a:n<a?n:a,h=o<u?o<l?o:l:u<l?u:l,f=s>n?s>a?s:a:n>a?n:a,p=o>u?o>l?o:l:u>l?u:l,m=i.next;m!==t;){if(m.x>=c&&m.x<=f&&m.y>=h&&m.y<=p&&cr(s,o,n,u,a,l,m.x,m.y)&&tt(m.prev,m,m.next)>=0)return!1;m=m.next}return!0}function c1(r,t,e,i){var s=r.prev,n=r,a=r.next;if(tt(s,n,a)>=0)return!1;for(var o=s.x,u=n.x,l=a.x,c=s.y,h=n.y,f=a.y,p=o<u?o<l?o:l:u<l?u:l,m=c<h?c<f?c:f:h<f?h:f,_=o>u?o>l?o:l:u>l?u:l,g=c>h?c>f?c:f:h>f?h:f,b=Ja(p,m,t,e,i),x=Ja(_,g,t,e,i),y=r.prevZ,T=r.nextZ;y&&y.z>=b&&T&&T.z<=x;){if(y.x>=p&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&cr(o,c,u,h,l,f,y.x,y.y)&&tt(y.prev,y,y.next)>=0||(y=y.prevZ,T.x>=p&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==a&&cr(o,c,u,h,l,f,T.x,T.y)&&tt(T.prev,T,T.next)>=0))return!1;T=T.nextZ}for(;y&&y.z>=b;){if(y.x>=p&&y.x<=_&&y.y>=m&&y.y<=g&&y!==s&&y!==a&&cr(o,c,u,h,l,f,y.x,y.y)&&tt(y.prev,y,y.next)>=0)return!1;y=y.prevZ}for(;T&&T.z<=x;){if(T.x>=p&&T.x<=_&&T.y>=m&&T.y<=g&&T!==s&&T!==a&&cr(o,c,u,h,l,f,T.x,T.y)&&tt(T.prev,T,T.next)>=0)return!1;T=T.nextZ}return!0}function h1(r,t,e){var i=r;do{var s=i.prev,n=i.next.next;!As(s,n)&&$f(s,i,i.next,n)&&Jr(s,n)&&Jr(n,s)&&(t.push(s.i/e|0),t.push(i.i/e|0),t.push(n.i/e|0),ti(i),ti(i.next),i=r=n),i=i.next}while(i!==r);return Fe(i)}function d1(r,t,e,i,s,n){var a=r;do{for(var o=a.next.next;o!==a.prev;){if(a.i!==o.i&&v1(a,o)){var u=Hf(a,o);a=Fe(a,a.next),u=Fe(u,u.next),Qr(a,t,e,i,s,n,0),Qr(u,t,e,i,s,n,0);return}o=o.next}a=a.next}while(a!==r)}function f1(r,t,e,i){var s=[],n,a,o,u,l;for(n=0,a=t.length;n<a;n++)o=t[n]*i,u=n<a-1?t[n+1]*i:r.length,l=Nf(r,o,u,i,!1),l===l.next&&(l.steiner=!0),s.push(x1(l));for(s.sort(p1),n=0;n<s.length;n++)e=m1(s[n],e);return e}function p1(r,t){return r.x-t.x}function m1(r,t){var e=g1(r,t);if(!e)return t;var i=Hf(e,r);return Fe(i,i.next),Fe(e,e.next)}function g1(r,t){var e=t,i=r.x,s=r.y,n=-1/0,a;do{if(s<=e.y&&s>=e.next.y&&e.next.y!==e.y){var o=e.x+(s-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(o<=i&&o>n&&(n=o,a=e.x<e.next.x?e:e.next,o===i))return a}e=e.next}while(e!==t);if(!a)return null;var u=a,l=a.x,c=a.y,h=1/0,f;e=a;do i>=e.x&&e.x>=l&&i!==e.x&&cr(s<c?i:n,s,l,c,s<c?n:i,s,e.x,e.y)&&(f=Math.abs(s-e.y)/(i-e.x),Jr(e,r)&&(f<h||f===h&&(e.x>a.x||e.x===a.x&&_1(a,e)))&&(a=e,h=f)),e=e.next;while(e!==u);return a}function _1(r,t){return tt(r.prev,r,t.prev)<0&&tt(t.next,r,r.next)<0}function b1(r,t,e,i){var s=r;do s.z===0&&(s.z=Ja(s.x,s.y,t,e,i)),s.prevZ=s.prev,s.nextZ=s.next,s=s.next;while(s!==r);s.prevZ.nextZ=null,s.prevZ=null,y1(s)}function y1(r){var t,e,i,s,n,a,o,u,l=1;do{for(e=r,r=null,n=null,a=0;e;){for(a++,i=e,o=0,t=0;t<l&&(o++,i=i.nextZ,!!i);t++);for(u=l;o>0||u>0&&i;)o!==0&&(u===0||!i||e.z<=i.z)?(s=e,e=e.nextZ,o--):(s=i,i=i.nextZ,u--),n?n.nextZ=s:r=s,s.prevZ=n,n=s;e=i}n.nextZ=null,l*=2}while(a>1);return r}function Ja(r,t,e,i,s){return r=(r-e)*s|0,t=(t-i)*s|0,r=(r|r<<8)&16711935,r=(r|r<<4)&252645135,r=(r|r<<2)&858993459,r=(r|r<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,r|t<<1}function x1(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,i,s,n,a,o){return(s-a)*(t-o)>=(r-a)*(n-o)&&(r-a)*(i-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(s-a)*(i-o)}function v1(r,t){return r.next.i!==t.i&&r.prev.i!==t.i&&!T1(r,t)&&(Jr(r,t)&&Jr(t,r)&&S1(r,t)&&(tt(r.prev,r,t.prev)||tt(r,t.prev,t))||As(r,t)&&tt(r.prev,r,r.next)>0&&tt(t.prev,t,t.next)>0)}function tt(r,t,e){return(t.y-r.y)*(e.x-t.x)-(t.x-r.x)*(e.y-t.y)}function As(r,t){return r.x===t.x&&r.y===t.y}function $f(r,t,e,i){var s=ws(tt(r,t,e)),n=ws(tt(r,t,i)),a=ws(tt(e,i,r)),o=ws(tt(e,i,t));return!!(s!==n&&a!==o||s===0&&Es(r,e,t)||n===0&&Es(r,i,t)||a===0&&Es(e,r,i)||o===0&&Es(e,t,i))}function Es(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 ws(r){return r>0?1:r<0?-1:0}function T1(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&&$f(e,e.next,r,t))return!0;e=e.next}while(e!==r);return!1}function Jr(r,t){return tt(r.prev,r,r.next)<0?tt(r,t,r.next)>=0&&tt(r,r.prev,t)>=0:tt(r,t,r.prev)<0||tt(r,r.next,t)<0}function S1(r,t){var e=r,i=!1,s=(r.x+t.x)/2,n=(r.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&s<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==r);return i}function Hf(r,t){var e=new to(r.i,r.x,r.y),i=new to(t.i,t.x,t.y),s=r.next,n=t.prev;return r.next=t,t.prev=r,e.next=s,s.prev=e,i.next=e,e.prev=i,n.next=i,i.prev=n,i}function Xf(r,t,e,i){var s=new to(r,t,e);return i?(s.next=i.next,s.prev=i,i.next.prev=s,i.next=s):(s.prev=s,s.next=s),s}function ti(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 to(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}Ss.deviation=function(r,t,e,i){var s=t&&t.length,n=s?t[0]*e:r.length,a=Math.abs(eo(r,0,n,e));if(s)for(var o=0,u=t.length;o<u;o++){var l=t[o]*e,c=o<u-1?t[o+1]*e:r.length;a-=Math.abs(eo(r,l,c,e))}var h=0;for(o=0;o<i.length;o+=3){var f=i[o]*e,p=i[o+1]*e,m=i[o+2]*e;h+=Math.abs((r[f]-r[m])*(r[p+1]-r[f+1])-(r[f]-r[p])*(r[m+1]-r[f+1]))}return a===0&&h===0?0:Math.abs((h-a)/a)};function eo(r,t,e,i){for(var s=0,n=t,a=e-i;n<e;n+=i)s+=(r[a]-r[n])*(r[n+1]+r[a+1]),a=n;return s}Ss.flatten=function(r){for(var t=r[0][0].length,e={vertices:[],holes:[],dimensions:t},i=0,s=0;s<r.length;s++){for(var n=0;n<r[s].length;n++)for(var a=0;a<t;a++)e.vertices.push(r[s][n][a]);s>0&&(i+=r[s-1].length,e.holes.push(i))}return e};var A1=Ts.exports,zf=Ii(A1);function ro(r,t,e,i,s,n,a){const o=zf(r,t,2);if(!o)return;for(let l=0;l<o.length;l+=3)n[a++]=o[l]+s,n[a++]=o[l+1]+s,n[a++]=o[l+2]+s;let u=s*i;for(let l=0;l<r.length;l+=2)e[u]=r[l],e[u+1]=r[l+1],u+=i}const E1=[],io={extension:{type:v.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,i,s,n){ro(r,E1,t,e,i,s,n)}},so={extension:{type:v.ShapeBuilder,name:"rectangle"},build(r,t){const e=r,i=e.x,s=e.y,n=e.width,a=e.height;return n>=0&&a>=0&&(t[0]=i,t[1]=s,t[2]=i+n,t[3]=s,t[4]=i+n,t[5]=s+a,t[6]=i,t[7]=s+a),t},triangulate(r,t,e,i,s,n){let a=0;i*=e,t[i+a]=r[0],t[i+a+1]=r[1],a+=e,t[i+a]=r[2],t[i+a+1]=r[3],a+=e,t[i+a]=r[6],t[i+a+1]=r[7],a+=e,t[i+a]=r[4],t[i+a+1]=r[5],a+=e;const o=i/e;s[n++]=o,s[n++]=o+1,s[n++]=o+2,s[n++]=o+1,s[n++]=o+3,s[n++]=o+2}},no={extension:{type:v.ShapeBuilder,name:"triangle"},build(r,t){return t[0]=r.x,t[1]=r.y,t[2]=r.x2,t[3]=r.y2,t[4]=r.x3,t[5]=r.y3,t},triangulate(r,t,e,i,s,n){let a=0;i*=e,t[i+a]=r[0],t[i+a+1]=r[1],a+=e,t[i+a]=r[2],t[i+a+1]=r[3],a+=e,t[i+a]=r[4],t[i+a+1]=r[5];const o=i/e;s[n++]=o,s[n++]=o+1,s[n++]=o+2}},ei={};L.handleByMap(v.ShapeBuilder,ei),L.add(so,io,no,oe,Gf,Ff);const w1=new W;function jf(r,t){const{geometryData:e,batches:i}=t;i.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let s=0;s<r.instructions.length;s++){const n=r.instructions[s];if(n.action==="texture")C1(n.data,i,e);else if(n.action==="fill"||n.action==="stroke"){const a=n.action==="stroke",o=n.data.path.shapePath,u=n.data.style,l=n.data.hole;a&&l&&Vf(l.shapePath,u,null,!0,i,e),Vf(o,u,l,a,i,e)}}}function C1(r,t,e){const{vertices:i,uvs:s,indices:n}=e,a=n.length,o=i.length/2,u=[],l=ei.rectangle,c=w1,h=r.image;c.x=r.dx,c.y=r.dy,c.width=r.dw,c.height=r.dh;const f=r.transform;l.build(c,u),f&&bs(u,f),l.triangulate(u,i,2,o,n,a);const p=h.uvs;s.push(p.x0,p.y0,p.x1,p.y1,p.x3,p.y3,p.x2,p.y2);const m=X.get(ys);m.indexOffset=a,m.indexSize=n.length-a,m.attributeOffset=o,m.attributeSize=i.length/2-o,m.baseColor=r.style,m.alpha=r.alpha,m.texture=h,m.geometryData=e,t.push(m)}function Vf(r,t,e,i,s,n){const{vertices:a,uvs:o,indices:u}=n,l=r.shapePrimitives.length-1;r.shapePrimitives.forEach(({shape:c,transform:h},f)=>{var p;const m=u.length,_=a.length/2,g=[],b=ei[c.type];if(b.build(c,g),h&&bs(g,h),i){const A=(p=c.closePath)!=null?p:!0;Lf(g,t,!1,A,a,2,_,u,m)}else if(e&&l===f){l!==0&&console.warn("[Pixi Graphics] only the last shape have be cut out");const A=[],R=g.slice();R1(e.shapePath).forEach(C=>{A.push(R.length/2),R.push(...C)}),ro(R,A,a,2,_,u,m)}else b.triangulate(g,a,2,_,u,m);const x=o.length/2,y=t.texture;if(y!==w.WHITE){const A=t.matrix;A&&(h&&A.append(h.clone().invert()),Ka(a,2,_,o,x,2,a.length/2-_,A))}else Za(o,x,2,a.length/2-_);const T=X.get(ys);T.indexOffset=m,T.indexSize=u.length-m,T.attributeOffset=_,T.attributeSize=a.length/2-_,T.baseColor=t.color,T.alpha=t.alpha,T.texture=y,T.geometryData=n,s.push(T)})}function R1(r){if(!r)return[];const t=r.shapePrimitives,e=[];for(let i=0;i<t.length;i++){const s=t[i].shape,n=[];ei[s.type].build(s,n),e.push(n)}return e}class Wf{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}}class Yf{constructor(){this.batcher=new _s,this.instructions=new ya}init(){this.instructions.reset()}get geometry(){return qa(Mf,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}}const ao=class mc{constructor(){this._gpuContextHash={},this._graphicsDataContextHash=Object.create(null)}init(t){var e;mc.defaultOptions.bezierSmoothness=(e=t==null?void 0:t.bezierSmoothness)!=null?e:mc.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),jf(t,e);const i=t.batchMode;t.customShader||i==="no-batch"?e.isBatchable=!1:i==="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=X.get(Yf),{batches:i,geometryData:s}=this._gpuContextHash[t.uid],n=s.vertices.length,a=s.indices.length;for(let c=0;c<i.length;c++)i[c].applyTransform=!1;const o=e.batcher;o.ensureAttributeBuffer(n),o.ensureIndexBuffer(a),o.begin();for(let c=0;c<i.length;c++){const h=i[c];o.add(h)}o.finish(e.instructions);const u=o.geometry;u.indexBuffer.setDataWithSize(o.indexBuffer,o.indexSize,!0),u.buffers[0].setDataWithSize(o.attributeBuffer.float32View,o.attributeSize,!0);const l=o.batches;for(let c=0;c<l.length;c++){const h=l[c];h.bindGroup=os(h.textures.textures,h.textures.count)}return this._graphicsDataContextHash[t.uid]=e,e}_initContext(t){const e=new Wf;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]&&(X.return(this.getContextRenderData(t)),this._graphicsDataContextHash[t.uid]=null),e.batches&&e.batches.forEach(i=>{X.return(i)})}destroy(){for(const t in this._gpuContextHash)this._gpuContextHash[t]&&this.onGraphicsContextDestroy(this._gpuContextHash[t].context)}};ao.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"graphicsContext"},ao.defaultOptions={bezierSmoothness:.5};let Cs=ao;const P1={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},oo=0,uo=1,lo=2,co=3,ho=4,fo=5,po=class gy{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<oo)}set blend(t){!!(this.data&1<<oo)!==t&&(this.data^=1<<oo)}get offsets(){return!!(this.data&1<<uo)}set offsets(t){!!(this.data&1<<uo)!==t&&(this.data^=1<<uo)}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<<lo)}set culling(t){!!(this.data&1<<lo)!==t&&(this.data^=1<<lo)}get depthTest(){return!!(this.data&1<<co)}set depthTest(t){!!(this.data&1<<co)!==t&&(this.data^=1<<co)}get depthMask(){return!!(this.data&1<<fo)}set depthMask(t){!!(this.data&1<<fo)!==t&&(this.data^=1<<fo)}get clockwiseFrontFace(){return!!(this.data&1<<ho)}set clockwiseFrontFace(t){!!(this.data&1<<ho)!==t&&(this.data^=1<<ho)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=P1[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}static for2d(){const t=new gy;return t.depthTest=!1,t.blend=!0,t}};po.default2d=po.for2d();let Ht=po;function M1(r,t,e,i){e[i++]=(r>>16&255)/255,e[i++]=(r>>8&255)/255,e[i++]=(r&255)/255,e[i++]=t}function ri(r,t,e){const i=(r>>24&255)/255;t[e++]=(r&255)/255*i,t[e++]=(r>>8&255)/255*i,t[e++]=(r>>16&255)/255*i,t[e++]=i}class mo{constructor(t,e){this.state=Ht.for2d(),this._graphicsBatchesHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=t.context,i=!!this._graphicsBatchesHash[t.uid],s=this.renderer.graphicsContext.updateGpuContext(e);return!!(s.isBatchable||i!==s.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t._didGraphicsUpdate&&(t._didGraphicsUpdate=!1,this._rebuild(t)),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const e=this._graphicsBatchesHash[t.uid];if(e)for(let i=0;i<e.length;i++){const s=e[i];s._batcher.updateElement(s)}}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,i=t.context;if(!e.graphicsContext.getGpuContext(i).batches.length)return;const s=i.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const n=s.resources.localUniforms.uniforms;n.uTransformMatrix=t.groupTransform,n.uRound=e._roundPixels|t._roundPixels,ri(t.groupColorAlpha,n.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=!!this._graphicsBatchesHash[t.uid],i=this.renderer.graphicsContext.updateGpuContext(t.context);e&&this._removeBatchForRenderable(t.uid),i.isBatchable&&this._initBatchesForRenderable(t),t.batched=i.isBatchable}_addToBatcher(t,e){const i=this.renderer.renderPipes.batch,s=this._getBatchesForRenderable(t);for(let n=0;n<s.length;n++){const a=s[n];i.addToBatch(a,e)}}_getBatchesForRenderable(t){return this._graphicsBatchesHash[t.uid]||this._initBatchesForRenderable(t)}_initBatchesForRenderable(t){const e=t.context,i=this.renderer.graphicsContext.getGpuContext(e),s=this.renderer._roundPixels|t._roundPixels,n=i.batches.map(a=>{const o=X.get(ys);return a.copyTo(o),o.renderable=t,o.roundPixels=s,o});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=>{X.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}}mo.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"graphics"},L.add(mo),L.add(Cs);class Rs{constructor(){this.batcherName="default",this.packAsQuad=!1,this.indexOffset=0,this.attributeOffset=0,this.roundPixels=0,this._batcher=null,this._batch=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get blendMode(){return this.renderable.groupBlendMode}reset(){this.renderable=null,this.texture=null,this._batcher=null,this._batch=null,this.geometry=null,this._uvUpdateId=-1,this._textureMatrixUpdateId=-1}get uvs(){const t=this.geometry.getBuffer("aUV"),e=t.data;let i=e;const s=this.texture.textureMatrix;return s.isSimple||(i=this._transformedUvs,(this._textureMatrixUpdateId!==s._updateID||this._uvUpdateId!==t._updateID)&&((!i||i.length<e.length)&&(i=this._transformedUvs=new Float32Array(e.length)),this._textureMatrixUpdateId=s._updateID,this._uvUpdateId=t._updateID,s.multiplyUvs(e,i))),i}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 go{constructor(t,e){this.localUniforms=new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),this.localUniformsBindGroup=new Zt({0:this.localUniforms}),this._meshDataHash=Object.create(null),this._gpuBatchableMeshHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this.renderer=t,this._adaptor=e,this._adaptor.init()}validateRenderable(t){const e=this._getMeshData(t),i=e.batched,s=t.batched;if(e.batched=s,i!==s)return!0;if(s){const n=t._geometry;if(n.indices.length!==e.indexSize||n.positions.length!==e.vertexSize)return e.indexSize=n.indices.length,e.vertexSize=n.positions.length,!0;const a=this._getBatchableMesh(t),o=t.texture;if(a.texture._source!==o._source&&a.texture._source!==o._source)return!a._batcher.checkAndUpdateTexture(a,o)}return!1}addRenderable(t,e){const i=this.renderer.renderPipes.batch,{batched:s}=this._getMeshData(t);if(s){const n=this._getBatchableMesh(t);n.texture=t._texture,n.geometry=t._geometry,i.addToBatch(n,e)}else i.break(e),e.add(t)}updateRenderable(t){if(t.batched){const e=this._gpuBatchableMeshHash[t.uid];e.texture=t._texture,e.geometry=t._geometry,e._batcher.updateElement(e)}}destroyRenderable(t){this._meshDataHash[t.uid]=null;const e=this._gpuBatchableMeshHash[t.uid];e&&(X.return(e),this._gpuBatchableMeshHash[t.uid]=null),t.off("destroyed",this._destroyRenderableBound)}execute(t){if(!t.isRenderable)return;t.state.blendMode=Kr(t.groupBlendMode,t.texture._source);const e=this.localUniforms;e.uniforms.uTransformMatrix=t.groupTransform,e.uniforms.uRound=this.renderer._roundPixels|t._roundPixels,e.update(),ri(t.groupColorAlpha,e.uniforms.uColor,0),this._adaptor.execute(this,t)}_getMeshData(t){return this._meshDataHash[t.uid]||this._initMeshData(t)}_initMeshData(t){var e,i;return this._meshDataHash[t.uid]={batched:t.batched,indexSize:(e=t._geometry.indices)==null?void 0:e.length,vertexSize:(i=t._geometry.positions)==null?void 0:i.length},t.on("destroyed",this._destroyRenderableBound),this._meshDataHash[t.uid]}_getBatchableMesh(t){return this._gpuBatchableMeshHash[t.uid]||this._initBatchableMesh(t)}_initBatchableMesh(t){const e=X.get(Rs);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]&&X.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}}go.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"mesh"},L.add(go);class Ps{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 _o{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),i=t._getKey();if(e.currentKey!==i){const{width:s,height:n}=this._renderer.canvasText.getTextureSize(t.text,t.resolution,t._style);return!(this._renderer.canvasText.getReferenceCount(e.currentKey)===1&&s===e.texture._source.width&&n===e.texture._source.height)}return!1}addRenderable(t,e){const i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.canvasText.decreaseReferenceCount(e.currentKey),X.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t),t._didTextUpdate=!1;const n=t._style.padding;Hr(s.bounds,t._anchor,s.texture,n)}_updateGpuText(t){const e=this._getGpuText(t),i=e.batchableSprite;e.texture&&this._renderer.canvasText.decreaseReferenceCount(e.currentKey),e.texture=i.texture=this._renderer.canvasText.getManagedTexture(t),e.currentKey=t._getKey(),i.texture=e.texture}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:null,currentKey:"--",batchableSprite:X.get(Ps)};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}}_o.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"text"};class qf{constructor(t){this._canvasPool=Object.create(null),this.canvasOptions=t||{},this.enableFullScreen=!1}_createCanvasAndContext(t,e){const i=$.get().createCanvas();i.width=t,i.height=e;const s=i.getContext("2d");return{canvas:i,context:s}}getOptimalCanvasAndContext(t,e,i=1){t=Math.ceil(t*i-1e-6),e=Math.ceil(e*i-1e-6),t=Pe(t),e=Pe(e);const s=(t<<17)+(e<<1);this._canvasPool[s]||(this._canvasPool[s]=[]);let n=this._canvasPool[s].pop();return n||(n=this._createCanvasAndContext(t,e)),n}returnCanvasAndContext(t){const e=t.canvas,{width:i,height:s}=e,n=(i<<17)+(s<<1);this._canvasPool[n].push(t)}clear(){this._canvasPool={}}}const Qt=new qf;var D1=Object.defineProperty,O1=Object.defineProperties,B1=Object.getOwnPropertyDescriptors,Kf=Object.getOwnPropertySymbols,G1=Object.prototype.hasOwnProperty,F1=Object.prototype.propertyIsEnumerable,Zf=(r,t,e)=>t in r?D1(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,I1=(r,t)=>{for(var e in t||(t={}))G1.call(t,e)&&Zf(r,e,t[e]);if(Kf)for(var e of Kf(t))F1.call(t,e)&&Zf(r,e,t[e]);return r},U1=(r,t)=>O1(r,B1(t));let k1=0;class Qf{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1}createTexture(t,e,i){const s=new et(U1(I1({},this.textureOptions),{width:t,height:e,resolution:1,antialias:i,autoGarbageCollect:!0}));return new w({source:s,label:`texturePool_${k1++}`})}getOptimalTexture(t,e,i=1,s){let n=Math.ceil(t*i-1e-6),a=Math.ceil(e*i-1e-6);n=Pe(n),a=Pe(a);const o=(n<<17)+(a<<1)+(s?1:0);this._texturePool[o]||(this._texturePool[o]=[]);let u=this._texturePool[o].pop();return u||(u=this.createTexture(n,a,s)),u.source._resolution=i,u.source.width=n/i,u.source.height=a/i,u.source.pixelWidth=n,u.source.pixelHeight=a,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=o,u}getSameSizeTexture(t,e=!1){const i=t.source;return this.getOptimalTexture(t.width,t.height,i._resolution,e)}returnTexture(t){const e=this._poolKeyHash[t.uid];this._texturePool[e].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const i=this._texturePool[e];if(i)for(let s=0;s<i.length;s++)i[s].destroy(!0)}this._texturePool={}}}const pt=new Qf;function Jf(r,t,e){for(let i=0,s=4*e*t;i<t;++i,s+=4)if(r[s+3]!==0)return!1;return!0}function tp(r,t,e,i,s){const n=4*t;for(let a=i,o=i*n+4*e;a<=s;++a,o+=n)if(r[o+3]!==0)return!1;return!0}function ep(r,t=1){const{width:e,height:i}=r,s=r.getContext("2d",{willReadFrequently:!0});if(s===null)throw new TypeError("Failed to get canvas 2D context");const n=s.getImageData(0,0,e,i).data;let a=0,o=0,u=e-1,l=i-1;for(;o<i&&Jf(n,e,o);)++o;if(o===i)return W.EMPTY;for(;Jf(n,e,l);)--l;for(;tp(n,e,a,o,l);)++a;for(;tp(n,e,u,o,l);)--u;return++u,++l,new W(a/t,o/t,(u-a)/t,(l-o)/t)}const rp=class gc{constructor(t,e,i,s){this.uid=J("fillGradient"),this.type="linear",this.gradientStops=[],this._styleKey=null,this.x0=t,this.y0=e,this.x1=i,this.y1=s}addColorStop(t,e){return this.gradientStops.push({offset:t,color:V.shared.setValue(e).toHexa()}),this._styleKey=null,this}buildLinearGradient(){const t=gc.defaultTextureSize,{gradientStops:e}=this,i=$.get().createCanvas();i.width=t,i.height=t;const s=i.getContext("2d"),n=s.createLinearGradient(0,0,gc.defaultTextureSize,1);for(let _=0;_<e.length;_++){const g=e[_];n.addColorStop(g.offset,g.color)}s.fillStyle=n,s.fillRect(0,0,t,t),this.texture=new w({source:new De({resource:i,addressModeU:"clamp-to-edge",addressModeV:"repeat"})});const{x0:a,y0:o,x1:u,y1:l}=this,c=new G,h=u-a,f=l-o,p=Math.sqrt(h*h+f*f),m=Math.atan2(f,h);c.translate(-a,-o),c.scale(1/t,1/t),c.rotate(-m),c.scale(256/p,1),this.transform=c,this._styleKey=null}get styleKey(){if(this._styleKey)return this._styleKey;const t=this.gradientStops.map(s=>`${s.offset}-${s.color}`).join("-"),e=this.texture.uid,i=this.transform.toArray().join("-");return`fill-gradient-${this.uid}-${t}-${e}-${i}-${this.x0}-${this.y0}-${this.x1}-${this.y1}`}};rp.defaultTextureSize=256;let hr=rp;const ip={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 ii{constructor(t,e){this.uid=J("fillPattern"),this.transform=new G,this._styleKey=null,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=ip[e].addressModeU,t.source.style.addressModeV=ip[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 L1=$1,bo={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},N1=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function $1(r){var t=[];return r.replace(N1,function(e,i,s){var n=i.toLowerCase();for(s=X1(s),n=="m"&&s.length>2&&(t.push([i].concat(s.splice(0,2))),n="l",i=i=="m"?"l":"L");;){if(s.length==bo[n])return s.unshift(i),t.push(s);if(s.length<bo[n])throw new Error("malformed path data");t.push([i].concat(s.splice(0,bo[n])))}}),t}var H1=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function X1(r){var t=r.match(H1);return t?t.map(Number):[]}var z1=Ii(L1);function sp(r,t){const e=z1(r),i=[];let s=null,n=0,a=0;for(let o=0;o<e.length;o++){const u=e[o],l=u[0],c=u;switch(l){case"M":n=c[1],a=c[2],t.moveTo(n,a);break;case"m":n+=c[1],a+=c[2],t.moveTo(n,a);break;case"H":n=c[1],t.lineTo(n,a);break;case"h":n+=c[1],t.lineTo(n,a);break;case"V":a=c[1],t.lineTo(n,a);break;case"v":a+=c[1],t.lineTo(n,a);break;case"L":n=c[1],a=c[2],t.lineTo(n,a);break;case"l":n+=c[1],a+=c[2],t.lineTo(n,a);break;case"C":n=c[5],a=c[6],t.bezierCurveTo(c[1],c[2],c[3],c[4],n,a);break;case"c":t.bezierCurveTo(n+c[1],a+c[2],n+c[3],a+c[4],n+c[5],a+c[6]),n+=c[5],a+=c[6];break;case"S":n=c[3],a=c[4],t.bezierCurveToShort(c[1],c[2],n,a);break;case"s":t.bezierCurveToShort(n+c[1],a+c[2],n+c[3],a+c[4]),n+=c[3],a+=c[4];break;case"Q":n=c[3],a=c[4],t.quadraticCurveTo(c[1],c[2],n,a);break;case"q":t.quadraticCurveTo(n+c[1],a+c[2],n+c[3],a+c[4]),n+=c[3],a+=c[4];break;case"T":n=c[1],a=c[2],t.quadraticCurveToShort(n,a);break;case"t":n+=c[1],a+=c[2],t.quadraticCurveToShort(n,a);break;case"A":n=c[6],a=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,a);break;case"a":n+=c[6],a+=c[7],t.arcToSvg(c[1],c[2],c[3],c[4],c[5],n,a);break;case"Z":case"z":t.closePath(),i.length>0&&(s=i.pop(),s?(n=s.startX,a=s.startY):(n=0,a=0)),s=null;break;default:}l!=="Z"&&l!=="z"&&s===null&&(s={startX:n,startY:a},i.push(s))}return t}class Ms{constructor(t=0,e=0,i=0){this.type="circle",this.x=t,this.y=e,this.radius=i}clone(){return new Ms(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const i=this.radius*this.radius;let s=this.x-t,n=this.y-e;return s*=s,n*=n,s+n<=i}strokeContains(t,e,i){if(this.radius===0)return!1;const s=this.x-t,n=this.y-e,a=this.radius,o=i/2,u=Math.sqrt(s*s+n*n);return u<a+o&&u>a-o}getBounds(t){return t=t||new W,t.x=this.x-this.radius,t.y=this.y-this.radius,t.width=this.radius*2,t.height=this.radius*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.radius=t.radius,this}copyTo(t){return t.copyFrom(this),t}}class Ds{constructor(t=0,e=0,i=0,s=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=i,this.halfHeight=s}clone(){return new Ds(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let i=(t-this.x)/this.halfWidth,s=(e-this.y)/this.halfHeight;return i*=i,s*=s,i+s<=1}strokeContains(t,e,i){const{halfWidth:s,halfHeight:n}=this;if(s<=0||n<=0)return!1;const a=i/2,o=s-a,u=n-a,l=s+a,c=n+a,h=t-this.x,f=e-this.y,p=h*h/(o*o)+f*f/(u*u),m=h*h/(l*l)+f*f/(c*c);return p>1&&m<=1}getBounds(t){return t=t||new W,t.x=this.x-this.halfWidth,t.y=this.y-this.halfHeight,t.width=this.halfWidth*2,t.height=this.halfHeight*2,t}copyFrom(t){return this.x=t.x,this.y=t.y,this.halfWidth=t.halfWidth,this.halfHeight=t.halfHeight,this}copyTo(t){return t.copyFrom(this),t}}function si(r,t,e,i,s,n){const a=r-e,o=t-i,u=s-e,l=n-i,c=a*u+o*l,h=u*u+l*l;let f=-1;h!==0&&(f=c/h);let p,m;f<0?(p=e,m=i):f>1?(p=s,m=n):(p=e+f*u,m=i+f*l);const _=r-p,g=t-m;return _*_+g*g}class dr{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const i=[];for(let s=0,n=e.length;s<n;s++)i.push(e[s].x,e[s].y);e=i}this.points=e,this.closePath=!0}clone(){const t=this.points.slice(),e=new dr(t);return e.closePath=this.closePath,e}contains(t,e){let i=!1;const s=this.points.length/2;for(let n=0,a=s-1;n<s;a=n++){const o=this.points[n*2],u=this.points[n*2+1],l=this.points[a*2],c=this.points[a*2+1];u>e!=c>e&&t<(l-o)*((e-u)/(c-u))+o&&(i=!i)}return i}strokeContains(t,e,i){const s=i/2,n=s*s,{points:a}=this,o=a.length-(this.closePath?0:2);for(let u=0;u<o;u+=2){const l=a[u],c=a[u+1],h=a[(u+2)%a.length],f=a[(u+3)%a.length];if(si(t,e,l,c,h,f)<=n)return!0}return!1}getBounds(t){t=t||new W;const e=this.points;let i=1/0,s=-1/0,n=1/0,a=-1/0;for(let o=0,u=e.length;o<u;o+=2){const l=e[o],c=e[o+1];i=l<i?l:i,s=l>s?l:s,n=c<n?c:n,a=c>a?c:a}return t.x=i,t.width=s-i,t.y=n,t.height=a-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 Os=(r,t,e,i,s,n)=>{const a=r-e,o=t-i,u=Math.sqrt(a*a+o*o);return u>=s-n&&u<=s+n};class Bs{constructor(t=0,e=0,i=0,s=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=i,this.height=s,this.radius=n}getBounds(t){return t=t||new W,t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new Bs(this.x,this.y,this.width,this.height,this.radius)}copyFrom(t){return this.x=t.x,this.y=t.y,this.width=t.width,this.height=t.height,this}copyTo(t){return t.copyFrom(this),t}contains(t,e){if(this.width<=0||this.height<=0)return!1;if(t>=this.x&&t<=this.x+this.width&&e>=this.y&&e<=this.y+this.height){const i=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+i&&e<=this.y+this.height-i||t>=this.x+i&&t<=this.x+this.width-i)return!0;let s=t-(this.x+i),n=e-(this.y+i);const a=i*i;if(s*s+n*n<=a||(s=t-(this.x+this.width-i),s*s+n*n<=a)||(n=e-(this.y+this.height-i),s*s+n*n<=a)||(s=t-(this.x+i),s*s+n*n<=a))return!0}return!1}strokeContains(t,e,i){const{x:s,y:n,width:a,height:o,radius:u}=this,l=i/2,c=s+u,h=n+u,f=a-u*2,p=o-u*2,m=s+a,_=n+o;return(t>=s-l&&t<=s+l||t>=m-l&&t<=m+l)&&e>=h&&e<=h+p||(e>=n-l&&e<=n+l||e>=_-l&&e<=_+l)&&t>=c&&t<=c+f?!0:t<c&&e<h&&Os(t,e,c,h,u,l)||t>m-u&&e<h&&Os(t,e,m-u,h,u,l)||t>m-u&&e>_-u&&Os(t,e,m-u,_-u,u,l)||t<c&&e>_-u&&Os(t,e,c,_-u,u,l)}}const j1=8,Gs=11920929e-14,V1=1,yo=.01,fr=0,Ie=0;function xo(r,t,e,i,s,n,a,o,u,l){const c=Math.min(.99,Math.max(0,l!=null?l:Cs.defaultOptions.bezierSmoothness));let h=(V1-c)/1;return h*=h,W1(t,e,i,s,n,a,o,u,r,h),r}function W1(r,t,e,i,s,n,a,o,u,l){vo(r,t,e,i,s,n,a,o,u,l,0),u.push(a,o)}function vo(r,t,e,i,s,n,a,o,u,l,c){if(c>j1)return;const h=Math.PI,f=(r+e)/2,p=(t+i)/2,m=(e+s)/2,_=(i+n)/2,g=(s+a)/2,b=(n+o)/2,x=(f+m)/2,y=(p+_)/2,T=(m+g)/2,A=(_+b)/2,R=(x+T)/2,C=(y+A)/2;if(c>0){let P=a-r,S=o-t;const E=Math.abs((e-a)*S-(i-o)*P),F=Math.abs((s-a)*S-(n-o)*P);let N,O;if(E>Gs&&F>Gs){if((E+F)*(E+F)<=l*(P*P+S*S)){if(fr<yo){u.push(R,C);return}const B=Math.atan2(n-i,s-e);if(N=Math.abs(B-Math.atan2(i-t,e-r)),O=Math.abs(Math.atan2(o-n,a-s)-B),N>=h&&(N=2*h-N),O>=h&&(O=2*h-O),N+O<fr){u.push(R,C);return}if(Ie!==0){if(N>Ie){u.push(e,i);return}if(O>Ie){u.push(s,n);return}}}}else if(E>Gs){if(E*E<=l*(P*P+S*S)){if(fr<yo){u.push(R,C);return}if(N=Math.abs(Math.atan2(n-i,s-e)-Math.atan2(i-t,e-r)),N>=h&&(N=2*h-N),N<fr){u.push(e,i),u.push(s,n);return}if(Ie!==0&&N>Ie){u.push(e,i);return}}}else if(F>Gs){if(F*F<=l*(P*P+S*S)){if(fr<yo){u.push(R,C);return}if(N=Math.abs(Math.atan2(o-n,a-s)-Math.atan2(n-i,s-e)),N>=h&&(N=2*h-N),N<fr){u.push(e,i),u.push(s,n);return}if(Ie!==0&&N>Ie){u.push(s,n);return}}}else if(P=R-(r+a)/2,S=C-(t+o)/2,P*P+S*S<=l){u.push(R,C);return}}vo(r,t,f,p,x,y,R,C,u,l,c+1),vo(R,C,T,A,g,b,a,o,u,l,c+1)}const Y1=8,q1=11920929e-14,K1=1,Z1=.01,np=0;function ap(r,t,e,i,s,n,a,o){const u=Math.min(.99,Math.max(0,o!=null?o:Cs.defaultOptions.bezierSmoothness));let l=(K1-u)/1;return l*=l,Q1(t,e,i,s,n,a,r,l),r}function Q1(r,t,e,i,s,n,a,o){To(a,r,t,e,i,s,n,o,0),a.push(s,n)}function To(r,t,e,i,s,n,a,o,u){if(u>Y1)return;const l=Math.PI,c=(t+i)/2,h=(e+s)/2,f=(i+n)/2,p=(s+a)/2,m=(c+f)/2,_=(h+p)/2;let g=n-t,b=a-e;const x=Math.abs((i-n)*b-(s-a)*g);if(x>q1){if(x*x<=o*(g*g+b*b)){if(np<Z1){r.push(m,_);return}let y=Math.abs(Math.atan2(a-s,n-i)-Math.atan2(s-e,i-t));if(y>=l&&(y=2*l-y),y<np){r.push(m,_);return}}}else if(g=m-(t+n)/2,b=_-(e+a)/2,g*g+b*b<=o){r.push(m,_);return}To(r,t,e,c,h,m,_,o,u+1),To(r,m,_,f,p,n,a,o,u+1)}function So(r,t,e,i,s,n,a,o){let u=Math.abs(s-n);(!a&&s>n||a&&n>s)&&(u=2*Math.PI-u),o=o||Math.max(6,Math.floor(6*Math.pow(i,.3333333333333333)*(u/Math.PI))),o=Math.max(o,3);let l=u/o,c=s;l*=a?-1:1;for(let h=0;h<o+1;h++){const f=Math.cos(c),p=Math.sin(c),m=t+f*i,_=e+p*i;r.push(m,_),c+=l}}function op(r,t,e,i,s,n){const a=r[r.length-2],o=r[r.length-1]-e,u=a-t,l=s-e,c=i-t,h=Math.abs(o*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 f=o*o+u*u,p=l*l+c*c,m=o*l+u*c,_=n*Math.sqrt(f)/h,g=n*Math.sqrt(p)/h,b=_*m/f,x=g*m/p,y=_*c+g*u,T=_*l+g*o,A=u*(g+b),R=o*(g+b),C=c*(_+x),P=l*(_+x),S=Math.atan2(R-T,A-y),E=Math.atan2(P-T,C-y);So(r,y+t,T+e,n,S,E,u*l>c*o)}const ni=Math.PI*2,Ao={centerX:0,centerY:0,ang1:0,ang2:0},Eo=({x:r,y:t},e,i,s,n,a,o,u)=>{r*=e,t*=i;const l=s*r-n*t,c=n*r+s*t;return u.x=l+a,u.y=c+o,u};function J1(r,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),i=t===1.5707963267948966?.551915024494:e,s=Math.cos(r),n=Math.sin(r),a=Math.cos(r+t),o=Math.sin(r+t);return[{x:s-n*i,y:n+s*i},{x:a+o*i,y:o-a*i},{x:a,y:o}]}const up=(r,t,e,i)=>{const s=r*i-t*e<0?-1:1;let n=r*e+t*i;return n>1&&(n=1),n<-1&&(n=-1),s*Math.acos(n)},tT=(r,t,e,i,s,n,a,o,u,l,c,h,f)=>{const p=Math.pow(s,2),m=Math.pow(n,2),_=Math.pow(c,2),g=Math.pow(h,2);let b=p*m-p*g-m*_;b<0&&(b=0),b/=p*g+m*_,b=Math.sqrt(b)*(a===o?-1:1);const x=b*s/n*h,y=b*-n/s*c,T=l*x-u*y+(r+e)/2,A=u*x+l*y+(t+i)/2,R=(c-x)/s,C=(h-y)/n,P=(-c-x)/s,S=(-h-y)/n,E=up(1,0,R,C);let F=up(R,C,P,S);o===0&&F>0&&(F-=ni),o===1&&F<0&&(F+=ni),f.centerX=T,f.centerY=A,f.ang1=E,f.ang2=F};function lp(r,t,e,i,s,n,a,o=0,u=0,l=0){if(n===0||a===0)return;const c=Math.sin(o*ni/360),h=Math.cos(o*ni/360),f=h*(t-i)/2+c*(e-s)/2,p=-c*(t-i)/2+h*(e-s)/2;if(f===0&&p===0)return;n=Math.abs(n),a=Math.abs(a);const m=Math.pow(f,2)/Math.pow(n,2)+Math.pow(p,2)/Math.pow(a,2);m>1&&(n*=Math.sqrt(m),a*=Math.sqrt(m)),tT(t,e,i,s,n,a,u,l,c,h,f,p,Ao);let{ang1:_,ang2:g}=Ao;const{centerX:b,centerY:x}=Ao;let y=Math.abs(g)/(ni/4);Math.abs(1-y)<1e-7&&(y=1);const T=Math.max(Math.ceil(y),1);g/=T;let A=r[r.length-2],R=r[r.length-1];const C={x:0,y:0};for(let P=0;P<T;P++){const S=J1(_,g),{x:E,y:F}=Eo(S[0],n,a,h,c,b,x,C),{x:N,y:O}=Eo(S[1],n,a,h,c,b,x,C),{x:B,y:q}=Eo(S[2],n,a,h,c,b,x,C);xo(r,A,R,E,F,N,O,B,q),A=B,R=q,_+=g}}function cp(r,t,e){var i;const s=(o,u)=>{const l=u.x-o.x,c=u.y-o.y,h=Math.sqrt(l*l+c*c),f=l/h,p=c/h;return{len:h,nx:f,ny:p}},n=(o,u)=>{o===0?r.moveTo(u.x,u.y):r.lineTo(u.x,u.y)};let a=t[t.length-1];for(let o=0;o<t.length;o++){const u=t[o%t.length],l=(i=u.radius)!=null?i:e;if(l<=0){n(o,u),a=u;continue}const c=t[(o+1)%t.length],h=s(u,a),f=s(u,c);if(h.len<1e-4||f.len<1e-4){n(o,u),a=u;continue}let p=Math.asin(h.nx*f.ny-h.ny*f.nx),m=1,_=!1;h.nx*f.nx-h.ny*-f.ny<0?p<0?p=Math.PI+p:(p=Math.PI-p,m=-1,_=!0):p>0&&(m=-1,_=!0);const g=p/2;let b,x=Math.abs(Math.cos(g)*l/Math.sin(g));x>Math.min(h.len/2,f.len/2)?(x=Math.min(h.len/2,f.len/2),b=Math.abs(x*Math.sin(g)/Math.cos(g))):b=l;const y=u.x+f.nx*x+-f.ny*b*m,T=u.y+f.ny*x+f.nx*b*m,A=Math.atan2(h.ny,h.nx)+Math.PI/2*m,R=Math.atan2(f.ny,f.nx)-Math.PI/2*m;o===0&&r.moveTo(y+Math.cos(A)*b,T+Math.sin(A)*b),r.arc(y,T,b,A,R,_),a=u}}function hp(r,t,e,i){var s;const n=(u,l)=>Math.sqrt((u.x-l.x)**2+(u.y-l.y)**2),a=(u,l,c)=>({x:u.x+(l.x-u.x)*c,y:u.y+(l.y-u.y)*c}),o=t.length;for(let u=0;u<o;u++){const l=t[(u+1)%o],c=(s=l.radius)!=null?s:e;if(c<=0){u===0?r.moveTo(l.x,l.y):r.lineTo(l.x,l.y);continue}const h=t[u],f=t[(u+2)%o],p=n(h,l);let m;if(p<1e-4)m=l;else{const b=Math.min(p/2,c);m=a(l,h,b/p)}const _=n(f,l);let g;if(_<1e-4)g=l;else{const b=Math.min(_/2,c);g=a(l,f,b/_)}u===0?r.moveTo(m.x,m.y):r.lineTo(m.x,m.y),r.quadraticCurveTo(l.x,l.y,g.x,g.y,i)}}const eT=new W;class dp{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new ft,this._graphicsPath2D=t}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const i=this._currentPoly.points,s=i[i.length-2],n=i[i.length-1];return(s!==t||n!==e)&&i.push(t,e),this}arc(t,e,i,s,n,a){this._ensurePoly(!1);const o=this._currentPoly.points;return So(o,t,e,i,s,n,a),this}arcTo(t,e,i,s,n){this._ensurePoly();const a=this._currentPoly.points;return op(a,t,e,i,s,n),this}arcToSvg(t,e,i,s,n,a,o){const u=this._currentPoly.points;return lp(u,this._currentPoly.lastX,this._currentPoly.lastY,a,o,t,e,i,s,n),this}bezierCurveTo(t,e,i,s,n,a,o){this._ensurePoly();const u=this._currentPoly;return xo(this._currentPoly.points,u.lastX,u.lastY,t,e,i,s,n,a,o),this}quadraticCurveTo(t,e,i,s,n){this._ensurePoly();const a=this._currentPoly;return ap(this._currentPoly.points,a.lastX,a.lastY,t,e,i,s,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 i=0;i<t.instructions.length;i++){const s=t.instructions[i];this[s.action](...s.data)}return this}finish(t=!1){this.endPoly(t)}rect(t,e,i,s,n){return this.drawShape(new W(t,e,i,s),n),this}circle(t,e,i,s){return this.drawShape(new Ms(t,e,i),s),this}poly(t,e,i){const s=new dr(t);return s.closePath=e,this.drawShape(s,i),this}regularPoly(t,e,i,s,n=0,a){s=Math.max(s|0,3);const o=-1*Math.PI/2+n,u=Math.PI*2/s,l=[];for(let c=0;c<s;c++){const h=c*u+o;l.push(t+i*Math.cos(h),e+i*Math.sin(h))}return this.poly(l,!0,a),this}roundPoly(t,e,i,s,n,a=0,o){if(s=Math.max(s|0,3),n<=0)return this.regularPoly(t,e,i,s,a);const u=i*Math.sin(Math.PI/s)-.001;n=Math.min(n,u);const l=-1*Math.PI/2+a,c=Math.PI*2/s,h=(s-2)*Math.PI/s/2;for(let f=0;f<s;f++){const p=f*c+l,m=t+i*Math.cos(p),_=e+i*Math.sin(p),g=p+Math.PI+h,b=p-Math.PI-h,x=m+n*Math.cos(g),y=_+n*Math.sin(g),T=m+n*Math.cos(b),A=_+n*Math.sin(b);f===0?this.moveTo(x,y):this.lineTo(x,y),this.quadraticCurveTo(m,_,T,A,o)}return this.closePath()}roundShape(t,e,i=!1,s){return t.length<3?this:(i?hp(this,t,e,s):cp(this,t,e),this.closePath())}filletRect(t,e,i,s,n){if(n===0)return this.rect(t,e,i,s);const a=Math.min(i,s)/2,o=Math.min(a,Math.max(-a,n)),u=t+i,l=e+s,c=o<0?-o:0,h=Math.abs(o);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+i-h,l,h).lineTo(t+h,l).arcTo(t+c,l-c,t,l-h,h).closePath()}chamferRect(t,e,i,s,n,a){if(n<=0)return this.rect(t,e,i,s);const o=Math.min(n,Math.min(i,s)/2),u=t+i,l=e+s,c=[t+o,e,u-o,e,u,e+o,u,l-o,u-o,l,t+o,l,t,l-o,t,e+o];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,a)}ellipse(t,e,i,s,n){return this.drawShape(new Ds(t,e,i,s),n),this}roundRect(t,e,i,s,n,a){return this.drawShape(new Bs(t,e,i,s,n),a),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let i=this._currentPoly;return i&&this.endPoly(),i=new dr,i.points.push(t,e),this._currentPoly=i,this}endPoly(t=!1){const e=this._currentPoly;return e&&e.points.length>2&&(e.closePath=t,this.shapePrimitives.push({shape:e})),this._currentPoly=null,this}_ensurePoly(t=!0){if(!this._currentPoly&&(this._currentPoly=new dr,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let i=e.shape.x,s=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,a=i;i=n.a*i+n.c*s+n.tx,s=n.b*a+n.d*s+n.ty}this._currentPoly.points.push(i,s)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const i=t.instructions[e];this[i.action](...i.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let i=0;i<e.length;i++){const s=e[i],n=s.shape.getBounds(eT);s.transform?t.addRect(n,s.transform):t.addRect(n)}return t}}class pe{constructor(t){this.instructions=[],this.uid=J("graphicsPath"),this._dirty=!0;var e;typeof t=="string"?sp(t,this):this.instructions=(e=t==null?void 0:t.slice())!=null?e:[]}get shapePath(){return this._shapePath||(this._shapePath=new dp(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,i,s,n){const a=this.instructions[this.instructions.length-1],o=this.getLastPoint(nt.shared);let u=0,l=0;if(!a||a.action!=="bezierCurveTo")u=o.x,l=o.y;else{u=a.data[2],l=a.data[3];const c=o.x,h=o.y;u=c+(c-u),l=h+(h-l)}return this.instructions.push({action:"bezierCurveTo",data:[u,l,t,e,i,s,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,i){const s=this.instructions[this.instructions.length-1],n=this.getLastPoint(nt.shared);let a=0,o=0;if(!s||s.action!=="quadraticCurveTo")a=n.x,o=n.y;else{a=s.data[0],o=s.data[1];const u=n.x,l=n.y;a=u+(u-a),o=l+(l-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,e,i]}),this._dirty=!0,this}rect(t,e,i,s,n){return this.instructions.push({action:"rect",data:[t,e,i,s,n]}),this._dirty=!0,this}circle(t,e,i,s){return this.instructions.push({action:"circle",data:[t,e,i,s]}),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,i,s,n,a,o){n=n||s/2;const u=-1*Math.PI/2+a,l=i*2,c=Math.PI*2/l,h=[];for(let f=0;f<l;f++){const p=f%2?n:s,m=f*c+u;h.push(t+p*Math.cos(m),e+p*Math.sin(m))}return this.poly(h,!0,o),this}clone(t=!1){const e=new pe;if(!t)e.instructions=this.instructions.slice();else for(let i=0;i<this.instructions.length;i++){const s=this.instructions[i];e.instructions.push({action:s.action,data:s.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,i=t.b,s=t.c,n=t.d,a=t.tx,o=t.ty;let u=0,l=0,c=0,h=0,f=0,p=0,m=0,_=0;for(let g=0;g<this.instructions.length;g++){const b=this.instructions[g],x=b.data;switch(b.action){case"moveTo":case"lineTo":u=x[0],l=x[1],x[0]=e*u+s*l+a,x[1]=i*u+n*l+o;break;case"bezierCurveTo":c=x[0],h=x[1],f=x[2],p=x[3],u=x[4],l=x[5],x[0]=e*c+s*h+a,x[1]=i*c+n*h+o,x[2]=e*f+s*p+a,x[3]=i*f+n*p+o,x[4]=e*u+s*l+a,x[5]=i*u+n*l+o;break;case"quadraticCurveTo":c=x[0],h=x[1],u=x[2],l=x[3],x[0]=e*c+s*h+a,x[1]=i*c+n*h+o,x[2]=e*u+s*l+a,x[3]=i*u+n*l+o;break;case"arcToSvg":u=x[5],l=x[6],m=x[0],_=x[1],x[0]=e*m+s*_,x[1]=i*m+n*_,x[5]=e*u+s*l+a,x[6]=i*u+n*l+o;break;case"circle":x[4]=ai(x[3],t);break;case"rect":x[4]=ai(x[4],t);break;case"ellipse":x[8]=ai(x[8],t);break;case"roundRect":x[5]=ai(x[5],t);break;case"addPath":x[0].transform(t);break;case"poly":x[2]=ai(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,i=this.instructions[e];if(!i)return t.x=0,t.y=0,t;for(;i.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;i=this.instructions[e]}switch(i.action){case"moveTo":case"lineTo":t.x=i.data[0],t.y=i.data[1];break;case"quadraticCurveTo":t.x=i.data[2],t.y=i.data[3];break;case"bezierCurveTo":t.x=i.data[4],t.y=i.data[5];break;case"arc":case"arcToSvg":t.x=i.data[5],t.y=i.data[6];break;case"addPath":i.data[0].getLastPoint(t);break}return t}}function ai(r,t){return r?r.prepend(t):t.clone()}var rT=Object.defineProperty,fp=Object.getOwnPropertySymbols,iT=Object.prototype.hasOwnProperty,sT=Object.prototype.propertyIsEnumerable,pp=(r,t,e)=>t in r?rT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fs=(r,t)=>{for(var e in t||(t={}))iT.call(t,e)&&pp(r,e,t[e]);if(fp)for(var e of fp(t))sT.call(t,e)&&pp(r,e,t[e]);return r};function mp(r,t){if(typeof r=="string"){const i=document.createElement("div");i.innerHTML=r.trim(),r=i.querySelector("svg")}const e={context:t,path:new pe};return gp(r,e,null,null),t}function gp(r,t,e,i){const s=r.children,{fillStyle:n,strokeStyle:a}=nT(r);n&&e?e=Fs(Fs({},e),n):n&&(e=n),a&&i?i=Fs(Fs({},i),a):a&&(i=a),t.context.fillStyle=e,t.context.strokeStyle=i;let o,u,l,c,h,f,p,m,_,g,b,x,y,T,A,R,C;switch(r.nodeName.toLowerCase()){case"path":T=r.getAttribute("d"),A=new pe(T),t.context.path(A),e&&t.context.fill(),i&&t.context.stroke();break;case"circle":p=ht(r,"cx",0),m=ht(r,"cy",0),_=ht(r,"r",0),t.context.ellipse(p,m,_,_),e&&t.context.fill(),i&&t.context.stroke();break;case"rect":o=ht(r,"x",0),u=ht(r,"y",0),R=ht(r,"width",0),C=ht(r,"height",0),g=ht(r,"rx",0),b=ht(r,"ry",0),g||b?t.context.roundRect(o,u,R,C,g||b):t.context.rect(o,u,R,C),e&&t.context.fill(),i&&t.context.stroke();break;case"ellipse":p=ht(r,"cx",0),m=ht(r,"cy",0),g=ht(r,"rx",0),b=ht(r,"ry",0),t.context.beginPath(),t.context.ellipse(p,m,g,b),e&&t.context.fill(),i&&t.context.stroke();break;case"line":l=ht(r,"x1",0),c=ht(r,"y1",0),h=ht(r,"x2",0),f=ht(r,"y2",0),t.context.beginPath(),t.context.moveTo(l,c),t.context.lineTo(h,f),i&&t.context.stroke();break;case"polygon":y=r.getAttribute("points"),x=y.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!0),e&&t.context.fill(),i&&t.context.stroke();break;case"polyline":y=r.getAttribute("points"),x=y.match(/\d+/g).map(P=>parseInt(P,10)),t.context.poly(x,!1),i&&t.context.stroke();break;case"g":case"svg":break;default:{console.info(`[SVG parser] <${r.nodeName}> elements unsupported`);break}}for(let P=0;P<s.length;P++)gp(s[P],t,e,i)}function ht(r,t,e){const i=r.getAttribute(t);return i?Number(i):e}function nT(r){const t=r.getAttribute("style"),e={},i={};let s=!1,n=!1;if(t){const a=t.split(";");for(let o=0;o<a.length;o++){const u=a[o],[l,c]=u.split(":");switch(l){case"stroke":c!=="none"&&(e.color=V.shared.setValue(c).toNumber(),n=!0);break;case"stroke-width":e.width=Number(c);break;case"fill":c!=="none"&&(s=!0,i.color=V.shared.setValue(c).toNumber());break;case"fill-opacity":i.alpha=Number(c);break;case"stroke-opacity":e.alpha=Number(c);break;case"opacity":i.alpha=Number(c),e.alpha=Number(c);break}}}else{const a=r.getAttribute("stroke");a&&a!=="none"&&(n=!0,e.color=V.shared.setValue(a).toNumber(),e.width=ht(r,"stroke-width",1));const o=r.getAttribute("fill");o&&o!=="none"&&(s=!0,i.color=V.shared.setValue(o).toNumber())}return{strokeStyle:n?e:null,fillStyle:s?i:null}}var aT=Object.defineProperty,Is=Object.getOwnPropertySymbols,_p=Object.prototype.hasOwnProperty,bp=Object.prototype.propertyIsEnumerable,yp=(r,t,e)=>t in r?aT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ue=(r,t)=>{for(var e in t||(t={}))_p.call(t,e)&&yp(r,e,t[e]);if(Is)for(var e of Is(t))bp.call(t,e)&&yp(r,e,t[e]);return r},oT=(r,t)=>{var e={};for(var i in r)_p.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Is)for(var i of Is(r))t.indexOf(i)<0&&bp.call(r,i)&&(e[i]=r[i]);return e};function uT(r){return V.isColorLike(r)}function xp(r){return r instanceof ii}function vp(r){return r instanceof hr}function lT(r,t,e){const i=V.shared.setValue(t!=null?t:0);return r.color=i.toNumber(),r.alpha=i.alpha===1?e.alpha:i.alpha,r.texture=w.WHITE,ue(ue({},e),r)}function Tp(r,t,e){return r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,ue(ue({},e),r)}function Sp(r,t,e){return t.buildLinearGradient(),r.fill=t,r.color=16777215,r.texture=t.texture,r.matrix=t.transform,ue(ue({},e),r)}function cT(r,t){var e;const i=ue(ue({},t),r);if(i.texture){if(i.texture!==w.WHITE){const a=((e=i.matrix)==null?void 0:e.invert())||new G;a.translate(i.texture.frame.x,i.texture.frame.y),a.scale(1/i.texture.source.width,1/i.texture.source.height),i.matrix=a}const n=i.texture.source.style;n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update())}const s=V.shared.setValue(i.color);return i.alpha*=s.alpha,i.color=s.toNumber(),i.matrix=i.matrix?i.matrix.clone():null,i}function me(r,t){if(r==null)return null;const e={},i=r;return uT(r)?lT(e,r,t):xp(r)?Tp(e,r,t):vp(r)?Sp(e,r,t):i.fill&&xp(i.fill)?Tp(i,i.fill,t):i.fill&&vp(i.fill)?Sp(i,i.fill,t):cT(i,t)}function oi(r,t){const e=t,{width:i,alignment:s,miterLimit:n,cap:a,join:o}=e,u=oT(e,["width","alignment","miterLimit","cap","join"]),l=me(r,u);return l?ue({width:i,alignment:s,miterLimit:n,cap:a,join:o},l):null}var hT=Object.defineProperty,Ap=Object.getOwnPropertySymbols,dT=Object.prototype.hasOwnProperty,fT=Object.prototype.propertyIsEnumerable,Ep=(r,t,e)=>t in r?hT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,pr=(r,t)=>{for(var e in t||(t={}))dT.call(t,e)&&Ep(r,e,t[e]);if(Ap)for(var e of Ap(t))fT.call(t,e)&&Ep(r,e,t[e]);return r};const pT=new nt,wp=new G,wo=class Jt extends Rt{constructor(){super(...arguments),this.uid=J("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this._activePath=new pe,this._transform=new G,this._fillStyle=pr({},Jt.defaultFillStyle),this._strokeStyle=pr({},Jt.defaultStrokeStyle),this._stateStack=[],this._tick=0,this._bounds=new ft,this._boundsDirty=!0}clone(){const t=new Jt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle=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=me(t,Jt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=oi(t,Jt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=me(t,Jt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=me(t,Jt.defaultStrokeStyle),this}texture(t,e,i,s,n,a){return this.instructions.push({action:"texture",data:{image:t,dx:i||0,dy:s||0,dw:n||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e?V.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new pe,this}fill(t,e){let i;const s=this.instructions[this.instructions.length-1];return this._tick===0&&s&&s.action==="stroke"?i=s.data.path:i=this._activePath.clone(),i?(t!=null&&(e!==void 0&&typeof t=="number"&&(t={color:t,alpha:e}),this._fillStyle=me(t,Jt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:i}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(nt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const i=this.instructions[this.instructions.length-1];return this._tick===0&&i&&i.action==="fill"?e=i.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=oi(t,Jt.defaultStrokeStyle)),this.instructions.push({action:"stroke",data:{style:this.strokeStyle,path:e}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}cut(){for(let t=0;t<2;t++){const e=this.instructions[this.instructions.length-1-t],i=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(i);else{e.data.hole=i;break}}return this._initNextPathLocation(),this}arc(t,e,i,s,n,a){this._tick++;const o=this._transform;return this._activePath.arc(o.a*t+o.c*e+o.tx,o.b*t+o.d*e+o.ty,i,s,n,a),this}arcTo(t,e,i,s,n){this._tick++;const a=this._transform;return this._activePath.arcTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*s+a.tx,a.b*i+a.d*s+a.ty,n),this}arcToSvg(t,e,i,s,n,a,o){this._tick++;const u=this._transform;return this._activePath.arcToSvg(t,e,i,s,n,u.a*a+u.c*o+u.tx,u.b*a+u.d*o+u.ty),this}bezierCurveTo(t,e,i,s,n,a,o){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*i+u.c*s+u.tx,u.b*i+u.d*s+u.ty,u.a*n+u.c*a+u.tx,u.b*n+u.d*a+u.ty,o),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,i,s){return this._tick++,this._activePath.ellipse(t,e,i,s,this._transform.clone()),this}circle(t,e,i){return this._tick++,this._activePath.circle(t,e,i,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const i=this._transform;return this._activePath.lineTo(i.a*t+i.c*e+i.tx,i.b*t+i.d*e+i.ty),this}moveTo(t,e){this._tick++;const i=this._transform,s=this._activePath.instructions,n=i.a*t+i.c*e+i.tx,a=i.b*t+i.d*e+i.ty;return s.length===1&&s[0].action==="moveTo"?(s[0].data[0]=n,s[0].data[1]=a,this):(this._activePath.moveTo(n,a),this)}quadraticCurveTo(t,e,i,s,n){this._tick++;const a=this._transform;return this._activePath.quadraticCurveTo(a.a*t+a.c*e+a.tx,a.b*t+a.d*e+a.ty,a.a*i+a.c*s+a.tx,a.b*i+a.d*s+a.ty,n),this}rect(t,e,i,s){return this._tick++,this._activePath.rect(t,e,i,s,this._transform.clone()),this}roundRect(t,e,i,s,n){return this._tick++,this._activePath.roundRect(t,e,i,s,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,i,s,n=0,a){return this._tick++,this._activePath.regularPoly(t,e,i,s,n,a),this}roundPoly(t,e,i,s,n,a){return this._tick++,this._activePath.roundPoly(t,e,i,s,n,a),this}roundShape(t,e,i,s){return this._tick++,this._activePath.roundShape(t,e,i,s),this}filletRect(t,e,i,s,n){return this._tick++,this._activePath.filletRect(t,e,i,s,n),this}chamferRect(t,e,i,s,n,a){return this._tick++,this._activePath.chamferRect(t,e,i,s,n,a),this}star(t,e,i,s,n=0,a=0){return this._tick++,this._activePath.star(t,e,i,s,n,a,this._transform.clone()),this}svg(t){return this._tick++,mp(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,i,s,n,a){return t instanceof G?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,i,s,n,a),this)}transform(t,e,i,s,n,a){return t instanceof G?(this._transform.append(t),this):(wp.set(t,e,i,s,n,a),this._transform.append(wp),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 i=this.instructions[e],s=i.action;if(s==="fill"){const n=i.data;t.addBounds(n.path.bounds)}else if(s==="texture"){const n=i.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(s==="stroke"){const n=i.data,a=n.style.width/2,o=n.path.bounds;t.addFrame(o.minX-a,o.minY-a,o.maxX+a,o.maxY+a)}}return t}containsPoint(t){var e;if(!this.bounds.containsPoint(t.x,t.y))return!1;const i=this.instructions;let s=!1;for(let n=0;n<i.length;n++){const a=i[n],o=a.data,u=o.path;if(!a.action||!u)continue;const l=o.style,c=u.shapePath.shapePrimitives;for(let h=0;h<c.length;h++){const f=c[h].shape;if(!l||!f)continue;const p=c[h].transform,m=p?p.applyInverse(t,pT):t;a.action==="fill"?s=f.contains(m.x,m.y):s=f.strokeContains(m.x,m.y,l.width);const _=o.hole;if(_){const g=(e=_.shapePath)==null?void 0:e.shapePrimitives;if(g)for(let b=0;b<g.length;b++)g[b].shape.contains(m.x,m.y)&&(s=!1)}if(s)return!0}}return s}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}};wo.defaultFillStyle={color:16777215,alpha:1,texture:w.WHITE,matrix:null,fill:null},wo.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:w.WHITE,matrix:null,fill:null};let _t=wo;const Cp=["align","breakWords","cssOverrides","fontVariant","fontWeight","leading","letterSpacing","lineHeight","padding","textBaseline","trim","whiteSpace","wordWrap","wordWrapWidth","fontFamily","fontStyle","fontSize"];function Co(r){const t=[];let e=0;for(let i=0;i<Cp.length;i++){const s=`_${Cp[i]}`;t[e++]=r[s]}return e=Rp(r._fill,t,e),e=mT(r._stroke,t,e),e=gT(r.dropShadow,t,e),t.join("-")}function Rp(r,t,e){var i;return r&&(t[e++]=r.color,t[e++]=r.alpha,t[e++]=(i=r.fill)==null?void 0:i.styleKey),e}function mT(r,t,e){return r&&(e=Rp(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 gT(r,t,e){return r&&(t[e++]=r.alpha,t[e++]=r.angle,t[e++]=r.blur,t[e++]=r.distance,t[e++]=V.shared.setValue(r.color).toNumber()),e}var _T=Object.defineProperty,bT=Object.defineProperties,yT=Object.getOwnPropertyDescriptors,Pp=Object.getOwnPropertySymbols,xT=Object.prototype.hasOwnProperty,vT=Object.prototype.propertyIsEnumerable,Mp=(r,t,e)=>t in r?_T(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Dt=(r,t)=>{for(var e in t||(t={}))xT.call(t,e)&&Mp(r,e,t[e]);if(Pp)for(var e of Pp(t))vT.call(t,e)&&Mp(r,e,t[e]);return r},TT=(r,t)=>bT(r,yT(t));const Ro=class Cr extends Rt{constructor(t={}){super(),ST(t);const e=Dt(Dt({},Cr.defaultTextStyle),t);for(const i in e){const s=i;this[s]=e[i]}this.update()}get align(){return this._align}set align(t){this._align=t,this.update()}get breakWords(){return this._breakWords}set breakWords(t){this._breakWords=t,this.update()}get dropShadow(){return this._dropShadow}set dropShadow(t){t!==null&&typeof t=="object"?this._dropShadow=this._createProxy(Dt(Dt({},Cr.defaultDropShadow),t)):this._dropShadow=t?this._createProxy(Dt({},Cr.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(Dt(Dt({},_t.defaultFillStyle),t),()=>{this._fill=me(Dt({},this._originalFill),_t.defaultFillStyle)})),this._fill=me(t===0?"black":t,_t.defaultFillStyle),this.update())}get stroke(){return this._originalStroke}set stroke(t){t!==this._originalStroke&&(this._originalStroke=t,this._isFillStyle(t)&&(this._originalStroke=this._createProxy(Dt(Dt({},_t.defaultStrokeStyle),t),()=>{this._stroke=oi(Dt({},this._originalStroke),_t.defaultStrokeStyle)})),this._stroke=oi(t,_t.defaultStrokeStyle),this.update())}_generateKey(){return this._styleKey=Co(this),this._styleKey}update(){this._styleKey=null,this.emit("update",this)}reset(){const t=Cr.defaultTextStyle;for(const e in t)this[e]=t[e]}get styleKey(){return this._styleKey||this._generateKey()}clone(){return new Cr({align:this.align,breakWords:this.breakWords,dropShadow:this._dropShadow?Dt({},this._dropShadow):null,fill:this._fill,fontFamily:this.fontFamily,fontSize:this.fontSize,fontStyle:this.fontStyle,fontVariant:this.fontVariant,fontWeight:this.fontWeight,leading:this.leading,letterSpacing:this.letterSpacing,lineHeight:this.lineHeight,padding:this.padding,stroke:this._stroke,textBaseline:this.textBaseline,whiteSpace:this.whiteSpace,wordWrap:this.wordWrap,wordWrapWidth:this.wordWrapWidth})}destroy(t=!1){var e,i,s,n;if(this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const a=typeof t=="boolean"?t:t==null?void 0:t.textureSource;(e=this._fill)!=null&&e.texture&&this._fill.texture.destroy(a),(i=this._originalFill)!=null&&i.texture&&this._originalFill.texture.destroy(a),(s=this._stroke)!=null&&s.texture&&this._stroke.texture.destroy(a),(n=this._originalStroke)!=null&&n.texture&&this._originalStroke.texture.destroy(a)}this._fill=null,this._stroke=null,this.dropShadow=null,this._originalStroke=null,this._originalFill=null}_createProxy(t,e){return new Proxy(t,{set:(i,s,n)=>(i[s]=n,e==null||e(s,n),this.update(),!0)})}_isFillStyle(t){return(t!=null?t:null)!==null&&!(V.isColorLike(t)||t instanceof hr||t instanceof ii)}};Ro.defaultDropShadow={alpha:1,angle:Math.PI/6,blur:0,color:"black",distance:5},Ro.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 Ot=Ro;function ST(r){var t,e,i,s,n;const a=r;if(typeof a.dropShadow=="boolean"&&a.dropShadow){const o=Ot.defaultDropShadow;r.dropShadow={alpha:(t=a.dropShadowAlpha)!=null?t:o.alpha,angle:(e=a.dropShadowAngle)!=null?e:o.angle,blur:(i=a.dropShadowBlur)!=null?i:o.blur,color:(s=a.dropShadowColor)!=null?s:o.color,distance:(n=a.dropShadowDistance)!=null?n:o.distance}}if(a.strokeThickness!==void 0){const o=a.stroke;let u={};if(V.isColorLike(o))u.color=o;else if(o instanceof hr||o instanceof ii)u.fill=o;else if(Object.hasOwnProperty.call(o,"color")||Object.hasOwnProperty.call(o,"fill"))u=o;else throw new Error("Invalid stroke value.");r.stroke=TT(Dt({},u),{width:a.strokeThickness})}if(Array.isArray(a.fillGradientStops)){let o;r.fontSize==null?r.fontSize=Ot.defaultTextStyle.fontSize:typeof r.fontSize=="string"?o=parseInt(r.fontSize,10):o=r.fontSize;const u=new hr(0,0,0,o*1.7),l=a.fillGradientStops.map(c=>V.shared.setValue(c).toNumber());l.forEach((c,h)=>{const f=h/(l.length-1);u.addColorStop(f,c)}),r.fill={fill:u}}}const AT=new ft;function Po(r,t,e,i){const s=AT;s.minX=0,s.minY=0,s.maxX=r.width/i|0,s.maxY=r.height/i|0;const n=pt.getOptimalTexture(s.width,s.height,i,!1);return n.source.uploadMethodId="image",n.source.resource=r,n.source.alphaMode="premultiply-alpha-on-upload",n.frame.width=t/i,n.frame.height=e/i,n.source.emit("update",n.source),n.updateUvs(),n}const ET=["serif","sans-serif","monospace","cursive","fantasy","system-ui"];function ui(r){const t=typeof r.fontSize=="number"?`${r.fontSize}px`:r.fontSize;let e=r.fontFamily;Array.isArray(r.fontFamily)||(e=r.fontFamily.split(","));for(let i=e.length-1;i>=0;i--){let s=e[i].trim();!/([\"\'])[^\'\"]+\1/.test(s)&&!ET.includes(s)&&(s=`"${s}"`),e[i]=s}return`${r.fontStyle} ${r.fontVariant} ${r.fontWeight} ${t} ${e.join(",")}`}const Mo={willReadFrequently:!0},Xt=class M{static get experimentalLetterSpacingSupported(){let t=M._experimentalLetterSpacingSupported;if(t!==void 0){const e=$.get().getCanvasRenderingContext2D().prototype;t=M._experimentalLetterSpacingSupported="letterSpacing"in e||"textLetterSpacing"in e}return t}constructor(t,e,i,s,n,a,o,u,l){this.text=t,this.style=e,this.width=i,this.height=s,this.lines=n,this.lineWidths=a,this.lineHeight=o,this.maxLineWidth=u,this.fontProperties=l}static measureText(t=" ",e,i=M._canvas,s=e.wordWrap){var n;const a=`${t}:${e.styleKey}`;if(M._measurementCache[a])return M._measurementCache[a];const o=ui(e),u=M.measureFont(o);u.fontSize===0&&(u.fontSize=e.fontSize,u.ascent=e.fontSize);const l=M.__context;l.font=o;const c=(s?M._wordWrap(t,e,i):t).split(/(?:\r\n|\r|\n)/),h=new Array(c.length);let f=0;for(let b=0;b<c.length;b++){const x=M._measureText(c[b],e.letterSpacing,l);h[b]=x,f=Math.max(f,x)}const p=((n=e._stroke)==null?void 0:n.width)||0;let m=f+p;e.dropShadow&&(m+=e.dropShadow.distance);const _=e.lineHeight||u.fontSize;let g=Math.max(_,u.fontSize+p)+(c.length-1)*(_+e.leading);return e.dropShadow&&(g+=e.dropShadow.distance),new M(t,e,m,g,c,h,_+e.leading,f,u)}static _measureText(t,e,i){let s=!1;M.experimentalLetterSpacingSupported&&(M.experimentalLetterSpacing?(i.letterSpacing=`${e}px`,i.textLetterSpacing=`${e}px`,s=!0):(i.letterSpacing="0px",i.textLetterSpacing="0px"));let n=i.measureText(t).width;return n>0&&(s?n-=e:n+=(M.graphemeSegmenter(t).length-1)*e),n}static _wordWrap(t,e,i=M._canvas){const s=i.getContext("2d",Mo);let n=0,a="",o="";const u=Object.create(null),{letterSpacing:l,whiteSpace:c}=e,h=M._collapseSpaces(c),f=M._collapseNewlines(c);let p=!h;const m=e.wordWrapWidth+l,_=M._tokenize(t);for(let g=0;g<_.length;g++){let b=_[g];if(M._isNewline(b)){if(!f){o+=M._addLine(a),p=!h,a="",n=0;continue}b=" "}if(h){const y=M.isBreakingSpace(b),T=M.isBreakingSpace(a[a.length-1]);if(y&&T)continue}const x=M._getFromCache(b,l,u,s);if(x>m)if(a!==""&&(o+=M._addLine(a),a="",n=0),M.canBreakWords(b,e.breakWords)){const y=M.wordWrapSplit(b);for(let T=0;T<y.length;T++){let A=y[T],R=A,C=1;for(;y[T+C];){const S=y[T+C];if(!M.canBreakChars(R,S,b,T,e.breakWords))A+=S;else break;R=S,C++}T+=C-1;const P=M._getFromCache(A,l,u,s);P+n>m&&(o+=M._addLine(a),p=!1,a="",n=0),a+=A,n+=P}}else{a.length>0&&(o+=M._addLine(a),a="",n=0);const y=g===_.length-1;o+=M._addLine(b,!y),p=!1,a="",n=0}else x+n>m&&(p=!1,o+=M._addLine(a),a="",n=0),(a.length>0||!M.isBreakingSpace(b)||p)&&(a+=b,n+=x)}return o+=M._addLine(a,!1),o}static _addLine(t,e=!0){return t=M._trimRight(t),t=e?`${t}
`:t,t}static _getFromCache(t,e,i,s){let n=i[t];return typeof n!="number"&&(n=M._measureText(t,e,s)+e,i[t]=n),n}static _collapseSpaces(t){return t==="normal"||t==="pre-line"}static _collapseNewlines(t){return t==="normal"}static _trimRight(t){if(typeof t!="string")return"";for(let e=t.length-1;e>=0;e--){const i=t[e];if(!M.isBreakingSpace(i))break;t=t.slice(0,-1)}return t}static _isNewline(t){return typeof t!="string"?!1:M._newlines.includes(t.charCodeAt(0))}static isBreakingSpace(t,e){return typeof t!="string"?!1:M._breakingSpaces.includes(t.charCodeAt(0))}static _tokenize(t){const e=[];let i="";if(typeof t!="string")return e;for(let s=0;s<t.length;s++){const n=t[s],a=t[s+1];if(M.isBreakingSpace(n,a)||M._isNewline(n)){i!==""&&(e.push(i),i=""),e.push(n);continue}i+=n}return i!==""&&e.push(i),e}static canBreakWords(t,e){return e}static canBreakChars(t,e,i,s,n){return!0}static wordWrapSplit(t){return M.graphemeSegmenter(t)}static measureFont(t){if(M._fonts[t])return M._fonts[t];const e=M._context;e.font=t;const i=e.measureText(M.METRICS_STRING+M.BASELINE_SYMBOL),s={ascent:i.actualBoundingBoxAscent,descent:i.actualBoundingBoxDescent,fontSize:i.actualBoundingBoxAscent+i.actualBoundingBoxDescent};return M._fonts[t]=s,s}static clearMetrics(t=""){t?delete M._fonts[t]:M._fonts={}}static get _canvas(){if(!M.__canvas){let t;try{const e=new OffscreenCanvas(0,0),i=e.getContext("2d",Mo);if(i!=null&&i.measureText)return M.__canvas=e,e;t=$.get().createCanvas()}catch(e){t=$.get().createCanvas()}t.width=t.height=10,M.__canvas=t}return M.__canvas}static get _context(){return M.__context||(M.__context=M._canvas.getContext("2d",Mo)),M.__context}};Xt.METRICS_STRING="|\xC9q\xC5",Xt.BASELINE_SYMBOL="M",Xt.BASELINE_MULTIPLIER=1.4,Xt.HEIGHT_MULTIPLIER=2,Xt.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]})(),Xt.experimentalLetterSpacing=!1,Xt._fonts={},Xt._newlines=[10,13],Xt._breakingSpaces=[9,32,8192,8193,8194,8195,8196,8197,8198,8200,8201,8202,8287,12288],Xt._measurementCache={};let zt=Xt;function li(r,t){var e;if(r.texture===w.WHITE&&!r.fill)return V.shared.setValue(r.color).setAlpha((e=r.alpha)!=null?e:1).toHexa();if(r.fill){if(r.fill instanceof ii){const i=r.fill,s=t.createPattern(i.texture.source.resource,"repeat"),n=i.transform.copyTo(G.shared);return n.scale(i.texture.frame.width,i.texture.frame.height),s.setTransform(n),s}else if(r.fill instanceof hr){const i=r.fill;if(i.type==="linear"){const s=t.createLinearGradient(i.x0,i.y0,i.x1,i.y1);return i.gradientStops.forEach(n=>{s.addColorStop(n.offset,V.shared.setValue(n.color).toHex())}),s}}}else{const i=t.createPattern(r.texture.source.resource,"repeat"),s=r.matrix.copyTo(G.shared);return s.scale(r.texture.frame.width,r.texture.frame.height),i.setTransform(s),i}return"red"}class Do{constructor(t){this._activeTextures={},this._renderer=t}getTextureSize(t,e,i){const s=zt.measureText(t||" ",i);let n=Math.ceil(Math.ceil(Math.max(1,s.width)+i.padding*2)*e),a=Math.ceil(Math.ceil(Math.max(1,s.height)+i.padding*2)*e);return n=Math.ceil(n-1e-6),a=Math.ceil(a-1e-6),n=Pe(n),a=Pe(a),{width:n,height:a}}getTexture(t,e,i,s){typeof t=="string"&&(qa("8.0.0","CanvasTextSystem.getTexture: Use object TextOptions instead of separate arguments"),t={text:t,style:i,resolution:e}),t.style instanceof Ot||(t.style=new Ot(t.style));const{texture:n,canvasAndContext:a}=this.createTextureAndCanvas(t);return this._renderer.texture.initSource(n._source),Qt.returnCanvasAndContext(a),n}createTextureAndCanvas(t){var e;const{text:i,style:s}=t,n=(e=t.resolution)!=null?e:this._renderer.resolution,a=zt.measureText(i||" ",s),o=Math.ceil(Math.ceil(Math.max(1,a.width)+s.padding*2)*n),u=Math.ceil(Math.ceil(Math.max(1,a.height)+s.padding*2)*n),l=Qt.getOptimalCanvasAndContext(o,u),{canvas:c}=l;this.renderTextToCanvas(i,s,n,l);const h=Po(c,o,u,n);if(s.trim){const f=ep(c,n);h.frame.copyFrom(f),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:i,canvasAndContext:s}=this.createTextureAndCanvas(t);return this._activeTextures[e]={canvasAndContext:s,texture:i,usageCount:1},i}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];if(e.usageCount--,e.usageCount===0){Qt.returnCanvasAndContext(e.canvasAndContext),pt.returnTexture(e.texture);const i=e.texture.source;i.resource=null,i.uploadMethodId="unknown",i.alphaMode="no-premultiply-alpha",this._activeTextures[t]=null}}getReferenceCount(t){return this._activeTextures[t].usageCount}renderTextToCanvas(t,e,i,s){var n,a,o,u,l,c,h;const{canvas:f,context:p}=s,m=ui(e),_=zt.measureText(t||" ",e),g=_.lines,b=_.lineHeight,x=_.lineWidths,y=_.maxLineWidth,T=_.fontProperties,A=f.height;p.resetTransform(),p.scale(i,i);const R=e.padding*2;if(p.clearRect(0,0,_.width+4+R,_.height+4+R),(n=e._stroke)!=null&&n.width){const E=e._stroke;p.lineWidth=E.width,p.miterLimit=E.miterLimit,p.lineJoin=E.join,p.lineCap=E.cap}p.font=m;let C,P;const S=e.dropShadow?2:1;for(let E=0;E<S;++E){const F=e.dropShadow&&E===0,N=F?Math.ceil(Math.max(1,A)+e.padding*2):0,O=N*i;if(F){p.fillStyle="black",p.strokeStyle="black";const D=e.dropShadow,Z=D.color,wr=D.alpha;p.shadowColor=V.shared.setValue(Z).setAlpha(wr).toRgbaString();const I=D.blur*i,k=D.distance*i;p.shadowBlur=I,p.shadowOffsetX=Math.cos(D.angle)*k,p.shadowOffsetY=Math.sin(D.angle)*k+O}else p.globalAlpha=(o=(a=e._fill)==null?void 0:a.alpha)!=null?o:1,p.fillStyle=e._fill?li(e._fill,p):null,(u=e._stroke)!=null&&u.width&&(p.strokeStyle=li(e._stroke,p)),p.shadowColor="black";let B=(b-T.fontSize)/2;b-T.fontSize<0&&(B=0);const q=(c=(l=e._stroke)==null?void 0:l.width)!=null?c:0;for(let D=0;D<g.length;D++)C=q/2,P=q/2+D*b+T.ascent+B,e.align==="right"?C+=y-x[D]:e.align==="center"&&(C+=(y-x[D])/2),(h=e._stroke)!=null&&h.width&&this._drawLetterSpacing(g[D],e,s,C+e.padding,P+e.padding-N,!0),e._fill!==void 0&&this._drawLetterSpacing(g[D],e,s,C+e.padding,P+e.padding-N)}}_drawLetterSpacing(t,e,i,s,n,a=!1){const{context:o}=i,u=e.letterSpacing;let l=!1;if(zt.experimentalLetterSpacingSupported&&(zt.experimentalLetterSpacing?(o.letterSpacing=`${u}px`,o.textLetterSpacing=`${u}px`,l=!0):(o.letterSpacing="0px",o.textLetterSpacing="0px")),u===0||l){a?o.strokeText(t,s,n):o.fillText(t,s,n);return}let c=s;const h=zt.graphemeSegmenter(t);let f=o.measureText(t).width,p=0;for(let m=0;m<h.length;++m){const _=h[m];a?o.strokeText(_,c,n):o.fillText(_,c,n);let g="";for(let b=m+1;b<h.length;++b)g+=h[b];p=o.measureText(g).width,c+=f-p+u,f=p}}destroy(){this._activeTextures=null}}Do.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"canvasText"},L.add(Do),L.add(_o);var wT=Object.defineProperty,Us=Object.getOwnPropertySymbols,Dp=Object.prototype.hasOwnProperty,Op=Object.prototype.propertyIsEnumerable,Bp=(r,t,e)=>t in r?wT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,CT=(r,t)=>{for(var e in t||(t={}))Dp.call(t,e)&&Bp(r,e,t[e]);if(Us)for(var e of Us(t))Op.call(t,e)&&Bp(r,e,t[e]);return r},RT=(r,t)=>{var e={};for(var i in r)Dp.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Us)for(var i of Us(r))t.indexOf(i)<0&&Op.call(r,i)&&(e[i]=r[i]);return e};class mr extends Me{constructor(t){t instanceof _t&&(t={context:t});const e=t||{},{context:i,roundPixels:s}=e,n=RT(e,["context","roundPixels"]);super(CT({label:"Graphics"},n)),this.renderPipeId="graphics",i?this._context=i:this._context=this._ownedContext=new _t,this._context.on("update",this.onViewUpdate,this),this.allowChildren=!1,this.roundPixels=s!=null?s:!1}set context(t){t!==this._context&&(this._context.off("update",this.onViewUpdate,this),this._context=t,this._context.on("update",this.onViewUpdate,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}addBounds(t){t.addBounds(this._context.bounds)}containsPoint(t){return this._context.containsPoint(t)}onViewUpdate(){if(this._didViewChangeTick++,this._didGraphicsUpdate=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t){this._ownedContext&&!t?this._ownedContext.destroy(t):(t===!0||(t==null?void 0:t.context)===!0)&&this._context.destroy(t),this._ownedContext=null,this._context=null,super.destroy(t)}_callContextMethod(t,e){return this.context[t](...e),this}setFillStyle(...t){return this._callContextMethod("setFillStyle",t)}setStrokeStyle(...t){return this._callContextMethod("setStrokeStyle",t)}fill(...t){return this._callContextMethod("fill",t)}stroke(...t){return this._callContextMethod("stroke",t)}texture(...t){return this._callContextMethod("texture",t)}beginPath(){return this._callContextMethod("beginPath",[])}cut(){return this._callContextMethod("cut",[])}arc(...t){return this._callContextMethod("arc",t)}arcTo(...t){return this._callContextMethod("arcTo",t)}arcToSvg(...t){return this._callContextMethod("arcToSvg",t)}bezierCurveTo(...t){return this._callContextMethod("bezierCurveTo",t)}closePath(){return this._callContextMethod("closePath",[])}ellipse(...t){return this._callContextMethod("ellipse",t)}circle(...t){return this._callContextMethod("circle",t)}path(...t){return this._callContextMethod("path",t)}lineTo(...t){return this._callContextMethod("lineTo",t)}moveTo(...t){return this._callContextMethod("moveTo",t)}quadraticCurveTo(...t){return this._callContextMethod("quadraticCurveTo",t)}rect(...t){return this._callContextMethod("rect",t)}roundRect(...t){return this._callContextMethod("roundRect",t)}poly(...t){return this._callContextMethod("poly",t)}regularPoly(...t){return this._callContextMethod("regularPoly",t)}roundPoly(...t){return this._callContextMethod("roundPoly",t)}roundShape(...t){return this._callContextMethod("roundShape",t)}filletRect(...t){return this._callContextMethod("filletRect",t)}chamferRect(...t){return this._callContextMethod("chamferRect",t)}star(...t){return this._callContextMethod("star",t)}svg(...t){return this._callContextMethod("svg",t)}restore(...t){return this._callContextMethod("restore",t)}save(){return this._callContextMethod("save",[])}getTransform(){return this.context.getTransform()}resetTransform(){return this._callContextMethod("resetTransform",[])}rotateTransform(...t){return this._callContextMethod("rotate",t)}scaleTransform(...t){return this._callContextMethod("scale",t)}setTransform(...t){return this._callContextMethod("setTransform",t)}transform(...t){return this._callContextMethod("transform",t)}translateTransform(...t){return this._callContextMethod("translate",t)}clear(){return this._callContextMethod("clear",[])}get fillStyle(){return this._context.fillStyle}set fillStyle(t){this._context.fillStyle=t}get strokeStyle(){return this._context.strokeStyle}set strokeStyle(t){this._context.strokeStyle=t}clone(t=!1){return t?new mr(this._context.clone()):(this._ownedContext=null,new mr(this._context))}lineStyle(t,e,i){const s={};return t&&(s.width=t),e&&(s.color=e),i&&(s.alpha=i),this.context.strokeStyle=s,this}beginFill(t,e){const i={};return t&&(i.color=t),e&&(i.alpha=e),this.context.fillStyle=i,this}endFill(){this.context.fill();const t=this.context.strokeStyle;return(t.width!==_t.defaultStrokeStyle.width||t.color!==_t.defaultStrokeStyle.color||t.alpha!==_t.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return this._callContextMethod("circle",t)}drawEllipse(...t){return this._callContextMethod("ellipse",t)}drawPolygon(...t){return this._callContextMethod("poly",t)}drawRect(...t){return this._callContextMethod("rect",t)}drawRoundedRect(...t){return this._callContextMethod("roundRect",t)}drawStar(...t){return this._callContextMethod("star",t)}}const Gp={name:"local-uniform-msdf-bit",vertex:{header:`
struct LocalUniforms {
uColor:vec4<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));
`}},Fp={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));
`}},Ip={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;
}
`}},Up={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 Oo,Bo;class kp extends Ut{constructor(){const t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uDistance:{value:4,type:"f32"},uRound:{value:0,type:"f32"}}),e=Oe();Oo!=null||(Oo=ar({name:"sdf-shader",bits:[hs,fs(e),Gp,Ip,ur]})),Bo!=null||(Bo=or({name:"sdf-shader",bits:[ds,ps(e),Fp,Up,lr]})),super({glProgram:Bo,gpuProgram:Oo,resources:{localUniforms:t,batchSamplers:ms(e)}})}}let Go=0;const Lp=500;function ge(...r){Go!==Lp&&(Go++,Go===Lp?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...r))}class Fo extends Rt{constructor(){super(...arguments),this.chars=Object.create(null),this.lineHeight=0,this.fontFamily="",this.fontMetrics={fontSize:0,ascent:0,descent:0},this.baseLineOffset=0,this.distanceField={type:"none",range:0},this.pages=[],this.applyFillAsTint=!0,this.baseMeasurementFontSize=100,this.baseRenderedFontSize=100}get font(){return this.fontFamily}get pageTextures(){return this.pages}get size(){return this.fontMetrics.fontSize}get distanceFieldRange(){return this.distanceField.range}get distanceFieldType(){return this.distanceField.type}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners();for(const i in this.chars)(e=this.chars[i].texture)==null||e.destroy();this.chars=null,t&&(this.pages.forEach(i=>i.texture.destroy(!0)),this.pages=null)}}function Io(r){if(r==="")return[];typeof r=="string"&&(r=[r]);const t=[];for(let e=0,i=r.length;e<i;e++){const s=r[e];if(Array.isArray(s)){if(s.length!==2)throw new Error(`[BitmapFont]: Invalid character range length, expecting 2 got ${s.length}.`);if(s[0].length===0||s[1].length===0)throw new Error("[BitmapFont]: Invalid character delimiter.");const n=s[0].charCodeAt(0),a=s[1].charCodeAt(0);if(a<n)throw new Error("[BitmapFont]: Invalid character range.");for(let o=n,u=a;o<=u;o++)t.push(String.fromCharCode(o))}else t.push(...Array.from(s))}if(t.length===0)throw new Error("[BitmapFont]: Empty set when resolving characters.");return t}var PT=Object.defineProperty,Np=Object.getOwnPropertySymbols,MT=Object.prototype.hasOwnProperty,DT=Object.prototype.propertyIsEnumerable,$p=(r,t,e)=>t in r?PT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Hp=(r,t)=>{for(var e in t||(t={}))MT.call(t,e)&&$p(r,e,t[e]);if(Np)for(var e of Np(t))DT.call(t,e)&&$p(r,e,t[e]);return r};const Xp=class _y extends Fo{constructor(t){var e,i,s;super(),this.resolution=1,this.pages=[],this._padding=0,this._measureCache=Object.create(null),this._currentChars=[],this._currentX=0,this._currentY=0,this._currentPageIndex=-1,this._skipKerning=!1;const n=Hp(Hp({},_y.defaultOptions),t);this._textureSize=n.textureSize,this._mipmap=n.mipmap;const a=n.style.clone();n.overrideFill&&(a._fill.color=16777215,a._fill.alpha=1,a._fill.texture=w.WHITE,a._fill.fill=null),this.applyFillAsTint=n.overrideFill;const o=a.fontSize;a.fontSize=this.baseMeasurementFontSize;const u=ui(a);n.overrideSize?a._stroke&&(a._stroke.width*=this.baseRenderedFontSize/o):a.fontSize=this.baseRenderedFontSize=o,this._style=a,this._skipKerning=(e=n.skipKerning)!=null?e:!1,this.resolution=(i=n.resolution)!=null?i:1,this._padding=(s=n.padding)!=null?s:4,this.fontMetrics=zt.measureFont(u),this.lineHeight=a.lineHeight||this.fontMetrics.fontSize||a.fontSize}ensureCharacters(t){var e,i,s,n;const a=Io(t).filter(y=>!this._currentChars.includes(y)).filter((y,T,A)=>A.indexOf(y)===T);if(!a.length)return;this._currentChars=[...this._currentChars,...a];let o;this._currentPageIndex===-1?o=this._nextPage():o=this.pages[this._currentPageIndex];let{canvas:u,context:l}=o.canvasAndContext,c=o.texture.source;const h=this._style;let f=this._currentX,p=this._currentY;const m=this.baseRenderedFontSize/this.baseMeasurementFontSize,_=this._padding*m,g=h.fontStyle==="italic"?2:1;let b=0,x=!1;for(let y=0;y<a.length;y++){const T=a[y],A=zt.measureText(T,h,u,!1);A.lineHeight=A.height;const R=g*A.width*m,C=A.height*m,P=R+_*2,S=C+_*2;if(x=!1,T!==`
`&&T!=="\r"&&T!==" "&&T!==" "&&(x=!0,b=Math.ceil(Math.max(S,b))),f+P>this._textureSize&&(p+=b,b=S,f=0,p+b>this._textureSize)){c.update();const F=this._nextPage();u=F.canvasAndContext.canvas,l=F.canvasAndContext.context,c=F.texture.source,p=0}const E=R/m-((i=(e=h.dropShadow)==null?void 0:e.distance)!=null?i:0)-((n=(s=h._stroke)==null?void 0:s.width)!=null?n:0);if(this.chars[T]={id:T.codePointAt(0),xOffset:-this._padding,yOffset:-this._padding,xAdvance:E,kerning:{}},x){this._drawGlyph(l,A,f+_,p+_,m,h);const F=c.width*m,N=c.height*m,O=new W(f/F*c.width,p/N*c.height,P/F*c.width,S/N*c.height);this.chars[T].texture=new w({source:c,frame:O}),f+=Math.ceil(P)}}c.update(),this._currentX=f,this._currentY=p,this._skipKerning&&this._applyKerning(a,l)}get pageTextures(){return this.pages}_applyKerning(t,e){const i=this._measureCache;for(let s=0;s<t.length;s++){const n=t[s];for(let a=0;a<this._currentChars.length;a++){const o=this._currentChars[a];let u=i[n];u||(u=i[n]=e.measureText(n).width);let l=i[o];l||(l=i[o]=e.measureText(o).width);let c=e.measureText(n+o).width,h=c-(u+l);h&&(this.chars[n].kerning[o]=h),c=e.measureText(n+o).width,h=c-(u+l),h&&(this.chars[o].kerning[n]=h)}}}_nextPage(){this._currentPageIndex++;const t=this.resolution,e=Qt.getOptimalCanvasAndContext(this._textureSize,this._textureSize,t);this._setupContext(e.context,this._style,t);const i=t*(this.baseRenderedFontSize/this.baseMeasurementFontSize),s=new w({source:new De({resource:e.canvas,resolution:i,alphaMode:"premultiply-alpha-on-upload",autoGenerateMipmaps:this._mipmap})}),n={canvasAndContext:e,texture:s};return this.pages[this._currentPageIndex]=n,n}_setupContext(t,e,i){var s;e.fontSize=this.baseRenderedFontSize,t.scale(i,i),t.font=ui(e),e.fontSize=this.baseMeasurementFontSize,t.textBaseline=e.textBaseline;const n=e._stroke,a=(s=n==null?void 0:n.width)!=null?s:0;if(n&&(t.lineWidth=a,t.lineJoin=n.join,t.miterLimit=n.miterLimit,t.strokeStyle=li(n,t)),e._fill&&(t.fillStyle=li(e._fill,t)),e.dropShadow){const o=e.dropShadow,u=V.shared.setValue(o.color).toArray(),l=o.blur*i,c=o.distance*i;t.shadowColor=`rgba(${u[0]*255},${u[1]*255},${u[2]*255},${o.alpha})`,t.shadowBlur=l,t.shadowOffsetX=Math.cos(o.angle)*c,t.shadowOffsetY=Math.sin(o.angle)*c}else t.shadowColor="black",t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0}_drawGlyph(t,e,i,s,n,a){var o;const u=e.text,l=e.fontProperties,c=a._stroke,h=((o=c==null?void 0:c.width)!=null?o:0)*n,f=i+h/2,p=s-h/2,m=l.descent*n,_=e.lineHeight*n;a.stroke&&h&&t.strokeText(u,f,p+_-m),a._fill&&t.fillText(u,f,p+_-m)}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{canvasAndContext:e,texture:i}=this.pages[t];e.canvas.width=e.canvas.width,Qt.returnCanvasAndContext(e),i.destroy(!0)}this.pages=null}};Xp.defaultOptions={textureSize:512,style:new Ot,mipmap:!0};let Uo=Xp;function ko(r,t,e,i){const s={width:0,height:0,offsetY:0,scale:t.fontSize/e.baseMeasurementFontSize,lines:[{width:0,charPositions:[],spaceWidth:0,spacesIndex:[],chars:[]}]};s.offsetY=e.baseLineOffset;let n=s.lines[0],a=null,o=!0;const u={spaceWord:!1,width:0,start:0,index:0,positions:[],chars:[]},l=m=>{const _=n.width;for(let g=0;g<u.index;g++){const b=m.positions[g];n.chars.push(m.chars[g]),n.charPositions.push(b+_)}n.width+=m.width,o=!1,u.width=0,u.index=0,u.chars.length=0},c=()=>{let m=n.chars.length-1;if(i){let _=n.chars[m];for(;_===" ";)n.width-=e.chars[_].xAdvance,_=n.chars[--m]}s.width=Math.max(s.width,n.width),n={width:0,charPositions:[],chars:[],spaceWidth:0,spacesIndex:[]},o=!0,s.lines.push(n),s.height+=e.lineHeight},h=e.baseMeasurementFontSize/t.fontSize,f=t.letterSpacing*h,p=t.wordWrapWidth*h;for(let m=0;m<r.length+1;m++){let _;const g=m===r.length;g||(_=r[m]);const b=e.chars[_]||e.chars[" "];if(/(?:\s)/.test(_)||_==="\r"||_===`
`||g){if(!o&&t.wordWrap&&n.width+u.width-f>p?(c(),l(u),g||n.charPositions.push(0)):(u.start=n.width,l(u),g||n.charPositions.push(0)),_==="\r"||_===`
`)n.width!==0&&c();else if(!g){const x=b.xAdvance+(b.kerning[a]||0)+f;n.width+=x,n.spaceWidth=x,n.spacesIndex.push(n.charPositions.length),n.chars.push(_)}}else{const x=b.kerning[a]||0,y=b.xAdvance+x+f;u.positions[u.index++]=u.width+x,u.chars.push(_),u.width+=y}a=_}return c(),t.align==="center"?OT(s):t.align==="right"?BT(s):t.align==="justify"&&GT(s),s}function OT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width/2-e.width/2;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function BT(r){for(let t=0;t<r.lines.length;t++){const e=r.lines[t],i=r.width-e.width;for(let s=0;s<e.charPositions.length;s++)e.charPositions[s]+=i}}function GT(r){const t=r.width;for(let e=0;e<r.lines.length;e++){const i=r.lines[e];let s=0,n=i.spacesIndex[s++],a=0;const o=i.spacesIndex.length,u=(t-i.width)/o;for(let l=0;l<i.charPositions.length;l++)l===n&&(n=i.spacesIndex[s++],a+=u),i.charPositions[l]+=a}}var FT=Object.defineProperty,zp=Object.getOwnPropertySymbols,IT=Object.prototype.hasOwnProperty,UT=Object.prototype.propertyIsEnumerable,jp=(r,t,e)=>t in r?FT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Lo=(r,t)=>{for(var e in t||(t={}))IT.call(t,e)&&jp(r,e,t[e]);if(zp)for(var e of zp(t))UT.call(t,e)&&jp(r,e,t[e]);return r};let ks=0,kT=class{constructor(){this.ALPHA=[["a","z"],["A","Z"]," "],this.NUMERIC=[["0","9"]],this.ALPHANUMERIC=[["a","z"],["A","Z"],["0","9"]," "],this.ASCII=[[" ","~"]],this.defaultOptions={chars:this.ALPHANUMERIC,resolution:1,padding:4,skipKerning:!1}}getFont(t,e){var i;let s=`${e.fontFamily}-bitmap`,n=!0;if(e._fill.fill&&!e._stroke)s+=e._fill.fill.styleKey,n=!1;else if(e._stroke||e.dropShadow){let o=e.styleKey;o=o.substring(0,o.lastIndexOf("-")),s=`${o}-bitmap`,n=!1}if(!K.has(s)){const o=new Uo(Lo({style:e,overrideFill:n,overrideSize:!0},this.defaultOptions));ks++,ks>50&&ge("BitmapText",`You have dynamically created ${ks} bitmap fonts, this can be inefficient. Try pre installing your font styles using \`BitmapFont.install({name:"style1", style})\``),o.once("destroy",()=>{ks--,K.remove(s)}),K.set(s,o)}const a=K.get(s);return(i=a.ensureCharacters)==null||i.call(a,t),a}getLayout(t,e,i=!0){const s=this.getFont(t,e);return ko([...t],e,s,i)}measureText(t,e,i=!0){return this.getLayout(t,e,i)}install(...t){var e,i,s,n;let a=t[0];typeof a=="string"&&(a={name:a,style:t[1],chars:(e=t[2])==null?void 0:e.chars,resolution:(i=t[2])==null?void 0:i.resolution,padding:(s=t[2])==null?void 0:s.padding,skipKerning:(n=t[2])==null?void 0:n.skipKerning});const o=a==null?void 0:a.name;if(!o)throw new Error("[BitmapFontManager] Property `name` is required.");a=Lo(Lo({},this.defaultOptions),a);const u=a.style,l=u instanceof Ot?u:new Ot(u),c=l._fill.fill!==null&&l._fill.fill!==void 0,h=new Uo({style:l,overrideFill:c,skipKerning:a.skipKerning,padding:a.padding,resolution:a.resolution,overrideSize:!1}),f=Io(a.chars);return h.ensureCharacters(f.join("")),K.set(`${o}-bitmap`,h),h.once("destroy",()=>K.remove(`${o}-bitmap`)),h}uninstall(t){const e=`${t}-bitmap`,i=K.get(e);i&&(K.remove(e),i.destroy())}};const ci=new kT;class No{constructor(t){this._gpuBitmapText={},this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){const e=this._getGpuBitmapText(t);return t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,e)),this._renderer.renderPipes.graphics.validateRenderable(e)}addRenderable(t,e){const i=this._getGpuBitmapText(t);Vp(t,i),t._didTextUpdate&&(t._didTextUpdate=!1,this._updateContext(t,i)),this._renderer.renderPipes.graphics.addRenderable(i,e),i.context.customShader&&this._updateDistanceField(t)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableByUid(t.uid)}_destroyRenderableByUid(t){const e=this._gpuBitmapText[t].context;e.customShader&&(X.return(e.customShader),e.customShader=null),X.return(this._gpuBitmapText[t]),this._gpuBitmapText[t]=null}updateRenderable(t){const e=this._getGpuBitmapText(t);Vp(t,e),this._renderer.renderPipes.graphics.updateRenderable(e),e.context.customShader&&this._updateDistanceField(t)}_updateContext(t,e){const{context:i}=e,s=ci.getFont(t.text,t._style);i.clear(),s.distanceField.type!=="none"&&(i.customShader||(i.customShader=X.get(kp)));const n=Array.from(t.text),a=t._style;let o=s.baseLineOffset;const u=ko(n,a,s,!0);let l=0;const c=a.padding,h=u.scale;let f=u.width,p=u.height+u.offsetY;a._stroke&&(f+=a._stroke.width/h,p+=a._stroke.width/h),i.translate(-t._anchor._x*f-c,-t._anchor._y*p-c).scale(h,h);const m=s.applyFillAsTint?a._fill.color:16777215;for(let _=0;_<u.lines.length;_++){const g=u.lines[_];for(let b=0;b<g.charPositions.length;b++){const x=n[l++],y=s.chars[x];y!=null&&y.texture&&i.texture(y.texture,m||"black",Math.round(g.charPositions[b]+y.xOffset),Math.round(o+y.yOffset))}o+=s.lineHeight}}_getGpuBitmapText(t){return this._gpuBitmapText[t.uid]||this.initGpuText(t)}initGpuText(t){const e=X.get(mr);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,i=t._style.fontFamily,s=K.get(`${i}-bitmap`),{a:n,b:a,c:o,d:u}=t.groupTransform,l=Math.sqrt(n*n+a*a),c=Math.sqrt(o*o+u*u),h=(Math.abs(l)+Math.abs(c))/2,f=s.baseRenderedFontSize/t._style.fontSize,p=h*s.distanceField.range*(1/f);e.customShader.resources.localUniforms.uniforms.uDistance=p}destroy(){for(const t in this._gpuBitmapText)this._destroyRenderableByUid(t);this._gpuBitmapText=null,this._renderer=null}}No.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"bitmapText"};function Vp(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}L.add(No);class $o{constructor(t){this._gpuText=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t,this._renderer.runners.resolutionChange.add(this)}resolutionChange(){for(const t in this._gpuText){const e=this._gpuText[t];if(!e)continue;const i=e.batchableSprite.renderable;i._autoResolution&&(i._resolution=this._renderer.resolution,i.onViewUpdate())}}validateRenderable(t){const e=this._getGpuText(t),i=t._getKey();return e.textureNeedsUploading?(e.textureNeedsUploading=!1,!0):e.currentKey!==i}addRenderable(t,e){const i=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._getGpuText(t).batchableSprite;t._didTextUpdate&&this._updateText(t),e._batcher.updateElement(e)}destroyRenderable(t){t.off("destroyed",this._destroyRenderableBound),this._destroyRenderableById(t.uid)}_destroyRenderableById(t){const e=this._gpuText[t];this._renderer.htmlText.decreaseReferenceCount(e.currentKey),X.return(e.batchableSprite),this._gpuText[t]=null}_updateText(t){const e=t._getKey(),i=this._getGpuText(t),s=i.batchableSprite;i.currentKey!==e&&this._updateGpuText(t).catch(a=>{console.error(a)}),t._didTextUpdate=!1;const n=t._style.padding;Hr(s.bounds,t._anchor,s.texture,n)}async _updateGpuText(t){var e;t._didTextUpdate=!1;const i=this._getGpuText(t);if(i.generatingTexture)return;const s=t._getKey();this._renderer.htmlText.decreaseReferenceCount(i.currentKey),i.generatingTexture=!0,i.currentKey=s;const n=(e=t.resolution)!=null?e:this._renderer.resolution,a=await this._renderer.htmlText.getManagedTexture(t.text,n,t._style,t._getKey()),o=i.batchableSprite;o.texture=i.texture=a,i.generatingTexture=!1,i.textureNeedsUploading=!0,t.onViewUpdate();const u=t._style.padding;Hr(o.bounds,t._anchor,o.texture,u)}_getGpuText(t){return this._gpuText[t.uid]||this.initGpuText(t)}initGpuText(t){const e={texture:w.EMPTY,currentKey:"--",batchableSprite:X.get(Ps),textureNeedsUploading:!1,generatingTexture:!1},i=e.batchableSprite;return i.renderable=t,i.transform=t.groupTransform,i.texture=w.EMPTY,i.bounds={minX:0,maxX:1,minY:0,maxY:0},i.roundPixels=this._renderer._roundPixels|t._roundPixels,t._resolution=t._autoResolution?this._renderer.resolution:t.resolution,this._gpuText[t.uid]=e,t.on("destroyed",this._destroyRenderableBound),e}destroy(){for(const t in this._gpuText)this._destroyRenderableById(t);this._gpuText=null,this._renderer=null}}$o.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"htmlText"};function Wp(){const{userAgent:r}=$.get().getNavigator();return/^((?!chrome|android).)*safari/i.test(r)}const Ho="http://www.w3.org/2000/svg",Xo="http://www.w3.org/1999/xhtml";class zo{constructor(){this.svgRoot=document.createElementNS(Ho,"svg"),this.foreignObject=document.createElementNS(Ho,"foreignObject"),this.domElement=document.createElementNS(Xo,"div"),this.styleElement=document.createElementNS(Xo,"style"),this.image=new Image;const{foreignObject:t,svgRoot:e,styleElement:i,domElement:s}=this;t.setAttribute("width","10000"),t.setAttribute("height","10000"),t.style.overflow="hidden",e.appendChild(t),t.appendChild(i),t.appendChild(s)}}function Yp(r){const t=r._stroke,e=r._fill,i=[`div { ${[`color: ${V.shared.setValue(e.color).toHex()}`,`font-size: ${r.fontSize}px`,`font-family: ${r.fontFamily}`,`font-weight: ${r.fontWeight}`,`font-style: ${r.fontStyle}`,`font-variant: ${r.fontVariant}`,`letter-spacing: ${r.letterSpacing}px`,`text-align: ${r.align}`,`padding: ${r.padding}px`,`white-space: ${r.whiteSpace==="pre"&&r.wordWrap?"pre-wrap":r.whiteSpace}`,...r.lineHeight?[`line-height: ${r.lineHeight}px`]:[],...r.wordWrap?[`word-wrap: ${r.breakWords?"break-all":"break-word"}`,`max-width: ${r.wordWrapWidth}px`]:[],...t?[Kp(t)]:[],...r.dropShadow?[qp(r.dropShadow)]:[],...r.cssOverrides].join(";")} }`];return LT(r.tagStyles,i),i.join(" ")}function qp(r){const t=V.shared.setValue(r.color).setAlpha(r.alpha).toHexa(),e=Math.round(Math.cos(r.angle)*r.distance),i=Math.round(Math.sin(r.angle)*r.distance),s=`${e}px ${i}px`;return r.blur>0?`text-shadow: ${s} ${r.blur}px ${t}`:`text-shadow: ${s} ${t}`}function Kp(r){return[`-webkit-text-stroke-width: ${r.width}px`,`-webkit-text-stroke-color: ${V.shared.setValue(r.color).toHex()}`,`text-stroke-width: ${r.width}px`,`text-stroke-color: ${V.shared.setValue(r.color).toHex()}`,"paint-order: stroke"].join(";")}const Zp={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"},Qp={fill:r=>`color: ${V.shared.setValue(r).toHex()}`,breakWords:r=>`word-wrap: ${r?"break-all":"break-word"}`,stroke:Kp,dropShadow:qp};function LT(r,t){for(const e in r){const i=r[e],s=[];for(const n in i)Qp[n]?s.push(Qp[n](i[n])):Zp[n]&&s.push(Zp[n].replace("{{VALUE}}",i[n]));t.push(`${e} { ${s.join(";")} }`)}}var NT=Object.defineProperty,Jp=Object.getOwnPropertySymbols,$T=Object.prototype.hasOwnProperty,HT=Object.prototype.propertyIsEnumerable,tm=(r,t,e)=>t in r?NT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,XT=(r,t)=>{for(var e in t||(t={}))$T.call(t,e)&&tm(r,e,t[e]);if(Jp)for(var e of Jp(t))HT.call(t,e)&&tm(r,e,t[e]);return r};class Ue extends Ot{constructor(t={}){var e,i;super(t),this._cssOverrides=[],(e=this.cssOverrides)!=null||(this.cssOverrides=t.cssOverrides),this.tagStyles=(i=t.tagStyles)!=null?i:{}}set cssOverrides(t){this._cssOverrides=t instanceof Array?t:[t],this.update()}get cssOverrides(){return this._cssOverrides}_generateKey(){return this._styleKey=Co(this)+this._cssOverrides.join("-"),this._styleKey}update(){this._cssStyle=null,super.update()}clone(){return new Ue({align:this.align,breakWords:this.breakWords,dropShadow:this.dropShadow?XT({},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=Yp(this)),this._cssStyle}addOverride(...t){const e=t.filter(i=>!this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides.push(...e),this.update())}removeOverride(...t){const e=t.filter(i=>this.cssOverrides.includes(i));e.length>0&&(this.cssOverrides=this.cssOverrides.filter(i=>!e.includes(i)),this.update())}set fill(t){super.fill=t}set stroke(t){super.stroke=t}}function em(r,t){const e=t.fontFamily,i=[],s={},n=/font-family:([^;"\s]+)/g,a=r.match(n);function o(u){s[u]||(i.push(u),s[u]=!0)}if(Array.isArray(e))for(let u=0;u<e.length;u++)o(e[u]);else o(e);a&&a.forEach(u=>{const l=u.split(":")[1].trim();o(l)});for(const u in t.tagStyles){const l=t.tagStyles[u].fontFamily;o(l)}return i}async function rm(r){const t=await(await $.get().fetch(r)).blob(),e=new FileReader;return await new Promise((i,s)=>{e.onloadend=()=>i(e.result),e.onerror=s,e.readAsDataURL(t)})}async function jo(r,t){const e=await rm(t);return`@font-face {
font-family: "${r.fontFamily}";
src: url('${e}');
font-weight: ${r.fontWeight};
font-style: ${r.fontStyle};
}`}const hi=new Map;async function im(r,t,e){const i=r.filter(s=>K.has(`${s}-and-url`)).map((s,n)=>{if(!hi.has(s)){const{url:a}=K.get(`${s}-and-url`);n===0?hi.set(s,jo({fontWeight:t.fontWeight,fontStyle:t.fontStyle,fontFamily:s},a)):hi.set(s,jo({fontWeight:e.fontWeight,fontStyle:e.fontStyle,fontFamily:s},a))}return hi.get(s)});return(await Promise.all(i)).join(`
`)}function sm(r,t,e,i,s){const{domElement:n,styleElement:a,svgRoot:o}=s;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`),a.textContent=i;const{width:u,height:l}=s.image;return o.setAttribute("width",u.toString()),o.setAttribute("height",l.toString()),new XMLSerializer().serializeToString(o)}function nm(r,t){const e=Qt.getOptimalCanvasAndContext(r.width,r.height,t),{context:i}=e;return i.clearRect(0,0,r.width,r.height),i.drawImage(r,0,0),Qt.returnCanvasAndContext(e),e.canvas}function am(r,t,e){return new Promise(async i=>{e&&await new Promise(s=>setTimeout(s,100)),r.onload=()=>{i()},r.src=`data:image/svg+xml;charset=utf8,${encodeURIComponent(t)}`,r.crossOrigin="anonymous"})}let om;function Vo(r,t,e,i){i=i||om||(om=new zo);const{domElement:s,styleElement:n,svgRoot:a}=i;s.innerHTML=`<style>${t.cssStyle};</style><div style='padding:0'>${r}</div>`,s.setAttribute("style","transform-origin: top left; display: inline-block"),e&&(n.textContent=e),document.body.appendChild(a);const o=s.getBoundingClientRect();a.remove();const u=zt.measureFont(t.fontStyle).descent,l=t.padding*2;return{width:o.width-l,height:o.height+u-l}}class Ls{constructor(t){this._activeTextures={},this._renderer=t,this._createCanvas=t.type===St.WEBGPU}getTexture(t){return this._buildTexturePromise(t.text,t.resolution,t.style)}getManagedTexture(t,e,i,s){if(this._activeTextures[s])return this._increaseReferenceCount(s),this._activeTextures[s].promise;const n=this._buildTexturePromise(t,e,i).then(a=>(this._activeTextures[s].texture=a,a));return this._activeTextures[s]={texture:null,promise:n,usageCount:1},n}async _buildTexturePromise(t,e,i){const s=X.get(zo),n=em(t,i),a=await im(n,i,Ue.defaultTextStyle),o=Vo(t,i,a,s),u=Math.ceil(Math.ceil(Math.max(1,o.width)+i.padding*2)*e),l=Math.ceil(Math.ceil(Math.max(1,o.height)+i.padding*2)*e),c=s.image,h=2;c.width=(u|0)+h,c.height=(l|0)+h;const f=sm(t,i,e,a,s);await am(c,f,Wp()&&n.length>0);let p=c;this._createCanvas&&(p=nm(c,e));const m=Po(p,c.width-h,c.height-h,e);return this._createCanvas&&this._renderer.texture.initSource(m.source),X.return(s),m}_increaseReferenceCount(t){this._activeTextures[t].usageCount++}decreaseReferenceCount(t){const e=this._activeTextures[t];e&&(e.usageCount--,e.usageCount===0&&(e.texture?this._cleanUp(e):e.promise.then(i=>{e.texture=i,this._cleanUp(e)}).catch(()=>{}),this._activeTextures[t]=null))}_cleanUp(t){pt.returnTexture(t.texture),t.texture.source.resource=null,t.texture.source.uploadMethodId="unknown"}getReferenceCount(t){return this._activeTextures[t].usageCount}destroy(){this._activeTextures=null}}Ls.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"htmlText"},Ls.defaultFontOptions={fontFamily:"Arial",fontStyle:"normal",fontWeight:"normal"},L.add(Ls),L.add($o);var zT=Object.defineProperty,um=Object.getOwnPropertySymbols,jT=Object.prototype.hasOwnProperty,VT=Object.prototype.propertyIsEnumerable,lm=(r,t,e)=>t in r?zT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,cm=(r,t)=>{for(var e in t||(t={}))jT.call(t,e)&&lm(r,e,t[e]);if(um)for(var e of um(t))VT.call(t,e)&&lm(r,e,t[e]);return r};const hm=class by extends rr{constructor(...t){var e;let i=(e=t[0])!=null?e:{};i instanceof Float32Array&&(i={positions:i,uvs:t[1],indices:t[2]}),i=cm(cm({},by.defaultOptions),i);const s=i.positions||new Float32Array([0,0,1,0,1,1,0,1]),n=i.uvs||new Float32Array([0,0,1,0,1,1,0,1]),a=i.indices||new Uint32Array([0,1,2,0,2,3]),o=i.shrinkBuffersToFit,u=new Pt({data:s,label:"attribute-mesh-positions",shrinkToFit:o,usage:z.VERTEX|z.COPY_DST}),l=new Pt({data:n,label:"attribute-mesh-uvs",shrinkToFit:o,usage:z.VERTEX|z.COPY_DST}),c=new Pt({data:a,label:"index-mesh-buffer",shrinkToFit:o,usage:z.INDEX|z.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:i.topology}),this.batchMode="auto"}get positions(){return this.attributes.aPosition.buffer.data}set positions(t){this.attributes.aPosition.buffer.data=t}get uvs(){return this.attributes.aUV.buffer.data}set uvs(t){this.attributes.aUV.buffer.data=t}get indices(){return this.indexBuffer.data}set indices(t){this.indexBuffer.data=t}};hm.defaultOptions={topology:"triangle-list",shrinkBuffersToFit:!1};let _e=hm;var WT=Object.defineProperty,YT=Object.defineProperties,qT=Object.getOwnPropertyDescriptors,dm=Object.getOwnPropertySymbols,KT=Object.prototype.hasOwnProperty,ZT=Object.prototype.propertyIsEnumerable,fm=(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={}))KT.call(t,e)&&fm(r,e,t[e]);if(dm)for(var e of dm(t))ZT.call(t,e)&&fm(r,e,t[e]);return r},mm=(r,t)=>YT(r,qT(t));const gr={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);
}
`}},gm=mm(pm({},gr),{vertex:mm(pm({},gr.vertex),{header:gr.vertex.header.replace("group(1)","group(2)")})}),Ns={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);
}
`}},_m={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);
`}},bm={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 Wo,Yo;class ym extends Ut{constructor(){Wo!=null||(Wo=ar({name:"tiling-sprite-shader",bits:[gr,_m,ur]})),Yo!=null||(Yo=or({name:"tiling-sprite-shader",bits:[Ns,bm,lr]}));const t=new ot({uMapCoord:{value:new G,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 G,type:"mat3x3<f32>"},uSizeAnchor:{value:new Float32Array([100,100,.5,.5]),type:"vec4<f32>"}});super({glProgram:Yo,gpuProgram:Wo,resources:{localUniforms:new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),tilingUniforms:t,uTexture:w.EMPTY.source,uSampler:w.EMPTY.source.style}})}updateUniforms(t,e,i,s,n,a){const o=this.resources.tilingUniforms,u=a.width,l=a.height,c=a.textureMatrix,h=o.uniforms.uTextureTransform;h.set(i.a*u/t,i.b*u/e,i.c*l/t,i.d*l/e,i.tx/t,i.ty/e),h.invert(),o.uniforms.uMapCoord=c.mapCoord,o.uniforms.uClampFrame=c.uClampFrame,o.uniforms.uClampOffset=c.uClampOffset,o.uniforms.uTextureTransform=h,o.uniforms.uSizeAnchor[0]=t,o.uniforms.uSizeAnchor[1]=e,o.uniforms.uSizeAnchor[2]=s,o.uniforms.uSizeAnchor[3]=n,a&&(this.resources.uTexture=a.source,this.resources.uSampler=a.source.style)}}class xm extends _e{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 vm(r,t){const e=r.anchor.x,i=r.anchor.y;t[0]=-e*r.width,t[1]=-i*r.height,t[2]=(1-e)*r.width,t[3]=-i*r.height,t[4]=(1-e)*r.width,t[5]=(1-i)*r.height,t[6]=-e*r.width,t[7]=(1-i)*r.height}function Tm(r,t,e,i){let s=0;const n=r.length/(t||2),a=i.a,o=i.b,u=i.c,l=i.d,c=i.tx,h=i.ty;for(e*=t;s<n;){const f=r[e],p=r[e+1];r[e]=a*f+u*p+c,r[e+1]=o*f+l*p+h,e+=t,s++}}function Sm(r,t){const e=r.texture,i=e.frame.width,s=e.frame.height;let n=0,a=0;r._applyAnchorToTexture&&(n=r.anchor.x,a=r.anchor.y),t[0]=t[6]=-n,t[2]=t[4]=1-n,t[1]=t[3]=-a,t[5]=t[7]=1-a;const o=G.shared;o.copyFrom(r._tileTransform.matrix),o.tx/=r.width,o.ty/=r.height,o.invert(),o.scale(r.width/i,r.height/s),Tm(t,2,0,o)}const $s=new xm;class qo{constructor(t){this._state=Ht.default2d,this._tilingSpriteDataHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}validateRenderable(t){const e=this._getTilingSpriteData(t),i=e.canBatch;this._updateCanBatch(t);const s=e.canBatch;if(s&&s===i){const{batchableMesh:n}=e;if(n&&n.texture._source!==t.texture._source)return!n._batcher.checkAndUpdateTexture(n,t.texture)}return i!==s}addRenderable(t,e){const i=this._renderer.renderPipes.batch;this._updateCanBatch(t);const s=this._getTilingSpriteData(t),{geometry:n,canBatch:a}=s;if(a){s.batchableMesh||(s.batchableMesh=new Rs);const o=s.batchableMesh;t._didTilingSpriteUpdate&&(t._didTilingSpriteUpdate=!1,this._updateBatchableMesh(t),o.geometry=n,o.renderable=t,o.transform=t.groupTransform,o.texture=t._texture),o.roundPixels=this._renderer._roundPixels|t._roundPixels,i.addToBatch(o,e)}else i.break(e),s.shader||(s.shader=new ym),this.updateRenderable(t),e.add(t)}execute(t){const{shader:e}=this._tilingSpriteDataHash[t.uid];e.groups[0]=this._renderer.globalUniforms.bindGroup;const i=e.resources.localUniforms.uniforms;i.uTransformMatrix=t.groupTransform,i.uRound=this._renderer._roundPixels|t._roundPixels,ri(t.groupColorAlpha,i.uColor,0),this._state.blendMode=Kr(t.groupBlendMode,t.texture._source),this._renderer.encoder.draw({geometry:$s,shader:e,state:this._state})}updateRenderable(t){const e=this._getTilingSpriteData(t),{canBatch:i}=e;if(i){const{batchableMesh:s}=e;t._didTilingSpriteUpdate&&this._updateBatchableMesh(t),s._batcher.updateElement(s)}else if(t._didTilingSpriteUpdate){const{shader:s}=e;s.updateUniforms(t.width,t.height,t._tileTransform.matrix,t.anchor.x,t.anchor.y,t.texture)}t._didTilingSpriteUpdate=!1}destroyRenderable(t){var e;const i=this._getTilingSpriteData(t);i.batchableMesh=null,(e=i.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 _e({indices:$s.indices,positions:$s.positions.slice(),uvs:$s.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:i}=e,s=t.texture.source.style;s.addressMode!=="repeat"&&(s.addressMode="repeat",s.update()),Sm(t,i.uvs),vm(t,i.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),i=t.texture;let s=!0;return this._renderer.type===St.WEBGL&&(s=this._renderer.context.supports.nonPowOf2wrapping),e.canBatch=i.textureMatrix.isSimple&&(s||i.source.isPowerOfTwo),e.canBatch}}qo.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"tilingSprite"},L.add(qo);var QT=Object.defineProperty,Am=Object.getOwnPropertySymbols,JT=Object.prototype.hasOwnProperty,tS=Object.prototype.propertyIsEnumerable,Em=(r,t,e)=>t in r?QT(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,wm=(r,t)=>{for(var e in t||(t={}))JT.call(t,e)&&Em(r,e,t[e]);if(Am)for(var e of Am(t))tS.call(t,e)&&Em(r,e,t[e]);return r};const Cm=class yy extends _e{constructor(...t){var e;super({});let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={width:i,height:t[1],verticesX:t[2],verticesY:t[3]}),this.build(i)}build(t){var e,i,s,n;t=wm(wm({},yy.defaultOptions),t),this.verticesX=(e=this.verticesX)!=null?e:t.verticesX,this.verticesY=(i=this.verticesY)!=null?i:t.verticesY,this.width=(s=this.width)!=null?s:t.width,this.height=(n=this.height)!=null?n:t.height;const a=this.verticesX*this.verticesY,o=[],u=[],l=[],c=this.verticesX-1,h=this.verticesY-1,f=this.width/c,p=this.height/h;for(let _=0;_<a;_++){const g=_%this.verticesX,b=_/this.verticesX|0;o.push(g*f,b*p),u.push(g/c,b/h)}const m=c*h;for(let _=0;_<m;_++){const g=_%c,b=_/c|0,x=b*this.verticesX+g,y=b*this.verticesX+g+1,T=(b+1)*this.verticesX+g,A=(b+1)*this.verticesX+g+1;l.push(x,y,T,y,A,T)}this.buffers[0].data=new Float32Array(o),this.buffers[1].data=new Float32Array(u),this.indexBuffer.data=new Uint32Array(l),this.buffers[0].update(),this.buffers[1].update(),this.indexBuffer.update()}};Cm.defaultOptions={width:100,height:100,verticesX:10,verticesY:10};let Hs=Cm;var eS=Object.defineProperty,Rm=Object.getOwnPropertySymbols,rS=Object.prototype.hasOwnProperty,iS=Object.prototype.propertyIsEnumerable,Pm=(r,t,e)=>t in r?eS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Mm=(r,t)=>{for(var e in t||(t={}))rS.call(t,e)&&Pm(r,e,t[e]);if(Rm)for(var e of Rm(t))iS.call(t,e)&&Pm(r,e,t[e]);return r};const Dm=class xy extends Hs{constructor(t={}){t=Mm(Mm({},xy.defaultOptions),t),super({width:t.width,height:t.height,verticesX:4,verticesY:4}),this.update(t)}update(t){var e,i,s,n,a,o,u,l;this.width=(e=t.width)!=null?e:this.width,this.height=(i=t.height)!=null?i:this.height,this._originalWidth=(s=t.originalWidth)!=null?s:this._originalWidth,this._originalHeight=(n=t.originalHeight)!=null?n:this._originalHeight,this._leftWidth=(a=t.leftWidth)!=null?a:this._leftWidth,this._rightWidth=(o=t.rightWidth)!=null?o: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,i=this.width>e?1:this.width/e,s=this._topHeight+this._bottomHeight,n=this.height>s?1:this.height/s,a=Math.min(i,n);t[9]=t[11]=t[13]=t[15]=this._topHeight*a,t[17]=t[19]=t[21]=t[23]=this.height-this._bottomHeight*a,t[25]=t[27]=t[29]=t[31]=this.height,t[2]=t[10]=t[18]=t[26]=this._leftWidth*a,t[4]=t[12]=t[20]=t[28]=this.width-this._rightWidth*a,t[6]=t[14]=t[22]=t[30]=this.width,this.getBuffer("aPosition").update()}updateUvs(){const t=this.uvs;t[0]=t[8]=t[16]=t[24]=0,t[1]=t[3]=t[5]=t[7]=0,t[6]=t[14]=t[22]=t[30]=1,t[25]=t[27]=t[29]=t[31]=1;const e=1/this._originalWidth,i=1/this._originalHeight;t[2]=t[10]=t[18]=t[26]=e*this._leftWidth,t[9]=t[11]=t[13]=t[15]=i*this._topHeight,t[4]=t[12]=t[20]=t[28]=1-e*this._rightWidth,t[17]=t[19]=t[21]=t[23]=1-i*this._bottomHeight,this.getBuffer("aUV").update()}};Dm.defaultOptions={width:100,height:100,leftWidth:10,topHeight:10,rightWidth:10,bottomHeight:10,originalWidth:100,originalHeight:100};let be=Dm;class Ko{constructor(t){this._gpuSpriteHash=Object.create(null),this._destroyRenderableBound=this.destroyRenderable.bind(this),this._renderer=t}addRenderable(t,e){const i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.return(e.geometry),X.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=X.get(Rs);return e.geometry=X.get(be),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}}Ko.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"nineSliceSprite"},L.add(Ko);class Zo{constructor(t){this._renderer=t}push(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",canBundle:!1,action:"pushFilter",container:e,filterEffect:t})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}execute(t){t.action==="pushFilter"?this._renderer.filter.push(t):t.action==="popFilter"&&this._renderer.filter.pop()}destroy(){this._renderer=null}}Zo.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"filter"};const sS=new G;function Om(r,t){return t.clear(),Qo(r,t),t.isValid||t.set(0,0,0,0),r.renderGroup?t.applyMatrix(r.renderGroup.localTransform):t.applyMatrix(r.parentRenderGroup.worldTransform),t}function Qo(r,t){if(r.localDisplayStatus!==7||!r.measurable)return;const e=!!r.effects.length;let i=t;if((r.renderGroup||e)&&(i=Kt.get().clear()),r.boundsArea)t.addRect(r.boundsArea,r.worldTransform);else{if(r.renderPipeId){const n=r.bounds;i.addFrame(n.minX,n.minY,n.maxX,n.maxY,r.groupTransform)}const s=r.children;for(let n=0;n<s.length;n++)Qo(s[n],i)}if(e){let s=!1;for(let n=0;n<r.effects.length;n++)r.effects[n].addBounds&&(s||(s=!0,i.applyMatrix(r.parentRenderGroup.worldTransform)),r.effects[n].addBounds(i,!0));s&&(i.applyMatrix(r.parentRenderGroup.worldTransform.copyTo(sS).invert()),t.addBounds(i,r.relativeGroupTransform)),t.addBounds(i),Kt.return(i)}else r.renderGroup&&(t.addBounds(i,r.relativeGroupTransform),Kt.return(i))}function Bm(r,t){t.clear();const e=t.matrix;for(let i=0;i<r.length;i++){const s=r[i];s.globalDisplayStatus<7||(t.matrix=s.worldTransform,s.addBounds(t))}return t.matrix=e,t}const nS=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 Jo{constructor(t){this._filterStackIndex=0,this._filterStack=[],this._filterGlobalUniforms=new ot({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 Zt({}),this.renderer=t}get activeBackTexture(){var t;return(t=this._activeFilterData)==null?void 0:t.backTexture}push(t){var e,i;const s=this.renderer,n=t.filterEffect.filters;this._filterStack[this._filterStackIndex]||(this._filterStack[this._filterStackIndex]=this._getFilterData());const a=this._filterStack[this._filterStackIndex];if(this._filterStackIndex++,n.length===0){a.skip=!0;return}const o=a.bounds;t.renderables?Bm(t.renderables,o):t.filterEffect.filterArea?(o.clear(),o.addRect(t.filterEffect.filterArea),o.applyMatrix(t.container.worldTransform)):Om(t.container,o);const u=s.renderTarget.renderTarget.colorTexture.source;let l=1/0,c=0,h=!0,f=!1,p=!1;for(let _=0;_<n.length;_++){const g=n[_];if(l=Math.min(l,g.resolution==="inherit"?u._resolution:g.resolution),c+=g.padding,g.antialias==="off"?h=!1:g.antialias==="inherit"&&h&&(h=u.antialias),!(g.compatibleRenderers&s.type)){p=!1;break}if(g.blendRequired&&!((i=(e=s.backBuffer)==null?void 0:e.useBackBuffer)==null||i)){p=!1;break}p=g.enabled||p,f=f||g.blendRequired}if(!p){a.skip=!0;return}const m=s.renderTarget.rootViewPort;if(o.scale(l).fitBounds(0,m.width,0,m.height).ceil().scale(1/l).pad(c|0),!o.isPositive){a.skip=!0;return}a.skip=!1,a.bounds=o,a.blendRequired=f,a.container=t.container,a.filterEffect=t.filterEffect,a.previousRenderSurface=s.renderTarget.renderSurface,a.inputTexture=pt.getOptimalTexture(o.width,o.height,l,h),s.renderTarget.bind(a.inputTexture,!0),s.globalUniforms.push({offset:o})}pop(){const t=this.renderer;this._filterStackIndex--;const e=this._filterStack[this._filterStackIndex];if(e.skip)return;this._activeFilterData=e;const i=e.inputTexture,s=e.bounds;let n=w.EMPTY;if(t.renderTarget.finishRenderPass(),e.blendRequired){const o=this._filterStackIndex>0?this._filterStack[this._filterStackIndex-1].bounds:null,u=t.renderTarget.getRenderTarget(e.previousRenderSurface);n=this.getBackTexture(u,s,o)}e.backTexture=n;const a=e.filterEffect.filters;if(this._globalFilterBindGroup.setResource(i.source.style,2),this._globalFilterBindGroup.setResource(n.source,3),t.globalUniforms.pop(),a.length===1)a[0].apply(this,i,e.previousRenderSurface,!1),pt.returnTexture(i);else{let o=e.inputTexture,u=pt.getOptimalTexture(s.width,s.height,o.source._resolution,!1),l=0;for(l=0;l<a.length-1;++l){a[l].apply(this,o,u,!0);const c=o;o=u,u=c}a[l].apply(this,o,e.previousRenderSurface,!1),pt.returnTexture(o),pt.returnTexture(u)}e.blendRequired&&pt.returnTexture(n)}getBackTexture(t,e,i){const s=t.colorTexture.source._resolution,n=pt.getOptimalTexture(e.width,e.height,s,!1);let a=e.minX,o=e.minY;i&&(a-=i.minX,o-=i.minY),a=Math.floor(a*s),o=Math.floor(o*s);const u=Math.ceil(e.width*s),l=Math.ceil(e.height*s);return this.renderer.renderTarget.copyToTexture(t,n,{x:a,y:o},{width:u,height:l},{x:0,y:0}),n}applyFilter(t,e,i,s){const n=this.renderer,a=this._filterStack[this._filterStackIndex],o=a.bounds,u=nt.shared,l=a.previousRenderSurface===i;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 f=this._filterGlobalUniforms,p=f.uniforms,m=p.uOutputFrame,_=p.uInputSize,g=p.uInputPixel,b=p.uInputClamp,x=p.uGlobalFrame,y=p.uOutputTexture;if(l){let R=this._filterStackIndex;for(;R>0;){R--;const C=this._filterStack[this._filterStackIndex-1];if(!C.skip){u.x=C.bounds.minX,u.y=C.bounds.minY;break}}m[0]=o.minX-u.x,m[1]=o.minY-u.y}else m[0]=0,m[1]=0;m[2]=e.frame.width,m[3]=e.frame.height,_[0]=e.source.width,_[1]=e.source.height,_[2]=1/_[0],_[3]=1/_[1],g[0]=e.source.pixelWidth,g[1]=e.source.pixelHeight,g[2]=1/g[0],g[3]=1/g[1],b[0]=.5*g[2],b[1]=.5*g[3],b[2]=e.frame.width*_[2]-.5*g[2],b[3]=e.frame.height*_[3]-.5*g[3];const T=this.renderer.renderTarget.rootRenderTarget.colorTexture;x[0]=u.x*c,x[1]=u.y*c,x[2]=T.source.width*c,x[3]=T.source.height*c;const A=this.renderer.renderTarget.getRenderTarget(i);if(n.renderTarget.bind(i,!!s),i instanceof w?(y[0]=i.frame.width,y[1]=i.frame.height):(y[0]=A.width,y[1]=A.height),y[2]=A.isRoot?-1:1,f.update(),n.renderPipes.uniformBatch){const R=n.renderPipes.uniformBatch.getUboResource(f);this._globalFilterBindGroup.setResource(R,0)}else this._globalFilterBindGroup.setResource(f,0);this._globalFilterBindGroup.setResource(e.source,1),this._globalFilterBindGroup.setResource(e.source.style,2),t.groups[0]=this._globalFilterBindGroup,n.encoder.draw({geometry:nS,shader:t,state:t._state,topology:"triangle-list"}),n.type===St.WEBGL&&n.renderTarget.finishRenderPass()}_getFilterData(){return{skip:!1,inputTexture:null,bounds:new ft,container:null,filterEffect:null,blendRequired:!1,previousRenderSurface:null}}calculateSpriteMatrix(t,e){const i=this._activeFilterData,s=t.set(i.inputTexture._source.width,0,0,i.inputTexture._source.height,i.bounds.minX,i.bounds.minY),n=e.worldTransform.copyTo(G.shared);return n.invert(),s.prepend(n),s.scale(1/e.texture.frame.width,1/e.texture.frame.height),s.translate(e.anchor.x,e.anchor.y),s}}Jo.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"filter"},L.add(Jo),L.add(Zo);var aS={__proto__:null};const tu=[];L.handleByNamedList(v.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 oS(r){return eu(!r)}let di;function ru(){if(typeof di=="boolean")return di;try{di=new Function("param1","param2","param3","return param1[param2] === param3;")({a:"b"},"a","b")===!0}catch(r){di=!1}return di}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 iu{constructor(t){this.items=[],this._name=t}emit(t,e,i,s,n,a,o,u){const{name:l,items:c}=this;for(let h=0,f=c.length;h<f;h++)c[h][l](t,e,i,s,n,a,o,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 uS=Object.defineProperty,Gm=Object.getOwnPropertySymbols,lS=Object.prototype.hasOwnProperty,cS=Object.prototype.propertyIsEnumerable,Fm=(r,t,e)=>t in r?uS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Xs=(r,t)=>{for(var e in t||(t={}))lS.call(t,e)&&Fm(r,e,t[e]);if(Gm)for(var e of Gm(t))cS.call(t,e)&&Fm(r,e,t[e]);return r};const hS=["init","destroy","contextChange","resolutionChange","reset","renderEnd","renderStart","render","update","postrender","prerender"],Im=class vy extends Rt{constructor(t){var e;super(),this.runners=Object.create(null),this.renderPipes=Object.create(null),this._initOptions={},this._systemsHash=Object.create(null),this.type=t.type,this.name=t.name,this.config=t;const i=[...hS,...(e=this.config.runners)!=null?e:[]];this._addRunners(...i),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 i in this._systemsHash){const s=this._systemsHash[i].constructor.defaultOptions;t=Xs(Xs({},s),t)}t=Xs(Xs({},vy.defaultOptions),t),this._roundPixels=t.roundPixels?1:0;for(let i=0;i<this.runners.init.items.length;i++)await this.runners.init.items[i].init(t);this._initOptions=t}render(t,e){let i=t;if(i instanceof rt&&(i={container:i},e&&(i.target=e.renderTexture)),i.target||(i.target=this.view.renderTarget),i.target===this.view.renderTarget&&(this._lastObjectRendered=i.container,i.clearColor=this.background.colorRgba),i.clearColor){const s=Array.isArray(i.clearColor)&&i.clearColor.length===4;i.clearColor=s?i.clearColor:V.shared.setValue(i.clearColor).toArray()}i.transform||(i.container.updateLocalTransform(),i.transform=i.container.localTransform),this.runners.prerender.emit(i),this.runners.renderStart.emit(i),this.runners.render.emit(i),this.runners.renderEnd.emit(i),this.runners.postrender.emit(i)}resize(t,e,i){const s=this.view.resolution;this.view.resize(t,e,i),this.emit("resize",this.view.screen.width,this.view.screen.height,this.view.resolution),i!==void 0&&i!==s&&this.runners.resolutionChange.emit(i)}clear(t={}){var e;const i=this;t.target||(t.target=i.renderTarget.renderTarget),t.clearColor||(t.clearColor=this.background.colorRgba),(e=t.clear)!=null||(t.clear=At.ALL);const{clear:s,clearColor:n,target:a}=t;V.shared.setValue(n!=null?n:this.background.colorRgba),i.renderTarget.clear(a,s,V.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 iu(e)})}_addSystems(t){let e;for(e in t){const i=t[e];this._addSystem(i.value,i.name)}}_addSystem(t,e){const i=new t(this);if(this[e])throw new Error(`Whoops! The name "${e}" is already in use`);this[e]=i,this._systemsHash[e]=i;for(const s in this.runners)this.runners[s].add(i);return this}_addPipes(t,e){const i=e.reduce((s,n)=>(s[n.name]=n.value,s),{});t.forEach(s=>{const n=s.value,a=s.name,o=i[a];this.renderPipes[a]=new n(this,o?new o: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.")}};Im.defaultOptions={resolution:1,failIfMajorPerformanceCaveat:!1,roundPixels:!1};let fi=Im,su;function pi(r){return su!==void 0||(su=(()=>{var t;const e={stencil:!0,failIfMajorPerformanceCaveat:r!=null?r:fi.defaultOptions.failIfMajorPerformanceCaveat};try{if(!$.get().getWebGLRenderingContext())return!1;let i=$.get().createCanvas().getContext("webgl",e);const s=!!((t=i==null?void 0:i.getContextAttributes())!=null&&t.stencil);if(i){const n=i.getExtension("WEBGL_lose_context");n&&n.loseContext()}return i=null,s}catch(i){return!1}})()),su}let nu;async function mi(r={}){return nu!==void 0||(nu=await(async()=>{const t=$.get().getNavigator().gpu;if(!t)return!1;try{return await(await t.requestAdapter(r)).requestDevice(),!0}catch(e){return!1}})()),nu}var dS=Object.defineProperty,Um=Object.getOwnPropertySymbols,fS=Object.prototype.hasOwnProperty,pS=Object.prototype.propertyIsEnumerable,km=(r,t,e)=>t in r?dS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gi=(r,t)=>{for(var e in t||(t={}))fS.call(t,e)&&km(r,e,t[e]);if(Um)for(var e of Um(t))pS.call(t,e)&&km(r,e,t[e]);return r};const Lm=["webgl","webgpu","canvas"];async function Nm(r){var t;let e=[];r.preference?(e.push(r.preference),Lm.forEach(a=>{a!==r.preference&&e.push(a)})):e=Lm.slice();let i,s={};for(let a=0;a<e.length;a++){const o=e[a];if(o==="webgpu"&&await mi()){const{WebGPURenderer:u}=await Promise.resolve().then(function(){return oC});i=u,s=gi(gi({},r),r.webgpu);break}else if(o==="webgl"&&pi((t=r.failIfMajorPerformanceCaveat)!=null?t:fi.defaultOptions.failIfMajorPerformanceCaveat)){const{WebGLRenderer:u}=await Promise.resolve().then(function(){return Hw});i=u,s=gi(gi({},r),r.webgl);break}else if(o==="canvas")throw s=gi({},r),new Error("CanvasRenderer is not yet implemented")}if(delete s.webgpu,delete s.webgl,!i)throw new Error("No available renderer for the current environment");const n=new i;return await n.init(s),n}const mS=/^\s*data:(?:([\w-]+)\/([\w+.-]+))?(?:;charset=([\w-]+))?(?:;(base64))?,(.*)/i,_i="8.4.1";class au{static init(){var t;(t=globalThis.__PIXI_APP_INIT__)==null||t.call(globalThis,this,_i)}static destroy(){}}au.extension=v.Application;class ou{constructor(t){this._renderer=t}init(){var t;(t=globalThis.__PIXI_RENDERER_INIT__)==null||t.call(globalThis,this._renderer,_i)}destroy(){this._renderer=null}}ou.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"initHook",priority:-10};var gS=Object.defineProperty,$m=Object.getOwnPropertySymbols,_S=Object.prototype.hasOwnProperty,bS=Object.prototype.propertyIsEnumerable,Hm=(r,t,e)=>t in r?gS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yS=(r,t)=>{for(var e in t||(t={}))_S.call(t,e)&&Hm(r,e,t[e]);if($m)for(var e of $m(t))bS.call(t,e)&&Hm(r,e,t[e]);return r};const Xm=class _c{constructor(...t){this.stage=new rt}async init(t){t=yS({},t),this.renderer=await Nm(t),_c._plugins.forEach(e=>{e.init.call(this,t)})}render(){this.renderer.render({container:this.stage})}get canvas(){return this.renderer.canvas}get view(){return this.renderer.canvas}get screen(){return this.renderer.screen}destroy(t=!1,e=!1){const i=_c._plugins.slice(0);i.reverse(),i.forEach(s=>{s.destroy.call(this)}),this.stage.destroy(e),this.stage=null,this.renderer.destroy(t),this.renderer=null}};Xm._plugins=[];let zm=Xm;L.handleByList(v.Application,zm._plugins),L.add(au);class uu extends Fo{constructor(t,e){var i;super();const{textures:s,data:n}=t;Object.keys(n.pages).forEach(a=>{const o=n.pages[parseInt(a,10)],u=s[o.id];this.pages.push({texture:u})}),Object.keys(n.chars).forEach(a=>{var o;const u=n.chars[a],{frame:l,source:c}=s[u.page],h=new W(u.x+l.x,u.y+l.y,u.width,u.height),f=new w({source:c,frame:h});this.chars[a]={id:a.codePointAt(0),xOffset:u.xOffset,yOffset:u.yOffset,xAdvance:u.xAdvance,kerning:(o=u.kerning)!=null?o:{},texture:f}}),this.baseRenderedFontSize=n.fontSize,this.baseMeasurementFontSize=n.fontSize,this.fontMetrics={ascent:0,descent:0,fontSize:n.fontSize},this.baseLineOffset=n.baseLineOffset,this.lineHeight=n.lineHeight,this.fontFamily=n.fontFamily,this.distanceField=(i=n.distanceField)!=null?i:{type:"none",range:0},this.url=e}destroy(){super.destroy();for(let t=0;t<this.pages.length;t++){const{texture:e}=this.pages[t];e.destroy(!0)}this.pages=null}static install(t){ci.install(t)}static uninstall(t){ci.uninstall(t)}}const zs={test(r){return typeof r=="string"&&r.startsWith("info face=")},parse(r){var t,e,i;const s=r.match(/^[a-z]+\s+.+$/gm),n={info:[],common:[],page:[],char:[],chars:[],kerning:[],kernings:[],distanceField:[]};for(const m in s){const _=s[m].match(/^[a-z]+/gm)[0],g=s[m].match(/[a-zA-Z]+=([^\s"']+|"([^"]*)")/gm),b={};for(const x in g){const y=g[x].split("="),T=y[0],A=y[1].replace(/"/gm,""),R=parseFloat(A),C=isNaN(R)?A:R;b[T]=C}n[_].push(b)}const a={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},[o]=n.info,[u]=n.common,[l]=(t=n.distanceField)!=null?t:[];l&&(a.distanceField={range:parseInt(l.distanceRange,10),type:l.fieldType}),a.fontSize=parseInt(o.size,10),a.fontFamily=o.face,a.lineHeight=parseInt(u.lineHeight,10);const c=n.page;for(let m=0;m<c.length;m++)a.pages.push({id:parseInt(c[m].id,10)||0,file:c[m].file});const h={};a.baseLineOffset=a.lineHeight-parseInt(u.base,10);const f=n.char;for(let m=0;m<f.length;m++){const _=f[m],g=parseInt(_.id,10);let b=(i=(e=_.letter)!=null?e:_.char)!=null?i:String.fromCharCode(g);b==="space"&&(b=" "),h[g]=b,a.chars[b]={id:g,page:parseInt(_.page,10)||0,x:parseInt(_.x,10),y:parseInt(_.y,10),width:parseInt(_.width,10),height:parseInt(_.height,10),xOffset:parseInt(_.xoffset,10),yOffset:parseInt(_.yoffset,10),xAdvance:parseInt(_.xadvance,10),kerning:{}}}const p=n.kerning||[];for(let m=0;m<p.length;m++){const _=parseInt(p[m].first,10),g=parseInt(p[m].second,10),b=parseInt(p[m].amount,10);a.chars[h[g]].kerning[h[_]]=b}return a}},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 i={chars:{},pages:[],lineHeight:0,fontSize:0,fontFamily:"",distanceField:null,baseLineOffset:0},s=r.getElementsByTagName("info")[0],n=r.getElementsByTagName("common")[0],a=r.getElementsByTagName("distanceField")[0];a&&(i.distanceField={type:a.getAttribute("fieldType"),range:parseInt(a.getAttribute("distanceRange"),10)});const o=r.getElementsByTagName("page"),u=r.getElementsByTagName("char"),l=r.getElementsByTagName("kerning");i.fontSize=parseInt(s.getAttribute("size"),10),i.fontFamily=s.getAttribute("face"),i.lineHeight=parseInt(n.getAttribute("lineHeight"),10);for(let h=0;h<o.length;h++)i.pages.push({id:parseInt(o[h].getAttribute("id"),10)||0,file:o[h].getAttribute("file")});const c={};i.baseLineOffset=i.lineHeight-parseInt(n.getAttribute("base"),10);for(let h=0;h<u.length;h++){const f=u[h],p=parseInt(f.getAttribute("id"),10);let m=(e=(t=f.getAttribute("letter"))!=null?t:f.getAttribute("char"))!=null?e:String.fromCharCode(p);m==="space"&&(m=" "),c[p]=m,i.chars[m]={id:p,page:parseInt(f.getAttribute("page"),10)||0,x:parseInt(f.getAttribute("x"),10),y:parseInt(f.getAttribute("y"),10),width:parseInt(f.getAttribute("width"),10),height:parseInt(f.getAttribute("height"),10),xOffset:parseInt(f.getAttribute("xoffset"),10),yOffset:parseInt(f.getAttribute("yoffset"),10),xAdvance:parseInt(f.getAttribute("xadvance"),10),kerning:{}}}for(let h=0;h<l.length;h++){const f=parseInt(l[h].getAttribute("first"),10),p=parseInt(l[h].getAttribute("second"),10),m=parseInt(l[h].getAttribute("amount"),10);i.chars[c[p]].kerning[c[f]]=m}return i}},cu={test(r){return typeof r=="string"&&r.includes("<font>")?lu.test($.get().parseXML(r)):!1},parse(r){return lu.parse($.get().parseXML(r))}},xS=[".xml",".fnt"],jm={extension:{type:v.CacheParser,name:"cacheBitmapFont"},test:r=>r instanceof uu,getCacheableAssets(r,t){const e={};return r.forEach(i=>{e[i]=t,e[`${i}-bitmap`]=t}),e[`${t.fontFamily}-bitmap`]=t,e}},Vm={extension:{type:v.LoadParser,priority:Ct.Normal},name:"loadBitmapFont",test(r){return xS.includes(Tt.extname(r).toLowerCase())},async testParse(r){return zs.test(r)||cu.test(r)},async parse(r,t,e){const i=zs.test(r)?zs.parse(r):cu.parse(r),{src:s}=t,{pages:n}=i,a=[],o=i.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 f=Tt.join(Tt.dirname(s),h);f=Wi(f,s),a.push({src:f,data:o})}const u=await e.load(a),l=a.map(c=>u[c.src]);return new uu({data:i,textures:l},s)},async load(r,t){return await(await $.get().fetch(r)).text()},async unload(r,t,e){await Promise.all(r.pages.map(i=>e.unload(i.texture.source._sourceOrigin))),r.destroy()}};class Wm{constructor(t,e=!1){this._loader=t,this._assetList=[],this._isLoading=!1,this._maxConcurrent=1,this.verbose=e}add(t){t.forEach(e=>{this._assetList.push(e)}),this.verbose&&console.log("[BackgroundLoader] assets: ",this._assetList),this._isActive&&!this._isLoading&&this._next()}async _next(){if(this._assetList.length&&this._isActive){this._isLoading=!0;const t=[],e=Math.min(this._assetList.length,this._maxConcurrent);for(let i=0;i<e;i++)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 Ym={extension:{type:v.CacheParser,name:"cacheTextureArray"},test:r=>Array.isArray(r)&&r.every(t=>t instanceof w),getCacheableAssets:(r,t)=>{const e={};return r.forEach(i=>{t.forEach((s,n)=>{e[i+(n===0?"":n+1)]=s})}),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:v.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")},Km=["png","jpg","jpeg"],Zm={extension:{type:v.DetectionParser,priority:-1},test:()=>Promise.resolve(!0),add:async r=>[...r,...Km],remove:async r=>r.filter(t=>!Km.includes(t))},vS="WorkerGlobalScope"in globalThis&&globalThis instanceof globalThis.WorkerGlobalScope;function js(r){return vS?!1:document.createElement("video").canPlayType(r)!==""}const Qm={extension:{type:v.DetectionParser,priority:0},test:async()=>js("video/mp4"),add:async r=>[...r,"mp4","m4v"],remove:async r=>r.filter(t=>t!=="mp4"&&t!=="m4v")},Jm={extension:{type:v.DetectionParser,priority:0},test:async()=>js("video/ogg"),add:async r=>[...r,"ogv"],remove:async r=>r.filter(t=>t!=="ogv")},tg={extension:{type:v.DetectionParser,priority:0},test:async()=>js("video/webm"),add:async r=>[...r,"webm"],remove:async r=>r.filter(t=>t!=="webm")},eg={extension:{type:v.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 TS=Object.defineProperty,SS=Object.defineProperties,AS=Object.getOwnPropertyDescriptors,rg=Object.getOwnPropertySymbols,ES=Object.prototype.hasOwnProperty,wS=Object.prototype.propertyIsEnumerable,ig=(r,t,e)=>t in r?TS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,CS=(r,t)=>{for(var e in t||(t={}))ES.call(t,e)&&ig(r,e,t[e]);if(rg)for(var e of rg(t))wS.call(t,e)&&ig(r,e,t[e]);return r},RS=(r,t)=>SS(r,AS(t));class sg{constructor(){this._parsers=[],this._parsersValidated=!1,this.parsers=new Proxy(this._parsers,{set:(t,e,i)=>(this._parsersValidated=!1,t[e]=i,!0)}),this.promiseCache={}}reset(){this._parsersValidated=!1,this.promiseCache={}}_getLoadPromiseAndParser(t,e){const i={promise:null,parser:null};return i.promise=(async()=>{var s,n;let a=null,o=null;if(e.loadParser&&(o=this._parserHash[e.loadParser]),!o){for(let u=0;u<this.parsers.length;u++){const l=this.parsers[u];if(l.load&&(s=l.test)!=null&&s.call(l,t,e,this)){o=l;break}}if(!o)return null}a=await o.load(t,e,this),i.parser=o;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,a,e,this))&&(a=await l.parse(a,e,this)||a,i.parser=l)}return a})(),i}async load(t,e){this._parsersValidated||this._validateParsers();let i=0;const s={},n=Nr(t),a=Gt(t,l=>({alias:[l],src:l,data:{}})),o=a.length,u=a.map(async l=>{const c=Tt.toAbsolute(l.src);if(!s[l.src])try{this.promiseCache[c]||(this.promiseCache[c]=this._getLoadPromiseAndParser(c,l)),s[l.src]=await this.promiseCache[c].promise,e&&e(++i/o)}catch(h){throw delete this.promiseCache[c],delete s[l.src],new Error(`[Loader.load] Failed to load ${c}.
${h}`)}});return await Promise.all(u),n?s[a[0].src]:s}async unload(t){const e=Gt(t,i=>({alias:[i],src:i})).map(async i=>{var s,n;const a=Tt.toAbsolute(i.src),o=this.promiseCache[a];if(o){const u=await o.promise;delete this.promiseCache[a],await((n=(s=o.parser)==null?void 0:s.unload)==null?void 0:n.call(s,u,i,this))}});await Promise.all(e)}_validateParsers(){this._parsersValidated=!0,this._parserHash=this._parsers.filter(t=>t.name).reduce((t,e)=>(e.name&&t[e.name],RS(CS({},t),{[e.name]:e})),{})}}function ke(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 kt(r,t){const e=r.split("?")[0],i=Tt.extname(e).toLowerCase();return Array.isArray(t)?t.includes(i):i===t}const PS=".json",MS="application/json",ng={extension:{type:v.LoadParser,priority:Ct.Low},name:"loadJson",test(r){return ke(r,MS)||kt(r,PS)},async load(r){return await(await $.get().fetch(r)).json()}},DS=".txt",OS="text/plain",ag={name:"loadTxt",extension:{type:v.LoadParser,priority:Ct.Low,name:"loadTxt"},test(r){return ke(r,OS)||kt(r,DS)},async load(r){return await(await $.get().fetch(r)).text()}};var BS=Object.defineProperty,GS=Object.defineProperties,FS=Object.getOwnPropertyDescriptors,og=Object.getOwnPropertySymbols,IS=Object.prototype.hasOwnProperty,US=Object.prototype.propertyIsEnumerable,ug=(r,t,e)=>t in r?BS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,kS=(r,t)=>{for(var e in t||(t={}))IS.call(t,e)&&ug(r,e,t[e]);if(og)for(var e of og(t))US.call(t,e)&&ug(r,e,t[e]);return r},LS=(r,t)=>GS(r,FS(t));const NS=["normal","bold","100","200","300","400","500","600","700","800","900"],$S=[".ttf",".otf",".woff",".woff2"],HS=["font/ttf","font/otf","font/woff","font/woff2"],XS=/^(--|-?[A-Z_])[0-9A-Z_-]*$/i;function lg(r){const t=Tt.extname(r),e=Tt.basename(r,t).replace(/(-|_)/g," ").toLowerCase().split(" ").map(n=>n.charAt(0).toUpperCase()+n.slice(1));let i=e.length>0;for(const n of e)if(!n.match(XS)){i=!1;break}let s=e.join(" ");return i||(s=`"${s.replace(/[\\"]/g,"\\$&")}"`),s}const zS=/^[0-9A-Za-z%:/?#\[\]@!\$&'()\*\+,;=\-._~]*$/;function jS(r){return zS.test(r)?r:encodeURI(r)}const cg={extension:{type:v.LoadParser,priority:Ct.Low},name:"loadWebFont",test(r){return ke(r,HS)||kt(r,$S)},async load(r,t){var e,i,s,n,a,o;const u=$.get().getFontFaceSet();if(u){const l=[],c=(i=(e=t.data)==null?void 0:e.family)!=null?i:lg(r),h=(a=(n=(s=t.data)==null?void 0:s.weights)==null?void 0:n.filter(p=>NS.includes(p)))!=null?a:["normal"],f=(o=t.data)!=null?o:{};for(let p=0;p<h.length;p++){const m=h[p],_=new FontFace(c,`url(${jS(r)})`,LS(kS({},f),{weight:m}));await _.load(),u.add(_),l.push(_)}return K.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=>{K.remove(t.family),$.get().getFontFaceSet().delete(t)})}};function Vs(r,t=1){var e;const i=(e=fe.RETINA_PREFIX)==null?void 0:e.exec(r);return i?parseFloat(i[1]):t}function ye(r,t,e){r.label=e,r._sourceOrigin=e;const i=new w({source:r,label:e}),s=()=>{delete t.promiseCache[e],K.has(e)&&K.remove(e)};return i.source.once("destroy",()=>{t.promiseCache[e]&&s()}),i.once("destroy",()=>{r.destroyed||s()}),i}var VS=Object.defineProperty,Ws=Object.getOwnPropertySymbols,hg=Object.prototype.hasOwnProperty,dg=Object.prototype.propertyIsEnumerable,fg=(r,t,e)=>t in r?VS(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,WS=(r,t)=>{for(var e in t||(t={}))hg.call(t,e)&&fg(r,e,t[e]);if(Ws)for(var e of Ws(t))dg.call(t,e)&&fg(r,e,t[e]);return r},YS=(r,t)=>{var e={};for(var i in r)hg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Ws)for(var i of Ws(r))t.indexOf(i)<0&&dg.call(r,i)&&(e[i]=r[i]);return e};const qS=".svg",KS="image/svg+xml",pg={extension:{type:v.LoadParser,priority:Ct.Low,name:"loadSVG"},name:"loadSVG",config:{crossOrigin:"anonymous",parseAsGraphicsContext:!1},test(r){return ke(r,KS)||kt(r,qS)},async load(r,t,e){var i;return((i=t.data.parseAsGraphicsContext)!=null?i:this.config.parseAsGraphicsContext)?QS(r):ZS(r,t,e,this.config.crossOrigin)},unload(r){r.destroy(!0)}};async function ZS(r,t,e,i){var s,n,a,o,u;const l=await(await $.get().fetch(r)).blob(),c=URL.createObjectURL(l),h=new Image;h.src=c,h.crossOrigin=i,await h.decode(),URL.revokeObjectURL(c);const f=document.createElement("canvas"),p=f.getContext("2d"),m=((s=t.data)==null?void 0:s.resolution)||Vs(r),_=(a=(n=t.data)==null?void 0:n.width)!=null?a:h.width,g=(u=(o=t.data)==null?void 0:o.height)!=null?u:h.height;f.width=_*m,f.height=g*m,p.drawImage(h,0,0,_*m,g*m);const b=t.data,{parseAsGraphicsContext:x}=b,y=YS(b,["parseAsGraphicsContext"]),T=new De(WS({resource:f,alphaMode:"premultiply-alpha-on-upload",resolution:m},y));return ye(T,e,r)}async function QS(r){const t=await(await $.get().fetch(r)).text(),e=new _t;return e.svg(t),e}const JS=`(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 _r=null,du=class{constructor(){_r||(_r=URL.createObjectURL(new Blob([JS],{type:"application/javascript"}))),this.worker=new Worker(_r)}};du.revokeObjectURL=function(){_r&&(URL.revokeObjectURL(_r),_r=null)};const tA='(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 br=null,mg=class{constructor(){br||(br=URL.createObjectURL(new Blob([tA],{type:"application/javascript"}))),this.worker=new Worker(br)}};mg.revokeObjectURL=function(){br&&(URL.revokeObjectURL(br),br=null)};let gg=0,fu,eA=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",i=>{e.terminate(),du.revokeObjectURL(),t(i.data)})}),this._isImageBitmapSupported)}loadImageBitmap(t,e){var i;return this._run("loadImageBitmap",[t,(i=e==null?void 0:e.data)==null?void 0:i.alphaMode])}async _initWorkers(){this._initialized||(this._initialized=!0)}_getWorker(){fu===void 0&&(fu=navigator.hardwareConcurrency||4);let t=this._workerPool.pop();return!t&&this._createdWorkers<fu&&(this._createdWorkers++,t=new mg().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 i=new Promise((s,n)=>{this._queue.push({id:t,arguments:e,resolve:s,reject:n})});return this._next(),i}_next(){if(!this._queue.length)return;const t=this._getWorker();if(!t)return;const e=this._queue.pop(),i=e.id;this._resolveHash[gg]={resolve:e.resolve,reject:e.reject},t.postMessage({data:e.arguments,uuid:gg++,id:i})}};const pu=new eA;var rA=Object.defineProperty,_g=Object.getOwnPropertySymbols,iA=Object.prototype.hasOwnProperty,sA=Object.prototype.propertyIsEnumerable,bg=(r,t,e)=>t in r?rA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,nA=(r,t)=>{for(var e in t||(t={}))iA.call(t,e)&&bg(r,e,t[e]);if(_g)for(var e of _g(t))sA.call(t,e)&&bg(r,e,t[e]);return r};const aA=[".jpeg",".jpg",".png",".webp",".avif"],oA=["image/jpeg","image/png","image/webp","image/avif"];async function yg(r,t){var e;const i=await $.get().fetch(r);if(!i.ok)throw new Error(`[loadImageBitmap] Failed to fetch ${r}: ${i.status} ${i.statusText}`);const s=await i.blob();return((e=t==null?void 0:t.data)==null?void 0:e.alphaMode)==="premultiplied-alpha"?createImageBitmap(s,{premultiplyAlpha:"none"}):createImageBitmap(s)}const mu={name:"loadTextures",extension:{type:v.LoadParser,priority:Ct.High,name:"loadTextures"},config:{preferWorkers:!0,preferCreateImageBitmap:!0,crossOrigin:"anonymous"},test(r){return ke(r,oA)||kt(r,aA)},async load(r,t,e){var i;let s=null;globalThis.createImageBitmap&&this.config.preferCreateImageBitmap?this.config.preferWorkers&&await pu.isImageBitmapSupported()?s=await pu.loadImageBitmap(r,t):s=await yg(r,t):s=await new Promise(a=>{s=new Image,s.crossOrigin=this.config.crossOrigin,s.src=r,s.complete?a(s):s.onload=()=>{a(s)}});const n=new De(nA({resource:s,alphaMode:"premultiply-alpha-on-upload",resolution:((i=t.data)==null?void 0:i.resolution)||Vs(r)},t.data));return ye(n,e,r)},unload(r){r.destroy(!0)}};var uA=Object.defineProperty,lA=Object.defineProperties,cA=Object.getOwnPropertyDescriptors,xg=Object.getOwnPropertySymbols,hA=Object.prototype.hasOwnProperty,dA=Object.prototype.propertyIsEnumerable,vg=(r,t,e)=>t in r?uA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,gu=(r,t)=>{for(var e in t||(t={}))hA.call(t,e)&&vg(r,e,t[e]);if(xg)for(var e of xg(t))dA.call(t,e)&&vg(r,e,t[e]);return r},Tg=(r,t)=>lA(r,cA(t));const Sg=[".mp4",".m4v",".webm",".ogg",".ogv",".h264",".avi",".mov"],fA=Sg.map(r=>`video/${r.substring(1)}`);function Ag(r,t,e){e===void 0&&!t.startsWith("data:")?r.crossOrigin=wg(t):e!==!1&&(r.crossOrigin=typeof e=="string"?e:"anonymous")}function Eg(r){return new Promise((t,e)=>{r.addEventListener("canplaythrough",i),r.addEventListener("error",s),r.load();function i(){n(),t()}function s(a){n(),e(a)}function n(){r.removeEventListener("canplaythrough",i),r.removeEventListener("error",s)}})}function wg(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 Cg={name:"loadVideo",extension:{type:v.LoadParser,name:"loadVideo"},test(r){const t=ke(r,fA),e=kt(r,Sg);return t||e},async load(r,t,e){var i,s;const n=gu(Tg(gu({},Yr.defaultOptions),{resolution:((i=t.data)==null?void 0:i.resolution)||Vs(r),alphaMode:((s=t.data)==null?void 0:s.alphaMode)||await Ra()}),t.data),a=document.createElement("video"),o={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(o).forEach(c=>{const h=o[c];h!==void 0&&a.setAttribute(c,h)}),n.muted===!0&&(a.muted=!0),Ag(a,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=Yr.MIME_TYPES[c]||`video/${c}`}return u.src=r,l&&(u.type=l),new Promise(c=>{const h=async()=>{const f=new Yr(Tg(gu({},n),{resource:a}));a.removeEventListener("canplay",h),t.data.preload&&await Eg(a),c(ye(f,e,r))};a.addEventListener("canplay",h),a.appendChild(u)})},unload(r){r.destroy(!0)}},_u={extension:{type:v.ResolveParser,name:"resolveTexture"},test:mu.test,parse:r=>{var t,e;return{resolution:parseFloat((e=(t=fe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:r.split(".").pop(),src:r}}},Rg={extension:{type:v.ResolveParser,priority:-2,name:"resolveJson"},test:r=>fe.RETINA_PREFIX.test(r)&&r.endsWith(".json"),parse:_u.parse};class Pg{constructor(){this._detections=[],this._initialized=!1,this.resolver=new fe,this.loader=new sg,this.cache=K,this._backgroundLoader=new Wm(this.loader),this._backgroundLoader.active=!0,this.reset()}async init(t={}){var e,i,s;if(this._initialized)return;if(this._initialized=!0,t.defaultSearchParams&&this.resolver.setDefaultSearchParams(t.defaultSearchParams),t.basePath&&(this.resolver.basePath=t.basePath),t.bundleIdentifier&&this.resolver.setBundleIdentifier(t.bundleIdentifier),t.manifest){let u=t.manifest;typeof u=="string"&&(u=await this.load(u)),this.resolver.addManifest(u)}const n=(i=(e=t.texturePreference)==null?void 0:e.resolution)!=null?i:1,a=typeof n=="number"?[n]:n,o=await this._detectFormats({preferredFormats:(s=t.texturePreference)==null?void 0:s.format,skipDetections:t.skipDetections,detections:this._detections});this.resolver.prefer({params:{format:o,resolution:a}}),t.preferences&&this.setPreferences(t.preferences)}add(t){this.resolver.add(t)}async load(t,e){this._initialized||await this.init();const i=Nr(t),s=Gt(t).map(o=>{if(typeof o!="string"){const u=this.resolver.getAlias(o);return u.some(l=>!this.resolver.hasKey(l))&&this.add(o),Array.isArray(u)?u[0]:u}return this.resolver.hasKey(o)||this.add({alias:o,src:o}),o}),n=this.resolver.resolve(s),a=await this._mapLoadToResolve(n,e);return i?a[s[0]]:a}addBundle(t,e){this.resolver.addBundle(t,e)}async loadBundle(t,e){this._initialized||await this.init();let i=!1;typeof t=="string"&&(i=!0,t=[t]);const s=this.resolver.resolveBundle(t),n={},a=Object.keys(s);let o=0,u=0;const l=()=>{e==null||e(++o/u)},c=a.map(h=>{const f=s[h];return u+=Object.keys(f).length,this._mapLoadToResolve(f,l).then(p=>{n[h]=p})});return await Promise.all(c),i?n[t[0]]:n}async backgroundLoad(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolve(t);this._backgroundLoader.add(Object.values(e))}async backgroundLoadBundle(t){this._initialized||await this.init(),typeof t=="string"&&(t=[t]);const e=this.resolver.resolveBundle(t);Object.values(e).forEach(i=>{this._backgroundLoader.add(Object.values(i))})}reset(){this.resolver.reset(),this.loader.reset(),this.cache.reset(),this._initialized=!1}get(t){if(typeof t=="string")return K.get(t);const e={};for(let i=0;i<t.length;i++)e[i]=K.get(t[i]);return e}async _mapLoadToResolve(t,e){const i=[...new Set(Object.values(t))];this._backgroundLoader.active=!1;const s=await this.loader.load(i,e);this._backgroundLoader.active=!0;const n={};return i.forEach(a=>{const o=s[a.src],u=[a.src];a.alias&&u.push(...a.alias),u.forEach(l=>{n[l]=o}),K.set(u,o)}),n}async unload(t){this._initialized||await this.init();const e=Gt(t).map(s=>typeof s!="string"?s.src:s),i=this.resolver.resolve(e);await this._unloadFromResolved(i)}async unloadBundle(t){this._initialized||await this.init(),t=Gt(t);const e=this.resolver.resolveBundle(t),i=Object.keys(e).map(s=>this._unloadFromResolved(e[s]));await Promise.all(i)}async _unloadFromResolved(t){const e=Object.values(t);e.forEach(i=>{K.remove(i.src)}),await this.loader.unload(e)}async _detectFormats(t){let e=[];t.preferredFormats&&(e=Array.isArray(t.preferredFormats)?t.preferredFormats:[t.preferredFormats]);for(const i of t.detections)t.skipDetections||await i.test()?e=await i.add(e):t.skipDetections||(e=await i.remove(e));return e=e.filter((i,s)=>e.indexOf(i)===s),e}get detections(){return this._detections}setPreferences(t){this.loader.parsers.forEach(e=>{e.config&&Object.keys(e.config).filter(i=>i in t).forEach(i=>{e.config[i]=t[i]})})}}const bi=new Pg;L.handleByList(v.LoadParser,bi.loader.parsers).handleByList(v.ResolveParser,bi.resolver.parsers).handleByList(v.CacheParser,bi.cache.parsers).handleByList(v.DetectionParser,bi.detections),L.add(Ym,Zm,qm,eg,Qm,Jm,tg,ng,ag,cg,pg,mu,Cg,Vm,jm,_u,Rg);const Mg={loader:v.LoadParser,resolver:v.ResolveParser,cache:v.CacheParser,detection:v.DetectionParser};L.handle(v.Asset,r=>{const t=r.ref;Object.entries(Mg).filter(([e])=>!!t[e]).forEach(([e,i])=>{var s;return L.add(Object.assign(t[e],{extension:(s=t[e].extension)!=null?s:i}))})},r=>{const t=r.ref;Object.keys(Mg).filter(e=>!!t[e]).forEach(e=>L.remove(t[e]))});const pA={extension:{type:v.DetectionParser,priority:3},test:async()=>!!(await mi()||pi()),add:async r=>[...r,"basis"],remove:async r=>r.filter(t=>t!=="basis")};class yi extends et{constructor(t){super(t),this.uploadMethodId="compressed",this.resource=t.resource,this.mipLevelCount=this.resource.length}}let Ys;function bu(){if(Ys)return Ys;const r=document.createElement("canvas").getContext("webgl");return r?(Ys=[...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"]:[]],Ys):[]}let qs;async function yu(){if(qs)return qs;const r=await $.get().getNavigator().gpu.requestAdapter();return qs=[...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"]:[]],qs}let xu;async function vu(){return xu!==void 0||(xu=await(async()=>{const r=await mi(),t=pi();if(r&&t){const e=await yu(),i=bu();return e.filter(s=>i.includes(s))}else{if(r)return await yu();if(t)return bu()}return[]})()),xu}const Dg=["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 Ks;async function xi(){if(Ks!==void 0)return Ks;const r=await vu();return Ks=[...Dg,...r],Ks}const mA='(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 yr=null,Og=class{constructor(){yr||(yr=URL.createObjectURL(new Blob([mA],{type:"application/javascript"}))),this.worker=new Worker(yr)}};Og.revokeObjectURL=function(){yr&&(URL.revokeObjectURL(yr),yr=null)};const Zs={jsUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.js",wasmUrl:"https://files.pixijs.download/transcoders/basis/basis_transcoder.wasm"};function gA(r){Object.assign(Zs,r)}let vi;const Bg={};function _A(r){return vi||(vi=new Og().worker,vi.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load Basis texture",i),Bg[i](s)},vi.postMessage({type:"init",jsUrl:Zs.jsUrl,wasmUrl:Zs.wasmUrl,supportedTextures:r})),vi}function Gg(r,t){const e=_A(t);return new Promise(i=>{Bg[r]=i,e.postMessage({type:"load",url:r})})}const bA={extension:{type:v.LoadParser,priority:Ct.High,name:"loadBasis"},name:"loadBasis",test(r){return kt(r,[".basis"])},async load(r,t,e){const i=await xi(),s=await Gg(r,i),n=new yi(s);return ye(n,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};function yA(r,t){const e=r.getNumImages(),i=r.getNumLevels(0);if(!r.startTranscoding())throw new Error("startTranscoding failed");const s=[];for(let n=0;n<i;++n)for(let a=0;a<e;++a){const o=r.getImageTranscodedSizeInBytes(a,n,t),u=new Uint8Array(o);if(!r.transcodeImage(u,a,n,t,1,0))throw new Error("transcodeImage failed");s.push(u)}return s}const xA={"bc3-rgba-unorm":3,"bc7-rgba-unorm":6,"etc2-rgba8unorm":1,"astc-4x4-unorm":10,rgba8unorm:13,rgba4unorm:16};function vA(r){const t=xA[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const TA={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},SA={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||{}),Su=(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))(Su||{});function dt(r){return r.charCodeAt(0)+(r.charCodeAt(1)<<8)+(r.charCodeAt(2)<<16)+(r.charCodeAt(3)<<24)}var Et=(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=dt("UYVY")]="UYVY",r[r.R8G8_B8G8=dt("RGBG")]="R8G8_B8G8",r[r.YUY2=dt("YUY2")]="YUY2",r[r.D3DFMT_G8R8_G8B8=dt("GRGB")]="D3DFMT_G8R8_G8B8",r[r.DXT1=dt("DXT1")]="DXT1",r[r.DXT2=dt("DXT2")]="DXT2",r[r.DXT3=dt("DXT3")]="DXT3",r[r.DXT4=dt("DXT4")]="DXT4",r[r.DXT5=dt("DXT5")]="DXT5",r[r.ATI1=dt("ATI1")]="ATI1",r[r.AT1N=dt("AT1N")]="AT1N",r[r.ATI2=dt("ATI2")]="ATI2",r[r.AT2N=dt("AT2N")]="AT2N",r[r.BC4U=dt("BC4U")]="BC4U",r[r.BC4S=dt("BC4S")]="BC4S",r[r.BC5U=dt("BC5U")]="BC5U",r[r.BC5S=dt("BC5S")]="BC5S",r[r.DX10=dt("DX10")]="DX10",r))(Et||{});const Au={[Et.DXT1]:"bc1-rgba-unorm",[Et.DXT2]:"bc2-rgba-unorm",[Et.DXT3]:"bc2-rgba-unorm",[Et.DXT4]:"bc3-rgba-unorm",[Et.DXT5]:"bc3-rgba-unorm",[Et.ATI1]:"bc4-r-unorm",[Et.BC4U]:"bc4-r-unorm",[Et.BC4S]:"bc4-r-snorm",[Et.ATI2]:"bc5-rg-unorm",[Et.BC5U]:"bc5-rg-unorm",[Et.BC5S]:"bc5-rg-snorm",36:"rgba16uint",110:"rgba16sint",111:"r16float",112:"rg16float",113:"rgba16float",114:"r32float",115:"rg32float",116:"rgba32float"},wt={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"},U={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:TA,HEADER_DX10_FIELDS:SA,DXGI_FORMAT:Tu,D3D10_RESOURCE_DIMENSION:Su,D3DFMT:Et},Fg={"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 Ig(r,t){const{format:e,fourCC:i,width:s,height:n,dataOffset:a,mipmapCount:o}=EA(r);if(!t.includes(e))throw new Error(`Unsupported texture format: ${i} ${e}, supported: ${t}`);if(o<=1)return{format:e,width:s,height:n,resource:[new Uint8Array(r,a)],alphaMode:"no-premultiply-alpha"};const u=AA(e,s,n,a,o,r);return{format:e,width:s,height:n,resource:u,alphaMode:"no-premultiply-alpha"}}function AA(r,t,e,i,s,n){const a=[],o=Fg[r];let u=t,l=e,c=i;for(let h=0;h<s;++h){const f=o?Math.max(4,u)/4*Math.max(4,l)/4*o:u*l*4,p=new Uint8Array(n,c,f);a.push(p),c+=f,u=Math.max(u>>1,1),l=Math.max(l>>1,1)}return a}function EA(r){const t=new Uint32Array(r,0,U.HEADER_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(t[U.HEADER_FIELDS.MAGIC]!==U.MAGIC_VALUE)throw new Error("Invalid magic number in DDS header");const e=t[U.HEADER_FIELDS.HEIGHT],i=t[U.HEADER_FIELDS.WIDTH],s=Math.max(1,t[U.HEADER_FIELDS.MIPMAP_COUNT]),n=t[U.HEADER_FIELDS.PF_FLAGS],a=t[U.HEADER_FIELDS.FOURCC],o=wA(t,n,a,r),u=U.MAGIC_SIZE+U.HEADER_SIZE+(a===U.D3DFMT.DX10?U.HEADER_DX10_SIZE:0);return{format:o,fourCC:a,width:i,height:e,dataOffset:u,mipmapCount:s}}function wA(r,t,e,i){if(t&U.PIXEL_FORMAT_FLAGS.FOURCC){if(e===U.D3DFMT.DX10){const s=new Uint32Array(i,U.MAGIC_SIZE+U.HEADER_SIZE,U.HEADER_DX10_SIZE/Uint32Array.BYTES_PER_ELEMENT);if(s[U.HEADER_DX10_FIELDS.MISC_FLAG]===U.RESOURCE_MISC_TEXTURECUBE)throw new Error("DDSParser does not support cubemap textures");if(s[U.HEADER_DX10_FIELDS.RESOURCE_DIMENSION]===U.D3D10_RESOURCE_DIMENSION.DDS_DIMENSION_TEXTURE3D)throw new Error("DDSParser does not supported 3D texture data");const n=s[U.HEADER_DX10_FIELDS.DXGI_FORMAT];if(n in wt)return wt[n];throw new Error(`DDSParser cannot parse texture data with DXGI format ${n}`)}if(e in Au)return Au[e];throw new Error(`DDSParser cannot parse texture data with fourCC format ${e}`)}if(t&U.PIXEL_FORMAT_FLAGS.RGB||t&U.PIXEL_FORMAT_FLAGS.RGBA)return CA(r);throw t&U.PIXEL_FORMAT_FLAGS.YUV?new Error("DDSParser does not supported YUV uncompressed texture data."):t&U.PIXEL_FORMAT_FLAGS.LUMINANCE||t&U.PIXEL_FORMAT_FLAGS.LUMINANCEA?new Error("DDSParser does not support single-channel (lumninance) texture data!"):t&U.PIXEL_FORMAT_FLAGS.ALPHA||t&U.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 CA(r){const t=r[U.HEADER_FIELDS.RGB_BITCOUNT],e=r[U.HEADER_FIELDS.R_BIT_MASK],i=r[U.HEADER_FIELDS.G_BIT_MASK],s=r[U.HEADER_FIELDS.B_BIT_MASK],n=r[U.HEADER_FIELDS.A_BIT_MASK];switch(t){case 32:if(e===255&&i===65280&&s===16711680&&n===4278190080)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R8G8B8A8_UNORM];if(e===16711680&&i===65280&&s===255&&n===4278190080)return wt[U.DXGI_FORMAT.DXGI_FORMAT_B8G8R8A8_UNORM];if(e===1072693248&&i===1047552&&s===1023&&n===3221225472)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R10G10B10A2_UNORM];if(e===65535&&i===4294901760&&s===0&&n===0)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R16G16_UNORM];if(e===4294967295&&i===0&&s===0&&n===0)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R32_FLOAT];break;case 24:break;case 16:if(e===31744&&i===992&&s===31&&n===32768)return wt[U.DXGI_FORMAT.DXGI_FORMAT_B5G5R5A1_UNORM];if(e===63488&&i===2016&&s===31&&n===0)return wt[U.DXGI_FORMAT.DXGI_FORMAT_B5G6R5_UNORM];if(e===3840&&i===240&&s===15&&n===61440)return wt[U.DXGI_FORMAT.DXGI_FORMAT_B4G4R4A4_UNORM];if(e===255&&i===0&&s===0&&n===65280)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R8G8_UNORM];if(e===65535&&i===0&&s===0&&n===0)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R16_UNORM];break;case 8:if(e===255&&i===0&&s===0&&n===0)return wt[U.DXGI_FORMAT.DXGI_FORMAT_R8_UNORM];break}throw new Error(`DDSParser does not support uncompressed texture with configuration:
bitCount = ${t}, rBitMask = ${e}, gBitMask = ${i}, aBitMask = ${n}`)}const RA={extension:{type:v.LoadParser,priority:Ct.High,name:"loadDDS"},name:"loadDDS",test(r){return kt(r,[".dds"])},async load(r,t,e){const i=await xi(),s=await(await fetch(r)).arrayBuffer(),n=Ig(s,i),a=new yi(n);return ye(a,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}};var Ug=(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))(Ug||{}),PA=(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))(PA||{}),MA=(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))(MA||{});const it={FILE_HEADER_SIZE:64,FILE_IDENTIFIER:[171,75,84,88,32,49,49,187,13,10,26,10],FORMATS_TO_COMPONENTS:{6408:4,6407:3,33319:2,6403:1,6409:1,6410:2,6406:1},INTERNAL_FORMAT_TO_BYTES_PER_PIXEL:{33776:.5,33777:.5,33778:1,33779:1,35916:.5,35917:.5,35918:1,35919:1,36283:.5,36284:.5,36285:1,36286:1,37488:.5,37489:.5,37490:1,37491:1,37492:.5,37496:1,37493:.5,37497:1,37494:.5,37495:.5,37808:1,37840:1,37809:.8,37841:.8,37810:.64,37842:.64,37811:.53375,37843:.53375,37812:.445,37844:.445,37813:.4,37845:.4,37814:.33375,37846:.33375,37815:.25,37847:.25,37816:.32,37848:.32,37817:.26625,37849:.26625,37818:.2,37850:.2,37819:.16,37851:.16,37820:.13375,37852:.13375,37821:.11125,37853:.11125,36492:1,36493:1,36494:1,36495:1},INTERNAL_FORMAT_TO_TEXTURE_FORMATS:{33776:"bc1-rgba-unorm",33777:"bc1-rgba-unorm",33778:"bc2-rgba-unorm",33779:"bc3-rgba-unorm",35916:"bc1-rgba-unorm-srgb",35917:"bc1-rgba-unorm-srgb",35918:"bc2-rgba-unorm-srgb",35919:"bc3-rgba-unorm-srgb",36283:"bc4-r-unorm",36284:"bc4-r-snorm",36285:"bc5-rg-unorm",36286:"bc5-rg-snorm",37488:"eac-r11unorm",37490:"eac-rg11snorm",37492:"etc2-rgb8unorm",37496:"etc2-rgba8unorm",37493:"etc2-rgb8unorm-srgb",37497:"etc2-rgba8unorm-srgb",37494:"etc2-rgb8a1unorm",37495:"etc2-rgb8a1unorm-srgb",37808:"astc-4x4-unorm",37840:"astc-4x4-unorm-srgb",37809:"astc-5x4-unorm",37841:"astc-5x4-unorm-srgb",37810:"astc-5x5-unorm",37842:"astc-5x5-unorm-srgb",37811:"astc-6x5-unorm",37843:"astc-6x5-unorm-srgb",37812:"astc-6x6-unorm",37844:"astc-6x6-unorm-srgb",37813:"astc-8x5-unorm",37845:"astc-8x5-unorm-srgb",37814:"astc-8x6-unorm",37846:"astc-8x6-unorm-srgb",37815:"astc-8x8-unorm",37847:"astc-8x8-unorm-srgb",37816:"astc-10x5-unorm",37848:"astc-10x5-unorm-srgb",37817:"astc-10x6-unorm",37849:"astc-10x6-unorm-srgb",37818:"astc-10x8-unorm",37850:"astc-10x8-unorm-srgb",37819:"astc-10x10-unorm",37851:"astc-10x10-unorm-srgb",37820:"astc-12x10-unorm",37852:"astc-12x10-unorm-srgb",37821:"astc-12x12-unorm",37853:"astc-12x12-unorm-srgb",36492:"bc7-rgba-unorm",36493:"bc7-rgba-unorm-srgb",36494:"bc6h-rgb-float",36495:"bc6h-rgb-ufloat",35907:"rgba8unorm-srgb",36759:"rgba8snorm",36220:"rgba8uint",36238:"rgba8sint",6408:"rgba8unorm"},FIELDS:{FILE_IDENTIFIER:0,ENDIANNESS:12,GL_TYPE:16,GL_TYPE_SIZE:20,GL_FORMAT:24,GL_INTERNAL_FORMAT:28,GL_BASE_INTERNAL_FORMAT:32,PIXEL_WIDTH:36,PIXEL_HEIGHT:40,PIXEL_DEPTH:44,NUMBER_OF_ARRAY_ELEMENTS:48,NUMBER_OF_FACES:52,NUMBER_OF_MIPMAP_LEVELS:56,BYTES_OF_KEY_VALUE_DATA:60},TYPES_TO_BYTES_PER_COMPONENT:{5121:1,5123:2,5124:4,5125:4,5126:4,36193:8},TYPES_TO_BYTES_PER_PIXEL:{32819:2,32820:2,33635:2},ENDIANNESS:67305985};function kg(r,t){const e=new DataView(r);if(!GA(e))throw new Error("Invalid KTX identifier in header");const{littleEndian:i,glType:s,glFormat:n,glInternalFormat:a,pixelWidth:o,pixelHeight:u,numberOfMipmapLevels:l,offset:c}=BA(e),h=it.INTERNAL_FORMAT_TO_TEXTURE_FORMATS[a];if(!h)throw new Error(`Unknown texture format ${a}`);if(!t.includes(h))throw new Error(`Unsupported texture format: ${h}, supportedFormats: ${t}`);const f=OA(s,n,a),p=DA(e,s,f,o,u,c,l,i);return{format:h,width:o,height:u,resource:p,alphaMode:"no-premultiply-alpha"}}function DA(r,t,e,i,s,n,a,o){const u=i+3&-4,l=s+3&-4;let c=i*s;t===0&&(c=u*l);let h=c*e,f=i,p=s,m=u,_=l,g=n;const b=new Array(a);for(let x=0;x<a;x++){const y=r.getUint32(g,o);let T=g+4;b[x]=new Uint8Array(r.buffer,T,h),T+=h,g+=y+4,g=g%4!==0?g+4-g%4:g,f=f>>1||1,p=p>>1||1,m=f+4-1&-4,_=p+4-1&-4,h=m*_*e}return b}function OA(r,t,e){let i=it.INTERNAL_FORMAT_TO_BYTES_PER_PIXEL[e];if(r!==0&&(it.TYPES_TO_BYTES_PER_COMPONENT[r]?i=it.TYPES_TO_BYTES_PER_COMPONENT[r]*it.FORMATS_TO_COMPONENTS[t]:i=it.TYPES_TO_BYTES_PER_PIXEL[r]),i===void 0)throw new Error("Unable to resolve the pixel format stored in the *.ktx file!");return i}function BA(r){const t=r.getUint32(it.FIELDS.ENDIANNESS,!0)===it.ENDIANNESS,e=r.getUint32(it.FIELDS.GL_TYPE,t),i=r.getUint32(it.FIELDS.GL_FORMAT,t),s=r.getUint32(it.FIELDS.GL_INTERNAL_FORMAT,t),n=r.getUint32(it.FIELDS.PIXEL_WIDTH,t),a=r.getUint32(it.FIELDS.PIXEL_HEIGHT,t)||1,o=r.getUint32(it.FIELDS.PIXEL_DEPTH,t)||1,u=r.getUint32(it.FIELDS.NUMBER_OF_ARRAY_ELEMENTS,t)||1,l=r.getUint32(it.FIELDS.NUMBER_OF_FACES,t),c=r.getUint32(it.FIELDS.NUMBER_OF_MIPMAP_LEVELS,t),h=r.getUint32(it.FIELDS.BYTES_OF_KEY_VALUE_DATA,t);if(a===0||o!==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:i,glInternalFormat:s,pixelWidth:n,pixelHeight:a,numberOfMipmapLevels:c,offset:it.FILE_HEADER_SIZE+h}}function GA(r){for(let t=0;t<it.FILE_IDENTIFIER.length;t++)if(r.getUint8(t)!==it.FILE_IDENTIFIER[t])return!1;return!0}const FA={extension:{type:v.LoadParser,priority:Ct.High,name:"loadKTX"},name:"loadKTX",test(r){return kt(r,".ktx")},async load(r,t,e){const i=await xi(),s=await(await fetch(r)).arrayBuffer(),n=kg(s,i),a=new yi(n);return ye(a,e,r)},unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},IA='(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 xr=null;class Lg{constructor(){xr||(xr=URL.createObjectURL(new Blob([IA],{type:"application/javascript"}))),this.worker=new Worker(xr)}}Lg.revokeObjectURL=function(){xr&&(URL.revokeObjectURL(xr),xr=null)};const Qs={jsUrl:"https://files.pixijs.download/transcoders/ktx/libktx.js",wasmUrl:"https://files.pixijs.download/transcoders/ktx/libktx.wasm"};function UA(r){Object.assign(Qs,r)}let Ti;const Ng={};function kA(r){return Ti||(Ti=new Lg().worker,Ti.onmessage=t=>{const{success:e,url:i,textureOptions:s}=t.data;e||console.warn("Failed to load KTX texture",i),Ng[i](s)},Ti.postMessage({type:"init",jsUrl:Qs.jsUrl,wasmUrl:Qs.wasmUrl,supportedTextures:r})),Ti}function $g(r,t){const e=kA(t);return new Promise(i=>{Ng[r]=i,e.postMessage({type:"load",url:r})})}const LA={extension:{type:v.LoadParser,priority:Ct.High,name:"loadKTX2"},name:"loadKTX2",test(r){return kt(r,".ktx2")},async load(r,t,e){const i=await xi(),s=await $g(r,i),n=new yi(s);return ye(n,e,r)},async unload(r){Array.isArray(r)?r.forEach(t=>t.destroy(!0)):r.destroy(!0)}},Eu={rgb8unorm:{convertedFormat:"rgba8unorm",convertFunction:Hg},"rgb8unorm-srgb":{convertedFormat:"rgba8unorm-srgb",convertFunction:Hg}};function NA(r){const t=r.format;if(Eu[t]){const e=Eu[t].convertFunction,i=r.resource;for(let s=0;s<i.length;s++)i[s]=e(i[s]);r.format=Eu[t].convertedFormat}}function Hg(r){const t=r.byteLength/3,e=new Uint32Array(t);for(let i=0;i<t;++i)e[i]=r[i*3]+(r[i*3+1]<<8)+(r[i*3+2]<<16)+4278190080;return new Uint8Array(e.buffer)}function $A(r){const t=[];for(let e=0;e<r.numLevels;e++){const i=r.getImageData(e,0,0),s=new Uint8Array(i.byteLength);s.set(i),t.push(s)}return t}const HA={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 Xg(r){const t=HA[r];if(t)return t;throw new Error(`Unsupported glInternalFormat: ${r}`)}const XA={23:"rgb8unorm",37:"rgba8unorm",43:"rgba8unorm-srgb"};function zg(r){const t=XA[r];if(t)return t;throw new Error(`Unsupported VkFormat: ${r}`)}function zA(r){return r.classId===2?zg(r.vkFormat):Xg(r.glInternalformat)}const jA={"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 VA(r){const t=jA[r];if(t)return t;throw new Error(`Unsupported transcoderFormat: ${r}`)}const Js=["basis","bc7","bc6h","astc","etc2","bc5","bc4","bc3","bc2","bc1","eac"],WA={extension:v.ResolveParser,test:r=>kt(r,[".ktx",".ktx2",".dds"]),parse:r=>{var t,e;let i;const s=r.split(".");if(s.length>2){const n=s[s.length-2];Js.includes(n)&&(i=n)}else i=s[s.length-1];return{resolution:parseFloat((e=(t=fe.RETINA_PREFIX.exec(r))==null?void 0:t[1])!=null?e:"1"),format:i,src:r}}};let tn;const YA={extension:{type:v.DetectionParser,priority:2},test:async()=>!!(await mi()||pi()),add:async r=>{const t=await vu();return tn=qA(t),[...tn,...r]},remove:async r=>tn?r.filter(t=>!(t in tn)):r};function qA(r){const t=["basis"],e={};return r.forEach(i=>{const s=i.split("-")[0];s&&!e[s]&&(e[s]=!0,t.push(s))}),t.sort((i,s)=>{const n=Js.indexOf(i),a=Js.indexOf(s);return n===-1?1:a===-1?-1:n-a}),t}const KA=new ft,wu=class{cull(t,e,i=!0){this._cullRecursive(t,e,i)}_cullRecursive(t,e,i=!0){var s;if(t.cullable&&t.measurable&&t.includeInBuild){const n=(s=t.cullArea)!=null?s:jr(t,i,KA);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,i)}};wu.shared=new wu;let jg=wu;class Vg{static init(){this._renderRef=this.render.bind(this),this.render=()=>{jg.shared.cull(this.stage,this.renderer.screen),this.renderer.render({container:this.stage})}}static destroy(){this.render=this._renderRef}}Vg.extension={priority:10,type:v.Application,name:"culler"};const ZA={extension:{type:v.Environment,name:"webworker",priority:0},test:()=>typeof self!="undefined"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Promise.resolve().then(function(){return aS})}};var QA=Object.defineProperty,en=Object.getOwnPropertySymbols,Wg=Object.prototype.hasOwnProperty,Yg=Object.prototype.propertyIsEnumerable,qg=(r,t,e)=>t in r?QA(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Cu=(r,t)=>{for(var e in t||(t={}))Wg.call(t,e)&&qg(r,e,t[e]);if(en)for(var e of en(t))Yg.call(t,e)&&qg(r,e,t[e]);return r},JA=(r,t)=>{var e={};for(var i in r)Wg.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&en)for(var i of en(r))t.indexOf(i)<0&&Yg.call(r,i)&&(e[i]=r[i]);return e};const Kg=class bc extends Ut{constructor(t){t=Cu(Cu({},bc.defaultOptions),t),super(t),this.enabled=!0,this._state=Ht.for2d(),this.blendMode=t.blendMode,this.padding=t.padding,typeof t.antialias=="boolean"?this.antialias=t.antialias?"on":"off":this.antialias=t.antialias,this.resolution=t.resolution,this.blendRequired=t.blendRequired,this.addResource("uTexture",0,1)}apply(t,e,i,s){t.applyFilter(this,e,i,s)}get blendMode(){return this._state.blendMode}set blendMode(t){this._state.blendMode=t}static from(t){const e=t,{gpu:i,gl:s}=e,n=JA(e,["gpu","gl"]);let a,o;return i&&(a=Mt.from(i)),s&&(o=It.from(s)),new bc(Cu({gpuProgram:a,glProgram:o},n))}};Kg.defaultOptions={blendMode:"normal",resolution:1,padding:0,antialias:"off",blendRequired:!1};let le=Kg;var Zg=`
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}
}
`,Qg=`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();
}
`,Jg=`
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;
}`,tE=Object.defineProperty,t_=Object.getOwnPropertySymbols,eE=Object.prototype.hasOwnProperty,rE=Object.prototype.propertyIsEnumerable,e_=(r,t,e)=>t in r?tE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,r_=(r,t)=>{for(var e in t||(t={}))eE.call(t,e)&&e_(r,e,t[e]);if(t_)for(var e of t_(t))rE.call(t,e)&&e_(r,e,t[e]);return r};class iE extends le{constructor(t){const e=t.gpu,i=i_(r_({source:Jg},e)),s=Mt.from({vertex:{source:i,entryPoint:"mainVertex"},fragment:{source:i,entryPoint:"mainFragment"}}),n=t.gl,a=i_(r_({source:Zg},n)),o=It.from({vertex:Qg,fragment:a}),u=new ot({uBlend:{value:1,type:"f32"}});super({gpuProgram:s,glProgram:o,blendRequired:!0,resources:{blendUniforms:u,uBackTexture:w.EMPTY}})}}function i_(r){const{source:t,functions:e,main:i}=r;return t.replace("{FUNCTIONS}",e).replace("{MAIN}",i)}const sE=`
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;
}
`,nE=`
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 rn=`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();
}
`,s_=`
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;
}`,aE=Object.defineProperty,oE=Object.defineProperties,uE=Object.getOwnPropertyDescriptors,sn=Object.getOwnPropertySymbols,n_=Object.prototype.hasOwnProperty,a_=Object.prototype.propertyIsEnumerable,o_=(r,t,e)=>t in r?aE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Pu=(r,t)=>{for(var e in t||(t={}))n_.call(t,e)&&o_(r,e,t[e]);if(sn)for(var e of sn(t))a_.call(t,e)&&o_(r,e,t[e]);return r},lE=(r,t)=>oE(r,uE(t)),cE=(r,t)=>{var e={};for(var i in r)n_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&sn)for(var i of sn(r))t.indexOf(i)<0&&a_.call(r,i)&&(e[i]=r[i]);return e};const u_=class Ty extends le{constructor(t){t=Pu(Pu({},Ty.defaultOptions),t);const e=Mt.from({vertex:{source:Ru,entryPoint:"mainVertex"},fragment:{source:Ru,entryPoint:"mainFragment"}}),i=It.from({vertex:rn,fragment:s_,name:"alpha-filter"}),s=t,{alpha:n}=s,a=cE(s,["alpha"]),o=new ot({uAlpha:{value:n,type:"f32"}});super(lE(Pu({},a),{gpuProgram:e,glProgram:i,resources:{alphaUniforms:o}}))}get alpha(){return this.resources.alphaUniforms.uniforms.uAlpha}set alpha(t){this.resources.alphaUniforms.uniforms.uAlpha=t}};u_.defaultOptions={alpha:1};let hE=u_;const Mu={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]},dE=["in vec2 vBlurTexCoords[%size%];","uniform sampler2D uTexture;","out vec4 finalColor;","void main(void)","{"," finalColor = vec4(0.0);"," %blur%","}"].join(`
`);function l_(r){const t=Mu[r],e=t.length;let i=dE,s="";const n="finalColor += texture(uTexture, vBlurTexCoords[%index%]) * %value%;";let a;for(let o=0;o<r;o++){let u=n.replace("%index%",o.toString());a=o,o>=e&&(a=r-o-1),u=u.replace("%value%",t[a].toString()),s+=u,s+=`
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i}const fE=`
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 c_(r,t){const e=Math.ceil(r/2);let i=fE,s="",n;t?n="vBlurTexCoords[%index%] = textureCoord + vec2(%sampleIndex% * pixelStrength, 0.0);":n="vBlurTexCoords[%index%] = textureCoord + vec2(0.0, %sampleIndex% * pixelStrength);";for(let a=0;a<r;a++){let o=n.replace("%index%",a.toString());o=o.replace("%sampleIndex%",`${a-(e-1)}.0`),s+=o,s+=`
`}return i=i.replace("%blur%",s),i=i.replace("%size%",r.toString()),i=i.replace("%dimension%",t?"z":"w"),i}function h_(r,t){const e=c_(t,r),i=l_(t);return It.from({vertex:e,fragment:i,name:`blur-${r?"horizontal":"vertical"}-pass-filter`})}var d_=`
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 f_(r,t){const e=Mu[t],i=e.length,s=[],n=[],a=[];for(let h=0;h<t;h++){s[h]=`@location(${h}) offset${h}: vec2<f32>,`,r?n[h]=`filteredCord + vec2(${h-i+1} * pixelStrength, 0.0),`:n[h]=`filteredCord + vec2(0.0, ${h-i+1} * pixelStrength),`;const f=h<i?h:t-h-1,p=e[f].toString();a[h]=`finalColor += textureSample(uTexture, uSampler, offset${h}) * ${p};`}const o=s.join(`
`),u=n.join(`
`),l=a.join(`
`),c=d_.replace("%blur-struct%",o).replace("%blur-vertex-out%",u).replace("%blur-fragment-in%",o).replace("%blur-sampling%",l).replace("%dimension%",r?"z":"w");return Mt.from({vertex:{source:c,entryPoint:"mainVertex"},fragment:{source:c,entryPoint:"mainFragment"}})}var pE=Object.defineProperty,p_=Object.getOwnPropertySymbols,mE=Object.prototype.hasOwnProperty,gE=Object.prototype.propertyIsEnumerable,m_=(r,t,e)=>t in r?pE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Du=(r,t)=>{for(var e in t||(t={}))mE.call(t,e)&&m_(r,e,t[e]);if(p_)for(var e of p_(t))gE.call(t,e)&&m_(r,e,t[e]);return r};const g_=class Sy extends le{constructor(t){t=Du(Du({},Sy.defaultOptions),t);const e=h_(t.horizontal,t.kernelSize),i=f_(t.horizontal,t.kernelSize);super(Du({glProgram:e,gpuProgram:i,resources:{blurUniforms:{uStrength:{value:0,type:"f32"}}}},t)),this.horizontal=t.horizontal,this._quality=0,this.quality=t.quality,this.blur=t.strength,this._uniforms=this.resources.blurUniforms.uniforms}apply(t,e,i,s){if(this._uniforms.uStrength=this.strength/this.passes,this.passes===1)t.applyFilter(this,e,i,s);else{const n=pt.getSameSizeTexture(e);let a=e,o=n;this._state.blend=!1;const u=t.renderer.type===St.WEBGPU;for(let l=0;l<this.passes-1;l++){t.applyFilter(this,a,o,l===0?!0:u);const c=o;o=a,a=c}this._state.blend=!0,t.applyFilter(this,a,i,s),pt.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}};g_.defaultOptions={strength:8,quality:4,kernelSize:5};let nn=g_;var _E=Object.defineProperty,bE=Object.defineProperties,yE=Object.getOwnPropertyDescriptors,an=Object.getOwnPropertySymbols,__=Object.prototype.hasOwnProperty,b_=Object.prototype.propertyIsEnumerable,y_=(r,t,e)=>t in r?_E(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Si=(r,t)=>{for(var e in t||(t={}))__.call(t,e)&&y_(r,e,t[e]);if(an)for(var e of an(t))b_.call(t,e)&&y_(r,e,t[e]);return r},xE=(r,t)=>bE(r,yE(t)),vE=(r,t)=>{var e={};for(var i in r)__.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&an)for(var i of an(r))t.indexOf(i)<0&&b_.call(r,i)&&(e[i]=r[i]);return e};class x_ extends le{constructor(...t){var e;let i=(e=t[0])!=null?e:{};typeof i=="number"&&(i={strength:i},t[1]!==void 0&&(i.quality=t[1]),t[2]!==void 0&&(i.resolution=t[2]||"inherit"),t[3]!==void 0&&(i.kernelSize=t[3])),i=Si(Si({},nn.defaultOptions),i);const s=i,{strength:n,strengthX:a,strengthY:o,quality:u}=s,l=vE(s,["strength","strengthX","strengthY","quality"]);super(xE(Si({},l),{compatibleRenderers:St.BOTH,resources:{}})),this._repeatEdgePixels=!1,this.blurXFilter=new nn(Si({horizontal:!0},i)),this.blurYFilter=new nn(Si({horizontal:!1},i)),this.quality=u,this.strengthX=a!=null?a:n,this.strengthY=o!=null?o:n,this.repeatEdgePixels=!1}apply(t,e,i,s){const n=Math.abs(this.blurXFilter.strength),a=Math.abs(this.blurYFilter.strength);if(n&&a){const o=pt.getSameSizeTexture(e);this.blurXFilter.blendMode="normal",this.blurXFilter.apply(t,e,o,!0),this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,o,i,s),pt.returnTexture(o)}else a?(this.blurYFilter.blendMode=this.blendMode,this.blurYFilter.apply(t,e,i,s)):(this.blurXFilter.blendMode=this.blendMode,this.blurXFilter.apply(t,e,i,s))}updatePadding(){this._repeatEdgePixels?this.padding=0:this.padding=Math.max(Math.abs(this.blurXFilter.blur),Math.abs(this.blurYFilter.blur))*2}get strength(){if(this.strengthX!==this.strengthY)throw new Error("BlurFilter's strengthX and strengthY are different");return this.strengthX}set strength(t){this.blurXFilter.blur=this.blurYFilter.blur=t,this.updatePadding()}get quality(){return this.blurXFilter.quality}set quality(t){this.blurXFilter.quality=this.blurYFilter.quality=t}get strengthX(){return this.blurXFilter.blur}set strengthX(t){this.blurXFilter.blur=t,this.updatePadding()}get strengthY(){return this.blurYFilter.blur}set strengthY(t){this.blurYFilter.blur=t,this.updatePadding()}get blur(){return this.strength}set blur(t){this.strength=t}get blurX(){return this.strengthX}set blurX(t){this.strengthX=t}get blurY(){return this.strengthY}set blurY(t){this.strengthY=t}get repeatEdgePixels(){return this._repeatEdgePixels}set repeatEdgePixels(t){this._repeatEdgePixels=t,this.updatePadding()}}x_.defaultOptions={strength:8,quality:4,kernelSize:5};var v_=`
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);
}`,TE=Object.defineProperty,SE=Object.defineProperties,AE=Object.getOwnPropertyDescriptors,T_=Object.getOwnPropertySymbols,EE=Object.prototype.hasOwnProperty,wE=Object.prototype.propertyIsEnumerable,S_=(r,t,e)=>t in r?TE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,CE=(r,t)=>{for(var e in t||(t={}))EE.call(t,e)&&S_(r,e,t[e]);if(T_)for(var e of T_(t))wE.call(t,e)&&S_(r,e,t[e]);return r},RE=(r,t)=>SE(r,AE(t));class PE extends le{constructor(t={}){const e=new ot({uColorMatrix:{value:[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0],type:"f32",size:20},uAlpha:{value:1,type:"f32"}}),i=Mt.from({vertex:{source:Ou,entryPoint:"mainVertex"},fragment:{source:Ou,entryPoint:"mainFragment"}}),s=It.from({vertex:rn,fragment:v_,name:"color-matrix-filter"});super(RE(CE({},t),{gpuProgram:i,glProgram:s,resources:{colorMatrixUniforms:e}})),this.alpha=1}_loadMatrix(t,e=!1){let i=t;e&&(this._multiply(i,this.matrix,t),i=this._colorMatrix(i)),this.resources.colorMatrixUniforms.uniforms.uColorMatrix=i,this.resources.colorMatrixUniforms.update()}_multiply(t,e,i){return t[0]=e[0]*i[0]+e[1]*i[5]+e[2]*i[10]+e[3]*i[15],t[1]=e[0]*i[1]+e[1]*i[6]+e[2]*i[11]+e[3]*i[16],t[2]=e[0]*i[2]+e[1]*i[7]+e[2]*i[12]+e[3]*i[17],t[3]=e[0]*i[3]+e[1]*i[8]+e[2]*i[13]+e[3]*i[18],t[4]=e[0]*i[4]+e[1]*i[9]+e[2]*i[14]+e[3]*i[19]+e[4],t[5]=e[5]*i[0]+e[6]*i[5]+e[7]*i[10]+e[8]*i[15],t[6]=e[5]*i[1]+e[6]*i[6]+e[7]*i[11]+e[8]*i[16],t[7]=e[5]*i[2]+e[6]*i[7]+e[7]*i[12]+e[8]*i[17],t[8]=e[5]*i[3]+e[6]*i[8]+e[7]*i[13]+e[8]*i[18],t[9]=e[5]*i[4]+e[6]*i[9]+e[7]*i[14]+e[8]*i[19]+e[9],t[10]=e[10]*i[0]+e[11]*i[5]+e[12]*i[10]+e[13]*i[15],t[11]=e[10]*i[1]+e[11]*i[6]+e[12]*i[11]+e[13]*i[16],t[12]=e[10]*i[2]+e[11]*i[7]+e[12]*i[12]+e[13]*i[17],t[13]=e[10]*i[3]+e[11]*i[8]+e[12]*i[13]+e[13]*i[18],t[14]=e[10]*i[4]+e[11]*i[9]+e[12]*i[14]+e[13]*i[19]+e[14],t[15]=e[15]*i[0]+e[16]*i[5]+e[17]*i[10]+e[18]*i[15],t[16]=e[15]*i[1]+e[16]*i[6]+e[17]*i[11]+e[18]*i[16],t[17]=e[15]*i[2]+e[16]*i[7]+e[17]*i[12]+e[18]*i[17],t[18]=e[15]*i[3]+e[16]*i[8]+e[17]*i[13]+e[18]*i[18],t[19]=e[15]*i[4]+e[16]*i[9]+e[17]*i[14]+e[18]*i[19]+e[19],t}_colorMatrix(t){const e=new Float32Array(t);return e[4]/=255,e[9]/=255,e[14]/=255,e[19]/=255,e}brightness(t,e){const i=[t,0,0,0,0,0,t,0,0,0,0,0,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}tint(t,e){const[i,s,n]=V.shared.setValue(t).toArray(),a=[i,0,0,0,0,0,s,0,0,0,0,0,n,0,0,0,0,0,1,0];this._loadMatrix(a,e)}greyscale(t,e){const i=[t,t,t,0,0,t,t,t,0,0,t,t,t,0,0,0,0,0,1,0];this._loadMatrix(i,e)}grayscale(t,e){this.greyscale(t,e)}blackAndWhite(t){const e=[.3,.6,.1,0,0,.3,.6,.1,0,0,.3,.6,.1,0,0,0,0,0,1,0];this._loadMatrix(e,t)}hue(t,e){t=(t||0)/180*Math.PI;const i=Math.cos(t),s=Math.sin(t),n=Math.sqrt,a=1/3,o=n(a),u=i+(1-i)*a,l=a*(1-i)-o*s,c=a*(1-i)+o*s,h=a*(1-i)+o*s,f=i+a*(1-i),p=a*(1-i)-o*s,m=a*(1-i)-o*s,_=a*(1-i)+o*s,g=i+a*(1-i),b=[u,l,c,0,0,h,f,p,0,0,m,_,g,0,0,0,0,0,1,0];this._loadMatrix(b,e)}contrast(t,e){const i=(t||0)+1,s=-.5*(i-1),n=[i,0,0,0,s,0,i,0,0,s,0,0,i,0,s,0,0,0,1,0];this._loadMatrix(n,e)}saturate(t=0,e){const i=t*2/3+1,s=(i-1)*-.5,n=[i,s,s,0,0,s,i,s,0,0,s,s,i,0,0,0,0,0,1,0];this._loadMatrix(n,e)}desaturate(){this.saturate(-1)}negative(t){const e=[-1,0,0,1,0,0,-1,0,1,0,0,0,-1,1,0,0,0,0,1,0];this._loadMatrix(e,t)}sepia(t){const e=[.393,.7689999,.18899999,0,0,.349,.6859999,.16799999,0,0,.272,.5339999,.13099999,0,0,0,0,0,1,0];this._loadMatrix(e,t)}technicolor(t){const e=[1.9125277891456083,-.8545344976951645,-.09155508482755585,0,11.793603434377337,-.3087833385928097,1.7658908555458428,-.10601743074722245,0,-70.35205161461398,-.231103377548616,-.7501899197440212,1.847597816108189,0,30.950940869491138,0,0,0,1,0];this._loadMatrix(e,t)}polaroid(t){const e=[1.438,-.062,-.062,0,0,-.122,1.378,-.122,0,0,-.016,-.016,1.483,0,0,0,0,0,1,0];this._loadMatrix(e,t)}toBGR(t){const e=[0,0,1,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,1,0];this._loadMatrix(e,t)}kodachrome(t){const e=[1.1285582396593525,-.3967382283601348,-.03992559172921793,0,63.72958762196502,-.16404339962244616,1.0835251566291304,-.05498805115633132,0,24.732407896706203,-.16786010706155763,-.5603416277695248,1.6014850761964943,0,35.62982807460946,0,0,0,1,0];this._loadMatrix(e,t)}browni(t){const e=[.5997023498159715,.34553243048391263,-.2708298674538042,0,47.43192855600873,-.037703249837783157,.8609577587992641,.15059552388459913,0,-36.96841498319127,.24113635128153335,-.07441037908422492,.44972182064877153,0,-7.562075277591283,0,0,0,1,0];this._loadMatrix(e,t)}vintage(t){const e=[.6279345635605994,.3202183420819367,-.03965408211312453,0,9.651285835294123,.02578397704808868,.6441188644374771,.03259127616149294,0,7.462829176470591,.0466055556782719,-.0851232987247891,.5241648018700465,0,5.159190588235296,0,0,0,1,0];this._loadMatrix(e,t)}colorTone(t,e,i,s,n){t=t||.2,e=e||.15,i=i||16770432,s=s||3375104;const a=V.shared,[o,u,l]=a.setValue(i).toArray(),[c,h,f]=a.setValue(s).toArray(),p=[.3,.59,.11,0,0,o,u,l,t,0,c,h,f,e,0,o-c,u-h,l-f,0,0];this._loadMatrix(p,n)}night(t,e){t=t||.1;const i=[t*-2,-t,0,0,0,-t,0,t,0,0,0,t,t*2,0,0,0,0,0,1,0];this._loadMatrix(i,e)}predator(t,e){const i=[11.224130630493164*t,-4.794486999511719*t,-2.8746118545532227*t,0*t,.40342438220977783*t,-3.6330697536468506*t,9.193157196044922*t,-2.951810836791992*t,0*t,-1.316135048866272*t,-3.2184197902679443*t,-4.2375030517578125*t,7.476448059082031*t,0*t,.8044459223747253*t,0,0,0,1,0];this._loadMatrix(i,e)}lsd(t){const e=[2,-.4,.5,0,0,-.5,2,-.4,0,0,-.4,-.5,3,0,0,0,0,0,1,0];this._loadMatrix(e,t)}reset(){const t=[1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,1,0];this._loadMatrix(t,!1)}get matrix(){return this.resources.colorMatrixUniforms.uniforms.uColorMatrix}set matrix(t){this.resources.colorMatrixUniforms.uniforms.uColorMatrix=t}get alpha(){return this.resources.colorMatrixUniforms.uniforms.uAlpha}set alpha(t){this.resources.colorMatrixUniforms.uniforms.uAlpha=t}}var A_=`
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));
}
`,E_=`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));
}`,ME=Object.defineProperty,DE=Object.defineProperties,OE=Object.getOwnPropertyDescriptors,on=Object.getOwnPropertySymbols,w_=Object.prototype.hasOwnProperty,C_=Object.prototype.propertyIsEnumerable,R_=(r,t,e)=>t in r?ME(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,BE=(r,t)=>{for(var e in t||(t={}))w_.call(t,e)&&R_(r,e,t[e]);if(on)for(var e of on(t))C_.call(t,e)&&R_(r,e,t[e]);return r},GE=(r,t)=>DE(r,OE(t)),FE=(r,t)=>{var e={};for(var i in r)w_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&on)for(var i of on(r))t.indexOf(i)<0&&C_.call(r,i)&&(e[i]=r[i]);return e};class IE extends le{constructor(...t){let e=t[0];e instanceof $t&&(e={sprite:e,scale:t[1]});const i=e,{sprite:s,scale:n}=i,a=FE(i,["sprite","scale"]);let o=n!=null?n:20;typeof o=="number"&&(o=new nt(o,o));const u=new ot({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uScale:{value:o,type:"vec2<f32>"},uRotation:{value:new Float32Array([0,0,0,0]),type:"mat2x2<f32>"}}),l=It.from({vertex:E_,fragment:A_,name:"displacement-filter"}),c=Mt.from({vertex:{source:Bu,entryPoint:"mainVertex"},fragment:{source:Bu,entryPoint:"mainFragment"}}),h=s.texture.source;super(GE(BE({},a),{gpuProgram:c,glProgram:l,resources:{filterUniforms:u,uMapTexture:h,uMapSampler:h.style}})),this._sprite=e.sprite,this._sprite.renderable=!1}apply(t,e,i,s){const n=this.resources.filterUniforms.uniforms;t.calculateSpriteMatrix(n.uFilterMatrix,this._sprite);const a=this._sprite.worldTransform,o=Math.sqrt(a.a*a.a+a.b*a.b),u=Math.sqrt(a.c*a.c+a.d*a.d);o!==0&&u!==0&&(n.uRotation[0]=a.a/o,n.uRotation[1]=a.b/o,n.uRotation[2]=a.c/u,n.uRotation[3]=a.d/u),this.resources.uMapTexture=this._sprite.texture.source,t.applyFilter(this,e,i,s)}get scale(){return this.resources.filterUniforms.uniforms.uScale}}var P_=`
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;
}`,UE=Object.defineProperty,kE=Object.defineProperties,LE=Object.getOwnPropertyDescriptors,un=Object.getOwnPropertySymbols,M_=Object.prototype.hasOwnProperty,D_=Object.prototype.propertyIsEnumerable,O_=(r,t,e)=>t in r?UE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Fu=(r,t)=>{for(var e in t||(t={}))M_.call(t,e)&&O_(r,e,t[e]);if(un)for(var e of un(t))D_.call(t,e)&&O_(r,e,t[e]);return r},NE=(r,t)=>kE(r,LE(t)),$E=(r,t)=>{var e={};for(var i in r)M_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&un)for(var i of un(r))t.indexOf(i)<0&&D_.call(r,i)&&(e[i]=r[i]);return e};const B_=class Ay extends le{constructor(t={}){t=Fu(Fu({},Ay.defaultOptions),t);const e=Mt.from({vertex:{source:Gu,entryPoint:"mainVertex"},fragment:{source:Gu,entryPoint:"mainFragment"}}),i=It.from({vertex:rn,fragment:P_,name:"noise-filter"}),s=t,{noise:n,seed:a}=s,o=$E(s,["noise","seed"]);super(NE(Fu({},o),{gpuProgram:e,glProgram:i,resources:{noiseUniforms:new ot({uNoise:{value:1,type:"f32"},uSeed:{value:1,type:"f32"}})}})),this.noise=n,this.seed=a!=null?a: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}};B_.defaultOptions={noise:.5};let HE=B_;var G_=`in vec2 vMaskCoord;
in vec2 vTextureCoord;
uniform sampler2D uTexture;
uniform sampler2D uMaskTexture;
uniform float uAlpha;
uniform vec4 uMaskClamp;
out vec4 finalColor;
void main(void)
{
float clip = step(3.5,
step(uMaskClamp.x, vMaskCoord.x) +
step(uMaskClamp.y, vMaskCoord.y) +
step(vMaskCoord.x, uMaskClamp.z) +
step(vMaskCoord.y, uMaskClamp.w));
// TODO look into why this is needed
float npmAlpha = uAlpha;
vec4 original = texture(uTexture, vTextureCoord);
vec4 masky = texture(uMaskTexture, vMaskCoord);
float alphaMul = 1.0 - npmAlpha * (1.0 - masky.a);
original *= (alphaMul * masky.r * uAlpha * clip);
finalColor = original;
}
`,F_=`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);
}
`,Iu=`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;
}`,XE=Object.defineProperty,zE=Object.defineProperties,jE=Object.getOwnPropertyDescriptors,ln=Object.getOwnPropertySymbols,I_=Object.prototype.hasOwnProperty,U_=Object.prototype.propertyIsEnumerable,k_=(r,t,e)=>t in r?XE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,VE=(r,t)=>{for(var e in t||(t={}))I_.call(t,e)&&k_(r,e,t[e]);if(ln)for(var e of ln(t))U_.call(t,e)&&k_(r,e,t[e]);return r},WE=(r,t)=>zE(r,jE(t)),YE=(r,t)=>{var e={};for(var i in r)I_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&ln)for(var i of ln(r))t.indexOf(i)<0&&U_.call(r,i)&&(e[i]=r[i]);return e};class L_ extends le{constructor(t){const e=t,{sprite:i}=e,s=YE(e,["sprite"]),n=new ha(i.texture),a=new ot({uFilterMatrix:{value:new G,type:"mat3x3<f32>"},uMaskClamp:{value:n.uClampFrame,type:"vec4<f32>"},uAlpha:{value:1,type:"f32"}}),o=Mt.from({vertex:{source:Iu,entryPoint:"mainVertex"},fragment:{source:Iu,entryPoint:"mainFragment"}}),u=It.from({vertex:F_,fragment:G_,name:"mask-filter"});super(WE(VE({},s),{gpuProgram:o,glProgram:u,resources:{filterUniforms:a,uMaskTexture:i.texture.source}})),this.sprite=i,this._textureMatrix=n}apply(t,e,i,s){this._textureMatrix.texture=this.sprite.texture,t.calculateSpriteMatrix(this.resources.filterUniforms.uniforms.uFilterMatrix,this.sprite).prepend(this._textureMatrix.mapCoord),this.resources.uMaskTexture=this.sprite.texture.source,t.applyFilter(this,e,i,s)}}var qE=`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,i,s,n,a,o){const u=a-e,l=o-i,c=s-e,h=n-i,f=r-e,p=t-i,m=u*u+l*l,_=u*c+l*h,g=u*f+l*p,b=c*c+h*h,x=c*f+h*p,y=1/(m*b-_*_),T=(b*g-_*x)*y,A=(m*x-_*g)*y;return T>=0&&A>=0&&T+A<1}class ku{constructor(t=0,e=0,i=0,s=0,n=0,a=0){this.type="triangle",this.x=t,this.y=e,this.x2=i,this.y2=s,this.x3=n,this.y3=a}contains(t,e){const i=(this.x-this.x3)*(e-this.y3)-(this.y-this.y3)*(t-this.x3),s=(this.x2-this.x)*(e-this.y)-(this.y2-this.y)*(t-this.x);if(i<0!=s<0&&i!==0&&s!==0)return!1;const n=(this.x3-this.x2)*(e-this.y2)-(this.y3-this.y2)*(t-this.x2);return n===0||n<0==i+s<=0}strokeContains(t,e,i){const s=i/2,n=s*s,{x:a,x2:o,x3:u,y:l,y2:c,y3:h}=this;return si(t,e,a,l,o,h)<=n||si(t,e,o,c,u,h)<=n||si(t,e,u,h,a,l)<=n}clone(){return new ku(this.x,this.y,this.x2,this.y2,this.x3,this.y3)}copyFrom(t){return this.x=t.x,this.y=t.y,this.x2=t.x2,this.y2=t.y2,this.x3=t.x3,this.y3=t.y3,this}copyTo(t){return t.copyFrom(this),t}getBounds(t){t=t||new W;const e=Math.min(this.x,this.x2,this.x3),i=Math.max(this.x,this.x2,this.x3),s=Math.min(this.y,this.y2,this.y3),n=Math.max(this.y,this.y2,this.y3);return t.x=e,t.y=s,t.width=i-e,t.height=n-s,t}}const N_=class Ey{constructor(t){this._tick=()=>{this.timeout=setTimeout(this._processQueue,0)},this._processQueue=()=>{const{queue:e}=this;let i=0;for(;e.length&&i<Ey.uploadsPerFrame;){const s=e.shift();this.uploadQueueItem(s),i++}e.length?gt.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 i of e)i instanceof rt?this._addContainer(i):this.resolveQueueItem(i,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(),gt.system.addOnce(this._tick,this,de.UTILITY)):e()})}dedupeQueue(){const t=Object.create(null);let e=0;for(let i=0;i<this.queue.length;i++){const s=this.queue[i];t[s.uid]||(t[s.uid]=!0,this.queue[e++]=s)}this.queue.length=e}_resolve(){const{resolves:t}=this,e=t.slice(0);t.length=0;for(const i of e)i()}};N_.uploadsPerFrame=4;let $_=N_;var KE=Object.defineProperty,cn=Object.getOwnPropertySymbols,H_=Object.prototype.hasOwnProperty,X_=Object.prototype.propertyIsEnumerable,z_=(r,t,e)=>t in r?KE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,ZE=(r,t)=>{for(var e in t||(t={}))H_.call(t,e)&&z_(r,e,t[e]);if(cn)for(var e of cn(t))X_.call(t,e)&&z_(r,e,t[e]);return r},QE=(r,t)=>{var e={};for(var i in r)H_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&cn)for(var i of cn(r))t.indexOf(i)<0&&X_.call(r,i)&&(e[i]=r[i]);return e};class vr extends Me{constructor(...t){var e;let i=t[0];i instanceof rr&&(i={geometry:i,shader:t[1]},t[3]&&(i.geometry.topology=t[3]));const s=i,{geometry:n,shader:a,texture:o,roundPixels:u,state:l}=s,c=QE(s,["geometry","shader","texture","roundPixels","state"]);super(ZE({label:"Mesh"},c)),this.renderPipeId="mesh",this._shader=null,this.allowChildren=!1,this.shader=a!=null?a:null,this.texture=(e=o!=null?o:a==null?void 0:a.texture)!=null?e:w.WHITE,this.state=l!=null?l:Ht.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=w.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 _e?this._geometry.batchMode==="auto"?this._geometry.positions.length/2<=100:this._geometry.batchMode==="batch":!1}get bounds(){return this._geometry.bounds}addBounds(t){t.addBounds(this.geometry.bounds)}containsPoint(t){const{x:e,y:i}=t;if(!this.bounds.containsPoint(e,i))return!1;const s=this.geometry.getBuffer("aPosition").data,n=this.geometry.topology==="triangle-strip"?3:1;if(this.geometry.getIndex()){const a=this.geometry.getIndex().data,o=a.length;for(let u=0;u+2<o;u+=n){const l=a[u]*2,c=a[u+1]*2,h=a[u+2]*2;if(Uu(e,i,s[l],s[l+1],s[c],s[c+1],s[h],s[h+1]))return!0}}else{const a=s.length/2;for(let o=0;o+2<a;o+=n){const u=o*2,l=(o+1)*2,c=(o+2)*2;if(Uu(e,i,s[u],s[u+1],s[l],s[l+1],s[c],s[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 i=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(i)}(e=this._geometry)==null||e.off("update",this.onViewUpdate,this),this._texture=null,this._geometry=null,this._shader=null}}var JE=Object.defineProperty,t3=Object.defineProperties,e3=Object.getOwnPropertyDescriptors,hn=Object.getOwnPropertySymbols,j_=Object.prototype.hasOwnProperty,V_=Object.prototype.propertyIsEnumerable,W_=(r,t,e)=>t in r?JE(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,r3=(r,t)=>{for(var e in t||(t={}))j_.call(t,e)&&W_(r,e,t[e]);if(hn)for(var e of hn(t))V_.call(t,e)&&W_(r,e,t[e]);return r},i3=(r,t)=>t3(r,e3(t)),s3=(r,t)=>{var e={};for(var i in r)j_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&hn)for(var i of hn(r))t.indexOf(i)<0&&V_.call(r,i)&&(e[i]=r[i]);return e};class Ai extends $t{constructor(...t){let e=t[0];Array.isArray(t[0])&&(e={textures:t[0],autoUpdate:t[1]});const i=e,{textures:s,autoUpdate:n}=i,a=s3(i,["textures","autoUpdate"]),[o]=s;super(i3(r3({},a),{texture:o instanceof w?o:o.texture})),this._textures=null,this._durations=null,this._autoUpdate=n!=null?n:!0,this._isConnectedToTicker=!1,this.animationSpeed=1,this.loop=!0,this.updateAnchor=!1,this.onComplete=null,this.onFrameChange=null,this.onLoop=null,this._currentTime=0,this._playing=!1,this._previousFrame=null,this.textures=s}stop(){this._playing&&(this._playing=!1,this._autoUpdate&&this._isConnectedToTicker&&(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1))}play(){this._playing||(this._playing=!0,this._autoUpdate&&!this._isConnectedToTicker&&(gt.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,i=this.animationSpeed*e,s=this.currentFrame;if(this._durations!==null){let n=this._currentTime%1*this._durations[this.currentFrame];for(n+=i/60*1e3;n<0;)this._currentTime--,n+=this._durations[this.currentFrame];const a=Math.sign(this.animationSpeed*e);for(this._currentTime=Math.floor(this._currentTime);n>=this._durations[this.currentFrame];)n-=this._durations[this.currentFrame]*a,this._currentTime+=a;this._currentTime+=n/this._durations[this.currentFrame]}else this._currentTime+=i;this._currentTime<0&&!this.loop?(this.gotoAndStop(0),this.onComplete&&this.onComplete()):this._currentTime>=this._textures.length&&!this.loop?(this.gotoAndStop(this._textures.length-1),this.onComplete&&this.onComplete()):s!==this.currentFrame&&(this.loop&&this.onLoop&&(this.animationSpeed>0&&this.currentFrame<s||this.animationSpeed<0&&this.currentFrame>s)&&this.onLoop(),this._updateTexture())}_updateTexture(){const t=this.currentFrame;this._previousFrame!==t&&(this._previousFrame=t,this.texture=this._textures[t],this.updateAnchor&&this.anchor.copyFrom(this.texture.defaultAnchor),this.onFrameChange&&this.onFrameChange(this.currentFrame))}destroy(){this.stop(),super.destroy(),this.onComplete=null,this.onFrameChange=null,this.onLoop=null}static fromFrames(t){const e=[];for(let i=0;i<t.length;++i)e.push(w.from(t[i]));return new Ai(e)}static fromImages(t){const e=[];for(let i=0;i<t.length;++i)e.push(w.from(t[i]));return new Ai(e)}get totalFrames(){return this._textures.length}get textures(){return this._textures}set textures(t){if(t[0]instanceof w)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?(gt.shared.remove(this.update,this),this._isConnectedToTicker=!1):this._autoUpdate&&!this._isConnectedToTicker&&this._playing&&(gt.shared.add(this.update,this),this._isConnectedToTicker=!0))}}class Y_{constructor({matrix:t,observer:e}={}){this.dirty=!0,this._matrix=t!=null?t:new G,this.observer=e,this.position=new at(this,0,0),this.scale=new at(this,1,1),this.pivot=new at(this,0,0),this.skew=new at(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 n3=Object.defineProperty,dn=Object.getOwnPropertySymbols,q_=Object.prototype.hasOwnProperty,K_=Object.prototype.propertyIsEnumerable,Z_=(r,t,e)=>t in r?n3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Ei=(r,t)=>{for(var e in t||(t={}))q_.call(t,e)&&Z_(r,e,t[e]);if(dn)for(var e of dn(t))K_.call(t,e)&&Z_(r,e,t[e]);return r},a3=(r,t)=>{var e={};for(var i in r)q_.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&dn)for(var i of dn(r))t.indexOf(i)<0&&K_.call(r,i)&&(e[i]=r[i]);return e};const Q_=class Nn extends Me{constructor(...t){let e=t[0]||{};e instanceof w&&(e={texture:e}),t.length>1&&(e.width=t[1],e.height=t[2]),e=Ei(Ei({},Nn.defaultOptions),e);const i=e!=null?e:{},{texture:s,anchor:n,tilePosition:a,tileScale:o,tileRotation:u,width:l,height:c,applyAnchorToTexture:h,roundPixels:f}=i,p=a3(i,["texture","anchor","tilePosition","tileScale","tileRotation","width","height","applyAnchorToTexture","roundPixels"]);super(Ei({label:"TilingSprite"},p)),this.renderPipeId="tilingSprite",this.batched=!0,this.allowChildren=!1,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),this._applyAnchorToTexture=h,this.texture=s,this._width=l!=null?l:s.width,this._height=c!=null?c:s.height,this._tileTransform=new Y_({observer:{_onUpdate:()=>this.onViewUpdate()}}),n&&(this.anchor=n),this.tilePosition=a,this.tileScale=o,this.tileRotation=u,this.roundPixels=f!=null?f:!1}static from(t,e={}){return typeof t=="string"?new Nn(Ei({texture:K.get(t)},e)):new Nn(Ei({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=w.EMPTY);const e=this._texture;e!==t&&(e&&e.dynamic&&e.off("update",this.onViewUpdate,this),t.dynamic&&t.on("update",this.onViewUpdate,this),this._texture=t,this.onViewUpdate())}get texture(){return this._texture}set width(t){this._width=t,this.onViewUpdate()}get width(){return this._width}set height(t){this._height=t,this.onViewUpdate()}get height(){return this._height}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this._width=t,this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}_updateBounds(){const t=this._bounds,e=this._anchor,i=this._width,s=this._height;t.maxX=-e._x*i,t.minX=t.maxX+i,t.maxY=-e._y*s,t.minY=t.maxY+s}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this._width,i=this._height,s=-e*this._anchor._x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this._anchor._y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._boundsDirty=!0,this._didTilingSpriteUpdate=!0,this._didViewChangeTick++,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}destroy(t=!1){if(super.destroy(t),this._anchor=null,this._tileTransform=null,this._bounds=null,typeof t=="boolean"?t:t==null?void 0:t.texture){const e=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(e)}this._texture=null}};Q_.defaultOptions={texture:w.EMPTY,anchor:{x:0,y:0},tilePosition:{x:0,y:0},tileScale:{x:1,y:1},tileRotation:0,applyAnchorToTexture:!1};let J_=Q_;var o3=Object.defineProperty,fn=Object.getOwnPropertySymbols,t0=Object.prototype.hasOwnProperty,e0=Object.prototype.propertyIsEnumerable,r0=(r,t,e)=>t in r?o3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,u3=(r,t)=>{for(var e in t||(t={}))t0.call(t,e)&&r0(r,e,t[e]);if(fn)for(var e of fn(t))e0.call(t,e)&&r0(r,e,t[e]);return r},l3=(r,t)=>{var e={};for(var i in r)t0.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&fn)for(var i of fn(r))t.indexOf(i)<0&&e0.call(r,i)&&(e[i]=r[i]);return e};class pn extends Me{constructor(t,e){const i=t,{text:s,resolution:n,style:a,anchor:o,width:u,height:l,roundPixels:c}=i,h=l3(i,["text","resolution","style","anchor","width","height","roundPixels"]);super(u3({},h)),this.batched=!0,this._resolution=null,this._autoResolution=!0,this._didTextUpdate=!0,this._styleClass=e,this.text=s!=null?s:"",this.style=a,this.resolution=n!=null?n:null,this.allowChildren=!1,this._anchor=new at({_onUpdate:()=>{this.onViewUpdate()}}),o&&(this.anchor=o),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 i;typeof t=="object"?(e=(i=t.height)!=null?i:t.width,t=t.width):e!=null||(e=t),t!==void 0&&this._setWidth(t,this.bounds.width),e!==void 0&&this._setHeight(e,this.bounds.height)}addBounds(t){const e=this.bounds;t.addFrame(e.minX,e.minY,e.maxX,e.maxY)}containsPoint(t){const e=this.bounds.width,i=this.bounds.height,s=-e*this.anchor.x;let n=0;return t.x>=s&&t.x<=s+e&&(n=-i*this.anchor.y,t.y>=n&&t.y<=n+i)}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0,this._didTextUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}_getKey(){return`${this.text}:${this._style.styleKey}:${this._resolution}`}destroy(t=!1){super.destroy(t),this.owner=null,this._bounds=null,this._anchor=null,(typeof t=="boolean"?t:t!=null&&t.style)&&this._style.destroy(t),this._style=null,this._text=null}}function mn(r,t){var e;let i=(e=r[0])!=null?e:{};return(typeof i=="string"||r[1])&&(i={text:i,style:r[1]}),i}class Lu extends pn{constructor(...t){const e=mn(t,"Text");super(e,Ot),this.renderPipeId="text"}_updateBounds(){const t=this._bounds,e=this._anchor,i=zt.measureText(this._text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class i0 extends $_{resolveQueueItem(t,e){return t instanceof rt?this.resolveContainerQueueItem(t,e):t instanceof et||t instanceof w?e.push(t.source):t instanceof _t&&e.push(t),null}resolveContainerQueueItem(t,e){t instanceof $t||t instanceof J_||t instanceof vr?e.push(t.texture.source):t instanceof Lu?e.push(t):t instanceof mr?e.push(t.context):t instanceof Ai&&t.textures.forEach(i=>{i.source?e.push(i.source):e.push(i.texture.source)})}resolveGraphicsContextQueueItem(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;return s.source}else if(i.action==="fill"){const{texture:s}=i.data.style;return s.source}return null}}class s0 extends pn{constructor(...t){var e,i,s;const n=mn(t,"BitmapText");(e=n.style)!=null||(n.style=n.style||{}),(s=(i=n.style).fill)!=null||(i.fill=16777215),super(n,Ot),this.renderPipeId="bitmapText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=ci.measureText(this.text,this._style),s=i.scale,n=i.offsetY*s;let a=i.width*s,o=i.height*s;const u=this._style._stroke;u&&(a+=u.width,o+=u.width),t.minX=-e._x*a,t.maxX=t.minX+a,t.minY=-e._y*(o+n),t.maxY=t.minY+o}}class n0 extends pn{constructor(...t){const e=mn(t,"HtmlText");super(e,Ue),this.renderPipeId="htmlText"}_updateBounds(){const t=this._bounds,e=this._anchor,i=Vo(this.text,this._style),{width:s,height:n}=i;t.minX=-e._x*s,t.maxX=t.minX+s,t.minY=-e._y*n,t.maxY=t.minY+n}}class a0 extends i0{uploadQueueItem(t){t instanceof et?this.uploadTextureSource(t):t instanceof Lu?this.uploadText(t):t instanceof n0?this.uploadHTMLText(t):t instanceof s0?this.uploadBitmapText(t):t instanceof _t&&this.uploadGraphicsContext(t)}uploadTextureSource(t){this.renderer.texture.initSource(t)}uploadText(t){this.renderer.renderPipes.text.initGpuText(t)}uploadBitmapText(t){this.renderer.renderPipes.bitmapText.initGpuText(t)}uploadHTMLText(t){this.renderer.renderPipes.htmlText.initGpuText(t)}uploadGraphicsContext(t){this.renderer.graphicsContext.getContextRenderData(t);const{instructions:e}=t;for(const i of e)if(i.action==="texture"){const{image:s}=i.data;this.uploadTextureSource(s.source)}else if(i.action==="fill"){const{texture:s}=i.data.style;this.uploadTextureSource(s.source)}return null}}class o0 extends a0{destroy(){clearTimeout(this.timeout),this.renderer=null,this.queue=null,this.resolves=null}}o0.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"prepare"};class Nu{constructor(){this._didUpload=!1,this._tempState=Ht.for2d()}init(t){t.renderer.runners.contextChange.add(this)}contextChange(){this._didUpload=!1}start(t,e,i){const s=t.renderer;s.shader.bind(i,this._didUpload),s.shader.updateUniformGroup(s.globalUniforms.uniformGroup),s.geometry.bind(e,i.glProgram)}execute(t,e){const i=t.renderer;this._didUpload=!0,this._tempState.blendMode=e.blendMode,i.state.set(this._tempState);const s=e.textures.textures;for(let n=0;n<e.textures.count;n++)i.texture.bind(s[n],n);i.geometry.draw("triangle-list",e.size,e.start)}}Nu.extension={type:[v.WebGLPipesAdaptor],name:"batch"};function c3(r){const t=[];let e=0;for(let i=0;i<r;i++)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 h3(r){const t={};let e=0;for(let i=0;i<r;i++)t[`textureSource${i+1}`]=e++,t[`textureSampler${i+1}`]=e++;return t}const gn=Ht.for2d();class $u{start(t,e,i){const s=t.renderer,n=s.encoder,a=i.gpuProgram;this._shader=i,this._geometry=e,n.setGeometry(e,a),gn.blendMode="normal",s.pipeline.getPipeline(e,a,gn);const o=s.globalUniforms.bindGroup;n.resetBindGroup(1),n.setBindGroup(0,o,a)}execute(t,e){const i=this._shader.gpuProgram,s=t.renderer,n=s.encoder;if(!e.bindGroup){const u=e.textures;e.bindGroup=os(u.textures,u.count)}gn.blendMode=e.blendMode;const a=s.bindGroup.getBindGroup(e.bindGroup,i,1),o=s.pipeline.getPipeline(this._geometry,i,gn);e.bindGroup._touch(s.textureGC.count),n.setPipeline(o),n.renderPassEncoder.setBindGroup(1,a),n.renderPassEncoder.drawIndexed(e.size,1,e.start)}}$u.extension={type:[v.WebGPUPipesAdaptor],name:"batch"};const Hu=class wy{constructor(t,e){this.state=Ht.for2d(),this._batchersByInstructionSet=Object.create(null),this._activeBatches=Object.create(null);var i,s;this.renderer=t,this._adaptor=e,(s=(i=this._adaptor).init)==null||s.call(i,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 _s)),this._activeBatches=e,this._activeBatch=this._activeBatches.default;for(const i in this._activeBatches)this._activeBatches[i].begin()}addToBatch(t,e){if(this._activeBatch.name!==t.batcherName){this._activeBatch.break(e);let i=this._activeBatches[t.batcherName];i||(i=this._activeBatches[t.batcherName]=wy.getBatcher(t.batcherName),i.begin()),this._activeBatch=i}this._activeBatch.add(t)}break(t){this._activeBatch.break(t)}buildEnd(t){this._activeBatch.break(t);const e=this._activeBatches;for(const i in e){const s=e[i],n=s.geometry;n.indexBuffer.setDataWithSize(s.indexBuffer,s.indexSize,!0),n.buffers[0].setDataWithSize(s.attributeBuffer.float32View,s.attributeSize,!1)}}upload(t){const e=this._batchersByInstructionSet[t.uid];for(const i in e){const s=e[i],n=s.geometry;s.dirty&&(s.dirty=!1,n.buffers[0].update(s.attributeSize*4))}}execute(t){if(t.action==="startBatch"){const e=t.batcher,i=e.geometry,s=e.shader;this._adaptor.start(this,i,s)}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}};Hu.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"batch"},Hu._availableBatchers=Object.create(null);let Xu=Hu;L.handleByMap(v.Batcher,Xu._availableBatchers),L.add(_s);function d3(r){const t=r.split(/([\n{}])/g).map(i=>i.trim()).filter(i=>i.length);let e="";return t.map(i=>{let s=e+i;return i==="{"?e+=" ":i==="}"&&(e=e.substr(0,e.length-4),s=e+i),s}).join(`
`)}const u0={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);
`}},l0={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 c0(r,t){const e=r.root,i=r.instructionSet;i.reset();const s=t.renderPipes?t:t.batch.renderer,n=s.renderPipes;n.batch.buildStart(i),n.blendMode.buildStart(),n.colorMask.buildStart(),e.sortableChildren&&e.sortChildren(),h0(e,i,s,!0),n.batch.buildEnd(i),n.blendMode.buildEnd(i)}function wi(r,t,e){const i=e.renderPipes?e:e.batch.renderer;r.globalDisplayStatus<7||!r.includeInBuild||(r.sortableChildren&&r.sortChildren(),r.isSimple?f3(r,t,i):h0(r,t,i,!1))}function f3(r,t,e){if(r.renderPipeId){const{renderPipes:i,renderableGC:s}=e;i.blendMode.setBlendMode(r,r.groupBlendMode,t),r.didViewUpdate=!1,i[r.renderPipeId].addRenderable(r,t),s.addRenderable(r,t)}if(!r.renderGroup){const i=r.children,s=i.length;for(let n=0;n<s;n++)wi(i[n],t,e)}}function h0(r,t,e,i){const{renderPipes:s,renderableGC:n}=e;if(!i&&r.renderGroup)s.renderGroup.addRenderGroup(r.renderGroup,t);else{for(let u=0;u<r.effects.length;u++){const l=r.effects[u];s[l.pipe].push(l,r,t)}const a=r.renderPipeId;a&&(s.blendMode.setBlendMode(r,r.groupBlendMode,t),r.didViewUpdate=!1,s[a].addRenderable(r,t),n.addRenderable(r,t));const o=r.children;if(o.length)for(let u=0;u<o.length;u++)wi(o[u],t,e);for(let u=r.effects.length-1;u>=0;u--){const l=r.effects[u];s[l.pipe].pop(l,r,t)}}}const p3=new ft;let m3=class extends zr{constructor(){super(),this.filters=[new L_({sprite:new $t(w.EMPTY),resolution:"inherit",antialias:"inherit"})]}get sprite(){return this.filters[0].sprite}set sprite(t){this.filters[0].sprite=t}};class zu{constructor(t){this._activeMaskStage=[],this._renderer=t}push(t,e,i){const s=this._renderer;if(s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskBegin",mask:t,canBundle:!1,maskedContainer:e}),t.renderMaskToTexture){const n=t.mask;n.includeInBuild=!0,wi(n,i,s),n.includeInBuild=!1}s.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"pushMaskEnd",mask:t,maskedContainer:e,canBundle:!1})}pop(t,e,i){this._renderer.renderPipes.batch.break(i),i.add({renderPipeId:"alphaMask",action:"popMaskEnd",mask:t,canBundle:!1})}execute(t){const e=this._renderer,i=t.mask.renderMaskToTexture;if(t.action==="pushMaskBegin"){const s=X.get(m3);if(i){t.mask.mask.measurable=!0;const n=jr(t.mask.mask,!0,p3);t.mask.mask.measurable=!1,n.ceil();const a=e.renderTarget.renderTarget.colorTexture.source,o=pt.getOptimalTexture(n.width,n.height,a._resolution,a.antialias);e.renderTarget.push(o,!0),e.globalUniforms.push({offset:n,worldColor:4294967295});const u=s.sprite;u.texture=o,u.worldTransform.tx=n.minX,u.worldTransform.ty=n.minY,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer,filterTexture:o})}else s.sprite=t.mask.mask,this._activeMaskStage.push({filterEffect:s,maskedContainer:t.maskedContainer})}else if(t.action==="pushMaskEnd"){const s=this._activeMaskStage[this._activeMaskStage.length-1];i&&(e.type===St.WEBGL&&e.renderTarget.finishRenderPass(),e.renderTarget.pop(),e.globalUniforms.pop()),e.filter.push({renderPipeId:"filter",action:"pushFilter",container:s.maskedContainer,filterEffect:s.filterEffect,canBundle:!1})}else if(t.action==="popMaskEnd"){e.filter.pop();const s=this._activeMaskStage.pop();i&&pt.returnTexture(s.filterTexture),X.return(s.filterEffect)}}destroy(){this._renderer=null,this._activeMaskStage=null}}zu.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"alphaMask"};class ju{constructor(t){this._colorStack=[],this._colorStackIndex=0,this._currentColor=0,this._renderer=t}buildStart(){this._colorStack[0]=15,this._colorStackIndex=1,this._currentColor=15}push(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;s[this._colorStackIndex]=s[this._colorStackIndex-1]&t.mask;const n=this._colorStack[this._colorStackIndex];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1})),this._colorStackIndex++}pop(t,e,i){this._renderer.renderPipes.batch.break(i);const s=this._colorStack;this._colorStackIndex--;const n=s[this._colorStackIndex-1];n!==this._currentColor&&(this._currentColor=n,i.add({renderPipeId:"colorMask",colorMask:n,canBundle:!1}))}execute(t){this._renderer.colorMask.setMask(t.colorMask)}destroy(){this._colorStack=null}}ju.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"colorMask"};class g3{constructor(t){this.priority=0,this.pipe="scissorMask",this.mask=t,this.mask.renderable=!1,this.mask.measurable=!1}addBounds(t,e){ss(this.mask,t,e)}addLocalBounds(t,e){ns(this.mask,t,e)}containsPoint(t,e){const i=this.mask;return e(i,t)}reset(){this.mask.measurable=!0,this.mask=null}destroy(){this.reset()}}class Vu{constructor(t){this._maskStackHash={},this._maskHash=new WeakMap,this._renderer=t}push(t,e,i){var s,n;const a=t,o=this._renderer;o.renderPipes.batch.break(i),o.renderPipes.blendMode.setBlendMode(a.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"pushMaskBegin",mask:t,canBundle:!1});const u=a.mask;u.includeInBuild=!0,this._maskHash.has(a)||this._maskHash.set(a,{instructionsStart:0,instructionsLength:0});const l=this._maskHash.get(a);l.instructionsStart=i.instructionSize,wi(u,i,o),u.includeInBuild=!1,o.renderPipes.batch.break(i),i.add({renderPipeId:"stencilMask",action:"pushMaskEnd",mask:t,canBundle:!1});const c=i.instructionSize-l.instructionsStart-1;l.instructionsLength=c;const h=o.renderTarget.renderTarget.uid;(n=(s=this._maskStackHash)[h])!=null||(s[h]=0)}pop(t,e,i){const s=t,n=this._renderer;n.renderPipes.batch.break(i),n.renderPipes.blendMode.setBlendMode(s.mask,"none",i),i.add({renderPipeId:"stencilMask",action:"popMaskBegin",canBundle:!1});const a=this._maskHash.get(t);for(let o=0;o<a.instructionsLength;o++)i.instructions[i.instructionSize++]=i.instructions[a.instructionsStart++];i.add({renderPipeId:"stencilMask",action:"popMaskEnd",canBundle:!1})}execute(t){var e,i;const s=this._renderer,n=s.renderTarget.renderTarget.uid;let a=(i=(e=this._maskStackHash)[n])!=null?i:e[n]=0;t.action==="pushMaskBegin"?(s.renderTarget.ensureDepthStencil(),s.stencil.setStencilMode(ut.RENDERING_MASK_ADD,a),a++,s.colorMask.setMask(0)):t.action==="pushMaskEnd"?(s.stencil.setStencilMode(ut.MASK_ACTIVE,a),s.colorMask.setMask(15)):t.action==="popMaskBegin"?(s.colorMask.setMask(0),a!==0?s.stencil.setStencilMode(ut.RENDERING_MASK_REMOVE,a):(s.renderTarget.clear(null,At.STENCIL),s.stencil.setStencilMode(ut.DISABLED,a)),a--):t.action==="popMaskEnd"&&(s.stencil.setStencilMode(ut.MASK_ACTIVE,a),s.colorMask.setMask(15)),this._maskStackHash[n]=a}destroy(){this._renderer=null,this._maskStackHash=null,this._maskHash=null}}Vu.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"stencilMask"};var Ci=(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))(Ci||{});class d0{constructor(t,e){this.buffer=t||null,this.updateID=-1,this.byteLength=-1,this.type=e}}class Wu{constructor(t){this._gpuBuffers=Object.create(null),this._boundBufferBases=Object.create(null),this._renderer=t}destroy(){this._renderer=null,this._gl=null,this._gpuBuffers=null,this._boundBufferBases=null}contextChange(){this._gpuBuffers=Object.create(null),this._gl=this._renderer.gl}getGlBuffer(t){return this._gpuBuffers[t.uid]||this.createGLBuffer(t)}bind(t){const{_gl:e}=this,i=this.getGlBuffer(t);e.bindBuffer(i.type,i.buffer)}bindBufferBase(t,e){const{_gl:i}=this;if(this._boundBufferBases[e]!==t){const s=this.getGlBuffer(t);this._boundBufferBases[e]=t,i.bindBufferBase(i.UNIFORM_BUFFER,e,s.buffer)}}bindBufferRange(t,e,i){const{_gl:s}=this;i=i||0;const n=this.getGlBuffer(t);s.bindBufferRange(s.UNIFORM_BUFFER,e||0,n.buffer,i*256,256)}updateBuffer(t){const{_gl:e}=this,i=this.getGlBuffer(t);if(t._updateID===i.updateID)return i;i.updateID=t._updateID,e.bindBuffer(i.type,i.buffer);const s=t.data;if(i.byteLength>=t.data.byteLength)e.bufferSubData(i.type,0,s,0,t._updateSize/s.BYTES_PER_ELEMENT);else{const n=t.descriptor.usage&z.STATIC?e.STATIC_DRAW:e.DYNAMIC_DRAW;i.byteLength=s.byteLength,e.bufferData(i.type,s,n)}return i}destroyAll(){const t=this._gl;for(const e in this._gpuBuffers)t.deleteBuffer(this._gpuBuffers[e].buffer);this._gpuBuffers=Object.create(null)}onBufferDestroy(t,e){const i=this._gpuBuffers[t.uid],s=this._gl;e||s.deleteBuffer(i.buffer),this._gpuBuffers[t.uid]=null}createGLBuffer(t){const{_gl:e}=this;let i=Ci.ARRAY_BUFFER;t.descriptor.usage&z.INDEX?i=Ci.ELEMENT_ARRAY_BUFFER:t.descriptor.usage&z.UNIFORM&&(i=Ci.UNIFORM_BUFFER);const s=new d0(e.createBuffer(),i);return this._gpuBuffers[t.uid]=s,t.on("destroy",this.onBufferDestroy,this),s}}Wu.extension={type:[v.WebGLSystem],name:"buffer"};var _3=Object.defineProperty,b3=Object.defineProperties,y3=Object.getOwnPropertyDescriptors,f0=Object.getOwnPropertySymbols,x3=Object.prototype.hasOwnProperty,v3=Object.prototype.propertyIsEnumerable,p0=(r,t,e)=>t in r?_3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,_n=(r,t)=>{for(var e in t||(t={}))x3.call(t,e)&&p0(r,e,t[e]);if(f0)for(var e of f0(t))v3.call(t,e)&&p0(r,e,t[e]);return r},m0=(r,t)=>b3(r,y3(t));const Yu=class Cy{constructor(t){this.supports={uint32Indices:!0,uniformBufferObject:!0,vertexArrayObject:!0,srgbTextures:!0,nonPowOf2wrapping:!0,msaa:!0,nonPowOf2mipmaps:!0},this._renderer=t,this.extensions=Object.create(null),this.handleContextLost=this.handleContextLost.bind(this),this.handleContextRestored=this.handleContextRestored.bind(this)}get isLost(){return!this.gl||this.gl.isContextLost()}contextChange(t){this.gl=t,this._renderer.gl=t}init(t){var e,i;t=_n(_n({},Cy.defaultOptions),t);let s=this.multiView=t.multiView;if(t.context&&s&&(ge("Renderer created with both a context and multiview enabled. Disabling multiView as both cannot work together."),s=!1),s?this.canvas=$.get().createCanvas(this._renderer.canvas.width,this._renderer.canvas.height):this.canvas=this._renderer.view.canvas,t.context)this.initFromContext(t.context);else{const n=this._renderer.background.alpha<1,a=(e=t.premultipliedAlpha)!=null?e:!0,o=t.antialias&&!this._renderer.backBuffer.useBackBuffer;this.createContext(t.preferWebGLVersion,{alpha:n,premultipliedAlpha:a,antialias:o,stencil:!0,preserveDrawingBuffer:t.preserveDrawingBuffer,powerPreference:(i=t.powerPreference)!=null?i:"default"})}}ensureCanvasSize(t){if(!this.multiView){t!==this.canvas&&ge("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 $.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 i;const s=this.canvas;if(t===2&&(i=s.getContext("webgl2",e)),!i&&(i=s.getContext("webgl",e),!i))throw new Error("This browser does not support WebGL. Try using the canvas renderer");this.gl=i,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=m0(_n({},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=m0(_n({},e),{colorBufferFloat:t.getExtension("EXT_color_buffer_float")});const i=t.getExtension("WEBGL_provoking_vertex");i&&i.provokingVertexWEBGL(i.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 i=this.supports,s=this.webGLVersion===2,n=this.extensions;i.uint32Indices=s||!!n.uint32ElementIndex,i.uniformBufferObject=s,i.vertexArrayObject=s||!!n.vertexArrayObject,i.srgbTextures=s||!!n.srgb,i.nonPowOf2wrapping=s,i.nonPowOf2mipmaps=s,i.msaa=s,i.uint32Indices}};Yu.extension={type:[v.WebGLSystem],name:"context"},Yu.defaultOptions={context:null,premultipliedAlpha:!0,preserveDrawingBuffer:!1,powerPreference:void 0,preferWebGLVersion:2,multiView:!1};let g0=Yu;function qu(r,t){var e,i,s;for(const n in r.attributes){const a=r.attributes[n],o=t[n];o?((e=a.format)!=null||(a.format=o.format),(i=a.offset)!=null||(a.offset=o.offset),(s=a.instance)!=null||(a.instance=o.instance)):ge(`Attribute ${n} is not present in the shader, but is present in the geometry. Unable to infer attribute details.`)}T3(r)}function T3(r){var t,e;const{buffers:i,attributes:s}=r,n={},a={};for(const o in i){const u=i[o];n[u.uid]=0,a[u.uid]=0}for(const o in s){const u=s[o];n[u.buffer.uid]+=sr(u.format).stride}for(const o in s){const u=s[o];(t=u.stride)!=null||(u.stride=n[u.buffer.uid]),(e=u.start)!=null||(u.start=a[u.buffer.uid]),a[u.buffer.uid]+=sr(u.format).stride}}var bn=(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))(bn||{}),Ku=(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))(Ku||{}),_0=(r=>(r[r.CLAMP=33071]="CLAMP",r[r.REPEAT=10497]="REPEAT",r[r.MIRRORED_REPEAT=33648]="MIRRORED_REPEAT",r))(_0||{}),j=(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))(j||{});const b0={uint8x2:j.UNSIGNED_BYTE,uint8x4:j.UNSIGNED_BYTE,sint8x2:j.BYTE,sint8x4:j.BYTE,unorm8x2:j.UNSIGNED_BYTE,unorm8x4:j.UNSIGNED_BYTE,snorm8x2:j.BYTE,snorm8x4:j.BYTE,uint16x2:j.UNSIGNED_SHORT,uint16x4:j.UNSIGNED_SHORT,sint16x2:j.SHORT,sint16x4:j.SHORT,unorm16x2:j.UNSIGNED_SHORT,unorm16x4:j.UNSIGNED_SHORT,snorm16x2:j.SHORT,snorm16x4:j.SHORT,float16x2:j.HALF_FLOAT,float16x4:j.HALF_FLOAT,float32:j.FLOAT,float32x2:j.FLOAT,float32x3:j.FLOAT,float32x4:j.FLOAT,uint32:j.UNSIGNED_INT,uint32x2:j.UNSIGNED_INT,uint32x3:j.UNSIGNED_INT,uint32x4:j.UNSIGNED_INT,sint32:j.INT,sint32x2:j.INT,sint32x3:j.INT,sint32x4:j.INT};function y0(r){var t;return(t=b0[r])!=null?t:b0.float32}const S3={"point-list":0,"line-list":1,"line-strip":3,"triangle-list":4,"triangle-strip":5};class Zu{constructor(t){this._geometryVaoHash=Object.create(null),this._renderer=t,this._activeGeometry=null,this._activeVao=null,this.hasVao=!0,this.hasInstance=!0}contextChange(){const t=this.gl=this._renderer.gl;if(!this._renderer.context.supports.vertexArrayObject)throw new Error("[PixiJS] Vertex Array Objects are not supported on this device");const e=this._renderer.context.extensions.vertexArrayObject;e&&(t.createVertexArray=()=>e.createVertexArrayOES(),t.bindVertexArray=s=>e.bindVertexArrayOES(s),t.deleteVertexArray=s=>e.deleteVertexArrayOES(s));const i=this._renderer.context.extensions.vertexAttribDivisorANGLE;i&&(t.drawArraysInstanced=(s,n,a,o)=>{i.drawArraysInstancedANGLE(s,n,a,o)},t.drawElementsInstanced=(s,n,a,o,u)=>{i.drawElementsInstancedANGLE(s,n,a,o,u)},t.vertexAttribDivisor=(s,n)=>i.vertexAttribDivisorANGLE(s,n)),this._activeGeometry=null,this._activeVao=null,this._geometryVaoHash=Object.create(null)}bind(t,e){const i=this.gl;this._activeGeometry=t;const s=this.getVao(t,e);this._activeVao!==s&&(this._activeVao=s,i.bindVertexArray(s)),this.updateBuffers()}reset(){this.unbind()}updateBuffers(){const t=this._activeGeometry,e=this._renderer.buffer;for(let i=0;i<t.buffers.length;i++){const s=t.buffers[i];e.updateBuffer(s)}}checkCompatibility(t,e){const i=t.attributes,s=e._attributeData;for(const n in s)if(!i[n])throw new Error(`shader and geometry incompatible, geometry missing the "${n}" attribute`)}getSignature(t,e){const i=t.attributes,s=e._attributeData,n=["g",t.uid];for(const a in i)s[a]&&n.push(a,s[a].location);return n.join("-")}getVao(t,e){var i;return((i=this._geometryVaoHash[t.uid])==null?void 0:i[e._key])||this.initGeometryVao(t,e)}initGeometryVao(t,e,i=!0){const s=this._renderer.gl,n=this._renderer.buffer;this._renderer.shader._getProgramData(e),this.checkCompatibility(t,e);const a=this.getSignature(t,e);this._geometryVaoHash[t.uid]||(this._geometryVaoHash[t.uid]=Object.create(null),t.on("destroy",this.onGeometryDestroy,this));const o=this._geometryVaoHash[t.uid];let u=o[a];if(u)return o[e._key]=u,u;qu(t,e._attributeData);const l=t.buffers;u=s.createVertexArray(),s.bindVertexArray(u);for(let c=0;c<l.length;c++){const h=l[c];n.bind(h)}return this.activateVao(t,e),o[e._key]=u,o[a]=u,s.bindVertexArray(null),u}onGeometryDestroy(t,e){const i=this._geometryVaoHash[t.uid],s=this.gl;if(i){if(e)for(const n in i)this._activeVao!==i[n]&&this.unbind(),s.deleteVertexArray(i[n]);this._geometryVaoHash[t.uid]=null}}destroyAll(t=!1){const e=this.gl;for(const i in this._geometryVaoHash){if(t)for(const s in this._geometryVaoHash[i]){const n=this._geometryVaoHash[i];this._activeVao!==n&&this.unbind(),e.deleteVertexArray(n[s])}this._geometryVaoHash[i]=null}}activateVao(t,e){var i,s;const n=this._renderer.gl,a=this._renderer.buffer,o=t.attributes;t.indexBuffer&&a.bind(t.indexBuffer);let u=null;for(const l in o){const c=o[l],h=c.buffer,f=a.getGlBuffer(h),p=e._attributeData[l];if(p){u!==f&&(a.bind(h),u=f);const m=p.location;n.enableVertexAttribArray(m);const _=sr(c.format),g=y0(c.format);if(((i=p.format)==null?void 0:i.substring(1,4))==="int"?n.vertexAttribIPointer(m,_.size,g,c.stride,c.offset):n.vertexAttribPointer(m,_.size,g,_.normalised,c.stride,c.offset),c.instance)if(this.hasInstance){const b=(s=c.divisor)!=null?s:1;n.vertexAttribDivisor(m,b)}else throw new Error("geometry error, GPU Instancing is not supported on this device")}}}draw(t,e,i,s){const{gl:n}=this._renderer,a=this._activeGeometry,o=S3[a.topology||t];if(s||(s=a.instanceCount),a.indexBuffer){const u=a.indexBuffer.data.BYTES_PER_ELEMENT,l=u===2?n.UNSIGNED_SHORT:n.UNSIGNED_INT;s>1?n.drawElementsInstanced(o,e||a.indexBuffer.data.length,l,(i||0)*u,s):n.drawElements(o,e||a.indexBuffer.data.length,l,(i||0)*u)}else s>1?n.drawArraysInstanced(o,i||0,e||a.getSize(),s):n.drawArrays(o,i||0,e||a.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}}Zu.extension={type:[v.WebGLSystem],name:"geometry"};var A3=Object.defineProperty,x0=Object.getOwnPropertySymbols,E3=Object.prototype.hasOwnProperty,w3=Object.prototype.propertyIsEnumerable,v0=(r,t,e)=>t in r?A3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,T0=(r,t)=>{for(var e in t||(t={}))E3.call(t,e)&&v0(r,e,t[e]);if(x0)for(var e of x0(t))w3.call(t,e)&&v0(r,e,t[e]);return r};const C3=new rr({attributes:{aPosition:[-1,-1,3,-1,-1,3]}}),Qu=class Ry{constructor(t){this.useBackBuffer=!1,this._useBackBufferThisRender=!1,this._renderer=t}init(t={}){const{useBackBuffer:e,antialias:i}=T0(T0({},Ry.defaultOptions),t);this.useBackBuffer=e,this._antialias=i,this._renderer.context.supports.msaa||(ge("antialiasing, is not supported on when using the back buffer"),this._antialias=!1),this._state=Ht.for2d();const s=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:s,resources:{uTexture:w.WHITE.source}})}renderStart(t){const e=this._renderer.renderTarget.getRenderTarget(t.target);if(this._useBackBufferThisRender=this.useBackBuffer&&!!e.isRoot,this._useBackBufferThisRender){const i=this._renderer.renderTarget.getRenderTarget(t.target);this._targetTexture=i.colorTexture,t.target=this._getBackBufferTexture(i.colorTexture)}}renderEnd(){this._presentBackBuffer()}_presentBackBuffer(){const t=this._renderer;t.renderTarget.finishRenderPass(),this._useBackBufferThisRender&&(t.renderTarget.bind(this._targetTexture,!1),this._bigTriangleShader.resources.uTexture=this._backBufferTexture.source,t.encoder.draw({geometry:C3,shader:this._bigTriangleShader,state:this._state}))}_getBackBufferTexture(t){return this._backBufferTexture=this._backBufferTexture||new w({source:new et({width:t.width,height:t.height,resolution:t._resolution,antialias:this._antialias})}),this._backBufferTexture.source.resize(t.width,t.height,t._resolution),this._backBufferTexture}destroy(){this._backBufferTexture&&(this._backBufferTexture.destroy(),this._backBufferTexture=null)}};Qu.extension={type:[v.WebGLSystem],name:"backBuffer",priority:1},Qu.defaultOptions={useBackBuffer:!1};let S0=Qu;class Ju{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)))}}Ju.extension={type:[v.WebGLSystem],name:"colorMask"};class tl{constructor(t){this.commandFinished=Promise.resolve(),this._renderer=t}setGeometry(t,e){this._renderer.geometry.bind(t,e.glProgram)}finishRenderPass(){}draw(t){const e=this._renderer,{geometry:i,shader:s,state:n,skipSync:a,topology:o,size:u,start:l,instanceCount:c}=t;e.shader.bind(s,a),e.geometry.bind(i,e.shader._activeProgram),n&&e.state.set(n),e.geometry.draw(o,u,l,c!=null?c:i.instanceCount)}destroy(){this._renderer=null}}tl.extension={type:[v.WebGLSystem],name:"encoder"};class A0{constructor(){this.width=-1,this.height=-1,this.msaa=!1,this.msaaRenderBuffer=[]}}const xe=[];xe[ut.NONE]=void 0,xe[ut.DISABLED]={stencilWriteMask:0,stencilReadMask:0},xe[ut.RENDERING_MASK_ADD]={stencilFront:{compare:"equal",passOp:"increment-clamp"},stencilBack:{compare:"equal",passOp:"increment-clamp"}},xe[ut.RENDERING_MASK_REMOVE]={stencilFront:{compare:"equal",passOp:"decrement-clamp"},stencilBack:{compare:"equal",passOp:"decrement-clamp"}},xe[ut.MASK_ACTIVE]={stencilWriteMask:0,stencilFront:{compare:"equal",passOp:"keep"},stencilBack:{compare:"equal",passOp:"keep"}};class el{constructor(t){this._stencilCache={enabled:!1,stencilReference:0,stencilMode:ut.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=ut.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:ut.DISABLED,stencilReference:0}),this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid],s=this._gl,n=xe[t],a=this._stencilCache;if(i.stencilMode=t,i.stencilReference=e,t===ut.DISABLED){this._stencilCache.enabled&&(this._stencilCache.enabled=!1,s.disable(s.STENCIL_TEST));return}this._stencilCache.enabled||(this._stencilCache.enabled=!0,s.enable(s.STENCIL_TEST)),(t!==a.stencilMode||a.stencilReference!==e)&&(a.stencilMode=t,a.stencilReference=e,s.stencilFunc(this._comparisonFuncMapping[n.stencilBack.compare],e,255),s.stencilOp(s.KEEP,s.KEEP,this._stencilOpsMapping[n.stencilBack.passOp]))}}el.extension={type:[v.WebGLSystem],name:"stencil"};class rl{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 Pt({data:new Float32Array(e.layout.size/4),usage:z.UNIFORM|z.COPY_DST}))}getUniformGroupData(t){return this._syncFunctionHash[t._signature]||this._initUniformGroup(t)}_initUniformGroup(t){const e=t._signature;let i=this._syncFunctionHash[e];if(!i){const s=Object.keys(t.uniformStructures).map(o=>t.uniformStructures[o]),n=this._adaptor.createUboElements(s),a=this._generateUboSync(n.uboElements);i=this._syncFunctionHash[e]={layout:n,syncFunction:a}}return this._syncFunctionHash[e]}_generateUboSync(t){return this._adaptor.generateUboSync(t)}syncUniformGroup(t,e,i){const s=this.getUniformGroupData(t);return t.buffer||(t.buffer=new Pt({data:new Float32Array(s.layout.size/4),usage:z.UNIFORM|z.COPY_DST})),e||(e=t.buffer.data),i||(i=0),s.syncFunction(t.uniforms,e,i),!0}updateUniformGroup(t){if(t.isStatic&&!t._dirtyId)return!1;t._dirtyId=0;const e=this.syncUniformGroup(t);return t.buffer.update(),e}destroy(){this._syncFunctionHash=null}}const il={f32:4,"vec2<f32>":8,"vec3<f32>":12,"vec4<f32>":16,"mat2x2<f32>":32,"mat3x3<f32>":48,"mat4x4<f32>":64};function E0(r){const t=r.map(n=>({data:n,offset:0,size:0}));let e=0,i=0,s=0;for(let n=0;n<t.length;n++){const a=t[n];if(e=il[a.data.type],!e)throw new Error(`Unknown type ${a.data.type}`);if(a.data.size>1&&(e=Math.max(e,16)*a.data.size),a.size=e,i%e!==0&&i<16){const o=i%e%16;i+=o,s+=o}i+e>16?(s=Math.ceil(s/16)*16,a.offset=s,s+=e,i=e):(a.offset=s,i+=e,s+=e)}return s=Math.ceil(s/16)*16,{uboElements:t,size:s}}const ve=[{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,i){const s=[`
var v = null;
var v2 = null;
var t = 0;
var index = 0;
var name = null;
var arrayOffset = null;
`];let n=0;for(let o=0;o<r.length;o++){const u=r[o],l=u.data.name;let c=!1,h=0;for(let f=0;f<ve.length;f++)if(ve[f].test(u.data)){h=u.offset/4,s.push(`name = "${l}";`,`offset += ${h-n};`,ve[f][t]||ve[f].ubo),c=!0;break}if(!c)if(u.data.size>1)h=u.offset/4,s.push(e(u,h-n));else{const f=i[u.data.type];h=u.offset/4,s.push(`
v = uv.${l};
offset += ${h-n};
${f};
`)}n=h}const a=s.join(`
`);return new Function("uv","data","offset",a)}var R3=Object.defineProperty,P3=Object.defineProperties,M3=Object.getOwnPropertyDescriptors,w0=Object.getOwnPropertySymbols,D3=Object.prototype.hasOwnProperty,O3=Object.prototype.propertyIsEnumerable,C0=(r,t,e)=>t in r?R3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,B3=(r,t)=>{for(var e in t||(t={}))D3.call(t,e)&&C0(r,e,t[e]);if(w0)for(var e of w0(t))O3.call(t,e)&&C0(r,e,t[e]);return r},G3=(r,t)=>P3(r,M3(t));function Tr(r,t){return`
for (let i = 0; i < ${r*t}; i++) {
data[offset + (((i / ${r})|0) * 4) + (i % ${r})] = v[i];
}
`}const nl={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>":Tr(3,2),"mat4x2<f32>":Tr(4,2),"mat2x3<f32>":Tr(2,3),"mat4x3<f32>":Tr(4,3),"mat2x4<f32>":Tr(2,4),"mat3x4<f32>":Tr(3,4)},R0=G3(B3({},nl),{"mat2x2<f32>":`
data[offset] = v[0];
data[offset + 1] = v[1];
data[offset + 2] = v[2];
data[offset + 3] = v[3];
`});function P0(r,t){const e=Math.max(il[r.data.type]/16,1),i=r.data.value.length/r.data.size,s=(4-i%4)%4;return`
v = uv.${r.data.name};
offset += ${t};
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*e}; i++)
{
for(var j = 0; j < ${i}; j++)
{
data[arrayOffset++] = v[t++];
}
${s!==0?`arrayOffset += ${s};`:""}
}
`}function M0(r){return sl(r,"uboStd40",P0,nl)}class al extends rl{constructor(){super({createUboElements:E0,generateUboSync:M0})}}al.extension={type:[v.WebGLSystem],name:"ubo"};class D0{constructor(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new W}init(t,e){this._renderer=t,this._renderTargetSystem=e,t.runners.contextChange.add(this)}contextChange(){this._clearColorCache=[0,0,0,0],this._viewPortCache=new W}copyToTexture(t,e,i,s,n){const a=this._renderTargetSystem,o=this._renderer,u=a.getGpuRenderTarget(t),l=o.gl;return this.finishRenderPass(t),l.bindFramebuffer(l.FRAMEBUFFER,u.resolveTargetFramebuffer),o.texture.bind(e,0),l.copyTexSubImage2D(l.TEXTURE_2D,0,n.x,n.y,i.x,i.y,s.width,s.height),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem,a=t.colorTexture,o=n.getGpuRenderTarget(t);let u=s.y;t.isRoot&&(u=a.pixelHeight-s.height),t.colorTextures.forEach(h=>{this._renderer.texture.unbind(h)});const l=this._renderer.gl;l.bindFramebuffer(l.FRAMEBUFFER,o.framebuffer);const c=this._viewPortCache;(c.x!==s.x||c.y!==u||c.width!==s.width||c.height!==s.height)&&(c.x=s.x,c.y=u,c.width=s.width,c.height=s.height,l.viewport(s.x,u,s.width,s.height)),!o.depthStencilRenderBuffer&&(t.stencil||t.depth)&&this._initStencil(o),this.clear(t,e,i)}finishRenderPass(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);if(!e.msaa)return;const i=this._renderer.gl;i.bindFramebuffer(i.FRAMEBUFFER,e.resolveTargetFramebuffer),i.bindFramebuffer(i.READ_FRAMEBUFFER,e.framebuffer),i.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,i.COLOR_BUFFER_BIT,i.NEAREST),i.bindFramebuffer(i.FRAMEBUFFER,e.framebuffer)}initGpuRenderTarget(t){const e=this._renderer.gl,i=new A0,s=t.colorTexture;return ae.test(s.resource)?(this._renderer.context.ensureCanvasSize(t.colorTexture.resource),i.framebuffer=null,i):(this._initColor(t,i),e.bindFramebuffer(e.FRAMEBUFFER,null),i)}destroyGpuRenderTarget(t){const e=this._renderer.gl;t.framebuffer&&(e.deleteFramebuffer(t.framebuffer),t.framebuffer=null),t.resolveTargetFramebuffer&&(e.deleteFramebuffer(t.resolveTargetFramebuffer),t.resolveTargetFramebuffer=null),t.depthStencilRenderBuffer&&(e.deleteRenderbuffer(t.depthStencilRenderBuffer),t.depthStencilRenderBuffer=null),t.msaaRenderBuffer.forEach(i=>{e.deleteRenderbuffer(i)}),t.msaaRenderBuffer=null}clear(t,e,i){if(!e)return;const s=this._renderTargetSystem;typeof e=="boolean"&&(e=e?At.ALL:At.NONE);const n=this._renderer.gl;if(e&At.COLOR){i!=null||(i=s.defaultClearColor);const a=this._clearColorCache,o=i;(a[0]!==o[0]||a[1]!==o[1]||a[2]!==o[2]||a[3]!==o[3])&&(a[0]=o[0],a[1]=o[1],a[2]=o[2],a[3]=o[3],n.clearColor(o[0],o[1],o[2],o[3]))}n.clear(e)}resizeGpuRenderTarget(t){if(t.isRoot)return;const e=this._renderTargetSystem.getGpuRenderTarget(t);this._resizeColor(t,e),(t.stencil||t.depth)&&this._resizeStencil(e)}_initColor(t,e){const i=this._renderer,s=i.gl,n=s.createFramebuffer();if(e.resolveTargetFramebuffer=n,s.bindFramebuffer(s.FRAMEBUFFER,n),e.width=t.colorTexture.source.pixelWidth,e.height=t.colorTexture.source.pixelHeight,t.colorTextures.forEach((a,o)=>{const u=a.source;u.antialias&&(i.context.supports.msaa?e.msaa=!0:ge("[RenderTexture] Antialiasing on textures is not supported in WebGL1")),i.texture.bindSource(u,0);const l=i.texture.getGlSource(u).texture;s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0+o,3553,l,0)}),e.msaa){const a=s.createFramebuffer();e.framebuffer=a,s.bindFramebuffer(s.FRAMEBUFFER,a),t.colorTextures.forEach((o,u)=>{const l=s.createRenderbuffer();e.msaaRenderBuffer[u]=l})}else e.framebuffer=n;this._resizeColor(t,e)}_resizeColor(t,e){const i=t.colorTexture.source;if(e.width=i.pixelWidth,e.height=i.pixelHeight,t.colorTextures.forEach((s,n)=>{n!==0&&s.source.resize(i.width,i.height,i._resolution)}),e.msaa){const s=this._renderer,n=s.gl,a=e.framebuffer;n.bindFramebuffer(n.FRAMEBUFFER,a),t.colorTextures.forEach((o,u)=>{const l=o.source;s.texture.bindSource(l,0);const c=s.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,i=e.createRenderbuffer();t.depthStencilRenderBuffer=i,e.bindRenderbuffer(e.RENDERBUFFER,i),e.framebufferRenderbuffer(e.FRAMEBUFFER,e.DEPTH_STENCIL_ATTACHMENT,e.RENDERBUFFER,i),this._resizeStencil(t)}_resizeStencil(t){const e=this._renderer.gl;e.bindRenderbuffer(e.RENDERBUFFER,t.depthStencilRenderBuffer),t.msaa?e.renderbufferStorageMultisample(e.RENDERBUFFER,4,e.DEPTH24_STENCIL8,t.width,t.height):e.renderbufferStorage(e.RENDERBUFFER,this._renderer.context.webGLVersion===2?e.DEPTH24_STENCIL8:e.DEPTH_STENCIL,t.width,t.height)}postrender(t){if(this._renderer.context.multiView&&ae.test(t.colorTexture.resource)){const e=this._renderer.context.canvas,i=t.colorTexture;i.context2D.drawImage(e,0,i.pixelHeight-e.height)}}}function O0(r,t,e,i,s,n){const a=n?1:-1;return r.identity(),r.a=1/i*2,r.d=a*(1/s*2),r.tx=-1-t*r.a,r.ty=-a-e*r.d,r}var F3=Object.defineProperty,B0=Object.getOwnPropertySymbols,I3=Object.prototype.hasOwnProperty,U3=Object.prototype.propertyIsEnumerable,G0=(r,t,e)=>t in r?F3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,k3=(r,t)=>{for(var e in t||(t={}))I3.call(t,e)&&G0(r,e,t[e]);if(B0)for(var e of B0(t))U3.call(t,e)&&G0(r,e,t[e]);return r};const Sr=new Map;function ol(r,t){if(!Sr.has(r)){const e=new w({source:new ae(k3({resource:r},t))}),i=()=>{Sr.get(r)===e&&Sr.delete(r)};e.once("destroy",i),e.source.once("destroy",i),Sr.set(r,e)}return Sr.get(r)}function L3(r){return Sr.has(r)}function F0(r){const t=r.colorTexture.source.resource;return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement&&document.body.contains(t)}var N3=Object.defineProperty,I0=Object.getOwnPropertySymbols,$3=Object.prototype.hasOwnProperty,H3=Object.prototype.propertyIsEnumerable,U0=(r,t,e)=>t in r?N3(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,k0=(r,t)=>{for(var e in t||(t={}))$3.call(t,e)&&U0(r,e,t[e]);if(I0)for(var e of I0(t))H3.call(t,e)&&U0(r,e,t[e]);return r};const L0=class Py{constructor(t={}){if(this.uid=J("renderTarget"),this.colorTextures=[],this.dirtyId=0,this.isRoot=!1,this._size=new Float32Array(2),this._managedColorTextures=!1,t=k0(k0({},Py.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 et({width:t.width,height:t.height,resolution:t.resolution,antialias:t.antialias}))}else{this.colorTextures=[...t.colorTextures.map(i=>i.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 w||t.depthStencilTexture instanceof et?this.depthStencilTexture=t.depthStencilTexture.source:this.ensureDepthStencilTexture())}get size(){const t=this._size;return t[0]=this.pixelWidth,t[1]=this.pixelHeight,t}get width(){return this.colorTexture.source.width}get height(){return this.colorTexture.source.height}get pixelWidth(){return this.colorTexture.source.pixelWidth}get pixelHeight(){return this.colorTexture.source.pixelHeight}get resolution(){return this.colorTexture.source._resolution}get colorTexture(){return this.colorTextures[0]}onSourceResize(t){this.resize(t.width,t.height,t._resolution,!0)}ensureDepthStencilTexture(){this.depthStencilTexture||(this.depthStencilTexture=new et({width:this.width,height:this.height,resolution:this.resolution,format:"depth24plus-stencil8",autoGenerateMipmaps:!1,antialias:!1,mipLevelCount:1}))}resize(t,e,i=this.resolution,s=!1){this.dirtyId++,this.colorTextures.forEach((n,a)=>{s&&a===0||n.source.resize(t,e,i)}),this.depthStencilTexture&&this.depthStencilTexture.source.resize(t,e,i)}destroy(){this.colorTexture.source.off("resize",this.onSourceResize,this),this._managedColorTextures&&this.colorTextures.forEach(t=>{t.destroy()}),this.depthStencilTexture&&(this.depthStencilTexture.destroy(),delete this.depthStencilTexture)}};L0.defaultOptions={width:0,height:0,resolution:1,colorTextures:1,stencil:!1,depth:!1,antialias:!1,isRoot:!1};let yn=L0;class ul{constructor(t){this.rootViewPort=new W,this.viewport=new W,this.onRenderTargetChange=new iu("onRenderTargetChange"),this.projectionMatrix=new G,this.defaultClearColor=[0,0,0,0],this._renderSurfaceToRenderTargetHash=new Map,this._gpuRenderTargetHash=Object.create(null),this._renderTargetStack=[],this._renderer=t}finishRenderPass(){this.adaptor.finishRenderPass(this.renderTarget)}renderStart({target:t,clear:e,clearColor:i,frame:s}){this._renderTargetStack.length=0,this.push(t,e,i,s),this.rootViewPort.copyFrom(this.viewport),this.rootRenderTarget=this.renderTarget,this.renderingToScreen=F0(this.rootRenderTarget)}postrender(){var t,e;(e=(t=this.adaptor).postrender)==null||e.call(t,this.rootRenderTarget)}bind(t,e=!0,i,s){const n=this.getRenderTarget(t),a=this.renderTarget!==n;this.renderTarget=n,this.renderSurface=t;const o=this.getGpuRenderTarget(n);(n.pixelWidth!==o.width||n.pixelHeight!==o.height)&&(this.adaptor.resizeGpuRenderTarget(n),o.width=n.pixelWidth,o.height=n.pixelHeight);const u=n.colorTexture,l=this.viewport,c=u.pixelWidth,h=u.pixelHeight;if(!s&&t instanceof w&&(s=t.frame),s){const f=u._resolution;l.x=s.x*f+.5|0,l.y=s.y*f+.5|0,l.width=s.width*f+.5|0,l.height=s.height*f+.5|0}else l.x=0,l.y=0,l.width=c,l.height=h;return O0(this.projectionMatrix,0,0,l.width/u.resolution,l.height/u.resolution,!n.isRoot),this.adaptor.startRenderPass(n,e,i,l),a&&this.onRenderTargetChange.emit(n),n}clear(t,e=At.ALL,i){e&&(t&&(t=this.getRenderTarget(t)),this.adaptor.clear(t||this.renderTarget,e,i,this.viewport))}contextChange(){this._gpuRenderTargetHash=Object.create(null)}push(t,e=At.ALL,i,s){const n=this.bind(t,e,i,s);return this._renderTargetStack.push({renderTarget:n,frame:s}),n}pop(){this._renderTargetStack.pop();const t=this._renderTargetStack[this._renderTargetStack.length-1];this.bind(t.renderTarget,!1,null,t.frame)}getRenderTarget(t){var e;return t.isTexture&&(t=t.source),(e=this._renderSurfaceToRenderTargetHash.get(t))!=null?e:this._initRenderTarget(t)}copyToTexture(t,e,i,s,n){i.x<0&&(s.width+=i.x,n.x-=i.x,i.x=0),i.y<0&&(s.height+=i.y,n.y-=i.y,i.y=0);const{pixelWidth:a,pixelHeight:o}=t;return s.width=Math.min(s.width,a-i.x),s.height=Math.min(s.height,o-i.y),this.adaptor.copyToTexture(t,e,i,s,n)}ensureDepthStencil(){this.renderTarget.stencil||(this.renderTarget.stencil=!0,this.adaptor.startRenderPass(this.renderTarget,!1,null,this.viewport))}destroy(){this._renderer=null,this._renderSurfaceToRenderTargetHash.forEach((t,e)=>{t!==e&&t.destroy()}),this._renderSurfaceToRenderTargetHash.clear(),this._gpuRenderTargetHash=Object.create(null)}_initRenderTarget(t){let e=null;return ae.test(t)&&(t=ol(t).source),t instanceof yn?e=t:t instanceof et&&(e=new yn({colorTextures:[t]}),ae.test(t.source.resource)&&(e.isRoot=!0),t.once("destroy",()=>{e.destroy(),this._renderSurfaceToRenderTargetHash.delete(t);const i=this._gpuRenderTargetHash[e.uid];i&&(this._gpuRenderTargetHash[e.uid]=null,this.adaptor.destroyGpuRenderTarget(i))})),this._renderSurfaceToRenderTargetHash.set(t,e),e}getGpuRenderTarget(t){return this._gpuRenderTargetHash[t.uid]||(this._gpuRenderTargetHash[t.uid]=this.adaptor.initGpuRenderTarget(t))}}class ll extends ul{constructor(t){super(t),this.adaptor=new D0,this.adaptor.init(t,this)}}ll.extension={type:[v.WebGLSystem],name:"renderTarget"};class xn extends Rt{constructor({buffer:t,offset:e,size:i}){super(),this.uid=J("buffer"),this._resourceType="bufferResource",this._touched=0,this._resourceId=J("resource"),this._bufferResource=!0,this.destroyed=!1,this.buffer=t,this.offset=e|0,this.size=i,this.buffer.on("change",this.onBufferChange,this)}onBufferChange(){this._resourceId=J("resource"),this.emit("change",this)}destroy(t=!1){this.destroyed=!0,t&&this.buffer.destroy(),this.emit("change",this),this.buffer=null}}function N0(r,t){const e=[],i=[`
var g = s.groups;
var sS = r.shader;
var p = s.glProgram;
var ugS = r.uniformGroup;
var resources;
`];let s=!1,n=0,a=0;const o=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 f=c.resources[h];if(f instanceof ot)f.ubo?e.push(`
sS.bindUniformBlock(
resources[${h}],
sS._uniformBindMap[${l}[${h}],
${n++}
);
`):e.push(`
ugS.updateUniformGroup(resources[${h}], p, sD);
`);else if(f instanceof xn)e.push(`
sS.bindUniformBlock(
resources[${h}],
sS._uniformBindMap[${l}[${h}],
${n++}
);
`);else if(f instanceof et){const p=r._uniformBindMap[l][h],m=o.uniformData[p];m&&(s||(s=!0,i.push(`
var tS = r.texture;
`)),t._gl.uniform1i(m.location,a),e.push(`
tS.bind(resources[${h}], ${a});
`),a++)}}}const u=[...i,...e].join(`
`);return new Function("r","s","sD",u)}class X3{}class $0{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 cl(r,t,e){const i=r.createShader(t);return r.shaderSource(i,e),r.compileShader(i),i}function hl(r){const t=new Array(r);for(let e=0;e<t.length;e++)t[e]=!1;return t}function dl(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 hl(2*t);case"bvec3":return hl(3*t);case"bvec4":return hl(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 vn=null;const H0={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"},z3={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 fl(r,t){if(!vn){const e=Object.keys(H0);vn={};for(let i=0;i<e.length;++i){const s=e[i];vn[r[s]]=H0[s]}}return vn[t]}function X0(r,t){const e=fl(r,t);return z3[e]||"float32"}function z0(r,t,e=!1){const i={},s=t.getProgramParameter(r,t.ACTIVE_ATTRIBUTES);for(let a=0;a<s;a++){const o=t.getActiveAttrib(r,a);if(o.name.startsWith("gl_"))continue;const u=X0(t,o.type);i[o.name]={location:0,format:u,stride:sr(u).stride,offset:0,instance:!1,start:0}}const n=Object.keys(i);if(e){n.sort((a,o)=>a>o?1:-1);for(let a=0;a<n.length;a++)i[n[a]].location=a,t.bindAttribLocation(r,a,n[a]);t.linkProgram(r)}else for(let a=0;a<n.length;a++)i[n[a]].location=t.getAttribLocation(r,n[a]);return i}function j0(r,t){if(!t.ACTIVE_UNIFORM_BLOCKS)return{};const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORM_BLOCKS);for(let s=0;s<i;s++){const n=t.getActiveUniformBlockName(r,s),a=t.getUniformBlockIndex(r,n),o=t.getActiveUniformBlockParameter(r,s,t.UNIFORM_BLOCK_DATA_SIZE);e[n]={name:n,index:a,size:o}}return e}function V0(r,t){const e={},i=t.getProgramParameter(r,t.ACTIVE_UNIFORMS);for(let s=0;s<i;s++){const n=t.getActiveUniform(r,s),a=n.name.replace(/\[.*?\]$/,""),o=!!n.name.match(/\[.*?\]$/),u=fl(t,n.type);e[a]={name:a,index:s,type:u,size:n.size,isArray:o,value:dl(u,n.size)}}return e}function W0(r,t){const e=r.getShaderSource(t).split(`
`).map((l,c)=>`${c}: ${l}`),i=r.getShaderInfoLog(t),s=i.split(`
`),n={},a=s.map(l=>parseFloat(l.replace(/^ERROR\: 0\:([\d]+)\:.*$/,"$1"))).filter(l=>l&&!n[l]?(n[l]=!0,!0):!1),o=[""];a.forEach(l=>{e[l-1]=`%c${e[l-1]}%c`,o.push("background: #FF0000; color:#FFFFFF; font-size: 10px","font-size: 10px")});const u=e.join(`
`);o[0]=u,console.error(i),console.groupCollapsed("click to view full shader code"),console.warn(...o),console.groupEnd()}function Y0(r,t,e,i){r.getProgramParameter(t,r.LINK_STATUS)||(r.getShaderParameter(e,r.COMPILE_STATUS)||W0(r,e),r.getShaderParameter(i,r.COMPILE_STATUS)||W0(r,i),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=cl(r,r.VERTEX_SHADER,t.vertex),i=cl(r,r.FRAGMENT_SHADER,t.fragment),s=r.createProgram();r.attachShader(s,e),r.attachShader(s,i);const n=t.transformFeedbackVaryings;n&&(typeof r.transformFeedbackVaryings!="function"||r.transformFeedbackVaryings(s,n.names,n.bufferMode==="separate"?r.SEPARATE_ATTRIBS:r.INTERLEAVED_ATTRIBS)),r.linkProgram(s),r.getProgramParameter(s,r.LINK_STATUS)||Y0(r,s,e,i),t._attributeData=z0(s,r,!/^[ \t]*#[ \t]*version[ \t]+300[ \t]+es[ \t]*$/m.test(t.vertex)),t._uniformData=V0(s,r),t._uniformBlockData=j0(s,r),r.deleteShader(e),r.deleteShader(i);const a={};for(const o in t._uniformData){const u=t._uniformData[o];a[o]={location:r.getUniformLocation(s,o),value:dl(u.type,u.size)}}return new $0(s,a)}const Tn={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=Oe()}bind(t,e){if(this._setProgram(t.glProgram),e)return;Tn.textureCount=0,Tn.blockIndex=0;let i=this._shaderSyncFunctions[t.glProgram._key];i||(i=this._shaderSyncFunctions[t.glProgram._key]=this._generateShaderSync(t,this)),i(this._renderer,t,Tn)}updateUniformGroup(t){this._renderer.uniformGroup.updateUniformGroup(t,this._activeProgram,Tn)}bindUniformBlock(t,e,i=0){const s=this._renderer.buffer,n=this._getProgramData(this._activeProgram),a=t._bufferResource;a&&this._renderer.ubo.updateUniformGroup(t),s.updateBuffer(t.buffer);let o=this._boundUniformsIdsToIndexHash[t.uid];if(o===void 0){const c=this._nextIndex++%this._maxBindings,h=this._boundIndexToUniformsHash[c];h&&(this._boundUniformsIdsToIndexHash[h.uid]=void 0),o=this._boundUniformsIdsToIndexHash[t.uid]=c,this._boundIndexToUniformsHash[c]=t,a?s.bindBufferRange(t.buffer,c,t.offset):s.bindBufferBase(t.buffer,c)}const u=this._gl,l=this._activeProgram._uniformBlockData[e].index;n.uniformBlockBindings[i]!==o&&(n.uniformBlockBindings[i]=o,u.uniformBlockBinding(n.program,l,o))}_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 N0(t,e)}}pl.extension={type:[v.WebGLSystem],name:"shader"};const K0={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);"},Z0={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 Q0(r,t){const e=[`
var v = null;
var cv = null;
var cu = null;
var t = 0;
var gl = renderer.gl;
var name = null;
`];for(const i in r.uniforms){if(!t[i]){r.uniforms[i]instanceof ot?r.uniforms[i].ubo?e.push(`
renderer.shader.bindUniformBlock(uv.${i}, "${i}");
`):e.push(`
renderer.shader.updateUniformGroup(uv.${i});
`):r.uniforms[i]instanceof xn&&e.push(`
renderer.shader.bindBufferResource(uv.${i}, "${i}");
`);continue}const s=r.uniformStructures[i];let n=!1;for(let a=0;a<ve.length;a++){const o=ve[a];if(s.type===o.type&&o.test(s)){e.push(`name = "${i}";`,ve[a].uniform),n=!0;break}}if(!n){const a=(s.size===1?K0:Z0)[s.type].replace("location",`ud["${i}"].location`);e.push(`
cu = ud["${i}"];
cv = cu.value;
v = uv["${i}"];
${a};`)}}return new Function("ud","uv","renderer","syncData",e.join(`
`))}class ml{constructor(t){this._cache={},this._uniformGroupSyncHash={},this._renderer=t,this.gl=null,this._cache={}}contextChange(t){this.gl=t}updateUniformGroup(t,e,i){const s=this._renderer.shader._getProgramData(e);(!t.isStatic||t._dirtyId!==s.uniformDirtyGroups[t.uid])&&(s.uniformDirtyGroups[t.uid]=t._dirtyId,this._getUniformSyncFunction(t,e)(s.uniformData,t.uniforms,this._renderer,i))}_getUniformSyncFunction(t,e){var i;return((i=this._uniformGroupSyncHash[t._signature])==null?void 0:i[e._key])||this._createUniformSyncFunction(t,e)}_createUniformSyncFunction(t,e){const i=this._uniformGroupSyncHash[t._signature]||(this._uniformGroupSyncHash[t._signature]={}),s=this._getSignature(t,e._uniformData,"u");return this._cache[s]||(this._cache[s]=this._generateUniformsSync(t,e._uniformData)),i[e._key]=this._cache[s],i[e._key]}_generateUniformsSync(t,e){return Q0(t,e)}_getSignature(t,e,i){const s=t.uniforms,n=[`${i}-`];for(const a in s)n.push(a),e[a]&&n.push(e[a].type);return n.join("-")}destroy(){this._renderer=null,this._cache=null}}ml.extension={type:[v.WebGLSystem],name:"uniformGroup"};function j3(r){return r=r.replaceAll("texture2D","texture").replaceAll("gl_FragColor","finalColor").replaceAll("varying","in"),r=`
out vec4 finalColor;
${r}
`,r}const V3={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 W3(r){return V3[r]}function J0(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 $.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 Y3=0,q3=1,K3=2,Z3=3,Q3=4,J3=5,t2=class yc{constructor(){this.gl=null,this.stateId=0,this.polygonOffset=0,this.blendMode="none",this._blendEq=!1,this.map=[],this.map[Y3]=this.setBlend,this.map[q3]=this.setOffset,this.map[K3]=this.setCullFace,this.map[Z3]=this.setDepthTest,this.map[Q3]=this.setFrontFace,this.map[J3]=this.setDepthMask,this.checks=[],this.defaultState=Ht.for2d()}contextChange(t){this.gl=t,this.blendModesMap=J0(t),this.reset()}set(t){if(t=t||this.defaultState,this.stateId!==t.data){let e=this.stateId^t.data,i=0;for(;e;)e&1&&this.map[i].call(this,!!(t.data&1<<i)),e=e>>1,i++;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(yc._checkBlendMode,t),this.gl[t?"enable":"disable"](this.gl.BLEND)}setOffset(t){this._updateCheck(yc._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],i=this.gl;e.length===2?i.blendFunc(e[0],e[1]):i.blendFuncSeparate(e[0],e[1],e[2],e[3]),e.length===6?(this._blendEq=!0,i.blendEquationSeparate(e[4],e[5])):this._blendEq&&(this._blendEq=!1,i.blendEquationSeparate(i.FUNC_ADD,i.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 i=this.checks.indexOf(t);e&&i===-1?this.checks.push(t):!e&&i!==-1&&this.checks.splice(i,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}};t2.extension={type:[v.WebGLSystem],name:"state"};let e2=t2;class r2{constructor(t){this.target=Ku.TEXTURE_2D,this.texture=t,this.width=-1,this.height=-1,this.type=j.UNSIGNED_BYTE,this.internalFormat=bn.RGBA,this.format=bn.RGBA,this.samplerType=0}}const i2={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}},tw={"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},s2={id:"compressed",upload(r,t,e){e.pixelStorei(e.UNPACK_ALIGNMENT,4);let i=r.pixelWidth,s=r.pixelHeight;const n=!!tw[r.format];for(let a=0;a<r.resource.length;a++){const o=r.resource[a];n?e.compressedTexImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,o):e.texImage2D(e.TEXTURE_2D,a,t.internalFormat,i,s,0,t.format,t.type,o),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},gl={id:"image",upload(r,t,e,i){const s=r.alphaMode==="premultiply-alpha-on-upload";e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,s);const n=t.width,a=t.height,o=r.pixelWidth,u=r.pixelHeight,l=r.resourceWidth,c=r.resourceHeight;l<o||c<u?((n!==o||a!==u)&&e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,null),i===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===o||a===u?e.texSubImage2D(e.TEXTURE_2D,0,0,0,t.format,t.type,r.resource):i===2?e.texImage2D(t.target,0,t.internalFormat,o,u,0,t.format,t.type,r.resource):e.texImage2D(t.target,0,t.internalFormat,t.format,t.type,r.resource),t.width=o,t.height=u}},n2={id:"video",upload(r,t,e,i){if(!r.isValid){e.texImage2D(t.target,0,t.internalFormat,1,1,0,t.format,t.type,null);return}gl.upload(r,t,e,i)}},_l={linear:9729,nearest:9728},a2={linear:{linear:9987,nearest:9985},nearest:{linear:9986,nearest:9984}},Sn={"clamp-to-edge":33071,repeat:10497,"mirror-repeat":33648},o2={never:512,less:513,equal:514,"less-equal":515,greater:516,"not-equal":517,"greater-equal":518,always:519};function bl(r,t,e,i,s,n,a,o){const u=n;if(!o||r.addressModeU!=="repeat"||r.addressModeV!=="repeat"||r.addressModeW!=="repeat"){const l=Sn[a?"clamp-to-edge":r.addressModeU],c=Sn[a?"clamp-to-edge":r.addressModeV],h=Sn[a?"clamp-to-edge":r.addressModeW];t[s](u,t.TEXTURE_WRAP_S,l),t[s](u,t.TEXTURE_WRAP_T,c),t.TEXTURE_WRAP_R&&t[s](u,t.TEXTURE_WRAP_R,h)}if((!o||r.magFilter!=="linear")&&t[s](u,t.TEXTURE_MAG_FILTER,_l[r.magFilter]),e){if(!o||r.mipmapFilter!=="linear"){const l=a2[r.minFilter][r.mipmapFilter];t[s](u,t.TEXTURE_MIN_FILTER,l)}}else t[s](u,t.TEXTURE_MIN_FILTER,_l[r.minFilter]);if(i&&r.maxAnisotropy>1){const l=Math.min(r.maxAnisotropy,t.getParameter(i.MAX_TEXTURE_MAX_ANISOTROPY_EXT));t[s](u,i.TEXTURE_MAX_ANISOTROPY_EXT,l)}r.compare&&t[s](u,t.TEXTURE_COMPARE_FUNC,o2[r.compare])}function u2(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 ew=Object.defineProperty,rw=Object.defineProperties,iw=Object.getOwnPropertyDescriptors,l2=Object.getOwnPropertySymbols,sw=Object.prototype.hasOwnProperty,nw=Object.prototype.propertyIsEnumerable,c2=(r,t,e)=>t in r?ew(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Le=(r,t)=>{for(var e in t||(t={}))sw.call(t,e)&&c2(r,e,t[e]);if(l2)for(var e of l2(t))nw.call(t,e)&&c2(r,e,t[e]);return r},aw=(r,t)=>rw(r,iw(t));function h2(r,t){let e={},i=r.RGBA;return r instanceof $.get().getWebGLRenderingContext()?t.srgb&&(e={"rgba8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT,"bgra8unorm-srgb":t.srgb.SRGB8_ALPHA8_EXT}):(e={"rgba8unorm-srgb":r.SRGB8_ALPHA8,"bgra8unorm-srgb":r.SRGB8_ALPHA8},i=r.RGBA8),Le(Le(Le(Le(Le(Le(aw(Le({r8unorm:r.R8,r8snorm:r.R8_SNORM,r8uint:r.R8UI,r8sint:r.R8I,r16uint:r.R16UI,r16sint:r.R16I,r16float:r.R16F,rg8unorm:r.RG8,rg8snorm:r.RG8_SNORM,rg8uint:r.RG8UI,rg8sint:r.RG8I,r32uint:r.R32UI,r32sint:r.R32I,r32float:r.R32F,rg16uint:r.RG16UI,rg16sint:r.RG16I,rg16float:r.RG16F,rgba8unorm:r.RGBA},e),{rgba8snorm:r.RGBA8_SNORM,rgba8uint:r.RGBA8UI,rgba8sint:r.RGBA8I,bgra8unorm:i,rgb9e5ufloat:r.RGB9_E5,rgb10a2unorm:r.RGB10_A2,rg11b10ufloat:r.R11F_G11F_B10F,rg32uint:r.RG32UI,rg32sint:r.RG32I,rg32float:r.RG32F,rgba16uint:r.RGBA16UI,rgba16sint:r.RGBA16I,rgba16float:r.RGBA16F,rgba32uint:r.RGBA32UI,rgba32sint:r.RGBA32I,rgba32float:r.RGBA32F,stencil8:r.STENCIL_INDEX8,depth16unorm:r.DEPTH_COMPONENT16,depth24plus:r.DEPTH_COMPONENT24,"depth24plus-stencil8":r.DEPTH24_STENCIL8,depth32float:r.DEPTH_COMPONENT32F,"depth32float-stencil8":r.DEPTH32F_STENCIL8}),t.s3tc?{"bc1-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT1_EXT,"bc2-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT3_EXT,"bc3-rgba-unorm":t.s3tc.COMPRESSED_RGBA_S3TC_DXT5_EXT}:{}),t.s3tc_sRGB?{"bc1-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,"bc2-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,"bc3-rgba-unorm-srgb":t.s3tc_sRGB.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}:{}),t.rgtc?{"bc4-r-unorm":t.rgtc.COMPRESSED_RED_RGTC1_EXT,"bc4-r-snorm":t.rgtc.COMPRESSED_SIGNED_RED_RGTC1_EXT,"bc5-rg-unorm":t.rgtc.COMPRESSED_RED_GREEN_RGTC2_EXT,"bc5-rg-snorm":t.rgtc.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}:{}),t.bptc?{"bc6h-rgb-float":t.bptc.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,"bc6h-rgb-ufloat":t.bptc.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,"bc7-rgba-unorm":t.bptc.COMPRESSED_RGBA_BPTC_UNORM_EXT,"bc7-rgba-unorm-srgb":t.bptc.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT}:{}),t.etc?{"etc2-rgb8unorm":t.etc.COMPRESSED_RGB8_ETC2,"etc2-rgb8unorm-srgb":t.etc.COMPRESSED_SRGB8_ETC2,"etc2-rgb8a1unorm":t.etc.COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgb8a1unorm-srgb":t.etc.COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,"etc2-rgba8unorm":t.etc.COMPRESSED_RGBA8_ETC2_EAC,"etc2-rgba8unorm-srgb":t.etc.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,"eac-r11unorm":t.etc.COMPRESSED_R11_EAC,"eac-rg11unorm":t.etc.COMPRESSED_SIGNED_RG11_EAC}:{}),t.astc?{"astc-4x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_4x4_KHR,"astc-4x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,"astc-5x4-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x4_KHR,"astc-5x4-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,"astc-5x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_5x5_KHR,"astc-5x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,"astc-6x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x5_KHR,"astc-6x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,"astc-6x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_6x6_KHR,"astc-6x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,"astc-8x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x5_KHR,"astc-8x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,"astc-8x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x6_KHR,"astc-8x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,"astc-8x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_8x8_KHR,"astc-8x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,"astc-10x5-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x5_KHR,"astc-10x5-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,"astc-10x6-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x6_KHR,"astc-10x6-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,"astc-10x8-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x8_KHR,"astc-10x8-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,"astc-10x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_10x10_KHR,"astc-10x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,"astc-12x10-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x10_KHR,"astc-12x10-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,"astc-12x12-unorm":t.astc.COMPRESSED_RGBA_ASTC_12x12_KHR,"astc-12x12-unorm-srgb":t.astc.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR}:{})}function d2(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 ow(r){r instanceof Uint8ClampedArray&&(r=new Uint8Array(r.buffer));const t=r.length;for(let e=0;e<t;e+=4){const i=r[e+3];if(i!==0){const s=255.001/i;r[e]=r[e]*s+.5,r[e+1]=r[e+1]*s+.5,r[e+2]=r[e+2]*s+.5}}}const uw=4;class yl{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:gl,buffer:i2,video:n2,compressed:s2},this._useSeparateSamplers=!1,this._renderer=t}contextChange(t){this._gl=t,this._mapFormatToInternalFormat||(this._mapFormatToInternalFormat=h2(t,this._renderer.context.extensions),this._mapFormatToType=d2(t),this._mapFormatToFormat=u2(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(w.EMPTY,e)}initSource(t){this.bind(t)}bind(t,e=0){const i=t.source;t?(this.bindSource(i,e),this._useSeparateSamplers&&this._bindSampler(i.style,e)):(this.bindSource(null,e),this._useSeparateSamplers&&this._bindSampler(null,e))}bindSource(t,e=0){const i=this._gl;if(t._touched=this._renderer.textureGC.count,this._boundTextures[e]!==t){this._boundTextures[e]=t,this._activateLocation(e),t=t||w.EMPTY.source;const s=this.getGlSource(t);i.bindTexture(s.target,s.texture)}}_bindSampler(t,e=0){const i=this._gl;if(!t){this._boundSamplers[e]=null,i.bindSampler(e,null);return}const s=this._getGlSampler(t);this._boundSamplers[e]!==s&&(this._boundSamplers[e]=s,i.bindSampler(e,s))}unbind(t){const e=t.source,i=this._boundTextures,s=this._gl;for(let n=0;n<i.length;n++)if(i[n]===e){this._activateLocation(n);const a=this.getGlSource(e);s.bindTexture(a.target,null),i[n]=null}}_activateLocation(t){this._activeTextureLocation!==t&&(this._activeTextureLocation=t,this._gl.activeTexture(this._gl.TEXTURE0+t))}_initSource(t){const e=this._gl,i=new r2(e.createTexture());if(i.type=this._mapFormatToType[t.format],i.internalFormat=this._mapFormatToInternalFormat[t.format],i.format=this._mapFormatToFormat[t.format],t.autoGenerateMipmaps&&(this._renderer.context.supports.nonPowOf2mipmaps||t.isPowerOfTwo)){const s=Math.max(t.width,t.height);t.mipLevelCount=Math.floor(Math.log2(s))+1}return this._glTextures[t.uid]=i,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),i}onStyleChange(t){this.updateStyle(t,!1)}updateStyle(t,e){const i=this._gl,s=this.getGlSource(t);i.bindTexture(i.TEXTURE_2D,s.texture),this._boundTextures[this._activeTextureLocation]=t,bl(t.style,i,t.mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"texParameteri",i.TEXTURE_2D,!this._renderer.context.supports.nonPowOf2wrapping&&!t.isPowerOfTwo,e)}onSourceUnload(t){const e=this._glTextures[t.uid];e&&(this.unbind(t),this._glTextures[t.uid]=null,this._gl.deleteTexture(e.texture))}onSourceUpdate(t){const e=this._gl,i=this.getGlSource(t);e.bindTexture(e.TEXTURE_2D,i.texture),this._boundTextures[this._activeTextureLocation]=t,this._uploads[t.uploadMethodId]?this._uploads[t.uploadMethodId].upload(t,i,e,this._renderer.context.webGLVersion):e.texImage2D(e.TEXTURE_2D,0,e.RGBA,t.pixelWidth,t.pixelHeight,0,e.RGBA,e.UNSIGNED_BYTE,null),t.autoGenerateMipmaps&&t.mipLevelCount>1&&this.onUpdateMipmaps(t,!1)}onUpdateMipmaps(t,e=!0){e&&this.bindSource(t,0);const i=this.getGlSource(t);this._gl.generateMipmap(i.target)}onSourceDestroy(t){t.off("destroy",this.onSourceDestroy,this),t.off("update",this.onSourceUpdate,this),t.off("resize",this.onSourceUpdate,this),t.off("unload",this.onSourceUnload,this),t.off("styleChange",this.onStyleChange,this),t.off("updateMipmaps",this.onUpdateMipmaps,this),this.managedTextures.splice(this.managedTextures.indexOf(t),1),this.onSourceUnload(t)}_initSampler(t){const e=this._gl,i=this._gl.createSampler();return this._glSamplers[t._resourceId]=i,bl(t,e,this._boundTextures[this._activeTextureLocation].mipLevelCount>1,this._renderer.context.extensions.anisotropicFiltering,"samplerParameteri",i,!1,!0),this._glSamplers[t._resourceId]}_getGlSampler(t){return this._glSamplers[t._resourceId]||this._initSampler(t)}getGlSource(t){return this._glTextures[t.uid]||this._initSource(t)}generateCanvas(t){const{pixels:e,width:i,height:s}=this.getPixels(t),n=$.get().createCanvas();n.width=i,n.height=s;const a=n.getContext("2d");if(a){const o=a.createImageData(i,s);o.data.set(e),a.putImageData(o,0,0)}return n}getPixels(t){const e=t.source.resolution,i=t.frame,s=Math.max(Math.round(i.width*e),1),n=Math.max(Math.round(i.height*e),1),a=new Uint8Array(uw*s*n),o=this._renderer,u=o.renderTarget.getRenderTarget(t),l=o.renderTarget.getGpuRenderTarget(u),c=o.gl;return c.bindFramebuffer(c.FRAMEBUFFER,l.resolveTargetFramebuffer),c.readPixels(Math.round(i.x*e),Math.round(i.y*e),s,n,c.RGBA,c.UNSIGNED_BYTE,a),{pixels:new Uint8ClampedArray(a.buffer),width:s,height:n}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null,this._renderer=null}}yl.extension={type:[v.WebGLSystem],name:"texture"};class xl{init(){const t=new ot({uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uRound:{value:0,type:"f32"}}),e=Oe(),i=or({name:"graphics",bits:[ds,ps(e),Ns,lr]});this.shader=new Ut({glProgram:i,resources:{localUniforms:t,batchSamplers:ms(e)}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,a=n.graphicsContext,{batcher:o,instructions:u}=a.getContextRenderData(i);s.groups[0]=n.globalUniforms.bindGroup,n.state.set(t.state),n.shader.bind(s),n.geometry.bind(o.geometry,s.glProgram);const l=u.instructions;for(let c=0;c<u.instructionSize;c++){const h=l[c];if(h.size){for(let f=0;f<h.textures.count;f++)n.texture.bind(h.textures.textures[f],f);n.geometry.draw("triangle-list",h.size,h.start)}}}destroy(){this.shader.destroy(!0),this.shader=null}}xl.extension={type:[v.WebGLPipesAdaptor],name:"graphics"};class vl{init(){const t=or({name:"mesh",bits:[Ns,l0,lr]});this._shader=new Ut({glProgram:t,resources:{uTexture:w.EMPTY.source,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(s){if(!s.glProgram)return}else{s=this._shader;const n=e.texture,a=n.source;s.resources.uTexture=a,s.resources.uSampler=a.style,s.resources.textureUniforms.uniforms.uTextureMatrix=n.textureMatrix.mapCoord}s.groups[100]=i.globalUniforms.bindGroup,s.groups[101]=t.localUniformsBindGroup,i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}vl.extension={type:[v.WebGLPipesAdaptor],name:"mesh"};class Tl{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}}Tl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"customRender"};function Sl(r,t){const e=r.instructionSet,i=e.instructions;for(let s=0;s<e.instructionSize;s++){const n=i[s];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}),Sl(t,this._renderer.renderPipes),this._renderer.globalUniforms.pop())}destroy(){this._renderer=null}}Al.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"renderGroup"};function An(r,t){t||(t=0);for(let e=t;e<r.length&&r[e];e++)r[e]=null}function El(r,t=[]){t.push(r);for(let e=0;e<r.renderGroupChildren.length;e++)El(r.renderGroupChildren[e],t);return t}function wl(r,t,e){const i=r>>16&255,s=r>>8&255,n=r&255,a=t>>16&255,o=t>>8&255,u=t&255,l=i+(a-i)*e,c=s+(o-s)*e,h=n+(u-n)*e;return(l<<16)+(c<<8)+h}const Ar=16777215;function Cl(r,t){return r===Ar||t===Ar?r+t-Ar:wl(r,t,.5)}function lw(r,t,e){const i=(e>>24&255)/255,s=t*i*255,n=((r&255)<<16)+(r&65280)+(r>>16&255),a=e&16777215;let o;return n===Ar||a===Ar?o=n+a-Ar:o=wl(n,a,.5),o+(s<<24)}const cw=new rt,f2=tr|Wr|rs;function Rl(r,t=!1){p2(r);const e=r.childrenToUpdate,i=r.updateTick++;for(const s in e){const n=Number(s),a=e[s],o=a.list,u=a.index;for(let l=0;l<u;l++){const c=o[l];c.parentRenderGroup===r&&c.relativeRenderGroupDepth===n&&Pl(c,i,0)}An(o,u),a.index=0}if(t)for(let s=0;s<r.renderGroupChildren.length;s++)Rl(r.renderGroupChildren[s],t)}function p2(r){const t=r.root;let e;if(r.renderGroupParent){const i=r.renderGroupParent;r.worldTransform.appendFrom(t.relativeGroupTransform,i.worldTransform),r.worldColor=Cl(t.groupColor,i.worldColor),e=t.groupAlpha*i.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 Pl(r,t,e){if(t===r.updateTick)return;r.updateTick=t,r.didChange=!1;const i=r.localTransform;r.updateLocalTransform();const s=r.parent;if(s&&!s.renderGroup?(e=e|r._updateFlags,r.relativeGroupTransform.appendFrom(i,s.relativeGroupTransform),e&f2&&m2(r,s,e)):(e=r._updateFlags,r.relativeGroupTransform.copyFrom(i),e&f2&&m2(r,cw,e)),!r.renderGroup){const n=r.children,a=n.length;for(let u=0;u<a;u++)Pl(n[u],t,e);const o=r.parentRenderGroup;r.renderPipeId&&!o.structureDidChange&&o.updateRenderable(r)}}function m2(r,t,e){if(e&Wr){r.groupColor=Cl(r.localColor,t.groupColor);let i=r.localAlpha*t.groupAlpha;i=i<0?0:i>1?1:i,r.groupAlpha=i,r.groupColorAlpha=r.groupColor+((i*255|0)<<24)}e&rs&&(r.groupBlendMode=r.localBlendMode==="inherit"?t.groupBlendMode:r.localBlendMode),e&tr&&(r.globalDisplayStatus=r.localDisplayStatus&t.globalDisplayStatus),r._updateFlags=0}function g2(r,t){const{list:e,index:i}=r.childrenRenderablesToUpdate;let s=!1;for(let n=0;n<i;n++){const a=e[n];if(s=t[a.renderPipeId].validateRenderable(a),s)break}return r.structureDidChange=s,s}const hw=new G;class Ml{constructor(t){this._renderer=t}render({container:t,transform:e}){t.isRenderGroup=!0;const i=t.parent,s=t.renderGroup.renderGroupParent;t.parent=null,t.renderGroup.renderGroupParent=null;const n=this._renderer,a=El(t.renderGroup,[]);let o=hw;e&&(o=o.copyFrom(t.renderGroup.localTransform),t.renderGroup.localTransform.copyFrom(e));const u=n.renderPipes;for(let l=0;l<a.length;l++){const c=a[l];c.runOnRender(),c.instructionSet.renderPipes=u,c.structureDidChange?An(c.childrenRenderablesToUpdate.list,0):g2(c,u),Rl(c),c.structureDidChange?(c.structureDidChange=!1,c0(c,n)):dw(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}),Sl(t.renderGroup,u),u.uniformBatch&&u.uniformBatch.renderEnd(),e&&t.renderGroup.localTransform.copyFrom(o),t.parent=i,t.renderGroup.renderGroupParent=s}destroy(){this._renderer=null}}Ml.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"renderGroup"};function dw(r){const{list:t,index:e}=r.childrenRenderablesToUpdate;for(let i=0;i<e;i++){const s=t[i];s.didViewUpdate&&r.updateRenderable(s)}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 i=this._getGpuSprite(t);t._didSpriteUpdate&&this._updateBatchableSprite(t,i),this._renderer.renderPipes.batch.addToBatch(i,e)}updateRenderable(t){const e=this._gpuSpriteHash[t.uid];t._didSpriteUpdate&&this._updateBatchableSprite(t,e),e._batcher.updateElement(e)}validateRenderable(t){const e=t._texture,i=this._getGpuSprite(t);return i.texture._source!==e._source?!i._batcher.checkAndUpdateTexture(i,e):!1}destroyRenderable(t){const e=this._gpuSpriteHash[t.uid];X.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=X.get(Ps);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)X.return(this._gpuSpriteHash[t]);this._gpuSpriteHash=null,this._renderer=null}}Dl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"sprite"};var fw=Object.defineProperty,_2=Object.getOwnPropertySymbols,pw=Object.prototype.hasOwnProperty,mw=Object.prototype.propertyIsEnumerable,b2=(r,t,e)=>t in r?fw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,y2=(r,t)=>{for(var e in t||(t={}))pw.call(t,e)&&b2(r,e,t[e]);if(_2)for(var e of _2(t))mw.call(t,e)&&b2(r,e,t[e]);return r};const Ol=class My{constructor(){this.clearBeforeRender=!0,this._backgroundColor=new V(0),this.color=this._backgroundColor,this.alpha=1}init(t){t=y2(y2({},My.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(){}};Ol.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"background",priority:0},Ol.defaultOptions={backgroundAlpha:1,backgroundColor:0,clearBeforeRender:!0};let x2=Ol;const Ri={};L.handle(v.BlendMode,r=>{if(!r.name)throw new Error("BlendMode extension must have a name property");Ri[r.name]=r.ref},r=>{delete Ri[r.name]});class Bl{constructor(t){this._isAdvanced=!1,this._filterHash=Object.create(null),this._renderer=t}setBlendMode(t,e,i){if(this._activeBlendMode===e){this._isAdvanced&&this._renderableList.push(t);return}this._activeBlendMode=e,this._isAdvanced&&this._endAdvancedBlendMode(i),this._isAdvanced=!!Ri[e],this._isAdvanced&&(this._beginAdvancedBlendMode(i),this._renderableList.push(t))}_beginAdvancedBlendMode(t){this._renderer.renderPipes.batch.break(t);const e=this._activeBlendMode;if(!Ri[e])return;let i=this._filterHash[e];i||(i=this._filterHash[e]=new zr,i.filters=[new Ri[e]]);const s={renderPipeId:"filter",action:"pushFilter",renderables:[],filterEffect:i,canBundle:!1};this._renderableList=s.renderables,t.add(s)}_endAdvancedBlendMode(t){this._renderableList=null,this._renderer.renderPipes.batch.break(t),t.add({renderPipeId:"filter",action:"popFilter",canBundle:!1})}buildStart(){this._isAdvanced=!1}buildEnd(t){this._isAdvanced&&this._endAdvancedBlendMode(t)}destroy(){this._renderer=null,this._renderableList=null;for(const t in this._filterHash)this._filterHash[t].destroy();this._filterHash=null}}Bl.extension={type:[v.WebGLPipes,v.WebGPUPipes,v.CanvasPipes],name:"blendMode"};var gw=Object.defineProperty,v2=Object.getOwnPropertySymbols,_w=Object.prototype.hasOwnProperty,bw=Object.prototype.propertyIsEnumerable,T2=(r,t,e)=>t in r?gw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Gl=(r,t)=>{for(var e in t||(t={}))_w.call(t,e)&&T2(r,e,t[e]);if(v2)for(var e of v2(t))bw.call(t,e)&&T2(r,e,t[e]);return r};const Fl={png:"image/png",jpg:"image/jpeg",webp:"image/webp"},Il=class Dy{constructor(t){this._renderer=t}_normalizeOptions(t,e={}){return t instanceof rt||t instanceof w?Gl({target:t},e):Gl(Gl({},e),t)}async image(t){const e=new Image;return e.src=await this.base64(t),e}async base64(t){t=this._normalizeOptions(t,Dy.defaultImageOptions);const{format:e,quality:i}=t,s=this.canvas(t);if(s.toBlob!==void 0)return new Promise((n,a)=>{s.toBlob(o=>{if(!o){a(new Error("ICanvas.toBlob failed!"));return}const u=new FileReader;u.onload=()=>n(u.result),u.onerror=a,u.readAsDataURL(o)},Fl[e],i)});if(s.toDataURL!==void 0)return s.toDataURL(Fl[e],i);if(s.convertToBlob!==void 0){const n=await s.convertToBlob({type:Fl[e],quality:i});return new Promise((a,o)=>{const u=new FileReader;u.onload=()=>a(u.result),u.onerror=o,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,i=this._renderer;if(e instanceof w)return i.texture.generateCanvas(e);const s=i.textureGenerator.generateTexture(t),n=i.texture.generateCanvas(s);return s.destroy(),n}pixels(t){t=this._normalizeOptions(t);const e=t.target,i=this._renderer,s=e instanceof w?e:i.textureGenerator.generateTexture(t),n=i.texture.getPixels(s);return e instanceof rt&&s.destroy(),n}texture(t){return t=this._normalizeOptions(t),t.target instanceof w?t.target:this._renderer.textureGenerator.generateTexture(t)}download(t){var e;t=this._normalizeOptions(t);const i=this.canvas(t),s=document.createElement("a");s.download=(e=t.filename)!=null?e:"image.png",s.href=i.toDataURL("image/png"),document.body.appendChild(s),s.click(),document.body.removeChild(s)}log(t){var e;const i=(e=t.width)!=null?e:200;t=this._normalizeOptions(t);const s=this.canvas(t),n=s.toDataURL();console.log(`[Pixi Texture] ${s.width}px ${s.height}px`);const a=["font-size: 1px;",`padding: ${i}px 300px;`,`background: url(${n}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",a)}destroy(){this._renderer=null}};Il.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"extract"},Il.defaultImageOptions={format:"png",quality:1};let S2=Il;class En extends w{static create(t){return new En({source:new et(t)})}resize(t,e,i){return this.source.resize(t,e,i),this}}var yw=Object.defineProperty,xw=Object.defineProperties,vw=Object.getOwnPropertyDescriptors,A2=Object.getOwnPropertySymbols,Tw=Object.prototype.hasOwnProperty,Sw=Object.prototype.propertyIsEnumerable,E2=(r,t,e)=>t in r?yw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Aw=(r,t)=>{for(var e in t||(t={}))Tw.call(t,e)&&E2(r,e,t[e]);if(A2)for(var e of A2(t))Sw.call(t,e)&&E2(r,e,t[e]);return r},Ew=(r,t)=>xw(r,vw(t));const ww=new W,Cw=new ft,Rw=[0,0,0,0];class Ul{constructor(t){this._renderer=t}generateTexture(t){var e;t instanceof rt&&(t={target:t,frame:void 0,textureSourceOptions:{},resolution:void 0});const i=t.resolution||this._renderer.resolution,s=t.antialias||this._renderer.view.antialias,n=t.target;let a=t.clearColor;a?a=Array.isArray(a)&&a.length===4?a:V.shared.setValue(a).toArray():a=Rw;const o=((e=t.frame)==null?void 0:e.copyTo(ww))||es(n,Cw).rectangle;o.width=Math.max(o.width,1/i)|0,o.height=Math.max(o.height,1/i)|0;const u=En.create(Ew(Aw({},t.textureSourceOptions),{width:o.width,height:o.height,resolution:i,antialias:s})),l=G.shared.translate(-o.x,-o.y);return this._renderer.render({container:n,transform:l,target:u,clearColor:a}),u.source.updateMipmaps(),u}destroy(){this._renderer=null}}Ul.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGenerator"};class kl{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:i,worldColor:s,offset:n}){const a=this._renderer.renderTarget.renderTarget,o=this._stackIndex?this._globalUniformDataStack[this._stackIndex-1]:{projectionData:a,worldTransformMatrix:new G,worldColor:4294967295,offset:new nt},u={projectionMatrix:e||this._renderer.renderTarget.projectionMatrix,resolution:t||a.size,worldTransformMatrix:i||o.worldTransformMatrix,worldColor:s||o.worldColor,offset:n||o.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,ri(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 Zt,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===St.WEBGL&&this._currentGlobalUniformData.bindGroup.resources[0].update()}get bindGroup(){return this._currentGlobalUniformData.bindGroup}get uniformGroup(){return this._currentGlobalUniformData.bindGroup.resources[0]}_createUniforms(){return new ot({uProjectionMatrix:{value:new G,type:"mat3x3<f32>"},uWorldTransformMatrix:{value:new G,type:"mat3x3<f32>"},uWorldColorAlpha:{value:new Float32Array(4),type:"vec4<f32>"},uResolution:{value:[0,0],type:"vec2<f32>"}},{isStatic:!0})}destroy(){this._renderer=null}}kl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"globalUniforms"};let Pw=1;class Ll{constructor(){this._tasks=[]}init(){gt.system.add(this._update,this)}repeat(t,e){const i=Pw++;return this._tasks.push({func:t,duration:e,start:performance.now(),last:performance.now(),repeat:!0,id:i}),i}cancel(t){for(let e=0;e<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 i=this._tasks[e];if(t-i.last>=i.duration){const s=t-i.start;i.func(s),i.last=t}}}destroy(){gt.system.remove(this._update,this),this._tasks.length=0}}Ll.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"scheduler",priority:0};let w2=!1;function C2(r){if(!w2){if($.get().getNavigator().userAgent.toLowerCase().indexOf("chrome")>-1){const t=[`%c %c %c %c %c PixiJS %c v${_i} (${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 ${_i} - ${r} - http://www.pixijs.com/`);w2=!0}}class wn{constructor(t){this._renderer=t}init(t){if(t.hello){let e=this._renderer.name;this._renderer.type===St.WEBGL&&(e+=` ${this._renderer.context.webGLVersion}`),C2(e)}}}wn.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"hello",priority:-2},wn.defaultOptions={hello:!1};var Mw=Object.defineProperty,R2=Object.getOwnPropertySymbols,Dw=Object.prototype.hasOwnProperty,Ow=Object.prototype.propertyIsEnumerable,P2=(r,t,e)=>t in r?Mw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,M2=(r,t)=>{for(var e in t||(t={}))Dw.call(t,e)&&P2(r,e,t[e]);if(R2)for(var e of R2(t))Ow.call(t,e)&&P2(r,e,t[e]);return r};const Nl=class Oy{constructor(t){this._managedRenderables=[],this._renderer=t}init(t){t=M2(M2({},Oy.defaultOptions),t),this.maxUnusedTime=t.renderableGCMaxUnusedTime,this._frequency=t.renderableGCFrequency,this.enabled=t.renderableGCActive}get enabled(){return!!this._handler}set enabled(t){this.enabled!==t&&(t?this._handler=this._renderer.scheduler.repeat(()=>this.run(),this._frequency):this._renderer.scheduler.cancel(this._handler))}prerender(){this._now=performance.now()}addRenderable(t,e){this.enabled&&(t._lastUsed=this._now,t._lastInstructionTick===-1&&(this._managedRenderables.push(t),t.once("destroyed",this._removeRenderable,this)),t._lastInstructionTick=e.tick)}run(){var t,e,i;const s=performance.now(),n=this._managedRenderables,a=this._renderer.renderPipes;let o=0;for(let u=0;u<n.length;u++){const l=n[u];if(l===null){o++;continue}const c=(t=l.renderGroup)!=null?t:l.parentRenderGroup,h=(i=(e=c==null?void 0:c.instructionSet)==null?void 0:e.tick)!=null?i:-1;l._lastInstructionTick!==h&&s-l._lastUsed>this.maxUnusedTime?(l.destroyed||a[l.renderPipeId].destroyRenderable(l),l._lastInstructionTick=-1,o++,l.off("destroyed",this._removeRenderable,this)):n[u-o]=l}n.length=n.length-o}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:[v.WebGLSystem,v.WebGPUSystem],name:"renderableGC"},Nl.defaultOptions={renderableGCActive:!0,renderableGCMaxUnusedTime:6e4,renderableGCFrequency:3e4};let D2=Nl;var Bw=Object.defineProperty,O2=Object.getOwnPropertySymbols,Gw=Object.prototype.hasOwnProperty,Fw=Object.prototype.propertyIsEnumerable,B2=(r,t,e)=>t in r?Bw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,G2=(r,t)=>{for(var e in t||(t={}))Gw.call(t,e)&&B2(r,e,t[e]);if(O2)for(var e of O2(t))Fw.call(t,e)&&B2(r,e,t[e]);return r};const $l=class By{constructor(t){this._renderer=t,this.count=0,this.checkCount=0}init(t){var e;t=G2(G2({},By.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 i=t[e];i.autoGarbageCollect&&i.resource&&i._touched>-1&&this.count-i._touched>this.maxIdle&&(i._touched=-1,i.unload())}}destroy(){this._renderer=null}};$l.extension={type:[v.WebGLSystem,v.WebGPUSystem],name:"textureGC"},$l.defaultOptions={textureGCActive:!0,textureGCAMaxIdle:null,textureGCMaxIdle:3600,textureGCCheckCountMax:600};let F2=$l;var Iw=Object.defineProperty,I2=Object.getOwnPropertySymbols,Uw=Object.prototype.hasOwnProperty,kw=Object.prototype.propertyIsEnumerable,U2=(r,t,e)=>t in r?Iw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,k2=(r,t)=>{for(var e in t||(t={}))Uw.call(t,e)&&U2(r,e,t[e]);if(I2)for(var e of I2(t))kw.call(t,e)&&U2(r,e,t[e]);return r};const Hl=class Gy{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=k2(k2({},Gy.defaultOptions),t),t.view&&(t.canvas=t.view),this.screen=new W(0,0,t.width,t.height),this.canvas=t.canvas||$.get().createCanvas(),this.antialias=!!t.antialias,this.texture=ol(this.canvas,t),this.renderTarget=new yn({colorTextures:[this.texture],depth:!!t.depth,isRoot:!0}),this.texture.source.transparent=t.backgroundAlpha<1,this.resolution=t.resolution}resize(t,e,i){this.texture.source.resize(t,e,i),this.screen.width=this.texture.frame.width,this.screen.height=this.texture.frame.height}destroy(t=!1){(typeof t=="boolean"?t:t!=null&&t.removeView)&&this.canvas.parentNode&&this.canvas.parentNode.removeChild(this.canvas)}};Hl.extension={type:[v.WebGLSystem,v.WebGPUSystem,v.CanvasSystem],name:"view",priority:0},Hl.defaultOptions={width:800,height:600,autoDensity:!1,antialias:!1};let L2=Hl;const Xl=[x2,kl,wn,L2,Ml,F2,Ul,S2,ou,D2,Ll],zl=[Bl,Xu,Dl,Al,zu,Vu,ju,Tl],Lw=[...Xl,al,S0,g0,Wu,yl,ll,Zu,ml,pl,tl,e2,el,Ju],Nw=[...zl],$w=[Nu,vl,xl],N2=[],$2=[],H2=[];L.handleByNamedList(v.WebGLSystem,N2),L.handleByNamedList(v.WebGLPipes,$2),L.handleByNamedList(v.WebGLPipesAdaptor,H2),L.add(...Lw,...Nw,...$w);class X2 extends fi{constructor(){const t={name:"webgl",type:St.WEBGL,systems:N2,renderPipes:$2,renderPipeAdaptors:H2};super(t)}}var Hw={__proto__:null,WebGLRenderer:X2};class jl{constructor(t){this._hash=Object.create(null),this._renderer=t}contextChange(t){this._gpu=t}getBindGroup(t,e,i){return t._updateKey(),this._hash[t._key]||this._createBindGroup(t,e,i)}_createBindGroup(t,e,i){var s;const n=this._gpu.device,a=e.layout[i],o=[],u=this._renderer;for(const h in a){const f=(s=t.resources[h])!=null?s:t.resources[a[h]];let p;if(f._resourceType==="uniformGroup"){const m=f;u.ubo.updateUniformGroup(m);const _=m.buffer;p={buffer:u.buffer.getGPUBuffer(_),offset:0,size:_.descriptor.size}}else if(f._resourceType==="buffer"){const m=f;p={buffer:u.buffer.getGPUBuffer(m),offset:0,size:m.descriptor.size}}else if(f._resourceType==="bufferResource"){const m=f;p={buffer:u.buffer.getGPUBuffer(m.buffer),offset:m.offset,size:m.size}}else if(f._resourceType==="textureSampler"){const m=f;p=u.texture.getGpuSampler(m)}else if(f._resourceType==="textureSource"){const m=f;p=u.texture.getGpuSource(m).createView({})}o.push({binding:a[h],resource:p})}const l=u.shader.getProgramData(e).bindGroups[i],c=n.createBindGroup({layout:l,entries:o});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}}jl.extension={type:[v.WebGPUSystem],name:"bindGroup"};class Vl{constructor(){this._gpuBuffers=Object.create(null),this._managedBuffers=[]}contextChange(t){this._gpu=t}getGPUBuffer(t){return this._gpuBuffers[t.uid]||this.createGPUBuffer(t)}updateBuffer(t){const e=this._gpuBuffers[t.uid]||this.createGPUBuffer(t),i=t.data;return t._updateID&&i&&(t._updateID=0,this._gpu.device.queue.writeBuffer(e,0,i.buffer,0,(t._updateSize||i.byteLength)+3&-4)),e}destroyAll(){for(const t in this._gpuBuffers)this._gpuBuffers[t].destroy();this._gpuBuffers={}}createGPUBuffer(t){this._gpuBuffers[t.uid]||(t.on("update",this.updateBuffer,this),t.on("change",this.onBufferChange,this),t.on("destroy",this.onBufferDestroy,this),this._managedBuffers.push(t));const e=this._gpu.device.createBuffer(t.descriptor);return t._updateID=0,t.data&&(us(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}}Vl.extension={type:[v.WebGPUSystem],name:"buffer"};function Xw(r,t){const e=r.descriptor.size,i=t.gpu.device,s=new Pt({data:new Float32Array(24e5),usage:z.MAP_READ|z.COPY_DST}),n=t.buffer.createGPUBuffer(s),a=i.createCommandEncoder();a.copyBufferToBuffer(t.buffer.getGPUBuffer(r),0,n,0,e),i.queue.submit([a.finish()]),n.mapAsync(GPUMapMode.READ,0,e).then(()=>{n.getMappedRange(0,e),n.unmap()})}class z2{constructor({minUniformOffsetAlignment:t}){this._minUniformOffsetAlignment=256,this.byteIndex=0,this._minUniformOffsetAlignment=t,this.data=new Float32Array(65535)}clear(){this.byteIndex=0}addEmptyGroup(t){if(t>this._minUniformOffsetAlignment/4)throw new Error(`UniformBufferBatch: array is too large: ${t*4}`);const e=this.byteIndex;let i=e+t*4;if(i=Math.ceil(i/this._minUniformOffsetAlignment)*this._minUniformOffsetAlignment,i>this.data.length*4)throw new Error("UniformBufferBatch: ubo batch got too big");return this.byteIndex=i,e}addGroup(t){const e=this.addEmptyGroup(t.length);for(let i=0;i<t.length;i++)this.data[e/4+i]=t[i];return e}destroy(){this._buffer.destroy(),this._buffer=null,this.data=null}}class Wl{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}}Wl.extension={type:[v.WebGPUSystem],name:"colorMask"};class Cn{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 $.get().getNavigator().gpu.requestAdapter({powerPreference:t.powerPreference,forceFallbackAdapter:t.forceFallbackAdapter}),i=["texture-compression-bc","texture-compression-astc","texture-compression-etc2"].filter(n=>e.features.has(n)),s=await e.requestDevice({requiredFeatures:i});return{adapter:e,device:s}}destroy(){this.gpu=null,this._renderer=null}}Cn.extension={type:[v.WebGPUSystem],name:"device"},Cn.defaultOptions={powerPreference:void 0,forceFallbackAdapter:!1};var zw=Object.defineProperty,j2=Object.getOwnPropertySymbols,jw=Object.prototype.hasOwnProperty,Vw=Object.prototype.propertyIsEnumerable,V2=(r,t,e)=>t in r?zw(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,W2=(r,t)=>{for(var e in t||(t={}))jw.call(t,e)&&V2(r,e,t[e]);if(j2)for(var e of j2(t))Vw.call(t,e)&&V2(r,e,t[e]);return r};class Yl{constructor(t){this._boundBindGroup=Object.create(null),this._boundVertexBuffer=Object.create(null),this._renderer=t}renderStart(){this.commandFinished=new Promise(t=>{this._resolveCommandFinished=t}),this.commandEncoder=this._renderer.gpu.device.createCommandEncoder()}beginRenderPass(t){this.endRenderPass(),this._clearCache(),this.renderPassEncoder=this.commandEncoder.beginRenderPass(t.descriptor)}endRenderPass(){this.renderPassEncoder&&this.renderPassEncoder.end(),this.renderPassEncoder=null}setViewport(t){this.renderPassEncoder.setViewport(t.x,t.y,t.width,t.height,0,1)}setPipelineFromGeometryProgramAndState(t,e,i,s){const n=this._renderer.pipeline.getPipeline(t,e,i,s);this.setPipeline(n)}setPipeline(t){this._boundPipeline!==t&&(this._boundPipeline=t,this.renderPassEncoder.setPipeline(t))}_setVertexBuffer(t,e){this._boundVertexBuffer[t]!==e&&(this._boundVertexBuffer[t]=e,this.renderPassEncoder.setVertexBuffer(t,this._renderer.buffer.updateBuffer(e)))}_setIndexBuffer(t){if(this._boundIndexBuffer===t)return;this._boundIndexBuffer=t;const e=t.data.BYTES_PER_ELEMENT===2?"uint16":"uint32";this.renderPassEncoder.setIndexBuffer(this._renderer.buffer.updateBuffer(t),e)}resetBindGroup(t){this._boundBindGroup[t]=null}setBindGroup(t,e,i){if(this._boundBindGroup[t]===e)return;this._boundBindGroup[t]=e,e._touch(this._renderer.textureGC.count);const s=this._renderer.bindGroup.getBindGroup(e,i,t);this.renderPassEncoder.setBindGroup(t,s)}setGeometry(t,e){const i=this._renderer.pipeline.getBufferNamesToBind(t,e);for(const s in i)this._setVertexBuffer(s,t.attributes[i[s]].buffer);t.indexBuffer&&this._setIndexBuffer(t.indexBuffer)}_setShaderBindGroups(t,e){for(const i in t.groups){const s=t.groups[i];e||this._syncBindGroup(s),this.setBindGroup(i,s,t.gpuProgram)}}_syncBindGroup(t){for(const e in t.resources){const i=t.resources[e];i.isUniformGroup&&this._renderer.ubo.updateUniformGroup(i)}}draw(t){const{geometry:e,shader:i,state:s,topology:n,size:a,start:o,instanceCount:u,skipSync:l}=t;this.setPipelineFromGeometryProgramAndState(e,i.gpuProgram,s,n),this.setGeometry(e,i.gpuProgram),this._setShaderBindGroups(i,l),e.indexBuffer?this.renderPassEncoder.drawIndexed(a||e.indexBuffer.data.length,u||e.instanceCount,o||0):this.renderPassEncoder.draw(a||e.getSize(),u||e.instanceCount,o||0)}finishRenderPass(){this.renderPassEncoder&&(this.renderPassEncoder.end(),this.renderPassEncoder=null)}postrender(){this.finishRenderPass(),this._gpu.device.queue.submit([this.commandEncoder.finish()]),this._resolveCommandFinished(),this.commandEncoder=null}restoreRenderPass(){const t=this._renderer.renderTarget.adaptor.getDescriptor(this._renderer.renderTarget.renderTarget,!1,[0,0,0,1]);this.renderPassEncoder=this.commandEncoder.beginRenderPass(t);const e=this._boundPipeline,i=W2({},this._boundVertexBuffer),s=this._boundIndexBuffer,n=W2({},this._boundBindGroup);this._clearCache();const a=this._renderer.renderTarget.viewport;this.renderPassEncoder.setViewport(a.x,a.y,a.width,a.height,0,1),this.setPipeline(e);for(const o in i)this._setVertexBuffer(o,i[o]);for(const o in n)this.setBindGroup(o,n[o],null);this._setIndexBuffer(s)}_clearCache(){for(let t=0;t<16;t++)this._boundBindGroup[t]=null,this._boundVertexBuffer[t]=null;this._boundIndexBuffer=null,this._boundPipeline=null}destroy(){this._renderer=null,this._gpu=null,this._boundBindGroup=null,this._boundVertexBuffer=null,this._boundIndexBuffer=null,this._boundPipeline=null}contextChange(t){this._gpu=t}}Yl.extension={type:[v.WebGPUSystem],name:"encoder",priority:1};class ql{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:ut.DISABLED,stencilReference:0}),this._activeRenderTarget=t,this.setStencilMode(e.stencilMode,e.stencilReference)}setStencilMode(t,e){const i=this._renderTargetStencilState[this._activeRenderTarget.uid];i.stencilMode=t,i.stencilReference=e;const s=this._renderer;s.pipeline.setStencilMode(t),s.encoder.renderPassEncoder.setStencilReference(e)}destroy(){this._renderer.renderTarget.onRenderTargetChange.remove(this),this._renderer=null,this._activeRenderTarget=null,this._renderTargetStencilState=null}}ql.extension={type:[v.WebGPUSystem],name:"stencil"};const Pi={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 Y2(r){const t=r.map(i=>({data:i,offset:0,size:0}));let e=0;for(let i=0;i<t.length;i++){const s=t[i];let n=Pi[s.data.type].size;const a=Pi[s.data.type].align;if(!Pi[s.data.type])throw new Error(`[Pixi.js] WebGPU UniformBuffer: Unknown type ${s.data.type}`);s.data.size>1&&(n=Math.max(n,a)*s.data.size),e=Math.ceil(e/a)*a,s.size=n,s.offset=e,e+=n}return e=Math.ceil(e/16)*16,{uboElements:t,size:e}}function q2(r,t){const{size:e,align:i}=Pi[r.data.type],s=(i-e)/4;return`
v = uv.${r.data.name};
${t!==0?`offset += ${t};`:""}
arrayOffset = offset;
t = 0;
for(var i=0; i < ${r.data.size*(e/4)}; i++)
{
for(var j = 0; j < ${e/4}; j++)
{
data[arrayOffset++] = v[t++];
}
${s!==0?`arrayOffset += ${s};`:""}
}
`}function K2(r){return sl(r,"uboWgsl",q2,R0)}class Kl extends rl{constructor(){super({createUboElements:Y2,generateUboSync:K2})}}Kl.extension={type:[v.WebGPUSystem],name:"ubo"};const Te=128;class Zl{constructor(t){this._bindGroupHash=Object.create(null),this._buffers=[],this._bindGroups=[],this._bufferResources=[],this._renderer=t,this._batchBuffer=new z2({minUniformOffsetAlignment:Te});const e=256/Te;for(let i=0;i<e;i++){let s=z.UNIFORM|z.COPY_DST;i===0&&(s|=z.COPY_SRC),this._buffers.push(new Pt({data:this._batchBuffer.data,usage:s}))}}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 i=t.buffer.data,s=this._batchBuffer.addEmptyGroup(i.length);return this._renderer.ubo.syncUniformGroup(t,this._batchBuffer.data,s/4),this._bindGroupHash[t.uid]=this._getBindGroup(s/Te),this._bindGroupHash[t.uid]}getUboResource(t){this._renderer.ubo.updateUniformGroup(t);const e=t.buffer.data,i=this._batchBuffer.addGroup(e);return this._getBufferResource(i/Te)}getArrayBindGroup(t){const e=this._batchBuffer.addGroup(t);return this._getBindGroup(e/Te)}getArrayBufferResource(t){const e=this._batchBuffer.addGroup(t)/Te;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:Te})}return this._bufferResources[t]}_getBindGroup(t){if(!this._bindGroups[t]){const e=new Zt({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 i=this._renderer.gpu.device.createCommandEncoder();for(let s=1;s<this._buffers.length;s++){const n=this._buffers[s];i.copyBufferToBuffer(t.getGPUBuffer(e),Te,t.getGPUBuffer(n),0,this._batchBuffer.byteIndex)}this._renderer.gpu.device.queue.submit([i.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}}Zl.extension={type:[v.WebGPUPipes],name:"uniformBatch"};var Ww=Object.defineProperty,Yw=Object.defineProperties,qw=Object.getOwnPropertyDescriptors,Z2=Object.getOwnPropertySymbols,Kw=Object.prototype.hasOwnProperty,Zw=Object.prototype.propertyIsEnumerable,Q2=(r,t,e)=>t in r?Ww(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Qw=(r,t)=>{for(var e in t||(t={}))Kw.call(t,e)&&Q2(r,e,t[e]);if(Z2)for(var e of Z2(t))Zw.call(t,e)&&Q2(r,e,t[e]);return r},Jw=(r,t)=>Yw(r,qw(t));const tC={"point-list":0,"line-list":1,"line-strip":2,"triangle-list":3,"triangle-strip":4};function eC(r,t,e,i,s){return r<<24|t<<16|e<<10|i<<5|s}function rC(r,t,e,i){return e<<6|r<<3|i<<1|t}class Ql{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(ut.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,i,s){const n=this.getPipeline(t,e,i);s.setPipeline(n)}getPipeline(t,e,i,s){t._layoutKey||(qu(t,e.attributeData),this._generateBufferKey(t)),s=s||t.topology;const n=eC(t._layoutKey,e._layoutKey,i.data,i._blendModeId,tC[s]);return this._pipeCache[n]?this._pipeCache[n]:(this._pipeCache[n]=this._createPipeline(t,e,i,s),this._pipeCache[n])}_createPipeline(t,e,i,s){const n=this._gpu.device,a=this._createVertexBufferLayouts(t,e),o=this._renderer.state.getColorTargets(i);o[0].writeMask=this._stencilMode===ut.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:a},fragment:{module:this._getModule(e.fragment.source),entryPoint:e.fragment.entryPoint,targets:o},primitive:{topology:s,cullMode:i.cullMode},layout:u,multisample:{count:this._multisampleCount},label:"PIXI Pipeline"};return this._depthStencilAttachment&&(l.depthStencil=Jw(Qw({},this._stencilState),{format:"depth24plus-stencil8",depthWriteEnabled:i.depthTest,depthCompare:i.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 i=0;const s=Object.keys(t.attributes).sort();for(let a=0;a<s.length;a++){const o=t.attributes[s[a]];e[i++]=o.offset,e[i++]=o.format,e[i++]=o.stride,e[i++]=o.instance}const n=e.join("|");return t._layoutKey=ir(n,"geometry"),t._layoutKey}_generateAttributeLocationsKey(t){const e=[];let i=0;const s=Object.keys(t.attributeData).sort();for(let a=0;a<s.length;a++){const o=t.attributeData[s[a]];e[i++]=o.location}const n=e.join("|");return t._attributeLocationsKey=ir(n,"programAttributes"),t._attributeLocationsKey}getBufferNamesToBind(t,e){const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bindingNamesCache[i])return this._bindingNamesCache[i];const s=this._createVertexBufferLayouts(t,e),n=Object.create(null),a=e.attributeData;for(let o=0;o<s.length;o++)for(const u in a)if(a[u].location===o){n[o]=u;break}return this._bindingNamesCache[i]=n,n}_createVertexBufferLayouts(t,e){e._attributeLocationsKey||this._generateAttributeLocationsKey(e);const i=t._layoutKey<<16|e._attributeLocationsKey;if(this._bufferLayoutsCache[i])return this._bufferLayoutsCache[i];const s=[];return t.buffers.forEach(n=>{var a;const o={arrayStride:0,stepMode:"vertex",attributes:[]},u=o.attributes;for(const l in e.attributeData){const c=t.attributes[l];((a=c.divisor)!=null?a:1)!==1&&ge(`Attribute ${l} has an invalid divisor value of '${c.divisor}'. WebGPU only supports a divisor value of 1`),c.buffer===n&&(o.arrayStride=c.stride,o.stepMode=c.instance?"instance":"vertex",u.push({shaderLocation:e.attributeData[l].location,offset:c.offset,format:c.format}))}u.length&&s.push(o)}),this._bufferLayoutsCache[i]=s,s}_updatePipeHash(){const t=rC(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}}Ql.extension={type:[v.WebGPUSystem],name:"pipeline"};class J2{constructor(){this.contexts=[],this.msaaTextures=[],this.msaaSamples=1}}class tb{init(t,e){this._renderer=t,this._renderTargetSystem=e}copyToTexture(t,e,i,s,n){const a=this._renderer,o=this._getGpuColorTexture(t),u=a.texture.getGpuSource(e.source);return a.encoder.commandEncoder.copyTextureToTexture({texture:o,origin:i},{texture:u,origin:n},s),e}startRenderPass(t,e=!0,i,s){const n=this._renderTargetSystem.getGpuRenderTarget(t),a=this.getDescriptor(t,e,i);n.descriptor=a,this._renderer.pipeline.setRenderTarget(n),this._renderer.encoder.beginRenderPass(n),this._renderer.encoder.setViewport(s)}finishRenderPass(){this._renderer.encoder.endRenderPass()}_getGpuColorTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);return e.contexts[0]?e.contexts[0].getCurrentTexture():this._renderer.texture.getGpuSource(t.colorTextures[0].source)}getDescriptor(t,e,i){typeof e=="boolean"&&(e=e?At.ALL:At.NONE);const s=this._renderTargetSystem,n=s.getGpuRenderTarget(t),a=t.colorTextures.map((u,l)=>{const c=n.contexts[l];let h,f;c?h=c.getCurrentTexture().createView():h=this._renderer.texture.getGpuSource(u).createView({mipLevelCount:1}),n.msaaTextures[l]&&(f=h,h=this._renderer.texture.getTextureView(n.msaaTextures[l]));const p=e&At.COLOR?"clear":"load";return i!=null||(i=s.defaultClearColor),{view:h,resolveTarget:f,clearValue:i,storeOp:"store",loadOp:p}});let o;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";o={view:this._renderer.texture.getGpuSource(t.depthStencilTexture.source).createView(),stencilStoreOp:"store",stencilLoadOp:u,depthClearValue:1,depthLoadOp:l,depthStoreOp:"store"}}return{colorAttachments:a,depthStencilAttachment:o}}clear(t,e=!0,i,s){if(!e)return;const{gpu:n,encoder:a}=this._renderer,o=n.device;if(a.commandEncoder===null){const u=o.createCommandEncoder(),l=this.getDescriptor(t,e,i),c=u.beginRenderPass(l);c.setViewport(s.x,s.y,s.width,s.height,0,1),c.end();const h=u.finish();o.queue.submit([h])}else this.startRenderPass(t,e,i,s)}initGpuRenderTarget(t){t.isRoot=!0;const e=new J2;return t.colorTextures.forEach((i,s)=>{if(ae.test(i.resource)){const n=i.resource.getContext("webgpu"),a=i.transparent?"premultiplied":"opaque";try{n.configure({device:this._renderer.gpu.device,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_DST|GPUTextureUsage.RENDER_ATTACHMENT|GPUTextureUsage.COPY_SRC,format:"bgra8unorm",alphaMode:a})}catch(o){console.error(o)}e.contexts[s]=n}if(e.msaa=i.source.antialias,i.source.antialias){const n=new et({width:0,height:0,sampleCount:4});e.msaaTextures[s]=n}}),e.msaa&&(e.msaaSamples=4,t.depthStencilTexture&&(t.depthStencilTexture.source.sampleCount=4)),e}destroyGpuRenderTarget(t){t.contexts.forEach(e=>{e.unconfigure()}),t.msaaTextures.forEach(e=>{e.destroy()}),t.msaaTextures.length=0,t.contexts.length=0}ensureDepthStencilTexture(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);t.depthStencilTexture&&e.msaa&&(t.depthStencilTexture.source.sampleCount=4)}resizeGpuRenderTarget(t){const e=this._renderTargetSystem.getGpuRenderTarget(t);e.width=t.width,e.height=t.height,e.msaa&&t.colorTextures.forEach((i,s)=>{const n=e.msaaTextures[s];n==null||n.resize(i.source.width,i.source.height,i.source._resolution)})}}class Jl extends ul{constructor(t){super(t),this.adaptor=new tb,this.adaptor.init(t,this)}}Jl.extension={type:[v.WebGPUSystem],name:"renderTarget"};class tc{constructor(){this._gpuProgramData=Object.create(null)}contextChange(t){this._gpu=t,this.maxTextures=t.device.limits.maxSampledTexturesPerShaderStage}getProgramData(t){return this._gpuProgramData[t._layoutKey]||this._createGPUProgramData(t)}_createGPUProgramData(t){const e=this._gpu.device,i=t.gpuLayout.map(n=>e.createBindGroupLayout({entries:n})),s={bindGroupLayouts:i};return this._gpuProgramData[t._layoutKey]={bindGroups:i,pipeline:e.createPipelineLayout(s)},this._gpuProgramData[t._layoutKey]}destroy(){this._gpu=null,this._gpuProgramData=null}}tc.extension={type:[v.WebGPUSystem],name:"shader"};const bt={};bt.normal={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"}},bt.add={alpha:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one",operation:"add"}},bt.multiply={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"dst",dstFactor:"one-minus-src-alpha",operation:"add"}},bt.screen={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},bt.overlay={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"one",dstFactor:"one-minus-src",operation:"add"}},bt.none={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"zero",operation:"add"}},bt["normal-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src-alpha",operation:"add"}},bt["add-npm"]={alpha:{srcFactor:"one",dstFactor:"one",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one",operation:"add"}},bt["screen-npm"]={alpha:{srcFactor:"one",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"src-alpha",dstFactor:"one-minus-src",operation:"add"}},bt.erase={alpha:{srcFactor:"zero",dstFactor:"one-minus-src-alpha",operation:"add"},color:{srcFactor:"zero",dstFactor:"one-minus-src",operation:"add"}},bt.min={alpha:{srcFactor:"one",dstFactor:"one",operation:"min"},color:{srcFactor:"one",dstFactor:"one",operation:"min"}},bt.max={alpha:{srcFactor:"one",dstFactor:"one",operation:"max"},color:{srcFactor:"one",dstFactor:"one",operation:"max"}};class ec{constructor(){this.defaultState=new Ht,this.defaultState.blend=!0}contextChange(t){this.gpu=t}getColorTargets(t){return[{format:"bgra8unorm",writeMask:0,blend:bt[t.blendMode]||bt.normal}]}destroy(){this.gpu=null}}ec.extension={type:[v.WebGPUSystem],name:"state"};const eb={type:"image",upload(r,t,e){const i=r.resource,s=(r.pixelWidth|0)*(r.pixelHeight|0),n=i.byteLength/s;e.device.queue.writeTexture({texture:t},i,{offset:0,rowsPerImage:r.pixelHeight,bytesPerRow:r.pixelHeight*n},{width:r.pixelWidth,height:r.pixelHeight,depthOrArrayLayers:1})}},rc={"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}},iC={blockBytes:4,blockWidth:1,blockHeight:1},rb={type:"compressed",upload(r,t,e){let i=r.pixelWidth,s=r.pixelHeight;const n=rc[r.format]||iC;for(let a=0;a<r.resource.length;a++){const o=r.resource[a],u=Math.ceil(i/n.blockWidth)*n.blockBytes;e.device.queue.writeTexture({texture:t,mipLevel:a},o,{offset:0,bytesPerRow:u},{width:Math.ceil(i/n.blockWidth)*n.blockWidth,height:Math.ceil(s/n.blockHeight)*n.blockHeight,depthOrArrayLayers:1}),i=Math.max(i>>1,1),s=Math.max(s>>1,1)}}},ic={type:"image",upload(r,t,e){const i=r.resource;if(!i)return;const s=Math.min(t.width,r.resourceWidth||r.pixelWidth),n=Math.min(t.height,r.resourceHeight||r.pixelHeight),a=r.alphaMode==="premultiply-alpha-on-upload";e.device.queue.copyExternalImageToTexture({source:i},{texture:t,premultipliedAlpha:a},{width:s,height:n})}},ib={type:"video",upload(r,t,e){ic.upload(r,t,e)}};class sb{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 i=t;const s=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:s},format:t.format,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.COPY_SRC|GPUTextureUsage.RENDER_ATTACHMENT,mipLevelCount:t.mipLevelCount-1};i=this.device.createTexture(u)}const a=this.device.createCommandEncoder({}),o=e.getBindGroupLayout(0);for(let u=0;u<s;++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 f=i.createView({baseMipLevel:c++,mipLevelCount:1,dimension:"2d",baseArrayLayer:u,arrayLayerCount:1}),p=a.beginRenderPass({colorAttachments:[{view:f,storeOp:"store",loadOp:"clear",clearValue:{r:0,g:0,b:0,a:0}}]}),m=this.device.createBindGroup({layout:o,entries:[{binding:0,resource:this.sampler},{binding:1,resource:l}]});p.setPipeline(e),p.setBindGroup(0,m),p.draw(3,1,0,0),p.end(),l=f}}if(!n){const u={width:Math.ceil(t.width/2),height:Math.ceil(t.height/2),depthOrArrayLayers:s};for(let l=1;l<t.mipLevelCount;++l)a.copyTextureToTexture({texture:i,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([a.finish()]),n||i.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:ic,buffer:eb,video:ib,compressed:rb},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 i=rc[t.format]||{blockBytes:4,blockWidth:1,blockHeight:1},s=Math.ceil(t.pixelWidth/i.blockWidth)*i.blockWidth,n=Math.ceil(t.pixelHeight/i.blockHeight)*i.blockHeight,a={label:t.label,size:{width:s,height:n},format:t.format,sampleCount:t.sampleCount,mipLevelCount:t.mipLevelCount,dimension:t.dimension,usage:e},o=this._gpu.device.createTexture(a);return this._gpuSources[t.uid]=o,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),o}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 sb(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 Zt({0:e,1:e.style,2:new ot({uTextureMatrix:{type:"mat3x3<f32>",value:t.textureMatrix.mapCoord}})}),this._bindGroupHash[t.uid]}getTextureView(t){var e;const i=t.source;return(e=this._textureViewHash[i.uid])!=null?e:this._createTextureView(i)}_createTextureView(t){return this._textureViewHash[t.uid]=this.getGpuSource(t).createView(),this._textureViewHash[t.uid]}generateCanvas(t){const e=this._renderer,i=e.gpu.device.createCommandEncoder(),s=$.get().createCanvas();s.width=t.source.pixelWidth,s.height=t.source.pixelHeight;const n=s.getContext("webgpu");return n.configure({device:e.gpu.device,usage:GPUTextureUsage.COPY_DST|GPUTextureUsage.COPY_SRC,format:$.get().getNavigator().gpu.getPreferredCanvasFormat(),alphaMode:"premultiplied"}),i.copyTextureToTexture({texture:e.texture.getGpuSource(t.source),origin:{x:0,y:0}},{texture:n.getCurrentTexture()},{width:s.width,height:s.height}),e.gpu.device.queue.submit([i.finish()]),s}getPixels(t){const e=this.generateCanvas(t),i=Qt.getOptimalCanvasAndContext(e.width,e.height),s=i.context;s.drawImage(e,0,0);const{width:n,height:a}=e,o=s.getImageData(0,0,n,a),u=new Uint8ClampedArray(o.data.buffer);return Qt.returnCanvasAndContext(i),{pixels:u,width:n,height:a}}destroy(){this.managedTextures.slice().forEach(t=>this.onSourceDestroy(t)),this.managedTextures=null;for(const t of Object.keys(this._bindGroupHash)){const e=Number(t),i=this._bindGroupHash[e];i==null||i.destroy(),this._bindGroupHash[e]=null}this._gpu=null,this._mipmapGenerator=null,this._gpuSources=null,this._bindGroupHash=null,this._textureViewHash=null,this._gpuSamplers=null}}sc.extension={type:[v.WebGPUSystem],name:"texture"};class nc{init(){const t=new ot({uTransformMatrix:{value:new G,type:"mat3x3<f32>"},uColor:{value:new Float32Array([1,1,1,1]),type:"vec4<f32>"},uRound:{value:0,type:"f32"}}),e=ar({name:"graphics",bits:[hs,fs(Oe()),gm,ur]});this.shader=new Ut({gpuProgram:e,resources:{localUniforms:t}})}execute(t,e){const i=e.context,s=i.customShader||this.shader,n=t.renderer,a=n.graphicsContext,{batcher:o,instructions:u}=a.getContextRenderData(i),l=n.encoder;l.setPipelineFromGeometryProgramAndState(o.geometry,s.gpuProgram,t.state),l.setGeometry(o.geometry,s.gpuProgram);const c=n.globalUniforms.bindGroup;l.setBindGroup(0,c,s.gpuProgram);const h=n.renderPipes.uniformBatch.getUniformBindGroup(s.resources.localUniforms,!0);l.setBindGroup(2,h,s.gpuProgram);const f=u.instructions;for(let p=0;p<u.instructionSize;p++){const m=f[p];if(s.groups[1]=m.bindGroup,!m.gpuBindGroup){const _=m.textures;m.bindGroup=os(_.textures,_.count),m.gpuBindGroup=n.bindGroup.getBindGroup(m.bindGroup,s.gpuProgram,1)}l.setBindGroup(1,m.bindGroup,s.gpuProgram),l.renderPassEncoder.drawIndexed(m.size,1,m.start)}}destroy(){this.shader.destroy(!0),this.shader=null}}nc.extension={type:[v.WebGPUPipesAdaptor],name:"graphics"};class ac{init(){const t=ar({name:"mesh",bits:[gr,u0,ur]});this._shader=new Ut({gpuProgram:t,resources:{uTexture:w.EMPTY._source,uSampler:w.EMPTY._source.style,textureUniforms:{uTextureMatrix:{type:"mat3x3<f32>",value:new G}}}})}execute(t,e){const i=t.renderer;let s=e._shader;if(!s)s=this._shader,s.groups[2]=i.texture.getTextureBindGroup(e.texture);else if(!s.gpuProgram)return;const n=s.gpuProgram;if(n.autoAssignGlobalUniforms&&(s.groups[0]=i.globalUniforms.bindGroup),n.autoAssignLocalUniforms){const a=t.localUniforms;s.groups[1]=i.renderPipes.uniformBatch.getUniformBindGroup(a,!0)}i.encoder.draw({geometry:e._geometry,shader:s,state:e.state})}destroy(){this._shader.destroy(!0),this._shader=null}}ac.extension={type:[v.WebGPUPipesAdaptor],name:"mesh"};const sC=[...Xl,Kl,Yl,Cn,Vl,sc,Jl,tc,ec,Ql,Wl,ql,jl],nC=[...zl,Zl],aC=[$u,ac,nc],nb=[],ab=[],ob=[];L.handleByNamedList(v.WebGPUSystem,nb),L.handleByNamedList(v.WebGPUPipes,ab),L.handleByNamedList(v.WebGPUPipesAdaptor,ob),L.add(...sC,...nC,...aC);class ub extends fi{constructor(){const t={name:"webgpu",type:St.WEBGPU,systems:nb,renderPipes:ab,renderPipeAdaptors:ob};super(t)}}var oC={__proto__:null,WebGPURenderer:ub};const uC={POINTS:"point-list",LINES:"line-list",LINE_STRIP:"line-strip",TRIANGLES:"triangle-list",TRIANGLE_STRIP:"triangle-strip"},lC=new Proxy(uC,{get(r,t){return r[t]}}),cC=new W(0,0,1,1);function hC(r,t,e){e||(e=cC);const i=t.pixelWidth,s=t.pixelHeight;return r.x=e.x*i|0,r.y=e.y*s|0,r.width=e.width*i|0,r.height=e.height*s|0,r}var lb=(r=>(r[r.NONE=0]="NONE",r[r.LOW=2]="LOW",r[r.MEDIUM=4]="MEDIUM",r[r.HIGH=8]="HIGH",r))(lb||{}),oc=(r=>(r.CLAMP="clamp-to-edge",r.REPEAT="repeat",r.MIRRORED_REPEAT="mirror-repeat",r))(oc||{});const dC=new Proxy(oc,{get(r,t){return r[t]}});var uc=(r=>(r.NEAREST="nearest",r.LINEAR="linear",r))(uc||{});const fC=new Proxy(uc,{get(r,t){return r[t]}});class pC{constructor(){this.x0=0,this.y0=0,this.x1=1,this.y1=0,this.x2=1,this.y2=1,this.x3=0,this.y3=1,this.uvsFloat32=new Float32Array(8)}set(t,e,i){const s=e.width,n=e.height;if(i){const a=t.width/2/s,o=t.height/2/n,u=t.x/s+a,l=t.y/n+o;i=H.add(i,H.NW),this.x0=u+a*H.uX(i),this.y0=l+o*H.uY(i),i=H.add(i,2),this.x1=u+a*H.uX(i),this.y1=l+o*H.uY(i),i=H.add(i,2),this.x2=u+a*H.uX(i),this.y2=l+o*H.uY(i),i=H.add(i,2),this.x3=u+a*H.uX(i),this.y3=l+o*H.uY(i)}else this.x0=t.x/s,this.y0=t.y/n,this.x1=(t.x+t.width)/s,this.y1=t.y/n,this.x2=(t.x+t.width)/s,this.y2=(t.y+t.height)/n,this.x3=t.x/s,this.y3=(t.y+t.height)/n;this.uvsFloat32[0]=this.x0,this.uvsFloat32[1]=this.y0,this.uvsFloat32[2]=this.x1,this.uvsFloat32[3]=this.y1,this.uvsFloat32[4]=this.x2,this.uvsFloat32[5]=this.y2,this.uvsFloat32[6]=this.x3,this.uvsFloat32[7]=this.y3}}let mC=0;function gC(){return mC++}function _C(r){const t=r.toString(),e=t.indexOf("{"),i=t.lastIndexOf("}");if(e===-1||i===-1)throw new Error("getFunctionBody: No body found in function definition");return t.slice(e+1,i).trim()}var bC=Object.defineProperty,Rn=Object.getOwnPropertySymbols,cb=Object.prototype.hasOwnProperty,hb=Object.prototype.propertyIsEnumerable,db=(r,t,e)=>t in r?bC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,yC=(r,t)=>{for(var e in t||(t={}))cb.call(t,e)&&db(r,e,t[e]);if(Rn)for(var e of Rn(t))hb.call(t,e)&&db(r,e,t[e]);return r},xC=(r,t)=>{var e={};for(var i in r)cb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Rn)for(var i of Rn(r))t.indexOf(i)<0&&hb.call(r,i)&&(e[i]=r[i]);return e};class vC extends rt{constructor(t){var e,i;typeof t=="function"&&(t={render:t});const s=t,{render:n}=s,a=xC(s,["render"]);super(yC({label:"RenderContainer"},a)),this.batched=!1,this._lastUsed=0,this._lastInstructionTick=-1,this.bounds=new ft,this.canBundle=!1,this.renderPipeId="customRender",n&&(this.render=n),this.containsPoint=(e=t.containsPoint)!=null?e:()=>!1,this.addBounds=(i=t.addBounds)!=null?i:()=>!1}render(t){}}function TC(r,t){const e=t._scale,i=t._pivot,s=t._position,n=e._x,a=e._y,o=i._x,u=i._y;r.a=t._cx*n,r.b=t._sx*n,r.c=t._cy*a,r.d=t._sy*a,r.tx=s._x-(o*r.a+u*r.c),r.ty=s._y-(o*r.b+u*r.d)}function SC(r,t,e){const i=r.a,s=r.b,n=r.c,a=r.d,o=r.tx,u=r.ty,l=t.a,c=t.b,h=t.c,f=t.d;e.a=i*l+s*h,e.b=i*c+s*f,e.c=n*l+a*h,e.d=n*c+a*f,e.tx=o*l+u*h+t.tx,e.ty=o*c+u*f+t.ty}const AC={rectangle:so,polygon:io,triangle:no,circle:oe,ellipse:oe,roundedRectangle:oe};function EC(r){r instanceof pe&&(r={path:r,textureMatrix:null,out:null});const t=[],e=[],i=[],s=r.path.shapePath,n=r.textureMatrix;s.shapePrimitives.forEach(({shape:o,transform:u})=>{const l=i.length,c=t.length/2,h=[],f=AC[o.type];f.build(o,h),u&&bs(h,u),f.triangulate(h,t,2,c,i,l);const p=e.length/2;n?(u&&n.append(u.clone().invert()),Ka(t,2,c,e,p,2,t.length/2-c,n)):Za(e,p,2,t.length/2-c)});const a=r.out;return a?(a.positions=new Float32Array(t),a.uvs=new Float32Array(e),a.indices=new Uint32Array(i),a):new _e({positions:new Float32Array(t),uvs:new Float32Array(e),indices:new Uint32Array(i)})}function fb(r,t,e,i){const s=e.buffers[0],n=s.data,{verticesX:a,verticesY:o}=e,u=r/(a-1),l=t/(o-1);let c=0;const h=i[0],f=i[1],p=i[2],m=i[3],_=i[4],g=i[5],b=i[6],x=i[7],y=i[8];for(let T=0;T<n.length;T+=2){const A=c%a*u,R=(c/a|0)*l,C=h*A+f*R+p,P=m*A+_*R+g,S=b*A+x*R+y;n[T]=C/S,n[T+1]=P/S,c++}s.update()}function pb(r,t){const e=t[0],i=t[1],s=t[2],n=t[3],a=t[4],o=t[5],u=t[6],l=t[7],c=t[8];return r[0]=a*c-o*l,r[1]=s*l-i*c,r[2]=i*o-s*a,r[3]=o*u-n*c,r[4]=e*c-s*u,r[5]=s*n-e*o,r[6]=n*l-a*u,r[7]=i*u-e*l,r[8]=e*a-i*n,r}function mb(r,t,e){const i=t[0],s=t[1],n=t[2],a=t[3],o=t[4],u=t[5],l=t[6],c=t[7],h=t[8],f=e[0],p=e[1],m=e[2],_=e[3],g=e[4],b=e[5],x=e[6],y=e[7],T=e[8];return r[0]=f*i+p*a+m*l,r[1]=f*s+p*o+m*c,r[2]=f*n+p*u+m*h,r[3]=_*i+g*a+b*l,r[4]=_*s+g*o+b*c,r[5]=_*n+g*u+b*h,r[6]=x*i+y*a+T*l,r[7]=x*s+y*o+T*c,r[8]=x*n+y*u+T*h,r}function wC(r,t,e){const i=e[0],s=e[1],n=e[2];return r[0]=t[0]*i+t[1]*s+t[2]*n,r[1]=t[3]*i+t[4]*s+t[5]*n,r[2]=t[6]*i+t[7]*s+t[8]*n,r}const CC=[0,0,0,0,0,0,0,0,0],RC=[0,0,0],Pn=[0,0,0];function gb(r,t,e,i,s,n,a,o,u){const l=CC;l[0]=t,l[1]=i,l[2]=n,l[3]=e,l[4]=s,l[5]=a,l[6]=1,l[7]=1,l[8]=1;const c=pb(r,l);Pn[0]=o,Pn[1]=u,Pn[2]=1;const h=wC(RC,c,Pn),f=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],mb(r,f,l)}const PC=[0,0,0,0,0,0,0,0,0],MC=[0,0,0,0,0,0,0,0,0];function _b(r,t,e,i,s,n,a,o,u,l,c,h,f,p,m,_,g){const b=gb(PC,t,e,n,a,l,c,p,m),x=gb(MC,i,s,o,u,h,f,_,g);return mb(r,pb(b,b),x)}class bb extends Hs{constructor(t){super(t),this._projectionMatrix=[0,0,0,0,0,0,0,0,0];const{width:e,height:i}=t;this.corners=[0,0,e,0,e,i,0,i]}setCorners(t,e,i,s,n,a,o,u){const l=this.corners;l[0]=t,l[1]=e,l[2]=i,l[3]=s,l[4]=n,l[5]=a,l[6]=o,l[7]=u,this.updateProjection()}updateProjection(){const{width:t,height:e}=this,i=this.corners,s=_b(this._projectionMatrix,0,0,i[0],i[1],t,0,i[2],i[3],t,e,i[4],i[5],0,e,i[6],i[7]);fb(t,e,this,s)}}var DC=Object.defineProperty,OC=Object.defineProperties,BC=Object.getOwnPropertyDescriptors,Mn=Object.getOwnPropertySymbols,yb=Object.prototype.hasOwnProperty,xb=Object.prototype.propertyIsEnumerable,vb=(r,t,e)=>t in r?DC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,lc=(r,t)=>{for(var e in t||(t={}))yb.call(t,e)&&vb(r,e,t[e]);if(Mn)for(var e of Mn(t))xb.call(t,e)&&vb(r,e,t[e]);return r},GC=(r,t)=>OC(r,BC(t)),FC=(r,t)=>{var e={};for(var i in r)yb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Mn)for(var i of Mn(r))t.indexOf(i)<0&&xb.call(r,i)&&(e[i]=r[i]);return e};const Tb=class Fy extends vr{constructor(t){t=lc(lc({},Fy.defaultOptions),t);const e=t,{texture:i,verticesX:s,verticesY:n}=e,a=FC(e,["texture","verticesX","verticesY"]),o=new bb(Wt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Wt(GC(lc({},a),{geometry:o}))),this._texture=i,this.geometry.setCorners(t.x0,t.y0,t.x1,t.y1,t.x2,t.y2,t.x3,t.y3)}textureUpdated(){const t=this.geometry;if(!t)return;const{width:e,height:i}=this.texture;(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.updateProjection())}set texture(t){this._texture!==t&&(super.texture=t,this.textureUpdated())}get texture(){return this._texture}setCorners(t,e,i,s,n,a,o,u){this.geometry.setCorners(t,e,i,s,n,a,o,u)}};Tb.defaultOptions={texture:w.WHITE,verticesX:10,verticesY:10,x0:0,y0:0,x1:100,y1:0,x2:100,y2:100,x3:0,y3:100};let IC=Tb;var UC=Object.defineProperty,kC=Object.defineProperties,LC=Object.getOwnPropertyDescriptors,Dn=Object.getOwnPropertySymbols,Sb=Object.prototype.hasOwnProperty,Ab=Object.prototype.propertyIsEnumerable,Eb=(r,t,e)=>t in r?UC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,NC=(r,t)=>{for(var e in t||(t={}))Sb.call(t,e)&&Eb(r,e,t[e]);if(Dn)for(var e of Dn(t))Ab.call(t,e)&&Eb(r,e,t[e]);return r},$C=(r,t)=>kC(r,LC(t)),HC=(r,t)=>{var e={};for(var i in r)Sb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Dn)for(var i of Dn(r))t.indexOf(i)<0&&Ab.call(r,i)&&(e[i]=r[i]);return e};class XC extends vr{constructor(t){const e=t,{texture:i,verticesX:s,verticesY:n}=e,a=HC(e,["texture","verticesX","verticesY"]),o=new Hs(Wt({width:i.width,height:i.height,verticesX:s,verticesY:n}));super(Wt($C(NC({},a),{geometry:o,texture:i}))),this.texture=i,this.autoResize=!0}textureUpdated(){const t=this.geometry,{width:e,height:i}=this.texture;this.autoResize&&(t.width!==e||t.height!==i)&&(t.width=e,t.height=i,t.build({}))}set texture(t){var e;(e=this._texture)==null||e.off("update",this.textureUpdated,this),super.texture=t,t.on("update",this.textureUpdated,this),this.textureUpdated()}get texture(){return this._texture}destroy(t){this.texture.off("update",this.textureUpdated,this),super.destroy(t)}}var zC=Object.defineProperty,wb=Object.getOwnPropertySymbols,jC=Object.prototype.hasOwnProperty,VC=Object.prototype.propertyIsEnumerable,Cb=(r,t,e)=>t in r?zC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,Rb=(r,t)=>{for(var e in t||(t={}))jC.call(t,e)&&Cb(r,e,t[e]);if(wb)for(var e of wb(t))VC.call(t,e)&&Cb(r,e,t[e]);return r};const Pb=class Iy extends _e{constructor(t){const{width:e,points:i,textureScale:s}=Rb(Rb({},Iy.defaultOptions),t);super({positions:new Float32Array(i.length*4),uvs:new Float32Array(i.length*4),indices:new Uint32Array((i.length-1)*6)}),this.points=i,this._width=e,this.textureScale=s,this._build()}get width(){return this._width}_build(){const t=this.points;if(!t)return;const e=this.getBuffer("aPosition"),i=this.getBuffer("aUV"),s=this.getIndex();if(t.length<1)return;e.data.length/4!==t.length&&(e.data=new Float32Array(t.length*4),i.data=new Float32Array(t.length*4),s.data=new Uint16Array((t.length-1)*6));const n=i.data,a=s.data;n[0]=0,n[1]=0,n[2]=0,n[3]=1;let o=0,u=t[0];const l=this._width*this.textureScale,c=t.length;for(let f=0;f<c;f++){const p=f*4;if(this.textureScale>0){const m=u.x-t[f].x,_=u.y-t[f].y,g=Math.sqrt(m*m+_*_);u=t[f],o+=g/l}else o=f/(c-1);n[p]=o,n[p+1]=0,n[p+2]=o,n[p+3]=1}let h=0;for(let f=0;f<c-1;f++){const p=f*2;a[h++]=p,a[h++]=p+1,a[h++]=p+2,a[h++]=p+2,a[h++]=p+1,a[h++]=p+3}i.update(),s.update(),this.updateVertices()}updateVertices(){const t=this.points;if(t.length<1)return;let e=t[0],i,s=0,n=0;const a=this.buffers[0].data,o=t.length,u=this.textureScale>0?this.textureScale*this._width/2:this._width/2;for(let l=0;l<o;l++){const c=t[l],h=l*4;l<t.length-1?i=t[l+1]:i=c,n=-(i.x-e.x),s=i.y-e.y;let f=(1-l/(o-1))*10;f>1&&(f=1);const p=Math.sqrt(s*s+n*n);p<1e-6?(s=0,n=0):(s/=p,n/=p,s*=u,n*=u),a[h]=c.x+s,a[h+1]=c.y+n,a[h+2]=c.x-s,a[h+3]=c.y-n,e=c}this.buffers[0].update()}update(){this.textureScale>0?this._build():this.updateVertices()}};Pb.defaultOptions={width:200,points:[],textureScale:0};let Mb=Pb;var WC=Object.defineProperty,YC=Object.defineProperties,qC=Object.getOwnPropertyDescriptors,On=Object.getOwnPropertySymbols,Db=Object.prototype.hasOwnProperty,Ob=Object.prototype.propertyIsEnumerable,Bb=(r,t,e)=>t in r?WC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,cc=(r,t)=>{for(var e in t||(t={}))Db.call(t,e)&&Bb(r,e,t[e]);if(On)for(var e of On(t))Ob.call(t,e)&&Bb(r,e,t[e]);return r},KC=(r,t)=>YC(r,qC(t)),ZC=(r,t)=>{var e={};for(var i in r)Db.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&On)for(var i of On(r))t.indexOf(i)<0&&Ob.call(r,i)&&(e[i]=r[i]);return e};const Gb=class Uy extends vr{constructor(t){const e=cc(cc({},Uy.defaultOptions),t),{texture:i,points:s,textureScale:n}=e,a=ZC(e,["texture","points","textureScale"]),o=new Mb(Wt({width:i.height,points:s,textureScale:n}));n>0&&(i.source.style.addressMode="repeat"),super(Wt(KC(cc({},a),{texture:i,geometry:o}))),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())}};Gb.defaultOptions={textureScale:0};let QC=Gb;var JC=Object.defineProperty,tR=Object.defineProperties,eR=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,Fb=Object.prototype.hasOwnProperty,Ib=Object.prototype.propertyIsEnumerable,Ub=(r,t,e)=>t in r?JC(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,rR=(r,t)=>{for(var e in t||(t={}))Fb.call(t,e)&&Ub(r,e,t[e]);if(Bn)for(var e of Bn(t))Ib.call(t,e)&&Ub(r,e,t[e]);return r},iR=(r,t)=>tR(r,eR(t)),sR=(r,t)=>{var e={};for(var i in r)Fb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Bn)for(var i of Bn(r))t.indexOf(i)<0&&Ib.call(r,i)&&(e[i]=r[i]);return e};class nR extends vr{constructor(t){const e=t,{texture:i,vertices:s,uvs:n,indices:a,topology:o}=e,u=sR(e,["texture","vertices","uvs","indices","topology"]),l=new _e(Wt({positions:s,uvs:n,indices:a,topology:o}));super(Wt(iR(rR({},u),{texture:i,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 aR(r,t){const{width:e,height:i}=r.frame;return t.scale(1/e,1/i),t}var oR=Object.defineProperty,Gn=Object.getOwnPropertySymbols,kb=Object.prototype.hasOwnProperty,Lb=Object.prototype.propertyIsEnumerable,Nb=(r,t,e)=>t in r?oR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,uR=(r,t)=>{for(var e in t||(t={}))kb.call(t,e)&&Nb(r,e,t[e]);if(Gn)for(var e of Gn(t))Lb.call(t,e)&&Nb(r,e,t[e]);return r},lR=(r,t)=>{var e={};for(var i in r)kb.call(r,i)&&t.indexOf(i)<0&&(e[i]=r[i]);if(r!=null&&Gn)for(var i of Gn(r))t.indexOf(i)<0&&Lb.call(r,i)&&(e[i]=r[i]);return e};const $b=class ky extends Me{constructor(t){var e,i,s,n,a,o,u,l,c,h;t instanceof w&&(t={texture:t});const f=t,{width:p,height:m,leftWidth:_,rightWidth:g,topHeight:b,bottomHeight:x,texture:y,roundPixels:T}=f,A=lR(f,["width","height","leftWidth","rightWidth","topHeight","bottomHeight","texture","roundPixels"]);super(uR({label:"NineSliceSprite"},A)),this.renderPipeId="nineSliceSprite",this.batched=!0,this._didSpriteUpdate=!0,this._leftWidth=(i=_!=null?_:(e=y==null?void 0:y.defaultBorders)==null?void 0:e.left)!=null?i:be.defaultOptions.leftWidth,this._topHeight=(n=b!=null?b:(s=y==null?void 0:y.defaultBorders)==null?void 0:s.top)!=null?n:be.defaultOptions.topHeight,this._rightWidth=(o=g!=null?g:(a=y==null?void 0:y.defaultBorders)==null?void 0:a.right)!=null?o:be.defaultOptions.rightWidth,this._bottomHeight=(l=x!=null?x:(u=y==null?void 0:y.defaultBorders)==null?void 0:u.bottom)!=null?l:be.defaultOptions.bottomHeight,this.bounds.maxX=this._width=(c=p!=null?p:y.width)!=null?c:be.defaultOptions.width,this.bounds.maxY=this._height=(h=m!=null?m:y.height)!=null?h:be.defaultOptions.height,this.allowChildren=!1,this.texture=y!=null?y:ky.defaultOptions.texture,this.roundPixels=T!=null?T:!1}get bounds(){return this._bounds}get width(){return this._width}set width(t){this.bounds.maxX=this._width=t,this.onViewUpdate()}get height(){return this._height}set height(t){this.bounds.maxY=this._height=t,this.onViewUpdate()}setSize(t,e){var i;typeof t=="object"&&(e=(i=t.height)!=null?i:t.width,t=t.width),this.bounds.maxX=this._width=t,this.bounds.maxY=this._height=e!=null?e:t,this.onViewUpdate()}getSize(t){return t||(t={}),t.width=this._width,t.height=this._height,t}get leftWidth(){return this._leftWidth}set leftWidth(t){this._leftWidth=t,this.onViewUpdate()}get topHeight(){return this._topHeight}set topHeight(t){this._topHeight=t,this.onViewUpdate()}get rightWidth(){return this._rightWidth}set rightWidth(t){this._rightWidth=t,this.onViewUpdate()}get bottomHeight(){return this._bottomHeight}set bottomHeight(t){this._bottomHeight=t,this.onViewUpdate()}get texture(){return this._texture}set texture(t){t||(t=w.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}};$b.defaultOptions={texture:w.EMPTY};let Hb=$b;class cR extends Hb{constructor(...t){let e=t[0];e instanceof w&&(e={texture:e,leftWidth:t[1],topHeight:t[2],rightWidth:t[3],bottomHeight:t[4]}),super(e)}}function hR(r,t){return t instanceof Ot||t instanceof Ue?t:r==="html"?new Ue(t):new Ot(t)}var hc=/iPhone/i,Xb=/iPod/i,zb=/iPad/i,jb=/\biOS-universal(?:.+)Mac\b/i,dc=/\bAndroid(?:.+)Mobile\b/i,Vb=/Android/i,Er=/(?:SD4930UR|\bSilk(?:.+)Mobile\b)/i,Fn=/Silk/i,ce=/Windows Phone/i,Wb=/\bWindows(?:.+)ARM\b/i,Yb=/BlackBerry/i,qb=/BB10/i,Kb=/Opera Mini/i,Zb=/\b(CriOS|Chrome)(?:.+)Mobile/i,Qb=/Mobile(?:.+)Firefox\b/i,Jb=function(r){return typeof r!="undefined"&&r.platform==="MacIntel"&&typeof r.maxTouchPoints=="number"&&r.maxTouchPoints>1&&typeof MSStream=="undefined"};function dR(r){return function(t){return t.test(r)}}function ty(r){var t={userAgent:"",platform:"",maxTouchPoints:0};!r&&typeof navigator!="undefined"?t={userAgent:navigator.userAgent,platform:navigator.platform,maxTouchPoints:navigator.maxTouchPoints||0}:typeof r=="string"?t.userAgent=r:r&&r.userAgent&&(t={userAgent:r.userAgent,platform:r.platform,maxTouchPoints:r.maxTouchPoints||0});var e=t.userAgent,i=e.split("[FBAN");typeof i[1]!="undefined"&&(e=i[0]),i=e.split("Twitter"),typeof i[1]!="undefined"&&(e=i[0]);var s=dR(e),n={apple:{phone:s(hc)&&!s(ce),ipod:s(Xb),tablet:!s(hc)&&(s(zb)||Jb(t))&&!s(ce),universal:s(jb),device:(s(hc)||s(Xb)||s(zb)||s(jb)||Jb(t))&&!s(ce)},amazon:{phone:s(Er),tablet:!s(Er)&&s(Fn),device:s(Er)||s(Fn)},android:{phone:!s(ce)&&s(Er)||!s(ce)&&s(dc),tablet:!s(ce)&&!s(Er)&&!s(dc)&&(s(Fn)||s(Vb)),device:!s(ce)&&(s(Er)||s(Fn)||s(dc)||s(Vb))||s(/\bokhttp\b/i)},windows:{phone:s(ce),tablet:s(Wb),device:s(ce)||s(Wb)},other:{blackberry:s(Yb),blackberry10:s(qb),opera:s(Kb),firefox:s(Qb),chrome:s(Zb),device:s(Yb)||s(qb)||s(Kb)||s(Qb)||s(Zb)},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 ey;const fR=((ey=ty.default)!=null?ey:ty)(globalThis.navigator);async function pR(r,t,e=200){const i=await t.extract.base64(r);await t.encoder.commandFinished;const s=e;console.log(`logging texture ${r.source.width}px ${r.source.height}px`);const n=["font-size: 1px;",`padding: ${s}px 300px;`,`background: url(${i}) no-repeat;`,"background-size: contain;"].join(" ");console.log("%c ",n)}var mR=Object.defineProperty,gR=Object.defineProperties,_R=Object.getOwnPropertyDescriptors,ry=Object.getOwnPropertySymbols,bR=Object.prototype.hasOwnProperty,yR=Object.prototype.propertyIsEnumerable,iy=(r,t,e)=>t in r?mR(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e,sy=(r,t)=>{for(var e in t||(t={}))bR.call(t,e)&&iy(r,e,t[e]);if(ry)for(var e of ry(t))yR.call(t,e)&&iy(r,e,t[e]);return r},xR=(r,t)=>gR(r,_R(t));const vR=["#000080","#228B22","#8B0000","#4169E1","#008080","#800000","#9400D3","#FF8C00","#556B2F","#8B008B"];let TR=0;function ny(r,t=0,e={color:"#000000"}){r.renderGroup&&(e.color=vR[TR++]);let i="";for(let a=0;a<t;a++)i+=" ";let s=r.label;!s&&r instanceof $t&&(s=`sprite:${r.texture.label}`);let n=`%c ${i}|- ${s} (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 a=0;a<r.children.length;a++){const o=r.children[a];ny(o,t,sy({},e))}}function ay(r,t=0,e={index:0,color:"#000000"}){let i="";for(let n=0;n<t;n++)i+=" ";const s=`%c ${i}- ${e.index}: ${r.root.label} worldX:${r.worldTransform.tx}`;console.log(s,`color:${e.color}; font-weight:bold;`),t++;for(let n=0;n<r.renderGroupChildren.length;n++){const a=r.renderGroupChildren[n];ay(a,t,xR(sy({},e),{index:n}))}}return $.set(ch),d.AbstractBitmapFont=Fo,d.AbstractRenderer=fi,d.AbstractText=pn,d.AlphaFilter=hE,d.AlphaMask=Aa,d.AlphaMaskPipe=zu,d.AnimatedSprite=Ai,d.Application=zm,d.ApplicationInitHook=au,d.Assets=bi,d.AssetsClass=Pg,d.BLEND_TO_NPM=Ad,d.BUFFER_TYPE=Ci,d.BackgroundLoader=Wm,d.BackgroundSystem=x2,d.Batch=Pd,d.BatchGeometry=Id,d.BatchTextureArray=Ed,d.BatchableGraphics=ys,d.BatchableMesh=Rs,d.BatchableSprite=Ps,d.Batcher=Gd,d.BatcherPipe=Xu,d.BigPool=X,d.BindGroup=Zt,d.BindGroupSystem=jl,d.BitmapFont=uu,d.BitmapFontManager=ci,d.BitmapText=s0,d.BitmapTextPipe=No,d.BlendModeFilter=iE,d.BlendModePipe=Bl,d.BlurFilter=x_,d.BlurFilterPass=nn,d.Bounds=ft,d.Buffer=Pt,d.BufferImageSource=Ki,d.BufferResource=xn,d.BufferUsage=z,d.CLEAR=At,d.Cache=K,d.CanvasPool=Qt,d.CanvasPoolClass=qf,d.CanvasSource=ae,d.CanvasTextMetrics=zt,d.CanvasTextPipe=_o,d.CanvasTextSystem=Do,d.Circle=Ms,d.Color=V,d.ColorMask=Ea,d.ColorMaskPipe=ju,d.ColorMatrixFilter=PE,d.CompressedSource=yi,d.Container=rt,d.Culler=jg,d.CullerPlugin=Vg,d.CustomRenderPipe=Tl,d.D3D10_RESOURCE_DIMENSION=Su,d.D3DFMT=Et,d.DATA_URI=mS,d.DDS=U,d.DEG_TO_RAD=Th,d.DEPRECATED_SCALE_MODES=uc,d.DEPRECATED_WRAP_MODES=oc,d.DOMAdapter=$,d.DRAW_MODES=lC,d.DXGI_FORMAT=Tu,d.DXGI_TO_TEXTURE_FORMAT=wt,d.DefaultBatcher=_s,d.DefaultShader=wf,d.DisplacementFilter=IE,d.DynamicBitmapFont=Uo,d.Ellipse=Ds,d.EventEmitter=Rt,d.ExtensionType=v,d.ExtractSystem=S2,d.FOURCC_TO_TEXTURE_FORMAT=Au,d.FillGradient=hr,d.FillPattern=ii,d.Filter=le,d.FilterEffect=zr,d.FilterPipe=Zo,d.FilterSystem=Jo,d.FontStylePromiseCache=hi,d.GAUSSIAN_VALUES=Mu,d.GL_FORMATS=bn,d.GL_INTERNAL_FORMAT=Ug,d.GL_TARGETS=Ku,d.GL_TYPES=j,d.GL_WRAP_MODES=_0,d.GenerateTextureSystem=Ul,d.Geometry=rr,d.GlBackBufferSystem=S0,d.GlBatchAdaptor=Nu,d.GlBuffer=d0,d.GlBufferSystem=Wu,d.GlColorMaskSystem=Ju,d.GlContextSystem=g0,d.GlEncoderSystem=tl,d.GlGeometrySystem=Zu,d.GlGraphicsAdaptor=xl,d.GlMeshAdaptor=vl,d.GlProgram=It,d.GlProgramData=$0,d.GlRenderTarget=A0,d.GlRenderTargetAdaptor=D0,d.GlRenderTargetSystem=ll,d.GlShaderSystem=pl,d.GlStateSystem=e2,d.GlStencilSystem=el,d.GlTexture=r2,d.GlTextureSystem=yl,d.GlUboSystem=al,d.GlUniformGroupSystem=ml,d.GlobalUniformSystem=kl,d.GpuBatchAdaptor=$u,d.GpuBlendModesToPixi=bt,d.GpuBufferSystem=Vl,d.GpuColorMaskSystem=Wl,d.GpuDeviceSystem=Cn,d.GpuEncoderSystem=Yl,d.GpuGraphicsAdaptor=nc,d.GpuGraphicsContext=Wf,d.GpuMeshAdapter=ac,d.GpuMipmapGenerator=sb,d.GpuProgram=Mt,d.GpuReadBuffer=Xw,d.GpuRenderTarget=J2,d.GpuRenderTargetAdaptor=tb,d.GpuRenderTargetSystem=Jl,d.GpuShaderSystem=tc,d.GpuStateSystem=ec,d.GpuStencilModesToPixi=xe,d.GpuStencilSystem=ql,d.GpuTextureSystem=sc,d.GpuUboSystem=Kl,d.GpuUniformBatchPipe=Zl,d.Graphics=mr,d.GraphicsContext=_t,d.GraphicsContextRenderData=Yf,d.GraphicsContextSystem=Cs,d.GraphicsPath=pe,d.GraphicsPipe=mo,d.HTMLText=n0,d.HTMLTextPipe=$o,d.HTMLTextRenderData=zo,d.HTMLTextStyle=Ue,d.HTMLTextSystem=Ls,d.HelloSystem=wn,d.IGLUniformData=X3,d.ImageSource=De,d.InstructionSet=ya,d.KTX=it,d.Loader=sg,d.LoaderParserPriority=Ct,d.MSAA_QUALITY=lb,d.MaskEffectManager=ts,d.MaskEffectManagerClass=sd,d.MaskFilter=L_,d.Matrix=G,d.Mesh=vr,d.MeshGeometry=_e,d.MeshPipe=go,d.MeshPlane=XC,d.MeshRope=QC,d.MeshSimple=nR,d.NOOP=la,d.NineSliceGeometry=be,d.NineSlicePlane=cR,d.NineSliceSprite=Hb,d.NineSliceSpritePipe=Ko,d.NoiseFilter=HE,d.ObservablePoint=at,d.PI_2=xh,d.PerspectiveMesh=IC,d.PerspectivePlaneGeometry=bb,d.PipelineSystem=Ql,d.PlaneGeometry=Hs,d.Point=nt,d.Polygon=dr,d.Pool=Ji,d.PoolGroupClass=ed,d.PrepareBase=$_,d.PrepareQueue=i0,d.PrepareSystem=o0,d.PrepareUpload=a0,d.QuadGeometry=xm,d.RAD_TO_DEG=vh,d.Rectangle=W,d.RenderContainer=vC,d.RenderGroup=fd,d.RenderGroupPipe=Al,d.RenderGroupSystem=Ml,d.RenderTarget=yn,d.RenderTargetSystem=ul,d.RenderTexture=En,d.RenderableGCSystem=D2,d.RendererInitHook=ou,d.RendererType=St,d.ResizePlugin=sa,d.Resolver=fe,d.RopeGeometry=Mb,d.RoundedRectangle=Bs,d.SCALE_MODES=fC,d.STENCIL_MODES=ut,d.SVGParser=mp,d.SVGToGraphicsPath=sp,d.SchedulerSystem=Ll,d.ScissorMask=g3,d.SdfShader=kp,d.Shader=Ut,d.ShaderStage=nr,d.ShapePath=dp,d.SharedRenderPipes=zl,d.SharedSystems=Xl,d.Sprite=$t,d.SpritePipe=Dl,d.Spritesheet=da,d.State=Ht,d.StencilMask=wa,d.StencilMaskPipe=Vu,d.SystemRunner=iu,d.TEXTURE_FORMAT_BLOCK_SIZE=Fg,d.Text=Lu,d.TextStyle=Ot,d.Texture=w,d.TextureGCSystem=F2,d.TextureMatrix=ha,d.TexturePool=pt,d.TexturePoolClass=Qf,d.TextureSource=et,d.TextureStyle=Ph,d.TextureUvs=pC,d.Ticker=gt,d.TickerListener=Vi,d.TickerPlugin=na,d.TilingSprite=J_,d.TilingSpritePipe=qo,d.TilingSpriteShader=ym,d.Transform=Y_,d.Triangle=ku,d.UNIFORM_TO_ARRAY_SETTERS=Z0,d.UNIFORM_TO_SINGLE_SETTERS=K0,d.UNIFORM_TYPES_MAP=gf,d.UNIFORM_TYPES_VALUES=Ya,d.UPDATE_BLEND=rs,d.UPDATE_COLOR=Wr,d.UPDATE_PRIORITY=de,d.UPDATE_TRANSFORM=cv,d.UPDATE_VISIBLE=tr,d.UboBatch=z2,d.UboSystem=rl,d.UniformGroup=ot,d.VERSION=_i,d.VideoSource=Yr,d.ViewContainer=Me,d.ViewSystem=L2,d.ViewableBuffer=Ga,d.WGSL_ALIGN_SIZE_DATA=Pi,d.WGSL_TO_STD40_SIZE=il,d.WRAP_MODES=dC,d.WebGLRenderer=X2,d.WebGPURenderer=ub,d.WebWorkerAdapter=ch,d.WorkerManager=pu,d._getGlobalBounds=_a,d._getGlobalBoundsRecursive=Qo,d.addBits=$a,d.addMaskBounds=ss,d.addMaskLocalBounds=ns,d.addProgramDefines=Ld,d.alphaFrag=s_,d.alphaWgsl=Ru,d.applyMatrix=Tm,d.applyProjectiveTransformationToPlane=fb,d.applyStyleParams=bl,d.assignWithIgnore=pd,d.autoDetectEnvironment=oS,d.autoDetectRenderer=Nm,d.autoDetectSource=Tv,d.basisTranscoderUrls=Zs,d.bitmapFontCachePlugin=jm,d.bitmapFontTextParser=zs,d.bitmapFontXMLParser=lu,d.bitmapFontXMLStringParser=cu,d.blendTemplateFrag=Zg,d.blendTemplateVert=Qg,d.blendTemplateWgsl=Jg,d.blockDataMap=rc,d.blurTemplateWgsl=d_,d.boundsPool=Kt,d.buildAdaptiveBezier=xo,d.buildAdaptiveQuadratic=ap,d.buildArc=So,d.buildArcTo=op,d.buildArcToSvg=lp,d.buildCircle=oe,d.buildContextBatches=jf,d.buildEllipse=Gf,d.buildGeometryFromPath=EC,d.buildInstructions=c0,d.buildLine=Lf,d.buildPolygon=io,d.buildRectangle=so,d.buildRoundedRectangle=Ff,d.buildSimpleUvs=Za,d.buildTriangle=no,d.buildUvs=Ka,d.cacheTextureArray=Ym,d.calculateProjection=O0,d.checkChildrenDidChange=ba,d.checkDataUrl=ke,d.checkExtension=kt,d.checkMaxIfStatementsInShader=Td,d.childrenHelperMixin=id,d.clearList=An,d.closePointEps=If,d.collectAllRenderables=wi,d.collectRenderGroups=El,d.color32BitToUniform=ri,d.colorBit=hs,d.colorBitGl=ds,d.colorMatrixFilterFrag=v_,d.colorMatrixFilterWgsl=Ou,d.colorToUniform=M1,d.compareModeToGlCompare=o2,d.compileHighShader=sf,d.compileHighShaderGl=nf,d.compileHighShaderGlProgram=or,d.compileHighShaderGpuProgram=ar,d.compileHooks=Ha,d.compileInputs=Xa,d.compileOutputs=rf,d.compileShader=cl,d.compute2DProjection=_b,d.convertFormatIfRequired=NA,d.convertToList=Gt,d.copySearchParams=Wi,d.createIdFromString=ir,d.createLevelBuffers=yA,d.createLevelBuffersFromKTX=$A,d.createStringVariations=gh,d.createTexture=ye,d.createUboElementsSTD40=E0,d.createUboElementsWGSL=Y2,d.createUboSyncFunction=sl,d.createUboSyncFunctionSTD40=M0,d.createUboSyncFunctionWGSL=K2,d.crossOrigin=Ag,d.cullingMixin=td,d.curveEps=Qa,d.defaultFilterVert=rn,d.defaultValue=dl,d.definedProps=Wt,d.deprecation=qa,d.detectAvif=qm,d.detectBasis=pA,d.detectCompressed=YA,d.detectDefaults=Zm,d.detectMp4=Qm,d.detectOgv=Jm,d.detectVideoAlphaMode=Ra,d.detectWebm=tg,d.detectWebp=eg,d.determineCrossOrigin=wg,d.displacementFrag=A_,d.displacementVert=E_,d.displacementWgsl=Bu,d.earcut=zf,d.effectsMixin=nd,d.ensureAttributes=qu,d.ensureIsBuffer=Ia,d.ensureOptions=mn,d.ensurePrecision=Nd,d.ensureTextStyle=hR,d.executeInstructions=Sl,d.extensions=L,d.extractAttributesFromGlProgram=z0,d.extractAttributesFromGpuProgram=qd,d.extractFontFamilies=em,d.extractStructAndGroups=cs,d.fastCopy=us,d.findHooksRx=Jd,d.findMixin=ad,d.fontStringFromTextStyle=ui,d.formatShader=d3,d.fragmentGPUTemplate=lf,d.fragmentGlTemplate=hf,d.generateArraySyncSTD40=P0,d.generateArraySyncWGSL=q2,d.generateBlurFragSource=l_,d.generateBlurGlProgram=h_,d.generateBlurProgram=f_,d.generateBlurVertSource=c_,d.generateGPULayout=c3,d.generateGpuLayoutGroups=Kd,d.generateLayout=h3,d.generateLayoutHash=Zd,d.generateProgram=q0,d.generateShaderSyncCode=N0,d.generateTextStyleKey=Co,d.generateTextureBatchBit=fs,d.generateTextureBatchBitGl=ps,d.generateUID=gC,d.generateUniformsSync=Q0,d.getAdjustedBlendModeBlend=Kr,d.getAttributeInfoFromFormat=sr,d.getBatchSamplersUniformGroup=ms,d.getBitmapTextLayout=ko,d.getCanvasBoundingBox=ep,d.getCanvasFillStyle=li,d.getCanvasTexture=ol,d.getDefaultUniformValue=_f,d.getFastGlobalBounds=Om,d.getFontCss=im,d.getFontFamilyName=lg,d.getGeometryBounds=Fd,d.getGlTypeFromFormat=y0,d.getGlobalBounds=jr,d.getGlobalRenderableBounds=Bm,d.getLocalBounds=es,d.getMatrixRelativeToParent=Sa,d.getMaxFragmentPrecision=kd,d.getMaxTexturesPerBatch=Oe,d.getOrientationOfPoints=Uf,d.getParent=ud,d.getPo2TextureFromSource=Po,d.getResolutionOfUrl=Vs,d.getSVGUrl=sm,d.getSupportedCompressedTextureFormats=vu,d.getSupportedGPUCompressedTextureFormats=yu,d.getSupportedGlCompressedTextureFormats=bu,d.getSupportedTextureFormats=xi,d.getTemporaryCanvasFromImage=nm,d.getTestContext=Oa,d.getTextureBatchBindGroup=os,d.getTextureDefaultMatrix=aR,d.getTextureFormatFromKTXTexture=zA,d.getUboData=j0,d.getUniformData=V0,d.getUrlExtension=yh,d.glFormatToGPUFormat=Xg,d.glUploadBufferImageResource=i2,d.glUploadCompressedTextureResource=s2,d.glUploadImageResource=gl,d.glUploadVideoResource=n2,d.globalUniformsBit=df,d.globalUniformsBitGl=ff,d.globalUniformsUBOBitGl=Hv,d.gpuFormatToBasisTranscoderFormat=vA,d.gpuFormatToKTXBasisTranscoderFormat=VA,d.gpuUploadBufferImageResource=eb,d.gpuUploadCompressedTextureResource=rb,d.gpuUploadImageResource=ic,d.gpuUploadVideoResource=ib,d.groupD8=H,d.hasCachedCanvasTexture=L3,d.hslWgsl=qE,d.hslgl=sE,d.hslgpu=nE,d.injectBits=za,d.insertVersion=$d,d.isMobile=fR,d.isPow2=ca,d.isRenderingToScreen=F0,d.isSafari=Wp,d.isSingleItem=Nr,d.isWebGLSupported=pi,d.isWebGPUSupported=mi,d.ktxTranscoderUrls=Qs,d.loadBasis=bA,d.loadBasisOnWorker=Gg,d.loadBitmapFont=Vm,d.loadDDS=RA,d.loadEnvironmentExtensions=eu,d.loadFontAsBase64=rm,d.loadFontCSS=jo,d.loadImageBitmap=yg,d.loadJson=ng,d.loadKTX=FA,d.loadKTX2=LA,d.loadKTX2onWorker=$g,d.loadSVGImage=am,d.loadSvg=pg,d.loadTextures=mu,d.loadTxt=ag,d.loadVideoTextures=Cg,d.loadWebFont=cg,d.localUniformBit=gr,d.localUniformBitGl=Ns,d.localUniformBitGroup2=gm,d.localUniformMSDFBit=Gp,d.localUniformMSDFBitGl=Fp,d.log2=Bx,d.logDebugTexture=pR,d.logProgramError=Y0,d.logRenderGroupScene=ay,d.logScene=ny,d.mSDFBit=Ip,d.mSDFBitGl=Up,d.mapFormatToGlFormat=u2,d.mapFormatToGlInternalFormat=h2,d.mapFormatToGlType=d2,d.mapGlToVertexFormat=X0,d.mapSize=W3,d.mapType=fl,d.mapWebGLBlendModesToPixi=J0,d.maskFrag=G_,d.maskVert=F_,d.maskWgsl=Iu,d.matrixPool=qt,d.measureHtmlText=Vo,d.measureMixin=ld,d.migrateFragmentFromV7toV8=j3,d.mipmapScaleModeToGlFilter=a2,d.mixColors=Cl,d.mixHexColors=wl,d.mixStandardAnd32BitColors=lw,d.multiplyHexColors=Df,d.nextPow2=Pe,d.noiseFrag=P_,d.noiseWgsl=Gu,d.nonCompressedFormats=Dg,d.normalizeExtensionPriority=kr,d.nssvg=Ho,d.nsxhtml=Xo,d.onRenderMixin=cd,d.parseDDS=Ig,d.parseFunctionBody=_C,d.parseKTX=kg,d.path=Tt,d.pointInTriangle=Uu,d.preloadVideo=Eg,d.removeItems=rd,d.removeStructAndGroupDuplicates=Qd,d.resetUids=Ox,d.resolveCharacters=Io,d.resolveCompressedTextureUrl=WA,d.resolveJsonUrl=Rg,d.resolveTextureUrl=_u,d.resourceToTexture=xd,d.roundPixelsBit=ur,d.roundPixelsBitGl=lr,d.roundedShapeArc=cp,d.roundedShapeQuadraticCurve=hp,d.sayHello=C2,d.scaleModeToGlFilter=_l,d.setBasisTranscoderPath=gA,d.setKTXTranscoderPath=UA,d.setPositions=vm,d.setProgramName=Hd,d.setUvs=Sm,d.shapeBuilders=ei,d.sortMixin=hd,d.spritesheetAsset=Lh,d.squaredDistanceToLineSegment=si,d.stripVersion=Xd,d.testImageFormat=hu,d.testVideoFormat=js,d.textStyleToCSS=Yp,d.textureBit=u0,d.textureBitGl=l0,d.textureFrom=vd,d.tilingBit=_m,d.tilingBitGl=bm,d.toFillStyle=me,d.toLocalGlobalMixin=dd,d.toStrokeStyle=oi,d.transformVertices=bs,d.triangulateWithHoles=ro,d.uboSyncFunctionsSTD40=nl,d.uboSyncFunctionsWGSL=R0,d.uid=J,d.uniformParsers=ve,d.unpremultiplyAlpha=ow,d.unsafeEvalSupported=ru,d.updateLocalTransform=TC,d.updateQuadBounds=Hr,d.updateRenderGroupTransform=p2,d.updateRenderGroupTransforms=Rl,d.updateTransformAndChildren=Pl,d.updateTransformBackwards=Vr,d.updateWorldTransform=SC,d.v8_0_0=r1,d.v8_3_4=Mf,d.validFormats=Js,d.validateRenderables=g2,d.vertexGPUTemplate=uf,d.vertexGlTemplate=cf,d.viewportFromFrame=hC,d.vkFormatToGPUFormat=zg,d.warn=ge,d.webworkerExt=ZA,d.wrapModeToGlAddress=Sn,d}({});
//# sourceMappingURL=webworker.min.js.map