@agent-play/play-ui 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{browserAll-CxJ5n1KR.js → browserAll-Cqm89Ctx.js} +1 -1
- package/dist/assets/index-DKWpRUbE.js +298 -0
- package/dist/assets/{webworkerAll-C0uXnrAJ.js → webworkerAll-B678c6tn.js} +1 -1
- package/dist/index.html +1 -1
- package/package.json +4 -2
- package/dist/assets/index-BoW5G5Xq.js +0 -298
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/browserAll-Cqm89Ctx.js","assets/webworkerAll-B678c6tn.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
var _h=Object.defineProperty;var bh=(s,t,e)=>t in s?_h(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var q=(s,t,e)=>bh(s,typeof t!="symbol"?t+"":t,e);(function(){const t=document.createElement("link").relList;if(t&&t.supports&&t.supports("modulepreload"))return;for(const i of document.querySelectorAll('link[rel="modulepreload"]'))r(i);new MutationObserver(i=>{for(const n of i)if(n.type==="childList")for(const a of n.addedNodes)a.tagName==="LINK"&&a.rel==="modulepreload"&&r(a)}).observe(document,{childList:!0,subtree:!0});function e(i){const n={};return i.integrity&&(n.integrity=i.integrity),i.referrerPolicy&&(n.referrerPolicy=i.referrerPolicy),i.crossOrigin==="use-credentials"?n.credentials="include":i.crossOrigin==="anonymous"?n.credentials="omit":n.credentials="same-origin",n}function r(i){if(i.ep)return;i.ep=!0;const n=e(i);fetch(i.href,n)}})();const wh="modulepreload",kh=function(s){return"/agent-play/"+s},Wn={},Io=function(t,e,r){let i=Promise.resolve();if(e&&e.length>0){let a=function(h){return Promise.all(h.map(c=>Promise.resolve(c).then(u=>({status:"fulfilled",value:u}),u=>({status:"rejected",reason:u}))))};document.getElementsByTagName("link");const o=document.querySelector("meta[property=csp-nonce]"),l=(o==null?void 0:o.nonce)||(o==null?void 0:o.getAttribute("nonce"));i=a(e.map(h=>{if(h=kh(h),h in Wn)return;Wn[h]=!0;const c=h.endsWith(".css"),u=c?'[rel="stylesheet"]':"";if(document.querySelector(`link[href="${h}"]${u}`))return;const f=document.createElement("link");if(f.rel=c?"stylesheet":wh,c||(f.as="script"),f.crossOrigin="",f.href=h,l&&f.setAttribute("nonce",l),document.head.appendChild(f),c)return new Promise((d,p)=>{f.addEventListener("load",d),f.addEventListener("error",()=>p(new Error(`Unable to preload CSS for ${h}`)))})}))}function n(a){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=a,window.dispatchEvent(o),!o.defaultPrevented)throw a}return i.then(a=>{for(const o of a||[])o.status==="rejected"&&n(o.reason);return t().catch(n)})};var tt=(s=>(s.Application="application",s.WebGLPipes="webgl-pipes",s.WebGLPipesAdaptor="webgl-pipes-adaptor",s.WebGLSystem="webgl-system",s.WebGPUPipes="webgpu-pipes",s.WebGPUPipesAdaptor="webgpu-pipes-adaptor",s.WebGPUSystem="webgpu-system",s.CanvasSystem="canvas-system",s.CanvasPipesAdaptor="canvas-pipes-adaptor",s.CanvasPipes="canvas-pipes",s.Asset="asset",s.LoadParser="load-parser",s.ResolveParser="resolve-parser",s.CacheParser="cache-parser",s.DetectionParser="detection-parser",s.MaskEffect="mask-effect",s.BlendMode="blend-mode",s.TextureSource="texture-source",s.Environment="environment",s.ShapeBuilder="shape-builder",s.Batcher="batcher",s))(tt||{});const Ci=s=>{if(typeof s=="function"||typeof s=="object"&&s.extension){if(!s.extension)throw new Error("Extension class must have an extension object");s={...typeof s.extension!="object"?{type:s.extension}:s.extension,ref:s}}if(typeof s=="object")s={...s};else throw new Error("Invalid extension type");return typeof s.type=="string"&&(s.type=[s.type]),s},Ks=(s,t)=>Ci(s).priority??t,Ot={_addHandlers:{},_removeHandlers:{},_queue:{},remove(...s){return s.map(Ci).forEach(t=>{t.type.forEach(e=>{var r,i;return(i=(r=this._removeHandlers)[e])==null?void 0:i.call(r,t)})}),this},add(...s){return s.map(Ci).forEach(t=>{t.type.forEach(e=>{var n,a;const r=this._addHandlers,i=this._queue;r[e]?(a=r[e])==null||a.call(r,t):(i[e]=i[e]||[],(n=i[e])==null||n.push(t))})}),this},handle(s,t,e){var a;const r=this._addHandlers,i=this._removeHandlers;if(r[s]||i[s])throw new Error(`Extension type ${s} already has a handler`);r[s]=t,i[s]=e;const n=this._queue;return n[s]&&((a=n[s])==null||a.forEach(o=>t(o)),delete n[s]),this},handleByMap(s,t){return this.handle(s,e=>{e.name&&(t[e.name]=e.ref)},e=>{e.name&&delete t[e.name]})},handleByNamedList(s,t,e=-1){return this.handle(s,r=>{t.findIndex(n=>n.name===r.name)>=0||(t.push({name:r.name,value:r.ref}),t.sort((n,a)=>Ks(a.value,e)-Ks(n.value,e)))},r=>{const i=t.findIndex(n=>n.name===r.name);i!==-1&&t.splice(i,1)})},handleByList(s,t,e=-1){return this.handle(s,r=>{t.includes(r.ref)||(t.push(r.ref),t.sort((i,n)=>Ks(n,e)-Ks(i,e)))},r=>{const i=t.indexOf(r.ref);i!==-1&&t.splice(i,1)})},mixin(s,...t){for(const e of t)Object.defineProperties(s.prototype,Object.getOwnPropertyDescriptors(e))}},vh={extension:{type:tt.Environment,name:"browser",priority:-1},test:()=>!0,load:async()=>{await Io(()=>import("./browserAll-Cqm89Ctx.js"),__vite__mapDeps([0,1]))}},Sh={extension:{type:tt.Environment,name:"webworker",priority:0},test:()=>typeof self<"u"&&self.WorkerGlobalScope!==void 0,load:async()=>{await Io(()=>import("./webworkerAll-B678c6tn.js"),[])}};class gt{constructor(t,e,r){this._x=e||0,this._y=r||0,this._observer=t}clone(t){return new gt(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}toString(){return`[pixi.js/math:ObservablePoint x=${this._x} y=${this._y} scope=${this._observer}]`}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 Do(s){return s&&s.__esModule&&Object.prototype.hasOwnProperty.call(s,"default")?s.default:s}var Vr={exports:{}},Xn;function Ah(){return Xn||(Xn=1,(function(s){var t=Object.prototype.hasOwnProperty,e="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(e=!1));function i(l,h,c){this.fn=l,this.context=h,this.once=c||!1}function n(l,h,c,u,f){if(typeof c!="function")throw new TypeError("The listener must be a function");var d=new i(c,u||l,f),p=e?e+h:h;return l._events[p]?l._events[p].fn?l._events[p]=[l._events[p],d]:l._events[p].push(d):(l._events[p]=d,l._eventsCount++),l}function a(l,h){--l._eventsCount===0?l._events=new r:delete l._events[h]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var h=[],c,u;if(this._eventsCount===0)return h;for(u in c=this._events)t.call(c,u)&&h.push(e?u.slice(1):u);return Object.getOwnPropertySymbols?h.concat(Object.getOwnPropertySymbols(c)):h},o.prototype.listeners=function(h){var c=e?e+h:h,u=this._events[c];if(!u)return[];if(u.fn)return[u.fn];for(var f=0,d=u.length,p=new Array(d);f<d;f++)p[f]=u[f].fn;return p},o.prototype.listenerCount=function(h){var c=e?e+h:h,u=this._events[c];return u?u.fn?1:u.length:0},o.prototype.emit=function(h,c,u,f,d,p){var g=e?e+h:h;if(!this._events[g])return!1;var m=this._events[g],y=arguments.length,b,_;if(m.fn){switch(m.once&&this.removeListener(h,m.fn,void 0,!0),y){case 1:return m.fn.call(m.context),!0;case 2:return m.fn.call(m.context,c),!0;case 3:return m.fn.call(m.context,c,u),!0;case 4:return m.fn.call(m.context,c,u,f),!0;case 5:return m.fn.call(m.context,c,u,f,d),!0;case 6:return m.fn.call(m.context,c,u,f,d,p),!0}for(_=1,b=new Array(y-1);_<y;_++)b[_-1]=arguments[_];m.fn.apply(m.context,b)}else{var w=m.length,T;for(_=0;_<w;_++)switch(m[_].once&&this.removeListener(h,m[_].fn,void 0,!0),y){case 1:m[_].fn.call(m[_].context);break;case 2:m[_].fn.call(m[_].context,c);break;case 3:m[_].fn.call(m[_].context,c,u);break;case 4:m[_].fn.call(m[_].context,c,u,f);break;default:if(!b)for(T=1,b=new Array(y-1);T<y;T++)b[T-1]=arguments[T];m[_].fn.apply(m[_].context,b)}}return!0},o.prototype.on=function(h,c,u){return n(this,h,c,u,!1)},o.prototype.once=function(h,c,u){return n(this,h,c,u,!0)},o.prototype.removeListener=function(h,c,u,f){var d=e?e+h:h;if(!this._events[d])return this;if(!c)return a(this,d),this;var p=this._events[d];if(p.fn)p.fn===c&&(!f||p.once)&&(!u||p.context===u)&&a(this,d);else{for(var g=0,m=[],y=p.length;g<y;g++)(p[g].fn!==c||f&&!p[g].once||u&&p[g].context!==u)&&m.push(p[g]);m.length?this._events[d]=m.length===1?m[0]:m:a(this,d)}return this},o.prototype.removeAllListeners=function(h){var c;return h?(c=e?e+h:h,this._events[c]&&a(this,c)):(this._events=new r,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,s.exports=o})(Vr)),Vr.exports}var Th=Ah();const ke=Do(Th),Ch=Math.PI*2,Mh=180/Math.PI,Ph=Math.PI/180;class yt{constructor(t=0,e=0){this.x=0,this.y=0,this.x=t,this.y=e}clone(){return new yt(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}toString(){return`[pixi.js/math:Point x=${this.x} y=${this.y}]`}static get shared(){return Yr.x=0,Yr.y=0,Yr}}const Yr=new yt;class H{constructor(t=1,e=0,r=0,i=1,n=0,a=0){this.array=null,this.a=t,this.b=e,this.c=r,this.d=i,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,r,i,n,a){return this.a=t,this.b=e,this.c=r,this.d=i,this.tx=n,this.ty=a,this}toArray(t,e){this.array||(this.array=new Float32Array(9));const r=e||this.array;return t?(r[0]=this.a,r[1]=this.b,r[2]=0,r[3]=this.c,r[4]=this.d,r[5]=0,r[6]=this.tx,r[7]=this.ty,r[8]=1):(r[0]=this.a,r[1]=this.c,r[2]=this.tx,r[3]=this.b,r[4]=this.d,r[5]=this.ty,r[6]=0,r[7]=0,r[8]=1),r}apply(t,e){e=e||new yt;const r=t.x,i=t.y;return e.x=this.a*r+this.c*i+this.tx,e.y=this.b*r+this.d*i+this.ty,e}applyInverse(t,e){e=e||new yt;const r=this.a,i=this.b,n=this.c,a=this.d,o=this.tx,l=this.ty,h=1/(r*a+n*-i),c=t.x,u=t.y;return e.x=a*h*c+-n*h*u+(l*n-o*a)*h,e.y=r*h*u+-i*h*c+(-l*r+o*i)*h,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),r=Math.sin(t),i=this.a,n=this.c,a=this.tx;return this.a=i*e-this.b*r,this.b=i*r+this.b*e,this.c=n*e-this.d*r,this.d=n*r+this.d*e,this.tx=a*e-this.ty*r,this.ty=a*r+this.ty*e,this}append(t){const e=this.a,r=this.b,i=this.c,n=this.d;return this.a=t.a*e+t.b*i,this.b=t.a*r+t.b*n,this.c=t.c*e+t.d*i,this.d=t.c*r+t.d*n,this.tx=t.tx*e+t.ty*i+this.tx,this.ty=t.tx*r+t.ty*n+this.ty,this}appendFrom(t,e){const r=t.a,i=t.b,n=t.c,a=t.d,o=t.tx,l=t.ty,h=e.a,c=e.b,u=e.c,f=e.d;return this.a=r*h+i*u,this.b=r*c+i*f,this.c=n*h+a*u,this.d=n*c+a*f,this.tx=o*h+l*u+e.tx,this.ty=o*c+l*f+e.ty,this}setTransform(t,e,r,i,n,a,o,l,h){return this.a=Math.cos(o+h)*n,this.b=Math.sin(o+h)*n,this.c=-Math.sin(o-l)*a,this.d=Math.cos(o-l)*a,this.tx=t-(r*this.a+i*this.c),this.ty=e-(r*this.b+i*this.d),this}prepend(t){const e=this.tx;if(t.a!==1||t.b!==0||t.c!==0||t.d!==1){const r=this.a,i=this.c;this.a=r*t.a+this.b*t.c,this.b=r*t.b+this.b*t.d,this.c=i*t.a+this.d*t.c,this.d=i*t.b+this.d*t.d}return this.tx=e*t.a+this.ty*t.c+t.tx,this.ty=e*t.b+this.ty*t.d+t.ty,this}decompose(t){const e=this.a,r=this.b,i=this.c,n=this.d,a=t.pivot,o=-Math.atan2(-i,n),l=Math.atan2(r,e),h=Math.abs(o+l);return h<1e-5||Math.abs(Ch-h)<1e-5?(t.rotation=l,t.skew.x=t.skew.y=0):(t.rotation=0,t.skew.x=o,t.skew.y=l),t.scale.x=Math.sqrt(e*e+r*r),t.scale.y=Math.sqrt(i*i+n*n),t.position.x=this.tx+(a.x*e+a.y*i),t.position.y=this.ty+(a.x*r+a.y*n),t}invert(){const t=this.a,e=this.b,r=this.c,i=this.d,n=this.tx,a=t*i-e*r;return this.a=i/a,this.b=-e/a,this.c=-r/a,this.d=t/a,this.tx=(r*this.ty-i*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 H;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}toString(){return`[pixi.js:Matrix a=${this.a} b=${this.b} c=${this.c} d=${this.d} tx=${this.tx} ty=${this.ty}]`}static get IDENTITY(){return Rh.identity()}static get shared(){return Eh.identity()}}const Eh=new H,Rh=new H,Me=[1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1,0,1],Pe=[0,1,1,1,0,-1,-1,-1,0,1,1,1,0,-1,-1,-1],Ee=[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],Mi=[],Lo=[],Js=Math.sign;function Ih(){for(let s=0;s<16;s++){const t=[];Mi.push(t);for(let e=0;e<16;e++){const r=Js(Me[s]*Me[e]+Ee[s]*Pe[e]),i=Js(Pe[s]*Me[e]+Re[s]*Pe[e]),n=Js(Me[s]*Ee[e]+Ee[s]*Re[e]),a=Js(Pe[s]*Ee[e]+Re[s]*Re[e]);for(let o=0;o<16;o++)if(Me[o]===r&&Pe[o]===i&&Ee[o]===n&&Re[o]===a){t.push(o);break}}}for(let s=0;s<16;s++){const t=new H;t.set(Me[s],Pe[s],Ee[s],Re[s],0,0),Lo.push(t)}}Ih();const K={E:0,SE:1,S:2,SW:3,W:4,NW:5,N:6,NE:7,MIRROR_VERTICAL:8,MAIN_DIAGONAL:10,MIRROR_HORIZONTAL:12,REVERSE_DIAGONAL:14,uX:s=>Me[s],uY:s=>Pe[s],vX:s=>Ee[s],vY:s=>Re[s],inv:s=>s&8?s&15:-s&7,add:(s,t)=>Mi[s][t],sub:(s,t)=>Mi[s][K.inv(t)],rotate180:s=>s^4,isVertical:s=>(s&3)===2,byDirection:(s,t)=>Math.abs(s)*2<=Math.abs(t)?t>=0?K.S:K.N:Math.abs(t)*2<=Math.abs(s)?s>0?K.E:K.W:t>0?s>0?K.SE:K.SW:s>0?K.NE:K.NW,matrixAppendRotationInv:(s,t,e=0,r=0,i=0,n=0)=>{const a=Lo[K.inv(t)],o=a.a,l=a.b,h=a.c,c=a.d,u=e-Math.min(0,o*i,h*n,o*i+h*n),f=r-Math.min(0,l*i,c*n,l*i+c*n),d=s.a,p=s.b,g=s.c,m=s.d;s.a=o*d+l*g,s.b=o*p+l*m,s.c=h*d+c*g,s.d=h*p+c*m,s.tx=u*d+f*g+s.tx,s.ty=u*p+f*m+s.ty},transformRectCoords:(s,t,e,r)=>{const{x:i,y:n,width:a,height:o}=s,{x:l,y:h,width:c,height:u}=t;return e===K.E?(r.set(i+l,n+h,a,o),r):e===K.S?r.set(c-n-o+l,i+h,o,a):e===K.W?r.set(c-i-a+l,u-n-o+h,a,o):e===K.N?r.set(n+l,u-i-a+h,o,a):r.set(i+l,n+h,a,o)}},tr=[new yt,new yt,new yt,new yt];class ft{constructor(t=0,e=0,r=0,i=0){this.type="rectangle",this.x=Number(t),this.y=Number(e),this.width=Number(r),this.height=Number(i)}get left(){return this.x}get right(){return this.x+this.width}get top(){return this.y}get bottom(){return this.y+this.height}isEmpty(){return this.left===this.right||this.top===this.bottom}static get EMPTY(){return new ft(0,0,0,0)}clone(){return new ft(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,r,i=.5){const{width:n,height:a}=this;if(n<=0||a<=0)return!1;const o=this.x,l=this.y,h=r*(1-i),c=r-h,u=o-h,f=o+n+h,d=l-h,p=l+a+h,g=o+c,m=o+n-c,y=l+c,b=l+a-c;return t>=u&&t<=f&&e>=d&&e<=p&&!(t>g&&t<m&&e>y&&e<b)}intersects(t,e){if(!e){const F=this.x<t.x?t.x:this.x;if((this.right>t.right?t.right:this.right)<=F)return!1;const M=this.y<t.y?t.y:this.y;return(this.bottom>t.bottom?t.bottom:this.bottom)>M}const r=this.left,i=this.right,n=this.top,a=this.bottom;if(i<=r||a<=n)return!1;const o=tr[0].set(t.left,t.top),l=tr[1].set(t.left,t.bottom),h=tr[2].set(t.right,t.top),c=tr[3].set(t.right,t.bottom);if(h.x<=o.x||l.y<=o.y)return!1;const u=Math.sign(e.a*e.d-e.b*e.c);if(u===0||(e.apply(o,o),e.apply(l,l),e.apply(h,h),e.apply(c,c),Math.max(o.x,l.x,h.x,c.x)<=r||Math.min(o.x,l.x,h.x,c.x)>=i||Math.max(o.y,l.y,h.y,c.y)<=n||Math.min(o.y,l.y,h.y,c.y)>=a))return!1;const f=u*(l.y-o.y),d=u*(o.x-l.x),p=f*r+d*n,g=f*i+d*n,m=f*r+d*a,y=f*i+d*a;if(Math.max(p,g,m,y)<=f*o.x+d*o.y||Math.min(p,g,m,y)>=f*c.x+d*c.y)return!1;const b=u*(o.y-h.y),_=u*(h.x-o.x),w=b*r+_*n,T=b*i+_*n,k=b*r+_*a,v=b*i+_*a;return!(Math.max(w,T,k,v)<=b*o.x+_*o.y||Math.min(w,T,k,v)>=b*c.x+_*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),r=Math.min(this.x+this.width,t.x+t.width),i=Math.max(this.y,t.y),n=Math.min(this.y+this.height,t.y+t.height);return this.x=e,this.width=Math.max(r-e,0),this.y=i,this.height=Math.max(n-i,0),this}ceil(t=1,e=.001){const r=Math.ceil((this.x+this.width-e)*t)/t,i=Math.ceil((this.y+this.height-e)*t)/t;return this.x=Math.floor((this.x+e)*t)/t,this.y=Math.floor((this.y+e)*t)/t,this.width=r-this.x,this.height=i-this.y,this}scale(t,e=t){return this.x*=t,this.y*=e,this.width*=t,this.height*=e,this}enlarge(t){const e=Math.min(this.x,t.x),r=Math.max(this.x+this.width,t.x+t.width),i=Math.min(this.y,t.y),n=Math.max(this.y+this.height,t.y+t.height);return this.x=e,this.width=r-e,this.y=i,this.height=n-i,this}getBounds(t){return t||(t=new ft),t.copyFrom(this),t}containsRect(t){if(this.width<=0||this.height<=0)return!1;const e=t.x,r=t.y,i=t.x+t.width,n=t.y+t.height;return e>=this.x&&e<this.x+this.width&&r>=this.y&&r<this.y+this.height&&i>=this.x&&i<this.x+this.width&&n>=this.y&&n<this.y+this.height}set(t,e,r,i){return this.x=t,this.y=e,this.width=r,this.height=i,this}toString(){return`[pixi.js/math:Rectangle x=${this.x} y=${this.y} width=${this.width} height=${this.height}]`}}const Wr={default:-1};function ct(s="default"){return Wr[s]===void 0&&(Wr[s]=-1),++Wr[s]}const qn=new Set,xt="8.0.0",Dh="8.3.4",qe={quiet:!1,noColor:!1},st=((s,t,e=3)=>{if(qe.quiet||qn.has(t))return;let r=new Error().stack;const i=`${t}
|
|
3
|
+
Deprecated since v${s}`,n=typeof console.groupCollapsed=="function"&&!qe.noColor;typeof r>"u"?console.warn("PixiJS Deprecation Warning: ",i):(r=r.split(`
|
|
4
|
+
`).splice(e).join(`
|
|
5
|
+
`),n?(console.groupCollapsed("%cPixiJS Deprecation Warning: %c%s","color:#614108;background:#fffbe6","font-weight:normal;color:#614108;background:#fffbe6",i),console.warn(r),console.groupEnd()):(console.warn("PixiJS Deprecation Warning: ",i),console.warn(r))),qn.add(t)});Object.defineProperties(st,{quiet:{get:()=>qe.quiet,set:s=>{qe.quiet=s},enumerable:!0,configurable:!1},noColor:{get:()=>qe.noColor,set:s=>{qe.noColor=s},enumerable:!0,configurable:!1}});const Oo=()=>{};function Zn(s){return s+=s===0?1:0,--s,s|=s>>>1,s|=s>>>2,s|=s>>>4,s|=s>>>8,s|=s>>>16,s+1}function Qn(s){return!(s&s-1)&&!!s}function No(s){const t={};for(const e in s)s[e]!==void 0&&(t[e]=s[e]);return t}const Kn=Object.create(null);function Lh(s){const t=Kn[s];return t===void 0&&(Kn[s]=ct("resource")),t}const Bo=class Fo extends ke{constructor(t={}){super(),this._resourceType="textureSampler",this._touched=0,this._maxAnisotropy=1,this.destroyed=!1,t={...Fo.defaultOptions,...t},this.addressMode=t.addressMode,this.addressModeU=t.addressModeU??this.addressModeU,this.addressModeV=t.addressModeV??this.addressModeV,this.addressModeW=t.addressModeW??this.addressModeW,this.scaleMode=t.scaleMode,this.magFilter=t.magFilter??this.magFilter,this.minFilter=t.minFilter??this.minFilter,this.mipmapFilter=t.mipmapFilter??this.mipmapFilter,this.lodMinClamp=t.lodMinClamp,this.lodMaxClamp=t.lodMaxClamp,this.compare=t.compare,this.maxAnisotropy=t.maxAnisotropy??1}set addressMode(t){this.addressModeU=t,this.addressModeV=t,this.addressModeW=t}get addressMode(){return this.addressModeU}set wrapMode(t){st(xt,"TextureStyle.wrapMode is now TextureStyle.addressMode"),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._sharedResourceId=null,this.emit("change",this)}_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=Lh(t),this._resourceId}destroy(){this.destroyed=!0,this.emit("destroy",this),this.emit("change",this),this.removeAllListeners()}};Bo.defaultOptions={addressMode:"clamp-to-edge",scaleMode:"linear"};let Go=Bo;const zo=class $o extends ke{constructor(t={}){super(),this.options=t,this._gpuData=Object.create(null),this._gcLastUsed=-1,this.uid=ct("textureSource"),this._resourceType="textureSource",this._resourceId=ct("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.viewDimension="2d",this.arrayLayerCount=1,this.antialias=!1,this._touched=0,this._batchTick=-1,this._textureBindLocation=-1,t={...$o.defaultOptions,...t},this.label=t.label??"",this.resource=t.resource,this.autoGarbageCollect=t.autoGarbageCollect,this._resolution=t.resolution,t.width?this.pixelWidth=t.width*this._resolution:this.pixelWidth=this.resource?this.resourceWidth??1:1,t.height?this.pixelHeight=t.height*this._resolution:this.pixelHeight=this.resource?this.resourceHeight??1:1,this.width=this.pixelWidth/this._resolution,this.height=this.pixelHeight/this._resolution,this.format=t.format,this.dimension=t.dimensions,this.viewDimension=t.viewDimension??t.dimensions,this.arrayLayerCount=t.arrayLayerCount,this.mipLevelCount=t.mipLevelCount,this.autoGenerateMipmaps=t.autoGenerateMipmaps,this.sampleCount=t.sampleCount,this.antialias=t.antialias,this.alphaMode=t.alphaMode,this.style=new Go(No(t)),this.destroyed=!1,this._refreshPOT()}get source(){return this}get style(){return this._style}set style(t){var e,r;this.style!==t&&((e=this._style)==null||e.off("change",this._onStyleChange,this),this._style=t,(r=this._style)==null||r.on("change",this._onStyleChange,this),this._onStyleChange())}set maxAnisotropy(t){this._style.maxAnisotropy=t}get maxAnisotropy(){return this._style.maxAnisotropy}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.unload(),this.emit("destroy",this),this._style&&(this._style.destroy(),this._style=null),this.uploadMethodId=null,this.resource=null,this.removeAllListeners()}unload(){var t,e;this._resourceId=ct("resource"),this.emit("change",this),this.emit("unload",this);for(const r in this._gpuData)(e=(t=this._gpuData[r])==null?void 0:t.destroy)==null||e.call(t);this._gpuData=Object.create(null)}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,r){r||(r=this._resolution),t||(t=this.width),e||(e=this.height);const i=Math.round(t*r),n=Math.round(e*r);return this.width=i/r,this.height=n/r,this._resolution=r,this.pixelWidth===i&&this.pixelHeight===n?!1:(this._refreshPOT(),this.pixelWidth=i,this.pixelHeight=n,this.emit("resize",this),this._resourceId=ct("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=Qn(this.pixelWidth)&&Qn(this.pixelHeight)}static test(t){throw new Error("Unimplemented")}};zo.defaultOptions={resolution:1,format:"bgra8unorm",alphaMode:"premultiply-alpha-on-upload",dimensions:"2d",viewDimension:"2d",arrayLayerCount:1,mipLevelCount:1,autoGenerateMipmaps:!1,sampleCount:1,antialias:!1,autoGarbageCollect:!1};let Wt=zo;class sn extends Wt{constructor(t){const e=t.resource||new Float32Array(t.width*t.height*4);let r=t.format;r||(e instanceof Float32Array?r="rgba32float":e instanceof Int32Array||e instanceof Uint32Array?r="rgba32uint":e instanceof Int16Array||e instanceof Uint16Array?r="rgba16uint":(e instanceof Int8Array,r="bgra8unorm")),super({...t,resource:e,format:r}),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}}sn.extension=tt.TextureSource;const Jn=new H;class Oh{constructor(t,e){this.mapCoord=new H,this.uClampFrame=new Float32Array(4),this.uClampOffset=new Float32Array(2),this._textureID=-1,this._updateID=0,this.clampOffset=0,typeof e>"u"?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 r=this.mapCoord;for(let i=0;i<t.length;i+=2){const n=t[i],a=t[i+1];e[i]=n*r.a+a*r.c+r.tx,e[i+1]=n*r.b+a*r.d+r.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 r=t.orig,i=t.trim;i&&(Jn.set(r.width/i.width,0,0,r.height/i.height,-i.x/i.width,-i.y/i.height),this.mapCoord.append(Jn));const n=t.source,a=this.uClampFrame,o=this.clampMargin/n._resolution,l=this.clampOffset/n._resolution;return a[0]=(t.frame.x+o+l)/n.width,a[1]=(t.frame.y+o+l)/n.height,a[2]=(t.frame.x+t.frame.width-o+l)/n.width,a[3]=(t.frame.y+t.frame.height-o+l)/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 J extends ke{constructor({source:t,label:e,frame:r,orig:i,trim:n,defaultAnchor:a,defaultBorders:o,rotate:l,dynamic:h}={}){if(super(),this.uid=ct("texture"),this.uvs={x0:0,y0:0,x1:0,y1:0,x2:0,y2:0,x3:0,y3:0},this.frame=new ft,this.noFrame=!1,this.dynamic=!1,this.isTexture=!0,this.label=e,this.source=(t==null?void 0:t.source)??new Wt,this.noFrame=!r,r)this.frame.copyFrom(r);else{const{width:c,height:u}=this._source;this.frame.width=c,this.frame.height=u}this.orig=i||this.frame,this.trim=n,this.rotate=l??0,this.defaultAnchor=a,this.defaultBorders=o,this.destroyed=!1,this.dynamic=h||!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 Oh(this)),this._textureMatrix}get width(){return this.orig.width}get height(){return this.orig.height}updateUvs(){const{uvs:t,frame:e}=this,{width:r,height:i}=this._source,n=e.x/r,a=e.y/i,o=e.width/r,l=e.height/i;let h=this.rotate;if(h){const c=o/2,u=l/2,f=n+c,d=a+u;h=K.add(h,K.NW),t.x0=f+c*K.uX(h),t.y0=d+u*K.uY(h),h=K.add(h,2),t.x1=f+c*K.uX(h),t.y1=d+u*K.uY(h),h=K.add(h,2),t.x2=f+c*K.uX(h),t.y2=d+u*K.uY(h),h=K.add(h,2),t.x3=f+c*K.uX(h),t.y3=d+u*K.uY(h)}else t.x0=n,t.y0=a,t.x1=n+o,t.y1=a,t.x2=n+o,t.y2=a+l,t.x3=n,t.y3=a+l}destroy(t=!1){this._source&&(this._source.off("resize",this.update,this),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 st(xt,"Texture.baseTexture is now Texture.source"),this._source}}J.EMPTY=new J({label:"EMPTY",source:new Wt({label:"EMPTY"})});J.EMPTY.destroy=Oo;J.WHITE=new J({source:new sn({resource:new Uint8Array([255,255,255,255]),width:1,height:1,alphaMode:"premultiply-alpha-on-upload",label:"WHITE"}),label:"WHITE"});J.WHITE.destroy=Oo;function Nh(s,t,e){const{width:r,height:i}=e.orig,n=e.trim;if(n){const a=n.width,o=n.height;s.minX=n.x-t._x*r,s.maxX=s.minX+a,s.minY=n.y-t._y*i,s.maxY=s.minY+o}else s.minX=-t._x*r,s.maxX=s.minX+r,s.minY=-t._y*i,s.maxY=s.minY+i}const ta=new H;class Yt{constructor(t=1/0,e=1/0,r=-1/0,i=-1/0){this.minX=1/0,this.minY=1/0,this.maxX=-1/0,this.maxY=-1/0,this.matrix=ta,this.minX=t,this.minY=e,this.maxX=r,this.maxY=i}isEmpty(){return this.minX>this.maxX||this.minY>this.maxY}get rectangle(){this._rectangle||(this._rectangle=new ft);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=ta,this}set(t,e,r,i){this.minX=t,this.minY=e,this.maxX=r,this.maxY=i}addFrame(t,e,r,i,n){n||(n=this.matrix);const a=n.a,o=n.b,l=n.c,h=n.d,c=n.tx,u=n.ty;let f=this.minX,d=this.minY,p=this.maxX,g=this.maxY,m=a*t+l*e+c,y=o*t+h*e+u;m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=a*r+l*e+c,y=o*r+h*e+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=a*t+l*i+c,y=o*t+h*i+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),m=a*r+l*i+c,y=o*r+h*i+u,m<f&&(f=m),y<d&&(d=y),m>p&&(p=m),y>g&&(g=y),this.minX=f,this.minY=d,this.maxX=p,this.maxY=g}addRect(t,e){this.addFrame(t.x,t.y,t.x+t.width,t.y+t.height,e)}addBounds(t,e){this.addFrame(t.minX,t.minY,t.maxX,t.maxY,e)}addBoundsMask(t){this.minX=this.minX>t.minX?this.minX:t.minX,this.minY=this.minY>t.minY?this.minY:t.minY,this.maxX=this.maxX<t.maxX?this.maxX:t.maxX,this.maxY=this.maxY<t.maxY?this.maxY:t.maxY}applyMatrix(t){const e=this.minX,r=this.minY,i=this.maxX,n=this.maxY,{a,b:o,c:l,d:h,tx:c,ty:u}=t;let f=a*e+l*r+c,d=o*e+h*r+u;this.minX=f,this.minY=d,this.maxX=f,this.maxY=d,f=a*i+l*r+c,d=o*i+h*r+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*e+l*n+c,d=o*e+h*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d:this.maxY,f=a*i+l*n+c,d=o*i+h*n+u,this.minX=f<this.minX?f:this.minX,this.minY=d<this.minY?d:this.minY,this.maxX=f>this.maxX?f:this.maxX,this.maxY=d>this.maxY?d: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,r,i){return this.minX<t&&(this.minX=t),this.maxX>e&&(this.maxX=e),this.minY<r&&(this.minY=r),this.maxY>i&&(this.maxY=i),this}pad(t,e=t){return this.minX-=t,this.maxX+=t,this.minY-=e,this.maxY+=e,this}ceil(){return this.minX=Math.floor(this.minX),this.minY=Math.floor(this.minY),this.maxX=Math.ceil(this.maxX),this.maxY=Math.ceil(this.maxY),this}clone(){return new Yt(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,r,i){let n=this.minX,a=this.minY,o=this.maxX,l=this.maxY;i||(i=this.matrix);const h=i.a,c=i.b,u=i.c,f=i.d,d=i.tx,p=i.ty;for(let g=e;g<r;g+=2){const m=t[g],y=t[g+1],b=h*m+u*y+d,_=c*m+f*y+p;n=b<n?b:n,a=_<a?_:a,o=b>o?b:o,l=_>l?_:l}this.minX=n,this.minY=a,this.maxX=o,this.maxY=l}containsPoint(t,e){return this.minX<=t&&this.minY<=e&&this.maxX>=t&&this.maxY>=e}toString(){return`[pixi.js:Bounds minX=${this.minX} minY=${this.minY} maxX=${this.maxX} maxY=${this.maxY} width=${this.width} height=${this.height}]`}copyFrom(t){return this.minX=t.minX,this.minY=t.minY,this.maxX=t.maxX,this.maxY=t.maxY,this}}var Bh={grad:.9,turn:360,rad:360/(2*Math.PI)},ae=function(s){return typeof s=="string"?s.length>0:typeof s=="number"},dt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=Math.pow(10,t)),Math.round(e*s)/e+0},Bt=function(s,t,e){return t===void 0&&(t=0),e===void 0&&(e=1),s>e?e:s>t?s:t},Uo=function(s){return(s=isFinite(s)?s%360:0)>0?s:s+360},ea=function(s){return{r:Bt(s.r,0,255),g:Bt(s.g,0,255),b:Bt(s.b,0,255),a:Bt(s.a)}},Xr=function(s){return{r:dt(s.r),g:dt(s.g),b:dt(s.b),a:dt(s.a,3)}},Fh=/^#([0-9a-f]{3,8})$/i,er=function(s){var t=s.toString(16);return t.length<2?"0"+t:t},Ho=function(s){var t=s.r,e=s.g,r=s.b,i=s.a,n=Math.max(t,e,r),a=n-Math.min(t,e,r),o=a?n===t?(e-r)/a:n===e?2+(r-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:i}},jo=function(s){var t=s.h,e=s.s,r=s.v,i=s.a;t=t/360*6,e/=100,r/=100;var n=Math.floor(t),a=r*(1-e),o=r*(1-(t-n)*e),l=r*(1-(1-t+n)*e),h=n%6;return{r:255*[r,o,a,a,l,r][h],g:255*[l,r,r,o,a,a][h],b:255*[a,a,l,r,r,o][h],a:i}},sa=function(s){return{h:Uo(s.h),s:Bt(s.s,0,100),l:Bt(s.l,0,100),a:Bt(s.a)}},ra=function(s){return{h:dt(s.h),s:dt(s.s),l:dt(s.l),a:dt(s.a,3)}},ia=function(s){return jo((e=(t=s).s,{h:t.h,s:(e*=((r=t.l)<50?r:100-r)/100)>0?2*e/(r+e)*100:0,v:r+e,a:t.a}));var t,e,r},Ms=function(s){return{h:(t=Ho(s)).h,s:(i=(200-(e=t.s))*(r=t.v)/100)>0&&i<200?e*r/100/(i<=100?i:200-i)*100:0,l:i/2,a:t.a};var t,e,r,i},Gh=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s*,\s*([+-]?\d*\.?\d+)%\s*,\s*([+-]?\d*\.?\d+)%\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,zh=/^hsla?\(\s*([+-]?\d*\.?\d+)(deg|rad|grad|turn)?\s+([+-]?\d*\.?\d+)%\s+([+-]?\d*\.?\d+)%\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,$h=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*,\s*([+-]?\d*\.?\d+)(%)?\s*(?:,\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Uh=/^rgba?\(\s*([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s+([+-]?\d*\.?\d+)(%)?\s*(?:\/\s*([+-]?\d*\.?\d+)(%)?\s*)?\)$/i,Pi={string:[[function(s){var t=Fh.exec(s);return t?(s=t[1]).length<=4?{r:parseInt(s[0]+s[0],16),g:parseInt(s[1]+s[1],16),b:parseInt(s[2]+s[2],16),a:s.length===4?dt(parseInt(s[3]+s[3],16)/255,2):1}:s.length===6||s.length===8?{r:parseInt(s.substr(0,2),16),g:parseInt(s.substr(2,2),16),b:parseInt(s.substr(4,2),16),a:s.length===8?dt(parseInt(s.substr(6,2),16)/255,2):1}:null:null},"hex"],[function(s){var t=$h.exec(s)||Uh.exec(s);return t?t[2]!==t[4]||t[4]!==t[6]?null:ea({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(s){var t=Gh.exec(s)||zh.exec(s);if(!t)return null;var e,r,i=sa({h:(e=t[1],r=t[2],r===void 0&&(r="deg"),Number(e)*(Bh[r]||1)),s:Number(t[3]),l:Number(t[4]),a:t[5]===void 0?1:Number(t[5])/(t[6]?100:1)});return ia(i)},"hsl"]],object:[[function(s){var t=s.r,e=s.g,r=s.b,i=s.a,n=i===void 0?1:i;return ae(t)&&ae(e)&&ae(r)?ea({r:Number(t),g:Number(e),b:Number(r),a:Number(n)}):null},"rgb"],[function(s){var t=s.h,e=s.s,r=s.l,i=s.a,n=i===void 0?1:i;if(!ae(t)||!ae(e)||!ae(r))return null;var a=sa({h:Number(t),s:Number(e),l:Number(r),a:Number(n)});return ia(a)},"hsl"],[function(s){var t=s.h,e=s.s,r=s.v,i=s.a,n=i===void 0?1:i;if(!ae(t)||!ae(e)||!ae(r))return null;var a=(function(o){return{h:Uo(o.h),s:Bt(o.s,0,100),v:Bt(o.v,0,100),a:Bt(o.a)}})({h:Number(t),s:Number(e),v:Number(r),a:Number(n)});return jo(a)},"hsv"]]},na=function(s,t){for(var e=0;e<t.length;e++){var r=t[e][0](s);if(r)return[r,t[e][1]]}return[null,void 0]},Hh=function(s){return typeof s=="string"?na(s.trim(),Pi.string):typeof s=="object"&&s!==null?na(s,Pi.object):[null,void 0]},qr=function(s,t){var e=Ms(s);return{h:e.h,s:Bt(e.s+100*t,0,100),l:e.l,a:e.a}},Zr=function(s){return(299*s.r+587*s.g+114*s.b)/1e3/255},aa=function(s,t){var e=Ms(s);return{h:e.h,s:e.s,l:Bt(e.l+100*t,0,100),a:e.a}},Ei=(function(){function s(t){this.parsed=Hh(t)[0],this.rgba=this.parsed||{r:0,g:0,b:0,a:1}}return s.prototype.isValid=function(){return this.parsed!==null},s.prototype.brightness=function(){return dt(Zr(this.rgba),2)},s.prototype.isDark=function(){return Zr(this.rgba)<.5},s.prototype.isLight=function(){return Zr(this.rgba)>=.5},s.prototype.toHex=function(){return t=Xr(this.rgba),e=t.r,r=t.g,i=t.b,a=(n=t.a)<1?er(dt(255*n)):"","#"+er(e)+er(r)+er(i)+a;var t,e,r,i,n,a},s.prototype.toRgb=function(){return Xr(this.rgba)},s.prototype.toRgbString=function(){return t=Xr(this.rgba),e=t.r,r=t.g,i=t.b,(n=t.a)<1?"rgba("+e+", "+r+", "+i+", "+n+")":"rgb("+e+", "+r+", "+i+")";var t,e,r,i,n},s.prototype.toHsl=function(){return ra(Ms(this.rgba))},s.prototype.toHslString=function(){return t=ra(Ms(this.rgba)),e=t.h,r=t.s,i=t.l,(n=t.a)<1?"hsla("+e+", "+r+"%, "+i+"%, "+n+")":"hsl("+e+", "+r+"%, "+i+"%)";var t,e,r,i,n},s.prototype.toHsv=function(){return t=Ho(this.rgba),{h:dt(t.h),s:dt(t.s),v:dt(t.v),a:dt(t.a,3)};var t},s.prototype.invert=function(){return Qt({r:255-(t=this.rgba).r,g:255-t.g,b:255-t.b,a:t.a});var t},s.prototype.saturate=function(t){return t===void 0&&(t=.1),Qt(qr(this.rgba,t))},s.prototype.desaturate=function(t){return t===void 0&&(t=.1),Qt(qr(this.rgba,-t))},s.prototype.grayscale=function(){return Qt(qr(this.rgba,-1))},s.prototype.lighten=function(t){return t===void 0&&(t=.1),Qt(aa(this.rgba,t))},s.prototype.darken=function(t){return t===void 0&&(t=.1),Qt(aa(this.rgba,-t))},s.prototype.rotate=function(t){return t===void 0&&(t=15),this.hue(this.hue()+t)},s.prototype.alpha=function(t){return typeof t=="number"?Qt({r:(e=this.rgba).r,g:e.g,b:e.b,a:t}):dt(this.rgba.a,3);var e},s.prototype.hue=function(t){var e=Ms(this.rgba);return typeof t=="number"?Qt({h:t,s:e.s,l:e.l,a:e.a}):dt(e.h)},s.prototype.isEqual=function(t){return this.toHex()===Qt(t).toHex()},s})(),Qt=function(s){return s instanceof Ei?s:new Ei(s)},oa=[],jh=function(s){s.forEach(function(t){oa.indexOf(t)<0&&(t(Ei,Pi),oa.push(t))})};function Vh(s,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"},r={};for(var i in e)r[e[i]]=i;var n={};s.prototype.toName=function(a){if(!(this.rgba.a||this.rgba.r||this.rgba.g||this.rgba.b))return"transparent";var o,l,h=r[this.toHex()];if(h)return h;if(a!=null&&a.closest){var c=this.toRgb(),u=1/0,f="black";if(!n.length)for(var d in e)n[d]=new s(e[d]).toRgb();for(var p in e){var g=(o=c,l=n[p],Math.pow(o.r-l.r,2)+Math.pow(o.g-l.g,2)+Math.pow(o.b-l.b,2));g<u&&(u=g,f=p)}return f}},t.string.push([function(a){var o=a.toLowerCase(),l=o==="transparent"?"#0000":e[o];return l?new s(l).toRgb():null},"name"])}jh([Vh]);const Ze=class ks{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 ks)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?{...t}:t}_isSourceEqual(t,e){const r=typeof t;if(r!==typeof e)return!1;if(r==="number"||r==="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((n,a)=>n===e[a]);if(t!==null&&e!==null){const n=Object.keys(t),a=Object.keys(e);return n.length!==a.length?!1:n.every(o=>t[o]===e[o])}return t===e}toRgba(){const[t,e,r,i]=this._components;return{r:t,g:e,b:r,a:i}}toRgb(){const[t,e,r]=this._components;return{r:t,g:e,b:r}}toRgbaString(){const[t,e,r]=this.toUint8RgbArray();return`rgba(${t},${e},${r},${this.alpha})`}toUint8RgbArray(t){const[e,r,i]=this._components;return this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb),t[0]=Math.round(e*255),t[1]=Math.round(r*255),t[2]=Math.round(i*255),t}toArray(t){this._arrayRgba||(this._arrayRgba=[]),t||(t=this._arrayRgba);const[e,r,i,n]=this._components;return t[0]=e,t[1]=r,t[2]=i,t[3]=n,t}toRgbArray(t){this._arrayRgb||(this._arrayRgb=[]),t||(t=this._arrayRgb);const[e,r,i]=this._components;return t[0]=e,t[1]=r,t[2]=i,t}toNumber(){return this._int}toBgrNumber(){const[t,e,r]=this.toUint8RgbArray();return(r<<16)+(e<<8)+t}toLittleEndianNumber(){const t=this._int;return(t>>16)+(t&65280)+((t&255)<<16)}multiply(t){const[e,r,i,n]=ks._temp.setValue(t)._components;return this._components[0]*=e,this._components[1]*=r,this._components[2]*=i,this._components[3]*=n,this._refreshInt(),this._value=null,this}premultiply(t,e=!0){return e&&(this._components[0]*=t,this._components[1]*=t,this._components[2]*=t),this._components[3]=t,this._refreshInt(),this._value=null,this}toPremultiplied(t,e=!0){if(t===1)return(255<<24)+this._int;if(t===0)return e?0:this._int;let r=this._int>>16&255,i=this._int>>8&255,n=this._int&255;return e&&(r=r*t+.5|0,i=i*t+.5|0,n=n*t+.5|0),(t*255<<24)+(r<<16)+(i<<8)+n}toHex(){const t=this._int.toString(16);return`#${"000000".substring(0,6-t.length)+t}`}toHexa(){const e=Math.round(this._components[3]*255).toString(16);return this.toHex()+"00".substring(0,2-e.length)+e}setAlpha(t){return this._components[3]=this._clamp(t),this._value=null,this}_normalize(t){let e,r,i,n;if((typeof t=="number"||t instanceof Number)&&t>=0&&t<=16777215){const a=t;e=(a>>16&255)/255,r=(a>>8&255)/255,i=(a&255)/255,n=1}else if((Array.isArray(t)||t instanceof Float32Array)&&t.length>=3&&t.length<=4)t=this._clamp(t),[e,r,i,n=1]=t;else if((t instanceof Uint8Array||t instanceof Uint8ClampedArray)&&t.length>=3&&t.length<=4)t=this._clamp(t,0,255),[e,r,i,n=255]=t,e/=255,r/=255,i/=255,n/=255;else if(typeof t=="string"||typeof t=="object"){if(typeof t=="string"){const o=ks.HEX_PATTERN.exec(t);o&&(t=`#${o[2]}`)}const a=Qt(t);a.isValid()&&({r:e,g:r,b:i,a:n}=a.rgba,e/=255,r/=255,i/=255)}if(e!==void 0)this._components[0]=e,this._components[1]=r,this._components[2]=i,this._components[3]=n,this._refreshInt();else throw new Error(`Unable to convert color ${t}`)}_refreshInt(){this._clamp(this._components);const[t,e,r]=this._components;this._int=(t*255<<16)+(e*255<<8)+(r*255|0)}_clamp(t,e=0,r=1){return typeof t=="number"?Math.min(Math.max(t,e),r):(t.forEach((i,n)=>{t[n]=Math.min(Math.max(i,e),r)}),t)}static isColorLike(t){return typeof t=="number"||typeof t=="string"||t instanceof Number||t instanceof ks||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}};Ze.shared=new Ze;Ze._temp=new Ze;Ze.HEX_PATTERN=/^(#|0x)?(([a-f0-9]{3}){1,2}([a-f0-9]{2})?)$/i;let ue=Ze;const Yh={cullArea:null,cullable:!1,cullableChildren:!0};let Qr=0;const la=500;function Lt(...s){Qr!==la&&(Qr++,Qr===la?console.warn("PixiJS Warning: too many warnings, no more warnings will be reported to the console by PixiJS."):console.warn("PixiJS Warning: ",...s))}const rn={_registeredResources:new Set,register(s){this._registeredResources.add(s)},unregister(s){this._registeredResources.delete(s)},release(){this._registeredResources.forEach(s=>s.clear())},get registeredCount(){return this._registeredResources.size},isRegistered(s){return this._registeredResources.has(s)},reset(){this._registeredResources.clear()}};class Wh{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 r;let e;return this._index>0?e=this._pool[--this._index]:(e=new this._classType,this._count++),(r=e.init)==null||r.call(e,t),e}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(){if(this._pool.length>0&&this._pool[0].destroy)for(let t=0;t<this._index;t++)this._pool[t].destroy();this._pool.length=0,this._count=0,this._index=0}}class Xh{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 Wh(t)),this._poolsByClass.get(t)}stats(){const t={};return this._poolsByClass.forEach(e=>{const r=t[e._classType.name]?e._classType.name+e._classType.ID:e._classType.name;t[r]={free:e.totalFree,used:e.totalUsed,size:e.totalSize}}),t}clear(){this._poolsByClass.forEach(t=>t.clear()),this._poolsByClass.clear()}}const Et=new Xh;rn.register(Et);const qh={get isCachedAsTexture(){var s;return!!((s=this.renderGroup)!=null&&s.isCachedAsTexture)},cacheAsTexture(s){typeof s=="boolean"&&s===!1?this.disableRenderGroup():(this.enableRenderGroup(),this.renderGroup.enableCacheAsTexture(s===!0?{}:s))},updateCacheTexture(){var s;(s=this.renderGroup)==null||s.updateCacheTexture()},get cacheAsBitmap(){return this.isCachedAsTexture},set cacheAsBitmap(s){st("v8.6.0","cacheAsBitmap is deprecated, use cacheAsTexture instead."),this.cacheAsTexture(s)}};function Zh(s,t,e){const r=s.length;let i;if(t>=r||e===0)return;e=t+e>r?r-t:e;const n=r-e;for(i=t;i<n;++i)s[i]=s[i+e];s.length=n}const Qh={allowChildren:!0,removeChildren(s=0,t){var n;const e=t??this.children.length,r=e-s,i=[];if(r>0&&r<=e){for(let o=e-1;o>=s;o--){const l=this.children[o];l&&(i.push(l),l.parent=null)}Zh(this.children,s,e);const a=this.renderGroup||this.parentRenderGroup;a&&a.removeChildren(i);for(let o=0;o<i.length;++o){const l=i[o];(n=l.parentRenderLayer)==null||n.detach(l),this.emit("childRemoved",l,this,o),i[o].emit("removed",this)}return i.length>0&&this._didViewChangeTick++,i}else if(r===0&&this.children.length===0)return i;throw new RangeError("removeChildren: numeric values are outside the acceptable range.")},removeChildAt(s){const t=this.getChildAt(s);return this.removeChild(t)},getChildAt(s){if(s<0||s>=this.children.length)throw new Error(`getChildAt: Index (${s}) does not exist.`);return this.children[s]},setChildIndex(s,t){if(t<0||t>=this.children.length)throw new Error(`The index ${t} supplied is out of bounds ${this.children.length}`);this.getChildIndex(s),this.addChildAt(s,t)},getChildIndex(s){const t=this.children.indexOf(s);if(t===-1)throw new Error("The supplied Container must be a child of the caller");return t},addChildAt(s,t){this.allowChildren||st(xt,"addChildAt: Only Containers will be allowed to add children in v8.0.0");const{children:e}=this;if(t<0||t>e.length)throw new Error(`${s}addChildAt: The index ${t} supplied is out of bounds ${e.length}`);const r=s.parent===this;if(s.parent){const n=s.parent.children.indexOf(s);if(r){if(n===t)return s;s.parent.children.splice(n,1)}else s.removeFromParent()}t===e.length?e.push(s):e.splice(t,0,s),s.parent=this,s.didChange=!0,s._updateFlags=15;const i=this.renderGroup||this.parentRenderGroup;return i&&i.addChild(s),this.sortableChildren&&(this.sortDirty=!0),r||(this.emit("childAdded",s,this,t),s.emit("added",this)),s},swapChildren(s,t){if(s===t)return;const e=this.getChildIndex(s),r=this.getChildIndex(t);this.children[e]=t,this.children[r]=s;const i=this.renderGroup||this.parentRenderGroup;i&&(i.structureDidChange=!0),this._didContainerChangeTick++},removeFromParent(){var s;(s=this.parent)==null||s.removeChild(this)},reparentChild(...s){return s.length===1?this.reparentChildAt(s[0],this.children.length):(s.forEach(t=>this.reparentChildAt(t,this.children.length)),s[0])},reparentChildAt(s,t){if(s.parent===this)return this.setChildIndex(s,t),s;const e=s.worldTransform.clone();s.removeFromParent(),this.addChildAt(s,t);const r=this.worldTransform.clone();return r.invert(),e.prepend(r),s.setFromMatrix(e),s},replaceChild(s,t){s.updateLocalTransform(),this.addChildAt(t,this.getChildIndex(s)),t.setFromMatrix(s.localTransform),t.updateLocalTransform(),this.removeChild(s)}},Kh={collectRenderables(s,t,e){this.parentRenderLayer&&this.parentRenderLayer!==e||this.globalDisplayStatus<7||!this.includeInBuild||(this.sortableChildren&&this.sortChildren(),this.isSimple?this.collectRenderablesSimple(s,t,e):this.renderGroup?t.renderPipes.renderGroup.addRenderGroup(this.renderGroup,s):this.collectRenderablesWithEffects(s,t,e))},collectRenderablesSimple(s,t,e){const r=this.children,i=r.length;for(let n=0;n<i;n++)r[n].collectRenderables(s,t,e)},collectRenderablesWithEffects(s,t,e){const{renderPipes:r}=t;for(let i=0;i<this.effects.length;i++){const n=this.effects[i];r[n.pipe].push(n,this,s)}this.collectRenderablesSimple(s,t,e);for(let i=this.effects.length-1;i>=0;i--){const n=this.effects[i];r[n.pipe].pop(n,this,s)}}};class ha{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 Jh{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 r=this._tests[e];if(r.test(t))return Et.get(r.maskClass,t)}return t}returnMaskEffect(t){Et.return(t)}}const Ri=new Jh;Ot.handleByList(tt.MaskEffect,Ri._effectClasses);const tc={_maskEffect:null,_maskOptions:{inverse:!1},_filterEffect:null,effects:[],_markStructureAsChanged(){const s=this.renderGroup||this.parentRenderGroup;s&&(s.structureDidChange=!0)},addEffect(s){this.effects.indexOf(s)===-1&&(this.effects.push(s),this.effects.sort((e,r)=>e.priority-r.priority),this._markStructureAsChanged(),this._updateIsSimple())},removeEffect(s){const t=this.effects.indexOf(s);t!==-1&&(this.effects.splice(t,1),this._markStructureAsChanged(),this._updateIsSimple())},set mask(s){const t=this._maskEffect;(t==null?void 0:t.mask)!==s&&(t&&(this.removeEffect(t),Ri.returnMaskEffect(t),this._maskEffect=null),s!=null&&(this._maskEffect=Ri.getMaskEffect(s),this.addEffect(this._maskEffect)))},get mask(){var s;return(s=this._maskEffect)==null?void 0:s.mask},setMask(s){this._maskOptions={...this._maskOptions,...s},s.mask&&(this.mask=s.mask),this._markStructureAsChanged()},set filters(s){var n;!Array.isArray(s)&&s&&(s=[s]);const t=this._filterEffect||(this._filterEffect=new ha);s=s;const e=(s==null?void 0:s.length)>0,r=((n=t.filters)==null?void 0:n.length)>0,i=e!==r;s=Array.isArray(s)?s.slice(0):s,t.filters=Object.freeze(s),i&&(e?this.addEffect(t):(this.removeEffect(t),t.filters=s??null))},get filters(){var s;return(s=this._filterEffect)==null?void 0:s.filters},set filterArea(s){this._filterEffect||(this._filterEffect=new ha),this._filterEffect.filterArea=s},get filterArea(){var s;return(s=this._filterEffect)==null?void 0:s.filterArea}},ec={label:null,get name(){return st(xt,"Container.name property has been removed, use Container.label instead"),this.label},set name(s){st(xt,"Container.name property has been removed, use Container.label instead"),this.label=s},getChildByName(s,t=!1){return this.getChildByLabel(s,t)},getChildByLabel(s,t=!1){const e=this.children;for(let r=0;r<e.length;r++){const i=e[r];if(i.label===s||s instanceof RegExp&&s.test(i.label))return i}if(t)for(let r=0;r<e.length;r++){const n=e[r].getChildByLabel(s,!0);if(n)return n}return null},getChildrenByLabel(s,t=!1,e=[]){const r=this.children;for(let i=0;i<r.length;i++){const n=r[i];(n.label===s||s instanceof RegExp&&s.test(n.label))&&e.push(n)}if(t)for(let i=0;i<r.length;i++)r[i].getChildrenByLabel(s,!0,e);return e}},kt=Et.getPool(H),he=Et.getPool(Yt),sc=new H,rc={getFastGlobalBounds(s,t){t||(t=new Yt),t.clear(),this._getGlobalBoundsRecursive(!!s,t,this.parentRenderLayer),t.isValid||t.set(0,0,0,0);const e=this.renderGroup||this.parentRenderGroup;return t.applyMatrix(e.worldTransform),t},_getGlobalBoundsRecursive(s,t,e){let r=t;if(s&&this.parentRenderLayer&&this.parentRenderLayer!==e||this.localDisplayStatus!==7||!this.measurable)return;const i=!!this.effects.length;if((this.renderGroup||i)&&(r=he.get().clear()),this.boundsArea)t.addRect(this.boundsArea,this.worldTransform);else{if(this.renderPipeId){const a=this.bounds;r.addFrame(a.minX,a.minY,a.maxX,a.maxY,this.groupTransform)}const n=this.children;for(let a=0;a<n.length;a++)n[a]._getGlobalBoundsRecursive(s,r,e)}if(i){let n=!1;const a=this.renderGroup||this.parentRenderGroup;for(let o=0;o<this.effects.length;o++)this.effects[o].addBounds&&(n||(n=!0,r.applyMatrix(a.worldTransform)),this.effects[o].addBounds(r,!0));n&&r.applyMatrix(a.worldTransform.copyTo(sc).invert()),t.addBounds(r),he.return(r)}else this.renderGroup&&(t.addBounds(r,this.relativeGroupTransform),he.return(r))}};function Vo(s,t,e){e.clear();let r,i;return s.parent?t?r=s.parent.worldTransform:(i=kt.get().identity(),r=nn(s,i)):r=H.IDENTITY,Yo(s,e,r,t),i&&kt.return(i),e.isValid||e.set(0,0,0,0),e}function Yo(s,t,e,r){var o,l;if(!s.visible||!s.measurable)return;let i;r?i=s.worldTransform:(s.updateLocalTransform(),i=kt.get(),i.appendFrom(s.localTransform,e));const n=t,a=!!s.effects.length;if(a&&(t=he.get().clear()),s.boundsArea)t.addRect(s.boundsArea,i);else{const h=s.bounds;h&&!h.isEmpty()&&(t.matrix=i,t.addBounds(h));for(let c=0;c<s.children.length;c++)Yo(s.children[c],t,i,r)}if(a){for(let h=0;h<s.effects.length;h++)(l=(o=s.effects[h]).addBounds)==null||l.call(o,t);n.addBounds(t,H.IDENTITY),he.return(t)}r||kt.return(i)}function nn(s,t){const e=s.parent;return e&&(nn(e,t),e.updateLocalTransform(),t.append(e.localTransform)),t}function Wo(s,t){if(s===16777215||!t)return t;if(t===16777215||!s)return s;const e=s>>16&255,r=s>>8&255,i=s&255,n=t>>16&255,a=t>>8&255,o=t&255,l=e*n/255|0,h=r*a/255|0,c=i*o/255|0;return(l<<16)+(h<<8)+c}const ca=16777215;function ua(s,t){return s===ca?t:t===ca?s:Wo(s,t)}function pr(s){return((s&255)<<16)+(s&65280)+(s>>16&255)}const ic={getGlobalAlpha(s){if(s)return this.renderGroup?this.renderGroup.worldAlpha:this.parentRenderGroup?this.parentRenderGroup.worldAlpha*this.alpha:this.alpha;let t=this.alpha,e=this.parent;for(;e;)t*=e.alpha,e=e.parent;return t},getGlobalTransform(s=new H,t){if(t)return s.copyFrom(this.worldTransform);this.updateLocalTransform();const e=nn(this,kt.get().identity());return s.appendFrom(this.localTransform,e),kt.return(e),s},getGlobalTint(s){if(s)return this.renderGroup?pr(this.renderGroup.worldColor):this.parentRenderGroup?pr(ua(this.localColor,this.parentRenderGroup.worldColor)):this.tint;let t=this.localColor,e=this.parent;for(;e;)t=ua(t,e.localColor),e=e.parent;return pr(t)}};function Xo(s,t,e){return t.clear(),e||(e=H.IDENTITY),qo(s,t,e,s,!0),t.isValid||t.set(0,0,0,0),t}function qo(s,t,e,r,i){var l,h;let n;if(i)n=kt.get(),n=e.copyTo(n);else{if(!s.visible||!s.measurable)return;s.updateLocalTransform();const c=s.localTransform;n=kt.get(),n.appendFrom(c,e)}const a=t,o=!!s.effects.length;if(o&&(t=he.get().clear()),s.boundsArea)t.addRect(s.boundsArea,n);else{s.renderPipeId&&(t.matrix=n,t.addBounds(s.bounds));const c=s.children;for(let u=0;u<c.length;u++)qo(c[u],t,n,r,!1)}if(o){for(let c=0;c<s.effects.length;c++)(h=(l=s.effects[c]).addLocalBounds)==null||h.call(l,t,r);a.addBounds(t,H.IDENTITY),he.return(t)}kt.return(n)}function Zo(s,t){const e=s.children;for(let r=0;r<e.length;r++){const i=e[r],n=i.uid,a=(i._didViewChangeTick&65535)<<16|i._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,i.children.length&&Zo(i,t)}return t.didChange}const nc=new H,ac={_localBoundsCacheId:-1,_localBoundsCacheData:null,_setWidth(s,t){const e=Math.sign(this.scale.x)||1;t!==0?this.scale.x=s/t*e:this.scale.x=e},_setHeight(s,t){const e=Math.sign(this.scale.y)||1;t!==0?this.scale.y=s/t*e:this.scale.y=e},getLocalBounds(){this._localBoundsCacheData||(this._localBoundsCacheData={data:[],index:1,didChange:!1,localBounds:new Yt});const s=this._localBoundsCacheData;return s.index=1,s.didChange=!1,s.data[0]!==this._didViewChangeTick&&(s.didChange=!0,s.data[0]=this._didViewChangeTick),Zo(this,s),s.didChange&&Xo(this,s.localBounds,nc),s.localBounds},getBounds(s,t){return Vo(this,s,t||new Yt)}},oc={_onRender:null,set onRender(s){const t=this.renderGroup||this.parentRenderGroup;if(!s){this._onRender&&(t==null||t.removeOnRender(this)),this._onRender=null;return}this._onRender||t==null||t.addOnRender(this),this._onRender=s},get onRender(){return this._onRender}},lc={_zIndex:0,sortDirty:!1,sortableChildren:!1,get zIndex(){return this._zIndex},set zIndex(s){this._zIndex!==s&&(this._zIndex=s,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(hc))}};function hc(s,t){return s._zIndex-t._zIndex}const cc={getGlobalPosition(s=new yt,t=!1){return this.parent?this.parent.toGlobal(this._position,s,t):(s.x=this._position.x,s.y=this._position.y),s},toGlobal(s,t,e=!1){const r=this.getGlobalTransform(kt.get(),e);return t=r.apply(s,t),kt.return(r),t},toLocal(s,t,e,r){t&&(s=t.toGlobal(s,e,r));const i=this.getGlobalTransform(kt.get(),r);return e=i.applyInverse(s,e),kt.return(i),e}};class an{constructor(){this.uid=ct("instructionSet"),this.instructions=[],this.instructionSize=0,this.renderables=[],this.gcTick=0}reset(){this.instructionSize=0}destroy(){this.instructions.length=0,this.renderables.length=0,this.renderPipes=null,this.gcTick=0}add(t){this.instructions[this.instructionSize++]=t}log(){this.instructions.length=this.instructionSize,console.table(this.instructions,["type","action"])}}let uc=0;class dc{constructor(t){this._poolKeyHash=Object.create(null),this._texturePool={},this.textureOptions=t||{},this.enableFullScreen=!1,this.textureStyle=new Go(this.textureOptions)}createTexture(t,e,r,i){const n=new Wt({...this.textureOptions,width:t,height:e,resolution:1,antialias:r,autoGarbageCollect:!1,autoGenerateMipmaps:i});return new J({source:n,label:`texturePool_${uc++}`})}getOptimalTexture(t,e,r=1,i,n=!1){let a=Math.ceil(t*r-1e-6),o=Math.ceil(e*r-1e-6);a=Zn(a),o=Zn(o);const l=i?1:0,h=n?1:0,c=(a<<17)+(o<<2)+(h<<1)+l;this._texturePool[c]||(this._texturePool[c]=[]);let u=this._texturePool[c].pop();return u||(u=this.createTexture(a,o,i,n)),u.source._resolution=r,u.source.width=a/r,u.source.height=o/r,u.source.pixelWidth=a,u.source.pixelHeight=o,u.frame.x=0,u.frame.y=0,u.frame.width=t,u.frame.height=e,u.updateUvs(),this._poolKeyHash[u.uid]=c,u}getSameSizeTexture(t,e=!1){const r=t.source;return this.getOptimalTexture(t.width,t.height,r._resolution,e)}returnTexture(t,e=!1){const r=this._poolKeyHash[t.uid];e&&(t.source.style=this.textureStyle),this._texturePool[r].push(t)}clear(t){if(t=t!==!1,t)for(const e in this._texturePool){const r=this._texturePool[e];if(r)for(let i=0;i<r.length;i++)r[i].destroy(!0)}this._texturePool={}}}const Qo=new dc;rn.register(Qo);class fc{constructor(){this.renderPipeId="renderGroup",this.root=null,this.canBundle=!1,this.renderGroupParent=null,this.renderGroupChildren=[],this.worldTransform=new H,this.worldColorAlpha=4294967295,this.worldColor=16777215,this.worldAlpha=1,this.childrenToUpdate=Object.create(null),this.updateTick=0,this.gcTick=0,this.childrenRenderablesToUpdate={list:[],index:0},this.structureDidChange=!0,this.instructionSet=new an,this._onRenderContainers=[],this.textureNeedsUpdate=!0,this.isCachedAsTexture=!1,this._matrixDirty=7}init(t){this.root=t,t._onRender&&this.addOnRender(t),t.didChange=!0;const e=t.children;for(let r=0;r<e.length;r++){const i=e[r];i._updateFlags=15,this.addChild(i)}}enableCacheAsTexture(t={}){this.textureOptions=t,this.isCachedAsTexture=!0,this.textureNeedsUpdate=!0}disableCacheAsTexture(){this.isCachedAsTexture=!1,this.texture&&(Qo.returnTexture(this.texture,!0),this.texture=null)}updateCacheTexture(){this.textureNeedsUpdate=!0;const t=this._parentCacheAsTextureRenderGroup;t&&!t.textureNeedsUpdate&&t.updateCacheTexture()}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,this.disableCacheAsTexture()}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 r=0;r<e.length;r++)this.addChild(e[r])}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 r=0;r<e.length;r++)this.removeChild(e[r])}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||(this.instructionSet.renderPipes[t.renderPipeId].updateRenderable(t),t.didViewUpdate=!1)}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(t){for(let e=0;e<this._onRenderContainers.length;e++)this._onRenderContainers[e]._onRender(t)}destroy(){this.disableCacheAsTexture(),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 r=0;r<e.length;r++)this._getChildren(e[r],t);return t}_getChildren(t,e=[]){if(e.push(t),t.renderGroup)return e;const r=t.children;for(let i=0;i<r.length;i++)this._getChildren(r[i],e);return e}invalidateMatrices(){this._matrixDirty=7}get inverseWorldTransform(){return(this._matrixDirty&1)===0?this._inverseWorldTransform:(this._matrixDirty&=-2,this._inverseWorldTransform||(this._inverseWorldTransform=new H),this._inverseWorldTransform.copyFrom(this.worldTransform).invert())}get textureOffsetInverseTransform(){return(this._matrixDirty&2)===0?this._textureOffsetInverseTransform:(this._matrixDirty&=-3,this._textureOffsetInverseTransform||(this._textureOffsetInverseTransform=new H),this._textureOffsetInverseTransform.copyFrom(this.inverseWorldTransform).translate(-this._textureBounds.x,-this._textureBounds.y))}get inverseParentTextureTransform(){if((this._matrixDirty&4)===0)return this._inverseParentTextureTransform;this._matrixDirty&=-5;const t=this._parentCacheAsTextureRenderGroup;return t?(this._inverseParentTextureTransform||(this._inverseParentTextureTransform=new H),this._inverseParentTextureTransform.copyFrom(this.worldTransform).prepend(t.inverseWorldTransform).translate(-t._textureBounds.x,-t._textureBounds.y)):this.worldTransform}get cacheToLocalTransform(){return this.isCachedAsTexture?this.textureOffsetInverseTransform:this._parentCacheAsTextureRenderGroup?this._parentCacheAsTextureRenderGroup.textureOffsetInverseTransform:null}}function pc(s,t,e={}){for(const r in t)!e[r]&&t[r]!==void 0&&(s[r]=t[r])}const Kr=new gt(null),sr=new gt(null),Jr=new gt(null,1,1),rr=new gt(null),da=1,mc=2,ti=4;class ve extends ke{constructor(t={}){var e,r;super(),this.uid=ct("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.parentRenderLayer=null,this.updateTick=-1,this.localTransform=new H,this.relativeGroupTransform=new H,this.groupTransform=this.relativeGroupTransform,this.destroyed=!1,this._position=new gt(this,0,0),this._scale=Jr,this._pivot=sr,this._origin=rr,this._skew=Kr,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=[],pc(this,t,{children:!0,parent:!0,effects:!0}),(e=t.children)==null||e.forEach(i=>this.addChild(i)),(r=t.parent)==null||r.addChild(this)}static mixin(t){st("8.8.0","Container.mixin is deprecated, please use extensions.mixin instead."),Ot.mixin(ve,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(this.allowChildren||st(xt,"addChild: Only Containers will be allowed to add children in v8.0.0"),t.length>1){for(let i=0;i<t.length;i++)this.addChild(t[i]);return t[0]}const e=t[0],r=this.renderGroup||this.parentRenderGroup;return e.parent===this?(this.children.splice(this.children.indexOf(e),1),this.children.push(e),r&&(r.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._updateFlags=15,r&&r.addChild(e),this.emit("childAdded",e,this,this.children.length-1),e.emit("added",this),this._didViewChangeTick++,e._zIndex!==0&&e.depthOfChildModified(),e)}removeChild(...t){if(t.length>1){for(let i=0;i<t.length;i++)this.removeChild(t[i]);return t[0]}const e=t[0],r=this.children.indexOf(e);return r>-1&&(this._didViewChangeTick++,this.children.splice(r,1),this.renderGroup?this.renderGroup.removeChild(e):this.parentRenderGroup&&this.parentRenderGroup.removeChild(e),e.parentRenderLayer&&e.parentRenderLayer.detach(e),e.parent=null,this.emit("childRemoved",e,this,r),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=Et.get(fc,this),this.groupTransform=H.IDENTITY,t==null||t.addChild(this),this._updateIsSimple()}disableRenderGroup(){if(!this.renderGroup)return;const t=this.parentRenderGroup;t==null||t.removeChild(this),Et.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 H),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*Mh}set angle(t){this.rotation=t*Ph}get pivot(){return this._pivot===sr&&(this._pivot=new gt(this,0,0)),this._pivot}set pivot(t){this._pivot===sr&&(this._pivot=new gt(this,0,0),this._origin!==rr&&Lt("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._pivot.set(t):this._pivot.copyFrom(t)}get skew(){return this._skew===Kr&&(this._skew=new gt(this,0,0)),this._skew}set skew(t){this._skew===Kr&&(this._skew=new gt(this,0,0)),this._skew.copyFrom(t)}get scale(){return this._scale===Jr&&(this._scale=new gt(this,1,1)),this._scale}set scale(t){this._scale===Jr&&(this._scale=new gt(this,0,0)),typeof t=="string"&&(t=parseFloat(t)),typeof t=="number"?this._scale.set(t):this._scale.copyFrom(t)}get origin(){return this._origin===rr&&(this._origin=new gt(this,0,0)),this._origin}set origin(t){this._origin===rr&&(this._origin=new gt(this,0,0),this._pivot!==sr&&Lt("Setting both a pivot and origin on a Container is not recommended. This can lead to unexpected behavior if not handled carefully.")),typeof t=="number"?this._origin.set(t):this._origin.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){const r=this.getLocalBounds();typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,r.width),e!==void 0&&this._setHeight(e,r.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.origin.set(typeof t.originX=="number"?t.originX:this.origin.x,typeof t.originY=="number"?t.originY:this.origin.y),this}setFromMatrix(t){t.decompose(this)}updateLocalTransform(){const t=this._didContainerChangeTick;if(this._didLocalTransformChangeId===t)return;this._didLocalTransformChangeId=t;const e=this.localTransform,r=this._scale,i=this._pivot,n=this._origin,a=this._position,o=r._x,l=r._y,h=i._x,c=i._y,u=-n._x,f=-n._y;e.a=this._cx*o,e.b=this._sx*o,e.c=this._cy*l,e.d=this._sy*l,e.tx=a._x-(h*e.a+c*e.c)+(u*e.a+f*e.c)-u,e.ty=a._y-(h*e.b+c*e.d)+(u*e.b+f*e.d)-f}set alpha(t){t!==this.localAlpha&&(this.localAlpha=t,this._updateFlags|=da,this._onUpdate())}get alpha(){return this.localAlpha}set tint(t){const r=ue.shared.setValue(t??16777215).toBgrNumber();r!==this.localColor&&(this.localColor=r,this._updateFlags|=da,this._onUpdate())}get tint(){return pr(this.localColor)}set blendMode(t){this.localBlendMode!==t&&(this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._updateFlags|=mc,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|=ti,this.localDisplayStatus^=2,this._onUpdate(),this.emit("visibleChanged",t))}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|=ti,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|=ti,this.localDisplayStatus^=1,this.parentRenderGroup&&(this.parentRenderGroup.structureDidChange=!0),this._onUpdate())}get isRenderable(){return this.localDisplayStatus===7&&this.groupAlpha>0}destroy(t=!1){var i;if(this.destroyed)return;this.destroyed=!0;let e;if(this.children.length&&(e=this.removeChildren(0,this.children.length)),this.removeFromParent(),this.parent=null,this._maskEffect=null,this._filterEffect=null,this.effects=null,this._position=null,this._scale=null,this._pivot=null,this._origin=null,this._skew=null,this.emit("destroyed",this),this.removeAllListeners(),(typeof t=="boolean"?t:t==null?void 0:t.children)&&e)for(let n=0;n<e.length;++n)e[n].destroy(t);(i=this.renderGroup)==null||i.destroy(),this.renderGroup=null}}Ot.mixin(ve,Qh,rc,cc,oc,ac,tc,ec,lc,Yh,qh,ic,Kh);class Ko extends ve{constructor(t){super(t),this.canBundle=!0,this.allowChildren=!1,this._roundPixels=0,this._lastUsed=-1,this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this._bounds=new Yt(0,1,0,0),this._boundsDirty=!0,this.autoGarbageCollect=t.autoGarbageCollect??!0}get bounds(){return this._boundsDirty?(this.updateBounds(),this._boundsDirty=!1,this._bounds):this._bounds}get roundPixels(){return!!this._roundPixels}set roundPixels(t){this._roundPixels=t?1:0}containsPoint(t){const e=this.bounds,{x:r,y:i}=t;return r>=e.minX&&r<=e.maxX&&i>=e.minY&&i<=e.maxY}onViewUpdate(){if(this._didViewChangeTick++,this._boundsDirty=!0,this.didViewUpdate)return;this.didViewUpdate=!0;const t=this.renderGroup||this.parentRenderGroup;t&&t.onChildViewUpdate(this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null),this.onViewUpdate()}destroy(t){this.unload(),super.destroy(t),this._bounds=null}collectRenderablesSimple(t,e,r){const{renderPipes:i}=e;i.blendMode.pushBlendMode(this,this.groupBlendMode,t);const a=i[this.renderPipeId];a!=null&&a.addRenderable&&a.addRenderable(this,t),this.didViewUpdate=!1;const o=this.children,l=o.length;for(let h=0;h<l;h++)o[h].collectRenderables(t,e,r);i.blendMode.popBlendMode(t)}}class Ds extends Ko{constructor(t=J.EMPTY){t instanceof J&&(t={texture:t});const{texture:e=J.EMPTY,anchor:r,roundPixels:i,width:n,height:a,...o}=t;super({label:"Sprite",...o}),this.renderPipeId="sprite",this.batched=!0,this._visualBounds={minX:0,maxX:1,minY:0,maxY:0},this._anchor=new gt({_onUpdate:()=>{this.onViewUpdate()}}),r?this.anchor=r:e.defaultAnchor&&(this.anchor=e.defaultAnchor),this.texture=e,this.allowChildren=!1,this.roundPixels=i??!1,n!==void 0&&(this.width=n),a!==void 0&&(this.height=a)}static from(t,e=!1){return t instanceof J?new Ds(t):new Ds(J.from(t,e))}set texture(t){t||(t=J.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 visualBounds(){return Nh(this._visualBounds,this._anchor,this._texture),this._visualBounds}get sourceBounds(){return st("8.6.1","Sprite.sourceBounds is deprecated, use visualBounds instead."),this.visualBounds}updateBounds(){const t=this._anchor,e=this._texture,r=this._bounds,{width:i,height:n}=e.orig;r.minX=-t._x*i,r.maxX=r.minX+i,r.minY=-t._y*n,r.maxY=r.minY+n}destroy(t=!1){if(super.destroy(t),typeof t=="boolean"?t:t==null?void 0:t.texture){const r=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._texture.destroy(r)}this._texture=null,this._visualBounds=null,this._bounds=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){typeof t=="object"?(e=t.height??t.width,t=t.width):e??(e=t),t!==void 0&&this._setWidth(t,this._texture.orig.width),e!==void 0&&this._setHeight(e,this._texture.orig.height)}}const gc=new Yt;function Jo(s,t,e){const r=gc;s.measurable=!0,Vo(s,e,r),t.addBoundsMask(r),s.measurable=!1}function tl(s,t,e){const r=he.get();s.measurable=!0;const i=kt.get().identity(),n=el(s,e,i);Xo(s,r,n),s.measurable=!1,t.addBoundsMask(r),kt.return(i),he.return(r)}function el(s,t,e){return s?(s!==t&&(el(s.parent,t,e),s.updateLocalTransform(),e.append(s.localTransform)),e):(Lt("Mask bounds, renderable is not inside the root container"),e)}class sl{constructor(t){this.priority=0,this.inverse=!1,this.pipe="alphaMask",t!=null&&t.mask&&this.init(t.mask)}init(t){this.mask=t,this.renderMaskToTexture=!(t instanceof Ds),this.mask.renderable=this.renderMaskToTexture,this.mask.includeInBuild=!this.renderMaskToTexture,this.mask.measurable=!1}reset(){this.mask!==null&&(this.mask.measurable=!0,this.mask=null)}addBounds(t,e){this.inverse||Jo(this.mask,t,e)}addLocalBounds(t,e){tl(this.mask,t,e)}containsPoint(t,e){const r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof Ds}}sl.extension=tt.MaskEffect;class rl{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"}}rl.extension=tt.MaskEffect;class il{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!==null&&(this.mask.measurable=!0,this.mask.includeInBuild=!0,this.mask=null)}addBounds(t,e){Jo(this.mask,t,e)}addLocalBounds(t,e){tl(this.mask,t,e)}containsPoint(t,e){const r=this.mask;return e(r,t)}destroy(){this.reset()}static test(t){return t instanceof ve}}il.extension=tt.MaskEffect;const xc={createCanvas:(s,t)=>{const e=document.createElement("canvas");return e.width=s,e.height=t,e},createImage:()=>new Image,getCanvasRenderingContext2D:()=>CanvasRenderingContext2D,getWebGLRenderingContext:()=>WebGLRenderingContext,getNavigator:()=>navigator,getBaseUrl:()=>document.baseURI??window.location.href,getFontFaceSet:()=>document.fonts,fetch:(s,t)=>fetch(s,t),parseXML:s=>new DOMParser().parseFromString(s,"text/xml")};let fa=xc;const js={get(){return fa},set(s){fa=s}};class nl extends Wt{constructor(t){t.resource||(t.resource=js.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,this.resizeCanvas(),this.transparent=!!t.transparent}resizeCanvas(){this.autoDensity&&"style"in this.resource&&(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,r=this._resolution){const i=super.resize(t,e,r);return i&&this.resizeCanvas(),i}static test(t){return globalThis.HTMLCanvasElement&&t instanceof HTMLCanvasElement||globalThis.OffscreenCanvas&&t instanceof OffscreenCanvas}get context2D(){return this._context2D||(this._context2D=this.resource.getContext("2d"))}}nl.extension=tt.TextureSource;class yr extends Wt{constructor(t){super(t),this.uploadMethodId="image",this.autoGarbageCollect=!0}static test(t){return globalThis.HTMLImageElement&&t instanceof HTMLImageElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap||globalThis.VideoFrame&&t instanceof VideoFrame}}yr.extension=tt.TextureSource;var Ii=(s=>(s[s.INTERACTION=50]="INTERACTION",s[s.HIGH=25]="HIGH",s[s.NORMAL=0]="NORMAL",s[s.LOW=-25]="LOW",s[s.UTILITY=-50]="UTILITY",s))(Ii||{});class ei{constructor(t,e=null,r=0,i=!1){this.next=null,this.previous=null,this._destroyed=!1,this._fn=t,this._context=e,this.priority=r,this._once=i}match(t,e=null){return this._fn===t&&this._context===e}emit(t){this._fn&&(this._context?this._fn.call(this._context,t):this._fn(t));const e=this.next;return this._once&&this.destroy(!0),this._destroyed&&(this.next=null),e}connect(t){this.previous=t,t.next&&(t.next.previous=this),this.next=t.next,t.next=this}destroy(t=!1){this._destroyed=!0,this._fn=null,this._context=null,this.previous&&(this.previous.next=this.next),this.next&&(this.next.previous=this.previous);const e=this.next;return this.next=t?null:e,this.previous=null,e}}const al=class Rt{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 ei(null,null,1/0),this.deltaMS=1/Rt.targetFPMS,this.elapsedMS=1/Rt.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,r=Ii.NORMAL){return this._addListener(new ei(t,e,r))}addOnce(t,e,r=Ii.NORMAL){return this._addListener(new ei(t,e,r,!0))}_addListener(t){let e=this._head.next,r=this._head;if(!e)t.connect(r);else{for(;e;){if(t.priority>e.priority){t.connect(r);break}r=e,e=e.next}t.previous||t.connect(r)}return this._startIfPossible(),this}remove(t,e){let r=this._head.next;for(;r;)r.match(t,e)?r=r.destroy():r=r.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*Rt.targetFPMS;const r=this._head;let i=r.next;for(;i;)i=i.emit(this);r.next||this._cancelIfNeeded()}else this.deltaTime=this.deltaMS=this.elapsedMS=0;this.lastTime=t}get FPS(){return 1e3/this.elapsedMS}get minFPS(){return 1e3/this._maxElapsedMS}set minFPS(t){const e=Math.min(Math.max(0,t)/1e3,Rt.targetFPMS);this._maxElapsedMS=1/e,this._minElapsedMS&&t>this.maxFPS&&(this.maxFPS=t)}get maxFPS(){return this._minElapsedMS?Math.round(1e3/this._minElapsedMS):0}set maxFPS(t){t===0?this._minElapsedMS=0:(t<this.minFPS&&(this.minFPS=t),this._minElapsedMS=1/(t/1e3))}static get shared(){if(!Rt._shared){const t=Rt._shared=new Rt;t.autoStart=!0,t._protected=!0}return Rt._shared}static get system(){if(!Rt._system){const t=Rt._system=new Rt;t.autoStart=!0,t._protected=!0}return Rt._system}};al.targetFPMS=.06;let ir=al,si;async function yc(){return si??(si=(async()=>{var a;const t=js.get().createCanvas(1,1).getContext("webgl");if(!t)return"premultiply-alpha-on-upload";const e=await new Promise(o=>{const l=document.createElement("video");l.onloadeddata=()=>o(l),l.onerror=()=>o(null),l.autoplay=!1,l.crossOrigin="anonymous",l.preload="auto",l.src="data:video/webm;base64,GkXfo59ChoEBQveBAULygQRC84EIQoKEd2VibUKHgQJChYECGFOAZwEAAAAAAAHTEU2bdLpNu4tTq4QVSalmU6yBoU27i1OrhBZUrmtTrIHGTbuMU6uEElTDZ1OsggEXTbuMU6uEHFO7a1OsggG97AEAAAAAAABZAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAVSalmoCrXsYMPQkBNgIRMYXZmV0GETGF2ZkSJiEBEAAAAAAAAFlSua8yuAQAAAAAAAEPXgQFzxYgAAAAAAAAAAZyBACK1nIN1bmSIgQCGhVZfVlA5g4EBI+ODhAJiWgDglLCBArqBApqBAlPAgQFVsIRVuYEBElTDZ9Vzc9JjwItjxYgAAAAAAAAAAWfInEWjh0VOQ09ERVJEh49MYXZjIGxpYnZweC12cDlnyKJFo4hEVVJBVElPTkSHlDAwOjAwOjAwLjA0MDAwMDAwMAAAH0O2dcfngQCgwqGggQAAAIJJg0IAABAAFgA4JBwYSgAAICAAEb///4r+AAB1oZ2mm+6BAaWWgkmDQgAAEAAWADgkHBhKAAAgIABIQBxTu2uRu4+zgQC3iveBAfGCAXHwgQM=",l.load()});if(!e)return"premultiply-alpha-on-upload";const r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r);const i=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,i),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,!1),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,t.NONE),t.texImage2D(t.TEXTURE_2D,0,t.RGBA,t.RGBA,t.UNSIGNED_BYTE,e);const n=new Uint8Array(4);return t.readPixels(0,0,1,1,t.RGBA,t.UNSIGNED_BYTE,n),t.deleteFramebuffer(i),t.deleteTexture(r),(a=t.getExtension("WEBGL_lose_context"))==null||a.loseContext(),n[0]<=n[3]?"premultiplied-alpha":"premultiply-alpha-on-upload"})()),si}const Er=class ol extends Wt{constructor(t){super(t),this.isReady=!1,this.uploadMethodId="video",t={...ol.defaultOptions,...t},this._autoUpdate=!0,this._isConnectedToTicker=!1,this._updateFPS=t.updateFPS||0,this._msToNextUpdate=0,this.autoPlay=t.autoPlay!==!1,this.alphaMode=t.alphaMode??"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=ir.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 yc(),this._load=new Promise((r,i)=>{this.isValid?r(this):(this._resolve=r,this._reject=i,e.preloadTimeoutMs!==void 0&&(this._preloadTimeout=setTimeout(()=>{this._onError(new ErrorEvent(`Preload exceeded timeout of ${e.preloadTimeoutMs}ms`))})),t.load())}),this._load}_onError(t){this.resource.removeEventListener("error",this._onError,!0),this.emit("error",t),this._reject&&(this._reject(t),this._reject=null,this._resolve=null)}_isSourcePlaying(){const t=this.resource;return!t.paused&&!t.ended}_isSourceReady(){return this.resource.readyState>2}_onPlayStart(){this.isValid||this._mediaReady(),this._configureAutoUpdate()}_onPlayStop(){this._configureAutoUpdate()}_onSeeked(){this._autoUpdate&&!this._isSourcePlaying()&&(this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0)}_onCanPlay(){this.resource.removeEventListener("canplay",this._onCanPlay),this._mediaReady()}_onCanPlayThrough(){this.resource.removeEventListener("canplaythrough",this._onCanPlay),this._preloadTimeout&&(clearTimeout(this._preloadTimeout),this._preloadTimeout=void 0),this._mediaReady()}_mediaReady(){const t=this.resource;this.isValid&&(this.isReady=!0,this.resize(t.videoWidth,t.videoHeight)),this._msToNextUpdate=0,this.updateFrame(),this._msToNextUpdate=0,this._resolve&&(this._resolve(this),this._resolve=null,this._reject=null),this._isSourcePlaying()?this._onPlayStart():this.autoPlay&&this.resource.play()}destroy(){this._configureAutoUpdate();const t=this.resource;t&&(t.removeEventListener("play",this._onPlayStart),t.removeEventListener("pause",this._onPlayStop),t.removeEventListener("seeked",this._onSeeked),t.removeEventListener("canplay",this._onCanPlay),t.removeEventListener("canplaythrough",this._onCanPlayThrough),t.removeEventListener("error",this._onError,!0),t.pause(),t.src="",t.load()),super.destroy()}get autoUpdate(){return this._autoUpdate}set autoUpdate(t){t!==this._autoUpdate&&(this._autoUpdate=t,this._configureAutoUpdate())}get updateFPS(){return this._updateFPS}set updateFPS(t){t!==this._updateFPS&&(this._updateFPS=t,this._configureAutoUpdate())}_configureAutoUpdate(){this._autoUpdate&&this._isSourcePlaying()?!this._updateFPS&&this.resource.requestVideoFrameCallback?(this._isConnectedToTicker&&(ir.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||(ir.shared.add(this.updateFrame,this),this._isConnectedToTicker=!0,this._msToNextUpdate=0)):(this._videoFrameRequestCallbackHandle!==null&&(this.resource.cancelVideoFrameCallback(this._videoFrameRequestCallbackHandle),this._videoFrameRequestCallbackHandle=null),this._isConnectedToTicker&&(ir.shared.remove(this.updateFrame,this),this._isConnectedToTicker=!1,this._msToNextUpdate=0))}static test(t){return globalThis.HTMLVideoElement&&t instanceof HTMLVideoElement}};Er.extension=tt.TextureSource;Er.defaultOptions={...Wt.defaultOptions,autoLoad:!0,autoPlay:!0,updateFPS:0,crossorigin:!0,loop:!1,muted:!0,playsinline:!0,preload:!1};Er.MIME_TYPES={ogv:"video/ogg",mov:"video/quicktime",m4v:"video/mp4"};let _c=Er;const Ye=(s,t,e=!1)=>(Array.isArray(s)||(s=[s]),t?s.map(r=>typeof r=="string"||e?t(r):r):s);class bc{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){const e=this._cache.get(t);return e||Lt(`[Assets] Asset id ${t} was not found in the Cache`),e}set(t,e){const r=Ye(t);let i;for(let l=0;l<this.parsers.length;l++){const h=this.parsers[l];if(h.test(e)){i=h.getCacheableAssets(r,e);break}}const n=new Map(Object.entries(i||{}));i||r.forEach(l=>{n.set(l,e)});const a=[...n.keys()],o={cacheKeys:a,keys:r};r.forEach(l=>{this._cacheMap.set(l,o)}),a.forEach(l=>{const h=i?i[l]:e;this._cache.has(l)&&this._cache.get(l)!==h&&Lt("[Cache] already has key:",l),this._cache.set(l,n.get(l))})}remove(t){if(!this._cacheMap.has(t)){Lt(`[Assets] Asset id ${t} was not found in the Cache`);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 We=new bc,Di=[];Ot.handleByList(tt.TextureSource,Di);function ll(s={}){const t=s&&s.resource,e=t?s.resource:s,r=t?s:{resource:s};for(let i=0;i<Di.length;i++){const n=Di[i];if(n.test(e))return new n(r)}throw new Error(`Could not find a source type for resource: ${r.resource}`)}function wc(s={},t=!1){const e=s&&s.resource,r=e?s.resource:s,i=e?s:{resource:s};if(!t&&We.has(r))return We.get(r);const n=new J({source:ll(i)});return n.on("destroy",()=>{We.has(r)&&We.remove(r)}),t||We.set(r,n),n}function kc(s,t=!1){return typeof s=="string"?We.get(s):s instanceof Wt?new J({source:s}):wc(s,t)}J.from=kc;Wt.from=ll;Ot.add(sl,rl,il,_c,yr,nl,sn);var hl=(s=>(s[s.Low=0]="Low",s[s.Normal=1]="Normal",s[s.High=2]="High",s))(hl||{});function Ht(s){if(typeof s!="string")throw new TypeError(`Path must be a string. Received ${JSON.stringify(s)}`)}function ls(s){return s.split("?")[0].split("#")[0]}function vc(s){return s.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}function Sc(s,t,e){return s.replace(new RegExp(vc(t),"g"),e)}function Ac(s,t){let e="",r=0,i=-1,n=0,a=-1;for(let o=0;o<=s.length;++o){if(o<s.length)a=s.charCodeAt(o);else{if(a===47)break;a=47}if(a===47){if(!(i===o-1||n===1))if(i!==o-1&&n===2){if(e.length<2||r!==2||e.charCodeAt(e.length-1)!==46||e.charCodeAt(e.length-2)!==46){if(e.length>2){const l=e.lastIndexOf("/");if(l!==e.length-1){l===-1?(e="",r=0):(e=e.slice(0,l),r=e.length-1-e.lastIndexOf("/")),i=o,n=0;continue}}else if(e.length===2||e.length===1){e="",r=0,i=o,n=0;continue}}}else e.length>0?e+=`/${s.slice(i+1,o)}`:e=s.slice(i+1,o),r=o-i-1;i=o,n=0}else a===46&&n!==-1?++n:n=-1}return e}const Ls={toPosix(s){return Sc(s,"\\","/")},isUrl(s){return/^https?:/.test(this.toPosix(s))},isDataUrl(s){return/^data:([a-z]+\/[a-z0-9-+.]+(;[a-z0-9-.!#$%*+.{}|~`]+=[a-z0-9-.!#$%*+.{}()_|~`]+)*)?(;base64)?,([a-z0-9!$&',()*+;=\-._~:@\/?%\s<>]*?)$/i.test(s)},isBlobUrl(s){return s.startsWith("blob:")},hasProtocol(s){return/^[^/:]+:/.test(this.toPosix(s))},getProtocol(s){Ht(s),s=this.toPosix(s);const t=/^file:\/\/\//.exec(s);if(t)return t[0];const e=/^[^/:]+:\/{0,2}/.exec(s);return e?e[0]:""},toAbsolute(s,t,e){if(Ht(s),this.isDataUrl(s)||this.isBlobUrl(s))return s;const r=ls(this.toPosix(t??js.get().getBaseUrl())),i=ls(this.toPosix(e??this.rootname(r)));return s=this.toPosix(s),s.startsWith("/")?Ls.join(i,s.slice(1)):this.isAbsolute(s)?s:this.join(r,s)},normalize(s){if(Ht(s),s.length===0)return".";if(this.isDataUrl(s)||this.isBlobUrl(s))return s;s=this.toPosix(s);let t="";const e=s.startsWith("/");this.hasProtocol(s)&&(t=this.rootname(s),s=s.slice(t.length));const r=s.endsWith("/");return s=Ac(s),s.length>0&&r&&(s+="/"),e?`/${s}`:t+s},isAbsolute(s){return Ht(s),s=this.toPosix(s),this.hasProtocol(s)?!0:s.startsWith("/")},join(...s){if(s.length===0)return".";let t;for(let e=0;e<s.length;++e){const r=s[e];if(Ht(r),r.length>0)if(t===void 0)t=r;else{const i=s[e-1]??"";this.joinExtensions.includes(this.extname(i).toLowerCase())?t+=`/../${r}`:t+=`/${r}`}}return t===void 0?".":this.normalize(t)},dirname(s){if(Ht(s),s.length===0)return".";s=this.toPosix(s);let t=s.charCodeAt(0);const e=t===47;let r=-1,i=!0;const n=this.getProtocol(s),a=s;s=s.slice(n.length);for(let o=s.length-1;o>=1;--o)if(t=s.charCodeAt(o),t===47){if(!i){r=o;break}}else i=!1;return r===-1?e?"/":this.isUrl(a)?n+s:n:e&&r===1?"//":n+s.slice(0,r)},rootname(s){Ht(s),s=this.toPosix(s);let t="";if(s.startsWith("/")?t="/":t=this.getProtocol(s),this.isUrl(s)){const e=s.indexOf("/",t.length);e!==-1?t=s.slice(0,e):t=s,t.endsWith("/")||(t+="/")}return t},basename(s,t){Ht(s),t&&Ht(t),s=ls(this.toPosix(s));let e=0,r=-1,i=!0,n;if(t!==void 0&&t.length>0&&t.length<=s.length){if(t.length===s.length&&t===s)return"";let a=t.length-1,o=-1;for(n=s.length-1;n>=0;--n){const l=s.charCodeAt(n);if(l===47){if(!i){e=n+1;break}}else o===-1&&(i=!1,o=n+1),a>=0&&(l===t.charCodeAt(a)?--a===-1&&(r=n):(a=-1,r=o))}return e===r?r=o:r===-1&&(r=s.length),s.slice(e,r)}for(n=s.length-1;n>=0;--n)if(s.charCodeAt(n)===47){if(!i){e=n+1;break}}else r===-1&&(i=!1,r=n+1);return r===-1?"":s.slice(e,r)},extname(s){Ht(s),s=ls(this.toPosix(s));let t=-1,e=0,r=-1,i=!0,n=0;for(let a=s.length-1;a>=0;--a){const o=s.charCodeAt(a);if(o===47){if(!i){e=a+1;break}continue}r===-1&&(i=!1,r=a+1),o===46?t===-1?t=a:n!==1&&(n=1):t!==-1&&(n=-1)}return t===-1||r===-1||n===0||n===1&&t===r-1&&t===e+1?"":s.slice(t,r)},parse(s){Ht(s);const t={root:"",dir:"",base:"",ext:"",name:""};if(s.length===0)return t;s=ls(this.toPosix(s));let e=s.charCodeAt(0);const r=this.isAbsolute(s);let i;t.root=this.rootname(s),r||this.hasProtocol(s)?i=1:i=0;let n=-1,a=0,o=-1,l=!0,h=s.length-1,c=0;for(;h>=i;--h){if(e=s.charCodeAt(h),e===47){if(!l){a=h+1;break}continue}o===-1&&(l=!1,o=h+1),e===46?n===-1?n=h:c!==1&&(c=1):n!==-1&&(c=-1)}return n===-1||o===-1||c===0||c===1&&n===o-1&&n===a+1?o!==-1&&(a===0&&r?t.base=t.name=s.slice(1,o):t.base=t.name=s.slice(a,o)):(a===0&&r?(t.name=s.slice(1,n),t.base=s.slice(1,o)):(t.name=s.slice(a,n),t.base=s.slice(a,o)),t.ext=s.slice(n,o)),t.dir=this.dirname(s),t},sep:"/",delimiter:":",joinExtensions:[".html"]};function cl(s,t,e,r,i){const n=t[e];for(let a=0;a<n.length;a++){const o=n[a];e<t.length-1?cl(s.replace(r[e],o),t,e+1,r,i):i.push(s.replace(r[e],o))}}function Tc(s){const t=/\{(.*?)\}/g,e=s.match(t),r=[];if(e){const i=[];e.forEach(n=>{const a=n.substring(1,n.length-1).split(",");i.push(a)}),cl(s,i,0,e,r)}else r.push(s);return r}const pa=s=>!Array.isArray(s);class ul{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){if(this._bundleIdConnector=t.connector??this._bundleIdConnector,this._createBundleAssetId=t.createBundleAssetId??this._createBundleAssetId,this._extractAssetIdFromBundle=t.extractAssetIdFromBundle??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(r=>`${encodeURIComponent(r)}=${encodeURIComponent(e[r])}`).join("&")}}getAlias(t){const{alias:e,src:r}=t;return Ye(e||r,n=>typeof n=="string"?n:Array.isArray(n)?n.map(a=>(a==null?void 0:a.src)??a):n!=null&&n.src?n.src:n,!0)}removeAlias(t,e){this._assetMap[t]&&(e&&e!==this._resolverHash[t]||(delete this._resolverHash[t],delete this._assetMap[t]))}addManifest(t){this._manifest&&Lt("[Resolver] Manifest already exists, this will be overwritten"),this._manifest=t,t.bundles.forEach(e=>{this.addBundle(e.name,e.assets)})}addBundle(t,e){const r=[];let i=e;Array.isArray(e)||(i=Object.entries(e).map(([n,a])=>typeof a=="string"||Array.isArray(a)?{alias:n,src:a}:{alias:n,...a})),i.forEach(n=>{const a=n.src,o=n.alias;let l;if(typeof o=="string"){const h=this._createBundleAssetId(t,o);r.push(h),l=[o,h]}else{const h=o.map(c=>this._createBundleAssetId(t,c));r.push(...h),l=[...o,...h]}this.add({...n,alias:l,src:a})}),this._bundles[t]=r}add(t){const e=[];Array.isArray(t)?e.push(...t):e.push(t);let r;r=n=>{this.hasKey(n)&&Lt(`[Resolver] already has key: ${n} overwriting`)},Ye(e).forEach(n=>{const{src:a}=n;let{data:o,format:l,loadParser:h,parser:c}=n;const u=Ye(a).map(g=>typeof g=="string"?Tc(g):Array.isArray(g)?g:[g]),f=this.getAlias(n);Array.isArray(f)?f.forEach(r):r(f);const d=[],p=g=>{const m=this._parsers.find(y=>y.test(g));return{src:g,...m==null?void 0:m.parse(g)}};u.forEach(g=>{g.forEach(m=>{let y={};if(typeof m!="object"?y=p(m):(o=m.data??o,l=m.format??l,(m.loadParser||m.parser)&&(h=m.loadParser??h,c=m.parser??c),y={...p(m.src),...m}),!f)throw new Error(`[Resolver] alias is undefined for this asset: ${y.src}`);y=this._buildResolvedAsset(y,{aliases:f,data:o,format:l,loadParser:h,parser:c,progressSize:n.progressSize}),d.push(y)})}),f.forEach(g=>{this._assetMap[g]=d})})}resolveBundle(t){const e=pa(t);t=Ye(t);const r={};return t.forEach(i=>{const n=this._bundles[i];if(n){const a=this.resolve(n),o={};for(const l in a){const h=a[l];o[this._extractAssetIdFromBundle(i,l)]=h}r[i]=o}}),e?r[t[0]]:r}resolveUrl(t){const e=this.resolve(t);if(typeof t!="string"){const r={};for(const i in e)r[i]=e[i].src;return r}return e.src}resolve(t){const e=pa(t);t=Ye(t);const r={};return t.forEach(i=>{if(!this._resolverHash[i])if(this._assetMap[i]){let n=this._assetMap[i];const a=this._getPreferredOrder(n);a==null||a.priority.forEach(o=>{a.params[o].forEach(l=>{const h=n.filter(c=>c[o]?c[o]===l:!1);h.length&&(n=h)})}),this._resolverHash[i]=n[0]}else this._resolverHash[i]=this._buildResolvedAsset({alias:[i],src:i},{});r[i]=this._resolverHash[i]}),e?r[t[0]]:r}hasKey(t){return!!this._assetMap[t]}hasBundle(t){return!!this._bundles[t]}_getPreferredOrder(t){for(let e=0;e<t.length;e++){const r=t[e],i=this._preferredOrder.find(n=>n.params.format.includes(r.format));if(i)return i}return this._preferredOrder[0]}_appendDefaultSearchParams(t){if(!this._defaultSearchParams)return t;const e=/\?/.test(t)?"&":"?";return`${t}${e}${this._defaultSearchParams}`}_buildResolvedAsset(t,e){const{aliases:r,data:i,loadParser:n,parser:a,format:o,progressSize:l}=e;return(this._basePath||this._rootPath)&&(t.src=Ls.toAbsolute(t.src,this._basePath,this._rootPath)),t.alias=r??t.alias??[t.src],t.src=this._appendDefaultSearchParams(t.src),t.data={...i||{},...t.data},t.loadParser=n??t.loadParser,t.parser=a??t.parser,t.format=o??t.format??Cc(t.src),l!==void 0&&(t.progressSize=l),t}}ul.RETINA_PREFIX=/@([0-9\.]+)x/;function Cc(s){return s.split(".").pop().split("?").shift().split("#").shift()}const ma=(s,t)=>{const e=t.split("?")[1];return e&&(s+=`?${e}`),s},dl=class vs{constructor(t,e){this.linkedSheets=[];let r=t;(t==null?void 0:t.source)instanceof Wt&&(r={texture:t,data:e});const{texture:i,data:n,cachePrefix:a=""}=r;this.cachePrefix=a,this._texture=i instanceof J?i:null,this.textureSource=i.source,this.textures={},this.animations={},this.data=n;const o=parseFloat(n.meta.scale);o?(this.resolution=o,i.source.resolution=this.resolution):this.resolution=i.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<=vs.BATCH_SIZE?(this._processFrames(0),this._processAnimations(),this._parseComplete()):this._nextBatch()})}parseSync(){return this._processFrames(0,!0),this._processAnimations(),this.textures}_processFrames(t,e=!1){let r=t;const i=e?1/0:vs.BATCH_SIZE;for(;r-t<i&&r<this._frameKeys.length;){const n=this._frameKeys[r],a=this._frames[n],o=a.frame;if(o){let l=null,h=null;const c=a.trimmed!==!1&&a.sourceSize?a.sourceSize:a.frame,u=new ft(0,0,Math.floor(c.w)/this.resolution,Math.floor(c.h)/this.resolution);a.rotated?l=new ft(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.h)/this.resolution,Math.floor(o.w)/this.resolution):l=new ft(Math.floor(o.x)/this.resolution,Math.floor(o.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution),a.trimmed!==!1&&a.spriteSourceSize&&(h=new ft(Math.floor(a.spriteSourceSize.x)/this.resolution,Math.floor(a.spriteSourceSize.y)/this.resolution,Math.floor(o.w)/this.resolution,Math.floor(o.h)/this.resolution)),this.textures[n]=new J({source:this.textureSource,frame:l,orig:u,trim:h,rotate:a.rotated?2:0,defaultAnchor:a.anchor,defaultBorders:a.borders,label:n.toString()})}r++}}_processAnimations(){const t=this.data.animations||{};for(const e in t){this.animations[e]=[];for(let r=0;r<t[e].length;r++){const i=t[e][r];this.animations[e].push(this.textures[i])}}}_parseComplete(){const t=this._callback;this._callback=null,this._batchIndex=0,t.call(this,this.textures)}_nextBatch(){this._processFrames(this._batchIndex*vs.BATCH_SIZE),this._batchIndex++,setTimeout(()=>{this._batchIndex*vs.BATCH_SIZE<this._frameKeys.length?this._nextBatch():(this._processAnimations(),this._parseComplete())},0)}destroy(t=!1){var e;for(const r in this.textures)this.textures[r].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=[]}};dl.BATCH_SIZE=1e3;let ga=dl;const Mc=["jpg","png","jpeg","avif","webp","basis","etc2","bc7","bc6h","bc5","bc4","bc3","bc2","bc1","eac","astc"];function fl(s,t,e){const r={};if(s.forEach(i=>{r[i]=t}),Object.keys(t.textures).forEach(i=>{r[`${t.cachePrefix}${i}`]=t.textures[i]}),!e){const i=Ls.dirname(s[0]);t.linkedSheets.forEach((n,a)=>{const o=fl([`${i}/${t.data.meta.related_multi_packs[a]}`],n,!0);Object.assign(r,o)})}return r}const Pc={extension:tt.Asset,cache:{test:s=>s instanceof ga,getCacheableAssets:(s,t)=>fl(s,t,!1)},resolver:{extension:{type:tt.ResolveParser,name:"resolveSpritesheet"},test:s=>{const e=s.split("?")[0].split("."),r=e.pop(),i=e.pop();return r==="json"&&Mc.includes(i)},parse:s=>{var e;const t=s.split(".");return{resolution:parseFloat(((e=ul.RETINA_PREFIX.exec(s))==null?void 0:e[1])??"1"),format:t[t.length-2],src:s}}},loader:{name:"spritesheetLoader",id:"spritesheet",extension:{type:tt.LoadParser,priority:hl.Normal,name:"spritesheetLoader"},async testParse(s,t){return Ls.extname(t.src).toLowerCase()===".json"&&!!s.frames},async parse(s,t,e){var u,f;const{texture:r,imageFilename:i,textureOptions:n,cachePrefix:a}=(t==null?void 0:t.data)??{};let o=Ls.dirname(t.src);o&&o.lastIndexOf("/")!==o.length-1&&(o+="/");let l;if(r instanceof J)l=r;else{const d=ma(o+(i??s.meta.image),t.src);l=(await e.load([{src:d,data:n}]))[d]}const h=new ga({texture:l.source,data:s,cachePrefix:a});await h.parse();const c=(u=s==null?void 0:s.meta)==null?void 0:u.related_multi_packs;if(Array.isArray(c)){const d=[];for(const g of c){if(typeof g!="string")continue;let m=o+g;(f=t.data)!=null&&f.ignoreMultiPack||(m=ma(m,t.src),d.push(e.load({src:m,data:{textureOptions:n,ignoreMultiPack:!0}})))}const p=await Promise.all(d);h.linkedSheets=p,p.forEach(g=>{g.linkedSheets=[h].concat(h.linkedSheets.filter(m=>m!==g))})}return h},async unload(s,t,e){await e.unload(s.textureSource._sourceOrigin),s.destroy(!1)}}};Ot.add(Pc);const ri=Object.create(null),xa=Object.create(null);function on(s,t){let e=xa[s];return e===void 0&&(ri[t]===void 0&&(ri[t]=1),xa[s]=e=ri[t]++),e}let je;function pl(){return(!je||je!=null&&je.isContextLost())&&(je=js.get().createCanvas().getContext("webgl",{})),je}let nr;function Ec(){if(!nr){nr="mediump";const s=pl();s&&s.getShaderPrecisionFormat&&(nr=s.getShaderPrecisionFormat(s.FRAGMENT_SHADER,s.HIGH_FLOAT).precision?"highp":"mediump")}return nr}function Rc(s,t,e){return t?s:e?(s=s.replace("out vec4 finalColor;",""),`
|
|
6
|
+
|
|
7
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
8
|
+
#define in varying
|
|
9
|
+
#define finalColor gl_FragColor
|
|
10
|
+
#define texture texture2D
|
|
11
|
+
#endif
|
|
12
|
+
${s}
|
|
13
|
+
`):`
|
|
14
|
+
|
|
15
|
+
#ifdef GL_ES // This checks if it is WebGL1
|
|
16
|
+
#define in attribute
|
|
17
|
+
#define out varying
|
|
18
|
+
#endif
|
|
19
|
+
${s}
|
|
20
|
+
`}function Ic(s,t,e){const r=e?t.maxSupportedFragmentPrecision:t.maxSupportedVertexPrecision;if(s.substring(0,9)!=="precision"){let i=e?t.requestedFragmentPrecision:t.requestedVertexPrecision;return i==="highp"&&r!=="highp"&&(i="mediump"),`precision ${i} float;
|
|
21
|
+
${s}`}else if(r!=="highp"&&s.substring(0,15)==="precision highp")return s.replace("precision highp","precision mediump");return s}function Dc(s,t){return t?`#version 300 es
|
|
22
|
+
${s}`:s}const Lc={},Oc={};function Nc(s,{name:t="pixi-program"},e=!0){t=t.replace(/\s+/g,"-"),t+=e?"-fragment":"-vertex";const r=e?Lc:Oc;return r[t]?(r[t]++,t+=`-${r[t]}`):r[t]=1,s.indexOf("#define SHADER_NAME")!==-1?s:`${`#define SHADER_NAME ${t}`}
|
|
23
|
+
${s}`}function Bc(s,t){return t?s.replace("#version 300 es",""):s}const ii={stripVersion:Bc,ensurePrecision:Ic,addProgramDefines:Rc,setProgramName:Nc,insertVersion:Dc},hs=Object.create(null),ml=class Li{constructor(t){t={...Li.defaultOptions,...t};const e=t.fragment.indexOf("#version 300 es")!==-1,r={stripVersion:e,ensurePrecision:{requestedFragmentPrecision:t.preferredFragmentPrecision,requestedVertexPrecision:t.preferredVertexPrecision,maxSupportedVertexPrecision:"highp",maxSupportedFragmentPrecision:Ec()},setProgramName:{name:t.name},addProgramDefines:e,insertVersion:e};let i=t.fragment,n=t.vertex;Object.keys(ii).forEach(a=>{const o=r[a];i=ii[a](i,o,!0),n=ii[a](n,o,!1)}),this.fragment=i,this.vertex=n,this.transformFeedbackVaryings=t.transformFeedbackVaryings,this._key=on(`${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,hs[this._cacheKey]=null}static from(t){const e=`${t.vertex}:${t.fragment}`;return hs[e]||(hs[e]=new Li(t),hs[e]._cacheKey=e),hs[e]}};ml.defaultOptions={preferredVertexPrecision:"highp",preferredFragmentPrecision:"mediump"};let gl=ml;const ya={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 Fc(s){return ya[s]??ya.float32}const Gc={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",vec2i:"sint32x2",vec3i:"sint32x3",vec4i:"sint32x4",u32:"uint32","vec2<u32>":"uint32x2","vec3<u32>":"uint32x3","vec4<u32>":"uint32x4",vec2u:"uint32x2",vec3u:"uint32x3",vec4u:"uint32x4",bool:"uint32","vec2<bool>":"uint32x2","vec3<bool>":"uint32x3","vec4<bool>":"uint32x4"},_a=/@location\((\d+)\)\s+([a-zA-Z0-9_]+)\s*:\s*([a-zA-Z0-9_<>]+)(?:,|\s|\)|$)/g;function ba(s,t){let e;for(;(e=_a.exec(s))!==null;){const r=Gc[e[3]]??"float32";t[e[2]]={location:parseInt(e[1],10),format:r,stride:Fc(r).stride,offset:0,instance:!1,start:0}}_a.lastIndex=0}function zc(s){return s.replace(/\/\/.*$/gm,"").replace(/\/\*[\s\S]*?\*\//g,"")}function $c({source:s,entryPoint:t}){const e={},r=zc(s),i=r.indexOf(`fn ${t}(`);if(i===-1)return e;const n=r.indexOf("->",i);if(n===-1)return e;const a=r.substring(i,n);if(ba(a,e),Object.keys(e).length===0){const o=a.match(/\(\s*\w+\s*:\s*(\w+)/);if(o){const l=o[1],h=new RegExp(`struct\\s+${l}\\s*\\{([^}]+)\\}`,"s"),c=r.match(h);c&&ba(c[1],e)}}return e}function ni(s){var u,f;const t=/(^|[^/])@(group|binding)\(\d+\)[^;]+;/g,e=/@group\((\d+)\)/,r=/@binding\((\d+)\)/,i=/var(<[^>]+>)? (\w+)/,n=/:\s*([\w<>]+)/,a=/struct\s+(\w+)\s*{([^}]+)}/g,o=/(\w+)\s*:\s*([\w\<\>]+)/g,l=/struct\s+(\w+)/,h=(u=s.match(t))==null?void 0:u.map(d=>({group:parseInt(d.match(e)[1],10),binding:parseInt(d.match(r)[1],10),name:d.match(i)[2],isUniform:d.match(i)[1]==="<uniform>",type:d.match(n)[1]}));if(!h)return{groups:[],structs:[]};const c=((f=s.match(a))==null?void 0:f.map(d=>{const p=d.match(l)[1],g=d.match(o).reduce((m,y)=>{const[b,_]=y.split(":");return m[b.trim()]=_.trim(),m},{});return g?{name:p,members:g}:null}).filter(({name:d})=>h.some(p=>p.type===d||p.type.includes(`<${d}>`))))??[];return{groups:h,structs:c}}var Ie=(s=>(s[s.VERTEX=1]="VERTEX",s[s.FRAGMENT=2]="FRAGMENT",s[s.COMPUTE=4]="COMPUTE",s))(Ie||{});function Uc({groups:s}){const t=[];for(let e=0;e<s.length;e++){const r=s[e];t[r.group]||(t[r.group]=[]),r.isUniform?t[r.group].push({binding:r.binding,visibility:Ie.VERTEX|Ie.FRAGMENT,buffer:{type:"uniform"}}):r.type==="sampler"?t[r.group].push({binding:r.binding,visibility:Ie.FRAGMENT,sampler:{type:"filtering"}}):r.type==="texture_2d"||r.type.startsWith("texture_2d<")?t[r.group].push({binding:r.binding,visibility:Ie.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d",multisampled:!1}}):r.type==="texture_2d_array"||r.type.startsWith("texture_2d_array<")?t[r.group].push({binding:r.binding,visibility:Ie.FRAGMENT,texture:{sampleType:"float",viewDimension:"2d-array",multisampled:!1}}):(r.type==="texture_cube"||r.type.startsWith("texture_cube<"))&&t[r.group].push({binding:r.binding,visibility:Ie.FRAGMENT,texture:{sampleType:"float",viewDimension:"cube",multisampled:!1}})}for(let e=0;e<t.length;e++)t[e]||(t[e]=[]);return t}function Hc({groups:s}){const t=[];for(let e=0;e<s.length;e++){const r=s[e];t[r.group]||(t[r.group]={}),t[r.group][r.name]=r.binding}return t}function jc(s,t){const e=new Set,r=new Set,i=[...s.structs,...t.structs].filter(a=>e.has(a.name)?!1:(e.add(a.name),!0)),n=[...s.groups,...t.groups].filter(a=>{const o=`${a.name}-${a.binding}`;return r.has(o)?!1:(r.add(o),!0)});return{structs:i,groups:n}}const cs=Object.create(null);class Rr{constructor(t){var o,l;this._layoutKey=0,this._attributeLocationsKey=0;const{fragment:e,vertex:r,layout:i,gpuLayout:n,name:a}=t;if(this.name=a,this.fragment=e,this.vertex=r,e.source===r.source){const h=ni(e.source);this.structsAndGroups=h}else{const h=ni(r.source),c=ni(e.source);this.structsAndGroups=jc(h,c)}this.layout=i??Hc(this.structsAndGroups),this.gpuLayout=n??Uc(this.structsAndGroups),this.autoAssignGlobalUniforms=((o=this.layout[0])==null?void 0:o.globalUniforms)!==void 0,this.autoAssignLocalUniforms=((l=this.layout[1])==null?void 0:l.localUniforms)!==void 0,this._generateProgramKey()}_generateProgramKey(){const{vertex:t,fragment:e}=this,r=t.source+e.source+t.entryPoint+e.entryPoint;this._layoutKey=on(r,"program")}get attributeData(){return this._attributeData??(this._attributeData=$c(this.vertex)),this._attributeData}destroy(){this.gpuLayout=null,this.layout=null,this.structsAndGroups=null,this.fragment=null,this.vertex=null,cs[this._cacheKey]=null}static from(t){const e=`${t.vertex.source}:${t.fragment.source}:${t.fragment.entryPoint}:${t.vertex.entryPoint}`;return cs[e]||(cs[e]=new Rr(t),cs[e]._cacheKey=e),cs[e]}}const xl=["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>","vec2<i32>","vec3<i32>","vec4<i32>"],Vc=xl.reduce((s,t)=>(s[t]=!0,s),{});function Yc(s,t){switch(s){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}const yl=class _l{constructor(t,e){this._touched=0,this.uid=ct("uniform"),this._resourceType="uniformGroup",this._resourceId=ct("resource"),this.isUniformGroup=!0,this._dirtyId=0,this.destroyed=!1,e={..._l.defaultOptions,...e},this.uniformStructures=t;const r={};for(const i in t){const n=t[i];if(n.name=i,n.size=n.size??1,!Vc[n.type]){const a=n.type.match(/^array<(\w+(?:<\w+>)?),\s*(\d+)>$/);if(a){const[,o,l]=a;throw new Error(`Uniform type ${n.type} is not supported. Use type: '${o}', size: ${l} instead.`)}throw new Error(`Uniform type ${n.type} is not supported. Supported uniform types are: ${xl.join(", ")}`)}n.value??(n.value=Yc(n.type,n.size)),r[i]=n.value}this.uniforms=r,this._dirtyId=1,this.ubo=e.ubo,this.isStatic=e.isStatic,this._signature=on(Object.keys(r).map(i=>`${i}-${t[i].type}`).join("-"),"uniform-group")}update(){this._dirtyId++}};yl.defaultOptions={ubo:!1,isStatic:!1};let bl=yl;class mr{constructor(t){this.resources=Object.create(null),this._dirty=!0;let e=0;for(const r in t){const i=t[r];this.setResource(i,e++)}this._updateKey()}_updateKey(){if(!this._dirty)return;this._dirty=!1;const t=[];let e=0;for(const r in this.resources)t[e++]=this.resources[r]._resourceId;this._key=t.join("|")}setResource(t,e){var i,n;const r=this.resources[e];t!==r&&((i=r==null?void 0:r.off)==null||i.call(r,"change",this.onResourceChange,this),(n=t.on)==null||n.call(t,"change",this.onResourceChange,this),this.resources[e]=t,this._dirty=!0)}getResource(t){return this.resources[t]}_touch(t,e){const r=this.resources;for(const i in r)r[i]._gcLastUsed=t,r[i]._touched=e}destroy(){var e;const t=this.resources;for(const r in t){const i=t[r];(e=i==null?void 0:i.off)==null||e.call(i,"change",this.onResourceChange,this)}this.resources=null}onResourceChange(t){this._dirty=!0,t.destroyed?this.destroy():this._updateKey()}}var Oi=(s=>(s[s.WEBGL=1]="WEBGL",s[s.WEBGPU=2]="WEBGPU",s[s.CANVAS=4]="CANVAS",s[s.BOTH=3]="BOTH",s))(Oi||{});class ln extends ke{constructor(t){super(),this.uid=ct("shader"),this._uniformBindMap=Object.create(null),this._ownedBindGroups=[],this._destroyed=!1;let{gpuProgram:e,glProgram:r,groups:i,resources:n,compatibleRenderers:a,groupMap:o}=t;this.gpuProgram=e,this.glProgram=r,a===void 0&&(a=0,e&&(a|=Oi.WEBGPU),r&&(a|=Oi.WEBGL)),this.compatibleRenderers=a;const l={};if(!n&&!i&&(n={}),n&&i)throw new Error("[Shader] Cannot have both resources and groups");if(!e&&i&&!o)throw new Error("[Shader] No group map or WebGPU shader provided - consider using resources instead.");if(!e&&i&&o)for(const h in o)for(const c in o[h]){const u=o[h][c];l[u]={group:h,binding:c,name:u}}else if(e&&i&&!o){const h=e.structsAndGroups.groups;o={},h.forEach(c=>{o[c.group]=o[c.group]||{},o[c.group][c.binding]=c.name,l[c.name]=c})}else if(n){i={},o={},e&&e.structsAndGroups.groups.forEach(u=>{o[u.group]=o[u.group]||{},o[u.group][u.binding]=u.name,l[u.name]=u});let h=0;for(const c in n)l[c]||(i[99]||(i[99]=new mr,this._ownedBindGroups.push(i[99])),l[c]={group:99,binding:h,name:c},o[99]=o[99]||{},o[99][h]=c,h++);for(const c in n){const u=c;let f=n[c];!f.source&&!f._resourceType&&(f=new bl(f));const d=l[u];d&&(i[d.group]||(i[d.group]=new mr,this._ownedBindGroups.push(i[d.group])),i[d.group].setResource(f,d.binding))}}this.groups=i,this._uniformBindMap=o,this.resources=this._buildResourceAccessor(i,l)}addResource(t,e,r){var i,n;(i=this._uniformBindMap)[e]||(i[e]={}),(n=this._uniformBindMap[e])[r]||(n[r]=t),this.groups[e]||(this.groups[e]=new mr,this._ownedBindGroups.push(this.groups[e]))}_buildResourceAccessor(t,e){const r={};for(const i in e){const n=e[i];Object.defineProperty(r,n.name,{get(){return t[n.group].getResource(n.binding)},set(a){t[n.group].setResource(a,n.binding)}})}return r}destroy(t=!1){var e,r;this._destroyed||(this._destroyed=!0,this.emit("destroy",this),t&&((e=this.gpuProgram)==null||e.destroy(),(r=this.glProgram)==null||r.destroy()),this.gpuProgram=null,this.glProgram=null,this.removeAllListeners(),this._uniformBindMap=null,this._ownedBindGroups.forEach(i=>{i.destroy()}),this._ownedBindGroups=null,this.resources=null,this.groups=null)}static from(t){const{gpu:e,gl:r,...i}=t;let n,a;return e&&(n=Rr.from(e)),r&&(a=gl.from(r)),new ln({gpuProgram:n,glProgram:a,...i})}}const Wc={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},ai=0,oi=1,li=2,hi=3,ci=4,ui=5,Ni=class wl{constructor(){this.data=0,this.blendMode="normal",this.polygonOffset=0,this.blend=!0,this.depthMask=!0}get blend(){return!!(this.data&1<<ai)}set blend(t){!!(this.data&1<<ai)!==t&&(this.data^=1<<ai)}get offsets(){return!!(this.data&1<<oi)}set offsets(t){!!(this.data&1<<oi)!==t&&(this.data^=1<<oi)}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<<li)}set culling(t){!!(this.data&1<<li)!==t&&(this.data^=1<<li)}get depthTest(){return!!(this.data&1<<hi)}set depthTest(t){!!(this.data&1<<hi)!==t&&(this.data^=1<<hi)}get depthMask(){return!!(this.data&1<<ui)}set depthMask(t){!!(this.data&1<<ui)!==t&&(this.data^=1<<ui)}get clockwiseFrontFace(){return!!(this.data&1<<ci)}set clockwiseFrontFace(t){!!(this.data&1<<ci)!==t&&(this.data^=1<<ci)}get blendMode(){return this._blendMode}set blendMode(t){this.blend=t!=="none",this._blendMode=t,this._blendModeId=Wc[t]||0}get polygonOffset(){return this._polygonOffset}set polygonOffset(t){this.offsets=!!t,this._polygonOffset=t}toString(){return`[pixi.js/core:State blendMode=${this.blendMode} clockwiseFrontFace=${this.clockwiseFrontFace} culling=${this.culling} depthMask=${this.depthMask} polygonOffset=${this.polygonOffset}]`}static for2d(){const t=new wl;return t.depthTest=!1,t.blend=!0,t}};Ni.default2d=Ni.for2d();let kl=Ni;function wa(s,t,e=2){const r=t&&t.length,i=r?t[0]*e:s.length;let n=vl(s,0,i,e,!0);const a=[];if(!n||n.next===n.prev)return a;let o,l,h;if(r&&(n=Kc(s,t,n,e)),s.length>80*e){o=s[0],l=s[1];let c=o,u=l;for(let f=e;f<i;f+=e){const d=s[f],p=s[f+1];d<o&&(o=d),p<l&&(l=p),d>c&&(c=d),p>u&&(u=p)}h=Math.max(c-o,u-l),h=h!==0?32767/h:0}return Os(n,a,e,o,l,h,0),a}function vl(s,t,e,r,i){let n;if(i===hu(s,t,e,r)>0)for(let a=t;a<e;a+=r)n=ka(a/r|0,s[a],s[a+1],n);else for(let a=e-r;a>=t;a-=r)n=ka(a/r|0,s[a],s[a+1],n);return n&&Qe(n,n.next)&&(Bs(n),n=n.next),n}function Le(s,t){if(!s)return s;t||(t=s);let e=s,r;do if(r=!1,!e.steiner&&(Qe(e,e.next)||at(e.prev,e,e.next)===0)){if(Bs(e),e=t=e.prev,e===e.next)break;r=!0}else e=e.next;while(r||e!==t);return t}function Os(s,t,e,r,i,n,a){if(!s)return;!a&&n&&ru(s,r,i,n);let o=s;for(;s.prev!==s.next;){const l=s.prev,h=s.next;if(n?qc(s,r,i,n):Xc(s)){t.push(l.i,s.i,h.i),Bs(s),s=h.next,o=h.next;continue}if(s=h,s===o){a?a===1?(s=Zc(Le(s),t),Os(s,t,e,r,i,n,2)):a===2&&Qc(s,t,e,r,i,n):Os(Le(s),t,e,r,i,n,1);break}}}function Xc(s){const t=s.prev,e=s,r=s.next;if(at(t,e,r)>=0)return!1;const i=t.x,n=e.x,a=r.x,o=t.y,l=e.y,h=r.y,c=Math.min(i,n,a),u=Math.min(o,l,h),f=Math.max(i,n,a),d=Math.max(o,l,h);let p=r.next;for(;p!==t;){if(p.x>=c&&p.x<=f&&p.y>=u&&p.y<=d&&Ss(i,o,n,l,a,h,p.x,p.y)&&at(p.prev,p,p.next)>=0)return!1;p=p.next}return!0}function qc(s,t,e,r){const i=s.prev,n=s,a=s.next;if(at(i,n,a)>=0)return!1;const o=i.x,l=n.x,h=a.x,c=i.y,u=n.y,f=a.y,d=Math.min(o,l,h),p=Math.min(c,u,f),g=Math.max(o,l,h),m=Math.max(c,u,f),y=Bi(d,p,t,e,r),b=Bi(g,m,t,e,r);let _=s.prevZ,w=s.nextZ;for(;_&&_.z>=y&&w&&w.z<=b;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&Ss(o,c,l,u,h,f,_.x,_.y)&&at(_.prev,_,_.next)>=0||(_=_.prevZ,w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==i&&w!==a&&Ss(o,c,l,u,h,f,w.x,w.y)&&at(w.prev,w,w.next)>=0))return!1;w=w.nextZ}for(;_&&_.z>=y;){if(_.x>=d&&_.x<=g&&_.y>=p&&_.y<=m&&_!==i&&_!==a&&Ss(o,c,l,u,h,f,_.x,_.y)&&at(_.prev,_,_.next)>=0)return!1;_=_.prevZ}for(;w&&w.z<=b;){if(w.x>=d&&w.x<=g&&w.y>=p&&w.y<=m&&w!==i&&w!==a&&Ss(o,c,l,u,h,f,w.x,w.y)&&at(w.prev,w,w.next)>=0)return!1;w=w.nextZ}return!0}function Zc(s,t){let e=s;do{const r=e.prev,i=e.next.next;!Qe(r,i)&&Al(r,e,e.next,i)&&Ns(r,i)&&Ns(i,r)&&(t.push(r.i,e.i,i.i),Bs(e),Bs(e.next),e=s=i),e=e.next}while(e!==s);return Le(e)}function Qc(s,t,e,r,i,n){let a=s;do{let o=a.next.next;for(;o!==a.prev;){if(a.i!==o.i&&au(a,o)){let l=Tl(a,o);a=Le(a,a.next),l=Le(l,l.next),Os(a,t,e,r,i,n,0),Os(l,t,e,r,i,n,0);return}o=o.next}a=a.next}while(a!==s)}function Kc(s,t,e,r){const i=[];for(let n=0,a=t.length;n<a;n++){const o=t[n]*r,l=n<a-1?t[n+1]*r:s.length,h=vl(s,o,l,r,!1);h===h.next&&(h.steiner=!0),i.push(nu(h))}i.sort(Jc);for(let n=0;n<i.length;n++)e=tu(i[n],e);return e}function Jc(s,t){let e=s.x-t.x;if(e===0&&(e=s.y-t.y,e===0)){const r=(s.next.y-s.y)/(s.next.x-s.x),i=(t.next.y-t.y)/(t.next.x-t.x);e=r-i}return e}function tu(s,t){const e=eu(s,t);if(!e)return t;const r=Tl(e,s);return Le(r,r.next),Le(e,e.next)}function eu(s,t){let e=t;const r=s.x,i=s.y;let n=-1/0,a;if(Qe(s,e))return e;do{if(Qe(s,e.next))return e.next;if(i<=e.y&&i>=e.next.y&&e.next.y!==e.y){const u=e.x+(i-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(u<=r&&u>n&&(n=u,a=e.x<e.next.x?e:e.next,u===r))return a}e=e.next}while(e!==t);if(!a)return null;const o=a,l=a.x,h=a.y;let c=1/0;e=a;do{if(r>=e.x&&e.x>=l&&r!==e.x&&Sl(i<h?r:n,i,l,h,i<h?n:r,i,e.x,e.y)){const u=Math.abs(i-e.y)/(r-e.x);Ns(e,s)&&(u<c||u===c&&(e.x>a.x||e.x===a.x&&su(a,e)))&&(a=e,c=u)}e=e.next}while(e!==o);return a}function su(s,t){return at(s.prev,s,t.prev)<0&&at(t.next,s,s.next)<0}function ru(s,t,e,r){let i=s;do i.z===0&&(i.z=Bi(i.x,i.y,t,e,r)),i.prevZ=i.prev,i.nextZ=i.next,i=i.next;while(i!==s);i.prevZ.nextZ=null,i.prevZ=null,iu(i)}function iu(s){let t,e=1;do{let r=s,i;s=null;let n=null;for(t=0;r;){t++;let a=r,o=0;for(let h=0;h<e&&(o++,a=a.nextZ,!!a);h++);let l=e;for(;o>0||l>0&&a;)o!==0&&(l===0||!a||r.z<=a.z)?(i=r,r=r.nextZ,o--):(i=a,a=a.nextZ,l--),n?n.nextZ=i:s=i,i.prevZ=n,n=i;r=a}n.nextZ=null,e*=2}while(t>1);return s}function Bi(s,t,e,r,i){return s=(s-e)*i|0,t=(t-r)*i|0,s=(s|s<<8)&16711935,s=(s|s<<4)&252645135,s=(s|s<<2)&858993459,s=(s|s<<1)&1431655765,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,s|t<<1}function nu(s){let t=s,e=s;do(t.x<e.x||t.x===e.x&&t.y<e.y)&&(e=t),t=t.next;while(t!==s);return e}function Sl(s,t,e,r,i,n,a,o){return(i-a)*(t-o)>=(s-a)*(n-o)&&(s-a)*(r-o)>=(e-a)*(t-o)&&(e-a)*(n-o)>=(i-a)*(r-o)}function Ss(s,t,e,r,i,n,a,o){return!(s===a&&t===o)&&Sl(s,t,e,r,i,n,a,o)}function au(s,t){return s.next.i!==t.i&&s.prev.i!==t.i&&!ou(s,t)&&(Ns(s,t)&&Ns(t,s)&&lu(s,t)&&(at(s.prev,s,t.prev)||at(s,t.prev,t))||Qe(s,t)&&at(s.prev,s,s.next)>0&&at(t.prev,t,t.next)>0)}function at(s,t,e){return(t.y-s.y)*(e.x-t.x)-(t.x-s.x)*(e.y-t.y)}function Qe(s,t){return s.x===t.x&&s.y===t.y}function Al(s,t,e,r){const i=or(at(s,t,e)),n=or(at(s,t,r)),a=or(at(e,r,s)),o=or(at(e,r,t));return!!(i!==n&&a!==o||i===0&&ar(s,e,t)||n===0&&ar(s,r,t)||a===0&&ar(e,s,r)||o===0&&ar(e,t,r))}function ar(s,t,e){return t.x<=Math.max(s.x,e.x)&&t.x>=Math.min(s.x,e.x)&&t.y<=Math.max(s.y,e.y)&&t.y>=Math.min(s.y,e.y)}function or(s){return s>0?1:s<0?-1:0}function ou(s,t){let e=s;do{if(e.i!==s.i&&e.next.i!==s.i&&e.i!==t.i&&e.next.i!==t.i&&Al(e,e.next,s,t))return!0;e=e.next}while(e!==s);return!1}function Ns(s,t){return at(s.prev,s,s.next)<0?at(s,t,s.next)>=0&&at(s,s.prev,t)>=0:at(s,t,s.prev)<0||at(s,s.next,t)<0}function lu(s,t){let e=s,r=!1;const i=(s.x+t.x)/2,n=(s.y+t.y)/2;do e.y>n!=e.next.y>n&&e.next.y!==e.y&&i<(e.next.x-e.x)*(n-e.y)/(e.next.y-e.y)+e.x&&(r=!r),e=e.next;while(e!==s);return r}function Tl(s,t){const e=Fi(s.i,s.x,s.y),r=Fi(t.i,t.x,t.y),i=s.next,n=t.prev;return s.next=t,t.prev=s,e.next=i,i.prev=e,r.next=e,e.prev=r,n.next=r,r.prev=n,r}function ka(s,t,e,r){const i=Fi(s,t,e);return r?(i.next=r.next,i.prev=r,r.next.prev=i,r.next=i):(i.prev=i,i.next=i),i}function Bs(s){s.next.prev=s.prev,s.prev.next=s.next,s.prevZ&&(s.prevZ.nextZ=s.nextZ),s.nextZ&&(s.nextZ.prevZ=s.prevZ)}function Fi(s,t,e){return{i:s,x:t,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function hu(s,t,e,r){let i=0;for(let n=t,a=e-r;n<e;n+=r)i+=(s[a]-s[n])*(s[n+1]+s[a+1]),a=n;return i}const cu=wa.default||wa;var di,va;function uu(){if(va)return di;va=1,di=e;var s={a:7,c:6,h:1,l:2,m:2,q:4,s:4,t:2,v:1,z:0},t=/([astvzqmhlc])([^astvzqmhlc]*)/ig;function e(n){var a=[];return n.replace(t,function(o,l,h){var c=l.toLowerCase();for(h=i(h),c=="m"&&h.length>2&&(a.push([l].concat(h.splice(0,2))),c="l",l=l=="m"?"l":"L");;){if(h.length==s[c])return h.unshift(l),a.push(h);if(h.length<s[c])throw new Error("malformed path data");a.push([l].concat(h.splice(0,s[c])))}}),a}var r=/-?[0-9]*\.?[0-9]+(?:e[-+]?\d+)?/ig;function i(n){var a=n.match(r);return a?a.map(Number):[]}return di}var du=uu();const fu=Do(du);function pu(s,t){const e=fu(s),r=[];let i=null,n=0,a=0;for(let o=0;o<e.length;o++){const l=e[o],h=l[0],c=l;switch(h){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(),r.length>0&&(i=r.pop(),i?(n=i.startX,a=i.startY):(n=0,a=0)),i=null;break;default:Lt(`Unknown SVG path command: ${h}`)}h!=="Z"&&h!=="z"&&i===null&&(i={startX:n,startY:a},r.push(i))}return t}class hn{constructor(t=0,e=0,r=0){this.type="circle",this.x=t,this.y=e,this.radius=r}clone(){return new hn(this.x,this.y,this.radius)}contains(t,e){if(this.radius<=0)return!1;const r=this.radius*this.radius;let i=this.x-t,n=this.y-e;return i*=i,n*=n,i+n<=r}strokeContains(t,e,r,i=.5){if(this.radius===0)return!1;const n=this.x-t,a=this.y-e,o=this.radius,l=(1-i)*r,h=Math.sqrt(n*n+a*a);return h<=o+l&&h>o-(r-l)}getBounds(t){return t||(t=new ft),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}toString(){return`[pixi.js/math:Circle x=${this.x} y=${this.y} radius=${this.radius}]`}}class cn{constructor(t=0,e=0,r=0,i=0){this.type="ellipse",this.x=t,this.y=e,this.halfWidth=r,this.halfHeight=i}clone(){return new cn(this.x,this.y,this.halfWidth,this.halfHeight)}contains(t,e){if(this.halfWidth<=0||this.halfHeight<=0)return!1;let r=(t-this.x)/this.halfWidth,i=(e-this.y)/this.halfHeight;return r*=r,i*=i,r+i<=1}strokeContains(t,e,r,i=.5){const{halfWidth:n,halfHeight:a}=this;if(n<=0||a<=0)return!1;const o=r*(1-i),l=r-o,h=n-l,c=a-l,u=n+o,f=a+o,d=t-this.x,p=e-this.y,g=d*d/(h*h)+p*p/(c*c),m=d*d/(u*u)+p*p/(f*f);return g>1&&m<=1}getBounds(t){return t||(t=new ft),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}toString(){return`[pixi.js/math:Ellipse x=${this.x} y=${this.y} halfWidth=${this.halfWidth} halfHeight=${this.halfHeight}]`}}function mu(s,t,e,r,i,n){const a=s-e,o=t-r,l=i-e,h=n-r,c=a*l+o*h,u=l*l+h*h;let f=-1;u!==0&&(f=c/u);let d,p;f<0?(d=e,p=r):f>1?(d=i,p=n):(d=e+f*l,p=r+f*h);const g=s-d,m=t-p;return g*g+m*m}let gu,xu;class Ps{constructor(...t){this.type="polygon";let e=Array.isArray(t[0])?t[0]:t;if(typeof e[0]!="number"){const r=[];for(let i=0,n=e.length;i<n;i++)r.push(e[i].x,e[i].y);e=r}this.points=e,this.closePath=!0}isClockwise(){let t=0;const e=this.points,r=e.length;for(let i=0;i<r;i+=2){const n=e[i],a=e[i+1],o=e[(i+2)%r],l=e[(i+3)%r];t+=(o-n)*(l+a)}return t<0}containsPolygon(t){const e=this.getBounds(gu),r=t.getBounds(xu);if(!e.containsRect(r))return!1;const i=t.points;for(let n=0;n<i.length;n+=2){const a=i[n],o=i[n+1];if(!this.contains(a,o))return!1}return!0}clone(){const t=this.points.slice(),e=new Ps(t);return e.closePath=this.closePath,e}contains(t,e){let r=!1;const i=this.points.length/2;for(let n=0,a=i-1;n<i;a=n++){const o=this.points[n*2],l=this.points[n*2+1],h=this.points[a*2],c=this.points[a*2+1];l>e!=c>e&&t<(h-o)*((e-l)/(c-l))+o&&(r=!r)}return r}strokeContains(t,e,r,i=.5){const n=r*r,a=n*(1-i),o=n-a,{points:l}=this,h=l.length-(this.closePath?0:2);for(let c=0;c<h;c+=2){const u=l[c],f=l[c+1],d=l[(c+2)%l.length],p=l[(c+3)%l.length],g=mu(t,e,u,f,d,p),m=Math.sign((d-u)*(e-f)-(p-f)*(t-u));if(g<=(m<0?o:a))return!0}return!1}getBounds(t){t||(t=new ft);const e=this.points;let r=1/0,i=-1/0,n=1/0,a=-1/0;for(let o=0,l=e.length;o<l;o+=2){const h=e[o],c=e[o+1];r=h<r?h:r,i=h>i?h:i,n=c<n?c:n,a=c>a?c:a}return t.x=r,t.width=i-r,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}toString(){return`[pixi.js/math:PolygoncloseStroke=${this.closePath}points=${this.points.reduce((t,e)=>`${t}, ${e}`,"")}]`}get lastX(){return this.points[this.points.length-2]}get lastY(){return this.points[this.points.length-1]}get x(){return st("8.11.0","Polygon.lastX is deprecated, please use Polygon.lastX instead."),this.points[this.points.length-2]}get y(){return st("8.11.0","Polygon.y is deprecated, please use Polygon.lastY instead."),this.points[this.points.length-1]}get startX(){return this.points[0]}get startY(){return this.points[1]}}const lr=(s,t,e,r,i,n,a)=>{const o=s-e,l=t-r,h=Math.sqrt(o*o+l*l);return h>=i-n&&h<=i+a};class un{constructor(t=0,e=0,r=0,i=0,n=20){this.type="roundedRectangle",this.x=t,this.y=e,this.width=r,this.height=i,this.radius=n}getBounds(t){return t||(t=new ft),t.x=this.x,t.y=this.y,t.width=this.width,t.height=this.height,t}clone(){return new un(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 r=Math.max(0,Math.min(this.radius,Math.min(this.width,this.height)/2));if(e>=this.y+r&&e<=this.y+this.height-r||t>=this.x+r&&t<=this.x+this.width-r)return!0;let i=t-(this.x+r),n=e-(this.y+r);const a=r*r;if(i*i+n*n<=a||(i=t-(this.x+this.width-r),i*i+n*n<=a)||(n=e-(this.y+this.height-r),i*i+n*n<=a)||(i=t-(this.x+r),i*i+n*n<=a))return!0}return!1}strokeContains(t,e,r,i=.5){const{x:n,y:a,width:o,height:l,radius:h}=this,c=r*(1-i),u=r-c,f=n+h,d=a+h,p=o-h*2,g=l-h*2,m=n+o,y=a+l;return(t>=n-c&&t<=n+u||t>=m-u&&t<=m+c)&&e>=d&&e<=d+g||(e>=a-c&&e<=a+u||e>=y-u&&e<=y+c)&&t>=f&&t<=f+p?!0:t<f&&e<d&&lr(t,e,f,d,h,u,c)||t>m-h&&e<d&&lr(t,e,m-h,d,h,u,c)||t>m-h&&e>y-h&&lr(t,e,m-h,y-h,h,u,c)||t<f&&e>y-h&&lr(t,e,f,y-h,h,u,c)}toString(){return`[pixi.js/math:RoundedRectangle x=${this.x} y=${this.y}width=${this.width} height=${this.height} radius=${this.radius}]`}}const Cl={};function yu(s,t,e){let r=2166136261;for(let i=0;i<t;i++)r^=s[i].uid,r=Math.imul(r,16777619),r>>>=0;return Cl[r]||_u(s,t,r,e)}function _u(s,t,e,r){const i={};let n=0;for(let o=0;o<r;o++){const l=o<t?s[o]:J.EMPTY.source;i[n++]=l.source,i[n++]=l.style}const a=new mr(i);return Cl[e]=a,a}class Sa{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.uint32View=null,this.float32View=null,this.uint16View=null,this._int8View=null,this._uint8View=null,this._int16View=null,this._int32View=null,this._float64Array=null,this._bigUint64Array=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 Aa(s,t,e,r){if(e??(e=0),r??(r=Math.min(s.byteLength-e,t.byteLength)),!(e&7)&&!(r&7)){const i=r/8;new Float64Array(t,0,i).set(new Float64Array(s,e,i))}else if(!(e&3)&&!(r&3)){const i=r/4;new Float32Array(t,0,i).set(new Float32Array(s,e,i))}else new Uint8Array(t).set(new Uint8Array(s,e,r))}const bu={normal:"normal-npm",add:"add-npm",screen:"screen-npm"};function Ta(s,t){return t.alphaMode==="no-premultiply-alpha"&&bu[s]||s}const wu=["precision mediump float;","void main(void){","float test = 0.1;","%forloop%","gl_FragColor = vec4(0.0);","}"].join(`
|
|
24
|
+
`);function ku(s){let t="";for(let e=0;e<s;++e)e>0&&(t+=`
|
|
25
|
+
else `),e<s-1&&(t+=`if(test == ${e}.0){}`);return t}function vu(s,t){if(s===0)throw new Error("Invalid value of `0` passed to `checkMaxIfStatementsInShader`");const e=t.createShader(t.FRAGMENT_SHADER);try{for(;;){const r=wu.replace(/%forloop%/gi,ku(s));if(t.shaderSource(e,r),t.compileShader(e),!t.getShaderParameter(e,t.COMPILE_STATUS))s=s/2|0;else break}}finally{t.deleteShader(e)}return s}let Ve=null;function Su(){var t;if(Ve)return Ve;const s=pl();return Ve=s.getParameter(s.MAX_TEXTURE_IMAGE_UNITS),Ve=vu(Ve,s),(t=s.getExtension("WEBGL_lose_context"))==null||t.loseContext(),Ve}class Au{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}}class Tu{constructor(){this.renderPipeId="batch",this.action="startBatch",this.start=0,this.size=0,this.textures=new Au,this.blendMode="normal",this.topology="triangle-strip",this.canBundle=!0}destroy(){this.textures=null,this.gpuBindGroup=null,this.bindGroup=null,this.batcher=null,this.elements=null}}const Es=[];let _r=0;rn.register({clear:()=>{if(Es.length>0)for(const s of Es)s&&s.destroy();Es.length=0,_r=0}});function Ca(){return _r>0?Es[--_r]:new Tu}function Ma(s){s.elements=null,Es[_r++]=s}let us=0;const Ml=class Pl{constructor(t){this.uid=ct("batcher"),this.dirty=!0,this.batchIndex=0,this.batches=[],this._elements=[],t={...Pl.defaultOptions,...t},t.maxTextures||(st("v8.8.0","maxTextures is a required option for Batcher now, please pass it in the options"),t.maxTextures=Su());const{maxTextures:e,attributesInitialSize:r,indicesInitialSize:i}=t;this.attributeBuffer=new Sa(r*4),this.indexBuffer=new Uint16Array(i),this.maxTextures=e}begin(){this.elementSize=0,this.elementStart=0,this.indexSize=0,this.attributeSize=0;for(let t=0;t<this.batchIndex;t++)Ma(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 r=t._batch.textures.ids[e._source.uid];return!r&&r!==0?!1:(t._textureId=r,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 r=Ca(),i=r.textures;i.clear();const n=e[this.elementStart];let a=Ta(n.blendMode,n.texture._source),o=n.topology;this.attributeSize*4>this.attributeBuffer.size&&this._resizeAttributeBuffer(this.attributeSize*4),this.indexSize>this.indexBuffer.length&&this._resizeIndexBuffer(this.indexSize);const l=this.attributeBuffer.float32View,h=this.attributeBuffer.uint32View,c=this.indexBuffer;let u=this._batchIndexSize,f=this._batchIndexStart,d="startBatch",p=[];const g=this.maxTextures;for(let m=this.elementStart;m<this.elementSize;++m){const y=e[m];e[m]=null;const _=y.texture._source,w=Ta(y.blendMode,_),T=a!==w||o!==y.topology;if(_._batchTick===us&&!T){y._textureId=_._textureBindLocation,u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,h,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,h,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize)),y._batch=r,p.push(y);continue}_._batchTick=us,(i.count>=g||T)&&(this._finishBatch(r,f,u-f,i,a,o,t,d,p),d="renderBatch",f=u,a=w,o=y.topology,r=Ca(),i=r.textures,i.clear(),p=[],++us),y._textureId=_._textureBindLocation=i.count,i.ids[_.uid]=i.count,i.textures[i.count++]=_,y._batch=r,p.push(y),u+=y.indexSize,y.packAsQuad?(this.packQuadAttributes(y,l,h,y._attributeStart,y._textureId),this.packQuadIndex(c,y._indexStart,y._attributeStart/this.vertexSize)):(this.packAttributes(y,l,h,y._attributeStart,y._textureId),this.packIndex(y,c,y._indexStart,y._attributeStart/this.vertexSize))}i.count>0&&(this._finishBatch(r,f,u-f,i,a,o,t,d,p),f=u,++us),this.elementStart=this.elementSize,this._batchIndexStart=f,this._batchIndexSize=u}_finishBatch(t,e,r,i,n,a,o,l,h){t.gpuBindGroup=null,t.bindGroup=null,t.action=l,t.batcher=this,t.textures=i,t.blendMode=n,t.topology=a,t.start=e,t.size=r,t.elements=h,++us,this.batches[this.batchIndex++]=t,o.add(t)}finish(t){this.break(t)}ensureAttributeBuffer(t){t*4<=this.attributeBuffer.size||this._resizeAttributeBuffer(t*4)}ensureIndexBuffer(t){t<=this.indexBuffer.length||this._resizeIndexBuffer(t)}_resizeAttributeBuffer(t){const e=Math.max(t,this.attributeBuffer.size*2),r=new Sa(e);Aa(this.attributeBuffer.rawBinaryData,r.rawBinaryData),this.attributeBuffer=r}_resizeIndexBuffer(t){const e=this.indexBuffer;let r=Math.max(t,e.length*1.5);r+=r%2;const i=r>65535?new Uint32Array(r):new Uint16Array(r);if(i.BYTES_PER_ELEMENT!==e.BYTES_PER_ELEMENT)for(let n=0;n<e.length;n++)i[n]=e[n];else Aa(e.buffer,i.buffer);this.indexBuffer=i}packQuadIndex(t,e,r){t[e]=r+0,t[e+1]=r+1,t[e+2]=r+2,t[e+3]=r+0,t[e+4]=r+2,t[e+5]=r+3}packIndex(t,e,r,i){const n=t.indices,a=t.indexSize,o=t.indexOffset,l=t.attributeOffset;for(let h=0;h<a;h++)e[r++]=i+n[h+o]-l}destroy(t={}){var e;if(this.batches!==null){for(let r=0;r<this.batchIndex;r++)Ma(this.batches[r]);this.batches=null,this.geometry.destroy(!0),this.geometry=null,t.shader&&((e=this.shader)==null||e.destroy(),this.shader=null);for(let r=0;r<this._elements.length;r++)this._elements[r]&&(this._elements[r]._batch=null);this._elements=null,this.indexBuffer=null,this.attributeBuffer.destroy(),this.attributeBuffer=null}}};Ml.defaultOptions={maxTextures:null,attributesInitialSize:4,indicesInitialSize:6};let Cu=Ml;var Pt=(s=>(s[s.MAP_READ=1]="MAP_READ",s[s.MAP_WRITE=2]="MAP_WRITE",s[s.COPY_SRC=4]="COPY_SRC",s[s.COPY_DST=8]="COPY_DST",s[s.INDEX=16]="INDEX",s[s.VERTEX=32]="VERTEX",s[s.UNIFORM=64]="UNIFORM",s[s.STORAGE=128]="STORAGE",s[s.INDIRECT=256]="INDIRECT",s[s.QUERY_RESOLVE=512]="QUERY_RESOLVE",s[s.STATIC=1024]="STATIC",s))(Pt||{});class Fs extends ke{constructor(t){let{data:e,size:r}=t;const{usage:i,label:n,shrinkToFit:a}=t;super(),this._gpuData=Object.create(null),this._gcLastUsed=-1,this.autoGarbageCollect=!0,this.uid=ct("buffer"),this._resourceType="buffer",this._resourceId=ct("resource"),this._touched=0,this._updateID=1,this._dataInt32=null,this.shrinkToFit=!0,this.destroyed=!1,e instanceof Array&&(e=new Float32Array(e)),this._data=e,r??(r=e==null?void 0:e.byteLength);const o=!!e;this.descriptor={size:r,usage:i,mappedAtCreation:o,label:n},this.shrinkToFit=a??!0}get data(){return this._data}set data(t){this.setDataWithSize(t,t.length,!0)}get dataInt32(){return this._dataInt32||(this._dataInt32=new Int32Array(this.data.buffer)),this._dataInt32}get static(){return!!(this.descriptor.usage&Pt.STATIC)}set static(t){t?this.descriptor.usage|=Pt.STATIC:this.descriptor.usage&=~Pt.STATIC}setDataWithSize(t,e,r){if(this._updateID++,this._updateSize=e*t.BYTES_PER_ELEMENT,this._data===t){r&&this.emit("update",this);return}const i=this._data;if(this._data=t,this._dataInt32=null,!i||i.length!==t.length){!this.shrinkToFit&&i&&t.byteLength<i.byteLength?r&&this.emit("update",this):(this.descriptor.size=t.byteLength,this._resourceId=ct("resource"),this.emit("change",this));return}r&&this.emit("update",this)}update(t){this._updateSize=t??this._updateSize,this._updateID++,this.emit("update",this)}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(){this.destroyed=!0,this.unload(),this.emit("destroy",this),this.emit("change",this),this._data=null,this.descriptor=null,this.removeAllListeners()}}function El(s,t){if(!(s instanceof Fs)){let e=t?Pt.INDEX:Pt.VERTEX;s instanceof Array&&(t?(s=new Uint32Array(s),e=Pt.INDEX|Pt.COPY_DST):(s=new Float32Array(s),e=Pt.VERTEX|Pt.COPY_DST)),s=new Fs({data:s,label:t?"index-mesh-buffer":"vertex-mesh-buffer",usage:e})}return s}function Mu(s,t,e){const r=s.getAttribute(t);if(!r)return e.minX=0,e.minY=0,e.maxX=0,e.maxY=0,e;const i=r.buffer.data;let n=1/0,a=1/0,o=-1/0,l=-1/0;const h=i.BYTES_PER_ELEMENT,c=(r.offset||0)/h,u=(r.stride||8)/h;for(let f=c;f<i.length;f+=u){const d=i[f],p=i[f+1];d>o&&(o=d),p>l&&(l=p),d<n&&(n=d),p<a&&(a=p)}return e.minX=n,e.minY=a,e.maxX=o,e.maxY=l,e}function Pu(s){return(s instanceof Fs||Array.isArray(s)||s.BYTES_PER_ELEMENT)&&(s={buffer:s}),s.buffer=El(s.buffer,!1),s}class Eu extends ke{constructor(t={}){super(),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=ct("geometry"),this._layoutKey=0,this.instanceCount=1,this._bounds=new Yt,this._boundsDirty=!0;const{attributes:e,indexBuffer:r,topology:i}=t;if(this.buffers=[],this.attributes={},e)for(const n in e)this.addAttribute(n,e[n]);this.instanceCount=t.instanceCount??1,r&&this.addIndex(r),this.topology=i||"triangle-list"}onBufferUpdate(){this._boundsDirty=!0,this.emit("update",this)}getAttribute(t){return this.attributes[t]}getIndex(){return this.indexBuffer}getBuffer(t){return this.getAttribute(t).buffer}getSize(){for(const t in this.attributes){const e=this.attributes[t];return e.buffer.data.length/(e.stride/4||e.size)}return 0}addAttribute(t,e){const r=Pu(e);this.buffers.indexOf(r.buffer)===-1&&(this.buffers.push(r.buffer),r.buffer.on("update",this.onBufferUpdate,this),r.buffer.on("change",this.onBufferUpdate,this)),this.attributes[t]=r}addIndex(t){this.indexBuffer=El(t,!0),this.buffers.push(this.indexBuffer)}get bounds(){return this._boundsDirty?(this._boundsDirty=!1,Mu(this,"aPosition",this._bounds)):this._bounds}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){var e;this.emit("destroy",this),this.removeAllListeners(),t&&this.buffers.forEach(r=>r.destroy()),this.unload(),(e=this.indexBuffer)==null||e.destroy(),this.attributes=null,this.buffers=null,this.indexBuffer=null,this._bounds=null}}const Ru=new Float32Array(1),Iu=new Uint32Array(1);class Du extends Eu{constructor(){const e=new Fs({data:Ru,label:"attribute-batch-buffer",usage:Pt.VERTEX|Pt.COPY_DST,shrinkToFit:!1}),r=new Fs({data:Iu,label:"index-batch-buffer",usage:Pt.INDEX|Pt.COPY_DST,shrinkToFit:!1}),i=24;super({attributes:{aPosition:{buffer:e,format:"float32x2",stride:i,offset:0},aUV:{buffer:e,format:"float32x2",stride:i,offset:8},aColor:{buffer:e,format:"unorm8x4",stride:i,offset:16},aTextureIdAndRound:{buffer:e,format:"uint16x2",stride:i,offset:20}},indexBuffer:r})}}function Pa(s,t,e){if(s)for(const r in s){const i=r.toLocaleLowerCase(),n=t[i];if(n){let a=s[r];r==="header"&&(a=a.replace(/@in\s+[^;]+;\s*/g,"").replace(/@out\s+[^;]+;\s*/g,"")),e&&n.push(`//----${e}----//`),n.push(a)}else Lt(`${r} placement hook does not exist in shader`)}}const Lu=/\{\{(.*?)\}\}/g;function Ea(s){var r;const t={};return(((r=s.match(Lu))==null?void 0:r.map(i=>i.replace(/[{()}]/g,"")))??[]).forEach(i=>{t[i]=[]}),t}function Ra(s,t){let e;const r=/@in\s+([^;]+);/g;for(;(e=r.exec(s))!==null;)t.push(e[1])}function Ia(s,t,e=!1){const r=[];Ra(t,r),s.forEach(o=>{o.header&&Ra(o.header,r)});const i=r;e&&i.sort();const n=i.map((o,l)=>` @location(${l}) ${o},`).join(`
|
|
26
|
+
`);let a=t.replace(/@in\s+[^;]+;\s*/g,"");return a=a.replace("{{in}}",`
|
|
27
|
+
${n}
|
|
28
|
+
`),a}function Da(s,t){let e;const r=/@out\s+([^;]+);/g;for(;(e=r.exec(s))!==null;)t.push(e[1])}function Ou(s){const e=/\b(\w+)\s*:/g.exec(s);return e?e[1]:""}function Nu(s){const t=/@.*?\s+/g;return s.replace(t,"")}function Bu(s,t){const e=[];Da(t,e),s.forEach(l=>{l.header&&Da(l.header,e)});let r=0;const i=e.sort().map(l=>l.indexOf("builtin")>-1?l:`@location(${r++}) ${l}`).join(`,
|
|
29
|
+
`),n=e.sort().map(l=>` var ${Nu(l)};`).join(`
|
|
30
|
+
`),a=`return VSOutput(
|
|
31
|
+
${e.sort().map(l=>` ${Ou(l)}`).join(`,
|
|
32
|
+
`)});`;let o=t.replace(/@out\s+[^;]+;\s*/g,"");return o=o.replace("{{struct}}",`
|
|
33
|
+
${i}
|
|
34
|
+
`),o=o.replace("{{start}}",`
|
|
35
|
+
${n}
|
|
36
|
+
`),o=o.replace("{{return}}",`
|
|
37
|
+
${a}
|
|
38
|
+
`),o}function La(s,t){let e=s;for(const r in t){const i=t[r];i.join(`
|
|
39
|
+
`).length?e=e.replace(`{{${r}}}`,`//-----${r} START-----//
|
|
40
|
+
${i.join(`
|
|
41
|
+
`)}
|
|
42
|
+
//----${r} FINISH----//`):e=e.replace(`{{${r}}}`,"")}return e}const _e=Object.create(null),fi=new Map;let Fu=0;function Gu({template:s,bits:t}){const e=Rl(s,t);if(_e[e])return _e[e];const{vertex:r,fragment:i}=$u(s,t);return _e[e]=Il(r,i,t),_e[e]}function zu({template:s,bits:t}){const e=Rl(s,t);return _e[e]||(_e[e]=Il(s.vertex,s.fragment,t)),_e[e]}function $u(s,t){const e=t.map(a=>a.vertex).filter(a=>!!a),r=t.map(a=>a.fragment).filter(a=>!!a);let i=Ia(e,s.vertex,!0);i=Bu(e,i);const n=Ia(r,s.fragment,!0);return{vertex:i,fragment:n}}function Rl(s,t){return t.map(e=>(fi.has(e)||fi.set(e,Fu++),fi.get(e))).sort((e,r)=>e-r).join("-")+s.vertex+s.fragment}function Il(s,t,e){const r=Ea(s),i=Ea(t);return e.forEach(n=>{Pa(n.vertex,r,n.name),Pa(n.fragment,i,n.name)}),{vertex:La(s,r),fragment:La(t,i)}}const Uu=`
|
|
43
|
+
@in aPosition: vec2<f32>;
|
|
44
|
+
@in aUV: vec2<f32>;
|
|
45
|
+
|
|
46
|
+
@out @builtin(position) vPosition: vec4<f32>;
|
|
47
|
+
@out vUV : vec2<f32>;
|
|
48
|
+
@out vColor : vec4<f32>;
|
|
49
|
+
|
|
50
|
+
{{header}}
|
|
51
|
+
|
|
52
|
+
struct VSOutput {
|
|
53
|
+
{{struct}}
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
@vertex
|
|
57
|
+
fn main( {{in}} ) -> VSOutput {
|
|
58
|
+
|
|
59
|
+
var worldTransformMatrix = globalUniforms.uWorldTransformMatrix;
|
|
60
|
+
var modelMatrix = mat3x3<f32>(
|
|
61
|
+
1.0, 0.0, 0.0,
|
|
62
|
+
0.0, 1.0, 0.0,
|
|
63
|
+
0.0, 0.0, 1.0
|
|
64
|
+
);
|
|
65
|
+
var position = aPosition;
|
|
66
|
+
var uv = aUV;
|
|
67
|
+
|
|
68
|
+
{{start}}
|
|
69
|
+
|
|
70
|
+
vColor = vec4<f32>(1., 1., 1., 1.);
|
|
71
|
+
|
|
72
|
+
{{main}}
|
|
73
|
+
|
|
74
|
+
vUV = uv;
|
|
75
|
+
|
|
76
|
+
var modelViewProjectionMatrix = globalUniforms.uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
77
|
+
|
|
78
|
+
vPosition = vec4<f32>((modelViewProjectionMatrix * vec3<f32>(position, 1.0)).xy, 0.0, 1.0);
|
|
79
|
+
|
|
80
|
+
vColor *= globalUniforms.uWorldColorAlpha;
|
|
81
|
+
|
|
82
|
+
{{end}}
|
|
83
|
+
|
|
84
|
+
{{return}}
|
|
85
|
+
};
|
|
86
|
+
`,Hu=`
|
|
87
|
+
@in vUV : vec2<f32>;
|
|
88
|
+
@in vColor : vec4<f32>;
|
|
89
|
+
|
|
90
|
+
{{header}}
|
|
91
|
+
|
|
92
|
+
@fragment
|
|
93
|
+
fn main(
|
|
94
|
+
{{in}}
|
|
95
|
+
) -> @location(0) vec4<f32> {
|
|
96
|
+
|
|
97
|
+
{{start}}
|
|
98
|
+
|
|
99
|
+
var outColor:vec4<f32>;
|
|
100
|
+
|
|
101
|
+
{{main}}
|
|
102
|
+
|
|
103
|
+
var finalColor:vec4<f32> = outColor * vColor;
|
|
104
|
+
|
|
105
|
+
{{end}}
|
|
106
|
+
|
|
107
|
+
return finalColor;
|
|
108
|
+
};
|
|
109
|
+
`,ju=`
|
|
110
|
+
in vec2 aPosition;
|
|
111
|
+
in vec2 aUV;
|
|
112
|
+
|
|
113
|
+
out vec4 vColor;
|
|
114
|
+
out vec2 vUV;
|
|
115
|
+
|
|
116
|
+
{{header}}
|
|
117
|
+
|
|
118
|
+
void main(void){
|
|
119
|
+
|
|
120
|
+
mat3 worldTransformMatrix = uWorldTransformMatrix;
|
|
121
|
+
mat3 modelMatrix = mat3(
|
|
122
|
+
1.0, 0.0, 0.0,
|
|
123
|
+
0.0, 1.0, 0.0,
|
|
124
|
+
0.0, 0.0, 1.0
|
|
125
|
+
);
|
|
126
|
+
vec2 position = aPosition;
|
|
127
|
+
vec2 uv = aUV;
|
|
128
|
+
|
|
129
|
+
{{start}}
|
|
130
|
+
|
|
131
|
+
vColor = vec4(1.);
|
|
132
|
+
|
|
133
|
+
{{main}}
|
|
134
|
+
|
|
135
|
+
vUV = uv;
|
|
136
|
+
|
|
137
|
+
mat3 modelViewProjectionMatrix = uProjectionMatrix * worldTransformMatrix * modelMatrix;
|
|
138
|
+
|
|
139
|
+
gl_Position = vec4((modelViewProjectionMatrix * vec3(position, 1.0)).xy, 0.0, 1.0);
|
|
140
|
+
|
|
141
|
+
vColor *= uWorldColorAlpha;
|
|
142
|
+
|
|
143
|
+
{{end}}
|
|
144
|
+
}
|
|
145
|
+
`,Vu=`
|
|
146
|
+
|
|
147
|
+
in vec4 vColor;
|
|
148
|
+
in vec2 vUV;
|
|
149
|
+
|
|
150
|
+
out vec4 finalColor;
|
|
151
|
+
|
|
152
|
+
{{header}}
|
|
153
|
+
|
|
154
|
+
void main(void) {
|
|
155
|
+
|
|
156
|
+
{{start}}
|
|
157
|
+
|
|
158
|
+
vec4 outColor;
|
|
159
|
+
|
|
160
|
+
{{main}}
|
|
161
|
+
|
|
162
|
+
finalColor = outColor * vColor;
|
|
163
|
+
|
|
164
|
+
{{end}}
|
|
165
|
+
}
|
|
166
|
+
`,Yu={name:"global-uniforms-bit",vertex:{header:`
|
|
167
|
+
struct GlobalUniforms {
|
|
168
|
+
uProjectionMatrix:mat3x3<f32>,
|
|
169
|
+
uWorldTransformMatrix:mat3x3<f32>,
|
|
170
|
+
uWorldColorAlpha: vec4<f32>,
|
|
171
|
+
uResolution: vec2<f32>,
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
@group(0) @binding(0) var<uniform> globalUniforms : GlobalUniforms;
|
|
175
|
+
`}},Wu={name:"global-uniforms-bit",vertex:{header:`
|
|
176
|
+
uniform mat3 uProjectionMatrix;
|
|
177
|
+
uniform mat3 uWorldTransformMatrix;
|
|
178
|
+
uniform vec4 uWorldColorAlpha;
|
|
179
|
+
uniform vec2 uResolution;
|
|
180
|
+
`}};function Xu({bits:s,name:t}){const e=Gu({template:{fragment:Hu,vertex:Uu},bits:[Yu,...s]});return Rr.from({name:t,vertex:{source:e.vertex,entryPoint:"main"},fragment:{source:e.fragment,entryPoint:"main"}})}function qu({bits:s,name:t}){return new gl({name:t,...zu({template:{vertex:ju,fragment:Vu},bits:[Wu,...s]})})}const Zu={name:"color-bit",vertex:{header:`
|
|
181
|
+
@in aColor: vec4<f32>;
|
|
182
|
+
`,main:`
|
|
183
|
+
vColor *= vec4<f32>(aColor.rgb * aColor.a, aColor.a);
|
|
184
|
+
`}},Qu={name:"color-bit",vertex:{header:`
|
|
185
|
+
in vec4 aColor;
|
|
186
|
+
`,main:`
|
|
187
|
+
vColor *= vec4(aColor.rgb * aColor.a, aColor.a);
|
|
188
|
+
`}},pi={};function Ku(s){const t=[];if(s===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 r=0;r<s;r++)t.push(`@group(1) @binding(${e++}) var textureSource${r+1}: texture_2d<f32>;`),t.push(`@group(1) @binding(${e++}) var textureSampler${r+1}: sampler;`)}return t.join(`
|
|
189
|
+
`)}function Ju(s){const t=[];if(s===1)t.push("outColor = textureSampleGrad(textureSource1, textureSampler1, vUV, uvDx, uvDy);");else{t.push("switch vTextureId {");for(let e=0;e<s;e++)e===s-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(`
|
|
190
|
+
`)}function td(s){return pi[s]||(pi[s]={name:"texture-batch-bit",vertex:{header:`
|
|
191
|
+
@in aTextureIdAndRound: vec2<u32>;
|
|
192
|
+
@out @interpolate(flat) vTextureId : u32;
|
|
193
|
+
`,main:`
|
|
194
|
+
vTextureId = aTextureIdAndRound.y;
|
|
195
|
+
`,end:`
|
|
196
|
+
if(aTextureIdAndRound.x == 1)
|
|
197
|
+
{
|
|
198
|
+
vPosition = vec4<f32>(roundPixels(vPosition.xy, globalUniforms.uResolution), vPosition.zw);
|
|
199
|
+
}
|
|
200
|
+
`},fragment:{header:`
|
|
201
|
+
@in @interpolate(flat) vTextureId: u32;
|
|
202
|
+
|
|
203
|
+
${Ku(s)}
|
|
204
|
+
`,main:`
|
|
205
|
+
var uvDx = dpdx(vUV);
|
|
206
|
+
var uvDy = dpdy(vUV);
|
|
207
|
+
|
|
208
|
+
${Ju(s)}
|
|
209
|
+
`}}),pi[s]}const mi={};function ed(s){const t=[];for(let e=0;e<s;e++)e>0&&t.push("else"),e<s-1&&t.push(`if(vTextureId < ${e}.5)`),t.push("{"),t.push(` outColor = texture(uTextures[${e}], vUV);`),t.push("}");return t.join(`
|
|
210
|
+
`)}function sd(s){return mi[s]||(mi[s]={name:"texture-batch-bit",vertex:{header:`
|
|
211
|
+
in vec2 aTextureIdAndRound;
|
|
212
|
+
out float vTextureId;
|
|
213
|
+
|
|
214
|
+
`,main:`
|
|
215
|
+
vTextureId = aTextureIdAndRound.y;
|
|
216
|
+
`,end:`
|
|
217
|
+
if(aTextureIdAndRound.x == 1.)
|
|
218
|
+
{
|
|
219
|
+
gl_Position.xy = roundPixels(gl_Position.xy, uResolution);
|
|
220
|
+
}
|
|
221
|
+
`},fragment:{header:`
|
|
222
|
+
in float vTextureId;
|
|
223
|
+
|
|
224
|
+
uniform sampler2D uTextures[${s}];
|
|
225
|
+
|
|
226
|
+
`,main:`
|
|
227
|
+
|
|
228
|
+
${ed(s)}
|
|
229
|
+
`}}),mi[s]}const rd={name:"round-pixels-bit",vertex:{header:`
|
|
230
|
+
fn roundPixels(position: vec2<f32>, targetSize: vec2<f32>) -> vec2<f32>
|
|
231
|
+
{
|
|
232
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
233
|
+
}
|
|
234
|
+
`}},id={name:"round-pixels-bit",vertex:{header:`
|
|
235
|
+
vec2 roundPixels(vec2 position, vec2 targetSize)
|
|
236
|
+
{
|
|
237
|
+
return (floor(((position * 0.5 + 0.5) * targetSize) + 0.5) / targetSize) * 2.0 - 1.0;
|
|
238
|
+
}
|
|
239
|
+
`}},Oa={};function nd(s){let t=Oa[s];if(t)return t;const e=new Int32Array(s);for(let r=0;r<s;r++)e[r]=r;return t=Oa[s]=new bl({uTextures:{value:e,type:"i32",size:s}},{isStatic:!0}),t}class Na extends ln{constructor(t){const e=qu({name:"batch",bits:[Qu,sd(t),id]}),r=Xu({name:"batch",bits:[Zu,td(t),rd]});super({glProgram:e,gpuProgram:r,resources:{batchSamplers:nd(t)}}),this.maxTextures=t}}let ds=null;const Dl=class Ll extends Cu{constructor(t){super(t),this.geometry=new Du,this.name=Ll.extension.name,this.vertexSize=6,ds??(ds=new Na(t.maxTextures)),this.shader=ds}packAttributes(t,e,r,i,n){const a=n<<16|t.roundPixels&65535,o=t.transform,l=o.a,h=o.b,c=o.c,u=o.d,f=o.tx,d=o.ty,{positions:p,uvs:g}=t,m=t.color,y=t.attributeOffset,b=y+t.attributeSize;for(let _=y;_<b;_++){const w=_*2,T=p[w],k=p[w+1];e[i++]=l*T+c*k+f,e[i++]=u*k+h*T+d,e[i++]=g[w],e[i++]=g[w+1],r[i++]=m,r[i++]=a}}packQuadAttributes(t,e,r,i,n){const a=t.texture,o=t.transform,l=o.a,h=o.b,c=o.c,u=o.d,f=o.tx,d=o.ty,p=t.bounds,g=p.maxX,m=p.minX,y=p.maxY,b=p.minY,_=a.uvs,w=t.color,T=n<<16|t.roundPixels&65535;e[i+0]=l*m+c*b+f,e[i+1]=u*b+h*m+d,e[i+2]=_.x0,e[i+3]=_.y0,r[i+4]=w,r[i+5]=T,e[i+6]=l*g+c*b+f,e[i+7]=u*b+h*g+d,e[i+8]=_.x1,e[i+9]=_.y1,r[i+10]=w,r[i+11]=T,e[i+12]=l*g+c*y+f,e[i+13]=u*y+h*g+d,e[i+14]=_.x2,e[i+15]=_.y2,r[i+16]=w,r[i+17]=T,e[i+18]=l*m+c*y+f,e[i+19]=u*y+h*m+d,e[i+20]=_.x3,e[i+21]=_.y3,r[i+22]=w,r[i+23]=T}_updateMaxTextures(t){this.shader.maxTextures!==t&&(ds=new Na(t),this.shader=ds)}destroy(){this.shader=null,super.destroy()}};Dl.extension={type:[tt.Batcher],name:"default"};let ad=Dl;class Ir{constructor(t){this.items=Object.create(null);const{renderer:e,type:r,onUnload:i,priority:n,name:a}=t;this._renderer=e,e.gc.addResourceHash(this,"items",r,n??0),this._onUnload=i,this.name=a}add(t){return this.items[t.uid]?!1:(this.items[t.uid]=t,t.once("unload",this.remove,this),t._gcLastUsed=this._renderer.gc.now,!0)}remove(t,...e){var i;if(!this.items[t.uid])return;const r=t._gpuData[this._renderer.uid];r&&((i=this._onUnload)==null||i.call(this,t,...e),r.destroy(),t._gpuData[this._renderer.uid]=null,this.items[t.uid]=null)}removeAll(...t){Object.values(this.items).forEach(e=>e&&this.remove(e,...t))}destroy(...t){this.removeAll(...t),this.items=Object.create(null),this._renderer=null,this._onUnload=null}}function od(s,t,e,r,i,n,a,o=null){let l=0;e*=t,i*=n;const h=o.a,c=o.b,u=o.c,f=o.d,d=o.tx,p=o.ty;for(;l<a;){const g=s[e],m=s[e+1];r[i]=h*g+u*m+d,r[i+1]=c*g+f*m+p,i+=n,e+=t,l++}}function ld(s,t,e,r){let i=0;for(t*=e;i<r;)s[t]=0,s[t+1]=0,t+=e,i++}function Ol(s,t,e,r,i){const n=t.a,a=t.b,o=t.c,l=t.d,h=t.tx,c=t.ty;e||(e=0),r||(r=2),i||(i=s.length/r-e);let u=e*r;for(let f=0;f<i;f++){const d=s[u],p=s[u+1];s[u]=n*d+o*p+h,s[u+1]=a*d+l*p+c,u+=r}}const hd=new H;class dn{constructor(){this.packAsQuad=!1,this.batcherName="default",this.topology="triangle-list",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.renderable&&this.applyTransform?this.renderable.groupBlendMode:"normal"}get color(){const t=this.baseColor,e=t>>16|t&65280|(t&255)<<16,r=this.renderable;return r?Wo(e,r.groupColor)+(this.alpha*r.groupAlpha*255<<24):e+(this.alpha*255<<24)}get transform(){var t;return((t=this.renderable)==null?void 0:t.groupTransform)||hd}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,t.topology=this.topology}reset(){this.applyTransform=!0,this.renderable=null,this.topology="triangle-list"}destroy(){this.renderable=null,this.texture=null,this.geometryData=null,this._batcher=null,this._batch=null}}const Gs={extension:{type:tt.ShapeBuilder,name:"circle"},build(s,t){let e,r,i,n,a,o;if(s.type==="circle"){const w=s;if(a=o=w.radius,a<=0)return!1;e=w.x,r=w.y,i=n=0}else if(s.type==="ellipse"){const w=s;if(a=w.halfWidth,o=w.halfHeight,a<=0||o<=0)return!1;e=w.x,r=w.y,i=n=0}else{const w=s,T=w.width/2,k=w.height/2;e=w.x+T,r=w.y+k,a=o=Math.max(0,Math.min(w.radius,Math.min(T,k))),i=T-a,n=k-o}if(i<0||n<0)return!1;const l=Math.ceil(2.3*Math.sqrt(a+o)),h=l*8+(i?4:0)+(n?4:0);if(h===0)return!1;if(l===0)return t[0]=t[6]=e+i,t[1]=t[3]=r+n,t[2]=t[4]=e-i,t[5]=t[7]=r-n,!0;let c=0,u=l*4+(i?2:0)+2,f=u,d=h,p=i+a,g=n,m=e+p,y=e-p,b=r+g;if(t[c++]=m,t[c++]=b,t[--u]=b,t[--u]=y,n){const w=r-g;t[f++]=y,t[f++]=w,t[--d]=w,t[--d]=m}for(let w=1;w<l;w++){const T=Math.PI/2*(w/l),k=i+Math.cos(T)*a,v=n+Math.sin(T)*o,F=e+k,G=e-k,M=r+v,C=r-v;t[c++]=F,t[c++]=M,t[--u]=M,t[--u]=G,t[f++]=G,t[f++]=C,t[--d]=C,t[--d]=F}p=i,g=n+o,m=e+p,y=e-p,b=r+g;const _=r-g;return t[c++]=m,t[c++]=b,t[--d]=_,t[--d]=m,i&&(t[c++]=y,t[c++]=b,t[--d]=_,t[--d]=y),!0},triangulate(s,t,e,r,i,n){if(s.length===0)return;let a=0,o=0;for(let c=0;c<s.length;c+=2)a+=s[c],o+=s[c+1];a/=s.length/2,o/=s.length/2;let l=r;t[l*e]=a,t[l*e+1]=o;const h=l++;for(let c=0;c<s.length;c+=2)t[l*e]=s[c],t[l*e+1]=s[c+1],c>0&&(i[n++]=l,i[n++]=h,i[n++]=l-1),l++;i[n++]=h+1,i[n++]=h,i[n++]=l-1}},cd={...Gs,extension:{...Gs.extension,name:"ellipse"}},ud={...Gs,extension:{...Gs.extension,name:"roundedRectangle"}},Nl=1e-4,Ba=1e-4;function dd(s){const t=s.length;if(t<6)return 1;let e=0;for(let r=0,i=s[t-2],n=s[t-1];r<t;r+=2){const a=s[r],o=s[r+1];e+=(a-i)*(o+n),i=a,n=o}return e<0?-1:1}function Fa(s,t,e,r,i,n,a,o){const l=s-e*i,h=t-r*i,c=s+e*n,u=t+r*n;let f,d;a?(f=r,d=-e):(f=-r,d=e);const p=l+f,g=h+d,m=c+f,y=u+d;return o.push(p,g),o.push(m,y),2}function Ce(s,t,e,r,i,n,a,o){const l=e-s,h=r-t;let c=Math.atan2(l,h),u=Math.atan2(i-s,n-t);o&&c<u?c+=Math.PI*2:!o&&c>u&&(u+=Math.PI*2);let f=c;const d=u-c,p=Math.abs(d),g=Math.sqrt(l*l+h*h),m=(15*p*Math.sqrt(g)/Math.PI>>0)+1,y=d/m;if(f+=y,o){a.push(s,t),a.push(e,r);for(let b=1,_=f;b<m;b++,_+=y)a.push(s,t),a.push(s+Math.sin(_)*g,t+Math.cos(_)*g);a.push(s,t),a.push(i,n)}else{a.push(e,r),a.push(s,t);for(let b=1,_=f;b<m;b++,_+=y)a.push(s+Math.sin(_)*g,t+Math.cos(_)*g),a.push(s,t);a.push(i,n),a.push(s,t)}return m*2}function fd(s,t,e,r,i,n){const a=Nl;if(s.length===0)return;const o=t;let l=o.alignment;if(t.alignment!==.5){let V=dd(s);l=(l-.5)*V+.5}const h=new yt(s[0],s[1]),c=new yt(s[s.length-2],s[s.length-1]),u=r,f=Math.abs(h.x-c.x)<a&&Math.abs(h.y-c.y)<a;if(u){s=s.slice(),f&&(s.pop(),s.pop(),c.set(s[s.length-2],s[s.length-1]));const V=(h.x+c.x)*.5,zt=(c.y+h.y)*.5;s.unshift(V,zt),s.push(V,zt)}const d=i,p=s.length/2;let g=s.length;const m=d.length/2,y=o.width/2,b=y*y,_=o.miterLimit*o.miterLimit;let w=s[0],T=s[1],k=s[2],v=s[3],F=0,G=0,M=-(T-v),C=w-k,W=0,Z=0,Q=Math.sqrt(M*M+C*C);M/=Q,C/=Q,M*=y,C*=y;const fe=l,R=(1-fe)*2,O=fe*2;u||(o.cap==="round"?g+=Ce(w-M*(R-O)*.5,T-C*(R-O)*.5,w-M*R,T-C*R,w+M*O,T+C*O,d,!0)+2:o.cap==="square"&&(g+=Fa(w,T,M,C,R,O,!0,d))),d.push(w-M*R,T-C*R),d.push(w+M*O,T+C*O);for(let V=1;V<p-1;++V){w=s[(V-1)*2],T=s[(V-1)*2+1],k=s[V*2],v=s[V*2+1],F=s[(V+1)*2],G=s[(V+1)*2+1],M=-(T-v),C=w-k,Q=Math.sqrt(M*M+C*C),M/=Q,C/=Q,M*=y,C*=y,W=-(v-G),Z=k-F,Q=Math.sqrt(W*W+Z*Z),W/=Q,Z/=Q,W*=y,Z*=y;const zt=k-w,rt=T-v,me=k-F,nt=G-v,rs=zt*me+rt*nt,et=rt*me-nt*zt,$t=et<0;if(Math.abs(et)<.001*Math.abs(rs)){d.push(k-M*R,v-C*R),d.push(k+M*O,v+C*O),rs>=0&&(o.join==="round"?g+=Ce(k,v,k-M*R,v-C*R,k-W*R,v-Z*R,d,!1)+4:g+=2,d.push(k-W*O,v-Z*O),d.push(k+W*R,v+Z*R));continue}const Se=(-M+w)*(-C+v)-(-M+k)*(-C+T),Ut=(-W+F)*(-Z+v)-(-W+k)*(-Z+G),Ae=(zt*Ut-me*Se)/et,ge=(nt*Se-rt*Ut)/et,Fe=(Ae-k)*(Ae-k)+(ge-v)*(ge-v),Xt=k+(Ae-k)*R,Ct=v+(ge-v)*R,Nt=k-(Ae-k)*O,_t=v-(ge-v)*O,is=Math.min(zt*zt+rt*rt,me*me+nt*nt),Ge=$t?R:O,xe=is+Ge*Ge*b;Fe<=xe?o.join==="bevel"||Fe/b>_?($t?(d.push(Xt,Ct),d.push(k+M*O,v+C*O),d.push(Xt,Ct),d.push(k+W*O,v+Z*O)):(d.push(k-M*R,v-C*R),d.push(Nt,_t),d.push(k-W*R,v-Z*R),d.push(Nt,_t)),g+=2):o.join==="round"?$t?(d.push(Xt,Ct),d.push(k+M*O,v+C*O),g+=Ce(k,v,k+M*O,v+C*O,k+W*O,v+Z*O,d,!0)+4,d.push(Xt,Ct),d.push(k+W*O,v+Z*O)):(d.push(k-M*R,v-C*R),d.push(Nt,_t),g+=Ce(k,v,k-M*R,v-C*R,k-W*R,v-Z*R,d,!1)+4,d.push(k-W*R,v-Z*R),d.push(Nt,_t)):(d.push(Xt,Ct),d.push(Nt,_t)):(d.push(k-M*R,v-C*R),d.push(k+M*O,v+C*O),o.join==="round"?$t?g+=Ce(k,v,k+M*O,v+C*O,k+W*O,v+Z*O,d,!0)+2:g+=Ce(k,v,k-M*R,v-C*R,k-W*R,v-Z*R,d,!1)+2:o.join==="miter"&&Fe/b<=_&&($t?(d.push(Nt,_t),d.push(Nt,_t)):(d.push(Xt,Ct),d.push(Xt,Ct)),g+=2),d.push(k-W*R,v-Z*R),d.push(k+W*O,v+Z*O),g+=2)}w=s[(p-2)*2],T=s[(p-2)*2+1],k=s[(p-1)*2],v=s[(p-1)*2+1],M=-(T-v),C=w-k,Q=Math.sqrt(M*M+C*C),M/=Q,C/=Q,M*=y,C*=y,d.push(k-M*R,v-C*R),d.push(k+M*O,v+C*O),u||(o.cap==="round"?g+=Ce(k-M*(R-O)*.5,v-C*(R-O)*.5,k-M*R,v-C*R,k+M*O,v+C*O,d,!1)+2:o.cap==="square"&&(g+=Fa(k,v,M,C,R,O,!1,d)));const pe=Ba*Ba;for(let V=m;V<g+m-2;++V)w=d[V*2],T=d[V*2+1],k=d[(V+1)*2],v=d[(V+1)*2+1],F=d[(V+2)*2],G=d[(V+2)*2+1],!(Math.abs(w*(v-G)+k*(G-T)+F*(T-v))<pe)&&n.push(V,V+1,V+2)}function pd(s,t,e,r){const i=Nl;if(s.length===0)return;const n=s[0],a=s[1],o=s[s.length-2],l=s[s.length-1],h=t||Math.abs(n-o)<i&&Math.abs(a-l)<i,c=e,u=s.length/2,f=c.length/2;for(let d=0;d<u;d++)c.push(s[d*2]),c.push(s[d*2+1]);for(let d=0;d<u-1;d++)r.push(f+d,f+d+1);h&&r.push(f+u-1,f)}function Bl(s,t,e,r,i,n,a){const o=cu(s,t,2);if(!o)return;for(let h=0;h<o.length;h+=3)n[a++]=o[h]+i,n[a++]=o[h+1]+i,n[a++]=o[h+2]+i;let l=i*r;for(let h=0;h<s.length;h+=2)e[l]=s[h],e[l+1]=s[h+1],l+=r}const md=[],gd={extension:{type:tt.ShapeBuilder,name:"polygon"},build(s,t){for(let e=0;e<s.points.length;e++)t[e]=s.points[e];return!0},triangulate(s,t,e,r,i,n){Bl(s,md,t,e,r,i,n)}},xd={extension:{type:tt.ShapeBuilder,name:"rectangle"},build(s,t){const e=s,r=e.x,i=e.y,n=e.width,a=e.height;return n>0&&a>0?(t[0]=r,t[1]=i,t[2]=r+n,t[3]=i,t[4]=r+n,t[5]=i+a,t[6]=r,t[7]=i+a,!0):!1},triangulate(s,t,e,r,i,n){let a=0;r*=e,t[r+a]=s[0],t[r+a+1]=s[1],a+=e,t[r+a]=s[2],t[r+a+1]=s[3],a+=e,t[r+a]=s[6],t[r+a+1]=s[7],a+=e,t[r+a]=s[4],t[r+a+1]=s[5],a+=e;const o=r/e;i[n++]=o,i[n++]=o+1,i[n++]=o+2,i[n++]=o+1,i[n++]=o+3,i[n++]=o+2}},yd={extension:{type:tt.ShapeBuilder,name:"triangle"},build(s,t){return t[0]=s.x,t[1]=s.y,t[2]=s.x2,t[3]=s.y2,t[4]=s.x3,t[5]=s.y3,!0},triangulate(s,t,e,r,i,n){let a=0;r*=e,t[r+a]=s[0],t[r+a+1]=s[1],a+=e,t[r+a]=s[2],t[r+a+1]=s[3],a+=e,t[r+a]=s[4],t[r+a+1]=s[5];const o=r/e;i[n++]=o,i[n++]=o+1,i[n++]=o+2}},Ga=[{offset:0,color:"white"},{offset:1,color:"black"}],fn=class Gi{constructor(...t){this.uid=ct("fillGradient"),this._tick=0,this.type="linear",this.colorStops=[];let e=_d(t);e={...e.type==="radial"?Gi.defaultRadialOptions:Gi.defaultLinearOptions,...No(e)},this._textureSize=e.textureSize,this._wrapMode=e.wrapMode,e.type==="radial"?(this.center=e.center,this.outerCenter=e.outerCenter??this.center,this.innerRadius=e.innerRadius,this.outerRadius=e.outerRadius,this.scale=e.scale,this.rotation=e.rotation):(this.start=e.start,this.end=e.end),this.textureSpace=e.textureSpace,this.type=e.type,e.colorStops.forEach(i=>{this.addColorStop(i.offset,i.color)})}addColorStop(t,e){return this.colorStops.push({offset:t,color:ue.shared.setValue(e).toHexa()}),this}buildLinearGradient(){if(this.texture)return;let{x:t,y:e}=this.start,{x:r,y:i}=this.end,n=r-t,a=i-e;const o=n<0||a<0;if(this._wrapMode==="clamp-to-edge"){if(n<0){const m=t;t=r,r=m,n*=-1}if(a<0){const m=e;e=i,i=m,a*=-1}}const l=this.colorStops.length?this.colorStops:Ga,h=this._textureSize,{canvas:c,context:u}=$a(h,1),f=o?u.createLinearGradient(this._textureSize,0,0,0):u.createLinearGradient(0,0,this._textureSize,0);za(f,l),u.fillStyle=f,u.fillRect(0,0,h,1),this.texture=new J({source:new yr({resource:c,addressMode:this._wrapMode})});const d=Math.sqrt(n*n+a*a),p=Math.atan2(a,n),g=new H;g.scale(d/h,1),g.rotate(p),g.translate(t,e),this.textureSpace==="local"&&g.scale(h,h),this.transform=g}buildGradient(){this.texture||this._tick++,this.type==="linear"?this.buildLinearGradient():this.buildRadialGradient()}buildRadialGradient(){if(this.texture)return;const t=this.colorStops.length?this.colorStops:Ga,e=this._textureSize,{canvas:r,context:i}=$a(e,e),{x:n,y:a}=this.center,{x:o,y:l}=this.outerCenter,h=this.innerRadius,c=this.outerRadius,u=o-c,f=l-c,d=e/(c*2),p=(n-u)*d,g=(a-f)*d,m=i.createRadialGradient(p,g,h*d,(o-u)*d,(l-f)*d,c*d);za(m,t),i.fillStyle=t[t.length-1].color,i.fillRect(0,0,e,e),i.fillStyle=m,i.translate(p,g),i.rotate(this.rotation),i.scale(1,this.scale),i.translate(-p,-g),i.fillRect(0,0,e,e),this.texture=new J({source:new yr({resource:r,addressMode:this._wrapMode})});const y=new H;y.scale(1/d,1/d),y.translate(u,f),this.textureSpace==="local"&&y.scale(e,e),this.transform=y}destroy(){var t;(t=this.texture)==null||t.destroy(!0),this.texture=null,this.transform=null,this.colorStops=[],this.start=null,this.end=null,this.center=null,this.outerCenter=null}get styleKey(){return`fill-gradient-${this.uid}-${this._tick}`}};fn.defaultLinearOptions={start:{x:0,y:0},end:{x:0,y:1},colorStops:[],textureSpace:"local",type:"linear",textureSize:256,wrapMode:"clamp-to-edge"};fn.defaultRadialOptions={center:{x:.5,y:.5},innerRadius:0,outerRadius:.5,colorStops:[],scale:1,textureSpace:"local",type:"radial",textureSize:256,wrapMode:"clamp-to-edge"};let Vs=fn;function za(s,t){for(let e=0;e<t.length;e++){const r=t[e];s.addColorStop(r.offset,r.color)}}function $a(s,t){const e=js.get().createCanvas(s,t),r=e.getContext("2d");return{canvas:e,context:r}}function _d(s){let t=s[0]??{};return(typeof t=="number"||s[1])&&(st("8.5.2","use options object instead"),t={type:"linear",start:{x:s[0],y:s[1]},end:{x:s[2],y:s[3]},textureSpace:s[4],textureSize:s[5]??Vs.defaultLinearOptions.textureSize}),t}const bd=new H,wd=new ft;function kd(s,t,e,r){const i=t.matrix?s.copyFrom(t.matrix).invert():s.identity();if(t.textureSpace==="local"){const a=e.getBounds(wd);t.width&&a.pad(t.width);const{x:o,y:l}=a,h=1/a.width,c=1/a.height,u=-o*h,f=-l*c,d=i.a,p=i.b,g=i.c,m=i.d;i.a*=h,i.b*=h,i.c*=c,i.d*=c,i.tx=u*d+f*g+i.tx,i.ty=u*p+f*m+i.ty}else i.translate(t.texture.frame.x,t.texture.frame.y),i.scale(1/t.texture.source.width,1/t.texture.source.height);const n=t.texture.source.style;return!(t.fill instanceof Vs)&&n.addressMode==="clamp-to-edge"&&(n.addressMode="repeat",n.update()),r&&i.append(bd.copyFrom(r).invert()),i}const Dr={};Ot.handleByMap(tt.ShapeBuilder,Dr);Ot.add(xd,gd,yd,Gs,cd,ud);const vd=new ft,Sd=new H;function Ad(s,t){const{geometryData:e,batches:r}=t;r.length=0,e.indices.length=0,e.vertices.length=0,e.uvs.length=0;for(let i=0;i<s.instructions.length;i++){const n=s.instructions[i];if(n.action==="texture")Td(n.data,r,e);else if(n.action==="fill"||n.action==="stroke"){const a=n.action==="stroke",o=n.data.path.shapePath,l=n.data.style,h=n.data.hole;a&&h&&Ua(h.shapePath,l,!0,r,e),h&&(o.shapePrimitives[o.shapePrimitives.length-1].holes=h.shapePath.shapePrimitives),Ua(o,l,a,r,e)}}}function Td(s,t,e){const r=[],i=Dr.rectangle,n=vd;n.x=s.dx,n.y=s.dy,n.width=s.dw,n.height=s.dh;const a=s.transform;if(!i.build(n,r))return;const{vertices:o,uvs:l,indices:h}=e,c=h.length,u=o.length/2;a&&Ol(r,a),i.triangulate(r,o,2,u,h,c);const f=s.image,d=f.uvs;l.push(d.x0,d.y0,d.x1,d.y1,d.x3,d.y3,d.x2,d.y2);const p=Et.get(dn);p.indexOffset=c,p.indexSize=h.length-c,p.attributeOffset=u,p.attributeSize=o.length/2-u,p.baseColor=s.style,p.alpha=s.alpha,p.texture=f,p.geometryData=e,t.push(p)}function Ua(s,t,e,r,i){const{vertices:n,uvs:a,indices:o}=i;s.shapePrimitives.forEach(({shape:l,transform:h,holes:c})=>{const u=[],f=Dr[l.type];if(!f.build(l,u))return;const d=o.length,p=n.length/2;let g="triangle-list";if(h&&Ol(u,h),e){const _=l.closePath??!0,w=t;w.pixelLine?(pd(u,_,n,o),g="line-list"):fd(u,w,!1,_,n,o)}else if(c){const _=[],w=u.slice();Cd(c).forEach(k=>{_.push(w.length/2),w.push(...k)}),Bl(w,_,n,2,p,o,d)}else f.triangulate(u,n,2,p,o,d);const m=a.length/2,y=t.texture;if(y!==J.WHITE){const _=kd(Sd,t,l,h);od(n,2,p,a,m,2,n.length/2-p,_)}else ld(a,m,2,n.length/2-p);const b=Et.get(dn);b.indexOffset=d,b.indexSize=o.length-d,b.attributeOffset=p,b.attributeSize=n.length/2-p,b.baseColor=t.color,b.alpha=t.alpha,b.texture=y,b.geometryData=i,b.topology=g,r.push(b)})}function Cd(s){const t=[];for(let e=0;e<s.length;e++){const r=s[e].shape,i=[];Dr[r.type].build(r,i)&&t.push(i)}return t}class Md{constructor(){this.batches=[],this.geometryData={vertices:[],uvs:[],indices:[]}}reset(){this.batches&&this.batches.forEach(t=>{Et.return(t)}),this.graphicsData&&Et.return(this.graphicsData),this.isBatchable=!1,this.context=null,this.batches.length=0,this.geometryData.indices.length=0,this.geometryData.vertices.length=0,this.geometryData.uvs.length=0,this.graphicsData=null}destroy(){this.reset(),this.batches=null,this.geometryData=null}}class Pd{constructor(){this.instructions=new an}init(t){const e=t.maxTextures;this.batcher?this.batcher._updateMaxTextures(e):this.batcher=new ad({maxTextures:e}),this.instructions.reset()}get geometry(){return st(Dh,"GraphicsContextRenderData#geometry is deprecated, please use batcher.geometry instead."),this.batcher.geometry}destroy(){this.batcher.destroy(),this.instructions.destroy(),this.batcher=null,this.instructions=null}}const pn=class zi{constructor(t){this._renderer=t,this._managedContexts=new Ir({renderer:t,type:"resource",name:"graphicsContext"})}init(t){zi.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??zi.defaultOptions.bezierSmoothness}getContextRenderData(t){return t._gpuData[this._renderer.uid].graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=!!t._gpuData[this._renderer.uid],r=t._gpuData[this._renderer.uid]||this._initContext(t);if(t.dirty||!e){e&&r.reset(),Ad(t,r);const i=t.batchMode;t.customShader||i==="no-batch"?r.isBatchable=!1:i==="auto"?r.isBatchable=r.geometryData.vertices.length<400:r.isBatchable=!0,t.dirty=!1}return r}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=Et.get(Pd,{maxTextures:this._renderer.limits.maxBatchableTextures}),r=t._gpuData[this._renderer.uid],{batches:i,geometryData:n}=r;r.graphicsData=e;const a=n.vertices.length,o=n.indices.length;for(let u=0;u<i.length;u++)i[u].applyTransform=!1;const l=e.batcher;l.ensureAttributeBuffer(a),l.ensureIndexBuffer(o),l.begin();for(let u=0;u<i.length;u++){const f=i[u];l.add(f)}l.finish(e.instructions);const h=l.geometry;h.indexBuffer.setDataWithSize(l.indexBuffer,l.indexSize,!0),h.buffers[0].setDataWithSize(l.attributeBuffer.float32View,l.attributeSize,!0);const c=l.batches;for(let u=0;u<c.length;u++){const f=c[u];f.bindGroup=yu(f.textures.textures,f.textures.count,this._renderer.limits.maxBatchableTextures)}return e}_initContext(t){const e=new Md;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};pn.extension={type:[tt.WebGLSystem,tt.WebGPUSystem],name:"graphicsContext"};pn.defaultOptions={bezierSmoothness:.5};let mn=pn;const Ed=8,hr=11920929e-14,Rd=1;function Fl(s,t,e,r,i,n,a,o,l,h){const u=Math.min(.99,Math.max(0,h??mn.defaultOptions.bezierSmoothness));let f=(Rd-u)/1;return f*=f,Id(t,e,r,i,n,a,o,l,s,f),s}function Id(s,t,e,r,i,n,a,o,l,h){$i(s,t,e,r,i,n,a,o,l,h,0),l.push(a,o)}function $i(s,t,e,r,i,n,a,o,l,h,c){if(c>Ed)return;const u=(s+e)/2,f=(t+r)/2,d=(e+i)/2,p=(r+n)/2,g=(i+a)/2,m=(n+o)/2,y=(u+d)/2,b=(f+p)/2,_=(d+g)/2,w=(p+m)/2,T=(y+_)/2,k=(b+w)/2;if(c>0){let v=a-s,F=o-t;const G=Math.abs((e-a)*F-(r-o)*v),M=Math.abs((i-a)*F-(n-o)*v);if(G>hr&&M>hr){if((G+M)*(G+M)<=h*(v*v+F*F)){l.push(T,k);return}}else if(G>hr){if(G*G<=h*(v*v+F*F)){l.push(T,k);return}}else if(M>hr){if(M*M<=h*(v*v+F*F)){l.push(T,k);return}}else if(v=T-(s+a)/2,F=k-(t+o)/2,v*v+F*F<=h){l.push(T,k);return}}$i(s,t,u,f,y,b,T,k,l,h,c+1),$i(T,k,_,w,g,m,a,o,l,h,c+1)}const Dd=8,Ld=11920929e-14,Od=1;function Nd(s,t,e,r,i,n,a,o){const h=Math.min(.99,Math.max(0,o??mn.defaultOptions.bezierSmoothness));let c=(Od-h)/1;return c*=c,Bd(t,e,r,i,n,a,s,c),s}function Bd(s,t,e,r,i,n,a,o){Ui(a,s,t,e,r,i,n,o,0),a.push(i,n)}function Ui(s,t,e,r,i,n,a,o,l){if(l>Dd)return;const h=(t+r)/2,c=(e+i)/2,u=(r+n)/2,f=(i+a)/2,d=(h+u)/2,p=(c+f)/2;let g=n-t,m=a-e;const y=Math.abs((r-n)*m-(i-a)*g);if(y>Ld){if(y*y<=o*(g*g+m*m)){s.push(d,p);return}}else if(g=d-(t+n)/2,m=p-(e+a)/2,g*g+m*m<=o){s.push(d,p);return}Ui(s,t,e,h,c,d,p,o,l+1),Ui(s,d,p,u,f,n,a,o,l+1)}function Gl(s,t,e,r,i,n,a,o){let l=Math.abs(i-n);(!a&&i>n||a&&n>i)&&(l=2*Math.PI-l),o||(o=Math.max(6,Math.floor(6*Math.pow(r,1/3)*(l/Math.PI)))),o=Math.max(o,3);let h=l/o,c=i;h*=a?-1:1;for(let u=0;u<o+1;u++){const f=Math.cos(c),d=Math.sin(c),p=t+f*r,g=e+d*r;s.push(p,g),c+=h}}function Fd(s,t,e,r,i,n){const a=s[s.length-2],l=s[s.length-1]-e,h=a-t,c=i-e,u=r-t,f=Math.abs(l*u-h*c);if(f<1e-8||n===0){(s[s.length-2]!==t||s[s.length-1]!==e)&&s.push(t,e);return}const d=l*l+h*h,p=c*c+u*u,g=l*c+h*u,m=n*Math.sqrt(d)/f,y=n*Math.sqrt(p)/f,b=m*g/d,_=y*g/p,w=m*u+y*h,T=m*c+y*l,k=h*(y+b),v=l*(y+b),F=u*(m+_),G=c*(m+_),M=Math.atan2(v-T,k-w),C=Math.atan2(G-T,F-w);Gl(s,w+t,T+e,n,M,C,h*c>u*l)}const Rs=Math.PI*2,gi={centerX:0,centerY:0,ang1:0,ang2:0},xi=({x:s,y:t},e,r,i,n,a,o,l)=>{s*=e,t*=r;const h=i*s-n*t,c=n*s+i*t;return l.x=h+a,l.y=c+o,l};function Gd(s,t){const e=t===-1.5707963267948966?-.551915024494:1.3333333333333333*Math.tan(t/4),r=t===1.5707963267948966?.551915024494:e,i=Math.cos(s),n=Math.sin(s),a=Math.cos(s+t),o=Math.sin(s+t);return[{x:i-n*r,y:n+i*r},{x:a+o*r,y:o-a*r},{x:a,y:o}]}const Ha=(s,t,e,r)=>{const i=s*r-t*e<0?-1:1;let n=s*e+t*r;return n>1&&(n=1),n<-1&&(n=-1),i*Math.acos(n)},zd=(s,t,e,r,i,n,a,o,l,h,c,u,f)=>{const d=Math.pow(i,2),p=Math.pow(n,2),g=Math.pow(c,2),m=Math.pow(u,2);let y=d*p-d*m-p*g;y<0&&(y=0),y/=d*m+p*g,y=Math.sqrt(y)*(a===o?-1:1);const b=y*i/n*u,_=y*-n/i*c,w=h*b-l*_+(s+e)/2,T=l*b+h*_+(t+r)/2,k=(c-b)/i,v=(u-_)/n,F=(-c-b)/i,G=(-u-_)/n,M=Ha(1,0,k,v);let C=Ha(k,v,F,G);o===0&&C>0&&(C-=Rs),o===1&&C<0&&(C+=Rs),f.centerX=w,f.centerY=T,f.ang1=M,f.ang2=C};function $d(s,t,e,r,i,n,a,o=0,l=0,h=0){if(n===0||a===0)return;const c=Math.sin(o*Rs/360),u=Math.cos(o*Rs/360),f=u*(t-r)/2+c*(e-i)/2,d=-c*(t-r)/2+u*(e-i)/2;if(f===0&&d===0)return;n=Math.abs(n),a=Math.abs(a);const p=Math.pow(f,2)/Math.pow(n,2)+Math.pow(d,2)/Math.pow(a,2);p>1&&(n*=Math.sqrt(p),a*=Math.sqrt(p)),zd(t,e,r,i,n,a,l,h,c,u,f,d,gi);let{ang1:g,ang2:m}=gi;const{centerX:y,centerY:b}=gi;let _=Math.abs(m)/(Rs/4);Math.abs(1-_)<1e-7&&(_=1);const w=Math.max(Math.ceil(_),1);m/=w;let T=s[s.length-2],k=s[s.length-1];const v={x:0,y:0};for(let F=0;F<w;F++){const G=Gd(g,m),{x:M,y:C}=xi(G[0],n,a,u,c,y,b,v),{x:W,y:Z}=xi(G[1],n,a,u,c,y,b,v),{x:Q,y:fe}=xi(G[2],n,a,u,c,y,b,v);Fl(s,T,k,M,C,W,Z,Q,fe),T=Q,k=fe,g+=m}}function Ud(s,t,e){const r=(a,o)=>{const l=o.x-a.x,h=o.y-a.y,c=Math.sqrt(l*l+h*h),u=l/c,f=h/c;return{len:c,nx:u,ny:f}},i=(a,o)=>{a===0?s.moveTo(o.x,o.y):s.lineTo(o.x,o.y)};let n=t[t.length-1];for(let a=0;a<t.length;a++){const o=t[a%t.length],l=o.radius??e;if(l<=0){i(a,o),n=o;continue}const h=t[(a+1)%t.length],c=r(o,n),u=r(o,h);if(c.len<1e-4||u.len<1e-4){i(a,o),n=o;continue}let f=Math.asin(c.nx*u.ny-c.ny*u.nx),d=1,p=!1;c.nx*u.nx-c.ny*-u.ny<0?f<0?f=Math.PI+f:(f=Math.PI-f,d=-1,p=!0):f>0&&(d=-1,p=!0);const g=f/2;let m,y=Math.abs(Math.cos(g)*l/Math.sin(g));y>Math.min(c.len/2,u.len/2)?(y=Math.min(c.len/2,u.len/2),m=Math.abs(y*Math.sin(g)/Math.cos(g))):m=l;const b=o.x+u.nx*y+-u.ny*m*d,_=o.y+u.ny*y+u.nx*m*d,w=Math.atan2(c.ny,c.nx)+Math.PI/2*d,T=Math.atan2(u.ny,u.nx)-Math.PI/2*d;a===0&&s.moveTo(b+Math.cos(w)*m,_+Math.sin(w)*m),s.arc(b,_,m,w,T,p),n=o}}function Hd(s,t,e,r){const i=(o,l)=>Math.sqrt((o.x-l.x)**2+(o.y-l.y)**2),n=(o,l,h)=>({x:o.x+(l.x-o.x)*h,y:o.y+(l.y-o.y)*h}),a=t.length;for(let o=0;o<a;o++){const l=t[(o+1)%a],h=l.radius??e;if(h<=0){o===0?s.moveTo(l.x,l.y):s.lineTo(l.x,l.y);continue}const c=t[o],u=t[(o+2)%a],f=i(c,l);let d;if(f<1e-4)d=l;else{const m=Math.min(f/2,h);d=n(l,c,m/f)}const p=i(u,l);let g;if(p<1e-4)g=l;else{const m=Math.min(p/2,h);g=n(l,u,m/p)}o===0?s.moveTo(d.x,d.y):s.lineTo(d.x,d.y),s.quadraticCurveTo(l.x,l.y,g.x,g.y,r)}}const jd=new ft;class Vd{constructor(t){this.shapePrimitives=[],this._currentPoly=null,this._bounds=new Yt,this._graphicsPath2D=t,this.signed=t.checkForHoles}moveTo(t,e){return this.startPoly(t,e),this}lineTo(t,e){this._ensurePoly();const r=this._currentPoly.points,i=r[r.length-2],n=r[r.length-1];return(i!==t||n!==e)&&r.push(t,e),this}arc(t,e,r,i,n,a){this._ensurePoly(!1);const o=this._currentPoly.points;return Gl(o,t,e,r,i,n,a),this}arcTo(t,e,r,i,n){this._ensurePoly();const a=this._currentPoly.points;return Fd(a,t,e,r,i,n),this}arcToSvg(t,e,r,i,n,a,o){const l=this._currentPoly.points;return $d(l,this._currentPoly.lastX,this._currentPoly.lastY,a,o,t,e,r,i,n),this}bezierCurveTo(t,e,r,i,n,a,o){this._ensurePoly();const l=this._currentPoly;return Fl(this._currentPoly.points,l.lastX,l.lastY,t,e,r,i,n,a,o),this}quadraticCurveTo(t,e,r,i,n){this._ensurePoly();const a=this._currentPoly;return Nd(this._currentPoly.points,a.lastX,a.lastY,t,e,r,i,n),this}closePath(){return this.endPoly(!0),this}addPath(t,e){this.endPoly(),e&&!e.isIdentity()&&(t=t.clone(!0),t.transform(e));const r=this.shapePrimitives,i=r.length;for(let n=0;n<t.instructions.length;n++){const a=t.instructions[n];this[a.action](...a.data)}if(t.checkForHoles&&r.length-i>1){let n=null;for(let a=i;a<r.length;a++){const o=r[a];if(o.shape.type==="polygon"){const l=o.shape,h=n==null?void 0:n.shape;h&&h.containsPolygon(l)?(n.holes||(n.holes=[]),n.holes.push(o),r.copyWithin(a,a+1),r.length--,a--):n=o}}}return this}finish(t=!1){this.endPoly(t)}rect(t,e,r,i,n){return this.drawShape(new ft(t,e,r,i),n),this}circle(t,e,r,i){return this.drawShape(new hn(t,e,r),i),this}poly(t,e,r){const i=new Ps(t);return i.closePath=e,this.drawShape(i,r),this}regularPoly(t,e,r,i,n=0,a){i=Math.max(i|0,3);const o=-1*Math.PI/2+n,l=Math.PI*2/i,h=[];for(let c=0;c<i;c++){const u=o-c*l;h.push(t+r*Math.cos(u),e+r*Math.sin(u))}return this.poly(h,!0,a),this}roundPoly(t,e,r,i,n,a=0,o){if(i=Math.max(i|0,3),n<=0)return this.regularPoly(t,e,r,i,a);const l=r*Math.sin(Math.PI/i)-.001;n=Math.min(n,l);const h=-1*Math.PI/2+a,c=Math.PI*2/i,u=(i-2)*Math.PI/i/2;for(let f=0;f<i;f++){const d=f*c+h,p=t+r*Math.cos(d),g=e+r*Math.sin(d),m=d+Math.PI+u,y=d-Math.PI-u,b=p+n*Math.cos(m),_=g+n*Math.sin(m),w=p+n*Math.cos(y),T=g+n*Math.sin(y);f===0?this.moveTo(b,_):this.lineTo(b,_),this.quadraticCurveTo(p,g,w,T,o)}return this.closePath()}roundShape(t,e,r=!1,i){return t.length<3?this:(r?Hd(this,t,e,i):Ud(this,t,e),this.closePath())}filletRect(t,e,r,i,n){if(n===0)return this.rect(t,e,r,i);const a=Math.min(r,i)/2,o=Math.min(a,Math.max(-a,n)),l=t+r,h=e+i,c=o<0?-o:0,u=Math.abs(o);return this.moveTo(t,e+u).arcTo(t+c,e+c,t+u,e,u).lineTo(l-u,e).arcTo(l-c,e+c,l,e+u,u).lineTo(l,h-u).arcTo(l-c,h-c,t+r-u,h,u).lineTo(t+u,h).arcTo(t+c,h-c,t,h-u,u).closePath()}chamferRect(t,e,r,i,n,a){if(n<=0)return this.rect(t,e,r,i);const o=Math.min(n,Math.min(r,i)/2),l=t+r,h=e+i,c=[t+o,e,l-o,e,l,e+o,l,h-o,l-o,h,t+o,h,t,h-o,t,e+o];for(let u=c.length-1;u>=2;u-=2)c[u]===c[u-2]&&c[u-1]===c[u-3]&&c.splice(u-1,2);return this.poly(c,!0,a)}ellipse(t,e,r,i,n){return this.drawShape(new cn(t,e,r,i),n),this}roundRect(t,e,r,i,n,a){return this.drawShape(new un(t,e,r,i,n),a),this}drawShape(t,e){return this.endPoly(),this.shapePrimitives.push({shape:t,transform:e}),this}startPoly(t,e){let r=this._currentPoly;return r&&this.endPoly(),r=new Ps,r.points.push(t,e),this._currentPoly=r,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 Ps,t)){const e=this.shapePrimitives[this.shapePrimitives.length-1];if(e){let r=e.shape.x,i=e.shape.y;if(e.transform&&!e.transform.isIdentity()){const n=e.transform,a=r;r=n.a*r+n.c*i+n.tx,i=n.b*a+n.d*i+n.ty}this._currentPoly.points.push(r,i)}else this._currentPoly.points.push(0,0)}}buildPath(){const t=this._graphicsPath2D;this.shapePrimitives.length=0,this._currentPoly=null;for(let e=0;e<t.instructions.length;e++){const r=t.instructions[e];this[r.action](...r.data)}this.finish()}get bounds(){const t=this._bounds;t.clear();const e=this.shapePrimitives;for(let r=0;r<e.length;r++){const i=e[r],n=i.shape.getBounds(jd);i.transform?t.addRect(n,i.transform):t.addRect(n)}return t}}class ce{constructor(t,e=!1){this.instructions=[],this.uid=ct("graphicsPath"),this._dirty=!0,this.checkForHoles=e,typeof t=="string"?pu(t,this):this.instructions=(t==null?void 0:t.slice())??[]}get shapePath(){return this._shapePath||(this._shapePath=new Vd(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,r,i,n){const a=this.instructions[this.instructions.length-1],o=this.getLastPoint(yt.shared);let l=0,h=0;if(!a||a.action!=="bezierCurveTo")l=o.x,h=o.y;else{l=a.data[2],h=a.data[3];const c=o.x,u=o.y;l=c+(c-l),h=u+(u-h)}return this.instructions.push({action:"bezierCurveTo",data:[l,h,t,e,r,i,n]}),this._dirty=!0,this}closePath(){return this.instructions.push({action:"closePath",data:[]}),this._dirty=!0,this}ellipse(...t){return this.instructions.push({action:"ellipse",data:t}),this._dirty=!0,this}lineTo(...t){return this.instructions.push({action:"lineTo",data:t}),this._dirty=!0,this}moveTo(...t){return this.instructions.push({action:"moveTo",data:t}),this}quadraticCurveTo(...t){return this.instructions.push({action:"quadraticCurveTo",data:t}),this._dirty=!0,this}quadraticCurveToShort(t,e,r){const i=this.instructions[this.instructions.length-1],n=this.getLastPoint(yt.shared);let a=0,o=0;if(!i||i.action!=="quadraticCurveTo")a=n.x,o=n.y;else{a=i.data[0],o=i.data[1];const l=n.x,h=n.y;a=l+(l-a),o=h+(h-o)}return this.instructions.push({action:"quadraticCurveTo",data:[a,o,t,e,r]}),this._dirty=!0,this}rect(t,e,r,i,n){return this.instructions.push({action:"rect",data:[t,e,r,i,n]}),this._dirty=!0,this}circle(t,e,r,i){return this.instructions.push({action:"circle",data:[t,e,r,i]}),this._dirty=!0,this}roundRect(...t){return this.instructions.push({action:"roundRect",data:t}),this._dirty=!0,this}poly(...t){return this.instructions.push({action:"poly",data:t}),this._dirty=!0,this}regularPoly(...t){return this.instructions.push({action:"regularPoly",data:t}),this._dirty=!0,this}roundPoly(...t){return this.instructions.push({action:"roundPoly",data:t}),this._dirty=!0,this}roundShape(...t){return this.instructions.push({action:"roundShape",data:t}),this._dirty=!0,this}filletRect(...t){return this.instructions.push({action:"filletRect",data:t}),this._dirty=!0,this}chamferRect(...t){return this.instructions.push({action:"chamferRect",data:t}),this._dirty=!0,this}star(t,e,r,i,n,a,o){n||(n=i/2);const l=-1*Math.PI/2+a,h=r*2,c=Math.PI*2/h,u=[];for(let f=0;f<h;f++){const d=f%2?n:i,p=f*c+l;u.push(t+d*Math.cos(p),e+d*Math.sin(p))}return this.poly(u,!0,o),this}clone(t=!1){const e=new ce;if(e.checkForHoles=this.checkForHoles,!t)e.instructions=this.instructions.slice();else for(let r=0;r<this.instructions.length;r++){const i=this.instructions[r];e.instructions.push({action:i.action,data:i.data.slice()})}return e}clear(){return this.instructions.length=0,this._dirty=!0,this}transform(t){if(t.isIdentity())return this;const e=t.a,r=t.b,i=t.c,n=t.d,a=t.tx,o=t.ty;let l=0,h=0,c=0,u=0,f=0,d=0,p=0,g=0;for(let m=0;m<this.instructions.length;m++){const y=this.instructions[m],b=y.data;switch(y.action){case"moveTo":case"lineTo":l=b[0],h=b[1],b[0]=e*l+i*h+a,b[1]=r*l+n*h+o;break;case"bezierCurveTo":c=b[0],u=b[1],f=b[2],d=b[3],l=b[4],h=b[5],b[0]=e*c+i*u+a,b[1]=r*c+n*u+o,b[2]=e*f+i*d+a,b[3]=r*f+n*d+o,b[4]=e*l+i*h+a,b[5]=r*l+n*h+o;break;case"quadraticCurveTo":c=b[0],u=b[1],l=b[2],h=b[3],b[0]=e*c+i*u+a,b[1]=r*c+n*u+o,b[2]=e*l+i*h+a,b[3]=r*l+n*h+o;break;case"arcToSvg":l=b[5],h=b[6],p=b[0],g=b[1],b[0]=e*p+i*g,b[1]=r*p+n*g,b[5]=e*l+i*h+a,b[6]=r*l+n*h+o;break;case"circle":b[4]=fs(b[3],t);break;case"rect":b[4]=fs(b[4],t);break;case"ellipse":b[8]=fs(b[8],t);break;case"roundRect":b[5]=fs(b[5],t);break;case"addPath":b[0].transform(t);break;case"poly":b[2]=fs(b[2],t);break;default:Lt("unknown transform action",y.action);break}}return this._dirty=!0,this}get bounds(){return this.shapePath.bounds}getLastPoint(t){let e=this.instructions.length-1,r=this.instructions[e];if(!r)return t.x=0,t.y=0,t;for(;r.action==="closePath";){if(e--,e<0)return t.x=0,t.y=0,t;r=this.instructions[e]}switch(r.action){case"moveTo":case"lineTo":t.x=r.data[0],t.y=r.data[1];break;case"quadraticCurveTo":t.x=r.data[2],t.y=r.data[3];break;case"bezierCurveTo":t.x=r.data[4],t.y=r.data[5];break;case"arc":case"arcToSvg":t.x=r.data[5],t.y=r.data[6];break;case"addPath":r.data[0].getLastPoint(t);break}return t}}function fs(s,t){return s?s.prepend(t):t.clone()}function ot(s,t,e){const r=s.getAttribute(t);return r?Number(r):e}function Yd(s,t){const e=s.querySelectorAll("defs");for(let r=0;r<e.length;r++){const i=e[r];for(let n=0;n<i.children.length;n++){const a=i.children[n];switch(a.nodeName.toLowerCase()){case"lineargradient":t.defs[a.id]=Wd(a);break;case"radialgradient":t.defs[a.id]=Xd();break}}}}function Wd(s){const t=ot(s,"x1",0),e=ot(s,"y1",0),r=ot(s,"x2",1),i=ot(s,"y2",0),n=s.getAttribute("gradientUnits")||"objectBoundingBox",a=new Vs(t,e,r,i,n==="objectBoundingBox"?"local":"global");for(let o=0;o<s.children.length;o++){const l=s.children[o],h=ot(l,"offset",0),c=ue.shared.setValue(l.getAttribute("stop-color")).toNumber();a.addColorStop(h,c)}return a}function Xd(s){return Lt("[SVG Parser] Radial gradients are not yet supported"),new Vs(0,0,1,0)}function ja(s){const t=s.match(/url\s*\(\s*['"]?\s*#([^'"\s)]+)\s*['"]?\s*\)/i);return t?t[1]:""}const Va={fill:{type:"paint",default:0},"fill-opacity":{type:"number",default:1},stroke:{type:"paint",default:0},"stroke-width":{type:"number",default:1},"stroke-opacity":{type:"number",default:1},"stroke-linecap":{type:"string",default:"butt"},"stroke-linejoin":{type:"string",default:"miter"},"stroke-miterlimit":{type:"number",default:10},"stroke-dasharray":{type:"string",default:"none"},"stroke-dashoffset":{type:"number",default:0},opacity:{type:"number",default:1}};function zl(s,t){const e=s.getAttribute("style"),r={},i={},n={strokeStyle:r,fillStyle:i,useFill:!1,useStroke:!1};for(const a in Va){const o=s.getAttribute(a);o&&Ya(t,n,a,o.trim())}if(e){const a=e.split(";");for(let o=0;o<a.length;o++){const l=a[o].trim(),[h,c]=l.split(":");Va[h]&&Ya(t,n,h,c.trim())}}return{strokeStyle:n.useStroke?r:null,fillStyle:n.useFill?i:null,useFill:n.useFill,useStroke:n.useStroke}}function Ya(s,t,e,r){switch(e){case"stroke":if(r!=="none"){if(r.startsWith("url(")){const i=ja(r);t.strokeStyle.fill=s.defs[i]}else t.strokeStyle.color=ue.shared.setValue(r).toNumber();t.useStroke=!0}break;case"stroke-width":t.strokeStyle.width=Number(r);break;case"fill":if(r!=="none"){if(r.startsWith("url(")){const i=ja(r);t.fillStyle.fill=s.defs[i]}else t.fillStyle.color=ue.shared.setValue(r).toNumber();t.useFill=!0}break;case"fill-opacity":t.fillStyle.alpha=Number(r);break;case"stroke-opacity":t.strokeStyle.alpha=Number(r);break;case"opacity":t.fillStyle.alpha=Number(r),t.strokeStyle.alpha=Number(r);break}}function qd(s){if(s.length<=2)return!0;const t=s.map(o=>o.area).sort((o,l)=>l-o),[e,r]=t,i=t[t.length-1],n=e/r,a=r/i;return!(n>3&&a<2)}function Zd(s){return s.split(/(?=[Mm])/).filter(r=>r.trim().length>0)}function Qd(s){const t=s.match(/[-+]?[0-9]*\.?[0-9]+/g);if(!t||t.length<4)return 0;const e=t.map(Number),r=[],i=[];for(let c=0;c<e.length;c+=2)c+1<e.length&&(r.push(e[c]),i.push(e[c+1]));if(r.length===0||i.length===0)return 0;const n=Math.min(...r),a=Math.max(...r),o=Math.min(...i),l=Math.max(...i);return(a-n)*(l-o)}function Wa(s,t){const e=new ce(s,!1);for(const r of e.instructions)t.instructions.push(r)}function Kd(s,t){if(typeof s=="string"){const a=document.createElement("div");a.innerHTML=s.trim(),s=a.querySelector("svg")}const e={context:t,defs:{},path:new ce};Yd(s,e);const r=s.children,{fillStyle:i,strokeStyle:n}=zl(s,e);for(let a=0;a<r.length;a++){const o=r[a];o.nodeName.toLowerCase()!=="defs"&&$l(o,e,i,n)}return t}function $l(s,t,e,r){const i=s.children,{fillStyle:n,strokeStyle:a}=zl(s,t);n&&e?e={...e,...n}:n&&(e=n),a&&r?r={...r,...a}:a&&(r=a);const o=!e&&!r;o&&(e={color:0});let l,h,c,u,f,d,p,g,m,y,b,_,w,T,k,v,F;switch(s.nodeName.toLowerCase()){case"path":{T=s.getAttribute("d");const G=s.getAttribute("fill-rule"),M=Zd(T),C=G==="evenodd",W=M.length>1;if(C&&W){const Q=M.map(R=>({path:R,area:Qd(R)}));if(Q.sort((R,O)=>O.area-R.area),M.length>3||!qd(Q))for(let R=0;R<Q.length;R++){const O=Q[R],pe=R===0;t.context.beginPath();const V=new ce(void 0,!0);Wa(O.path,V),t.context.path(V),pe?(e&&t.context.fill(e),r&&t.context.stroke(r)):t.context.cut()}else for(let R=0;R<Q.length;R++){const O=Q[R],pe=R%2===1;t.context.beginPath();const V=new ce(void 0,!0);Wa(O.path,V),t.context.path(V),pe?t.context.cut():(e&&t.context.fill(e),r&&t.context.stroke(r))}}else{const Q=G?G==="evenodd":!0;k=new ce(T,Q),t.context.path(k),e&&t.context.fill(e),r&&t.context.stroke(r)}break}case"circle":p=ot(s,"cx",0),g=ot(s,"cy",0),m=ot(s,"r",0),t.context.ellipse(p,g,m,m),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"rect":l=ot(s,"x",0),h=ot(s,"y",0),v=ot(s,"width",0),F=ot(s,"height",0),y=ot(s,"rx",0),b=ot(s,"ry",0),y||b?t.context.roundRect(l,h,v,F,y||b):t.context.rect(l,h,v,F),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"ellipse":p=ot(s,"cx",0),g=ot(s,"cy",0),y=ot(s,"rx",0),b=ot(s,"ry",0),t.context.beginPath(),t.context.ellipse(p,g,y,b),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"line":c=ot(s,"x1",0),u=ot(s,"y1",0),f=ot(s,"x2",0),d=ot(s,"y2",0),t.context.beginPath(),t.context.moveTo(c,u),t.context.lineTo(f,d),r&&t.context.stroke(r);break;case"polygon":w=s.getAttribute("points"),_=w.match(/-?\d+/g).map(G=>parseInt(G,10)),t.context.poly(_,!0),e&&t.context.fill(e),r&&t.context.stroke(r);break;case"polyline":w=s.getAttribute("points"),_=w.match(/-?\d+/g).map(G=>parseInt(G,10)),t.context.poly(_,!1),r&&t.context.stroke(r);break;case"g":case"svg":break;default:{Lt(`[SVG parser] <${s.nodeName}> elements unsupported`);break}}o&&(e=null);for(let G=0;G<i.length;G++)$l(i[G],t,e,r)}const Xa={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 Jd{constructor(t,e){this.uid=ct("fillPattern"),this._tick=0,this.transform=new H,this.texture=t,this.transform.scale(1/t.frame.width,1/t.frame.height),e&&(t.source.style.addressModeU=Xa[e].addressModeU,t.source.style.addressModeV=Xa[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._tick++}get texture(){return this._texture}set texture(t){this._texture!==t&&(this._texture=t,this._tick++)}get styleKey(){return`fill-pattern-${this.uid}-${this._tick}`}destroy(){this.texture.destroy(!0),this.texture=null}}function tf(s){return ue.isColorLike(s)}function qa(s){return s instanceof Jd}function Za(s){return s instanceof Vs}function ef(s){return s instanceof J}function sf(s,t,e){const r=ue.shared.setValue(t??0);return s.color=r.toNumber(),s.alpha=r.alpha===1?e.alpha:r.alpha,s.texture=J.WHITE,{...e,...s}}function rf(s,t,e){return s.texture=t,{...e,...s}}function Qa(s,t,e){return s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,{...e,...s}}function Ka(s,t,e){return t.buildGradient(),s.fill=t,s.color=16777215,s.texture=t.texture,s.matrix=t.transform,s.textureSpace=t.textureSpace,{...e,...s}}function nf(s,t){const e={...t,...s},r=ue.shared.setValue(e.color);return e.alpha*=r.alpha,e.color=r.toNumber(),e}function As(s,t){if(s==null)return null;const e={},r=s;return tf(s)?sf(e,s,t):ef(s)?rf(e,s,t):qa(s)?Qa(e,s,t):Za(s)?Ka(e,s,t):r.fill&&qa(r.fill)?Qa(r,r.fill,t):r.fill&&Za(r.fill)?Ka(r,r.fill,t):nf(r,t)}function Ja(s,t){const{width:e,alignment:r,miterLimit:i,cap:n,join:a,pixelLine:o,...l}=t,h=As(s,l);return h?{width:e,alignment:r,miterLimit:i,cap:n,join:a,pixelLine:o,...h}:null}function af(s,t){let e=1;const r=s.shapePath.shapePrimitives;for(let i=0;i<r.length;i++){const n=r[i].shape;if(n.type!=="polygon")continue;const a=n.points,o=a.length;if(o<6)continue;const l=n.closePath;for(let h=0;h<o;h+=2){if(!l&&(h===0||h===o-2))continue;const c=(h-2+o)%o,u=(h+2)%o,f=a[c],d=a[c+1],p=a[h],g=a[h+1],m=a[u],y=a[u+1],b=f-p,_=d-g,w=m-p,T=y-g,k=b*b+_*_,v=w*w+T*T;if(k<1e-12||v<1e-12)continue;let M=(b*w+_*T)/Math.sqrt(k*v);M<-1?M=-1:M>1&&(M=1);const C=Math.sqrt((1-M)*.5);if(C<1e-6)continue;const W=Math.min(1/C,t);W>e&&(e=W)}}return e}const of=new yt,to=new H,gn=class Kt extends ke{constructor(){super(...arguments),this._gpuData=Object.create(null),this.autoGarbageCollect=!0,this._gcLastUsed=-1,this.uid=ct("graphicsContext"),this.dirty=!0,this.batchMode="auto",this.instructions=[],this.destroyed=!1,this._activePath=new ce,this._transform=new H,this._fillStyle={...Kt.defaultFillStyle},this._strokeStyle={...Kt.defaultStrokeStyle},this._stateStack=[],this._tick=0,this._bounds=new Yt,this._boundsDirty=!0}clone(){const t=new Kt;return t.batchMode=this.batchMode,t.instructions=this.instructions.slice(),t._activePath=this._activePath.clone(),t._transform=this._transform.clone(),t._fillStyle={...this._fillStyle},t._strokeStyle={...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=As(t,Kt.defaultFillStyle)}get strokeStyle(){return this._strokeStyle}set strokeStyle(t){this._strokeStyle=Ja(t,Kt.defaultStrokeStyle)}setFillStyle(t){return this._fillStyle=As(t,Kt.defaultFillStyle),this}setStrokeStyle(t){return this._strokeStyle=As(t,Kt.defaultStrokeStyle),this}texture(t,e,r,i,n,a){return this.instructions.push({action:"texture",data:{image:t,dx:r||0,dy:i||0,dw:n||t.frame.width,dh:a||t.frame.height,transform:this._transform.clone(),alpha:this._fillStyle.alpha,style:e||e===0?ue.shared.setValue(e).toNumber():16777215}}),this.onUpdate(),this}beginPath(){return this._activePath=new ce,this}fill(t,e){let r;const i=this.instructions[this.instructions.length-1];return this._tick===0&&(i==null?void 0:i.action)==="stroke"?r=i.data.path:r=this._activePath.clone(),r?(t!=null&&(e!==void 0&&typeof t=="number"&&(st(xt,"GraphicsContext.fill(color, alpha) is deprecated, use GraphicsContext.fill({ color, alpha }) instead"),t={color:t,alpha:e}),this._fillStyle=As(t,Kt.defaultFillStyle)),this.instructions.push({action:"fill",data:{style:this.fillStyle,path:r}}),this.onUpdate(),this._initNextPathLocation(),this._tick=0,this):this}_initNextPathLocation(){const{x:t,y:e}=this._activePath.getLastPoint(yt.shared);this._activePath.clear(),this._activePath.moveTo(t,e)}stroke(t){let e;const r=this.instructions[this.instructions.length-1];return this._tick===0&&(r==null?void 0:r.action)==="fill"?e=r.data.path:e=this._activePath.clone(),e?(t!=null&&(this._strokeStyle=Ja(t,Kt.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],r=this._activePath.clone();if(e&&(e.action==="stroke"||e.action==="fill"))if(e.data.hole)e.data.hole.addPath(r);else{e.data.hole=r;break}}return this._initNextPathLocation(),this}arc(t,e,r,i,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,r,i,n,a),this}arcTo(t,e,r,i,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*r+a.c*i+a.tx,a.b*r+a.d*i+a.ty,n),this}arcToSvg(t,e,r,i,n,a,o){this._tick++;const l=this._transform;return this._activePath.arcToSvg(t,e,r,i,n,l.a*a+l.c*o+l.tx,l.b*a+l.d*o+l.ty),this}bezierCurveTo(t,e,r,i,n,a,o){this._tick++;const l=this._transform;return this._activePath.bezierCurveTo(l.a*t+l.c*e+l.tx,l.b*t+l.d*e+l.ty,l.a*r+l.c*i+l.tx,l.b*r+l.d*i+l.ty,l.a*n+l.c*a+l.tx,l.b*n+l.d*a+l.ty,o),this}closePath(){var t;return this._tick++,(t=this._activePath)==null||t.closePath(),this}ellipse(t,e,r,i){return this._tick++,this._activePath.ellipse(t,e,r,i,this._transform.clone()),this}circle(t,e,r){return this._tick++,this._activePath.circle(t,e,r,this._transform.clone()),this}path(t){return this._tick++,this._activePath.addPath(t,this._transform.clone()),this}lineTo(t,e){this._tick++;const r=this._transform;return this._activePath.lineTo(r.a*t+r.c*e+r.tx,r.b*t+r.d*e+r.ty),this}moveTo(t,e){this._tick++;const r=this._transform,i=this._activePath.instructions,n=r.a*t+r.c*e+r.tx,a=r.b*t+r.d*e+r.ty;return i.length===1&&i[0].action==="moveTo"?(i[0].data[0]=n,i[0].data[1]=a,this):(this._activePath.moveTo(n,a),this)}quadraticCurveTo(t,e,r,i,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*r+a.c*i+a.tx,a.b*r+a.d*i+a.ty,n),this}rect(t,e,r,i){return this._tick++,this._activePath.rect(t,e,r,i,this._transform.clone()),this}roundRect(t,e,r,i,n){return this._tick++,this._activePath.roundRect(t,e,r,i,n,this._transform.clone()),this}poly(t,e){return this._tick++,this._activePath.poly(t,e,this._transform.clone()),this}regularPoly(t,e,r,i,n=0,a){return this._tick++,this._activePath.regularPoly(t,e,r,i,n,a),this}roundPoly(t,e,r,i,n,a){return this._tick++,this._activePath.roundPoly(t,e,r,i,n,a),this}roundShape(t,e,r,i){return this._tick++,this._activePath.roundShape(t,e,r,i),this}filletRect(t,e,r,i,n){return this._tick++,this._activePath.filletRect(t,e,r,i,n),this}chamferRect(t,e,r,i,n,a){return this._tick++,this._activePath.chamferRect(t,e,r,i,n,a),this}star(t,e,r,i,n=0,a=0){return this._tick++,this._activePath.star(t,e,r,i,n,a,this._transform.clone()),this}svg(t){return this._tick++,Kd(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:{...this._fillStyle},strokeStyle:{...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,r,i,n,a){return t instanceof H?(this._transform.set(t.a,t.b,t.c,t.d,t.tx,t.ty),this):(this._transform.set(t,e,r,i,n,a),this)}transform(t,e,r,i,n,a){return t instanceof H?(this._transform.append(t),this):(to.set(t,e,r,i,n,a),this._transform.append(to),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._boundsDirty=!0,this.dirty=!0,this.emit("update",this,16)}get bounds(){if(!this._boundsDirty)return this._bounds;this._boundsDirty=!1;const t=this._bounds;t.clear();for(let e=0;e<this.instructions.length;e++){const r=this.instructions[e],i=r.action;if(i==="fill"){const n=r.data;t.addBounds(n.path.bounds)}else if(i==="texture"){const n=r.data;t.addFrame(n.dx,n.dy,n.dx+n.dw,n.dy+n.dh,n.transform)}if(i==="stroke"){const n=r.data,a=n.style.alignment;let o=n.style.width*(1-a);n.style.join==="miter"&&(o*=af(n.path,n.style.miterLimit));const l=n.path.bounds;t.addFrame(l.minX-o,l.minY-o,l.maxX+o,l.maxY+o)}}return t.isValid||t.set(0,0,0,0),t}containsPoint(t){var i;if(!this.bounds.containsPoint(t.x,t.y))return!1;const e=this.instructions;let r=!1;for(let n=0;n<e.length;n++){const a=e[n],o=a.data,l=o.path;if(!a.action||!l)continue;const h=o.style,c=l.shapePath.shapePrimitives;for(let u=0;u<c.length;u++){const f=c[u].shape;if(!h||!f)continue;const d=c[u].transform,p=d?d.applyInverse(t,of):t;if(a.action==="fill")r=f.contains(p.x,p.y);else{const m=h;r=f.strokeContains(p.x,p.y,m.width,m.alignment)}const g=o.hole;if(g){const m=(i=g.shapePath)==null?void 0:i.shapePrimitives;if(m)for(let y=0;y<m.length;y++)m[y].shape.contains(p.x,p.y)&&(r=!1)}if(r)return!0}}return r}unload(){var t;this.emit("unload",this);for(const e in this._gpuData)(t=this._gpuData[e])==null||t.destroy();this._gpuData=Object.create(null)}destroy(t=!1){if(this.destroyed)return;if(this.destroyed=!0,this._stateStack.length=0,this._transform=null,this.unload(),this.emit("destroy",this),this.removeAllListeners(),typeof t=="boolean"?t:t==null?void 0:t.texture){const r=typeof t=="boolean"?t:t==null?void 0:t.textureSource;this._fillStyle.texture&&(this._fillStyle.fill&&"uid"in this._fillStyle.fill?this._fillStyle.fill.destroy():this._fillStyle.texture.destroy(r)),this._strokeStyle.texture&&(this._strokeStyle.fill&&"uid"in this._strokeStyle.fill?this._strokeStyle.fill.destroy():this._strokeStyle.texture.destroy(r))}this._fillStyle=null,this._strokeStyle=null,this.instructions=null,this._activePath=null,this._bounds=null,this._stateStack=null,this.customShader=null,this._transform=null}};gn.defaultFillStyle={color:16777215,alpha:1,texture:J.WHITE,matrix:null,fill:null,textureSpace:"local"};gn.defaultStrokeStyle={width:1,color:16777215,alpha:1,alignment:.5,miterLimit:10,cap:"butt",join:"miter",texture:J.WHITE,matrix:null,fill:null,textureSpace:"local",pixelLine:!1};let ps=gn;class lf{constructor(){this.isBatchable=!1}reset(){this.isBatchable=!1,this.context=null,this.graphicsData&&(this.graphicsData.destroy(),this.graphicsData=null)}destroy(){this.reset()}}class hf{constructor(){this.instructions=new an}init(){this.instructions.reset()}destroy(){this.instructions.destroy(),this.instructions=null}}const xn=class Hi{constructor(t){this._renderer=t,this._managedContexts=new Ir({renderer:t,type:"resource",name:"graphicsContext"})}init(t){Hi.defaultOptions.bezierSmoothness=(t==null?void 0:t.bezierSmoothness)??Hi.defaultOptions.bezierSmoothness}getContextRenderData(t){return this.getGpuContext(t).graphicsData||this._initContextRenderData(t)}updateGpuContext(t){const e=t._gpuData,r=!!e[this._renderer.uid],i=e[this._renderer.uid]||this._initContext(t);return(t.dirty||!r)&&(r&&i.reset(),i.isBatchable=!1,t.dirty=!1),i}getGpuContext(t){return t._gpuData[this._renderer.uid]||this._initContext(t)}_initContextRenderData(t){const e=new hf,r=this.getGpuContext(t);return r.graphicsData=e,e.init(),e}_initContext(t){const e=new lf;return e.context=t,t._gpuData[this._renderer.uid]=e,this._managedContexts.add(t),e}destroy(){this._managedContexts.destroy(),this._renderer=null}};xn.extension={type:[tt.CanvasSystem],name:"graphicsContext"};xn.defaultOptions={bezierSmoothness:.5};let cf=xn;class Ul{constructor(t,e){this.state=kl.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ir({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){return!1}addRenderable(t,e){this._managedGraphics.add(t),this.renderer.renderPipes.batch.break(e),e.add(t)}updateRenderable(t){}execute(t){t.isRenderable&&this._adaptor.execute(this,t)}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null}}Ul.extension={type:[tt.CanvasPipes],name:"graphics"};function uf(s,t,e){const r=(s>>24&255)/255;t[e++]=(s&255)/255*r,t[e++]=(s>>8&255)/255*r,t[e++]=(s>>16&255)/255*r,t[e++]=r}class df{constructor(){this.batches=[],this.batched=!1}destroy(){this.batches.forEach(t=>{Et.return(t)}),this.batches.length=0}}class Hl{constructor(t,e){this.state=kl.for2d(),this.renderer=t,this._adaptor=e,this.renderer.runners.contextChange.add(this),this._managedGraphics=new Ir({renderer:t,type:"renderable",priority:-1,name:"graphics"})}contextChange(){this._adaptor.contextChange(this.renderer)}validateRenderable(t){const e=t.context,r=!!t._gpuData,n=this.renderer.graphicsContext.updateGpuContext(e);return!!(n.isBatchable||r!==n.isBatchable)}addRenderable(t,e){const i=this.renderer.graphicsContext.updateGpuContext(t.context);t.didViewUpdate&&this._rebuild(t),i.isBatchable?this._addToBatcher(t,e):(this.renderer.renderPipes.batch.break(e),e.add(t))}updateRenderable(t){const r=this._getGpuDataForRenderable(t).batches;for(let i=0;i<r.length;i++){const n=r[i];n._batcher.updateElement(n)}}execute(t){if(!t.isRenderable)return;const e=this.renderer,r=t.context;if(!e.graphicsContext.getGpuContext(r).batches.length)return;const n=r.customShader||this._adaptor.shader;this.state.blendMode=t.groupBlendMode;const a=n.resources.localUniforms.uniforms;a.uTransformMatrix=t.groupTransform,a.uRound=e._roundPixels|t._roundPixels,uf(t.groupColorAlpha,a.uColor,0),this._adaptor.execute(this,t)}_rebuild(t){const e=this._getGpuDataForRenderable(t),i=this.renderer.graphicsContext.updateGpuContext(t.context);e.destroy(),i.isBatchable&&this._updateBatchesForRenderable(t,e)}_addToBatcher(t,e){const r=this.renderer.renderPipes.batch,i=this._getGpuDataForRenderable(t).batches;for(let n=0;n<i.length;n++){const a=i[n];r.addToBatch(a,e)}}_getGpuDataForRenderable(t){return t._gpuData[this.renderer.uid]||this._initGpuDataForRenderable(t)}_initGpuDataForRenderable(t){const e=new df;return t._gpuData[this.renderer.uid]=e,this._managedGraphics.add(t),e}_updateBatchesForRenderable(t,e){const r=t.context,n=this.renderer.graphicsContext.getGpuContext(r),a=this.renderer._roundPixels|t._roundPixels;e.batches=n.batches.map(o=>{const l=Et.get(dn);return o.copyTo(l),l.renderable=t,l.roundPixels=a,l})}destroy(){this._managedGraphics.destroy(),this.renderer=null,this._adaptor.destroy(),this._adaptor=null,this.state=null}}Hl.extension={type:[tt.WebGLPipes,tt.WebGPUPipes],name:"graphics"};Ot.add(Ul);Ot.add(Hl);Ot.add(cf);Ot.add(mn);class br extends Ko{constructor(t){t instanceof ps&&(t={context:t});const{context:e,roundPixels:r,...i}=t||{};super({label:"Graphics",...i}),this.renderPipeId="graphics",e?this.context=e:(this.context=this._ownedContext=new ps,this.context.autoGarbageCollect=this.autoGarbageCollect),this.didViewUpdate=!0,this.allowChildren=!1,this.roundPixels=r??!1}set context(t){t!==this._context&&(this._context&&(this._context.off("update",this.onViewUpdate,this),this._context.off("unload",this.unload,this)),this._context=t,this._context.on("update",this.onViewUpdate,this),this._context.on("unload",this.unload,this),this.onViewUpdate())}get context(){return this._context}get bounds(){return this._context.bounds}updateBounds(){}containsPoint(t){return this._context.containsPoint(t)}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)}_onTouch(t){this._gcLastUsed=t,this._context._gcLastUsed=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 br(this._context.clone()):(this._ownedContext=null,new br(this._context))}lineStyle(t,e,r){st(xt,"Graphics#lineStyle is no longer needed. Use Graphics#setStrokeStyle to set the stroke style.");const i={};return t&&(i.width=t),e&&(i.color=e),r&&(i.alpha=r),this.context.strokeStyle=i,this}beginFill(t,e){st(xt,"Graphics#beginFill is no longer needed. Use Graphics#fill to fill the shape with the desired style.");const r={};return t!==void 0&&(r.color=t),e!==void 0&&(r.alpha=e),this.context.fillStyle=r,this}endFill(){st(xt,"Graphics#endFill is no longer needed. Use Graphics#fill to fill the shape with the desired style."),this.context.fill();const t=this.context.strokeStyle;return(t.width!==ps.defaultStrokeStyle.width||t.color!==ps.defaultStrokeStyle.color||t.alpha!==ps.defaultStrokeStyle.alpha)&&this.context.stroke(),this}drawCircle(...t){return st(xt,"Graphics#drawCircle has been renamed to Graphics#circle"),this._callContextMethod("circle",t)}drawEllipse(...t){return st(xt,"Graphics#drawEllipse has been renamed to Graphics#ellipse"),this._callContextMethod("ellipse",t)}drawPolygon(...t){return st(xt,"Graphics#drawPolygon has been renamed to Graphics#poly"),this._callContextMethod("poly",t)}drawRect(...t){return st(xt,"Graphics#drawRect has been renamed to Graphics#rect"),this._callContextMethod("rect",t)}drawRoundedRect(...t){return st(xt,"Graphics#drawRoundedRect has been renamed to Graphics#roundRect"),this._callContextMethod("roundRect",t)}drawStar(...t){return st(xt,"Graphics#drawStar has been renamed to Graphics#star"),this._callContextMethod("star",t)}}Ot.add(vh,Sh);const ff={background:"#1a1c2e",grid:"rgba(100, 118, 140, 0.15)",structureTool:"#3b82f6",structureHome:"#f59e0b",structureVendorAwning:"#f97316",structureVendorBody:"#9a3412",structureMcpFacade:"#1e3a5f",structureMcpAccent:"#7dd3fc",agent:"#22d3ee",calloutBg:"rgba(15, 23, 42, 0.88)",text:"#e2e8f0",textMuted:"#94a3b8",stroke:"#334155"};function pf(s){return{...ff,...s}}var Y;(function(s){s.assertEqual=i=>{};function t(i){}s.assertIs=t;function e(i){throw new Error}s.assertNever=e,s.arrayToEnum=i=>{const n={};for(const a of i)n[a]=a;return n},s.getValidEnumValues=i=>{const n=s.objectKeys(i).filter(o=>typeof i[i[o]]!="number"),a={};for(const o of n)a[o]=i[o];return s.objectValues(a)},s.objectValues=i=>s.objectKeys(i).map(function(n){return i[n]}),s.objectKeys=typeof Object.keys=="function"?i=>Object.keys(i):i=>{const n=[];for(const a in i)Object.prototype.hasOwnProperty.call(i,a)&&n.push(a);return n},s.find=(i,n)=>{for(const a of i)if(n(a))return a},s.isInteger=typeof Number.isInteger=="function"?i=>Number.isInteger(i):i=>typeof i=="number"&&Number.isFinite(i)&&Math.floor(i)===i;function r(i,n=" | "){return i.map(a=>typeof a=="string"?`'${a}'`:a).join(n)}s.joinValues=r,s.jsonStringifyReplacer=(i,n)=>typeof n=="bigint"?n.toString():n})(Y||(Y={}));var eo;(function(s){s.mergeShapes=(t,e)=>({...t,...e})})(eo||(eo={}));const E=Y.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),ye=s=>{switch(typeof s){case"undefined":return E.undefined;case"string":return E.string;case"number":return Number.isNaN(s)?E.nan:E.number;case"boolean":return E.boolean;case"function":return E.function;case"bigint":return E.bigint;case"symbol":return E.symbol;case"object":return Array.isArray(s)?E.array:s===null?E.null:s.then&&typeof s.then=="function"&&s.catch&&typeof s.catch=="function"?E.promise:typeof Map<"u"&&s instanceof Map?E.map:typeof Set<"u"&&s instanceof Set?E.set:typeof Date<"u"&&s instanceof Date?E.date:E.object;default:return E.unknown}},S=Y.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class de extends Error{get errors(){return this.issues}constructor(t){super(),this.issues=[],this.addIssue=r=>{this.issues=[...this.issues,r]},this.addIssues=(r=[])=>{this.issues=[...this.issues,...r]};const e=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,e):this.__proto__=e,this.name="ZodError",this.issues=t}format(t){const e=t||function(n){return n.message},r={_errors:[]},i=n=>{for(const a of n.issues)if(a.code==="invalid_union")a.unionErrors.map(i);else if(a.code==="invalid_return_type")i(a.returnTypeError);else if(a.code==="invalid_arguments")i(a.argumentsError);else if(a.path.length===0)r._errors.push(e(a));else{let o=r,l=0;for(;l<a.path.length;){const h=a.path[l];l===a.path.length-1?(o[h]=o[h]||{_errors:[]},o[h]._errors.push(e(a))):o[h]=o[h]||{_errors:[]},o=o[h],l++}}};return i(this),r}static assert(t){if(!(t instanceof de))throw new Error(`Not a ZodError: ${t}`)}toString(){return this.message}get message(){return JSON.stringify(this.issues,Y.jsonStringifyReplacer,2)}get isEmpty(){return this.issues.length===0}flatten(t=e=>e.message){const e={},r=[];for(const i of this.issues)if(i.path.length>0){const n=i.path[0];e[n]=e[n]||[],e[n].push(t(i))}else r.push(t(i));return{formErrors:r,fieldErrors:e}}get formErrors(){return this.flatten()}}de.create=s=>new de(s);const ji=(s,t)=>{let e;switch(s.code){case S.invalid_type:s.received===E.undefined?e="Required":e=`Expected ${s.expected}, received ${s.received}`;break;case S.invalid_literal:e=`Invalid literal value, expected ${JSON.stringify(s.expected,Y.jsonStringifyReplacer)}`;break;case S.unrecognized_keys:e=`Unrecognized key(s) in object: ${Y.joinValues(s.keys,", ")}`;break;case S.invalid_union:e="Invalid input";break;case S.invalid_union_discriminator:e=`Invalid discriminator value. Expected ${Y.joinValues(s.options)}`;break;case S.invalid_enum_value:e=`Invalid enum value. Expected ${Y.joinValues(s.options)}, received '${s.received}'`;break;case S.invalid_arguments:e="Invalid function arguments";break;case S.invalid_return_type:e="Invalid function return type";break;case S.invalid_date:e="Invalid date";break;case S.invalid_string:typeof s.validation=="object"?"includes"in s.validation?(e=`Invalid input: must include "${s.validation.includes}"`,typeof s.validation.position=="number"&&(e=`${e} at one or more positions greater than or equal to ${s.validation.position}`)):"startsWith"in s.validation?e=`Invalid input: must start with "${s.validation.startsWith}"`:"endsWith"in s.validation?e=`Invalid input: must end with "${s.validation.endsWith}"`:Y.assertNever(s.validation):s.validation!=="regex"?e=`Invalid ${s.validation}`:e="Invalid";break;case S.too_small:s.type==="array"?e=`Array must contain ${s.exact?"exactly":s.inclusive?"at least":"more than"} ${s.minimum} element(s)`:s.type==="string"?e=`String must contain ${s.exact?"exactly":s.inclusive?"at least":"over"} ${s.minimum} character(s)`:s.type==="number"?e=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="bigint"?e=`Number must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${s.minimum}`:s.type==="date"?e=`Date must be ${s.exact?"exactly equal to ":s.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(s.minimum))}`:e="Invalid input";break;case S.too_big:s.type==="array"?e=`Array must contain ${s.exact?"exactly":s.inclusive?"at most":"less than"} ${s.maximum} element(s)`:s.type==="string"?e=`String must contain ${s.exact?"exactly":s.inclusive?"at most":"under"} ${s.maximum} character(s)`:s.type==="number"?e=`Number must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="bigint"?e=`BigInt must be ${s.exact?"exactly":s.inclusive?"less than or equal to":"less than"} ${s.maximum}`:s.type==="date"?e=`Date must be ${s.exact?"exactly":s.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(s.maximum))}`:e="Invalid input";break;case S.custom:e="Invalid input";break;case S.invalid_intersection_types:e="Intersection results could not be merged";break;case S.not_multiple_of:e=`Number must be a multiple of ${s.multipleOf}`;break;case S.not_finite:e="Number must be finite";break;default:e=t.defaultError,Y.assertNever(s)}return{message:e}};let mf=ji;function gf(){return mf}const xf=s=>{const{data:t,path:e,errorMaps:r,issueData:i}=s,n=[...e,...i.path||[]],a={...i,path:n};if(i.message!==void 0)return{...i,path:n,message:i.message};let o="";const l=r.filter(h=>!!h).slice().reverse();for(const h of l)o=h(a,{data:t,defaultError:o}).message;return{...i,path:n,message:o}};function P(s,t){const e=gf(),r=xf({issueData:t,data:s.data,path:s.path,errorMaps:[s.common.contextualErrorMap,s.schemaErrorMap,e,e===ji?void 0:ji].filter(i=>!!i)});s.common.issues.push(r)}class St{constructor(){this.value="valid"}dirty(){this.value==="valid"&&(this.value="dirty")}abort(){this.value!=="aborted"&&(this.value="aborted")}static mergeArray(t,e){const r=[];for(const i of e){if(i.status==="aborted")return B;i.status==="dirty"&&t.dirty(),r.push(i.value)}return{status:t.value,value:r}}static async mergeObjectAsync(t,e){const r=[];for(const i of e){const n=await i.key,a=await i.value;r.push({key:n,value:a})}return St.mergeObjectSync(t,r)}static mergeObjectSync(t,e){const r={};for(const i of e){const{key:n,value:a}=i;if(n.status==="aborted"||a.status==="aborted")return B;n.status==="dirty"&&t.dirty(),a.status==="dirty"&&t.dirty(),n.value!=="__proto__"&&(typeof a.value<"u"||i.alwaysSet)&&(r[n.value]=a.value)}return{status:t.value,value:r}}}const B=Object.freeze({status:"aborted"}),Ts=s=>({status:"dirty",value:s}),Gt=s=>({status:"valid",value:s}),so=s=>s.status==="aborted",ro=s=>s.status==="dirty",Ke=s=>s.status==="valid",wr=s=>typeof Promise<"u"&&s instanceof Promise;var D;(function(s){s.errToObj=t=>typeof t=="string"?{message:t}:t||{},s.toString=t=>typeof t=="string"?t:t==null?void 0:t.message})(D||(D={}));class se{constructor(t,e,r,i){this._cachedPath=[],this.parent=t,this.data=e,this._path=r,this._key=i}get path(){return this._cachedPath.length||(Array.isArray(this._key)?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}const io=(s,t)=>{if(Ke(t))return{success:!0,data:t.value};if(!s.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const e=new de(s.common.issues);return this._error=e,this._error}}};function z(s){if(!s)return{};const{errorMap:t,invalid_type_error:e,required_error:r,description:i}=s;if(t&&(e||r))throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);return t?{errorMap:t,description:i}:{errorMap:(a,o)=>{const{message:l}=s;return a.code==="invalid_enum_value"?{message:l??o.defaultError}:typeof o.data>"u"?{message:l??r??o.defaultError}:a.code!=="invalid_type"?{message:o.defaultError}:{message:l??e??o.defaultError}},description:i}}class U{get description(){return this._def.description}_getType(t){return ye(t.data)}_getOrReturnCtx(t,e){return e||{common:t.parent.common,data:t.data,parsedType:ye(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}_processInputParams(t){return{status:new St,ctx:{common:t.parent.common,data:t.data,parsedType:ye(t.data),schemaErrorMap:this._def.errorMap,path:t.path,parent:t.parent}}}_parseSync(t){const e=this._parse(t);if(wr(e))throw new Error("Synchronous parse encountered promise.");return e}_parseAsync(t){const e=this._parse(t);return Promise.resolve(e)}parse(t,e){const r=this.safeParse(t,e);if(r.success)return r.data;throw r.error}safeParse(t,e){const r={common:{issues:[],async:(e==null?void 0:e.async)??!1,contextualErrorMap:e==null?void 0:e.errorMap},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ye(t)},i=this._parseSync({data:t,path:r.path,parent:r});return io(r,i)}"~validate"(t){var r,i;const e={common:{issues:[],async:!!this["~standard"].async},path:[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ye(t)};if(!this["~standard"].async)try{const n=this._parseSync({data:t,path:[],parent:e});return Ke(n)?{value:n.value}:{issues:e.common.issues}}catch(n){(i=(r=n==null?void 0:n.message)==null?void 0:r.toLowerCase())!=null&&i.includes("encountered")&&(this["~standard"].async=!0),e.common={issues:[],async:!0}}return this._parseAsync({data:t,path:[],parent:e}).then(n=>Ke(n)?{value:n.value}:{issues:e.common.issues})}async parseAsync(t,e){const r=await this.safeParseAsync(t,e);if(r.success)return r.data;throw r.error}async safeParseAsync(t,e){const r={common:{issues:[],contextualErrorMap:e==null?void 0:e.errorMap,async:!0},path:(e==null?void 0:e.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:t,parsedType:ye(t)},i=this._parse({data:t,path:r.path,parent:r}),n=await(wr(i)?i:Promise.resolve(i));return io(r,n)}refine(t,e){const r=i=>typeof e=="string"||typeof e>"u"?{message:e}:typeof e=="function"?e(i):e;return this._refinement((i,n)=>{const a=t(i),o=()=>n.addIssue({code:S.custom,...r(i)});return typeof Promise<"u"&&a instanceof Promise?a.then(l=>l?!0:(o(),!1)):a?!0:(o(),!1)})}refinement(t,e){return this._refinement((r,i)=>t(r)?!0:(i.addIssue(typeof e=="function"?e(r,i):e),!1))}_refinement(t){return new ts({schema:this,typeName:N.ZodEffects,effect:{type:"refinement",refinement:t}})}superRefine(t){return this._refinement(t)}constructor(t){this.spa=this.safeParseAsync,this._def=t,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this),this["~standard"]={version:1,vendor:"zod",validate:e=>this["~validate"](e)}}optional(){return be.create(this,this._def)}nullable(){return es.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return ee.create(this)}promise(){return Tr.create(this,this._def)}or(t){return vr.create([this,t],this._def)}and(t){return Sr.create(this,t,this._def)}transform(t){return new ts({...z(this._def),schema:this,typeName:N.ZodEffects,effect:{type:"transform",transform:t}})}default(t){const e=typeof t=="function"?t:()=>t;return new Xi({...z(this._def),innerType:this,defaultValue:e,typeName:N.ZodDefault})}brand(){return new zf({typeName:N.ZodBranded,type:this,...z(this._def)})}catch(t){const e=typeof t=="function"?t:()=>t;return new qi({...z(this._def),innerType:this,catchValue:e,typeName:N.ZodCatch})}describe(t){const e=this.constructor;return new e({...this._def,description:t})}pipe(t){return yn.create(this,t)}readonly(){return Zi.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const yf=/^c[^\s-]{8,}$/i,_f=/^[0-9a-z]+$/,bf=/^[0-9A-HJKMNP-TV-Z]{26}$/i,wf=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,kf=/^[a-z0-9_-]{21}$/i,vf=/^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/,Sf=/^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/,Af=/^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,Tf="^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";let yi;const Cf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/,Mf=/^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/,Pf=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/,Ef=/^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/,Rf=/^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/,If=/^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/,jl="((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))",Df=new RegExp(`^${jl}$`);function Vl(s){let t="[0-5]\\d";s.precision?t=`${t}\\.\\d{${s.precision}}`:s.precision==null&&(t=`${t}(\\.\\d+)?`);const e=s.precision?"+":"?";return`([01]\\d|2[0-3]):[0-5]\\d(:${t})${e}`}function Lf(s){return new RegExp(`^${Vl(s)}$`)}function Of(s){let t=`${jl}T${Vl(s)}`;const e=[];return e.push(s.local?"Z?":"Z"),s.offset&&e.push("([+-]\\d{2}:?\\d{2})"),t=`${t}(${e.join("|")})`,new RegExp(`^${t}$`)}function Nf(s,t){return!!((t==="v4"||!t)&&Cf.test(s)||(t==="v6"||!t)&&Pf.test(s))}function Bf(s,t){if(!vf.test(s))return!1;try{const[e]=s.split(".");if(!e)return!1;const r=e.replace(/-/g,"+").replace(/_/g,"/").padEnd(e.length+(4-e.length%4)%4,"="),i=JSON.parse(atob(r));return!(typeof i!="object"||i===null||"typ"in i&&(i==null?void 0:i.typ)!=="JWT"||!i.alg||t&&i.alg!==t)}catch{return!1}}function Ff(s,t){return!!((t==="v4"||!t)&&Mf.test(s)||(t==="v6"||!t)&&Ef.test(s))}class le extends U{_parse(t){if(this._def.coerce&&(t.data=String(t.data)),this._getType(t)!==E.string){const n=this._getOrReturnCtx(t);return P(n,{code:S.invalid_type,expected:E.string,received:n.parsedType}),B}const r=new St;let i;for(const n of this._def.checks)if(n.kind==="min")t.data.length<n.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:S.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="max")t.data.length>n.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:S.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!1,message:n.message}),r.dirty());else if(n.kind==="length"){const a=t.data.length>n.value,o=t.data.length<n.value;(a||o)&&(i=this._getOrReturnCtx(t,i),a?P(i,{code:S.too_big,maximum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}):o&&P(i,{code:S.too_small,minimum:n.value,type:"string",inclusive:!0,exact:!0,message:n.message}),r.dirty())}else if(n.kind==="email")Af.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"email",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="emoji")yi||(yi=new RegExp(Tf,"u")),yi.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"emoji",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="uuid")wf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"uuid",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="nanoid")kf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"nanoid",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid")yf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cuid",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="cuid2")_f.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cuid2",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="ulid")bf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"ulid",code:S.invalid_string,message:n.message}),r.dirty());else if(n.kind==="url")try{new URL(t.data)}catch{i=this._getOrReturnCtx(t,i),P(i,{validation:"url",code:S.invalid_string,message:n.message}),r.dirty()}else n.kind==="regex"?(n.regex.lastIndex=0,n.regex.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"regex",code:S.invalid_string,message:n.message}),r.dirty())):n.kind==="trim"?t.data=t.data.trim():n.kind==="includes"?t.data.includes(n.value,n.position)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:{includes:n.value,position:n.position},message:n.message}),r.dirty()):n.kind==="toLowerCase"?t.data=t.data.toLowerCase():n.kind==="toUpperCase"?t.data=t.data.toUpperCase():n.kind==="startsWith"?t.data.startsWith(n.value)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:{startsWith:n.value},message:n.message}),r.dirty()):n.kind==="endsWith"?t.data.endsWith(n.value)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:{endsWith:n.value},message:n.message}),r.dirty()):n.kind==="datetime"?Of(n).test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:"datetime",message:n.message}),r.dirty()):n.kind==="date"?Df.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:"date",message:n.message}),r.dirty()):n.kind==="time"?Lf(n).test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{code:S.invalid_string,validation:"time",message:n.message}),r.dirty()):n.kind==="duration"?Sf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"duration",code:S.invalid_string,message:n.message}),r.dirty()):n.kind==="ip"?Nf(t.data,n.version)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"ip",code:S.invalid_string,message:n.message}),r.dirty()):n.kind==="jwt"?Bf(t.data,n.alg)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"jwt",code:S.invalid_string,message:n.message}),r.dirty()):n.kind==="cidr"?Ff(t.data,n.version)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"cidr",code:S.invalid_string,message:n.message}),r.dirty()):n.kind==="base64"?Rf.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"base64",code:S.invalid_string,message:n.message}),r.dirty()):n.kind==="base64url"?If.test(t.data)||(i=this._getOrReturnCtx(t,i),P(i,{validation:"base64url",code:S.invalid_string,message:n.message}),r.dirty()):Y.assertNever(n);return{status:r.value,value:t.data}}_regex(t,e,r){return this.refinement(i=>t.test(i),{validation:e,code:S.invalid_string,...D.errToObj(r)})}_addCheck(t){return new le({...this._def,checks:[...this._def.checks,t]})}email(t){return this._addCheck({kind:"email",...D.errToObj(t)})}url(t){return this._addCheck({kind:"url",...D.errToObj(t)})}emoji(t){return this._addCheck({kind:"emoji",...D.errToObj(t)})}uuid(t){return this._addCheck({kind:"uuid",...D.errToObj(t)})}nanoid(t){return this._addCheck({kind:"nanoid",...D.errToObj(t)})}cuid(t){return this._addCheck({kind:"cuid",...D.errToObj(t)})}cuid2(t){return this._addCheck({kind:"cuid2",...D.errToObj(t)})}ulid(t){return this._addCheck({kind:"ulid",...D.errToObj(t)})}base64(t){return this._addCheck({kind:"base64",...D.errToObj(t)})}base64url(t){return this._addCheck({kind:"base64url",...D.errToObj(t)})}jwt(t){return this._addCheck({kind:"jwt",...D.errToObj(t)})}ip(t){return this._addCheck({kind:"ip",...D.errToObj(t)})}cidr(t){return this._addCheck({kind:"cidr",...D.errToObj(t)})}datetime(t){return typeof t=="string"?this._addCheck({kind:"datetime",precision:null,offset:!1,local:!1,message:t}):this._addCheck({kind:"datetime",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,offset:(t==null?void 0:t.offset)??!1,local:(t==null?void 0:t.local)??!1,...D.errToObj(t==null?void 0:t.message)})}date(t){return this._addCheck({kind:"date",message:t})}time(t){return typeof t=="string"?this._addCheck({kind:"time",precision:null,message:t}):this._addCheck({kind:"time",precision:typeof(t==null?void 0:t.precision)>"u"?null:t==null?void 0:t.precision,...D.errToObj(t==null?void 0:t.message)})}duration(t){return this._addCheck({kind:"duration",...D.errToObj(t)})}regex(t,e){return this._addCheck({kind:"regex",regex:t,...D.errToObj(e)})}includes(t,e){return this._addCheck({kind:"includes",value:t,position:e==null?void 0:e.position,...D.errToObj(e==null?void 0:e.message)})}startsWith(t,e){return this._addCheck({kind:"startsWith",value:t,...D.errToObj(e)})}endsWith(t,e){return this._addCheck({kind:"endsWith",value:t,...D.errToObj(e)})}min(t,e){return this._addCheck({kind:"min",value:t,...D.errToObj(e)})}max(t,e){return this._addCheck({kind:"max",value:t,...D.errToObj(e)})}length(t,e){return this._addCheck({kind:"length",value:t,...D.errToObj(e)})}nonempty(t){return this.min(1,D.errToObj(t))}trim(){return new le({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new le({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new le({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(t=>t.kind==="datetime")}get isDate(){return!!this._def.checks.find(t=>t.kind==="date")}get isTime(){return!!this._def.checks.find(t=>t.kind==="time")}get isDuration(){return!!this._def.checks.find(t=>t.kind==="duration")}get isEmail(){return!!this._def.checks.find(t=>t.kind==="email")}get isURL(){return!!this._def.checks.find(t=>t.kind==="url")}get isEmoji(){return!!this._def.checks.find(t=>t.kind==="emoji")}get isUUID(){return!!this._def.checks.find(t=>t.kind==="uuid")}get isNANOID(){return!!this._def.checks.find(t=>t.kind==="nanoid")}get isCUID(){return!!this._def.checks.find(t=>t.kind==="cuid")}get isCUID2(){return!!this._def.checks.find(t=>t.kind==="cuid2")}get isULID(){return!!this._def.checks.find(t=>t.kind==="ulid")}get isIP(){return!!this._def.checks.find(t=>t.kind==="ip")}get isCIDR(){return!!this._def.checks.find(t=>t.kind==="cidr")}get isBase64(){return!!this._def.checks.find(t=>t.kind==="base64")}get isBase64url(){return!!this._def.checks.find(t=>t.kind==="base64url")}get minLength(){let t=null;for(const e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxLength(){let t=null;for(const e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}}le.create=s=>new le({checks:[],typeName:N.ZodString,coerce:(s==null?void 0:s.coerce)??!1,...z(s)});function Gf(s,t){const e=(s.toString().split(".")[1]||"").length,r=(t.toString().split(".")[1]||"").length,i=e>r?e:r,n=Number.parseInt(s.toFixed(i).replace(".","")),a=Number.parseInt(t.toFixed(i).replace(".",""));return n%a/10**i}class zs extends U{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(t){if(this._def.coerce&&(t.data=Number(t.data)),this._getType(t)!==E.number){const n=this._getOrReturnCtx(t);return P(n,{code:S.invalid_type,expected:E.number,received:n.parsedType}),B}let r;const i=new St;for(const n of this._def.checks)n.kind==="int"?Y.isInteger(t.data)||(r=this._getOrReturnCtx(t,r),P(r,{code:S.invalid_type,expected:"integer",received:"float",message:n.message}),i.dirty()):n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.too_small,minimum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.too_big,maximum:n.value,type:"number",inclusive:n.inclusive,exact:!1,message:n.message}),i.dirty()):n.kind==="multipleOf"?Gf(t.data,n.value)!==0&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):n.kind==="finite"?Number.isFinite(t.data)||(r=this._getOrReturnCtx(t,r),P(r,{code:S.not_finite,message:n.message}),i.dirty()):Y.assertNever(n);return{status:i.value,value:t.data}}gte(t,e){return this.setLimit("min",t,!0,D.toString(e))}gt(t,e){return this.setLimit("min",t,!1,D.toString(e))}lte(t,e){return this.setLimit("max",t,!0,D.toString(e))}lt(t,e){return this.setLimit("max",t,!1,D.toString(e))}setLimit(t,e,r,i){return new zs({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:D.toString(i)}]})}_addCheck(t){return new zs({...this._def,checks:[...this._def.checks,t]})}int(t){return this._addCheck({kind:"int",message:D.toString(t)})}positive(t){return this._addCheck({kind:"min",value:0,inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:0,inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:0,inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:0,inclusive:!0,message:D.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:D.toString(e)})}finite(t){return this._addCheck({kind:"finite",message:D.toString(t)})}safe(t){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:D.toString(t)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:D.toString(t)})}get minValue(){let t=null;for(const e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(const e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}get isInt(){return!!this._def.checks.find(t=>t.kind==="int"||t.kind==="multipleOf"&&Y.isInteger(t.value))}get isFinite(){let t=null,e=null;for(const r of this._def.checks){if(r.kind==="finite"||r.kind==="int"||r.kind==="multipleOf")return!0;r.kind==="min"?(e===null||r.value>e)&&(e=r.value):r.kind==="max"&&(t===null||r.value<t)&&(t=r.value)}return Number.isFinite(e)&&Number.isFinite(t)}}zs.create=s=>new zs({checks:[],typeName:N.ZodNumber,coerce:(s==null?void 0:s.coerce)||!1,...z(s)});class $s extends U{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(t){if(this._def.coerce)try{t.data=BigInt(t.data)}catch{return this._getInvalidInput(t)}if(this._getType(t)!==E.bigint)return this._getInvalidInput(t);let r;const i=new St;for(const n of this._def.checks)n.kind==="min"?(n.inclusive?t.data<n.value:t.data<=n.value)&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.too_small,type:"bigint",minimum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="max"?(n.inclusive?t.data>n.value:t.data>=n.value)&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.too_big,type:"bigint",maximum:n.value,inclusive:n.inclusive,message:n.message}),i.dirty()):n.kind==="multipleOf"?t.data%n.value!==BigInt(0)&&(r=this._getOrReturnCtx(t,r),P(r,{code:S.not_multiple_of,multipleOf:n.value,message:n.message}),i.dirty()):Y.assertNever(n);return{status:i.value,value:t.data}}_getInvalidInput(t){const e=this._getOrReturnCtx(t);return P(e,{code:S.invalid_type,expected:E.bigint,received:e.parsedType}),B}gte(t,e){return this.setLimit("min",t,!0,D.toString(e))}gt(t,e){return this.setLimit("min",t,!1,D.toString(e))}lte(t,e){return this.setLimit("max",t,!0,D.toString(e))}lt(t,e){return this.setLimit("max",t,!1,D.toString(e))}setLimit(t,e,r,i){return new $s({...this._def,checks:[...this._def.checks,{kind:t,value:e,inclusive:r,message:D.toString(i)}]})}_addCheck(t){return new $s({...this._def,checks:[...this._def.checks,t]})}positive(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:D.toString(t)})}negative(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:D.toString(t)})}nonpositive(t){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:D.toString(t)})}nonnegative(t){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:D.toString(t)})}multipleOf(t,e){return this._addCheck({kind:"multipleOf",value:t,message:D.toString(e)})}get minValue(){let t=null;for(const e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t}get maxValue(){let t=null;for(const e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t}}$s.create=s=>new $s({checks:[],typeName:N.ZodBigInt,coerce:(s==null?void 0:s.coerce)??!1,...z(s)});class no extends U{_parse(t){if(this._def.coerce&&(t.data=!!t.data),this._getType(t)!==E.boolean){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.boolean,received:r.parsedType}),B}return Gt(t.data)}}no.create=s=>new no({typeName:N.ZodBoolean,coerce:(s==null?void 0:s.coerce)||!1,...z(s)});class kr extends U{_parse(t){if(this._def.coerce&&(t.data=new Date(t.data)),this._getType(t)!==E.date){const n=this._getOrReturnCtx(t);return P(n,{code:S.invalid_type,expected:E.date,received:n.parsedType}),B}if(Number.isNaN(t.data.getTime())){const n=this._getOrReturnCtx(t);return P(n,{code:S.invalid_date}),B}const r=new St;let i;for(const n of this._def.checks)n.kind==="min"?t.data.getTime()<n.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:S.too_small,message:n.message,inclusive:!0,exact:!1,minimum:n.value,type:"date"}),r.dirty()):n.kind==="max"?t.data.getTime()>n.value&&(i=this._getOrReturnCtx(t,i),P(i,{code:S.too_big,message:n.message,inclusive:!0,exact:!1,maximum:n.value,type:"date"}),r.dirty()):Y.assertNever(n);return{status:r.value,value:new Date(t.data.getTime())}}_addCheck(t){return new kr({...this._def,checks:[...this._def.checks,t]})}min(t,e){return this._addCheck({kind:"min",value:t.getTime(),message:D.toString(e)})}max(t,e){return this._addCheck({kind:"max",value:t.getTime(),message:D.toString(e)})}get minDate(){let t=null;for(const e of this._def.checks)e.kind==="min"&&(t===null||e.value>t)&&(t=e.value);return t!=null?new Date(t):null}get maxDate(){let t=null;for(const e of this._def.checks)e.kind==="max"&&(t===null||e.value<t)&&(t=e.value);return t!=null?new Date(t):null}}kr.create=s=>new kr({checks:[],coerce:(s==null?void 0:s.coerce)||!1,typeName:N.ZodDate,...z(s)});class ao extends U{_parse(t){if(this._getType(t)!==E.symbol){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.symbol,received:r.parsedType}),B}return Gt(t.data)}}ao.create=s=>new ao({typeName:N.ZodSymbol,...z(s)});class oo extends U{_parse(t){if(this._getType(t)!==E.undefined){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.undefined,received:r.parsedType}),B}return Gt(t.data)}}oo.create=s=>new oo({typeName:N.ZodUndefined,...z(s)});class lo extends U{_parse(t){if(this._getType(t)!==E.null){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.null,received:r.parsedType}),B}return Gt(t.data)}}lo.create=s=>new lo({typeName:N.ZodNull,...z(s)});class ho extends U{constructor(){super(...arguments),this._any=!0}_parse(t){return Gt(t.data)}}ho.create=s=>new ho({typeName:N.ZodAny,...z(s)});class Vi extends U{constructor(){super(...arguments),this._unknown=!0}_parse(t){return Gt(t.data)}}Vi.create=s=>new Vi({typeName:N.ZodUnknown,...z(s)});class we extends U{_parse(t){const e=this._getOrReturnCtx(t);return P(e,{code:S.invalid_type,expected:E.never,received:e.parsedType}),B}}we.create=s=>new we({typeName:N.ZodNever,...z(s)});class co extends U{_parse(t){if(this._getType(t)!==E.undefined){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.void,received:r.parsedType}),B}return Gt(t.data)}}co.create=s=>new co({typeName:N.ZodVoid,...z(s)});class ee extends U{_parse(t){const{ctx:e,status:r}=this._processInputParams(t),i=this._def;if(e.parsedType!==E.array)return P(e,{code:S.invalid_type,expected:E.array,received:e.parsedType}),B;if(i.exactLength!==null){const a=e.data.length>i.exactLength.value,o=e.data.length<i.exactLength.value;(a||o)&&(P(e,{code:a?S.too_big:S.too_small,minimum:o?i.exactLength.value:void 0,maximum:a?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(i.minLength!==null&&e.data.length<i.minLength.value&&(P(e,{code:S.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),i.maxLength!==null&&e.data.length>i.maxLength.value&&(P(e,{code:S.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),e.common.async)return Promise.all([...e.data].map((a,o)=>i.type._parseAsync(new se(e,a,e.path,o)))).then(a=>St.mergeArray(r,a));const n=[...e.data].map((a,o)=>i.type._parseSync(new se(e,a,e.path,o)));return St.mergeArray(r,n)}get element(){return this._def.type}min(t,e){return new ee({...this._def,minLength:{value:t,message:D.toString(e)}})}max(t,e){return new ee({...this._def,maxLength:{value:t,message:D.toString(e)}})}length(t,e){return new ee({...this._def,exactLength:{value:t,message:D.toString(e)}})}nonempty(t){return this.min(1,t)}}ee.create=(s,t)=>new ee({type:s,minLength:null,maxLength:null,exactLength:null,typeName:N.ZodArray,...z(t)});function Xe(s){if(s instanceof ht){const t={};for(const e in s.shape){const r=s.shape[e];t[e]=be.create(Xe(r))}return new ht({...s._def,shape:()=>t})}else return s instanceof ee?new ee({...s._def,type:Xe(s.element)}):s instanceof be?be.create(Xe(s.unwrap())):s instanceof es?es.create(Xe(s.unwrap())):s instanceof Oe?Oe.create(s.items.map(t=>Xe(t))):s}class ht extends U{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(this._cached!==null)return this._cached;const t=this._def.shape(),e=Y.objectKeys(t);return this._cached={shape:t,keys:e},this._cached}_parse(t){if(this._getType(t)!==E.object){const h=this._getOrReturnCtx(t);return P(h,{code:S.invalid_type,expected:E.object,received:h.parsedType}),B}const{status:r,ctx:i}=this._processInputParams(t),{shape:n,keys:a}=this._getCached(),o=[];if(!(this._def.catchall instanceof we&&this._def.unknownKeys==="strip"))for(const h in i.data)a.includes(h)||o.push(h);const l=[];for(const h of a){const c=n[h],u=i.data[h];l.push({key:{status:"valid",value:h},value:c._parse(new se(i,u,i.path,h)),alwaysSet:h in i.data})}if(this._def.catchall instanceof we){const h=this._def.unknownKeys;if(h==="passthrough")for(const c of o)l.push({key:{status:"valid",value:c},value:{status:"valid",value:i.data[c]}});else if(h==="strict")o.length>0&&(P(i,{code:S.unrecognized_keys,keys:o}),r.dirty());else if(h!=="strip")throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const h=this._def.catchall;for(const c of o){const u=i.data[c];l.push({key:{status:"valid",value:c},value:h._parse(new se(i,u,i.path,c)),alwaysSet:c in i.data})}}return i.common.async?Promise.resolve().then(async()=>{const h=[];for(const c of l){const u=await c.key,f=await c.value;h.push({key:u,value:f,alwaysSet:c.alwaysSet})}return h}).then(h=>St.mergeObjectSync(r,h)):St.mergeObjectSync(r,l)}get shape(){return this._def.shape()}strict(t){return D.errToObj,new ht({...this._def,unknownKeys:"strict",...t!==void 0?{errorMap:(e,r)=>{var n,a;const i=((a=(n=this._def).errorMap)==null?void 0:a.call(n,e,r).message)??r.defaultError;return e.code==="unrecognized_keys"?{message:D.errToObj(t).message??i}:{message:i}}}:{}})}strip(){return new ht({...this._def,unknownKeys:"strip"})}passthrough(){return new ht({...this._def,unknownKeys:"passthrough"})}extend(t){return new ht({...this._def,shape:()=>({...this._def.shape(),...t})})}merge(t){return new ht({unknownKeys:t._def.unknownKeys,catchall:t._def.catchall,shape:()=>({...this._def.shape(),...t._def.shape()}),typeName:N.ZodObject})}setKey(t,e){return this.augment({[t]:e})}catchall(t){return new ht({...this._def,catchall:t})}pick(t){const e={};for(const r of Y.objectKeys(t))t[r]&&this.shape[r]&&(e[r]=this.shape[r]);return new ht({...this._def,shape:()=>e})}omit(t){const e={};for(const r of Y.objectKeys(this.shape))t[r]||(e[r]=this.shape[r]);return new ht({...this._def,shape:()=>e})}deepPartial(){return Xe(this)}partial(t){const e={};for(const r of Y.objectKeys(this.shape)){const i=this.shape[r];t&&!t[r]?e[r]=i:e[r]=i.optional()}return new ht({...this._def,shape:()=>e})}required(t){const e={};for(const r of Y.objectKeys(this.shape))if(t&&!t[r])e[r]=this.shape[r];else{let n=this.shape[r];for(;n instanceof be;)n=n._def.innerType;e[r]=n}return new ht({...this._def,shape:()=>e})}keyof(){return Yl(Y.objectKeys(this.shape))}}ht.create=(s,t)=>new ht({shape:()=>s,unknownKeys:"strip",catchall:we.create(),typeName:N.ZodObject,...z(t)});ht.strictCreate=(s,t)=>new ht({shape:()=>s,unknownKeys:"strict",catchall:we.create(),typeName:N.ZodObject,...z(t)});ht.lazycreate=(s,t)=>new ht({shape:s,unknownKeys:"strip",catchall:we.create(),typeName:N.ZodObject,...z(t)});class vr extends U{_parse(t){const{ctx:e}=this._processInputParams(t),r=this._def.options;function i(n){for(const o of n)if(o.result.status==="valid")return o.result;for(const o of n)if(o.result.status==="dirty")return e.common.issues.push(...o.ctx.common.issues),o.result;const a=n.map(o=>new de(o.ctx.common.issues));return P(e,{code:S.invalid_union,unionErrors:a}),B}if(e.common.async)return Promise.all(r.map(async n=>{const a={...e,common:{...e.common,issues:[]},parent:null};return{result:await n._parseAsync({data:e.data,path:e.path,parent:a}),ctx:a}})).then(i);{let n;const a=[];for(const l of r){const h={...e,common:{...e.common,issues:[]},parent:null},c=l._parseSync({data:e.data,path:e.path,parent:h});if(c.status==="valid")return c;c.status==="dirty"&&!n&&(n={result:c,ctx:h}),h.common.issues.length&&a.push(h.common.issues)}if(n)return e.common.issues.push(...n.ctx.common.issues),n.result;const o=a.map(l=>new de(l));return P(e,{code:S.invalid_union,unionErrors:o}),B}}get options(){return this._def.options}}vr.create=(s,t)=>new vr({options:s,typeName:N.ZodUnion,...z(t)});function Yi(s,t){const e=ye(s),r=ye(t);if(s===t)return{valid:!0,data:s};if(e===E.object&&r===E.object){const i=Y.objectKeys(t),n=Y.objectKeys(s).filter(o=>i.indexOf(o)!==-1),a={...s,...t};for(const o of n){const l=Yi(s[o],t[o]);if(!l.valid)return{valid:!1};a[o]=l.data}return{valid:!0,data:a}}else if(e===E.array&&r===E.array){if(s.length!==t.length)return{valid:!1};const i=[];for(let n=0;n<s.length;n++){const a=s[n],o=t[n],l=Yi(a,o);if(!l.valid)return{valid:!1};i.push(l.data)}return{valid:!0,data:i}}else return e===E.date&&r===E.date&&+s==+t?{valid:!0,data:s}:{valid:!1}}class Sr extends U{_parse(t){const{status:e,ctx:r}=this._processInputParams(t),i=(n,a)=>{if(so(n)||so(a))return B;const o=Yi(n.value,a.value);return o.valid?((ro(n)||ro(a))&&e.dirty(),{status:e.value,value:o.data}):(P(r,{code:S.invalid_intersection_types}),B)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([n,a])=>i(n,a)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}Sr.create=(s,t,e)=>new Sr({left:s,right:t,typeName:N.ZodIntersection,...z(e)});class Oe extends U{_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==E.array)return P(r,{code:S.invalid_type,expected:E.array,received:r.parsedType}),B;if(r.data.length<this._def.items.length)return P(r,{code:S.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),B;!this._def.rest&&r.data.length>this._def.items.length&&(P(r,{code:S.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),e.dirty());const n=[...r.data].map((a,o)=>{const l=this._def.items[o]||this._def.rest;return l?l._parse(new se(r,a,r.path,o)):null}).filter(a=>!!a);return r.common.async?Promise.all(n).then(a=>St.mergeArray(e,a)):St.mergeArray(e,n)}get items(){return this._def.items}rest(t){return new Oe({...this._def,rest:t})}}Oe.create=(s,t)=>{if(!Array.isArray(s))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new Oe({items:s,typeName:N.ZodTuple,rest:null,...z(t)})};class Ar extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==E.object)return P(r,{code:S.invalid_type,expected:E.object,received:r.parsedType}),B;const i=[],n=this._def.keyType,a=this._def.valueType;for(const o in r.data)i.push({key:n._parse(new se(r,o,r.path,o)),value:a._parse(new se(r,r.data[o],r.path,o)),alwaysSet:o in r.data});return r.common.async?St.mergeObjectAsync(e,i):St.mergeObjectSync(e,i)}get element(){return this._def.valueType}static create(t,e,r){return e instanceof U?new Ar({keyType:t,valueType:e,typeName:N.ZodRecord,...z(r)}):new Ar({keyType:le.create(),valueType:t,typeName:N.ZodRecord,...z(e)})}}class uo extends U{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==E.map)return P(r,{code:S.invalid_type,expected:E.map,received:r.parsedType}),B;const i=this._def.keyType,n=this._def.valueType,a=[...r.data.entries()].map(([o,l],h)=>({key:i._parse(new se(r,o,r.path,[h,"key"])),value:n._parse(new se(r,l,r.path,[h,"value"]))}));if(r.common.async){const o=new Map;return Promise.resolve().then(async()=>{for(const l of a){const h=await l.key,c=await l.value;if(h.status==="aborted"||c.status==="aborted")return B;(h.status==="dirty"||c.status==="dirty")&&e.dirty(),o.set(h.value,c.value)}return{status:e.value,value:o}})}else{const o=new Map;for(const l of a){const h=l.key,c=l.value;if(h.status==="aborted"||c.status==="aborted")return B;(h.status==="dirty"||c.status==="dirty")&&e.dirty(),o.set(h.value,c.value)}return{status:e.value,value:o}}}}uo.create=(s,t,e)=>new uo({valueType:t,keyType:s,typeName:N.ZodMap,...z(e)});class Us extends U{_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.parsedType!==E.set)return P(r,{code:S.invalid_type,expected:E.set,received:r.parsedType}),B;const i=this._def;i.minSize!==null&&r.data.size<i.minSize.value&&(P(r,{code:S.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),e.dirty()),i.maxSize!==null&&r.data.size>i.maxSize.value&&(P(r,{code:S.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),e.dirty());const n=this._def.valueType;function a(l){const h=new Set;for(const c of l){if(c.status==="aborted")return B;c.status==="dirty"&&e.dirty(),h.add(c.value)}return{status:e.value,value:h}}const o=[...r.data.values()].map((l,h)=>n._parse(new se(r,l,r.path,h)));return r.common.async?Promise.all(o).then(l=>a(l)):a(o)}min(t,e){return new Us({...this._def,minSize:{value:t,message:D.toString(e)}})}max(t,e){return new Us({...this._def,maxSize:{value:t,message:D.toString(e)}})}size(t,e){return this.min(t,e).max(t,e)}nonempty(t){return this.min(1,t)}}Us.create=(s,t)=>new Us({valueType:s,minSize:null,maxSize:null,typeName:N.ZodSet,...z(t)});class fo extends U{get schema(){return this._def.getter()}_parse(t){const{ctx:e}=this._processInputParams(t);return this._def.getter()._parse({data:e.data,path:e.path,parent:e})}}fo.create=(s,t)=>new fo({getter:s,typeName:N.ZodLazy,...z(t)});class Wi extends U{_parse(t){if(t.data!==this._def.value){const e=this._getOrReturnCtx(t);return P(e,{received:e.data,code:S.invalid_literal,expected:this._def.value}),B}return{status:"valid",value:t.data}}get value(){return this._def.value}}Wi.create=(s,t)=>new Wi({value:s,typeName:N.ZodLiteral,...z(t)});function Yl(s,t){return new Je({values:s,typeName:N.ZodEnum,...z(t)})}class Je extends U{_parse(t){if(typeof t.data!="string"){const e=this._getOrReturnCtx(t),r=this._def.values;return P(e,{expected:Y.joinValues(r),received:e.parsedType,code:S.invalid_type}),B}if(this._cache||(this._cache=new Set(this._def.values)),!this._cache.has(t.data)){const e=this._getOrReturnCtx(t),r=this._def.values;return P(e,{received:e.data,code:S.invalid_enum_value,options:r}),B}return Gt(t.data)}get options(){return this._def.values}get enum(){const t={};for(const e of this._def.values)t[e]=e;return t}get Values(){const t={};for(const e of this._def.values)t[e]=e;return t}get Enum(){const t={};for(const e of this._def.values)t[e]=e;return t}extract(t,e=this._def){return Je.create(t,{...this._def,...e})}exclude(t,e=this._def){return Je.create(this.options.filter(r=>!t.includes(r)),{...this._def,...e})}}Je.create=Yl;class po extends U{_parse(t){const e=Y.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(t);if(r.parsedType!==E.string&&r.parsedType!==E.number){const i=Y.objectValues(e);return P(r,{expected:Y.joinValues(i),received:r.parsedType,code:S.invalid_type}),B}if(this._cache||(this._cache=new Set(Y.getValidEnumValues(this._def.values))),!this._cache.has(t.data)){const i=Y.objectValues(e);return P(r,{received:r.data,code:S.invalid_enum_value,options:i}),B}return Gt(t.data)}get enum(){return this._def.values}}po.create=(s,t)=>new po({values:s,typeName:N.ZodNativeEnum,...z(t)});class Tr extends U{unwrap(){return this._def.type}_parse(t){const{ctx:e}=this._processInputParams(t);if(e.parsedType!==E.promise&&e.common.async===!1)return P(e,{code:S.invalid_type,expected:E.promise,received:e.parsedType}),B;const r=e.parsedType===E.promise?e.data:Promise.resolve(e.data);return Gt(r.then(i=>this._def.type.parseAsync(i,{path:e.path,errorMap:e.common.contextualErrorMap})))}}Tr.create=(s,t)=>new Tr({type:s,typeName:N.ZodPromise,...z(t)});class ts extends U{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===N.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(t){const{status:e,ctx:r}=this._processInputParams(t),i=this._def.effect||null,n={addIssue:a=>{P(r,a),a.fatal?e.abort():e.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),i.type==="preprocess"){const a=i.transform(r.data,n);if(r.common.async)return Promise.resolve(a).then(async o=>{if(e.value==="aborted")return B;const l=await this._def.schema._parseAsync({data:o,path:r.path,parent:r});return l.status==="aborted"?B:l.status==="dirty"||e.value==="dirty"?Ts(l.value):l});{if(e.value==="aborted")return B;const o=this._def.schema._parseSync({data:a,path:r.path,parent:r});return o.status==="aborted"?B:o.status==="dirty"||e.value==="dirty"?Ts(o.value):o}}if(i.type==="refinement"){const a=o=>{const l=i.refinement(o,n);if(r.common.async)return Promise.resolve(l);if(l instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return o};if(r.common.async===!1){const o=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return o.status==="aborted"?B:(o.status==="dirty"&&e.dirty(),a(o.value),{status:e.value,value:o.value})}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(o=>o.status==="aborted"?B:(o.status==="dirty"&&e.dirty(),a(o.value).then(()=>({status:e.value,value:o.value}))))}if(i.type==="transform")if(r.common.async===!1){const a=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!Ke(a))return B;const o=i.transform(a.value,n);if(o instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:e.value,value:o}}else return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(a=>Ke(a)?Promise.resolve(i.transform(a.value,n)).then(o=>({status:e.value,value:o})):B);Y.assertNever(i)}}ts.create=(s,t,e)=>new ts({schema:s,typeName:N.ZodEffects,effect:t,...z(e)});ts.createWithPreprocess=(s,t,e)=>new ts({schema:t,effect:{type:"preprocess",transform:s},typeName:N.ZodEffects,...z(e)});class be extends U{_parse(t){return this._getType(t)===E.undefined?Gt(void 0):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}be.create=(s,t)=>new be({innerType:s,typeName:N.ZodOptional,...z(t)});class es extends U{_parse(t){return this._getType(t)===E.null?Gt(null):this._def.innerType._parse(t)}unwrap(){return this._def.innerType}}es.create=(s,t)=>new es({innerType:s,typeName:N.ZodNullable,...z(t)});class Xi extends U{_parse(t){const{ctx:e}=this._processInputParams(t);let r=e.data;return e.parsedType===E.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:e.path,parent:e})}removeDefault(){return this._def.innerType}}Xi.create=(s,t)=>new Xi({innerType:s,typeName:N.ZodDefault,defaultValue:typeof t.default=="function"?t.default:()=>t.default,...z(t)});class qi extends U{_parse(t){const{ctx:e}=this._processInputParams(t),r={...e,common:{...e.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return wr(i)?i.then(n=>({status:"valid",value:n.status==="valid"?n.value:this._def.catchValue({get error(){return new de(r.common.issues)},input:r.data})})):{status:"valid",value:i.status==="valid"?i.value:this._def.catchValue({get error(){return new de(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}qi.create=(s,t)=>new qi({innerType:s,typeName:N.ZodCatch,catchValue:typeof t.catch=="function"?t.catch:()=>t.catch,...z(t)});class mo extends U{_parse(t){if(this._getType(t)!==E.nan){const r=this._getOrReturnCtx(t);return P(r,{code:S.invalid_type,expected:E.nan,received:r.parsedType}),B}return{status:"valid",value:t.data}}}mo.create=s=>new mo({typeName:N.ZodNaN,...z(s)});class zf extends U{_parse(t){const{ctx:e}=this._processInputParams(t),r=e.data;return this._def.type._parse({data:r,path:e.path,parent:e})}unwrap(){return this._def.type}}class yn extends U{_parse(t){const{status:e,ctx:r}=this._processInputParams(t);if(r.common.async)return(async()=>{const n=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return n.status==="aborted"?B:n.status==="dirty"?(e.dirty(),Ts(n.value)):this._def.out._parseAsync({data:n.value,path:r.path,parent:r})})();{const i=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return i.status==="aborted"?B:i.status==="dirty"?(e.dirty(),{status:"dirty",value:i.value}):this._def.out._parseSync({data:i.value,path:r.path,parent:r})}}static create(t,e){return new yn({in:t,out:e,typeName:N.ZodPipeline})}}class Zi extends U{_parse(t){const e=this._def.innerType._parse(t),r=i=>(Ke(i)&&(i.value=Object.freeze(i.value)),i);return wr(e)?e.then(i=>r(i)):r(e)}unwrap(){return this._def.innerType}}Zi.create=(s,t)=>new Zi({innerType:s,typeName:N.ZodReadonly,...z(t)});var N;(function(s){s.ZodString="ZodString",s.ZodNumber="ZodNumber",s.ZodNaN="ZodNaN",s.ZodBigInt="ZodBigInt",s.ZodBoolean="ZodBoolean",s.ZodDate="ZodDate",s.ZodSymbol="ZodSymbol",s.ZodUndefined="ZodUndefined",s.ZodNull="ZodNull",s.ZodAny="ZodAny",s.ZodUnknown="ZodUnknown",s.ZodNever="ZodNever",s.ZodVoid="ZodVoid",s.ZodArray="ZodArray",s.ZodObject="ZodObject",s.ZodUnion="ZodUnion",s.ZodDiscriminatedUnion="ZodDiscriminatedUnion",s.ZodIntersection="ZodIntersection",s.ZodTuple="ZodTuple",s.ZodRecord="ZodRecord",s.ZodMap="ZodMap",s.ZodSet="ZodSet",s.ZodFunction="ZodFunction",s.ZodLazy="ZodLazy",s.ZodLiteral="ZodLiteral",s.ZodEnum="ZodEnum",s.ZodEffects="ZodEffects",s.ZodNativeEnum="ZodNativeEnum",s.ZodOptional="ZodOptional",s.ZodNullable="ZodNullable",s.ZodDefault="ZodDefault",s.ZodCatch="ZodCatch",s.ZodPromise="ZodPromise",s.ZodBranded="ZodBranded",s.ZodPipeline="ZodPipeline",s.ZodReadonly="ZodReadonly"})(N||(N={}));const Dt=le.create,_n=Vi.create;we.create;ee.create;const Lr=ht.create;vr.create;Sr.create;Oe.create;const bn=Ar.create,$f=Wi.create,Hs=Je.create;Tr.create;be.create;es.create;var wt=Dt().trim().min(1),Uf=Lr({requestId:wt,mainNodeId:wt,fromPlayerId:wt,toPlayerId:wt,kind:Hs(["assist","chat"]),toolName:Dt().optional(),args:bn(Dt(),_n()).optional(),text:Dt().optional()}).superRefine((s,t)=>{s.kind==="assist"&&(s.toolName??"").trim().length===0&&t.addIssue({code:S.custom,path:["toolName"],message:"toolName is required for assist"}),s.kind==="chat"&&(s.text??"").trim().length===0&&t.addIssue({code:S.custom,path:["text"],message:"text is required for chat"})});Lr({requestId:wt,mainNodeId:wt,toPlayerId:wt,fromPlayerId:wt,kind:Hs(["assist","chat"]),status:Hs(["started","stream","completed","failed","forwarded"]),toolName:Dt().optional(),message:Dt().optional(),result:bn(Dt(),_n()).optional(),error:Dt().nullable().optional(),ts:wt,channelKey:Dt().optional(),command:Uf.optional()});Lr({requestId:wt,mainNodeId:wt,toPlayerId:wt,fromPlayerId:wt,kind:Hs(["assist","chat"]),status:Hs(["stream","completed","failed"]),toolName:Dt().optional(),message:Dt().optional(),result:bn(Dt(),_n()).optional(),error:Dt().nullable().optional(),ts:wt}).superRefine((s,t)=>{s.status==="failed"&&(s.error??"").trim().length===0&&t.addIssue({code:S.custom,path:["error"],message:"error is required when status is failed"})});Lr({consent:$f(!0),passw:wt}).strict();new TextEncoder;/*! @license DOMPurify 3.3.3 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.3.3/LICENSE */const{entries:Wl,setPrototypeOf:go,isFrozen:Hf,getPrototypeOf:jf,getOwnPropertyDescriptor:Vf}=Object;let{freeze:At,seal:Ft,create:gr}=Object,{apply:Qi,construct:Ki}=typeof Reflect<"u"&&Reflect;At||(At=function(t){return t});Ft||(Ft=function(t){return t});Qi||(Qi=function(t,e){for(var r=arguments.length,i=new Array(r>2?r-2:0),n=2;n<r;n++)i[n-2]=arguments[n];return t.apply(e,i)});Ki||(Ki=function(t){for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return new t(...r)});const cr=Tt(Array.prototype.forEach),Yf=Tt(Array.prototype.lastIndexOf),xo=Tt(Array.prototype.pop),ms=Tt(Array.prototype.push),Wf=Tt(Array.prototype.splice),xr=Tt(String.prototype.toLowerCase),_i=Tt(String.prototype.toString),bi=Tt(String.prototype.match),gs=Tt(String.prototype.replace),Xf=Tt(String.prototype.indexOf),qf=Tt(String.prototype.trim),It=Tt(Object.prototype.hasOwnProperty),bt=Tt(RegExp.prototype.test),xs=Zf(TypeError);function Tt(s){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var e=arguments.length,r=new Array(e>1?e-1:0),i=1;i<e;i++)r[i-1]=arguments[i];return Qi(s,t,r)}}function Zf(s){return function(){for(var t=arguments.length,e=new Array(t),r=0;r<t;r++)e[r]=arguments[r];return Ki(s,e)}}function $(s,t){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xr;go&&go(s,null);let r=t.length;for(;r--;){let i=t[r];if(typeof i=="string"){const n=e(i);n!==i&&(Hf(t)||(t[r]=n),i=n)}s[i]=!0}return s}function Qf(s){for(let t=0;t<s.length;t++)It(s,t)||(s[t]=null);return s}function Jt(s){const t=gr(null);for(const[e,r]of Wl(s))It(s,e)&&(Array.isArray(r)?t[e]=Qf(r):r&&typeof r=="object"&&r.constructor===Object?t[e]=Jt(r):t[e]=r);return t}function ys(s,t){for(;s!==null;){const r=Vf(s,t);if(r){if(r.get)return Tt(r.get);if(typeof r.value=="function")return Tt(r.value)}s=jf(s)}function e(){return null}return e}const yo=At(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),wi=At(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),ki=At(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),Kf=At(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),vi=At(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),Jf=At(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),_o=At(["#text"]),bo=At(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns","slot"]),Si=At(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),wo=At(["accent","accentunder","align","bevelled","close","columnsalign","columnlines","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lspace","lquote","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),ur=At(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),tp=Ft(/\{\{[\w\W]*|[\w\W]*\}\}/gm),ep=Ft(/<%[\w\W]*|[\w\W]*%>/gm),sp=Ft(/\$\{[\w\W]*/gm),rp=Ft(/^data-[\-\w.\u00B7-\uFFFF]+$/),ip=Ft(/^aria-[\-\w]+$/),Xl=Ft(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),np=Ft(/^(?:\w+script|data):/i),ap=Ft(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),ql=Ft(/^html$/i),op=Ft(/^[a-z][.\w]*(-[.\w]+)+$/i);var ko=Object.freeze({__proto__:null,ARIA_ATTR:ip,ATTR_WHITESPACE:ap,CUSTOM_ELEMENT:op,DATA_ATTR:rp,DOCTYPE_NAME:ql,ERB_EXPR:ep,IS_ALLOWED_URI:Xl,IS_SCRIPT_OR_DATA:np,MUSTACHE_EXPR:tp,TMPLIT_EXPR:sp});const _s={element:1,text:3,progressingInstruction:7,comment:8,document:9},lp=function(){return typeof window>"u"?null:window},hp=function(t,e){if(typeof t!="object"||typeof t.createPolicy!="function")return null;let r=null;const i="data-tt-policy-suffix";e&&e.hasAttribute(i)&&(r=e.getAttribute(i));const n="dompurify"+(r?"#"+r:"");try{return t.createPolicy(n,{createHTML(a){return a},createScriptURL(a){return a}})}catch{return console.warn("TrustedTypes policy "+n+" could not be created."),null}},vo=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}};function Zl(){let s=arguments.length>0&&arguments[0]!==void 0?arguments[0]:lp();const t=L=>Zl(L);if(t.version="3.3.3",t.removed=[],!s||!s.document||s.document.nodeType!==_s.document||!s.Element)return t.isSupported=!1,t;let{document:e}=s;const r=e,i=r.currentScript,{DocumentFragment:n,HTMLTemplateElement:a,Node:o,Element:l,NodeFilter:h,NamedNodeMap:c=s.NamedNodeMap||s.MozNamedAttrMap,HTMLFormElement:u,DOMParser:f,trustedTypes:d}=s,p=l.prototype,g=ys(p,"cloneNode"),m=ys(p,"remove"),y=ys(p,"nextSibling"),b=ys(p,"childNodes"),_=ys(p,"parentNode");if(typeof a=="function"){const L=e.createElement("template");L.content&&L.content.ownerDocument&&(e=L.content.ownerDocument)}let w,T="";const{implementation:k,createNodeIterator:v,createDocumentFragment:F,getElementsByTagName:G}=e,{importNode:M}=r;let C=vo();t.isSupported=typeof Wl=="function"&&typeof _=="function"&&k&&k.createHTMLDocument!==void 0;const{MUSTACHE_EXPR:W,ERB_EXPR:Z,TMPLIT_EXPR:Q,DATA_ATTR:fe,ARIA_ATTR:R,IS_SCRIPT_OR_DATA:O,ATTR_WHITESPACE:pe,CUSTOM_ELEMENT:V}=ko;let{IS_ALLOWED_URI:zt}=ko,rt=null;const me=$({},[...yo,...wi,...ki,...vi,..._o]);let nt=null;const rs=$({},[...bo,...Si,...wo,...ur]);let et=Object.seal(gr(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),$t=null,Se=null;const Ut=Object.seal(gr(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let Ae=!0,ge=!0,Fe=!1,Xt=!0,Ct=!1,Nt=!0,_t=!1,is=!1,Ge=!1,xe=!1,ns=!1,Ws=!1,En=!0,Rn=!1;const uh="user-content-";let Br=!0,as=!1,ze={},qt=null;const Fr=$({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","style","svg","template","thead","title","video","xmp"]);let In=null;const Dn=$({},["audio","video","img","source","image","track"]);let Gr=null;const Ln=$({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Xs="http://www.w3.org/1998/Math/MathML",qs="http://www.w3.org/2000/svg",re="http://www.w3.org/1999/xhtml";let $e=re,zr=!1,$r=null;const dh=$({},[Xs,qs,re],_i);let Zs=$({},["mi","mo","mn","ms","mtext"]),Qs=$({},["annotation-xml"]);const fh=$({},["title","style","font","a","script"]);let os=null;const ph=["application/xhtml+xml","text/html"],mh="text/html";let ut=null,Ue=null;const gh=e.createElement("form"),On=function(x){return x instanceof RegExp||x instanceof Function},Ur=function(){let x=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(!(Ue&&Ue===x)){if((!x||typeof x!="object")&&(x={}),x=Jt(x),os=ph.indexOf(x.PARSER_MEDIA_TYPE)===-1?mh:x.PARSER_MEDIA_TYPE,ut=os==="application/xhtml+xml"?_i:xr,rt=It(x,"ALLOWED_TAGS")?$({},x.ALLOWED_TAGS,ut):me,nt=It(x,"ALLOWED_ATTR")?$({},x.ALLOWED_ATTR,ut):rs,$r=It(x,"ALLOWED_NAMESPACES")?$({},x.ALLOWED_NAMESPACES,_i):dh,Gr=It(x,"ADD_URI_SAFE_ATTR")?$(Jt(Ln),x.ADD_URI_SAFE_ATTR,ut):Ln,In=It(x,"ADD_DATA_URI_TAGS")?$(Jt(Dn),x.ADD_DATA_URI_TAGS,ut):Dn,qt=It(x,"FORBID_CONTENTS")?$({},x.FORBID_CONTENTS,ut):Fr,$t=It(x,"FORBID_TAGS")?$({},x.FORBID_TAGS,ut):Jt({}),Se=It(x,"FORBID_ATTR")?$({},x.FORBID_ATTR,ut):Jt({}),ze=It(x,"USE_PROFILES")?x.USE_PROFILES:!1,Ae=x.ALLOW_ARIA_ATTR!==!1,ge=x.ALLOW_DATA_ATTR!==!1,Fe=x.ALLOW_UNKNOWN_PROTOCOLS||!1,Xt=x.ALLOW_SELF_CLOSE_IN_ATTR!==!1,Ct=x.SAFE_FOR_TEMPLATES||!1,Nt=x.SAFE_FOR_XML!==!1,_t=x.WHOLE_DOCUMENT||!1,xe=x.RETURN_DOM||!1,ns=x.RETURN_DOM_FRAGMENT||!1,Ws=x.RETURN_TRUSTED_TYPE||!1,Ge=x.FORCE_BODY||!1,En=x.SANITIZE_DOM!==!1,Rn=x.SANITIZE_NAMED_PROPS||!1,Br=x.KEEP_CONTENT!==!1,as=x.IN_PLACE||!1,zt=x.ALLOWED_URI_REGEXP||Xl,$e=x.NAMESPACE||re,Zs=x.MATHML_TEXT_INTEGRATION_POINTS||Zs,Qs=x.HTML_INTEGRATION_POINTS||Qs,et=x.CUSTOM_ELEMENT_HANDLING||{},x.CUSTOM_ELEMENT_HANDLING&&On(x.CUSTOM_ELEMENT_HANDLING.tagNameCheck)&&(et.tagNameCheck=x.CUSTOM_ELEMENT_HANDLING.tagNameCheck),x.CUSTOM_ELEMENT_HANDLING&&On(x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)&&(et.attributeNameCheck=x.CUSTOM_ELEMENT_HANDLING.attributeNameCheck),x.CUSTOM_ELEMENT_HANDLING&&typeof x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements=="boolean"&&(et.allowCustomizedBuiltInElements=x.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements),Ct&&(ge=!1),ns&&(xe=!0),ze&&(rt=$({},_o),nt=gr(null),ze.html===!0&&($(rt,yo),$(nt,bo)),ze.svg===!0&&($(rt,wi),$(nt,Si),$(nt,ur)),ze.svgFilters===!0&&($(rt,ki),$(nt,Si),$(nt,ur)),ze.mathMl===!0&&($(rt,vi),$(nt,wo),$(nt,ur))),It(x,"ADD_TAGS")||(Ut.tagCheck=null),It(x,"ADD_ATTR")||(Ut.attributeCheck=null),x.ADD_TAGS&&(typeof x.ADD_TAGS=="function"?Ut.tagCheck=x.ADD_TAGS:(rt===me&&(rt=Jt(rt)),$(rt,x.ADD_TAGS,ut))),x.ADD_ATTR&&(typeof x.ADD_ATTR=="function"?Ut.attributeCheck=x.ADD_ATTR:(nt===rs&&(nt=Jt(nt)),$(nt,x.ADD_ATTR,ut))),x.ADD_URI_SAFE_ATTR&&$(Gr,x.ADD_URI_SAFE_ATTR,ut),x.FORBID_CONTENTS&&(qt===Fr&&(qt=Jt(qt)),$(qt,x.FORBID_CONTENTS,ut)),x.ADD_FORBID_CONTENTS&&(qt===Fr&&(qt=Jt(qt)),$(qt,x.ADD_FORBID_CONTENTS,ut)),Br&&(rt["#text"]=!0),_t&&$(rt,["html","head","body"]),rt.table&&($(rt,["tbody"]),delete $t.tbody),x.TRUSTED_TYPES_POLICY){if(typeof x.TRUSTED_TYPES_POLICY.createHTML!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if(typeof x.TRUSTED_TYPES_POLICY.createScriptURL!="function")throw xs('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');w=x.TRUSTED_TYPES_POLICY,T=w.createHTML("")}else w===void 0&&(w=hp(d,i)),w!==null&&typeof T=="string"&&(T=w.createHTML(""));At&&At(x),Ue=x}},Nn=$({},[...wi,...ki,...Kf]),Bn=$({},[...vi,...Jf]),xh=function(x){let A=_(x);(!A||!A.tagName)&&(A={namespaceURI:$e,tagName:"template"});const I=xr(x.tagName),it=xr(A.tagName);return $r[x.namespaceURI]?x.namespaceURI===qs?A.namespaceURI===re?I==="svg":A.namespaceURI===Xs?I==="svg"&&(it==="annotation-xml"||Zs[it]):!!Nn[I]:x.namespaceURI===Xs?A.namespaceURI===re?I==="math":A.namespaceURI===qs?I==="math"&&Qs[it]:!!Bn[I]:x.namespaceURI===re?A.namespaceURI===qs&&!Qs[it]||A.namespaceURI===Xs&&!Zs[it]?!1:!Bn[I]&&(fh[I]||!Nn[I]):!!(os==="application/xhtml+xml"&&$r[x.namespaceURI]):!1},Zt=function(x){ms(t.removed,{element:x});try{_(x).removeChild(x)}catch{m(x)}},Te=function(x,A){try{ms(t.removed,{attribute:A.getAttributeNode(x),from:A})}catch{ms(t.removed,{attribute:null,from:A})}if(A.removeAttribute(x),x==="is")if(xe||ns)try{Zt(A)}catch{}else try{A.setAttribute(x,"")}catch{}},Fn=function(x){let A=null,I=null;if(Ge)x="<remove></remove>"+x;else{const lt=bi(x,/^[\r\n\t ]+/);I=lt&<[0]}os==="application/xhtml+xml"&&$e===re&&(x='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+x+"</body></html>");const it=w?w.createHTML(x):x;if($e===re)try{A=new f().parseFromString(it,os)}catch{}if(!A||!A.documentElement){A=k.createDocument($e,"template",null);try{A.documentElement.innerHTML=zr?T:it}catch{}}const mt=A.body||A.documentElement;return x&&I&&mt.insertBefore(e.createTextNode(I),mt.childNodes[0]||null),$e===re?G.call(A,_t?"html":"body")[0]:_t?A.documentElement:mt},Gn=function(x){return v.call(x.ownerDocument||x,x,h.SHOW_ELEMENT|h.SHOW_COMMENT|h.SHOW_TEXT|h.SHOW_PROCESSING_INSTRUCTION|h.SHOW_CDATA_SECTION,null)},Hr=function(x){return x instanceof u&&(typeof x.nodeName!="string"||typeof x.textContent!="string"||typeof x.removeChild!="function"||!(x.attributes instanceof c)||typeof x.removeAttribute!="function"||typeof x.setAttribute!="function"||typeof x.namespaceURI!="string"||typeof x.insertBefore!="function"||typeof x.hasChildNodes!="function")},zn=function(x){return typeof o=="function"&&x instanceof o};function ie(L,x,A){cr(L,I=>{I.call(t,x,A,Ue)})}const $n=function(x){let A=null;if(ie(C.beforeSanitizeElements,x,null),Hr(x))return Zt(x),!0;const I=ut(x.nodeName);if(ie(C.uponSanitizeElement,x,{tagName:I,allowedTags:rt}),Nt&&x.hasChildNodes()&&!zn(x.firstElementChild)&&bt(/<[/\w!]/g,x.innerHTML)&&bt(/<[/\w!]/g,x.textContent)||x.nodeType===_s.progressingInstruction||Nt&&x.nodeType===_s.comment&&bt(/<[/\w]/g,x.data))return Zt(x),!0;if(!(Ut.tagCheck instanceof Function&&Ut.tagCheck(I))&&(!rt[I]||$t[I])){if(!$t[I]&&Hn(I)&&(et.tagNameCheck instanceof RegExp&&bt(et.tagNameCheck,I)||et.tagNameCheck instanceof Function&&et.tagNameCheck(I)))return!1;if(Br&&!qt[I]){const it=_(x)||x.parentNode,mt=b(x)||x.childNodes;if(mt&&it){const lt=mt.length;for(let Mt=lt-1;Mt>=0;--Mt){const ne=g(mt[Mt],!0);ne.__removalCount=(x.__removalCount||0)+1,it.insertBefore(ne,y(x))}}}return Zt(x),!0}return x instanceof l&&!xh(x)||(I==="noscript"||I==="noembed"||I==="noframes")&&bt(/<\/no(script|embed|frames)/i,x.innerHTML)?(Zt(x),!0):(Ct&&x.nodeType===_s.text&&(A=x.textContent,cr([W,Z,Q],it=>{A=gs(A,it," ")}),x.textContent!==A&&(ms(t.removed,{element:x.cloneNode()}),x.textContent=A)),ie(C.afterSanitizeElements,x,null),!1)},Un=function(x,A,I){if(Se[A]||En&&(A==="id"||A==="name")&&(I in e||I in gh))return!1;if(!(ge&&!Se[A]&&bt(fe,A))){if(!(Ae&&bt(R,A))){if(!(Ut.attributeCheck instanceof Function&&Ut.attributeCheck(A,x))){if(!nt[A]||Se[A]){if(!(Hn(x)&&(et.tagNameCheck instanceof RegExp&&bt(et.tagNameCheck,x)||et.tagNameCheck instanceof Function&&et.tagNameCheck(x))&&(et.attributeNameCheck instanceof RegExp&&bt(et.attributeNameCheck,A)||et.attributeNameCheck instanceof Function&&et.attributeNameCheck(A,x))||A==="is"&&et.allowCustomizedBuiltInElements&&(et.tagNameCheck instanceof RegExp&&bt(et.tagNameCheck,I)||et.tagNameCheck instanceof Function&&et.tagNameCheck(I))))return!1}else if(!Gr[A]){if(!bt(zt,gs(I,pe,""))){if(!((A==="src"||A==="xlink:href"||A==="href")&&x!=="script"&&Xf(I,"data:")===0&&In[x])){if(!(Fe&&!bt(O,gs(I,pe,"")))){if(I)return!1}}}}}}}return!0},Hn=function(x){return x!=="annotation-xml"&&bi(x,V)},jn=function(x){ie(C.beforeSanitizeAttributes,x,null);const{attributes:A}=x;if(!A||Hr(x))return;const I={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:nt,forceKeepAttr:void 0};let it=A.length;for(;it--;){const mt=A[it],{name:lt,namespaceURI:Mt,value:ne}=mt,He=ut(lt),jr=ne;let pt=lt==="value"?jr:qf(jr);if(I.attrName=He,I.attrValue=pt,I.keepAttr=!0,I.forceKeepAttr=void 0,ie(C.uponSanitizeAttribute,x,I),pt=I.attrValue,Rn&&(He==="id"||He==="name")&&(Te(lt,x),pt=uh+pt),Nt&&bt(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,pt)){Te(lt,x);continue}if(He==="attributename"&&bi(pt,"href")){Te(lt,x);continue}if(I.forceKeepAttr)continue;if(!I.keepAttr){Te(lt,x);continue}if(!Xt&&bt(/\/>/i,pt)){Te(lt,x);continue}Ct&&cr([W,Z,Q],Yn=>{pt=gs(pt,Yn," ")});const Vn=ut(x.nodeName);if(!Un(Vn,He,pt)){Te(lt,x);continue}if(w&&typeof d=="object"&&typeof d.getAttributeType=="function"&&!Mt)switch(d.getAttributeType(Vn,He)){case"TrustedHTML":{pt=w.createHTML(pt);break}case"TrustedScriptURL":{pt=w.createScriptURL(pt);break}}if(pt!==jr)try{Mt?x.setAttributeNS(Mt,lt,pt):x.setAttribute(lt,pt),Hr(x)?Zt(x):xo(t.removed)}catch{Te(lt,x)}}ie(C.afterSanitizeAttributes,x,null)},yh=function L(x){let A=null;const I=Gn(x);for(ie(C.beforeSanitizeShadowDOM,x,null);A=I.nextNode();)ie(C.uponSanitizeShadowNode,A,null),$n(A),jn(A),A.content instanceof n&&L(A.content);ie(C.afterSanitizeShadowDOM,x,null)};return t.sanitize=function(L){let x=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},A=null,I=null,it=null,mt=null;if(zr=!L,zr&&(L="<!-->"),typeof L!="string"&&!zn(L))if(typeof L.toString=="function"){if(L=L.toString(),typeof L!="string")throw xs("dirty is not a string, aborting")}else throw xs("toString is not a function");if(!t.isSupported)return L;if(is||Ur(x),t.removed=[],typeof L=="string"&&(as=!1),as){if(L.nodeName){const ne=ut(L.nodeName);if(!rt[ne]||$t[ne])throw xs("root node is forbidden and cannot be sanitized in-place")}}else if(L instanceof o)A=Fn("<!---->"),I=A.ownerDocument.importNode(L,!0),I.nodeType===_s.element&&I.nodeName==="BODY"||I.nodeName==="HTML"?A=I:A.appendChild(I);else{if(!xe&&!Ct&&!_t&&L.indexOf("<")===-1)return w&&Ws?w.createHTML(L):L;if(A=Fn(L),!A)return xe?null:Ws?T:""}A&&Ge&&Zt(A.firstChild);const lt=Gn(as?L:A);for(;it=lt.nextNode();)$n(it),jn(it),it.content instanceof n&&yh(it.content);if(as)return L;if(xe){if(ns)for(mt=F.call(A.ownerDocument);A.firstChild;)mt.appendChild(A.firstChild);else mt=A;return(nt.shadowroot||nt.shadowrootmode)&&(mt=M.call(r,mt,!0)),mt}let Mt=_t?A.outerHTML:A.innerHTML;return _t&&rt["!doctype"]&&A.ownerDocument&&A.ownerDocument.doctype&&A.ownerDocument.doctype.name&&bt(ql,A.ownerDocument.doctype.name)&&(Mt="<!DOCTYPE "+A.ownerDocument.doctype.name+`>
|
|
240
|
+
`+Mt),Ct&&cr([W,Z,Q],ne=>{Mt=gs(Mt,ne," ")}),w&&Ws?w.createHTML(Mt):Mt},t.setConfig=function(){let L=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};Ur(L),is=!0},t.clearConfig=function(){Ue=null,is=!1},t.isValidAttribute=function(L,x,A){Ue||Ur({});const I=ut(L),it=ut(x);return Un(I,it,A)},t.addHook=function(L,x){typeof x=="function"&&ms(C[L],x)},t.removeHook=function(L,x){if(x!==void 0){const A=Yf(C[L],x);return A===-1?void 0:Wf(C[L],A,1)[0]}return xo(C[L])},t.removeHooks=function(L){C[L]=[]},t.removeAllHooks=function(){C=vo()},t}Zl();function wn(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var Be=wn();function Ql(s){Be=s}var De={exec:()=>null};function j(s,t=""){let e=typeof s=="string"?s:s.source,r={replace:(i,n)=>{let a=typeof n=="string"?n:n.source;return a=a.replace(vt.caret,"$1"),e=e.replace(i,a),r},getRegex:()=>new RegExp(e,t)};return r}var cp=(()=>{try{return!!new RegExp("(?<=1)(?<!1)")}catch{return!1}})(),vt={codeRemoveIndent:/^(?: {1,4}| {0,3}\t)/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:s=>new RegExp(`^( {0,3}${s})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`),hrRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}((?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$)`),fencesBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}(?:\`\`\`|~~~)`),headingBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}#`),htmlBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}<(?:[a-z].*>|!--)`,"i"),blockquoteBeginRegex:s=>new RegExp(`^ {0,${Math.min(3,s-1)}}>`)},up=/^(?:[ \t]*(?:\n|$))+/,dp=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,fp=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,Ys=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,pp=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,kn=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,Kl=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,Jl=j(Kl).replace(/bull/g,kn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,"").getRegex(),mp=j(Kl).replace(/bull/g,kn).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),vn=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,gp=/^[^\n]+/,Sn=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,xp=j(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace("label",Sn).replace("title",/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),yp=j(/^(bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,kn).getRegex(),Or="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",An=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,_p=j("^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))","i").replace("comment",An).replace("tag",Or).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),th=j(vn).replace("hr",Ys).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("|table","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Or).getRegex(),bp=j(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace("paragraph",th).getRegex(),Tn={blockquote:bp,code:dp,def:xp,fences:fp,heading:pp,hr:Ys,html:_p,lheading:Jl,list:yp,newline:up,paragraph:th,table:De,text:gp},So=j("^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)").replace("hr",Ys).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("blockquote"," {0,3}>").replace("code","(?: {4}| {0,3} )[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Or).getRegex(),wp={...Tn,lheading:mp,table:So,paragraph:j(vn).replace("hr",Ys).replace("heading"," {0,3}#{1,6}(?:\\s|$)").replace("|lheading","").replace("table",So).replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)])[ \\t]").replace("html","</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)").replace("tag",Or).getRegex()},kp={...Tn,html:j(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace("comment",An).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:De,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:j(vn).replace("hr",Ys).replace("heading",` *#{1,6} *[^
|
|
241
|
+
]`).replace("lheading",Jl).replace("|table","").replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").replace("|tag","").getRegex()},vp=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,Sp=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,eh=/^( {2,}|\\)\n(?!\s*$)/,Ap=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,ss=/[\p{P}\p{S}]/u,Nr=/[\s\p{P}\p{S}]/u,Cn=/[^\s\p{P}\p{S}]/u,Tp=j(/^((?![*_])punctSpace)/,"u").replace(/punctSpace/g,Nr).getRegex(),sh=/(?!~)[\p{P}\p{S}]/u,Cp=/(?!~)[\s\p{P}\p{S}]/u,Mp=/(?:[^\s\p{P}\p{S}]|~)/u,Pp=j(/link|precode-code|html/,"g").replace("link",/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace("precode-",cp?"(?<!`)()":"(^^|[^`])").replace("code",/(?<b>`+)[^`]+\k<b>(?!`)/).replace("html",/<(?! )[^<>]*?>/).getRegex(),rh=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,Ep=j(rh,"u").replace(/punct/g,ss).getRegex(),Rp=j(rh,"u").replace(/punct/g,sh).getRegex(),ih="^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)",Ip=j(ih,"gu").replace(/notPunctSpace/g,Cn).replace(/punctSpace/g,Nr).replace(/punct/g,ss).getRegex(),Dp=j(ih,"gu").replace(/notPunctSpace/g,Mp).replace(/punctSpace/g,Cp).replace(/punct/g,sh).getRegex(),Lp=j("^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)","gu").replace(/notPunctSpace/g,Cn).replace(/punctSpace/g,Nr).replace(/punct/g,ss).getRegex(),Op=j(/^~~?(?:((?!~)punct)|[^\s~])/,"u").replace(/punct/g,ss).getRegex(),Np="^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)",Bp=j(Np,"gu").replace(/notPunctSpace/g,Cn).replace(/punctSpace/g,Nr).replace(/punct/g,ss).getRegex(),Fp=j(/\\(punct)/,"gu").replace(/punct/g,ss).getRegex(),Gp=j(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace("scheme",/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace("email",/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),zp=j(An).replace("(?:-->|$)","-->").getRegex(),$p=j("^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>").replace("comment",zp).replace("attribute",/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Cr=/(?:\[(?:\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/,Up=j(/^!?\[(label)\]\(\s*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?\s*\)/).replace("label",Cr).replace("href",/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]*/).replace("title",/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),nh=j(/^!?\[(label)\]\[(ref)\]/).replace("label",Cr).replace("ref",Sn).getRegex(),ah=j(/^!?\[(ref)\](?:\[\])?/).replace("ref",Sn).getRegex(),Hp=j("reflink|nolink(?!\\()","g").replace("reflink",nh).replace("nolink",ah).getRegex(),Ao=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Mn={_backpedal:De,anyPunctuation:Fp,autolink:Gp,blockSkip:Pp,br:eh,code:Sp,del:De,delLDelim:De,delRDelim:De,emStrongLDelim:Ep,emStrongRDelimAst:Ip,emStrongRDelimUnd:Lp,escape:vp,link:Up,nolink:ah,punctuation:Tp,reflink:nh,reflinkSearch:Hp,tag:$p,text:Ap,url:De},jp={...Mn,link:j(/^!?\[(label)\]\((.*?)\)/).replace("label",Cr).getRegex(),reflink:j(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",Cr).getRegex()},Ji={...Mn,emStrongRDelimAst:Dp,emStrongLDelim:Rp,delLDelim:Op,delRDelim:Bp,url:j(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace("protocol",Ao).replace("email",/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:j(/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/).replace("protocol",Ao).getRegex()},Vp={...Ji,br:j(eh).replace("{2,}","*").getRegex(),text:j(Ji.text).replace("\\b_","\\b_| {2,}\\n").replace(/\{2,\}/g,"*").getRegex()},dr={normal:Tn,gfm:wp,pedantic:kp},bs={normal:Mn,gfm:Ji,breaks:Vp,pedantic:jp},Yp={"&":"&","<":"<",">":">",'"':""","'":"'"},To=s=>Yp[s];function te(s,t){if(t){if(vt.escapeTest.test(s))return s.replace(vt.escapeReplace,To)}else if(vt.escapeTestNoEncode.test(s))return s.replace(vt.escapeReplaceNoEncode,To);return s}function Co(s){try{s=encodeURI(s).replace(vt.percentDecode,"%")}catch{return null}return s}function Mo(s,t){var n;let e=s.replace(vt.findPipe,(a,o,l)=>{let h=!1,c=o;for(;--c>=0&&l[c]==="\\";)h=!h;return h?"|":" |"}),r=e.split(vt.splitPipe),i=0;if(r[0].trim()||r.shift(),r.length>0&&!((n=r.at(-1))!=null&&n.trim())&&r.pop(),t)if(r.length>t)r.splice(t);else for(;r.length<t;)r.push("");for(;i<r.length;i++)r[i]=r[i].trim().replace(vt.slashPipe,"|");return r}function ws(s,t,e){let r=s.length;if(r===0)return"";let i=0;for(;i<r&&s.charAt(r-i-1)===t;)i++;return s.slice(0,r-i)}function Wp(s,t){if(s.indexOf(t[1])===-1)return-1;let e=0;for(let r=0;r<s.length;r++)if(s[r]==="\\")r++;else if(s[r]===t[0])e++;else if(s[r]===t[1]&&(e--,e<0))return r;return e>0?-2:-1}function Xp(s,t=0){let e=t,r="";for(let i of s)if(i===" "){let n=4-e%4;r+=" ".repeat(n),e+=n}else r+=i,e++;return r}function Po(s,t,e,r,i){let n=t.href,a=t.title||null,o=s[1].replace(i.other.outputLinkReplace,"$1");r.state.inLink=!0;let l={type:s[0].charAt(0)==="!"?"image":"link",raw:e,href:n,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,l}function qp(s,t,e){let r=s.match(e.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
242
|
+
`).map(n=>{let a=n.match(e.other.beginningSpace);if(a===null)return n;let[o]=a;return o.length>=i.length?n.slice(i.length):n}).join(`
|
|
243
|
+
`)}var Mr=class{constructor(s){q(this,"options");q(this,"rules");q(this,"lexer");this.options=s||Be}space(s){let t=this.rules.block.newline.exec(s);if(t&&t[0].length>0)return{type:"space",raw:t[0]}}code(s){let t=this.rules.block.code.exec(s);if(t){let e=t[0].replace(this.rules.other.codeRemoveIndent,"");return{type:"code",raw:t[0],codeBlockStyle:"indented",text:this.options.pedantic?e:ws(e,`
|
|
244
|
+
`)}}}fences(s){let t=this.rules.block.fences.exec(s);if(t){let e=t[0],r=qp(e,t[3]||"",this.rules);return{type:"code",raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,"$1"):t[2],text:r}}}heading(s){let t=this.rules.block.heading.exec(s);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let r=ws(e,"#");(this.options.pedantic||!r||this.rules.other.endingSpaceChar.test(r))&&(e=r.trim())}return{type:"heading",raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(s){let t=this.rules.block.hr.exec(s);if(t)return{type:"hr",raw:ws(t[0],`
|
|
245
|
+
`)}}blockquote(s){let t=this.rules.block.blockquote.exec(s);if(t){let e=ws(t[0],`
|
|
246
|
+
`).split(`
|
|
247
|
+
`),r="",i="",n=[];for(;e.length>0;){let a=!1,o=[],l;for(l=0;l<e.length;l++)if(this.rules.other.blockquoteStart.test(e[l]))o.push(e[l]),a=!0;else if(!a)o.push(e[l]);else break;e=e.slice(l);let h=o.join(`
|
|
248
|
+
`),c=h.replace(this.rules.other.blockquoteSetextReplace,`
|
|
249
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,"");r=r?`${r}
|
|
250
|
+
${h}`:h,i=i?`${i}
|
|
251
|
+
${c}`:c;let u=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,n,!0),this.lexer.state.top=u,e.length===0)break;let f=n.at(-1);if((f==null?void 0:f.type)==="code")break;if((f==null?void 0:f.type)==="blockquote"){let d=f,p=d.raw+`
|
|
252
|
+
`+e.join(`
|
|
253
|
+
`),g=this.blockquote(p);n[n.length-1]=g,r=r.substring(0,r.length-d.raw.length)+g.raw,i=i.substring(0,i.length-d.text.length)+g.text;break}else if((f==null?void 0:f.type)==="list"){let d=f,p=d.raw+`
|
|
254
|
+
`+e.join(`
|
|
255
|
+
`),g=this.list(p);n[n.length-1]=g,r=r.substring(0,r.length-f.raw.length)+g.raw,i=i.substring(0,i.length-d.raw.length)+g.raw,e=p.substring(n.at(-1).raw.length).split(`
|
|
256
|
+
`);continue}}return{type:"blockquote",raw:r,tokens:n,text:i}}}list(s){var e,r;let t=this.rules.block.list.exec(s);if(t){let i=t[1].trim(),n=i.length>1,a={type:"list",raw:"",ordered:n,start:n?+i.slice(0,-1):"",loose:!1,items:[]};i=n?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=n?i:"[*+-]");let o=this.rules.other.listItemRegex(i),l=!1;for(;s;){let c=!1,u="",f="";if(!(t=o.exec(s))||this.rules.block.hr.test(s))break;u=t[0],s=s.substring(u.length);let d=Xp(t[2].split(`
|
|
257
|
+
`,1)[0],t[1].length),p=s.split(`
|
|
258
|
+
`,1)[0],g=!d.trim(),m=0;if(this.options.pedantic?(m=2,f=d.trimStart()):g?m=t[1].length+1:(m=d.search(this.rules.other.nonSpaceChar),m=m>4?1:m,f=d.slice(m),m+=t[1].length),g&&this.rules.other.blankLine.test(p)&&(u+=p+`
|
|
259
|
+
`,s=s.substring(p.length+1),c=!0),!c){let y=this.rules.other.nextBulletRegex(m),b=this.rules.other.hrRegex(m),_=this.rules.other.fencesBeginRegex(m),w=this.rules.other.headingBeginRegex(m),T=this.rules.other.htmlBeginRegex(m),k=this.rules.other.blockquoteBeginRegex(m);for(;s;){let v=s.split(`
|
|
260
|
+
`,1)[0],F;if(p=v,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting," "),F=p):F=p.replace(this.rules.other.tabCharGlobal," "),_.test(p)||w.test(p)||T.test(p)||k.test(p)||y.test(p)||b.test(p))break;if(F.search(this.rules.other.nonSpaceChar)>=m||!p.trim())f+=`
|
|
261
|
+
`+F.slice(m);else{if(g||d.replace(this.rules.other.tabCharGlobal," ").search(this.rules.other.nonSpaceChar)>=4||_.test(d)||w.test(d)||b.test(d))break;f+=`
|
|
262
|
+
`+p}g=!p.trim(),u+=v+`
|
|
263
|
+
`,s=s.substring(v.length+1),d=F.slice(m)}}a.loose||(l?a.loose=!0:this.rules.other.doubleBlankLine.test(u)&&(l=!0)),a.items.push({type:"list_item",raw:u,task:!!this.options.gfm&&this.rules.other.listIsTask.test(f),loose:!1,text:f,tokens:[]}),a.raw+=u}let h=a.items.at(-1);if(h)h.raw=h.raw.trimEnd(),h.text=h.text.trimEnd();else return;a.raw=a.raw.trimEnd();for(let c of a.items){if(this.lexer.state.top=!1,c.tokens=this.lexer.blockTokens(c.text,[]),c.task){if(c.text=c.text.replace(this.rules.other.listReplaceTask,""),((e=c.tokens[0])==null?void 0:e.type)==="text"||((r=c.tokens[0])==null?void 0:r.type)==="paragraph"){c.tokens[0].raw=c.tokens[0].raw.replace(this.rules.other.listReplaceTask,""),c.tokens[0].text=c.tokens[0].text.replace(this.rules.other.listReplaceTask,"");for(let f=this.lexer.inlineQueue.length-1;f>=0;f--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[f].src)){this.lexer.inlineQueue[f].src=this.lexer.inlineQueue[f].src.replace(this.rules.other.listReplaceTask,"");break}}let u=this.rules.other.listTaskCheckbox.exec(c.raw);if(u){let f={type:"checkbox",raw:u[0]+" ",checked:u[0]!=="[ ]"};c.checked=f.checked,a.loose?c.tokens[0]&&["paragraph","text"].includes(c.tokens[0].type)&&"tokens"in c.tokens[0]&&c.tokens[0].tokens?(c.tokens[0].raw=f.raw+c.tokens[0].raw,c.tokens[0].text=f.raw+c.tokens[0].text,c.tokens[0].tokens.unshift(f)):c.tokens.unshift({type:"paragraph",raw:f.raw,text:f.raw,tokens:[f]}):c.tokens.unshift(f)}}if(!a.loose){let u=c.tokens.filter(d=>d.type==="space"),f=u.length>0&&u.some(d=>this.rules.other.anyLine.test(d.raw));a.loose=f}}if(a.loose)for(let c of a.items){c.loose=!0;for(let u of c.tokens)u.type==="text"&&(u.type="paragraph")}return a}}html(s){let t=this.rules.block.html.exec(s);if(t)return{type:"html",block:!0,raw:t[0],pre:t[1]==="pre"||t[1]==="script"||t[1]==="style",text:t[0]}}def(s){let t=this.rules.block.def.exec(s);if(t){let e=t[1].toLowerCase().replace(this.rules.other.multipleSpaceGlobal," "),r=t[2]?t[2].replace(this.rules.other.hrefBrackets,"$1").replace(this.rules.inline.anyPunctuation,"$1"):"",i=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,"$1"):t[3];return{type:"def",tag:e,raw:t[0],href:r,title:i}}}table(s){var a;let t=this.rules.block.table.exec(s);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let e=Mo(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,"").split("|"),i=(a=t[3])!=null&&a.trim()?t[3].replace(this.rules.other.tableRowBlankLine,"").split(`
|
|
264
|
+
`):[],n={type:"table",raw:t[0],header:[],align:[],rows:[]};if(e.length===r.length){for(let o of r)this.rules.other.tableAlignRight.test(o)?n.align.push("right"):this.rules.other.tableAlignCenter.test(o)?n.align.push("center"):this.rules.other.tableAlignLeft.test(o)?n.align.push("left"):n.align.push(null);for(let o=0;o<e.length;o++)n.header.push({text:e[o],tokens:this.lexer.inline(e[o]),header:!0,align:n.align[o]});for(let o of i)n.rows.push(Mo(o,n.header.length).map((l,h)=>({text:l,tokens:this.lexer.inline(l),header:!1,align:n.align[h]})));return n}}lheading(s){let t=this.rules.block.lheading.exec(s);if(t){let e=t[1].trim();return{type:"heading",raw:t[0],depth:t[2].charAt(0)==="="?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(s){let t=this.rules.block.paragraph.exec(s);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
265
|
+
`?t[1].slice(0,-1):t[1];return{type:"paragraph",raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(s){let t=this.rules.block.text.exec(s);if(t)return{type:"text",raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(s){let t=this.rules.inline.escape.exec(s);if(t)return{type:"escape",raw:t[0],text:t[1]}}tag(s){let t=this.rules.inline.tag.exec(s);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:"html",raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(s){let t=this.rules.inline.link.exec(s);if(t){let e=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(e)){if(!this.rules.other.endAngleBracket.test(e))return;let n=ws(e.slice(0,-1),"\\");if((e.length-n.length)%2===0)return}else{let n=Wp(t[2],"()");if(n===-2)return;if(n>-1){let a=(t[0].indexOf("!")===0?5:4)+t[1].length+n;t[2]=t[2].substring(0,n),t[0]=t[0].substring(0,a).trim(),t[3]=""}}let r=t[2],i="";if(this.options.pedantic){let n=this.rules.other.pedanticHrefTitle.exec(r);n&&(r=n[1],i=n[3])}else i=t[3]?t[3].slice(1,-1):"";return r=r.trim(),this.rules.other.startAngleBracket.test(r)&&(this.options.pedantic&&!this.rules.other.endAngleBracket.test(e)?r=r.slice(1):r=r.slice(1,-1)),Po(t,{href:r&&r.replace(this.rules.inline.anyPunctuation,"$1"),title:i&&i.replace(this.rules.inline.anyPunctuation,"$1")},t[0],this.lexer,this.rules)}}reflink(s,t){let e;if((e=this.rules.inline.reflink.exec(s))||(e=this.rules.inline.nolink.exec(s))){let r=(e[2]||e[1]).replace(this.rules.other.multipleSpaceGlobal," "),i=t[r.toLowerCase()];if(!i){let n=e[0].charAt(0);return{type:"text",raw:n,text:n}}return Po(e,i,e[0],this.lexer,this.rules)}}emStrong(s,t,e=""){let r=this.rules.inline.emStrongLDelim.exec(s);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&e.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,n,a,o=i,l=0,h=r[0][0]==="*"?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(h.lastIndex=0,t=t.slice(-1*s.length+i);(r=h.exec(t))!==null;){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n)continue;if(a=[...n].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&i%3&&!((i+a)%3)){l+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+l);let c=[...r[0]][0].length,u=s.slice(0,i+r.index+c+a);if(Math.min(i,a)%2){let d=u.slice(1,-1);return{type:"em",raw:u,text:d,tokens:this.lexer.inlineTokens(d)}}let f=u.slice(2,-2);return{type:"strong",raw:u,text:f,tokens:this.lexer.inlineTokens(f)}}}}codespan(s){let t=this.rules.inline.code.exec(s);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal," "),r=this.rules.other.nonSpaceChar.test(e),i=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return r&&i&&(e=e.substring(1,e.length-1)),{type:"codespan",raw:t[0],text:e}}}br(s){let t=this.rules.inline.br.exec(s);if(t)return{type:"br",raw:t[0]}}del(s,t,e=""){let r=this.rules.inline.delLDelim.exec(s);if(r&&(!r[1]||!e||this.rules.inline.punctuation.exec(e))){let i=[...r[0]].length-1,n,a,o=i,l=this.rules.inline.delRDelim;for(l.lastIndex=0,t=t.slice(-1*s.length+i);(r=l.exec(t))!==null;){if(n=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!n||(a=[...n].length,a!==i))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let h=[...r[0]][0].length,c=s.slice(0,i+r.index+h+a),u=c.slice(i,-i);return{type:"del",raw:c,text:u,tokens:this.lexer.inlineTokens(u)}}}}autolink(s){let t=this.rules.inline.autolink.exec(s);if(t){let e,r;return t[2]==="@"?(e=t[1],r="mailto:"+e):(e=t[1],r=e),{type:"link",raw:t[0],text:e,href:r,tokens:[{type:"text",raw:e,text:e}]}}}url(s){var e;let t;if(t=this.rules.inline.url.exec(s)){let r,i;if(t[2]==="@")r=t[0],i="mailto:"+r;else{let n;do n=t[0],t[0]=((e=this.rules.inline._backpedal.exec(t[0]))==null?void 0:e[0])??"";while(n!==t[0]);r=t[0],t[1]==="www."?i="http://"+t[0]:i=t[0]}return{type:"link",raw:t[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}}inlineText(s){let t=this.rules.inline.text.exec(s);if(t){let e=this.lexer.state.inRawBlock;return{type:"text",raw:t[0],text:t[0],escaped:e}}}},jt=class tn{constructor(t){q(this,"tokens");q(this,"options");q(this,"state");q(this,"inlineQueue");q(this,"tokenizer");this.tokens=[],this.tokens.links=Object.create(null),this.options=t||Be,this.options.tokenizer=this.options.tokenizer||new Mr,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let e={other:vt,block:dr.normal,inline:bs.normal};this.options.pedantic?(e.block=dr.pedantic,e.inline=bs.pedantic):this.options.gfm&&(e.block=dr.gfm,this.options.breaks?e.inline=bs.breaks:e.inline=bs.gfm),this.tokenizer.rules=e}static get rules(){return{block:dr,inline:bs}}static lex(t,e){return new tn(e).lex(t)}static lexInline(t,e){return new tn(e).inlineTokens(t)}lex(t){t=t.replace(vt.carriageReturn,`
|
|
266
|
+
`),this.blockTokens(t,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let r=this.inlineQueue[e];this.inlineTokens(r.src,r.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(t,e=[],r=!1){var i,n,a;for(this.tokenizer.lexer=this,this.options.pedantic&&(t=t.replace(vt.tabCharGlobal," ").replace(vt.spaceLine,""));t;){let o;if((n=(i=this.options.extensions)==null?void 0:i.block)!=null&&n.some(h=>(o=h.call({lexer:this},t,e))?(t=t.substring(o.raw.length),e.push(o),!0):!1))continue;if(o=this.tokenizer.space(t)){t=t.substring(o.raw.length);let h=e.at(-1);o.raw.length===1&&h!==void 0?h.raw+=`
|
|
267
|
+
`:e.push(o);continue}if(o=this.tokenizer.code(t)){t=t.substring(o.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
268
|
+
`)?"":`
|
|
269
|
+
`)+o.raw,h.text+=`
|
|
270
|
+
`+o.text,this.inlineQueue.at(-1).src=h.text):e.push(o);continue}if(o=this.tokenizer.fences(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.heading(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.hr(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.blockquote(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.list(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.html(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.def(t)){t=t.substring(o.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="paragraph"||(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
271
|
+
`)?"":`
|
|
272
|
+
`)+o.raw,h.text+=`
|
|
273
|
+
`+o.raw,this.inlineQueue.at(-1).src=h.text):this.tokens.links[o.tag]||(this.tokens.links[o.tag]={href:o.href,title:o.title},e.push(o));continue}if(o=this.tokenizer.table(t)){t=t.substring(o.raw.length),e.push(o);continue}if(o=this.tokenizer.lheading(t)){t=t.substring(o.raw.length),e.push(o);continue}let l=t;if((a=this.options.extensions)!=null&&a.startBlock){let h=1/0,c=t.slice(1),u;this.options.extensions.startBlock.forEach(f=>{u=f.call({lexer:this},c),typeof u=="number"&&u>=0&&(h=Math.min(h,u))}),h<1/0&&h>=0&&(l=t.substring(0,h+1))}if(this.state.top&&(o=this.tokenizer.paragraph(l))){let h=e.at(-1);r&&(h==null?void 0:h.type)==="paragraph"?(h.raw+=(h.raw.endsWith(`
|
|
274
|
+
`)?"":`
|
|
275
|
+
`)+o.raw,h.text+=`
|
|
276
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):e.push(o),r=l.length!==t.length,t=t.substring(o.raw.length);continue}if(o=this.tokenizer.text(t)){t=t.substring(o.raw.length);let h=e.at(-1);(h==null?void 0:h.type)==="text"?(h.raw+=(h.raw.endsWith(`
|
|
277
|
+
`)?"":`
|
|
278
|
+
`)+o.raw,h.text+=`
|
|
279
|
+
`+o.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=h.text):e.push(o);continue}if(t){let h="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(h);break}else throw new Error(h)}}return this.state.top=!0,e}inline(t,e=[]){return this.inlineQueue.push({src:t,tokens:e}),e}inlineTokens(t,e=[]){var l,h,c,u,f;this.tokenizer.lexer=this;let r=t,i=null;if(this.tokens.links){let d=Object.keys(this.tokens.links);if(d.length>0)for(;(i=this.tokenizer.rules.inline.reflinkSearch.exec(r))!==null;)d.includes(i[0].slice(i[0].lastIndexOf("[")+1,-1))&&(r=r.slice(0,i.index)+"["+"a".repeat(i[0].length-2)+"]"+r.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(i=this.tokenizer.rules.inline.anyPunctuation.exec(r))!==null;)r=r.slice(0,i.index)+"++"+r.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);let n;for(;(i=this.tokenizer.rules.inline.blockSkip.exec(r))!==null;)n=i[2]?i[2].length:0,r=r.slice(0,i.index+n)+"["+"a".repeat(i[0].length-n-2)+"]"+r.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);r=((h=(l=this.options.hooks)==null?void 0:l.emStrongMask)==null?void 0:h.call({lexer:this},r))??r;let a=!1,o="";for(;t;){a||(o=""),a=!1;let d;if((u=(c=this.options.extensions)==null?void 0:c.inline)!=null&&u.some(g=>(d=g.call({lexer:this},t,e))?(t=t.substring(d.raw.length),e.push(d),!0):!1))continue;if(d=this.tokenizer.escape(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.tag(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.link(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.reflink(t,this.tokens.links)){t=t.substring(d.raw.length);let g=e.at(-1);d.type==="text"&&(g==null?void 0:g.type)==="text"?(g.raw+=d.raw,g.text+=d.text):e.push(d);continue}if(d=this.tokenizer.emStrong(t,r,o)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.codespan(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.br(t)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.del(t,r,o)){t=t.substring(d.raw.length),e.push(d);continue}if(d=this.tokenizer.autolink(t)){t=t.substring(d.raw.length),e.push(d);continue}if(!this.state.inLink&&(d=this.tokenizer.url(t))){t=t.substring(d.raw.length),e.push(d);continue}let p=t;if((f=this.options.extensions)!=null&&f.startInline){let g=1/0,m=t.slice(1),y;this.options.extensions.startInline.forEach(b=>{y=b.call({lexer:this},m),typeof y=="number"&&y>=0&&(g=Math.min(g,y))}),g<1/0&&g>=0&&(p=t.substring(0,g+1))}if(d=this.tokenizer.inlineText(p)){t=t.substring(d.raw.length),d.raw.slice(-1)!=="_"&&(o=d.raw.slice(-1)),a=!0;let g=e.at(-1);(g==null?void 0:g.type)==="text"?(g.raw+=d.raw,g.text+=d.text):e.push(d);continue}if(t){let g="Infinite loop on byte: "+t.charCodeAt(0);if(this.options.silent){console.error(g);break}else throw new Error(g)}}return e}},Pr=class{constructor(s){q(this,"options");q(this,"parser");this.options=s||Be}space(s){return""}code({text:s,lang:t,escaped:e}){var n;let r=(n=(t||"").match(vt.notSpaceStart))==null?void 0:n[0],i=s.replace(vt.endingNewline,"")+`
|
|
280
|
+
`;return r?'<pre><code class="language-'+te(r)+'">'+(e?i:te(i,!0))+`</code></pre>
|
|
281
|
+
`:"<pre><code>"+(e?i:te(i,!0))+`</code></pre>
|
|
282
|
+
`}blockquote({tokens:s}){return`<blockquote>
|
|
283
|
+
${this.parser.parse(s)}</blockquote>
|
|
284
|
+
`}html({text:s}){return s}def(s){return""}heading({tokens:s,depth:t}){return`<h${t}>${this.parser.parseInline(s)}</h${t}>
|
|
285
|
+
`}hr(s){return`<hr>
|
|
286
|
+
`}list(s){let t=s.ordered,e=s.start,r="";for(let a=0;a<s.items.length;a++){let o=s.items[a];r+=this.listitem(o)}let i=t?"ol":"ul",n=t&&e!==1?' start="'+e+'"':"";return"<"+i+n+`>
|
|
287
|
+
`+r+"</"+i+`>
|
|
288
|
+
`}listitem(s){return`<li>${this.parser.parse(s.tokens)}</li>
|
|
289
|
+
`}checkbox({checked:s}){return"<input "+(s?'checked="" ':"")+'disabled="" type="checkbox"> '}paragraph({tokens:s}){return`<p>${this.parser.parseInline(s)}</p>
|
|
290
|
+
`}table(s){let t="",e="";for(let i=0;i<s.header.length;i++)e+=this.tablecell(s.header[i]);t+=this.tablerow({text:e});let r="";for(let i=0;i<s.rows.length;i++){let n=s.rows[i];e="";for(let a=0;a<n.length;a++)e+=this.tablecell(n[a]);r+=this.tablerow({text:e})}return r&&(r=`<tbody>${r}</tbody>`),`<table>
|
|
291
|
+
<thead>
|
|
292
|
+
`+t+`</thead>
|
|
293
|
+
`+r+`</table>
|
|
294
|
+
`}tablerow({text:s}){return`<tr>
|
|
295
|
+
${s}</tr>
|
|
296
|
+
`}tablecell(s){let t=this.parser.parseInline(s.tokens),e=s.header?"th":"td";return(s.align?`<${e} align="${s.align}">`:`<${e}>`)+t+`</${e}>
|
|
297
|
+
`}strong({tokens:s}){return`<strong>${this.parser.parseInline(s)}</strong>`}em({tokens:s}){return`<em>${this.parser.parseInline(s)}</em>`}codespan({text:s}){return`<code>${te(s,!0)}</code>`}br(s){return"<br>"}del({tokens:s}){return`<del>${this.parser.parseInline(s)}</del>`}link({href:s,title:t,tokens:e}){let r=this.parser.parseInline(e),i=Co(s);if(i===null)return r;s=i;let n='<a href="'+s+'"';return t&&(n+=' title="'+te(t)+'"'),n+=">"+r+"</a>",n}image({href:s,title:t,text:e,tokens:r}){r&&(e=this.parser.parseInline(r,this.parser.textRenderer));let i=Co(s);if(i===null)return te(e);s=i;let n=`<img src="${s}" alt="${te(e)}"`;return t&&(n+=` title="${te(t)}"`),n+=">",n}text(s){return"tokens"in s&&s.tokens?this.parser.parseInline(s.tokens):"escaped"in s&&s.escaped?s.text:te(s.text)}},Pn=class{strong({text:s}){return s}em({text:s}){return s}codespan({text:s}){return s}del({text:s}){return s}html({text:s}){return s}text({text:s}){return s}link({text:s}){return""+s}image({text:s}){return""+s}br(){return""}checkbox({raw:s}){return s}},Vt=class en{constructor(t){q(this,"options");q(this,"renderer");q(this,"textRenderer");this.options=t||Be,this.options.renderer=this.options.renderer||new Pr,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new Pn}static parse(t,e){return new en(e).parse(t)}static parseInline(t,e){return new en(e).parseInline(t)}parse(t){var r,i;this.renderer.parser=this;let e="";for(let n=0;n<t.length;n++){let a=t[n];if((i=(r=this.options.extensions)==null?void 0:r.renderers)!=null&&i[a.type]){let l=a,h=this.options.extensions.renderers[l.type].call({parser:this},l);if(h!==!1||!["space","hr","heading","code","table","blockquote","list","html","def","paragraph","text"].includes(l.type)){e+=h||"";continue}}let o=a;switch(o.type){case"space":{e+=this.renderer.space(o);break}case"hr":{e+=this.renderer.hr(o);break}case"heading":{e+=this.renderer.heading(o);break}case"code":{e+=this.renderer.code(o);break}case"table":{e+=this.renderer.table(o);break}case"blockquote":{e+=this.renderer.blockquote(o);break}case"list":{e+=this.renderer.list(o);break}case"checkbox":{e+=this.renderer.checkbox(o);break}case"html":{e+=this.renderer.html(o);break}case"def":{e+=this.renderer.def(o);break}case"paragraph":{e+=this.renderer.paragraph(o);break}case"text":{e+=this.renderer.text(o);break}default:{let l='Token with "'+o.type+'" type was not found.';if(this.options.silent)return console.error(l),"";throw new Error(l)}}}return e}parseInline(t,e=this.renderer){var i,n;this.renderer.parser=this;let r="";for(let a=0;a<t.length;a++){let o=t[a];if((n=(i=this.options.extensions)==null?void 0:i.renderers)!=null&&n[o.type]){let h=this.options.extensions.renderers[o.type].call({parser:this},o);if(h!==!1||!["escape","html","link","image","strong","em","codespan","br","del","text"].includes(o.type)){r+=h||"";continue}}let l=o;switch(l.type){case"escape":{r+=e.text(l);break}case"html":{r+=e.html(l);break}case"link":{r+=e.link(l);break}case"image":{r+=e.image(l);break}case"checkbox":{r+=e.checkbox(l);break}case"strong":{r+=e.strong(l);break}case"em":{r+=e.em(l);break}case"codespan":{r+=e.codespan(l);break}case"br":{r+=e.br(l);break}case"del":{r+=e.del(l);break}case"text":{r+=e.text(l);break}default:{let h='Token with "'+l.type+'" type was not found.';if(this.options.silent)return console.error(h),"";throw new Error(h)}}}return r}},fr,Cs=(fr=class{constructor(s){q(this,"options");q(this,"block");this.options=s||Be}preprocess(s){return s}postprocess(s){return s}processAllTokens(s){return s}emStrongMask(s){return s}provideLexer(s=this.block){return s?jt.lex:jt.lexInline}provideParser(s=this.block){return s?Vt.parse:Vt.parseInline}},q(fr,"passThroughHooks",new Set(["preprocess","postprocess","processAllTokens","emStrongMask"])),q(fr,"passThroughHooksRespectAsync",new Set(["preprocess","postprocess","processAllTokens"])),fr),Zp=class{constructor(...s){q(this,"defaults",wn());q(this,"options",this.setOptions);q(this,"parse",this.parseMarkdown(!0));q(this,"parseInline",this.parseMarkdown(!1));q(this,"Parser",Vt);q(this,"Renderer",Pr);q(this,"TextRenderer",Pn);q(this,"Lexer",jt);q(this,"Tokenizer",Mr);q(this,"Hooks",Cs);this.use(...s)}walkTokens(s,t){var r,i;let e=[];for(let n of s)switch(e=e.concat(t.call(this,n)),n.type){case"table":{let a=n;for(let o of a.header)e=e.concat(this.walkTokens(o.tokens,t));for(let o of a.rows)for(let l of o)e=e.concat(this.walkTokens(l.tokens,t));break}case"list":{let a=n;e=e.concat(this.walkTokens(a.items,t));break}default:{let a=n;(i=(r=this.defaults.extensions)==null?void 0:r.childTokens)!=null&&i[a.type]?this.defaults.extensions.childTokens[a.type].forEach(o=>{let l=a[o].flat(1/0);e=e.concat(this.walkTokens(l,t))}):a.tokens&&(e=e.concat(this.walkTokens(a.tokens,t)))}}return e}use(...s){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return s.forEach(e=>{let r={...e};if(r.async=this.defaults.async||r.async||!1,e.extensions&&(e.extensions.forEach(i=>{if(!i.name)throw new Error("extension name required");if("renderer"in i){let n=t.renderers[i.name];n?t.renderers[i.name]=function(...a){let o=i.renderer.apply(this,a);return o===!1&&(o=n.apply(this,a)),o}:t.renderers[i.name]=i.renderer}if("tokenizer"in i){if(!i.level||i.level!=="block"&&i.level!=="inline")throw new Error("extension level must be 'block' or 'inline'");let n=t[i.level];n?n.unshift(i.tokenizer):t[i.level]=[i.tokenizer],i.start&&(i.level==="block"?t.startBlock?t.startBlock.push(i.start):t.startBlock=[i.start]:i.level==="inline"&&(t.startInline?t.startInline.push(i.start):t.startInline=[i.start]))}"childTokens"in i&&i.childTokens&&(t.childTokens[i.name]=i.childTokens)}),r.extensions=t),e.renderer){let i=this.defaults.renderer||new Pr(this.defaults);for(let n in e.renderer){if(!(n in i))throw new Error(`renderer '${n}' does not exist`);if(["options","parser"].includes(n))continue;let a=n,o=e.renderer[a],l=i[a];i[a]=(...h)=>{let c=o.apply(i,h);return c===!1&&(c=l.apply(i,h)),c||""}}r.renderer=i}if(e.tokenizer){let i=this.defaults.tokenizer||new Mr(this.defaults);for(let n in e.tokenizer){if(!(n in i))throw new Error(`tokenizer '${n}' does not exist`);if(["options","rules","lexer"].includes(n))continue;let a=n,o=e.tokenizer[a],l=i[a];i[a]=(...h)=>{let c=o.apply(i,h);return c===!1&&(c=l.apply(i,h)),c}}r.tokenizer=i}if(e.hooks){let i=this.defaults.hooks||new Cs;for(let n in e.hooks){if(!(n in i))throw new Error(`hook '${n}' does not exist`);if(["options","block"].includes(n))continue;let a=n,o=e.hooks[a],l=i[a];Cs.passThroughHooks.has(n)?i[a]=h=>{if(this.defaults.async&&Cs.passThroughHooksRespectAsync.has(n))return(async()=>{let u=await o.call(i,h);return l.call(i,u)})();let c=o.call(i,h);return l.call(i,c)}:i[a]=(...h)=>{if(this.defaults.async)return(async()=>{let u=await o.apply(i,h);return u===!1&&(u=await l.apply(i,h)),u})();let c=o.apply(i,h);return c===!1&&(c=l.apply(i,h)),c}}r.hooks=i}if(e.walkTokens){let i=this.defaults.walkTokens,n=e.walkTokens;r.walkTokens=function(a){let o=[];return o.push(n.call(this,a)),i&&(o=o.concat(i.call(this,a))),o}}this.defaults={...this.defaults,...r}}),this}setOptions(s){return this.defaults={...this.defaults,...s},this}lexer(s,t){return jt.lex(s,t??this.defaults)}parser(s,t){return Vt.parse(s,t??this.defaults)}parseMarkdown(s){return(t,e)=>{let r={...e},i={...this.defaults,...r},n=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return n(new Error("marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise."));if(typeof t>"u"||t===null)return n(new Error("marked(): input parameter is undefined or null"));if(typeof t!="string")return n(new Error("marked(): input parameter is of type "+Object.prototype.toString.call(t)+", string expected"));if(i.hooks&&(i.hooks.options=i,i.hooks.block=s),i.async)return(async()=>{let a=i.hooks?await i.hooks.preprocess(t):t,o=await(i.hooks?await i.hooks.provideLexer(s):s?jt.lex:jt.lexInline)(a,i),l=i.hooks?await i.hooks.processAllTokens(o):o;i.walkTokens&&await Promise.all(this.walkTokens(l,i.walkTokens));let h=await(i.hooks?await i.hooks.provideParser(s):s?Vt.parse:Vt.parseInline)(l,i);return i.hooks?await i.hooks.postprocess(h):h})().catch(n);try{i.hooks&&(t=i.hooks.preprocess(t));let a=(i.hooks?i.hooks.provideLexer(s):s?jt.lex:jt.lexInline)(t,i);i.hooks&&(a=i.hooks.processAllTokens(a)),i.walkTokens&&this.walkTokens(a,i.walkTokens);let o=(i.hooks?i.hooks.provideParser(s):s?Vt.parse:Vt.parseInline)(a,i);return i.hooks&&(o=i.hooks.postprocess(o)),o}catch(a){return n(a)}}}onError(s,t){return e=>{if(e.message+=`
|
|
298
|
+
Please report this to https://github.com/markedjs/marked.`,s){let r="<p>An error occurred:</p><pre>"+te(e.message+"",!0)+"</pre>";return t?Promise.resolve(r):r}if(t)return Promise.reject(e);throw e}}},Ne=new Zp;function X(s,t){return Ne.parse(s,t)}X.options=X.setOptions=function(s){return Ne.setOptions(s),X.defaults=Ne.defaults,Ql(X.defaults),X};X.getDefaults=wn;X.defaults=Be;X.use=function(...s){return Ne.use(...s),X.defaults=Ne.defaults,Ql(X.defaults),X};X.walkTokens=function(s,t){return Ne.walkTokens(s,t)};X.parseInline=Ne.parseInline;X.Parser=Vt;X.parser=Vt.parse;X.Renderer=Pr;X.TextRenderer=Pn;X.Lexer=jt;X.lexer=jt.lex;X.Tokenizer=Mr;X.Hooks=Cs;X.parse=X;X.options;X.setOptions;X.use;X.walkTokens;X.parseInline;Vt.parse;jt.lex;X.setOptions({gfm:!0,breaks:!0,async:!1});const Qp="agent-play-preview-chat-display-v1",oh={fontSizePx:8,panelWidthPx:200,scrollMaxHeightPx:148};function Ai(s,t,e){return Math.min(e,Math.max(t,s))}function Kp(s){if(s===null||s.length===0)return null;try{const t=JSON.parse(s);if(t===null||typeof t!="object")return null;const e=t,r={};return typeof e.fontSizePx=="number"&&Number.isFinite(e.fontSizePx)&&(r.fontSizePx=e.fontSizePx),typeof e.panelWidthPx=="number"&&Number.isFinite(e.panelWidthPx)&&(r.panelWidthPx=e.panelWidthPx),typeof e.scrollMaxHeightPx=="number"&&Number.isFinite(e.scrollMaxHeightPx)&&(r.scrollMaxHeightPx=e.scrollMaxHeightPx),Object.keys(r).length>0?r:null}catch{return null}}let Eo={...oh};function Jp(s){return{fontSizePx:Ai(Math.round(s.fontSizePx),5,18),panelWidthPx:Ai(Math.round(s.panelWidthPx),100,400),scrollMaxHeightPx:Ai(Math.round(s.scrollMaxHeightPx),24,200)}}function tm(){const s=Kp(typeof localStorage<"u"?localStorage.getItem(Qp):null),t={...oh,...s};return Eo=Jp(t),{...Eo}}typeof localStorage<"u"&&tm();function em(){return["park","new_york","tokyo"]}const sm="agent-play-preview-view-settings-v2";function rm(){if(typeof window>"u")return!1;const s=window.location.hostname;return s==="localhost"||s==="127.0.0.1"||s==="::1"||s==="[::1]"}function lh(s){return s==="default"||s==="ember"||s==="forest"}function hh(s){return s==="unspecified"||s==="feminine"||s==="masculine"||s==="neutral"}function Is(){return{themeId:"park",showChatUi:!0,debugMode:rm(),joystickEnabled:!0,profileAvatarPresetId:"default",profileGender:"unspecified"}}function ch(s){return em().includes(s)}function im(s){if(s===null||s.length===0)return null;try{const t=JSON.parse(s);if(t===null||typeof t!="object")return null;const e=t,r={};return typeof e.themeId=="string"&&ch(e.themeId)&&(r.themeId=e.themeId),typeof e.showChatUi=="boolean"&&(r.showChatUi=e.showChatUi),typeof e.debugMode=="boolean"&&(r.debugMode=e.debugMode),typeof e.joystickEnabled=="boolean"&&(r.joystickEnabled=e.joystickEnabled),typeof e.profileAvatarPresetId=="string"&&lh(e.profileAvatarPresetId)&&(r.profileAvatarPresetId=e.profileAvatarPresetId),typeof e.profileGender=="string"&&hh(e.profileGender)&&(r.profileGender=e.profileGender),Object.keys(r).length>0?r:null}catch{return null}}let Ro=Is();function nm(s){const t=ch(s.themeId)?s.themeId:Is().themeId,e=lh(s.profileAvatarPresetId)?s.profileAvatarPresetId:Is().profileAvatarPresetId,r=hh(s.profileGender)?s.profileGender:Is().profileGender;return{themeId:t,showChatUi:s.showChatUi,debugMode:s.debugMode,joystickEnabled:s.joystickEnabled,profileAvatarPresetId:e,profileGender:r}}function am(){const s=im(typeof localStorage<"u"?localStorage.getItem(sm):null),t={...Is(),...s};return Ro=nm(t),{...Ro}}typeof localStorage<"u"&&am();const Ti={};var oe={};const om=typeof process<"u"&&typeof(oe==null?void 0:oe.NEXT_PUBLIC_AGENT_PLAY_BASE)=="string"?oe.NEXT_PUBLIC_AGENT_PLAY_BASE.replace(/\/$/,""):typeof import.meta<"u"&&"/agent-play/".replace(/\/$/,"")||"";typeof process<"u"&&typeof(oe==null?void 0:oe.NEXT_PUBLIC_PLAY_API_BASE)=="string"&&oe.NEXT_PUBLIC_PLAY_API_BASE.length>0?oe.NEXT_PUBLIC_PLAY_API_BASE.replace(/\/$/,""):typeof import.meta<"u"&&typeof(Ti==null?void 0:Ti.VITE_PLAY_API_BASE)=="string"&&(void 0).length>0&&(void 0).replace(/\/$/,"");pf({});new ve;new br;new ve;new ve;export{mr as B,ve as C,tt as E,Rr as G,H as M,yt as P,Oi as R,ln as S,ir as T,Ii as U,ke as a,kl as b,gl as c,bl as d,Ot as e,Qo as f,J as g,Eu as h,Yt as i,Zh as r,Lt as w};
|